diff mbox series

[2/5] PCI: Clean up VPD constants and functions in pci.h

Message ID 97f81466-96a8-4895-aafe-c7317c852db7@gmail.com
State New
Headers show
Series PCI/VPD: Further improvements | expand

Commit Message

Heiner Kallweit May 13, 2021, 8:55 p.m. UTC
Move some constants that are used by vpd.c only from include/linux/pci.h
to drivers/pci/vpd.c. In addition remove some unused VPD inline functions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/pci/vpd.c   |  7 +++++++
 include/linux/pci.h | 43 -------------------------------------------
 2 files changed, 7 insertions(+), 43 deletions(-)

Comments

Bjorn Helgaas July 14, 2021, 4:43 p.m. UTC | #1
On Thu, May 13, 2021 at 10:55:26PM +0200, Heiner Kallweit wrote:
> Move some constants that are used by vpd.c only from include/linux/pci.h
> to drivers/pci/vpd.c. In addition remove some unused VPD inline functions.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/pci/vpd.c   |  7 +++++++
>  include/linux/pci.h | 43 -------------------------------------------
>  2 files changed, 7 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
> index ecdce170f..ff537371c 100644
> --- a/drivers/pci/vpd.c
> +++ b/drivers/pci/vpd.c
> @@ -13,6 +13,13 @@
>  
>  /* VPD access through PCI 2.2+ VPD capability */
>  
> +/* Small Resource Data Type */
> +#define PCI_VPD_SRDT_TAG_SIZE	1
> +#define PCI_VPD_SRDT_END	(0x0f << 3) /* end tag */
> +
> +/* Large Resource Data Type */
> +#define PCI_VPD_LRDT_TIN_MASK	0x7f
> +
>  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);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index c20211e59..c21558821 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -2240,17 +2240,7 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask);
>  #define PCI_VPD_LRDT_RO_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
>  #define PCI_VPD_LRDT_RW_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
>  
> -/* Small Resource Data Type Tag Item Names */
> -#define PCI_VPD_STIN_END		0x0f	/* End */
> -
> -#define PCI_VPD_SRDT_END		(PCI_VPD_STIN_END << 3)
> -
> -#define PCI_VPD_SRDT_TIN_MASK		0x78
> -#define PCI_VPD_SRDT_LEN_MASK		0x07
> -#define PCI_VPD_LRDT_TIN_MASK		0x7f
> -
>  #define PCI_VPD_LRDT_TAG_SIZE		3
> -#define PCI_VPD_SRDT_TAG_SIZE		1
>  
>  #define PCI_VPD_INFO_FLD_HDR_SIZE	3
>  
> @@ -2271,39 +2261,6 @@ static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
>  	return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
>  }
>  
> -/**
> - * pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item
> - * @lrdt: Pointer to the beginning of the Large Resource Data Type tag
> - *
> - * Returns the extracted Large Resource Data Type Tag item.
> - */
> -static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
> -{
> -	return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK);
> -}
> -
> -/**
> - * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
> - * @srdt: Pointer to the beginning of the Small Resource Data Type tag
> - *
> - * Returns the extracted Small Resource Data Type length.
> - */
> -static inline u8 pci_vpd_srdt_size(const u8 *srdt)
> -{
> -	return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
> -}
> -
> -/**
> - * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
> - * @srdt: Pointer to the beginning of the Small Resource Data Type tag
> - *
> - * Returns the extracted Small Resource Data Type Tag Item.
> - */
> -static inline u8 pci_vpd_srdt_tag(const u8 *srdt)
> -{
> -	return ((*srdt) & PCI_VPD_SRDT_TIN_MASK) >> 3;
> -}

I think the last uses of these were removed by the previous patch.
Can you remove these definitions in the same patch that removed the
last use?  Then we don't have the unused things dangling between
patches.

>  /**
>   * pci_vpd_info_field_size - Extracts the information field length
>   * @info_field: Pointer to the beginning of an information field header
> -- 
> 2.31.1
> 
>
diff mbox series

Patch

diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index ecdce170f..ff537371c 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -13,6 +13,13 @@ 
 
 /* VPD access through PCI 2.2+ VPD capability */
 
+/* Small Resource Data Type */
+#define PCI_VPD_SRDT_TAG_SIZE	1
+#define PCI_VPD_SRDT_END	(0x0f << 3) /* end tag */
+
+/* Large Resource Data Type */
+#define PCI_VPD_LRDT_TIN_MASK	0x7f
+
 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);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c20211e59..c21558821 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2240,17 +2240,7 @@  int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask);
 #define PCI_VPD_LRDT_RO_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
 #define PCI_VPD_LRDT_RW_DATA		PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
 
-/* Small Resource Data Type Tag Item Names */
-#define PCI_VPD_STIN_END		0x0f	/* End */
-
-#define PCI_VPD_SRDT_END		(PCI_VPD_STIN_END << 3)
-
-#define PCI_VPD_SRDT_TIN_MASK		0x78
-#define PCI_VPD_SRDT_LEN_MASK		0x07
-#define PCI_VPD_LRDT_TIN_MASK		0x7f
-
 #define PCI_VPD_LRDT_TAG_SIZE		3
-#define PCI_VPD_SRDT_TAG_SIZE		1
 
 #define PCI_VPD_INFO_FLD_HDR_SIZE	3
 
@@ -2271,39 +2261,6 @@  static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
 	return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
 }
 
-/**
- * pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item
- * @lrdt: Pointer to the beginning of the Large Resource Data Type tag
- *
- * Returns the extracted Large Resource Data Type Tag item.
- */
-static inline u16 pci_vpd_lrdt_tag(const u8 *lrdt)
-{
-	return (u16)(lrdt[0] & PCI_VPD_LRDT_TIN_MASK);
-}
-
-/**
- * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
- * @srdt: Pointer to the beginning of the Small Resource Data Type tag
- *
- * Returns the extracted Small Resource Data Type length.
- */
-static inline u8 pci_vpd_srdt_size(const u8 *srdt)
-{
-	return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
-}
-
-/**
- * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
- * @srdt: Pointer to the beginning of the Small Resource Data Type tag
- *
- * Returns the extracted Small Resource Data Type Tag Item.
- */
-static inline u8 pci_vpd_srdt_tag(const u8 *srdt)
-{
-	return ((*srdt) & PCI_VPD_SRDT_TIN_MASK) >> 3;
-}
-
 /**
  * pci_vpd_info_field_size - Extracts the information field length
  * @info_field: Pointer to the beginning of an information field header