Skip to contentSkip to conversation

i2c: mux: pca954x: simplify code to reach the adapter

PATCH RESEND Superseded Luca Ceresoli 3 participants 3 messages Sep 26, 2018 – Oct 1, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 i2c: mux: pca954x: simplify code to reach the adapter

From: Luca Ceresoli <[email protected]>

struct i2c_client has a direct pointer to the adapter, no need to dig it out of the struct device tree.

---

Sorry for the RESEND noise, but my provider and vger are not interacting (again). I'll solve the issue at its root ASAP, but in the meanwhile I'm sending from a different account.

 drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index 24bd9275fde5..bfabf985e830 100644
@@ -347,7 +347,7 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)
 static int pca954x_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adap = client->adapter;
 	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct device *dev = &client->dev;
 	struct device_node *np = dev->of_node;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Luca Ceresoli

From: Luca Ceresoli <[email protected]>

struct i2c_client has a direct pointer to the adapter, no need to dig it out of the struct device tree.

Right, looks sane, but can you please also do the same thing for the ltc4306 and mlxcpld drivers which have the same pattern?

Cheers,
Peter

Quoted 24 lines

---

Sorry for the RESEND noise, but my provider and vger are not interacting (again). I'll solve the issue at its root ASAP, but in the meanwhile I'm sending from a different account.

 drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-pca954x.c +1 -1
index 24bd9275fde5..bfabf985e830 100644
@@ -347,7 +347,7 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)
 static int pca954x_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adap = client->adapter;
 	struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct device *dev = &client->dev;
 	struct device_node *np = dev->of_node;
#2 lore raw

Hi Peter,

thanks for the review.

Quoted 8 lines · Peter Rosin
Quoted 4 lines · Luca Ceresoli

From: Luca Ceresoli <[email protected]>

struct i2c_client has a direct pointer to the adapter, no need to dig it out of the struct device tree.

Right, looks sane, but can you please also do the same thing for the ltc4306 and mlxcpld drivers which have the same pattern?

No problem. But be aware I can't runtime test these two drivers.

Signature · 1 line
Luca