[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1401142372-14148-2-git-send-email-holler@ahsoftware.de>
Date: Tue, 27 May 2014 00:12:26 +0200
From: Alexander Holler <holler@...oftware.de>
To: linux-kernel@...r.kernel.org
Cc: linux-mtd@...ts.infradead.org,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Alexander Holler <holler@...oftware.de>
Subject: [PATCH 01/27] mtd: nand: introduce function to fix a common bug in most nand-drivers not showing a device in sysfs
Most nand drivers don't set a parent device for the mtd-device. The result
is that information in sysfs is missing (no folder device).
Comparing the output of
git grep mtd_device_parse_register drivers/mtd/nand/
with
git grep parent drivers/mtd/nand/ | cut -f 1 | sort -u
showed that this is a very common error. Looking at some of those drivers
a common pattern is visible which I put into a new inline function to
reduce source code size and to avoid future similiar errors.
Signed-off-by: Alexander Holler <holler@...oftware.de>
---
include/linux/mtd/mtd.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a1b0b4c..2e24afe 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -23,7 +23,7 @@
#include <linux/types.h>
#include <linux/uio.h>
#include <linux/notifier.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
#include <mtd/mtd-abi.h>
@@ -366,6 +366,15 @@ static inline int mtd_can_have_bb(const struct mtd_info *mtd)
struct mtd_partition;
struct mtd_part_parser_data;
+static inline void mtd_setup_common_members(struct mtd_info *mtd, void *priv,
+ struct platform_device *pdev)
+{
+ mtd->priv = priv;
+ mtd->owner = pdev->dev.driver->owner;
+ mtd->dev.parent = &pdev->dev;
+ mtd->name = pdev->dev.driver->name;
+}
+
extern int mtd_device_parse_register(struct mtd_info *mtd,
const char * const *part_probe_types,
struct mtd_part_parser_data *parser_data,
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists