summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorDavid Milburn <dmilburn@redhat.com>2013-05-14 13:48:40 -0500
committerTejun Heo <tj@kernel.org>2013-05-14 11:44:07 -0700
commite628dc999e43a9dd51fb6bd810772c277f934484 (patch)
treed950d81c8a2351ae0f12cc5cb45a7f6222dadc98 /drivers/ata/libata-core.c
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
downloadblackbird-obmc-linux-e628dc999e43a9dd51fb6bd810772c277f934484.tar.gz
blackbird-obmc-linux-e628dc999e43a9dd51fb6bd810772c277f934484.zip
libata: export ata_port port_no attribute via /sys
While registering host controller track port number based upon number of ports available on the controller, export port_no attribute through /sys. This patch is needed by udev for composing persistent links in /dev/disk/by-path. /sys/devices/pci0000:00/0000:00:1f.2/ata8/ata_port/ata8 total 0 lrwxrwxrwx. 1 root root 0 Mar 6 12:43 device -> ../../../ata8 -r--r--r--. 1 root root 4096 Mar 6 12:43 idle_irq -r--r--r--. 1 root root 4096 Mar 6 12:43 nr_pmp_links -r--r--r--. 1 root root 4096 Mar 6 12:43 port_no drwxr-xr-x. 2 root root 0 Mar 6 12:42 power lrwxrwxrwx. 1 root root 0 Mar 6 12:41 subsystem -> ../../../../../../class/ata_port -rw-r--r--. 1 root root 4096 Mar 6 12:40 uevent 1 Signed-off-by: David Milburn <dmilburn@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 63c743baf920..5f7d5f9ee820 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5636,6 +5636,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
ap->lock = &host->lock;
ap->print_id = -1;
+ ap->local_port_no = -1;
ap->host = host;
ap->dev = host->dev;
@@ -6126,9 +6127,10 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
kfree(host->ports[i]);
/* give ports names and add SCSI hosts */
- for (i = 0; i < host->n_ports; i++)
+ for (i = 0; i < host->n_ports; i++) {
host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
-
+ host->ports[i]->local_port_no = i + 1;
+ }
/* Create associated sysfs transport objects */
for (i = 0; i < host->n_ports; i++) {
OpenPOWER on IntegriCloud