Skip to content

ahci/libata: clean up platform device removal

Brian Norris linux-ide 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14ahci_platform: enable hotplug unbindingdrivers/ata/ahci_platform.c+3 -20 replies
2/14ahci_platform: convert to module_platform_driverdrivers/ata/ahci_platform.c+1 -120 replies
3/14ahci_platform: perform platform exit in host_stop() hookdrivers/ata/ahci_platform.c+23 -70 replies
4/14libata: implement ata_platform_remove_one()drivers/ata/libata-core.c include/linux/libata.h+27 -06 replies
5/14ahci_platform: utilize common ata_platform_remove_one()drivers/ata/ahci_platform.c+1 -110 replies
6/14pata_ixp4xx_cf: utilize common ata_platform_remove_one()drivers/ata/pata_ixp4xx_cf.c+1 -100 replies
7/14pata_mpc52xx: utilize common ata_platform_remove_one()drivers/ata/pata_mpc52xx.c+3 -140 replies
8/14pata_of_platform: utilize common ata_platform_remove_one()drivers/ata/pata_of_platform.c+1 -60 replies
9/14pata_platform: utilize common ata_platform_remove_one()drivers/ata/pata_platform.c+1 -60 replies
10/14ata_platform: remove unused remove functiondrivers/ata/pata_platform.c include/linux/ata_platform.h+0 -190 replies
11/14pata_palmld: utilize common ata_platform_remove_one()drivers/ata/pata_palmld.c+1 -30 replies
12/14sata_highbank: utilize common ata_platform_remove_one()drivers/ata/sata_highbank.c+1 -113 replies
13/14pata_octeon_cf: perform host detach, removal on exitdrivers/ata/pata_octeon_cf.c+1 -00 replies
14/14libata: use pci_get_drvdata() helperdrivers/ata/libata-core.c+3 -40 replies

Reviews trailers per patch

None of the 14 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchTejun Heo
SeriesA-b
1/14
2/14
3/14
4/14
5/14
6/14
7/14
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] ahci/libata: clean up platform device removal

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(-)
Signature · 1 line
1.7.11.3