git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Staging: w35und: remove useless macro from common.h
[safe/jmp/linux-2.6]
/
drivers
/
scsi
/
sr.c
diff --git
a/drivers/scsi/sr.c
b/drivers/scsi/sr.c
index
c82df8b
..
e7fa3ca
100644
(file)
--- a/
drivers/scsi/sr.c
+++ b/
drivers/scsi/sr.c
@@
-177,7
+177,7
@@
int sr_test_unit_ready(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr)
do {
the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL,
0, sshdr, SR_TIMEOUT,
do {
the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL,
0, sshdr, SR_TIMEOUT,
- retries--);
+ retries--
, NULL
);
if (scsi_sense_valid(sshdr) &&
sshdr->sense_key == UNIT_ATTENTION)
sdev->changed = 1;
if (scsi_sense_valid(sshdr) &&
sshdr->sense_key == UNIT_ATTENTION)
sdev->changed = 1;
@@
-331,7
+331,7
@@
static int sr_done(struct scsi_cmnd *SCpnt)
static int sr_prep_fn(struct request_queue *q, struct request *rq)
{
static int sr_prep_fn(struct request_queue *q, struct request *rq)
{
- int block
=0, this_count, s_size, timeout = SR_TIMEOUT
;
+ int block
= 0, this_count, s_size
;
struct scsi_cd *cd;
struct scsi_cmnd *SCpnt;
struct scsi_device *sdp = q->queuedata;
struct scsi_cd *cd;
struct scsi_cmnd *SCpnt;
struct scsi_device *sdp = q->queuedata;
@@
-461,7
+461,6
@@
static int sr_prep_fn(struct request_queue *q, struct request *rq)
SCpnt->transfersize = cd->device->sector_size;
SCpnt->underflow = this_count << 9;
SCpnt->allowed = MAX_RETRIES;
SCpnt->transfersize = cd->device->sector_size;
SCpnt->underflow = this_count << 9;
SCpnt->allowed = MAX_RETRIES;
- SCpnt->timeout_per_command = timeout;
/*
* This indicates that the command is ready from our end to be
/*
* This indicates that the command is ready from our end to be
@@
-472,38
+471,31
@@
static int sr_prep_fn(struct request_queue *q, struct request *rq)
return scsi_prep_return(q, rq, ret);
}
return scsi_prep_return(q, rq, ret);
}
-static int sr_block_open(struct
inode *inode, struct file *fil
e)
+static int sr_block_open(struct
block_device *bdev, fmode_t mod
e)
{
{
- struct gendisk *disk = inode->i_bdev->bd_disk;
- struct scsi_cd *cd;
- int ret = 0;
-
- if(!(cd = scsi_cd_get(disk)))
- return -ENXIO;
-
- if((ret = cdrom_open(&cd->cdi, inode, file)) != 0)
- scsi_cd_put(cd);
+ struct scsi_cd *cd = scsi_cd_get(bdev->bd_disk);
+ int ret = -ENXIO;
+ if (cd) {
+ ret = cdrom_open(&cd->cdi, bdev, mode);
+ if (ret)
+ scsi_cd_put(cd);
+ }
return ret;
}
return ret;
}
-static int sr_block_release(struct
inode *inode, struct file *fil
e)
+static int sr_block_release(struct
gendisk *disk, fmode_t mod
e)
{
{
- int ret;
- struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk);
- ret = cdrom_release(&cd->cdi, file);
- if(ret)
- return ret;
-
+ struct scsi_cd *cd = scsi_cd(disk);
+ cdrom_release(&cd->cdi, mode);
scsi_cd_put(cd);
scsi_cd_put(cd);
-
return 0;
}
return 0;
}
-static int sr_block_ioctl(struct
inode *inode, struct file *fil
e, unsigned cmd,
+static int sr_block_ioctl(struct
block_device *bdev, fmode_t mod
e, unsigned cmd,
unsigned long arg)
{
unsigned long arg)
{
- struct scsi_cd *cd = scsi_cd(
inode->i_
bdev->bd_disk);
+ struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
struct scsi_device *sdev = cd->device;
void __user *argp = (void __user *)arg;
int ret;
struct scsi_device *sdev = cd->device;
void __user *argp = (void __user *)arg;
int ret;
@@
-518,7
+510,7
@@
static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
return scsi_ioctl(sdev, cmd, argp);
}
return scsi_ioctl(sdev, cmd, argp);
}
- ret = cdrom_ioctl(
file, &cd->cdi, in
ode, cmd, arg);
+ ret = cdrom_ioctl(
&cd->cdi, bdev, m
ode, cmd, arg);
if (ret != -ENOSYS)
return ret;
if (ret != -ENOSYS)
return ret;
@@
-528,7
+520,8
@@
static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
* case fall through to scsi_ioctl, which will return ENDOEV again
* if it doesn't recognise the ioctl
*/
* case fall through to scsi_ioctl, which will return ENDOEV again
* if it doesn't recognise the ioctl
*/
- ret = scsi_nonblockable_ioctl(sdev, cmd, argp, NULL);
+ ret = scsi_nonblockable_ioctl(sdev, cmd, argp,
+ (mode & FMODE_NDELAY) != 0);
if (ret != -ENODEV)
return ret;
return scsi_ioctl(sdev, cmd, argp);
if (ret != -ENODEV)
return ret;
return scsi_ioctl(sdev, cmd, argp);
@@
-545,7
+538,7
@@
static struct block_device_operations sr_bdops =
.owner = THIS_MODULE,
.open = sr_block_open,
.release = sr_block_release,
.owner = THIS_MODULE,
.open = sr_block_open,
.release = sr_block_release,
- .
ioctl
= sr_block_ioctl,
+ .
locked_ioctl
= sr_block_ioctl,
.media_changed = sr_block_media_changed,
/*
* No compat_ioctl for now because sr_block_ioctl never
.media_changed = sr_block_media_changed,
/*
* No compat_ioctl for now because sr_block_ioctl never
@@
-620,6
+613,8
@@
static int sr_probe(struct device *dev)
disk->fops = &sr_bdops;
disk->flags = GENHD_FL_CD;
disk->fops = &sr_bdops;
disk->flags = GENHD_FL_CD;
+ blk_queue_rq_timeout(sdev->request_queue, SR_TIMEOUT);
+
cd->device = sdev;
cd->disk = disk;
cd->driver = &sr_template;
cd->device = sdev;
cd->disk = disk;
cd->driver = &sr_template;
@@
-673,24
+668,20
@@
fail:
static void get_sectorsize(struct scsi_cd *cd)
{
unsigned char cmd[10];
static void get_sectorsize(struct scsi_cd *cd)
{
unsigned char cmd[10];
- unsigned char
*buffer
;
+ unsigned char
buffer[8]
;
int the_result, retries = 3;
int sector_size;
struct request_queue *queue;
int the_result, retries = 3;
int sector_size;
struct request_queue *queue;
- buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
- if (!buffer)
- goto Enomem;
-
do {
cmd[0] = READ_CAPACITY;
memset((void *) &cmd[1], 0, 9);
do {
cmd[0] = READ_CAPACITY;
memset((void *) &cmd[1], 0, 9);
- memset(buffer, 0,
8
);
+ memset(buffer, 0,
sizeof(buffer)
);
/* Do the command and wait.. */
the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE,
/* Do the command and wait.. */
the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE,
- buffer,
8, NULL, SR_TIMEOUT
,
-
MAX_RETRIES
);
+ buffer,
sizeof(buffer), NULL
,
+
SR_TIMEOUT, MAX_RETRIES, NULL
);
retries--;
retries--;
@@
-745,14
+736,8
@@
static void get_sectorsize(struct scsi_cd *cd)
queue = cd->device->request_queue;
blk_queue_hardsect_size(queue, sector_size);
queue = cd->device->request_queue;
blk_queue_hardsect_size(queue, sector_size);
-out:
- kfree(buffer);
- return;
-Enomem:
- cd->capacity = 0x1fffff;
- cd->device->sector_size = 2048; /* A guess, just in case */
- goto out;
+ return;
}
static void get_capabilities(struct scsi_cd *cd)
}
static void get_capabilities(struct scsi_cd *cd)
@@
-888,7
+873,7
@@
static void sr_kref_release(struct kref *kref)
struct gendisk *disk = cd->disk;
spin_lock(&sr_index_lock);
struct gendisk *disk = cd->disk;
spin_lock(&sr_index_lock);
- clear_bit(
disk->first_minor
, sr_index_bits);
+ clear_bit(
MINOR(disk_devt(disk))
, sr_index_bits);
spin_unlock(&sr_index_lock);
unregister_cdrom(&cd->cdi);
spin_unlock(&sr_index_lock);
unregister_cdrom(&cd->cdi);