public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Kieran Bingham <kieranbingham@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Samuel Ortiz <sameo@linux.intel.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	grant.likely@linaro.org
Subject: Re: [RESEND PATCH v4 0/8] i2c: Relax mandatory I2C ID table passing
Date: Thu, 24 Sep 2015 19:32:34 +0200	[thread overview]
Message-ID: <560433B2.6040508@osg.samsung.com> (raw)
In-Reply-To: <20150924165807.GA27197@x1>

Hello Lee,

On 09/24/2015 06:58 PM, Lee Jones wrote:

[snip]

>>
>>> Drivers will know if they either only supply an I2C or OF table, so
>>> they will know which call to use in order to obtain their
>>
>> Yes but that is not true for drivers that support both OF and legacy board
>> files. For those drivers, there will be a lot of boiler plate code duplicated
>> that would look something like:
>>
>>      unsigned long data;
>>      struct of_device_id *match;
>>      struct i2c_devicd_id *id;
>>
>>      if (i2c->dev.of_node) {
>>             match = i2c_of_match_device(of_match_table, i2c);
>> 	    if (!match)
>> 	           return -EINVAL;
>>
>>             data = (unsigned long)match->data;
>>      } else {
>>             id = i2c_match_id(id_table, i2c);
>> 	    if (!id)
>> 	           return -EINVAL;
>>
>>             data = id->driver_data;
>>      }
>>
>> While it would be nice to have something like:
>>
>>     data = i2c_get_data(i2c);
>>
>> and let the core handle which table should be looked up depending on
>> which mechanism was used to register the i2c device (legacy or OF).
> 
> I'm fine with a new API for this stuff.  I'm even happy to go ahead
> and code it up, but it's important to note that this is work which
> should be based on this set and not a blocker for this set to be
> accepted.
>

I didn't mean this should be a blocker and yes can be done as a follow up.
 
>>> .driver_data|.data. attributes.  We can generify the call if you think
>>> that makes things easier, but I don't see a need for it ATM.
>>>
>>
>> As I explained above, it will make easier for drivers but I raised the
>> point to discuss if the table data should be looked up by the driver
>> or if the core should get it and pass to the probe() function as it is
>> made right now for the I2C device ID table. i.e:
>>
>> static int foo_i2c_probe(struct i2c_client *i2c, const void *data)
>>
>> If the correct approach is the former, then this series is the right
>> direction and as you said a generic match function can be added later.
>>
>> But if the correct approach is the latter, then this series is not
>> the right direction and a different approach is needed. I don't have
>> a strong opinion but wanted to mention that we have two options here.
> 
> The correct approach is the former.  One of the aims of this set was
> to bring the I2C .probe() call-back more into line with the majority
> of the other .probe() calls in the kernel i.e. with only a single
> parameter.  I'm really not a fan of passing some random void pointer
> in.  Using a look-up call to fetch ACPI/OF/I2C/etc data is the current
> norm and is a very viable option.
>

Ok, as I said I don't have a strong opinion and you are right that this
set will make I2C to be more aligned with other subsystems (i.e: SPI that
the I2C implementation is very similar to).

> Wolfram, please (finally :D) take this set.
>

Indeed :)

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

  reply	other threads:[~2015-09-24 17:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 11:55 [RESEND PATCH v4 0/8] i2c: Relax mandatory I2C ID table passing Kieran Bingham
2015-09-11 11:55 ` [RESEND PATCH v4 1/8] i2c: Add pointer dereference protection to i2c_match_id() Kieran Bingham
2015-09-11 11:55 ` [RESEND PATCH v4 2/8] i2c: Add the ability to match device to compatible string without an of_node Kieran Bingham
2015-09-11 11:55 ` [RESEND PATCH v4 3/8] i2c: Match using traditional OF methods, then by vendor-less compatible strings Kieran Bingham
2015-09-11 11:56 ` [RESEND PATCH v4 4/8] i2c: Make I2C ID tables non-mandatory for DT'ed devices Kieran Bingham
2015-09-11 11:56 ` [RESEND PATCH v4 5/8] i2c: Export i2c_match_id() for direct use by device drivers Kieran Bingham
2015-09-11 11:56 ` [RESEND PATCH v4 6/8] i2c: Provide a temporary .probe2() call-back type Kieran Bingham
2015-09-11 11:56 ` [RESEND PATCH v4 7/8] mfd: 88pm860x: Move over to new I2C device .probe() call Kieran Bingham
2015-09-11 11:56 ` [RESEND PATCH v4 8/8] mfd: as3722: Rid driver of superfluous I2C device ID structure Kieran Bingham
2015-09-11 16:30 ` [RESEND PATCH v4 0/8] i2c: Relax mandatory I2C ID table passing Lee Jones
2015-09-17 15:46 ` Javier Martinez Canillas
2015-09-20  4:15   ` Lee Jones
2015-09-24  7:38     ` Javier Martinez Canillas
2015-09-24 16:58       ` Lee Jones
2015-09-24 17:32         ` Javier Martinez Canillas [this message]
2015-10-01 20:50         ` Wolfram Sang
2015-10-01 21:10           ` Kieran Bingham
2015-10-02  9:35           ` Lee Jones
2015-10-09 21:16 ` Wolfram Sang
2015-10-12 11:36   ` Kieran Bingham
2016-03-08  4:22     ` Lee Jones
     [not found]       ` <CAB3z_RpyRr5T4W2iLJfA8xiZLuiMgAN=-EN=xgv2RDTNMmOdzg@mail.gmail.com>
2016-03-09  5:30         ` Lee Jones

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=560433B2.6040508@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=grant.likely@linaro.org \
    --cc=kieranbingham@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=wsa@the-dreams.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox