diff mbox series

[04/12] i2c: ocores: convert to use i2c_new_client_device()

Message ID 20200107174748.9616-5-wsa+renesas@sang-engineering.com
State Accepted
Headers show
Series i2c: convert subsystem to use i2c_new_client_device() | expand

Commit Message

Wolfram Sang Jan. 7, 2020, 5:47 p.m. UTC
Move away from the deprecated API and return the shiny new ERRPTR where
useful.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only.

 drivers/i2c/busses/i2c-ocores.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Korsgaard Jan. 7, 2020, 6:32 p.m. UTC | #1
>>>>> "Wolfram" == Wolfram Sang <wsa+renesas@sang-engineering.com> writes:

 > Move away from the deprecated API and return the shiny new ERRPTR where
 > useful.

 > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

I didn't follow the discussion, but I don't see any returns anywhere?

 > ---
 > Build tested only.

 >  drivers/i2c/busses/i2c-ocores.c | 2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
 > index ca8b3ecfa93d..f5fc75b65a19 100644
 > --- a/drivers/i2c/busses/i2c-ocores.c
 > +++ b/drivers/i2c/busses/i2c-ocores.c
 > @@ -731,7 +731,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 >  	/* add in known devices to the bus */
 >  	if (pdata) {
 >  		for (i = 0; i < pdata->num_devices; i++)
 > -			i2c_new_device(&i2c->adap, pdata->devices + i);
 > +			i2c_new_client_device(&i2c->adap, pdata->devices + i);
 >  	}
 
 >  	return 0;
 > -- 
 > 2.20.1
Wolfram Sang Jan. 7, 2020, 7:31 p.m. UTC | #2
Hi Peter,

a happy new year to you!

>  > Move away from the deprecated API and return the shiny new ERRPTR where
>  > useful.
> 
>  > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> I didn't follow the discussion, but I don't see any returns anywhere?

Yeah, an ERRPTR is not "useful" here. However, the old API is going to
be removed, so your driver is converted, too.

Happy hacking,

   Wolfram
Andrew Lunn Jan. 7, 2020, 7:36 p.m. UTC | #3
On Tue, Jan 07, 2020 at 07:32:50PM +0100, Peter Korsgaard wrote:
> >>>>> "Wolfram" == Wolfram Sang <wsa+renesas@sang-engineering.com> writes:
> 
>  > Move away from the deprecated API and return the shiny new ERRPTR where
>  > useful.
> 
>  > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> I didn't follow the discussion, but I don't see any returns anywhere?

Hi Peter

I have also not been following the discussion. But i2c_new_device()
seems to of always returned a NULL pointer on error, and the code has
been ignoring it. The 'where useful' comment suggests the return value
maybe checked, but it is optional to check it.  So this patch seems
O.K.

I suppose the commit message could be extended with:

In this case, the shiny new stuff is not useful, so ignore it.

But:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Peter Korsgaard Jan. 7, 2020, 7:58 p.m. UTC | #4
>>>>> "Wolfram" == Wolfram Sang <wsa@the-dreams.de> writes:

 > Hi Peter,
 > a happy new year to you!

thanks, You too!

 >> > Move away from the deprecated API and return the shiny new ERRPTR where
 >> > useful.
 >> 
 >> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
 >> 
 >> I didn't follow the discussion, but I don't see any returns anywhere?

 > Yeah, an ERRPTR is not "useful" here. However, the old API is going to
 > be removed, so your driver is converted, too.

Ok, great.

Reviewed-by: Peter Korsgaard <peter@korsgaard.com>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index ca8b3ecfa93d..f5fc75b65a19 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -731,7 +731,7 @@  static int ocores_i2c_probe(struct platform_device *pdev)
 	/* add in known devices to the bus */
 	if (pdata) {
 		for (i = 0; i < pdata->num_devices; i++)
-			i2c_new_device(&i2c->adap, pdata->devices + i);
+			i2c_new_client_device(&i2c->adap, pdata->devices + i);
 	}
 
 	return 0;