From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C762C4BA0B for ; Wed, 26 Feb 2020 05:52:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29F98206E2 for ; Wed, 26 Feb 2020 05:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgBZFwe (ORCPT ); Wed, 26 Feb 2020 00:52:34 -0500 Received: from mx.socionext.com ([202.248.49.38]:44988 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgBZFwe (ORCPT ); Wed, 26 Feb 2020 00:52:34 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 26 Feb 2020 14:52:32 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 3CAB8603AB; Wed, 26 Feb 2020 14:52:33 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 26 Feb 2020 14:52:33 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 8D4C81A0006; Wed, 26 Feb 2020 14:52:32 +0900 (JST) From: Kunihiko Hayashi To: Kishon Vijay Abraham I , Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH v2] PCI: endpoint: Fix clearing start entry in configfs Date: Wed, 26 Feb 2020 14:52:23 +0900 Message-Id: <1582696343-23049-1-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org After endpoint has started using configfs, if 0 is written to the entry 'start', the controller stops but the entry value remains 1. At this time, unlinking the function from the controller, WARN_ON_ONCE() in pci_epc_epf_unlink() will be triggered despite right behavior. This fixes the issue by clearing the entry when stopping the controller. Fixes: d74679911610 ("PCI: endpoint: Introduce configfs entry for configuring EP functions") Cc: Kishon Vijay Abraham I Signed-off-by: Kunihiko Hayashi Acked-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-ep-cfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index d1288a0..4fead88 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -58,6 +58,7 @@ static ssize_t pci_epc_start_store(struct config_item *item, const char *page, if (!start) { pci_epc_stop(epc); + epc_group->start = 0; return len; } -- 2.7.4