diff options
-rw-r--r-- | drivers/block/cciss.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 5c269c00d6eb..ca56a0e5cd5e 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1582,38 +1582,36 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1582 | * allows us to delete disk zero but keep the controller registered. | 1582 | * allows us to delete disk zero but keep the controller registered. |
1583 | */ | 1583 | */ |
1584 | if (h->gendisk[0] != disk) { | 1584 | if (h->gendisk[0] != disk) { |
1585 | if (disk) { | 1585 | struct request_queue *q = disk->queue; |
1586 | struct request_queue *q = disk->queue; | 1586 | if (disk->flags & GENHD_FL_UP) |
1587 | if (disk->flags & GENHD_FL_UP) | 1587 | del_gendisk(disk); |
1588 | del_gendisk(disk); | 1588 | if (q) { |
1589 | if (q) { | 1589 | blk_cleanup_queue(q); |
1590 | blk_cleanup_queue(q); | 1590 | /* Set drv->queue to NULL so that we do not try |
1591 | /* Set drv->queue to NULL so that we do not try | 1591 | * to call blk_start_queue on this queue in the |
1592 | * to call blk_start_queue on this queue in the | 1592 | * interrupt handler |
1593 | * interrupt handler | 1593 | */ |
1594 | */ | 1594 | drv->queue = NULL; |
1595 | drv->queue = NULL; | 1595 | } |
1596 | } | 1596 | /* If clear_all is set then we are deleting the logical |
1597 | /* If clear_all is set then we are deleting the logical | 1597 | * drive, not just refreshing its info. For drives |
1598 | * drive, not just refreshing its info. For drives | 1598 | * other than disk 0 we will call put_disk. We do not |
1599 | * other than disk 0 we will call put_disk. We do not | 1599 | * do this for disk 0 as we need it to be able to |
1600 | * do this for disk 0 as we need it to be able to | 1600 | * configure the controller. |
1601 | * configure the controller. | 1601 | */ |
1602 | if (clear_all){ | ||
1603 | /* This isn't pretty, but we need to find the | ||
1604 | * disk in our array and NULL our the pointer. | ||
1605 | * This is so that we will call alloc_disk if | ||
1606 | * this index is used again later. | ||
1602 | */ | 1607 | */ |
1603 | if (clear_all){ | 1608 | for (i=0; i < CISS_MAX_LUN; i++){ |
1604 | /* This isn't pretty, but we need to find the | 1609 | if(h->gendisk[i] == disk){ |
1605 | * disk in our array and NULL our the pointer. | 1610 | h->gendisk[i] = NULL; |
1606 | * This is so that we will call alloc_disk if | 1611 | break; |
1607 | * this index is used again later. | ||
1608 | */ | ||
1609 | for (i=0; i < CISS_MAX_LUN; i++){ | ||
1610 | if(h->gendisk[i] == disk){ | ||
1611 | h->gendisk[i] = NULL; | ||
1612 | break; | ||
1613 | } | ||
1614 | } | 1612 | } |
1615 | put_disk(disk); | ||
1616 | } | 1613 | } |
1614 | put_disk(disk); | ||
1617 | } | 1615 | } |
1618 | } else { | 1616 | } else { |
1619 | set_capacity(disk, 0); | 1617 | set_capacity(disk, 0); |