PCI/VPD: Add pci_vpd_alloc()
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 18 Aug 2021 18:59:31 +0000 (20:59 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 20 Aug 2021 20:13:20 +0000 (15:13 -0500)
commit76f3c032adad86aad26f8ad3eebc993b4ba32138
treed4ad227a456d5233f998fb2435d94f35a215e0cc
parentfe7568cf2f2dc3a0783f6ffdb3802c1ce2085466
PCI/VPD: Add pci_vpd_alloc()

Several users of the VPD API use a fixed-size buffer and read the VPD into
it for further usage. This requires special handling for the case that the
buffer isn't big enough to hold the full VPD data.  Also the buffer is
often allocated on the stack, which isn't too nice.

Add pci_vpd_alloc() to dynamically allocate buffer of the correct size and
read VPD into it.

Link: https://lore.kernel.org/r/955ff598-0021-8446-f856-0c2c077635d7@gmail.com
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/vpd.c
include/linux/pci.h