All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UBI: block: Configurable device major number
@ 2015-01-14 20:40 Dan Ehrenberg
  2015-01-15 18:52 ` Daniel Ehrenberg
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Ehrenberg @ 2015-01-14 20:40 UTC (permalink / raw)
  To: Brian Norris; +Cc: grundler, gwendal, linux-mtd, ezequiel, Dan Ehrenberg

By default UBI block devices use a dynamic major number. This
config option can replace that with a static major number. Set
to the new major number, or 0 for dynamic. This is useful if
you want to use an ubiblock as the root filesystem in an
indirect way, e.g., though DM and need to refer to it before
userspace is up.

Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
---
 drivers/mtd/ubi/Kconfig | 13 +++++++++++++
 drivers/mtd/ubi/block.c |  7 ++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig
index f0855ce..5ac8d63 100644
--- a/drivers/mtd/ubi/Kconfig
+++ b/drivers/mtd/ubi/Kconfig
@@ -103,4 +103,17 @@ config MTD_UBI_BLOCK
 
 	   If in doubt, say "N".
 
+config MTD_UBI_BLOCK_MAJOR
+	int "Major device number for UBI block devices"
+	default 0
+	range 0 256
+	depends on MTD_UBI_BLOCK
+	help
+	   By default UBI block devices use a dynamic major number. This
+	   config option can replace that with a static major number. Set
+	   to the new major number, or 0 for dynamic. This is useful if
+	   you want to use an ubiblock as the root filesystem in an
+	   indirect way, e.g., though DM and need to refer to it before
+	   userspace is up.
+
 endif # MTD_UBI
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 6b6bce2..6c8333d 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -635,9 +635,14 @@ int __init ubiblock_init(void)
 {
 	int ret;
 
-	ubiblock_major = register_blkdev(0, "ubiblock");
+	ubiblock_major = register_blkdev(CONFIG_MTD_UBI_BLOCK_MAJOR,
+					 "ubiblock");
 	if (ubiblock_major < 0)
 		return ubiblock_major;
+	if (CONFIG_MTD_UBI_BLOCK_MAJOR) {
+		BUG_ON(ubiblock_major);
+		ubiblock_major = CONFIG_MTD_UBI_BLOCK_MAJOR;
+	}
 
 	/* Attach block devices from 'block=' module param */
 	ret = ubiblock_create_from_param();
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UBI: block: Configurable device major number
  2015-01-14 20:40 [PATCH] UBI: block: Configurable device major number Dan Ehrenberg
@ 2015-01-15 18:52 ` Daniel Ehrenberg
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Ehrenberg @ 2015-01-15 18:52 UTC (permalink / raw)
  To: Brian Norris
  Cc: Grant Grundler, Gwendal Grignou, linux-mtd, Ezequiel Garcia,
	Dan Ehrenberg

Hi,

Please ignore this patch. I've found a better way to achieve the same
thing--modify dm to accept paths like /dev/ubiblock3_0 (parsed the
same as root=) as arguments for the target, rather than only paths in
the filesystem and major:minor pairs.

Thanks,
Dan

On Wed, Jan 14, 2015 at 12:40 PM, Dan Ehrenberg <dehrenberg@chromium.org> wrote:
> By default UBI block devices use a dynamic major number. This
> config option can replace that with a static major number. Set
> to the new major number, or 0 for dynamic. This is useful if
> you want to use an ubiblock as the root filesystem in an
> indirect way, e.g., though DM and need to refer to it before
> userspace is up.
>
> Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
> ---
>  drivers/mtd/ubi/Kconfig | 13 +++++++++++++
>  drivers/mtd/ubi/block.c |  7 ++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig
> index f0855ce..5ac8d63 100644
> --- a/drivers/mtd/ubi/Kconfig
> +++ b/drivers/mtd/ubi/Kconfig
> @@ -103,4 +103,17 @@ config MTD_UBI_BLOCK
>
>            If in doubt, say "N".
>
> +config MTD_UBI_BLOCK_MAJOR
> +       int "Major device number for UBI block devices"
> +       default 0
> +       range 0 256
> +       depends on MTD_UBI_BLOCK
> +       help
> +          By default UBI block devices use a dynamic major number. This
> +          config option can replace that with a static major number. Set
> +          to the new major number, or 0 for dynamic. This is useful if
> +          you want to use an ubiblock as the root filesystem in an
> +          indirect way, e.g., though DM and need to refer to it before
> +          userspace is up.
> +
>  endif # MTD_UBI
> diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
> index 6b6bce2..6c8333d 100644
> --- a/drivers/mtd/ubi/block.c
> +++ b/drivers/mtd/ubi/block.c
> @@ -635,9 +635,14 @@ int __init ubiblock_init(void)
>  {
>         int ret;
>
> -       ubiblock_major = register_blkdev(0, "ubiblock");
> +       ubiblock_major = register_blkdev(CONFIG_MTD_UBI_BLOCK_MAJOR,
> +                                        "ubiblock");
>         if (ubiblock_major < 0)
>                 return ubiblock_major;
> +       if (CONFIG_MTD_UBI_BLOCK_MAJOR) {
> +               BUG_ON(ubiblock_major);
> +               ubiblock_major = CONFIG_MTD_UBI_BLOCK_MAJOR;
> +       }
>
>         /* Attach block devices from 'block=' module param */
>         ret = ubiblock_create_from_param();
> --
> 2.2.0.rc0.207.ga3a616c
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 20:40 [PATCH] UBI: block: Configurable device major number Dan Ehrenberg
2015-01-15 18:52 ` Daniel Ehrenberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.