diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-03-26 00:42:41 -0700 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-04-04 14:29:07 +0100 |
commit | 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 (patch) | |
tree | 07dfc44f62dac78bdf4a8cdb4d91d60f73c04ff4 /include/linux/mtd | |
parent | 9d63287a461c269edb39941744f4ff22223cf349 (diff) | |
download | op-kernel-dev-1f24b5a8ecbb2a3c7080f418974d40e3ffedb221.zip op-kernel-dev-1f24b5a8ecbb2a3c7080f418974d40e3ffedb221.tar.gz |
[MTD] driver model updates
Update driver model support in the MTD framework, so it fits
better into the current udev-based hotplug framework:
- Each mtd_info now has a device node. MTD drivers should set
the dev.parent field to point to the physical device, before
setting up partitions or otherwise declaring MTDs.
- Those device nodes always map to /sys/class/mtdX device nodes,
which no longer depend on MTD_CHARDEV.
- Those mtdX sysfs nodes have a "starter set" of attributes;
it's not yet sufficient to replace /proc/mtd.
- Enabling MTD_CHARDEV provides /sys/class/mtdXro/ nodes and the
/sys/class/mtd*/dev attributes (for udev, mdev, etc).
- Include a MODULE_ALIAS_CHARDEV_MAJOR macro. It'll work with
udev creating the /dev/mtd* nodes, not just a static rootfs.
So the sysfs structure is pretty much what you'd expect, except
that readonly chardev nodes are a bit quirky.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/mtd.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 0c079fd..5675b63 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -11,6 +11,7 @@ #include <linux/module.h> #include <linux/uio.h> #include <linux/notifier.h> +#include <linux/device.h> #include <linux/mtd/compatmac.h> #include <mtd/mtd-abi.h> @@ -237,6 +238,7 @@ struct mtd_info { void *priv; struct module *owner; + struct device dev; int usecount; /* If the driver is something smart, like UBI, it may need to maintain @@ -247,6 +249,11 @@ struct mtd_info { void (*put_device) (struct mtd_info *mtd); }; +static inline struct mtd_info *dev_to_mtd(struct device *dev) +{ + return dev ? container_of(dev, struct mtd_info, dev) : NULL; +} + static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) { if (mtd->erasesize_shift) |