fix a compile error in block2mtd when compiled as module

SVN-Revision: 19709
This commit is contained in:
Felix Fietkau 2010-02-18 21:34:49 +00:00
parent 4c1e6a7e39
commit 8a7049730f
3 changed files with 15 additions and 12 deletions

View file

@ -441,7 +441,7 @@
if (devt) { if (devt) {
bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
} }
@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( @@ -263,17 +276,98 @@ static struct block2mtd_dev *add_device(
#endif #endif
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
@ -505,9 +505,10 @@
+ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); + bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
+ if (!bdev || !bdev->bd_disk) + if (!bdev || !bdev->bd_disk)
+ err = -EINVAL; + err = -EINVAL;
+ else { +#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
+ else
+ err = rescan_partitions(bdev->bd_disk, bdev); + err = rescan_partitions(bdev->bd_disk, bdev);
+ } +#endif
+ if (bdev) + if (bdev)
+ close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); + close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
+ +
@ -542,7 +543,7 @@
if (!mtdname) if (!mtdname)
mtdname = devname; mtdname = devname;
@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( @@ -297,6 +391,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.read = block2mtd_read; dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev; dev->mtd.priv = dev;
dev->mtd.owner = THIS_MODULE; dev->mtd.owner = THIS_MODULE;

View file

@ -434,7 +434,7 @@
if (devt) { if (devt) {
bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
} }
@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( @@ -263,17 +276,98 @@ static struct block2mtd_dev *add_device(
#endif #endif
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
@ -498,9 +498,10 @@
+ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); + bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
+ if (!bdev || !bdev->bd_disk) + if (!bdev || !bdev->bd_disk)
+ err = -EINVAL; + err = -EINVAL;
+ else { +#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
+ else
+ err = rescan_partitions(bdev->bd_disk, bdev); + err = rescan_partitions(bdev->bd_disk, bdev);
+ } +#endif
+ if (bdev) + if (bdev)
+ close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); + close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
+ +
@ -535,7 +536,7 @@
if (!mtdname) if (!mtdname)
mtdname = devname; mtdname = devname;
@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( @@ -297,6 +391,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.read = block2mtd_read; dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev; dev->mtd.priv = dev;
dev->mtd.owner = THIS_MODULE; dev->mtd.owner = THIS_MODULE;

View file

@ -434,7 +434,7 @@
if (devt) { if (devt) {
bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
} }
@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( @@ -263,17 +276,98 @@ static struct block2mtd_dev *add_device(
#endif #endif
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
@ -498,9 +498,10 @@
+ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); + bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
+ if (!bdev || !bdev->bd_disk) + if (!bdev || !bdev->bd_disk)
+ err = -EINVAL; + err = -EINVAL;
+ else { +#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
+ else
+ err = rescan_partitions(bdev->bd_disk, bdev); + err = rescan_partitions(bdev->bd_disk, bdev);
+ } +#endif
+ if (bdev) + if (bdev)
+ close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE); + close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
+ +
@ -535,7 +536,7 @@
if (!mtdname) if (!mtdname)
mtdname = devname; mtdname = devname;
@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( @@ -297,6 +391,7 @@ static struct block2mtd_dev *add_device(
dev->mtd.read = block2mtd_read; dev->mtd.read = block2mtd_read;
dev->mtd.priv = dev; dev->mtd.priv = dev;
dev->mtd.owner = THIS_MODULE; dev->mtd.owner = THIS_MODULE;