Skip to contentSkip to conversation

iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()

PATCH In review [email protected] 4 participants 4 messages May 18, 2021 – May 25, 2021

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

PATCH 1/1 iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()

From: Tom Rix <[email protected]>

The build is failing with this link error
ld: fxls8962af-core.o: in function `fxls8962af_fifo_transfer':
fxls8962af-core.c: undefined reference to `i2c_verify_client'

This is needed for the i2c variant, not the spi variant. So conditionally compile based on CONFIG_FXLS8962AF_I2C.

---
 drivers/iio/accel/fxls8962af-core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/accel/fxls8962af-core.c +4 -0
index 9fe5a18a605cc..b6d833e2058c8 100644
@@ -624,6 +624,7 @@ static const struct iio_buffer_setup_ops fxls8962af_buffer_ops = {
 	.postdisable = fxls8962af_buffer_postdisable,
 };
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 					   u16 *buffer, int samples,
 					   int sample_length)
@@ -639,6 +640,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 
 	return ret;
 }
+#endif
 
 static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 				    u16 *buffer, int samples)
@@ -648,6 +650,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 	int total_length = samples * sample_length;
 	int ret;
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 	if (i2c_verify_client(dev))
 		/*
 		 * Due to errata bug:
@@ -657,6 +660,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 		ret = fxls8962af_i2c_raw_read_errata3(data, buffer, samples,
 						      sample_length);
 	else
+#endif
 		ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB, buffer,
 				      total_length);
 
Signature · 1 line
2.26.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On 19/05/2021 01.48, [email protected] wrote:

From: Tom Rix <[email protected]>

The build is failing with this link error
ld: fxls8962af-core.o: in function `fxls8962af_fifo_transfer':
fxls8962af-core.c: undefined reference to `i2c_verify_client'

This is needed for the i2c variant, not the spi variant. So conditionally compile based on CONFIG_FXLS8962AF_I2C.

Fixes 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Quoted 1 line
Quoted 41 lines
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/accel/fxls8962af-core.c +4 -0
index 9fe5a18a605cc..b6d833e2058c8 100644
@@ -624,6 +624,7 @@ static const struct iio_buffer_setup_ops fxls8962af_buffer_ops = {
 	.postdisable = fxls8962af_buffer_postdisable,
 };
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 					   u16 *buffer, int samples,
 					   int sample_length)
@@ -639,6 +640,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 
 	return ret;
 }
+#endif
 
 static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 				    u16 *buffer, int samples)
@@ -648,6 +650,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 	int total_length = samples * sample_length;
 	int ret;
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 	if (i2c_verify_client(dev))
 		/*
 		 * Due to errata bug:
@@ -657,6 +660,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 		ret = fxls8962af_i2c_raw_read_errata3(data, buffer, samples,
 						      sample_length);
 	else
+#endif
 		ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB, buffer,
 				      total_length);
 
maintainer
#2 lore raw
Quoted 7 lines · On Wed, 19 May 2021 07:37:16 +0200 Sean Nyekjaer <[email protected]> wrote:
Quoted 6 lines · On 19/05/2021 01.48, [email protected] wrote:

From: Tom Rix <[email protected]>

The build is failing with this link error
ld: fxls8962af-core.o: in function `fxls8962af_fifo_transfer':
fxls8962af-core.c: undefined reference to `i2c_verify_client'

Quoted 6 lines
Quoted 3 lines

This is needed for the i2c variant, not the spi variant. So conditionally compile based on CONFIG_FXLS8962AF_I2C.

Fixes 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Quoted 1 line

Given the purpose of that check is to verify it was an i2c_client should we be looking to instead provide a stub for the case where we don't have CONFIG_I2C?

+CC Wolfram and linux-i2c list for input.

Quoted 42 lines
Quoted 41 lines
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iio/accel/fxls8962af-core.c +4 -0
index 9fe5a18a605cc..b6d833e2058c8 100644
@@ -624,6 +624,7 @@ static const struct iio_buffer_setup_ops fxls8962af_buffer_ops = {
 	.postdisable = fxls8962af_buffer_postdisable,
 };
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 					   u16 *buffer, int samples,
 					   int sample_length)
@@ -639,6 +640,7 @@ static int fxls8962af_i2c_raw_read_errata3(struct fxls8962af_data *data,
 
 	return ret;
 }
+#endif
 
 static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 				    u16 *buffer, int samples)
@@ -648,6 +650,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 	int total_length = samples * sample_length;
 	int ret;
 
+#if IS_ENABLED(CONFIG_FXLS8962AF_I2C)
 	if (i2c_verify_client(dev))
 		/*
 		 * Due to errata bug:
@@ -657,6 +660,7 @@ static int fxls8962af_fifo_transfer(struct fxls8962af_data *data,
 		ret = fxls8962af_i2c_raw_read_errata3(data, buffer, samples,
 						      sample_length);
 	else
+#endif
 		ret = regmap_raw_read(data->regmap, FXLS8962AF_BUF_X_LSB, buffer,
 				      total_length);
 
#3 lore raw
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

The build is failing with this link error
ld: fxls8962af-core.o: in function `fxls8962af_fifo_transfer':
fxls8962af-core.c: undefined reference to `i2c_verify_client'

This is needed for the i2c variant, not the spi variant. So conditionally compile based on CONFIG_FXLS8962AF_I2C.

Fixes 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Given the purpose of that check is to verify it was an i2c_client should we be looking to instead provide a stub for the case where we don't have CONFIG_I2C?

+CC Wolfram and linux-i2c list for input.

Such a stub sounds reasonable.