From: Bjorn Helgaas <helgaas@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH RESEND] PCI/VPD: Remove pci_set_vpd_size
Date: Tue, 30 Mar 2021 17:07:35 -0500 [thread overview]
Message-ID: <20210330220735.GA1322162@bjorn-Precision-5520> (raw)
In-Reply-To: <47d86e52-9bcf-7da7-1edb-0d988a7a82ab@gmail.com>
On Fri, Feb 12, 2021 at 11:02:47AM +0100, Heiner Kallweit wrote:
> 24a1720a0841 ("cxgb4: collect serial config version from register")
> removed the only usage of pci_set_vpd_size(). If a device needs to
> override the auto-detected VPD size, then this can be done using a
> PCI quirk, like it's done for Chelsio devices. There's no need to
> allow drivers to change the VPD size. So let's remove
> pci_set_vpd_size().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Applied to pci/vpd for v5.13, thanks!
> ---
> - Referenced commit just landed in linux-next via the netdev tree.
> - Uups, had the list on bcc instead of cc.
> ---
> drivers/pci/vpd.c | 47 +++++++--------------------------------------
> include/linux/pci.h | 1 -
> 2 files changed, 7 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
> index 4cf0d77ca..d1cbc5e64 100644
> --- a/drivers/pci/vpd.c
> +++ b/drivers/pci/vpd.c
> @@ -16,7 +16,6 @@
> struct pci_vpd_ops {
> ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
> ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
> - int (*set_size)(struct pci_dev *dev, size_t len);
> };
>
> struct pci_vpd {
> @@ -59,19 +58,6 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
> }
> EXPORT_SYMBOL(pci_write_vpd);
>
> -/**
> - * pci_set_vpd_size - Set size of Vital Product Data space
> - * @dev: pci device struct
> - * @len: size of vpd space
> - */
> -int pci_set_vpd_size(struct pci_dev *dev, size_t len)
> -{
> - if (!dev->vpd || !dev->vpd->ops)
> - return -ENODEV;
> - return dev->vpd->ops->set_size(dev, len);
> -}
> -EXPORT_SYMBOL(pci_set_vpd_size);
> -
> #define PCI_VPD_MAX_SIZE (PCI_VPD_ADDR_MASK + 1)
>
> /**
> @@ -296,23 +282,19 @@ static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count,
> return ret ? ret : count;
> }
>
> -static int pci_vpd_set_size(struct pci_dev *dev, size_t len)
> +static void pci_vpd_set_size(struct pci_dev *dev, size_t len)
> {
> struct pci_vpd *vpd = dev->vpd;
>
> - if (len == 0 || len > PCI_VPD_MAX_SIZE)
> - return -EIO;
> -
> - vpd->valid = 1;
> - vpd->len = len;
> -
> - return 0;
> + if (vpd && len && len <= PCI_VPD_MAX_SIZE) {
> + vpd->valid = 1;
> + vpd->len = len;
> + }
> }
>
> static const struct pci_vpd_ops pci_vpd_ops = {
> .read = pci_vpd_read,
> .write = pci_vpd_write,
> - .set_size = pci_vpd_set_size,
> };
>
> static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
> @@ -345,24 +327,9 @@ static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count,
> return ret;
> }
>
> -static int pci_vpd_f0_set_size(struct pci_dev *dev, size_t len)
> -{
> - struct pci_dev *tdev = pci_get_slot(dev->bus,
> - PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
> - int ret;
> -
> - if (!tdev)
> - return -ENODEV;
> -
> - ret = pci_set_vpd_size(tdev, len);
> - pci_dev_put(tdev);
> - return ret;
> -}
> -
> static const struct pci_vpd_ops pci_vpd_f0_ops = {
> .read = pci_vpd_f0_read,
> .write = pci_vpd_f0_write,
> - .set_size = pci_vpd_f0_set_size,
> };
>
> int pci_vpd_init(struct pci_dev *dev)
> @@ -528,9 +495,9 @@ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
> * limits.
> */
> if (chip == 0x0 && prod >= 0x20)
> - pci_set_vpd_size(dev, 8192);
> + pci_vpd_set_size(dev, 8192);
> else if (chip >= 0x4 && func < 0x8)
> - pci_set_vpd_size(dev, 2048);
> + pci_vpd_set_size(dev, 2048);
> }
>
> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 86c799c97..edadc62ae 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1302,7 +1302,6 @@ void pci_unlock_rescan_remove(void);
> /* Vital Product Data routines */
> ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
> ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
> -int pci_set_vpd_size(struct pci_dev *dev, size_t len);
>
> /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
> resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
> --
> 2.30.0
>
next prev parent reply other threads:[~2021-03-30 22:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 10:02 [PATCH RESEND] PCI/VPD: Remove pci_set_vpd_size Heiner Kallweit
2021-03-30 22:07 ` Bjorn Helgaas [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-02-11 13:47 Heiner Kallweit
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=20210330220735.GA1322162@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=hkallweit1@gmail.com \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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