]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: isch: switch i2c registration to devm functions
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 16 Sep 2024 12:01:32 +0000 (15:01 +0300)
committerAndi Shyti <andi.shyti@kernel.org>
Wed, 13 Nov 2024 22:29:45 +0000 (23:29 +0100)
Switch from i2c_add_adapter() to resource managed devm_i2c_add_adapter()
for matching rest of driver initialization, and more concise code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-isch.c

index 0fe7c9d1dd0d130d7273a6690a1748a6789704f9..d752f822b52ea61068469bf6127c0cf2d4f26a42 100644 (file)
@@ -274,7 +274,6 @@ static int smbus_sch_probe(struct platform_device *dev)
 {
        struct sch_i2c *priv;
        struct resource *res;
-       int retval;
 
        priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
@@ -299,20 +298,7 @@ static int smbus_sch_probe(struct platform_device *dev)
        snprintf(priv->adapter.name, sizeof(priv->adapter.name),
                 "SMBus SCH adapter at %04x", (unsigned short)res->start);
 
-       retval = i2c_add_adapter(&priv->adapter);
-       if (retval)
-               return retval;
-
-       platform_set_drvdata(dev, priv);
-
-       return 0;
-}
-
-static void smbus_sch_remove(struct platform_device *pdev)
-{
-       struct sch_i2c *priv = platform_get_drvdata(pdev);
-
-       i2c_del_adapter(&priv->adapter);
+       return devm_i2c_add_adapter(&dev->dev, &priv->adapter);
 }
 
 static struct platform_driver smbus_sch_driver = {
@@ -320,7 +306,6 @@ static struct platform_driver smbus_sch_driver = {
                .name = "isch_smbus",
        },
        .probe          = smbus_sch_probe,
-       .remove_new     = smbus_sch_remove,
 };
 
 module_platform_driver(smbus_sch_driver);