fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / usb / image / microtek.c
index 28538db..8ccddf7 100644 (file)
@@ -225,7 +225,7 @@ static inline void mts_debug_dump(struct mts_desc* desc) {
 }
 
 
-static inline void mts_show_command(Scsi_Cmnd *srb)
+static inline void mts_show_command(struct scsi_cmnd *srb)
 {
        char *what = NULL;
 
@@ -309,7 +309,7 @@ static inline void mts_show_command(Scsi_Cmnd *srb)
 
 #else
 
-static inline void mts_show_command(Scsi_Cmnd * dummy)
+static inline void mts_show_command(struct scsi_cmnd * dummy)
 {
 }
 
@@ -338,7 +338,7 @@ static int mts_slave_configure (struct scsi_device *s)
        return 0;
 }
 
-static int mts_scsi_abort (Scsi_Cmnd *srb)
+static int mts_scsi_abort(struct scsi_cmnd *srb)
 {
        struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
 
@@ -349,7 +349,7 @@ static int mts_scsi_abort (Scsi_Cmnd *srb)
        return FAILED;
 }
 
-static int mts_scsi_host_reset (Scsi_Cmnd *srb)
+static int mts_scsi_host_reset(struct scsi_cmnd *srb)
 {
        struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
        int result, rc;
@@ -360,17 +360,17 @@ static int mts_scsi_host_reset (Scsi_Cmnd *srb)
        rc = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf);
        if (rc < 0)
                return FAILED;
-       result = usb_reset_device(desc->usb_dev);;
+       result = usb_reset_device(desc->usb_dev);
        if (rc)
                usb_unlock_device(desc->usb_dev);
        return result ? FAILED : SUCCESS;
 }
 
-static
-int mts_scsi_queuecommand (Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback );
+static int
+mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback);
 
 static void mts_transfer_cleanup( struct urb *transfer );
-static void mts_do_sg(struct urb * transfer, struct pt_regs *regs);
+static void mts_do_sg(struct urb * transfer);
 
 static inline
 void mts_int_submit_urb (struct urb* transfer,
@@ -417,7 +417,7 @@ static void mts_transfer_cleanup( struct urb *transfer )
 
 }
 
-static void mts_transfer_done( struct urb *transfer, struct pt_regs *regs )
+static void mts_transfer_done( struct urb *transfer )
 {
        MTS_INT_INIT();
 
@@ -443,7 +443,7 @@ static void mts_get_status( struct urb *transfer )
                           mts_transfer_done );
 }
 
-static void mts_data_done( struct urb* transfer, struct pt_regs *regs )
+static void mts_data_done( struct urb* transfer )
 /* Interrupt context! */
 {
        MTS_INT_INIT();
@@ -460,7 +460,7 @@ static void mts_data_done( struct urb* transfer, struct pt_regs *regs )
 }
 
 
-static void mts_command_done( struct urb *transfer, struct pt_regs *regs )
+static void mts_command_done( struct urb *transfer )
 /* Interrupt context! */
 {
        MTS_INT_INIT();
@@ -501,7 +501,7 @@ static void mts_command_done( struct urb *transfer, struct pt_regs *regs )
        return;
 }
 
-static void mts_do_sg (struct urb* transfer, struct pt_regs *regs)
+static void mts_do_sg (struct urb* transfer)
 {
        struct scatterlist * sg;
        MTS_INT_INIT();
@@ -513,7 +513,7 @@ static void mts_do_sg (struct urb* transfer, struct pt_regs *regs)
                mts_transfer_cleanup(transfer);
         }
 
-       sg = context->srb->buffer;
+       sg = context->srb->request_buffer;
        context->fragment++;
        mts_int_submit_urb(transfer,
                           context->data_pipe,
@@ -537,7 +537,7 @@ static const unsigned char mts_direction[256/8] = {
 #define MTS_DIRECTION_IS_IN(x) ((mts_direction[x>>3] >> (x & 7)) & 1)
 
 static void
-mts_build_transfer_context( Scsi_Cmnd *srb, struct mts_desc* desc )
+mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
 {
        int pipe;
        struct scatterlist * sg;
@@ -549,19 +549,19 @@ mts_build_transfer_context( Scsi_Cmnd *srb, struct mts_desc* desc )
        desc->context.fragment = 0;
 
        if (!srb->use_sg) {
-               if ( !srb->bufflen ){
+               if ( !srb->request_bufflen ){
                        desc->context.data = NULL;
                        desc->context.data_length = 0;
                        return;
                } else {
-                       desc->context.data = srb->buffer;
-                       desc->context.data_length = srb->bufflen;
+                       desc->context.data = srb->request_buffer;
+                       desc->context.data_length = srb->request_bufflen;
                        MTS_DEBUG("length = %d or %d\n",
                                  srb->request_bufflen, srb->bufflen);
                }
        } else {
                MTS_DEBUG("Using scatter/gather\n");
-               sg = srb->buffer;
+               sg = srb->request_buffer;
                desc->context.data = page_address(sg[0].page) + sg[0].offset;
                desc->context.data_length = sg[0].length;
        }
@@ -588,8 +588,8 @@ mts_build_transfer_context( Scsi_Cmnd *srb, struct mts_desc* desc )
 }
 
 
-static
-int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback )
+static int
+mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
 {
        struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
        int err = 0;
@@ -796,7 +796,7 @@ static int mts_usb_probe(struct usb_interface *intf,
 
        new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL);
        if (!new_desc->context.scsi_status)
-               goto out_kfree2;
+               goto out_free_urb;
 
        new_desc->usb_dev = dev;
        new_desc->usb_intf = intf;
@@ -822,18 +822,20 @@ static int mts_usb_probe(struct usb_interface *intf,
        new_desc->host = scsi_host_alloc(&mts_scsi_host_template,
                        sizeof(new_desc));
        if (!new_desc->host)
-               goto out_free_urb;
+               goto out_kfree2;
 
        new_desc->host->hostdata[0] = (unsigned long)new_desc;
        if (scsi_add_host(new_desc->host, NULL)) {
                err_retval = -EIO;
-               goto out_free_urb;
+               goto out_host_put;
        }
        scsi_scan_host(new_desc->host);
 
        usb_set_intfdata(intf, new_desc);
        return 0;
 
+ out_host_put:
+       scsi_host_put(new_desc->host);
  out_kfree2:
        kfree(new_desc->context.scsi_status);
  out_free_urb: