aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2007-09-11 17:07:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:34:46 -0500
commit5a3201b2809a9f7bcda8413c445483f5b5e490a3 (patch)
tree3be21f9b9a8fa953645b889bbf31c3b8ec6f19a0 /drivers/usb
parentde6f92b9ee00e9f841fb1a63d0bd60593ec55dbe (diff)
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hcd.c14
-rw-r--r--drivers/usb/host/ehci-dbg.c34
-rw-r--r--drivers/usb/host/ehci-hub.c23
-rw-r--r--drivers/usb/host/ohci-dbg.c34
4 files changed, 54 insertions, 51 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d5ed3fa9e304..372372116bb0 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -807,13 +807,13 @@ static int usb_register_bus(struct usb_bus *bus)
807 } 807 }
808 set_bit (busnum, busmap.busmap); 808 set_bit (busnum, busmap.busmap);
809 bus->busnum = busnum; 809 bus->busnum = busnum;
810 bus->class_dev = class_device_create(usb_host_class, NULL, MKDEV(0,0), 810
811 bus->controller, "usb_host%d", 811 bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0),
812 busnum); 812 "usb_host%d", busnum);
813 result = PTR_ERR(bus->class_dev); 813 result = PTR_ERR(bus->dev);
814 if (IS_ERR(bus->class_dev)) 814 if (IS_ERR(bus->dev))
815 goto error_create_class_dev; 815 goto error_create_class_dev;
816 class_set_devdata(bus->class_dev, bus); 816 dev_set_drvdata(bus->dev, bus);
817 817
818 /* Add it to the local list of buses */ 818 /* Add it to the local list of buses */
819 list_add (&bus->bus_list, &usb_bus_list); 819 list_add (&bus->bus_list, &usb_bus_list);
@@ -857,7 +857,7 @@ static void usb_deregister_bus (struct usb_bus *bus)
857 857
858 clear_bit (bus->busnum, busmap.busmap); 858 clear_bit (bus->busnum, busmap.busmap);
859 859
860 class_device_unregister(bus->class_dev); 860 device_unregister(bus->dev);
861} 861}
862 862
863/** 863/**
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index c9cc4413198e..754a146cf828 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -442,7 +442,7 @@ done:
442} 442}
443 443
444static ssize_t 444static ssize_t
445show_async (struct class_device *class_dev, char *buf) 445show_async(struct device *dev, struct device_attribute *attr, char *buf)
446{ 446{
447 struct usb_bus *bus; 447 struct usb_bus *bus;
448 struct usb_hcd *hcd; 448 struct usb_hcd *hcd;
@@ -454,7 +454,7 @@ show_async (struct class_device *class_dev, char *buf)
454 454
455 *buf = 0; 455 *buf = 0;
456 456
457 bus = class_get_devdata(class_dev); 457 bus = dev_get_drvdata(dev);
458 hcd = bus_to_hcd(bus); 458 hcd = bus_to_hcd(bus);
459 ehci = hcd_to_ehci (hcd); 459 ehci = hcd_to_ehci (hcd);
460 next = buf; 460 next = buf;
@@ -479,12 +479,12 @@ show_async (struct class_device *class_dev, char *buf)
479 479
480 return strlen (buf); 480 return strlen (buf);
481} 481}
482static CLASS_DEVICE_ATTR (async, S_IRUGO, show_async, NULL); 482static DEVICE_ATTR(async, S_IRUGO, show_async, NULL);
483 483
484#define DBG_SCHED_LIMIT 64 484#define DBG_SCHED_LIMIT 64
485 485
486static ssize_t 486static ssize_t
487show_periodic (struct class_device *class_dev, char *buf) 487show_periodic(struct device *dev, struct device_attribute *attr, char *buf)
488{ 488{
489 struct usb_bus *bus; 489 struct usb_bus *bus;
490 struct usb_hcd *hcd; 490 struct usb_hcd *hcd;
@@ -500,7 +500,7 @@ show_periodic (struct class_device *class_dev, char *buf)
500 return 0; 500 return 0;
501 seen_count = 0; 501 seen_count = 0;
502 502
503 bus = class_get_devdata(class_dev); 503 bus = dev_get_drvdata(dev);
504 hcd = bus_to_hcd(bus); 504 hcd = bus_to_hcd(bus);
505 ehci = hcd_to_ehci (hcd); 505 ehci = hcd_to_ehci (hcd);
506 next = buf; 506 next = buf;
@@ -623,12 +623,12 @@ show_periodic (struct class_device *class_dev, char *buf)
623 623
624 return PAGE_SIZE - size; 624 return PAGE_SIZE - size;
625} 625}
626static CLASS_DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL); 626static DEVICE_ATTR(periodic, S_IRUGO, show_periodic, NULL);
627 627
628#undef DBG_SCHED_LIMIT 628#undef DBG_SCHED_LIMIT
629 629
630static ssize_t 630static ssize_t
631show_registers (struct class_device *class_dev, char *buf) 631show_registers(struct device *dev, struct device_attribute *attr, char *buf)
632{ 632{
633 struct usb_bus *bus; 633 struct usb_bus *bus;
634 struct usb_hcd *hcd; 634 struct usb_hcd *hcd;
@@ -639,7 +639,7 @@ show_registers (struct class_device *class_dev, char *buf)
639 static char fmt [] = "%*s\n"; 639 static char fmt [] = "%*s\n";
640 static char label [] = ""; 640 static char label [] = "";
641 641
642 bus = class_get_devdata(class_dev); 642 bus = dev_get_drvdata(dev);
643 hcd = bus_to_hcd(bus); 643 hcd = bus_to_hcd(bus);
644 ehci = hcd_to_ehci (hcd); 644 ehci = hcd_to_ehci (hcd);
645 next = buf; 645 next = buf;
@@ -789,25 +789,25 @@ done:
789 789
790 return PAGE_SIZE - size; 790 return PAGE_SIZE - size;
791} 791}
792static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); 792static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
793 793
794static inline void create_debug_files (struct ehci_hcd *ehci) 794static inline void create_debug_files (struct ehci_hcd *ehci)
795{ 795{
796 struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev; 796 struct device *dev = ehci_to_hcd(ehci)->self.dev;
797 int retval; 797 int retval;
798 798
799 retval = class_device_create_file(cldev, &class_device_attr_async); 799 retval = device_create_file(dev, &dev_attr_async);
800 retval = class_device_create_file(cldev, &class_device_attr_periodic); 800 retval = device_create_file(dev, &dev_attr_periodic);
801 retval = class_device_create_file(cldev, &class_device_attr_registers); 801 retval = device_create_file(dev, &dev_attr_registers);
802} 802}
803 803
804static inline void remove_debug_files (struct ehci_hcd *ehci) 804static inline void remove_debug_files (struct ehci_hcd *ehci)
805{ 805{
806 struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev; 806 struct device *dev = ehci_to_hcd(ehci)->self.dev;
807 807
808 class_device_remove_file(cldev, &class_device_attr_async); 808 device_remove_file(dev, &dev_attr_async);
809 class_device_remove_file(cldev, &class_device_attr_periodic); 809 device_remove_file(dev, &dev_attr_periodic);
810 class_device_remove_file(cldev, &class_device_attr_registers); 810 device_remove_file(dev, &dev_attr_registers);
811} 811}
812 812
813#endif /* STUB_DEBUG_FILES */ 813#endif /* STUB_DEBUG_FILES */
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 735db4aec831..1ad7a6572826 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -291,14 +291,16 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
291/*-------------------------------------------------------------------------*/ 291/*-------------------------------------------------------------------------*/
292 292
293/* Display the ports dedicated to the companion controller */ 293/* Display the ports dedicated to the companion controller */
294static ssize_t show_companion(struct class_device *class_dev, char *buf) 294static ssize_t show_companion(struct device *dev,
295 struct device_attribute *attr,
296 char *buf)
295{ 297{
296 struct ehci_hcd *ehci; 298 struct ehci_hcd *ehci;
297 int nports, index, n; 299 int nports, index, n;
298 int count = PAGE_SIZE; 300 int count = PAGE_SIZE;
299 char *ptr = buf; 301 char *ptr = buf;
300 302
301 ehci = hcd_to_ehci(bus_to_hcd(class_get_devdata(class_dev))); 303 ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
302 nports = HCS_N_PORTS(ehci->hcs_params); 304 nports = HCS_N_PORTS(ehci->hcs_params);
303 305
304 for (index = 0; index < nports; ++index) { 306 for (index = 0; index < nports; ++index) {
@@ -316,15 +318,16 @@ static ssize_t show_companion(struct class_device *class_dev, char *buf)
316 * Syntax is "[-]portnum", where a leading '-' sign means 318 * Syntax is "[-]portnum", where a leading '-' sign means
317 * return control of the port to the EHCI controller. 319 * return control of the port to the EHCI controller.
318 */ 320 */
319static ssize_t store_companion(struct class_device *class_dev, 321static ssize_t store_companion(struct device *dev,
320 const char *buf, size_t count) 322 struct device_attribute *attr,
323 const char *buf, size_t count)
321{ 324{
322 struct ehci_hcd *ehci; 325 struct ehci_hcd *ehci;
323 int portnum, new_owner, try; 326 int portnum, new_owner, try;
324 u32 __iomem *status_reg; 327 u32 __iomem *status_reg;
325 u32 port_status; 328 u32 port_status;
326 329
327 ehci = hcd_to_ehci(bus_to_hcd(class_get_devdata(class_dev))); 330 ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
328 new_owner = PORT_OWNER; /* Owned by companion */ 331 new_owner = PORT_OWNER; /* Owned by companion */
329 if (sscanf(buf, "%d", &portnum) != 1) 332 if (sscanf(buf, "%d", &portnum) != 1)
330 return -EINVAL; 333 return -EINVAL;
@@ -364,7 +367,7 @@ static ssize_t store_companion(struct class_device *class_dev,
364 } 367 }
365 return count; 368 return count;
366} 369}
367static CLASS_DEVICE_ATTR(companion, 0644, show_companion, store_companion); 370static DEVICE_ATTR(companion, 0644, show_companion, store_companion);
368 371
369static inline void create_companion_file(struct ehci_hcd *ehci) 372static inline void create_companion_file(struct ehci_hcd *ehci)
370{ 373{
@@ -372,16 +375,16 @@ static inline void create_companion_file(struct ehci_hcd *ehci)
372 375
373 /* with integrated TT there is no companion! */ 376 /* with integrated TT there is no companion! */
374 if (!ehci_is_TDI(ehci)) 377 if (!ehci_is_TDI(ehci))
375 i = class_device_create_file(ehci_to_hcd(ehci)->self.class_dev, 378 i = device_create_file(ehci_to_hcd(ehci)->self.dev,
376 &class_device_attr_companion); 379 &dev_attr_companion);
377} 380}
378 381
379static inline void remove_companion_file(struct ehci_hcd *ehci) 382static inline void remove_companion_file(struct ehci_hcd *ehci)
380{ 383{
381 /* with integrated TT there is no companion! */ 384 /* with integrated TT there is no companion! */
382 if (!ehci_is_TDI(ehci)) 385 if (!ehci_is_TDI(ehci))
383 class_device_remove_file(ehci_to_hcd(ehci)->self.class_dev, 386 device_remove_file(ehci_to_hcd(ehci)->self.dev,
384 &class_device_attr_companion); 387 &dev_attr_companion);
385} 388}
386 389
387 390
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index ebab5ce8f5ce..9bd589806245 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -468,7 +468,7 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
468} 468}
469 469
470static ssize_t 470static ssize_t
471show_async (struct class_device *class_dev, char *buf) 471show_async(struct device *dev, struct device_attribute *attr, char *buf)
472{ 472{
473 struct usb_bus *bus; 473 struct usb_bus *bus;
474 struct usb_hcd *hcd; 474 struct usb_hcd *hcd;
@@ -476,7 +476,7 @@ show_async (struct class_device *class_dev, char *buf)
476 size_t temp; 476 size_t temp;
477 unsigned long flags; 477 unsigned long flags;
478 478
479 bus = class_get_devdata(class_dev); 479 bus = dev_get_drvdata(dev);
480 hcd = bus_to_hcd(bus); 480 hcd = bus_to_hcd(bus);
481 ohci = hcd_to_ohci(hcd); 481 ohci = hcd_to_ohci(hcd);
482 482
@@ -488,13 +488,13 @@ show_async (struct class_device *class_dev, char *buf)
488 488
489 return temp; 489 return temp;
490} 490}
491static CLASS_DEVICE_ATTR (async, S_IRUGO, show_async, NULL); 491static DEVICE_ATTR(async, S_IRUGO, show_async, NULL);
492 492
493 493
494#define DBG_SCHED_LIMIT 64 494#define DBG_SCHED_LIMIT 64
495 495
496static ssize_t 496static ssize_t
497show_periodic (struct class_device *class_dev, char *buf) 497show_periodic(struct device *dev, struct device_attribute *attr, char *buf)
498{ 498{
499 struct usb_bus *bus; 499 struct usb_bus *bus;
500 struct usb_hcd *hcd; 500 struct usb_hcd *hcd;
@@ -509,7 +509,7 @@ show_periodic (struct class_device *class_dev, char *buf)
509 return 0; 509 return 0;
510 seen_count = 0; 510 seen_count = 0;
511 511
512 bus = class_get_devdata(class_dev); 512 bus = dev_get_drvdata(dev);
513 hcd = bus_to_hcd(bus); 513 hcd = bus_to_hcd(bus);
514 ohci = hcd_to_ohci(hcd); 514 ohci = hcd_to_ohci(hcd);
515 next = buf; 515 next = buf;
@@ -589,13 +589,13 @@ show_periodic (struct class_device *class_dev, char *buf)
589 589
590 return PAGE_SIZE - size; 590 return PAGE_SIZE - size;
591} 591}
592static CLASS_DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL); 592static DEVICE_ATTR(periodic, S_IRUGO, show_periodic, NULL);
593 593
594 594
595#undef DBG_SCHED_LIMIT 595#undef DBG_SCHED_LIMIT
596 596
597static ssize_t 597static ssize_t
598show_registers (struct class_device *class_dev, char *buf) 598show_registers(struct device *dev, struct device_attribute *attr, char *buf)
599{ 599{
600 struct usb_bus *bus; 600 struct usb_bus *bus;
601 struct usb_hcd *hcd; 601 struct usb_hcd *hcd;
@@ -606,7 +606,7 @@ show_registers (struct class_device *class_dev, char *buf)
606 char *next; 606 char *next;
607 u32 rdata; 607 u32 rdata;
608 608
609 bus = class_get_devdata(class_dev); 609 bus = dev_get_drvdata(dev);
610 hcd = bus_to_hcd(bus); 610 hcd = bus_to_hcd(bus);
611 ohci = hcd_to_ohci(hcd); 611 ohci = hcd_to_ohci(hcd);
612 regs = ohci->regs; 612 regs = ohci->regs;
@@ -679,27 +679,27 @@ done:
679 spin_unlock_irqrestore (&ohci->lock, flags); 679 spin_unlock_irqrestore (&ohci->lock, flags);
680 return PAGE_SIZE - size; 680 return PAGE_SIZE - size;
681} 681}
682static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); 682static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
683 683
684 684
685static inline void create_debug_files (struct ohci_hcd *ohci) 685static inline void create_debug_files (struct ohci_hcd *ohci)
686{ 686{
687 struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev; 687 struct device *dev = ohci_to_hcd(ohci)->self.dev;
688 int retval; 688 int retval;
689 689
690 retval = class_device_create_file(cldev, &class_device_attr_async); 690 retval = device_create_file(dev, &dev_attr_async);
691 retval = class_device_create_file(cldev, &class_device_attr_periodic); 691 retval = device_create_file(dev, &dev_attr_periodic);
692 retval = class_device_create_file(cldev, &class_device_attr_registers); 692 retval = device_create_file(dev, &dev_attr_registers);
693 ohci_dbg (ohci, "created debug files\n"); 693 ohci_dbg (ohci, "created debug files\n");
694} 694}
695 695
696static inline void remove_debug_files (struct ohci_hcd *ohci) 696static inline void remove_debug_files (struct ohci_hcd *ohci)
697{ 697{
698 struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev; 698 struct device *dev = ohci_to_hcd(ohci)->self.dev;
699 699
700 class_device_remove_file(cldev, &class_device_attr_async); 700 device_remove_file(dev, &dev_attr_async);
701 class_device_remove_file(cldev, &class_device_attr_periodic); 701 device_remove_file(dev, &dev_attr_periodic);
702 class_device_remove_file(cldev, &class_device_attr_registers); 702 device_remove_file(dev, &dev_attr_registers);
703} 703}
704 704
705#endif 705#endif