Skip to contentSkip to conversation

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

PATCH In review Luca Ceresoli 3 participants 7 messages Oct 3, 2018 – Oct 8, 2018

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

PATCH v2 1/3 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.

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

PATCH v2 2/3 i2c: mux: ltc4306: 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.

---
 drivers/i2c/muxes/i2c-mux-ltc4306.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
index a9af93259b19..83a714605cd6 100644
@@ -208,7 +208,7 @@ MODULE_DEVICE_TABLE(of, ltc4306_of_match);
 
 static int ltc4306_probe(struct i2c_client *client)
 {
-	struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
+	struct i2c_adapter *adap = client->adapter;
 	const struct chip_desc *chip;
 	struct i2c_mux_core *muxc;
 	struct ltc4306 *data;
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/3 i2c: mux: mlxcpld: simplify code to reach the adapter

In reply to 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.

---
 drivers/i2c/muxes/i2c-mux-mlxcpld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-mlxcpld.c +1 -1
index f2bf3e57ed67..5ed55ca4fe93 100644
@@ -132,7 +132,7 @@ static int mlxcpld_mux_deselect(struct i2c_mux_core *muxc, u32 chan)
 static int mlxcpld_mux_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 mlxcpld_mux_plat_data *pdata = dev_get_platdata(&client->dev);
 	struct i2c_mux_core *muxc;
 	int num, force;
Signature · 1 line
2.17.1