diff options
author | Oliver Neukum <oliver@neukum.org> | 2005-11-17 12:47:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-17 14:29:54 -0500 |
commit | 9142d59a451731d23539d218c962418acc93283c (patch) | |
tree | 620f7c15bd32f2e21962f20ab82490944b56526f /drivers/usb/image | |
parent | b8f4c1d6674463e5824eada1ad7ec799276718bd (diff) |
[PATCH] USB: Adapt microtek driver to new scsi features
the scsi layer now uses very short sg lists. This breaks the microtek
driver. Here is a patch fixes this and some other issues.
Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/usb/image')
-rw-r--r-- | drivers/usb/image/microtek.c | 35 | ||||
-rw-r--r-- | drivers/usb/image/microtek.h | 2 |
2 files changed, 28 insertions, 9 deletions
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 61a2604cce4f..950543aa5ac7 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -327,6 +327,18 @@ static inline void mts_urb_abort(struct mts_desc* desc) { | |||
327 | usb_kill_urb( desc->urb ); | 327 | usb_kill_urb( desc->urb ); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int mts_slave_alloc (struct scsi_device *s) | ||
331 | { | ||
332 | s->inquiry_len = 0x24; | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static int mts_slave_configure (struct scsi_device *s) | ||
337 | { | ||
338 | blk_queue_dma_alignment(s->request_queue, (512 - 1)); | ||
339 | return 0; | ||
340 | } | ||
341 | |||
330 | static int mts_scsi_abort (Scsi_Cmnd *srb) | 342 | static int mts_scsi_abort (Scsi_Cmnd *srb) |
331 | { | 343 | { |
332 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); | 344 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); |
@@ -411,7 +423,7 @@ static void mts_transfer_done( struct urb *transfer, struct pt_regs *regs ) | |||
411 | MTS_INT_INIT(); | 423 | MTS_INT_INIT(); |
412 | 424 | ||
413 | context->srb->result &= MTS_SCSI_ERR_MASK; | 425 | context->srb->result &= MTS_SCSI_ERR_MASK; |
414 | context->srb->result |= (unsigned)context->status<<1; | 426 | context->srb->result |= (unsigned)(*context->scsi_status)<<1; |
415 | 427 | ||
416 | mts_transfer_cleanup(transfer); | 428 | mts_transfer_cleanup(transfer); |
417 | 429 | ||
@@ -427,7 +439,7 @@ static void mts_get_status( struct urb *transfer ) | |||
427 | mts_int_submit_urb(transfer, | 439 | mts_int_submit_urb(transfer, |
428 | usb_rcvbulkpipe(context->instance->usb_dev, | 440 | usb_rcvbulkpipe(context->instance->usb_dev, |
429 | context->instance->ep_response), | 441 | context->instance->ep_response), |
430 | &context->status, | 442 | context->scsi_status, |
431 | 1, | 443 | 1, |
432 | mts_transfer_done ); | 444 | mts_transfer_done ); |
433 | } | 445 | } |
@@ -481,7 +493,7 @@ static void mts_command_done( struct urb *transfer, struct pt_regs *regs ) | |||
481 | context->data_pipe, | 493 | context->data_pipe, |
482 | context->data, | 494 | context->data, |
483 | context->data_length, | 495 | context->data_length, |
484 | context->srb->use_sg ? mts_do_sg : mts_data_done); | 496 | context->srb->use_sg > 1 ? mts_do_sg : mts_data_done); |
485 | } else { | 497 | } else { |
486 | mts_get_status(transfer); | 498 | mts_get_status(transfer); |
487 | } | 499 | } |
@@ -627,7 +639,6 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback ) | |||
627 | callback(srb); | 639 | callback(srb); |
628 | 640 | ||
629 | } | 641 | } |
630 | |||
631 | out: | 642 | out: |
632 | return err; | 643 | return err; |
633 | } | 644 | } |
@@ -645,6 +656,9 @@ static struct scsi_host_template mts_scsi_host_template = { | |||
645 | .cmd_per_lun = 1, | 656 | .cmd_per_lun = 1, |
646 | .use_clustering = 1, | 657 | .use_clustering = 1, |
647 | .emulated = 1, | 658 | .emulated = 1, |
659 | .slave_alloc = mts_slave_alloc, | ||
660 | .slave_configure = mts_slave_configure, | ||
661 | .max_sectors= 256, /* 128 K */ | ||
648 | }; | 662 | }; |
649 | 663 | ||
650 | struct vendor_product | 664 | struct vendor_product |
@@ -771,8 +785,8 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
771 | MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); | 785 | MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); |
772 | return -ENODEV; | 786 | return -ENODEV; |
773 | } | 787 | } |
774 | 788 | ||
775 | 789 | ||
776 | new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL); | 790 | new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL); |
777 | if (!new_desc) | 791 | if (!new_desc) |
778 | goto out; | 792 | goto out; |
@@ -781,6 +795,10 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
781 | if (!new_desc->urb) | 795 | if (!new_desc->urb) |
782 | goto out_kfree; | 796 | goto out_kfree; |
783 | 797 | ||
798 | new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL); | ||
799 | if (!new_desc->context.scsi_status) | ||
800 | goto out_kfree2; | ||
801 | |||
784 | new_desc->usb_dev = dev; | 802 | new_desc->usb_dev = dev; |
785 | new_desc->usb_intf = intf; | 803 | new_desc->usb_intf = intf; |
786 | init_MUTEX(&new_desc->lock); | 804 | init_MUTEX(&new_desc->lock); |
@@ -817,6 +835,8 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
817 | usb_set_intfdata(intf, new_desc); | 835 | usb_set_intfdata(intf, new_desc); |
818 | return 0; | 836 | return 0; |
819 | 837 | ||
838 | out_kfree2: | ||
839 | kfree(new_desc->context.scsi_status); | ||
820 | out_free_urb: | 840 | out_free_urb: |
821 | usb_free_urb(new_desc->urb); | 841 | usb_free_urb(new_desc->urb); |
822 | out_kfree: | 842 | out_kfree: |
@@ -836,6 +856,7 @@ static void mts_usb_disconnect (struct usb_interface *intf) | |||
836 | 856 | ||
837 | scsi_host_put(desc->host); | 857 | scsi_host_put(desc->host); |
838 | usb_free_urb(desc->urb); | 858 | usb_free_urb(desc->urb); |
859 | kfree(desc->context.scsi_status); | ||
839 | kfree(desc); | 860 | kfree(desc); |
840 | } | 861 | } |
841 | 862 | ||
@@ -856,5 +877,3 @@ module_exit(microtek_drv_exit); | |||
856 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 877 | MODULE_AUTHOR( DRIVER_AUTHOR ); |
857 | MODULE_DESCRIPTION( DRIVER_DESC ); | 878 | MODULE_DESCRIPTION( DRIVER_DESC ); |
858 | MODULE_LICENSE("GPL"); | 879 | MODULE_LICENSE("GPL"); |
859 | |||
860 | |||
diff --git a/drivers/usb/image/microtek.h b/drivers/usb/image/microtek.h index 3271deb8c001..926d4bdc6746 100644 --- a/drivers/usb/image/microtek.h +++ b/drivers/usb/image/microtek.h | |||
@@ -22,7 +22,7 @@ struct mts_transfer_context | |||
22 | int data_pipe; | 22 | int data_pipe; |
23 | int fragment; | 23 | int fragment; |
24 | 24 | ||
25 | u8 status; /* status returned from ep_response after command completion */ | 25 | u8 *scsi_status; /* status returned from ep_response after command completion */ |
26 | }; | 26 | }; |
27 | 27 | ||
28 | 28 | ||