/[linux-patches]/genpatches-2.6/tags/2.6.14-5/2900_microtek-fix.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.14-5/2900_microtek-fix.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 226 - (show annotations) (download)
Fri Dec 2 12:14:55 2005 UTC (12 years, 4 months ago) by dsd
File size: 3635 byte(s)
2.6.14-5 release
1 From: Oliver Neukum <oliver@neukum.org>
2 Date: Thu, 17 Nov 2005 17:47:41 +0000 (-0800)
3 Subject: [PATCH] USB: Adapt microtek driver to new scsi features
4 X-Git-Tag: v2.6.15-rc2
5 X-Git-Url: http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9142d59a451731d23539d218c962418acc93283c
6
7 [PATCH] USB: Adapt microtek driver to new scsi features
8
9 the scsi layer now uses very short sg lists. This breaks the microtek
10 driver. Here is a patch fixes this and some other issues.
11
12 Signed-off-by: Oliver Neukum <oliver@neukum.name>
13 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
15 ---
16
17 --- a/drivers/usb/image/microtek.c
18 +++ b/drivers/usb/image/microtek.c
19 @@ -327,6 +327,18 @@ static inline void mts_urb_abort(struct
20 usb_kill_urb( desc->urb );
21 }
22
23 +static int mts_slave_alloc (struct scsi_device *s)
24 +{
25 + s->inquiry_len = 0x24;
26 + return 0;
27 +}
28 +
29 +static int mts_slave_configure (struct scsi_device *s)
30 +{
31 + blk_queue_dma_alignment(s->request_queue, (512 - 1));
32 + return 0;
33 +}
34 +
35 static int mts_scsi_abort (Scsi_Cmnd *srb)
36 {
37 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
38 @@ -411,7 +423,7 @@ static void mts_transfer_done( struct ur
39 MTS_INT_INIT();
40
41 context->srb->result &= MTS_SCSI_ERR_MASK;
42 - context->srb->result |= (unsigned)context->status<<1;
43 + context->srb->result |= (unsigned)(*context->scsi_status)<<1;
44
45 mts_transfer_cleanup(transfer);
46
47 @@ -427,7 +439,7 @@ static void mts_get_status( struct urb *
48 mts_int_submit_urb(transfer,
49 usb_rcvbulkpipe(context->instance->usb_dev,
50 context->instance->ep_response),
51 - &context->status,
52 + context->scsi_status,
53 1,
54 mts_transfer_done );
55 }
56 @@ -481,7 +493,7 @@ static void mts_command_done( struct urb
57 context->data_pipe,
58 context->data,
59 context->data_length,
60 - context->srb->use_sg ? mts_do_sg : mts_data_done);
61 + context->srb->use_sg > 1 ? mts_do_sg : mts_data_done);
62 } else {
63 mts_get_status(transfer);
64 }
65 @@ -627,7 +639,6 @@ int mts_scsi_queuecommand( Scsi_Cmnd *sr
66 callback(srb);
67
68 }
69 -
70 out:
71 return err;
72 }
73 @@ -645,6 +656,9 @@ static struct scsi_host_template mts_scs
74 .cmd_per_lun = 1,
75 .use_clustering = 1,
76 .emulated = 1,
77 + .slave_alloc = mts_slave_alloc,
78 + .slave_configure = mts_slave_configure,
79 + .max_sectors= 256, /* 128 K */
80 };
81
82 struct vendor_product
83 @@ -781,6 +795,10 @@ static int mts_usb_probe(struct usb_inte
84 if (!new_desc->urb)
85 goto out_kfree;
86
87 + new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL);
88 + if (!new_desc->context.scsi_status)
89 + goto out_kfree2;
90 +
91 new_desc->usb_dev = dev;
92 new_desc->usb_intf = intf;
93 init_MUTEX(&new_desc->lock);
94 @@ -817,6 +835,8 @@ static int mts_usb_probe(struct usb_inte
95 usb_set_intfdata(intf, new_desc);
96 return 0;
97
98 + out_kfree2:
99 + kfree(new_desc->context.scsi_status);
100 out_free_urb:
101 usb_free_urb(new_desc->urb);
102 out_kfree:
103 @@ -836,6 +856,7 @@ static void mts_usb_disconnect (struct u
104
105 scsi_host_put(desc->host);
106 usb_free_urb(desc->urb);
107 + kfree(desc->context.scsi_status);
108 kfree(desc);
109 }
110
111 @@ -856,5 +877,3 @@ module_exit(microtek_drv_exit);
112 MODULE_AUTHOR( DRIVER_AUTHOR );
113 MODULE_DESCRIPTION( DRIVER_DESC );
114 MODULE_LICENSE("GPL");
115 -
116 -
117 --- a/drivers/usb/image/microtek.h
118 +++ b/drivers/usb/image/microtek.h
119 @@ -22,7 +22,7 @@ struct mts_transfer_context
120 int data_pipe;
121 int fragment;
122
123 - u8 status; /* status returned from ep_response after command completion */
124 + u8 *scsi_status; /* status returned from ep_response after command completion */
125 };
126
127

  ViewVC Help
Powered by ViewVC 1.1.20