Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Rosen Penev and committed by
Andi Shyti
f6551f78 fc31008d

+4 -5
+4 -5
drivers/i2c/busses/i2c-rtl9300.c
··· 371 371 { 372 372 struct device *dev = &pdev->dev; 373 373 struct rtl9300_i2c *i2c; 374 - struct fwnode_handle *child; 375 374 const struct rtl9300_i2c_drv_data *drv_data; 376 375 struct reg_field fields[F_NUM_FIELDS]; 377 376 u32 clock_freq, scl_num, sda_num; ··· 414 415 return ret; 415 416 416 417 i = 0; 417 - device_for_each_child_node(dev, child) { 418 + for_each_child_of_node_scoped(dev->of_node, child) { 418 419 struct rtl9300_i2c_chan *chan = &i2c->chans[i]; 419 420 struct i2c_adapter *adap = &chan->adap; 420 421 421 - ret = fwnode_property_read_u32(child, "reg", &sda_num); 422 + ret = of_property_read_u32(child, "reg", &sda_num); 422 423 if (ret) 423 424 return ret; 424 425 425 - ret = fwnode_property_read_u32(child, "clock-frequency", &clock_freq); 426 + ret = of_property_read_u32(child, "clock-frequency", &clock_freq); 426 427 if (ret) 427 428 clock_freq = I2C_MAX_STANDARD_MODE_FREQ; 428 429 ··· 448 449 adap->retries = 3; 449 450 adap->dev.parent = dev; 450 451 i2c_set_adapdata(adap, chan); 451 - adap->dev.of_node = to_of_node(child); 452 + adap->dev.of_node = child; 452 453 snprintf(adap->name, sizeof(adap->name), "%s SDA%d\n", dev_name(dev), sda_num); 453 454 i++; 454 455