Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1701434

Re: [RFC 2/5] i3c: Add core I3C infrastructure

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [RFC 2/5] i3c: Add core I3C infrastructure
Date 2017-08-01 22:20 +0200
Message-ID <u9LO2-9K-29@gated-at.bofh.it> (permalink)
References (6 earlier) <u9FfB-4tk-21@gated-at.bofh.it> <u9FyX-4zN-31@gated-at.bofh.it> <u9FSh-4Gv-1@gated-at.bofh.it> <u9Glj-55w-1@gated-at.bofh.it> <u9H7H-5CS-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Aug 1, 2017 at 5:14 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Tue, 1 Aug 2017 16:22:21 +0200 Arnd Bergmann <arnd@arndb.de> wrote:
>> On Tue, Aug 1, 2017 at 3:58 PM, Boris Brezillon
>> <boris.brezillon@free-electrons.com> wrote:
>> > On Tue, 1 Aug 2017 15:34:14 +0200
>> > Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>> >> On Tue, 1 Aug 2017 15:11:44 +0200
>> >> Arnd Bergmann <arnd@arndb.de> wrote:
>> >> > On Tue, Aug 1, 2017 at 2:29 PM, Boris Brezillon
>> >> > <boris.brezillon@free-electrons.com> wrote:
>> > I just realized I forgot to add a "depends on I2C" in the I3C Kconfig
>> > entry. Indeed, I'm unconditionally calling functions provided by the
>> > I2C framework which have no dummy wrapper when I2C support is disabled.
>> > I could of course conditionally compile some portion of the I3C
>> > framework so that it still builds when I2C is disabled but I'm not sure
>> > it's worth the trouble.
>> >
>> > This "depends on I2C" should also solve the I2C+I3C driver issue, since
>> > I2C is necessarily enabled when I3C is.
>> >
>> > Am I missing something?
>>
>> That should solve another part of the problem, as a combined driver then
>> just needs 'depends on I3C'.
>>
>> On top of that, the i3c_driver structure could also contain callback
>> pointers for the i2c subsystem, e.g. i2c_probe(), i2c_remove() etc.
>> When the i2c_probe() callback exists, the i3c layer could construct
>> a 'struct i2c_driver' with those callbacks and register that under the
>> cover. This would mean that combined drivers no longer need to
>> register two driver objects.
>
> That should work. Actually, i2c_driver contains a few more hooks, like
> ->alert(), ->command() and ->detect(). Of course we could assume that
> I3C/I2C drivers do not need them,

I was thinking we can add them as they are needed.

> but I'm wondering if it's not easier
> to just add an i2c_driver pointer inside the i3c_driver struct and let
> the driver populate it if it needs to supports both protocols.
>
> Something like:
>
>         struct i3c_driver {
>                 ...
>                 struct i2c_driver *i2c_compat;
>                 ...
>         };
>
>
> and then in I3C/I2C drivers:
>
>         static struct i2c_driver my_i2c_driver = {
>                 ...
>         };
>
>         static struct i3c_driver my_i3c_driver = {
>                 ...
>                 .i2c_compat = &my_i2c_driver,
>                 ...
>         };
>         module_i3c_driver(my_i3c_driver);
>
>
>
> Of course, you'll have a few fields of ->i2c_compat that would be
> filled by the core (like the driver name which can be extracted from
> my_i3c_driver->driver.name).

Right, that would work too, but it's almost the same as the version
you proposed earlier that would use

module_i2c_i3c_driver(my_i2c_driver, my_i3c_driver);

It's probably a little cleaner this way in the subsystem implementation
compared to my suggestion of adding the i2c callback pointers in
struct i3c_driver, while that would make the drivers look a little nicer
(and save a few lines per driver).

         Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/5] Add I3C subsystem Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-31 18:30 +0200
  [RFC 5/5] dt-bindings: i3c: Document Cadence I3C master bindings Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-31 18:30 +0200
  Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-07-31 21:20 +0200
    Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-31 22:50 +0200
  Re: [RFC 0/5] Add I3C subsystem Wolfram Sang <wsa@the-dreams.de> - 2017-07-31 21:20 +0200
    Re: [RFC 0/5] Add I3C subsystem Wolfram Sang <wsa@the-dreams.de> - 2017-07-31 22:50 +0200
    Re: [RFC 0/5] Add I3C subsystem Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-31 22:50 +0200
  Re: [RFC 2/5] i3c: Add core I3C infrastructure Arnd Bergmann <arnd@arndb.de> - 2017-07-31 22:20 +0200
    Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-31 23:20 +0200
      Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-07-31 23:50 +0200
        Re: [RFC 2/5] i3c: Add core I3C infrastructure "Andrew F. Davis" <afd@ti.com> - 2017-08-01 18:50 +0200
          Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-08-01 19:30 +0200
            Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 23:50 +0200
              Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-08-02 12:30 +0200
      Re: [RFC 2/5] i3c: Add core I3C infrastructure Arnd Bergmann <arnd@arndb.de> - 2017-08-01 14:10 +0200
        Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 14:30 +0200
          Re: [RFC 2/5] i3c: Add core I3C infrastructure Arnd Bergmann <arnd@arndb.de> - 2017-08-01 15:20 +0200
            Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 15:40 +0200
              Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 16:00 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Arnd Bergmann <arnd@arndb.de> - 2017-08-01 16:30 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 17:20 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Arnd Bergmann <arnd@arndb.de> - 2017-08-01 22:20 +0200
              Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-08-01 16:20 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 16:50 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Wolfram Sang <wsa@the-dreams.de> - 2017-08-01 17:10 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 17:30 +0200
                Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-03 10:10 +0200
  Re: [RFC 2/5] i3c: Add core I3C infrastructure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-01 03:50 +0200
    Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 12:50 +0200
      Re: [RFC 2/5] i3c: Add core I3C infrastructure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-01 20:00 +0200
        Re: [RFC 2/5] i3c: Add core I3C infrastructure Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-08-01 23:40 +0200
          Re: [RFC 2/5] i3c: Add core I3C infrastructure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-02 03:00 +0200
          Re: [RFC 2/5] i3c: Add core I3C infrastructure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-02 04:20 +0200

csiph-web