Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4690360imm; Fri, 18 May 2018 09:04:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoF2nXKBFR9UiUwbEKl3dF6yBJNYsKjM/t9Myc3G3kjAk6QkiyMF1jACU3hcpdW9s3bt90/ X-Received: by 2002:a62:5281:: with SMTP id g123-v6mr10030512pfb.22.1526659466820; Fri, 18 May 2018 09:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526659466; cv=none; d=google.com; s=arc-20160816; b=q9qPJ8K0zIDE1WQatFPbuT+uRcU+alGn+hxd1kvtZ+i0oxl2GO3cEuxCXaIi2GRACh oPulV6oC5272zUsj7XHPc15PG3bxkP10BBF5biDdSaNkzbcNRDyTWOzbqWDXFBV/Dh6V aB4xl63iT1Mdl1sW5WV+VOOudHN0ado5wM+DQNL+rkr8+2YkWOKbyH1CcLQZq661QqzW 9L3175Av0rFaaDCTWLHMq+Ytd83NRErapGs6hBaZZeoCzTDyeSmLfe7T2O25tXkiiI/q 7fs+0rd93bWtIHgi2VleqxdzM8DXI8tFlBxmTrW1I8VRpKji9XwKItNyGW+aEbcwKaZh ptgw== 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=ljMJ755F0ZPZkIelIjkoA13XV8tZQ0CW9GfjUXRbge0=; b=VIB116OUXuFMLwMnk2yy9CsYpkq+9FJfw9fqeSYqK/QpgGCM6velKYi7YsG/Rk4Lwi BAE8e5kndwQdGWJp10fmffuw5puPj1IohvSHxg2UNputXq32cduOHX04nJVXFman3Vlu wqjMJT/XKZtq4/Gm0Yde25F2l1tvMNlXPiHwEf+/PpL6tsaODbas8BsCL8NRqi9khmHy H02Ki0ysfbjNp09bEiKhP/bKsqekmV1Qd7M7eckbuBUGiHHc0i5BlFn4PavhSgurUbuQ 7hM4d7e1hucQhj9ESujo+FhCNBIcnzhqYHeuPc/NNXiCeeP77iY5emRF6S1IWZMxzu8W lcvg== 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 m2-v6si4609584pgc.588.2018.05.18.09.04.03; Fri, 18 May 2018 09:04:26 -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 S1752475AbeERQCB (ORCPT + 99 others); Fri, 18 May 2018 12:02:01 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeERQCA (ORCPT ); Fri, 18 May 2018 12:02:00 -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 0EB5D1529; Fri, 18 May 2018 09:02:00 -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 00A973F25D; Fri, 18 May 2018 09:01:58 -0700 (PDT) Date: Fri, 18 May 2018 17:01:54 +0100 From: Lorenzo Pieralisi To: Kishon Vijay Abraham I Cc: Gustavo Pimentel , 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: <20180518160154.GA20543@e107981-ln.cambridge.arm.com> References: <20180402132935.32008-1-kishon@ti.com> <20180518142253.GB18605@e107981-ln.cambridge.arm.com> <5a4856cb-5680-586f-1826-fa2349a69328@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a4856cb-5680-586f-1826-fa2349a69328@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 On Fri, May 18, 2018 at 08:19:20PM +0530, Kishon Vijay Abraham I wrote: > Hi Lorenzo, > > On Friday 18 May 2018 07:52 PM, Lorenzo Pieralisi wrote: > > 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 ? > > Yeah, Since we allow multiple pci_epf_device_id entries to be created, I think > this patch is still valid. > > If someone wants to create a new pci_epf_device_id entry (maybe for configuring > the driver in a different way), this would be still required. Applied to pci/endpoint for v4.18, thanks. Lorenzo > Thanks > Kishon > > > > 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 > >>