[PATCH] shpchp - cleanup controller list
This patch changes SHPCHP driver to use list_head structure for managing controller list. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5b1a960d18
commit
a453456081
@@ -78,7 +78,7 @@ struct event_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct controller {
|
struct controller {
|
||||||
struct controller *next;
|
struct list_head ctrl_list;
|
||||||
struct mutex crit_sect; /* critical section mutex */
|
struct mutex crit_sect; /* critical section mutex */
|
||||||
struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
|
struct php_ctlr_state_s *hpc_ctlr_handle; /* HPC controller handle */
|
||||||
int num_slots; /* Number of slots on ctlr */
|
int num_slots; /* Number of slots on ctlr */
|
||||||
@@ -204,7 +204,7 @@ extern void shpchp_remove_ctrl_files(struct controller *ctrl);
|
|||||||
|
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
extern struct controller *shpchp_ctrl_list;
|
extern struct list_head shpchp_ctrl_list;
|
||||||
|
|
||||||
struct ctrl_reg {
|
struct ctrl_reg {
|
||||||
volatile u32 base_offset;
|
volatile u32 base_offset;
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
int shpchp_debug;
|
int shpchp_debug;
|
||||||
int shpchp_poll_mode;
|
int shpchp_poll_mode;
|
||||||
int shpchp_poll_time;
|
int shpchp_poll_time;
|
||||||
struct controller *shpchp_ctrl_list; /* = NULL */
|
LIST_HEAD(shpchp_ctrl_list);
|
||||||
|
|
||||||
#define DRIVER_VERSION "0.4"
|
#define DRIVER_VERSION "0.4"
|
||||||
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
|
#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
|
||||||
@@ -452,13 +452,7 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
/* Finish setting up the hot plug ctrl device */
|
/* Finish setting up the hot plug ctrl device */
|
||||||
ctrl->next_event = 0;
|
ctrl->next_event = 0;
|
||||||
|
|
||||||
if (!shpchp_ctrl_list) {
|
list_add(&ctrl->ctrl_list, &shpchp_ctrl_list);
|
||||||
shpchp_ctrl_list = ctrl;
|
|
||||||
ctrl->next = NULL;
|
|
||||||
} else {
|
|
||||||
ctrl->next = shpchp_ctrl_list;
|
|
||||||
shpchp_ctrl_list = ctrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
shpchp_create_ctrl_files(ctrl);
|
shpchp_create_ctrl_files(ctrl);
|
||||||
|
|
||||||
@@ -493,22 +487,17 @@ static int shpc_start_thread(void)
|
|||||||
|
|
||||||
static void __exit unload_shpchpd(void)
|
static void __exit unload_shpchpd(void)
|
||||||
{
|
{
|
||||||
|
struct list_head *tmp;
|
||||||
|
struct list_head *next;
|
||||||
struct controller *ctrl;
|
struct controller *ctrl;
|
||||||
struct controller *tctrl;
|
|
||||||
|
|
||||||
ctrl = shpchp_ctrl_list;
|
list_for_each_safe(tmp, next, &shpchp_ctrl_list) {
|
||||||
|
ctrl = list_entry(tmp, struct controller, ctrl_list);
|
||||||
while (ctrl) {
|
|
||||||
shpchp_remove_ctrl_files(ctrl);
|
shpchp_remove_ctrl_files(ctrl);
|
||||||
cleanup_slots(ctrl);
|
cleanup_slots(ctrl);
|
||||||
|
|
||||||
kfree (ctrl->pci_bus);
|
kfree (ctrl->pci_bus);
|
||||||
ctrl->hpc_ops->release_ctlr(ctrl);
|
ctrl->hpc_ops->release_ctlr(ctrl);
|
||||||
|
kfree(ctrl);
|
||||||
tctrl = ctrl;
|
|
||||||
ctrl = ctrl->next;
|
|
||||||
|
|
||||||
kfree(tctrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop the notification mechanism */
|
/* Stop the notification mechanism */
|
||||||
|
@@ -688,7 +688,7 @@ static int event_thread(void* data)
|
|||||||
if (pushbutton_pending)
|
if (pushbutton_pending)
|
||||||
shpchp_pushbutton_thread(pushbutton_pending);
|
shpchp_pushbutton_thread(pushbutton_pending);
|
||||||
else
|
else
|
||||||
for (ctrl = shpchp_ctrl_list; ctrl; ctrl=ctrl->next)
|
list_for_each_entry(ctrl, &shpchp_ctrl_list, ctrl_list)
|
||||||
interrupt_event_handler(ctrl);
|
interrupt_event_handler(ctrl);
|
||||||
}
|
}
|
||||||
dbg("event_thread signals exit\n");
|
dbg("event_thread signals exit\n");
|
||||||
|
Reference in New Issue
Block a user