提交 d6c4932f 编写于 作者: S Sam Bobroff 提交者: Michael Ellerman

powerpc/eeh: Strengthen types of eeh traversal functions

The traversal functions eeh_pe_traverse() and eeh_pe_dev_traverse()
both provide their first argument as void * but every single user casts
it to the expected type.

Change the type of the first parameter from void * to the appropriate
type, and clean up all uses.
Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 a0bd5464
......@@ -262,7 +262,8 @@ static inline bool eeh_state_active(int state)
== (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
}
typedef void *(*eeh_traverse_func)(void *data, void *flag);
typedef void *(*eeh_edev_traverse_func)(struct eeh_dev *edev, void *flag);
typedef void *(*eeh_pe_traverse_func)(struct eeh_pe *pe, void *flag);
void eeh_set_pe_aux_size(int size);
int eeh_phb_pe_create(struct pci_controller *phb);
struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
......@@ -272,9 +273,9 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev);
int eeh_rmv_from_parent_pe(struct eeh_dev *edev);
void eeh_pe_update_time_stamp(struct eeh_pe *pe);
void *eeh_pe_traverse(struct eeh_pe *root,
eeh_traverse_func fn, void *flag);
eeh_pe_traverse_func fn, void *flag);
void *eeh_pe_dev_traverse(struct eeh_pe *root,
eeh_traverse_func fn, void *flag);
eeh_edev_traverse_func fn, void *flag);
void eeh_pe_restore_bars(struct eeh_pe *pe);
const char *eeh_pe_loc_get(struct eeh_pe *pe);
struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
......
......@@ -263,9 +263,8 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)
return n;
}
static void *eeh_dump_pe_log(void *data, void *flag)
static void *eeh_dump_pe_log(struct eeh_pe *pe, void *flag)
{
struct eeh_pe *pe = data;
struct eeh_dev *edev, *tmp;
size_t *plen = flag;
......@@ -686,9 +685,9 @@ int eeh_pci_enable(struct eeh_pe *pe, int function)
return rc;
}
static void *eeh_disable_and_save_dev_state(void *data, void *userdata)
static void *eeh_disable_and_save_dev_state(struct eeh_dev *edev,
void *userdata)
{
struct eeh_dev *edev = data;
struct pci_dev *pdev = eeh_dev_to_pci_dev(edev);
struct pci_dev *dev = userdata;
......@@ -714,9 +713,8 @@ static void *eeh_disable_and_save_dev_state(void *data, void *userdata)
return NULL;
}
static void *eeh_restore_dev_state(void *data, void *userdata)
static void *eeh_restore_dev_state(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = data;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
struct pci_dev *pdev = eeh_dev_to_pci_dev(edev);
struct pci_dev *dev = userdata;
......@@ -856,11 +854,10 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
* the indicated device and its children so that the bunch of the
* devices could be reset properly.
*/
static void *eeh_set_dev_freset(void *data, void *flag)
static void *eeh_set_dev_freset(struct eeh_dev *edev, void *flag)
{
struct pci_dev *dev;
unsigned int *freset = (unsigned int *)flag;
struct eeh_dev *edev = (struct eeh_dev *)data;
dev = eeh_dev_to_pci_dev(edev);
if (dev)
......
......@@ -149,9 +149,8 @@ static bool eeh_dev_removed(struct eeh_dev *edev)
return false;
}
static void *eeh_dev_save_state(void *data, void *userdata)
static void *eeh_dev_save_state(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = data;
struct pci_dev *pdev;
if (!edev)
......@@ -184,9 +183,8 @@ static void *eeh_dev_save_state(void *data, void *userdata)
* merge the device driver responses. Cumulative response
* passed back in "userdata".
*/
static void *eeh_report_error(void *data, void *userdata)
static void *eeh_report_error(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
......@@ -231,9 +229,8 @@ static void *eeh_report_error(void *data, void *userdata)
* are now enabled. Collects up and merges the device driver responses.
* Cumulative response passed back in "userdata".
*/
static void *eeh_report_mmio_enabled(void *data, void *userdata)
static void *eeh_report_mmio_enabled(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
......@@ -273,9 +270,8 @@ static void *eeh_report_mmio_enabled(void *data, void *userdata)
* some actions, usually to save data the driver needs so that the
* driver can work again while the device is recovered.
*/
static void *eeh_report_reset(void *data, void *userdata)
static void *eeh_report_reset(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
enum pci_ers_result rc, *res = userdata;
struct pci_driver *driver;
......@@ -310,9 +306,8 @@ static void *eeh_report_reset(void *data, void *userdata)
return NULL;
}
static void *eeh_dev_restore_state(void *data, void *userdata)
static void *eeh_dev_restore_state(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = data;
struct pci_dev *pdev;
if (!edev)
......@@ -348,9 +343,8 @@ static void *eeh_dev_restore_state(void *data, void *userdata)
* could resume so that the device driver can do some initialization
* to make the recovered device work again.
*/
static void *eeh_report_resume(void *data, void *userdata)
static void *eeh_report_resume(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
bool was_in_error;
struct pci_driver *driver;
......@@ -397,9 +391,8 @@ static void *eeh_report_resume(void *data, void *userdata)
* This informs the device driver that the device is permanently
* dead, and that no further recovery attempts will be made on it.
*/
static void *eeh_report_failure(void *data, void *userdata)
static void *eeh_report_failure(struct eeh_dev *edev, void *userdata)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
struct pci_driver *driver;
......@@ -457,10 +450,9 @@ static void *eeh_add_virt_device(void *data, void *userdata)
return NULL;
}
static void *eeh_rmv_device(void *data, void *userdata)
static void *eeh_rmv_device(struct eeh_dev *edev, void *userdata)
{
struct pci_driver *driver;
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dev *dev = eeh_dev_to_pci_dev(edev);
struct eeh_rmv_data *rmv_data = (struct eeh_rmv_data *)userdata;
int *removed = rmv_data ? &rmv_data->removed : NULL;
......@@ -532,9 +524,8 @@ static void *eeh_rmv_device(void *data, void *userdata)
return NULL;
}
static void *eeh_pe_detach_dev(void *data, void *userdata)
static void *eeh_pe_detach_dev(struct eeh_pe *pe, void *userdata)
{
struct eeh_pe *pe = (struct eeh_pe *)data;
struct eeh_dev *edev, *tmp;
eeh_pe_for_each_dev(pe, edev, tmp) {
......@@ -555,9 +546,8 @@ static void *eeh_pe_detach_dev(void *data, void *userdata)
* PE reset (for 3 times), we try to clear the frozen state
* for 3 times as well.
*/
static void *__eeh_clear_pe_frozen_state(void *data, void *flag)
static void *__eeh_clear_pe_frozen_state(struct eeh_pe *pe, void *flag)
{
struct eeh_pe *pe = (struct eeh_pe *)data;
bool clear_sw_state = *(bool *)flag;
int i, rc = 1;
......
......@@ -173,7 +173,7 @@ static struct eeh_pe *eeh_pe_next(struct eeh_pe *pe,
* to be traversed.
*/
void *eeh_pe_traverse(struct eeh_pe *root,
eeh_traverse_func fn, void *flag)
eeh_pe_traverse_func fn, void *flag)
{
struct eeh_pe *pe;
void *ret;
......@@ -196,7 +196,7 @@ void *eeh_pe_traverse(struct eeh_pe *root,
* PE and its child PEs.
*/
void *eeh_pe_dev_traverse(struct eeh_pe *root,
eeh_traverse_func fn, void *flag)
eeh_edev_traverse_func fn, void *flag)
{
struct eeh_pe *pe;
struct eeh_dev *edev, *tmp;
......@@ -235,9 +235,8 @@ struct eeh_pe_get_flag {
int config_addr;
};
static void *__eeh_pe_get(void *data, void *flag)
static void *__eeh_pe_get(struct eeh_pe *pe, void *flag)
{
struct eeh_pe *pe = (struct eeh_pe *)data;
struct eeh_pe_get_flag *tmp = (struct eeh_pe_get_flag *) flag;
/* Unexpected PHB PE */
......@@ -551,9 +550,8 @@ void eeh_pe_update_time_stamp(struct eeh_pe *pe)
* PE. Also, the associated PCI devices will be put into IO frozen
* state as well.
*/
static void *__eeh_pe_state_mark(void *data, void *flag)
static void *__eeh_pe_state_mark(struct eeh_pe *pe, void *flag)
{
struct eeh_pe *pe = (struct eeh_pe *)data;
int state = *((int *)flag);
struct eeh_dev *edev, *tmp;
struct pci_dev *pdev;
......@@ -595,9 +593,8 @@ void eeh_pe_state_mark(struct eeh_pe *pe, int state)
}
EXPORT_SYMBOL_GPL(eeh_pe_state_mark);
static void *__eeh_pe_dev_mode_mark(void *data, void *flag)
static void *__eeh_pe_dev_mode_mark(struct eeh_dev *edev, void *flag)
{
struct eeh_dev *edev = data;
int mode = *((int *)flag);
edev->mode |= mode;
......@@ -625,9 +622,8 @@ void eeh_pe_dev_mode_mark(struct eeh_pe *pe, int mode)
* given PE. Besides, we also clear the check count of the PE
* as well.
*/
static void *__eeh_pe_state_clear(void *data, void *flag)
static void *__eeh_pe_state_clear(struct eeh_pe *pe, void *flag)
{
struct eeh_pe *pe = (struct eeh_pe *)data;
int state = *((int *)flag);
struct eeh_dev *edev, *tmp;
struct pci_dev *pdev;
......@@ -858,9 +854,8 @@ static void eeh_restore_device_bars(struct eeh_dev *edev)
* the expansion ROM base address, the latency timer, and etc.
* from the saved values in the device node.
*/
static void *eeh_restore_one_device_bars(void *data, void *flag)
static void *eeh_restore_one_device_bars(struct eeh_dev *edev, void *flag)
{
struct eeh_dev *edev = (struct eeh_dev *)data;
struct pci_dn *pdn = eeh_dev_to_pdn(edev);
/* Do special restore for bridges */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册