[109/606] iio: imu: inv_mpu6050: Convert to i2c's .probe_new()

Message ID 20221118224540.619276-110-uwe@kleine-koenig.org
State New
Headers
Series i2c: Complete conversion to i2c_probe_new |

Commit Message

Uwe Kleine-König Nov. 18, 2022, 10:37 p.m. UTC
  From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jean-Baptiste Maneyrol Nov. 22, 2022, 10:06 a.m. UTC | #1
Hello,

looks good, thanks for the patch.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>

Best regards,
JB


From: Uwe Kleine-König <uwe@kleine-koenig.org>
Sent: Friday, November 18, 2022 23:37
To: Angel Iglesias <ang.iglesiasg@gmail.com>; Lee Jones <lee.jones@linaro.org>; Grant Likely <grant.likely@linaro.org>; Wolfram Sang <wsa@kernel.org>; Jonathan Cameron <jic23@kernel.org>; Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; Hans Verkuil <hverkuil-cisco@xs4all.nl>; Michael Srba <Michael.Srba@seznam.cz>
Cc: linux-i2c@vger.kernel.org <linux-i2c@vger.kernel.org>; kernel@pengutronix.de <kernel@pengutronix.de>; Uwe Kleine-König <u.kleine-koenig@pengutronix.de>; Lars-Peter Clausen <lars@metafoo.de>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: [PATCH 109/606] iio: imu: inv_mpu6050: Convert to i2c's .probe_new() 
 
[CAUTION] This is an EXTERNAL email. Do not click links or open attachments unless you recognize the sender and know the content is safe.

======================================================================
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 7a8d60a5afa9..70eaa408e388 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -95,9 +95,9 @@ static int inv_mpu_i2c_aux_setup(struct iio_dev *indio_dev)
  *
  *  Returns 0 on success, a negative error code otherwise.
  */
-static int inv_mpu_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int inv_mpu_probe(struct i2c_client *client)
 {
+       const struct i2c_device_id *id = i2c_client_get_device_id(client);
         const void *match;
         struct inv_mpu6050_state *st;
         int result;
@@ -260,7 +260,7 @@ static const struct acpi_device_id inv_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, inv_acpi_match);
 
 static struct i2c_driver inv_mpu_driver = {
-       .probe          =       inv_mpu_probe,
+       .probe_new      =       inv_mpu_probe,
         .remove         =       inv_mpu_remove,
         .id_table       =       inv_mpu_id,
         .driver = {
  
Jonathan Cameron Nov. 23, 2022, 8:21 p.m. UTC | #2
On Fri, 18 Nov 2022 23:37:23 +0100
Uwe Kleine-König <uwe@kleine-koenig.org> wrote:

> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> .probe_new() doesn't get the i2c_device_id * parameter, so determine
> that explicitly in the probe function.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> index 7a8d60a5afa9..70eaa408e388 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> @@ -95,9 +95,9 @@ static int inv_mpu_i2c_aux_setup(struct iio_dev *indio_dev)
>   *
Kernel-doc (no idea why it needs it for a probe function) has
id documented.  I've fixed up dropping that.

Jonathan

>   *  Returns 0 on success, a negative error code otherwise.
>   */
> -static int inv_mpu_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int inv_mpu_probe(struct i2c_client *client)
>  {
> +	const struct i2c_device_id *id = i2c_client_get_device_id(client);
>  	const void *match;
>  	struct inv_mpu6050_state *st;
>  	int result;
> @@ -260,7 +260,7 @@ static const struct acpi_device_id inv_acpi_match[] = {
>  MODULE_DEVICE_TABLE(acpi, inv_acpi_match);
>  
>  static struct i2c_driver inv_mpu_driver = {
> -	.probe		=	inv_mpu_probe,
> +	.probe_new	=	inv_mpu_probe,
>  	.remove		=	inv_mpu_remove,
>  	.id_table	=	inv_mpu_id,
>  	.driver = {
  

Patch

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 7a8d60a5afa9..70eaa408e388 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -95,9 +95,9 @@  static int inv_mpu_i2c_aux_setup(struct iio_dev *indio_dev)
  *
  *  Returns 0 on success, a negative error code otherwise.
  */
-static int inv_mpu_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int inv_mpu_probe(struct i2c_client *client)
 {
+	const struct i2c_device_id *id = i2c_client_get_device_id(client);
 	const void *match;
 	struct inv_mpu6050_state *st;
 	int result;
@@ -260,7 +260,7 @@  static const struct acpi_device_id inv_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, inv_acpi_match);
 
 static struct i2c_driver inv_mpu_driver = {
-	.probe		=	inv_mpu_probe,
+	.probe_new	=	inv_mpu_probe,
 	.remove		=	inv_mpu_remove,
 	.id_table	=	inv_mpu_id,
 	.driver = {