Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1063169ybh; Thu, 16 Jul 2020 02:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdwSsTH7JNQsmjtLtWUd8Am94cUl99Nw6Ct9DRGcH3m076Sz/YV67aujdyacVDqczb++D8 X-Received: by 2002:a17:906:fb99:: with SMTP id lr25mr2733541ejb.49.1594890107671; Thu, 16 Jul 2020 02:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594890107; cv=none; d=google.com; s=arc-20160816; b=LFcxYfowWv6xCsR+712eYi8c0Jf57XyqreMyw6M4IW8hnsCHV5GbA9p7M+VINTY5N1 XJbvTJtyYwVeMsbfHWuTLr+WH7SoELWsMX1P06smfYbykIDXHSJ0Bb1Deuo4+9y+wDW6 cO70sRHI285cjq4sqJJtU9x+yZrdQfDFUB60lDFgGdx0uJs2h7UncjAgFtphwVjdKDgz IZPx85uF+bmHhUokvsPXxtkWx4N0Nbw7A9npt6OXWYlLhzrC64ZYEZoJyERc4VnUh4TB 80HzaMDTSQiB8Kdx4Pg3mKX1i5suHjQtXi8TME+b4+75Y6zthi0K0pQCYA1wf1qT8t93 HBew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=C07k4cvxBbbY5ZzleHVQ2plD29U8sI+2A2TjHGwOyzU=; b=PegoaXAZ1sLc2c1jngTWMMCuhX2DVCoug+f+D/d7Vu5NjInRnMgGHcGPPXKg+0d9Ng x1tYmJsh8eEE5KADjKc8ajEC/tf99otNiANdxDuVG5m9JdKDxHQhkrhSc1iPhXvhg2US G6IrcCuEy1/G35h2PzR9+QnJtKiUvClIJ90zOTTmGa07YFE4LFri2PAGSPXlLbQ8GbZ7 UEfHq6mfbU7ZpaFEUzlCgf+rGfsRZctZ5a8y3ismnbpAhT71S626QU2zof5zhHOuoWBF dHRqjCJEksIQl0Q/ujIgCjWwdnqJmZT/oGVgufXqYjV+l0ID1InZmbyg3VRcU45UoCYp oHWA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si2724047ejk.677.2020.07.16.02.01.24; Thu, 16 Jul 2020 02:01:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbgGPI6r (ORCPT + 99 others); Thu, 16 Jul 2020 04:58:47 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7762 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725867AbgGPI6r (ORCPT ); Thu, 16 Jul 2020 04:58:47 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A2097B1935B7EFF40E69; Thu, 16 Jul 2020 16:58:45 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Thu, 16 Jul 2020 16:58:40 +0800 From: Qinglang Miao To: Greg Kroah-Hartman , Linus Walleij , Lee Jones CC: , Subject: [PATCH -next] mfd: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 16 Jul 2020 17:02:36 +0800 Message-ID: <20200716090236.13057-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Liu Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yongqiang Liu --- drivers/mfd/ab3100-core.c | 15 ++------------- drivers/mfd/ab3100-otp.c | 16 +++------------- drivers/mfd/tps65010.c | 14 ++------------ 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index 092c78b5e..4a347d059 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c @@ -451,7 +451,7 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data) /* * Some debugfs entries only exposed if we're using debug */ -static int ab3100_registers_print(struct seq_file *s, void *p) +static int ab3100_registers_show(struct seq_file *s, void *p) { struct ab3100 *ab3100 = s->private; u8 value; @@ -466,18 +466,7 @@ static int ab3100_registers_print(struct seq_file *s, void *p) return 0; } -static int ab3100_registers_open(struct inode *inode, struct file *file) -{ - return single_open(file, ab3100_registers_print, inode->i_private); -} - -static const struct file_operations ab3100_registers_fops = { - .open = ab3100_registers_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, - .owner = THIS_MODULE, -}; +DEFINE_SHOW_ATTRIBUTE(ab3100_registers); struct ab3100_get_set_reg_priv { struct ab3100 *ab3100; diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c index 3c1157e7a..e5d294805 100644 --- a/drivers/mfd/ab3100-otp.c +++ b/drivers/mfd/ab3100-otp.c @@ -96,7 +96,7 @@ static int __init ab3100_otp_read(struct ab3100_otp *otp) * the contents of the OTP. */ #ifdef CONFIG_DEBUG_FS -static int ab3100_show_otp(struct seq_file *s, void *v) +static int ab3100_otp_show(struct seq_file *s, void *v) { struct ab3100_otp *otp = s->private; @@ -110,23 +110,13 @@ static int ab3100_show_otp(struct seq_file *s, void *v) return 0; } -static int ab3100_otp_open(struct inode *inode, struct file *file) -{ - return single_open(file, ab3100_show_otp, inode->i_private); -} - -static const struct file_operations ab3100_otp_operations = { - .open = ab3100_otp_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(ab3100_otp); static void __init ab3100_otp_init_debugfs(struct device *dev, struct ab3100_otp *otp) { otp->debugfs = debugfs_create_file("ab3100_otp", S_IFREG | S_IRUGO, - NULL, otp, &ab3100_otp_operations); + NULL, otp, &ab3100_otp_fops); } static void __exit ab3100_otp_exit_debugfs(struct ab3100_otp *otp) diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 31259867f..f6d6b6c18 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c @@ -179,7 +179,7 @@ static inline void show_chgconfig(int por, const char *label, u8 chgconfig) { } #ifdef CONFIG_DEBUG_FS -static int dbg_show(struct seq_file *s, void *_) +static int debug_show(struct seq_file *s, void *_) { struct tps65010 *tps = s->private; u8 value, v2; @@ -283,17 +283,7 @@ static int dbg_show(struct seq_file *s, void *_) return 0; } -static int dbg_tps_open(struct inode *inode, struct file *file) -{ - return single_open(file, dbg_show, inode->i_private); -} - -static const struct file_operations debug_fops = { - .open = dbg_tps_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(debug); #define DEBUG_FOPS &debug_fops -- 2.17.1