[usb] Allow USB device IDs to include arbitrary driver-specific data

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/43/head
Michael Brown 2015-12-07 00:32:08 +00:00
parent eb1fc1e957
commit fb8c52de9b
2 changed files with 9 additions and 3 deletions

View File

@ -1186,6 +1186,11 @@ static int usb_probe ( struct usb_function *func,
return -ENOENT; return -ENOENT;
} }
/* Record driver */
func->driver = driver;
func->id = id;
func->dev.driver_name = id->name;
/* Probe driver */ /* Probe driver */
if ( ( rc = driver->probe ( func, config ) ) != 0 ) { if ( ( rc = driver->probe ( func, config ) ) != 0 ) {
DBGC ( usb, "USB %s failed to probe driver %s: %s\n", 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; return rc;
} }
/* Record driver */
func->driver = driver;
func->dev.driver_name = id->name;
return 0; return 0;
} }

View File

@ -662,6 +662,8 @@ struct usb_function {
struct usb_driver *driver; struct usb_driver *driver;
/** Driver private data */ /** Driver private data */
void *priv; void *priv;
/** Driver device ID */
struct usb_device_id *id;
/** List of interface numbers /** List of interface numbers
* *
@ -1308,6 +1310,8 @@ struct usb_device_id {
uint16_t vendor; uint16_t vendor;
/** Product ID */ /** Product ID */
uint16_t product; uint16_t product;
/** Arbitrary driver data */
unsigned long driver_data;
}; };
/** Match-anything ID */ /** Match-anything ID */