Re: [PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-31 Thread Wolfram Sang
On Wed, Jul 10, 2019 at 10:51:49PM +0100, Kieran Bingham wrote:
> The I2C core framework provides a simplified probe framework from commit
> b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").
> 
> These drivers do not utilise the i2c_device_id table in the probe, so we
> can easily convert them to utilise the simplfied i2c driver
> registration.
> 
> Signed-off-by: Kieran Bingham 
> ---
>  drivers/media/i2c/adv7343.c  | 5 ++---
>  drivers/media/i2c/imx274.c   | 5 ++---
>  drivers/media/i2c/max2175.c  | 5 ++---
>  drivers/media/i2c/mt9m001.c  | 5 ++---
>  drivers/media/i2c/mt9m111.c  | 5 ++---
>  drivers/media/i2c/ov2640.c   | 5 ++---
>  drivers/media/i2c/ov2659.c   | 5 ++---
>  drivers/media/i2c/ov5640.c   | 5 ++---
>  drivers/media/i2c/ov5645.c   | 5 ++---
>  drivers/media/i2c/ov5647.c   | 5 ++---
>  drivers/media/i2c/ov772x.c   | 5 ++---
>  drivers/media/i2c/ov7740.c   | 5 ++---
>  drivers/media/i2c/ov9650.c   | 5 ++---
>  drivers/media/i2c/s5k5baf.c  | 5 ++---
>  drivers/media/i2c/s5k6a3.c   | 5 ++---
>  drivers/media/i2c/tc358743.c | 5 ++---
>  drivers/media/i2c/ths8200.c  | 5 ++---
>  drivers/media/i2c/tvp5150.c  | 5 ++---
>  drivers/media/i2c/tvp7002.c  | 4 ++--

These drivers, I did not review visually but build tested them and
verified they didn't show any build warnings or failures. Glimpsed
through the conversion pattern. Looks all good.

Reviewed-by: Wolfram Sang 



signature.asc
Description: PGP signature


Re: [PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-12 Thread Marco Felsch
Hi Kieran,

On 19-07-11 09:18, Kieran Bingham wrote:
> Hi Marco,
> 
> Thank you for reviewing this topic,
> 
> On 11/07/2019 09:05, Marco Felsch wrote:
> > Hi Kieran,
> > 
> > On 19-07-10 22:51, Kieran Bingham wrote:
> >> The I2C core framework provides a simplified probe framework from commit
> >> b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").
> >>
> >> These drivers do not utilise the i2c_device_id table in the probe, so we
> >> can easily convert them to utilise the simplfied i2c driver
> >> registration.
> >>
> >> Signed-off-by: Kieran Bingham 
> >> ---
> >>  drivers/media/i2c/adv7343.c  | 5 ++---
> >>  drivers/media/i2c/imx274.c   | 5 ++---
> >>  drivers/media/i2c/max2175.c  | 5 ++---
> >>  drivers/media/i2c/mt9m001.c  | 5 ++---
> >>  drivers/media/i2c/mt9m111.c  | 5 ++---
> >>  drivers/media/i2c/ov2640.c   | 5 ++---
> >>  drivers/media/i2c/ov2659.c   | 5 ++---
> >>  drivers/media/i2c/ov5640.c   | 5 ++---
> >>  drivers/media/i2c/ov5645.c   | 5 ++---
> >>  drivers/media/i2c/ov5647.c   | 5 ++---
> >>  drivers/media/i2c/ov772x.c   | 5 ++---
> >>  drivers/media/i2c/ov7740.c   | 5 ++---
> >>  drivers/media/i2c/ov9650.c   | 5 ++---
> >>  drivers/media/i2c/s5k5baf.c  | 5 ++---
> >>  drivers/media/i2c/s5k6a3.c   | 5 ++---
> >>  drivers/media/i2c/tc358743.c | 5 ++---
> >>  drivers/media/i2c/ths8200.c  | 5 ++---
> >>  drivers/media/i2c/tvp5150.c  | 5 ++---
> >>  drivers/media/i2c/tvp7002.c  | 4 ++--
> >>  19 files changed, 38 insertions(+), 56 deletions(-)
> >>
> >> diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
> >> index 4a441ee99dd8..63e94dfcb5d3 100644
> >> --- a/drivers/media/i2c/adv7343.c
> >> +++ b/drivers/media/i2c/adv7343.c
> >> @@ -428,8 +428,7 @@ adv7343_get_pdata(struct i2c_client *client)
> >>return pdata;
> >>  }
> >>  
> >> -static int adv7343_probe(struct i2c_client *client,
> >> -  const struct i2c_device_id *id)
> >> +static int adv7343_probe(struct i2c_client *client)
> >>  {
> >>struct adv7343_state *state;
> >>int err;
> >> @@ -524,7 +523,7 @@ static struct i2c_driver adv7343_driver = {
> >>.of_match_table = of_match_ptr(adv7343_of_match),
> >>.name   = "adv7343",
> >>},
> >> -  .probe  = adv7343_probe,
> >> +  .probe_new  = adv7343_probe,
> >>.remove = adv7343_remove,
> >>.id_table   = adv7343_id,
> > 
> > Can we remove the id_table too if it isn't required anymore? This
> > applies to the other drivers as well.
> 
> I would very much like to (and I have already got patches to do so), but
> I have posted this patch without removing the tables intentionally as I
> am concerned about a topic that Javier brought up with me some time ago.
> 
> With the ID table removed, when the driver is built as a module there is
> no longer a MODULE_DEVICE_TABLE(i2c, ); entry.
> 
> This results in the modpost stage not adding an i2c:xxx alias for each
> module, and thus could adversely affect module auto-loading.
> 
> I have posted an RFC [0], which I referenced in my cover letter:
> 
> [0] [PATCH RFC] modpost: Support I2C Aliases from OF tables
> https://lore.kernel.org/lkml/20190710193918.31135-1-kieran.bingham+rene...@ideasonboard.com/
> 
> In that patch I propose an extension to file2alias which allows the OF
> match table to be registered as I2C specific aliases when referenced
> with an i2c_of specific tag allowing the following changes to be made:
> 
>  /* si4713_i2c_driver - i2c driver interface */
> -static const struct i2c_device_id si4713_id[] = {
> -   { "si4713" , 0 },
> -   { },
> -};
> -MODULE_DEVICE_TABLE(i2c, si4713_id);
> 
>  static const struct of_device_id si4713_of_match[] = {
> { .compatible = "silabs,si4713" },
> { },
>  };
>  MODULE_DEVICE_TABLE(of, si4713_of_match);
> +MODULE_DEVICE_TABLE(i2c_of, si4713_of_match);
> 
> 
> When a module device table is registered with the i2c_of tag, the alias
> is registered in the module as the compatible string with the vendor
> prefixes removed.
> 
> (This matches the i2c-framework functionality at
> i2c_of_match_device_sysfs())

Thanks for the explanation didn't had that in my mind. I will pick the
patch and test it for the tvp5150 in the next week(s).

Regards,
  Marco

> Regards
> 
> Kieran
> 
> > 
> > Regards,
> >   Marco
> > 
> >>  };
> >> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
> >> index f3ff1af209f9..6011cec5e351 100644
> >> --- a/drivers/media/i2c/imx274.c
> >> +++ b/drivers/media/i2c/imx274.c
> >> @@ -1821,8 +1821,7 @@ static const struct i2c_device_id imx274_id[] = {
> >>  };
> >>  MODULE_DEVICE_TABLE(i2c, imx274_id);
> >>  
> >> -static int imx274_probe(struct i2c_client *client,
> >> -  const struct i2c_device_id *id)
> >> +static int imx274_probe(struct i2c_client *client)
> >>  {
> >>struct v4l2_subdev *sd;
> >>struct stimx274 *imx274;
> >> @@ -1984,7 +1983,7 @@ static struct i2c_driver imx274_i2c_driver = {
> 

Re: [PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-12 Thread Andrzej Hajda
On 10.07.2019 23:51, Kieran Bingham wrote:
> The I2C core framework provides a simplified probe framework from commit
> b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").
>
> These drivers do not utilise the i2c_device_id table in the probe, so we
> can easily convert them to utilise the simplfied i2c driver
> registration.
>
> Signed-off-by: Kieran Bingham 


If needed, for S5K5BAF:

Acked-by: Andrzej Hajda 

 --
Regards
Andrzej


> ---
>  drivers/media/i2c/adv7343.c  | 5 ++---
>  drivers/media/i2c/imx274.c   | 5 ++---
>  drivers/media/i2c/max2175.c  | 5 ++---
>  drivers/media/i2c/mt9m001.c  | 5 ++---
>  drivers/media/i2c/mt9m111.c  | 5 ++---
>  drivers/media/i2c/ov2640.c   | 5 ++---
>  drivers/media/i2c/ov2659.c   | 5 ++---
>  drivers/media/i2c/ov5640.c   | 5 ++---
>  drivers/media/i2c/ov5645.c   | 5 ++---
>  drivers/media/i2c/ov5647.c   | 5 ++---
>  drivers/media/i2c/ov772x.c   | 5 ++---
>  drivers/media/i2c/ov7740.c   | 5 ++---
>  drivers/media/i2c/ov9650.c   | 5 ++---
>  drivers/media/i2c/s5k5baf.c  | 5 ++---
>  drivers/media/i2c/s5k6a3.c   | 5 ++---
>  drivers/media/i2c/tc358743.c | 5 ++---
>  drivers/media/i2c/ths8200.c  | 5 ++---
>  drivers/media/i2c/tvp5150.c  | 5 ++---
>  drivers/media/i2c/tvp7002.c  | 4 ++--
>  19 files changed, 38 insertions(+), 56 deletions(-)
>
> diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
> index 4a441ee99dd8..63e94dfcb5d3 100644
> --- a/drivers/media/i2c/adv7343.c
> +++ b/drivers/media/i2c/adv7343.c
> @@ -428,8 +428,7 @@ adv7343_get_pdata(struct i2c_client *client)
>   return pdata;
>  }
>  
> -static int adv7343_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int adv7343_probe(struct i2c_client *client)
>  {
>   struct adv7343_state *state;
>   int err;
> @@ -524,7 +523,7 @@ static struct i2c_driver adv7343_driver = {
>   .of_match_table = of_match_ptr(adv7343_of_match),
>   .name   = "adv7343",
>   },
> - .probe  = adv7343_probe,
> + .probe_new  = adv7343_probe,
>   .remove = adv7343_remove,
>   .id_table   = adv7343_id,
>  };
> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
> index f3ff1af209f9..6011cec5e351 100644
> --- a/drivers/media/i2c/imx274.c
> +++ b/drivers/media/i2c/imx274.c
> @@ -1821,8 +1821,7 @@ static const struct i2c_device_id imx274_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, imx274_id);
>  
> -static int imx274_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int imx274_probe(struct i2c_client *client)
>  {
>   struct v4l2_subdev *sd;
>   struct stimx274 *imx274;
> @@ -1984,7 +1983,7 @@ static struct i2c_driver imx274_i2c_driver = {
>   .name   = DRIVER_NAME,
>   .of_match_table = imx274_of_id_table,
>   },
> - .probe  = imx274_probe,
> + .probe_new  = imx274_probe,
>   .remove = imx274_remove,
>   .id_table   = imx274_id,
>  };
> diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
> index 7b226fadcdb8..19a3ceea3bc2 100644
> --- a/drivers/media/i2c/max2175.c
> +++ b/drivers/media/i2c/max2175.c
> @@ -1271,8 +1271,7 @@ static int max2175_refout_load_to_bits(struct 
> i2c_client *client, u32 load,
>   return 0;
>  }
>  
> -static int max2175_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int max2175_probe(struct i2c_client *client)
>  {
>   bool master = true, am_hiz = false;
>   u32 refout_load, refout_bits = 0;   /* REFOUT disabled */
> @@ -1433,7 +1432,7 @@ static struct i2c_driver max2175_driver = {
>   .name   = DRIVER_NAME,
>   .of_match_table = max2175_of_ids,
>   },
> - .probe  = max2175_probe,
> + .probe_new  = max2175_probe,
>   .remove = max2175_remove,
>   .id_table   = max2175_id,
>  };
> diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c
> index 2df743cbe09d..5613072908ac 100644
> --- a/drivers/media/i2c/mt9m001.c
> +++ b/drivers/media/i2c/mt9m001.c
> @@ -726,8 +726,7 @@ static const struct v4l2_subdev_ops mt9m001_subdev_ops = {
>   .pad= _subdev_pad_ops,
>  };
>  
> -static int mt9m001_probe(struct i2c_client *client,
> -  const struct i2c_device_id *did)
> +static int mt9m001_probe(struct i2c_client *client)
>  {
>   struct mt9m001 *mt9m001;
>   struct i2c_adapter *adapter = client->adapter;
> @@ -872,7 +871,7 @@ static struct i2c_driver mt9m001_i2c_driver = {
>   .pm = _pm_ops,
>   .of_match_table = mt9m001_of_match,
>   },
> - .probe  = mt9m001_probe,
> + .probe_new  = mt9m001_probe,
>   .remove = mt9m001_remove,
>   .id_table   = mt9m001_id,
>  };
> diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> index 

Re: [PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-11 Thread Kieran Bingham
Hi Marco,

Thank you for reviewing this topic,

On 11/07/2019 09:05, Marco Felsch wrote:
> Hi Kieran,
> 
> On 19-07-10 22:51, Kieran Bingham wrote:
>> The I2C core framework provides a simplified probe framework from commit
>> b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").
>>
>> These drivers do not utilise the i2c_device_id table in the probe, so we
>> can easily convert them to utilise the simplfied i2c driver
>> registration.
>>
>> Signed-off-by: Kieran Bingham 
>> ---
>>  drivers/media/i2c/adv7343.c  | 5 ++---
>>  drivers/media/i2c/imx274.c   | 5 ++---
>>  drivers/media/i2c/max2175.c  | 5 ++---
>>  drivers/media/i2c/mt9m001.c  | 5 ++---
>>  drivers/media/i2c/mt9m111.c  | 5 ++---
>>  drivers/media/i2c/ov2640.c   | 5 ++---
>>  drivers/media/i2c/ov2659.c   | 5 ++---
>>  drivers/media/i2c/ov5640.c   | 5 ++---
>>  drivers/media/i2c/ov5645.c   | 5 ++---
>>  drivers/media/i2c/ov5647.c   | 5 ++---
>>  drivers/media/i2c/ov772x.c   | 5 ++---
>>  drivers/media/i2c/ov7740.c   | 5 ++---
>>  drivers/media/i2c/ov9650.c   | 5 ++---
>>  drivers/media/i2c/s5k5baf.c  | 5 ++---
>>  drivers/media/i2c/s5k6a3.c   | 5 ++---
>>  drivers/media/i2c/tc358743.c | 5 ++---
>>  drivers/media/i2c/ths8200.c  | 5 ++---
>>  drivers/media/i2c/tvp5150.c  | 5 ++---
>>  drivers/media/i2c/tvp7002.c  | 4 ++--
>>  19 files changed, 38 insertions(+), 56 deletions(-)
>>
>> diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
>> index 4a441ee99dd8..63e94dfcb5d3 100644
>> --- a/drivers/media/i2c/adv7343.c
>> +++ b/drivers/media/i2c/adv7343.c
>> @@ -428,8 +428,7 @@ adv7343_get_pdata(struct i2c_client *client)
>>  return pdata;
>>  }
>>  
>> -static int adv7343_probe(struct i2c_client *client,
>> -const struct i2c_device_id *id)
>> +static int adv7343_probe(struct i2c_client *client)
>>  {
>>  struct adv7343_state *state;
>>  int err;
>> @@ -524,7 +523,7 @@ static struct i2c_driver adv7343_driver = {
>>  .of_match_table = of_match_ptr(adv7343_of_match),
>>  .name   = "adv7343",
>>  },
>> -.probe  = adv7343_probe,
>> +.probe_new  = adv7343_probe,
>>  .remove = adv7343_remove,
>>  .id_table   = adv7343_id,
> 
> Can we remove the id_table too if it isn't required anymore? This
> applies to the other drivers as well.

I would very much like to (and I have already got patches to do so), but
I have posted this patch without removing the tables intentionally as I
am concerned about a topic that Javier brought up with me some time ago.

With the ID table removed, when the driver is built as a module there is
no longer a MODULE_DEVICE_TABLE(i2c, ); entry.

This results in the modpost stage not adding an i2c:xxx alias for each
module, and thus could adversely affect module auto-loading.

I have posted an RFC [0], which I referenced in my cover letter:

[0] [PATCH RFC] modpost: Support I2C Aliases from OF tables
https://lore.kernel.org/lkml/20190710193918.31135-1-kieran.bingham+rene...@ideasonboard.com/

In that patch I propose an extension to file2alias which allows the OF
match table to be registered as I2C specific aliases when referenced
with an i2c_of specific tag allowing the following changes to be made:

 /* si4713_i2c_driver - i2c driver interface */
-static const struct i2c_device_id si4713_id[] = {
-   { "si4713" , 0 },
-   { },
-};
-MODULE_DEVICE_TABLE(i2c, si4713_id);

 static const struct of_device_id si4713_of_match[] = {
{ .compatible = "silabs,si4713" },
{ },
 };
 MODULE_DEVICE_TABLE(of, si4713_of_match);
+MODULE_DEVICE_TABLE(i2c_of, si4713_of_match);


When a module device table is registered with the i2c_of tag, the alias
is registered in the module as the compatible string with the vendor
prefixes removed.

(This matches the i2c-framework functionality at
i2c_of_match_device_sysfs())

Regards

Kieran

> 
> Regards,
>   Marco
> 
>>  };
>> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
>> index f3ff1af209f9..6011cec5e351 100644
>> --- a/drivers/media/i2c/imx274.c
>> +++ b/drivers/media/i2c/imx274.c
>> @@ -1821,8 +1821,7 @@ static const struct i2c_device_id imx274_id[] = {
>>  };
>>  MODULE_DEVICE_TABLE(i2c, imx274_id);
>>  
>> -static int imx274_probe(struct i2c_client *client,
>> -const struct i2c_device_id *id)
>> +static int imx274_probe(struct i2c_client *client)
>>  {
>>  struct v4l2_subdev *sd;
>>  struct stimx274 *imx274;
>> @@ -1984,7 +1983,7 @@ static struct i2c_driver imx274_i2c_driver = {
>>  .name   = DRIVER_NAME,
>>  .of_match_table = imx274_of_id_table,
>>  },
>> -.probe  = imx274_probe,
>> +.probe_new  = imx274_probe,
>>  .remove = imx274_remove,
>>  .id_table   = imx274_id,
>>  };
>> diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
>> index 7b226fadcdb8..19a3ceea3bc2 100644
>> --- a/drivers/media/i2c/max2175.c
>> 

Re: [PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-11 Thread Marco Felsch
Hi Kieran,

On 19-07-10 22:51, Kieran Bingham wrote:
> The I2C core framework provides a simplified probe framework from commit
> b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").
> 
> These drivers do not utilise the i2c_device_id table in the probe, so we
> can easily convert them to utilise the simplfied i2c driver
> registration.
> 
> Signed-off-by: Kieran Bingham 
> ---
>  drivers/media/i2c/adv7343.c  | 5 ++---
>  drivers/media/i2c/imx274.c   | 5 ++---
>  drivers/media/i2c/max2175.c  | 5 ++---
>  drivers/media/i2c/mt9m001.c  | 5 ++---
>  drivers/media/i2c/mt9m111.c  | 5 ++---
>  drivers/media/i2c/ov2640.c   | 5 ++---
>  drivers/media/i2c/ov2659.c   | 5 ++---
>  drivers/media/i2c/ov5640.c   | 5 ++---
>  drivers/media/i2c/ov5645.c   | 5 ++---
>  drivers/media/i2c/ov5647.c   | 5 ++---
>  drivers/media/i2c/ov772x.c   | 5 ++---
>  drivers/media/i2c/ov7740.c   | 5 ++---
>  drivers/media/i2c/ov9650.c   | 5 ++---
>  drivers/media/i2c/s5k5baf.c  | 5 ++---
>  drivers/media/i2c/s5k6a3.c   | 5 ++---
>  drivers/media/i2c/tc358743.c | 5 ++---
>  drivers/media/i2c/ths8200.c  | 5 ++---
>  drivers/media/i2c/tvp5150.c  | 5 ++---
>  drivers/media/i2c/tvp7002.c  | 4 ++--
>  19 files changed, 38 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
> index 4a441ee99dd8..63e94dfcb5d3 100644
> --- a/drivers/media/i2c/adv7343.c
> +++ b/drivers/media/i2c/adv7343.c
> @@ -428,8 +428,7 @@ adv7343_get_pdata(struct i2c_client *client)
>   return pdata;
>  }
>  
> -static int adv7343_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int adv7343_probe(struct i2c_client *client)
>  {
>   struct adv7343_state *state;
>   int err;
> @@ -524,7 +523,7 @@ static struct i2c_driver adv7343_driver = {
>   .of_match_table = of_match_ptr(adv7343_of_match),
>   .name   = "adv7343",
>   },
> - .probe  = adv7343_probe,
> + .probe_new  = adv7343_probe,
>   .remove = adv7343_remove,
>   .id_table   = adv7343_id,

Can we remove the id_table too if it isn't required anymore? This
applies to the other drivers as well.

Regards,
  Marco

>  };
> diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
> index f3ff1af209f9..6011cec5e351 100644
> --- a/drivers/media/i2c/imx274.c
> +++ b/drivers/media/i2c/imx274.c
> @@ -1821,8 +1821,7 @@ static const struct i2c_device_id imx274_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, imx274_id);
>  
> -static int imx274_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int imx274_probe(struct i2c_client *client)
>  {
>   struct v4l2_subdev *sd;
>   struct stimx274 *imx274;
> @@ -1984,7 +1983,7 @@ static struct i2c_driver imx274_i2c_driver = {
>   .name   = DRIVER_NAME,
>   .of_match_table = imx274_of_id_table,
>   },
> - .probe  = imx274_probe,
> + .probe_new  = imx274_probe,
>   .remove = imx274_remove,
>   .id_table   = imx274_id,
>  };
> diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
> index 7b226fadcdb8..19a3ceea3bc2 100644
> --- a/drivers/media/i2c/max2175.c
> +++ b/drivers/media/i2c/max2175.c
> @@ -1271,8 +1271,7 @@ static int max2175_refout_load_to_bits(struct 
> i2c_client *client, u32 load,
>   return 0;
>  }
>  
> -static int max2175_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> +static int max2175_probe(struct i2c_client *client)
>  {
>   bool master = true, am_hiz = false;
>   u32 refout_load, refout_bits = 0;   /* REFOUT disabled */
> @@ -1433,7 +1432,7 @@ static struct i2c_driver max2175_driver = {
>   .name   = DRIVER_NAME,
>   .of_match_table = max2175_of_ids,
>   },
> - .probe  = max2175_probe,
> + .probe_new  = max2175_probe,
>   .remove = max2175_remove,
>   .id_table   = max2175_id,
>  };
> diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c
> index 2df743cbe09d..5613072908ac 100644
> --- a/drivers/media/i2c/mt9m001.c
> +++ b/drivers/media/i2c/mt9m001.c
> @@ -726,8 +726,7 @@ static const struct v4l2_subdev_ops mt9m001_subdev_ops = {
>   .pad= _subdev_pad_ops,
>  };
>  
> -static int mt9m001_probe(struct i2c_client *client,
> -  const struct i2c_device_id *did)
> +static int mt9m001_probe(struct i2c_client *client)
>  {
>   struct mt9m001 *mt9m001;
>   struct i2c_adapter *adapter = client->adapter;
> @@ -872,7 +871,7 @@ static struct i2c_driver mt9m001_i2c_driver = {
>   .pm = _pm_ops,
>   .of_match_table = mt9m001_of_match,
>   },
> - .probe  = mt9m001_probe,
> + .probe_new  = mt9m001_probe,
>   .remove = mt9m001_remove,
>   .id_table   = mt9m001_id,
>  };
> diff --git 

[PATCH 6/6] media: i2c: Convert to new i2c device probe()

2019-07-10 Thread Kieran Bingham
The I2C core framework provides a simplified probe framework from commit
b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type").

These drivers do not utilise the i2c_device_id table in the probe, so we
can easily convert them to utilise the simplfied i2c driver
registration.

Signed-off-by: Kieran Bingham 
---
 drivers/media/i2c/adv7343.c  | 5 ++---
 drivers/media/i2c/imx274.c   | 5 ++---
 drivers/media/i2c/max2175.c  | 5 ++---
 drivers/media/i2c/mt9m001.c  | 5 ++---
 drivers/media/i2c/mt9m111.c  | 5 ++---
 drivers/media/i2c/ov2640.c   | 5 ++---
 drivers/media/i2c/ov2659.c   | 5 ++---
 drivers/media/i2c/ov5640.c   | 5 ++---
 drivers/media/i2c/ov5645.c   | 5 ++---
 drivers/media/i2c/ov5647.c   | 5 ++---
 drivers/media/i2c/ov772x.c   | 5 ++---
 drivers/media/i2c/ov7740.c   | 5 ++---
 drivers/media/i2c/ov9650.c   | 5 ++---
 drivers/media/i2c/s5k5baf.c  | 5 ++---
 drivers/media/i2c/s5k6a3.c   | 5 ++---
 drivers/media/i2c/tc358743.c | 5 ++---
 drivers/media/i2c/ths8200.c  | 5 ++---
 drivers/media/i2c/tvp5150.c  | 5 ++---
 drivers/media/i2c/tvp7002.c  | 4 ++--
 19 files changed, 38 insertions(+), 56 deletions(-)

diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index 4a441ee99dd8..63e94dfcb5d3 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -428,8 +428,7 @@ adv7343_get_pdata(struct i2c_client *client)
return pdata;
 }
 
-static int adv7343_probe(struct i2c_client *client,
-   const struct i2c_device_id *id)
+static int adv7343_probe(struct i2c_client *client)
 {
struct adv7343_state *state;
int err;
@@ -524,7 +523,7 @@ static struct i2c_driver adv7343_driver = {
.of_match_table = of_match_ptr(adv7343_of_match),
.name   = "adv7343",
},
-   .probe  = adv7343_probe,
+   .probe_new  = adv7343_probe,
.remove = adv7343_remove,
.id_table   = adv7343_id,
 };
diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c
index f3ff1af209f9..6011cec5e351 100644
--- a/drivers/media/i2c/imx274.c
+++ b/drivers/media/i2c/imx274.c
@@ -1821,8 +1821,7 @@ static const struct i2c_device_id imx274_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, imx274_id);
 
-static int imx274_probe(struct i2c_client *client,
-   const struct i2c_device_id *id)
+static int imx274_probe(struct i2c_client *client)
 {
struct v4l2_subdev *sd;
struct stimx274 *imx274;
@@ -1984,7 +1983,7 @@ static struct i2c_driver imx274_i2c_driver = {
.name   = DRIVER_NAME,
.of_match_table = imx274_of_id_table,
},
-   .probe  = imx274_probe,
+   .probe_new  = imx274_probe,
.remove = imx274_remove,
.id_table   = imx274_id,
 };
diff --git a/drivers/media/i2c/max2175.c b/drivers/media/i2c/max2175.c
index 7b226fadcdb8..19a3ceea3bc2 100644
--- a/drivers/media/i2c/max2175.c
+++ b/drivers/media/i2c/max2175.c
@@ -1271,8 +1271,7 @@ static int max2175_refout_load_to_bits(struct i2c_client 
*client, u32 load,
return 0;
 }
 
-static int max2175_probe(struct i2c_client *client,
-   const struct i2c_device_id *id)
+static int max2175_probe(struct i2c_client *client)
 {
bool master = true, am_hiz = false;
u32 refout_load, refout_bits = 0;   /* REFOUT disabled */
@@ -1433,7 +1432,7 @@ static struct i2c_driver max2175_driver = {
.name   = DRIVER_NAME,
.of_match_table = max2175_of_ids,
},
-   .probe  = max2175_probe,
+   .probe_new  = max2175_probe,
.remove = max2175_remove,
.id_table   = max2175_id,
 };
diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c
index 2df743cbe09d..5613072908ac 100644
--- a/drivers/media/i2c/mt9m001.c
+++ b/drivers/media/i2c/mt9m001.c
@@ -726,8 +726,7 @@ static const struct v4l2_subdev_ops mt9m001_subdev_ops = {
.pad= _subdev_pad_ops,
 };
 
-static int mt9m001_probe(struct i2c_client *client,
-const struct i2c_device_id *did)
+static int mt9m001_probe(struct i2c_client *client)
 {
struct mt9m001 *mt9m001;
struct i2c_adapter *adapter = client->adapter;
@@ -872,7 +871,7 @@ static struct i2c_driver mt9m001_i2c_driver = {
.pm = _pm_ops,
.of_match_table = mt9m001_of_match,
},
-   .probe  = mt9m001_probe,
+   .probe_new  = mt9m001_probe,
.remove = mt9m001_remove,
.id_table   = mt9m001_id,
 };
diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index d10fe3712036..b5fa60068850 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -1246,8 +1246,7 @@ static int mt9m111_probe_fw(struct i2c_client *client, 
struct mt9m111 *mt9m111)
return ret;
 }
 
-static int mt9m111_probe(struct i2c_client *client,
-