/* This callback is called by the PCI subsystem whenever a PCI bus error is detected.  */
static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state)
/* This callback is called by the PCI subsystem whenever a PCI bus error is detected.  */
static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state)
{
	struct net_device *ndev = pci_get_drvdata(pdev);
	switch (state) {
	case pci_channel_io_normal:
		return PCI_ERS_RESULT_CAN_RECOVER;
	case pci_channel_io_frozen:
		netif_device_detach(ndev);
		if (netif_running(ndev))
			ql_eeh_close(ndev);
		pci_disable_device(pdev);
		return PCI_ERS_RESULT_NEED_RESET;
	case pci_channel_io_perm_failure:
		dev_err(&pdev->dev,
			"%s: pci_channel_io_perm_failure.\n", __func__);
		return PCI_ERS_RESULT_DISCONNECT;
	}
	return PCI_ERS_RESULT_NEED_RESET;
}