summaryrefslogtreecommitdiff
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6b859fad6a8a..030ee2f87891 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -266,6 +266,7 @@ extern void add_partition(struct gendisk *, int, sector_t, sector_t);
extern void delete_partition(struct gendisk *, int);
extern struct gendisk *alloc_disk(int minors);
+extern struct gendisk *get_disk(struct gendisk *disk);
extern void put_disk(struct gendisk *disk);
/* will go away */
@@ -273,9 +274,11 @@ extern void blk_set_probe(int major, struct gendisk *(p)(int));
static inline unsigned int disk_index (kdev_t dev)
{
- int part;
+ int part, res;
struct gendisk *g = get_gendisk(kdev_t_to_nr(dev), &part);
- return g ? (minor(dev) >> g->minor_shift) : 0;
+ res = g ? (minor(dev) >> g->minor_shift) : 0;
+ put_disk(g);
+ return res;
}
#endif