Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1177808pxf; Fri, 2 Apr 2021 03:30:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbgjRFkY2MlqP3CRVSZ0+RLgdWUz6sF1jORBxkmMyeFqmSK4pfr8jsjHw08L3+JPuwCyAX X-Received: by 2002:a05:6e02:156a:: with SMTP id k10mr10435733ilu.113.1617359433526; Fri, 02 Apr 2021 03:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617359433; cv=none; d=google.com; s=arc-20160816; b=jmrg+I2qmwEWpTFJTmdnfDhPXoIMwE5AGoYdo4E4Q9K5hrWcaaAkH07XpQVeyxpisV RtQN/iX74n2YMHmJzDH/IQGQ9bspgRLCat93/P43OzpyI/pqRZh85E+jiqS/fHJCToJ3 ur4ocWgey+/5sBTorh9EzCPJf4nFpNqrzNnfT24ZSu8ugeOjNK0xVovTD+TQDei8u948 6ECQP1r0+J3cqwJsfKxmIROnEM8LyZBs9ncs8TBIhh526/kwyWnCIx2I7LGAli1bWMjS RC1fzaSaiOnodn3u45kKZ22t1lXDnqRVV1cv7y+/DyVr+i3RsC6iKaKp3oOQfLJxlZE0 r5ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:mime-version:user-agent :message-id:in-reply-to:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=MgE9vhgJDxNX/7OSTmWVb2DPktc/puyZSxUEVub/ni4=; b=D36iPnXqqt6zlQuk8Dm+NjLNDNPCgO9GQHv8wSuw1qM8n9lE3aD1zVVigKHtbA9lzZ V+nwaLK8aYRjmSLktdwwYbV3iKXhDSmNJj2bTHncN52NjMJmq/qSwdQc1Nf+Xie27mL6 KWzTLdjTvsCkP45c3bxrIgZaO4rBt/CPRB+qIe8GybFcV24WFqgsj/AlppQwP+c0Nvxl vxO+hsNN5v1r/q23MuZYGCIyRdGPiTMoesqt35WqkT4b3pUmcBfS7xp/GoqkPvSlEDMH Edalh1nZ3VplANAu4c8G72s95OLe3kkn0AQJ6nnGtaNRKQAzrlZDqfXZuXIDvCBbm3eX p4Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="omcDR/AU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si7513854jak.86.2021.04.02.03.30.19; Fri, 02 Apr 2021 03:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="omcDR/AU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234877AbhDBK2T (ORCPT + 99 others); Fri, 2 Apr 2021 06:28:19 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:31192 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbhDBK2Q (ORCPT ); Fri, 2 Apr 2021 06:28:16 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20210402102814euoutp02061d45b5d50d75fd6671a5de4f6d690b~yA7V0frI21182511825euoutp02V; Fri, 2 Apr 2021 10:28:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210402102814euoutp02061d45b5d50d75fd6671a5de4f6d690b~yA7V0frI21182511825euoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1617359294; bh=MgE9vhgJDxNX/7OSTmWVb2DPktc/puyZSxUEVub/ni4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omcDR/AUjsiQWf8PqjHH3ZZ0QoR9eupWGh8oDgfrItwQZxxrH6Qw54XBKfe37oZ3f yGs2WtaeA1eE7qXGfaSCh0VaU76dRErwa2unJoER4KLMoAdD+v5WH1zN871jH2rWUN rnzKHoJFLxFaS4X2TUSSGVNOHEn064rkj09V6YTQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20210402102813eucas1p1cf3098a4ecfe51c51986e4e4b6eb715e~yA7VjaW1V1504015040eucas1p10; Fri, 2 Apr 2021 10:28:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 32.D6.09444.DB1F6606; Fri, 2 Apr 2021 11:28:13 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20210402102813eucas1p1bae7ec57559fa8df622118275bf6fae0~yA7VI2HMj0542305423eucas1p1-; Fri, 2 Apr 2021 10:28:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210402102813eusmtrp248c1cf8a1f7be57cc25e75867c96a941~yA7VIQFMG2853628536eusmtrp2E; Fri, 2 Apr 2021 10:28:13 +0000 (GMT) X-AuditID: cbfec7f4-dbdff700000024e4-b3-6066f1bdcff9 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 99.B9.08696.DB1F6606; Fri, 2 Apr 2021 11:28:13 +0100 (BST) Received: from localhost (unknown [106.120.51.46]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210402102813eusmtip1af6019f143c7711d58f54d33b2f455f8~yA7U4SlyQ0203102031eusmtip1b; Fri, 2 Apr 2021 10:28:13 +0000 (GMT) From: =?utf-8?Q?=C5=81ukasz_Stelmach?= To: Alexandre Belloni Cc: linux-rtc@vger.kernel.org, =?utf-8?Q?Bart=C5=82omiej_=C5=BBolnierkiew?= =?utf-8?Q?icz?= , Marek Szyprowski , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] rtc: rtc_update_irq_enable: rework UIE emulation Date: Fri, 02 Apr 2021 12:28:12 +0200 In-Reply-To: <20210330000343.801566-3-alexandre.belloni@bootlin.com> (Alexandre Belloni's message of "Tue, 30 Mar 2021 02:03:43 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha256"; protocol="application/pgp-signature" X-Brightmail-Tracker: H4sIAAAAAAAAA02SfSzUcRzH973f73f3c9vp16X5dFq1S21pXXp0SnpQo6ep9TCrFRe/juG0 +zmFFio9KA49XLh0aWHnCLsOh4wMdRutVKJSEnXCdNajHpyftv57f9+f1/vzsH1JTJhHiMgw RTStVMgixFw+bmr63rqoduRwkPtojpv07FA+T1p27Q4hfWLWcqVNRe1caXHjK946wi/XEO+X ZtQjP1v5rB3YPr5XCB0RFkMrF3sH8UN7np0hjnTOOFZe9ZWbiPKmpyAHEqjlYDF1YCmITwqp QgTVqfU89jGKoD/ZQLAPG4J2/SD3X6Ty+hucLRQgeFimmaT6EWiHbhF2ikutBXXjPdyunagV kJxk5tohjGpBMJx6FaUgkpxGbYYP9W52BqfmwcuKdI6dcaDOI+js0iJ7QUB5QOflHxNNp1Oe YPzQzWP9qfAgq3diAEZFQlbbJ2QPA9VBgvbhCx6760ZosyVjrJ4G1mbjpD8T/lTd4NiXACoB LmWuZLMXEZi033CWWQ0vW39M3rweSm29BMs7QsfgVHauI2SaNBhrC+DcGS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xkV5xYm5xaV66XnJ+7iZG YLRsO/Zzyw7Gla8+6h1iZOJgPMSoAtT5aMPqC4xSLHn5ealKIrw3tqQmCPGmJFZWpRblxxeV 5qQWH2I0BfptIrOUaHI+MI7zSuINzQxMDU3MLA1MLc2MlcR5TY6siRcSSE8sSc1OTS1ILYLp Y+LglGpgmvZ5aj3DsfqOg3/1ZRx++csvZqmaoiKS+p614D3nRpGFB9+s01+htPBj47Q9yo+q Pa6w/z/PaBXgMfV4S/CV51lHJfydipbsnFLtPi23KfTBO/dvzi94/JyPrC995/fGYAfXtImn DEyYPrO/jrZaVFmzgq3X33PmvGKXB8Zbb7SlvlYqVAq4ulw54oGFLuOLlxpv88sE/SX8DZ5P /2B+MtBOUXcCdw+DwCUDlaXz3/7alm2x8sCfZRE3frUuOF5vZrBv35djcR9XznySqrbQs27z RQaWRayrRB03sq3MS7+usqlxX/R9vv7/coskM88embCQ+5bTnIiHEyr9LjxIefHwhsPzDLtb W6+t95NYLqPEUpyRaKjFXFScCAC2qjCgKwMAAA== X-CMS-MailID: 20210402102813eucas1p1bae7ec57559fa8df622118275bf6fae0 X-Msg-Generator: CA X-RootMTR: 20210402102813eucas1p1bae7ec57559fa8df622118275bf6fae0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210402102813eucas1p1bae7ec57559fa8df622118275bf6fae0 References: <20210330000343.801566-3-alexandre.belloni@bootlin.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It was <2021-03-30 wto 02:03>, when Alexandre Belloni wrote: > Now that the core is aware of whether alarms are available, it is possible > to decide whether UIE emulation is required before actually trying to set > the alarm. > > This greatly simplifies rtc_update_irq_enable because there is now only o= ne > error value to track and is not relying on the return value of > __rtc_set_alarm anymore. > > Signed-off-by: Alexandre Belloni > --- > drivers/rtc/interface.c | 28 +++++++--------------------- > 1 file changed, 7 insertions(+), 21 deletions(-) > Tested-by: =C5=81ukasz Stelmach > diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c > index dcb34c73319e..b162964d2b39 100644 > --- a/drivers/rtc/interface.c > +++ b/drivers/rtc/interface.c > @@ -561,8 +561,12 @@ int rtc_update_irq_enable(struct rtc_device *rtc, un= signed int enabled) > if (rtc->uie_rtctimer.enabled =3D=3D enabled) > goto out; >=20=20 > - if (rtc->uie_unsupported) { > + if (rtc->uie_unsupported || !test_bit(RTC_FEATURE_ALARM, rtc->features)= ) { > +#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL > + err =3D rtc_dev_update_irq_enable_emul(rtc, enabled); > +#else > err =3D -EINVAL; > +#endif > goto out; > } >=20=20 > @@ -570,8 +574,8 @@ int rtc_update_irq_enable(struct rtc_device *rtc, uns= igned int enabled) > struct rtc_time tm; > ktime_t now, onesec; >=20=20 > - rc =3D __rtc_read_time(rtc, &tm); > - if (rc) > + err =3D __rtc_read_time(rtc, &tm); > + if (err) > goto out; > onesec =3D ktime_set(1, 0); > now =3D rtc_tm_to_ktime(tm); > @@ -585,24 +589,6 @@ int rtc_update_irq_enable(struct rtc_device *rtc, un= signed int enabled) > out: > mutex_unlock(&rtc->ops_lock); >=20=20 > - /* > - * __rtc_read_time() failed, this probably means that the RTC time has > - * never been set or less probably there is a transient error on the > - * bus. In any case, avoid enabling emulation has this will fail when > - * reading the time too. > - */ > - if (rc) > - return rc; > - > -#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL > - /* > - * Enable emulation if the driver returned -EINVAL to signal that it has > - * been configured without interrupts or they are not available at the > - * moment. > - */ > - if (err =3D=3D -EINVAL) > - err =3D rtc_dev_update_irq_enable_emul(rtc, enabled); > -#endif > return err; > } > EXPORT_SYMBOL_GPL(rtc_update_irq_enable); =2D-=20 =C5=81ukasz Stelmach Samsung R&D Institute Poland Samsung Electronics --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEXpuyqjq9kGEVr9UQsK4enJilgBAFAmBm8bwACgkQsK4enJil gBD42wf/UcrU2D9DLxVyCc1wtFCR+nbGigi/3pfka0FGhspMGjPhXlmbthkob3Eo hTPvfZCUjAZ1G6SV3ZgCrLqKzqiKmtYQLdfZKnH7i+p8t5Uc5CfbV/mhfupZbrS+ PphJCO+sW/yiz0eeDLptDPhUhr7modWBsDS4+WK4o9AwBOXMZfKoJErn9UutTNIV EEevVHzXc00nlRt7MU5D6s8E1OIn8HXhEcBDJJ2DssqtOj2Xw7RncNfxUNyHg+Ke QpdAxH31lYRHnvQEpLEkcbqY3JkJpsOjpI2ID1+V69iIVeEQymw18C/Sbf9BYlSW Ns7y1JVtzTA/b//7RAOvJRDOD89pcQ== =sLOG -----END PGP SIGNATURE----- --=-=-=--