0201-block2mtd.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. --- a/drivers/mtd/devices/block2mtd.c
  2. +++ b/drivers/mtd/devices/block2mtd.c
  3. @@ -32,6 +32,8 @@
  4. #include <linux/slab.h>
  5. #include <linux/major.h>
  6. +static const char * const block2mtd_probe_types[] = { "cmdlinepart", NULL };
  7. +
  8. /* Info for the block device */
  9. struct block2mtd_dev {
  10. struct list_head list;
  11. @@ -227,6 +229,7 @@ static struct block2mtd_dev *add_device(
  12. #endif
  13. const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
  14. struct block_device *bdev = ERR_PTR(-ENODEV);
  15. + struct mtd_part_parser_data ppdata = { 0 };
  16. struct block2mtd_dev *dev;
  17. struct mtd_partition *part;
  18. char *name;
  19. @@ -307,11 +310,7 @@ static struct block2mtd_dev *add_device(
  20. dev->mtd.priv = dev;
  21. dev->mtd.owner = THIS_MODULE;
  22. - part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
  23. - part->name = name;
  24. - part->offset = 0;
  25. - part->size = dev->mtd.size;
  26. - if (mtd_device_register(&dev->mtd, part, 1)) {
  27. + if (mtd_device_parse_register(&dev->mtd, block2mtd_probe_types, &ppdata, NULL, 0)) {
  28. /* Device didn't get added, so free the entry */
  29. goto err_destroy_mutex;
  30. }