Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2587103lqb; Tue, 28 May 2024 04:54:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVecejlvwL46lmwDVpImYIGzhzGw60Cgo6hWKXpa5Q/72Bgj5jqO/6V09QejwzyUDZEToooNRlvMxaZykPMns0QYRZ5XPwYgcfaVreLZA== X-Google-Smtp-Source: AGHT+IHsPCg9fpgG3gtkqd3bjIIUHsZj64Y3DVzHl9qm16DcsDz5BoPyXFTJPOmnhyLsHXR2WW2f X-Received: by 2002:a05:6870:b290:b0:24f:d37a:2fc0 with SMTP id 586e51a60fabf-24fd37a3067mr8421001fac.11.1716897261974; Tue, 28 May 2024 04:54:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716897261; cv=pass; d=google.com; s=arc-20160816; b=FWaWGmdk/k+XomN2y1aFNBnA0IsI18JPwgE6lfZbRvnIgHQToGp0hmpvk09vMWg1m8 u6+0fD/lDn+EKZbWF6rzSDBp4LAIFE7pqGLNp/ElQgZRPyYLOx0yG4OSrGByBZmWZcFZ Qbw2o7Jn22W5qsv2kUrVDQaimU15rngvGrbj3SQGSDUvWXwkYtbW8Lyjk3tPmIWddy0G 1ytOMlK82kjp68nK8kCgjLJuhj9EP3zuwCBhwv3RxyIJYv1YebFAjD0aor5UqIN9SW9l hg5412E56Kcgl/tcrV8Ufs48GKNXJNaeRF72GSZ97u/DqdKCHgS83fgZni8bXLx5+kEm ObKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:message-id:in-reply-to:subject:cc:to:date :from:dkim-signature; bh=NtJ+TU2WglUleV4KBW2VqbuRjxed7pFlnMJ93Zai/8g=; fh=QVMY/yLq5kJ8Ymp8gGeV5B4S/XrwbseX6VSZ5ke4Bm8=; b=tNrdsM5fYSmNlaxEHAkKV4aesutqMbWHb2AZ1Y1P/xNvVfZPJPaE/Z15fWeO8ug4Dv pCCRQNJK2KgWCQEMtesGc8SAhcN5wKBFLUcBiQIi0vTrfM8867/sKzg+TAoWTVnk8uaw QWHfqlM0N5VtjiGKUFw9wLsVU8dY28O5rSfQx/lHw10LmnUH04fUTlqJfNAVU3W5RSAf 8px44qJeu88CZ+jRLJPJvGDp4pp+cmYIkW9wbsGywHCE+hZNokYalchbD6HQpv8CBZ52 +wf2o6nBPqIcx+0NeIrhwKnVg49LFr6Ug3xLscHfMISjblUDgJSyIF/qXYGOhiZxP9AR lZCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PYEomHgR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-192139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-682274bbdafsi4915190a12.412.2024.05.28.04.54.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 04:54:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PYEomHgR; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-192139-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 040ECB26487 for ; Tue, 28 May 2024 10:54:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 761F916C844; Tue, 28 May 2024 10:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PYEomHgR" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 E31C516C455; Tue, 28 May 2024 10:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716893650; cv=none; b=PzTbpYuISXGD55SiArdUB3gx0cN/6VRXM0jGu4H6U4nFLIYSgvsvmCatBuBsi0QLb9Q323KJzBeB+w9m2q/uscTYhMGkppTXw7E5we/p6JIhK+3bJv3D/Ltn15OtlJ1XyPIOGMpdkR5qWGO/+EKG2xqcIwFHWXSNKIPXS/1kQd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716893650; c=relaxed/simple; bh=hY2IyF5VkKUnCRNoEiTmp1zbBUsXZq3aH2g9Jh6R51Q=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=tsdGaAZhQcls/+NsVpnI05QTfVwg7oVRI+UCsXK6c6/kpXG4woTU/uxFguOWYo4kzUEinGE8NVPXTMwkILOlcb2EtPnRNbzgnB+56g2ioZSZUJI6ZKEzzNmU4L9AFZ+m0ox2PqsygGgKQbzdrQfpRCQUD4am015vM5SW7K/J5DY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PYEomHgR; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716893649; x=1748429649; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version:content-id; bh=hY2IyF5VkKUnCRNoEiTmp1zbBUsXZq3aH2g9Jh6R51Q=; b=PYEomHgRHsNgh1SljttYL7HVV0yZfDQf/P0KH2mrZ6yW6RJyNvLUI0P3 EptQnq64CfcV0/dftx20yWTDVuEf4onKxNeUd+6GsGaRNK6JX83x/rgFJ QFITkZ5IdHhLg1v2tiXFUbLRGndpluRjvUjdQYAh1XGvBFVYr0lBobwhY uPFZHie0Iw8DZD2aE3tcfn4dGEcyaBScu5NfazJCi4GcORdDf3xvL0ZAj WeimUJvO5Ox9iwBhC9mzhg6O5ZcfyP3WJNL0VTetBSENnHkQyfTBGg4SW W878hYv9klLUy3PTIvVLeaj8se6YuYGbjUyR2WiUB6oP+H948dnl96Gfc w==; X-CSE-ConnectionGUID: H0x1fhldS5m+ZiKvdJ8Cww== X-CSE-MsgGUID: jzRfvlc/RieaKOgk0OG3DQ== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="13002696" X-IronPort-AV: E=Sophos;i="6.08,195,1712646000"; d="scan'208";a="13002696" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 03:54:08 -0700 X-CSE-ConnectionGUID: UNCRf7SlSyaz0Q8mmkl4CQ== X-CSE-MsgGUID: KjNuWBEBSz+0OXvc+v0qUA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,195,1712646000"; d="scan'208";a="39473828" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.144]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 03:54:05 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Tue, 28 May 2024 13:54:01 +0300 (EEST) To: Bitao Hu cc: Lukas Wunner , bhelgaas@google.com, weirongguang@kylinos.cn, linux-pci@vger.kernel.org, LKML , kanie@linux.alibaba.com Subject: Re: [PATCHv2] PCI: pciehp: Use appropriate conditions to check the hotplug controller status In-Reply-To: <20240528064200.87762-1-yaoma@linux.alibaba.com> Message-ID: References: <20240524063023.77148-1-yaoma@linux.alibaba.com> <20240528064200.87762-1-yaoma@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323328-1602990161-1716893227=:5869" Content-ID: <6bf27e0d-15c0-dfee-137d-3a1869110431@linux.intel.com> This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1602990161-1716893227=:5869 Content-Type: text/plain; CHARSET=ISO-8859-15 Content-Transfer-Encoding: QUOTED-PRINTABLE Content-ID: On Tue, 28 May 2024, Bitao Hu wrote: > "present" and "link_active" can be 1 if the status is ready, and 0 if > it is not. Both of them can be -ENODEV if reading the config space > of the hotplug port failed. That's typically the case if the hotplug > port itself was hot-removed. Therefore, this situation can occur: > pciehp_card_present() may return 1 and pciehp_check_link_active() > may return -ENODEV because the hotplug port was hot-removed in-between > the two function calls. In that case we'll emit both "Card present" > *and* "Link Up" since both 1 and -ENODEV are considered "true". This > is not the expected behavior. Those messages should be emited when > "present" and "link_active" are positive. >=20 > Signed-off-by: Bitao Hu > Reviewed-by: Lukas Wunner Thanks for updaring the description. Reviewed-by: Ilpo J=E4rvinen --=20 i. > --- > v1 -> v2: > 1. Explain the rationale of the code change in the commit message > more clearly. > 2. Add the "Reviewed-by" tag of Lukas. > --- > drivers/pci/hotplug/pciehp_ctrl.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pcie= hp_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 c= ontroller *ctrl, u32 events) > =09case OFF_STATE: > =09=09ctrl->state =3D POWERON_STATE; > =09=09mutex_unlock(&ctrl->state_lock); > -=09=09if (present) > +=09=09if (present > 0) > =09=09=09ctrl_info(ctrl, "Slot(%s): Card present\n", > =09=09=09=09 slot_name(ctrl)); > -=09=09if (link_active) > +=09=09if (link_active > 0) > =09=09=09ctrl_info(ctrl, "Slot(%s): Link Up\n", > =09=09=09=09 slot_name(ctrl)); > =09=09ctrl->request_result =3D pciehp_enable_slot(ctrl); >=20 --8323328-1602990161-1716893227=:5869--