netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] PCI/VPD: Final extensions and cleanups
@ 2021-08-26 18:52 Heiner Kallweit
  2021-08-26 18:56 ` [PATCH 5/7] cxgb4: Use pci_vpd_find_id_string() to find VPD id string Heiner Kallweit
  2021-09-02 15:30 ` [PATCH 0/7] PCI/VPD: Final extensions and cleanups Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-08-26 18:52 UTC (permalink / raw)
  To: Raju Rangoju, Bjorn Helgaas, Jakub Kicinski, David Miller
  Cc: linux-pci, netdev

This series finalizes the VPD extensions and cleanups.
It should be applied via the PCI tree.

Heiner Kallweit (7):
  PCI/VPD: Stop exporting pci_vpd_find_tag()
  PCI/VPD: Stop exporting pci_vpd_find_info_keyword()
  PCI/VPD: Include post-processing in pci_vpd_find_tag()
  PCI/VPD: Add pci_vpd_find_id_string()
  cxgb4: Use pci_vpd_find_id_string() to find VPD id string
  PCI/VPD: Clean up public VPD defines and inline functions
  PCI/VPD: Use unaligned access helpers

 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 13 ++-
 drivers/pci/vpd.c                          | 71 +++++++++++-----
 include/linux/pci.h                        | 95 ++--------------------
 3 files changed, 61 insertions(+), 118 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 5/7] cxgb4: Use pci_vpd_find_id_string() to find VPD id string
  2021-08-26 18:52 [PATCH 0/7] PCI/VPD: Final extensions and cleanups Heiner Kallweit
@ 2021-08-26 18:56 ` Heiner Kallweit
  2021-09-02 15:30 ` [PATCH 0/7] PCI/VPD: Final extensions and cleanups Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2021-08-26 18:56 UTC (permalink / raw)
  To: Raju Rangoju, Bjorn Helgaas, Jakub Kicinski, David Miller
  Cc: linux-pci, netdev

Use new VPD API function pci_vpd_find_id_string() for finding the VPD
id string. This simplifies the code and avoids using VPD low-level
function pci_vpd_lrdt_size().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 5e8ac42ac..64144b617 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -2744,7 +2744,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable)
 int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
 {
 	unsigned int id_len, pn_len, sn_len, na_len;
-	int sn, pn, na, addr, ret = 0;
+	int id, sn, pn, na, addr, ret = 0;
 	u8 *vpd, base_val = 0;
 
 	vpd = vmalloc(VPD_LEN);
@@ -2764,13 +2764,10 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
 	if (ret < 0)
 		goto out;
 
-	if (vpd[0] != PCI_VPD_LRDT_ID_STRING) {
-		dev_err(adapter->pdev_dev, "missing VPD ID string\n");
-		ret = -EINVAL;
+	ret = pci_vpd_find_id_string(vpd, VPD_LEN, &id_len);
+	if (ret < 0)
 		goto out;
-	}
-
-	id_len = pci_vpd_lrdt_size(vpd);
+	id = ret;
 
 	ret = pci_vpd_check_csum(vpd, VPD_LEN);
 	if (ret) {
@@ -2796,7 +2793,7 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
 		goto out;
 	na = ret;
 
-	memcpy(p->id, vpd + PCI_VPD_LRDT_TAG_SIZE, min_t(int, id_len, ID_LEN));
+	memcpy(p->id, vpd + id, min_t(int, id_len, ID_LEN));
 	strim(p->id);
 	memcpy(p->sn, vpd + sn, min_t(int, sn_len, SERNUM_LEN));
 	strim(p->sn);
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/7] PCI/VPD: Final extensions and cleanups
  2021-08-26 18:52 [PATCH 0/7] PCI/VPD: Final extensions and cleanups Heiner Kallweit
  2021-08-26 18:56 ` [PATCH 5/7] cxgb4: Use pci_vpd_find_id_string() to find VPD id string Heiner Kallweit
@ 2021-09-02 15:30 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2021-09-02 15:30 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Raju Rangoju, Bjorn Helgaas, Jakub Kicinski, David Miller,
	linux-pci, netdev

On Thu, Aug 26, 2021 at 08:52:32PM +0200, Heiner Kallweit wrote:
> This series finalizes the VPD extensions and cleanups.
> It should be applied via the PCI tree.
> 
> Heiner Kallweit (7):
>   PCI/VPD: Stop exporting pci_vpd_find_tag()
>   PCI/VPD: Stop exporting pci_vpd_find_info_keyword()
>   PCI/VPD: Include post-processing in pci_vpd_find_tag()
>   PCI/VPD: Add pci_vpd_find_id_string()
>   cxgb4: Use pci_vpd_find_id_string() to find VPD id string
>   PCI/VPD: Clean up public VPD defines and inline functions
>   PCI/VPD: Use unaligned access helpers
> 
>  drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 13 ++-
>  drivers/pci/vpd.c                          | 71 +++++++++++-----
>  include/linux/pci.h                        | 95 ++--------------------
>  3 files changed, 61 insertions(+), 118 deletions(-)

Applied to pci/vpd for v5.15, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-02 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 18:52 [PATCH 0/7] PCI/VPD: Final extensions and cleanups Heiner Kallweit
2021-08-26 18:56 ` [PATCH 5/7] cxgb4: Use pci_vpd_find_id_string() to find VPD id string Heiner Kallweit
2021-09-02 15:30 ` [PATCH 0/7] PCI/VPD: Final extensions and cleanups Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).