diff mbox

[v2,04/14] libata: implement ata_platform_remove_one()

Message ID 1351883393-32354-1-git-send-email-computersforpeace@gmail.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Brian Norris Nov. 2, 2012, 7:09 p.m. UTC
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(+)

Comments

Brian Norris Nov. 2, 2012, 7:29 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Nov. 2, 2012, 8:12 p.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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
  */