From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F100ECA9EAC for ; Sat, 19 Oct 2019 20:50:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC2C0222C2 for ; Sat, 19 Oct 2019 20:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726146AbfJSUui (ORCPT ); Sat, 19 Oct 2019 16:50:38 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:35057 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfJSUui (ORCPT ); Sat, 19 Oct 2019 16:50:38 -0400 X-Originating-IP: 86.202.229.42 Received: from localhost (lfbn-lyo-1-146-42.w86-202.abo.wanadoo.fr [86.202.229.42]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 9E2351C0002; Sat, 19 Oct 2019 20:50:36 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alexandre Belloni Subject: [PATCH] rtc: introduce lock helpers Date: Sat, 19 Oct 2019 22:50:34 +0200 Message-Id: <20191019205034.6382-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org Introduce rtc_lock and rtc_unlock to shorten the code when locking and unlocking ops_lock from drivers. Signed-off-by: Alexandre Belloni --- include/linux/rtc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/rtc.h b/include/linux/rtc.h index e86a9f307b82..4e9d3c71addb 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -159,6 +159,9 @@ struct rtc_device { }; #define to_rtc_device(d) container_of(d, struct rtc_device, dev) +#define rtc_lock(d) mutex_lock(&d->ops_lock) +#define rtc_unlock(d) mutex_unlock(&d->ops_lock) + /* useful timestamps */ #define RTC_TIMESTAMP_BEGIN_0000 -62167219200ULL /* 0000-01-01 00:00:00 */ #define RTC_TIMESTAMP_BEGIN_1900 -2208988800LL /* 1900-01-01 00:00:00 */ -- 2.21.0