Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1632079pxk; Fri, 18 Sep 2020 19:20:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhU+7hNdLTDIuWtMJ5Li8bvhxQ4fqAxvpC+O1Z4dURo0i4tgIKbA2g1P/X7ZdjEEf52SXT X-Received: by 2002:a17:906:4cd6:: with SMTP id q22mr38196040ejt.139.1600482035299; Fri, 18 Sep 2020 19:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600482035; cv=none; d=google.com; s=arc-20160816; b=tzUQyCbeanNfLfI02T6fg/5rc+vTnSkmlNdN9xRJ55ToOUvdDVEY0Mnf/rhSIGyY35 ZcYBjlg2FUWBX2GleiB4Gp0RwEhjC51PoytMC/aoMPIqbI6VcGvHKlUreySq5bduNcu2 xGavY53fwH/5A9t7D8hXxAE5xZYnspblTehxgX6uMGaOVMfx5sFAp6Ez8C7GRDKNgqs5 LBVrivO/mRbZfYJ8wlDCPmv7QDOj9G2JHUG4+mm5R/9qIV3RwePaXaIXdI/hyEShbWQw 1Bizcrj/Zcd+Y2v78KupaF6YpM87RdYNYYUVJ9rqIR2XTtvesO+XufylQwX+08ZhVz+/ S7Qw== 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=kGraCCpVPv4AE2FSD6x4cH4ArRCYlQeEzH4u2hUEhIY=; b=MhJ+ghSkowgmUvLxEn2xOIIWHDohXsb9auFMGDoJS2tV7+tnULbWb8zHx3rdV/u8cK /Kmz9D2l/dxYUyjk+jL5aah0lClYE0GKi01KpO5UU+MgcTBVd1TLv8v2iy2OkVHkKWOQ nvw5xW3AedCaXKSj+TjyKuwsMD0NCsJXMefDGbwlY+hKT2ClnnIMNXimjW6m0Rl/miia vANfpCk5m5892gofHFwqxlWdO8ThqOvkUjGdF3vlQ7dKEGVmV72q7FP1JpKIwkwvZ7L0 T/0hPWeIjzW/7++Brc7yq7aiZ0FOvBR1aUMuLb14A7Ok4S0vVc3GLzmbdAXhiTeg51HW Itdg== 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 g7si3377980edp.272.2020.09.18.19.20.12; Fri, 18 Sep 2020 19:20:35 -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 S1726245AbgISCSJ (ORCPT + 99 others); Fri, 18 Sep 2020 22:18:09 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36364 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726009AbgISCSJ (ORCPT ); Fri, 18 Sep 2020 22:18:09 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0426F3DC7334026F9B0F; Sat, 19 Sep 2020 10:18:07 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 10:18:00 +0800 From: Qinglang Miao To: Linus Walleij , Lee Jones CC: , , Qinglang Miao Subject: [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 19 Sep 2020 10:18:32 +0800 Message-ID: <20200919021832.191137-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-otp.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c index c393102e3..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 = seq_read, - .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) -- 2.23.0