public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net, oliver@neukum.org
Subject: [patch 14/22] USB: Adapt microtek driver to new scsi features
Date: Thu, 17 Nov 2005 09:47:41 -0800	[thread overview]
Message-ID: <20051117174741.GO11174@kroah.com> (raw)
In-Reply-To: <20051117174609.GA11174@kroah.com>

[-- Attachment #1: usb-adapt-microtek-driver-to-new-scsi-features.patch --]
[-- Type: text/plain, Size: 3689 bytes --]

From: Oliver Neukum <oliver@neukum.org>

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>

---
 drivers/usb/image/microtek.c |   35 +++++++++++++++++++++++++++--------
 drivers/usb/image/microtek.h |    2 +-
 2 files changed, 28 insertions(+), 9 deletions(-)

--- usb-2.6.orig/drivers/usb/image/microtek.c
+++ usb-2.6/drivers/usb/image/microtek.c
@@ -327,6 +327,18 @@ static inline void mts_urb_abort(struct 
 	usb_kill_urb( desc->urb );
 }
 
+static int mts_slave_alloc (struct scsi_device *s)
+{
+	s->inquiry_len = 0x24;
+	return 0;
+}
+
+static int mts_slave_configure (struct scsi_device *s)
+{
+	blk_queue_dma_alignment(s->request_queue, (512 - 1));
+	return 0;
+}
+
 static int mts_scsi_abort (Scsi_Cmnd *srb)
 {
 	struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
@@ -411,7 +423,7 @@ static void mts_transfer_done( struct ur
 	MTS_INT_INIT();
 
 	context->srb->result &= MTS_SCSI_ERR_MASK;
-	context->srb->result |= (unsigned)context->status<<1;
+	context->srb->result |= (unsigned)(*context->scsi_status)<<1;
 
 	mts_transfer_cleanup(transfer);
 
@@ -427,7 +439,7 @@ static void mts_get_status( struct urb *
 	mts_int_submit_urb(transfer,
 			   usb_rcvbulkpipe(context->instance->usb_dev,
 					   context->instance->ep_response),
-			   &context->status,
+			   context->scsi_status,
 			   1,
 			   mts_transfer_done );
 }
@@ -481,7 +493,7 @@ static void mts_command_done( struct urb
 					   context->data_pipe,
 					   context->data,
 					   context->data_length,
-					   context->srb->use_sg ? mts_do_sg : mts_data_done);
+					   context->srb->use_sg > 1 ? mts_do_sg : mts_data_done);
 		} else {
 			mts_get_status(transfer);
 		}
@@ -627,7 +639,6 @@ int mts_scsi_queuecommand( Scsi_Cmnd *sr
 			callback(srb);
 
 	}
-
 out:
 	return err;
 }
@@ -645,6 +656,9 @@ static struct scsi_host_template mts_scs
 	.cmd_per_lun =		1,
 	.use_clustering =	1,
 	.emulated =		1,
+	.slave_alloc =		mts_slave_alloc,
+	.slave_configure =	mts_slave_configure,
+	.max_sectors=		256, /* 128 K */
 };
 
 struct vendor_product
@@ -771,8 +785,8 @@ static int mts_usb_probe(struct usb_inte
 		MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" );
 		return -ENODEV;
 	}
-	
-	
+
+
 	new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL);
 	if (!new_desc)
 		goto out;
@@ -781,6 +795,10 @@ static int mts_usb_probe(struct usb_inte
 	if (!new_desc->urb)
 		goto out_kfree;
 
+	new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL);
+	if (!new_desc->context.scsi_status)
+		goto out_kfree2;
+
 	new_desc->usb_dev = dev;
 	new_desc->usb_intf = intf;
 	init_MUTEX(&new_desc->lock);
@@ -817,6 +835,8 @@ static int mts_usb_probe(struct usb_inte
 	usb_set_intfdata(intf, new_desc);
 	return 0;
 
+ out_kfree2:
+	kfree(new_desc->context.scsi_status);
  out_free_urb:
 	usb_free_urb(new_desc->urb);
  out_kfree:
@@ -836,6 +856,7 @@ static void mts_usb_disconnect (struct u
 
 	scsi_host_put(desc->host);
 	usb_free_urb(desc->urb);
+	kfree(desc->context.scsi_status);
 	kfree(desc);
 }
 
@@ -856,5 +877,3 @@ module_exit(microtek_drv_exit);
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
-
-
--- usb-2.6.orig/drivers/usb/image/microtek.h
+++ usb-2.6/drivers/usb/image/microtek.h
@@ -22,7 +22,7 @@ struct mts_transfer_context
 	int data_pipe;
 	int fragment;
 
-	u8 status; /* status returned from ep_response after command completion */
+	u8 *scsi_status; /* status returned from ep_response after command completion */
 };
 
 

--

  parent reply	other threads:[~2005-11-17 18:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051117174227.007572000@press.kroah.org>
2005-11-17 17:46 ` [patch 00/22] USB patches for 2.6.15-rc1 Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 01/22] USB: fix build breakage in dummy_hcd.c Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 02/22] USB Serial: rename ChangeLog.old Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 03/22] USB: add new wacom devices to usb hid-core list Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 06/22] USB: Delete leftovers from bluetty driver Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 05/22] USB: fix 'unused variable' warning Greg Kroah-Hartman
2005-11-17 17:46   ` [patch 04/22] USB: wacom tablet driver update Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 08/22] USB: usbdevfs_ioctl 32bit fix Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 07/22] usbfs: usbfs_dir_inode_operations cleanup Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 09/22] USB: kill unneccessary usb-storage blacklist entries Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 10/22] USB: cp2101.c: Jablotron usb serial interface identification Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 11/22] USB: onetouch doesn't suspend yet Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 12/22] USB: pl2303: adds new IDs Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 13/22] USB: pl2303: updates pl2303_update_line_status() Greg Kroah-Hartman
2005-11-17 17:47   ` Greg Kroah-Hartman [this message]
2005-11-17 17:47   ` [patch 16/22] USB: fix race in kaweth disconnect Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 17/22] usb devio warning fix Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 18/22] USB: Maxtor OneTouch button support for older drives Greg Kroah-Hartman
2005-11-17 17:47   ` [patch 19/22] USB: OHCI lh7a404 platform device conversion fixup Greg Kroah-Hartman
2005-11-17 17:48   ` [patch 15/22] usb-storage: Fix detection of kodak flash readers in shuttle_usbat driver Greg Kroah-Hartman
2005-11-17 17:48   ` [patch 20/22] USB: move CONFIG_USB_DEBUG checks into the Makefile Greg Kroah-Hartman
2005-11-17 17:48   ` Greg Kroah-Hartman
2005-11-17 17:48   ` [patch 21/22] USB: delete the nokia_dku2 driver Greg Kroah-Hartman
2005-11-17 17:48   ` [patch 22/22] USB: add the anydata usb-serial driver Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051117174741.GO11174@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oliver@neukum.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox