Skip to contentSkip to conversation

Add small improvements to iio/magnetometer hmc5843 driver

PATCH New Cristina Opriceana 1 participant 3 messages Mar 22, 2015

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

v3 cover Add small improvements to iio/magnetometer hmc5843 driver

This patchset reviews the iio/magnetometer hmc5843 driver and fixes incorrect file header and reconfigures some small error checks.

Changes in v3:
- avoid duplicated code in PATCH 1/2 for the 2 goto labels

Cristina Opriceana (2):
Staging: iio: Place driver in sleep mode on error
Staging: iio: Fix file header to match standards

 drivers/staging/iio/magnetometer/hmc5843_core.c | 48 +++++++++++++------------
 1 file changed, 25 insertions(+), 23 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/2 Staging: iio: Place driver in sleep mode on error

Put device in sleep mode if an error is encountered after initialization in order to avoid wasting power.

---
 drivers/staging/iio/magnetometer/hmc5843_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/iio/magnetometer/hmc5843_core.c +3 -1
index 0074af2..6f6e96d 100644
@@ -611,7 +611,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
 	ret = iio_triggered_buffer_setup(indio_dev, NULL,
 					 hmc5843_trigger_handler, NULL);
 	if (ret < 0)
-		return ret;
+		goto buffer_setup_err;
 
 	ret = iio_device_register(indio_dev);
 	if (ret < 0)
@@ -621,6 +621,8 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
 
 buffer_cleanup:
 	iio_triggered_buffer_cleanup(indio_dev);
+buffer_setup_err:
+	hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
 	return ret;
 }
 EXPORT_SYMBOL(hmc5843_common_probe);
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 2/2 Staging: iio: Fix file header to match standards

In reply to Cristina Opriceana

Fix file header to match Linux Kernel style. Remove Free Software Foundation reference to silence the checkpatch.pl warning. Add driver description and correct spelling mistakes.

---
 drivers/staging/iio/magnetometer/hmc5843_core.c | 44 ++++++++++++-------------
 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/staging/iio/magnetometer/hmc5843_core.c +22 -22
index 6f6e96d..fffca3a 100644
@@ -1,25 +1,25 @@
-/*  Copyright (C) 2010 Texas Instruments
-    Author: Shubhrajyoti Datta <[email protected]>
-    Acknowledgement: Jonathan Cameron <[email protected]> for valuable inputs.
-
-    Support for HMC5883 and HMC5883L by Peter Meerwald <[email protected]>.
-
-    Split to multiple files by Josef Gajdusek <[email protected]> - 2014
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+/*
+ * Device driver for the the HMC5843 multi-chip module designed
+ * for low field magnetic sensing.
+ *
+ * Copyright (C) 2010 Texas Instruments
+ *
+ * Author: Shubhrajyoti Datta <[email protected]>
+ * Acknowledgment: Jonathan Cameron <[email protected]> for valuable inputs.
+ * Support for HMC5883 and HMC5883L by Peter Meerwald <[email protected]>.
+ * Split to multiple files by Josef Gajdusek <[email protected]> - 2014
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
 
 #include <linux/module.h>
 #include <linux/regmap.h>
Signature · 1 line
1.9.1