linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: remove helpers for ref-counting clients
@ 2019-11-09 21:26 Wolfram Sang
  2019-11-11 10:27 ` Niklas Söderlund
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Wolfram Sang @ 2019-11-09 21:26 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, Jean Delvare, linux-renesas-soc, Wolfram Sang

There are no in-tree users of these helpers anymore, and there
shouldn't. Most use cases went away once the driver model started to
refcount for us. There have been users like the media subsystem, but
they all switched to better refcounting methods meanwhile. Media did
this in 2008. Last user (IPMI) left 2018. Remove this cruft.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/i2c-core-base.c | 32 --------------------------------
 include/linux/i2c.h         |  3 ---
 2 files changed, 35 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 9c55d24c7a30..5a44a92ed1fb 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1743,38 +1743,6 @@ EXPORT_SYMBOL(i2c_del_driver);
 
 /* ------------------------------------------------------------------------- */
 
-/**
- * i2c_use_client - increments the reference count of the i2c client structure
- * @client: the client being referenced
- *
- * Each live reference to a client should be refcounted. The driver model does
- * that automatically as part of driver binding, so that most drivers don't
- * need to do this explicitly: they hold a reference until they're unbound
- * from the device.
- *
- * A pointer to the client with the incremented reference counter is returned.
- */
-struct i2c_client *i2c_use_client(struct i2c_client *client)
-{
-	if (client && get_device(&client->dev))
-		return client;
-	return NULL;
-}
-EXPORT_SYMBOL(i2c_use_client);
-
-/**
- * i2c_release_client - release a use of the i2c client structure
- * @client: the client being no longer referenced
- *
- * Must be called when a user of a client is finished with it.
- */
-void i2c_release_client(struct i2c_client *client)
-{
-	if (client)
-		put_device(&client->dev);
-}
-EXPORT_SYMBOL(i2c_release_client);
-
 struct i2c_cmd_arg {
 	unsigned	cmd;
 	void		*arg;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8f512b992acd..23583f76c6dc 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -861,9 +861,6 @@ static inline bool i2c_client_has_driver(struct i2c_client *client)
 	return !IS_ERR_OR_NULL(client) && client->dev.driver;
 }
 
-extern struct i2c_client *i2c_use_client(struct i2c_client *client);
-extern void i2c_release_client(struct i2c_client *client);
-
 /* call the i2c_client->command() of all attached clients with
  * the given arguments */
 extern void i2c_clients_command(struct i2c_adapter *adap,
-- 
2.20.1


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

* Re: [PATCH] i2c: remove helpers for ref-counting clients
  2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
@ 2019-11-11 10:27 ` Niklas Söderlund
  2019-11-11 19:54 ` Jean Delvare
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Niklas Söderlund @ 2019-11-11 10:27 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Jean Delvare, linux-renesas-soc

Hi Wolfram,

Thanks for your work.

On 2019-11-09 22:26:15 +0100, Wolfram Sang wrote:
> There are no in-tree users of these helpers anymore, and there
> shouldn't. Most use cases went away once the driver model started to
> refcount for us. There have been users like the media subsystem, but
> they all switched to better refcounting methods meanwhile. Media did
> this in 2008. Last user (IPMI) left 2018. Remove this cruft.

Nice to clean out some old stuff :-)

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

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/i2c/i2c-core-base.c | 32 --------------------------------
>  include/linux/i2c.h         |  3 ---
>  2 files changed, 35 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 9c55d24c7a30..5a44a92ed1fb 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -1743,38 +1743,6 @@ EXPORT_SYMBOL(i2c_del_driver);
>  
>  /* ------------------------------------------------------------------------- */
>  
> -/**
> - * i2c_use_client - increments the reference count of the i2c client structure
> - * @client: the client being referenced
> - *
> - * Each live reference to a client should be refcounted. The driver model does
> - * that automatically as part of driver binding, so that most drivers don't
> - * need to do this explicitly: they hold a reference until they're unbound
> - * from the device.
> - *
> - * A pointer to the client with the incremented reference counter is returned.
> - */
> -struct i2c_client *i2c_use_client(struct i2c_client *client)
> -{
> -	if (client && get_device(&client->dev))
> -		return client;
> -	return NULL;
> -}
> -EXPORT_SYMBOL(i2c_use_client);
> -
> -/**
> - * i2c_release_client - release a use of the i2c client structure
> - * @client: the client being no longer referenced
> - *
> - * Must be called when a user of a client is finished with it.
> - */
> -void i2c_release_client(struct i2c_client *client)
> -{
> -	if (client)
> -		put_device(&client->dev);
> -}
> -EXPORT_SYMBOL(i2c_release_client);
> -
>  struct i2c_cmd_arg {
>  	unsigned	cmd;
>  	void		*arg;
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 8f512b992acd..23583f76c6dc 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -861,9 +861,6 @@ static inline bool i2c_client_has_driver(struct i2c_client *client)
>  	return !IS_ERR_OR_NULL(client) && client->dev.driver;
>  }
>  
> -extern struct i2c_client *i2c_use_client(struct i2c_client *client);
> -extern void i2c_release_client(struct i2c_client *client);
> -
>  /* call the i2c_client->command() of all attached clients with
>   * the given arguments */
>  extern void i2c_clients_command(struct i2c_adapter *adap,
> -- 
> 2.20.1
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH] i2c: remove helpers for ref-counting clients
  2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
  2019-11-11 10:27 ` Niklas Söderlund
@ 2019-11-11 19:54 ` Jean Delvare
  2019-11-12  7:59 ` Luca Ceresoli
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2019-11-11 19:54 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, linux-renesas-soc

On Sat,  9 Nov 2019 22:26:15 +0100, Wolfram Sang wrote:
> There are no in-tree users of these helpers anymore, and there
> shouldn't. Most use cases went away once the driver model started to
> refcount for us. There have been users like the media subsystem, but
> they all switched to better refcounting methods meanwhile. Media did
> this in 2008. Last user (IPMI) left 2018. Remove this cruft.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/i2c-core-base.c | 32 --------------------------------
>  include/linux/i2c.h         |  3 ---
>  2 files changed, 35 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 9c55d24c7a30..5a44a92ed1fb 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -1743,38 +1743,6 @@ EXPORT_SYMBOL(i2c_del_driver);
>  
>  /* ------------------------------------------------------------------------- */
>  
> -/**
> - * i2c_use_client - increments the reference count of the i2c client structure
> - * @client: the client being referenced
> - *
> - * Each live reference to a client should be refcounted. The driver model does
> - * that automatically as part of driver binding, so that most drivers don't
> - * need to do this explicitly: they hold a reference until they're unbound
> - * from the device.
> - *
> - * A pointer to the client with the incremented reference counter is returned.
> - */
> -struct i2c_client *i2c_use_client(struct i2c_client *client)
> -{
> -	if (client && get_device(&client->dev))
> -		return client;
> -	return NULL;
> -}
> -EXPORT_SYMBOL(i2c_use_client);
> -
> -/**
> - * i2c_release_client - release a use of the i2c client structure
> - * @client: the client being no longer referenced
> - *
> - * Must be called when a user of a client is finished with it.
> - */
> -void i2c_release_client(struct i2c_client *client)
> -{
> -	if (client)
> -		put_device(&client->dev);
> -}
> -EXPORT_SYMBOL(i2c_release_client);
> -
>  struct i2c_cmd_arg {
>  	unsigned	cmd;
>  	void		*arg;
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 8f512b992acd..23583f76c6dc 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -861,9 +861,6 @@ static inline bool i2c_client_has_driver(struct i2c_client *client)
>  	return !IS_ERR_OR_NULL(client) && client->dev.driver;
>  }
>  
> -extern struct i2c_client *i2c_use_client(struct i2c_client *client);
> -extern void i2c_release_client(struct i2c_client *client);
> -
>  /* call the i2c_client->command() of all attached clients with
>   * the given arguments */
>  extern void i2c_clients_command(struct i2c_adapter *adap,

Sweet!

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

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

* Re: [PATCH] i2c: remove helpers for ref-counting clients
  2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
  2019-11-11 10:27 ` Niklas Söderlund
  2019-11-11 19:54 ` Jean Delvare
@ 2019-11-12  7:59 ` Luca Ceresoli
  2019-11-12  8:16 ` Geert Uytterhoeven
  2019-11-17  7:21 ` Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Luca Ceresoli @ 2019-11-12  7:59 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c; +Cc: linux-kernel, Jean Delvare, linux-renesas-soc

Hi,

On 09/11/19 22:26, Wolfram Sang wrote:
> There are no in-tree users of these helpers anymore, and there
> shouldn't. Most use cases went away once the driver model started to
> refcount for us. There have been users like the media subsystem, but
> they all switched to better refcounting methods meanwhile. Media did
> this in 2008. Last user (IPMI) left 2018. Remove this cruft.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

[Tested on older kernel + TI serdes patches]
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>

-- 
Luca

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

* Re: [PATCH] i2c: remove helpers for ref-counting clients
  2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
                   ` (2 preceding siblings ...)
  2019-11-12  7:59 ` Luca Ceresoli
@ 2019-11-12  8:16 ` Geert Uytterhoeven
  2019-11-17  7:21 ` Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-11-12  8:16 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linux I2C, Linux Kernel Mailing List, Jean Delvare, Linux-Renesas

On Sat, Nov 9, 2019 at 10:26 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> There are no in-tree users of these helpers anymore, and there
> shouldn't. Most use cases went away once the driver model started to
> refcount for us. There have been users like the media subsystem, but
> they all switched to better refcounting methods meanwhile. Media did
> this in 2008. Last user (IPMI) left 2018. Remove this cruft.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] i2c: remove helpers for ref-counting clients
  2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
                   ` (3 preceding siblings ...)
  2019-11-12  8:16 ` Geert Uytterhoeven
@ 2019-11-17  7:21 ` Wolfram Sang
  4 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2019-11-17  7:21 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Jean Delvare, linux-renesas-soc

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

On Sat, Nov 09, 2019 at 10:26:15PM +0100, Wolfram Sang wrote:
> There are no in-tree users of these helpers anymore, and there
> shouldn't. Most use cases went away once the driver model started to
> refcount for us. There have been users like the media subsystem, but
> they all switched to better refcounting methods meanwhile. Media did
> this in 2008. Last user (IPMI) left 2018. Remove this cruft.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


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

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

end of thread, other threads:[~2019-11-17  7:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 21:26 [PATCH] i2c: remove helpers for ref-counting clients Wolfram Sang
2019-11-11 10:27 ` Niklas Söderlund
2019-11-11 19:54 ` Jean Delvare
2019-11-12  7:59 ` Luca Ceresoli
2019-11-12  8:16 ` Geert Uytterhoeven
2019-11-17  7:21 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).