[PATCH v5 2/2] iio: magnetometer: bmc150_magn: minor formatting cleanup

Neel Bullywon posted 2 patches 1 day, 13 hours ago
[PATCH v5 2/2] iio: magnetometer: bmc150_magn: minor formatting cleanup
Posted by Neel Bullywon 1 day, 13 hours ago
Add spaces inside braces for initializer lists in the sampling
frequency and preset tables for consistency.

Fix indentation of bmc150_magn_scan_masks array and add trailing
comma. No functional changes.

Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
 drivers/iio/magnetometer/bmc150_magn.c | 29 +++++++++++++-------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
index 117bf70d6899..8e249e25b799 100644
--- a/drivers/iio/magnetometer/bmc150_magn.c
+++ b/drivers/iio/magnetometer/bmc150_magn.c
@@ -149,14 +149,14 @@ struct bmc150_magn_data {
 static const struct {
 	int freq;
 	u8 reg_val;
-} bmc150_magn_samp_freq_table[] = { {2, 0x01},
-				    {6, 0x02},
-				    {8, 0x03},
-				    {10, 0x00},
-				    {15, 0x04},
-				    {20, 0x05},
-				    {25, 0x06},
-				    {30, 0x07} };
+} bmc150_magn_samp_freq_table[] = { { 2, 0x01 },
+				    { 6, 0x02 },
+				    { 8, 0x03 },
+				    { 10, 0x00 },
+				    { 15, 0x04 },
+				    { 20, 0x05 },
+				    { 25, 0x06 },
+				    { 30, 0x07 } };
 
 enum bmc150_magn_presets {
 	LOW_POWER_PRESET,
@@ -170,10 +170,10 @@ static const struct bmc150_magn_preset {
 	u8 rep_z;
 	u8 odr;
 } bmc150_magn_presets_table[] = {
-	[LOW_POWER_PRESET] = {3, 3, 10},
-	[REGULAR_PRESET] =  {9, 15, 10},
-	[ENHANCED_REGULAR_PRESET] =  {15, 27, 10},
-	[HIGH_ACCURACY_PRESET] =  {47, 83, 20},
+	[LOW_POWER_PRESET] = { 3, 3, 10 },
+	[REGULAR_PRESET] = { 9, 15, 10 },
+	[ENHANCED_REGULAR_PRESET] = { 15, 27, 10 },
+	[HIGH_ACCURACY_PRESET] = { 47, 83, 20 },
 };
 
 #define BMC150_MAGN_DEFAULT_PRESET REGULAR_PRESET
@@ -643,8 +643,9 @@ static const struct iio_info bmc150_magn_info = {
 };
 
 static const unsigned long bmc150_magn_scan_masks[] = {
-					BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z),
-					0};
+	BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z),
+	0,
+};
 
 static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)
 {
-- 
2.44.0
Re: [PATCH v5 2/2] iio: magnetometer: bmc150_magn: minor formatting cleanup
Posted by Andy Shevchenko 1 day ago
On Sat, Feb 07, 2026 at 08:16:59PM -0500, Neel Bullywon wrote:
> Add spaces inside braces for initializer lists in the sampling
> frequency and preset tables for consistency.
> 
> Fix indentation of bmc150_magn_scan_masks array and add trailing
> comma. No functional changes.

...

> +} bmc150_magn_samp_freq_table[] = { { 2, 0x01 },
> +				    { 6, 0x02 },
> +				    { 8, 0x03 },
> +				    { 10, 0x00 },
> +				    { 15, 0x04 },
> +				    { 20, 0x05 },
> +				    { 25, 0x06 },
> +				    { 30, 0x07 } };

While at it, fix the style, the above is weird one.

} bmc150_magn_samp_freq_table[] = {
	{ 2, 0x01 },
	{ 6, 0x02 },
	{ 8, 0x03 },
	{ 10, 0x00 },
	{ 15, 0x04 },
	{ 20, 0x05 },
	{ 25, 0x06 },
	{ 30, 0x07 },
// also mind a comma
};

OR alternatively

} bmc150_magn_samp_freq_table[] = {
	{ 2, 0x01 }, { 6, 0x02 }, { 8, 0x03 }, { 10, 0x00 },		/* 0 - 3 */
	{ 15, 0x04 }, { 20, 0x05 }, { 25, 0x06 }, { 30, 0x07 },		/* 4 - 7 */
};

...

>  static const unsigned long bmc150_magn_scan_masks[] = {
> +	BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z),
> +	0,

No comma for the terminator, please.

> +};

-- 
With Best Regards,
Andy Shevchenko