Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1631721pxk; Fri, 18 Sep 2020 19:19:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvMrNbY6BhTE8lOOpPpQB+HycHxaYkkrstun5mCT/ZgEEAqYpZzUyrahV13kwB+WRunucN X-Received: by 2002:a17:906:1186:: with SMTP id n6mr37596522eja.331.1600481971199; Fri, 18 Sep 2020 19:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600481971; cv=none; d=google.com; s=arc-20160816; b=BRS8tOlZePsbrt6JVFnhmgSr2hNisVn2THfvMu4yba9Ram/srhGWu98nlnglK95ZjP 9YYHOS6eI0mFScWBJhPvLDHf59gROYAdPolX7EDtr/inWSebyQwjs+dJk+EWg4zOKWrK adCMwGLJIYShF0zxqfaRJHfbWqxB6C7GoLHY618EkHVeL76RUaDzKtFLYK67nO9bQcYR Uc6LCMtMfgdDaSZzYXYHKbffANDMu0HwYxQGxFeghhOkR9Y9VSUL6Zuak2uHRvVcfX0f yhOJct7QIyvq6/INARQkmXq+V3Wk/JKX415KRc1kV5Sa4RJEo7Tz06OEnHj9SlufClCQ SqVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9CBpCMDpTbeQhg+808u1/F+cTOnxGyu8YGvAQ3+le80=; b=mNbEE8LzRUAb/f17HNQZqIXbR8w4ZCzQcMwydmZTBMENeDFSqpP1Kc5VJb5YMMOuUO jj2sX9Q1/e5ZGgH7/yFclrzLsKRxw1cL6OtRpHekBuQc1HyG1+Xly/jEcJ6TbzYR+aWs lCDn3cK8TKbemFD6NHK2DU/jHD+YP9BjFB6Vfewtzt/klHQPaSp5bAb1FW40e6VC8WXI I/N7OynF94PAg+7FAS8eCyTIAf5txfROwamVl5txjpyhTv3i9x9XBhLKYqX8kzanFn/Z 7Em/3hUr58XaQ6tssV/f7Gb85Qp6cXGaCaza8A63dtu+NYMlR9oYFWs3FqWvA/Si5SjA NKjg== 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 v12si3870792edl.552.2020.09.18.19.19.08; Fri, 18 Sep 2020 19:19:31 -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 S1726293AbgISCSL (ORCPT + 99 others); Fri, 18 Sep 2020 22:18:11 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13708 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726134AbgISCSJ (ORCPT ); Fri, 18 Sep 2020 22:18:09 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 35A51914B868A78A9708; Sat, 19 Sep 2020 10:18:08 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 10:17:59 +0800 From: Qinglang Miao To: Linus Walleij , Lee Jones CC: , , Qinglang Miao Subject: [PATCH -next v2] mfd: ab3100-core: Convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 19 Sep 2020 10:18:31 +0800 Message-ID: <20200919021831.191077-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao --- v2: based on linux-next(20200917), and can be applied to mainline cleanly now. drivers/mfd/ab3100-core.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index ee71ae04b..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 = 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; -- 2.23.0