[ARM] mv78xx0: wire i2c support
[cascardo/linux.git] / block / genhd.c
index d84a7df..e1eadcc 100644 (file)
@@ -1084,9 +1084,17 @@ dev_t blk_lookup_devt(const char *name, int partno)
                struct gendisk *disk = dev_to_disk(dev);
                struct hd_struct *part;
 
-               if (strcmp(dev->bus_id, name))
+               if (strcmp(dev_name(dev), name))
                        continue;
 
+               if (partno < disk->minors) {
+                       /* We need to return the right devno, even
+                        * if the partition doesn't exist yet.
+                        */
+                       devt = MKDEV(MAJOR(dev->devt),
+                                    MINOR(dev->devt) + partno);
+                       break;
+               }
                part = disk_get_part(disk, partno);
                if (part) {
                        devt = part_devt(part);