Skip to contentSkip to conversation

iio:kxsd9 basic driver move out of staging

PATCH In review Jonathan Cameron 1 participant 4 messages Jan 6, 2013 – Jan 20, 2013

Subsystems (3)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover iio:kxsd9 basic driver move out of staging

This is a simple driver I wrote as a proof of concept a long time ago. Whilst it only supports the basics, it might as well move out of staging as there is nothing particularly interesting or controversial in it!

The first patch does a bit of trivial cleanup and avoids a theoretical race condition.

Jonathan Cameron (2):
staging:iio:accel:kxsd9
iio:accel:kxsd9 move out of staging

 drivers/iio/accel/Kconfig               |  7 +++++++
 drivers/iio/accel/Makefile              |  1 +
 drivers/{staging => }/iio/accel/kxsd9.c | 10 +++++-----
 drivers/staging/iio/accel/Kconfig       |  7 -------
 drivers/staging/iio/accel/Makefile      |  2 --
 5 files changed, 13 insertions(+), 14 deletions(-)
 rename drivers/{staging => }/iio/accel/kxsd9.c (99%)
Signature · 1 line
1.8.1
author maintainer
#1 lore raw

PATCH 1/2 staging:iio:accel:kxsd9

Remove an unneeded initialization and trivial reorder to ensure the device is ready when the device is registered.

---
 drivers/staging/iio/accel/kxsd9.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/iio/accel/kxsd9.c +5 -5
index 318331f..4a24c2e 100644
@@ -226,7 +226,7 @@ static int kxsd9_probe(struct spi_device *spi)
 {
 	struct iio_dev *indio_dev;
 	struct kxsd9_state *st;
-	int ret = 0;
+	int ret;
 
 	indio_dev = iio_device_alloc(sizeof(*st));
 	if (indio_dev == NULL) {
@@ -245,14 +245,14 @@ static int kxsd9_probe(struct spi_device *spi)
 	indio_dev->info = &kxsd9_info;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	ret = iio_device_register(indio_dev);
-	if (ret)
-		goto error_free_dev;
-
 	spi->mode = SPI_MODE_0;
 	spi_setup(spi);
 	kxsd9_power_up(st);
 
+	ret = iio_device_register(indio_dev);
+	if (ret)
+		goto error_free_dev;
+
 	return 0;
 
 error_free_dev:
Signature · 1 line
1.8.1
author maintainer
#2 lore raw

PATCH 2/2 iio:accel:kxsd9 move out of staging

In reply to Jonathan Cameron

This is a very simple driver giving basic access to this part over an spi bus.

---
 drivers/iio/accel/Kconfig               | 7 +++++++
 drivers/iio/accel/Makefile              | 1 +
 drivers/{staging => }/iio/accel/kxsd9.c | 0
 drivers/staging/iio/accel/Kconfig       | 7 -------
 drivers/staging/iio/accel/Makefile      | 2 --
 5 files changed, 8 insertions(+), 9 deletions(-)
drivers/iio/accel/Kconfig +7 -0
index fe4bcd7..a588764 100644
@@ -13,4 +13,11 @@ config HID_SENSOR_ACCEL_3D
 	  Say yes here to build support for the HID SENSOR
 	  accelerometers 3D.
 
+config KXSD9
+	tristate "Kionix KXSD9 Accelerometer Driver"
+	depends on SPI
+	help
+	  Say yes here to build support for the Kionix KXSD9 accelerometer.
+	  Currently this only supports the device via an SPI interface.
+
 endmenu
drivers/iio/accel/Makefile +1 -0
index 5bc6855..4e1c859 100644
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o
+obj-$(CONFIG_KXSD9)	+= kxsd9.o
drivers/iio/accel/kxsd9.c renamed from drivers/staging/iio/accel/kxsd9.c +0 -0
similarity index 100%
rename from drivers/staging/iio/accel/kxsd9.c
rename to drivers/iio/accel/kxsd9.c
drivers/staging/iio/accel/Kconfig +0 -7
index 2b54430..d10c7ad 100644
@@ -56,13 +56,6 @@ config ADIS16240
 	  Say yes here to build support for Analog Devices adis16240 programmable
 	  impact Sensor and recorder.
 
-config KXSD9
-	tristate "Kionix KXSD9 Accelerometer Driver"
-	depends on SPI
-	help
-	  Say yes here to build support for the Kionix KXSD9 accelerometer.
-	  Currently this only supports the device via an SPI interface.
-
 config LIS3L02DQ
 	tristate "ST Microelectronics LIS3L02DQ Accelerometer Driver"
 	depends on SPI
drivers/staging/iio/accel/Makefile +0 -2
index 8e7ee03..1ed137f 100644
@@ -20,8 +20,6 @@ obj-$(CONFIG_ADIS16220) += adis16220.o
 adis16240-y             := adis16240_core.o
 obj-$(CONFIG_ADIS16240) += adis16240.o
 
-obj-$(CONFIG_KXSD9)	+= kxsd9.o
-
 lis3l02dq-y		:= lis3l02dq_core.o
 lis3l02dq-$(CONFIG_IIO_BUFFER) += lis3l02dq_ring.o
 obj-$(CONFIG_LIS3L02DQ)	+= lis3l02dq.o
Signature · 1 line
1.8.1
author maintainer
#3 lore raw
In reply to Jonathan Cameron
Quoted 8 lines · Jonathan Cameron

This is a simple driver I wrote as a proof of concept a long time ago. Whilst it only supports the basics, it might as well move out of staging as there is nothing particularly interesting or controversial in it!

The first patch does a bit of trivial cleanup and avoids a theoretical race condition.

These have sat on the list on enough. I guess everyone who cares is happy ;)

Added to togreg branch of iio.git

Quoted 12 lines

Jonathan Cameron (2):
staging:iio:accel:kxsd9
iio:accel:kxsd9 move out of staging

 drivers/iio/accel/Kconfig               |  7 +++++++
 drivers/iio/accel/Makefile              |  1 +
 drivers/{staging => }/iio/accel/kxsd9.c | 10 +++++-----
 drivers/staging/iio/accel/Kconfig       |  7 -------
 drivers/staging/iio/accel/Makefile      |  2 --
 5 files changed, 13 insertions(+), 14 deletions(-)
 rename drivers/{staging => }/iio/accel/kxsd9.c (99%)