2019-06-08 10:58:11

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 00/34] 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(-)

--
2.19.1


2019-06-08 10:58:22

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 19/34] power: supply: max14656_charger_detector: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/max14656_charger_detector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/max14656_charger_detector.c b/drivers/power/supply/max14656_charger_detector.c
index 9e6472834e37..f27b780d2c02 100644
--- a/drivers/power/supply/max14656_charger_detector.c
+++ b/drivers/power/supply/max14656_charger_detector.c
@@ -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;
--
2.19.1

2019-06-08 10:58:40

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 29/34] rtc: rx8010: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 7ddc22eb5b0f..2b58b9b683a9 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -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;

--
2.19.1

2019-06-08 10:58:47

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 26/34] rtc: fm3130: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
index e1137670d4d2..015cf639166e 100644
--- a/drivers/rtc/rtc-fm3130.c
+++ b/drivers/rtc/rtc-fm3130.c
@@ -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))
--
2.19.1

2019-06-08 10:58:51

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 24/34] power: supply: sbs-manager: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/sbs-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
index cb6e8f66c7a2..4c29a89df968 100644
--- a/drivers/power/supply/sbs-manager.c
+++ b/drivers/power/supply/sbs-manager.c
@@ -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;
--
2.19.1

2019-06-08 10:59:02

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 18/34] power: supply: bq25890_charger: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/bq25890_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index b2ff82b4707a..d333f2b321b9 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -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;
--
2.19.1

2019-06-08 10:59:18

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 32/34] staging: media: soc_camera: mt9t031: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/staging/media/soc_camera/mt9t031.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/soc_camera/mt9t031.c b/drivers/staging/media/soc_camera/mt9t031.c
index 615ae9df2c57..c14f23221544 100644
--- a/drivers/staging/media/soc_camera/mt9t031.c
+++ b/drivers/staging/media/soc_camera/mt9t031.c
@@ -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) {
--
2.19.1

2019-06-08 10:59:40

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 31/34] staging: media: soc_camera: imx074: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/staging/media/soc_camera/imx074.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/soc_camera/imx074.c b/drivers/staging/media/soc_camera/imx074.c
index d907aa62f898..14240b74cdd0 100644
--- a/drivers/staging/media/soc_camera/imx074.c
+++ b/drivers/staging/media/soc_camera/imx074.c
@@ -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;

--
2.19.1

2019-06-08 10:59:45

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 30/34] rtc: rx8025: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index fddc996cb38d..781fa992afab 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -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;

--
2.19.1

2019-06-08 11:00:01

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 27/34] rtc: m41t80: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index dd5a8991f75b..e55179d74377 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -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;
--
2.19.1

2019-06-08 11:00:02

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 33/34] staging: media: soc_camera: soc_mt9v022: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/staging/media/soc_camera/soc_mt9v022.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/soc_camera/soc_mt9v022.c b/drivers/staging/media/soc_camera/soc_mt9v022.c
index e7e0d3d29499..1739a618846d 100644
--- a/drivers/staging/media/soc_camera/soc_mt9v022.c
+++ b/drivers/staging/media/soc_camera/soc_mt9v022.c
@@ -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;

--
2.19.1

2019-06-08 11:00:04

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 34/34] usb: typec: tcpm: fusb302: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/usb/typec/tcpm/fusb302.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 7302f7501ec9..c524088246ee 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -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");
--
2.19.1

2019-06-08 11:00:19

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 25/34] 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 2a123b87d9f2..5d3096e20f47 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -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;
--
2.19.1

2019-06-08 11:00:32

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 23/34] power: supply: rt9455_charger: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/rt9455_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c
index 40a9d329418a..29161ae90245 100644
--- a/drivers/power/supply/rt9455_charger.c
+++ b/drivers/power/supply/rt9455_charger.c
@@ -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 = {};
--
2.19.1

2019-06-08 11:00:32

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 22/34] power: supply: rt5033_battery: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/rt5033_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
index bcdd83048492..508f825ff190 100644
--- a/drivers/power/supply/rt5033_battery.c
+++ b/drivers/power/supply/rt5033_battery.c
@@ -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;
--
2.19.1

2019-06-08 11:00:44

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 21/34] power: supply: max17042_battery: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/max17042_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 581c6bd23388..64f3358eaa3c 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -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;
--
2.19.1

2019-06-08 11:00:48

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 10/34] media: i2c: ov2640: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/ov2640.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index 83031cfc7914..30e7e6b2b293 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -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)) {
--
2.19.1

2019-06-08 11:00:58

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 17/34] power: supply: bq24257_charger: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/bq24257_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq24257_charger.c b/drivers/power/supply/bq24257_charger.c
index 7eb58f10e092..eb151687beb3 100644
--- a/drivers/power/supply/bq24257_charger.c
+++ b/drivers/power/supply/bq24257_charger.c
@@ -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;
--
2.19.1

2019-06-08 11:01:00

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 20/34] power: supply: max17040_battery: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/max17040_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index 91cafc7bed30..62499018e68b 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -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;

--
2.19.1

2019-06-08 11:01:09

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 15/34] mtd: maps: pismo: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/mtd/maps/pismo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
index 788d4996e2c1..7fcae3af435c 100644
--- a/drivers/mtd/maps/pismo.c
+++ b/drivers/mtd/maps/pismo.c
@@ -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;
--
2.19.1

2019-06-08 11:01:16

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 28/34] rtc: rv8803: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index 0b102c3cf5a4..fc5243400108 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -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 = {
--
2.19.1

2019-06-08 11:01:18

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 13/34] misc: isl29003: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c
index 3431a825f24e..5d0d0c3bad85 100644
--- a/drivers/misc/isl29003.c
+++ b/drivers/misc/isl29003.c
@@ -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;

--
2.19.1

2019-06-08 11:01:20

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 08/34] media: i2c: mt9m111: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/mt9m111.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index 5168bb5880c4..a9da43316504 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -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)) {
--
2.19.1

2019-06-08 11:01:26

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 11/34] media: i2c: tw9910: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/tw9910.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 4d7cd736b930..a25a350b0ddc 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -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) {
--
2.19.1

2019-06-08 11:01:42

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 09/34] media: i2c: mt9p031: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/mt9p031.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 715be3632b01..5d824dd33edd 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -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;
--
2.19.1

2019-06-08 11:01:42

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 02/34] gpu: drm: bridge: sii9234: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/gpu/drm/bridge/sii9234.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
index b36bbafb0e43..25d4ad8c7ad6 100644
--- a/drivers/gpu/drm/bridge/sii9234.c
+++ b/drivers/gpu/drm/bridge/sii9234.c
@@ -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;
--
2.19.1

2019-06-08 11:01:45

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 07/34] media: i2c: mt9m001: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/mt9m001.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c
index 4b23fde937b3..2df743cbe09d 100644
--- a/drivers/media/i2c/mt9m001.c
+++ b/drivers/media/i2c/mt9m001.c
@@ -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)) {
--
2.19.1

2019-06-08 11:01:58

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 05/34] leds: leds-tca6507: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index c59035e157d1..58be20cae183 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -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))
--
2.19.1

2019-06-08 11:01:58

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 04/34] leds: leds-pca955x: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index a9f5dad55956..460626d81c6a 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -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);
--
2.19.1

2019-06-08 11:02:00

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 01/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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
index f21d9092564f..476d29c013e5 100644
--- a/drivers/clk/clk-cdce706.c
+++ b/drivers/clk/clk-cdce706.c
@@ -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;

--
2.19.1

2019-06-08 11:02:08

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 03/34] iio: light: bh1780: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/iio/light/bh1780.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
index 340d64d0ac59..a8361006dcd9 100644
--- a/drivers/iio/light/bh1780.c
+++ b/drivers/iio/light/bh1780.c
@@ -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))
--
2.19.1

2019-06-08 11:02:19

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 16/34] power: supply: bq24190_charger: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/power/supply/bq24190_charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
index cc0dfdc9e85a..ec03521c46d1 100644
--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -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;
--
2.19.1

2019-06-08 11:02:33

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 14/34] misc: tsl2550: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c
index 5b7afd6190fe..09db397df287 100644
--- a/drivers/misc/tsl2550.c
+++ b/drivers/misc/tsl2550.c
@@ -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;

--
2.19.1

2019-06-08 11:03:07

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 06/34] media: i2c: ak881x: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

drivers/media/i2c/ak881x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
index 30f9db1351b9..09860603da64 100644
--- a/drivers/media/i2c/ak881x.c
+++ b/drivers/media/i2c/ak881x.c
@@ -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;

--
2.19.1

2019-06-08 11:10:16

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 12/34] misc: fsa9480: 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.

Signed-off-by: Wolfram Sang <[email protected]>
---

Please apply to your subsystem tree.

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

diff --git a/drivers/misc/fsa9480.c b/drivers/misc/fsa9480.c
index 607b489a6501..a8126790f8de 100644
--- a/drivers/misc/fsa9480.c
+++ b/drivers/misc/fsa9480.c
@@ -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;

--
2.19.1

2019-06-08 11:47:53

by Laurent Pinchart

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

Hi Wolfram,

Thank you for the patch.

On Sat, Jun 08, 2019 at 12:55:48PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Laurent Pinchart <[email protected]>

and taken in my tree.

> ---
>
> Please apply to your subsystem tree.
>
> drivers/media/i2c/mt9p031.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index 715be3632b01..5d824dd33edd 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -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;

--
Regards,

Laurent Pinchart

2019-06-08 11:55:14

by Laurent Pinchart

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

Hi Wolfram,

Thank you for the patch.

On Sat, Jun 08, 2019 at 12:55:41PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Laurent Pinchart <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/gpu/drm/bridge/sii9234.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
> index b36bbafb0e43..25d4ad8c7ad6 100644
> --- a/drivers/gpu/drm/bridge/sii9234.c
> +++ b/drivers/gpu/drm/bridge/sii9234.c
> @@ -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;

--
Regards,

Laurent Pinchart

2019-06-08 12:01:53

by Jonathan Cameron

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

On Sat, 8 Jun 2019 12:55:42 +0200
Wolfram Sang <[email protected]> wrote:

> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>
> Please apply to your subsystem tree.
>
> drivers/iio/light/bh1780.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
> index 340d64d0ac59..a8361006dcd9 100644
> --- a/drivers/iio/light/bh1780.c
> +++ b/drivers/iio/light/bh1780.c
> @@ -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))

2019-06-08 13:01:42

by Guenter Roeck

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

On 6/8/19 3:56 AM, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/usb/typec/tcpm/fusb302.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index 7302f7501ec9..c524088246ee 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -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");
>

2019-06-09 11:07:52

by Pavel Machek

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

On Sun 2019-06-09 13:03:40, Jacek Anaszewski wrote:
> Hi Wolfram,
>
> Thank you for the patches.
>
> On 6/8/19 12:55 PM, Wolfram Sang wrote:
> >We have a dedicated pointer for that, so use it. Much easier to read and
> >less computation involved.
> >
> >Signed-off-by: Wolfram Sang <[email protected]>
> >---
> >
> >Please apply to your subsystem tree.
> >
> > drivers/leds/leds-pca955x.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
> >index a9f5dad55956..460626d81c6a 100644
> >--- a/drivers/leds/leds-pca955x.c
> >+++ b/drivers/leds/leds-pca955x.c
> >@@ -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:
>
> Acked-by: Jacek Anaszewski <[email protected]>

4 and 5:

Acked-by: Pavel Machek <[email protected]>

But I wonder if it should go through the leds tree?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.36 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2019-06-09 11:17:34

by Jacek Anaszewski

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

Hi Wolfram,

Thank you for the patches.

On 6/8/19 12:55 PM, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/leds/leds-pca955x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
> index a9f5dad55956..460626d81c6a 100644
> --- a/drivers/leds/leds-pca955x.c
> +++ b/drivers/leds/leds-pca955x.c
> @@ -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:

Acked-by: Jacek Anaszewski <[email protected]>

--
Best regards,
Jacek Anaszewski

2019-06-09 11:20:46

by Jacek Anaszewski

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

On 6/9/19 1:05 PM, Pavel Machek wrote:
> On Sun 2019-06-09 13:03:40, Jacek Anaszewski wrote:
>> Hi Wolfram,
>>
>> Thank you for the patches.
>>
>> On 6/8/19 12:55 PM, Wolfram Sang wrote:
>>> We have a dedicated pointer for that, so use it. Much easier to read and
>>> less computation involved.
>>>
>>> Signed-off-by: Wolfram Sang <[email protected]>
>>> ---
>>>
>>> Please apply to your subsystem tree.
>>>
>>> drivers/leds/leds-pca955x.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
>>> index a9f5dad55956..460626d81c6a 100644
>>> --- a/drivers/leds/leds-pca955x.c
>>> +++ b/drivers/leds/leds-pca955x.c
>>> @@ -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:
>>
>> Acked-by: Jacek Anaszewski <[email protected]>
>
> 4 and 5:
>
> Acked-by: Pavel Machek <[email protected]>
>
> 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.

--
Best regards,
Jacek Anaszewski

2019-06-09 14:50:37

by Alexandre Belloni

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

On 08/06/2019 12:56:07+0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/rtc/rtc-rv8803.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-06-09 14:50:44

by Alexandre Belloni

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

On 08/06/2019 12:56:05+0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/rtc/rtc-fm3130.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-06-09 14:50:53

by Alexandre Belloni

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

On 08/06/2019 12:56:08+0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/rtc/rtc-rx8010.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-06-09 14:54:46

by Alexandre Belloni

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

On 08/06/2019 12:56:06+0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/rtc/rtc-m41t80.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-06-09 14:54:57

by Alexandre Belloni

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

On 08/06/2019 12:56:09+0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> Please apply to your subsystem tree.
>
> drivers/rtc/rtc-rx8025.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-06-09 16:40:43

by Peter Rosin

[permalink] [raw]
Subject: Re: [PATCH 00/34] treewide: simplify getting the adapter of an I2C client

On 2019-06-08 12:55, Wolfram Sang wrote:
> 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.

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

2019-06-10 07:15:59

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 00/34] treewide: simplify getting the adapter of an I2C client

Hi Peter,

> Similar things go on in:
>
> drivers/hwmon/lm90.c
> drivers/leds/leds-is31fl319x.c
> drivers/of/unittest.c

Right. I'll fix them, too.

> 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


Attachments:
(No filename) (305.00 B)
signature.asc (849.00 B)
Download all attachments

2019-06-10 17:37:12

by Mark Brown

[permalink] [raw]
Subject: 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

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.

Signed-off-by: Wolfram Sang <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
---
drivers/regulator/max8952.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index cf2a2912cb1b..451237efb359 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -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;
--
2.20.1

2019-06-12 18:00:09

by Andrzej Hajda

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

On 08.06.2019 13:40, Laurent Pinchart wrote:
> Hi Wolfram,
>
> Thank you for the patch.
>
> On Sat, Jun 08, 2019 at 12:55:41PM +0200, Wolfram Sang wrote:
>> We have a dedicated pointer for that, so use it. Much easier to read and
>> less computation involved.
>>
>> Signed-off-by: Wolfram Sang <[email protected]>
> Reviewed-by: Laurent Pinchart <[email protected]>


Queued to drm-misc-next.


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


Reviewed-by: Andrzej Hajda <[email protected]>

 --
Regards
Andrzej


>
>> ---
>>
>> Please apply to your subsystem tree.
>>
>> drivers/gpu/drm/bridge/sii9234.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9234.c
>> index b36bbafb0e43..25d4ad8c7ad6 100644
>> --- a/drivers/gpu/drm/bridge/sii9234.c
>> +++ b/drivers/gpu/drm/bridge/sii9234.c
>> @@ -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;


2019-06-13 15:40:54

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:11PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/staging/media/soc_camera/mt9t031.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/soc_camera/mt9t031.c b/drivers/staging/media/soc_camera/mt9t031.c
> index 615ae9df2c57..c14f23221544 100644
> --- a/drivers/staging/media/soc_camera/mt9t031.c
> +++ b/drivers/staging/media/soc_camera/mt9t031.c
> @@ -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) {
> --
> 2.19.1
>

2019-06-13 15:41:03

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:10PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/staging/media/soc_camera/imx074.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/soc_camera/imx074.c b/drivers/staging/media/soc_camera/imx074.c
> index d907aa62f898..14240b74cdd0 100644
> --- a/drivers/staging/media/soc_camera/imx074.c
> +++ b/drivers/staging/media/soc_camera/imx074.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:41:36

by Simon Horman

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

On Sat, Jun 08, 2019 at 05:59:17AM -0700, Guenter Roeck wrote:
> On 6/8/19 3:56 AM, Wolfram Sang wrote:
> > We have a dedicated pointer for that, so use it. Much easier to read and
> > less computation involved.
> >
> > Signed-off-by: Wolfram Sang <[email protected]>
>
> Reviewed-by: Guenter Roeck <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

>
> > ---
> >
> > Please apply to your subsystem tree.
> >
> > drivers/usb/typec/tcpm/fusb302.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> > index 7302f7501ec9..c524088246ee 100644
> > --- a/drivers/usb/typec/tcpm/fusb302.c
> > +++ b/drivers/usb/typec/tcpm/fusb302.c
> > @@ -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");
> >
>

2019-06-13 15:41:44

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:00PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/max17042_battery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
> index 581c6bd23388..64f3358eaa3c 100644
> --- a/drivers/power/supply/max17042_battery.c
> +++ b/drivers/power/supply/max17042_battery.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:41:46

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:59PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/max17040_battery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
> index 91cafc7bed30..62499018e68b 100644
> --- a/drivers/power/supply/max17040_battery.c
> +++ b/drivers/power/supply/max17040_battery.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:41:48

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:12PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/staging/media/soc_camera/soc_mt9v022.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/soc_camera/soc_mt9v022.c b/drivers/staging/media/soc_camera/soc_mt9v022.c
> index e7e0d3d29499..1739a618846d 100644
> --- a/drivers/staging/media/soc_camera/soc_mt9v022.c
> +++ b/drivers/staging/media/soc_camera/soc_mt9v022.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:42:17

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:03PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/sbs-manager.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/sbs-manager.c b/drivers/power/supply/sbs-manager.c
> index cb6e8f66c7a2..4c29a89df968 100644
> --- a/drivers/power/supply/sbs-manager.c
> +++ b/drivers/power/supply/sbs-manager.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:42:27

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:56PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/bq24257_charger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq24257_charger.c b/drivers/power/supply/bq24257_charger.c
> index 7eb58f10e092..eb151687beb3 100644
> --- a/drivers/power/supply/bq24257_charger.c
> +++ b/drivers/power/supply/bq24257_charger.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:42:33

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:02PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/rt9455_charger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/rt9455_charger.c b/drivers/power/supply/rt9455_charger.c
> index 40a9d329418a..29161ae90245 100644
> --- a/drivers/power/supply/rt9455_charger.c
> +++ b/drivers/power/supply/rt9455_charger.c
> @@ -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 = {};
> --
> 2.19.1
>

2019-06-13 15:42:40

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:54PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/mtd/maps/pismo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
> index 788d4996e2c1..7fcae3af435c 100644
> --- a/drivers/mtd/maps/pismo.c
> +++ b/drivers/mtd/maps/pismo.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:42:41

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:56:01PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/rt5033_battery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
> index bcdd83048492..508f825ff190 100644
> --- a/drivers/power/supply/rt5033_battery.c
> +++ b/drivers/power/supply/rt5033_battery.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:43:18

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:58PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/max14656_charger_detector.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/max14656_charger_detector.c b/drivers/power/supply/max14656_charger_detector.c
> index 9e6472834e37..f27b780d2c02 100644
> --- a/drivers/power/supply/max14656_charger_detector.c
> +++ b/drivers/power/supply/max14656_charger_detector.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:43:25

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:57PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/bq25890_charger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index b2ff82b4707a..d333f2b321b9 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:43:48

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:51PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/misc/fsa9480.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/fsa9480.c b/drivers/misc/fsa9480.c
> index 607b489a6501..a8126790f8de 100644
> --- a/drivers/misc/fsa9480.c
> +++ b/drivers/misc/fsa9480.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:43:57

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:55PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/power/supply/bq24190_charger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> index cc0dfdc9e85a..ec03521c46d1 100644
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
> @@ -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;
> --
> 2.19.1
>

2019-06-13 15:44:24

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:53PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>


Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/misc/tsl2550.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c
> index 5b7afd6190fe..09db397df287 100644
> --- a/drivers/misc/tsl2550.c
> +++ b/drivers/misc/tsl2550.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:44:27

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:52PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/misc/isl29003.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c
> index 3431a825f24e..5d0d0c3bad85 100644
> --- a/drivers/misc/isl29003.c
> +++ b/drivers/misc/isl29003.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:44:40

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:40PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/clk/clk-cdce706.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-cdce706.c b/drivers/clk/clk-cdce706.c
> index f21d9092564f..476d29c013e5 100644
> --- a/drivers/clk/clk-cdce706.c
> +++ b/drivers/clk/clk-cdce706.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:44:44

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:50PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---

Reviewed-by: Simon Horman <[email protected]>

>
> Please apply to your subsystem tree.
>
> drivers/media/i2c/tw9910.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
> index 4d7cd736b930..a25a350b0ddc 100644
> --- a/drivers/media/i2c/tw9910.c
> +++ b/drivers/media/i2c/tw9910.c
> @@ -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) {
> --
> 2.19.1
>

2019-06-13 15:44:51

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:47PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/media/i2c/mt9m111.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> index 5168bb5880c4..a9da43316504 100644
> --- a/drivers/media/i2c/mt9m111.c
> +++ b/drivers/media/i2c/mt9m111.c
> @@ -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)) {
> --
> 2.19.1
>

2019-06-13 15:44:53

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:49PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/media/i2c/ov2640.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
> index 83031cfc7914..30e7e6b2b293 100644
> --- a/drivers/media/i2c/ov2640.c
> +++ b/drivers/media/i2c/ov2640.c
> @@ -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)) {
> --
> 2.19.1
>

2019-06-13 15:45:02

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:45PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/media/i2c/ak881x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
> index 30f9db1351b9..09860603da64 100644
> --- a/drivers/media/i2c/ak881x.c
> +++ b/drivers/media/i2c/ak881x.c
> @@ -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;
>
> --
> 2.19.1
>

2019-06-13 15:45:05

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH 07/34] media: i2c: mt9m001: simplify getting the adapter of a client

On Sat, Jun 08, 2019 at 12:55:46PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

2019-06-13 15:45:21

by Simon Horman

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

On Sat, Jun 08, 2019 at 12:55:44PM +0200, Wolfram Sang wrote:
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

> ---
>
> Please apply to your subsystem tree.
>
> drivers/leds/leds-tca6507.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
> index c59035e157d1..58be20cae183 100644
> --- a/drivers/leds/leds-tca6507.c
> +++ b/drivers/leds/leds-tca6507.c
> @@ -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))
> --
> 2.19.1
>

2019-06-25 22:56:31

by Stephen Boyd

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

Quoting Wolfram Sang (2019-06-08 03:55:40)
> We have a dedicated pointer for that, so use it. Much easier to read and
> less computation involved.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---

Applied to clk-next

2019-06-27 18:30:03

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH 00/34] treewide: simplify getting the adapter of an I2C client

Hi,

On Sat, Jun 08, 2019 at 12:55:39PM +0200, Wolfram Sang wrote:
> 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

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

-- Sebastian

> 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(-)
>
> --
> 2.19.1
>


Attachments:
(No filename) (5.77 kB)
signature.asc (849.00 B)
Download all attachments