]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: core: Reuse fwnode variable where it makes sense
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 16 Apr 2025 07:01:34 +0000 (10:01 +0300)
committerWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 16 Apr 2025 16:08:12 +0000 (18:08 +0200)
Reuse fwnode variable where it makes sense. This avoids unneeded
duplication hidden in some macros and unifies the code for different
types of fwnode.

Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
drivers/i2c/i2c-core-base.c

index 08ff3f1eb28e3849741cd76289f3cb4b9be712d6..b186de31a9eefc13f02d4d297ba8d26ff2de50f5 100644 (file)
@@ -567,7 +567,7 @@ static int i2c_device_probe(struct device *dev)
 
        dev_dbg(dev, "probe\n");
 
-       status = of_clk_set_defaults(dev->of_node, false);
+       status = of_clk_set_defaults(to_of_node(fwnode), false);
        if (status < 0)
                goto err_clear_wakeup_irq;
 
@@ -1061,10 +1061,10 @@ void i2c_unregister_device(struct i2c_client *client)
 
        fwnode = dev_fwnode(&client->dev);
        if (is_of_node(fwnode)) {
-               of_node_clear_flag(client->dev.of_node, OF_POPULATED);
+               of_node_clear_flag(to_of_node(fwnode), OF_POPULATED);
                of_node_put(client->dev.of_node);
        } else if (is_acpi_device_node(fwnode)) {
-               acpi_device_clear_enumerated(ACPI_COMPANION(&client->dev));
+               acpi_device_clear_enumerated(to_acpi_device_node(fwnode));
        }
 
        device_remove_software_node(&client->dev);