summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-10 17:17:53 +0000
commitb2ad5f821b1381492d792ca10b1eb7a107b48f14 (patch)
tree954a648692e7da983db1d2470953705f6a729264 /drivers/usb
parentc9c06167e7933d93a6e396174c68abf242294abb (diff)
Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your
Makefiles.
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Makefile30
-rw-r--r--drivers/usb/serial/Makefile14
-rw-r--r--drivers/usb/storage/Makefile15
-rw-r--r--drivers/usb/storage/scsiglue.c2
-rw-r--r--drivers/usb/storage/usb.c6
-rw-r--r--drivers/usb/usb.c125
6 files changed, 111 insertions, 81 deletions
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 217fa9f2c..c53a93b26 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -4,15 +4,9 @@
# Subdirs.
-SUB_DIRS :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS) serial storage
-
# The target object and module list name.
O_TARGET := usbdrv.o
-M_OBJS :=
-O_OBJS :=
# Objects that export symbols.
@@ -68,35 +62,17 @@ obj-$(CONFIG_USB_NET1080) += net1080.o
# Object files in subdirectories
+subdir-$(CONFIG_USB_SERIAL) += serial
+subdir-$(CONFIG_USB_STORAGE) += storage
+
ifeq ($(CONFIG_USB_SERIAL),y)
- SUB_DIRS += serial
obj-y += serial/usb-serial.o
-else
- ifeq ($(CONFIG_USB_SERIAL),m)
- MOD_SUB_DIRS += serial
- endif
endif
ifeq ($(CONFIG_USB_STORAGE),y)
- SUB_DIRS += storage
obj-y += storage/storage.o
-else
- ifeq ($(CONFIG_USB_STORAGE),m)
- MOD_SUB_DIRS += storage
- endif
endif
-# Translate to Rules.make lists.
-multi-used := $(filter $(list-multi), $(obj-y) $(obj-m))
-multi-objs := $(foreach m, $(multi-used), $($(basename $(m))-objs))
-active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
-
-O_OBJS := $(obj-y)
-M_OBJS := $(obj-m)
-MIX_OBJS := $(filter $(export-objs), $(active-objs))
-
-# The global Rules.make.
-
include $(TOPDIR)/Rules.make
# Link rules for multi-part drivers.
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 97b5516aa..1f73146c5 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -3,16 +3,9 @@
#
O_TARGET := usb-serial.o
-M_OBJS :=
-O_OBJS :=
# Object file lists.
-obj-y :=
-obj-m :=
-obj-n :=
-obj- :=
-
obj-$(CONFIG_USB_SERIAL) += usbserial.o
obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
@@ -28,12 +21,5 @@ obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o
# Objects that export symbols.
export-objs := usbserial.o
-# Translate to Rules.make lists.
-
-O_OBJS := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS := $(sort $(filter $(export-objs), $(obj-y)))
-M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
-
include $(TOPDIR)/Rules.make
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index f0f177d2c..411233648 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -23,21 +23,6 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o
usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
initializers.o $(usb-storage-obj-y)
-# Extract lists of the multi-part drivers.
-# The 'int-*' lists are the intermediate files used to build the multi's.
-multi-y := $(filter $(list-multi), $(obj-y))
-multi-m := $(filter $(list-multi), $(obj-m))
-int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs)))
-int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
-
-# Take multi-part drivers out of obj-y and put components in.
-obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y)
-
-# Translate to Rules.make lists.
-O_OBJS := $(obj-y)
-M_OBJS := $(obj-m)
-MI_OBJS := $(int-m)
-
include $(TOPDIR)/Rules.make
usb-storage.o: $(usb-storage-objs)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 5c50b578c..241f7d5f6 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -248,7 +248,7 @@ static int bus_reset( Scsi_Cmnd *srb )
for (i = 0; i < us->pusb_dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *intf =
&us->pusb_dev->actconfig->interface[i];
- struct usb_device_id *id;
+ const struct usb_device_id *id;
/* if this is an unclaimed interface, skip it */
if (!intf->driver) {
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index ce31133b9..6c254c701 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -93,7 +93,8 @@ static int my_host_number;
struct us_data *us_list;
struct semaphore us_list_semaphore;
-static void * storage_probe(struct usb_device *dev, unsigned int ifnum);
+static void * storage_probe(struct usb_device *dev, unsigned int ifnum,
+ const struct usb_device_id *id);
static void storage_disconnect(struct usb_device *dev, void *ptr);
struct usb_driver usb_storage_driver = {
name: "usb-storage",
@@ -615,7 +616,8 @@ static int usb_stor_allocate_irq(struct us_data *ss)
}
/* Probe to see if a new device is actually a SCSI device */
-static void * storage_probe(struct usb_device *dev, unsigned int ifnum)
+static void * storage_probe(struct usb_device *dev, unsigned int ifnum,
+ const struct usb_device_id *id)
{
int i;
char mf[USB_STOR_STRING_LEN]; /* manufacturer */
diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c
index fad7e48f6..1f531fd6b 100644
--- a/drivers/usb/usb.c
+++ b/drivers/usb/usb.c
@@ -73,6 +73,15 @@ static struct usb_busmap busmap;
static struct usb_driver *usb_minors[16];
+/**
+ * usb_register - register a USB driver
+ * @new_driver: USB operations for the driver
+ *
+ * Registers a USB driver with the USB core. The list of unattached
+ * interfaces will be rescanned whenever a new driver is added, allowing
+ * the new driver to attach to any recognized devices.
+ * Returns a negative error code on failure and 0 on success.
+ */
int usb_register(struct usb_driver *new_driver)
{
if (new_driver->fops != NULL) {
@@ -95,12 +104,14 @@ int usb_register(struct usb_driver *new_driver)
return 0;
}
-/*
- * We go through all existing devices, and see if any of them would
- * be acceptable to the new driver.. This is done using a depth-first
- * search for devices without a registered driver already, then
- * running 'probe' with each of the drivers registered on every one
- * of these.
+/**
+ * usb_scan_devices - scans all unclaimed USB interfaces
+ *
+ * Goes through all unclaimed USB interfaces, and offers them to all
+ * registered USB drivers through the 'probe' function.
+ * This will automatically be called after usb_register is called.
+ * It is called by some of the USB subsystems after one of their subdrivers
+ * are registered.
*/
void usb_scan_devices(void)
{
@@ -152,8 +163,11 @@ static void usb_drivers_purge(struct usb_driver *driver,struct usb_device *dev)
}
}
-/*
- * Unlink a driver from the driver list when it is unloaded
+/**
+ * usb_deregister - unregister a USB driver
+ * @driver: USB operations of the driver to unregister
+ *
+ * Unlinks the specified driver from the internal USB driver list.
*/
void usb_deregister(struct usb_driver *driver)
{
@@ -329,8 +343,16 @@ void usb_release_bandwidth(struct usb_device *dev, struct urb *urb, int isoc)
urb->bandwidth = 0;
}
-/*
- * New functions for (de)registering a controller
+/**
+ * usb_alloc_bus - creates a new USB host controller structure
+ * @op: pointer to a struct usb_operations that this bus structure should use
+ *
+ * Creates a USB host controller bus structure with the specified
+ * usb_operations and initializes all the necessary internal objects.
+ *
+ * If no memory is available, NULL is returned.
+ *
+ * The caller should call usb_free_bus() when it is finished with the structure.
*/
struct usb_bus *usb_alloc_bus(struct usb_operations *op)
{
@@ -356,6 +378,11 @@ struct usb_bus *usb_alloc_bus(struct usb_operations *op)
return bus;
}
+/**
+ * usb_free_bus - frees the memory used by a bus structure
+ * @bus: pointer to the bus to free
+ *
+ */
void usb_free_bus(struct usb_bus *bus)
{
if (!bus)
@@ -364,6 +391,11 @@ void usb_free_bus(struct usb_bus *bus)
kfree(bus);
}
+/**
+ * usb_register_bus - registers the USB host controller with the usb core
+ * @bus: pointer to the bus to register
+ *
+ */
void usb_register_bus(struct usb_bus *bus)
{
int busnum;
@@ -875,6 +907,18 @@ void usb_inc_dev_use(struct usb_device *dev)
* New USB Core Functions
* -------------------------------------------------------------------------------------*/
+/**
+ * usb_alloc_urb - creates a new urb for a USB driver to use
+ * @iso_packets: number of iso packets for this urb
+ *
+ * Creates an urb for the USB driver to use and returns a pointer to it.
+ * If no memory is available, NULL is returned.
+ *
+ * If the driver want to use this urb for interrupt, control, or bulk
+ * endpoints, pass '0' as the number of iso packets.
+ *
+ * The driver should call usb_free_urb() when it is finished with the urb.
+ */
urb_t *usb_alloc_urb(int iso_packets)
{
urb_t *urb;
@@ -893,7 +937,14 @@ urb_t *usb_alloc_urb(int iso_packets)
return urb;
}
-/*-------------------------------------------------------------------*/
+/**
+ * usb_free_urb - frees the memory used by a urb
+ * @urb: pointer to the urb to free
+ *
+ * If an urb is created with a call to usb_create_urb() it should be
+ * cleaned up with a call to usb_free_urb() when the driver is finished
+ * with it.
+ */
void usb_free_urb(urb_t* urb)
{
if (urb)
@@ -1010,12 +1061,27 @@ int usb_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe,
}
-/*-------------------------------------------------------------------*/
-/* usb_control_msg() - builds control urb, and waits for completion */
-/* Synchronous behavior - don't use this function from within an */
-/* interrupt context, (like a bottom half handler.) In this case, */
-/* use usb_submit_urb() directly instead. */
-
+/**
+ * usb_control_msg - Builds a control urb, sends it off and waits for completion
+ * @dev: pointer to the usb device to send the message to
+ * @pipe: endpoint "pipe" to send the message to
+ * @request: USB message request value
+ * @requesttype: USB message request type value
+ * @value: USB message value
+ * @index: USB message index value
+ * @data: pointer to the data to send
+ * @size: length in bytes of the data to send
+ * @timeout: time to wait for the message to complete before timing out (if 0 the wait is forever)
+ *
+ * This function sends a simple control message to a specified endpoint
+ * and waits for the message to complete, or timeout.
+ *
+ * If successful, it returns 0, othwise a negative error number.
+ *
+ * Don't use this function from within an interrupt context, like a
+ * bottom half handler. If you need a asyncronous message, or need to send
+ * a message from within interrupt context, use usb_submit_urb()
+ */
int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype,
__u16 value, __u16 index, void *data, __u16 size, int timeout)
{
@@ -1040,12 +1106,27 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u
return ret;
}
-/*-------------------------------------------------------------------*/
-/* usb_bulk_msg() Builds a bulk urb, and waits for completion. */
-/* Synchronous behavior - don't use this function from within an */
-/* interrupt context, (like a bottom half handler.) In this case, */
-/* use usb_submit_urb() directly instead. */
+/**
+ * usb_bulk_msg - Builds a bulk urb, sends it off and waits for completion
+ * @usb_dev: pointer to the usb device to send the message to
+ * @pipe: endpoint "pipe" to send the message to
+ * @data: pointer to the data to send
+ * @len: length in bytes of the data to send
+ * @actual_length: pointer to a location to put the actual length transfered in bytes
+ * @timeout: time to wait for the message to complete before timing out (if 0 the wait is forever)
+ *
+ * This function sends a simple bulk message to a specified endpoint
+ * and waits for the message to complete, or timeout.
+ *
+ * If successful, it returns 0, othwise a negative error number.
+ * The number of actual bytes transferred will be plaed in the
+ * actual_timeout paramater.
+ *
+ * Don't use this function from within an interrupt context, like a
+ * bottom half handler. If you need a asyncronous message, or need to
+ * send a message from within interrupt context, use usb_submit_urb()
+ */
int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
void *data, int len, int *actual_length, int timeout)
{