Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2445916pxb; Sun, 24 Jan 2021 07:15:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzsI25JQbjSSq7G0RD8LeI9j9HbJr/2134RIQQZJoBNJBhaX9+fd+xdtZXXMYYlmF1JJD9g X-Received: by 2002:a50:8741:: with SMTP id 1mr86973edv.349.1611501314044; Sun, 24 Jan 2021 07:15:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611501314; cv=none; d=google.com; s=arc-20160816; b=Ia/+mcd4EajhISQb3FnPYTY4uMEPMT/P26WfQoEDytUjBCZoO+PS9RlsME7a9pqM4d BfBdTXcSf96vN/8DYp4p7SQcXd2UqxAJywTh3ugOlirLtxRGmxnBZqD7HtxGzkWlXlvW M2MnTSZZ/b77mM3npbcRGjdBGr7PRGUpa+l50bgQwtQb1kwwRm3ppbMpRYEhTNben+hU 0Amy2CITIMNl0qvmkGJgN95uX6KLHbAGWNACiuTB2iFPUFvcX+iU0cLzzryVtRzhFV5N +el6EJFurz+VVoTD+ism4vRlqdBtSC+dWa4VyhtGxD3KAKCx8kTHDzcVh9E2WciHgLSO Rvnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=fTLPTIA/sHaOdGdcqw/vJG+oZ9mxGpsJgc4NWeJrG4o=; b=WXqW6NRquygfHBAfrdgpESN/LOBix3KQKY+LOBSWu3NfyouvFNirYz5Fwil5aUET9Y fY8pa55lZM47gc3diYvUhG6trJdSPpKRMEwhVNTv+ly6aX/pRjJV9jmmsvIQhclzoldL GIXsXRSxCeNIUxidp4ZOty78QqCGZMZUJos3Q1z3GpnnIIFpnsJvg6ZOgKQVAktZbVqB /fXSt4+Xl6gw/7CSgm30/alFkxexlW3MNfeJt2BgF1OBMfL8l6YVES7DVrGwlOS/CM2H jPaHlJ6/MnvaZ//GcceOrE5fZ6vd9hrgT6rWviQUcoMJ45qSrY8VWdEaQ8YTl7K3k39F GSCA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pk20si5106668ejb.103.2021.01.24.07.14.50; Sun, 24 Jan 2021 07:15:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726507AbhAXPLe (ORCPT + 99 others); Sun, 24 Jan 2021 10:11:34 -0500 Received: from mx.socionext.com ([202.248.49.38]:26509 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbhAXPKb (ORCPT ); Sun, 24 Jan 2021 10:10:31 -0500 Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 25 Jan 2021 00:09:44 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id 7693A205902B; Mon, 25 Jan 2021 00:09:44 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Mon, 25 Jan 2021 00:09:44 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan2.css.socionext.com (Postfix) with ESMTP id DABBDB1D40; Mon, 25 Jan 2021 00:09:43 +0900 (JST) From: Kunihiko Hayashi To: Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH v2 1/3] PCI: endpoint: Add 'started' to pci_epc to set whether the controller is started Date: Mon, 25 Jan 2021 00:09:35 +0900 Message-Id: <1611500977-24816-2-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611500977-24816-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1611500977-24816-1-git-send-email-hayashi.kunihiko@socionext.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a member 'started' as a boolean value to struct pci_epc to set whether the controller is started, and also adds a function to get the value. Signed-off-by: Kunihiko Hayashi --- drivers/pci/endpoint/pci-epc-core.c | 2 ++ include/linux/pci-epc.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index cc8f9eb..2904175 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -174,6 +174,7 @@ void pci_epc_stop(struct pci_epc *epc) mutex_lock(&epc->lock); epc->ops->stop(epc); + epc->started = false; mutex_unlock(&epc->lock); } EXPORT_SYMBOL_GPL(pci_epc_stop); @@ -196,6 +197,7 @@ int pci_epc_start(struct pci_epc *epc) mutex_lock(&epc->lock); ret = epc->ops->start(epc); + epc->started = true; mutex_unlock(&epc->lock); return ret; diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index b82c9b1..5808952 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -131,6 +131,7 @@ struct pci_epc_mem { * @lock: mutex to protect pci_epc ops * @function_num_map: bitmap to manage physical function number * @notifier: used to notify EPF of any EPC events (like linkup) + * @started: true if this EPC is started */ struct pci_epc { struct device dev; @@ -145,6 +146,7 @@ struct pci_epc { struct mutex lock; unsigned long function_num_map; struct atomic_notifier_head notifier; + bool started; }; /** @@ -191,6 +193,11 @@ pci_epc_register_notifier(struct pci_epc *epc, struct notifier_block *nb) return atomic_notifier_chain_register(&epc->notifier, nb); } +static inline bool pci_epc_is_started(struct pci_epc *epc) +{ + return epc->started; +} + struct pci_epc * __devm_pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, struct module *owner); -- 2.7.4