From patchwork Wed Jun 2 07:38:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293303 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 63492C4708F for ; Wed, 2 Jun 2021 08:18:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25ED9613AC for ; Wed, 2 Jun 2021 08:18:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25ED9613AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4XT3c34qRiI0544wWqcsLbBeQRJPJa01wpIF8pIuhw4=; b=jMD1cA1Dsq7htA JgUor0sf1t7dNzrrpA/aUkGA32PwnHo1TQijDB9vMcntiREmJA0a5RP2Cf5fd8s3m+k2qeL8s9lM1 q4CJnmczu6vMrXPiiQHXADM/EB/DdNVmKpnFlBo5oy5HAqu8SVG6s/0z13HOkyoF0NtEQToApsXqT pBbI4Uz3HQwu+uI1l+EeFwB9/vIbR7QD2Fg2e89pZ0aii/SY1dmSa632RmhCORBrGUQ7Vikv6/WPA SXoesM/l9ngTprc7tHgnNxD0FJi/1L+9RnIQD0JLiJhg40VQZvLlEZ6J5QHECiLAVbyp5ooFLWmjC GiKAzfqMh6x03OfYaaNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM36-002YoK-2h; Wed, 02 Jun 2021 08:16:24 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002MlT-AL for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:49 +0000 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fw14647J7z19Rl6; Wed, 2 Jun 2021 15:33:58 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:41 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:40 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 1/8] rtc: x1205: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 15:38:13 +0800 Message-ID: <20210602073820.11011-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003847_580910_3347E429 X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-x1205.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index d1d5a44d9122ad9..351e4725a7a5439 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c @@ -566,8 +566,8 @@ static const struct rtc_class_ops x1205_rtc_ops = { .set_alarm = x1205_rtc_set_alarm, }; -static ssize_t x1205_sysfs_show_atrim(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t atrim_show(struct device *dev, + struct device_attribute *attr, char *buf) { int err, atrim; @@ -577,10 +577,10 @@ static ssize_t x1205_sysfs_show_atrim(struct device *dev, return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000); } -static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL); +static DEVICE_ATTR_RO(atrim); -static ssize_t x1205_sysfs_show_dtrim(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t dtrim_show(struct device *dev, + struct device_attribute *attr, char *buf) { int err, dtrim; @@ -590,7 +590,7 @@ static ssize_t x1205_sysfs_show_dtrim(struct device *dev, return sprintf(buf, "%d ppm\n", dtrim); } -static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL); +static DEVICE_ATTR_RO(dtrim); static int x1205_sysfs_register(struct device *dev) { From patchwork Wed Jun 2 07:38:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293309 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 1B573C47083 for ; Wed, 2 Jun 2021 08:22:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5E686100A for ; Wed, 2 Jun 2021 08:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5E686100A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c4WQzN041Rd31QLCqp9rlhELoV2ga0CkzcCW/8S5Hr0=; b=GENTgI1OCmn5bA 4SPe8hhl/ItcOWVAgwhuZRc7/vgjE6t++v6Y3j5dWkhp2WNPXZ0Xs8ys1ohURZOOxZ4LdqtNqqKvG W7HDaAhf85aTQzZ/w8HyxLwZJt2/g3WcvKOTvXPRetp1sktgSe4bswtQq5gdb36Yta4bJnEfXAndi TtNCBXY+clmtA1puwIZQ3eZEIyTPLR7TPNfvo1C5iMQIXa7sDvOWeBGrnb4S2JQfa6zIMu9i6Fmyv 3zkQThmD9EGfCWBMzvqQa7nSrBMI2R1Wjq86dy7nhveRFjloYzoXyUAJ7+ZvpAeaxEEPQ4eBZ4SCA d6Kk7yjA11YIvVCNWNSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM6u-002afg-7k; Wed, 02 Jun 2021 08:20:20 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002MlV-A1 for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:50 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fw1470qgcz19S48; Wed, 2 Jun 2021 15:33:59 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:41 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:41 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro Date: Wed, 2 Jun 2021 15:38:14 +0800 Message-ID: <20210602073820.11011-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003847_579613_15556659 X-CRM114-Status: GOOD ( 10.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-rx8025.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index c914091819ba7da..73973886db4441d 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -458,9 +458,9 @@ static int rx8025_set_clock_adjust(struct device *dev, int adj) return 0; } -static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t clock_adjust_ppb_show(struct device *dev, + struct device_attribute *attr, + char *buf) { int err, adj; @@ -471,9 +471,9 @@ static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev, return sprintf(buf, "%d\n", adj); } -static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t clock_adjust_ppb_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int adj, err; @@ -485,9 +485,7 @@ static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev, return err ? err : count; } -static DEVICE_ATTR(clock_adjust_ppb, S_IRUGO | S_IWUSR, - rx8025_sysfs_show_clock_adjust, - rx8025_sysfs_store_clock_adjust); +static DEVICE_ATTR_RW(clock_adjust_ppb); static int rx8025_sysfs_register(struct device *dev) { From patchwork Wed Jun 2 07:38:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293311 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 5C66AC47083 for ; Wed, 2 Jun 2021 08:22:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 276F7613CD for ; Wed, 2 Jun 2021 08:22:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 276F7613CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xzn3082+RUfRltkDLjwQq7FH7q4D80jcufNP+yjuJGE=; b=0o3W6o1M7QVLiV X1Q4u3zvgS2kOWzgEshzZuxE+WzYf66EwQixrrxTWXhZ0J41iT7RmOimOIsEkwIzXfBoyd1JSI8Xg rzoCr/U3o8GDQPs2Pm3r3+aRWhXLN9EpF7tjgp3SbD3GWB4trwjTHdomUSwhs/C0anq6vtt2lEAgW TXzXYbGFnbPjfz1EPdZjD1GoKwzR20IGekJXWvcqIA2lHL+S9K1REgH2xmqWYSKCbYPoWWy8M/1g2 nAzKZNOnzKFioPpZUHYLRXTaNnDmuHnVOx2Uc8zlZvgXZ6QJZd76wqDGcvVej3LQ4G5E2H1+R5fGG R2HKKS+H2hADsNS1gt/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM7V-002avo-HP; Wed, 02 Jun 2021 08:20:57 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002MlS-PJ for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:51 +0000 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Fw15G0BfQz66Tn; Wed, 2 Jun 2021 15:34:58 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:42 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:41 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 3/8] rtc: rs5c372: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 15:38:15 +0800 Message-ID: <20210602073820.11011-4-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003848_029375_DBE5354C X-CRM114-Status: GOOD ( 10.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-rs5c372.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 80980414890c703..eae0fbad64c109e 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c @@ -496,8 +496,8 @@ static const struct rtc_class_ops rs5c372_rtc_ops = { #if IS_ENABLED(CONFIG_RTC_INTF_SYSFS) -static ssize_t rs5c372_sysfs_show_trim(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t trim_show(struct device *dev, + struct device_attribute *attr, char *buf) { int err, trim; @@ -507,10 +507,10 @@ static ssize_t rs5c372_sysfs_show_trim(struct device *dev, return sprintf(buf, "%d\n", trim); } -static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); +static DEVICE_ATTR_RO(trim); -static ssize_t rs5c372_sysfs_show_osc(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t osc_show(struct device *dev, + struct device_attribute *attr, char *buf) { int err, osc; @@ -520,7 +520,7 @@ static ssize_t rs5c372_sysfs_show_osc(struct device *dev, return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); } -static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); +static DEVICE_ATTR_RO(osc); static int rs5c_sysfs_register(struct device *dev) { From patchwork Wed Jun 2 07:38:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293315 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 BFF0DC4708F for ; Wed, 2 Jun 2021 08:24:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A43661360 for ; Wed, 2 Jun 2021 08:24:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A43661360 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dOwPt8DwUC3CJGjxtTtpzz18cZjpQaxeBqwfmuF/Xfg=; b=EvuKUBxMSzvTj7 RhhE5EPg5pl3QbTVQlPwVpstxt44Rw5t2CiG9Gi/8rYtyvcfamlyVV5x1r3RL/xvC1bBkMGjj/BCC MPCHUT6VxGA5y2GWBSGRguBWyaRXHPKx4W0cKm15xwUGRwdCvVO23ExQ2rnh6a1Wd9lk3vX5R9e6w wo/sgJp5B2t0CCUhyTjMWukUhqnjm/Aq1QU4HZ86Jq9gAttRDaF73cdBmyDojiQQL2NjNL8dTUQGs 7aAcZYt9XTNyTNfTqX6j+VpWaYt/AuibSSWkpSf8kpsMxIfa/RvVgxN4YzLFyKmnUA2JHX3heID3a HNZHEC/tcKOmuF4Yv2fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM8g-002bOw-So; Wed, 02 Jun 2021 08:22:11 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002Mlu-HU for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:51 +0000 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fw16B2q7zz685g; Wed, 2 Jun 2021 15:35:46 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:42 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:42 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 4/8] rtc: isl1208: use DEVICE_ATTR_* macro Date: Wed, 2 Jun 2021 15:38:16 +0800 Message-ID: <20210602073820.11011-5-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003847_962924_6A178D73 X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_* macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-isl1208.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 182dfa605515572..1e0069ab9769647 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -654,9 +654,8 @@ static const struct rtc_class_ops isl1208_rtc_ops = { /* sysfs interface */ -static ssize_t -isl1208_sysfs_show_atrim(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t atrim_show(struct device *dev, + struct device_attribute *attr, char *buf) { int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent)); if (atr < 0) @@ -665,11 +664,10 @@ isl1208_sysfs_show_atrim(struct device *dev, return sprintf(buf, "%d.%.2d pF\n", atr >> 2, (atr & 0x3) * 25); } -static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL); +static DEVICE_ATTR_RO(atrim); -static ssize_t -isl1208_sysfs_show_dtrim(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t dtrim_show(struct device *dev, + struct device_attribute *attr, char *buf) { int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent)); if (dtr < 0) @@ -678,11 +676,10 @@ isl1208_sysfs_show_dtrim(struct device *dev, return sprintf(buf, "%d ppm\n", dtr - 100); } -static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL); +static DEVICE_ATTR_RO(dtrim); -static ssize_t -isl1208_sysfs_show_usr(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t usr_show(struct device *dev, + struct device_attribute *attr, char *buf) { int usr = isl1208_i2c_get_usr(to_i2c_client(dev->parent)); if (usr < 0) @@ -691,10 +688,9 @@ isl1208_sysfs_show_usr(struct device *dev, return sprintf(buf, "0x%.4x\n", usr); } -static ssize_t -isl1208_sysfs_store_usr(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t usr_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int usr = -1; @@ -715,8 +711,7 @@ isl1208_sysfs_store_usr(struct device *dev, return count; } -static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr, - isl1208_sysfs_store_usr); +static DEVICE_ATTR_RW(usr); static struct attribute *isl1208_rtc_attrs[] = { &dev_attr_atrim.attr, From patchwork Wed Jun 2 07:38:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293313 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 D407AC4708F for ; Wed, 2 Jun 2021 08:23:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A29B613AC for ; Wed, 2 Jun 2021 08:23:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A29B613AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CHvnLdK2hb1rMEhqK2KL07WPZJcupVea/lO/XeADlTE=; b=TxpXozVHOtl+un fPCllj3JTdvSapnVu0gJETkyUS7jfLcZ9Gs5g96NLlxzWSpQiRDQGiHk3zcl15GWMwYI2gv8XMPfs VTRhzqiXvLMKhfYA0rvEWhUJuiK8ufk5elKQTD9jGh8m7k56mwdZzXPV/pQ7YacBKpQucirh3FZqx FB04bz3cIF0ddN4lkUVSfPsT2cqcKfxyeFhTZ/WZH4qKcQwJRD7JBDVGDdsXkv3022HsarRJMNBTD ORi7u4oIk2kL9g4JsaRy/Ium9zEFtPd/NfhHYeRcGjVq6agpjOA3i/4575PhYgmRYqaH7pfALTR4T 0lO+8/23nZwQZFyIId+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM83-002b8z-K3; Wed, 02 Jun 2021 08:21:32 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002Mli-9A for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:51 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fw1484r63z19RJy; Wed, 2 Jun 2021 15:34:00 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:43 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:42 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 5/8] rtc: ds1685: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 15:38:17 +0800 Message-ID: <20210602073820.11011-6-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003847_758531_F0CBC18A X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-ds1685.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 75db7ab654a5ae1..60209320c7ac9ca 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c @@ -975,14 +975,13 @@ static int ds1685_nvram_write(void *priv, unsigned int pos, void *val, /* SysFS interface */ /** - * ds1685_rtc_sysfs_battery_show - sysfs file for main battery status. + * battery_show - sysfs file for main battery status. * @dev: pointer to device structure. * @attr: pointer to device_attribute structure. * @buf: pointer to char array to hold the output. */ -static ssize_t -ds1685_rtc_sysfs_battery_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t battery_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); u8 ctrld; @@ -992,17 +991,16 @@ ds1685_rtc_sysfs_battery_show(struct device *dev, return sprintf(buf, "%s\n", (ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A"); } -static DEVICE_ATTR(battery, S_IRUGO, ds1685_rtc_sysfs_battery_show, NULL); +static DEVICE_ATTR_RO(battery); /** - * ds1685_rtc_sysfs_auxbatt_show - sysfs file for aux battery status. + * auxbatt_show - sysfs file for aux battery status. * @dev: pointer to device structure. * @attr: pointer to device_attribute structure. * @buf: pointer to char array to hold the output. */ -static ssize_t -ds1685_rtc_sysfs_auxbatt_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t auxbatt_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); u8 ctrl4a; @@ -1014,17 +1012,16 @@ ds1685_rtc_sysfs_auxbatt_show(struct device *dev, return sprintf(buf, "%s\n", (ctrl4a & RTC_CTRL_4A_VRT2) ? "ok" : "not ok or N/A"); } -static DEVICE_ATTR(auxbatt, S_IRUGO, ds1685_rtc_sysfs_auxbatt_show, NULL); +static DEVICE_ATTR_RO(auxbatt); /** - * ds1685_rtc_sysfs_serial_show - sysfs file for silicon serial number. + * serial_show - sysfs file for silicon serial number. * @dev: pointer to device structure. * @attr: pointer to device_attribute structure. * @buf: pointer to char array to hold the output. */ -static ssize_t -ds1685_rtc_sysfs_serial_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t serial_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); u8 ssn[8]; @@ -1035,7 +1032,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev, return sprintf(buf, "%8phC\n", ssn); } -static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL); +static DEVICE_ATTR_RO(serial); /* * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features. From patchwork Wed Jun 2 07:38:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293317 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 0BB91C4708F for ; Wed, 2 Jun 2021 08:24:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0D3361360 for ; Wed, 2 Jun 2021 08:24:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0D3361360 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cKtOoBnHHiGW7/nTUiN8Bs5AZUrt55cF5jRtWylYcqg=; b=GBYHKetSqvMPWy QH0VWRk6mYQA4LcZQ5rAKfFXKX9PsNxeRsMXVS6XKirVaKRm52sP1av+BD+C13dF7WbJ263LnBDW5 gzNXda8hIRLDgfm8QorZiTkCsj/0MgNK1UyKUedTGHeCYzJb9KdZoKqf6KNbxzkKiiGzQmNMuw0V6 l4uI0tvYqXNjYg1dTDRWTddSc2VkbGR5pJ/yJx4TU8ro1KdyKXVa2j+smfgaO+OF8ufpvKu+kPiig M/6FOV0ybITyS3i4iSU5a1mAv3/2z92wWgWWEKgY1LL7Ew9TlerDwF5flhIBoKE7pUEGXQHMwOnUB hs9Aqn89IOjDaJpIFRwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM9T-002bjO-3H; Wed, 02 Jun 2021 08:22:59 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSh-002Mlp-QK for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:51 +0000 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Fw15H44YKz64ls; Wed, 2 Jun 2021 15:34:59 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:43 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:43 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 6/8] rtc: ds1343: use DEVICE_ATTR_* macro Date: Wed, 2 Jun 2021 15:38:18 +0800 Message-ID: <20210602073820.11011-7-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003848_232585_C280A897 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_* macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-ds1343.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c index f14ed6c96437b44..ffabb8b69e6d8e6 100644 --- a/drivers/rtc/rtc-ds1343.c +++ b/drivers/rtc/rtc-ds1343.c @@ -80,8 +80,8 @@ struct ds1343_priv { int irq; }; -static ssize_t ds1343_show_glitchfilter(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t glitch_filter_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct ds1343_priv *priv = dev_get_drvdata(dev->parent); int glitch_filt_status, data; @@ -99,9 +99,9 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev, return sprintf(buf, "disabled\n"); } -static ssize_t ds1343_store_glitchfilter(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t glitch_filter_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { struct ds1343_priv *priv = dev_get_drvdata(dev->parent); int data = 0; @@ -120,8 +120,7 @@ static ssize_t ds1343_store_glitchfilter(struct device *dev, return count; } -static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter, - ds1343_store_glitchfilter); +static DEVICE_ATTR_RW(glitch_filter); static int ds1343_nvram_write(void *priv, unsigned int off, void *val, size_t bytes) @@ -139,8 +138,8 @@ static int ds1343_nvram_read(void *priv, unsigned int off, void *val, return regmap_bulk_read(ds1343->map, DS1343_NVRAM + off, val, bytes); } -static ssize_t ds1343_show_tricklecharger(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t trickle_charger_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct ds1343_priv *priv = dev_get_drvdata(dev->parent); int res, data; @@ -183,7 +182,7 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev, return sprintf(buf, "%s %s\n", diodes, resistors); } -static DEVICE_ATTR(trickle_charger, S_IRUGO, ds1343_show_tricklecharger, NULL); +static DEVICE_ATTR_RO(trickle_charger); static struct attribute *ds1343_attrs[] = { &dev_attr_glitch_filter.attr, From patchwork Wed Jun 2 07:38:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293319 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 974E3C47083 for ; Wed, 2 Jun 2021 08:25:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66EDA61360 for ; Wed, 2 Jun 2021 08:25:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66EDA61360 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FHTt/fWABb/k24oOLTWATxt9sthlnOfnX/AiZ3bywTM=; b=klHN3jWvioIYmV EeIiGALBFE26sUQMCayJSgqVzZ5htw2ntgwkkgn6bOwvawJa4AybWWYzwbXKfpT/ynLAmNEOmzhRt pPOa6XERHGGBCfQeYV6Q4tQy8ZOlnff1OLB2NyUYpLJa7bm9BgxsqhqncjhJruypBc0wcofWIn/D6 I/Zqb0hD+Nm+YGxVCtBXhNT3D3dWYnptqWNbMQWwpGfO4iBUwW7SZ/+4wHyZi7IHQVUSg3N0XAAlQ WtLHBOOSyxd0P0voRQ8r/AYMrPPImKQHVuOSUilbvTJGQdcV3lRytQTVCkBUZ4Qi+ILK47c56cDep HJut+yTksuYE+50cn9Tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loMAU-002c8h-86; Wed, 02 Jun 2021 08:24:03 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSi-002MnP-WD for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:52 +0000 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Fw16F30pVz68Qp; Wed, 2 Jun 2021 15:35:49 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:44 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:43 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 7/8] rtc: bq32k: use DEVICE_ATTR_RW macro Date: Wed, 2 Jun 2021 15:38:19 +0800 Message-ID: <20210602073820.11011-8-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003849_266885_A01124D4 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/rtc/rtc-bq32k.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c index 2235c968842db76..83c799f59331bff 100644 --- a/drivers/rtc/rtc-bq32k.c +++ b/drivers/rtc/rtc-bq32k.c @@ -190,9 +190,9 @@ static int trickle_charger_of_init(struct device *dev, struct device_node *node) return 0; } -static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t trickle_charge_bypass_show(struct device *dev, + struct device_attribute *attr, + char *buf) { int reg, error; @@ -203,9 +203,9 @@ static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev, return sprintf(buf, "%d\n", (reg & BQ32K_TCFE) ? 1 : 0); } -static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t trickle_charge_bypass_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int reg, enable, error; @@ -235,9 +235,7 @@ static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev, return count; } -static DEVICE_ATTR(trickle_charge_bypass, 0644, - bq32k_sysfs_show_tricklecharge_bypass, - bq32k_sysfs_store_tricklecharge_bypass); +static DEVICE_ATTR_RW(trickle_charge_bypass); static int bq32k_sysfs_register(struct device *dev) { From patchwork Wed Jun 2 07:38:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 12293307 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=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 821F7C4708F for ; Wed, 2 Jun 2021 08:21:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EECA613CA for ; Wed, 2 Jun 2021 08:21:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EECA613CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oOr1qJ1Ov3kkbCfpsLmXnKG/m3d1l6DoyLXWfZnK11Q=; b=pi7xnNdqzl4H6D 3313eaRd1WnmU0sS78TSjhhOEWPa4v+iy2M/ImoRHDS9P+9tTQzIbrfASSx63iycSiBuqjCbAM3NQ egJhLwU7k7vhnLbKBT/pXfgaQ1GSadzGacP2t8iD8N0gA2rkensnf0MYkRuzH/imDT29m0FNvlyLx W3PJJx5OCqYY+bhezkn9BpgqlY/Zz1g7i4X0uPqVt6ywcNjd2hrv0UL5R0r3wl+b2k1ejSaV1oguG tLEx8cuUM6CJaw6vWmEs1g3KAGDvez+BIYS+rsUbRjcQenGOdTVO1DJRVLsoB4f+jKlFadWx8kY68 7FBPUU8XlJl/BmBE10TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loM5q-002aEc-Bc; Wed, 02 Jun 2021 08:19:15 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loLSi-002Mlz-Jw for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 07:38:52 +0000 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fw14B0dJGzWmQH; Wed, 2 Jun 2021 15:34:02 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:44 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 15:38:44 +0800 From: Zhen Lei To: Alessandro Zummo , Alexandre Belloni , Joshua Kinard , "Linus Walleij" , linux-arm-kernel , linux-rtc , linux-kernel CC: Zhen Lei Subject: [PATCH 8/8] rtc: ab8500: use DEVICE_ATTR_RW macro Date: Wed, 2 Jun 2021 15:38:20 +0800 Message-ID: <20210602073820.11011-9-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210602073820.11011-1-thunder.leizhen@huawei.com> References: <20210602073820.11011-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_003848_871645_8773635A X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use DEVICE_ATTR_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei Reviewed-by: Linus Walleij --- drivers/rtc/rtc-ab8500.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index b40048871295d12..540a1a5d42d0b57 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c @@ -274,9 +274,9 @@ static int ab8500_rtc_get_calibration(struct device *dev, int *calibration) return retval; } -static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t rtc_calibration_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int retval; int calibration = 0; @@ -291,8 +291,8 @@ static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev, return retval ? retval : count; } -static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t rtc_calibration_show(struct device *dev, + struct device_attribute *attr, char *buf) { int retval = 0; int calibration = 0; @@ -307,9 +307,7 @@ static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev, return sprintf(buf, "%d\n", calibration); } -static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR, - ab8500_sysfs_show_rtc_calibration, - ab8500_sysfs_store_rtc_calibration); +static DEVICE_ATTR_RW(rtc_calibration); static struct attribute *ab8500_rtc_attrs[] = { &dev_attr_rtc_calibration.attr,