Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Mark Brown
af9c8092 ed5d499b

+3 -2
+3 -2
drivers/base/regmap/regmap-i3c.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Copyright (c) 2018 Synopsys, Inc. and/or its affiliates. 3 3 4 + #include <linux/array_size.h> 4 5 #include <linux/regmap.h> 5 6 #include <linux/i3c/device.h> 6 7 #include <linux/i3c/master.h> ··· 19 18 }, 20 19 }; 21 20 22 - return i3c_device_do_priv_xfers(i3c, xfers, 1); 21 + return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers)); 23 22 } 24 23 25 24 static int regmap_i3c_read(void *context, ··· 38 37 xfers[1].len = val_size; 39 38 xfers[1].data.in = val; 40 39 41 - return i3c_device_do_priv_xfers(i3c, xfers, 2); 40 + return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers)); 42 41 } 43 42 44 43 static const struct regmap_bus regmap_i3c = {