lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR04MB58162980CA2A2244626C999DE74D0@BYAPR04MB5816.namprd04.prod.outlook.com>
Date:   Mon, 18 Nov 2019 01:45:51 +0000
From:   Damien Le Moal <Damien.LeMoal@....com>
To:     Frederick Lawler <fred@...dlawl.com>,
        "axboe@...nel.dk" <axboe@...nel.dk>
CC:     "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
        "bvanassche@....org" <bvanassche@....org>
Subject: Re: [PATCH v2 2/4] skd: Replace magic numbers with PCI constants

On 2019/11/18 9:21, Frederick Lawler wrote:
> Readability was improved by replacing pci_read_config_word() with
> pcie_capability_read_word(). Take that a step further by replacing magic
> numbers with PCI reg constants.
> 
> No functional change intended.
> 
> Signed-off-by: Frederick Lawler <fred@...dlawl.com>
> ---
> v2
> - Added this patch
> ---
>  drivers/block/skd_main.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> index f25f6ef6b4c7..7f8243573ad9 100644
> --- a/drivers/block/skd_main.c
> +++ b/drivers/block/skd_main.c
> @@ -3141,9 +3141,11 @@ static char *skd_pci_info(struct skd_device *skdev, char *str)
>  		char lwstr[6];
>  		uint16_t pcie_lstat, lspeed, lwidth;
>  
> -		pcie_capability_read_word(skdev->pdev, 0x12, &pcie_lstat);
> -		lspeed = pcie_lstat & (0xF);
> -		lwidth = (pcie_lstat & 0x3F0) >> 4;
> +		pcie_capability_read_word(skdev->pdev, PCI_EXP_LNKSTA,
> +					  &pcie_lstat);
> +		lspeed = pcie_lstat & PCI_EXP_LNKSTA_CLS;
> +		lwidth = (pcie_lstat & PCI_EXP_LNKSTA_NLW) >>
> +			 PCI_EXP_LNKSTA_NLW_SHIFT;
>  
>  		if (lspeed == 1)
>  			strcat(str, "2.5GT/s ");
> 

Looks OK to me. But since this is changing again one line that is added
by patch 1/4, why not make patch 1 and this patch changes a single patch ?

-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ