[PATCH 1/9] ata: register disks as /dev/ata*

Sascha Hauer s.hauer at pengutronix.de
Thu Dec 6 08:34:22 EST 2012


Using /dev/disk* for every type of device is not helpful. It increases
the chance that the user doesn't know which file corresponds to which
device. So rename ata device files to /dev/ata*. Also add a dev_info
about which device just has been registered.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/ata/disk_ata_drive.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c
index 6bb72a9..303d6d0 100644
--- a/drivers/ata/disk_ata_drive.c
+++ b/drivers/ata/disk_ata_drive.c
@@ -572,12 +572,12 @@ int register_ata_drive(struct device_d *dev, struct ata_ioports *io)
 #ifdef DEBUG
 	ata_dump_id(drive->id);
 #endif
-	rc = cdev_find_free_index("disk");
+	rc = cdev_find_free_index("ata");
 	if (rc == -1)
 		pr_err("Cannot find a free index for the disk node\n");
 
 	drive->blk.num_blocks = ata_id_n_sectors(drive->id);
-	drive->blk.cdev.name = asprintf("disk%d", rc);
+	drive->blk.cdev.name = asprintf("ata%d", rc);
 	drive->blk.blockbits = SECTOR_SHIFT;
 
 	rc = blockdevice_register(&drive->blk);
@@ -586,6 +586,8 @@ int register_ata_drive(struct device_d *dev, struct ata_ioports *io)
 		goto on_error;
 	}
 
+	dev_info(dev, "registered /dev/%s\n", port->blk.cdev.name);
+
 	/* create partitions on demand */
 	rc = parse_partition_table(&drive->blk);
 	if (rc != 0)
-- 
1.7.10.4




More information about the barebox mailing list