aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-05 09:37:56 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-05 09:37:56 -0500
commit4c1ac1b49122b805adfa4efc620592f68dccf5db (patch)
tree87557f4bc2fd4fe65b7570489c2f610c45c0adcd /include/linux/usb.h
parentc4028958b6ecad064b1a6303a6a5906d4fe48d73 (diff)
parentd916faace3efc0bf19fe9a615a1ab8fa1a24cd93 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/infiniband/core/iwcm.c drivers/net/chelsio/cxgb2.c drivers/net/wireless/bcm43xx/bcm43xx_main.c drivers/net/wireless/prism54/islpci_eth.c drivers/usb/core/hub.h drivers/usb/input/hid-core.c net/core/netpoll.c Fix up merge failures with Linus's head and fix new compilation failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h181
1 files changed, 165 insertions, 16 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 06ce7a626040..aab5b1b72021 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -313,8 +313,13 @@ struct usb_bus {
313/* This is arbitrary. 313/* This is arbitrary.
314 * From USB 2.0 spec Table 11-13, offset 7, a hub can 314 * From USB 2.0 spec Table 11-13, offset 7, a hub can
315 * have up to 255 ports. The most yet reported is 10. 315 * have up to 255 ports. The most yet reported is 10.
316 *
317 * Current Wireless USB host hardware (Intel i1480 for example) allows
318 * up to 22 devices to connect. Upcoming hardware might raise that
319 * limit. Because the arrays need to add a bit for hub status data, we
320 * do 31, so plus one evens out to four bytes.
316 */ 321 */
317#define USB_MAXCHILDREN (16) 322#define USB_MAXCHILDREN (31)
318 323
319struct usb_tt; 324struct usb_tt;
320 325
@@ -357,7 +362,8 @@ struct usb_device {
357 u8 portnum; /* Parent port number (origin 1) */ 362 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */ 363 u8 level; /* Number of USB hub ancestors */
359 364
360 int have_langid; /* whether string_langid is valid */ 365 unsigned discon_suspended:1; /* Disconnected while suspended */
366 unsigned have_langid:1; /* whether string_langid is valid */
361 int string_langid; /* language ID for strings */ 367 int string_langid; /* language ID for strings */
362 368
363 /* static strings from the device */ 369 /* static strings from the device */
@@ -410,14 +416,37 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
410 416
411/* USB autosuspend and autoresume */ 417/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND 418#ifdef CONFIG_USB_SUSPEND
419extern int usb_autopm_set_interface(struct usb_interface *intf);
413extern int usb_autopm_get_interface(struct usb_interface *intf); 420extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf); 421extern void usb_autopm_put_interface(struct usb_interface *intf);
415 422
423static inline void usb_autopm_enable(struct usb_interface *intf)
424{
425 intf->pm_usage_cnt = 0;
426 usb_autopm_set_interface(intf);
427}
428
429static inline void usb_autopm_disable(struct usb_interface *intf)
430{
431 intf->pm_usage_cnt = 1;
432 usb_autopm_set_interface(intf);
433}
434
416#else 435#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420 436
437static inline int usb_autopm_set_interface(struct usb_interface *intf)
438{ return 0; }
439
440static inline int usb_autopm_get_interface(struct usb_interface *intf)
441{ return 0; }
442
443static inline void usb_autopm_put_interface(struct usb_interface *intf)
444{ }
445static inline void usb_autopm_enable(struct usb_interface *intf)
446{ }
447static inline void usb_autopm_disable(struct usb_interface *intf)
448{ }
449#endif
421 450
422/*-------------------------------------------------------------------------*/ 451/*-------------------------------------------------------------------------*/
423 452
@@ -490,17 +519,137 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
490 519
491/*-------------------------------------------------------------------------*/ 520/*-------------------------------------------------------------------------*/
492 521
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); 522/**
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); 523 * usb_endpoint_dir_in - check if the endpoint has IN direction
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); 524 * @epd: endpoint to be checked
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); 525 *
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd); 526 * Returns true if the endpoint is of type IN, otherwise it returns false.
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); 527 */
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); 528static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); 529{
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); 530 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); 531}
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd); 532
533/**
534 * usb_endpoint_dir_out - check if the endpoint has OUT direction
535 * @epd: endpoint to be checked
536 *
537 * Returns true if the endpoint is of type OUT, otherwise it returns false.
538 */
539static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
540{
541 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
542}
543
544/**
545 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
546 * @epd: endpoint to be checked
547 *
548 * Returns true if the endpoint is of type bulk, otherwise it returns false.
549 */
550static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
551{
552 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
553 USB_ENDPOINT_XFER_BULK);
554}
555
556/**
557 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
558 * @epd: endpoint to be checked
559 *
560 * Returns true if the endpoint is of type interrupt, otherwise it returns
561 * false.
562 */
563static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
564{
565 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
566 USB_ENDPOINT_XFER_INT);
567}
568
569/**
570 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
571 * @epd: endpoint to be checked
572 *
573 * Returns true if the endpoint is of type isochronous, otherwise it returns
574 * false.
575 */
576static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
577{
578 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
579 USB_ENDPOINT_XFER_ISOC);
580}
581
582/**
583 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
584 * @epd: endpoint to be checked
585 *
586 * Returns true if the endpoint has bulk transfer type and IN direction,
587 * otherwise it returns false.
588 */
589static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
590{
591 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
592}
593
594/**
595 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
596 * @epd: endpoint to be checked
597 *
598 * Returns true if the endpoint has bulk transfer type and OUT direction,
599 * otherwise it returns false.
600 */
601static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
602{
603 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
604}
605
606/**
607 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
608 * @epd: endpoint to be checked
609 *
610 * Returns true if the endpoint has interrupt transfer type and IN direction,
611 * otherwise it returns false.
612 */
613static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
614{
615 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
616}
617
618/**
619 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
620 * @epd: endpoint to be checked
621 *
622 * Returns true if the endpoint has interrupt transfer type and OUT direction,
623 * otherwise it returns false.
624 */
625static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)
626{
627 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
628}
629
630/**
631 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
632 * @epd: endpoint to be checked
633 *
634 * Returns true if the endpoint has isochronous transfer type and IN direction,
635 * otherwise it returns false.
636 */
637static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)
638{
639 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
640}
641
642/**
643 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
644 * @epd: endpoint to be checked
645 *
646 * Returns true if the endpoint has isochronous transfer type and OUT direction,
647 * otherwise it returns false.
648 */
649static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)
650{
651 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
652}
504 653
505/*-------------------------------------------------------------------------*/ 654/*-------------------------------------------------------------------------*/
506 655