Skip to contentSkip to conversation

treewide: simplify getting the adapter of an I2C client

PATCH Applied Wolfram Sang 14 participants 77 messages Jun 8, 2019 – Jun 27, 2019

Subsystems (24)
lore
Share & tools
lore
#0 lore raw

cover treewide: simplify getting the adapter of an I2C client

While preparing a refactoring series, I noticed that some drivers use a complicated way of determining the adapter of a client. The easy way is to use the intended pointer: client->adapter

These drivers do:

	to_i2c_adapter(client->dev.parent);

The I2C core populates the parent pointer 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.

The conversion was done using a coccinelle script with some manual indentation fixes applied on top.

To avoid a brown paper bag mistake, I double checked this on a Renesas Salvator-XS board (R-Car M3N) and verified both expression result in the same pointer. Other than that, the series is only build tested.

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 (34):
clk: clk-cdce706: simplify getting the adapter of a client
gpu: drm: bridge: sii9234: simplify getting the adapter of a client
iio: light: bh1780: simplify getting the adapter of a client
leds: leds-pca955x: simplify getting the adapter of a client
leds: leds-tca6507: simplify getting the adapter of a client
media: i2c: ak881x: simplify getting the adapter of a client
media: i2c: mt9m001: simplify getting the adapter of a client
media: i2c: mt9m111: simplify getting the adapter of a client
media: i2c: mt9p031: simplify getting the adapter of a client
media: i2c: ov2640: simplify getting the adapter of a client
media: i2c: tw9910: simplify getting the adapter of a client
misc: fsa9480: simplify getting the adapter of a client
misc: isl29003: simplify getting the adapter of a client
misc: tsl2550: simplify getting the adapter of a client
mtd: maps: pismo: simplify getting the adapter of a client
power: supply: bq24190_charger: simplify getting the adapter of a client
power: supply: bq24257_charger: simplify getting the adapter of a client
power: supply: bq25890_charger: simplify getting the adapter of a client
power: supply: max14656_charger_detector: simplify getting the adapter
of a client
power: supply: max17040_battery: simplify getting the adapter of a client
power: supply: max17042_battery: simplify getting the adapter of a client
power: supply: rt5033_battery: simplify getting the adapter of a client
power: supply: rt9455_charger: simplify getting the adapter of a client
power: supply: sbs-manager: simplify getting the adapter of a client
regulator: max8952: simplify getting the adapter of a client
rtc: fm3130: simplify getting the adapter of a client
rtc: m41t80: simplify getting the adapter of a client
rtc: rv8803: simplify getting the adapter of a client
rtc: rx8010: simplify getting the adapter of a client
rtc: rx8025: simplify getting the adapter of a client
staging: media: soc_camera: imx074: simplify getting the adapter of a client
staging: media: soc_camera: mt9t031: simplify getting the adapter of a client
staging: media: soc_camera: soc_mt9v022: simplify getting the adapter
of a client
usb: typec: tcpm: fusb302: simplify getting the adapter of a client

 drivers/clk/clk-cdce706.c                        | 2 +-
 drivers/gpu/drm/bridge/sii9234.c                 | 4 ++--
 drivers/iio/light/bh1780.c                       | 2 +-
 drivers/leds/leds-pca955x.c                      | 2 +-
 drivers/leds/leds-tca6507.c                      | 2 +-
 drivers/media/i2c/ak881x.c                       | 2 +-
 drivers/media/i2c/mt9m001.c                      | 2 +-
 drivers/media/i2c/mt9m111.c                      | 2 +-
 drivers/media/i2c/mt9p031.c                      | 2 +-
 drivers/media/i2c/ov2640.c                       | 2 +-
 drivers/media/i2c/tw9910.c                       | 3 +--
 drivers/misc/fsa9480.c                           | 2 +-
 drivers/misc/isl29003.c                          | 2 +-
 drivers/misc/tsl2550.c                           | 2 +-
 drivers/mtd/maps/pismo.c                         | 2 +-
 drivers/power/supply/bq24190_charger.c           | 2 +-
 drivers/power/supply/bq24257_charger.c           | 2 +-
 drivers/power/supply/bq25890_charger.c           | 2 +-
 drivers/power/supply/max14656_charger_detector.c | 2 +-
 drivers/power/supply/max17040_battery.c          | 2 +-
 drivers/power/supply/max17042_battery.c          | 2 +-
 drivers/power/supply/rt5033_battery.c            | 2 +-
 drivers/power/supply/rt9455_charger.c            | 2 +-
 drivers/power/supply/sbs-manager.c               | 2 +-
 drivers/regulator/max8952.c                      | 2 +-
 drivers/rtc/rtc-fm3130.c                         | 8 +++-----
 drivers/rtc/rtc-m41t80.c                         | 2 +-
 drivers/rtc/rtc-rv8803.c                         | 2 +-
 drivers/rtc/rtc-rx8010.c                         | 2 +-
 drivers/rtc/rtc-rx8025.c                         | 2 +-
 drivers/staging/media/soc_camera/imx074.c        | 2 +-
 drivers/staging/media/soc_camera/mt9t031.c       | 2 +-
 drivers/staging/media/soc_camera/soc_mt9v022.c   | 2 +-
 drivers/usb/typec/tcpm/fusb302.c                 | 3 +--
 34 files changed, 37 insertions(+), 41 deletions(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/34 clk: clk-cdce706: simplify getting the adapter of a client

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

---

Please apply to your subsystem tree.

 drivers/clk/clk-cdce706.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-cdce706.c +1 -1
index f21d9092564f..476d29c013e5 100644
@@ -633,7 +633,7 @@ of_clk_cdce_get(struct of_phandle_args *clkspec, void *data)
 static int cdce706_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct cdce706_dev_data *cdce;
 	int ret;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 1/34
#2 lore raw

Re: [PATCH 01/34] clk: clk-cdce706: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/clk/clk-cdce706.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-cdce706.c +1 -1
index f21d9092564f..476d29c013e5 100644
@@ -633,7 +633,7 @@ of_clk_cdce_get(struct of_phandle_args *clkspec, void *data)
 static int cdce706_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct cdce706_dev_data *cdce;
 	int ret;
 
Signature · 1 line
2.19.1
maintainer Applied
#3 lore raw

Re: [PATCH 01/34] clk: clk-cdce706: simplify getting the adapter of a client

In reply to Wolfram Sang

Quoting Wolfram Sang (2019-06-08 03:55:40)

Quoted 5 lines

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

---

Applied to clk-next

#4 lore raw

PATCH 2/34 gpu: drm: bridge: sii9234: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/gpu/drm/bridge/sii9234.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/sii9234.c +2 -2
index b36bbafb0e43..25d4ad8c7ad6 100644
@@ -815,7 +815,7 @@ static irqreturn_t sii9234_irq_thread(int irq, void *data)
 static int sii9234_init_resources(struct sii9234 *ctx,
 				  struct i2c_client *client)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!ctx->dev->of_node) {
@@ -897,7 +897,7 @@ static const struct drm_bridge_funcs sii9234_bridge_funcs = {
 static int sii9234_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct sii9234 *ctx;
 	struct device *dev = &client->dev;
 	int ret;
Signature · 1 line
2.19.1
maintainer Reviewed-by on v1 2/34
#5 lore raw

Re: [PATCH 02/34] gpu: drm: bridge: sii9234: simplify getting the adapter of a client

Hi Wolfram,

Thank you for the patch.

Quoted 4 lines · Wolfram Sang

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

Quoted 29 lines

---

Please apply to your subsystem tree.

 drivers/gpu/drm/bridge/sii9234.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/sii9234.c +2 -2
index b36bbafb0e43..25d4ad8c7ad6 100644
@@ -815,7 +815,7 @@ static irqreturn_t sii9234_irq_thread(int irq, void *data)
 static int sii9234_init_resources(struct sii9234 *ctx,
 				  struct i2c_client *client)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!ctx->dev->of_node) {
@@ -897,7 +897,7 @@ static const struct drm_bridge_funcs sii9234_bridge_funcs = {
 static int sii9234_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct sii9234 *ctx;
 	struct device *dev = &client->dev;
 	int ret;
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by Applied
#6 lore raw

Re: [PATCH 02/34] gpu: drm: bridge: sii9234: simplify getting the adapter of a client

Quoted 10 lines · Laurent Pinchart

Hi Wolfram,

Thank you for the patch.

Quoted 4 lines · Wolfram Sang

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

Queued to drm-misc-next.

Laurent, for unknown reason patchwork does not collect yours tags, and it is not the 1st time, added manually.

 --
Regards
Andrzej

Quoted 30 lines
Quoted 30 lines

---

Please apply to your subsystem tree.

 drivers/gpu/drm/bridge/sii9234.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/sii9234.c +2 -2
index b36bbafb0e43..25d4ad8c7ad6 100644
@@ -815,7 +815,7 @@ static irqreturn_t sii9234_irq_thread(int irq, void *data)
 static int sii9234_init_resources(struct sii9234 *ctx,
 				  struct i2c_client *client)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!ctx->dev->of_node) {
@@ -897,7 +897,7 @@ static const struct drm_bridge_funcs sii9234_bridge_funcs = {
 static int sii9234_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct sii9234 *ctx;
 	struct device *dev = &client->dev;
 	int ret;
#7 lore raw

PATCH 3/34 iio: light: bh1780: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/iio/light/bh1780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/bh1780.c +1 -1
index 340d64d0ac59..a8361006dcd9 100644
@@ -146,7 +146,7 @@ static int bh1780_probe(struct i2c_client *client,
 {
 	int ret;
 	struct bh1780_data *bh1780;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct iio_dev *indio_dev;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
Signature · 1 line
2.19.1
maintainer
#8 lore raw

Re: [PATCH 03/34] iio: light: bh1780: simplify getting the adapter of a client

Quoted 4 lines · On Sat, 8 Jun 2019 12:55:42 +0200 Wolfram Sang…

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

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 20 lines

---

Please apply to your subsystem tree.

 drivers/iio/light/bh1780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/bh1780.c +1 -1
index 340d64d0ac59..a8361006dcd9 100644
@@ -146,7 +146,7 @@ static int bh1780_probe(struct i2c_client *client,
 {
 	int ret;
 	struct bh1780_data *bh1780;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct iio_dev *indio_dev;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
#9 lore raw

PATCH 4/34 leds: leds-pca955x: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/leds/leds-pca955x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pca955x.c +1 -1
index a9f5dad55956..460626d81c6a 100644
@@ -432,7 +432,7 @@ static int pca955x_probe(struct i2c_client *client,
 	int ngpios = 0;
 
 	chip = &pca955x_chipdefs[id->driver_data];
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
 	pdata = dev_get_platdata(&client->dev);
 	if (!pdata) {
 		pdata =	pca955x_get_pdata(client, chip);
Signature · 1 line
2.19.1
Acked-by on v1 4/34
#10 lore raw

Re: [PATCH 04/34] leds: leds-pca955x: simplify getting the adapter of a client

Hi Wolfram,

Thank you for the patches.

Quoted 17 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

  drivers/leds/leds-pca955x.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pca955x.c +0 -0
index a9f5dad55956..460626d81c6a 100644

drivers/leds/leds-pca955x.c static int pca955x_probe(struct i2c_client *client, · line 438

Quoted 8 lines
drivers/leds/leds-pca955x.c +1 -1
@@ -432,7 +432,7 @@ static int pca955x_probe(struct i2c_client *client,
  	int ngpios = 0;
 
  	chip = &pca955x_chipdefs[id->driver_data];
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
  	pdata = dev_get_platdata(&client->dev);
  	if (!pdata) {
  		pdata =	pca955x_get_pdata(client, chip);

For both 4/34 and 5/34:

Signature · 2 lines
Best regards,
Jacek Anaszewski
Acked-by
#11 lore raw

Re: [PATCH 04/34] leds: leds-pca955x: simplify getting the adapter of a client

Quoted 32 lines · Jacek Anaszewski

Hi Wolfram,

Thank you for the patches.

Quoted 16 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/leds/leds-pca955x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pca955x.c +0 -0
index a9f5dad55956..460626d81c6a 100644

drivers/leds/leds-pca955x.c static int pca955x_probe(struct i2c_client *client, · line 438

Quoted 8 lines
drivers/leds/leds-pca955x.c +1 -1
@@ -432,7 +432,7 @@ static int pca955x_probe(struct i2c_client *client,
 	int ngpios = 0;
 	chip = &pca955x_chipdefs[id->driver_data];
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
 	pdata = dev_get_platdata(&client->dev);
 	if (!pdata) {
 		pdata =	pca955x_get_pdata(client, chip);
 

For both 4/34 and 5/34:

Quoted 1 line

4 and 5:

But I wonder if it should go through the leds tree?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#12 lore raw

Re: [PATCH 04/34] leds: leds-pca955x: simplify getting the adapter of a client

Quoted 33 lines · Pavel Machek
Quoted 32 lines · Jacek Anaszewski

Hi Wolfram,

Thank you for the patches.

Quoted 16 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

  drivers/leds/leds-pca955x.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pca955x.c +0 -0
index a9f5dad55956..460626d81c6a 100644

drivers/leds/leds-pca955x.c static int pca955x_probe(struct i2c_client *client, · line 438

Quoted 8 lines
drivers/leds/leds-pca955x.c +1 -1
@@ -432,7 +432,7 @@ static int pca955x_probe(struct i2c_client *client,
  	int ngpios = 0;
  	chip = &pca955x_chipdefs[id->driver_data];
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
  	pdata = dev_get_platdata(&client->dev);
  	if (!pdata) {
  		pdata =	pca955x_get_pdata(client, chip);
 

For both 4/34 and 5/34:

Quoted 7 lines
Quoted 1 line

4 and 5:

But I wonder if it should go through the leds tree?

Yes, I missed that "Please apply to your subsystem tree." comment. And this change relies on the existing code.

Applied 4/34 and 5/34 to the for-next branch of linux-leds.git.

Thanks.

Signature · 2 lines
Best regards,
Jacek Anaszewski
#13 lore raw

PATCH 5/34 leds: leds-tca6507: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/leds/leds-tca6507.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-tca6507.c +1 -1
index c59035e157d1..58be20cae183 100644
@@ -758,7 +758,7 @@ static int tca6507_probe(struct i2c_client *client,
 	int err;
 	int i = 0;
 
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
 	pdata = dev_get_platdata(&client->dev);
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
Signature · 1 line
2.19.1
Reviewed-by on v1 5/34
#14 lore raw

Re: [PATCH 05/34] leds: leds-tca6507: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/leds/leds-tca6507.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-tca6507.c +1 -1
index c59035e157d1..58be20cae183 100644
@@ -758,7 +758,7 @@ static int tca6507_probe(struct i2c_client *client,
 	int err;
 	int i = 0;
 
-	adapter = to_i2c_adapter(client->dev.parent);
+	adapter = client->adapter;
 	pdata = dev_get_platdata(&client->dev);
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
Signature · 1 line
2.19.1
#15 lore raw

PATCH 6/34 media: i2c: ak881x: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/ak881x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ak881x.c +1 -1
index 30f9db1351b9..09860603da64 100644
@@ -232,7 +232,7 @@ static const struct v4l2_subdev_ops ak881x_subdev_ops = {
 static int ak881x_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct ak881x *ak881x;
 	u8 ifmode, data;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 6/34
#16 lore raw

Re: [PATCH 06/34] media: i2c: ak881x: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/media/i2c/ak881x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ak881x.c +1 -1
index 30f9db1351b9..09860603da64 100644
@@ -232,7 +232,7 @@ static const struct v4l2_subdev_ops ak881x_subdev_ops = {
 static int ak881x_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct ak881x *ak881x;
 	u8 ifmode, data;
 
Signature · 1 line
2.19.1
#17 lore raw

PATCH 7/34 media: i2c: mt9m001: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/mt9m001.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9m001.c +1 -1
index 4b23fde937b3..2df743cbe09d 100644
@@ -730,7 +730,7 @@ static int mt9m001_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
 	struct mt9m001 *mt9m001;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
Signature · 1 line
2.19.1
#19 lore raw

PATCH 8/34 media: i2c: mt9m111: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/mt9m111.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9m111.c +1 -1
index 5168bb5880c4..a9da43316504 100644
@@ -1235,7 +1235,7 @@ static int mt9m111_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
 	struct mt9m111 *mt9m111;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
Signature · 1 line
2.19.1
Reviewed-by on v1 8/34
#20 lore raw

Re: [PATCH 08/34] media: i2c: mt9m111: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/media/i2c/mt9m111.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9m111.c +1 -1
index 5168bb5880c4..a9da43316504 100644
@@ -1235,7 +1235,7 @@ static int mt9m111_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
 	struct mt9m111 *mt9m111;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
Signature · 1 line
2.19.1
#21 lore raw

PATCH 9/34 media: i2c: mt9p031: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/mt9p031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9p031.c +1 -1
index 715be3632b01..5d824dd33edd 100644
@@ -1034,7 +1034,7 @@ static int mt9p031_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
 	struct mt9p031_platform_data *pdata = mt9p031_get_pdata(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct mt9p031 *mt9p031;
 	unsigned int i;
 	int ret;
Signature · 1 line
2.19.1
maintainer Reviewed-by on v1 9/34
#22 lore raw

Re: [PATCH 09/34] media: i2c: mt9p031: simplify getting the adapter of a client

Hi Wolfram,

Thank you for the patch.

Quoted 4 lines · Wolfram Sang

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

and taken in my tree.

Quoted 20 lines

---

Please apply to your subsystem tree.

 drivers/media/i2c/mt9p031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9p031.c +1 -1
index 715be3632b01..5d824dd33edd 100644
@@ -1034,7 +1034,7 @@ static int mt9p031_probe(struct i2c_client *client,
 			 const struct i2c_device_id *did)
 {
 	struct mt9p031_platform_data *pdata = mt9p031_get_pdata(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct mt9p031 *mt9p031;
 	unsigned int i;
 	int ret;
Signature · 3 lines
Regards,

Laurent Pinchart
#23 lore raw

PATCH 10/34 media: i2c: ov2640: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/ov2640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2640.c +1 -1
index 83031cfc7914..30e7e6b2b293 100644
@@ -1197,7 +1197,7 @@ static int ov2640_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
 	struct ov2640_priv	*priv;
-	struct i2c_adapter	*adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter	*adapter = client->adapter;
 	int			ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
Signature · 1 line
2.19.1
Reviewed-by on v1 10/34
#24 lore raw

Re: [PATCH 10/34] media: i2c: ov2640: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/media/i2c/ov2640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2640.c +1 -1
index 83031cfc7914..30e7e6b2b293 100644
@@ -1197,7 +1197,7 @@ static int ov2640_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
 	struct ov2640_priv	*priv;
-	struct i2c_adapter	*adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter	*adapter = client->adapter;
 	int			ret;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
Signature · 1 line
2.19.1
#25 lore raw

PATCH 11/34 media: i2c: tw9910: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/media/i2c/tw9910.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/i2c/tw9910.c +1 -2
index 4d7cd736b930..a25a350b0ddc 100644
@@ -934,8 +934,7 @@ static int tw9910_probe(struct i2c_client *client,
 {
 	struct tw9910_priv		*priv;
 	struct tw9910_video_info	*info;
-	struct i2c_adapter		*adapter =
-		to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter		*adapter = client->adapter;
 	int ret;
 
 	if (!client->dev.platform_data) {
Signature · 1 line
2.19.1
Reviewed-by on v1 11/34
#26 lore raw

Re: [PATCH 11/34] media: i2c: tw9910: simplify getting the adapter of a client

Quoted 5 lines · Wolfram Sang

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

---

Quoted 23 lines

Please apply to your subsystem tree.

 drivers/media/i2c/tw9910.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/i2c/tw9910.c +1 -2
index 4d7cd736b930..a25a350b0ddc 100644
@@ -934,8 +934,7 @@ static int tw9910_probe(struct i2c_client *client,
 {
 	struct tw9910_priv		*priv;
 	struct tw9910_video_info	*info;
-	struct i2c_adapter		*adapter =
-		to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter		*adapter = client->adapter;
 	int ret;
 
 	if (!client->dev.platform_data) {
Signature · 1 line
2.19.1
#27 lore raw

PATCH 12/34 misc: fsa9480: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/misc/fsa9480.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fsa9480.c +1 -1
index 607b489a6501..a8126790f8de 100644
@@ -410,7 +410,7 @@ static int fsa9480_irq_init(struct fsa9480_usbsw *usbsw)
 static int fsa9480_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct fsa9480_usbsw *usbsw;
 	int ret = 0;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 12/34
#28 lore raw

Re: [PATCH 12/34] misc: fsa9480: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/misc/fsa9480.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fsa9480.c +1 -1
index 607b489a6501..a8126790f8de 100644
@@ -410,7 +410,7 @@ static int fsa9480_irq_init(struct fsa9480_usbsw *usbsw)
 static int fsa9480_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct fsa9480_usbsw *usbsw;
 	int ret = 0;
 
Signature · 1 line
2.19.1
#29 lore raw

PATCH 13/34 misc: isl29003: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/misc/isl29003.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/isl29003.c +1 -1
index 3431a825f24e..5d0d0c3bad85 100644
@@ -377,7 +377,7 @@ static int isl29003_init_client(struct i2c_client *client)
 static int isl29003_probe(struct i2c_client *client,
 				    const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct isl29003_data *data;
 	int err = 0;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 13/34
#30 lore raw

Re: [PATCH 13/34] misc: isl29003: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/misc/isl29003.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/isl29003.c +1 -1
index 3431a825f24e..5d0d0c3bad85 100644
@@ -377,7 +377,7 @@ static int isl29003_init_client(struct i2c_client *client)
 static int isl29003_probe(struct i2c_client *client,
 				    const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct isl29003_data *data;
 	int err = 0;
 
Signature · 1 line
2.19.1
#31 lore raw

PATCH 14/34 misc: tsl2550: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/misc/tsl2550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/tsl2550.c +1 -1
index 5b7afd6190fe..09db397df287 100644
@@ -336,7 +336,7 @@ static struct i2c_driver tsl2550_driver;
 static int tsl2550_probe(struct i2c_client *client,
 				   const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct tsl2550_data *data;
 	int *opmode, err = 0;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 14/34
#32 lore raw

Re: [PATCH 14/34] misc: tsl2550: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/misc/tsl2550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/tsl2550.c +1 -1
index 5b7afd6190fe..09db397df287 100644
@@ -336,7 +336,7 @@ static struct i2c_driver tsl2550_driver;
 static int tsl2550_probe(struct i2c_client *client,
 				   const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct tsl2550_data *data;
 	int *opmode, err = 0;
 
Signature · 1 line
2.19.1
#33 lore raw

PATCH 15/34 mtd: maps: pismo: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/mtd/maps/pismo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/pismo.c +1 -1
index 788d4996e2c1..7fcae3af435c 100644
@@ -211,7 +211,7 @@ static int pismo_remove(struct i2c_client *client)
 static int pismo_probe(struct i2c_client *client,
 		       const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct pismo_pdata *pdata = client->dev.platform_data;
 	struct pismo_eeprom eeprom;
 	struct pismo_data *pismo;
Signature · 6 lines
2.19.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v1 15/34
#34 lore raw

Re: [PATCH 15/34] mtd: maps: pismo: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/mtd/maps/pismo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/pismo.c +1 -1
index 788d4996e2c1..7fcae3af435c 100644
@@ -211,7 +211,7 @@ static int pismo_remove(struct i2c_client *client)
 static int pismo_probe(struct i2c_client *client,
 		       const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct pismo_pdata *pdata = client->dev.platform_data;
 	struct pismo_eeprom eeprom;
 	struct pismo_data *pismo;
Signature · 1 line
2.19.1

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#35 lore raw

PATCH 16/34 power: supply: bq24190_charger: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/bq24190_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +1 -1
index cc0dfdc9e85a..ec03521c46d1 100644
@@ -1700,7 +1700,7 @@ static int bq24190_get_config(struct bq24190_dev_info *bdi)
 static int bq24190_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct power_supply_config charger_cfg = {}, battery_cfg = {};
 	struct bq24190_dev_info *bdi;
Signature · 1 line
2.19.1
Reviewed-by on v1 16/34
#36 lore raw

Re: [PATCH 16/34] power: supply: bq24190_charger: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/bq24190_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +1 -1
index cc0dfdc9e85a..ec03521c46d1 100644
@@ -1700,7 +1700,7 @@ static int bq24190_get_config(struct bq24190_dev_info *bdi)
 static int bq24190_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct power_supply_config charger_cfg = {}, battery_cfg = {};
 	struct bq24190_dev_info *bdi;
Signature · 1 line
2.19.1
#37 lore raw

PATCH 17/34 power: supply: bq24257_charger: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/bq24257_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq24257_charger.c +1 -1
index 7eb58f10e092..eb151687beb3 100644
@@ -950,7 +950,7 @@ static int bq24257_fw_probe(struct bq24257_device *bq)
 static int bq24257_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	const struct acpi_device_id *acpi_id;
 	struct bq24257_device *bq;
Signature · 1 line
2.19.1
Reviewed-by on v1 17/34
#38 lore raw

Re: [PATCH 17/34] power: supply: bq24257_charger: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/bq24257_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq24257_charger.c +1 -1
index 7eb58f10e092..eb151687beb3 100644
@@ -950,7 +950,7 @@ static int bq24257_fw_probe(struct bq24257_device *bq)
 static int bq24257_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	const struct acpi_device_id *acpi_id;
 	struct bq24257_device *bq;
Signature · 1 line
2.19.1
#39 lore raw

PATCH 18/34 power: supply: bq25890_charger: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/bq25890_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq25890_charger.c +1 -1
index b2ff82b4707a..d333f2b321b9 100644
@@ -817,7 +817,7 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
 static int bq25890_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct bq25890_device *bq;
 	int ret;
Signature · 1 line
2.19.1
Reviewed-by on v1 18/34
#40 lore raw

Re: [PATCH 18/34] power: supply: bq25890_charger: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/bq25890_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq25890_charger.c +1 -1
index b2ff82b4707a..d333f2b321b9 100644
@@ -817,7 +817,7 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
 static int bq25890_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct bq25890_device *bq;
 	int ret;
Signature · 1 line
2.19.1
#41 lore raw

PATCH 19/34 power: supply: max14656_charger_detector: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/max14656_charger_detector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max14656_charger_detector.c +1 -1
index 9e6472834e37..f27b780d2c02 100644
@@ -251,7 +251,7 @@ static void stop_irq_work(void *data)
 static int max14656_probe(struct i2c_client *client,
 			  const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct power_supply_config psy_cfg = {};
 	struct max14656_chip *chip;
Signature · 1 line
2.19.1
Reviewed-by on v1 19/34
#42 lore raw

Re: [PATCH 19/34] power: supply: max14656_charger_detector: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/max14656_charger_detector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max14656_charger_detector.c +1 -1
index 9e6472834e37..f27b780d2c02 100644
@@ -251,7 +251,7 @@ static void stop_irq_work(void *data)
 static int max14656_probe(struct i2c_client *client,
 			  const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct power_supply_config psy_cfg = {};
 	struct max14656_chip *chip;
Signature · 1 line
2.19.1
#43 lore raw

PATCH 20/34 power: supply: max17040_battery: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/max17040_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17040_battery.c +1 -1
index 91cafc7bed30..62499018e68b 100644
@@ -193,7 +193,7 @@ static const struct power_supply_desc max17040_battery_desc = {
 static int max17040_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct power_supply_config psy_cfg = {};
 	struct max17040_chip *chip;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 20/34
#44 lore raw

Re: [PATCH 20/34] power: supply: max17040_battery: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/max17040_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17040_battery.c +1 -1
index 91cafc7bed30..62499018e68b 100644
@@ -193,7 +193,7 @@ static const struct power_supply_desc max17040_battery_desc = {
 static int max17040_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct power_supply_config psy_cfg = {};
 	struct max17040_chip *chip;
 
Signature · 1 line
2.19.1
#45 lore raw

PATCH 21/34 power: supply: max17042_battery: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/max17042_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
index 581c6bd23388..64f3358eaa3c 100644
@@ -1005,7 +1005,7 @@ static void max17042_stop_work(void *data)
 static int max17042_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	const struct power_supply_desc *max17042_desc = &max17042_psy_desc;
 	struct power_supply_config psy_cfg = {};
 	const struct acpi_device_id *acpi_id = NULL;
Signature · 1 line
2.19.1
Reviewed-by on v1 21/34
#46 lore raw

Re: [PATCH 21/34] power: supply: max17042_battery: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/max17042_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
index 581c6bd23388..64f3358eaa3c 100644
@@ -1005,7 +1005,7 @@ static void max17042_stop_work(void *data)
 static int max17042_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	const struct power_supply_desc *max17042_desc = &max17042_psy_desc;
 	struct power_supply_config psy_cfg = {};
 	const struct acpi_device_id *acpi_id = NULL;
Signature · 1 line
2.19.1
#47 lore raw

PATCH 22/34 power: supply: rt5033_battery: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/rt5033_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt5033_battery.c +1 -1
index bcdd83048492..508f825ff190 100644
@@ -118,7 +118,7 @@ static const struct power_supply_desc rt5033_battery_desc = {
 static int rt5033_battery_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct power_supply_config psy_cfg = {};
 	struct rt5033_battery *battery;
 	u32 ret;
Signature · 1 line
2.19.1
Reviewed-by on v1 22/34
#48 lore raw

Re: [PATCH 22/34] power: supply: rt5033_battery: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/rt5033_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt5033_battery.c +1 -1
index bcdd83048492..508f825ff190 100644
@@ -118,7 +118,7 @@ static const struct power_supply_desc rt5033_battery_desc = {
 static int rt5033_battery_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct power_supply_config psy_cfg = {};
 	struct rt5033_battery *battery;
 	u32 ret;
Signature · 1 line
2.19.1
#49 lore raw

PATCH 23/34 power: supply: rt9455_charger: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/rt9455_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt9455_charger.c +1 -1
index 40a9d329418a..29161ae90245 100644
@@ -1584,7 +1584,7 @@ static const struct regmap_config rt9455_regmap_config = {
 static int rt9455_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct rt9455_info *info;
 	struct power_supply_config rt9455_charger_config = {};
Signature · 1 line
2.19.1
Reviewed-by on v1 23/34
#50 lore raw

Re: [PATCH 23/34] power: supply: rt9455_charger: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/rt9455_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/rt9455_charger.c +1 -1
index 40a9d329418a..29161ae90245 100644
@@ -1584,7 +1584,7 @@ static const struct regmap_config rt9455_regmap_config = {
 static int rt9455_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct rt9455_info *info;
 	struct power_supply_config rt9455_charger_config = {};
Signature · 1 line
2.19.1
#51 lore raw

PATCH 24/34 power: supply: sbs-manager: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/power/supply/sbs-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/sbs-manager.c +1 -1
index cb6e8f66c7a2..4c29a89df968 100644
@@ -317,7 +317,7 @@ static const struct power_supply_desc sbsm_default_psy_desc = {
 static int sbsm_probe(struct i2c_client *client,
 		      const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct sbsm_data *data;
 	struct device *dev = &client->dev;
 	struct power_supply_desc *psy_desc;
Signature · 1 line
2.19.1
Reviewed-by on v1 24/34
#52 lore raw

Re: [PATCH 24/34] power: supply: sbs-manager: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/power/supply/sbs-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/sbs-manager.c +1 -1
index cb6e8f66c7a2..4c29a89df968 100644
@@ -317,7 +317,7 @@ static const struct power_supply_desc sbsm_default_psy_desc = {
 static int sbsm_probe(struct i2c_client *client,
 		      const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct sbsm_data *data;
 	struct device *dev = &client->dev;
 	struct power_supply_desc *psy_desc;
Signature · 1 line
2.19.1
#53 lore raw

PATCH 25/34 regulator: max8952: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/regulator/max8952.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max8952.c +1 -1
index 2a123b87d9f2..5d3096e20f47 100644
@@ -179,7 +179,7 @@ static struct max8952_platform_data *max8952_parse_dt(struct device *dev)
 static int max8952_pmic_probe(struct i2c_client *client,
 		const struct i2c_device_id *i2c_id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct max8952_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct regulator_config config = { };
 	struct max8952_data *max8952;
Signature · 1 line
2.19.1
maintainer
#54 lore raw

Applied "regulator: max8952: simplify getting the adapter of a client" to the regulator tree

The patch

regulator: max8952: simplify getting the adapter of a client

has been applied to the regulator tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.3

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 6b96092a6bfa65566dda2f5a68a559a743b8d132 Mon Sep 17 00:00:00 2001

From: Wolfram Sang <[email protected]>
Date: Sat, 8 Jun 2019 12:56:04 +0200
Subject: [PATCH] regulator: max8952: simplify getting the adapter of a client

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

---
 drivers/regulator/max8952.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max8952.c +1 -1
index cf2a2912cb1b..451237efb359 100644
@@ -192,7 +192,7 @@ static struct max8952_platform_data *max8952_parse_dt(struct device *dev)
 static int max8952_pmic_probe(struct i2c_client *client,
 		const struct i2c_device_id *i2c_id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct max8952_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct regulator_config config = { };
 	struct max8952_data *max8952;
Signature · 1 line
2.20.1
#55 lore raw

PATCH 26/34 rtc: fm3130: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-fm3130.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/rtc/rtc-fm3130.c +3 -5
index e1137670d4d2..015cf639166e 100644
@@ -107,8 +107,7 @@ static int fm3130_get_time(struct device *dev, struct rtc_time *t)
 	fm3130_rtc_mode(dev, FM3130_MODE_READ);
 
 	/* read the RTC date and time registers all at once */
-	tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
-			fm3130->msg, 2);
+	tmp = i2c_transfer(fm3130->client->adapter, fm3130->msg, 2);
 	if (tmp != 2) {
 		dev_err(dev, "%s error %d\n", "read", tmp);
 		return -EIO;
@@ -200,8 +199,7 @@ static int fm3130_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	}
 
 	/* read the RTC alarm registers all at once */
-	tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
-			&fm3130->msg[2], 2);
+	tmp = i2c_transfer(fm3130->client->adapter, &fm3130->msg[2], 2);
 	if (tmp != 2) {
 		dev_err(dev, "%s error %d\n", "read", tmp);
 		return -EIO;
@@ -351,7 +349,7 @@ static int fm3130_probe(struct i2c_client *client,
 	struct fm3130		*fm3130;
 	int			err = -ENODEV;
 	int			tmp;
-	struct i2c_adapter	*adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter	*adapter = client->adapter;
 
 	if (!i2c_check_functionality(adapter,
 			I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
Signature · 1 line
2.19.1
maintainer Applied
#56 lore raw

Re: [PATCH 26/34] rtc: fm3130: simplify getting the adapter of a client

Quoted 11 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-fm3130.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#57 lore raw

PATCH 27/34 rtc: m41t80: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-m41t80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-m41t80.c +1 -1
index dd5a8991f75b..e55179d74377 100644
@@ -876,7 +876,7 @@ static struct notifier_block wdt_notifier = {
 static int m41t80_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int rc = 0;
 	struct rtc_time tm;
 	struct m41t80_data *m41t80_data = NULL;
Signature · 1 line
2.19.1
maintainer Applied
#58 lore raw

Re: [PATCH 27/34] rtc: m41t80: simplify getting the adapter of a client

Quoted 11 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

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

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#59 lore raw

PATCH 28/34 rtc: rv8803: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-rv8803.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rv8803.c +1 -1
index 0b102c3cf5a4..fc5243400108 100644
@@ -517,7 +517,7 @@ static int rx8900_trickle_charger_init(struct rv8803_data *rv8803)
 static int rv8803_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct rv8803_data *rv8803;
 	int err, flags;
 	struct nvmem_config nvmem_cfg = {
Signature · 1 line
2.19.1
maintainer Applied
#60 lore raw

Re: [PATCH 28/34] rtc: rv8803: simplify getting the adapter of a client

Quoted 11 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

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

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#61 lore raw

PATCH 29/34 rtc: rx8010: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-rx8010.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rx8010.c +1 -1
index 7ddc22eb5b0f..2b58b9b683a9 100644
@@ -437,7 +437,7 @@ static struct rtc_class_ops rx8010_rtc_ops = {
 static int rx8010_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct rx8010_data *rx8010;
 	int err = 0;
 
Signature · 1 line
2.19.1
maintainer Applied
#62 lore raw

Re: [PATCH 29/34] rtc: rx8010: simplify getting the adapter of a client

Quoted 11 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

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

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#63 lore raw

PATCH 30/34 rtc: rx8025: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/rtc/rtc-rx8025.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rx8025.c +1 -1
index fddc996cb38d..781fa992afab 100644
@@ -504,7 +504,7 @@ static void rx8025_sysfs_unregister(struct device *dev)
 static int rx8025_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct rx8025_data *rx8025;
 	int err = 0;
 
Signature · 1 line
2.19.1
maintainer Applied
#64 lore raw

Re: [PATCH 30/34] rtc: rx8025: simplify getting the adapter of a client

Quoted 11 lines · Wolfram Sang

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

---

Please apply to your subsystem tree.

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

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#65 lore raw

PATCH 31/34 staging: media: soc_camera: imx074: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/imx074.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/imx074.c +1 -1
index d907aa62f898..14240b74cdd0 100644
@@ -409,7 +409,7 @@ static int imx074_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
 	struct imx074 *priv;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
 	int ret;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 31/34
#66 lore raw

Re: [PATCH 31/34] staging: media: soc_camera: imx074: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/imx074.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/imx074.c +1 -1
index d907aa62f898..14240b74cdd0 100644
@@ -409,7 +409,7 @@ static int imx074_probe(struct i2c_client *client,
 			const struct i2c_device_id *did)
 {
 	struct imx074 *priv;
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
 	int ret;
 
Signature · 1 line
2.19.1
#67 lore raw

PATCH 32/34 staging: media: soc_camera: mt9t031: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/mt9t031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/mt9t031.c +1 -1
index 615ae9df2c57..c14f23221544 100644
@@ -751,7 +751,7 @@ static int mt9t031_probe(struct i2c_client *client,
 {
 	struct mt9t031 *mt9t031;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!ssdd) {
Signature · 1 line
2.19.1
Reviewed-by on v1 32/34
#68 lore raw

Re: [PATCH 32/34] staging: media: soc_camera: mt9t031: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/mt9t031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/mt9t031.c +1 -1
index 615ae9df2c57..c14f23221544 100644
@@ -751,7 +751,7 @@ static int mt9t031_probe(struct i2c_client *client,
 {
 	struct mt9t031 *mt9t031;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	int ret;
 
 	if (!ssdd) {
Signature · 1 line
2.19.1
#69 lore raw

PATCH 33/34 staging: media: soc_camera: soc_mt9v022: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/soc_mt9v022.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/soc_mt9v022.c +1 -1
index e7e0d3d29499..1739a618846d 100644
@@ -883,7 +883,7 @@ static int mt9v022_probe(struct i2c_client *client,
 {
 	struct mt9v022 *mt9v022;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct mt9v022_platform_data *pdata;
 	int ret;
 
Signature · 1 line
2.19.1
Reviewed-by on v1 33/34
#70 lore raw

Re: [PATCH 33/34] staging: media: soc_camera: soc_mt9v022: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 23 lines

---

Please apply to your subsystem tree.

 drivers/staging/media/soc_camera/soc_mt9v022.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/soc_camera/soc_mt9v022.c +1 -1
index e7e0d3d29499..1739a618846d 100644
@@ -883,7 +883,7 @@ static int mt9v022_probe(struct i2c_client *client,
 {
 	struct mt9v022 *mt9v022;
 	struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
-	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adapter = client->adapter;
 	struct mt9v022_platform_data *pdata;
 	int ret;
 
Signature · 1 line
2.19.1
#71 lore raw

PATCH 34/34 usb: typec: tcpm: fusb302: simplify getting the adapter of a client

In reply to Wolfram Sang

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

---

Please apply to your subsystem tree.

 drivers/usb/typec/tcpm/fusb302.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/typec/tcpm/fusb302.c +1 -2
index 7302f7501ec9..c524088246ee 100644
@@ -1697,13 +1697,12 @@ static int fusb302_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
 	struct fusb302_chip *chip;
-	struct i2c_adapter *adapter;
+	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	const char *name;
 	int ret = 0;
 	u32 v;
 
-	adapter = to_i2c_adapter(client->dev.parent);
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
 		dev_err(&client->dev,
 			"I2C/SMBus block functionality not supported!\n");
Signature · 1 line
2.19.1
Reviewed-by on v1 34/34
#72 lore raw

Re: [PATCH 34/34] usb: typec: tcpm: fusb302: simplify getting the adapter of a client

Quoted 4 lines · Wolfram Sang

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

Quoted 27 lines

---

Please apply to your subsystem tree.

  drivers/usb/typec/tcpm/fusb302.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/typec/tcpm/fusb302.c +1 -2
index 7302f7501ec9..c524088246ee 100644
@@ -1697,13 +1697,12 @@ static int fusb302_probe(struct i2c_client *client,
  			 const struct i2c_device_id *id)
  {
  	struct fusb302_chip *chip;
-	struct i2c_adapter *adapter;
+	struct i2c_adapter *adapter = client->adapter;
  	struct device *dev = &client->dev;
  	const char *name;
  	int ret = 0;
  	u32 v;
 
-	adapter = to_i2c_adapter(client->dev.parent);
  	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
  		dev_err(&client->dev,
  			"I2C/SMBus block functionality not supported!\n");
Reviewed-by
#73 lore raw

Re: [PATCH 34/34] usb: typec: tcpm: fusb302: simplify getting the adapter of a client

Quoted 7 lines · Guenter Roeck
Quoted 4 lines · Wolfram Sang

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

Quoted 28 lines
Quoted 27 lines

---

Please apply to your subsystem tree.

  drivers/usb/typec/tcpm/fusb302.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/typec/tcpm/fusb302.c +1 -2
index 7302f7501ec9..c524088246ee 100644
@@ -1697,13 +1697,12 @@ static int fusb302_probe(struct i2c_client *client,
  			 const struct i2c_device_id *id)
  {
  	struct fusb302_chip *chip;
-	struct i2c_adapter *adapter;
+	struct i2c_adapter *adapter = client->adapter;
  	struct device *dev = &client->dev;
  	const char *name;
  	int ret = 0;
  	u32 v;
-	adapter = to_i2c_adapter(client->dev.parent);
  	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
  		dev_err(&client->dev,
  			"I2C/SMBus block functionality not supported!\n");
 
#74 lore raw
In reply to Wolfram Sang
Quoted 17 lines · Wolfram Sang

While preparing a refactoring series, I noticed that some drivers use a complicated way of determining the adapter of a client. The easy way is to use the intended pointer: client->adapter

These drivers do:

	to_i2c_adapter(client->dev.parent);

The I2C core populates the parent pointer 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.

Quoted 6 lines

The conversion was done using a coccinelle script with some manual indentation fixes applied on top.

To avoid a brown paper bag mistake, I double checked this on a Renesas Salvator-XS board (R-Car M3N) and verified both expression result in the same pointer. Other than that, the series is only build tested.

Similar things go on in:

drivers/hwmon/lm90.c
drivers/leds/leds-is31fl319x.c
drivers/of/unittest.c

Those have this pattern:

	struct device *dev = &client->dev;
	struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);

And drivers/rtc/rtc-fm3130.c has a couple of these:

	tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
			...);

where fm3130->client is of type "struct i2c_client *"

Cheers,
Peter

#75 lore raw

Hi Peter,

Quoted 5 lines

Similar things go on in:

drivers/hwmon/lm90.c
drivers/leds/leds-is31fl319x.c
drivers/of/unittest.c

Right. I'll fix them, too.

Quoted 1 line

And drivers/rtc/rtc-fm3130.c has a couple of these:

These are fixed in patch 26 of this series.

Thanks and happy hacking,

Wolfram

#76 lore raw
In reply to Wolfram Sang

Hi,

Quoted 26 lines · Wolfram Sang

While preparing a refactoring series, I noticed that some drivers use a complicated way of determining the adapter of a client. The easy way is to use the intended pointer: client->adapter

These drivers do:

	to_i2c_adapter(client->dev.parent);

The I2C core populates the parent pointer 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.

The conversion was done using a coccinelle script with some manual indentation fixes applied on top.

To avoid a brown paper bag mistake, I double checked this on a Renesas Salvator-XS board (R-Car M3N) and verified both expression result in the same pointer. Other than that, the series is only build tested.

A branch can be found here:

Quoted 8 lines

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

Thanks, I queued the patches prefixed with "power: supply: [...]".

-- Sebastian

Quoted 77 lines

Wolfram Sang (34):
clk: clk-cdce706: simplify getting the adapter of a client
gpu: drm: bridge: sii9234: simplify getting the adapter of a client
iio: light: bh1780: simplify getting the adapter of a client
leds: leds-pca955x: simplify getting the adapter of a client
leds: leds-tca6507: simplify getting the adapter of a client
media: i2c: ak881x: simplify getting the adapter of a client
media: i2c: mt9m001: simplify getting the adapter of a client
media: i2c: mt9m111: simplify getting the adapter of a client
media: i2c: mt9p031: simplify getting the adapter of a client
media: i2c: ov2640: simplify getting the adapter of a client
media: i2c: tw9910: simplify getting the adapter of a client
misc: fsa9480: simplify getting the adapter of a client
misc: isl29003: simplify getting the adapter of a client
misc: tsl2550: simplify getting the adapter of a client
mtd: maps: pismo: simplify getting the adapter of a client
power: supply: bq24190_charger: simplify getting the adapter of a client
power: supply: bq24257_charger: simplify getting the adapter of a client
power: supply: bq25890_charger: simplify getting the adapter of a client
power: supply: max14656_charger_detector: simplify getting the adapter
of a client
power: supply: max17040_battery: simplify getting the adapter of a client
power: supply: max17042_battery: simplify getting the adapter of a client
power: supply: rt5033_battery: simplify getting the adapter of a client
power: supply: rt9455_charger: simplify getting the adapter of a client
power: supply: sbs-manager: simplify getting the adapter of a client
regulator: max8952: simplify getting the adapter of a client
rtc: fm3130: simplify getting the adapter of a client
rtc: m41t80: simplify getting the adapter of a client
rtc: rv8803: simplify getting the adapter of a client
rtc: rx8010: simplify getting the adapter of a client
rtc: rx8025: simplify getting the adapter of a client
staging: media: soc_camera: imx074: simplify getting the adapter of a client
staging: media: soc_camera: mt9t031: simplify getting the adapter of a client
staging: media: soc_camera: soc_mt9v022: simplify getting the adapter
of a client
usb: typec: tcpm: fusb302: simplify getting the adapter of a client

 drivers/clk/clk-cdce706.c                        | 2 +-
 drivers/gpu/drm/bridge/sii9234.c                 | 4 ++--
 drivers/iio/light/bh1780.c                       | 2 +-
 drivers/leds/leds-pca955x.c                      | 2 +-
 drivers/leds/leds-tca6507.c                      | 2 +-
 drivers/media/i2c/ak881x.c                       | 2 +-
 drivers/media/i2c/mt9m001.c                      | 2 +-
 drivers/media/i2c/mt9m111.c                      | 2 +-
 drivers/media/i2c/mt9p031.c                      | 2 +-
 drivers/media/i2c/ov2640.c                       | 2 +-
 drivers/media/i2c/tw9910.c                       | 3 +--
 drivers/misc/fsa9480.c                           | 2 +-
 drivers/misc/isl29003.c                          | 2 +-
 drivers/misc/tsl2550.c                           | 2 +-
 drivers/mtd/maps/pismo.c                         | 2 +-
 drivers/power/supply/bq24190_charger.c           | 2 +-
 drivers/power/supply/bq24257_charger.c           | 2 +-
 drivers/power/supply/bq25890_charger.c           | 2 +-
 drivers/power/supply/max14656_charger_detector.c | 2 +-
 drivers/power/supply/max17040_battery.c          | 2 +-
 drivers/power/supply/max17042_battery.c          | 2 +-
 drivers/power/supply/rt5033_battery.c            | 2 +-
 drivers/power/supply/rt9455_charger.c            | 2 +-
 drivers/power/supply/sbs-manager.c               | 2 +-
 drivers/regulator/max8952.c                      | 2 +-
 drivers/rtc/rtc-fm3130.c                         | 8 +++-----
 drivers/rtc/rtc-m41t80.c                         | 2 +-
 drivers/rtc/rtc-rv8803.c                         | 2 +-
 drivers/rtc/rtc-rx8010.c                         | 2 +-
 drivers/rtc/rtc-rx8025.c                         | 2 +-
 drivers/staging/media/soc_camera/imx074.c        | 2 +-
 drivers/staging/media/soc_camera/mt9t031.c       | 2 +-
 drivers/staging/media/soc_camera/soc_mt9v022.c   | 2 +-
 drivers/usb/typec/tcpm/fusb302.c                 | 3 +--
 34 files changed, 37 insertions(+), 41 deletions(-)
Signature · 1 line
2.19.1