summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2024-07-03 20:44:22 +0200
committerNiklas Cassel <cassel@kernel.org>2024-07-04 11:52:32 +0200
commit1dd63a6b573ffb989ca618e60b6469f885454606 (patch)
tree7f39c301d59bad4fcd55c901c5a77586b56fa1ff /drivers/ata
parent6933eb8e50a3e4dc129095cb795261454476f111 (diff)
downloadlinux-1dd63a6b573ffb989ca618e60b6469f885454606.tar.gz
linux-1dd63a6b573ffb989ca618e60b6469f885454606.tar.bz2
linux-1dd63a6b573ffb989ca618e60b6469f885454606.zip
ata: libata-core: Remove local_port_no struct member
ap->local_port_no is simply ap->port_no + 1. Since ap->local_port_no can be derived from ap->port_no, there is no need for the ap->local_port_no struct member, so remove ap->local_port_no. Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240703184418.723066-16-cassel@kernel.org Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-core.c5
-rw-r--r--drivers/ata/libata-transport.c3
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d2d397964be4..68a75483822e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5471,7 +5471,6 @@ 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;
@@ -5909,10 +5908,8 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh
}
/* 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++) {
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index d24f201c0ab2..9e24c33388f9 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -217,7 +217,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_ata_port_##name, NULL)
ata_port_simple_attr(nr_pmp_links, nr_pmp_links, "%d\n", int);
ata_port_simple_attr(stats.idle_irq, idle_irq, "%ld\n", unsigned long);
-ata_port_simple_attr(local_port_no, port_no, "%u\n", unsigned int);
+/* We want the port_no sysfs attibute to start at 1 (ap->port_no starts at 0) */
+ata_port_simple_attr(port_no + 1, port_no, "%u\n", unsigned int);
static DECLARE_TRANSPORT_CLASS(ata_port_class,
"ata_port", NULL, NULL, NULL);