From: "Sascha Hauer" <s.hauer@pengutronix.de>
To: chalianis1@gmail.com
Cc: barebox@lists.infradead.org, Anis Chali <anis.chali@ro-main.com>
Subject: Re: [PATCH] usb: storage: make disk cdev name configurable via Kconfig
Date: Tue, 30 Jun 2026 12:41:33 +0000 [thread overview]
Message-ID: <E1weXmP-00000008Ed1-0ycK@pty.whiteo.stw.pengutronix.de> (raw)
In-Reply-To: <20260623142646.87173-1-chalianis1@gmail.com>
Hi,
On 2026-06-23 10:26, chalianis1 wrote:
> From: Anis Chali <anis.chali@ro-main.com>
>
> Add USBDISK_NAME string option to allow customizing the USB storage
> device name, defaulting to "disk" to preserve existing behaviour.
I just sent a patch which registers USB storage devices with usbdiskx
which doesn't require compile time changes. I hope that suits your needs
as well.
Sascha
>
> Signed-off-by: Anis Chali <anis.chali@ro-main.com>
> ---
> drivers/usb/storage/Kconfig | 5 +++++
> drivers/usb/storage/usb.c | 6 +++---
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
> index efca9874d5..90a62a9d24 100644
> --- a/drivers/usb/storage/Kconfig
> +++ b/drivers/usb/storage/Kconfig
> @@ -2,3 +2,8 @@
> config USB_STORAGE
> tristate "USB Mass Storage support"
> select DISK
> +
> +config USBDISK_NAME
> + string "USB storage disk name"
> + depends on USB_STORAGE
> + default "disk"
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index b3116dc6e6..b6944f531d 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -414,12 +414,12 @@ static int usb_stor_add_blkdev(struct us_data *us, unsigned char lun)
> if (result < 0)
> goto BadDevice;
>
> - result = cdev_find_free_index("disk");
> + result = cdev_find_free_index(CONFIG_USBDISK_NAME);
> if (result == -1)
> pr_err("Cannot find a free number for the disk node\n");
> - dev_info(dev, "registering as disk%d\n", result);
> + dev_info(dev, "registering as %s%d\n", CONFIG_USBDISK_NAME, result);
>
> - pblk_dev->blk.cdev.name = basprintf("disk%d", result);
> + pblk_dev->blk.cdev.name = basprintf("%s%d", CONFIG_USBDISK_NAME, result);
> pblk_dev->blk.blockbits = SECTOR_SHIFT;
> pblk_dev->blk.type = BLK_TYPE_USB;
> pblk_dev->blk.removable = true;
> --
> 2.54.0
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-06-30 12:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 14:26 chalianis1
2026-06-30 12:41 ` Sascha Hauer [this message]
2026-07-07 5:57 ` [PATCH] USB: make storage device name configurable chalianis1
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=E1weXmP-00000008Ed1-0ycK@pty.whiteo.stw.pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=anis.chali@ro-main.com \
--cc=barebox@lists.infradead.org \
--cc=chalianis1@gmail.com \
/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