Lines Matching defs:driver

3  * drivers/usb/core/driver.c - most of the driver model stuff for usb
21 * NOTE! This is not actually a driver at all, rather this is
39 * Adds a new dynamic USBdevice ID to this driver,
40 * and cause the driver to probe for all devices again.
44 struct device_driver *driver,
102 retval = driver_attach(driver);
131 static ssize_t new_id_show(struct device_driver *driver, char *buf)
133 struct usb_driver *usb_drv = to_usb_driver(driver);
138 static ssize_t new_id_store(struct device_driver *driver,
141 struct usb_driver *usb_drv = to_usb_driver(driver);
143 return usb_store_new_id(&usb_drv->dynids, usb_drv->id_table, driver, buf, count);
148 * Remove a USB device ID from this driver
150 static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
154 struct usb_driver *usb_driver = to_usb_driver(driver);
178 static ssize_t remove_id_show(struct device_driver *driver, char *buf)
180 return new_id_show(driver, buf);
192 error = driver_create_file(&usb_drv->driver,
195 error = driver_create_file(&usb_drv->driver,
198 driver_remove_file(&usb_drv->driver,
212 driver_remove_file(&usb_drv->driver,
214 driver_remove_file(&usb_drv->driver,
248 /* called from driver core with dev locked */
251 struct usb_device_driver *udriver = to_usb_device_driver(dev->driver);
260 * unless the driver supports autosuspend.
272 /* Probe the USB device with the driver in hand, but only
273 * defer to a generic driver in case the current USB
274 * device driver has an id_table or a match function; i.e.,
275 * when the device driver was explicitly matched against
278 * If the device driver does not have either of these,
280 * not truly a more specialized/non-generic driver, so a
282 * to be handled by the generic USB driver, as there
283 * can still be another, more specialized, device driver.
285 * This accommodates the usbip driver.
305 /* called from driver core with dev locked */
309 struct usb_device_driver *udriver = to_usb_device_driver(dev->driver);
320 /* called from driver core with dev locked */
323 struct usb_driver *driver = to_usb_driver(dev->driver);
346 id = usb_match_dynamic_id(intf, driver);
348 id = usb_match_id(intf, driver->id_table);
361 * runtime-PM-enabled only if the driver has autosuspend support.
366 if (driver->supports_autosuspend)
369 /* If the new driver doesn't allow hub-initiated LPM, and we can't
380 if (driver->disable_hub_initiated_lpm) {
383 dev_err(&intf->dev, "%s Failed to disable LPM for driver %s\n",
384 __func__, driver->name);
399 error = driver->probe(intf, id);
422 if (driver->supports_autosuspend)
430 /* called from driver core with dev locked */
433 struct usb_driver *driver = to_usb_driver(dev->driver);
447 * the driver is unbound. If LPM isn't disabled, that's fine because it
451 if (driver->disable_hub_initiated_lpm)
455 * Terminate all URBs for this interface unless the driver
458 if (!driver->soft_unbind || udev->state == USB_STATE_NOTATTACHED)
461 driver->disconnect(intf);
510 if (driver->supports_autosuspend)
521 * usb_driver_claim_interface - bind a driver to an interface
522 * @driver: the driver to be bound
525 * @data: driver data associated with that interface
529 * No device driver should directly modify internal usb_interface or
532 * Callers must own the device lock, so driver probe() entries don't need
538 int usb_driver_claim_interface(struct usb_driver *driver,
548 if (dev->driver)
555 dev->driver = &driver->driver;
562 * runtime-PM-enabled, but only if the driver has autosuspend
568 if (driver->supports_autosuspend)
580 dev->driver = NULL;
589 if (driver->supports_autosuspend)
599 * usb_driver_release_interface - unbind a driver from an interface
600 * @driver: the driver to be unbound
605 * also causes the driver disconnect() method to be called.
608 * Callers must own the device lock, so driver disconnect() entries don't
612 void usb_driver_release_interface(struct usb_driver *driver,
618 if (!dev->driver || dev->driver != &driver->driver)
626 /* Release via the driver core only if the interface
634 dev->driver = NULL;
739 * This is used when binding (or rebinding) a driver to an interface.
741 * but some layered driver frameworks use it directly.
743 * modutils, to support the driver loading functionality of USB hotplugging.
757 * as a driver's "modules.usbmap" entry if you provide an id with
759 * driver's probe() routine should use additional intelligence to
765 * driver selection must come from smart driver id records.
815 indicates that the driver want to examine every
872 /* If the device driver under consideration does not have a
873 * id_table or a match function, then let the driver's probe
920 /* driver is often null here; dev_dbg() would oops */
936 /* class-based driver binding models */
952 /* Don't reprobe if current driver isn't usb_generic_driver */
953 if (dev->driver != &usb_generic_driver.driver)
973 * usb_register_device_driver - register a USB device (not interface) driver
974 * @new_udriver: USB operations for the device driver
975 * @owner: module owner of this driver.
977 * Registers a USB device driver with the USB core. The list of
978 * unattached devices will be rescanned whenever a new driver is
979 * added, allowing the new driver to attach to any recognized devices.
991 new_udriver->driver.name = new_udriver->name;
992 new_udriver->driver.bus = &usb_bus_type;
993 new_udriver->driver.probe = usb_probe_device;
994 new_udriver->driver.remove = usb_unbind_device;
995 new_udriver->driver.owner = owner;
996 new_udriver->driver.dev_groups = new_udriver->dev_groups;
998 retval = driver_register(&new_udriver->driver);
1001 pr_info("%s: registered new device driver %s\n",
1005 * this new driver
1010 pr_err("%s: error %d registering device driver %s\n",
1019 * usb_deregister_device_driver - unregister a USB device (not interface) driver
1020 * @udriver: USB operations of the device driver to unregister
1023 * Unlinks the specified driver from the internal USB driver list.
1027 pr_info("%s: deregistering device driver %s\n",
1030 driver_unregister(&udriver->driver);
1035 * usb_register_driver - register a USB interface driver
1036 * @new_driver: USB operations for the interface driver
1037 * @owner: module owner of this driver.
1040 * Registers a USB interface driver with the USB core. The list of
1041 * unattached interfaces will be rescanned whenever a new driver is
1042 * added, allowing the new driver to attach to any recognized interfaces.
1046 * NOTE: if you want your driver to use the USB major number, you must call
1058 new_driver->driver.name = new_driver->name;
1059 new_driver->driver.bus = &usb_bus_type;
1060 new_driver->driver.probe = usb_probe_interface;
1061 new_driver->driver.remove = usb_unbind_interface;
1062 new_driver->driver.owner = owner;
1063 new_driver->driver.mod_name = mod_name;
1064 new_driver->driver.dev_groups = new_driver->dev_groups;
1068 retval = driver_register(&new_driver->driver);
1076 pr_info("%s: registered new interface driver %s\n",
1083 driver_unregister(&new_driver->driver);
1085 pr_err("%s: error %d registering interface driver %s\n",
1092 * usb_deregister - unregister a USB interface driver
1093 * @driver: USB operations of the interface driver to unregister
1096 * Unlinks the specified driver from the internal USB driver list.
1099 * usb_deregister_dev() to clean up your driver's allocated minor numbers,
1102 void usb_deregister(struct usb_driver *driver)
1104 pr_info("%s: deregistering interface driver %s\n",
1105 usbcore_name, driver->name);
1107 usb_remove_newid_files(driver);
1108 driver_unregister(&driver->driver);
1109 usb_free_dynids(driver);
1113 /* Forced unbinding of a USB interface driver, either because
1121 struct usb_driver *driver = to_usb_driver(intf->dev.driver);
1124 usb_driver_release_interface(driver, intf);
1146 if (intf->dev.driver && intf->needs_binding)
1152 /* Delayed forced unbinding of a USB interface driver and scan
1164 /* Delayed unbind of an existing driver */
1165 if (intf->dev.driver)
1232 if (intf->dev.driver) {
1233 drv = to_usb_driver(intf->dev.driver);
1250 /* For devices that don't have a driver, we do a generic suspend. */
1251 if (udev->dev.driver)
1252 udriver = to_usb_device_driver(udev->dev.driver);
1275 /* Can't resume it if it doesn't have a driver. */
1276 if (udev->dev.driver == NULL) {
1291 udriver = to_usb_device_driver(udev->dev.driver);
1305 struct usb_driver *driver;
1311 driver = to_usb_driver(intf->dev.driver);
1313 /* at this time we know the driver supports suspend */
1314 status = driver->suspend(intf, msg);
1326 struct usb_driver *driver;
1336 /* Can't resume it if it doesn't have a driver. */
1351 driver = to_usb_driver(intf->dev.driver);
1354 if (driver->reset_resume) {
1355 status = driver->reset_resume(intf);
1361 dev_dbg(&intf->dev, "no reset_resume for driver %s?\n",
1362 driver->name);
1365 status = driver->resume(intf);
1373 /* Later we will unbind the driver and/or reprobe, if necessary */
1394 * driver may be made without the protection of @udev's device lock, but
1495 * driver may be made without the protection of @udev's device lock, but
1726 * This routine should be called by an interface driver when it is
1728 * example would be a character-device driver when its device file is
1760 * Typically a driver would call this routine during an URB's completion
1800 * This routine should be called by an interface driver when it wants to
1806 * driver when its device file is opened.
1913 struct usb_driver *driver;
1915 driver = to_usb_driver(intf->dev.driver);
1916 if (!driver->reset_resume ||
2001 if (hcd->driver->set_usb2_hw_lpm) {
2002 ret = hcd->driver->set_usb2_hw_lpm(hcd, udev, enable);