[PATCH 6/7] usb: dwc3: pci: Create header file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move dwc3_pci structure definition and some common function declarations
to their own header file so multiple source files can reference them.

Signed-off-by: Thinh Nguyen <thinhn@xxxxxxxxxxxx>
---
 drivers/usb/dwc3/dwc3-pci.h | 46 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/pci.c      | 34 +++++++--------------------------
 2 files changed, 53 insertions(+), 27 deletions(-)
 create mode 100644 drivers/usb/dwc3/dwc3-pci.h

diff --git a/drivers/usb/dwc3/dwc3-pci.h b/drivers/usb/dwc3/dwc3-pci.h
new file mode 100644
index 000000000000..55f2b0a8e5e9
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-pci.h
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+/**
+ * dwc3-pci.h - PCI Specific glue layer header
+ *
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Authors: Felipe Balbi <balbi@xxxxxx>,
+ *	    Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
+ */
+
+#ifndef __DWC3_PCI_H
+#define __DWC3_PCI_H
+
+#include <linux/pci.h>
+#include <linux/platform_device.h>
+#include <linux/acpi.h>
+
+/**
+ * struct dwc3_pci - Driver private structure
+ * @dwc3: child dwc3 platform_device
+ * @pci: our link to PCI bus
+ * @guid: _DSM GUID
+ * @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
+ * @properties: null terminated array of device properties
+ * @property_array_size: property array size
+ */
+struct dwc3_pci {
+	struct platform_device *dwc3;
+	struct pci_dev *pci;
+
+	guid_t guid;
+
+	unsigned int has_dsm_for_pm:1;
+	struct work_struct wakeup_work;
+
+	struct property_entry *properties;
+	int property_array_size;
+};
+
+int dwc3_pci_add_one_property(struct dwc3_pci *dwc,
+			      struct property_entry property);
+int dwc3_pci_add_properties(struct dwc3_pci *dwc,
+			    struct property_entry *properties);
+int dwc3_pci_add_platform_device(struct dwc3_pci *dwc);
+
+#endif /* __DWC3_PCI_H */
diff --git a/drivers/usb/dwc3/pci.c b/drivers/usb/dwc3/pci.c
index e2bc735bbcca..c67a274232a5 100644
--- a/drivers/usb/dwc3/pci.c
+++ b/drivers/usb/dwc3/pci.c
@@ -19,6 +19,8 @@
 #include <linux/acpi.h>
 #include <linux/delay.h>
 
+#include "dwc3-pci.h"
+
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3		0xabcd
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI	0xabce
 #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31	0xabcf
@@ -42,28 +44,6 @@
 
 #define PROPERTY_ARRAY_INITIAL_SIZE	32
 
-/**
- * struct dwc3_pci - Driver private structure
- * @dwc3: child dwc3 platform_device
- * @pci: our link to PCI bus
- * @guid: _DSM GUID
- * @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
- * @properties: null terminated array of device properties
- * @property_array_size: property array size
- */
-struct dwc3_pci {
-	struct platform_device *dwc3;
-	struct pci_dev *pci;
-
-	guid_t guid;
-
-	unsigned int has_dsm_for_pm:1;
-	struct work_struct wakeup_work;
-
-	struct property_entry *properties;
-	int property_array_size;
-};
-
 static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
 static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
 
@@ -80,8 +60,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = {
  *
  * Returns 0 on success otherwise negative errno.
  */
-static int dwc3_pci_add_one_property(struct dwc3_pci *dwc,
-				     struct property_entry property)
+int dwc3_pci_add_one_property(struct dwc3_pci *dwc,
+			      struct property_entry property)
 {
 	int idx = 0;
 	int count;
@@ -121,8 +101,8 @@ static int dwc3_pci_add_one_property(struct dwc3_pci *dwc,
  *
  * Returns 0 on success otherwise negative errno.
  */
-static int dwc3_pci_add_properties(struct dwc3_pci *dwc,
-				   struct property_entry *properties)
+int dwc3_pci_add_properties(struct dwc3_pci *dwc,
+			    struct property_entry *properties)
 {
 	int ret;
 	int idx;
@@ -243,7 +223,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
 	return 0;
 }
 
-static int dwc3_pci_add_platform_device(struct dwc3_pci *dwc)
+int dwc3_pci_add_platform_device(struct dwc3_pci *dwc)
 {
 	struct resource		res[2];
 	int			ret;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux