From patchwork Fri Aug 18 14:57:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 110398 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935039obb; Fri, 18 Aug 2017 07:58:43 -0700 (PDT) X-Received: by 10.99.190.4 with SMTP id l4mr8812843pgf.46.1503068323511; Fri, 18 Aug 2017 07:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068323; cv=none; d=google.com; s=arc-20160816; b=vnkesoRN++TbivsoJzFAUswycYOp4f5Yg3tb7LKRRihaZeCdzyfOiVM9wlBqZF8FPD 7mrAZhzKYU1PJjcO8Qy4ToCSeMLalU+Xc3Ye5n9yHxDtnk/OzrDgNZPV7yZ7ZpRunLGF vD+H/IpmZWWZl/4q7BD8N+QNp75OqcG6bR3MPTYh6jjAX/PJTnxmL1iTfcYGLd6KbrfE jz7XsRRL2ihWptIXaZpYXtOIBQ5Fu/szc8A0ewR93BYLkek7LphjVAyzNCBMSoDXNFHr OncUx2qDVZb0VUSdqIqLkTg4ihHu2SmgAbDw/nL3sBAKzG+PZXftT9yZgLg0EOid32nR pr6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ZJGL1kutuAMLPNd2CQD2VaEU0L7BApoSNJiIz/xHj/o=; b=QvIWrQbYO6kl6gJxahC2nL+lO85csA13vEJX8xdjQVzGnGYqCn9puOrDctKm21qIHj yHNwtB+bggUXXM9QZRooTZRI4XXJjxZPCTFE0sygPismXICKSfb4HNRJPw7K0R/CU36V 2/ABvhsYeZ2MC7ZccZbTUeV4D4LfDwteX/O6BHlzCO+orJ0WfUdxF1d0W1nGkqgeTg/R CnyeQ3J+c+CoIrgynwKqKiLBUSygncQAdANkGoRkGweEbOsEiWpsSy6NoIlJFtBwe2f6 ZRaPbOGezuve/ovX1TEV4CuNChMy0dKWQn3Jc1C5aQnx+Vnca1mJHA/C+m5RgV+VMaRm 8VPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PcFUfSy7; 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 31si3996467plj.485.2017.08.18.07.58.43; Fri, 18 Aug 2017 07:58:43 -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=PcFUfSy7; 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 S1752167AbdHRO6j (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:39 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25675 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbdHRO6e (ORCPT ); Fri, 18 Aug 2017 10:58:34 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwTUS013876; Fri, 18 Aug 2017 09:58:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068309; bh=67nNEp1fVxtz3Uwu0aX6kFImDso7cNwQ2Tric0wbfuk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PcFUfSy7BLHM9bU4XfDjPBhEZZko0k3zvgowLoPqvaE0QuVUTGuoCXRVudlnzXdjy k9LZ/KNVS4nl77ml+Pfrm4mx8Ej2u0U47iyPLQzdqbvnNUBYdnP84dQAoGU8FZdYRu jo5IwRLWjmXhQI2gJzCvWmI77hi7GHoTMCga5/4Y= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwT5x002716; Fri, 18 Aug 2017 09:58:29 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:29 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:28 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:28 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwKk0023721; Fri, 18 Aug 2017 09:58:26 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 02/18] PCI: endpoint: pci-epf-core: Add an API to get matching "pci_epf_device_id" Date: Fri, 18 Aug 2017 20:27:54 +0530 Message-ID: <20170818145810.17649-3-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 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 Add an API to get "pci_epf_device_id" matching the epf name. This can be used by the epf driver to get the driver data corresponding to the epf device name. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epf-core.c | 16 ++++++++++++++++ include/linux/pci-epf.h | 2 ++ 2 files changed, 18 insertions(+) -- 2.11.0 diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 6877d6a5bcc9..60ea0c51161e 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -267,6 +267,22 @@ struct pci_epf *pci_epf_create(const char *name) } EXPORT_SYMBOL_GPL(pci_epf_create); +const struct pci_epf_device_id * +pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf) +{ + if (!id || !epf) + return NULL; + + while (id) { + if (strcmp(epf->name, id->name) == 0) + return id; + id++; + } + + return NULL; +} +EXPORT_SYMBOL_GPL(pci_epf_match_device); + static void pci_epf_dev_release(struct device *dev) { struct pci_epf *epf = to_pci_epf(dev); diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 0d529cb90143..6ed63b5e106b 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -149,6 +149,8 @@ static inline void *epf_get_drvdata(struct pci_epf *epf) return dev_get_drvdata(&epf->dev); } +const struct pci_epf_device_id * +pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf); struct pci_epf *pci_epf_create(const char *name); void pci_epf_destroy(struct pci_epf *epf); int __pci_epf_register_driver(struct pci_epf_driver *driver,