rtc: rework rtc_register_device() resource management
rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. 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-8-brgl@bgdev.pl
This commit is contained in:
parent
6746bc095b
commit
fdcfd85433
|
@ -414,6 +414,7 @@ RESET
|
|||
RTC
|
||||
devm_rtc_device_register()
|
||||
devm_rtc_allocate_device()
|
||||
devm_rtc_register_device()
|
||||
devm_rtc_nvmem_register()
|
||||
|
||||
SERDEV
|
||||
|
|
|
@ -216,6 +216,6 @@ alpha_rtc_init(void)
|
|||
rtc->ops = &remote_rtc_ops;
|
||||
#endif
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
device_initcall(alpha_rtc_init);
|
||||
|
|
|
@ -1119,7 +1119,7 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m)
|
|||
menelaus_write_reg(MENELAUS_RTC_CTRL, m->rtc_control);
|
||||
}
|
||||
|
||||
err = rtc_register_device(m->rtc);
|
||||
err = devm_rtc_register_device(m->rtc);
|
||||
if (err) {
|
||||
if (alarm) {
|
||||
menelaus_remove_irq_work(MENELAUS_RTCALM_IRQ);
|
||||
|
|
|
@ -321,8 +321,10 @@ static void rtc_device_get_offset(struct rtc_device *rtc)
|
|||
*
|
||||
* @rtc: the RTC class device to destroy
|
||||
*/
|
||||
static void rtc_device_unregister(struct rtc_device *rtc)
|
||||
static void devm_rtc_unregister_device(void *data)
|
||||
{
|
||||
struct rtc_device *rtc = data;
|
||||
|
||||
mutex_lock(&rtc->ops_lock);
|
||||
/*
|
||||
* Remove innards of this RTC, then disable it, before
|
||||
|
@ -339,9 +341,6 @@ static void devm_rtc_release_device(struct device *dev, void *res)
|
|||
{
|
||||
struct rtc_device *rtc = *(struct rtc_device **)res;
|
||||
|
||||
if (rtc->registered)
|
||||
rtc_device_unregister(rtc);
|
||||
else
|
||||
put_device(&rtc->dev);
|
||||
}
|
||||
|
||||
|
@ -383,7 +382,7 @@ exit_ida:
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(devm_rtc_allocate_device);
|
||||
|
||||
int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
|
||||
int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc)
|
||||
{
|
||||
struct rtc_wkalrm alrm;
|
||||
int err;
|
||||
|
@ -413,7 +412,6 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
|
|||
|
||||
rtc_proc_add_device(rtc);
|
||||
|
||||
rtc->registered = true;
|
||||
dev_info(rtc->dev.parent, "registered as %s\n",
|
||||
dev_name(&rtc->dev));
|
||||
|
||||
|
@ -422,9 +420,10 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
|
|||
rtc_hctosys(rtc);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return devm_add_action_or_reset(rtc->dev.parent,
|
||||
devm_rtc_unregister_device, rtc);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__rtc_register_device);
|
||||
EXPORT_SYMBOL_GPL(__devm_rtc_register_device);
|
||||
|
||||
/**
|
||||
* devm_rtc_device_register - resource managed rtc_device_register()
|
||||
|
@ -454,7 +453,7 @@ struct rtc_device *devm_rtc_device_register(struct device *dev,
|
|||
|
||||
rtc->ops = ops;
|
||||
|
||||
err = __rtc_register_device(owner, rtc);
|
||||
err = __devm_rtc_register_device(owner, rtc);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ static int pm80x_rtc_probe(struct platform_device *pdev)
|
|||
info->rtc_dev->ops = &pm80x_rtc_ops;
|
||||
info->rtc_dev->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(info->rtc_dev);
|
||||
ret = devm_rtc_register_device(info->rtc_dev);
|
||||
if (ret)
|
||||
goto out_rtc;
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ static int pm860x_rtc_probe(struct platform_device *pdev)
|
|||
info->rtc_dev->ops = &pm860x_rtc_ops;
|
||||
info->rtc_dev->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(info->rtc_dev);
|
||||
ret = devm_rtc_register_device(info->rtc_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -892,7 +892,7 @@ static int abb5zes3_probe(struct i2c_client *client,
|
|||
}
|
||||
}
|
||||
|
||||
ret = rtc_register_device(data->rtc);
|
||||
ret = devm_rtc_register_device(data->rtc);
|
||||
|
||||
err:
|
||||
if (ret && data->irq)
|
||||
|
|
|
@ -420,7 +420,7 @@ static int abeoz9_probe(struct i2c_client *client,
|
|||
data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
data->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
ret = rtc_register_device(data->rtc);
|
||||
ret = devm_rtc_register_device(data->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver ab3100_rtc_driver = {
|
||||
|
|
|
@ -404,7 +404,7 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static int ab8500_rtc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -851,7 +851,7 @@ static int abx80x_probe(struct i2c_client *client,
|
|||
return err;
|
||||
}
|
||||
|
||||
return rtc_register_device(priv->rtc);
|
||||
return devm_rtc_register_device(priv->rtc);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id abx80x_id[] = {
|
||||
|
|
|
@ -610,7 +610,7 @@ static int ac100_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return rtc_register_device(chip->rtc);
|
||||
return devm_rtc_register_device(chip->rtc);
|
||||
}
|
||||
|
||||
static int ac100_rtc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -556,7 +556,7 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
rtc->rtc_dev->range_max = U32_MAX;
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
@ -104,7 +104,7 @@ static int aspeed_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900;
|
||||
rtc->rtc_dev->range_max = 38814989399LL; /* 3199-12-31 23:59:59 */
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
static const struct of_device_id aspeed_rtc_match[] = {
|
||||
|
|
|
@ -538,7 +538,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
rtc->range_min = RTC_TIMESTAMP_BEGIN_1900;
|
||||
rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
ret = rtc_register_device(rtc);
|
||||
ret = devm_rtc_register_device(rtc);
|
||||
if (ret)
|
||||
goto err_clk;
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
|
|||
dev_warn(&pdev->dev, "%s: SET TIME!\n",
|
||||
dev_name(&rtc->rtcdev->dev));
|
||||
|
||||
return rtc_register_device(rtc->rtcdev);
|
||||
return devm_rtc_register_device(rtc->rtcdev);
|
||||
|
||||
err_clk:
|
||||
clk_disable_unprepare(rtc->sclk);
|
||||
|
|
|
@ -104,7 +104,7 @@ static int au1xtoy_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, rtcdev);
|
||||
|
||||
return rtc_register_device(rtcdev);
|
||||
return devm_rtc_register_device(rtcdev);
|
||||
}
|
||||
|
||||
static struct platform_driver au1xrtc_driver = {
|
||||
|
|
|
@ -604,7 +604,7 @@ static int bd70528_probe(struct platform_device *pdev)
|
|||
}
|
||||
}
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static const struct platform_device_id bd718x7_rtc_id[] = {
|
||||
|
|
|
@ -252,7 +252,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
|
|||
timer->rtc->ops = &brcmstb_waketmr_ops;
|
||||
timer->rtc->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(timer->rtc);
|
||||
ret = devm_rtc_register_device(timer->rtc);
|
||||
if (ret)
|
||||
goto err_notifier;
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ static int cdns_rtc_probe(struct platform_device *pdev)
|
|||
writel(0, crtc->regs + CDNS_RTC_HMR);
|
||||
writel(CDNS_RTC_KRTCR_KRTC, crtc->regs + CDNS_RTC_KRTCR);
|
||||
|
||||
ret = rtc_register_device(crtc->rtc_dev);
|
||||
ret = devm_rtc_register_device(crtc->rtc_dev);
|
||||
if (ret)
|
||||
goto err_disable_wakeup;
|
||||
|
||||
|
|
|
@ -863,7 +863,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
|
|||
cmos_rtc.rtc->ops = &cmos_rtc_ops_no_alarm;
|
||||
}
|
||||
|
||||
retval = rtc_register_device(cmos_rtc.rtc);
|
||||
retval = devm_rtc_register_device(cmos_rtc.rtc);
|
||||
if (retval)
|
||||
goto cleanup2;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ static int __init coh901331_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, rtap);
|
||||
|
||||
ret = rtc_register_device(rtap->rtc);
|
||||
ret = devm_rtc_register_device(rtap->rtc);
|
||||
if (ret)
|
||||
goto out_no_rtc;
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ static int cpcap_rtc_probe(struct platform_device *pdev)
|
|||
/* ignore error and continue without wakeup support */
|
||||
}
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
static const struct of_device_id cpcap_rtc_of_match[] = {
|
||||
|
|
|
@ -350,7 +350,7 @@ static int cros_ec_rtc_probe(struct platform_device *pdev)
|
|||
cros_ec_rtc->rtc->ops = &cros_ec_rtc_ops;
|
||||
cros_ec_rtc->rtc->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(cros_ec_rtc->rtc);
|
||||
ret = devm_rtc_register_device(cros_ec_rtc->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rtc->rtc->range_max = RTC_TIMESTAMP_END_2063;
|
||||
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ static int da9063_rtc_probe(struct platform_device *pdev)
|
|||
dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
|
||||
irq_alarm, ret);
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
static struct platform_driver da9063_rtc_driver = {
|
||||
|
|
|
@ -484,7 +484,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
|
||||
return rtc_register_device(davinci_rtc->rtc);
|
||||
return devm_rtc_register_device(davinci_rtc->rtc);
|
||||
}
|
||||
|
||||
static int __exit davinci_rtc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -202,7 +202,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc_dev->ops = &dc_rtc_ops;
|
||||
rtc->rtc_dev->range_max = U32_MAX;
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
static const struct of_device_id dc_dt_ids[] = {
|
||||
|
|
|
@ -132,7 +132,7 @@ static int dm355evm_rtc_probe(struct platform_device *pdev)
|
|||
rtc->ops = &dm355evm_rtc_ops;
|
||||
rtc->range_max = U32_MAX;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -694,7 +694,7 @@ static int ds1305_probe(struct spi_device *spi)
|
|||
ds1305->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
ds1305_nvmem_cfg.priv = ds1305;
|
||||
status = rtc_register_device(ds1305->rtc);
|
||||
status = devm_rtc_register_device(ds1305->rtc);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
|
|
|
@ -2001,7 +2001,7 @@ static int ds1307_probe(struct i2c_client *client,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
err = rtc_register_device(ds1307->rtc);
|
||||
err = devm_rtc_register_device(ds1307->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ static int ds1343_probe(struct spi_device *spi)
|
|||
dev_err(&spi->dev,
|
||||
"unable to create sysfs entries for rtc ds1343\n");
|
||||
|
||||
res = rtc_register_device(priv->rtc);
|
||||
res = devm_rtc_register_device(priv->rtc);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ static int ds1347_probe(struct spi_device *spi)
|
|||
rtc->range_min = RTC_TIMESTAMP_BEGIN_0000;
|
||||
rtc->range_max = RTC_TIMESTAMP_END_9999;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct spi_driver ds1347_driver = {
|
||||
|
|
|
@ -508,7 +508,7 @@ static int ds1374_probe(struct i2c_client *client,
|
|||
ds1374->rtc->ops = &ds1374_rtc_ops;
|
||||
ds1374->rtc->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(ds1374->rtc);
|
||||
ret = devm_rtc_register_device(ds1374->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
pdata->rtc->ops = &ds1511_rtc_ops;
|
||||
|
||||
ret = rtc_register_device(pdata->rtc);
|
||||
ret = devm_rtc_register_device(pdata->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
pdata->rtc->ops = &ds1553_rtc_ops;
|
||||
|
||||
ret = rtc_register_device(pdata->rtc);
|
||||
ret = devm_rtc_register_device(pdata->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ static int ds1672_probe(struct i2c_client *client,
|
|||
rtc->ops = &ds1672_rtc_ops;
|
||||
rtc->range_max = U32_MAX;
|
||||
|
||||
err = rtc_register_device(rtc);
|
||||
err = devm_rtc_register_device(rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -1321,7 +1321,7 @@ ds1685_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return rtc_register_device(rtc_dev);
|
||||
return devm_rtc_register_device(rtc_dev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -191,7 +191,7 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
rtc->ops = &ds1742_rtc_ops;
|
||||
|
||||
ret = rtc_register_device(rtc);
|
||||
ret = devm_rtc_register_device(rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ static int rtc_probe(struct platform_device *pdev)
|
|||
chip->rtc->ops = &ds2404_rtc_ops;
|
||||
chip->rtc->range_max = U32_MAX;
|
||||
|
||||
retval = rtc_register_device(chip->rtc);
|
||||
retval = devm_rtc_register_device(chip->rtc);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
return rtc_register_device(ep93xx_rtc->rtc);
|
||||
return devm_rtc_register_device(ep93xx_rtc->rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver ep93xx_rtc_driver = {
|
||||
|
|
|
@ -290,7 +290,7 @@ static int ftm_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
dev_err(&pdev->dev, "failed to enable irq wake\n");
|
||||
|
||||
ret = rtc_register_device(rtc->rtc_dev);
|
||||
ret = devm_rtc_register_device(rtc->rtc_dev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "can't register rtc device\n");
|
||||
return ret;
|
||||
|
|
|
@ -176,7 +176,7 @@ static int ftrtc010_rtc_probe(struct platform_device *pdev)
|
|||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
static int ftrtc010_rtc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -194,7 +194,7 @@ static int goldfish_rtc_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
return rtc_register_device(rtcdrv->rtc);
|
||||
return devm_rtc_register_device(rtcdrv->rtc);
|
||||
}
|
||||
|
||||
static const struct of_device_id goldfish_rtc_of_match[] = {
|
||||
|
|
|
@ -166,7 +166,7 @@ static int imx_sc_rtc_probe(struct platform_device *pdev)
|
|||
imx_sc_rtc->range_min = 0;
|
||||
imx_sc_rtc->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(imx_sc_rtc);
|
||||
ret = devm_rtc_register_device(imx_sc_rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -814,7 +814,7 @@ static int __init dryice_rtc_probe(struct platform_device *pdev)
|
|||
imxdi->rtc->ops = &dryice_rtc_ops;
|
||||
imxdi->rtc->range_max = U32_MAX;
|
||||
|
||||
rc = rtc_register_device(imxdi->rtc);
|
||||
rc = devm_rtc_register_device(imxdi->rtc);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ static int isl12026_probe_new(struct i2c_client *client)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return rtc_register_device(priv->rtc);
|
||||
return devm_rtc_register_device(priv->rtc);
|
||||
}
|
||||
|
||||
static int isl12026_remove(struct i2c_client *client)
|
||||
|
|
|
@ -894,7 +894,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
return rtc_register_device(isl1208->rtc);
|
||||
return devm_rtc_register_device(isl1208->rtc);
|
||||
}
|
||||
|
||||
static struct i2c_driver isl1208_driver = {
|
||||
|
|
|
@ -375,7 +375,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
|
|||
/* Each 1 Hz pulse should happen after (rate) ticks */
|
||||
jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR, rate - 1);
|
||||
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc->ops = &lpc32xx_rtc_ops;
|
||||
rtc->rtc->range_max = U32_MAX;
|
||||
|
||||
err = rtc_register_device(rtc->rtc);
|
||||
err = devm_rtc_register_device(rtc->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ static int ls1x_rtc_probe(struct platform_device *pdev)
|
|||
rtcdev->range_min = RTC_TIMESTAMP_BEGIN_1900;
|
||||
rtcdev->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
return rtc_register_device(rtcdev);
|
||||
return devm_rtc_register_device(rtcdev);
|
||||
}
|
||||
|
||||
static struct platform_driver ls1x_rtc_driver = {
|
||||
|
|
|
@ -977,7 +977,7 @@ static int m41t80_probe(struct i2c_client *client,
|
|||
m41t80_sqw_register_clk(m41t80_data);
|
||||
#endif
|
||||
|
||||
rc = rtc_register_device(m41t80_data->rtc);
|
||||
rc = devm_rtc_register_device(m41t80_data->rtc);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = rtc_register_device(m48t59->rtc);
|
||||
ret = devm_rtc_register_device(m48t59->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ static int m48t86_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
info->rtc->ops = &m48t86_rtc_ops;
|
||||
|
||||
err = rtc_register_device(info->rtc);
|
||||
err = devm_rtc_register_device(info->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
mc13xxx_unlock(mc13xxx);
|
||||
|
||||
ret = rtc_register_device(priv->rtc);
|
||||
ret = devm_rtc_register_device(priv->rtc);
|
||||
if (ret) {
|
||||
mc13xxx_lock(mc13xxx);
|
||||
goto err_irq_request;
|
||||
|
|
|
@ -83,7 +83,7 @@ static int meson_vrtc_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(vrtc->rtc);
|
||||
|
||||
vrtc->rtc->ops = &meson_vrtc_ops;
|
||||
return rtc_register_device(vrtc->rtc);
|
||||
return devm_rtc_register_device(vrtc->rtc);
|
||||
}
|
||||
|
||||
static int __maybe_unused meson_vrtc_suspend(struct device *dev)
|
||||
|
|
|
@ -369,7 +369,7 @@ static int meson_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
goto out_disable_vdd;
|
||||
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret)
|
||||
goto out_disable_vdd;
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static int mpc5121_rtc_probe(struct platform_device *op)
|
|||
rtc->rtc->range_max = U32_MAX;
|
||||
}
|
||||
|
||||
err = rtc_register_device(rtc->rtc);
|
||||
err = devm_rtc_register_device(rtc->rtc);
|
||||
if (err)
|
||||
goto out_dispose2;
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ static int vrtc_mrst_do_probe(struct device *dev, struct resource *iomem,
|
|||
}
|
||||
}
|
||||
|
||||
retval = rtc_register_device(mrst_rtc.rtc);
|
||||
retval = devm_rtc_register_device(mrst_rtc.rtc);
|
||||
if (retval)
|
||||
goto cleanup0;
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ static int mt2712_rtc_probe(struct platform_device *pdev)
|
|||
mt2712_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
mt2712_rtc->rtc->range_max = MT2712_RTC_TIMESTAMP_END_2127;
|
||||
|
||||
return rtc_register_device(mt2712_rtc->rtc);
|
||||
return devm_rtc_register_device(mt2712_rtc->rtc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
@ -301,7 +301,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
rtc->rtc_dev->ops = &mtk_rtc_ops;
|
||||
|
||||
return rtc_register_device(rtc->rtc_dev);
|
||||
return devm_rtc_register_device(rtc->rtc_dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
@ -278,7 +278,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
|
|||
pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
ret = rtc_register_device(pdata->rtc);
|
||||
ret = devm_rtc_register_device(pdata->rtc);
|
||||
if (!ret)
|
||||
return 0;
|
||||
out:
|
||||
|
|
|
@ -408,7 +408,7 @@ static int mxc_rtc_probe(struct platform_device *pdev)
|
|||
dev_err(&pdev->dev, "failed to enable irq wake\n");
|
||||
}
|
||||
|
||||
ret = rtc_register_device(rtc);
|
||||
ret = devm_rtc_register_device(rtc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ static int mxc_rtc_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = rtc_register_device(pdata->rtc);
|
||||
ret = devm_rtc_register_device(pdata->rtc);
|
||||
if (ret < 0)
|
||||
clk_unprepare(pdata->clk);
|
||||
|
||||
|
|
|
@ -886,7 +886,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ static int __init pcap_rtc_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
return rtc_register_device(pcap_rtc->rtc);
|
||||
return devm_rtc_register_device(pcap_rtc->rtc);
|
||||
}
|
||||
|
||||
static int __exit pcap_rtc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -434,7 +434,7 @@ static int pcf2123_probe(struct spi_device *spi)
|
|||
rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
rtc->set_start_time = true;
|
||||
|
||||
ret = rtc_register_device(rtc);
|
||||
ret = devm_rtc_register_device(rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -682,7 +682,7 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
|
|||
return ret;
|
||||
}
|
||||
|
||||
return rtc_register_device(pcf2127->rtc);
|
||||
return devm_rtc_register_device(pcf2127->rtc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
|
|
|
@ -614,7 +614,7 @@ static int pcf85063_probe(struct i2c_client *client)
|
|||
pcf85063_clkout_register_clk(pcf85063);
|
||||
#endif
|
||||
|
||||
return rtc_register_device(pcf85063->rtc);
|
||||
return devm_rtc_register_device(pcf85063->rtc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
|
|
|
@ -418,7 +418,7 @@ static int pcf85363_probe(struct i2c_client *client,
|
|||
pcf85363->rtc->ops = &rtc_ops_alarm;
|
||||
}
|
||||
|
||||
ret = rtc_register_device(pcf85363->rtc);
|
||||
ret = devm_rtc_register_device(pcf85363->rtc);
|
||||
|
||||
for (i = 0; i < config->num_nvram; i++) {
|
||||
nvmem_cfg[i].priv = pcf85363;
|
||||
|
|
|
@ -582,7 +582,7 @@ static int pcf8563_probe(struct i2c_client *client,
|
|||
}
|
||||
}
|
||||
|
||||
err = rtc_register_device(pcf8563->rtc);
|
||||
err = devm_rtc_register_device(pcf8563->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ static int pic32_rtc_probe(struct platform_device *pdev)
|
|||
pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
ret = rtc_register_device(pdata->rtc);
|
||||
ret = devm_rtc_register_device(pdata->rtc);
|
||||
if (ret)
|
||||
goto err_nortc;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
|
|||
if (ret)
|
||||
goto err_irq;
|
||||
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret)
|
||||
goto err_reg;
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
|
|||
ldata->rtc->range_min = vendor->range_min;
|
||||
ldata->rtc->range_max = vendor->range_max;
|
||||
|
||||
ret = rtc_register_device(ldata->rtc);
|
||||
ret = devm_rtc_register_device(ldata->rtc);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -508,7 +508,7 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
|
|||
return rc;
|
||||
}
|
||||
|
||||
return rtc_register_device(rtc_dd->rtc);
|
||||
return devm_rtc_register_device(rtc_dd->rtc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
@ -56,7 +56,7 @@ static int __init ps3_rtc_probe(struct platform_device *dev)
|
|||
|
||||
platform_set_drvdata(dev, rtc);
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver ps3_rtc_driver = {
|
||||
|
|
|
@ -127,7 +127,7 @@ static int r9701_probe(struct spi_device *spi)
|
|||
rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct spi_driver r9701_driver = {
|
||||
|
|
|
@ -426,7 +426,7 @@ static int rc5t619_rtc_probe(struct platform_device *pdev)
|
|||
dev_warn(&pdev->dev, "rc5t619 interrupt is disabled\n");
|
||||
}
|
||||
|
||||
return rtc_register_device(rtc->rtc);
|
||||
return devm_rtc_register_device(rtc->rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver rc5t619_rtc_driver = {
|
||||
|
|
|
@ -447,7 +447,7 @@ static int rk808_rtc_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
return rtc_register_device(rk808_rtc->rtc);
|
||||
return devm_rtc_register_device(rk808_rtc->rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver rk808_rtc_driver = {
|
||||
|
|
|
@ -259,7 +259,7 @@ static int __init rp5c01_rtc_probe(struct platform_device *dev)
|
|||
if (error)
|
||||
return error;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver rp5c01_rtc_driver = {
|
||||
|
|
|
@ -197,7 +197,7 @@ static int rs5c348_probe(struct spi_device *spi)
|
|||
|
||||
rtc->ops = &rs5c348_rtc_ops;
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct spi_driver rs5c348_driver = {
|
||||
|
|
|
@ -886,7 +886,7 @@ static int rv3028_probe(struct i2c_client *client)
|
|||
rv3028->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rv3028->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
rv3028->rtc->ops = &rv3028_rtc_ops;
|
||||
ret = rtc_register_device(rv3028->rtc);
|
||||
ret = devm_rtc_register_device(rv3028->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -750,7 +750,7 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
|
|||
rv3029->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rv3029->rtc->range_max = RTC_TIMESTAMP_END_2079;
|
||||
|
||||
rc = rtc_register_device(rv3029->rtc);
|
||||
rc = devm_rtc_register_device(rv3029->rtc);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -885,7 +885,7 @@ static int rv3032_probe(struct i2c_client *client)
|
|||
rv3032->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rv3032->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
rv3032->rtc->ops = &rv3032_rtc_ops;
|
||||
ret = rtc_register_device(rv3032->rtc);
|
||||
ret = devm_rtc_register_device(rv3032->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -587,7 +587,7 @@ static int rv8803_probe(struct i2c_client *client,
|
|||
rv8803->rtc->ops = &rv8803_rtc_ops;
|
||||
rv8803->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rv8803->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
err = rtc_register_device(rv8803->rtc);
|
||||
err = devm_rtc_register_device(rv8803->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ static int rx8010_probe(struct i2c_client *client)
|
|||
rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
return rtc_register_device(rx8010->rtc);
|
||||
return devm_rtc_register_device(rx8010->rtc);
|
||||
}
|
||||
|
||||
static struct i2c_driver rx8010_driver = {
|
||||
|
|
|
@ -298,7 +298,7 @@ static int rx8581_probe(struct i2c_client *client,
|
|||
rx8581->rtc->start_secs = 0;
|
||||
rx8581->rtc->set_start_time = true;
|
||||
|
||||
ret = rtc_register_device(rx8581->rtc);
|
||||
ret = devm_rtc_register_device(rx8581->rtc);
|
||||
|
||||
for (i = 0; i < config->num_nvram; i++) {
|
||||
nvmem_cfg[i].priv = rx8581;
|
||||
|
|
|
@ -497,7 +497,7 @@ static int s35390a_probe(struct i2c_client *client,
|
|||
if (status1 & S35390A_FLAG_INT2)
|
||||
rtc_update_irq(s35390a->rtc, 1, RTC_AF);
|
||||
|
||||
return rtc_register_device(s35390a->rtc);
|
||||
return devm_rtc_register_device(s35390a->rtc);
|
||||
}
|
||||
|
||||
static struct i2c_driver s35390a_driver = {
|
||||
|
|
|
@ -205,7 +205,7 @@ int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
|
|||
info->rtc->max_user_freq = RTC_FREQ;
|
||||
info->rtc->range_max = U32_MAX;
|
||||
|
||||
ret = rtc_register_device(info->rtc);
|
||||
ret = devm_rtc_register_device(info->rtc);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(info->clk);
|
||||
return ret;
|
||||
|
|
|
@ -618,7 +618,7 @@ static int sprd_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc->ops = &sprd_rtc_ops;
|
||||
rtc->rtc->range_min = 0;
|
||||
rtc->rtc->range_max = 5662310399LL;
|
||||
ret = rtc_register_device(rtc->rtc);
|
||||
ret = devm_rtc_register_device(rtc->rtc);
|
||||
if (ret) {
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
return ret;
|
||||
|
|
|
@ -192,7 +192,7 @@ static int sd3078_probe(struct i2c_client *client,
|
|||
sd3078->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
|
||||
sd3078->rtc->range_max = RTC_TIMESTAMP_END_2099;
|
||||
|
||||
ret = rtc_register_device(sd3078->rtc);
|
||||
ret = devm_rtc_register_device(sd3078->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -607,7 +607,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc_dev->range_max = mktime64(2098, 12, 31, 23, 59, 59);
|
||||
}
|
||||
|
||||
ret = rtc_register_device(rtc->rtc_dev);
|
||||
ret = devm_rtc_register_device(rtc->rtc_dev);
|
||||
if (ret)
|
||||
goto err_unmap;
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
return rtc_register_device(rtcdrv->rtc);
|
||||
return devm_rtc_register_device(rtcdrv->rtc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
@ -387,7 +387,7 @@ static int snvs_rtc_probe(struct platform_device *pdev)
|
|||
data->rtc->ops = &snvs_rtc_ops;
|
||||
data->rtc->range_max = U32_MAX;
|
||||
|
||||
return rtc_register_device(data->rtc);
|
||||
return devm_rtc_register_device(data->rtc);
|
||||
}
|
||||
|
||||
static int __maybe_unused snvs_rtc_suspend_noirq(struct device *dev)
|
||||
|
|
|
@ -250,7 +250,7 @@ static int st_rtc_probe(struct platform_device *pdev)
|
|||
rtc->rtc_dev->range_max = U64_MAX;
|
||||
do_div(rtc->rtc_dev->range_max, rtc->clkrate);
|
||||
|
||||
ret = rtc_register_device(rtc->rtc_dev);
|
||||
ret = devm_rtc_register_device(rtc->rtc_dev);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(rtc->clk);
|
||||
return ret;
|
||||
|
|
|
@ -48,7 +48,7 @@ static int __init starfire_rtc_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver starfire_rtc_driver = {
|
||||
|
|
|
@ -317,7 +317,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return rtc_register_device(pdata->rtc);
|
||||
return devm_rtc_register_device(pdata->rtc);
|
||||
}
|
||||
|
||||
/* work with hotplug and coldplug */
|
||||
|
|
|
@ -366,7 +366,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
|
|||
rtc_data->rtc->ops = &stmp3xxx_rtc_ops;
|
||||
rtc_data->rtc->range_max = U32_MAX;
|
||||
|
||||
err = rtc_register_device(rtc_data->rtc);
|
||||
err = devm_rtc_register_device(rtc_data->rtc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ static int __init sun4v_rtc_probe(struct platform_device *pdev)
|
|||
rtc->range_max = U64_MAX;
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
|
||||
return rtc_register_device(rtc);
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static struct platform_driver sun4v_rtc_driver = {
|
||||
|
|
|
@ -726,7 +726,7 @@ static int sun6i_rtc_probe(struct platform_device *pdev)
|
|||
chip->rtc->ops = &sun6i_rtc_ops;
|
||||
chip->rtc->range_max = 2019686399LL; /* 2033-12-31 23:59:59 */
|
||||
|
||||
ret = rtc_register_device(chip->rtc);
|
||||
ret = devm_rtc_register_device(chip->rtc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue