From patchwork Sun Dec 23 15:32:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10741745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35C836C2 for ; Sun, 23 Dec 2018 15:32:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 195D1286C8 for ; Sun, 23 Dec 2018 15:32:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C013286D3; Sun, 23 Dec 2018 15:32:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9723A286C8 for ; Sun, 23 Dec 2018 15:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=uMXScF54WRk+PfJwCRLF69UNnpCkDBRb+vUDivjrBFE=; b=Yn9 OXmlZ75eNh8hjpAK22dqb1a8g6VOkKJi8UEvg/Uzu7nABHFi8bYY9G+Py1RdLbd0bAqYzA4lPjhuM PPt/RKBvgGwCmOH97IqlNdGVDYE4aIZHiUVJ60rBcllkoI9y7+j9AhHzCwpl5gTQMJOBl2OkXvI9u xLt1/DX5nA9/ATJv0Y0cGsxriMIORF7lCQ20cx2L89LTeB6nUH7xdDAYY9ZDjypbuEUK1IFIpMe6b 1K+85YVx/NfHbtImhHFJ+JJ0LiGbwOgeUqMb+mIT4I48L4asGdJqdtRoiS8lgjJOOy4mlxVBhks6j TLFzPBk9B4MoyEMl84fiDdCvYgLDyag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gb5kA-0005oy-B4; Sun, 23 Dec 2018 15:32:42 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gb5k7-0005oA-4c for linux-arm-kernel@lists.infradead.org; Sun, 23 Dec 2018 15:32:40 +0000 Received: by mail-pg1-x541.google.com with SMTP id v28so4661365pgk.10 for ; Sun, 23 Dec 2018 07:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/yl7yD8531dQAr+4IA2CAhKhyKJ3AEPgtSs1TJxnYfo=; b=l6CIWCuHjARMIGRHcUj+OQlkkdjHbbZeVF+JoVW2cRU+kC/18hizNbcPKsbTNidZtd 1kPt3DkwS/OBVFDmf6a3QeWbaUceQ19kz/hAQ35DvHSg/QAHJ/5K9ab8eSaHHZXkYeVN tOa25GUx6vOqIAlmdlu8bTYvehy/ckQ0jog7WihVx6fr004t5GG7ZXYEd8Anw3pVRsWZ AnGox1fsMqA7QsP3wn5RJyrqW9zyYgJEtqJggbQ19ah0tEFgNEtAi5ntE4b4EZGc9lu9 7EUv5+6gjeR4mODhqk7uXFEkzdgFUtFP+CTA4PgqbG5QHoHF/i0EvWZuT8Nc8CYYqpf2 Spyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/yl7yD8531dQAr+4IA2CAhKhyKJ3AEPgtSs1TJxnYfo=; b=Uou6f2rdf16BEJobb/jWoh19JwrSFPYbGGYGjnaY2SVxZuiv92WQvhWDXyT9R7o0WX BLDk2/dhw9hzuZMvWcv/AkARkkrCOqDC4kUhaq7JiYsniRppdMqcCVjMTJLrR+qztU/R dxRFXc/vt80pVdp3+z+O5qOUF8pKaEvLYyvAQefxnvuFBsOjZWTj9nu0wGYSVvvn5msz kefilrAqlP1yPOLuTGZuR7qh385dx8YtvW1J5kUSR2scuk19bPBTufZP8aTG95TKis9b tHBbdL9+p8UZMys/XOi/haVvXm/zxRNazelRvLgp7VUlvQMM9VVKSUuctTYIndq5tcyu 649w== X-Gm-Message-State: AJcUukdxXbPImLKwlVrvpMphIUJLRubxynuDHuunOL4HhH11JYuqVXgt SYl73syj0NT6ySlE8+seOiELz738zpA= X-Google-Smtp-Source: ALg8bN79CmOBovGiouvim/nS6nPSsVB5XFhdwff7b5rV3LprnU++t1cgJAkIckXIGikTLgZqOx7pFQ== X-Received: by 2002:a63:c00b:: with SMTP id h11mr9619074pgg.429.1545579148043; Sun, 23 Dec 2018 07:32:28 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id b68sm42945737pfg.160.2018.12.23.07.32.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Dec 2018 07:32:27 -0800 (PST) From: Yangtao Li To: linus.walleij@linaro.org, lee.jones@linaro.org Subject: [RESNED] mfd: convert to DEFINE_SHOW_ATTRIBUTE Date: Sun, 23 Dec 2018 10:32:24 -0500 Message-Id: <20181223153224.2037-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181223_073239_191761_4CCBC978 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yangtao Li , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li Acked-for-MFD-by: Lee Jones Acked-by: Linus Walleij --- 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 099635bed188..3fe448a29389 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 = seq_read, - .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 55b207a4b336..24873e1ae865 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,24 +110,14 @@ 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 = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(ab3100_otp); static int __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); + &ab3100_otp_fops); if (!otp->debugfs) { dev_err(dev, "AB3100 debugfs OTP file registration failed!\n"); return -ENOENT; diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 2ab67386b4ef..4202b5c40f18 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c @@ -192,7 +192,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; @@ -296,17 +296,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 = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(debug); #define DEBUG_FOPS &debug_fops