Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4607038imm; Fri, 18 May 2018 07:51:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpiv052OwRD6nJPzWkTYJhx5kCoJUxGCXH/9NjbPA6CiWXvXaw/f3rqJyzSr2HNAyrtJ3iN X-Received: by 2002:a17:902:7046:: with SMTP id h6-v6mr9895875plt.249.1526655087938; Fri, 18 May 2018 07:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526655087; cv=none; d=google.com; s=arc-20160816; b=lhd/3aMx7/lIcYomnwBSIxVU6EeIkWzJkVl+T76HcIRVWsK5O59SMOzH8H2gnONHx3 iTEXhsRKkticcWMMP8l6C1PSAYK9ME0sWHF3C/UKujVef/o+saKGBSCAgyYSzIk7OC5T JBd9j5pk75Vu0Z+T1ye9YL//y6ULzx1n9e3qKC86bzikl00SdghWwK1Gf5VrUKnL94sx tXy0AfhrdqQZ9IBCtwDLnZtys1O3/ALfwUt9/pO4LNQNCkGmIQTRe4E0s3rgI2z6+Iuq onU+mQdU7BGBBnr7TwIuvDpTIJfN9yTQt6f878L/4qjLTrzWI9KTnlK3N5tR+t1qeK8f JP5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=MWk4fbsY/VpF85JRwC4u7W8pm5VLfcFgte8hIXQxWUQ=; b=aZUou+38EiZWPfU+3tADmkN6ZWWvL0CKwP8p90gbMGDL4fULpGm00j2IAfA4RQYqtb oC7qPzvH/JjTM+P8D3dNcRA5OKYXRXzL4tQfPxK8O6mabgkN3qb7mwACoVLzFxOF7GBq P8NsLmmkxRKsgsPRhbIagpx6fHjNhyam+4KrjEwJ5uuALZ66wm5veTmV0GQK+braBJpf n5cqTmGxkndfGlU7z5cj61Ouef9DbAITT2eORrONWe/dLytAnDbNqIYJSgvQogus8UeR I8JExIvPgHZsX92/AJGaKj0b+m9WjQjbVyvjTaoCzBtF4w0bb8nJ7VMCbS99tyQ2Xx6u QcNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Qj3r8EG5; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21-v6si7561625plo.51.2018.05.18.07.51.13; Fri, 18 May 2018 07:51:27 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Qj3r8EG5; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbeEROtc (ORCPT + 99 others); Fri, 18 May 2018 10:49:32 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:18074 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751488AbeEROt2 (ORCPT ); Fri, 18 May 2018 10:49:28 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w4IEnNQx006386; Fri, 18 May 2018 09:49:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1526654963; bh=MWk4fbsY/VpF85JRwC4u7W8pm5VLfcFgte8hIXQxWUQ=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=Qj3r8EG5eNvAPuTW76WlG+78QFPt0GtRn2DM1qm/p8wfBUG4YvOYzUvyFMWvwRIEt cYKgdHalFky67tfPI7lx3QRE5E40rudRL/Gn1jFotmnnTPvZjdxm8Y3sGgNsi0soPx b3sHdVjLeoRiP2Ra8YipVJVuvhyvMvDUKHoGRLow= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4IEnNAt027527; Fri, 18 May 2018 09:49:23 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 18 May 2018 09:49:23 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 18 May 2018 09:49:23 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4IEnLlW017290; Fri, 18 May 2018 09:49:21 -0500 Subject: Re: [PATCH] PCI: endpoint: Create configfs entry for each pci_epf_device_id table entry To: Lorenzo Pieralisi , Gustavo Pimentel References: <20180402132935.32008-1-kishon@ti.com> <20180518142253.GB18605@e107981-ln.cambridge.arm.com> CC: Bjorn Helgaas , , From: Kishon Vijay Abraham I Message-ID: <5a4856cb-5680-586f-1826-fa2349a69328@ti.com> Date: Fri, 18 May 2018 20:19:20 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180518142253.GB18605@e107981-ln.cambridge.arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 >>