lkml.org 
[lkml]   [2013]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH RFC v3] media: i2c: mt9p031: add OF support
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


\
 
 \ /
  Last update: 2013-05-07 12:21    [W:0.075 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site