regmap: i3c: Use ARRAY_SIZE()

Use ARRAY_SIZE() instead of hard coded numbers to show the intention
and make code robust against potential changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20251103180946.604127-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2025-11-03 19:09:46 +01:00 committed by Mark Brown
parent ed5d499b5c
commit af9c8092d8
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018 Synopsys, Inc. and/or its affiliates. // Copyright (c) 2018 Synopsys, Inc. and/or its affiliates.
#include <linux/array_size.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/i3c/device.h> #include <linux/i3c/device.h>
#include <linux/i3c/master.h> #include <linux/i3c/master.h>
@ -18,7 +19,7 @@ static int regmap_i3c_write(void *context, const void *data, size_t count)
}, },
}; };
return i3c_device_do_priv_xfers(i3c, xfers, 1); return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers));
} }
static int regmap_i3c_read(void *context, static int regmap_i3c_read(void *context,
@ -37,7 +38,7 @@ static int regmap_i3c_read(void *context,
xfers[1].len = val_size; xfers[1].len = val_size;
xfers[1].data.in = val; xfers[1].data.in = val;
return i3c_device_do_priv_xfers(i3c, xfers, 2); return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers));
} }
static const struct regmap_bus regmap_i3c = { static const struct regmap_bus regmap_i3c = {