Greg, please apply this patch from Alan to 2.5

Matt

----- Forwarded message from Alan Stern <[EMAIL PROTECTED]> -----

Date: Tue, 15 Jul 2003 16:24:40 -0400 (EDT)
From: Alan Stern <[EMAIL PROTECTED]>
Subject: [usb-storage] PATCH: (as59) Make sddr55 use proper I/O buffering
To: Matthew Dharm <[EMAIL PROTECTED]>
cc: USB Storage List <[EMAIL PROTECTED]>
List-Id: Linux USB Mass Storage Driver Developers List <usb-storage.one-eyed-alien.net>
X-Spam-Status: No, hits=-4.0 required=5.0 tests=UNIFIED_PATCH,RCVD_IN_ORBS version=2.11

Matt:

This patch makes the sddr55 subdriver use proper DMA I/O buffering.

Alan Stern


# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.1655  -> 1.1656 
#       drivers/usb/storage/sddr55.c    1.11    -> 1.12   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/09      [EMAIL PROTECTED]       1.1656
# Make the sddr55 subdriver use proper DMA buffers.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
--- a/drivers/usb/storage/sddr55.c      Wed Jul  9 15:49:51 2003
+++ b/drivers/usb/storage/sddr55.c      Wed Jul  9 15:49:51 2003
@@ -91,13 +91,14 @@
 static int sddr55_status(struct us_data *us)
 {
        int result;
-       unsigned char command[8] = {
-               0, 0, 0, 0, 0, 0xb0, 0, 0x80
-       };
-       unsigned char status[8];
+       unsigned char *command = us->iobuf;
+       unsigned char *status = us->iobuf;
        struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
 
        /* send command */
+       memset(command, 0, 8);
+       command[5] = 0xB0;
+       command[7] = 0x80;
        result = sddr55_bulk_transport(us,
                SCSI_DATA_WRITE, command, 8);
 
@@ -158,10 +159,8 @@
                int use_sg) {
 
        int result = USB_STOR_TRANSPORT_GOOD;
-       unsigned char command[8] = {
-               0, 0, 0, 0, 0, 0xb0, 0, 0x85
-       };
-       unsigned char status[8];
+       unsigned char *command = us->iobuf;
+       unsigned char *status = us->iobuf;
        struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
 
        unsigned int pba;
@@ -205,11 +204,15 @@
 
                        address = (pba << info->blockshift) + page;
 
+                       command[0] = 0;
                        command[1] = LSB_of(address>>16);
                        command[2] = LSB_of(address>>8);
                        command[3] = LSB_of(address);
 
+                       command[4] = 0;
+                       command[5] = 0xB0;
                        command[6] = LSB_of(pages << (1 - info->smallpageshift));
+                       command[7] = 0x85;
 
                        /* send command */
                        result = sddr55_bulk_transport(us,
@@ -274,10 +277,8 @@
                int use_sg) {
 
        int result = USB_STOR_TRANSPORT_GOOD;
-       unsigned char command[8] = {
-               0, 0, 0, 0, 0, 0xb0, 0, 0x86
-       };
-       unsigned char status[8];
+       unsigned char *command = us->iobuf;
+       unsigned char *status = us->iobuf;
        struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
 
        unsigned int pba;
@@ -380,6 +381,8 @@
                command[6] = MSB_of(lba % 1000);
 
                command[4] |= LSB_of(pages >> info->smallpageshift);
+               command[5] = 0xB0;
+               command[7] = 0x86;
 
                /* send command */
                result = sddr55_bulk_transport(us,
@@ -473,11 +476,12 @@
                unsigned char *deviceID) {
 
        int result;
-       unsigned char command[8] = {
-               0, 0, 0, 0, 0, 0xb0, 0, 0x84
-       };
-       unsigned char content[64];
+       unsigned char *command = us->iobuf;
+       unsigned char *content = us->iobuf;
 
+       memset(command, 0, 8);
+       command[5] = 0xB0;
+       command[7] = 0x84;
        result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
 
        US_DEBUGP("Result of send_control for device ID is %d\n",
@@ -598,7 +602,7 @@
        struct sddr55_card_info *info = (struct sddr55_card_info *)(us->extra);
        int numblocks;
        unsigned char *buffer;
-       unsigned char command[8] = { 0, 0, 0, 0, 0, 0xb0, 0, 0x8a};     
+       unsigned char *command = us->iobuf;
        int i;
        unsigned short lba;
        unsigned short max_lba;
@@ -614,7 +618,10 @@
        if (!buffer)
                return -1;
 
+       memset(command, 0, 8);
+       command[5] = 0xB0;
        command[6] = numblocks * 2 / 256;
+       command[7] = 0x8A;
 
        result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
 

_______________________________________________
usb-storage mailing list
[EMAIL PROTECTED]
http://www2.one-eyed-alien.net/mailman/listinfo/usb-storage

----- End forwarded message -----

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Okay, this isn't funny anymore! Let me down!  I'll tell Bill on you!!
                                        -- Microsoft Salesman
User Friendly, 4/1/1998

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to