aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-03-26 03:42:41 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-04-04 09:29:07 -0400
commit1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 (patch)
tree07dfc44f62dac78bdf4a8cdb4d91d60f73c04ff4 /drivers/mtd/mtdpart.c
parent9d63287a461c269edb39941744f4ff22223cf349 (diff)
[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 'drivers/mtd/mtdpart.c')
-rw-r--r--drivers/mtd/mtdpart.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 06d5b9d8853a..02ce38fb1fc3 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -356,6 +356,11 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
356 slave->mtd.owner = master->owner; 356 slave->mtd.owner = master->owner;
357 slave->mtd.backing_dev_info = master->backing_dev_info; 357 slave->mtd.backing_dev_info = master->backing_dev_info;
358 358
359 /* NOTE: we don't arrange MTDs as a tree; it'd be error-prone
360 * to have the same data be in two different partitions.
361 */
362 slave->mtd.dev.parent = master->dev.parent;
363
359 slave->mtd.read = part_read; 364 slave->mtd.read = part_read;
360 slave->mtd.write = part_write; 365 slave->mtd.write = part_write;
361 366
@@ -508,7 +513,9 @@ out_register:
508 * This function, given a master MTD object and a partition table, creates 513 * This function, given a master MTD object and a partition table, creates
509 * and registers slave MTD objects which are bound to the master according to 514 * and registers slave MTD objects which are bound to the master according to
510 * the partition definitions. 515 * the partition definitions.
511 * (Q: should we register the master MTD object as well?) 516 *
517 * We don't register the master, or expect the caller to have done so,
518 * for reasons of data integrity.
512 */ 519 */
513 520
514int add_mtd_partitions(struct mtd_info *master, 521int add_mtd_partitions(struct mtd_info *master,