devicetree.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 3/3] of: unittest: 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 3/3] of: unittest: 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-07-09  2:23   ` Rob Herring
  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, Rob Herring, Frank Rowand, devicetree,
	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/of/unittest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 3832a5de4602..e6b175370f2e 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1946,7 +1946,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client,
 {
 	int i, nchans;
 	struct device *dev = &client->dev;
-	struct i2c_adapter *adap = to_i2c_adapter(dev->parent);
+	struct i2c_adapter *adap = client->adapter;
 	struct device_node *np = client->dev.of_node, *child;
 	struct i2c_mux_core *muxc;
 	u32 reg, max_reg;
-- 
2.19.1

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

* Re: [PATCH 3/3] of: unittest: simplify getting the adapter of a client
  2019-06-10  9:51 ` [PATCH 3/3] of: unittest: simplify getting the adapter of a client Wolfram Sang
@ 2019-07-09  2:23   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2019-07-09  2:23 UTC (permalink / raw)
  Cc: linux-i2c, Peter Rosin, Wolfram Sang, Frank Rowand, devicetree,
	linux-kernel

On Mon, 10 Jun 2019 11:51:56 +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>
> ---
> 
> Please apply to your subsystem tree.
> 
>  drivers/of/unittest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied, thanks.

Rob

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

end of thread, other threads:[~2019-07-09  2:23 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 3/3] of: unittest: simplify getting the adapter of a client Wolfram Sang
2019-07-09  2:23   ` Rob Herring

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