Skip to content

Commit f212246

Browse files
hkallweitfloatious
authored andcommitted
ata: libata-transport: inline ata_attach|release_transport
Both functions are helpers which are used only once. So remove them and merge their code into libata_transport_init() and libata_transport_exit() respectively. Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Niklas Cassel <cassel@kernel.org>
1 parent ee1ed7a commit f212246

3 files changed

Lines changed: 11 additions & 28 deletions

File tree

drivers/ata/libata-core.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6778,7 +6778,6 @@ static int __init ata_init(void)
67786778
}
67796779

67806780
libata_transport_init();
6781-
ata_scsi_transport_template = ata_attach_transport();
67826781

67836782
printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
67846783

@@ -6787,7 +6786,6 @@ static int __init ata_init(void)
67876786

67886787
static void __exit ata_exit(void)
67896788
{
6790-
ata_release_transport();
67916789
libata_transport_exit();
67926790
ata_sff_exit();
67936791
ata_free_force_param();

drivers/ata/libata-transport.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -766,29 +766,6 @@ static struct ata_internal ata_transport_internal = {
766766
* Setup / Teardown code
767767
*/
768768

769-
/**
770-
* ata_attach_transport -- instantiate ATA transport template
771-
*/
772-
struct scsi_transport_template *ata_attach_transport(void)
773-
{
774-
transport_container_register(&ata_transport_internal.t.host_attrs);
775-
transport_container_register(&ata_transport_internal.link_attr_cont);
776-
transport_container_register(&ata_transport_internal.dev_attr_cont);
777-
778-
return &ata_transport_internal.t;
779-
}
780-
781-
/**
782-
* ata_release_transport -- release ATA transport template instance
783-
* @t: transport template instance
784-
*/
785-
void ata_release_transport(void)
786-
{
787-
transport_container_unregister(&ata_transport_internal.t.host_attrs);
788-
transport_container_unregister(&ata_transport_internal.link_attr_cont);
789-
transport_container_unregister(&ata_transport_internal.dev_attr_cont);
790-
}
791-
792769
__init int libata_transport_init(void)
793770
{
794771
int error;
@@ -802,6 +779,13 @@ __init int libata_transport_init(void)
802779
error = transport_class_register(&ata_dev_class);
803780
if (error)
804781
goto out_unregister_port;
782+
783+
transport_container_register(&ata_transport_internal.t.host_attrs);
784+
transport_container_register(&ata_transport_internal.link_attr_cont);
785+
transport_container_register(&ata_transport_internal.dev_attr_cont);
786+
787+
ata_scsi_transport_template = &ata_transport_internal.t;
788+
805789
return 0;
806790

807791
out_unregister_port:
@@ -815,6 +799,10 @@ __init int libata_transport_init(void)
815799

816800
void __exit libata_transport_exit(void)
817801
{
802+
transport_container_unregister(&ata_transport_internal.t.host_attrs);
803+
transport_container_unregister(&ata_transport_internal.link_attr_cont);
804+
transport_container_unregister(&ata_transport_internal.dev_attr_cont);
805+
818806
transport_class_unregister(&ata_link_class);
819807
transport_class_unregister(&ata_port_class);
820808
transport_class_unregister(&ata_dev_class);

drivers/ata/libata-transport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ extern struct scsi_transport_template *ata_scsi_transport_template;
88
int ata_tlink_add(struct ata_link *link);
99
void ata_tlink_delete(struct ata_link *link);
1010

11-
struct scsi_transport_template *ata_attach_transport(void);
12-
void ata_release_transport(void);
13-
1411
__init int libata_transport_init(void);
1512
void __exit libata_transport_exit(void);
1613
#endif

0 commit comments

Comments
 (0)