mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] USB: storage: register disks as usbdiskx symlink
Date: Fri, 18 Oct 2013 18:33:12 +0200	[thread overview]
Message-ID: <1382113992-9082-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1382113992-9082-1-git-send-email-plagnioj@jcrosoft.com>

From: Sascha Hauer <s.hauer@pengutronix.de>

To better identify them as USB storage devices. Also make the
info message look nicer.

We keep the old disk%d to do not brake backword compatibility for env.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/usb/storage/usb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index e4b08b9..6833983 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -25,6 +25,7 @@
 #include <scsi.h>
 #include <usb/usb.h>
 #include <usb/usb_defs.h>
+#include <linux/err.h>
 
 #undef USB_STOR_DEBUG
 
@@ -376,6 +377,7 @@ static int usb_stor_add_blkdev(struct us_data *us, struct device_d *dev,
 							unsigned char lun)
 {
 	struct us_blk_dev *pblk_dev;
+	struct cdev *cdev;
 	int result;
 
 	/* allocate a new USB block device */
@@ -406,6 +408,12 @@ static int usb_stor_add_blkdev(struct us_data *us, struct device_d *dev,
 		goto BadDevice;
 	}
 
+	cdev = devfs_add_symlink_index("usbdisk", &pblk_dev->blk.cdev);
+	if (IS_ERR(cdev))
+		dev_warn(dev, "Cannot create symlink usbdisk\n");
+	else
+		dev_info(dev, "registered /dev/%s\n", cdev->name);
+
 	/* create partitions on demand */
 	result = parse_partition_table(&pblk_dev->blk);
 	if (result != 0)
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-10-18 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 16:31 [PATCH 0/3] devfs: add symlink support Jean-Christophe PLAGNIOL-VILLARD
2013-10-18 16:33 ` [PATCH 1/3] " Jean-Christophe PLAGNIOL-VILLARD
2013-10-18 16:33   ` [PATCH 2/3] partition: use symlink for named partition Jean-Christophe PLAGNIOL-VILLARD
2013-10-18 16:33   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-10-21  8:42   ` [PATCH 1/3] devfs: add symlink support Sascha Hauer

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=1382113992-9082-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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