diff mbox series

[v2] PCI: Make saved capability state private to core

Message ID 20210802221728.1469304-1-helgaas@kernel.org (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series [v2] PCI: Make saved capability state private to core | expand

Commit Message

Bjorn Helgaas Aug. 2, 2021, 10:17 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Interfaces and structs for saving and restoring PCI Capability state were
declared in include/linux/pci.h, but aren't needed outside drivers/pci/.

Move these to drivers/pci/pci.h:

  struct pci_cap_saved_data
  struct pci_cap_saved_state
  void pci_allocate_cap_save_buffers()
  void pci_free_cap_save_buffers()
  int pci_add_cap_save_buffer()
  int pci_add_ext_cap_save_buffer()
  struct pci_cap_saved_state *pci_find_saved_cap()
  struct pci_cap_saved_state *pci_find_saved_ext_cap()

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.h   | 23 +++++++++++++++++++++--
 include/linux/pci.h | 18 ------------------
 2 files changed, 21 insertions(+), 20 deletions(-)

Comments

Alex Williamson Aug. 3, 2021, 6:59 p.m. UTC | #1
On Mon,  2 Aug 2021 17:17:28 -0500
Bjorn Helgaas <helgaas@kernel.org> wrote:

> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Interfaces and structs for saving and restoring PCI Capability state were
> declared in include/linux/pci.h, but aren't needed outside drivers/pci/.
> 
> Move these to drivers/pci/pci.h:
> 
>   struct pci_cap_saved_data
>   struct pci_cap_saved_state
>   void pci_allocate_cap_save_buffers()
>   void pci_free_cap_save_buffers()
>   int pci_add_cap_save_buffer()
>   int pci_add_ext_cap_save_buffer()
>   struct pci_cap_saved_state *pci_find_saved_cap()
>   struct pci_cap_saved_state *pci_find_saved_ext_cap()
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pci/pci.h   | 23 +++++++++++++++++++++--
>  include/linux/pci.h | 18 ------------------
>  2 files changed, 21 insertions(+), 20 deletions(-)

LGTM

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Bjorn Helgaas Aug. 20, 2021, 9:28 p.m. UTC | #2
On Mon, Aug 02, 2021 at 05:17:28PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Interfaces and structs for saving and restoring PCI Capability state were
> declared in include/linux/pci.h, but aren't needed outside drivers/pci/.
> 
> Move these to drivers/pci/pci.h:
> 
>   struct pci_cap_saved_data
>   struct pci_cap_saved_state
>   void pci_allocate_cap_save_buffers()
>   void pci_free_cap_save_buffers()
>   int pci_add_cap_save_buffer()
>   int pci_add_ext_cap_save_buffer()
>   struct pci_cap_saved_state *pci_find_saved_cap()
>   struct pci_cap_saved_state *pci_find_saved_ext_cap()
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Applied with Alex's Reviewed-by to pci/misc for v5.15.

> ---
>  drivers/pci/pci.h   | 23 +++++++++++++++++++++--
>  include/linux/pci.h | 18 ------------------
>  2 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 93dcdd431072..288126062a38 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -37,6 +37,27 @@ int pci_probe_reset_function(struct pci_dev *dev);
>  int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
>  int pci_bus_error_reset(struct pci_dev *dev);
>  
> +struct pci_cap_saved_data {
> +	u16		cap_nr;
> +	bool		cap_extended;
> +	unsigned int	size;
> +	u32		data[];
> +};
> +
> +struct pci_cap_saved_state {
> +	struct hlist_node		next;
> +	struct pci_cap_saved_data	cap;
> +};
> +
> +void pci_allocate_cap_save_buffers(struct pci_dev *dev);
> +void pci_free_cap_save_buffers(struct pci_dev *dev);
> +int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size);
> +int pci_add_ext_cap_save_buffer(struct pci_dev *dev,
> +				u16 cap, unsigned int size);
> +struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
> +struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev,
> +						   u16 cap);
> +
>  #define PCI_PM_D2_DELAY         200	/* usec; see PCIe r4.0, sec 5.9.1 */
>  #define PCI_PM_D3HOT_WAIT       10	/* msec */
>  #define PCI_PM_D3COLD_WAIT      100	/* msec */
> @@ -100,8 +121,6 @@ void pci_pm_init(struct pci_dev *dev);
>  void pci_ea_init(struct pci_dev *dev);
>  void pci_msi_init(struct pci_dev *dev);
>  void pci_msix_init(struct pci_dev *dev);
> -void pci_allocate_cap_save_buffers(struct pci_dev *dev);
> -void pci_free_cap_save_buffers(struct pci_dev *dev);
>  bool pci_bridge_d3_possible(struct pci_dev *dev);
>  void pci_bridge_d3_update(struct pci_dev *dev);
>  void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 540b377ca8f6..fd35327812af 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -288,18 +288,6 @@ enum pci_bus_speed {
>  enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev);
>  enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev);
>  
> -struct pci_cap_saved_data {
> -	u16		cap_nr;
> -	bool		cap_extended;
> -	unsigned int	size;
> -	u32		data[];
> -};
> -
> -struct pci_cap_saved_state {
> -	struct hlist_node		next;
> -	struct pci_cap_saved_data	cap;
> -};
> -
>  struct irq_affinity;
>  struct pcie_link_state;
>  struct pci_vpd;
> @@ -1278,12 +1266,6 @@ int pci_load_saved_state(struct pci_dev *dev,
>  			 struct pci_saved_state *state);
>  int pci_load_and_free_saved_state(struct pci_dev *dev,
>  				  struct pci_saved_state **state);
> -struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
> -struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev,
> -						   u16 cap);
> -int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size);
> -int pci_add_ext_cap_save_buffer(struct pci_dev *dev,
> -				u16 cap, unsigned int size);
>  int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state);
>  int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
>  pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 93dcdd431072..288126062a38 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -37,6 +37,27 @@  int pci_probe_reset_function(struct pci_dev *dev);
 int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
 int pci_bus_error_reset(struct pci_dev *dev);
 
+struct pci_cap_saved_data {
+	u16		cap_nr;
+	bool		cap_extended;
+	unsigned int	size;
+	u32		data[];
+};
+
+struct pci_cap_saved_state {
+	struct hlist_node		next;
+	struct pci_cap_saved_data	cap;
+};
+
+void pci_allocate_cap_save_buffers(struct pci_dev *dev);
+void pci_free_cap_save_buffers(struct pci_dev *dev);
+int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size);
+int pci_add_ext_cap_save_buffer(struct pci_dev *dev,
+				u16 cap, unsigned int size);
+struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
+struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev,
+						   u16 cap);
+
 #define PCI_PM_D2_DELAY         200	/* usec; see PCIe r4.0, sec 5.9.1 */
 #define PCI_PM_D3HOT_WAIT       10	/* msec */
 #define PCI_PM_D3COLD_WAIT      100	/* msec */
@@ -100,8 +121,6 @@  void pci_pm_init(struct pci_dev *dev);
 void pci_ea_init(struct pci_dev *dev);
 void pci_msi_init(struct pci_dev *dev);
 void pci_msix_init(struct pci_dev *dev);
-void pci_allocate_cap_save_buffers(struct pci_dev *dev);
-void pci_free_cap_save_buffers(struct pci_dev *dev);
 bool pci_bridge_d3_possible(struct pci_dev *dev);
 void pci_bridge_d3_update(struct pci_dev *dev);
 void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 540b377ca8f6..fd35327812af 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -288,18 +288,6 @@  enum pci_bus_speed {
 enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev);
 enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev);
 
-struct pci_cap_saved_data {
-	u16		cap_nr;
-	bool		cap_extended;
-	unsigned int	size;
-	u32		data[];
-};
-
-struct pci_cap_saved_state {
-	struct hlist_node		next;
-	struct pci_cap_saved_data	cap;
-};
-
 struct irq_affinity;
 struct pcie_link_state;
 struct pci_vpd;
@@ -1278,12 +1266,6 @@  int pci_load_saved_state(struct pci_dev *dev,
 			 struct pci_saved_state *state);
 int pci_load_and_free_saved_state(struct pci_dev *dev,
 				  struct pci_saved_state **state);
-struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
-struct pci_cap_saved_state *pci_find_saved_ext_cap(struct pci_dev *dev,
-						   u16 cap);
-int pci_add_cap_save_buffer(struct pci_dev *dev, char cap, unsigned int size);
-int pci_add_ext_cap_save_buffer(struct pci_dev *dev,
-				u16 cap, unsigned int size);
 int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state);
 int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);