diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-12-08 01:07:56 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-12-08 01:07:56 -0500 |
commit | bef986502fa398b1785a3979b1aa17cd902d3527 (patch) | |
tree | b59c1afe7b1dfcc001b86e54863f550d7ddc8c34 /include/linux/usb.h | |
parent | 4bdbd2807deeccc0793d57fb5120d7a53f2c0b3c (diff) | |
parent | c99767974ebd2a719d849fdeaaa1674456f5283f (diff) |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/usb/input/hid.h
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 183 |
1 files changed, 166 insertions, 17 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 5482bfb3303d..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 | ||
319 | struct usb_tt; | 324 | struct 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 */ |
@@ -382,7 +388,7 @@ struct usb_device { | |||
382 | 388 | ||
383 | int pm_usage_cnt; /* usage counter for autosuspend */ | 389 | int pm_usage_cnt; /* usage counter for autosuspend */ |
384 | #ifdef CONFIG_PM | 390 | #ifdef CONFIG_PM |
385 | struct work_struct autosuspend; /* for delayed autosuspends */ | 391 | struct delayed_work autosuspend; /* for delayed autosuspends */ |
386 | struct mutex pm_mutex; /* protects PM operations */ | 392 | struct mutex pm_mutex; /* protects PM operations */ |
387 | 393 | ||
388 | unsigned auto_pm:1; /* autosuspend/resume in progress */ | 394 | unsigned auto_pm:1; /* autosuspend/resume in progress */ |
@@ -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 |
419 | extern int usb_autopm_set_interface(struct usb_interface *intf); | ||
413 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 420 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
414 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 421 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
415 | 422 | ||
423 | static inline void usb_autopm_enable(struct usb_interface *intf) | ||
424 | { | ||
425 | intf->pm_usage_cnt = 0; | ||
426 | usb_autopm_set_interface(intf); | ||
427 | } | ||
428 | |||
429 | static 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 | ||
437 | static inline int usb_autopm_set_interface(struct usb_interface *intf) | ||
438 | { return 0; } | ||
439 | |||
440 | static inline int usb_autopm_get_interface(struct usb_interface *intf) | ||
441 | { return 0; } | ||
442 | |||
443 | static inline void usb_autopm_put_interface(struct usb_interface *intf) | ||
444 | { } | ||
445 | static inline void usb_autopm_enable(struct usb_interface *intf) | ||
446 | { } | ||
447 | static 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 | ||
493 | extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); | 522 | /** |
494 | extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); | 523 | * usb_endpoint_dir_in - check if the endpoint has IN direction |
495 | extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); | 524 | * @epd: endpoint to be checked |
496 | extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); | 525 | * |
497 | extern 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. |
498 | extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); | 527 | */ |
499 | extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); | 528 | static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) |
500 | extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); | 529 | { |
501 | extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); | 530 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); |
502 | extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); | 531 | } |
503 | extern 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 | */ | ||
539 | static 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 | */ | ||
550 | static 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 | */ | ||
563 | static 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 | */ | ||
576 | static 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 | */ | ||
589 | static 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 | */ | ||
601 | static 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 | */ | ||
613 | static 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 | */ | ||
625 | static 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 | */ | ||
637 | static 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 | */ | ||
649 | static 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 | ||