Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: endpoint: Allow user to create sub-directory of 'EPF Device' directory

Documentation/PCI/endpoint/pci-endpoint-cfs.rst explains how a user has to
create a directory in-order to create a 'EPF Device' that can be
configured/probed by 'EPF Driver'.

Allow user to create a sub-directory of 'EPF Device' directory for any
function specific attributes that has to be exposed to the user.

Link: https://lore.kernel.org/r/20210201195809.7342-11-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Kishon Vijay Abraham I and committed by
Bjorn Helgaas
38ad827e 256ae475

+26
+23
drivers/pci/endpoint/pci-ep-cfs.c
··· 490 490 .release = pci_epf_release, 491 491 }; 492 492 493 + static struct config_group *pci_epf_type_make(struct config_group *group, 494 + const char *name) 495 + { 496 + struct pci_epf_group *epf_group = to_pci_epf_group(&group->cg_item); 497 + struct config_group *epf_type_group; 498 + 499 + epf_type_group = pci_epf_type_add_cfs(epf_group->epf, group); 500 + return epf_type_group; 501 + } 502 + 503 + static void pci_epf_type_drop(struct config_group *group, 504 + struct config_item *item) 505 + { 506 + config_item_put(item); 507 + } 508 + 509 + static struct configfs_group_operations pci_epf_type_group_ops = { 510 + .make_group = &pci_epf_type_make, 511 + .drop_item = &pci_epf_type_drop, 512 + }; 513 + 493 514 static const struct config_item_type pci_epf_type = { 515 + .ct_group_ops = &pci_epf_type_group_ops, 494 516 .ct_item_ops = &pci_epf_ops, 495 517 .ct_attrs = pci_epf_attrs, 496 518 .ct_owner = THIS_MODULE, ··· 575 553 goto free_name; 576 554 } 577 555 556 + epf->group = &epf_group->group; 578 557 epf_group->epf = epf; 579 558 580 559 kfree(epf_name);
+3
include/linux/pci-epf.h
··· 9 9 #ifndef __LINUX_PCI_EPF_H 10 10 #define __LINUX_PCI_EPF_H 11 11 12 + #include <linux/configfs.h> 12 13 #include <linux/device.h> 13 14 #include <linux/mod_devicetable.h> 14 15 #include <linux/pci.h> ··· 129 128 * EPC device 130 129 * @sec_epc_bar: represents the BAR of EPF device associated with secondary EPC 131 130 * @sec_epc_func_no: unique (physical) function number within the secondary EPC 131 + * @group: configfs group associated with the EPF device 132 132 */ 133 133 struct pci_epf { 134 134 struct device dev; ··· 152 150 struct list_head sec_epc_list; 153 151 struct pci_epf_bar sec_epc_bar[6]; 154 152 u8 sec_epc_func_no; 153 + struct config_group *group; 155 154 }; 156 155 157 156 /**