Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp386369lqb; Fri, 24 May 2024 01:01:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVeQmqdvx1QIdfXU9ntm3oiAemgDosV0/xuskQAPensVtE6CEr5W5IuCJcyg0Qb74BrdJtTBJSbD9YMN0+/NMerL27fu4bSNj+qZpLfZw== X-Google-Smtp-Source: AGHT+IG8J2Get/rB3zZqE9uCyyA03KEJaezyxMrdLaiVR0X/vpRzJx9aiF8IjLD8/psRFIArMftE X-Received: by 2002:a17:903:2347:b0:1f0:9951:8491 with SMTP id d9443c01a7336-1f448246e50mr24236025ad.29.1716537670658; Fri, 24 May 2024 01:01:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716537670; cv=pass; d=google.com; s=arc-20160816; b=ixlD1lfWfJYvAeotQKQENcRiJqu0q1/tq5jJRBFFrL3OBDJdJqcb5PzsxgIH+DUuQG WgQxSxwK/MzgSG5W+yj4ml6jTtB/NzVN56Tdd/Q/8yjaGWfUVTKarcAMQPhRRNTrEeuF p9JkyjdqF9LSPOjdlG8MMKu5ereiSnyS2o4y2HIrjfacqfB5cfp2YjT7O+F4hxIs2jGU KyDlnq/Rxg2OPgHeQqeOvTiZiZ5E5J780vErUSvyTKoFSt3J9xBKkVenw865VS6TJ9t9 9enwyEKuJ0aD8QMy1ZoZ2Gk3wsVr1SFoqmj12X2G5SsZxzjbTftR/piKd+fJMyB9d1Es 6XzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=FZrk+PZb1zjWrpiyRzCIKQTjqumfXlSvNCJntRmBclk=; fh=Oi5o5eQ3KYMkvsq5hNat+qWZFHRKs9V6X3bJVCKDV1A=; b=O6DMfO90jncsgHTGH8YUSL0Jzl8w8YVMmVRY8oWQLQ/W/xwK3Z9TiUt8rCGd0ALQ63 FPLSzygwbma/7NBmqKXyls6wNJyAftk2luZsLembz8DVipPJpz5OBNzgsZJ20n8Vz/Ux eiVdSj5+yD818TxpERn6M2ddGTSV6zgmQcJ8r8by+GL9P06yVddmEboV4JB1PbLpivwa BM6T4F2A5rZp7AxWp27pDrQNID7GcybgPam1g4DEUUF2I3YhVJeIshyP4Qx27nKX+dbB zuQJv5gz4qAU0Bf/pHmL0HIvxNMBafodzeCCwsNqy12tt7cJf6ikCFY4qEvt0SGpEBde 1Hfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-188432-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188432-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c78f3cesi8871695ad.35.2024.05.24.01.01.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 01:01:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188432-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-188432-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188432-linux.lists.archive=gmail.com@vger.kernel.org" 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 8F155B21A43 for ; Fri, 24 May 2024 08:01:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 020FB128814; Fri, 24 May 2024 08:01:01 +0000 (UTC) Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (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 3811617578; Fri, 24 May 2024 08:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.242.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716537660; cv=none; b=rjcNAfFW+Jn3bRy92IOpUE2JygG+Fil91RAsU4tzMH8Vytm2x1aIRYiXA2IYvJaezQ3zD2LXj4qa2ZXkJdgBauPtLKdt71NdfMS78qLZ0RnUhvERK2Zb1zzTZXvbQO3ZypMzoi2u5qaaT+nph0hSb+EEChYJ3SD3siCduInEjdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716537660; c=relaxed/simple; bh=DNGZeOxYDqy7RtdurPwzY4rLHbt20lsCtA68JHLwjSU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LY8g2QaYI5oOyrnHFOaar4LNCtUBHP40z3fPrfuhTKYOpLaTRCHHfyQe59s245Gb8OuceWi1VnJsAzu2kMBrI0atlSt0XaB65irkaHlQkJe4Oa6/oFyCrltMN8Im4bNEw57f985eZnEmKQ2pjOgNFTDk/GC0zQAPvfp2cghQ1nQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=176.9.242.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 87F7E100FC2B8; Fri, 24 May 2024 09:53:49 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 37AB2541E49; Fri, 24 May 2024 09:53:49 +0200 (CEST) Date: Fri, 24 May 2024 09:53:49 +0200 From: Lukas Wunner To: Bitao Hu Cc: bhelgaas@google.com, weirongguang@kylinos.cn, kanie@linux.alibaba.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: pciehp: Use appropriate conditions to check the hotplug controller status Message-ID: References: <20240524063023.77148-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: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240524063023.77148-1-yaoma@linux.alibaba.com> On Fri, May 24, 2024 at 02:30:23PM +0800, Bitao Hu wrote: > 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. [...] > --- 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); We already handle the "<= 0" case immediately above this code excerpt: if (present <= 0 && link_active <= 0) { ... } So neither "present" nor "link_active" can be < 0 at this point. Hence I don't quite understand what motivates the proposed code change? Thanks, Lukas