All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: lars@metafoo.de, denis.ciocca@st.com,
	Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 1/2] Make the st_sensors core library stuff build in all combinations.
Date: Sun, 20 Jan 2013 12:56:14 +0000	[thread overview]
Message-ID: <1358686575-16779-1-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <50FBE8F8.7010300@kernel.org>

---
 drivers/iio/common/st_sensors/Kconfig          | 11 ++++++++++-
 drivers/iio/common/st_sensors/Makefile         | 24 ++++++------------------
 drivers/iio/common/st_sensors/st_sensors_i2c.c |  3 ++-
 drivers/iio/common/st_sensors/st_sensors_spi.c |  4 ++--
 include/linux/iio/common/st_i2c.h              |  7 +++++++
 include/linux/iio/common/st_sensors.h          | 14 --------------
 include/linux/iio/common/st_spi.h              |  9 +++++++++
 7 files changed, 36 insertions(+), 36 deletions(-)
 create mode 100644 include/linux/iio/common/st_i2c.h
 create mode 100644 include/linux/iio/common/st_spi.h

diff --git a/drivers/iio/common/st_sensors/Kconfig b/drivers/iio/common/st_sensors/Kconfig
index 0749f5c..58e06eb 100644
--- a/drivers/iio/common/st_sensors/Kconfig
+++ b/drivers/iio/common/st_sensors/Kconfig
@@ -2,5 +2,14 @@
 # Hid Sensor common modules
 #
 
+config IIO_ST_SENSORS_I2C
+       tristate
+
+config IIO_ST_SENSORS_SPI
+       tristate
+
 config IIO_ST_SENSORS_CORE
-	bool
+       tristate
+       select IIO_ST_SENSORS_I2C if I2C
+       select IIO_ST_SENSORS_SPI if SPI_MASTER
+
diff --git a/drivers/iio/common/st_sensors/Makefile b/drivers/iio/common/st_sensors/Makefile
index 8c9a57a..2075ad4 100644
--- a/drivers/iio/common/st_sensors/Makefile
+++ b/drivers/iio/common/st_sensors/Makefile
@@ -1,21 +1,9 @@
 #
 # Makefile for the STMicroelectronics sensor common modules.
 #
-
-ifneq ($(CONFIG_I2C),)
-st_accel_i2c			= st_sensors_i2c.o
-endif
-
-ifneq ($(CONFIG_SPI_MASTER),)
-st_accel_spi			= st_sensors_spi.o
-endif
-
-ifneq ($(CONFIG_IIO_BUFFER),)
-st_sensors_triggered_buffer	= st_sensors_trigger.o st_sensors_buffer.o
-endif
-
-obj-$(CONFIG_IIO_ST_SENSORS_CORE) += 	st_sensors_library.o
-st_sensors_library-y := st_sensors_core.o \
-			$(st_accel_i2c) \
-			$(st_accel_spi) \
-			$(st_sensors_triggered_buffer)
+obj-$(CONFIG_IIO_ST_SENSORS_I2C) += st_sensors_i2c.o
+obj-$(CONFIG_IIO_ST_SENSORS_SPI) += st_sensors_spi.o
+obj-$(CONFIG_IIO_ST_SENSORS_CORE) += st_sensors.o
+st_sensors-y := st_sensors_core.o
+st_sensors-$(CONFIG_IIO_BUFFER) += st_sensors_buffer.o
+st_sensors-$(CONFIG_IIO_TRIGGER) += st_sensors_trigger.o
diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
index b2d2fdf..43169ce 100644
--- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
+++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
@@ -13,12 +13,13 @@
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
 
+#include <linux/iio/common/st_i2c.h>
 #include <linux/iio/common/st_sensors.h>
 
 
 #define ST_SENSORS_I2C_MULTIREAD	0x80
 
-unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev)
+static unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
index 5030766..f89726f 100644
--- a/drivers/iio/common/st_sensors/st_sensors_spi.c
+++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
@@ -12,14 +12,14 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
-
+#include <linux/iio/common/st_spi.h>
 #include <linux/iio/common/st_sensors.h>
 
 
 #define ST_SENSORS_SPI_MULTIREAD	0xc0
 #define ST_SENSORS_SPI_READ		0x80
 
-unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev)
+static unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
diff --git a/include/linux/iio/common/st_i2c.h b/include/linux/iio/common/st_i2c.h
new file mode 100644
index 0000000..c4ff039
--- /dev/null
+++ b/include/linux/iio/common/st_i2c.h
@@ -0,0 +1,7 @@
+
+struct iio_dev;
+struct i2c_client;
+struct st_sensor_data;
+
+void st_sensors_i2c_configure(struct iio_dev *indio_dev,
+		struct i2c_client *client, struct st_sensor_data *sdata);
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index a8a0c40..f27b1e0 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -215,20 +215,6 @@ struct st_sensors {
 	unsigned int bootime;
 };
 
-#ifdef CONFIG_SPI_MASTER
-void st_sensors_spi_configure(struct iio_dev *indio_dev,
-			struct spi_device *spi, struct st_sensor_data *sdata);
-
-unsigned int st_sensors_spi_get_irq(struct iio_dev *indio_dev);
-#endif
-
-#ifdef CONFIG_I2C
-void st_sensors_i2c_configure(struct iio_dev *indio_dev,
-		struct i2c_client *client, struct st_sensor_data *sdata);
-
-unsigned int st_sensors_i2c_get_irq(struct iio_dev *indio_dev);
-#endif
-
 #ifdef CONFIG_IIO_BUFFER
 int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 					struct iio_trigger_ops *trigger_ops);
diff --git a/include/linux/iio/common/st_spi.h b/include/linux/iio/common/st_spi.h
new file mode 100644
index 0000000..d1dddc6
--- /dev/null
+++ b/include/linux/iio/common/st_spi.h
@@ -0,0 +1,9 @@
+
+
+struct iio_dev;
+struct st_sensor_data;
+struct spi_device;
+
+void st_sensors_spi_configure(struct iio_dev *indio_dev,
+			struct spi_device *spi, struct st_sensor_data *sdata);
+
-- 
1.8.1


  reply	other threads:[~2013-01-20 12:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 16:58 STMicroelectronics drivers Denis CIOCCA
2013-01-18 16:58 ` [PATCH 1/4] iio:common: Add STMicroelectronics common library Denis CIOCCA
2013-01-18 16:58 ` [PATCH 2/4] iio:accel: Add STMicroelectronics accelerometers driver Denis CIOCCA
2013-01-18 16:58 ` [PATCH 3/4] iio:gyro: Add STMicroelectronics gyroscopes driver Denis CIOCCA
2013-01-18 16:58 ` [PATCH 4/4] iio:magnetometer: Add STMicroelectronics magnetometers driver Denis CIOCCA
2013-01-20 12:54 ` STMicroelectronics drivers Jonathan Cameron
2013-01-20 12:56   ` Jonathan Cameron [this message]
2013-01-20 12:56     ` [PATCH 2/2] Rework the Makefile / Kconfig for the st accel driver so that all options work Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358686575-16779-1-git-send-email-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=denis.ciocca@st.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.