Commit e53ad084 authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: m48t59: remove m48t02_rtc_ops

Clear RTC_FEATURE_ALARM to signal that alarms are not available instead of
having a supplementary struct rtc_class_ops without alarm callbacks.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210110231752.1418816-7-alexandre.belloni@bootlin.com
parent b0d42def
...@@ -313,11 +313,6 @@ static const struct rtc_class_ops m48t59_rtc_ops = { ...@@ -313,11 +313,6 @@ static const struct rtc_class_ops m48t59_rtc_ops = {
.alarm_irq_enable = m48t59_rtc_alarm_irq_enable, .alarm_irq_enable = m48t59_rtc_alarm_irq_enable,
}; };
static const struct rtc_class_ops m48t02_rtc_ops = {
.read_time = m48t59_rtc_read_time,
.set_time = m48t59_rtc_set_time,
};
static int m48t59_nvram_read(void *priv, unsigned int offset, void *val, static int m48t59_nvram_read(void *priv, unsigned int offset, void *val,
size_t size) size_t size)
{ {
...@@ -366,7 +361,6 @@ static int m48t59_rtc_probe(struct platform_device *pdev) ...@@ -366,7 +361,6 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
struct m48t59_private *m48t59 = NULL; struct m48t59_private *m48t59 = NULL;
struct resource *res; struct resource *res;
int ret = -ENOMEM; int ret = -ENOMEM;
const struct rtc_class_ops *ops;
struct nvmem_config nvmem_cfg = { struct nvmem_config nvmem_cfg = {
.name = "m48t59-", .name = "m48t59-",
.word_size = 1, .word_size = 1,
...@@ -438,17 +432,21 @@ static int m48t59_rtc_probe(struct platform_device *pdev) ...@@ -438,17 +432,21 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
} }
m48t59->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(m48t59->rtc))
return PTR_ERR(m48t59->rtc);
switch (pdata->type) { switch (pdata->type) {
case M48T59RTC_TYPE_M48T59: case M48T59RTC_TYPE_M48T59:
ops = &m48t59_rtc_ops;
pdata->offset = 0x1ff0; pdata->offset = 0x1ff0;
break; break;
case M48T59RTC_TYPE_M48T02: case M48T59RTC_TYPE_M48T02:
ops = &m48t02_rtc_ops; clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features);
pdata->offset = 0x7f0; pdata->offset = 0x7f0;
break; break;
case M48T59RTC_TYPE_M48T08: case M48T59RTC_TYPE_M48T08:
ops = &m48t02_rtc_ops; clear_bit(RTC_FEATURE_ALARM, m48t59->rtc->features);
pdata->offset = 0x1ff0; pdata->offset = 0x1ff0;
break; break;
default: default:
...@@ -459,11 +457,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev) ...@@ -459,11 +457,7 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
spin_lock_init(&m48t59->lock); spin_lock_init(&m48t59->lock);
platform_set_drvdata(pdev, m48t59); platform_set_drvdata(pdev, m48t59);
m48t59->rtc = devm_rtc_allocate_device(&pdev->dev); m48t59->rtc->ops = &m48t59_rtc_ops;
if (IS_ERR(m48t59->rtc))
return PTR_ERR(m48t59->rtc);
m48t59->rtc->ops = ops;
nvmem_cfg.size = pdata->offset; nvmem_cfg.size = pdata->offset;
ret = devm_rtc_nvmem_register(m48t59->rtc, &nvmem_cfg); ret = devm_rtc_nvmem_register(m48t59->rtc, &nvmem_cfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment