Skip to content

Commit 1dd63a6

Browse files
committed
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 <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Niklas Cassel <[email protected]>
1 parent 6933eb8 commit 1dd63a6

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

drivers/ata/libata-core.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5471,7 +5471,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
54715471
ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
54725472
ap->lock = &host->lock;
54735473
ap->print_id = -1;
5474-
ap->local_port_no = -1;
54755474
ap->host = host;
54765475
ap->dev = host->dev;
54775476

@@ -5909,10 +5908,8 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh
59095908
}
59105909

59115910
/* give ports names and add SCSI hosts */
5912-
for (i = 0; i < host->n_ports; i++) {
5911+
for (i = 0; i < host->n_ports; i++)
59135912
host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
5914-
host->ports[i]->local_port_no = i + 1;
5915-
}
59165913

59175914
/* Create associated sysfs transport objects */
59185915
for (i = 0; i < host->n_ports; i++) {

drivers/ata/libata-transport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_ata_port_##name, NULL)
217217

218218
ata_port_simple_attr(nr_pmp_links, nr_pmp_links, "%d\n", int);
219219
ata_port_simple_attr(stats.idle_irq, idle_irq, "%ld\n", unsigned long);
220-
ata_port_simple_attr(local_port_no, port_no, "%u\n", unsigned int);
220+
/* We want the port_no sysfs attibute to start at 1 (ap->port_no starts at 0) */
221+
ata_port_simple_attr(port_no + 1, port_no, "%u\n", unsigned int);
221222

222223
static DECLARE_TRANSPORT_CLASS(ata_port_class,
223224
"ata_port", NULL, NULL, NULL);

include/linux/libata.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,6 @@ struct ata_port {
814814
/* Flags that change dynamically, protected by ap->lock */
815815
unsigned int pflags; /* ATA_PFLAG_xxx */
816816
unsigned int print_id; /* user visible unique port ID */
817-
unsigned int local_port_no; /* host local port num */
818817
unsigned int port_no; /* 0 based port no. inside the host */
819818

820819
#ifdef CONFIG_ATA_SFF

0 commit comments

Comments
 (0)