USB: Convert from class_device to device for USB core
Convert from class_device to device for drivers/usb/core. Signed-off-by: Tony Jones <tonyj@suse.de> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
de6f92b9ee
Коммит
5a3201b280
|
@ -807,13 +807,13 @@ static int usb_register_bus(struct usb_bus *bus)
|
||||||
}
|
}
|
||||||
set_bit (busnum, busmap.busmap);
|
set_bit (busnum, busmap.busmap);
|
||||||
bus->busnum = busnum;
|
bus->busnum = busnum;
|
||||||
bus->class_dev = class_device_create(usb_host_class, NULL, MKDEV(0,0),
|
|
||||||
bus->controller, "usb_host%d",
|
bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0),
|
||||||
busnum);
|
"usb_host%d", busnum);
|
||||||
result = PTR_ERR(bus->class_dev);
|
result = PTR_ERR(bus->dev);
|
||||||
if (IS_ERR(bus->class_dev))
|
if (IS_ERR(bus->dev))
|
||||||
goto error_create_class_dev;
|
goto error_create_class_dev;
|
||||||
class_set_devdata(bus->class_dev, bus);
|
dev_set_drvdata(bus->dev, bus);
|
||||||
|
|
||||||
/* Add it to the local list of buses */
|
/* Add it to the local list of buses */
|
||||||
list_add (&bus->bus_list, &usb_bus_list);
|
list_add (&bus->bus_list, &usb_bus_list);
|
||||||
|
@ -857,7 +857,7 @@ static void usb_deregister_bus (struct usb_bus *bus)
|
||||||
|
|
||||||
clear_bit (bus->busnum, busmap.busmap);
|
clear_bit (bus->busnum, busmap.busmap);
|
||||||
|
|
||||||
class_device_unregister(bus->class_dev);
|
device_unregister(bus->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -442,7 +442,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_async (struct class_device *class_dev, char *buf)
|
show_async(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -454,7 +454,7 @@ show_async (struct class_device *class_dev, char *buf)
|
||||||
|
|
||||||
*buf = 0;
|
*buf = 0;
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ehci = hcd_to_ehci (hcd);
|
ehci = hcd_to_ehci (hcd);
|
||||||
next = buf;
|
next = buf;
|
||||||
|
@ -479,12 +479,12 @@ show_async (struct class_device *class_dev, char *buf)
|
||||||
|
|
||||||
return strlen (buf);
|
return strlen (buf);
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
|
static DEVICE_ATTR(async, S_IRUGO, show_async, NULL);
|
||||||
|
|
||||||
#define DBG_SCHED_LIMIT 64
|
#define DBG_SCHED_LIMIT 64
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_periodic (struct class_device *class_dev, char *buf)
|
show_periodic(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -500,7 +500,7 @@ show_periodic (struct class_device *class_dev, char *buf)
|
||||||
return 0;
|
return 0;
|
||||||
seen_count = 0;
|
seen_count = 0;
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ehci = hcd_to_ehci (hcd);
|
ehci = hcd_to_ehci (hcd);
|
||||||
next = buf;
|
next = buf;
|
||||||
|
@ -623,12 +623,12 @@ show_periodic (struct class_device *class_dev, char *buf)
|
||||||
|
|
||||||
return PAGE_SIZE - size;
|
return PAGE_SIZE - size;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
|
static DEVICE_ATTR(periodic, S_IRUGO, show_periodic, NULL);
|
||||||
|
|
||||||
#undef DBG_SCHED_LIMIT
|
#undef DBG_SCHED_LIMIT
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_registers (struct class_device *class_dev, char *buf)
|
show_registers(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -639,7 +639,7 @@ show_registers (struct class_device *class_dev, char *buf)
|
||||||
static char fmt [] = "%*s\n";
|
static char fmt [] = "%*s\n";
|
||||||
static char label [] = "";
|
static char label [] = "";
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ehci = hcd_to_ehci (hcd);
|
ehci = hcd_to_ehci (hcd);
|
||||||
next = buf;
|
next = buf;
|
||||||
|
@ -789,25 +789,25 @@ done:
|
||||||
|
|
||||||
return PAGE_SIZE - size;
|
return PAGE_SIZE - size;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
|
static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
|
||||||
|
|
||||||
static inline void create_debug_files (struct ehci_hcd *ehci)
|
static inline void create_debug_files (struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev;
|
struct device *dev = ehci_to_hcd(ehci)->self.dev;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_async);
|
retval = device_create_file(dev, &dev_attr_async);
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_periodic);
|
retval = device_create_file(dev, &dev_attr_periodic);
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_registers);
|
retval = device_create_file(dev, &dev_attr_registers);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void remove_debug_files (struct ehci_hcd *ehci)
|
static inline void remove_debug_files (struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev;
|
struct device *dev = ehci_to_hcd(ehci)->self.dev;
|
||||||
|
|
||||||
class_device_remove_file(cldev, &class_device_attr_async);
|
device_remove_file(dev, &dev_attr_async);
|
||||||
class_device_remove_file(cldev, &class_device_attr_periodic);
|
device_remove_file(dev, &dev_attr_periodic);
|
||||||
class_device_remove_file(cldev, &class_device_attr_registers);
|
device_remove_file(dev, &dev_attr_registers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* STUB_DEBUG_FILES */
|
#endif /* STUB_DEBUG_FILES */
|
||||||
|
|
|
@ -291,14 +291,16 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Display the ports dedicated to the companion controller */
|
/* Display the ports dedicated to the companion controller */
|
||||||
static ssize_t show_companion(struct class_device *class_dev, char *buf)
|
static ssize_t show_companion(struct device *dev,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
char *buf)
|
||||||
{
|
{
|
||||||
struct ehci_hcd *ehci;
|
struct ehci_hcd *ehci;
|
||||||
int nports, index, n;
|
int nports, index, n;
|
||||||
int count = PAGE_SIZE;
|
int count = PAGE_SIZE;
|
||||||
char *ptr = buf;
|
char *ptr = buf;
|
||||||
|
|
||||||
ehci = hcd_to_ehci(bus_to_hcd(class_get_devdata(class_dev)));
|
ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
|
||||||
nports = HCS_N_PORTS(ehci->hcs_params);
|
nports = HCS_N_PORTS(ehci->hcs_params);
|
||||||
|
|
||||||
for (index = 0; index < nports; ++index) {
|
for (index = 0; index < nports; ++index) {
|
||||||
|
@ -316,15 +318,16 @@ static ssize_t show_companion(struct class_device *class_dev, char *buf)
|
||||||
* Syntax is "[-]portnum", where a leading '-' sign means
|
* Syntax is "[-]portnum", where a leading '-' sign means
|
||||||
* return control of the port to the EHCI controller.
|
* return control of the port to the EHCI controller.
|
||||||
*/
|
*/
|
||||||
static ssize_t store_companion(struct class_device *class_dev,
|
static ssize_t store_companion(struct device *dev,
|
||||||
const char *buf, size_t count)
|
struct device_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
struct ehci_hcd *ehci;
|
struct ehci_hcd *ehci;
|
||||||
int portnum, new_owner, try;
|
int portnum, new_owner, try;
|
||||||
u32 __iomem *status_reg;
|
u32 __iomem *status_reg;
|
||||||
u32 port_status;
|
u32 port_status;
|
||||||
|
|
||||||
ehci = hcd_to_ehci(bus_to_hcd(class_get_devdata(class_dev)));
|
ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
|
||||||
new_owner = PORT_OWNER; /* Owned by companion */
|
new_owner = PORT_OWNER; /* Owned by companion */
|
||||||
if (sscanf(buf, "%d", &portnum) != 1)
|
if (sscanf(buf, "%d", &portnum) != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -364,7 +367,7 @@ static ssize_t store_companion(struct class_device *class_dev,
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR(companion, 0644, show_companion, store_companion);
|
static DEVICE_ATTR(companion, 0644, show_companion, store_companion);
|
||||||
|
|
||||||
static inline void create_companion_file(struct ehci_hcd *ehci)
|
static inline void create_companion_file(struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
|
@ -372,16 +375,16 @@ static inline void create_companion_file(struct ehci_hcd *ehci)
|
||||||
|
|
||||||
/* with integrated TT there is no companion! */
|
/* with integrated TT there is no companion! */
|
||||||
if (!ehci_is_TDI(ehci))
|
if (!ehci_is_TDI(ehci))
|
||||||
i = class_device_create_file(ehci_to_hcd(ehci)->self.class_dev,
|
i = device_create_file(ehci_to_hcd(ehci)->self.dev,
|
||||||
&class_device_attr_companion);
|
&dev_attr_companion);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void remove_companion_file(struct ehci_hcd *ehci)
|
static inline void remove_companion_file(struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
/* with integrated TT there is no companion! */
|
/* with integrated TT there is no companion! */
|
||||||
if (!ehci_is_TDI(ehci))
|
if (!ehci_is_TDI(ehci))
|
||||||
class_device_remove_file(ehci_to_hcd(ehci)->self.class_dev,
|
device_remove_file(ehci_to_hcd(ehci)->self.dev,
|
||||||
&class_device_attr_companion);
|
&dev_attr_companion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -468,7 +468,7 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_async (struct class_device *class_dev, char *buf)
|
show_async(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -476,7 +476,7 @@ show_async (struct class_device *class_dev, char *buf)
|
||||||
size_t temp;
|
size_t temp;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ohci = hcd_to_ohci(hcd);
|
ohci = hcd_to_ohci(hcd);
|
||||||
|
|
||||||
|
@ -488,13 +488,13 @@ show_async (struct class_device *class_dev, char *buf)
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
|
static DEVICE_ATTR(async, S_IRUGO, show_async, NULL);
|
||||||
|
|
||||||
|
|
||||||
#define DBG_SCHED_LIMIT 64
|
#define DBG_SCHED_LIMIT 64
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_periodic (struct class_device *class_dev, char *buf)
|
show_periodic(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -509,7 +509,7 @@ show_periodic (struct class_device *class_dev, char *buf)
|
||||||
return 0;
|
return 0;
|
||||||
seen_count = 0;
|
seen_count = 0;
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ohci = hcd_to_ohci(hcd);
|
ohci = hcd_to_ohci(hcd);
|
||||||
next = buf;
|
next = buf;
|
||||||
|
@ -589,13 +589,13 @@ show_periodic (struct class_device *class_dev, char *buf)
|
||||||
|
|
||||||
return PAGE_SIZE - size;
|
return PAGE_SIZE - size;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
|
static DEVICE_ATTR(periodic, S_IRUGO, show_periodic, NULL);
|
||||||
|
|
||||||
|
|
||||||
#undef DBG_SCHED_LIMIT
|
#undef DBG_SCHED_LIMIT
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
show_registers (struct class_device *class_dev, char *buf)
|
show_registers(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct usb_bus *bus;
|
struct usb_bus *bus;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -606,7 +606,7 @@ show_registers (struct class_device *class_dev, char *buf)
|
||||||
char *next;
|
char *next;
|
||||||
u32 rdata;
|
u32 rdata;
|
||||||
|
|
||||||
bus = class_get_devdata(class_dev);
|
bus = dev_get_drvdata(dev);
|
||||||
hcd = bus_to_hcd(bus);
|
hcd = bus_to_hcd(bus);
|
||||||
ohci = hcd_to_ohci(hcd);
|
ohci = hcd_to_ohci(hcd);
|
||||||
regs = ohci->regs;
|
regs = ohci->regs;
|
||||||
|
@ -679,27 +679,27 @@ done:
|
||||||
spin_unlock_irqrestore (&ohci->lock, flags);
|
spin_unlock_irqrestore (&ohci->lock, flags);
|
||||||
return PAGE_SIZE - size;
|
return PAGE_SIZE - size;
|
||||||
}
|
}
|
||||||
static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
|
static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
|
||||||
|
|
||||||
|
|
||||||
static inline void create_debug_files (struct ohci_hcd *ohci)
|
static inline void create_debug_files (struct ohci_hcd *ohci)
|
||||||
{
|
{
|
||||||
struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev;
|
struct device *dev = ohci_to_hcd(ohci)->self.dev;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_async);
|
retval = device_create_file(dev, &dev_attr_async);
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_periodic);
|
retval = device_create_file(dev, &dev_attr_periodic);
|
||||||
retval = class_device_create_file(cldev, &class_device_attr_registers);
|
retval = device_create_file(dev, &dev_attr_registers);
|
||||||
ohci_dbg (ohci, "created debug files\n");
|
ohci_dbg (ohci, "created debug files\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void remove_debug_files (struct ohci_hcd *ohci)
|
static inline void remove_debug_files (struct ohci_hcd *ohci)
|
||||||
{
|
{
|
||||||
struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev;
|
struct device *dev = ohci_to_hcd(ohci)->self.dev;
|
||||||
|
|
||||||
class_device_remove_file(cldev, &class_device_attr_async);
|
device_remove_file(dev, &dev_attr_async);
|
||||||
class_device_remove_file(cldev, &class_device_attr_periodic);
|
device_remove_file(dev, &dev_attr_periodic);
|
||||||
class_device_remove_file(cldev, &class_device_attr_registers);
|
device_remove_file(dev, &dev_attr_registers);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -318,7 +318,7 @@ struct usb_bus {
|
||||||
#ifdef CONFIG_USB_DEVICEFS
|
#ifdef CONFIG_USB_DEVICEFS
|
||||||
struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
|
struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
|
||||||
#endif
|
#endif
|
||||||
struct class_device *class_dev; /* class device for this bus */
|
struct device *dev; /* device for this bus */
|
||||||
|
|
||||||
#if defined(CONFIG_USB_MON)
|
#if defined(CONFIG_USB_MON)
|
||||||
struct mon_bus *mon_bus; /* non-null when associated */
|
struct mon_bus *mon_bus; /* non-null when associated */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче