From: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: I2C slave support
Date: Mon, 26 Jan 2015 18:07:47 +0100 [thread overview]
Message-ID: <20150126180747.07ddacfd@endymion.delvare> (raw)
In-Reply-To: <20150126163013.GE13494@katana>
On Mon, 26 Jan 2015 17:30:13 +0100, Wolfram Sang wrote:
>
> > > Own module: Again, undecided. On the one hand it makes for a nice
> > > encapsulation, on the other hand there is overhead for having another
> > > module. I am very happy that the core code for slave support is so slim.
> >
> > I gave a try to the separate module approach and I have to agree that
> > it seems overkill given the small amount of code.
>
> OK, thanks for trying!
>
> > Something like this?
>
> Yes, pretty much what I had in mind. One issue, though:
>
> > +#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
>
> This should fail because bus drivers need those enums for their slave
> backend. Try building i2c-sh_mobile which builds with an x86 toolchain
> as well.
Sorry I missed that, because there is currently no i2c bus driver
implementing slave support on x86-64.
> * Either we leave this included, so bus drivers don't need any ifdeffery
We can do that. The enum itself has no run-time cost so I don't mind.
> or
>
> * we mandate that bus drivers also use the ifedeffery. Then, we could
> also mask out the (un)reg_slave callbacks in struct i2c_adapter
>
> What do you think?
Oh, I admit I completely missed the (un)reg_slave callbacks in my first
patch.
While I am happy with a few ifdefs in i2c-core and i2c.h, I agree it
will become messy if these are required in device drivers as well.
Hmm, what about bus drivers with slave mode support must select
CONFIG_I2C_SLAVE? This solves my problem nicely, and makes no change
compared to the current situation for people using slave mode.
Thanks,
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2015-01-26 17:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-24 20:08 I2C slave support Jean Delvare
[not found] ` <20150124210825.521bf923-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-26 11:33 ` Wolfram Sang
2015-01-26 16:17 ` Jean Delvare
[not found] ` <20150126171745.3d6d0fec-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-26 16:30 ` Wolfram Sang
2015-01-26 17:07 ` Jean Delvare [this message]
[not found] ` <20150126180747.07ddacfd-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-26 17:45 ` Wolfram Sang
-- strict thread matches above, loose matches on Subject: below --
2010-05-28 8:14 I2c " Jack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150126180747.07ddacfd@endymion.delvare \
--to=jdelvare-l3a5bk7wagm@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.