devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prabhakar Lad <prabhakar.csengg@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: LMML <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	DLOS <davinci-linux-open-source@linux.davincidsp.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>,
	devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH RFC v3] media: i2c: mt9p031: add OF support
Date: Tue, 7 May 2013 15:10:36 +0530	[thread overview]
Message-ID: <CA+V-a8tXZrh68_T=VAOTB23sFfOCOA+GafueWuH6cFFmKz7cvA@mail.gmail.com> (raw)
In-Reply-To: <CA+V-a8vxhedos6cQbxAbMAwiXOmjrqh0TVp8Rhc_Ou4y9tSaoQ@mail.gmail.com>

Hi Arnd,

On Mon, May 6, 2013 at 8:29 PM, Prabhakar Lad
<prabhakar.csengg@gmail.com> wrote:
> Hi Arnd,
>
> On Fri, May 3, 2013 at 8:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Friday 03 May 2013, Prabhakar Lad wrote:
>>>
> [snip]
>>> +}
>>
>> Ok, good.
>>
>>> @@ -955,7 +998,17 @@ static int mt9p031_probe(struct i2c_client *client,
>>>         mt9p031->pdata = pdata;
>>>         mt9p031->output_control = MT9P031_OUTPUT_CONTROL_DEF;
>>>         mt9p031->mode2 = MT9P031_READ_MODE_2_ROW_BLC;
>>> -       mt9p031->model = did->driver_data;
>>> +
>>> +       if (!client->dev.of_node) {
>>> +               mt9p031->model = (enum mt9p031_model)did->driver_data;
>>> +       } else {
>>> +               const struct of_device_id *of_id;
>>> +
>>> +               of_id = of_match_device(of_match_ptr(mt9p031_of_match),
>>> +                                       &client->dev);
>>> +               if (of_id)
>>> +                       mt9p031->model = (enum mt9p031_model)of_id->data;
>>> +       }
>>>         mt9p031->reset = -1;
>>
>> Is this actually required? I thought the i2c core just compared the
>> part of the "compatible" value after the first comma to the string, so
>> "mt9p031->model = (enum mt9p031_model)did->driver_data" should work
>> in both cases.
>>
> I am OK with "mt9p031->model = (enum mt9p031_model)did->driver_data"
> but I see still few drivers doing this, I am not sure for what reason.
> If everyone is
> OK with it I can drop the above change.
>
My bad, while booting with DT the i2c_device_id ie did in this case
will be NULL,
so the above changes are required :-)

Regards,
--Prabhakar Lad

  reply	other threads:[~2013-05-07  9:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  6:51 [PATCH RFC v3] media: i2c: mt9p031: add OF support Prabhakar Lad
     [not found] ` <1367563919-2880-1-git-send-email-prabhakar.csengg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-03 14:34   ` Arnd Bergmann
2013-05-06 14:59     ` Prabhakar Lad
2013-05-07  9:40       ` Prabhakar Lad [this message]
2013-05-08  2:02         ` Laurent Pinchart
2013-05-08  4:49           ` Prabhakar Lad
2013-05-08 10:37             ` Laurent Pinchart
2013-05-08 12:43               ` Prabhakar Lad
2013-05-13 10:46               ` Sascha Hauer
2013-05-13 22:59                 ` Laurent Pinchart
2013-05-14  5:13                   ` Sascha Hauer
2013-05-08  2:01 ` Laurent Pinchart
2013-05-08  4:47   ` Prabhakar Lad

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='CA+V-a8tXZrh68_T=VAOTB23sFfOCOA+GafueWuH6cFFmKz7cvA@mail.gmail.com' \
    --to=prabhakar.csengg@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=grant.likely@secretlab.ca \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=s.hauer@pengutronix.de \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@iki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).