]> git.baikalelectronics.ru Git - kernel.git/commitdiff
rtc: nvmem: remove nvram ABI
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 9 Nov 2020 16:34:05 +0000 (17:34 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 19 Nov 2020 11:50:11 +0000 (12:50 +0100)
The nvram sysfs attributes have been deprecated at least since v4.13, more
than 3 years ago and nobody ever complained about the deprecation warning.

Remove the sysfs attributes now.

[Bartosz: remove the declaration of rtc_nvmem_unregister()]

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20201109163409.24301-5-brgl@bgdev.pl
17 files changed:
drivers/rtc/class.c
drivers/rtc/nvmem.c
drivers/rtc/rtc-cmos.c
drivers/rtc/rtc-ds1305.c
drivers/rtc/rtc-ds1307.c
drivers/rtc/rtc-ds1343.c
drivers/rtc/rtc-ds1511.c
drivers/rtc/rtc-ds1553.c
drivers/rtc/rtc-ds1685.c
drivers/rtc/rtc-ds1742.c
drivers/rtc/rtc-m48t59.c
drivers/rtc/rtc-m48t86.c
drivers/rtc/rtc-rp5c01.c
drivers/rtc/rtc-rv8803.c
drivers/rtc/rtc-stk17ta8.c
drivers/rtc/rtc-tx4939.c
include/linux/rtc.h

index 7c88d190c51fc4ecd5f783e2ab20c5f9dd6eb5ca..a99b7d24b77c2b78fd696e99c2fefcfb0eab5ed3 100644 (file)
@@ -339,8 +339,6 @@ static void devm_rtc_release_device(struct device *dev, void *res)
 {
        struct rtc_device *rtc = *(struct rtc_device **)res;
 
-       rtc_nvmem_unregister(rtc);
-
        if (rtc->registered)
                rtc_device_unregister(rtc);
        else
index 4312096c773873160c583d2efd9d5b99ac646508..5e0b178a3b65fe241522bbb902730eff7e4ea985 100644 (file)
@@ -9,74 +9,7 @@
 #include <linux/types.h>
 #include <linux/nvmem-consumer.h>
 #include <linux/rtc.h>
-#include <linux/slab.h>
-#include <linux/sysfs.h>
 
-/*
- * Deprecated ABI compatibility, this should be removed at some point
- */
-
-static const char nvram_warning[] = "Deprecated ABI, please use nvmem";
-
-static ssize_t
-rtc_nvram_read(struct file *filp, struct kobject *kobj,
-              struct bin_attribute *attr,
-              char *buf, loff_t off, size_t count)
-{
-       dev_warn_once(kobj_to_dev(kobj), nvram_warning);
-
-       return nvmem_device_read(attr->private, off, count, buf);
-}
-
-static ssize_t
-rtc_nvram_write(struct file *filp, struct kobject *kobj,
-               struct bin_attribute *attr,
-               char *buf, loff_t off, size_t count)
-{
-       dev_warn_once(kobj_to_dev(kobj), nvram_warning);
-
-       return nvmem_device_write(attr->private, off, count, buf);
-}
-
-static int rtc_nvram_register(struct rtc_device *rtc,
-                             struct nvmem_device *nvmem, size_t size)
-{
-       int err;
-
-       rtc->nvram = kzalloc(sizeof(*rtc->nvram), GFP_KERNEL);
-       if (!rtc->nvram)
-               return -ENOMEM;
-
-       rtc->nvram->attr.name = "nvram";
-       rtc->nvram->attr.mode = 0644;
-       rtc->nvram->private = nvmem;
-
-       sysfs_bin_attr_init(rtc->nvram);
-
-       rtc->nvram->read = rtc_nvram_read;
-       rtc->nvram->write = rtc_nvram_write;
-       rtc->nvram->size = size;
-
-       err = sysfs_create_bin_file(&rtc->dev.parent->kobj,
-                                   rtc->nvram);
-       if (err) {
-               kfree(rtc->nvram);
-               rtc->nvram = NULL;
-       }
-
-       return err;
-}
-
-static void rtc_nvram_unregister(struct rtc_device *rtc)
-{
-       sysfs_remove_bin_file(&rtc->dev.parent->kobj, rtc->nvram);
-       kfree(rtc->nvram);
-       rtc->nvram = NULL;
-}
-
-/*
- * New ABI, uses nvmem
- */
 int rtc_nvmem_register(struct rtc_device *rtc,
                       struct nvmem_config *nvmem_config)
 {
@@ -88,20 +21,7 @@ int rtc_nvmem_register(struct rtc_device *rtc,
        nvmem_config->dev = rtc->dev.parent;
        nvmem_config->owner = rtc->owner;
        nvmem = devm_nvmem_register(rtc->dev.parent, nvmem_config);
-       if (IS_ERR(nvmem))
-               return PTR_ERR(nvmem);
-
-       /* Register the old ABI */
-       if (rtc->nvram_old_abi)
-               rtc_nvram_register(rtc, nvmem, nvmem_config->size);
 
-       return 0;
+       return PTR_ERR_OR_ZERO(nvmem);
 }
 EXPORT_SYMBOL_GPL(rtc_nvmem_register);
-
-void rtc_nvmem_unregister(struct rtc_device *rtc)
-{
-       /* unregister the old ABI */
-       if (rtc->nvram)
-               rtc_nvram_unregister(rtc);
-}
index c633319cdb91319d8af218ec4eda30503e59ec4e..adca0de76e536b3ab47997ddacc415d8dd2d096c 100644 (file)
@@ -863,7 +863,6 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
                cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm;
        }
 
-       cmos_rtc.rtc->nvram_old_abi = true;
        retval = rtc_register_device(cmos_rtc.rtc);
        if (retval)
                goto cleanup2;
index a3d790889eea6bc8e8f4cb4c25565b7fa9195dec..a1ed539d41b49f8ce534f3b825d4785169dd76e5 100644 (file)
@@ -694,7 +694,6 @@ static int ds1305_probe(struct spi_device *spi)
        ds1305->rtc->range_max = RTC_TIMESTAMP_END_2099;
 
        ds1305_nvmem_cfg.priv = ds1305;
-       ds1305->rtc->nvram_old_abi = true;
        status = rtc_register_device(ds1305->rtc);
        if (status)
                return status;
index fdf25db1b1b3aadfc9a6ab2f61eb7ac95232b64e..e359cbf7882b1f8d25162a663616e51778903d6c 100644 (file)
@@ -2016,7 +2016,6 @@ static int ds1307_probe(struct i2c_client *client,
                        .priv = ds1307,
                };
 
-               ds1307->rtc->nvram_old_abi = true;
                rtc_nvmem_register(ds1307->rtc, &nvmem_cfg);
        }
 
index ba143423875b9276fccf32a05b9138232fa5d41e..e7604e844cbdc1851228325fb8ef2e37ded3a9f4 100644 (file)
@@ -399,7 +399,6 @@ static int ds1343_probe(struct spi_device *spi)
        if (IS_ERR(priv->rtc))
                return PTR_ERR(priv->rtc);
 
-       priv->rtc->nvram_old_abi = true;
        priv->rtc->ops = &ds1343_rtc_ops;
        priv->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
        priv->rtc->range_max = RTC_TIMESTAMP_END_2099;
index a63872c4c76d07182a39aeac4212174505a189e6..33c483d759c81f2582b29325c6e08e70b5910f55 100644 (file)
@@ -466,8 +466,6 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
 
        pdata->rtc->ops = &ds1511_rtc_ops;
 
-       pdata->rtc->nvram_old_abi = true;
-
        ret = rtc_register_device(pdata->rtc);
        if (ret)
                return ret;
index cdf5e05b9489aca2a701e9fad9e5206a5176f336..c6a5563504e558b43d96549f3340e0fa8740e4b5 100644 (file)
@@ -294,7 +294,6 @@ static int ds1553_rtc_probe(struct platform_device *pdev)
                return PTR_ERR(pdata->rtc);
 
        pdata->rtc->ops = &ds1553_rtc_ops;
-       pdata->rtc->nvram_old_abi = true;
 
        ret = rtc_register_device(pdata->rtc);
        if (ret)
index dfbd7b88b2b91d572b8bb799778d2405d0cdfef5..9043c96e884588924ca851152165fec3119d56ab 100644 (file)
@@ -1316,7 +1316,6 @@ ds1685_rtc_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       rtc_dev->nvram_old_abi = true;
        nvmem_cfg.priv = rtc;
        ret = rtc_nvmem_register(rtc_dev, &nvmem_cfg);
        if (ret)
index 2b949f0dbaa92ca4ff240dc27c43273f06889b65..291bbed90ef854a009b64a5ee40a39fe1f98fda5 100644 (file)
@@ -190,7 +190,6 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
                return PTR_ERR(rtc);
 
        rtc->ops = &ds1742_rtc_ops;
-       rtc->nvram_old_abi = true;
 
        ret = rtc_register_device(rtc);
        if (ret)
index 67e218758a8b87594da9509b22e533425c617582..ee1d8f0146fd14b7d863d2e0f08d2e573125db9e 100644 (file)
@@ -463,7 +463,6 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
        if (IS_ERR(m48t59->rtc))
                return PTR_ERR(m48t59->rtc);
 
-       m48t59->rtc->nvram_old_abi = true;
        m48t59->rtc->ops = ops;
 
        nvmem_cfg.size = pdata->offset;
index 75a0e73071d8dbe1aeca244b63e2e609bc3bce3f..2b1135590dd56154ad73b7921149421ee38b798d 100644 (file)
@@ -254,7 +254,6 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
                return PTR_ERR(info->rtc);
 
        info->rtc->ops = &m48t86_rtc_ops;
-       info->rtc->nvram_old_abi = true;
 
        err = rtc_register_device(info->rtc);
        if (err)
index 8776eadbdd3a704eca6d89820a24d625f38fde53..a69e8adcc4a119ba398c70122763654a869c9d95 100644 (file)
@@ -251,7 +251,6 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev)
                return PTR_ERR(rtc);
 
        rtc->ops = &rp5c01_rtc_ops;
-       rtc->nvram_old_abi = true;
 
        priv->rtc = rtc;
 
index c6d8e3425688b97a6475b393b6ffb66c7c32ecdf..1d888da48c7c90bc08f7e1c6eff44d15ad53d9b6 100644 (file)
@@ -585,7 +585,6 @@ static int rv8803_probe(struct i2c_client *client,
        }
 
        rv8803->rtc->ops = &rv8803_rtc_ops;
-       rv8803->rtc->nvram_old_abi = true;
        rv8803->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
        rv8803->rtc->range_max = RTC_TIMESTAMP_END_2099;
        err = rtc_register_device(rv8803->rtc);
index 01a45044f468aaa9c85a088f1b49bb23db01b83d..1ccf0d5d05b471435882127bdb2b70ae190f5a46 100644 (file)
@@ -311,7 +311,6 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev)
                return PTR_ERR(pdata->rtc);
 
        pdata->rtc->ops = &stk17ta8_rtc_ops;
-       pdata->rtc->nvram_old_abi = true;
 
        nvmem_cfg.priv = pdata;
        ret = rtc_nvmem_register(pdata->rtc, &nvmem_cfg);
index 715b82981279d474b0dff874c37d999011b7402e..abbb62b14d7a07ce23f7bf5a9d87bf9c37a8dd9c 100644 (file)
@@ -266,7 +266,6 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)
                return PTR_ERR(rtc);
 
        rtc->ops = &tx4939_rtc_ops;
-       rtc->nvram_old_abi = true;
        rtc->range_max = U32_MAX;
 
        pdata->rtc = rtc;
index 22d1575e4991b0b280e394fe54a8f7563f36aabe..0983ab9faffb3e6ed5ca7897fd86d5d33bc355fa 100644 (file)
@@ -120,10 +120,6 @@ struct rtc_device {
 
        bool registered;
 
-       /* Old ABI support */
-       bool nvram_old_abi;
-       struct bin_attribute *nvram;
-
        time64_t range_min;
        timeu64_t range_max;
        time64_t start_secs;
@@ -250,14 +246,12 @@ extern int rtc_hctosys_ret;
 #ifdef CONFIG_RTC_NVMEM
 int rtc_nvmem_register(struct rtc_device *rtc,
                       struct nvmem_config *nvmem_config);
-void rtc_nvmem_unregister(struct rtc_device *rtc);
 #else
 static inline int rtc_nvmem_register(struct rtc_device *rtc,
                                     struct nvmem_config *nvmem_config)
 {
        return 0;
 }
-static inline void rtc_nvmem_unregister(struct rtc_device *rtc) {}
 #endif
 
 #ifdef CONFIG_RTC_INTF_SYSFS