Skip to contentSkip to conversation

staging:iio Build issue fixes

PATCH In review Jonathan Cameron 2 participants 8 messages Jul 29, 2010

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

v2 cover staging:iio Build issue fixes

Hi All,

This lot are in response to Randy Dunlap finding a number of build issues. The final patch actually fixes a bug that has been there quite some time.

Sorry again for clearly not testing my previous series properly!

Jonathan Cameron (6):
staging:iio: iio_sw_ring_helper_state - add dummy case for no buffer
builds.
staging:iio:lis3l02dq add a thresh_timestamp field to state for no
ring case
staging:iio:adis16350 add dummy ring functions for no ring build case

  staging:iio:ring_sw  Add select of triggers to avoid build issue.
  staging:iio:ring_sw  remove unnecessary function stub.
  staging:iio:ring_sw  Fix pointer arithmetic for 64bit arches by using

phys_addr_t

 drivers/staging/iio/Kconfig                |    1 +
 drivers/staging/iio/accel/lis3l02dq.h      |    2 ++
 drivers/staging/iio/accel/lis3l02dq_core.c |   14 +++++++-------
 drivers/staging/iio/imu/adis16350.h        |    8 ++++++++
 drivers/staging/iio/ring_sw.c              |    2 +-
 drivers/staging/iio/ring_sw.h              |    5 +++--
 6 files changed, 22 insertions(+), 10 deletions(-)
#1 lore raw

PATCH v2 1/6 staging:iio: iio_sw_ring_helper_state - add dummy case for no buffer builds.

---
 drivers/staging/iio/ring_sw.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/staging/iio/ring_sw.h +3 -0
index 0194e7f..7c27e2c 100644
@@ -222,5 +222,8 @@ void iio_sw_trigger_bh_to_ring(struct work_struct *work_s);
 #else /* CONFIG_IIO_RING_BUFFER*/
 static inline void iio_ring_sw_register_funcs(struct iio_ring_access_funcs *ra)
 {};
+struct iio_sw_ring_helper_state {
+	struct iio_dev			*indio_dev;
+};
 #endif /* !CONFIG_IIO_RING_BUFFER */
 #endif /* _IIO_RING_SW_H_ */
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/6 staging:iio:lis3l02dq add a thresh_timestamp field to state for no ring case

In reply to Jonathan Cameron
---
 drivers/staging/iio/accel/lis3l02dq.h      |    2 ++
 drivers/staging/iio/accel/lis3l02dq_core.c |   14 +++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/staging/iio/accel/lis3l02dq.h +2 -0
index 44669ee..6e73055 100644
@@ -151,6 +151,7 @@ Form of high byte dependant on justification set in ctrl reg */
  * @helper:		data and func pointer allowing generic functions
  * @us:			actual spi_device
  * @work_thresh:	bh for threshold events
+ * @thresh_timestamp:	timestamp for threshold interrupts.
  * @inter:		used to check if new interrupt has been triggered
  * @trig:		data ready trigger registered with iio
  * @tx:			transmit buffer
@@ -161,6 +162,7 @@ struct lis3l02dq_state {
 	struct iio_sw_ring_helper_state	help;
 	struct spi_device		*us;
 	struct work_struct		work_thresh;
+	s64				thresh_timestamp;
 	bool				inter;
 	struct iio_trigger		*trig;
 	u8				*tx;
drivers/staging/iio/accel/lis3l02dq_core.c +7 -7
index b04f498..0ee9337 100644
@@ -615,7 +615,7 @@ static int lis3l02dq_thresh_handler_th(struct iio_dev *indio_dev,
 	struct lis3l02dq_state *st = lis3l02dq_h_to_s(h);
 
 	/* Stash the timestamp somewhere convenient for the bh */
-	h->last_timestamp = timestamp;
+	st->thresh_timestamp = timestamp;
 	schedule_work(&st->work_thresh);
 
 	return 0;
@@ -640,32 +640,32 @@ static void lis3l02dq_thresh_handler_bh_no_check(struct work_struct *work_s)
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_Z_HIGH,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_LOW)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_Z_LOW,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_HIGH)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_Y_HIGH,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_LOW)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_Y_LOW,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_HIGH)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_X_HIGH,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 
 	if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_LOW)
 		iio_push_event(st->help.indio_dev, 0,
 			       IIO_EVENT_CODE_ACCEL_X_LOW,
-			       st->help.last_timestamp);
+			       st->thresh_timestamp);
 	/* reenable the irq */
 	enable_irq(st->us->irq);
 	/* Ack and allow for new interrupts */
Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 3/6 staging:iio:adis16350 add dummy ring functions for no ring build case

In reply to Jonathan Cameron
---
 drivers/staging/iio/imu/adis16350.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/staging/iio/imu/adis16350.h +8 -0
index 738deba..b00001e 100644
@@ -165,5 +165,13 @@ adis16350_read_data_from_ring(struct device *dev,
 	return 0;
 }
 
+static inline int adis16350_configure_ring(struct iio_dev *indio_dev)
+{
+	return 0;
+}
+
+static inline void adis16350_unconfigure_ring(struct iio_dev *indio_dev)
+{
+}
 #endif /* CONFIG_IIO_RING_BUFFER */
 #endif /* SPI_ADIS16350_H_ */
Signature · 1 line
1.7.1
#4 lore raw

PATCH v2 4/6 staging:iio:ring_sw Add select of triggers to avoid build issue.

In reply to Jonathan Cameron

Currently all drivers that use ring_sw use triggers and I am yet to see a good reason for any driver not doing so.

---
 drivers/staging/iio/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/staging/iio/Kconfig +1 -0
index 569b938..ed48815 100644
@@ -21,6 +21,7 @@ config IIO_RING_BUFFER
 if IIO_RING_BUFFER
 
 config IIO_SW_RING
+       select IIO_TRIGGER
 	tristate "Industrial I/O lock free software ring"
 	help
 	  Example software ring buffer implementation.  The design aim
Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 5/6 staging:iio:ring_sw remove unnecessary function stub.

In reply to Jonathan Cameron
---
 drivers/staging/iio/ring_sw.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/iio/ring_sw.h +0 -2
index 7c27e2c..61f1ed6 100644
@@ -220,8 +220,6 @@ void iio_sw_poll_func_th(struct iio_dev *indio_dev, s64 time);
 void iio_sw_trigger_bh_to_ring(struct work_struct *work_s);
 
 #else /* CONFIG_IIO_RING_BUFFER*/
-static inline void iio_ring_sw_register_funcs(struct iio_ring_access_funcs *ra)
-{};
 struct iio_sw_ring_helper_state {
 	struct iio_dev			*indio_dev;
 };
Signature · 1 line
1.7.1
#6 lore raw

PATCH v2 6/6 staging:iio:ring_sw Fix pointer arithmetic for 64bit arches by using phys_addr_t

In reply to Jonathan Cameron
---
 drivers/staging/iio/ring_sw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/iio/ring_sw.c +1 -1
index 9b3598e..e2f01c6 100644
@@ -478,7 +478,7 @@ void iio_sw_trigger_bh_to_ring(struct work_struct *work_s)
 
 	  /* Guaranteed to be aligned with 8 byte boundary */
 	if (st->indio_dev->scan_timestamp)
-		*(s64 *)(((u32)data + len
+		*(s64 *)(((phys_addr_t)data + len
 				+ sizeof(s64) - 1) & ~(sizeof(s64) - 1))
 			= st->last_timestamp;
 	  st->indio_dev->ring->access.store_to(st->indio_dev->ring,
Signature · 1 line
1.7.1
Acked-by on the v2 series
#7 lore raw
In reply to Jonathan Cameron
Quoted 8 lines · Jonathan Cameron

Hi All,

This lot are in response to Randy Dunlap finding a number of build issues. The final patch actually fixes a bug that has been there quite some time.

Sorry again for clearly not testing my previous series properly!

Thanks for the quick update.

Quoted 20 lines

Jonathan Cameron (6):
staging:iio: iio_sw_ring_helper_state - add dummy case for no buffer
builds.
staging:iio:lis3l02dq add a thresh_timestamp field to state for no
ring case
staging:iio:adis16350 add dummy ring functions for no ring build case

  staging:iio:ring_sw  Add select of triggers to avoid build issue.
  staging:iio:ring_sw  remove unnecessary function stub.
  staging:iio:ring_sw  Fix pointer arithmetic for 64bit arches by using

phys_addr_t

 drivers/staging/iio/Kconfig                |    1 +
 drivers/staging/iio/accel/lis3l02dq.h      |    2 ++
 drivers/staging/iio/accel/lis3l02dq_core.c |   14 +++++++-------
 drivers/staging/iio/imu/adis16350.h        |    8 ++++++++
 drivers/staging/iio/ring_sw.c              |    2 +-
 drivers/staging/iio/ring_sw.h              |    5 +++--
 6 files changed, 22 insertions(+), 10 deletions(-)
Signature · 2 lines
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***