07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

148 /* set up data structures for the wakeup system */<br />

149 init_completion(&urb_done);<br />

150<br />

151 /* fill the common fields in the URB */<br />

152 us->current_urb->context = &urb_done;<br />

153 us->current_urb->actual_length = 0;<br />

154 us->current_urb->error_count = 0;<br />

155 us->current_urb->status = 0;<br />

156<br />

157 /* we assume that if transfer_buffer isn't us->iobuf then it<br />

158 * hasn't been mapped for DMA. Yes, this is clunky, but it's<br />

159 * easier than always having the caller tell us whether the<br />

160 * transfer buffer has already been mapped. */<br />

161 us->current_urb->transfer_flags =<br />

162 URB_ASYNC_UNLINK | URB_NO_SETUP_DMA_MAP;<br />

163 if (us->current_urb->transfer_buffer == us->iobuf)<br />

164 us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;<br />

165 us->current_urb->transfer_dma = us->iobuf_dma;<br />

75<br />

166 us->current_urb->setup_dma = us->cr_dma;<br />

167<br />

168 /* submit the URB */<br />

169 status = usb_submit_urb(us->current_urb, GFP_NOIO);<br />

170 if (status) {<br />

171 /* something went wrong */<br />

172 return status;<br />

173 }<br />

174<br />

175 /* since the URB has been submitted successfully, it's now okay<br />

176 * to cancel it */<br />

177 set_bit(US_FLIDX_URB_ACTIVE, &us->flags);<br />

178<br />

179 /* did an abort/disconnect occur during the submission? */<br />

180 if (us->flags & ABORTING_OR_DISCONNECTING) {<br />

181<br />

182 /* cancel the URB, if it hasn't been cancelled already */<br />

183 if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) {<br />

184 US_DEBUGP("-- cancelling URB\n");<br />

185 usb_unlink_urb(us->current_urb);<br />

186 }<br />

187 }<br />

188<br />

189 /* submit the timeout timer, if a timeout was requested */<br />

190 if (timeout > 0) {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!