Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp449342pxb; Wed, 11 Nov 2020 07:40:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCXhok/dvKVW8cjDjCIn2PIGyq9REHjUfkOflX6oQ0o77INRrQk9j8xDEJ6gt7cWkIHooO X-Received: by 2002:aa7:cb4c:: with SMTP id w12mr5560379edt.309.1605109215050; Wed, 11 Nov 2020 07:40:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605109215; cv=none; d=google.com; s=arc-20160816; b=V5z2Wo6Nwnn/Oll2nPVXiPAmqEhgYPZqNing2+EgCfCSoLTfE9OuZsLD/BWWZvBgTf FMrmPTYNcn9EuAnCWupl3MrRy/5wgks+/NQ3ho0HSkd+XziRxr0C88njfFxsEKMs2tCy 67jIfsIY8v/Gr83t7vx1z3TePReELSxpRzB/xmLTDNVWjqUruQDxNl7M6smosf7/vn1M nBzX7713UiAqISkDzQgYSy4L6oOtSMNIemZohbs8F5WQ2VOVg6rSVKiHhEFOD/yLbVxi YsOo/myCvriu3tYsOjPHiwlIT+D8ZYEl3vYYGkN1E4174A0Tc5RTf0GwyfrKrnI7pBW2 xvYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6+pEZ2sU4Okxi+WU1gPDCbDCdtKwOEBqEUtnhiZE5hw=; b=ckSavmJ9vYRfrAdCLop5vXYqoSjp7deQDRwGDyVX2DqzVLCNwbYVXky7k+5YhhKvWX wrIxSePHn4cSrW7y72PWosk0yPZocmvDL05kKLwYbaslRKky5wHlpFzPOgd+/EcMYLmt QnPdOV3z30q0xcDcKbXWmnrG6XCTfmeI6M6pLCrqjxlUKoJlmvIwkaThwdkkFOZ3L6rk oHYrKRrINwHh5S7d9+MhYGJzZqNxHSuNXpajOhxEGntm9+ZTIBYbK4wgmcQRkNrDjTLf zdlpsIALfccOyKR7r4AF/ZF8o2ZEZRhAAz9ZXpKcwkdmo65V9Wks8oy7xH45PX8q35Qj CQbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=uKSkeQ+t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u27si1662929edi.588.2020.11.11.07.39.52; Wed, 11 Nov 2020 07:40:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=uKSkeQ+t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727530AbgKKPhz (ORCPT + 99 others); Wed, 11 Nov 2020 10:37:55 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:59198 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726220AbgKKPhw (ORCPT ); Wed, 11 Nov 2020 10:37:52 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0ABFbdGw125202; Wed, 11 Nov 2020 09:37:39 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605109059; bh=6+pEZ2sU4Okxi+WU1gPDCbDCdtKwOEBqEUtnhiZE5hw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uKSkeQ+tcMz2voE+uDRhcCNtide1wNYyVmDTXC9vWPaMWTS+fsS9PM34DFbBeydR6 z+sxvN2RJHdzlVZBSaUXBvXUROxoKC9EC5hAPrnJeSJBS0EeWtQGHcwNM+jKXADt4h 5X4fcHIr1K10iOSJN2/8IJW8+uab4bGzg6D0vYHE= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0ABFbdNM124453 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Nov 2020 09:37:39 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 11 Nov 2020 09:37:39 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 11 Nov 2020 09:37:38 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0ABFa041042109; Wed, 11 Nov 2020 09:37:17 -0600 From: Kishon Vijay Abraham I To: Bjorn Helgaas , Jonathan Corbet , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann , Jon Mason , Dave Jiang , Allen Hubbe , Tom Joseph , Rob Herring CC: Greg Kroah-Hartman , , , , Subject: [PATCH v8 10/18] PCI: endpoint: Allow user to create sub-directory of 'EPF Device' directory Date: Wed, 11 Nov 2020 21:05:51 +0530 Message-ID: <20201111153559.19050-11-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111153559.19050-1-kishon@ti.com> References: <20201111153559.19050-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-ep-cfs.c | 23 +++++++++++++++++++++++ include/linux/pci-epf.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 8f750961d6ab..f3a8b833b479 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -490,7 +490,29 @@ static struct configfs_item_operations pci_epf_ops = { .release = pci_epf_release, }; +static struct config_group *pci_epf_type_make(struct config_group *group, + const char *name) +{ + struct pci_epf_group *epf_group = to_pci_epf_group(&group->cg_item); + struct config_group *epf_type_group; + + epf_type_group = pci_epf_type_add_cfs(epf_group->epf, group); + return epf_type_group; +} + +static void pci_epf_type_drop(struct config_group *group, + struct config_item *item) +{ + config_item_put(item); +} + +static struct configfs_group_operations pci_epf_type_group_ops = { + .make_group = &pci_epf_type_make, + .drop_item = &pci_epf_type_drop, +}; + static const struct config_item_type pci_epf_type = { + .ct_group_ops = &pci_epf_type_group_ops, .ct_item_ops = &pci_epf_ops, .ct_attrs = pci_epf_attrs, .ct_owner = THIS_MODULE, @@ -553,6 +575,7 @@ static struct config_group *pci_epf_make(struct config_group *group, goto free_name; } + epf->group = &epf_group->group; epf_group->epf = epf; kfree(epf_name); diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index b241e7dd171f..6833e2160ef1 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -9,6 +9,7 @@ #ifndef __LINUX_PCI_EPF_H #define __LINUX_PCI_EPF_H +#include #include #include #include @@ -128,6 +129,7 @@ struct pci_epf_bar { * EPC device * @sec_epc_bar: represents the BAR of EPF device associated with secondary EPC * @sec_epc_func_no: unique (physical) function number within the secondary EPC + * @group: configfs group associated with the EPF device */ struct pci_epf { struct device dev; @@ -150,6 +152,7 @@ struct pci_epf { struct list_head sec_epc_list; struct pci_epf_bar sec_epc_bar[6]; u8 sec_epc_func_no; + struct config_group *group; }; /** -- 2.17.1