public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux•intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux•intel.com>,
	Russell Currey <ruscur@russell•cc>,
	Sam Bobroff <sbobroff@linux•ibm.com>,
	Oliver O'Halloran <oohall@gmail•com>,
	linuxppc-dev@lists•ozlabs.org,
	Bjorn Helgaas <bhelgaas@google•com>,
	linux-pci@vger•kernel.org
Subject: Re: [PATCH v1 1/2] PCI/AER: Use for_each_set_bit()
Date: Tue, 27 Aug 2019 10:06:44 -0700	[thread overview]
Message-ID: <bddfd223-fa9b-dd7c-6997-b9bc568ef2b0@linux.intel.com> (raw)
In-Reply-To: <20190827151823.75312-1-andriy.shevchenko@linux.intel.com>


On 8/27/19 8:18 AM, Andy Shevchenko wrote:
> This simplifies and standardizes slot manipulation code
> by using for_each_set_bit() library function.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux•intel.com>
Reviewed-by: Kuppuswamy Sathyanarayanan 
<sathyanarayanan.kuppuswamy@linux•intel.com>
> ---
>   drivers/pci/pcie/aer.c | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index b45bc47d04fe..f883f81d759a 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -15,6 +15,7 @@
>   #define pr_fmt(fmt) "AER: " fmt
>   #define dev_fmt pr_fmt
>   
> +#include <linux/bitops.h>
>   #include <linux/cper.h>
>   #include <linux/pci.h>
>   #include <linux/pci-acpi.h>
> @@ -657,7 +658,8 @@ const struct attribute_group aer_stats_attr_group = {
>   static void pci_dev_aer_stats_incr(struct pci_dev *pdev,
>   				   struct aer_err_info *info)
>   {
> -	int status, i, max = -1;
> +	unsigned long status = info->status & ~info->mask;
> +	int i, max = -1;
>   	u64 *counter = NULL;
>   	struct aer_stats *aer_stats = pdev->aer_stats;
>   
> @@ -682,10 +684,8 @@ static void pci_dev_aer_stats_incr(struct pci_dev *pdev,
>   		break;
>   	}
>   
> -	status = (info->status & ~info->mask);
> -	for (i = 0; i < max; i++)
> -		if (status & (1 << i))
> -			counter[i]++;
> +	for_each_set_bit(i, &status, max)
> +		counter[i]++;
>   }
>   
>   static void pci_rootport_aer_stats_incr(struct pci_dev *pdev,
> @@ -717,14 +717,11 @@ static void __print_tlp_header(struct pci_dev *dev,
>   static void __aer_print_error(struct pci_dev *dev,
>   			      struct aer_err_info *info)
>   {
> -	int i, status;
> +	unsigned long status = info->status & ~info->mask;
>   	const char *errmsg = NULL;
> -	status = (info->status & ~info->mask);
> -
> -	for (i = 0; i < 32; i++) {
> -		if (!(status & (1 << i)))
> -			continue;
> +	int i;
>   
> +	for_each_set_bit(i, &status, 32) {
>   		if (info->severity == AER_CORRECTABLE)
>   			errmsg = i < ARRAY_SIZE(aer_correctable_error_string) ?
>   				aer_correctable_error_string[i] : NULL;

-- 
Sathyanarayanan Kuppuswamy
Linux kernel developer


  parent reply	other threads:[~2019-08-29 21:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 15:18 [PATCH v1 1/2] PCI/AER: Use for_each_set_bit() Andy Shevchenko
2019-08-27 15:18 ` [PATCH v1 2/2] PCI/AER: Update parameter descriptions to satisfy kernel-doc validator Andy Shevchenko
2019-08-27 17:06   ` Kuppuswamy Sathyanarayanan
2019-08-28 10:07     ` Andy Shevchenko
2019-08-27 17:06 ` Kuppuswamy Sathyanarayanan [this message]
2019-09-27 10:44 ` [PATCH v1 1/2] PCI/AER: Use for_each_set_bit() Bjorn Helgaas
2019-09-27 12:39 ` Bjorn Helgaas
2019-09-30 12:13   ` Andy Shevchenko
2019-10-02 10:27     ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bddfd223-fa9b-dd7c-6997-b9bc568ef2b0@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux$(echo .)intel.com \
    --cc=andriy.shevchenko@linux$(echo .)intel.com \
    --cc=bhelgaas@google$(echo .)com \
    --cc=linux-pci@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=oohall@gmail$(echo .)com \
    --cc=ruscur@russell$(echo .)cc \
    --cc=sbobroff@linux$(echo .)ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox