Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp668404pxb; Tue, 2 Feb 2021 15:00:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDfsxsy82zuI80hlAZMiXCjQTnXIGRSTBsCtBSbhOEHSU1eIi7Xz9GPxXGMFuvDblaCCtJ X-Received: by 2002:a17:906:17d3:: with SMTP id u19mr295756eje.316.1612306800993; Tue, 02 Feb 2021 15:00:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612306800; cv=none; d=google.com; s=arc-20160816; b=cmrg+HKVG8DAXmbCBYvPNQA+/VXmgGoaaF+85+Vlbh/6yhqCz9NNBxCnfM5D0320MX py3HcYXYz4LAMDo4/uBi4XNXeTkfABSHJmilrDuIRS14tlovQF10a52uMQFBY+Kh1MvV KQHD9s4N9nHdhuLclXiGG7w956jExV44bWki6oQEwdti8M8KvBq1NS/tudaV4insw113 bgaiUQml4S6Hg2BCLJH/A9zNms/LhZLJodDB+t+2Wo1algBQDOOQgiLZCotMu9nJRR2J e6onE/ngNjkEu0J1uuo3JYbr6FAZEiSdNeQkLtIjm6ZKdiqcLOMB/6jaFaWVj/NmiO+w lk9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=gQmPlOxeLLopT1mijPFfS21z1iFFBc2OA8HunAZSaz4=; b=0yc1ybxYle+wks99vD4U7eMwX0rokPo9pIdmBk62mJVS16pbJAPoDTBgZoYrR7B54m C043Hr/33p9lmmAR/AIso62TJogSzRsPaFVlL45D1m3VoQwh/P8mDczmT+sZIfkYdoa1 L2DiFDsFKEheprflNesGXSuNG9uJhnkYiSZmqbLadEtb4ZkmfqyPtLUdzRk3FPcGyE+9 wMQyTkkSwLHQuHEORhqKuyGstJJu0AwnwwRvfFBMgxx/zu6fZ5UydCE/gVMhpBNSDy6P CRyKBHUnaqXkYgK0J+2jRcWb7DqMGdStLd3mZo7OiEhv8uwuN477jEO08gnUDpIDnq/s dldA== 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 p17si94962edi.439.2021.02.02.14.59.36; Tue, 02 Feb 2021 15:00:00 -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 S236043AbhBBQR4 (ORCPT + 99 others); Tue, 2 Feb 2021 11:17:56 -0500 Received: from mx.socionext.com ([202.248.49.38]:24641 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236044AbhBBQPd (ORCPT ); Tue, 2 Feb 2021 11:15:33 -0500 Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 03 Feb 2021 01:13:27 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id EAA732059027; Wed, 3 Feb 2021 01:13:27 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 3 Feb 2021 01:13:27 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 6B16EB1D40; Wed, 3 Feb 2021 01:13:27 +0900 (JST) Received: from [10.212.20.246] (unknown [10.212.20.246]) by yuzu.css.socionext.com (Postfix) with ESMTP id C6B731202F7; Wed, 3 Feb 2021 01:13:26 +0900 (JST) Subject: Re: [PATCH v2 1/3] PCI: endpoint: Add 'started' to pci_epc to set whether the controller is started To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masami Hiramatsu , Jassi Brar References: <1611500977-24816-1-git-send-email-hayashi.kunihiko@socionext.com> <1611500977-24816-2-git-send-email-hayashi.kunihiko@socionext.com> <1253c4c9-4e5e-1456-6475-0334f3bb8634@ti.com> From: Kunihiko Hayashi Message-ID: <83a6ec4e-3f59-5084-2241-404169d50116@socionext.com> Date: Wed, 3 Feb 2021 01:13:26 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <1253c4c9-4e5e-1456-6475-0334f3bb8634@ti.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kishon, On 2021/01/28 23:11, Kishon Vijay Abraham I wrote: > Hi Kunihiko, > > On 24/01/21 8:39 pm, Kunihiko Hayashi wrote: >> 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; >> +} > > This should also be protected. Ok, I prepared this function for restart management in patch 2/3. This also needs to be reconsidered. Thank you, --- Best Regards Kunihiko Hayashi