Now when we have removed support for decreasing the number of ports, the most logical thing is to assign local_port_no at the same location(s) where we assign port_no. Note that we cannot move the local_port_no assignment to ata_port_alloc(), because not all users of ata_port_alloc() assigns local_port_no (i.e. ata_sas_port_alloc()). I have no idea what local_port_no is actually used for, but at least there should be no functional changes caused by this commit. Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx> --- drivers/ata/libata-core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index fb4835c2ba2d..ee1a75bc0466 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5591,6 +5591,7 @@ struct ata_host *ata_host_alloc(struct device *dev, int n_ports) goto err_out; ap->port_no = i; + ap->local_port_no = i + 1; host->ports[i] = ap; } @@ -5902,10 +5903,6 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh for (i = host->n_ports; host->ports[i]; i++) WARN_ON(host->ports[i]); - /* give ports names and add SCSI hosts */ - for (i = 0; i < host->n_ports; i++) - host->ports[i]->local_port_no = i + 1; - /* Create associated sysfs transport objects */ for (i = 0; i < host->n_ports; i++) { rc = ata_tport_add(host->dev,host->ports[i]); -- 2.45.2