All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] char: convert to use new I2C API
@ 2020-03-26 21:09 Wolfram Sang
  2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-kernel, openipmi-developer

We are deprecating calls which return NULL in favor of new variants which
return an ERR_PTR. Only build tested.


Wolfram Sang (1):
  char: ipmi: convert to use i2c_new_client_device()

 drivers/char/ipmi/ipmi_ssif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-03-26 21:09 [PATCH 0/1] char: convert to use new I2C API Wolfram Sang
@ 2020-03-26 21:09 ` Wolfram Sang
  2020-05-12 16:30   ` Wolfram Sang
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Wolfram Sang @ 2020-03-26 21:09 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Corey Minyard, Arnd Bergmann, Greg Kroah-Hartman,
	openipmi-developer, linux-kernel

Move away from the deprecated API.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/char/ipmi/ipmi_ssif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 8ac390c2b514..2791b799e33d 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1945,8 +1945,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
 	if (adev->type != &i2c_adapter_type)
 		return 0;
 
-	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
-						 &addr_info->binfo);
+	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
+							&addr_info->binfo);
 
 	if (!addr_info->adapter_name)
 		return 1; /* Only try the first I2C adapter by default. */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
@ 2020-05-12 16:30   ` Wolfram Sang
  2020-05-12 18:25   ` Corey Minyard
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2020-05-12 16:30 UTC (permalink / raw)
  To: linux-i2c
  Cc: Corey Minyard, Arnd Bergmann, Greg Kroah-Hartman,
	openipmi-developer, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]

On Thu, Mar 26, 2020 at 10:09:58PM +0100, Wolfram Sang wrote:
> Move away from the deprecated API.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Can we have this now so I can remove the old API in the next merge
window?

> ---
>  drivers/char/ipmi/ipmi_ssif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index 8ac390c2b514..2791b799e33d 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1945,8 +1945,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
>  	if (adev->type != &i2c_adapter_type)
>  		return 0;
>  
> -	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
> -						 &addr_info->binfo);
> +	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
> +							&addr_info->binfo);
>  
>  	if (!addr_info->adapter_name)
>  		return 1; /* Only try the first I2C adapter by default. */
> -- 
> 2.20.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
  2020-05-12 16:30   ` Wolfram Sang
@ 2020-05-12 18:25   ` Corey Minyard
  2020-05-12 20:07     ` Wolfram Sang
  2020-05-12 21:14   ` Corey Minyard
  2020-05-12 21:45   ` [PATCH] " minyard
  3 siblings, 1 reply; 11+ messages in thread
From: Corey Minyard @ 2020-05-12 18:25 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

On Thu, Mar 26, 2020 at 10:09:58PM +0100, Wolfram Sang wrote:
> Move away from the deprecated API.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ok by me.

Acked-by: Corey Minyard <cminyard@mvista.com>

Do you want me to take this, or is this part of something else?  I can
submit it if you like.

-corey

> ---
>  drivers/char/ipmi/ipmi_ssif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index 8ac390c2b514..2791b799e33d 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1945,8 +1945,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
>  	if (adev->type != &i2c_adapter_type)
>  		return 0;
>  
> -	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
> -						 &addr_info->binfo);
> +	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
> +							&addr_info->binfo);
>  
>  	if (!addr_info->adapter_name)
>  		return 1; /* Only try the first I2C adapter by default. */
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-05-12 18:25   ` Corey Minyard
@ 2020-05-12 20:07     ` Wolfram Sang
  0 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2020-05-12 20:07 UTC (permalink / raw)
  To: Corey Minyard
  Cc: linux-i2c, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

On Tue, May 12, 2020 at 01:25:17PM -0500, Corey Minyard wrote:
> On Thu, Mar 26, 2020 at 10:09:58PM +0100, Wolfram Sang wrote:
> > Move away from the deprecated API.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Ok by me.
> 
> Acked-by: Corey Minyard <cminyard@mvista.com>
> 
> Do you want me to take this, or is this part of something else?  I can
> submit it if you like.

I'd prefer if you take it. But I can take it if it is easier for you.

Thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
  2020-05-12 16:30   ` Wolfram Sang
  2020-05-12 18:25   ` Corey Minyard
@ 2020-05-12 21:14   ` Corey Minyard
  2020-05-13  7:10     ` Wolfram Sang
  2020-05-12 21:45   ` [PATCH] " minyard
  3 siblings, 1 reply; 11+ messages in thread
From: Corey Minyard @ 2020-05-12 21:14 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

On Thu, Mar 26, 2020 at 10:09:58PM +0100, Wolfram Sang wrote:
> Move away from the deprecated API.

Well, I should have looked a little closer first... comment inline

> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/char/ipmi/ipmi_ssif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index 8ac390c2b514..2791b799e33d 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1945,8 +1945,8 @@ static int ssif_adapter_handler(struct device *adev, void *opaque)
>  	if (adev->type != &i2c_adapter_type)
>  		return 0;
>  
> -	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
> -						 &addr_info->binfo);
> +	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
> +							&addr_info->binfo);

i2c_new_client_device returns an ERR_PTR, not NULL on error.  So this
needs some more work.  I'll send something out soon.

-corey

>  
>  	if (!addr_info->adapter_name)
>  		return 1; /* Only try the first I2C adapter by default. */
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] char: ipmi: convert to use i2c_new_client_device()
  2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
                     ` (2 preceding siblings ...)
  2020-05-12 21:14   ` Corey Minyard
@ 2020-05-12 21:45   ` minyard
  2020-05-13  8:37     ` Wolfram Sang
  3 siblings, 1 reply; 11+ messages in thread
From: minyard @ 2020-05-12 21:45 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel, Corey Minyard

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Move away from the deprecated API.

Based on a patch by Wolfram Sang <wsa+renesas@sang-engineering.com>.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
I think this works.

 drivers/char/ipmi/ipmi_ssif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index b7145f370d3b..65563e5e5731 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1943,12 +1943,14 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
 static int ssif_adapter_handler(struct device *adev, void *opaque)
 {
 	struct ssif_addr_info *addr_info = opaque;
+	struct i2c_client *cl;
 
 	if (adev->type != &i2c_adapter_type)
 		return 0;
 
-	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
-						 &addr_info->binfo);
+	cl = i2c_new_client_device(to_i2c_adapter(adev), &addr_info->binfo);
+	if (!IS_ERR(cl))
+		addr_info->added_client = cl;
 
 	if (!addr_info->adapter_name)
 		return 1; /* Only try the first I2C adapter by default. */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-05-12 21:14   ` Corey Minyard
@ 2020-05-13  7:10     ` Wolfram Sang
  2020-05-13 12:28       ` Corey Minyard
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2020-05-13  7:10 UTC (permalink / raw)
  To: Corey Minyard
  Cc: linux-i2c, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]


> > -	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
> > -						 &addr_info->binfo);
> > +	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
> > +							&addr_info->binfo);
> 
> i2c_new_client_device returns an ERR_PTR, not NULL on error.  So this

Yes, this is the main motivation for the new API.

> needs some more work.  I'll send something out soon.

Why does it need that work? 'added_client' is only used with
i2c_unregister_device() which has been fixed to handle ERR_PTR as well.
Or am I missing something?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] char: ipmi: convert to use i2c_new_client_device()
  2020-05-12 21:45   ` [PATCH] " minyard
@ 2020-05-13  8:37     ` Wolfram Sang
  2020-05-13 11:18       ` Corey Minyard
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2020-05-13  8:37 UTC (permalink / raw)
  To: minyard
  Cc: Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel, Corey Minyard

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

On Tue, May 12, 2020 at 04:45:32PM -0500, minyard@acm.org wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Move away from the deprecated API.
> 
> Based on a patch by Wolfram Sang <wsa+renesas@sang-engineering.com>.
> 
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> ---
> I think this works.

Yes, we can do it like this (despite the question from earlier if it is
really needed). I fixed other drivers using this pattern, too.

As Stephen Rothwell pointed out, you either need to remove my "From:" or
add my SoB. I am fine with both.

Thanks,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] char: ipmi: convert to use i2c_new_client_device()
  2020-05-13  8:37     ` Wolfram Sang
@ 2020-05-13 11:18       ` Corey Minyard
  0 siblings, 0 replies; 11+ messages in thread
From: Corey Minyard @ 2020-05-13 11:18 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: minyard, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

On Wed, May 13, 2020 at 10:37:46AM +0200, Wolfram Sang wrote:
> On Tue, May 12, 2020 at 04:45:32PM -0500, minyard@acm.org wrote:
> > From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > 
> > Move away from the deprecated API.
> > 
> > Based on a patch by Wolfram Sang <wsa+renesas@sang-engineering.com>.
> > 
> > Signed-off-by: Corey Minyard <cminyard@mvista.com>
> > ---
> > I think this works.
> 
> Yes, we can do it like this (despite the question from earlier if it is
> really needed). I fixed other drivers using this pattern, too.

I was wondering whether this is really needed, too, but I'm not 100%
sure it can be removed in all cases.  This is the safer route.

> 
> As Stephen Rothwell pointed out, you either need to remove my "From:" or
> add my SoB. I am fine with both.

It was enough of a rewrite that you as the author didn't seem right.
I've fixed the From line, sorry about that.

-corey

> 
> Thanks,
> 
>    Wolfram
> 



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device()
  2020-05-13  7:10     ` Wolfram Sang
@ 2020-05-13 12:28       ` Corey Minyard
  0 siblings, 0 replies; 11+ messages in thread
From: Corey Minyard @ 2020-05-13 12:28 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
	linux-kernel

On Wed, May 13, 2020 at 09:10:04AM +0200, Wolfram Sang wrote:
> 
> > > -	addr_info->added_client = i2c_new_device(to_i2c_adapter(adev),
> > > -						 &addr_info->binfo);
> > > +	addr_info->added_client = i2c_new_client_device(to_i2c_adapter(adev),
> > > +							&addr_info->binfo);
> > 
> > i2c_new_client_device returns an ERR_PTR, not NULL on error.  So this
> 
> Yes, this is the main motivation for the new API.
> 
> > needs some more work.  I'll send something out soon.
> 
> Why does it need that work? 'added_client' is only used with
> i2c_unregister_device() which has been fixed to handle ERR_PTR as well.
> Or am I missing something?
> 

No, I didn't look to see if i2c_unregister_device could handle that.

-corey

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-05-13 12:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 21:09 [PATCH 0/1] char: convert to use new I2C API Wolfram Sang
2020-03-26 21:09 ` [PATCH 1/1] char: ipmi: convert to use i2c_new_client_device() Wolfram Sang
2020-05-12 16:30   ` Wolfram Sang
2020-05-12 18:25   ` Corey Minyard
2020-05-12 20:07     ` Wolfram Sang
2020-05-12 21:14   ` Corey Minyard
2020-05-13  7:10     ` Wolfram Sang
2020-05-13 12:28       ` Corey Minyard
2020-05-12 21:45   ` [PATCH] " minyard
2020-05-13  8:37     ` Wolfram Sang
2020-05-13 11:18       ` Corey Minyard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.