diff mbox

UBI: block: Export ubiblock major number

Message ID 1421278927-3237-1-git-send-email-dehrenberg@chromium.org
State Rejected
Headers show

Commit Message

Dan Ehrenberg Jan. 14, 2015, 11:42 p.m. UTC
This patch exports the ubiblock major number so that it is usable from
other pieces of kernel code. This is useful, for example, if you have
another piece of kernel code which wants to determine whether a block
device is an ubiblock device or not.

Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
---
 drivers/mtd/ubi/block.c | 3 ++-
 include/linux/mtd/ubi.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Dan Ehrenberg Jan. 15, 2015, 6:50 p.m. UTC | #1
Hi,

Please ignore this patch. I've found a way to do achieve the same
thing for my without exporting the major number--I can just check
whether the block device's disk_name is ubiblock.

Thanks,
Dan

On Wed, Jan 14, 2015 at 3:42 PM, Dan Ehrenberg <dehrenberg@chromium.org> wrote:
> This patch exports the ubiblock major number so that it is usable from
> other pieces of kernel code. This is useful, for example, if you have
> another piece of kernel code which wants to determine whether a block
> device is an ubiblock device or not.
>
> Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
> ---
>  drivers/mtd/ubi/block.c | 3 ++-
>  include/linux/mtd/ubi.h | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
> index 6c8333d..faf35d4 100644
> --- a/drivers/mtd/ubi/block.c
> +++ b/drivers/mtd/ubi/block.c
> @@ -94,7 +94,8 @@ struct ubiblock {
>  /* Linked list of all ubiblock instances */
>  static LIST_HEAD(ubiblock_devices);
>  static DEFINE_MUTEX(devices_mutex);
> -static int ubiblock_major;
> +int ubiblock_major;
> +EXPORT_SYMBOL(ubiblock_major);
>
>  static int __init ubiblock_set_param(const char *val,
>                                      const struct kernel_param *kp)
> diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
> index c3918a0..8603d87 100644
> --- a/include/linux/mtd/ubi.h
> +++ b/include/linux/mtd/ubi.h
> @@ -230,4 +230,6 @@ static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
>  {
>         return ubi_leb_read(desc, lnum, buf, offset, len, 0);
>  }
> +
> +extern int ubiblock_major;
>  #endif /* !__LINUX_UBI_H__ */
> --
> 2.2.0.rc0.207.ga3a616c
>
diff mbox

Patch

diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index 6c8333d..faf35d4 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -94,7 +94,8 @@  struct ubiblock {
 /* Linked list of all ubiblock instances */
 static LIST_HEAD(ubiblock_devices);
 static DEFINE_MUTEX(devices_mutex);
-static int ubiblock_major;
+int ubiblock_major;
+EXPORT_SYMBOL(ubiblock_major);
 
 static int __init ubiblock_set_param(const char *val,
 				     const struct kernel_param *kp)
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index c3918a0..8603d87 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -230,4 +230,6 @@  static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
 {
 	return ubi_leb_read(desc, lnum, buf, offset, len, 0);
 }
+
+extern int ubiblock_major;
 #endif /* !__LINUX_UBI_H__ */