Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752201AbcDVXtI (ORCPT ); Fri, 22 Apr 2016 19:49:08 -0400 Received: from down.free-electrons.com ([37.187.137.238]:54147 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751470AbcDVXtH (ORCPT ); Fri, 22 Apr 2016 19:49:07 -0400 Date: Sat, 23 Apr 2016 01:48:54 +0200 From: Alexandre Belloni To: =?iso-8859-1?Q?Myl=E8ne?= Josserand Cc: rtc-linux@googlegroups.com, Alessandro Zummo , linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/6] rtc: rv3029: add alarm IRQ Message-ID: <20160422234854.GI17051@piout.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1761 Lines: 49 On 21/04/2016 at 20:24:19 +0200, Myl?ne Josserand wrote : > @@ -731,11 +786,9 @@ static void rv3029_hwmon_register(struct device *dev, const char *name) > > #endif /* CONFIG_RTC_DRV_RV3029_HWMON */ > > -static const struct rtc_class_ops rv3029_rtc_ops = { > +static struct rtc_class_ops rv3029_rtc_ops = { > .read_time = rv3029_read_time, > .set_time = rv3029_set_time, > - .read_alarm = rv3029_read_alarm, > - .set_alarm = rv3029_set_alarm, > }; > > static struct i2c_device_id rv3029_id[] = { > @@ -772,8 +825,27 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq, > > rv3029->rtc = devm_rtc_device_register(dev, name, &rv3029_rtc_ops, > THIS_MODULE); > + if (IS_ERR(rv3029->rtc)) { > + dev_err(dev, "unable to register the class device\n"); > + return PTR_ERR(rv3029->rtc); > + } > > - return PTR_ERR_OR_ZERO(rv3029->rtc); > + if (rv3029->irq > 0) { > + rc = devm_request_threaded_irq(dev, rv3029->irq, > + NULL, rv3029_handle_irq, > + IRQF_TRIGGER_LOW | IRQF_ONESHOT, > + "rv3029", dev); > + if (rc) { > + dev_warn(dev, "unable to request IRQ, alarms disabled\n"); > + rv3029->irq = 0; > + } else { > + rv3029_rtc_ops.read_alarm = rv3029_read_alarm; > + rv3029_rtc_ops.set_alarm = rv3029_set_alarm; > + rv3029_rtc_ops.alarm_irq_enable = rv3029_alarm_irq_enable; > + } > + } > + While this work, devm_rtc_device_register() needs to know whether the alarms are enabled and will try to call .read_alarm(). That is not completely an issue right now and as we discussed, I'm planning to send a rework of the rtc core to overcome that issue. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com