block2mtd: More 2.6.38 fixes
[openwrt/staging/mkresin.git] / target / linux / generic / patches-2.6.38 / 067-block2mtd_2.6.38_fix.patch
1 Index: linux-2.6.38-rc6/drivers/mtd/devices/block2mtd.c
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/drivers/mtd/devices/block2mtd.c 2011-02-28 16:41:59.839603348 +0100
4 +++ linux-2.6.38-rc6/drivers/mtd/devices/block2mtd.c 2011-02-28 16:47:59.637698484 +0100
5 @@ -264,12 +264,13 @@ static int _open_bdev(struct block2mtd_d
6 bdev = blkdev_get_by_path(dev->devname, mode, dev);
7 #ifndef MODULE
8 if (IS_ERR(bdev)) {
9 + dev_t devt;
10
11 /* We might not have rootfs mounted at this point. Try
12 to resolve the device name by other means. */
13
14 wait_for_device_probe();
15 - dev_t devt = name_to_dev_t(dev->devname);
16 + devt = name_to_dev_t(dev->devname);
17 if (devt)
18 bdev = blkdev_get_by_dev(devt, mode, dev);
19 }
20 @@ -330,7 +331,7 @@ static int block2mtd_refresh(struct mtd_
21 _close_bdev(dev);
22
23 /* open the whole disk, issue a partition rescan, then */
24 - bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ);
25 + bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ, mtd);
26 if (!bdev || !bdev->bd_disk)
27 err = -EINVAL;
28 #ifndef CONFIG_MTD_BLOCK2MTD_MODULE
29 @@ -395,7 +396,7 @@ static struct block2mtd_dev *add_device(
30 dev->mtd.refresh_device = block2mtd_refresh;
31
32 part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
33 - part->name = dev->mtd.name;
34 + part->name = name;
35 part->offset = 0;
36 part->size = dev->mtd.size;
37 if (add_mtd_partitions(&dev->mtd, part, 1)) {