linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C
@ 2021-05-26 17:44 Jonathan Cameron
  2021-05-27  5:38 ` Sean Nyekjaer
  2021-05-27 20:23 ` Wolfram Sang
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Cameron @ 2021-05-26 17:44 UTC (permalink / raw)
  To: linux-iio, linux-i2c
  Cc: Jonathan Cameron, Tom Rix, Sean Nyekjaer, Wolfram Sang

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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'

Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 68068fad0e1c ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Cc: Sean Nyekjaer <sean@geanix.com>
Cc: Wolfram Sang <wsa@kernel.org>
---

Note the broken patch is only in the IIO/togreg branch at the moment.

 include/linux/i2c.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e8f2ac8c9c3d..aa52738b9c46 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -343,7 +343,14 @@ struct i2c_client {
 };
 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
 
+#if IS_ENABLED(CONFIG_I2C)
 struct i2c_client *i2c_verify_client(struct device *dev);
+#else
+static inline struct i2c_client *i2c_verify_client(struct device *dev)
+{
+	return NULL;
+}
+#endif
 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);
-- 
2.31.1


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

end of thread, other threads:[~2021-06-03 12:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 17:44 [PATCH] i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C Jonathan Cameron
2021-05-27  5:38 ` Sean Nyekjaer
2021-05-27 20:23 ` Wolfram Sang
2021-06-03 11:24   ` Jonathan Cameron
2021-06-03 11:55     ` Wolfram Sang
2021-06-03 12:42       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).