summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSaeed Bishara <saeed@marvell.com>2009-07-28 04:56:43 -0700
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-08-03 14:16:01 +0100
commit6afc4fdb3e94ba60cd566cb878b60c6c01979277 (patch)
tree75cc3a29b3e988f852fde390e3fe79e6d157db51 /include
parent7699ad35ed06044c4fc1be162553880f98658616 (diff)
downloadlinux-3.10-6afc4fdb3e94ba60cd566cb878b60c6c01979277.tar.gz
linux-3.10-6afc4fdb3e94ba60cd566cb878b60c6c01979277.tar.bz2
linux-3.10-6afc4fdb3e94ba60cd566cb878b60c6c01979277.zip
mtd: fix the conversion from dev to mtd_info
The patch fixes a bug when converting dev to mtd_info by using the drvdata of the dev, the previous code used container_of(dev, struct mtd_info, dev), but won't work for the mtdXro devices as they created without being contained inside mtd_info structure. Signed-off-by: Saeed Bishara <saeed@marvell.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/mtd.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 5675b63a063..0f32a9b6ff5 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -251,7 +251,7 @@ struct mtd_info {
static inline struct mtd_info *dev_to_mtd(struct device *dev)
{
- return dev ? container_of(dev, struct mtd_info, dev) : NULL;
+ return dev ? dev_get_drvdata(dev) : NULL;
}
static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)