aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-12-07 00:32:08 +0000
committerMichael Brown <mcb30@ipxe.org>2015-12-07 13:08:23 +0000
commitfb8c52de9b50d3562ce08469f23bbd221946519d (patch)
tree08cccbbed849605a6f41fe8b4733f44f1cc0a6ae /src
parenteb1fc1e9579a4f70bb28283bf3eadcf493fa0dcb (diff)
downloadipxe-fb8c52de9b50d3562ce08469f23bbd221946519d.tar.gz
[usb] Allow USB device IDs to include arbitrary driver-specific data
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/bus/usb.c8
-rw-r--r--src/include/ipxe/usb.h4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c
index a3718d831..b1fa4efb5 100644
--- a/src/drivers/bus/usb.c
+++ b/src/drivers/bus/usb.c
@@ -1186,6 +1186,11 @@ static int usb_probe ( struct usb_function *func,
return -ENOENT;
}
+ /* Record driver */
+ func->driver = driver;
+ func->id = id;
+ func->dev.driver_name = id->name;
+
/* Probe driver */
if ( ( rc = driver->probe ( func, config ) ) != 0 ) {
DBGC ( usb, "USB %s failed to probe driver %s: %s\n",
@@ -1193,9 +1198,6 @@ static int usb_probe ( struct usb_function *func,
return rc;
}
- /* Record driver */
- func->driver = driver;
- func->dev.driver_name = id->name;
return 0;
}
diff --git a/src/include/ipxe/usb.h b/src/include/ipxe/usb.h
index c268988f4..37b6d94ed 100644
--- a/src/include/ipxe/usb.h
+++ b/src/include/ipxe/usb.h
@@ -662,6 +662,8 @@ struct usb_function {
struct usb_driver *driver;
/** Driver private data */
void *priv;
+ /** Driver device ID */
+ struct usb_device_id *id;
/** List of interface numbers
*
@@ -1308,6 +1310,8 @@ struct usb_device_id {
uint16_t vendor;
/** Product ID */
uint16_t product;
+ /** Arbitrary driver data */
+ unsigned long driver_data;
};
/** Match-anything ID */