This patch adds a new dummy bus 'ata', which collects all ata device
objects like ata_port, ata_link, and ata_dev, and adds an 'ata' prefix
to the message log.
To be consistent with the other libata objects the 'ata_port' object name
has been changed from 'ata' to 'port'.
Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
drivers/ata/libata-transport.c | 21 +++++++++++--
include/linux/libata.h | 54 ++++++++++------------------------
2 files changed, 34 insertions(+), 41 deletions(-)
diff --git a/drivers/ata/libata-transport.c
b/drivers/ata/libata-transport.c
index ca129854a88c..555fe6e2293d 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -81,10 +81,13 @@ struct ata_internal {
tdev_to_port((dev)->parent)
-/* Device objects are always created whit link objects */
+/* Device objects are always created with link objects */
static int ata_tdev_add(struct ata_device *dev);
static void ata_tdev_delete(struct ata_device *dev);
+struct bus_type ata_bus_type = {
+ .name = "ata",
+};
/*
* Hack to allow attributes of the same name in different objects.
@@ -288,7 +291,9 @@ int ata_tport_add(struct device *parent,
dev->parent = parent;
ata_host_get(ap->host);
dev->release = ata_tport_release;
- dev_set_name(dev, "ata%d", ap->print_id);
+ dev->bus = &ata_bus_type;
+ dev_set_name(dev, "port%d", ap->print_id);
+
transport_setup_device(dev);
ata_acpi_bind_port(ap);
error = device_add(dev);
@@ -444,6 +449,8 @@ int ata_tlink_add(struct ata_link *link)
device_initialize(dev);
dev->parent = &ap->tdev;
dev->release = ata_tlink_release;
+ dev->bus = &ata_bus_type;
+
if (ata_is_host_link(link))
dev_set_name(dev, "link%d", ap->print_id);
else
@@ -695,8 +702,10 @@ static int ata_tdev_add(struct ata_device *ata_dev)
device_initialize(dev);
dev->parent = &link->tdev;
dev->release = ata_tdev_release;
+ dev->bus = &ata_bus_type;
+
if (ata_is_host_link(link))
- dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);
+ dev_set_name(dev, "dev%d.%d", ap->print_id, ata_dev->devno);
else
dev_set_name(dev, "dev%d.%d.0", ap->print_id, link->pmp);
@@ -822,8 +831,13 @@ __init int libata_transport_init(void)
error = transport_class_register(&ata_dev_class);
if (error)
goto out_unregister_port;
+ error = bus_register(&ata_bus_type);
+ if (error)
+ goto out_unregister_bus;