Skip to contentSkip to conversation

Fix iio/magnetometer style warnings

PATCH In review Cristina Opriceana 2 participants 7 messages Mar 19, 2015 – Mar 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix iio/magnetometer style warnings

This patchset fixes some iio/magnetometer style warnings in order to keep the code clean.

Cristina Opriceana (5):
Staging: iio: Simplify NULL pointer condition
Staging: iio: Align function parameters to match first row
Staging: iio: Remove multiple blank lines
Staging: iio: Remove line over 80 characters
Staging: iio: Add kernel-doc for struct hmc5843

 drivers/staging/iio/magnetometer/hmc5843.h      | 13 ++++--
 drivers/staging/iio/magnetometer/hmc5843_core.c | 59 ++++++++++++++-----------
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  8 ++--
 3 files changed, 46 insertions(+), 34 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 Staging: iio: Simplify NULL pointer condition

Replace NULL comparrison with its shorter form.
Done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

---
 drivers/staging/iio/magnetometer/hmc5843_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/magnetometer/hmc5843_core.c +1 -1
index d03833b..20c693e 100644
@@ -579,7 +579,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
 	int ret;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
-	if (indio_dev == NULL)
+	if (!indio_dev)
 		return -ENOMEM;
 
 	dev_set_drvdata(dev, indio_dev);
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/5 Staging: iio: Align function parameters to match first row

In reply to Cristina Opriceana

This patch improves coding style by aligning parameters in iio/magnetometer function calls, to remove the following warning:
"CHECK: Alignment should match open parenthesis".

---
 drivers/staging/iio/magnetometer/hmc5843.h      |  2 +-
 drivers/staging/iio/magnetometer/hmc5843_core.c | 56 ++++++++++++++-----------
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  2 +-
 3 files changed, 33 insertions(+), 27 deletions(-)
drivers/staging/iio/magnetometer/hmc5843.h +1 -1
index b784e3e..879d43b 100644
@@ -41,7 +41,7 @@ struct hmc5843_data {
 };
 
 int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
-		enum hmc5843_ids id);
+			 enum hmc5843_ids id);
 int hmc5843_common_remove(struct device *dev);
 
 int hmc5843_common_suspend(struct device *dev);
drivers/staging/iio/magnetometer/hmc5843_core.c +31 -25

160 lines not on this page · raw message

drivers/staging/iio/magnetometer/hmc5843_i2c.c +1 -1
index 6acd614..8d090b4 100644
@@ -57,7 +57,7 @@ static struct regmap_config hmc5843_i2c_regmap_config = {
 };
 
 static int hmc5843_i2c_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+			     const struct i2c_device_id *id)
 {
 	return hmc5843_common_probe(&client->dev,
 			devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config),
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/5 Staging: iio: Remove multiple blank lines

In reply to Cristina Opriceana

This patch removes blank uneeded lines in order to remove the folowing checkpatch.pl warning:
"Please don't use multiple blank lines".

---
 drivers/staging/iio/magnetometer/hmc5843.h      | 1 -
 drivers/staging/iio/magnetometer/hmc5843_core.c | 1 -
 2 files changed, 2 deletions(-)
drivers/staging/iio/magnetometer/hmc5843.h +0 -1
index 879d43b..332a75c 100644
@@ -10,7 +10,6 @@
  *
  * */
 
-
 #ifndef HMC5843_CORE_H
 #define HMC5843_CORE_H
 
drivers/staging/iio/magnetometer/hmc5843_core.c +0 -1
index 9c4ac0a..cdbf369 100644
@@ -562,7 +562,6 @@ static const struct iio_info hmc5843_info = {
 
 static const unsigned long hmc5843_scan_masks[] = {0x7, 0};
 
-
 int hmc5843_common_suspend(struct device *dev)
 {
 	return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)),
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/5 Staging: iio: Remove line over 80 characters

In reply to Cristina Opriceana

Rename variable in order to fix the 80 characters per line warning. Found by checkpatch.pl

---
 drivers/staging/iio/magnetometer/hmc5843_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/iio/magnetometer/hmc5843_i2c.c +3 -3
index 8d090b4..6b4c742 100644
@@ -56,11 +56,11 @@ static struct regmap_config hmc5843_i2c_regmap_config = {
 		.cache_type = REGCACHE_RBTREE,
 };
 
-static int hmc5843_i2c_probe(struct i2c_client *client,
+static int hmc5843_i2c_probe(struct i2c_client *cli,
 			     const struct i2c_device_id *id)
 {
-	return hmc5843_common_probe(&client->dev,
-			devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config),
+	return hmc5843_common_probe(&cli->dev,
+			devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config),
 			id->driver_data);
 }
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/5 Staging: iio: Add kernel-doc for struct hmc5843

In reply to Cristina Opriceana

This patch documents the struct hmc5843 specific data following this warning:
"CHECK: struct mutex definition without comment".

---
 drivers/staging/iio/magnetometer/hmc5843.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/iio/magnetometer/hmc5843.h +9 -1
index 332a75c..ab729d3 100644
@@ -31,12 +31,20 @@ enum hmc5843_ids {
 	HMC5983_ID,
 };
 
+/**
+ * struct hcm5843_data	- device specific data
+ * @dev		actual device
+ * @lock		update and read regmap data
+ * @regmap		hardware access register maps
+ * @variant		describe chip variants
+ * @buffer		3x 16-bit channels + padding + 64-bit timestamp
+ **/
 struct hmc5843_data {
 	struct device *dev;
 	struct mutex lock;
 	struct regmap *regmap;
 	const struct hmc5843_chip_info *variant;
-	__be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */
+	__be16 buffer[8];
 };
 
 int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
Signature · 1 line
1.9.1
maintainer
#6 lore raw

Re: [Outreachy kernel] [PATCH 5/5] Staging: iio: Add kernel-doc for struct hmc5843

Quoted 14 lines · Cristina Opriceana

This patch documents the struct hmc5843 specific data following this warning:
"CHECK: struct mutex definition without comment".

---
 drivers/staging/iio/magnetometer/hmc5843.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/iio/magnetometer/hmc5843.h +0 -0
index 332a75c..ab729d3 100644

drivers/staging/iio/magnetometer/hmc5843.h enum hmc5843_ids { · line 36

Quoted 6 lines
drivers/staging/iio/magnetometer/hmc5843.h +3 -0
@@ -31,12 +31,20 @@ enum hmc5843_ids {
 	HMC5983_ID,
 };
 
+/**
+ * struct hcm5843_data	- device specific data
+ * @dev		actual device

Don't you need a ":" after "@dev"? That's the proper kerneldoc format, this will not properly parse.

thanks,

greg k-h