diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-08-25 04:54:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-25 04:54:07 -0400 |
commit | e4f807c2b4d81636fc63993368646c5bfd42b22f (patch) | |
tree | 2ff100911b1ba4e26e3d9aad41edb9b48405f01e /block/genhd.c | |
parent | 25258ef762bc4a05fa9c4523f7dae56e3fd01864 (diff) | |
parent | 83097aca8567a0bd593534853b71fe0fa9a75d69 (diff) |
Merge branch 'linus' into x86/xen
Conflicts:
arch/x86/kernel/paravirt.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/block/genhd.c b/block/genhd.c index c13cc77291af..656c2c7abf99 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -293,27 +293,30 @@ void __init printk_all_partitions(void) | |||
293 | /* iterator */ | 293 | /* iterator */ |
294 | static int find_start(struct device *dev, void *data) | 294 | static int find_start(struct device *dev, void *data) |
295 | { | 295 | { |
296 | loff_t k = *(loff_t *)data; | 296 | loff_t *k = data; |
297 | 297 | ||
298 | if (dev->type != &disk_type) | 298 | if (dev->type != &disk_type) |
299 | return 0; | 299 | return 0; |
300 | if (!k--) | 300 | if (!*k) |
301 | return 1; | 301 | return 1; |
302 | (*k)--; | ||
302 | return 0; | 303 | return 0; |
303 | } | 304 | } |
304 | 305 | ||
305 | static void *part_start(struct seq_file *part, loff_t *pos) | 306 | static void *part_start(struct seq_file *part, loff_t *pos) |
306 | { | 307 | { |
307 | struct device *dev; | 308 | struct device *dev; |
308 | loff_t n = *pos; | 309 | loff_t k = *pos; |
309 | 310 | ||
310 | if (!n) | 311 | if (!k) |
311 | seq_puts(part, "major minor #blocks name\n\n"); | 312 | seq_puts(part, "major minor #blocks name\n\n"); |
312 | 313 | ||
313 | mutex_lock(&block_class_lock); | 314 | mutex_lock(&block_class_lock); |
314 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); | 315 | dev = class_find_device(&block_class, NULL, &k, find_start); |
315 | if (dev) | 316 | if (dev) { |
317 | put_device(dev); | ||
316 | return dev_to_disk(dev); | 318 | return dev_to_disk(dev); |
319 | } | ||
317 | return NULL; | 320 | return NULL; |
318 | } | 321 | } |
319 | 322 | ||
@@ -330,8 +333,10 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos) | |||
330 | struct device *dev; | 333 | struct device *dev; |
331 | ++*pos; | 334 | ++*pos; |
332 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); | 335 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
333 | if (dev) | 336 | if (dev) { |
337 | put_device(dev); | ||
334 | return dev_to_disk(dev); | 338 | return dev_to_disk(dev); |
339 | } | ||
335 | return NULL; | 340 | return NULL; |
336 | } | 341 | } |
337 | 342 | ||
@@ -568,11 +573,14 @@ static struct device_type disk_type = { | |||
568 | static void *diskstats_start(struct seq_file *part, loff_t *pos) | 573 | static void *diskstats_start(struct seq_file *part, loff_t *pos) |
569 | { | 574 | { |
570 | struct device *dev; | 575 | struct device *dev; |
576 | loff_t k = *pos; | ||
571 | 577 | ||
572 | mutex_lock(&block_class_lock); | 578 | mutex_lock(&block_class_lock); |
573 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); | 579 | dev = class_find_device(&block_class, NULL, &k, find_start); |
574 | if (dev) | 580 | if (dev) { |
581 | put_device(dev); | ||
575 | return dev_to_disk(dev); | 582 | return dev_to_disk(dev); |
583 | } | ||
576 | return NULL; | 584 | return NULL; |
577 | } | 585 | } |
578 | 586 | ||
@@ -583,8 +591,10 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
583 | 591 | ||
584 | ++*pos; | 592 | ++*pos; |
585 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); | 593 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
586 | if (dev) | 594 | if (dev) { |
595 | put_device(dev); | ||
587 | return dev_to_disk(dev); | 596 | return dev_to_disk(dev); |
597 | } | ||
588 | return NULL; | 598 | return NULL; |
589 | } | 599 | } |
590 | 600 | ||
@@ -712,10 +722,12 @@ dev_t blk_lookup_devt(const char *name, int part) | |||
712 | mutex_lock(&block_class_lock); | 722 | mutex_lock(&block_class_lock); |
713 | find.name = name; | 723 | find.name = name; |
714 | find.part = part; | 724 | find.part = part; |
715 | dev = class_find_device(&block_class, NULL, (void *)&find, match_id); | 725 | dev = class_find_device(&block_class, NULL, &find, match_id); |
716 | if (dev) | 726 | if (dev) { |
727 | put_device(dev); | ||
717 | devt = MKDEV(MAJOR(dev->devt), | 728 | devt = MKDEV(MAJOR(dev->devt), |
718 | MINOR(dev->devt) + part); | 729 | MINOR(dev->devt) + part); |
730 | } | ||
719 | mutex_unlock(&block_class_lock); | 731 | mutex_unlock(&block_class_lock); |
720 | 732 | ||
721 | return devt; | 733 | return devt; |