[PATCH 1/3] mtd: name the mtd device with an optional label property

Boris Brezillon boris.brezillon at free-electrons.com
Tue Jan 24 06:27:04 PST 2017


On Tue, 24 Jan 2017 15:13:53 +0100
Boris Brezillon <boris.brezillon at free-electrons.com> wrote:

> >  	if (mtd->dev.parent) {
> >  		if (!mtd->owner && mtd->dev.parent->driver)
> >  			mtd->owner = mtd->dev.parent->driver->owner;  
> 
> --->8---  
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 13f8052b9ff9..a12b68f941e3 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -385,6 +385,8 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
>                                    struct device_node *np)
>  {
>         mtd->dev.of_node = np;
> +
> +       of_property_read_string(np, "label", mtd->name);
>  }
>  
>  static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)

Sorry, I forgot to compile test this change. Here is a valid version:

--->8---
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 13f8052b9ff9..581057f8d9a5 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -24,6 +24,7 @@
 #include <linux/uio.h>
 #include <linux/notifier.h>
 #include <linux/device.h>
+#include <linux/of.h>
 
 #include <mtd/mtd-abi.h>
 
@@ -385,6 +386,8 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
                                   struct device_node *np)
 {
        mtd->dev.of_node = np;
+
+       of_property_read_string(np, "label", &mtd->name);
 }
 
 static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)



More information about the linux-mtd mailing list