Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7337064imu; Mon, 3 Dec 2018 11:11:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+zyAHMZFUS/4XQmx8cmZ7KPpMvwSBSEIhb1og75J1ZQsnrejfmRoOEVPWnczPSaoXdibm X-Received: by 2002:a62:8d4f:: with SMTP id z76mr17603837pfd.2.1543864308027; Mon, 03 Dec 2018 11:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543864307; cv=none; d=google.com; s=arc-20160816; b=lUURaeegTWcR1rtkGkRSWJx3F5uHQCDBBMbMTjb3wzZfqhxiZ3Duw9mGjmjqlZiQc/ Rr+APRLovh1+4VCsMu94XS82zxcBz5lcHVQpQ09CQ/2fQrI+JyqmYud267lHXQWkgbq8 vPGVZfyFlhrlaD/+esLKfOfvFsr5dJazCeP3b/fyCWpYpZ0iRV/yNwRuiFuGYPWtd28q GuVIm0rw3Z88uv2XrAbMAxg90sN45fOhF0IqxICWhVinYwYPbOXAvmITbupN9FqoXPn+ 458kQdVtMDsYD+Q4oW/uqVkHmzqmsAdOV2pJcXloTiUP+w+Y3h3IZOyOOcJkwbc83b4c NEwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=c9B6ZvdHB5QzgldK0P6MI9mVpmAd5Mev5B7zmvE7Cvs=; b=byd7gbY0AQ5nLPribzqb3TlZunJD1m1eXsAJh+DMY7z0rS+HBxLnLkaeZwUsBJfArY CZrNZGK3BudTa2WVWMZ1jwjwdTRGUKS4XUBhmwdxDXuF4H+4lq7D0bHKyYTF4C68Ra9d sxqRT5Q38xjMH2UHsBgwfk7CeNMQ7D1ypW/9zAThcQN0YrhIzaHR6Gl25xIuTRDPCBVT e1xYzhyyRMVJr2Dk/90yzSgLUIqAKqqNifdCEkl3FRH16LmlzdvtTrWQ/nAryqomguwd 1DKwGYbtq4vBf+MbgB1ce+FWk0YXox87uPzSG7uoELIDi5m5rOv2ik1+EOxP6rhttGBe wEdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohCVMB10; 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 j6si14184933pfc.57.2018.12.03.11.11.32; Mon, 03 Dec 2018 11:11:47 -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=ohCVMB10; 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 S1726876AbeLCTJs (ORCPT + 99 others); Mon, 3 Dec 2018 14:09:48 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38835 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbeLCTJs (ORCPT ); Mon, 3 Dec 2018 14:09:48 -0500 Received: by mail-qt1-f195.google.com with SMTP id p17so15110983qtl.5; Mon, 03 Dec 2018 11:09:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c9B6ZvdHB5QzgldK0P6MI9mVpmAd5Mev5B7zmvE7Cvs=; b=ohCVMB10Mt8J7IVOoCHR+mwayqfuqCnGDua2kT7kWBGRE023wmDsQeWbwNYy3hNSFH ZO3LTNCPwS96B60KnYBTwSzbtC5iA3/yMTHNCyE8sVAydTspxtUkbfSgjYaUG3ZYZEoY twqgVxFst6KEy2VsfWND86tn/ktc8Tut9QYp4iDZ+D7GpfpffQxBLI3deBpUFuGouKp1 Dz6ImqdaIYflfqMIqO9nf6m8V3M7YCCYfhBGeFQ1kU2kPUsswuhPiI6Ioui1pCOzjBcj dwtjQDOfl7esXalhvMRws3w6BOIlTaqC6EDEj+3JrpxryNvIv8rS867NMVkUnrUuXQc8 QoJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c9B6ZvdHB5QzgldK0P6MI9mVpmAd5Mev5B7zmvE7Cvs=; b=cBaKsGmcSHo3FxqNUDFLr0r/ScU7kRlu9h0+bpeCBM6KyzPMB7GPWi7pkf7fXWpPOe PO+cLmGfiVa6ZCxOuzzSoGzD+u01lpBPwdVsbfTdQF9PMP3DCYH99b9+52fmANFzYjLT BFFwJfhnonHT+TCqSN0FhVUmvlgnJ4hokG4OSAyJb0P42156RZQinwuQAF+A7mSxX39b ffV/6Ot9KPp0/A/T29O8ja8zf3uu6H7r1vsviRC8nK9fRSAWuJ3J9HLqDaSKN3H0au8F GCCeM0MdcgpWiKO6Sblhbtc9SFNAF8n9uHo0/iTS3Ni+K6n/xk86q9uXLtcoWbv7YRSa dobw== X-Gm-Message-State: AA+aEWbnWZHbCmdIWVEGyI9M5BQ1bacVlcm9LZebR7fhTZKkIKFGkyJC RKJw0HuJLc25b5Hth4GGP6zQUmHq5d5wiB8eW4c= X-Received: by 2002:a0c:c2ce:: with SMTP id c14mr17434788qvi.7.1543864185584; Mon, 03 Dec 2018 11:09:45 -0800 (PST) MIME-Version: 1.0 References: <20181201155229.8532-1-tiny.windzz@gmail.com> In-Reply-To: <20181201155229.8532-1-tiny.windzz@gmail.com> From: Andy Shevchenko Date: Mon, 3 Dec 2018 21:09:34 +0200 Message-ID: Subject: Re: [PATCH] platform/x86: convert to DEFINE_SHOW_ATTRIBUTE To: tiny.windzz@gmail.com Cc: Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko , David Box , Platform Driver , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 1, 2018 at 5:52 PM Yangtao Li wrote: > > Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. By some reason it's not applicable. Please, rebase on top of our for-next branch, thanks! > > Signed-off-by: Yangtao Li > --- > drivers/platform/x86/intel_pmc_core.c | 46 ++++--------------- > .../platform/x86/intel_telemetry_debugfs.c | 42 +++-------------- > 2 files changed, 14 insertions(+), 74 deletions(-) > > diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c > index 6b31d410cb09..95311ad6ec6f 100644 > --- a/drivers/platform/x86/intel_pmc_core.c > +++ b/drivers/platform/x86/intel_pmc_core.c > @@ -311,7 +311,7 @@ static void pmc_core_display_map(struct seq_file *s, int index, > pf_map[index].bit_mask & pf_reg ? "Off" : "On"); > } > > -static int pmc_core_ppfear_sts_show(struct seq_file *s, void *unused) > +static int pmc_core_ppfear_show(struct seq_file *s, void *unused) > { > struct pmc_dev *pmcdev = s->private; > const struct pmc_bit_map *map = pmcdev->map->pfear_sts; > @@ -330,17 +330,7 @@ static int pmc_core_ppfear_sts_show(struct seq_file *s, void *unused) > return 0; > } > > -static int pmc_core_ppfear_sts_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, pmc_core_ppfear_sts_show, inode->i_private); > -} > - > -static const struct file_operations pmc_core_ppfear_ops = { > - .open = pmc_core_ppfear_sts_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(pmc_core_ppfear); > > /* This function should return link status, 0 means ready */ > static int pmc_core_mtpmc_link_status(void) > @@ -372,7 +362,7 @@ static int pmc_core_send_msg(u32 *addr_xram) > return 0; > } > > -static int pmc_core_mphy_pg_sts_show(struct seq_file *s, void *unused) > +static int pmc_core_mphy_pg_show(struct seq_file *s, void *unused) > { > struct pmc_dev *pmcdev = s->private; > const struct pmc_bit_map *map = pmcdev->map->mphy_sts; > @@ -425,17 +415,7 @@ static int pmc_core_mphy_pg_sts_show(struct seq_file *s, void *unused) > return err; > } > > -static int pmc_core_mphy_pg_sts_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, pmc_core_mphy_pg_sts_show, inode->i_private); > -} > - > -static const struct file_operations pmc_core_mphy_pg_ops = { > - .open = pmc_core_mphy_pg_sts_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(pmc_core_mphy_pg); > > static int pmc_core_pll_show(struct seq_file *s, void *unused) > { > @@ -472,17 +452,7 @@ static int pmc_core_pll_show(struct seq_file *s, void *unused) > return err; > } > > -static int pmc_core_pll_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, pmc_core_pll_show, inode->i_private); > -} > - > -static const struct file_operations pmc_core_pll_ops = { > - .open = pmc_core_pll_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(pmc_core_pll); > > static ssize_t pmc_core_ltr_ignore_write(struct file *file, const char __user > *userbuf, size_t count, loff_t *ppos) > @@ -602,19 +572,19 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) > &pmc_core_dev_state); > > debugfs_create_file("pch_ip_power_gating_status", 0444, dir, pmcdev, > - &pmc_core_ppfear_ops); > + &pmc_core_ppfear_fops); > > debugfs_create_file("ltr_ignore", 0644, dir, pmcdev, > &pmc_core_ltr_ignore_ops); > > if (pmcdev->map->pll_sts) > debugfs_create_file("pll_status", 0444, dir, pmcdev, > - &pmc_core_pll_ops); > + &pmc_core_pll_fops); > > if (pmcdev->map->mphy_sts) > debugfs_create_file("mphy_core_lanes_power_gating_status", > 0444, dir, pmcdev, > - &pmc_core_mphy_pg_ops); > + &pmc_core_mphy_pg_fops); > > if (pmcdev->map->slps0_dbg_maps) { > debugfs_create_file("slp_s0_debug_status", 0444, > diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c > index 40bce560eb30..98ba9185a27b 100644 > --- a/drivers/platform/x86/intel_telemetry_debugfs.c > +++ b/drivers/platform/x86/intel_telemetry_debugfs.c > @@ -466,17 +466,7 @@ static int telem_pss_states_show(struct seq_file *s, void *unused) > return 0; > } > > -static int telem_pss_state_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, telem_pss_states_show, inode->i_private); > -} > - > -static const struct file_operations telem_pss_ops = { > - .open = telem_pss_state_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(telem_pss_states); > > static int telem_ioss_states_show(struct seq_file *s, void *unused) > { > @@ -505,17 +495,7 @@ static int telem_ioss_states_show(struct seq_file *s, void *unused) > return 0; > } > > -static int telem_ioss_state_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, telem_ioss_states_show, inode->i_private); > -} > - > -static const struct file_operations telem_ioss_ops = { > - .open = telem_ioss_state_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(telem_ioss_states); > > static int telem_soc_states_show(struct seq_file *s, void *unused) > { > @@ -664,17 +644,7 @@ static int telem_soc_states_show(struct seq_file *s, void *unused) > return 0; > } > > -static int telem_soc_state_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, telem_soc_states_show, inode->i_private); > -} > - > -static const struct file_operations telem_socstate_ops = { > - .open = telem_soc_state_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release = single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(telem_soc_states); > > static int telem_s0ix_res_get(void *data, u64 *val) > { > @@ -960,7 +930,7 @@ static int __init telemetry_debugfs_init(void) > > f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO, > debugfs_conf->telemetry_dbg_dir, NULL, > - &telem_pss_ops); > + &telem_pss_states_fops); > if (!f) { > pr_err("pss_sample_info debugfs register failed\n"); > goto out; > @@ -968,7 +938,7 @@ static int __init telemetry_debugfs_init(void) > > f = debugfs_create_file("ioss_info", S_IFREG | S_IRUGO, > debugfs_conf->telemetry_dbg_dir, NULL, > - &telem_ioss_ops); > + &telem_ioss_states_fops); > if (!f) { > pr_err("ioss_sample_info debugfs register failed\n"); > goto out; > @@ -976,7 +946,7 @@ static int __init telemetry_debugfs_init(void) > > f = debugfs_create_file("soc_states", S_IFREG | S_IRUGO, > debugfs_conf->telemetry_dbg_dir, > - NULL, &telem_socstate_ops); > + NULL, &telem_soc_states_fops); > if (!f) { > pr_err("ioss_sample_info debugfs register failed\n"); > goto out; > -- > 2.17.0 > -- With Best Regards, Andy Shevchenko