* [PATCH 00/14] ahci/libata: clean up platform device removal
@ 2012-11-02 7:46 Brian Norris
2012-11-02 7:46 ` [PATCH 01/14] ahci_platform: enable hotplug unbinding Brian Norris
` (14 more replies)
0 siblings, 15 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo, Kevin Cernekee
Hi,
This is a revision and extension of an RFC series I sent out a few times. Here
are links to the previous patches, discussion, and questions.
http://article.gmane.org/gmane.linux.ide/53159
http://article.gmane.org/gmane.linux.ide/53143
http://article.gmane.org/gmane.linux.ide/52951
The major change from RFC v2 is that I rebased to the current libata/NEXT, then
added new patches (PATCH 04/14 through PATCH 14/14).
This series does the following:
(1) Allows ahci_platform to unbind a device from the driver. This is useful for
allowing total power-off of the device, for instance.
(2) Adds ahci_platform ata_port_operations.host_stop() hook, so that
platform-device exit() can power down the device at the appropriate point
in the removal sequence.
(3) Adds a common ata_platform_remove_one() function so that we don't
re-implement a simple host detach across many platform drivers
(4) Switches many platform drivers to the new .remove function from (3)
Thanks to Tejun for the comments, which suggested that ahci_platform (not
libata-core) was broken.
Note that patch 13 provides untested new functionality to the pata_octeon_cf
driver. It was missing a .remove function, so I took the liberty to add the
common one. Feel free to exclude this patch.
Thanks,
Brian
P.S. A related but distinct issue: someting is still broken in the
ata_host_detach() function, for shutting down the host, spinning down disks,
etc. When I rmmod the driver or unbind the device, I get the following
failures, and the HDD doesn't spin down:
# echo strict-ahci.0 > /sys/bus/platform/drivers/ahci/unbind
ata2.00: disabled
sd 1:0:0:0: [sda] Synchronizing SCSI cache
sd 1:0:0:0: [sda] Result: hostbyte=0x04 driverbyte=0x00
sd 1:0:0:0: [sda] Stopping disk
sd 1:0:0:0: [sda] START_STOP FAILED
sd 1:0:0:0: [sda] Result: hostbyte=0x04 driverbyte=0x00
This is reproducible on my laptop (v3.2 kernel, AHCI PCI driver) and on my SoC
AHCI core (v3.3 kernel, AHCI platform driver). I haven't been able to try a
more recent kernel, but nothing I see in the changelogs suggests that there
would be any difference.
I have narrowed down the error messages to the following info, although I am
not yet familiar enough with these codepaths to make a recommendation:
ata_host_detach
|_ ata_port_detach
|_ ata_port_schedule_eh => SCSI error handler calls ata_dev_disable()
| ...
|_scsi_remove_host()
| ...
|__..._ sd_start_stop_device() => failure!
Brian Norris (14):
ahci_platform: enable hotplug unbinding
ahci_platform: convert to module_platform_driver
ahci_platform: perform platform exit in host_stop() hook
libata: implement ata_platform_remove_one()
ahci_platform: utilize common ata_platform_remove_one()
pata_ixp4xx_cf: utilize common ata_platform_remove_one()
pata_mpc52xx: utilize common ata_platform_remove_one()
pata_of_platform: utilize common ata_platform_remove_one()
pata_platform: utilize common ata_platform_remove_one()
ata_platform: remove unused remove function
pata_palmld: utilize common ata_platform_remove_one()
sata_highbank: utilize common ata_platform_remove_one()
pata_octeon_cf: perform host detach, removal on exit
libata: use pci_get_drvdata() helper
drivers/ata/ahci_platform.c | 44 +++++++++++++++++++-----------------------
drivers/ata/libata-core.c | 30 ++++++++++++++++++++++++----
drivers/ata/pata_ixp4xx_cf.c | 11 +----------
drivers/ata/pata_mpc52xx.c | 17 +++-------------
drivers/ata/pata_octeon_cf.c | 1 +
drivers/ata/pata_of_platform.c | 7 +------
drivers/ata/pata_palmld.c | 4 +---
drivers/ata/pata_platform.c | 24 +----------------------
drivers/ata/sata_highbank.c | 12 +-----------
include/linux/ata_platform.h | 2 --
include/linux/libata.h | 4 ++++
11 files changed, 59 insertions(+), 97 deletions(-)
--
1.7.11.3
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH 01/14] ahci_platform: enable hotplug unbinding
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 02/14] ahci_platform: convert to module_platform_driver Brian Norris
` (13 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
platform_driver_probe() should be used for registering this driver only
if we want to
"...remove its run-once probe() infrastructure from memory after the
driver has bound to the device."
However, we may want to leave the probe infrastructure in place in order
to support binding/unbinding a device dynamically. This is useful, for
instance, as a power management mechanism, where a device can be totally
powered down when unbound (whereas with runtime power management,
powering down the SATA core would incur unacceptable loss of
functionality).
Thus, convert this driver to use platform_driver_register().
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/ahci_platform.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index b1ae480..9bc8a78 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -75,7 +75,7 @@ static struct scsi_host_template ahci_platform_sht = {
AHCI_SHT("ahci_platform"),
};
-static int __init ahci_probe(struct platform_device *pdev)
+static int __devinit ahci_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev_get_platdata(dev);
@@ -326,6 +326,7 @@ static const struct of_device_id ahci_of_match[] = {
MODULE_DEVICE_TABLE(of, ahci_of_match);
static struct platform_driver ahci_driver = {
+ .probe = ahci_probe,
.remove = __devexit_p(ahci_remove),
.driver = {
.name = "ahci",
@@ -338,7 +339,7 @@ static struct platform_driver ahci_driver = {
static int __init ahci_init(void)
{
- return platform_driver_probe(&ahci_driver, ahci_probe);
+ return platform_driver_register(&ahci_driver);
}
module_init(ahci_init);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 02/14] ahci_platform: convert to module_platform_driver
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
2012-11-02 7:46 ` [PATCH 01/14] ahci_platform: enable hotplug unbinding Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 03/14] ahci_platform: perform platform exit in host_stop() hook Brian Norris
` (12 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
The ahci_platform driver can now use the module_platform_driver() macro.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/ahci_platform.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 9bc8a78..8ae1c6f 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -336,18 +336,7 @@ static struct platform_driver ahci_driver = {
},
.id_table = ahci_devtype,
};
-
-static int __init ahci_init(void)
-{
- return platform_driver_register(&ahci_driver);
-}
-module_init(ahci_init);
-
-static void __exit ahci_exit(void)
-{
- platform_driver_unregister(&ahci_driver);
-}
-module_exit(ahci_exit);
+module_platform_driver(ahci_driver);
MODULE_DESCRIPTION("AHCI SATA platform driver");
MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 03/14] ahci_platform: perform platform exit in host_stop() hook
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
2012-11-02 7:46 ` [PATCH 01/14] ahci_platform: enable hotplug unbinding Brian Norris
2012-11-02 7:46 ` [PATCH 02/14] ahci_platform: convert to module_platform_driver Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 04/14] libata: implement ata_platform_remove_one() Brian Norris
` (11 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
AHCI platform devices may provide an exit() routine, via
ahci_platform_data, that powers off the SATA core. Such a routine should
be executed from the ata_port_operations host_stop() hook. That way, the
ATA subsystem can perform any last-minute hardware cleanup (via devres,
for example), then trigger the power-off at the appropriate time.
This patch fixes bus errors triggered during module removal or device
unbinding, seen on an SoC SATA core.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/ahci_platform.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 8ae1c6f..05806e0 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -25,6 +25,8 @@
#include <linux/ahci_platform.h>
#include "ahci.h"
+static void ahci_host_stop(struct ata_host *host);
+
enum ahci_type {
AHCI, /* standard platform ahci */
IMX53_AHCI, /* ahci on i.mx53 */
@@ -47,6 +49,15 @@ static struct platform_device_id ahci_devtype[] = {
};
MODULE_DEVICE_TABLE(platform, ahci_devtype);
+struct ata_port_operations ahci_platform_ops = {
+ .inherits = &ahci_ops,
+ .host_stop = ahci_host_stop,
+};
+
+struct ata_port_operations ahci_platform_retry_srst_ops = {
+ .inherits = &ahci_pmp_retry_srst_ops,
+ .host_stop = ahci_host_stop,
+};
static const struct ata_port_info ahci_port_info[] = {
/* by features */
@@ -54,20 +65,20 @@ static const struct ata_port_info ahci_port_info[] = {
.flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
- .port_ops = &ahci_ops,
+ .port_ops = &ahci_platform_ops,
},
[IMX53_AHCI] = {
.flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
- .port_ops = &ahci_pmp_retry_srst_ops,
+ .port_ops = &ahci_platform_retry_srst_ops,
},
[STRICT_AHCI] = {
AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
.flags = AHCI_FLAG_COMMON,
.pio_mask = ATA_PIO4,
.udma_mask = ATA_UDMA6,
- .port_ops = &ahci_ops,
+ .port_ops = &ahci_platform_ops,
},
};
@@ -221,12 +232,19 @@ free_clk:
static int __devexit ahci_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct ahci_platform_data *pdata = dev_get_platdata(dev);
struct ata_host *host = dev_get_drvdata(dev);
- struct ahci_host_priv *hpriv = host->private_data;
ata_host_detach(host);
+ return 0;
+}
+
+static void ahci_host_stop(struct ata_host *host)
+{
+ struct device *dev = host->dev;
+ struct ahci_platform_data *pdata = dev_get_platdata(dev);
+ struct ahci_host_priv *hpriv = host->private_data;
+
if (pdata && pdata->exit)
pdata->exit(dev);
@@ -234,8 +252,6 @@ static int __devexit ahci_remove(struct platform_device *pdev)
clk_disable_unprepare(hpriv->clk);
clk_put(hpriv->clk);
}
-
- return 0;
}
#ifdef CONFIG_PM
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 04/14] libata: implement ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (2 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 03/14] ahci_platform: perform platform exit in host_stop() hook Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 11:07 ` Sergei Shtylyov
2012-11-02 19:09 ` [PATCH v2 " Brian Norris
2012-11-02 7:46 ` [PATCH 05/14] ahci_platform: utilize common ata_platform_remove_one() Brian Norris
` (10 subsequent siblings)
14 siblings, 2 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
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 <computersforpeace@gmail.com>
---
drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
include/linux/libata.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 611050d..820e47f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -67,6 +67,7 @@
#include <linux/cdrom.h>
#include <linux/ratelimit.h>
#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
#include "libata.h"
#include "libata-transport.h"
@@ -6350,6 +6351,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)
@@ -6844,6 +6865,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 464e67c..cedcd0f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1103,6 +1103,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
*/
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 05/14] ahci_platform: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (3 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 04/14] libata: implement ata_platform_remove_one() Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 06/14] pata_ixp4xx_cf: " Brian Norris
` (9 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/ahci_platform.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 05806e0..13e4456 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -229,16 +229,6 @@ free_clk:
return rc;
}
-static int __devexit ahci_remove(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct ata_host *host = dev_get_drvdata(dev);
-
- ata_host_detach(host);
-
- return 0;
-}
-
static void ahci_host_stop(struct ata_host *host)
{
struct device *dev = host->dev;
@@ -343,7 +333,7 @@ MODULE_DEVICE_TABLE(of, ahci_of_match);
static struct platform_driver ahci_driver = {
.probe = ahci_probe,
- .remove = __devexit_p(ahci_remove),
+ .remove = ata_platform_remove_one,
.driver = {
.name = "ahci",
.owner = THIS_MODULE,
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 06/14] pata_ixp4xx_cf: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (4 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 05/14] ahci_platform: utilize common ata_platform_remove_one() Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 07/14] pata_mpc52xx: " Brian Norris
` (8 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_ixp4xx_cf.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index badb178..0566e67 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -187,22 +187,13 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht);
}
-static __devexit int ixp4xx_pata_remove(struct platform_device *dev)
-{
- struct ata_host *host = platform_get_drvdata(dev);
-
- ata_host_detach(host);
-
- return 0;
-}
-
static struct platform_driver ixp4xx_pata_platform_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
},
.probe = ixp4xx_pata_probe,
- .remove = __devexit_p(ixp4xx_pata_remove),
+ .remove = ata_platform_remove_one,
};
module_platform_driver(ixp4xx_pata_platform_driver);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 07/14] pata_mpc52xx: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (5 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 06/14] pata_ixp4xx_cf: " Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 08/14] pata_of_platform: " Brian Norris
` (7 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_mpc52xx.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index d2c102f..ec67f54 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -663,18 +663,6 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv,
&mpc52xx_ata_sht);
}
-static struct mpc52xx_ata_priv *
-mpc52xx_ata_remove_one(struct device *dev)
-{
- struct ata_host *host = dev_get_drvdata(dev);
- struct mpc52xx_ata_priv *priv = host->private_data;
-
- ata_host_detach(host);
-
- return priv;
-}
-
-
/* ======================================================================== */
/* OF Platform driver */
/* ======================================================================== */
@@ -815,11 +803,12 @@ mpc52xx_ata_probe(struct platform_device *op)
static int
mpc52xx_ata_remove(struct platform_device *op)
{
- struct mpc52xx_ata_priv *priv;
+ struct ata_host *host = platform_get_drvdata(op);
+ struct mpc52xx_ata_priv *priv = host->private_data;
int task_irq;
/* Deregister the ATA interface */
- priv = mpc52xx_ata_remove_one(&op->dev);
+ ata_platform_remove_one(op);
/* Clean up DMA */
task_irq = bcom_get_task_irq(priv->dmatsk);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 08/14] pata_of_platform: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (6 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 07/14] pata_mpc52xx: " Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 09/14] pata_platform: " Brian Norris
` (6 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_of_platform.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 1654dc2..cd0f9da 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -76,11 +76,6 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev)
reg_shift, pio_mask);
}
-static int __devexit pata_of_platform_remove(struct platform_device *ofdev)
-{
- return __pata_platform_remove(&ofdev->dev);
-}
-
static struct of_device_id pata_of_platform_match[] = {
{ .compatible = "ata-generic", },
{ .compatible = "electra-ide", },
@@ -95,7 +90,7 @@ static struct platform_driver pata_of_platform_driver = {
.of_match_table = pata_of_platform_match,
},
.probe = pata_of_platform_probe,
- .remove = __devexit_p(pata_of_platform_remove),
+ .remove = ata_platform_remove_one,
};
module_platform_driver(pata_of_platform_driver);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 09/14] pata_platform: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (7 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 08/14] pata_of_platform: " Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 10/14] ata_platform: remove unused remove function Brian Norris
` (5 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_platform.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index f1848ae..449aa29 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -242,14 +242,9 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
pio_mask);
}
-static int __devexit pata_platform_remove(struct platform_device *pdev)
-{
- return __pata_platform_remove(&pdev->dev);
-}
-
static struct platform_driver pata_platform_driver = {
.probe = pata_platform_probe,
- .remove = __devexit_p(pata_platform_remove),
+ .remove = ata_platform_remove_one,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 10/14] ata_platform: remove unused remove function
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (8 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 09/14] pata_platform: " Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 11/14] pata_palmld: utilize common ata_platform_remove_one() Brian Norris
` (4 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
All users of __pata_platform_remove() have been converted to utilize the
common ata_platform_remove_one().
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_platform.c | 17 -----------------
include/linux/ata_platform.h | 2 --
2 files changed, 19 deletions(-)
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 449aa29..f4372d0 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -178,23 +178,6 @@ int __devinit __pata_platform_probe(struct device *dev,
}
EXPORT_SYMBOL_GPL(__pata_platform_probe);
-/**
- * __pata_platform_remove - unplug a platform interface
- * @dev: device
- *
- * A platform bus ATA device has been unplugged. Perform the needed
- * cleanup. Also called on module unload for any active devices.
- */
-int __pata_platform_remove(struct device *dev)
-{
- struct ata_host *host = dev_get_drvdata(dev);
-
- ata_host_detach(host);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(__pata_platform_remove);
-
static int __devinit pata_platform_probe(struct platform_device *pdev)
{
struct resource *io_res;
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b856a2a..fe99896 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -22,8 +22,6 @@ extern int __devinit __pata_platform_probe(struct device *dev,
unsigned int ioport_shift,
int __pio_mask);
-extern int __devexit __pata_platform_remove(struct device *dev);
-
/*
* Marvell SATA private data
*/
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 11/14] pata_palmld: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (9 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 10/14] ata_platform: remove unused remove function Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 12/14] sata_highbank: " Brian Norris
` (3 subsequent siblings)
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_palmld.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
index 5ff31b6..f9f79fc 100644
--- a/drivers/ata/pata_palmld.c
+++ b/drivers/ata/pata_palmld.c
@@ -111,9 +111,7 @@ err1:
static __devexit int palmld_pata_remove(struct platform_device *dev)
{
- struct ata_host *host = platform_get_drvdata(dev);
-
- ata_host_detach(host);
+ ata_platform_remove_one(dev);
/* power down the HDD */
gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 12/14] sata_highbank: utilize common ata_platform_remove_one()
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (10 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 11/14] pata_palmld: utilize common ata_platform_remove_one() Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 19:12 ` [PATCH v2 " Brian Norris
2012-11-02 7:46 ` [PATCH 13/14] pata_octeon_cf: perform host detach, removal on exit Brian Norris
` (2 subsequent siblings)
14 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/sata_highbank.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 0d7c4c2..7601dd8 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -368,16 +368,6 @@ err0:
return rc;
}
-static int __devexit ahci_highbank_remove(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct ata_host *host = dev_get_drvdata(dev);
-
- ata_host_detach(host);
-
- return 0;
-}
-
#ifdef CONFIG_PM
static int ahci_highbank_suspend(struct device *dev)
{
@@ -432,7 +422,7 @@ SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops,
ahci_highbank_suspend, ahci_highbank_resume);
static struct platform_driver ahci_highbank_driver = {
- .remove = __devexit_p(ahci_highbank_remove),
+ .remove = ata_platform_remove_one,
.driver = {
.name = "highbank-ahci",
.owner = THIS_MODULE,
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 13/14] pata_octeon_cf: perform host detach, removal on exit
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (11 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 12/14] sata_highbank: " Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 7:46 ` [PATCH 14/14] libata: use pci_get_drvdata() helper Brian Norris
2012-11-02 17:01 ` [PATCH 00/14] ahci/libata: clean up platform device removal Tejun Heo
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
This driver does not detach and remove its ata_host properly on device
removal. Add the common .remove helper.
Note: I do not know this driver well enough to ensure this is the right
thing to do. Merge this patch with caution.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/pata_octeon_cf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 1d61d5d..d8df93b 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -921,6 +921,7 @@ free_cf_port:
static struct platform_driver octeon_cf_driver = {
.probe = octeon_cf_probe,
+ .remove = ata_platform_remove_one,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH 14/14] libata: use pci_get_drvdata() helper
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (12 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 13/14] pata_octeon_cf: perform host detach, removal on exit Brian Norris
@ 2012-11-02 7:46 ` Brian Norris
2012-11-02 17:01 ` [PATCH 00/14] ahci/libata: clean up platform device removal Tejun Heo
14 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 7:46 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Brian Norris, Tejun Heo
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/ata/libata-core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 820e47f..a0c6cac 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6255,8 +6255,7 @@ void ata_host_detach(struct ata_host *host)
*/
void ata_pci_remove_one(struct pci_dev *pdev)
{
- struct device *dev = &pdev->dev;
- struct ata_host *host = dev_get_drvdata(dev);
+ struct ata_host *host = pci_get_drvdata(pdev);
ata_host_detach(host);
}
@@ -6325,7 +6324,7 @@ int ata_pci_device_do_resume(struct pci_dev *pdev)
int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
{
- struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ struct ata_host *host = pci_get_drvdata(pdev);
int rc = 0;
rc = ata_host_suspend(host, mesg);
@@ -6339,7 +6338,7 @@ int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
int ata_pci_device_resume(struct pci_dev *pdev)
{
- struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ struct ata_host *host = pci_get_drvdata(pdev);
int rc;
rc = ata_pci_device_do_resume(pdev);
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH 04/14] libata: implement ata_platform_remove_one()
2012-11-02 7:46 ` [PATCH 04/14] libata: implement ata_platform_remove_one() Brian Norris
@ 2012-11-02 11:07 ` Sergei Shtylyov
2012-11-02 19:05 ` Brian Norris
2012-11-02 19:09 ` [PATCH v2 " Brian Norris
1 sibling, 1 reply; 27+ messages in thread
From: Sergei Shtylyov @ 2012-11-02 11:07 UTC (permalink / raw)
To: Brian Norris; +Cc: Jeff Garzik, linux-ide, Tejun Heo
Hello.
On 02-11-2012 11:46, Brian Norris wrote:
> 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 <computersforpeace@gmail.com>
> ---
> drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
> include/linux/libata.h | 4 ++++
> 2 files changed, 27 insertions(+)
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 611050d..820e47f 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
[...]
> @@ -6350,6 +6351,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);
Indent with tabs, not spaces, as below.
> +
> + return 0;
> +}
> +
> static int __init ata_parse_force_one(char **cur,
> struct ata_force_ent *force_ent,
> const char **reason)
MBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/14] ahci/libata: clean up platform device removal
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
` (13 preceding siblings ...)
2012-11-02 7:46 ` [PATCH 14/14] libata: use pci_get_drvdata() helper Brian Norris
@ 2012-11-02 17:01 ` Tejun Heo
2012-11-02 19:03 ` Brian Norris
14 siblings, 1 reply; 27+ messages in thread
From: Tejun Heo @ 2012-11-02 17:01 UTC (permalink / raw)
To: Brian Norris; +Cc: Jeff Garzik, linux-ide, Kevin Cernekee
Hello,
On Fri, Nov 02, 2012 at 12:46:14AM -0700, Brian Norris wrote:
> (1) Allows ahci_platform to unbind a device from the driver. This is useful for
> allowing total power-off of the device, for instance.
> (2) Adds ahci_platform ata_port_operations.host_stop() hook, so that
> platform-device exit() can power down the device at the appropriate point
> in the removal sequence.
> (3) Adds a common ata_platform_remove_one() function so that we don't
> re-implement a simple host detach across many platform drivers
> (4) Switches many platform drivers to the new .remove function from (3)
I personally would have converted all drivers in one patch but I think
either way is fine. Other than the indentation thing, for all patches
in this series.
Acked-by: Tejun Heo <tj@kernel.org>
> P.S. A related but distinct issue: someting is still broken in the
> ata_host_detach() function, for shutting down the host, spinning down disks,
> etc. When I rmmod the driver or unbind the device, I get the following
> failures, and the HDD doesn't spin down:
That's because detaching the driver is handled basically as controller
hot unplug. By the time SCSI is noticing the SCSI devices are going
away, the corresponding ATA devices are already away. It's kinda
natural to implement that way. Is this an actual problem?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/14] ahci/libata: clean up platform device removal
2012-11-02 17:01 ` [PATCH 00/14] ahci/libata: clean up platform device removal Tejun Heo
@ 2012-11-02 19:03 ` Brian Norris
2012-11-02 19:04 ` Tejun Heo
0 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:03 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, Kevin Cernekee
On Fri, Nov 2, 2012 at 10:01 AM, Tejun Heo <tj@kernel.org> wrote:
> On Fri, Nov 02, 2012 at 12:46:14AM -0700, Brian Norris wrote:
>> (1) Allows ahci_platform to unbind a device from the driver. This is useful for
>> allowing total power-off of the device, for instance.
>> (2) Adds ahci_platform ata_port_operations.host_stop() hook, so that
>> platform-device exit() can power down the device at the appropriate point
>> in the removal sequence.
>> (3) Adds a common ata_platform_remove_one() function so that we don't
>> re-implement a simple host detach across many platform drivers
>> (4) Switches many platform drivers to the new .remove function from (3)
>
> I personally would have converted all drivers in one patch but I think
> either way is fine. Other than the indentation thing, for all patches
> in this series.
>
> Acked-by: Tejun Heo <tj@kernel.org>
Thanks. I'll reply to the indentation patch with a v2.
>> P.S. A related but distinct issue: someting is still broken in the
>> ata_host_detach() function, for shutting down the host, spinning down disks,
>> etc. When I rmmod the driver or unbind the device, I get the following
>> failures, and the HDD doesn't spin down:
>
> That's because detaching the driver is handled basically as controller
> hot unplug. By the time SCSI is noticing the SCSI devices are going
> away, the corresponding ATA devices are already away. It's kinda
> natural to implement that way. Is this an actual problem?
Yes. The HDD doesn't spin down. I'm removing the device because I want
some power savings, so I would expect to spin down the disk.
Brian
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 00/14] ahci/libata: clean up platform device removal
2012-11-02 19:03 ` Brian Norris
@ 2012-11-02 19:04 ` Tejun Heo
0 siblings, 0 replies; 27+ messages in thread
From: Tejun Heo @ 2012-11-02 19:04 UTC (permalink / raw)
To: Brian Norris; +Cc: Jeff Garzik, linux-ide, Kevin Cernekee
Hello,
On Fri, Nov 02, 2012 at 12:03:02PM -0700, Brian Norris wrote:
> > That's because detaching the driver is handled basically as controller
> > hot unplug. By the time SCSI is noticing the SCSI devices are going
> > away, the corresponding ATA devices are already away. It's kinda
> > natural to implement that way. Is this an actual problem?
>
> Yes. The HDD doesn't spin down. I'm removing the device because I want
> some power savings, so I would expect to spin down the disk.
Detach the hdds first then. You're essentially yanking out the
controller. The high level driver naturally loses control of the
device before it can do anything about it.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH 04/14] libata: implement ata_platform_remove_one()
2012-11-02 11:07 ` Sergei Shtylyov
@ 2012-11-02 19:05 ` Brian Norris
0 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:05 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Jeff Garzik, linux-ide, Tejun Heo
On Fri, Nov 2, 2012 at 4:07 AM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:
> On 02-11-2012 11:46, Brian Norris wrote:
>
>> 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 <computersforpeace@gmail.com>
>> ---
>> drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
>> include/linux/libata.h | 4 ++++
>> 2 files changed, 27 insertions(+)
>
>
>> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
>> index 611050d..820e47f 100644
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>
> [...]
>
>> @@ -6350,6 +6351,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);
>
>
> Indent with tabs, not spaces, as below.
I need to remind myself to run checkpatch.pl more often. Thanks for
pointing this out. Will send v2. (Also, patch 12 had a pre-existing
indentation problem; I'll fix it for the line I change.)
Brian
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 04/14] libata: implement ata_platform_remove_one()
2012-11-02 7:46 ` [PATCH 04/14] libata: implement ata_platform_remove_one() Brian Norris
2012-11-02 11:07 ` Sergei Shtylyov
@ 2012-11-02 19:09 ` Brian Norris
2012-11-02 19:29 ` [PATCH v3 " Brian Norris
2012-11-02 20:12 ` [PATCH v2 " Sergei Shtylyov
1 sibling, 2 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:09 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Tejun Heo, Brian Norris, Sergei Shtylyov
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 <computersforpeace@gmail.com>
---
v2: fix whitespace
drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
include/linux/libata.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 611050d..7bf1199 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -67,6 +67,7 @@
#include <linux/cdrom.h>
#include <linux/ratelimit.h>
#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
#include "libata.h"
#include "libata-transport.h"
@@ -6350,6 +6351,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)
@@ -6844,6 +6865,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 464e67c..cedcd0f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1103,6 +1103,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
*/
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH v2 12/14] sata_highbank: utilize common ata_platform_remove_one()
2012-11-02 7:46 ` [PATCH 12/14] sata_highbank: " Brian Norris
@ 2012-11-02 19:12 ` Brian Norris
2012-12-03 10:17 ` Jeff Garzik
0 siblings, 1 reply; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:12 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Tejun Heo, Brian Norris, Sergei Shtylyov
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
v2: fix whitespace
drivers/ata/sata_highbank.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 0d7c4c2..64c7276 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -368,16 +368,6 @@ err0:
return rc;
}
-static int __devexit ahci_highbank_remove(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- struct ata_host *host = dev_get_drvdata(dev);
-
- ata_host_detach(host);
-
- return 0;
-}
-
#ifdef CONFIG_PM
static int ahci_highbank_suspend(struct device *dev)
{
@@ -432,7 +422,7 @@ SIMPLE_DEV_PM_OPS(ahci_highbank_pm_ops,
ahci_highbank_suspend, ahci_highbank_resume);
static struct platform_driver ahci_highbank_driver = {
- .remove = __devexit_p(ahci_highbank_remove),
+ .remove = ata_platform_remove_one,
.driver = {
.name = "highbank-ahci",
.owner = THIS_MODULE,
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH v2 04/14] libata: implement ata_platform_remove_one()
2012-11-02 20:12 ` [PATCH v2 " Sergei Shtylyov
@ 2012-11-02 19:29 ` Brian Norris
0 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:29 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Jeff Garzik, linux-ide, Tejun Heo
On 11/02/2012 01:12 PM, Sergei Shtylyov wrote:
> On 11/02/2012 10:09 PM, Brian Norris wrote:
>> @@ -6350,6 +6351,26 @@ int ata_pci_device_resume(struct pci_dev *pdev)
>>
>> #endif /* CONFIG_PCI */
>>
>> +/**
>> + * ata_platform_remove_one- Platform layer callback for device removal
>
> A space before hyphen is needed.
>
>> + * @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).
>> + */
>
> I actually meant indenting with tabs within the comment too. :-)
Ugh, more sloppiness, due to a bad copy&paste job, from
ata_pci_remove_one(). Thanks for keeping your eyes open. v3 coming...
Brian
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 04/14] libata: implement ata_platform_remove_one()
2012-11-02 19:09 ` [PATCH v2 " Brian Norris
@ 2012-11-02 19:29 ` Brian Norris
2012-11-02 20:12 ` [PATCH v2 " Sergei Shtylyov
1 sibling, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-11-02 19:29 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Tejun Heo, linux-ide, Brian Norris, Sergei Shtylyov
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 <computersforpeace@gmail.com>
---
v2: fix whitespace
v3: really fix whitespace. Thanks Sergei.
drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
include/linux/libata.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 611050d..f13fe28 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -67,6 +67,7 @@
#include <linux/cdrom.h>
#include <linux/ratelimit.h>
#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
#include "libata.h"
#include "libata-transport.h"
@@ -6350,6 +6351,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)
@@ -6844,6 +6865,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 464e67c..cedcd0f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1103,6 +1103,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
*/
--
1.7.11.3
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH v2 04/14] libata: implement ata_platform_remove_one()
2012-11-02 19:09 ` [PATCH v2 " Brian Norris
2012-11-02 19:29 ` [PATCH v3 " Brian Norris
@ 2012-11-02 20:12 ` Sergei Shtylyov
2012-11-02 19:29 ` Brian Norris
1 sibling, 1 reply; 27+ messages in thread
From: Sergei Shtylyov @ 2012-11-02 20:12 UTC (permalink / raw)
To: Brian Norris; +Cc: Jeff Garzik, linux-ide, Tejun Heo
On 11/02/2012 10:09 PM, Brian Norris wrote:
> 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 <computersforpeace@gmail.com>
> ---
> v2: fix whitespace
> drivers/ata/libata-core.c | 23 +++++++++++++++++++++++
> include/linux/libata.h | 4 ++++
> 2 files changed, 27 insertions(+)
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 611050d..7bf1199 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
[...]
> @@ -6350,6 +6351,26 @@ int ata_pci_device_resume(struct pci_dev *pdev)
>
> #endif /* CONFIG_PCI */
>
> +/**
> + * ata_platform_remove_one- Platform layer callback for device removal
A space before hyphen is needed.
> + * @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).
> + */
I actually meant indenting with tabs within the comment too. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 12/14] sata_highbank: utilize common ata_platform_remove_one()
2012-11-02 19:12 ` [PATCH v2 " Brian Norris
@ 2012-12-03 10:17 ` Jeff Garzik
2012-12-03 18:12 ` Brian Norris
0 siblings, 1 reply; 27+ messages in thread
From: Jeff Garzik @ 2012-12-03 10:17 UTC (permalink / raw)
To: Brian Norris; +Cc: linux-ide, Tejun Heo, Sergei Shtylyov
On 11/02/2012 03:12 PM, Brian Norris wrote:
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> v2: fix whitespace
>
> drivers/ata/sata_highbank.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
applied patches 1-11
patch #12 failed to apply (even manually), so I stopped there
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 12/14] sata_highbank: utilize common ata_platform_remove_one()
2012-12-03 10:17 ` Jeff Garzik
@ 2012-12-03 18:12 ` Brian Norris
0 siblings, 0 replies; 27+ messages in thread
From: Brian Norris @ 2012-12-03 18:12 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, Tejun Heo, Sergei Shtylyov
On Mon, Dec 3, 2012 at 2:17 AM, Jeff Garzik <jgarzik@pobox.com> wrote:
> On 11/02/2012 03:12 PM, Brian Norris wrote:
>>
>> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
>> ---
>> v2: fix whitespace
>>
>> drivers/ata/sata_highbank.c | 12 +-----------
>> 1 file changed, 1 insertion(+), 11 deletions(-)
>
>
> applied patches 1-11
Thanks.
> patch #12 failed to apply (even manually), so I stopped there
There was just a trivial change to the #ifdef next to the (unrelated,
but adjacent) ahci_highbank_suspend function. I'll resend 12-14, as a
v2 series, plus a (new) compile-error fix for pata_of_platform.
BTW, Tejun posted his "Ack" in reply to the original series. I'll
include it in my version 2 of the original patches, but I noticed you
didn't add it in libata-dev.git.
Brian
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2012-12-03 18:12 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02 7:46 [PATCH 00/14] ahci/libata: clean up platform device removal Brian Norris
2012-11-02 7:46 ` [PATCH 01/14] ahci_platform: enable hotplug unbinding Brian Norris
2012-11-02 7:46 ` [PATCH 02/14] ahci_platform: convert to module_platform_driver Brian Norris
2012-11-02 7:46 ` [PATCH 03/14] ahci_platform: perform platform exit in host_stop() hook Brian Norris
2012-11-02 7:46 ` [PATCH 04/14] libata: implement ata_platform_remove_one() Brian Norris
2012-11-02 11:07 ` Sergei Shtylyov
2012-11-02 19:05 ` Brian Norris
2012-11-02 19:09 ` [PATCH v2 " Brian Norris
2012-11-02 19:29 ` [PATCH v3 " Brian Norris
2012-11-02 20:12 ` [PATCH v2 " Sergei Shtylyov
2012-11-02 19:29 ` Brian Norris
2012-11-02 7:46 ` [PATCH 05/14] ahci_platform: utilize common ata_platform_remove_one() Brian Norris
2012-11-02 7:46 ` [PATCH 06/14] pata_ixp4xx_cf: " Brian Norris
2012-11-02 7:46 ` [PATCH 07/14] pata_mpc52xx: " Brian Norris
2012-11-02 7:46 ` [PATCH 08/14] pata_of_platform: " Brian Norris
2012-11-02 7:46 ` [PATCH 09/14] pata_platform: " Brian Norris
2012-11-02 7:46 ` [PATCH 10/14] ata_platform: remove unused remove function Brian Norris
2012-11-02 7:46 ` [PATCH 11/14] pata_palmld: utilize common ata_platform_remove_one() Brian Norris
2012-11-02 7:46 ` [PATCH 12/14] sata_highbank: " Brian Norris
2012-11-02 19:12 ` [PATCH v2 " Brian Norris
2012-12-03 10:17 ` Jeff Garzik
2012-12-03 18:12 ` Brian Norris
2012-11-02 7:46 ` [PATCH 13/14] pata_octeon_cf: perform host detach, removal on exit Brian Norris
2012-11-02 7:46 ` [PATCH 14/14] libata: use pci_get_drvdata() helper Brian Norris
2012-11-02 17:01 ` [PATCH 00/14] ahci/libata: clean up platform device removal Tejun Heo
2012-11-02 19:03 ` Brian Norris
2012-11-02 19:04 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).