diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/block/genhd.c b/block/genhd.c index 70f1d7075783..c13cc77291af 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -317,17 +317,21 @@ static void *part_start(struct seq_file *part, loff_t *pos) | |||
317 | return NULL; | 317 | return NULL; |
318 | } | 318 | } |
319 | 319 | ||
320 | static int find_next(struct device *dev, void *data) | ||
321 | { | ||
322 | if (dev->type == &disk_type) | ||
323 | return 1; | ||
324 | return 0; | ||
325 | } | ||
326 | |||
320 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) | 327 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) |
321 | { | 328 | { |
322 | struct gendisk *gp = v; | 329 | struct gendisk *gp = v; |
323 | struct device *dev; | 330 | struct device *dev; |
324 | ++*pos; | 331 | ++*pos; |
325 | list_for_each_entry(dev, &gp->dev.node, node) { | 332 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
326 | if (&dev->node == &block_class.devices) | 333 | if (dev) |
327 | return NULL; | 334 | return dev_to_disk(dev); |
328 | if (dev->type == &disk_type) | ||
329 | return dev_to_disk(dev); | ||
330 | } | ||
331 | return NULL; | 335 | return NULL; |
332 | } | 336 | } |
333 | 337 | ||
@@ -578,12 +582,9 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
578 | struct device *dev; | 582 | struct device *dev; |
579 | 583 | ||
580 | ++*pos; | 584 | ++*pos; |
581 | list_for_each_entry(dev, &gp->dev.node, node) { | 585 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
582 | if (&dev->node == &block_class.devices) | 586 | if (dev) |
583 | return NULL; | 587 | return dev_to_disk(dev); |
584 | if (dev->type == &disk_type) | ||
585 | return dev_to_disk(dev); | ||
586 | } | ||
587 | return NULL; | 588 | return NULL; |
588 | } | 589 | } |
589 | 590 | ||