Lines Matching refs:epf
34 struct config_group *pci_epf_type_add_cfs(struct pci_epf *epf, in pci_epf_type_add_cfs() argument
39 if (!epf->driver) { in pci_epf_type_add_cfs()
40 dev_err(&epf->dev, "epf device not bound to driver\n"); in pci_epf_type_add_cfs()
44 if (!epf->driver->ops->add_cfs) in pci_epf_type_add_cfs()
47 mutex_lock(&epf->lock); in pci_epf_type_add_cfs()
48 epf_type_group = epf->driver->ops->add_cfs(epf, group); in pci_epf_type_add_cfs()
49 mutex_unlock(&epf->lock); in pci_epf_type_add_cfs()
63 void pci_epf_unbind(struct pci_epf *epf) in pci_epf_unbind() argument
67 if (!epf->driver) { in pci_epf_unbind()
68 dev_WARN(&epf->dev, "epf device not bound to driver\n"); in pci_epf_unbind()
72 mutex_lock(&epf->lock); in pci_epf_unbind()
73 list_for_each_entry(epf_vf, &epf->pci_vepf, list) { in pci_epf_unbind()
77 if (epf->is_bound) in pci_epf_unbind()
78 epf->driver->ops->unbind(epf); in pci_epf_unbind()
79 mutex_unlock(&epf->lock); in pci_epf_unbind()
80 module_put(epf->driver->owner); in pci_epf_unbind()
91 int pci_epf_bind(struct pci_epf *epf) in pci_epf_bind() argument
93 struct device *dev = &epf->dev; in pci_epf_bind()
99 if (!epf->driver) { in pci_epf_bind()
104 if (!try_module_get(epf->driver->owner)) in pci_epf_bind()
107 mutex_lock(&epf->lock); in pci_epf_bind()
108 list_for_each_entry(epf_vf, &epf->pci_vepf, list) { in pci_epf_bind()
117 epc = epf->epc; in pci_epf_bind()
118 func_no = epf->func_no; in pci_epf_bind()
134 epc = epf->sec_epc; in pci_epf_bind()
135 func_no = epf->sec_epc_func_no; in pci_epf_bind()
151 epf_vf->func_no = epf->func_no; in pci_epf_bind()
152 epf_vf->sec_epc_func_no = epf->sec_epc_func_no; in pci_epf_bind()
153 epf_vf->epc = epf->epc; in pci_epf_bind()
154 epf_vf->sec_epc = epf->sec_epc; in pci_epf_bind()
161 ret = epf->driver->ops->bind(epf); in pci_epf_bind()
164 epf->is_bound = true; in pci_epf_bind()
166 mutex_unlock(&epf->lock); in pci_epf_bind()
170 mutex_unlock(&epf->lock); in pci_epf_bind()
171 pci_epf_unbind(epf); in pci_epf_bind()
251 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar, in pci_epf_free_space() argument
262 epc = epf->epc; in pci_epf_free_space()
263 epf_bar = epf->bar; in pci_epf_free_space()
265 epc = epf->sec_epc; in pci_epf_free_space()
266 epf_bar = epf->sec_epc_bar; in pci_epf_free_space()
291 void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar, in pci_epf_alloc_space() argument
309 epc = epf->epc; in pci_epf_alloc_space()
310 epf_bar = epf->bar; in pci_epf_alloc_space()
312 epc = epf->sec_epc; in pci_epf_alloc_space()
313 epf_bar = epf->sec_epc_bar; in pci_epf_alloc_space()
426 void pci_epf_destroy(struct pci_epf *epf) in pci_epf_destroy() argument
428 device_unregister(&epf->dev); in pci_epf_destroy()
443 struct pci_epf *epf; in pci_epf_create() local
447 epf = kzalloc(sizeof(*epf), GFP_KERNEL); in pci_epf_create()
448 if (!epf) in pci_epf_create()
452 epf->name = kstrndup(name, len, GFP_KERNEL); in pci_epf_create()
453 if (!epf->name) { in pci_epf_create()
454 kfree(epf); in pci_epf_create()
459 epf->vfunction_num_map = 1; in pci_epf_create()
460 INIT_LIST_HEAD(&epf->pci_vepf); in pci_epf_create()
462 dev = &epf->dev; in pci_epf_create()
466 mutex_init(&epf->lock); in pci_epf_create()
480 return epf; in pci_epf_create()
486 struct pci_epf *epf = to_pci_epf(dev); in pci_epf_dev_release() local
488 kfree(epf->name); in pci_epf_dev_release()
489 kfree(epf); in pci_epf_dev_release()
497 pci_epf_match_id(const struct pci_epf_device_id *id, const struct pci_epf *epf) in pci_epf_match_id() argument
500 if (strcmp(epf->name, id->name) == 0) in pci_epf_match_id()
510 struct pci_epf *epf = to_pci_epf(dev); in pci_epf_device_match() local
514 return pci_epf_match_id(driver->id_table, epf); in pci_epf_device_match()
516 return !strcmp(epf->name, drv->name); in pci_epf_device_match()
521 struct pci_epf *epf = to_pci_epf(dev); in pci_epf_device_probe() local
527 epf->driver = driver; in pci_epf_device_probe()
529 return driver->probe(epf); in pci_epf_device_probe()
534 struct pci_epf *epf = to_pci_epf(dev); in pci_epf_device_remove() local
538 driver->remove(epf); in pci_epf_device_remove()
539 epf->driver = NULL; in pci_epf_device_remove()