mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ahci_platform: perform platform exit in host_stop() hook
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> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
9a99e4768a
commit
1896b15edd
|
|
@ -25,6 +25,8 @@
|
||||||
#include <linux/ahci_platform.h>
|
#include <linux/ahci_platform.h>
|
||||||
#include "ahci.h"
|
#include "ahci.h"
|
||||||
|
|
||||||
|
static void ahci_host_stop(struct ata_host *host);
|
||||||
|
|
||||||
enum ahci_type {
|
enum ahci_type {
|
||||||
AHCI, /* standard platform ahci */
|
AHCI, /* standard platform ahci */
|
||||||
IMX53_AHCI, /* ahci on i.mx53 */
|
IMX53_AHCI, /* ahci on i.mx53 */
|
||||||
|
|
@ -47,6 +49,15 @@ static struct platform_device_id ahci_devtype[] = {
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(platform, 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[] = {
|
static const struct ata_port_info ahci_port_info[] = {
|
||||||
/* by features */
|
/* by features */
|
||||||
|
|
@ -54,20 +65,20 @@ static const struct ata_port_info ahci_port_info[] = {
|
||||||
.flags = AHCI_FLAG_COMMON,
|
.flags = AHCI_FLAG_COMMON,
|
||||||
.pio_mask = ATA_PIO4,
|
.pio_mask = ATA_PIO4,
|
||||||
.udma_mask = ATA_UDMA6,
|
.udma_mask = ATA_UDMA6,
|
||||||
.port_ops = &ahci_ops,
|
.port_ops = &ahci_platform_ops,
|
||||||
},
|
},
|
||||||
[IMX53_AHCI] = {
|
[IMX53_AHCI] = {
|
||||||
.flags = AHCI_FLAG_COMMON,
|
.flags = AHCI_FLAG_COMMON,
|
||||||
.pio_mask = ATA_PIO4,
|
.pio_mask = ATA_PIO4,
|
||||||
.udma_mask = ATA_UDMA6,
|
.udma_mask = ATA_UDMA6,
|
||||||
.port_ops = &ahci_pmp_retry_srst_ops,
|
.port_ops = &ahci_platform_retry_srst_ops,
|
||||||
},
|
},
|
||||||
[STRICT_AHCI] = {
|
[STRICT_AHCI] = {
|
||||||
AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
|
AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
|
||||||
.flags = AHCI_FLAG_COMMON,
|
.flags = AHCI_FLAG_COMMON,
|
||||||
.pio_mask = ATA_PIO4,
|
.pio_mask = ATA_PIO4,
|
||||||
.udma_mask = ATA_UDMA6,
|
.udma_mask = ATA_UDMA6,
|
||||||
.port_ops = &ahci_ops,
|
.port_ops = &ahci_platform_ops,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -221,12 +232,19 @@ static int __devinit ahci_probe(struct platform_device *pdev)
|
||||||
static int __devexit ahci_remove(struct platform_device *pdev)
|
static int __devexit ahci_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct ahci_platform_data *pdata = dev_get_platdata(dev);
|
|
||||||
struct ata_host *host = dev_get_drvdata(dev);
|
struct ata_host *host = dev_get_drvdata(dev);
|
||||||
struct ahci_host_priv *hpriv = host->private_data;
|
|
||||||
|
|
||||||
ata_host_detach(host);
|
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)
|
if (pdata && pdata->exit)
|
||||||
pdata->exit(dev);
|
pdata->exit(dev);
|
||||||
|
|
||||||
|
|
@ -234,8 +252,6 @@ static int __devexit ahci_remove(struct platform_device *pdev)
|
||||||
clk_disable_unprepare(hpriv->clk);
|
clk_disable_unprepare(hpriv->clk);
|
||||||
clk_put(hpriv->clk);
|
clk_put(hpriv->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user