diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-12-14 13:35:08 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-01-10 15:43:46 +0100 |
commit | e70b9d7a74698f1374244b2251216428db920aed (patch) | |
tree | b8091531241075d04501751b5236ab54afbe48c2 /drivers/i2c | |
parent | 12763d0fe56899d3729d0e6755446ed7c740a88a (diff) | |
download | barebox-e70b9d7a74698f1374244b2251216428db920aed.tar.gz |
Rename device_d::device_node to device_d::of_node
Linux struct device has the member of_node for the device_node pointer.
Rename this in barebox accordingly to minimize the necessary changes
when porting Linux code. This was done with the semantic patch:
@@ struct device_d E; @@
- E.device_node
+ E.of_node
@@ struct device_d *E; @@
- E->device_node
+ E->of_node
Plus some manual adjustments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-at91.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-bcm283x.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-cadence.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-designware.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-gpio.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 16 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mv64xxx.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-rockchip.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-stm32.c | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 6 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-versatile.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-mux.c | 6 | ||||
-rw-r--r-- | drivers/i2c/i2c.c | 10 | ||||
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-pca954x.c | 4 |
15 files changed, 42 insertions, 40 deletions
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index b100dc6c17..49f0338df3 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -546,7 +546,7 @@ static int at91_twi_probe(struct device_d *dev) i2c_at91->adapter.master_xfer = at91_twi_xfer; i2c_at91->adapter.dev.parent = dev; i2c_at91->adapter.nr = dev->id; - i2c_at91->adapter.dev.device_node = dev->device_node; + i2c_at91->adapter.dev.of_node = dev->of_node; rc = i2c_add_numbered_adapter(&i2c_at91->adapter); if (rc) { diff --git a/drivers/i2c/busses/i2c-bcm283x.c b/drivers/i2c/busses/i2c-bcm283x.c index d9bbc17b13..63380d632e 100644 --- a/drivers/i2c/busses/i2c-bcm283x.c +++ b/drivers/i2c/busses/i2c-bcm283x.c @@ -271,7 +271,7 @@ static int bcm283x_i2c_probe(struct device_d *dev) int ret; struct resource *iores; struct bcm283x_i2c *bcm_i2c; - struct device_node *np = dev->device_node; + struct device_node *np = dev->of_node; bcm_i2c = xzalloc(sizeof(*bcm_i2c)); @@ -308,7 +308,7 @@ static int bcm283x_i2c_probe(struct device_d *dev) bcm_i2c->adapter.master_xfer = bcm283x_i2c_xfer; bcm_i2c->adapter.nr = dev->id; bcm_i2c->adapter.dev.parent = dev; - bcm_i2c->adapter.dev.device_node = np; + bcm_i2c->adapter.dev.of_node = np; ret = bcm283x_i2c_init(bcm_i2c); if (ret) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 5537efff23..255e085d90 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -398,7 +398,7 @@ static int cdns_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msg, static int cdns_i2c_probe(struct device_d *dev) { - struct device_node *np = dev->device_node; + struct device_node *np = dev->of_node; struct resource *iores; struct cdns_i2c *i2c; u32 bitrate; @@ -424,7 +424,7 @@ static int cdns_i2c_probe(struct device_d *dev) i2c->adapter.master_xfer = cdns_i2c_xfer; i2c->adapter.nr = dev->id; i2c->adapter.dev.parent = dev; - i2c->adapter.dev.device_node = np; + i2c->adapter.dev.of_node = np; cdns_i2c_reset_hardware(i2c); diff --git a/drivers/i2c/busses/i2c-designware.c b/drivers/i2c/busses/i2c-designware.c index 93b7af6623..70bb0dc4cc 100644 --- a/drivers/i2c/busses/i2c-designware.c +++ b/drivers/i2c/busses/i2c-designware.c @@ -245,7 +245,7 @@ static void i2c_dw_setup_timings(struct dw_i2c_dev *dw) u32 ht; int ret; - ret = of_property_read_u32(dw->adapter.dev.device_node, + ret = of_property_read_u32(dw->adapter.dev.of_node, "i2c-sda-hold-time-ns", &ht); if (ret) { /* Keep previous hold time setting if no one set it */ @@ -527,7 +527,7 @@ static int i2c_dw_probe(struct device_d *pdev) dw->adapter.master_xfer = i2c_dw_xfer; dw->adapter.nr = pdev->id; dw->adapter.dev.parent = pdev; - dw->adapter.dev.device_node = pdev->device_node; + dw->adapter.dev.of_node = pdev->of_node; iores = dev_request_mem_resource(pdev, 0); if (IS_ERR(iores)) { diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index ad0c4c8f82..abe3b804dd 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -140,8 +140,8 @@ static int i2c_gpio_probe(struct device_d *dev) bit_data = &priv->bit_data; pdata = &priv->pdata; - if (dev->device_node) { - ret = of_i2c_gpio_probe(dev->device_node, pdata); + if (dev->of_node) { + ret = of_i2c_gpio_probe(dev->of_node, pdata); if (ret) return ret; } else { @@ -193,7 +193,7 @@ static int i2c_gpio_probe(struct device_d *dev) adap->algo_data = bit_data; adap->dev.parent = dev; - adap->dev.device_node = dev->device_node; + adap->dev.of_node = dev->of_node; adap->bus_recovery_info = xzalloc(sizeof(*adap->bus_recovery_info)); adap->bus_recovery_info->scl_gpio = pdata->scl_pin; adap->bus_recovery_info->sda_gpio = pdata->sda_pin; diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index bd8183b266..91be49155c 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -527,13 +527,15 @@ static void i2c_fsl_unprepare_recovery(struct i2c_adapter *adapter) static void i2c_fsl_init_recovery(struct fsl_i2c_struct *i2c_fsl, struct device_d *dev) { - if (!dev->device_node) + if (!dev->of_node) return; - i2c_fsl->rinfo.sda_gpio = of_get_named_gpio_flags(dev->device_node, - "sda-gpios", 0, NULL); - i2c_fsl->rinfo.scl_gpio = of_get_named_gpio_flags(dev->device_node, - "scl-gpios", 0, NULL); + i2c_fsl->rinfo.sda_gpio = of_get_named_gpio_flags(dev->of_node, + "sda-gpios", 0, + NULL); + i2c_fsl->rinfo.scl_gpio = of_get_named_gpio_flags(dev->of_node, + "scl-gpios", 0, + NULL); if (!gpio_is_valid(i2c_fsl->rinfo.sda_gpio) || !gpio_is_valid(i2c_fsl->rinfo.scl_gpio)) @@ -585,7 +587,7 @@ static int __init i2c_fsl_probe(struct device_d *pdev) i2c_fsl->adapter.master_xfer = i2c_fsl_xfer; i2c_fsl->adapter.nr = pdev->id; i2c_fsl->adapter.dev.parent = pdev; - i2c_fsl->adapter.dev.device_node = pdev->device_node; + i2c_fsl->adapter.dev.of_node = pdev->of_node; iores = dev_request_mem_resource(pdev, 0); if (IS_ERR(iores)) { ret = PTR_ERR(iores); @@ -599,7 +601,7 @@ static int __init i2c_fsl_probe(struct device_d *pdev) /* Set up clock divider */ bitrate = 100000; - of_property_read_u32(pdev->device_node, "clock-frequency", &bitrate); + of_property_read_u32(pdev->of_node, "clock-frequency", &bitrate); if (pdata && pdata->bitrate) bitrate = pdata->bitrate; diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 765fc9926b..20b262e081 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -530,7 +530,7 @@ static int mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, struct device_d *pd) { - struct device_node *np = pd->device_node; + struct device_node *np = pd->of_node; u32 bus_freq, tclk; int rc = 0; u32 prop; @@ -602,7 +602,7 @@ mv64xxx_i2c_probe(struct device_d *pd) struct mv64xxx_i2c_data *drv_data; int rc; - if (!pd->device_node) + if (!pd->of_node) return -ENODEV; drv_data = xzalloc(sizeof(*drv_data)); @@ -625,7 +625,7 @@ mv64xxx_i2c_probe(struct device_d *pd) drv_data->adapter.master_xfer = mv64xxx_i2c_xfer; drv_data->adapter.dev.parent = pd; drv_data->adapter.nr = pd->id; - drv_data->adapter.dev.device_node = pd->device_node; + drv_data->adapter.dev.of_node = pd->of_node; mv64xxx_i2c_hw_init(drv_data); diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 29a618c8b2..74161288ae 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1091,8 +1091,8 @@ i2c_omap_probe(struct device_d *pdev) if (pdev->platform_data != NULL) { speed = *(u32 *)pdev->platform_data; } else { - of_property_read_u32(pdev->device_node, "clock-frequency", - &speed); + of_property_read_u32(pdev->of_node, "clock-frequency", + &speed); /* convert DT freq value in Hz into kHz for speed */ speed /= 1000; } @@ -1170,7 +1170,7 @@ i2c_omap_probe(struct device_d *pdev) i2c_omap->adapter.master_xfer = omap_i2c_xfer; i2c_omap->adapter.nr = pdev->id; i2c_omap->adapter.dev.parent = pdev; - i2c_omap->adapter.dev.device_node = pdev->device_node; + i2c_omap->adapter.dev.of_node = pdev->of_node; i2c_omap->adapter.bus_recovery_info = &omap_i2c_bus_recovery_info; /* i2c device drivers may be active on return from add_adapter() */ diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c index ca33905335..df71a8a733 100644 --- a/drivers/i2c/busses/i2c-rockchip.c +++ b/drivers/i2c/busses/i2c-rockchip.c @@ -410,7 +410,7 @@ static int rockchip_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, static int rk_i2c_probe(struct device_d *dev) { - struct device_node *np = dev->device_node; + struct device_node *np = dev->of_node; struct resource *iores; struct rk_i2c *i2c; unsigned bitrate; @@ -434,7 +434,7 @@ static int rk_i2c_probe(struct device_d *dev) i2c->adapter.master_xfer = rockchip_i2c_xfer; i2c->adapter.nr = dev->id; i2c->adapter.dev.parent = dev; - i2c->adapter.dev.device_node = np; + i2c->adapter.dev.of_node = np; /* Set up clock divider */ bitrate = 100000; diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c index d412630365..7825b50d9e 100644 --- a/drivers/i2c/busses/i2c-stm32.c +++ b/drivers/i2c/busses/i2c-stm32.c @@ -823,7 +823,7 @@ static int __init stm32_i2c_probe(struct device_d *dev) stm32_i2c->adapter.master_xfer = stm32_i2c_xfer; stm32_i2c->adapter.nr = dev->id; stm32_i2c->adapter.dev.parent = dev; - stm32_i2c->adapter.dev.device_node = dev->device_node; + stm32_i2c->adapter.dev.of_node = dev->of_node; iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) return PTR_ERR(iores); diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 077b55e175..eec377fc8a 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -627,14 +627,14 @@ static int tegra_i2c_probe(struct device_d *dev) return PTR_ERR(i2c_dev->rst); } - ret = of_property_read_u32(dev->device_node, "clock-frequency", + ret = of_property_read_u32(dev->of_node, "clock-frequency", &i2c_dev->bus_clk_rate); if (ret) i2c_dev->bus_clk_rate = 100000; /* default clock rate */ i2c_dev->hw = &tegra20_i2c_hw; dev_get_drvdata(dev, (const void **)&i2c_dev->hw); - i2c_dev->is_dvc = of_device_is_compatible(dev->device_node, + i2c_dev->is_dvc = of_device_is_compatible(dev->of_node, "nvidia,tegra20-i2c-dvc"); if (!i2c_dev->hw->has_single_clk_source) { @@ -655,7 +655,7 @@ static int tegra_i2c_probe(struct device_d *dev) i2c_dev->adapter.master_xfer = tegra_i2c_xfer; i2c_dev->adapter.dev.parent = dev; i2c_dev->adapter.nr = dev->id; - i2c_dev->adapter.dev.device_node = dev->device_node; + i2c_dev->adapter.dev.of_node = dev->of_node; ret = i2c_add_numbered_adapter(&i2c_dev->adapter); if (ret) { diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c index ece483f6f5..998d69422b 100644 --- a/drivers/i2c/busses/i2c-versatile.c +++ b/drivers/i2c/busses/i2c-versatile.c @@ -86,7 +86,7 @@ static int i2c_versatile_probe(struct device_d *dev) i2c->adap.algo_data = &i2c->algo; i2c->adap.dev.parent = dev; - i2c->adap.dev.device_node = dev->device_node; + i2c->adap.dev.of_node = dev->of_node; i2c->algo = i2c_versatile_algo; i2c->algo.data = i2c; diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 233d231525..1e5fd1e552 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -95,16 +95,16 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, * Try to populate the mux adapter's device_node, expands to * nothing if !CONFIG_OFDEVICE. */ - if (mux_dev->device_node) { + if (mux_dev->of_node) { struct device_node *child; u32 reg; - for_each_child_of_node(mux_dev->device_node, child) { + for_each_child_of_node(mux_dev->of_node, child) { ret = of_property_read_u32(child, "reg", ®); if (ret) continue; if (chan_id == reg) { - priv->adap.dev.device_node = child; + priv->adap.dev.of_node = child; break; } } diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c index 40590b7d11..ffcc866ad0 100644 --- a/drivers/i2c/i2c.c +++ b/drivers/i2c/i2c.c @@ -394,7 +394,7 @@ static struct i2c_client *i2c_new_device(struct i2c_adapter *adapter, client->dev.platform_data = chip->platform_data; client->dev.id = DEVICE_ID_DYNAMIC; client->dev.bus = &i2c_bus; - client->dev.device_node = chip->of_node; + client->dev.of_node = chip->of_node; client->adapter = adapter; client->addr = chip->addr; @@ -418,10 +418,10 @@ static void of_i2c_register_devices(struct i2c_adapter *adap) struct device_node *n; /* Only register child devices if the adapter has a node pointer set */ - if (!IS_ENABLED(CONFIG_OFDEVICE) || !adap->dev.device_node) + if (!IS_ENABLED(CONFIG_OFDEVICE) || !adap->dev.of_node) return; - for_each_available_child_of_node(adap->dev.device_node, n) { + for_each_available_child_of_node(adap->dev.of_node, n) { struct i2c_board_info info = {}; struct i2c_client *result; const __be32 *addr; @@ -578,7 +578,7 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node) return ERR_PTR(ret); for_each_i2c_adapter(adap) - if (adap->dev.device_node == node) + if (adap->dev.of_node == node) return adap; return NULL; @@ -615,7 +615,7 @@ static void i2c_parse_timing(struct device_d *dev, char *prop_name, u32 *cur_val { int ret; - ret = of_property_read_u32(dev->device_node, prop_name, cur_val_p); + ret = of_property_read_u32(dev->of_node, prop_name, cur_val_p); if (ret && use_def) *cur_val_p = def_val; diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index f547527fed..a05d25f344 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -199,7 +199,7 @@ static int pca954x_probe(struct device_d *dev) i2c_set_clientdata(client, data); - gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0); + gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); if (gpio_is_valid(gpio)) gpio_direction_output(gpio, 1); @@ -215,7 +215,7 @@ static int pca954x_probe(struct device_d *dev) if (ret) goto exit_free; - idle_disconnect = of_property_read_bool(dev->device_node, + idle_disconnect = of_property_read_bool(dev->of_node, "i2c-mux-idle-disconnect"); data->last_chan = 0; /* force the first selection */ |