* [PATCH v2] i2c: Only include slave support if selected
@ 2015-01-26 18:00 Jean Delvare
[not found] ` <20150126190047.7bc44f26-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2015-01-26 18:00 UTC (permalink / raw)
To: Linux I2C; +Cc: Wolfram Sang
Make the slave support depend on CONFIG_I2C_SLAVE. Otherwise it gets
included unconditionally, even when it is not needed.
Signed-off-by: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
---
Changes since v1:
* Let I2C_RCAR select I2C_SLAVE
Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to
implement slave support in v3.19-rc6 so I did not include it. Feel free
to add more selects to drivers/i2c/busses/Kconfig to match the current
state of your i2c tree.
drivers/i2c/busses/Kconfig | 1 +
drivers/i2c/i2c-core.c | 2 ++
include/linux/i2c.h | 4 ++++
3 files changed, 7 insertions(+)
--- linux-3.19-rc6.orig/drivers/i2c/i2c-core.c 2015-01-26 12:47:26.467671896 +0100
+++ linux-3.19-rc6/drivers/i2c/i2c-core.c 2015-01-26 12:50:23.541420438 +0100
@@ -2962,6 +2962,7 @@ trace:
}
EXPORT_SYMBOL(i2c_smbus_xfer);
+#if IS_ENABLED(CONFIG_I2C_SLAVE)
int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
{
int ret;
@@ -3009,6 +3010,7 @@ int i2c_slave_unregister(struct i2c_clie
return ret;
}
EXPORT_SYMBOL_GPL(i2c_slave_unregister);
+#endif
MODULE_AUTHOR("Simon G. Vogl <simon-nD9nYVNVf00W+b/DJNNodF6hYfS7NtTn@public.gmane.org>");
MODULE_DESCRIPTION("I2C-Bus main module");
--- linux-3.19-rc6.orig/include/linux/i2c.h 2015-01-26 12:47:26.470671959 +0100
+++ linux-3.19-rc6/include/linux/i2c.h 2015-01-26 12:52:00.027462551 +0100
@@ -222,7 +222,9 @@ struct i2c_client {
struct device dev; /* the device structure */
int irq; /* irq issued by device */
struct list_head detected;
+#if IS_ENABLED(CONFIG_I2C_SLAVE)
i2c_slave_cb_t slave_cb; /* callback for slave mode */
+#endif
};
#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -247,6 +249,7 @@ static inline void i2c_set_clientdata(st
/* I2C slave support */
+#if IS_ENABLED(CONFIG_I2C_SLAVE)
enum i2c_slave_event {
I2C_SLAVE_REQ_READ_START,
I2C_SLAVE_REQ_READ_END,
@@ -263,6 +266,7 @@ static inline int i2c_slave_event(struct
{
return client->slave_cb(client, event, val);
}
+#endif
/**
* struct i2c_board_info - template for device creation
--- linux-3.19-rc6.orig/drivers/i2c/busses/Kconfig 2015-01-23 10:30:56.044531347 +0100
+++ linux-3.19-rc6/drivers/i2c/busses/Kconfig 2015-01-26 18:55:07.163736062 +0100
@@ -881,6 +881,7 @@ config I2C_XLR
config I2C_RCAR
tristate "Renesas R-Car I2C Controller"
depends on ARCH_SHMOBILE || COMPILE_TEST
+ select I2C_SLAVE
help
If you say yes to this option, support will be included for the
R-Car I2C controller.
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: Only include slave support if selected
[not found] ` <20150126190047.7bc44f26-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
@ 2015-01-26 18:05 ` Wolfram Sang
2015-01-26 18:53 ` Jean Delvare
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2015-01-26 18:05 UTC (permalink / raw)
To: Jean Delvare; +Cc: Linux I2C
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
On Mon, Jan 26, 2015 at 07:00:47PM +0100, Jean Delvare wrote:
> Make the slave support depend on CONFIG_I2C_SLAVE. Otherwise it gets
> included unconditionally, even when it is not needed.
>
> Signed-off-by: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
> Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> ---
> Changes since v1:
> * Let I2C_RCAR select I2C_SLAVE
>
> Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to
> implement slave support in v3.19-rc6 so I did not include it. Feel free
> to add more selects to drivers/i2c/busses/Kconfig to match the current
> state of your i2c tree.
Sorry, my bad. I meant the RCAR driver which you spotted. What about the
function pointers in the algo struct?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: Only include slave support if selected
2015-01-26 18:05 ` Wolfram Sang
@ 2015-01-26 18:53 ` Jean Delvare
0 siblings, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2015-01-26 18:53 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Linux I2C
On Mon, 26 Jan 2015 19:05:09 +0100, Wolfram Sang wrote:
> On Mon, Jan 26, 2015 at 07:00:47PM +0100, Jean Delvare wrote:
> > Make the slave support depend on CONFIG_I2C_SLAVE. Otherwise it gets
> > included unconditionally, even when it is not needed.
> >
> > Signed-off-by: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
> > Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> > ---
> > Changes since v1:
> > * Let I2C_RCAR select I2C_SLAVE
> >
> > Wolfram, you mentioned i2c-sh_mobile but that driver doesn't seem to
> > implement slave support in v3.19-rc6 so I did not include it. Feel free
> > to add more selects to drivers/i2c/busses/Kconfig to match the current
> > state of your i2c tree.
>
> Sorry, my bad. I meant the RCAR driver which you spotted. What about the
> function pointers in the algo struct?
Doh, forgot about them once again. Stay tuned, patch v3 is coming...
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-26 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-26 18:00 [PATCH v2] i2c: Only include slave support if selected Jean Delvare
[not found] ` <20150126190047.7bc44f26-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-26 18:05 ` Wolfram Sang
2015-01-26 18:53 ` Jean Delvare
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).