From 0d0cdb028f9d9771e2b346038707734121f906e3 Mon Sep 17 00:00:00 2001 From: Aaron Lu Date: Mon, 26 Nov 2012 13:55:25 +0800 Subject: libata: restore acpi disable functionality Commit 66fa7f215 "libata-acpi: improve ACPI disabling" introdcued the behaviour of disabling ATA ACPI if ata_acpi_on_devcfg failed the 2nd time, but commit 30dcf76ac dropped this behaviour and this caused problem for Dimitris Damigos, where his laptop can not resume correctly. The bugzilla page for it is: https://bugzilla.kernel.org/show_bug.cgi?id=49331 The problem is, ata_dev_push_id will fail the 2nd time it is invoked, and due to disabling ACPI code is dropped, ata_acpi_on_devcfg which calls ata_dev_push_id will keep failing and eventually made the device disabled. This patch restores the original behaviour, if acpi failed the 2nd time, disable acpi functionality for the device(and we do not event need to add a debug message for this as it is still there ;-). Reported-by: Dimitris Damigos Signed-off-by: Aaron Lu Cc: Signed-off-by: Jeff Garzik --- include/linux/libata.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/libata.h') diff --git a/include/linux/libata.h b/include/linux/libata.h index 77eeeda2b6e..e931c9ad107 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -163,6 +163,7 @@ enum { ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */ + ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */ ATA_DEV_UNKNOWN = 0, /* unknown device */ ATA_DEV_ATA = 1, /* ATA device */ -- cgit v1.2.3-70-g09d2 From b7db04d9264fca4b00e949da7b3180c50e243fca Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 2 Nov 2012 12:29:32 -0700 Subject: libata: implement ata_platform_remove_one() This relatively simple boiler-plate code is repeated in several platform drivers. We should implement a common version in libata. Signed-off-by: Brian Norris Signed-off-by: Jeff Garzik --- drivers/ata/libata-core.c | 23 +++++++++++++++++++++++ include/linux/libata.h | 4 ++++ 2 files changed, 27 insertions(+) (limited to 'include/linux/libata.h') diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 583f26d6d45..8e3f4a90c08 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -67,6 +67,7 @@ #include #include #include +#include #include "libata.h" #include "libata-transport.h" @@ -6382,6 +6383,26 @@ int ata_pci_device_resume(struct pci_dev *pdev) #endif /* CONFIG_PCI */ +/** + * ata_platform_remove_one - Platform layer callback for device removal + * @pdev: Platform device that was removed + * + * Platform layer indicates to libata via this hook that hot-unplug or + * module unload event has occurred. Detach all ports. Resource + * release is handled via devres. + * + * LOCKING: + * Inherited from platform layer (may sleep). + */ +int ata_platform_remove_one(struct platform_device *pdev) +{ + struct ata_host *host = platform_get_drvdata(pdev); + + ata_host_detach(host); + + return 0; +} + static int __init ata_parse_force_one(char **cur, struct ata_force_ent *force_ent, const char **reason) @@ -6877,6 +6898,8 @@ EXPORT_SYMBOL_GPL(ata_pci_device_resume); #endif /* CONFIG_PM */ #endif /* CONFIG_PCI */ +EXPORT_SYMBOL_GPL(ata_platform_remove_one); + EXPORT_SYMBOL_GPL(__ata_ehi_push_desc); EXPORT_SYMBOL_GPL(ata_ehi_push_desc); EXPORT_SYMBOL_GPL(ata_ehi_clear_desc); diff --git a/include/linux/libata.h b/include/linux/libata.h index e931c9ad107..83ba0ab2c91 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1115,6 +1115,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev); #endif /* CONFIG_PM */ #endif /* CONFIG_PCI */ +struct platform_device; + +extern int ata_platform_remove_one(struct platform_device *pdev); + /* * ACPI - drivers/ata/libata-acpi.c */ -- cgit v1.2.3-70-g09d2