X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fstorage%2Fjumpshot.c;h=5031aa98f6a977d13760cc9cde790e0e79751018;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=77429109c6f6bff43156cdcb0a8bb6201d75be05;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 77429109c..5031aa98f 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -47,15 +47,19 @@ * in that routine. */ +#include +#include +#include + +#include +#include + +#include "usb.h" #include "transport.h" #include "protocol.h" -#include "usb.h" #include "debug.h" #include "jumpshot.h" -#include -#include -#include static inline int jumpshot_bulk_read(struct us_data *us, unsigned char *data, @@ -253,7 +257,7 @@ static int jumpshot_write_data(struct us_data *us, if (result != USB_STOR_TRANSPORT_GOOD) { // I have not experimented to find the smallest value. // - wait_ms(50); + msleep(50); } } while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10)); @@ -319,7 +323,7 @@ static int jumpshot_id_device(struct us_data *us, } static int jumpshot_handle_mode_sense(struct us_data *us, - Scsi_Cmnd * srb, + struct scsi_cmnd * srb, int sense_6) { static unsigned char rw_err_page[12] = { @@ -409,14 +413,14 @@ static int jumpshot_handle_mode_sense(struct us_data *us, if (sense_6) ptr[0] = i - 1; else - ((u16 *) ptr)[0] = cpu_to_be16(i - 2); + ((__be16 *) ptr)[0] = cpu_to_be16(i - 2); usb_stor_set_xfer_buf(ptr, i, srb); return USB_STOR_TRANSPORT_GOOD; } -void jumpshot_info_destructor(void *extra) +static void jumpshot_info_destructor(void *extra) { // this routine is a placeholder... // currently, we don't allocate any extra blocks so we're okay @@ -426,7 +430,7 @@ void jumpshot_info_destructor(void *extra) // Transport for the Lexar 'Jumpshot' // -int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us) +int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us) { struct jumpshot_info *info; int rc; @@ -437,12 +441,11 @@ int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us) }; if (!us->extra) { - us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_NOIO); + us->extra = kzalloc(sizeof(struct jumpshot_info), GFP_NOIO); if (!us->extra) { US_DEBUGP("jumpshot_transport: Gah! Can't allocate storage for jumpshot info struct!\n"); return USB_STOR_TRANSPORT_ERROR; } - memset(us->extra, 0, sizeof(struct jumpshot_info)); us->extra_destructor = jumpshot_info_destructor; } @@ -471,8 +474,8 @@ int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us) // build the reply // - ((u32 *) ptr)[0] = cpu_to_be32(info->sectors); - ((u32 *) ptr)[1] = cpu_to_be32(info->ssize); + ((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1); + ((__be32 *) ptr)[1] = cpu_to_be32(info->ssize); usb_stor_set_xfer_buf(ptr, 8, srb); return USB_STOR_TRANSPORT_GOOD; @@ -551,12 +554,12 @@ int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us) if (srb->cmnd[0] == MODE_SENSE) { US_DEBUGP("jumpshot_transport: MODE_SENSE_6 detected\n"); - return jumpshot_handle_mode_sense(us, srb, TRUE); + return jumpshot_handle_mode_sense(us, srb, 1); } if (srb->cmnd[0] == MODE_SENSE_10) { US_DEBUGP("jumpshot_transport: MODE_SENSE_10 detected\n"); - return jumpshot_handle_mode_sense(us, srb, FALSE); + return jumpshot_handle_mode_sense(us, srb, 0); } if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {