[PATCH 2/2] pciehp: generate udev events corrensponding to the hotplug event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds the function to pciehp that generates udev events
corresponding to the hotplug event.

Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx>

---
 drivers/pci/hotplug/pciehp.h      |    1 +
 drivers/pci/hotplug/pciehp_ctrl.c |    8 ++++++++
 2 files changed, 9 insertions(+)

Index: linux-next.29rc6/drivers/pci/hotplug/pciehp.h
===================================================================
--- linux-next.29rc6.orig/drivers/pci/hotplug/pciehp.h
+++ linux-next.29rc6/drivers/pci/hotplug/pciehp.h
@@ -36,6 +36,7 @@
 #include <linux/sched.h>		/* signal_pending() */
 #include <linux/pcieport_if.h>
 #include <linux/mutex.h>
+#include "pci_hotplug_uevent.h"

 #define MY_NAME	"pciehp"

Index: linux-next.29rc6/drivers/pci/hotplug/pciehp_ctrl.c
===================================================================
--- linux-next.29rc6.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ linux-next.29rc6/drivers/pci/hotplug/pciehp_ctrl.c
@@ -67,6 +67,7 @@ u8 pciehp_handle_attention_button(struct
 	 *  Button pressed - See if need to TAKE ACTION!!!
 	 */
 	ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot));
+	pcihp_slot_uevent(PHP_UEVT_BUTTON_PRESS, p_slot->hotplug_slot);
 	event_type = INT_BUTTON_PRESS;

 	queue_interrupt_event(p_slot, event_type);
@@ -89,12 +90,14 @@ u8 pciehp_handle_switch_change(struct sl
 		 * Switch opened
 		 */
 		ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_SWITCH_OPEN, p_slot->hotplug_slot);
 		event_type = INT_SWITCH_OPEN;
 	} else {
 		/*
 		 *  Switch closed
 		 */
 		ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_SWITCH_CLOSE, p_slot->hotplug_slot);
 		event_type = INT_SWITCH_CLOSE;
 	}

@@ -121,6 +124,7 @@ u8 pciehp_handle_presence_change(struct
 		 * Card Present
 		 */
 		ctrl_info(ctrl, "Card present on Slot(%s)\n", slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_PRESENCE_ON, p_slot->hotplug_slot);
 		event_type = INT_PRESENCE_ON;
 	} else {
 		/*
@@ -128,6 +132,7 @@ u8 pciehp_handle_presence_change(struct
 		 */
 		ctrl_info(ctrl, "Card not present on Slot(%s)\n",
 			  slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_PRESENCE_OFF, p_slot->hotplug_slot);
 		event_type = INT_PRESENCE_OFF;
 	}

@@ -150,12 +155,15 @@ u8 pciehp_handle_power_fault(struct slot
 		 */
 		ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n",
 			  slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_POWER_FAULT_CLEAR,
+				  p_slot->hotplug_slot);
 		event_type = INT_POWER_FAULT_CLEAR;
 	} else {
 		/*
 		 *   power fault
 		 */
 		ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot));
+		pcihp_slot_uevent(PHP_UEVT_POWER_FAULT, p_slot->hotplug_slot);
 		event_type = INT_POWER_FAULT;
 		ctrl_info(ctrl, "Power fault bit %x set\n", 0);
 	}


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux