[PATCH v2 5/5] ata: libata-transport: remove static variable ata_scsi_transport_template

Heiner Kallweit
2026-04-02T13:32:16Z

Simplify the code by making struct ata_scsi_transportt public, instead
of using separate variable ata_scsi_transport_template.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/ata/libata-scsi.c | 2 +-
drivers/ata/libata-transport.c | 9 ++-------
drivers/ata/libata-transport.h | 2 +-
3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 06f3a243f..b15830bed 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4624,7 +4624,7 @@ int ata_scsi_add_hosts(struct ata_host *host, const struct scsi_host_template *s
*(struct ata_port **)&shost->hostdata[0] = ap;
ap->scsi_host = shost;

- shost->transportt = ata_scsi_transport_template;
+ shost->transportt = &ata_scsi_transportt;
shost->unique_id = ap->print_id;
shost->max_id = 16;
shost->max_lun = 1;
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 538743e88..adf38e4bb 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -37,9 +37,6 @@
#include "libata.h"
#include "libata-transport.h"

-struct scsi_transport_template;
-struct scsi_transport_template *ata_scsi_transport_template;
-
static int ata_tlink_match(struct attribute_container *cont,
struct device *dev);
static int ata_tdev_match(struct attribute_container *cont,
@@ -224,7 +221,7 @@ static int ata_tport_match(struct attribute_container *cont,
{
if (!ata_is_port(dev))
return 0;
- return &ata_scsi_transport_template->host_attrs.ac == cont;
+ return &ata_scsi_transportt.host_attrs.ac == cont;
}

/**
@@ -722,7 +719,7 @@ int ata_tlink_add(struct ata_link *link)
return error;
}

-static struct scsi_transport_template ata_scsi_transportt = {
+struct scsi_transport_template ata_scsi_transportt = {
.eh_strategy_handler = ata_scsi_error,
.user_scan = ata_scsi_user_scan,

@@ -783,8 +780,6 @@ __init int libata_transport_init(void)
transport_container_register(&ata_link_attr_cont);
transport_container_register(&ata_dev_attr_cont);

- ata_scsi_transport_template = &ata_scsi_transportt;
-
return 0;

out_unregister_port:
diff --git a/drivers/ata/libata-transport.h b/drivers/ata/libata-transport.h
index fe5ca66fc..629ac843a 100644
--- a/drivers/ata/libata-transport.h
+++ b/drivers/ata/libata-transport.h
@@ -3,7 +3,7 @@
#define _LIBATA_TRANSPORT_H

-extern struct scsi_transport_template *ata_scsi_transport_template;
+extern struct scsi_transport_template ata_scsi_transportt;

int ata_tlink_add(struct ata_link *link);
void ata_tlink_delete(struct ata_link *link);
--
2.53.0