All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bitao Hu <yaoma@linux.alibaba.com>
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	[thread overview]
Message-ID: <20240524063023.77148-1-yaoma@linux.alibaba.com> (raw)

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 <yaoma@linux.alibaba.com>
---
 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)


             reply	other threads:[~2024-05-24  6:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24  6:30 Bitao Hu [this message]
2024-05-24  7:53 ` [PATCH] PCI: pciehp: Use appropriate conditions to check the hotplug controller status Lukas Wunner
2024-05-26 14:45   ` yaoma
2024-05-27  8:50     ` Lukas Wunner
2024-05-27  9:43       ` yaoma
2024-05-28  6:42 ` [PATCHv2] " Bitao Hu
2024-05-28 10:54   ` Ilpo Järvinen
2024-06-14 18:41   ` Bjorn Helgaas
2024-06-14 19:36     ` Lukas Wunner
2024-06-14 22:03       ` Bjorn Helgaas
2024-06-15 10:06         ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240524063023.77148-1-yaoma@linux.alibaba.com \
    --to=yaoma@linux.alibaba.com \
    --cc=bhelgaas@google.com \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=weirongguang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.