Skip to contentSkip to conversation

iio: pressure: mpl115: don't set unused i2c clientdata

PATCH Superseded Akinobu Mita 2 participants 4 messages Jan 14, 2016 – Jan 15, 2016 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iio: pressure: mpl115: don't set unused i2c clientdata

mpl115 sets i2c clientdata, but it is not used anywhere. So remove it.

Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>
---
 drivers/iio/pressure/mpl115.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/pressure/mpl115.c +0 -1
index f5ecd6e..3e1e3353 100644
@@ -163,7 +163,6 @@ static int mpl115_probe(struct i2c_client *client,
 	data->client = client;
 	mutex_init(&data->lock);
 
-	i2c_set_clientdata(client, indio_dev);
 	indio_dev->info = &mpl115_info;
 	indio_dev->name = id->name;
 	indio_dev->dev.parent = &client->dev;
Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/2 iio: pressure: mpl115: support MPL115A1

mpl115 driver currently supports i2c interface (MPL115A2). There is also SPI version (MPL115A1). The difference between them is only physical transport so we can easily support both while sharing most of the code.

Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>
---
 drivers/iio/pressure/Kconfig  |   8 +-
 drivers/iio/pressure/mpl115.c | 258 +++++++++++++++++++++++++++++++++++++-----
 2 files changed, 236 insertions(+), 30 deletions(-)
drivers/iio/pressure/Kconfig +4 -4
index 6f2e7c9..fa628b7 100644
@@ -31,11 +31,11 @@ config HID_SENSOR_PRESS
           will be called hid-sensor-press.
 
 config MPL115
-	tristate "Freescale MPL115A2 pressure sensor driver"
-	depends on I2C
+	tristate "Freescale MPL115A1/2 pressure sensor driver"
+	depends on (SPI_MASTER && I2C!=m) || I2C
 	help
-	  Say yes here to build support for the Freescale MPL115A2
-	  pressure sensor connected via I2C.
+	  Say yes here to build support for the Freescale MPL115A1/2
+	  pressure sensor connected via I2C or SPI.
 
           To compile this driver as a module, choose M here: the module
           will be called mpl115.
drivers/iio/pressure/mpl115.c +232 -26

349 lines not on this page · raw message

Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH 2/2] iio: pressure: mpl115: support MPL115A1

Quoted 21 lines · Akinobu Mita

mpl115 driver currently supports i2c interface (MPL115A2). There is also SPI version (MPL115A1). The difference between them is only physical transport so we can easily support both while sharing most of the code.

Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>
---
 drivers/iio/pressure/Kconfig  |   8 +-
 drivers/iio/pressure/mpl115.c | 258 +++++++++++++++++++++++++++++++++++++-----
 2 files changed, 236 insertions(+), 30 deletions(-)
drivers/iio/pressure/Kconfig +0 -0
index 6f2e7c9..fa628b7 100644

drivers/iio/pressure/Kconfig config HID_SENSOR_PRESS · line 35

Quoted 7 lines
drivers/iio/pressure/Kconfig +2 -2
@@ -31,11 +31,11 @@ config HID_SENSOR_PRESS
           will be called hid-sensor-press.
 
 config MPL115
-	tristate "Freescale MPL115A2 pressure sensor driver"
-	depends on I2C
+	tristate "Freescale MPL115A1/2 pressure sensor driver"
+	depends on (SPI_MASTER && I2C!=m) || I2C

Hi,

for combined SPI and I2C support please follow a scheme similar to that used by the mma7455 driver
(http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/iio?id=a84ef0d181d917125f1f16cffe53f84c19968969)
and split the driver into a core support module and one module each for I2C and SPI support.

That is a much cleaner approach and avoids issues that can happen if core I2C support is build as a module and core SPI support is built-in.

- Lars

#3 lore raw

Re: [PATCH 2/2] iio: pressure: mpl115: support MPL115A1

2016-01-15 1:37 GMT+09:00 Lars-Peter Clausen <[email protected]>:

Quoted 32 lines · Akinobu Mita
Quoted 21 lines

mpl115 driver currently supports i2c interface (MPL115A2). There is also SPI version (MPL115A1). The difference between them is only physical transport so we can easily support both while sharing most of the code.

Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>
---
 drivers/iio/pressure/Kconfig  |   8 +-
 drivers/iio/pressure/mpl115.c | 258 +++++++++++++++++++++++++++++++++++++-----
 2 files changed, 236 insertions(+), 30 deletions(-)
drivers/iio/pressure/Kconfig +0 -0
index 6f2e7c9..fa628b7 100644

drivers/iio/pressure/Kconfig config HID_SENSOR_PRESS · line 35

Quoted 7 lines
drivers/iio/pressure/Kconfig +2 -2
@@ -31,11 +31,11 @@ config HID_SENSOR_PRESS
           will be called hid-sensor-press.
 
 config MPL115
-     tristate "Freescale MPL115A2 pressure sensor driver"
-     depends on I2C
+     tristate "Freescale MPL115A1/2 pressure sensor driver"
+     depends on (SPI_MASTER && I2C!=m) || I2C

Hi,

Quoted 8 lines

for combined SPI and I2C support please follow a scheme similar to that used by the mma7455 driver
(http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/iio?id=a84ef0d181d917125f1f16cffe53f84c19968969)
and split the driver into a core support module and one module each for I2C and SPI support.

That is a much cleaner approach and avoids issues that can happen if core I2C support is build as a module and core SPI support is built-in.

Thanks for your advise. I've just finished the conversion. It looks good as we can continue to use module_i2c_driver() instead of open-coding it.