Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp354163lqb; Thu, 23 May 2024 23:30:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBgyGF3ofZgLfngeK68HHH9552J7SHwzF5/JZTT3jJvVM6iaTs7/kuOx0hJ9OqHYHgQsCEhQ2XhifA9KkGiwlwyHpmS/OUd5I5ccqM4g== X-Google-Smtp-Source: AGHT+IEl33EAQdzVKBW7/8cPAcVkxlGFyUMHTJ9bn12KPdcY9gu4uCZLs0OmI8L6ozExNzakJTnV X-Received: by 2002:a05:6512:3096:b0:523:87b6:2ac2 with SMTP id 2adb3069b0e04-52965199527mr796184e87.40.1716532242075; Thu, 23 May 2024 23:30:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716532242; cv=pass; d=google.com; s=arc-20160816; b=niCiXHvQEJgzoThddLi7srNl0DLL8bRaPeHg1GP/v17TvSbz1DFl2Cvqji8Mizii5P /OXCs1hkb7pk2K/OGF4fJML6fzaCAPwZehiEwxbXm2xKypRpMIux3QqYpuEj1av83YOn ad2DQ6iLBj45ww5Su0A+9E+/6tv80EOGPA2vvMFAEjSZJ8R4FdNgpvyyMAhY9bbziAyJ OepTqid5FyQeh5jlI0zuTZkbDXOPSBUDVvaF4mMg8QSspPAefkXSugLu0vYaxc63L3gv pWFLCVXrsrlNhyXSHsyzw8rkoXSv4TWnAE0MYkIVA5OaEKVQwNXuQRaJ874zWjUtBAKC vUUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=aWmDooCH+504yrVciyeVZogdYg0a3sQ6PlOGFpfiMIU=; fh=eFgy7RYSouGDxuO3/yeOk6dGpqiHmiHLie896YuPFcM=; b=fc2zJbp8gsk2hvOwPQEIx44cE5Qh5Em/Gbp8UElXiPa+Hl1nnw+FMMUfMCk54gYrEG 4+aSFrcUMiBhSLtcO/nzrCMTvHvfSYR6OWgLcYT2/XGApsVinGYGNJRTBLdcP/u++HZo J0Kr5/Y1xSt223p+Hqoz+IWw5nTm8kPu1Bo/teIQ8WOha9oOY6/hficnJMlKHX0XLyb1 VDSpUA0p8jnYf11Jcr8/oUIQQAdHvhWNEW6mpNCI4BuH7E3pJG6xf69XDsCMhJwyb3RX 8LvM30r3XoIQZxNe41VltWkLQf1v8DG2UPW4RskVMzh+3tjWBOqBSF2cxvHmbxKBHi5o PVKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=bRfeisR0; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-188357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785f8a6175si90928a12.189.2024.05.23.23.30.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 23:30:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=bRfeisR0; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-188357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BCEC71F21EA9 for ; Fri, 24 May 2024 06:30:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2EAC128376; Fri, 24 May 2024 06:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="bRfeisR0" Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FC5D381DF; Fri, 24 May 2024 06:30:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716532233; cv=none; b=HTUFj88n34FDxpDmBH8t3GWFfUmxzwhvJKwIda0ZMg8grBC+x/b0e/zc3gYSPb9ZcjONY8QZLzEF5JUZL9uPm6PJwvek5lRWR+tfr7iCQhey/mujSTv0UCgfjM7OgaJTe4X59Q1WJFUo7GSSJvSS7u9to3bhv0T2USWDpTO+FKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716532233; c=relaxed/simple; bh=3UoxeqbBMKbmjTS7oVcj+8a9bJ9zUGrCAQeT0hunQAY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hdS7KBukfnsd6chzKaRTL4+0xFHuNTo7Dd8skcMF31S5VGYZe5NvYkKRa+yq6U+Y39nz4ikp7WW2Xi2mu/GMCVCj4A8ukUQxswBaTrRf8iBX1xVzLGfR8p8J6LA74RZUR1hAeeaRp7hSL3b9dbFXZBYQHipjJQIJrnTOwylk5Y4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=bRfeisR0; arc=none smtp.client-ip=115.124.30.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716532227; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=aWmDooCH+504yrVciyeVZogdYg0a3sQ6PlOGFpfiMIU=; b=bRfeisR0W0UtOIqWbNFPjJnhB6HIsiZdsA/RM4BNKenHZMmLMisBbbYkriQIdPQEzJ/aWsWfbGz93wHi1MisJs2loZ8cbvssS/hJYsIfYxFt8Ix6L67RRcEC/605jghWlxRXmfKGQPEl03VUD5vjW3LzSL/EXo2j9C9001iPh7s= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067110;MF=yaoma@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0W757k.t_1716532225; Received: from localhost.localdomain(mailfrom:yaoma@linux.alibaba.com fp:SMTPD_---0W757k.t_1716532225) by smtp.aliyun-inc.com; Fri, 24 May 2024 14:30:27 +0800 From: Bitao Hu To: bhelgaas@google.com, lukas@wunner.de, weirongguang@kylinos.cn Cc: yaoma@linux.alibaba.com, kanie@linux.alibaba.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: pciehp: Use appropriate conditions to check the hotplug controller status Date: Fri, 24 May 2024 14:30:23 +0800 Message-Id: <20240524063023.77148-1-yaoma@linux.alibaba.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The values of 'present' and 'link_active' have similar meanings: the value is %1 if the status is ready, and %0 if it is not. If the hotplug controller itself is not available, the value should be %-ENODEV. However, both %1 and %-ENODEV are considered true, which obviously does not meet expectations. 'Slot(xx): Card present' and 'Slot(xx): Link Up' should only be output when the value is %1. Signed-off-by: Bitao Hu --- drivers/pci/hotplug/pciehp_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index dcdbfcf404dd..6adfdbb70150 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -276,10 +276,10 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events) case OFF_STATE: ctrl->state = POWERON_STATE; mutex_unlock(&ctrl->state_lock); - if (present) + if (present > 0) ctrl_info(ctrl, "Slot(%s): Card present\n", slot_name(ctrl)); - if (link_active) + if (link_active > 0) ctrl_info(ctrl, "Slot(%s): Link Up\n", slot_name(ctrl)); ctrl->request_result = pciehp_enable_slot(ctrl); -- 2.37.1 (Apple Git-137.1)