public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Ashok Raj <ashok.raj@intel.com>,
	james puthukattukaran <james.puthukattukaran@oracle.com>,
	Yinghai Lu <yinghai.lu@oracle.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH] PCI, pciehp: Reuse set_slot_off()
Date: Thu, 23 Feb 2017 22:54:35 -0800	[thread overview]
Message-ID: <20170224065435.14954-1-yinghai@kernel.org> (raw)

Now set_slot_off() is used in board_added() err path.

We could reuse in remove_board.

Also need to move green_led and attention_status out it.
and make code more readable.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/hotplug/pciehp_ctrl.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Index: linux-2.6/drivers/pci/hotplug/pciehp_ctrl.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_ctrl.c
@@ -71,9 +71,6 @@ static void set_slot_off(struct controll
 		 */
 		msleep(1000);
 	}
-
-	pciehp_green_led_off(pslot);
-	pciehp_set_attention_status(pslot, 1);
 }
 
 /**
@@ -126,6 +123,8 @@ static int board_added(struct slot *p_sl
 
 err_exit:
 	set_slot_off(ctrl, p_slot);
+	pciehp_green_led_off(p_slot);
+	pciehp_set_attention_status(p_slot, 1);
 	return retval;
 }
 
@@ -142,16 +141,7 @@ static int remove_board(struct slot *p_s
 	if (retval)
 		return retval;
 
-	if (POWER_CTRL(ctrl)) {
-		pciehp_power_off_slot(p_slot);
-
-		/*
-		 * After turning power off, we must wait for at least 1 second
-		 * before taking any action that relies on power having been
-		 * removed from the slot/adapter.
-		 */
-		msleep(1000);
-	}
+	set_slot_off(ctrl, p_slot);
 
 	/* turn off Green LED */
 	pciehp_green_led_off(p_slot);

             reply	other threads:[~2017-02-24  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24  6:54 Yinghai Lu [this message]
2017-02-24 17:17 ` [PATCH] PCI, pciehp: Reuse set_slot_off() Raj, Ashok
2017-02-24 18:39   ` Yinghai Lu

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=20170224065435.14954-1-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=ashok.raj@intel.com \
    --cc=bhelgaas@google.com \
    --cc=james.puthukattukaran@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=yinghai.lu@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox