Hi!
I try to make code more readable... So typedefs with just one use are
gone, spinlock is now static and usb_driver is moved to the end so
that no prototypes are needed. Please apply,
Pavel
--- usb-storage.c.ofic Fri Mar 31 23:12:25 2000
+++ usb-storage.c Fri Mar 31 23:17:35 2000
@@ -53,18 +53,12 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+static int my_host_number = 0;
+
/*
* Per device data
*/
-static int my_host_number;
-
-struct us_data;
-
-typedef int (*trans_cmnd)(Scsi_Cmnd*, struct us_data*);
-typedef int (*trans_reset)(struct us_data*);
-typedef void (*proto_cmnd)(Scsi_Cmnd*, struct us_data*);
-
/* we allocate one of these for every device that we remember */
struct us_data {
struct us_data *next; /* next device */
@@ -84,9 +78,9 @@
__u8 protocol;
/* function pointers for this device */
- trans_cmnd transport; /* transport function */
- trans_reset transport_reset; /* transport device reset */
- proto_cmnd proto_handler; /* protocol handler */
+ int (*transport)(Scsi_Cmnd*, struct us_data*); /*
+transport function */
+ int (*transport_reset)(struct us_data*); /*
+transport device reset */
+ int (*proto_handler)(Scsi_Cmnd*, struct us_data*); /*
+protocol handler */
/* SCSI interfaces */
GUID(guid); /* unique dev id */
@@ -127,16 +121,7 @@
/* The list of structures and the protective lock for them */
static struct us_data *us_list;
-spinlock_t us_list_spinlock = SPIN_LOCK_UNLOCKED;
-
-static void * storage_probe(struct usb_device *dev, unsigned int ifnum);
-static void storage_disconnect(struct usb_device *dev, void *ptr);
-static struct usb_driver storage_driver = {
- "usb-storage",
- storage_probe,
- storage_disconnect,
- { NULL, NULL }
-};
+static spinlock_t us_list_spinlock = SPIN_LOCK_UNLOCKED;
/***********************************************************************
* Data transfer routines
@@ -174,16 +159,14 @@
}
/* did we send all the data? */
- if (partial == length) {
+ if (partial == length)
return US_BULK_TRANSFER_GOOD;
- }
/* uh oh... we have an error code, so something went wrong. */
if (result) {
/* NAK - that means we've retried a few times allready */
- if (result == -ETIMEDOUT) {
+ if (result == -ETIMEDOUT)
US_DEBUGP("us_bulk_transfer: device NAKed\n");
- }
return US_BULK_TRANSFER_FAILED;
}
@@ -1871,6 +1854,12 @@
spin_unlock_irqrestore(&(ss->dev_spinlock), flags);
}
+static struct usb_driver storage_driver = {
+ "usb-storage",
+ storage_probe,
+ storage_disconnect,
+ { NULL, NULL }
+};
/***********************************************************************
* Initialization and registration
--
I'm [EMAIL PROTECTED] "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents me at [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]