From: Heiner Kallweit <hkallweit1@gmail.com>
To: Damien Le Moal <dlemoal@kernel.org>, Niklas Cassel <cassel@kernel.org>
Cc: linux-ide@vger.kernel.org
Subject: [PATCH v2 4/5] ata: libata-transport: split struct ata_internal
Date: Thu, 2 Apr 2026 15:31:22 +0200 [thread overview]
Message-ID: <91a152e2-a29a-4ea4-9bab-5f9e61510a3e@gmail.com> (raw)
In-Reply-To: <93fc6c62-ed8c-4953-ad7b-522031bb7ed9@gmail.com>
There's no need for an umbrella struct, so remove it. It's also a
prerequisite for making the embedded struct scsi_transport_template
public.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/ata/libata-transport.c | 53 ++++++++++++++++------------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 68ae57a89..538743e88 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -40,13 +40,6 @@
struct scsi_transport_template;
struct scsi_transport_template *ata_scsi_transport_template;
-struct ata_internal {
- struct scsi_transport_template t;
-
- struct transport_container link_attr_cont;
- struct transport_container dev_attr_cont;
-};
-
static int ata_tlink_match(struct attribute_container *cont,
struct device *dev);
static int ata_tdev_match(struct attribute_container *cont,
@@ -729,21 +722,25 @@ int ata_tlink_add(struct ata_link *link)
return error;
}
-static struct ata_internal ata_transport_internal = {
- .t.eh_strategy_handler = ata_scsi_error,
- .t.user_scan = ata_scsi_user_scan,
+static struct scsi_transport_template ata_scsi_transportt = {
+ .eh_strategy_handler = ata_scsi_error,
+ .user_scan = ata_scsi_user_scan,
- .t.host_attrs.ac.class = &ata_port_class.class,
- .t.host_attrs.ac.grp = &ata_port_attr_group,
- .t.host_attrs.ac.match = ata_tport_match,
+ .host_attrs.ac.class = &ata_port_class.class,
+ .host_attrs.ac.grp = &ata_port_attr_group,
+ .host_attrs.ac.match = ata_tport_match,
+};
- .link_attr_cont.ac.class = &ata_link_class.class,
- .link_attr_cont.ac.grp = &ata_link_attr_group,
- .link_attr_cont.ac.match = ata_tlink_match,
+static struct transport_container ata_link_attr_cont = {
+ .ac.class = &ata_link_class.class,
+ .ac.grp = &ata_link_attr_group,
+ .ac.match = ata_tlink_match,
+};
- .dev_attr_cont.ac.class = &ata_dev_class.class,
- .dev_attr_cont.ac.grp = &ata_device_attr_group,
- .dev_attr_cont.ac.match = ata_tdev_match,
+static struct transport_container ata_dev_attr_cont = {
+ .ac.class = &ata_dev_class.class,
+ .ac.grp = &ata_device_attr_group,
+ .ac.match = ata_tdev_match,
};
static int ata_tlink_match(struct attribute_container *cont,
@@ -752,7 +749,7 @@ static int ata_tlink_match(struct attribute_container *cont,
if (!ata_is_link(dev))
return 0;
- return &ata_transport_internal.link_attr_cont.ac == cont;
+ return &ata_link_attr_cont.ac == cont;
}
static int ata_tdev_match(struct attribute_container *cont,
@@ -761,7 +758,7 @@ static int ata_tdev_match(struct attribute_container *cont,
if (!ata_is_ata_dev(dev))
return 0;
- return &ata_transport_internal.dev_attr_cont.ac == cont;
+ return &ata_dev_attr_cont.ac == cont;
}
/*
@@ -782,11 +779,11 @@ __init int libata_transport_init(void)
if (error)
goto out_unregister_port;
- transport_container_register(&ata_transport_internal.t.host_attrs);
- transport_container_register(&ata_transport_internal.link_attr_cont);
- transport_container_register(&ata_transport_internal.dev_attr_cont);
+ transport_container_register(&ata_scsi_transportt.host_attrs);
+ transport_container_register(&ata_link_attr_cont);
+ transport_container_register(&ata_dev_attr_cont);
- ata_scsi_transport_template = &ata_transport_internal.t;
+ ata_scsi_transport_template = &ata_scsi_transportt;
return 0;
@@ -801,9 +798,9 @@ __init int libata_transport_init(void)
void __exit libata_transport_exit(void)
{
- transport_container_unregister(&ata_transport_internal.t.host_attrs);
- transport_container_unregister(&ata_transport_internal.link_attr_cont);
- transport_container_unregister(&ata_transport_internal.dev_attr_cont);
+ transport_container_unregister(&ata_scsi_transportt.host_attrs);
+ transport_container_unregister(&ata_link_attr_cont);
+ transport_container_unregister(&ata_dev_attr_cont);
transport_class_unregister(&ata_link_class);
transport_class_unregister(&ata_port_class);
--
2.53.0
next prev parent reply other threads:[~2026-04-02 13:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 13:28 [PATCH v2 0/5] ata: libata-transport: series with further refactorings Heiner Kallweit
2026-04-02 13:29 ` [PATCH v2 1/5] ata: libata-transport: instantiate struct ata_internal statically Heiner Kallweit
2026-04-02 13:30 ` [PATCH v2 2/5] ata: libata-transport: inline ata_attach|release_transport Heiner Kallweit
2026-04-02 13:30 ` [PATCH v2 3/5] ata: libata-transport: use static struct ata_transport_internal to simplify match functions Heiner Kallweit
2026-04-02 13:31 ` Heiner Kallweit [this message]
2026-04-02 13:32 ` [PATCH v2 5/5] ata: libata-transport: remove static variable ata_scsi_transport_template Heiner Kallweit
2026-04-02 19:03 ` [PATCH v2 0/5] ata: libata-transport: series with further refactorings Niklas Cassel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91a152e2-a29a-4ea4-9bab-5f9e61510a3e@gmail.com \
--to=hkallweit1@gmail.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox