linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] treewide: simplify getting the adapter of an I2C client, part2
@ 2019-06-10  9:51 Wolfram Sang
  2019-06-10  9:51 ` [PATCH 1/3] hwmon: lm90: simplify getting the adapter of a client Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2019-06-10  9:51 UTC (permalink / raw)
  To: linux-i2c
  Cc: Peter Rosin, Wolfram Sang, devicetree, linux-hwmon, linux-kernel,
	linux-leds

This is a small follow-up series to a larger cleanup series already
sent:

http://patchwork.ozlabs.org/project/linux-i2c/list/?series=112605
("treewide: simplify getting the adapter of an I2C client")

These drivers use a bit different but still unnecessarily complex way to
determine the adapter of a client. Thanks to Peter Rosin for pointing
them out. They have been fixed manually, no need for a coccinelle script
here. Build tested, too. From the previous cover-letter:

The I2C core populates the parent pointer of a client as:
	client->dev.parent = &client->adapter->dev;

Now take into consideration that
	to_i2c_adapter(&adapter->dev);

is a complicated way of saying 'adapter', then we can even formally
prove that the complicated expression can be simplified by using
client->adapter.

A branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/no_to_adapter

Please apply the patches to the individual subsystem trees. There are no
dependencies.

Thanks and kind regards,

   Wolfram

Wolfram Sang (3):
  hwmon: lm90: simplify getting the adapter of a client
  leds: is31fl319x: simplify getting the adapter of a client
  of: unittest: simplify getting the adapter of a client

 drivers/hwmon/lm90.c           | 2 +-
 drivers/leds/leds-is31fl319x.c | 2 +-
 drivers/of/unittest.c          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.19.1


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

* [PATCH 1/3] hwmon: lm90: simplify getting the adapter of a client
  2019-06-10  9:51 [PATCH 0/3] treewide: simplify getting the adapter of an I2C client, part2 Wolfram Sang
@ 2019-06-10  9:51 ` Wolfram Sang
  2019-06-12 12:41   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2019-06-10  9:51 UTC (permalink / raw)
  To: linux-i2c
  Cc: Peter Rosin, Wolfram Sang, Jean Delvare, Guenter Roeck,
	linux-hwmon, linux-kernel

We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.

Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Please apply to your subsystem tree.

 drivers/hwmon/lm90.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index e562a578f20e..2ebcab8b0a9b 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1718,7 +1718,7 @@ static int lm90_probe(struct i2c_client *client,
 		      const struct i2c_device_id *id)
 {
 	struct device *dev = &client->dev;
-	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct hwmon_channel_info *info;
 	struct regulator *regulator;
 	struct device *hwmon_dev;
-- 
2.19.1


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

* Re: [PATCH 1/3] hwmon: lm90: simplify getting the adapter of a client
  2019-06-10  9:51 ` [PATCH 1/3] hwmon: lm90: simplify getting the adapter of a client Wolfram Sang
@ 2019-06-12 12:41   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2019-06-12 12:41 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Peter Rosin, Jean Delvare, linux-hwmon, linux-kernel

On Mon, Jun 10, 2019 at 11:51:54AM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
> 
> Reported-by: Peter Rosin <peda@axentia.se>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Aplied.

Thanks,
Guenter

> ---
> 
> Please apply to your subsystem tree.
> 
>  drivers/hwmon/lm90.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index e562a578f20e..2ebcab8b0a9b 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -1718,7 +1718,7 @@ static int lm90_probe(struct i2c_client *client,
>  		      const struct i2c_device_id *id)
>  {
>  	struct device *dev = &client->dev;
> -	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
> +	struct i2c_adapter *adapter = client->adapter;
>  	struct hwmon_channel_info *info;
>  	struct regulator *regulator;
>  	struct device *hwmon_dev;

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

end of thread, other threads:[~2019-06-12 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10  9:51 [PATCH 0/3] treewide: simplify getting the adapter of an I2C client, part2 Wolfram Sang
2019-06-10  9:51 ` [PATCH 1/3] hwmon: lm90: simplify getting the adapter of a client Wolfram Sang
2019-06-12 12:41   ` Guenter Roeck

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).