rtc: add devm_ prefix to rtc_nvmem_register()
rtc_nvmem_register() is a managed interface. It doesn't require any release function to be called at driver detach. To avoid confusing driver authors, let's rename it to devm_rtc_nvmem_register() and add it to the list of managed interfaces in Documentation/. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-6-brgl@bgdev.pl
This commit is contained in:
parent
25ece30561
commit
3a905c2d95
|
@ -414,6 +414,7 @@ RESET
|
||||||
RTC
|
RTC
|
||||||
devm_rtc_device_register()
|
devm_rtc_device_register()
|
||||||
devm_rtc_allocate_device()
|
devm_rtc_allocate_device()
|
||||||
|
devm_rtc_nvmem_register()
|
||||||
|
|
||||||
SERDEV
|
SERDEV
|
||||||
devm_serdev_device_open()
|
devm_serdev_device_open()
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <linux/nvmem-consumer.h>
|
#include <linux/nvmem-consumer.h>
|
||||||
#include <linux/rtc.h>
|
#include <linux/rtc.h>
|
||||||
|
|
||||||
int rtc_nvmem_register(struct rtc_device *rtc,
|
int devm_rtc_nvmem_register(struct rtc_device *rtc,
|
||||||
struct nvmem_config *nvmem_config)
|
struct nvmem_config *nvmem_config)
|
||||||
{
|
{
|
||||||
struct nvmem_device *nvmem;
|
struct nvmem_device *nvmem;
|
||||||
|
@ -24,4 +24,4 @@ int rtc_nvmem_register(struct rtc_device *rtc,
|
||||||
|
|
||||||
return PTR_ERR_OR_ZERO(nvmem);
|
return PTR_ERR_OR_ZERO(nvmem);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rtc_nvmem_register);
|
EXPORT_SYMBOL_GPL(devm_rtc_nvmem_register);
|
||||||
|
|
|
@ -869,7 +869,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
|
||||||
|
|
||||||
/* export at least the first block of NVRAM */
|
/* export at least the first block of NVRAM */
|
||||||
nvmem_cfg.size = address_space - NVRAM_OFFSET;
|
nvmem_cfg.size = address_space - NVRAM_OFFSET;
|
||||||
if (rtc_nvmem_register(cmos_rtc.rtc, &nvmem_cfg))
|
if (devm_rtc_nvmem_register(cmos_rtc.rtc, &nvmem_cfg))
|
||||||
dev_err(dev, "nvmem registration failed\n");
|
dev_err(dev, "nvmem registration failed\n");
|
||||||
|
|
||||||
dev_info(dev, "%s%s, %d bytes nvram%s\n",
|
dev_info(dev, "%s%s, %d bytes nvram%s\n",
|
||||||
|
|
|
@ -698,7 +698,7 @@ static int ds1305_probe(struct spi_device *spi)
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
rtc_nvmem_register(ds1305->rtc, &ds1305_nvmem_cfg);
|
devm_rtc_nvmem_register(ds1305->rtc, &ds1305_nvmem_cfg);
|
||||||
|
|
||||||
/* Maybe set up alarm IRQ; be ready to handle it triggering right
|
/* Maybe set up alarm IRQ; be ready to handle it triggering right
|
||||||
* away. NOTE that we don't share this. The signal is active low,
|
* away. NOTE that we don't share this. The signal is active low,
|
||||||
|
|
|
@ -2016,7 +2016,7 @@ static int ds1307_probe(struct i2c_client *client,
|
||||||
.priv = ds1307,
|
.priv = ds1307,
|
||||||
};
|
};
|
||||||
|
|
||||||
rtc_nvmem_register(ds1307->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(ds1307->rtc, &nvmem_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ds1307_hwmon_register(ds1307);
|
ds1307_hwmon_register(ds1307);
|
||||||
|
|
|
@ -413,7 +413,7 @@ static int ds1343_probe(struct spi_device *spi)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
nvmem_cfg.priv = priv;
|
nvmem_cfg.priv = priv;
|
||||||
rtc_nvmem_register(priv->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(priv->rtc, &nvmem_cfg);
|
||||||
|
|
||||||
priv->irq = spi->irq;
|
priv->irq = spi->irq;
|
||||||
|
|
||||||
|
|
|
@ -470,7 +470,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
rtc_nvmem_register(pdata->rtc, &ds1511_nvmem_cfg);
|
devm_rtc_nvmem_register(pdata->rtc, &ds1511_nvmem_cfg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the platform has an interrupt in mind for this device,
|
* if the platform has an interrupt in mind for this device,
|
||||||
|
|
|
@ -309,7 +309,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rtc_nvmem_register(pdata->rtc, &nvmem_cfg))
|
if (devm_rtc_nvmem_register(pdata->rtc, &nvmem_cfg))
|
||||||
dev_err(&pdev->dev, "unable to register nvmem\n");
|
dev_err(&pdev->dev, "unable to register nvmem\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ ds1685_rtc_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nvmem_cfg.priv = rtc;
|
nvmem_cfg.priv = rtc;
|
||||||
ret = rtc_nvmem_register(rtc_dev, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(rtc_dev, &nvmem_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (rtc_nvmem_register(rtc, &nvmem_cfg))
|
if (devm_rtc_nvmem_register(rtc, &nvmem_cfg))
|
||||||
dev_err(&pdev->dev, "Unable to register nvmem\n");
|
dev_err(&pdev->dev, "Unable to register nvmem\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -518,7 +518,7 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||||
if (IS_ERR(ds3232->rtc))
|
if (IS_ERR(ds3232->rtc))
|
||||||
return PTR_ERR(ds3232->rtc);
|
return PTR_ERR(ds3232->rtc);
|
||||||
|
|
||||||
ret = rtc_nvmem_register(ds3232->rtc, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(ds3232->rtc, &nvmem_cfg);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ static int isl12026_probe_new(struct i2c_client *client)
|
||||||
|
|
||||||
priv->rtc->ops = &isl12026_rtc_ops;
|
priv->rtc->ops = &isl12026_rtc_ops;
|
||||||
nvm_cfg.priv = priv;
|
nvm_cfg.priv = priv;
|
||||||
ret = rtc_nvmem_register(priv->rtc, &nvm_cfg);
|
ret = devm_rtc_nvmem_register(priv->rtc, &nvm_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -890,7 +890,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = rtc_nvmem_register(isl1208->rtc, &isl1208->nvmem_config);
|
rc = devm_rtc_nvmem_register(isl1208->rtc, &isl1208->nvmem_config);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
|
||||||
m48t59->rtc->ops = ops;
|
m48t59->rtc->ops = ops;
|
||||||
|
|
||||||
nvmem_cfg.size = pdata->offset;
|
nvmem_cfg.size = pdata->offset;
|
||||||
ret = rtc_nvmem_register(m48t59->rtc, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(m48t59->rtc, &nvmem_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
rtc_nvmem_register(info->rtc, &m48t86_nvmem_cfg);
|
devm_rtc_nvmem_register(info->rtc, &m48t86_nvmem_cfg);
|
||||||
|
|
||||||
/* read battery status */
|
/* read battery status */
|
||||||
reg = m48t86_readb(&pdev->dev, M48T86_D);
|
reg = m48t86_readb(&pdev->dev, M48T86_D);
|
||||||
|
|
|
@ -365,7 +365,7 @@ static int meson_rtc_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
meson_rtc_nvmem_config.priv = rtc;
|
meson_rtc_nvmem_config.priv = rtc;
|
||||||
ret = rtc_nvmem_register(rtc->rtc, &meson_rtc_nvmem_config);
|
ret = devm_rtc_nvmem_register(rtc->rtc, &meson_rtc_nvmem_config);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_disable_vdd;
|
goto out_disable_vdd;
|
||||||
|
|
||||||
|
|
|
@ -890,7 +890,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config);
|
devm_rtc_nvmem_register(rtc->rtc, &omap_rtc_nvmem_config);
|
||||||
|
|
||||||
if (rtc->is_pmic_controller) {
|
if (rtc->is_pmic_controller) {
|
||||||
if (!pm_power_off) {
|
if (!pm_power_off) {
|
||||||
|
|
|
@ -608,7 +608,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
|
||||||
.size = 512,
|
.size = 512,
|
||||||
};
|
};
|
||||||
|
|
||||||
ret = rtc_nvmem_register(pcf2127->rtc, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(pcf2127->rtc, &nvmem_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -607,7 +607,7 @@ static int pcf85063_probe(struct i2c_client *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
nvmem_cfg.priv = pcf85063->regmap;
|
nvmem_cfg.priv = pcf85063->regmap;
|
||||||
rtc_nvmem_register(pcf85063->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(pcf85063->rtc, &nvmem_cfg);
|
||||||
|
|
||||||
#ifdef CONFIG_COMMON_CLK
|
#ifdef CONFIG_COMMON_CLK
|
||||||
/* register clk in common clk framework */
|
/* register clk in common clk framework */
|
||||||
|
|
|
@ -422,7 +422,7 @@ static int pcf85363_probe(struct i2c_client *client,
|
||||||
|
|
||||||
for (i = 0; i < config->num_nvram; i++) {
|
for (i = 0; i < config->num_nvram; i++) {
|
||||||
nvmem_cfg[i].priv = pcf85363;
|
nvmem_cfg[i].priv = pcf85363;
|
||||||
rtc_nvmem_register(pcf85363->rtc, &nvmem_cfg[i]);
|
devm_rtc_nvmem_register(pcf85363->rtc, &nvmem_cfg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -255,7 +255,7 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev)
|
||||||
priv->rtc = rtc;
|
priv->rtc = rtc;
|
||||||
|
|
||||||
nvmem_cfg.priv = priv;
|
nvmem_cfg.priv = priv;
|
||||||
error = rtc_nvmem_register(rtc, &nvmem_cfg);
|
error = devm_rtc_nvmem_register(rtc, &nvmem_cfg);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
|
@ -891,9 +891,9 @@ static int rv3028_probe(struct i2c_client *client)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nvmem_cfg.priv = rv3028->regmap;
|
nvmem_cfg.priv = rv3028->regmap;
|
||||||
rtc_nvmem_register(rv3028->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(rv3028->rtc, &nvmem_cfg);
|
||||||
eeprom_cfg.priv = rv3028;
|
eeprom_cfg.priv = rv3028;
|
||||||
rtc_nvmem_register(rv3028->rtc, &eeprom_cfg);
|
devm_rtc_nvmem_register(rv3028->rtc, &eeprom_cfg);
|
||||||
|
|
||||||
rv3028->rtc->max_user_freq = 1;
|
rv3028->rtc->max_user_freq = 1;
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
nvmem_cfg.priv = rv3029->regmap;
|
nvmem_cfg.priv = rv3029->regmap;
|
||||||
rtc_nvmem_register(rv3029->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(rv3029->rtc, &nvmem_cfg);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -890,9 +890,9 @@ static int rv3032_probe(struct i2c_client *client)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
nvmem_cfg.priv = rv3032->regmap;
|
nvmem_cfg.priv = rv3032->regmap;
|
||||||
rtc_nvmem_register(rv3032->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(rv3032->rtc, &nvmem_cfg);
|
||||||
eeprom_cfg.priv = rv3032;
|
eeprom_cfg.priv = rv3032;
|
||||||
rtc_nvmem_register(rv3032->rtc, &eeprom_cfg);
|
devm_rtc_nvmem_register(rv3032->rtc, &eeprom_cfg);
|
||||||
|
|
||||||
rv3032->rtc->max_user_freq = 1;
|
rv3032->rtc->max_user_freq = 1;
|
||||||
|
|
||||||
|
|
|
@ -591,7 +591,7 @@ static int rv8803_probe(struct i2c_client *client,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
|
devm_rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
|
||||||
|
|
||||||
rv8803->rtc->max_user_freq = 1;
|
rv8803->rtc->max_user_freq = 1;
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ static int rx8581_probe(struct i2c_client *client,
|
||||||
|
|
||||||
for (i = 0; i < config->num_nvram; i++) {
|
for (i = 0; i < config->num_nvram; i++) {
|
||||||
nvmem_cfg[i].priv = rx8581;
|
nvmem_cfg[i].priv = rx8581;
|
||||||
rtc_nvmem_register(rx8581->rtc, &nvmem_cfg[i]);
|
devm_rtc_nvmem_register(rx8581->rtc, &nvmem_cfg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -313,7 +313,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev)
|
||||||
pdata->rtc->ops = &stk17ta8_rtc_ops;
|
pdata->rtc->ops = &stk17ta8_rtc_ops;
|
||||||
|
|
||||||
nvmem_cfg.priv = pdata;
|
nvmem_cfg.priv = pdata;
|
||||||
ret = rtc_nvmem_register(pdata->rtc, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(pdata->rtc, &nvmem_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)
|
||||||
pdata->rtc = rtc;
|
pdata->rtc = rtc;
|
||||||
|
|
||||||
nvmem_cfg.priv = pdata;
|
nvmem_cfg.priv = pdata;
|
||||||
ret = rtc_nvmem_register(rtc, &nvmem_cfg);
|
ret = devm_rtc_nvmem_register(rtc, &nvmem_cfg);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -244,11 +244,11 @@ extern int rtc_hctosys_ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_RTC_NVMEM
|
#ifdef CONFIG_RTC_NVMEM
|
||||||
int rtc_nvmem_register(struct rtc_device *rtc,
|
int devm_rtc_nvmem_register(struct rtc_device *rtc,
|
||||||
struct nvmem_config *nvmem_config);
|
struct nvmem_config *nvmem_config);
|
||||||
#else
|
#else
|
||||||
static inline int rtc_nvmem_register(struct rtc_device *rtc,
|
static inline int devm_rtc_nvmem_register(struct rtc_device *rtc,
|
||||||
struct nvmem_config *nvmem_config)
|
struct nvmem_config *nvmem_config)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue