aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c
index fda9c7a63c29..129ad939f9dd 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -653,7 +653,7 @@ void genhd_media_change_notify(struct gendisk *disk)
653EXPORT_SYMBOL_GPL(genhd_media_change_notify); 653EXPORT_SYMBOL_GPL(genhd_media_change_notify);
654#endif /* 0 */ 654#endif /* 0 */
655 655
656dev_t blk_lookup_devt(const char *name) 656dev_t blk_lookup_devt(const char *name, int part)
657{ 657{
658 struct device *dev; 658 struct device *dev;
659 dev_t devt = MKDEV(0, 0); 659 dev_t devt = MKDEV(0, 0);
@@ -661,7 +661,11 @@ dev_t blk_lookup_devt(const char *name)
661 mutex_lock(&block_class_lock); 661 mutex_lock(&block_class_lock);
662 list_for_each_entry(dev, &block_class.devices, node) { 662 list_for_each_entry(dev, &block_class.devices, node) {
663 if (strcmp(dev->bus_id, name) == 0) { 663 if (strcmp(dev->bus_id, name) == 0) {
664 devt = dev->devt; 664 struct gendisk *disk = dev_to_disk(dev);
665
666 if (part < disk->minors)
667 devt = MKDEV(MAJOR(dev->devt),
668 MINOR(dev->devt) + part);
665 break; 669 break;
666 } 670 }
667 } 671 }
@@ -669,7 +673,6 @@ dev_t blk_lookup_devt(const char *name)
669 673
670 return devt; 674 return devt;
671} 675}
672
673EXPORT_SYMBOL(blk_lookup_devt); 676EXPORT_SYMBOL(blk_lookup_devt);
674 677
675struct gendisk *alloc_disk(int minors) 678struct gendisk *alloc_disk(int minors)