Skip to content

Commit

Permalink
libata: implement ata_platform_remove_one()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Brian Norris authored and Jeff Garzik committed Dec 3, 2012
1 parent 1896b15 commit b7db04d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions include/linux/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit b7db04d

Please sign in to comment.