Commit 48fe3915 authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Greg Kroah-Hartman

pciehp: remove unnecessary php_ctlr

The struct php_ctlr seems to be only for complicating codes. This
patch removes struct php_ctlr and related codes.
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarKristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2410fa4e
...@@ -70,30 +70,11 @@ struct event_info { ...@@ -70,30 +70,11 @@ struct event_info {
u8 hp_slot; u8 hp_slot;
}; };
typedef u8(*php_intr_callback_t) (u8 hp_slot, void *instance_id);
struct php_ctlr_state_s {
struct php_ctlr_state_s *pnext;
struct pci_dev *pci_dev;
unsigned int irq;
unsigned long flags; /* spinlock's */
u32 slot_device_offset;
u32 num_slots;
struct timer_list int_poll_timer; /* Added for poll event */
php_intr_callback_t attention_button_callback;
php_intr_callback_t switch_change_callback;
php_intr_callback_t presence_change_callback;
php_intr_callback_t power_fault_callback;
void *callback_instance_id;
struct ctrl_reg *creg; /* Ptr to controller register space */
};
#define MAX_EVENTS 10 #define MAX_EVENTS 10
struct controller { struct controller {
struct controller *next; struct controller *next;
struct mutex crit_sect; /* critical section mutex */ struct mutex crit_sect; /* critical section mutex */
struct mutex ctrl_lock; /* controller lock */ struct mutex ctrl_lock; /* controller lock */
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 */
int slot_num_inc; /* 1 or -1 */ int slot_num_inc; /* 1 or -1 */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
...@@ -113,6 +94,7 @@ struct controller { ...@@ -113,6 +94,7 @@ struct controller {
u8 ctrlcap; u8 ctrlcap;
u16 vendor_id; u16 vendor_id;
u8 cap_base; u8 cap_base;
struct timer_list poll_timer;
}; };
#define INT_BUTTON_IGNORE 0 #define INT_BUTTON_IGNORE 0
...@@ -179,10 +161,10 @@ extern void pciehp_event_stop_thread (void); ...@@ -179,10 +161,10 @@ extern void pciehp_event_stop_thread (void);
extern int pciehp_enable_slot (struct slot *slot); extern int pciehp_enable_slot (struct slot *slot);
extern int pciehp_disable_slot (struct slot *slot); extern int pciehp_disable_slot (struct slot *slot);
extern u8 pciehp_handle_attention_button (u8 hp_slot, void *inst_id); extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_switch_change (u8 hp_slot, void *inst_id); extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_presence_change (u8 hp_slot, void *inst_id); extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
extern u8 pciehp_handle_power_fault (u8 hp_slot, void *inst_id); extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
/* extern void long_delay (int delay); */ /* extern void long_delay (int delay); */
/* pci functions */ /* pci functions */
...@@ -229,21 +211,8 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl) ...@@ -229,21 +211,8 @@ static inline int wait_for_ctrl_irq(struct controller *ctrl)
return retval; return retval;
} }
enum php_ctlr_type {
PCI,
ISA,
ACPI
};
int pcie_init(struct controller *ctrl, struct pcie_device *dev); int pcie_init(struct controller *ctrl, struct pcie_device *dev);
/* This has no meaning for PCI Express, as there is only 1 slot per port */
int pcie_get_ctlr_slot_config(struct controller *ctrl,
int *num_ctlr_slots,
int *first_device_num,
int *physical_slot_num,
u8 *ctrlcap);
struct hpc_ops { struct hpc_ops {
int (*power_on_slot) (struct slot *slot); int (*power_on_slot) (struct slot *slot);
int (*power_off_slot) (struct slot *slot); int (*power_off_slot) (struct slot *slot);
......
...@@ -187,33 +187,6 @@ static void cleanup_slots(struct controller *ctrl) ...@@ -187,33 +187,6 @@ static void cleanup_slots(struct controller *ctrl)
} }
} }
static int get_ctlr_slot_config(struct controller *ctrl)
{
int num_ctlr_slots; /* Not needed; PCI Express has 1 slot per port*/
int first_device_num; /* Not needed */
int physical_slot_num;
u8 ctrlcap;
int rc;
rc = pcie_get_ctlr_slot_config(ctrl, &num_ctlr_slots, &first_device_num, &physical_slot_num, &ctrlcap);
if (rc) {
err("%s: get_ctlr_slot_config fail for b:d (%x:%x)\n", __FUNCTION__, ctrl->bus, ctrl->device);
return (-1);
}
ctrl->num_slots = num_ctlr_slots; /* PCI Express has 1 slot per port */
ctrl->slot_device_offset = first_device_num;
ctrl->first_slot = physical_slot_num;
ctrl->ctrlcap = ctrlcap;
dbg("%s: bus(0x%x) num_slot(0x%x) 1st_dev(0x%x) psn(0x%x) ctrlcap(%x) for b:d (%x:%x)\n",
__FUNCTION__, ctrl->slot_bus, num_ctlr_slots, first_device_num, physical_slot_num, ctrlcap,
ctrl->bus, ctrl->device);
return (0);
}
/* /*
* set_attention_status - Turns the Amber LED for a slot on, off or blink * set_attention_status - Turns the Amber LED for a slot on, off or blink
*/ */
...@@ -352,8 +325,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -352,8 +325,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
int rc; int rc;
struct controller *ctrl; struct controller *ctrl;
struct slot *t_slot; struct slot *t_slot;
int first_device_num = 0 ; /* first PCI device number supported by this PCIE */
int num_ctlr_slots; /* number of slots supported by this HPC */
u8 value; u8 value;
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -390,18 +361,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -390,18 +361,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
dbg("%s: ctrl bus=0x%x, device=%x, function=%x, irq=%x\n", __FUNCTION__, dbg("%s: ctrl bus=0x%x, device=%x, function=%x, irq=%x\n", __FUNCTION__,
ctrl->bus, ctrl->device, ctrl->function, pdev->irq); ctrl->bus, ctrl->device, ctrl->function, pdev->irq);
/*
* Save configuration headers for this and subordinate PCI buses
*/
rc = get_ctlr_slot_config(ctrl);
if (rc) {
err(msg_initialization_err, rc);
goto err_out_free_ctrl_bus;
}
first_device_num = ctrl->slot_device_offset;
num_ctlr_slots = ctrl->num_slots;
/* Setup the slot information structures */ /* Setup the slot information structures */
rc = init_slots(ctrl); rc = init_slots(ctrl);
if (rc) { if (rc) {
...@@ -409,7 +368,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -409,7 +368,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
goto err_out_free_ctrl_slot; goto err_out_free_ctrl_slot;
} }
t_slot = pciehp_find_slot(ctrl, first_device_num); t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
/* Finish setting up the hot plug ctrl device */ /* Finish setting up the hot plug ctrl device */
ctrl->next_event = 0; ctrl->next_event = 0;
...@@ -445,7 +404,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ ...@@ -445,7 +404,6 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
err_out_free_ctrl_slot: err_out_free_ctrl_slot:
cleanup_slots(ctrl); cleanup_slots(ctrl);
err_out_free_ctrl_bus:
kfree(ctrl->pci_bus); kfree(ctrl->pci_bus);
err_out_unmap_mmio_region: err_out_unmap_mmio_region:
ctrl->hpc_ops->release_ctlr(ctrl); ctrl->hpc_ops->release_ctlr(ctrl);
......
...@@ -48,9 +48,8 @@ static inline char *slot_name(struct slot *p_slot) ...@@ -48,9 +48,8 @@ static inline char *slot_name(struct slot *p_slot)
return p_slot->hotplug_slot->name; return p_slot->hotplug_slot->name;
} }
u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u8 rc = 0; u8 rc = 0;
u8 getstatus; u8 getstatus;
...@@ -101,9 +100,8 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id) ...@@ -101,9 +100,8 @@ u8 pciehp_handle_attention_button(u8 hp_slot, void *inst_id)
} }
u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u8 rc = 0; u8 rc = 0;
u8 getstatus; u8 getstatus;
...@@ -143,9 +141,8 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id) ...@@ -143,9 +141,8 @@ u8 pciehp_handle_switch_change(u8 hp_slot, void *inst_id)
return rc; return rc;
} }
u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u8 presence_save, rc = 0; u8 presence_save, rc = 0;
struct event_info *taskInfo; struct event_info *taskInfo;
...@@ -187,9 +184,8 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id) ...@@ -187,9 +184,8 @@ u8 pciehp_handle_presence_change(u8 hp_slot, void *inst_id)
return rc; return rc;
} }
u8 pciehp_handle_power_fault(u8 hp_slot, void *inst_id) u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u8 rc = 0; u8 rc = 0;
struct event_info *taskInfo; struct event_info *taskInfo;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment