summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@maxwell.earthlink.net>2002-09-16 19:34:34 -0700
committerJames Simmons <jsimmons@maxwell.earthlink.net>2002-09-16 19:34:34 -0700
commit586d2a0d222c497a8f707bf464e48e968129202f (patch)
treee7d9bccb51e1505688aa53d4eaf7fce76f025281 /include
parentc598bcd01bd613127079f83a58cfda8cdfbc8bcc (diff)
parent6b29059af3cb8607e055c5051c608a876572cdf7 (diff)
Merge http://linuxconsole.bkbits.net/stable
into maxwell.earthlink.net:/usr/src/console-stable
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/hardirq.h2
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/usb.h43
3 files changed, 30 insertions, 27 deletions
diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h
index 291ce33484b3..0b521e86de2f 100644
--- a/include/asm-i386/hardirq.h
+++ b/include/asm-i386/hardirq.h
@@ -77,7 +77,7 @@ typedef struct {
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#if CONFIG_PREEMPT
-# define in_atomic() (preempt_count() != kernel_locked())
+# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else
# define in_atomic() (preempt_count() != 0)
diff --git a/include/linux/device.h b/include/linux/device.h
index 9b310071cb41..21f789350502 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -306,6 +306,18 @@ g_list_to_dev(struct list_head *g_list)
return list_entry(g_list, struct device, g_list);
}
+static inline void *
+dev_get_drvdata (struct device *dev)
+{
+ return dev->driver_data;
+}
+
+static inline void
+dev_set_drvdata (struct device *dev, void *data)
+{
+ dev->driver_data = data;
+}
+
/*
* High level routines for use by the bus drivers
*/
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7e78883daa20..5d323aa0d36e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -227,7 +227,7 @@ struct usb_interface {
int act_altsetting; /* active alternate setting */
int num_altsetting; /* number of alternate settings */
int max_altsetting; /* total memory allocated */
-
+
struct usb_driver *driver; /* driver */
struct device dev; /* interface specific device info */
void *private_data;
@@ -399,9 +399,6 @@ extern struct usb_device *usb_get_dev(struct usb_device *dev);
extern void usb_free_dev(struct usb_device *);
#define usb_put_dev usb_free_dev
-/* for when layers above USB add new non-USB drivers */
-extern void usb_scan_devices(void);
-
/* mostly for devices emulating SCSI over USB */
extern int usb_reset_device(struct usb_device *dev);
@@ -623,10 +620,10 @@ struct usb_device_id {
* expose information to user space regardless of where they
* do (or don't) show up otherwise in the filesystem.
* @id_table: USB drivers use ID table to support hotplugging.
- * Export this with MODULE_DEVICE_TABLE(usb,...), or use NULL to
- * say that probe() should be called for any unclaimed interfce.
+ * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
+ * or your driver's probe function will never get called.
*
- * USB drivers should provide a name, probe() and disconnect() methods,
+ * USB drivers must provide a name, probe() and disconnect() methods,
* and an id_table. Other driver fields are optional.
*
* The id_table is used in hotplugging. It holds a set of descriptors,
@@ -643,32 +640,23 @@ struct usb_device_id {
*/
struct usb_driver {
struct module *owner;
+
const char *name;
- void *(*probe)(
- struct usb_device *dev, /* the device */
- unsigned intf, /* what interface */
- const struct usb_device_id *id /* from id_table */
- );
- void (*disconnect)(
- struct usb_device *dev, /* the device */
- void *handle /* as returned by probe() */
- );
-
- struct list_head driver_list;
- struct semaphore serialize;
+ int (*probe) (struct usb_interface *intf,
+ const struct usb_device_id *id);
- /* ioctl -- userspace apps can talk to drivers through usbfs */
- int (*ioctl)(struct usb_device *dev, unsigned int code, void *buf);
+ void (*disconnect) (struct usb_interface *intf);
+
+ int (*ioctl) (struct usb_device *dev, unsigned int code, void *buf);
- /* support for "new-style" USB hotplugging */
const struct usb_device_id *id_table;
- /* suspend before the bus suspends;
- * disconnect or resume when the bus resumes */
- /* void (*suspend)(struct usb_device *dev); */
- /* void (*resume)(struct usb_device *dev); */
+ struct device_driver driver;
+
+ struct semaphore serialize;
};
+#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
extern struct bus_type usb_bus_type;
@@ -682,6 +670,9 @@ extern void usb_deregister(struct usb_driver *);
extern int usb_register_dev(struct file_operations *fops, int minor, int num_minors, int *start_minor);
extern void usb_deregister_dev(int num_minors, int start_minor);
+extern int usb_device_probe(struct device *dev);
+extern int usb_device_remove(struct device *dev);
+
/* -------------------------------------------------------------------------- */
/*