Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600AbbGNIAO (ORCPT ); Tue, 14 Jul 2015 04:00:14 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:57835 "EHLO e23smtp06.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbGNIAM (ORCPT ); Tue, 14 Jul 2015 04:00:12 -0400 X-Helo: d23dlp03.au.ibm.com X-MailFrom: vaibhav@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org From: Vaibhav Jain To: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Neelesh Gupta , Michael Neuling , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, Vaibhav Jain Subject: [PATCH] rtc/rtc-opal: Enable alarms only when opal supports tpo Date: Tue, 14 Jul 2015 13:28:28 +0530 Message-Id: <1436860708-17058-1-git-send-email-vaibhav@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.3 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15071408-0021-0000-0000-00000189A426 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2070 Lines: 58 rtc-opal driver provides support for rtc alarms via timed-power-on(tpo). However some Power platforms like BML use a fake rtc clock and don't support tpo. Such platforms are indicated by the missing 'has-tpo' property in the device tree. Current implementation however enables callback for rtc_class_ops.read/set alarm irrespective of the tpo support from the platform. This results in a failed opal call when kernel tries to read an existing alarms via opal_get_tpo_time during rtc device registration. This patch fixes this issue by setting opal_rtc_ops.read/set_alarm callback pointers only when tpo is supported. Acked-by: Michael Neuling Acked-by: Neelesh Gupta Signed-off-by: Vaibhav Jain --- drivers/rtc/rtc-opal.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-opal.c b/drivers/rtc/rtc-opal.c index 7061dca..1125641 100644 --- a/drivers/rtc/rtc-opal.c +++ b/drivers/rtc/rtc-opal.c @@ -190,11 +190,9 @@ exit: return rc; } -static const struct rtc_class_ops opal_rtc_ops = { +static struct rtc_class_ops opal_rtc_ops = { .read_time = opal_get_rtc_time, .set_time = opal_set_rtc_time, - .read_alarm = opal_get_tpo_time, - .set_alarm = opal_set_tpo_time, }; static int opal_rtc_probe(struct platform_device *pdev) @@ -202,8 +200,11 @@ static int opal_rtc_probe(struct platform_device *pdev) struct rtc_device *rtc; if (pdev->dev.of_node && of_get_property(pdev->dev.of_node, "has-tpo", - NULL)) + NULL)) { device_set_wakeup_capable(&pdev->dev, true); + opal_rtc_ops.read_alarm = opal_get_tpo_time; + opal_rtc_ops.set_alarm = opal_set_tpo_time; + } rtc = devm_rtc_device_register(&pdev->dev, DRVNAME, &opal_rtc_ops, THIS_MODULE); -- 2.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/