diff mbox series

[v1,4/4] rtc: ab-eoz9: make use of RTC_FEATURE_ALARM

Message ID 20210405141334.3884528-5-liambeguin@gmail.com
State Superseded
Headers show
Series add alarm support for the rtc-ab-eoz9 | expand

Commit Message

Liam Beguin April 5, 2021, 2:13 p.m. UTC
From: Liam Beguin <lvb@xiphos.com>

Move the alarm callbacks in rtc_ops and use RTC_FEATURE_ALARM to notify
the core whether alarm capabilities are available or not.

Signed-off-by: Liam Beguin <lvb@xiphos.com>
---
 drivers/rtc/rtc-ab-eoz9.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Alexandre Belloni April 5, 2021, 5:43 p.m. UTC | #1
On 05/04/2021 10:13:34-0400, Liam Beguin wrote:
> From: Liam Beguin <lvb@xiphos.com>
> 
> Move the alarm callbacks in rtc_ops and use RTC_FEATURE_ALARM to notify
> the core whether alarm capabilities are available or not.
> 

Please squash that one with the previous one.

alse, the series looks good, thanks for working on that!

> Signed-off-by: Liam Beguin <lvb@xiphos.com>
> ---
>  drivers/rtc/rtc-ab-eoz9.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c
> index 4c8ba62fb1c6..a8256747d95d 100644
> --- a/drivers/rtc/rtc-ab-eoz9.c
> +++ b/drivers/rtc/rtc-ab-eoz9.c
> @@ -368,11 +368,6 @@ static int abeoz9_rtc_setup(struct device *dev, struct device_node *node)
>  }
>  
>  static const struct rtc_class_ops rtc_ops = {
> -	.read_time = abeoz9_rtc_get_time,
> -	.set_time  = abeoz9_rtc_set_time,
> -};
> -
> -static const struct rtc_class_ops rtc_alarm_ops = {
>  	.read_time = abeoz9_rtc_get_time,
>  	.set_time = abeoz9_rtc_set_time,
>  	.read_alarm = abeoz9_rtc_read_alarm,
> @@ -540,6 +535,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;
>  	data->rtc->uie_unsupported = 1;
> +	clear_bit(RTC_FEATURE_ALARM, data->rtc->features);
>  
>  	if (client->irq > 0) {
>  		ret = devm_request_threaded_irq(dev, client->irq, NULL,
> @@ -554,7 +550,7 @@ static int abeoz9_probe(struct i2c_client *client,
>  
>  	if (client->irq > 0 || device_property_read_bool(dev, "wakeup-source")) {
>  		ret = device_init_wakeup(dev, true);
> -		data->rtc->ops = &rtc_alarm_ops;
> +		set_bit(RTC_FEATURE_ALARM, data->rtc->features);
>  	}
>  
>  	ret = devm_rtc_register_device(data->rtc);
> -- 
> 2.30.1.489.g328c10930387
>
Liam Beguin April 5, 2021, 8:24 p.m. UTC | #2
Hi Alexandre,

On Mon Apr 5, 2021 at 1:43 PM EDT, Alexandre Belloni wrote:
> On 05/04/2021 10:13:34-0400, Liam Beguin wrote:
> > From: Liam Beguin <lvb@xiphos.com>
> > 
> > Move the alarm callbacks in rtc_ops and use RTC_FEATURE_ALARM to notify
> > the core whether alarm capabilities are available or not.
> > 
>
> Please squash that one with the previous one.
>

I kept this separate because I'm currently working on v5.4 which doesn't
have RTC_FEATURE_ALARM. If it's okay with you I'd like to keep it like
this to make it easier to backport.

> alse, the series looks good, thanks for working on that!
>

Thanks,
Liam

> > Signed-off-by: Liam Beguin <lvb@xiphos.com>
> > ---
> >  drivers/rtc/rtc-ab-eoz9.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c
> > index 4c8ba62fb1c6..a8256747d95d 100644
> > --- a/drivers/rtc/rtc-ab-eoz9.c
> > +++ b/drivers/rtc/rtc-ab-eoz9.c
> > @@ -368,11 +368,6 @@ static int abeoz9_rtc_setup(struct device *dev, struct device_node *node)
> >  }
> >  
> >  static const struct rtc_class_ops rtc_ops = {
> > -	.read_time = abeoz9_rtc_get_time,
> > -	.set_time  = abeoz9_rtc_set_time,
> > -};
> > -
> > -static const struct rtc_class_ops rtc_alarm_ops = {
> >  	.read_time = abeoz9_rtc_get_time,
> >  	.set_time = abeoz9_rtc_set_time,
> >  	.read_alarm = abeoz9_rtc_read_alarm,
> > @@ -540,6 +535,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;
> >  	data->rtc->uie_unsupported = 1;
> > +	clear_bit(RTC_FEATURE_ALARM, data->rtc->features);
> >  
> >  	if (client->irq > 0) {
> >  		ret = devm_request_threaded_irq(dev, client->irq, NULL,
> > @@ -554,7 +550,7 @@ static int abeoz9_probe(struct i2c_client *client,
> >  
> >  	if (client->irq > 0 || device_property_read_bool(dev, "wakeup-source")) {
> >  		ret = device_init_wakeup(dev, true);
> > -		data->rtc->ops = &rtc_alarm_ops;
> > +		set_bit(RTC_FEATURE_ALARM, data->rtc->features);
> >  	}
> >  
> >  	ret = devm_rtc_register_device(data->rtc);
> > -- 
> > 2.30.1.489.g328c10930387
> > 
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-ab-eoz9.c b/drivers/rtc/rtc-ab-eoz9.c
index 4c8ba62fb1c6..a8256747d95d 100644
--- a/drivers/rtc/rtc-ab-eoz9.c
+++ b/drivers/rtc/rtc-ab-eoz9.c
@@ -368,11 +368,6 @@  static int abeoz9_rtc_setup(struct device *dev, struct device_node *node)
 }
 
 static const struct rtc_class_ops rtc_ops = {
-	.read_time = abeoz9_rtc_get_time,
-	.set_time  = abeoz9_rtc_set_time,
-};
-
-static const struct rtc_class_ops rtc_alarm_ops = {
 	.read_time = abeoz9_rtc_get_time,
 	.set_time = abeoz9_rtc_set_time,
 	.read_alarm = abeoz9_rtc_read_alarm,
@@ -540,6 +535,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;
 	data->rtc->uie_unsupported = 1;
+	clear_bit(RTC_FEATURE_ALARM, data->rtc->features);
 
 	if (client->irq > 0) {
 		ret = devm_request_threaded_irq(dev, client->irq, NULL,
@@ -554,7 +550,7 @@  static int abeoz9_probe(struct i2c_client *client,
 
 	if (client->irq > 0 || device_property_read_bool(dev, "wakeup-source")) {
 		ret = device_init_wakeup(dev, true);
-		data->rtc->ops = &rtc_alarm_ops;
+		set_bit(RTC_FEATURE_ALARM, data->rtc->features);
 	}
 
 	ret = devm_rtc_register_device(data->rtc);