diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-04 09:59:47 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-04 09:59:47 -0500 |
| commit | 5cb2faa6ede7ada9cb2bffc832c4ce60f53d6834 (patch) | |
| tree | 7b72b66081d042a41dc822575503133364857ce2 /drivers/block | |
| parent | e0ee98513d1a2e24d2ddbdecf4216bcca29d1158 (diff) | |
| parent | 6060e8df517847bf445ebc61de7d4d9c7faae990 (diff) | |
Merge branch 'pending-misc' (early part) into devel
Diffstat (limited to 'drivers/block')
| -rw-r--r-- | drivers/block/cciss.c | 16 | ||||
| -rw-r--r-- | drivers/block/loop.c | 2 | ||||
| -rw-r--r-- | drivers/block/virtio_blk.c | 39 |
3 files changed, 12 insertions, 45 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6399e5090df4..92b126394fa1 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -482,7 +482,7 @@ static ssize_t host_store_rescan(struct device *dev, | |||
| 482 | 482 | ||
| 483 | return count; | 483 | return count; |
| 484 | } | 484 | } |
| 485 | DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); | 485 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); |
| 486 | 486 | ||
| 487 | static ssize_t dev_show_unique_id(struct device *dev, | 487 | static ssize_t dev_show_unique_id(struct device *dev, |
| 488 | struct device_attribute *attr, | 488 | struct device_attribute *attr, |
| @@ -512,7 +512,7 @@ static ssize_t dev_show_unique_id(struct device *dev, | |||
| 512 | sn[8], sn[9], sn[10], sn[11], | 512 | sn[8], sn[9], sn[10], sn[11], |
| 513 | sn[12], sn[13], sn[14], sn[15]); | 513 | sn[12], sn[13], sn[14], sn[15]); |
| 514 | } | 514 | } |
| 515 | DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL); | 515 | static DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL); |
| 516 | 516 | ||
| 517 | static ssize_t dev_show_vendor(struct device *dev, | 517 | static ssize_t dev_show_vendor(struct device *dev, |
| 518 | struct device_attribute *attr, | 518 | struct device_attribute *attr, |
| @@ -536,7 +536,7 @@ static ssize_t dev_show_vendor(struct device *dev, | |||
| 536 | else | 536 | else |
| 537 | return snprintf(buf, sizeof(vendor) + 1, "%s\n", drv->vendor); | 537 | return snprintf(buf, sizeof(vendor) + 1, "%s\n", drv->vendor); |
| 538 | } | 538 | } |
| 539 | DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL); | 539 | static DEVICE_ATTR(vendor, S_IRUGO, dev_show_vendor, NULL); |
| 540 | 540 | ||
| 541 | static ssize_t dev_show_model(struct device *dev, | 541 | static ssize_t dev_show_model(struct device *dev, |
| 542 | struct device_attribute *attr, | 542 | struct device_attribute *attr, |
| @@ -560,7 +560,7 @@ static ssize_t dev_show_model(struct device *dev, | |||
| 560 | else | 560 | else |
| 561 | return snprintf(buf, sizeof(model) + 1, "%s\n", drv->model); | 561 | return snprintf(buf, sizeof(model) + 1, "%s\n", drv->model); |
| 562 | } | 562 | } |
| 563 | DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL); | 563 | static DEVICE_ATTR(model, S_IRUGO, dev_show_model, NULL); |
| 564 | 564 | ||
| 565 | static ssize_t dev_show_rev(struct device *dev, | 565 | static ssize_t dev_show_rev(struct device *dev, |
| 566 | struct device_attribute *attr, | 566 | struct device_attribute *attr, |
| @@ -584,7 +584,7 @@ static ssize_t dev_show_rev(struct device *dev, | |||
| 584 | else | 584 | else |
| 585 | return snprintf(buf, sizeof(rev) + 1, "%s\n", drv->rev); | 585 | return snprintf(buf, sizeof(rev) + 1, "%s\n", drv->rev); |
| 586 | } | 586 | } |
| 587 | DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); | 587 | static DEVICE_ATTR(rev, S_IRUGO, dev_show_rev, NULL); |
| 588 | 588 | ||
| 589 | static ssize_t cciss_show_lunid(struct device *dev, | 589 | static ssize_t cciss_show_lunid(struct device *dev, |
| 590 | struct device_attribute *attr, char *buf) | 590 | struct device_attribute *attr, char *buf) |
| @@ -609,7 +609,7 @@ static ssize_t cciss_show_lunid(struct device *dev, | |||
| 609 | lunid[0], lunid[1], lunid[2], lunid[3], | 609 | lunid[0], lunid[1], lunid[2], lunid[3], |
| 610 | lunid[4], lunid[5], lunid[6], lunid[7]); | 610 | lunid[4], lunid[5], lunid[6], lunid[7]); |
| 611 | } | 611 | } |
| 612 | DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); | 612 | static DEVICE_ATTR(lunid, S_IRUGO, cciss_show_lunid, NULL); |
| 613 | 613 | ||
| 614 | static ssize_t cciss_show_raid_level(struct device *dev, | 614 | static ssize_t cciss_show_raid_level(struct device *dev, |
| 615 | struct device_attribute *attr, char *buf) | 615 | struct device_attribute *attr, char *buf) |
| @@ -632,7 +632,7 @@ static ssize_t cciss_show_raid_level(struct device *dev, | |||
| 632 | return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", | 632 | return snprintf(buf, strlen(raid_label[raid]) + 7, "RAID %s\n", |
| 633 | raid_label[raid]); | 633 | raid_label[raid]); |
| 634 | } | 634 | } |
| 635 | DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); | 635 | static DEVICE_ATTR(raid_level, S_IRUGO, cciss_show_raid_level, NULL); |
| 636 | 636 | ||
| 637 | static ssize_t cciss_show_usage_count(struct device *dev, | 637 | static ssize_t cciss_show_usage_count(struct device *dev, |
| 638 | struct device_attribute *attr, char *buf) | 638 | struct device_attribute *attr, char *buf) |
| @@ -651,7 +651,7 @@ static ssize_t cciss_show_usage_count(struct device *dev, | |||
| 651 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 651 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
| 652 | return snprintf(buf, 20, "%d\n", count); | 652 | return snprintf(buf, 20, "%d\n", count); |
| 653 | } | 653 | } |
| 654 | DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); | 654 | static DEVICE_ATTR(usage_count, S_IRUGO, cciss_show_usage_count, NULL); |
| 655 | 655 | ||
| 656 | static struct attribute *cciss_host_attrs[] = { | 656 | static struct attribute *cciss_host_attrs[] = { |
| 657 | &dev_attr_rescan.attr, | 657 | &dev_attr_rescan.attr, |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index edda9ea7c626..bd112c8c7bcd 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
| @@ -949,7 +949,7 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev) | |||
| 949 | lo->lo_state = Lo_unbound; | 949 | lo->lo_state = Lo_unbound; |
| 950 | /* This is safe: open() is still holding a reference. */ | 950 | /* This is safe: open() is still holding a reference. */ |
| 951 | module_put(THIS_MODULE); | 951 | module_put(THIS_MODULE); |
| 952 | if (max_part > 0) | 952 | if (max_part > 0 && bdev) |
| 953 | ioctl_by_bdev(bdev, BLKRRPART, 0); | 953 | ioctl_by_bdev(bdev, BLKRRPART, 0); |
| 954 | mutex_unlock(&lo->lo_ctl_mutex); | 954 | mutex_unlock(&lo->lo_ctl_mutex); |
| 955 | /* | 955 | /* |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43f19389647a..51042f0ba7e1 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | #include <linux/blkdev.h> | 3 | #include <linux/blkdev.h> |
| 4 | #include <linux/hdreg.h> | 4 | #include <linux/hdreg.h> |
| 5 | #include <linux/virtio.h> | 5 | #include <linux/virtio.h> |
| 6 | #include <linux/virtio_ids.h> | ||
| 7 | #include <linux/virtio_blk.h> | 6 | #include <linux/virtio_blk.h> |
| 8 | #include <linux/scatterlist.h> | 7 | #include <linux/scatterlist.h> |
| 9 | 8 | ||
| @@ -183,34 +182,6 @@ static void do_virtblk_request(struct request_queue *q) | |||
| 183 | vblk->vq->vq_ops->kick(vblk->vq); | 182 | vblk->vq->vq_ops->kick(vblk->vq); |
| 184 | } | 183 | } |
| 185 | 184 | ||
| 186 | /* return ATA identify data | ||
| 187 | */ | ||
| 188 | static int virtblk_identify(struct gendisk *disk, void *argp) | ||
| 189 | { | ||
| 190 | struct virtio_blk *vblk = disk->private_data; | ||
| 191 | void *opaque; | ||
| 192 | int err = -ENOMEM; | ||
| 193 | |||
| 194 | opaque = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL); | ||
| 195 | if (!opaque) | ||
| 196 | goto out; | ||
| 197 | |||
| 198 | err = virtio_config_buf(vblk->vdev, VIRTIO_BLK_F_IDENTIFY, | ||
| 199 | offsetof(struct virtio_blk_config, identify), opaque, | ||
| 200 | VIRTIO_BLK_ID_BYTES); | ||
| 201 | |||
| 202 | if (err) | ||
| 203 | goto out_kfree; | ||
| 204 | |||
| 205 | if (copy_to_user(argp, opaque, VIRTIO_BLK_ID_BYTES)) | ||
| 206 | err = -EFAULT; | ||
| 207 | |||
| 208 | out_kfree: | ||
| 209 | kfree(opaque); | ||
| 210 | out: | ||
| 211 | return err; | ||
| 212 | } | ||
| 213 | |||
| 214 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) | 185 | static void virtblk_prepare_flush(struct request_queue *q, struct request *req) |
| 215 | { | 186 | { |
| 216 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; | 187 | req->cmd_type = REQ_TYPE_LINUX_BLOCK; |
| @@ -222,10 +193,6 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 222 | { | 193 | { |
| 223 | struct gendisk *disk = bdev->bd_disk; | 194 | struct gendisk *disk = bdev->bd_disk; |
| 224 | struct virtio_blk *vblk = disk->private_data; | 195 | struct virtio_blk *vblk = disk->private_data; |
| 225 | void __user *argp = (void __user *)data; | ||
| 226 | |||
| 227 | if (cmd == HDIO_GET_IDENTITY) | ||
| 228 | return virtblk_identify(disk, argp); | ||
| 229 | 196 | ||
| 230 | /* | 197 | /* |
| 231 | * Only allow the generic SCSI ioctls if the host can support it. | 198 | * Only allow the generic SCSI ioctls if the host can support it. |
| @@ -233,7 +200,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 233 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) | 200 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) |
| 234 | return -ENOTTY; | 201 | return -ENOTTY; |
| 235 | 202 | ||
| 236 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); | 203 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, |
| 204 | (void __user *)data); | ||
| 237 | } | 205 | } |
| 238 | 206 | ||
| 239 | /* We provide getgeo only to please some old bootloader/partitioning tools */ | 207 | /* We provide getgeo only to please some old bootloader/partitioning tools */ |
| @@ -332,7 +300,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
| 332 | } | 300 | } |
| 333 | 301 | ||
| 334 | vblk->disk->queue->queuedata = vblk; | 302 | vblk->disk->queue->queuedata = vblk; |
| 335 | queue_flag_set_unlocked(QUEUE_FLAG_VIRT, vblk->disk->queue); | ||
| 336 | 303 | ||
| 337 | if (index < 26) { | 304 | if (index < 26) { |
| 338 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | 305 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); |
| @@ -445,7 +412,7 @@ static struct virtio_device_id id_table[] = { | |||
| 445 | static unsigned int features[] = { | 412 | static unsigned int features[] = { |
| 446 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 413 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
| 447 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, | 414 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, |
| 448 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_IDENTIFY, VIRTIO_BLK_F_FLUSH | 415 | VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH |
| 449 | }; | 416 | }; |
| 450 | 417 | ||
| 451 | /* | 418 | /* |
