diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/block/genhd.c b/block/genhd.c index 0be95135c404..9eb8b3e212c1 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -283,9 +283,7 @@ static int printk_partition(struct device *dev, void *data) | |||
283 | */ | 283 | */ |
284 | void __init printk_all_partitions(void) | 284 | void __init printk_all_partitions(void) |
285 | { | 285 | { |
286 | mutex_lock(&block_class_lock); | ||
287 | class_for_each_device(&block_class, NULL, NULL, printk_partition); | 286 | class_for_each_device(&block_class, NULL, NULL, printk_partition); |
288 | mutex_unlock(&block_class_lock); | ||
289 | } | 287 | } |
290 | 288 | ||
291 | #ifdef CONFIG_PROC_FS | 289 | #ifdef CONFIG_PROC_FS |
@@ -305,17 +303,15 @@ static int find_start(struct device *dev, void *data) | |||
305 | static void *part_start(struct seq_file *part, loff_t *pos) | 303 | static void *part_start(struct seq_file *part, loff_t *pos) |
306 | { | 304 | { |
307 | struct device *dev; | 305 | struct device *dev; |
308 | loff_t k = *pos; | 306 | loff_t n = *pos; |
309 | 307 | ||
310 | if (!k) | 308 | if (!n) |
311 | part->private = (void *)1LU; /* tell show to print header */ | 309 | part->private = (void *)1LU; /* tell show to print header */ |
312 | 310 | ||
313 | mutex_lock(&block_class_lock); | 311 | dev = class_find_device(&block_class, NULL, &n, find_start); |
314 | dev = class_find_device(&block_class, NULL, &k, find_start); | 312 | if (dev) |
315 | if (dev) { | ||
316 | put_device(dev); | ||
317 | return dev_to_disk(dev); | 313 | return dev_to_disk(dev); |
318 | } | 314 | |
319 | return NULL; | 315 | return NULL; |
320 | } | 316 | } |
321 | 317 | ||
@@ -341,7 +337,6 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos) | |||
341 | 337 | ||
342 | static void part_stop(struct seq_file *part, void *v) | 338 | static void part_stop(struct seq_file *part, void *v) |
343 | { | 339 | { |
344 | mutex_unlock(&block_class_lock); | ||
345 | } | 340 | } |
346 | 341 | ||
347 | static int show_partition(struct seq_file *part, void *v) | 342 | static int show_partition(struct seq_file *part, void *v) |
@@ -583,14 +578,12 @@ static struct device_type disk_type = { | |||
583 | static void *diskstats_start(struct seq_file *part, loff_t *pos) | 578 | static void *diskstats_start(struct seq_file *part, loff_t *pos) |
584 | { | 579 | { |
585 | struct device *dev; | 580 | struct device *dev; |
586 | loff_t k = *pos; | 581 | loff_t n = *pos; |
587 | 582 | ||
588 | mutex_lock(&block_class_lock); | 583 | dev = class_find_device(&block_class, NULL, &n, find_start); |
589 | dev = class_find_device(&block_class, NULL, &k, find_start); | 584 | if (dev) |
590 | if (dev) { | ||
591 | put_device(dev); | ||
592 | return dev_to_disk(dev); | 585 | return dev_to_disk(dev); |
593 | } | 586 | |
594 | return NULL; | 587 | return NULL; |
595 | } | 588 | } |
596 | 589 | ||
@@ -610,7 +603,6 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
610 | 603 | ||
611 | static void diskstats_stop(struct seq_file *part, void *v) | 604 | static void diskstats_stop(struct seq_file *part, void *v) |
612 | { | 605 | { |
613 | mutex_unlock(&block_class_lock); | ||
614 | } | 606 | } |
615 | 607 | ||
616 | static int diskstats_show(struct seq_file *s, void *v) | 608 | static int diskstats_show(struct seq_file *s, void *v) |
@@ -729,7 +721,6 @@ dev_t blk_lookup_devt(const char *name, int part) | |||
729 | dev_t devt = MKDEV(0, 0); | 721 | dev_t devt = MKDEV(0, 0); |
730 | struct find_block find; | 722 | struct find_block find; |
731 | 723 | ||
732 | mutex_lock(&block_class_lock); | ||
733 | find.name = name; | 724 | find.name = name; |
734 | find.part = part; | 725 | find.part = part; |
735 | dev = class_find_device(&block_class, NULL, &find, match_id); | 726 | dev = class_find_device(&block_class, NULL, &find, match_id); |
@@ -738,7 +729,6 @@ dev_t blk_lookup_devt(const char *name, int part) | |||
738 | devt = MKDEV(MAJOR(dev->devt), | 729 | devt = MKDEV(MAJOR(dev->devt), |
739 | MINOR(dev->devt) + part); | 730 | MINOR(dev->devt) + part); |
740 | } | 731 | } |
741 | mutex_unlock(&block_class_lock); | ||
742 | 732 | ||
743 | return devt; | 733 | return devt; |
744 | } | 734 | } |