Linux Kernel
3.7.1
|
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/rwsem.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include "usb.h"
Go to the source code of this file.
Data Structures | |
struct | usb_class |
Macros | |
#define | MAX_USB_MINORS 256 |
Functions | |
int | usb_major_init (void) |
void | usb_major_cleanup (void) |
int | usb_register_dev (struct usb_interface *intf, struct usb_class_driver *class_driver) |
EXPORT_SYMBOL_GPL (usb_register_dev) | |
void | usb_deregister_dev (struct usb_interface *intf, struct usb_class_driver *class_driver) |
EXPORT_SYMBOL_GPL (usb_deregister_dev) | |
EXPORT_SYMBOL_GPL | ( | usb_register_dev | ) |
EXPORT_SYMBOL_GPL | ( | usb_deregister_dev | ) |
void usb_deregister_dev | ( | struct usb_interface * | intf, |
struct usb_class_driver * | class_driver | ||
) |
usb_deregister_dev - deregister a USB device's dynamic minor. : pointer to the usb_interface that is being deregistered : pointer to the usb_class_driver for this device
Used in conjunction with usb_register_dev(). This function is called when the USB driver is finished with the minor numbers gotten from a call to usb_register_dev() (usually when the device is disconnected from the system.)
This function also removes the usb class device from the sysfs tree.
This should be called by all drivers that use the USB major number.
int usb_register_dev | ( | struct usb_interface * | intf, |
struct usb_class_driver * | class_driver | ||
) |
usb_register_dev - register a USB device, and ask for a minor number : pointer to the usb_interface that is being registered : pointer to the usb_class_driver for this device
This should be called by all USB drivers that use the USB major number. If CONFIG_USB_DYNAMIC_MINORS is enabled, the minor number will be dynamically allocated out of the list of available ones. If it is not enabled, the minor number will be based on the next available free minor, starting at the class_driver->minor_base.
This function also creates a usb class device in the sysfs tree.
usb_deregister_dev() must be called when the driver is done with the minor numbers given out by this function.
Returns -EINVAL if something bad happens with trying to register a device, and 0 on success.