Skip to content

Commit f6551f7

Browse files
nehebAndi Shyti
authored andcommitted
i2c: rtl9300: use of instead of fwnode
Avoids having to use to_of_node and just assign directly. This is an OF only driver anyway. Use _scoped for the for each loop to avoid refcount leaks. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20251217063027.37987-3-rosenp@gmail.com
1 parent fc31008 commit f6551f7

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/i2c/busses/i2c-rtl9300.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
371371
{
372372
struct device *dev = &pdev->dev;
373373
struct rtl9300_i2c *i2c;
374-
struct fwnode_handle *child;
375374
const struct rtl9300_i2c_drv_data *drv_data;
376375
struct reg_field fields[F_NUM_FIELDS];
377376
u32 clock_freq, scl_num, sda_num;
@@ -415,15 +414,15 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
415414
return ret;
416415

417416
i = 0;
418-
device_for_each_child_node(dev, child) {
417+
for_each_child_of_node_scoped(dev->of_node, child) {
419418
struct rtl9300_i2c_chan *chan = &i2c->chans[i];
420419
struct i2c_adapter *adap = &chan->adap;
421420

422-
ret = fwnode_property_read_u32(child, "reg", &sda_num);
421+
ret = of_property_read_u32(child, "reg", &sda_num);
423422
if (ret)
424423
return ret;
425424

426-
ret = fwnode_property_read_u32(child, "clock-frequency", &clock_freq);
425+
ret = of_property_read_u32(child, "clock-frequency", &clock_freq);
427426
if (ret)
428427
clock_freq = I2C_MAX_STANDARD_MODE_FREQ;
429428

@@ -449,7 +448,7 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
449448
adap->retries = 3;
450449
adap->dev.parent = dev;
451450
i2c_set_adapdata(adap, chan);
452-
adap->dev.of_node = to_of_node(child);
451+
adap->dev.of_node = child;
453452
snprintf(adap->name, sizeof(adap->name), "%s SDA%d\n", dev_name(dev), sda_num);
454453
i++;
455454

0 commit comments

Comments
 (0)