From: Dan Williams Date: Tue, 10 Apr 2012 21:11:03 +0000 (-0700) Subject: serial/8250_pci: fix suspend/resume vs init/exit quirks X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5f1a38952b7e932a1c169c28917b9a831f641bcc;p=linux-beck.git serial/8250_pci: fix suspend/resume vs init/exit quirks Commit e86ff4a6 "serial/8250_pci: init-quirk msi support for kt serial controller" introduced a regression in suspend/resume by causing msi's to be enabled twice without an intervening disable. 00:16.3 Serial controller: Intel Corporation Patsburg KT Controller (rev 05) (prog-if 02 [16550]) Subsystem: Intel Corporation Device 7270 Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 72 I/O ports at 4080 [size=8] Memory at d1c30000 (32-bit, non-prefetchable) [size=4K] Capabilities: [c8] Power Management version 3 Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Kernel driver in use: serial [ 365.250523] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:16.3/msi_irqs' [ 365.250525] Modules linked in: nls_utf8 ipv6 uinput sg iTCO_wdt iTCO_vendor_support ioatdma dca i2c_i801 i2c_core wmi sd_mod ahci libahci isci libsas libata scsi_transport_sas [last unloaded: scsi_wait_scan] [ 365.250540] Pid: 9030, comm: kworker/u:1 Tainted: G W 3.3.0-isci-3.0.213+ #1 [ 365.250542] Call Trace: [ 365.250545] [] ? sysfs_add_one+0x99/0xad [ 365.250548] [] warn_slowpath_common+0x85/0x9e [ 365.250551] [] warn_slowpath_fmt+0x6e/0x70 [ 365.250555] [] ? sysfs_add_one+0x3e/0xad [ 365.250558] [] ? sysfs_pathname+0x3c/0x44 [ 365.250561] [] ? sysfs_pathname+0x3c/0x44 [ 365.250564] [] ? sysfs_pathname+0x3c/0x44 [ 365.250567] [] ? sysfs_pathname+0x3c/0x44 [ 365.250570] [] sysfs_add_one+0x99/0xad [ 365.250573] [] create_dir+0x72/0xa5 [ 365.250577] [] sysfs_create_dir+0xa2/0xbe [ 365.250581] [] kobject_add_internal+0x126/0x1f8 [ 365.250585] [] kset_register+0x26/0x3f [ 365.250588] [] kset_create_and_add+0x62/0x7c [ 365.250592] [] populate_msi_sysfs+0x34/0x103 [ 365.250595] [] pci_enable_msi_block+0x1b3/0x216 [ 365.250599] [] try_enable_msi+0x13/0x17 [ 365.250603] [] pciserial_resume_ports+0x21/0x42 [ 365.250607] [] pciserial_resume_one+0x50/0x57 [ 365.250610] [] pci_legacy_resume+0x38/0x47 [ 365.250613] [] pci_pm_restore+0x54/0x87 [ 365.250616] [] ? pci_legacy_resume+0x47/0x47 [ 365.250619] [] dpm_run_callback+0x48/0x7b [ 365.250623] [] device_resume+0x342/0x394 [ 365.250626] [] async_resume+0x21/0x49 That patch has since been reverted, but by inspection it seems that pciserial_suspend_ports() should be invoking .exit() quirks to release resources acquired during .init(). Acked-by: Alan Cox Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 024551acf874..24ea98c6e77a 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -2814,6 +2814,12 @@ void pciserial_suspend_ports(struct serial_private *priv) for (i = 0; i < priv->nr; i++) if (priv->line[i] >= 0) serial8250_suspend_port(priv->line[i]); + + /* + * Ensure that every init quirk is properly torn down + */ + if (priv->quirk->exit) + priv->quirk->exit(priv->dev); } EXPORT_SYMBOL_GPL(pciserial_suspend_ports);