From: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
To: Kishon Vijay Abraham I <kishon@ti.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry
Date: Fri, 6 Apr 2018 16:27:48 +0100 [thread overview]
Message-ID: <29e8dcb0-32f9-a05a-4351-07845d43ee33@synopsys.com> (raw)
In-Reply-To: <20180402132935.32008-1-kishon@ti.com>
Hi Kishon,
On 02/04/2018 14:29, Kishon Vijay Abraham I wrote:
> In order to be able to provide correct driver_data for pci_epf device,
> a separate configfs entry for each pci_epf_device_id table entry in
> pci_epf_driver is required.
>
> Add support to create configfs entry for each pci_epf_device_id
> table entry here.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> drivers/pci/endpoint/pci-epf-core.c | 23 +++++++++++++++++++++--
> include/linux/pci-epf.h | 4 ++--
> 2 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
> index 59ed29e550e9..d6787f39fd41 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -15,6 +15,8 @@
> #include <linux/pci-epf.h>
> #include <linux/pci-ep-cfs.h>
>
> +static DEFINE_MUTEX(pci_epf_mutex);
> +
> static struct bus_type pci_epf_bus_type;
> static const struct device_type pci_epf_type;
>
> @@ -139,7 +141,13 @@ EXPORT_SYMBOL_GPL(pci_epf_alloc_space);
> */
> void pci_epf_unregister_driver(struct pci_epf_driver *driver)
> {
> - pci_ep_cfs_remove_epf_group(driver->group);
> + struct config_group *group;
> +
> + mutex_lock(&pci_epf_mutex);
> + list_for_each_entry(group, &driver->epf_group, group_entry)
> + pci_ep_cfs_remove_epf_group(group);
> + list_del(&driver->epf_group);
> + mutex_unlock(&pci_epf_mutex);
> driver_unregister(&driver->driver);
> }
> EXPORT_SYMBOL_GPL(pci_epf_unregister_driver);
> @@ -155,6 +163,8 @@ int __pci_epf_register_driver(struct pci_epf_driver *driver,
> struct module *owner)
> {
> int ret;
> + struct config_group *group;
> + const struct pci_epf_device_id *id;
>
> if (!driver->ops)
> return -EINVAL;
> @@ -169,7 +179,16 @@ int __pci_epf_register_driver(struct pci_epf_driver *driver,
> if (ret)
> return ret;
>
> - driver->group = pci_ep_cfs_add_epf_group(driver->driver.name);
> + INIT_LIST_HEAD(&driver->epf_group);
> +
> + id = driver->id_table;
> + while (id->name[0]) {
> + group = pci_ep_cfs_add_epf_group(id->name);
> + mutex_lock(&pci_epf_mutex);
> + list_add_tail(&group->group_entry, &driver->epf_group);
> + mutex_unlock(&pci_epf_mutex);
> + id++;
> + }
>
> return 0;
> }
> diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
> index e897bf076701..a30dcaafa6e8 100644
> --- a/include/linux/pci-epf.h
> +++ b/include/linux/pci-epf.h
> @@ -72,7 +72,7 @@ struct pci_epf_ops {
> * @driver: PCI EPF driver
> * @ops: set of function pointers for performing EPF operations
> * @owner: the owner of the module that registers the PCI EPF driver
> - * @group: configfs group corresponding to the PCI EPF driver
> + * @epf_group: list of configfs group corresponding to the PCI EPF driver
> * @id_table: identifies EPF devices for probing
> */
> struct pci_epf_driver {
> @@ -82,7 +82,7 @@ struct pci_epf_driver {
> struct device_driver driver;
> struct pci_epf_ops *ops;
> struct module *owner;
> - struct config_group *group;
> + struct list_head epf_group;
> const struct pci_epf_device_id *id_table;
> };
>
>
Works like a charm. :)
Tested-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
next prev parent reply other threads:[~2018-04-06 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 13:29 [PATCH] PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry Kishon Vijay Abraham I
2018-04-06 15:27 ` Gustavo Pimentel [this message]
2018-05-18 14:22 ` Lorenzo Pieralisi
2018-05-18 14:49 ` Kishon Vijay Abraham I
2018-05-18 16:01 ` Lorenzo Pieralisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29e8dcb0-32f9-a05a-4351-07845d43ee33@synopsys.com \
--to=gustavo.pimentel@synopsys.com \
--cc=bhelgaas@google.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).