Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4578788imm; Fri, 18 May 2018 07:24:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZocBlfXv4c9putGJtMax24kUWq+oIbp4eKbq7t7cL1cmk7ANmFT561SzsswKvfP4DNi7fC+ X-Received: by 2002:a17:902:189:: with SMTP id b9-v6mr9906058plb.204.1526653490147; Fri, 18 May 2018 07:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526653490; cv=none; d=google.com; s=arc-20160816; b=czt5iNfHNrohJaHth1JWCokPCZZlS8rgby4P30wClsnj+KqeGTz2LB8EVO/yTfpwCZ 8utokX5fNU69HjcDzK+4ciZNt1fkrRxN63YupqPfsm7G+K4Jm04kY8eZK9IVmPHcm5vB aJyoN6K1P743443IFr3brYUcNS9IUNbJ4nf8qhd5874AIvqkA8VSVx8ifKH6RrN8UAL3 1BrpIc2/5UJqWMjJHJM3OjULoBA8wyECOGcKdJPM09XJu7DZGrO9+Mq9KeUQYDX/xhVU O9DygKqmc5pbvfzHk/gR23Yf4trEqnz2P78VFD7AC8XjwQ+LLAlRmPhH+54nTt3xRGuH fjbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=m/J28i46Fx0vYqokj8Ho7rHZlgUVoIUyAzsre1q0074=; b=seBjVHJjDdRbfi9R8CYUMPJ5znx6pJONSKiLeOmSbRxALfk07tQPGi1YMHdpHTckKQ mzNw6NTlVhnzK/wE51wqTEvt443k6dGAXbSyYAFyaFkRtU0hqiPTARmQSdJfgJcjZ4cF MmJ0EWNsK7r1uRNhAonnnwP1uBTPQFjI56+q2ydvEyIoZRziXejMqjXcZy7fNCkvO3Es fK8S4FTk0nl4Xag9rh6AFS09ujuoLFXiYuKCm/mOD2Fu6KtTXS+E6bgp+tMskCmaUtt4 uENwppA3npGRP6b1xU7qw8RelKCIo7WAU3t5kV/PEBnxUqMNFhto4HofyJ28dpVXqxHA YgAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i63-v6si1550510pgc.607.2018.05.18.07.24.35; Fri, 18 May 2018 07:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbeEROXF (ORCPT + 99 others); Fri, 18 May 2018 10:23:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53768 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbeEROW5 (ORCPT ); Fri, 18 May 2018 10:22:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4169C1435; Fri, 18 May 2018 07:22:57 -0700 (PDT) Received: from e107981-ln.cambridge.arm.com (e107981-ln.cambridge.arm.com [10.1.207.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 299C33F24A; Fri, 18 May 2018 07:22:56 -0700 (PDT) Date: Fri, 18 May 2018 15:22:53 +0100 From: Lorenzo Pieralisi To: Kishon Vijay Abraham I , Gustavo Pimentel Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry Message-ID: <20180518142253.GB18605@e107981-ln.cambridge.arm.com> References: <20180402132935.32008-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180402132935.32008-1-kishon@ti.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kishon, Gustavo, On Mon, Apr 02, 2018 at 06:59:35PM +0530, 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 > --- > drivers/pci/endpoint/pci-epf-core.c | 23 +++++++++++++++++++++-- > include/linux/pci-epf.h | 4 ++-- > 2 files changed, 23 insertions(+), 4 deletions(-) Do we still need this patch after the recent discussion on the configfs interface ? https://patchwork.ozlabs.org/patch/903494/ Lorenzo > 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 > #include > > +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; > }; > > -- > 2.16.2 >