i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C
Jonathan Cameron
maintainerPATCH 1/1 i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C
From: Jonathan Cameron <[email protected]>
If I2C is not compiled, there is no way we should see a call to i2c_verify_client() on a device that is an i2c client. As such, provide a stub to return NULL to resolve an associated build failure.
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'
---
V2: Move to end of existing #if IS_ENABLED(CONFIG_I2C) block.
Plan for this an immutable branch in iio.git which can be pulled into both the togreg branch of iio.git and the i2c tree.
Fixes tag is there so that people can track the need for this patch if they are backporting that device errata work around.
include/linux/i2c.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/i2c.h +7 -1
@@ -343,7 +343,6 @@ struct i2c_client { };#define to_i2c_client (d) container_of(d, struct i2c_client, dev) -struct i2c_client *i2c_verify_client (struct device *dev);struct i2c_adapter *i2c_verify_adapter (struct device *dev);const struct i2c_device_id *i2c_match_id (const struct i2c_device_id *id,const struct i2c_client *client);
@@ -477,6 +476,13 @@ i2c_new_ancillary_device(struct i2c_client *client, u16 default_addr);void i2c_unregister_device (struct i2c_client *client); + +struct i2c_client *i2c_verify_client (struct device *dev); +#else +static inline struct i2c_client *i2c_verify_client (struct device *dev) +{ +return NULL ; +}#endif /* I2C */ /* Mainboard arch_initcall() code should register all its I2C devices.
Signature · 1 line
2.31.1
Quoted 10 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
If I2C is not compiled, there is no way we should see a call to
i2c_verify_client()on a device that is an i2c client. As such, provide a stub to return NULL to resolve an associated build failure.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 5 lines
Reported-by Tom Rix <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>Fixes 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")Reviewed-by Sean Nyekjaer <[email protected]>Cc Wolfram Sang <[email protected]>
Thanks for doing this!
Jonathan Cameron
maintainerQuoted 17 lines · On Thu, 3 Jun 2021 21:55:51 +0200 Wolfram Sang <[email protected]> wrote:
Quoted 10 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
If I2C is not compiled, there is no way we should see a call to
i2c_verify_client()on a device that is an i2c client. As such, provide a stub to return NULL to resolve an associated build failure.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 5 lines
Reported-by Tom Rix <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>Fixes 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")Reviewed-by Sean Nyekjaer <[email protected]>Cc Wolfram Sang <[email protected]>
Quoted 4 lines
Thanks for doing this!
Acked-by Wolfram Sang <[email protected]>
immutable branch at:
ib-iio-i2c-5.13rc1 https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
I let this sit in next (via a merge with IIO togreg branch) for a day to shake out any ways in which I messed it up.
As it turns out, that was a good plan given the fixes tag had gone stale. Now fixed that and will be sending a pull request to Greg KH including the update IIO merge shortly (which is in linux-next today).
Thanks,
Jonathan