Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2663284imu; Fri, 23 Nov 2018 12:43:07 -0800 (PST) X-Google-Smtp-Source: AJdET5dPW8Bwlz2wZOrs17oe6iTrNFU7YXv1WM95lJKrjlFavXAOFcT4U8c7QsBsV+G5VtthSP9N X-Received: by 2002:a63:dd15:: with SMTP id t21mr14936644pgg.347.1543005787106; Fri, 23 Nov 2018 12:43:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543005787; cv=none; d=google.com; s=arc-20160816; b=KS8eNQLzldH6jHvKZ8Qt6UZRyKyhb3m0eVwl3GQY+SSsRNV2Zvu4zjifhvCjYq+jo6 IK0fYGn3moYu7X2vl7gV3GjmwXMU2sjKZCkvYIzL14fP//7iFepOnvClgqVaw1nkOh8P GLwsx+kZn++oIx5oKgLNPDDGCQLoZxeMFrIQ/CYCZePx17yJs8s4Gmpn0bN0JhD671IQ YF4LXUT8cd4zXCaxLCNeTWV5v9OTaGsCaMy/f1co6KebtAzfsSWn7hEpSvKMlXYeN9+k jvdF0GjYeK+KrKXhgnG6n7/6mmUJ7X1fD0QG0902GKY9vaZCzqaC2Xb/q3ifbvvHnPwj tVKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/2FQipLjfEG4na7CrddqYMj4I93hdSyt+i9eHE3UFwo=; b=Uv06M1+yLgDiwJD4Q1P1xnflprzsTQcMzTCklbivpNUvMha2SWLKlGiWjVOme0pGvx pq5vXcV0Aa881Um46E04EKt6Q4vkL368vWfcrDPF6HH2ZfHqyCETMg0xFCN/Fs8sZQsK fk9HC6+VlEdE60LlSjLDaGWHO1LtAl6eQr4mSkfkncCJIXr6o/2/rrfgEwisRR3adOFD t7igTYXviia2PXWHrSFyBpuKJljy6BjDnhE2OhPTCFv3ScLETxaROnmQDUy5glnRYfr/ X57vC+E+VqnNaiVjHnRvo8ZxwWB4fHKZoBGafoKjK5uLw0hKkfKP11AWs9J16yTU7nle zusw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JZbt5L/w"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b21si36003378pfb.89.2018.11.23.12.42.52; Fri, 23 Nov 2018 12:43:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JZbt5L/w"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395507AbeKWBFa (ORCPT + 99 others); Thu, 22 Nov 2018 20:05:30 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46002 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388795AbeKWBFa (ORCPT ); Thu, 22 Nov 2018 20:05:30 -0500 Received: by mail-pl1-f194.google.com with SMTP id a14so9335281plm.12; Thu, 22 Nov 2018 06:25:54 -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=/2FQipLjfEG4na7CrddqYMj4I93hdSyt+i9eHE3UFwo=; b=JZbt5L/w9ToDRXZ7H/SIF0QAZtAiiL3GiMaXh2Eq7nI19S0fTNmQRN1bb3NQ3Oo/nk RCPGncwi3Yr/FluCLvw5YTDQx3USmPO72BgVxkei3anA6HAXY1RcHK8WLdm9Wpwe72h6 b1XdzpfU6iVbXcnwW8EUlaX86cSJ7m+agz0r49LWGi/89KMGvToWT5947UuJLlLLUeew qe8ppO++C4jJZKl1kn5Dl9qeFayKOaBB2mTZ/NFi7acvpA3aqHt/U7AcEE1W9X6snesh k3Pm7mCDInXhFKOm0NHN4t18xFkr4YncKDppwFJcAoq+9z+Sz6wzUOXmwgPivzjXILCj T2Iw== 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=/2FQipLjfEG4na7CrddqYMj4I93hdSyt+i9eHE3UFwo=; b=KhMvGuFr1jx5p5wNG8xsi0NxiXjGkvHrQyoG1uNuHdHy6jUhtJzQaCSdcz1jUlDYm3 Ds+FSRyWLjbvLltMPX94xRdPAU6dIbWjZ2rRHLozi3njNCpXcBQUdaZVozZHleNAxpnR TtP3KpDHV9l1Fg800lx7RlTRp3LxmYPaFepAOiSv32bgCj9xvP9a30lj5H1Sqa3H0wva 7cZI2G3bXkpGw2p9hFsZqlKfSTyQsfnk728j/jEv2A7KnBph6cVF4XERWH5K+uTr9tZ9 6ipBWVFhXuNeISl7Ke/LPC3q/KH7G4BQQvrDf5GFxuQkoTqIJQkjXUtqeKd65kg8ZL9q U1eA== X-Gm-Message-State: AA+aEWaCimWnWzH8AufAYbrNVC5yaxqQtJr56mkD5wz7nuMGNFG5gCoM 0Zs1pDskZ3+yl0FX/yJj+1M= X-Received: by 2002:a17:902:6848:: with SMTP id f8mr11254854pln.300.1542896754440; Thu, 22 Nov 2018 06:25:54 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id z7sm42537609pga.6.2018.11.22.06.25.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Nov 2018 06:25:53 -0800 (PST) From: Yangtao Li To: sre@kernel.org, hdegoede@redhat.com, wens@csie.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] power: supply: axp288_fuel_gauge: Change to use DEFINE_SHOW_ATTRIBUTE macro Date: Thu, 22 Nov 2018 09:25:51 -0500 Message-Id: <20181122142551.25367-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li --- drivers/power/supply/axp288_fuel_gauge.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c index 084c8ba9749d..9ff2461820d8 100644 --- a/drivers/power/supply/axp288_fuel_gauge.c +++ b/drivers/power/supply/axp288_fuel_gauge.c @@ -307,22 +307,12 @@ static int fuel_gauge_debug_show(struct seq_file *s, void *data) return 0; } -static int debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, fuel_gauge_debug_show, inode->i_private); -} - -static const struct file_operations fg_debug_fops = { - .open = debug_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(fuel_gauge_debug); static void fuel_gauge_create_debugfs(struct axp288_fg_info *info) { info->debug_file = debugfs_create_file("fuelgauge", 0666, NULL, - info, &fg_debug_fops); + info, &fuel_gauge_debug_fops); } static void fuel_gauge_remove_debugfs(struct axp288_fg_info *info) -- 2.17.0