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]
Date:   Thu, 18 Jul 2019 07:43:53 -0500
From:   Bjorn Helgaas <bhelgaas@...gle.com>
To:     Frederick Lawler <fred@...dlawl.com>
Cc:     Jens Axboe <axboe@...nel.dk>, bvanassche@....org,
        linux-block@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] skd: Prefer pcie_capability_read_word()

On Wed, Jul 17, 2019 at 9:09 PM Frederick Lawler <fred@...dlawl.com> wrote:
>
> Commit 8c0d3a02c130 ("PCI: Add accessors for PCI Express Capability")
> added accessors for the PCI Express Capability so that drivers didn't
> need to be aware of differences between v1 and v2 of the PCI
> Express Capability.
>
> Replace pci_read_config_word() and pci_write_config_word() calls with
> pcie_capability_read_word() and pcie_capability_write_word().
>
> Signed-off-by: Frederick Lawler <fred@...dlawl.com>
> ---
>  drivers/block/skd_main.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> index 7d3ad6c22ee5..996c38d03fc4 100644
> --- a/drivers/block/skd_main.c
> +++ b/drivers/block/skd_main.c
> @@ -3137,18 +3137,14 @@ MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
>
>  static char *skd_pci_info(struct skd_device *skdev, char *str)
>  {
> -       int pcie_reg;
> -
>         strcpy(str, "PCIe (");
> -       pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);
>
> -       if (pcie_reg) {
> +       if (pci_is_pcie(skdev->pdev)) {
>
>                 char lwstr[6];
>                 uint16_t pcie_lstat, lspeed, lwidth;
>
> -               pcie_reg += 0x12;
> -               pci_read_config_word(skdev->pdev, pcie_reg, &pcie_lstat);
> +               pcie_capability_read_word(skdev->pdev, 0x12, &pcie_lstat);
>                 lspeed = pcie_lstat & (0xF);
>                 lwidth = (pcie_lstat & 0x3F0) >> 4;

This should use PCI_EXP_LNKSTA, PCI_EXP_LNKSTA_CLS, PCI_EXP_LNKSTA_NLW, etc.

Would probably make sense to do that in a separate patch so this patch
matches the other conversions to pcie_capability_read_word().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ