diff options
author | Jens Axboe <axboe@suse.de> | 2005-06-20 08:06:01 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2005-06-20 08:06:01 -0400 |
commit | dd1cab95f356f1395278633565f198463cf6bd24 (patch) | |
tree | ddf12e2fad7c0df0656a10ee6aac3f12a04dbed8 /drivers/cdrom | |
parent | b823825e8e09aac6dc1ca362cd5639a87329d636 (diff) |
[PATCH] Cleanup blk_rq_map_* interfaces
Change the blk_rq_map_user() and blk_rq_map_kern() interface to require
a previously allocated request to be passed in. This is both more efficient
for multiple iterations of mapping data to the same request, and it is also
a much nicer API.
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/cdrom.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index beaa561f2ed8..6a7d926774a1 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2097,6 +2097,10 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2097 | if (!q) | 2097 | if (!q) |
2098 | return -ENXIO; | 2098 | return -ENXIO; |
2099 | 2099 | ||
2100 | rq = blk_get_request(q, READ, GFP_KERNEL); | ||
2101 | if (!rq) | ||
2102 | return -ENOMEM; | ||
2103 | |||
2100 | cdi->last_sense = 0; | 2104 | cdi->last_sense = 0; |
2101 | 2105 | ||
2102 | while (nframes) { | 2106 | while (nframes) { |
@@ -2108,9 +2112,9 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2108 | 2112 | ||
2109 | len = nr * CD_FRAMESIZE_RAW; | 2113 | len = nr * CD_FRAMESIZE_RAW; |
2110 | 2114 | ||
2111 | rq = blk_rq_map_user(q, READ, ubuf, len); | 2115 | ret = blk_rq_map_user(q, rq, ubuf, len); |
2112 | if (IS_ERR(rq)) | 2116 | if (ret) |
2113 | return PTR_ERR(rq); | 2117 | break; |
2114 | 2118 | ||
2115 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 2119 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
2116 | rq->cmd[0] = GPCMD_READ_CD; | 2120 | rq->cmd[0] = GPCMD_READ_CD; |
@@ -2138,7 +2142,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2138 | cdi->last_sense = s->sense_key; | 2142 | cdi->last_sense = s->sense_key; |
2139 | } | 2143 | } |
2140 | 2144 | ||
2141 | if (blk_rq_unmap_user(rq, bio, len)) | 2145 | if (blk_rq_unmap_user(bio, len)) |
2142 | ret = -EFAULT; | 2146 | ret = -EFAULT; |
2143 | 2147 | ||
2144 | if (ret) | 2148 | if (ret) |
@@ -2149,6 +2153,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2149 | ubuf += len; | 2153 | ubuf += len; |
2150 | } | 2154 | } |
2151 | 2155 | ||
2156 | blk_put_request(rq); | ||
2152 | return ret; | 2157 | return ret; |
2153 | } | 2158 | } |
2154 | 2159 | ||