Skip to content

Commit af9c809

Browse files
andy-shevbroonie
authored andcommitted
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>
1 parent ed5d499 commit af9c809

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/base/regmap/regmap-i3c.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
// Copyright (c) 2018 Synopsys, Inc. and/or its affiliates.
33

4+
#include <linux/array_size.h>
45
#include <linux/regmap.h>
56
#include <linux/i3c/device.h>
67
#include <linux/i3c/master.h>
@@ -18,7 +19,7 @@ static int regmap_i3c_write(void *context, const void *data, size_t count)
1819
},
1920
};
2021

21-
return i3c_device_do_priv_xfers(i3c, xfers, 1);
22+
return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers));
2223
}
2324

2425
static int regmap_i3c_read(void *context,
@@ -37,7 +38,7 @@ static int regmap_i3c_read(void *context,
3738
xfers[1].len = val_size;
3839
xfers[1].data.in = val;
3940

40-
return i3c_device_do_priv_xfers(i3c, xfers, 2);
41+
return i3c_device_do_priv_xfers(i3c, xfers, ARRAY_SIZE(xfers));
4142
}
4243

4344
static const struct regmap_bus regmap_i3c = {

0 commit comments

Comments
 (0)