aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2017-03-27 05:45:01 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-04-11 15:18:37 -0400
commit3a401a2ce1cb6f6e52b78f21aa82e5d90e35c430 (patch)
tree348b395dea242f37306da3a493c779fc3fd88ca8
parentbea37d3d3121d051b12541f06327d7ac63996fc0 (diff)
PCI: endpoint: Create configfs entry for EPC device and EPF driver
Invoke APIs provided by pci-ep-cfs to create configfs entry for every EPC device and EPF driver to help users in creating EPF device and binding the EPF device to the EPC device. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/endpoint/pci-epc-core.c4
-rw-r--r--drivers/pci/endpoint/pci-epf-core.c4
-rw-r--r--include/linux/pci-epc.h2
-rw-r--r--include/linux/pci-epf.h2
4 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 7c71dd94721c..caa7be10e473 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/pci-epc.h> 25#include <linux/pci-epc.h>
26#include <linux/pci-epf.h> 26#include <linux/pci-epf.h>
27#include <linux/pci-ep-cfs.h>
27 28
28static struct class *pci_epc_class; 29static struct class *pci_epc_class;
29 30
@@ -442,6 +443,7 @@ EXPORT_SYMBOL_GPL(pci_epc_linkup);
442 */ 443 */
443void pci_epc_destroy(struct pci_epc *epc) 444void pci_epc_destroy(struct pci_epc *epc)
444{ 445{
446 pci_ep_cfs_remove_epc_group(epc->group);
445 device_unregister(&epc->dev); 447 device_unregister(&epc->dev);
446 kfree(epc); 448 kfree(epc);
447} 449}
@@ -508,6 +510,8 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
508 if (ret) 510 if (ret)
509 goto put_dev; 511 goto put_dev;
510 512
513 epc->group = pci_ep_cfs_add_epc_group(dev_name(dev));
514
511 return epc; 515 return epc;
512 516
513put_dev: 517put_dev:
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index a281c599a504..6877d6a5bcc9 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/pci-epc.h> 25#include <linux/pci-epc.h>
26#include <linux/pci-epf.h> 26#include <linux/pci-epf.h>
27#include <linux/pci-ep-cfs.h>
27 28
28static struct bus_type pci_epf_bus_type; 29static struct bus_type pci_epf_bus_type;
29static struct device_type pci_epf_type; 30static struct device_type pci_epf_type;
@@ -149,6 +150,7 @@ EXPORT_SYMBOL_GPL(pci_epf_alloc_space);
149 */ 150 */
150void pci_epf_unregister_driver(struct pci_epf_driver *driver) 151void pci_epf_unregister_driver(struct pci_epf_driver *driver)
151{ 152{
153 pci_ep_cfs_remove_epf_group(driver->group);
152 driver_unregister(&driver->driver); 154 driver_unregister(&driver->driver);
153} 155}
154EXPORT_SYMBOL_GPL(pci_epf_unregister_driver); 156EXPORT_SYMBOL_GPL(pci_epf_unregister_driver);
@@ -178,6 +180,8 @@ int __pci_epf_register_driver(struct pci_epf_driver *driver,
178 if (ret) 180 if (ret)
179 return ret; 181 return ret;
180 182
183 driver->group = pci_ep_cfs_add_epf_group(driver->driver.name);
184
181 return 0; 185 return 0;
182} 186}
183EXPORT_SYMBOL_GPL(__pci_epf_register_driver); 187EXPORT_SYMBOL_GPL(__pci_epf_register_driver);
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
index 8c63d3c37f76..af5edbf3eea3 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -77,6 +77,7 @@ struct pci_epc_mem {
77 * @ops: function pointers for performing endpoint operations 77 * @ops: function pointers for performing endpoint operations
78 * @mem: address space of the endpoint controller 78 * @mem: address space of the endpoint controller
79 * @max_functions: max number of functions that can be configured in this EPC 79 * @max_functions: max number of functions that can be configured in this EPC
80 * @group: configfs group representing the PCI EPC device
80 * @lock: spinlock to protect pci_epc ops 81 * @lock: spinlock to protect pci_epc ops
81 */ 82 */
82struct pci_epc { 83struct pci_epc {
@@ -85,6 +86,7 @@ struct pci_epc {
85 const struct pci_epc_ops *ops; 86 const struct pci_epc_ops *ops;
86 struct pci_epc_mem *mem; 87 struct pci_epc_mem *mem;
87 u8 max_functions; 88 u8 max_functions;
89 struct config_group *group;
88 /* spinlock to protect against concurrent access of EP controller */ 90 /* spinlock to protect against concurrent access of EP controller */
89 spinlock_t lock; 91 spinlock_t lock;
90}; 92};
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 5628714f7bcf..0d529cb90143 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -82,6 +82,7 @@ struct pci_epf_ops {
82 * @driver: PCI EPF driver 82 * @driver: PCI EPF driver
83 * @ops: set of function pointers for performing EPF operations 83 * @ops: set of function pointers for performing EPF operations
84 * @owner: the owner of the module that registers the PCI EPF driver 84 * @owner: the owner of the module that registers the PCI EPF driver
85 * @group: configfs group corresponding to the PCI EPF driver
85 * @id_table: identifies EPF devices for probing 86 * @id_table: identifies EPF devices for probing
86 */ 87 */
87struct pci_epf_driver { 88struct pci_epf_driver {
@@ -91,6 +92,7 @@ struct pci_epf_driver {
91 struct device_driver driver; 92 struct device_driver driver;
92 struct pci_epf_ops *ops; 93 struct pci_epf_ops *ops;
93 struct module *owner; 94 struct module *owner;
95 struct config_group *group;
94 const struct pci_epf_device_id *id_table; 96 const struct pci_epf_device_id *id_table;
95}; 97};
96 98