mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
serial: 8250_pci: Detach low-level driver during PCI error recovery
am: 4fa1c65cf0
Change-Id: Iaa90075090ace1338995c9163f277818ade70c91
This commit is contained in:
committed by
android-build-merger
commit
50314d9022
@@ -52,6 +52,7 @@ struct serial_private {
|
||||
struct pci_dev *dev;
|
||||
unsigned int nr;
|
||||
struct pci_serial_quirk *quirk;
|
||||
const struct pciserial_board *board;
|
||||
int line[0];
|
||||
};
|
||||
|
||||
@@ -3871,6 +3872,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
|
||||
}
|
||||
}
|
||||
priv->nr = i;
|
||||
priv->board = board;
|
||||
return priv;
|
||||
|
||||
err_deinit:
|
||||
@@ -3881,7 +3883,7 @@ err_out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pciserial_init_ports);
|
||||
|
||||
void pciserial_remove_ports(struct serial_private *priv)
|
||||
void pciserial_detach_ports(struct serial_private *priv)
|
||||
{
|
||||
struct pci_serial_quirk *quirk;
|
||||
int i;
|
||||
@@ -3895,7 +3897,11 @@ void pciserial_remove_ports(struct serial_private *priv)
|
||||
quirk = find_quirk(priv->dev);
|
||||
if (quirk->exit)
|
||||
quirk->exit(priv->dev);
|
||||
}
|
||||
|
||||
void pciserial_remove_ports(struct serial_private *priv)
|
||||
{
|
||||
pciserial_detach_ports(priv);
|
||||
kfree(priv);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pciserial_remove_ports);
|
||||
@@ -5590,7 +5596,7 @@ static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
|
||||
if (priv)
|
||||
pciserial_suspend_ports(priv);
|
||||
pciserial_detach_ports(priv);
|
||||
|
||||
pci_disable_device(dev);
|
||||
|
||||
@@ -5615,9 +5621,18 @@ static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
|
||||
static void serial8250_io_resume(struct pci_dev *dev)
|
||||
{
|
||||
struct serial_private *priv = pci_get_drvdata(dev);
|
||||
const struct pciserial_board *board;
|
||||
|
||||
if (priv)
|
||||
pciserial_resume_ports(priv);
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
board = priv->board;
|
||||
kfree(priv);
|
||||
priv = pciserial_init_ports(dev, board);
|
||||
|
||||
if (!IS_ERR(priv)) {
|
||||
pci_set_drvdata(dev, priv);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct pci_error_handlers serial8250_err_handler = {
|
||||
|
||||
Reference in New Issue
Block a user