diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2007-03-06 18:02:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-05-02 22:02:34 -0400 |
commit | 9233352628bc8e284f66fc90c4dc74473db1fbc1 (patch) | |
tree | ecf92538599c5515dbcb9f2eaddc8445cafac009 /drivers/pci | |
parent | 5d386e1ac4025b4bcc6bad6811e771cb76064dfe (diff) |
pciehp: Adapt to device driver model
This patch adapts PCIEHP driver to PCI device driver model.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 3 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 38 |
2 files changed, 6 insertions, 35 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index c98e27128cc4..74d0bf62e649 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -161,9 +161,6 @@ extern int pciehp_unconfigure_device(struct slot *p_slot); | |||
161 | extern void queue_pushbutton_work(struct work_struct *work); | 161 | extern void queue_pushbutton_work(struct work_struct *work); |
162 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); | 162 | int pcie_init(struct controller *ctrl, struct pcie_device *dev); |
163 | 163 | ||
164 | /* Global variables */ | ||
165 | extern struct controller *pciehp_ctrl_list; | ||
166 | |||
167 | static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) | 164 | static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device) |
168 | { | 165 | { |
169 | struct slot *slot; | 166 | struct slot *slot; |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 749227ecdb04..0550edf0ce25 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -42,7 +42,6 @@ int pciehp_poll_mode; | |||
42 | int pciehp_poll_time; | 42 | int pciehp_poll_time; |
43 | int pciehp_force; | 43 | int pciehp_force; |
44 | struct workqueue_struct *pciehp_wq; | 44 | struct workqueue_struct *pciehp_wq; |
45 | struct controller *pciehp_ctrl_list; | ||
46 | 45 | ||
47 | #define DRIVER_VERSION "0.4" | 46 | #define DRIVER_VERSION "0.4" |
48 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" | 47 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" |
@@ -471,14 +470,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
471 | 470 | ||
472 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | 471 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); |
473 | 472 | ||
474 | if (!pciehp_ctrl_list) { | ||
475 | pciehp_ctrl_list = ctrl; | ||
476 | ctrl->next = NULL; | ||
477 | } else { | ||
478 | ctrl->next = pciehp_ctrl_list; | ||
479 | pciehp_ctrl_list = ctrl; | ||
480 | } | ||
481 | |||
482 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 473 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
483 | if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { | 474 | if ((POWER_CTRL(ctrl->ctrlcap)) && !value) { |
484 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ | 475 | rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/ |
@@ -498,28 +489,14 @@ err_out_none: | |||
498 | return -ENODEV; | 489 | return -ENODEV; |
499 | } | 490 | } |
500 | 491 | ||
501 | static void __exit unload_pciehpd(void) | 492 | static void pciehp_remove (struct pcie_device *dev) |
502 | { | 493 | { |
503 | struct controller *ctrl; | 494 | struct pci_dev *pdev = dev->port; |
504 | struct controller *tctrl; | 495 | struct controller *ctrl = pci_get_drvdata(pdev); |
505 | |||
506 | ctrl = pciehp_ctrl_list; | ||
507 | |||
508 | while (ctrl) { | ||
509 | cleanup_slots(ctrl); | ||
510 | |||
511 | ctrl->hpc_ops->release_ctlr(ctrl); | ||
512 | |||
513 | tctrl = ctrl; | ||
514 | ctrl = ctrl->next; | ||
515 | |||
516 | kfree(tctrl); | ||
517 | } | ||
518 | } | ||
519 | 496 | ||
520 | static void pciehp_remove (struct pcie_device *device) | 497 | cleanup_slots(ctrl); |
521 | { | 498 | ctrl->hpc_ops->release_ctlr(ctrl); |
522 | /* XXX - Needs to be adapted to device driver model */ | 499 | kfree(ctrl); |
523 | } | 500 | } |
524 | 501 | ||
525 | #ifdef CONFIG_PM | 502 | #ifdef CONFIG_PM |
@@ -578,10 +555,7 @@ static int __init pcied_init(void) | |||
578 | static void __exit pcied_cleanup(void) | 555 | static void __exit pcied_cleanup(void) |
579 | { | 556 | { |
580 | dbg("unload_pciehpd()\n"); | 557 | dbg("unload_pciehpd()\n"); |
581 | unload_pciehpd(); | ||
582 | |||
583 | pcie_port_service_unregister(&hpdriver_portdrv); | 558 | pcie_port_service_unregister(&hpdriver_portdrv); |
584 | |||
585 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); | 559 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); |
586 | } | 560 | } |
587 | 561 | ||