All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()
@ 2021-05-18 23:48 trix
  2021-05-19  5:37 ` Sean Nyekjaer
  0 siblings, 1 reply; 4+ messages in thread
From: trix @ 2021-05-18 23:48 UTC (permalink / raw)
  To: jic23, lars, sean, andy.shevchenko; +Cc: linux-iio, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

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.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/iio/accel/fxls8962af-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 9fe5a18a605cc..b6d833e2058c8 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -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);
 
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()
  2021-05-18 23:48 [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3() trix
@ 2021-05-19  5:37 ` Sean Nyekjaer
  2021-05-21 16:54   ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Nyekjaer @ 2021-05-19  5:37 UTC (permalink / raw)
  To: trix, jic23, lars, andy.shevchenko; +Cc: linux-iio, linux-kernel

On 19/05/2021 01.48, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> 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")
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
> ---
>  drivers/iio/accel/fxls8962af-core.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> index 9fe5a18a605cc..b6d833e2058c8 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -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);
>  
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()
  2021-05-19  5:37 ` Sean Nyekjaer
@ 2021-05-21 16:54   ` Jonathan Cameron
  2021-05-25 20:30     ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2021-05-21 16:54 UTC (permalink / raw)
  To: Sean Nyekjaer
  Cc: trix, lars, andy.shevchenko, linux-iio, linux-kernel,
	Wolfram Sang, linux-i2c

On Wed, 19 May 2021 07:37:16 +0200
Sean Nyekjaer <sean@geanix.com> wrote:

> On 19/05/2021 01.48, trix@redhat.com wrote:
> > From: Tom Rix <trix@redhat.com>
> > 
> > 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")
> > Signed-off-by: Tom Rix <trix@redhat.com>  
> Reviewed-by: Sean Nyekjaer <sean@geanix.com>

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.

> > ---
> >  drivers/iio/accel/fxls8962af-core.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> > index 9fe5a18a605cc..b6d833e2058c8 100644
> > --- a/drivers/iio/accel/fxls8962af-core.c
> > +++ b/drivers/iio/accel/fxls8962af-core.c
> > @@ -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);
> >  
> >   
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3()
  2021-05-21 16:54   ` Jonathan Cameron
@ 2021-05-25 20:30     ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-05-25 20:30 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Sean Nyekjaer, trix, lars, andy.shevchenko, linux-iio,
	linux-kernel, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]


> > > 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")
> > > Signed-off-by: Tom Rix <trix@redhat.com>  
> > Reviewed-by: Sean Nyekjaer <sean@geanix.com>
> 
> 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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-25 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 23:48 [PATCH] iio: accel: fxls8962af: conditionally compile fxls8962af_i2c_raw_read_errata3() trix
2021-05-19  5:37 ` Sean Nyekjaer
2021-05-21 16:54   ` Jonathan Cameron
2021-05-25 20:30     ` Wolfram Sang

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.