diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2006-02-21 18:45:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-23 17:35:13 -0500 |
commit | e6b82b13c4066ca091a4919620d6403c8a269bc3 (patch) | |
tree | c32a3dd79081f9633c81d9c58780c7220118621b | |
parent | a246fa4e9f0f1b5096a1cad0659d22fb10fb3732 (diff) |
[PATCH] shpchp: adapt to pci driver model
This patch adapts SHPCHP driver to the 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>
-rw-r--r-- | drivers/pci/hotplug/shpchp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/shpchp_core.c | 26 |
2 files changed, 7 insertions, 23 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index dd449512cf68..f10f1ba877af 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -82,7 +82,6 @@ struct event_info { | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | struct controller { | 84 | struct controller { |
85 | struct list_head ctrl_list; | ||
86 | struct mutex crit_sect; /* critical section mutex */ | 85 | struct mutex crit_sect; /* critical section mutex */ |
87 | struct mutex cmd_lock; /* command lock */ | 86 | struct mutex cmd_lock; /* command lock */ |
88 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ | 87 | struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */ |
@@ -203,9 +202,6 @@ extern void shpchp_remove_ctrl_files(struct controller *ctrl); | |||
203 | extern void cleanup_slots(struct controller *ctrl); | 202 | extern void cleanup_slots(struct controller *ctrl); |
204 | extern void queue_pushbutton_work(void *data); | 203 | extern void queue_pushbutton_work(void *data); |
205 | 204 | ||
206 | /* Global variables */ | ||
207 | extern struct list_head shpchp_ctrl_list; | ||
208 | |||
209 | struct ctrl_reg { | 205 | struct ctrl_reg { |
210 | volatile u32 base_offset; | 206 | volatile u32 base_offset; |
211 | volatile u32 slot_avail1; | 207 | volatile u32 slot_avail1; |
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index fa60ae47d91d..0e83c5fbc9df 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -39,7 +39,6 @@ | |||
39 | int shpchp_debug; | 39 | int shpchp_debug; |
40 | int shpchp_poll_mode; | 40 | int shpchp_poll_mode; |
41 | int shpchp_poll_time; | 41 | int shpchp_poll_time; |
42 | LIST_HEAD(shpchp_ctrl_list); | ||
43 | struct workqueue_struct *shpchp_wq; | 42 | struct workqueue_struct *shpchp_wq; |
44 | 43 | ||
45 | #define DRIVER_VERSION "0.4" | 44 | #define DRIVER_VERSION "0.4" |
@@ -433,8 +432,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
433 | ctrl->speed = PCI_SPEED_33MHz; | 432 | ctrl->speed = PCI_SPEED_33MHz; |
434 | } | 433 | } |
435 | 434 | ||
436 | list_add(&ctrl->ctrl_list, &shpchp_ctrl_list); | ||
437 | |||
438 | shpchp_create_ctrl_files(ctrl); | 435 | shpchp_create_ctrl_files(ctrl); |
439 | 436 | ||
440 | return 0; | 437 | return 0; |
@@ -447,20 +444,13 @@ err_out_none: | |||
447 | return -ENODEV; | 444 | return -ENODEV; |
448 | } | 445 | } |
449 | 446 | ||
450 | static void __exit unload_shpchpd(void) | 447 | static void shpc_remove(struct pci_dev *dev) |
451 | { | 448 | { |
452 | struct list_head *tmp; | 449 | struct controller *ctrl = pci_get_drvdata(dev); |
453 | struct list_head *next; | ||
454 | struct controller *ctrl; | ||
455 | |||
456 | list_for_each_safe(tmp, next, &shpchp_ctrl_list) { | ||
457 | ctrl = list_entry(tmp, struct controller, ctrl_list); | ||
458 | shpchp_remove_ctrl_files(ctrl); | ||
459 | ctrl->hpc_ops->release_ctlr(ctrl); | ||
460 | kfree(ctrl); | ||
461 | } | ||
462 | 450 | ||
463 | destroy_workqueue(shpchp_wq); | 451 | shpchp_remove_ctrl_files(ctrl); |
452 | ctrl->hpc_ops->release_ctlr(ctrl); | ||
453 | kfree(ctrl); | ||
464 | } | 454 | } |
465 | 455 | ||
466 | static struct pci_device_id shpcd_pci_tbl[] = { | 456 | static struct pci_device_id shpcd_pci_tbl[] = { |
@@ -473,7 +463,7 @@ static struct pci_driver shpc_driver = { | |||
473 | .name = SHPC_MODULE_NAME, | 463 | .name = SHPC_MODULE_NAME, |
474 | .id_table = shpcd_pci_tbl, | 464 | .id_table = shpcd_pci_tbl, |
475 | .probe = shpc_probe, | 465 | .probe = shpc_probe, |
476 | /* remove: shpc_remove_one, */ | 466 | .remove = shpc_remove, |
477 | }; | 467 | }; |
478 | 468 | ||
479 | static int __init shpcd_init(void) | 469 | static int __init shpcd_init(void) |
@@ -500,10 +490,8 @@ static int __init shpcd_init(void) | |||
500 | static void __exit shpcd_cleanup(void) | 490 | static void __exit shpcd_cleanup(void) |
501 | { | 491 | { |
502 | dbg("unload_shpchpd()\n"); | 492 | dbg("unload_shpchpd()\n"); |
503 | unload_shpchpd(); | ||
504 | |||
505 | pci_unregister_driver(&shpc_driver); | 493 | pci_unregister_driver(&shpc_driver); |
506 | 494 | destroy_workqueue(shpchp_wq); | |
507 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); | 495 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); |
508 | } | 496 | } |
509 | 497 | ||