diff options
author | Julia Lawall <julia@diku.dk> | 2008-12-29 16:48:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:27 -0400 |
commit | 4d6914b72966862f37de634299a80ca2a4b1829f (patch) | |
tree | 1c7dec08838b413a6a32343879f1209362bda491 /include | |
parent | ee069fb1185895e725ad942c7a529f947e25166d (diff) |
USB: Move definitions from usb.h to usb/ch9.h
The functions:
usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_is_isoc_in(epd)
usb_endpoint_is_isoc_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)
are moved from include/linux/usb.h to include/linux/usb/ch9.h.
include/linux/usb/ch9.h makes more sense for these functions because they
only depend on constants that are defined in this file.
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb.h | 180 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 179 |
2 files changed, 179 insertions, 180 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 88079fd60235..0c05ff621192 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -643,186 +643,6 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) | |||
643 | 643 | ||
644 | /*-------------------------------------------------------------------------*/ | 644 | /*-------------------------------------------------------------------------*/ |
645 | 645 | ||
646 | /** | ||
647 | * usb_endpoint_num - get the endpoint's number | ||
648 | * @epd: endpoint to be checked | ||
649 | * | ||
650 | * Returns @epd's number: 0 to 15. | ||
651 | */ | ||
652 | static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) | ||
653 | { | ||
654 | return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | ||
655 | } | ||
656 | |||
657 | /** | ||
658 | * usb_endpoint_type - get the endpoint's transfer type | ||
659 | * @epd: endpoint to be checked | ||
660 | * | ||
661 | * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according | ||
662 | * to @epd's transfer type. | ||
663 | */ | ||
664 | static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) | ||
665 | { | ||
666 | return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
667 | } | ||
668 | |||
669 | /** | ||
670 | * usb_endpoint_dir_in - check if the endpoint has IN direction | ||
671 | * @epd: endpoint to be checked | ||
672 | * | ||
673 | * Returns true if the endpoint is of type IN, otherwise it returns false. | ||
674 | */ | ||
675 | static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) | ||
676 | { | ||
677 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); | ||
678 | } | ||
679 | |||
680 | /** | ||
681 | * usb_endpoint_dir_out - check if the endpoint has OUT direction | ||
682 | * @epd: endpoint to be checked | ||
683 | * | ||
684 | * Returns true if the endpoint is of type OUT, otherwise it returns false. | ||
685 | */ | ||
686 | static inline int usb_endpoint_dir_out( | ||
687 | const struct usb_endpoint_descriptor *epd) | ||
688 | { | ||
689 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); | ||
690 | } | ||
691 | |||
692 | /** | ||
693 | * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type | ||
694 | * @epd: endpoint to be checked | ||
695 | * | ||
696 | * Returns true if the endpoint is of type bulk, otherwise it returns false. | ||
697 | */ | ||
698 | static inline int usb_endpoint_xfer_bulk( | ||
699 | const struct usb_endpoint_descriptor *epd) | ||
700 | { | ||
701 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
702 | USB_ENDPOINT_XFER_BULK); | ||
703 | } | ||
704 | |||
705 | /** | ||
706 | * usb_endpoint_xfer_control - check if the endpoint has control transfer type | ||
707 | * @epd: endpoint to be checked | ||
708 | * | ||
709 | * Returns true if the endpoint is of type control, otherwise it returns false. | ||
710 | */ | ||
711 | static inline int usb_endpoint_xfer_control( | ||
712 | const struct usb_endpoint_descriptor *epd) | ||
713 | { | ||
714 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
715 | USB_ENDPOINT_XFER_CONTROL); | ||
716 | } | ||
717 | |||
718 | /** | ||
719 | * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type | ||
720 | * @epd: endpoint to be checked | ||
721 | * | ||
722 | * Returns true if the endpoint is of type interrupt, otherwise it returns | ||
723 | * false. | ||
724 | */ | ||
725 | static inline int usb_endpoint_xfer_int( | ||
726 | const struct usb_endpoint_descriptor *epd) | ||
727 | { | ||
728 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
729 | USB_ENDPOINT_XFER_INT); | ||
730 | } | ||
731 | |||
732 | /** | ||
733 | * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type | ||
734 | * @epd: endpoint to be checked | ||
735 | * | ||
736 | * Returns true if the endpoint is of type isochronous, otherwise it returns | ||
737 | * false. | ||
738 | */ | ||
739 | static inline int usb_endpoint_xfer_isoc( | ||
740 | const struct usb_endpoint_descriptor *epd) | ||
741 | { | ||
742 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
743 | USB_ENDPOINT_XFER_ISOC); | ||
744 | } | ||
745 | |||
746 | /** | ||
747 | * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN | ||
748 | * @epd: endpoint to be checked | ||
749 | * | ||
750 | * Returns true if the endpoint has bulk transfer type and IN direction, | ||
751 | * otherwise it returns false. | ||
752 | */ | ||
753 | static inline int usb_endpoint_is_bulk_in( | ||
754 | const struct usb_endpoint_descriptor *epd) | ||
755 | { | ||
756 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | ||
757 | } | ||
758 | |||
759 | /** | ||
760 | * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT | ||
761 | * @epd: endpoint to be checked | ||
762 | * | ||
763 | * Returns true if the endpoint has bulk transfer type and OUT direction, | ||
764 | * otherwise it returns false. | ||
765 | */ | ||
766 | static inline int usb_endpoint_is_bulk_out( | ||
767 | const struct usb_endpoint_descriptor *epd) | ||
768 | { | ||
769 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | ||
770 | } | ||
771 | |||
772 | /** | ||
773 | * usb_endpoint_is_int_in - check if the endpoint is interrupt IN | ||
774 | * @epd: endpoint to be checked | ||
775 | * | ||
776 | * Returns true if the endpoint has interrupt transfer type and IN direction, | ||
777 | * otherwise it returns false. | ||
778 | */ | ||
779 | static inline int usb_endpoint_is_int_in( | ||
780 | const struct usb_endpoint_descriptor *epd) | ||
781 | { | ||
782 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | ||
783 | } | ||
784 | |||
785 | /** | ||
786 | * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT | ||
787 | * @epd: endpoint to be checked | ||
788 | * | ||
789 | * Returns true if the endpoint has interrupt transfer type and OUT direction, | ||
790 | * otherwise it returns false. | ||
791 | */ | ||
792 | static inline int usb_endpoint_is_int_out( | ||
793 | const struct usb_endpoint_descriptor *epd) | ||
794 | { | ||
795 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | ||
796 | } | ||
797 | |||
798 | /** | ||
799 | * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN | ||
800 | * @epd: endpoint to be checked | ||
801 | * | ||
802 | * Returns true if the endpoint has isochronous transfer type and IN direction, | ||
803 | * otherwise it returns false. | ||
804 | */ | ||
805 | static inline int usb_endpoint_is_isoc_in( | ||
806 | const struct usb_endpoint_descriptor *epd) | ||
807 | { | ||
808 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | ||
809 | } | ||
810 | |||
811 | /** | ||
812 | * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT | ||
813 | * @epd: endpoint to be checked | ||
814 | * | ||
815 | * Returns true if the endpoint has isochronous transfer type and OUT direction, | ||
816 | * otherwise it returns false. | ||
817 | */ | ||
818 | static inline int usb_endpoint_is_isoc_out( | ||
819 | const struct usb_endpoint_descriptor *epd) | ||
820 | { | ||
821 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | ||
822 | } | ||
823 | |||
824 | /*-------------------------------------------------------------------------*/ | ||
825 | |||
826 | #define USB_DEVICE_ID_MATCH_DEVICE \ | 646 | #define USB_DEVICE_ID_MATCH_DEVICE \ |
827 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) | 647 | (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) |
828 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ | 648 | #define USB_DEVICE_ID_MATCH_DEV_RANGE \ |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 9b42baed3900..fa777db7f7eb 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -353,6 +353,185 @@ struct usb_endpoint_descriptor { | |||
353 | #define USB_ENDPOINT_XFER_INT 3 | 353 | #define USB_ENDPOINT_XFER_INT 3 |
354 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 | 354 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 |
355 | 355 | ||
356 | /*-------------------------------------------------------------------------*/ | ||
357 | |||
358 | /** | ||
359 | * usb_endpoint_num - get the endpoint's number | ||
360 | * @epd: endpoint to be checked | ||
361 | * | ||
362 | * Returns @epd's number: 0 to 15. | ||
363 | */ | ||
364 | static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) | ||
365 | { | ||
366 | return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | ||
367 | } | ||
368 | |||
369 | /** | ||
370 | * usb_endpoint_type - get the endpoint's transfer type | ||
371 | * @epd: endpoint to be checked | ||
372 | * | ||
373 | * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according | ||
374 | * to @epd's transfer type. | ||
375 | */ | ||
376 | static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) | ||
377 | { | ||
378 | return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
379 | } | ||
380 | |||
381 | /** | ||
382 | * usb_endpoint_dir_in - check if the endpoint has IN direction | ||
383 | * @epd: endpoint to be checked | ||
384 | * | ||
385 | * Returns true if the endpoint is of type IN, otherwise it returns false. | ||
386 | */ | ||
387 | static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) | ||
388 | { | ||
389 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * usb_endpoint_dir_out - check if the endpoint has OUT direction | ||
394 | * @epd: endpoint to be checked | ||
395 | * | ||
396 | * Returns true if the endpoint is of type OUT, otherwise it returns false. | ||
397 | */ | ||
398 | static inline int usb_endpoint_dir_out( | ||
399 | const struct usb_endpoint_descriptor *epd) | ||
400 | { | ||
401 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); | ||
402 | } | ||
403 | |||
404 | /** | ||
405 | * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type | ||
406 | * @epd: endpoint to be checked | ||
407 | * | ||
408 | * Returns true if the endpoint is of type bulk, otherwise it returns false. | ||
409 | */ | ||
410 | static inline int usb_endpoint_xfer_bulk( | ||
411 | const struct usb_endpoint_descriptor *epd) | ||
412 | { | ||
413 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
414 | USB_ENDPOINT_XFER_BULK); | ||
415 | } | ||
416 | |||
417 | /** | ||
418 | * usb_endpoint_xfer_control - check if the endpoint has control transfer type | ||
419 | * @epd: endpoint to be checked | ||
420 | * | ||
421 | * Returns true if the endpoint is of type control, otherwise it returns false. | ||
422 | */ | ||
423 | static inline int usb_endpoint_xfer_control( | ||
424 | const struct usb_endpoint_descriptor *epd) | ||
425 | { | ||
426 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
427 | USB_ENDPOINT_XFER_CONTROL); | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type | ||
432 | * @epd: endpoint to be checked | ||
433 | * | ||
434 | * Returns true if the endpoint is of type interrupt, otherwise it returns | ||
435 | * false. | ||
436 | */ | ||
437 | static inline int usb_endpoint_xfer_int( | ||
438 | const struct usb_endpoint_descriptor *epd) | ||
439 | { | ||
440 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
441 | USB_ENDPOINT_XFER_INT); | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type | ||
446 | * @epd: endpoint to be checked | ||
447 | * | ||
448 | * Returns true if the endpoint is of type isochronous, otherwise it returns | ||
449 | * false. | ||
450 | */ | ||
451 | static inline int usb_endpoint_xfer_isoc( | ||
452 | const struct usb_endpoint_descriptor *epd) | ||
453 | { | ||
454 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
455 | USB_ENDPOINT_XFER_ISOC); | ||
456 | } | ||
457 | |||
458 | /** | ||
459 | * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN | ||
460 | * @epd: endpoint to be checked | ||
461 | * | ||
462 | * Returns true if the endpoint has bulk transfer type and IN direction, | ||
463 | * otherwise it returns false. | ||
464 | */ | ||
465 | static inline int usb_endpoint_is_bulk_in( | ||
466 | const struct usb_endpoint_descriptor *epd) | ||
467 | { | ||
468 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | ||
469 | } | ||
470 | |||
471 | /** | ||
472 | * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT | ||
473 | * @epd: endpoint to be checked | ||
474 | * | ||
475 | * Returns true if the endpoint has bulk transfer type and OUT direction, | ||
476 | * otherwise it returns false. | ||
477 | */ | ||
478 | static inline int usb_endpoint_is_bulk_out( | ||
479 | const struct usb_endpoint_descriptor *epd) | ||
480 | { | ||
481 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * usb_endpoint_is_int_in - check if the endpoint is interrupt IN | ||
486 | * @epd: endpoint to be checked | ||
487 | * | ||
488 | * Returns true if the endpoint has interrupt transfer type and IN direction, | ||
489 | * otherwise it returns false. | ||
490 | */ | ||
491 | static inline int usb_endpoint_is_int_in( | ||
492 | const struct usb_endpoint_descriptor *epd) | ||
493 | { | ||
494 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT | ||
499 | * @epd: endpoint to be checked | ||
500 | * | ||
501 | * Returns true if the endpoint has interrupt transfer type and OUT direction, | ||
502 | * otherwise it returns false. | ||
503 | */ | ||
504 | static inline int usb_endpoint_is_int_out( | ||
505 | const struct usb_endpoint_descriptor *epd) | ||
506 | { | ||
507 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | ||
508 | } | ||
509 | |||
510 | /** | ||
511 | * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN | ||
512 | * @epd: endpoint to be checked | ||
513 | * | ||
514 | * Returns true if the endpoint has isochronous transfer type and IN direction, | ||
515 | * otherwise it returns false. | ||
516 | */ | ||
517 | static inline int usb_endpoint_is_isoc_in( | ||
518 | const struct usb_endpoint_descriptor *epd) | ||
519 | { | ||
520 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | ||
521 | } | ||
522 | |||
523 | /** | ||
524 | * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT | ||
525 | * @epd: endpoint to be checked | ||
526 | * | ||
527 | * Returns true if the endpoint has isochronous transfer type and OUT direction, | ||
528 | * otherwise it returns false. | ||
529 | */ | ||
530 | static inline int usb_endpoint_is_isoc_out( | ||
531 | const struct usb_endpoint_descriptor *epd) | ||
532 | { | ||
533 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | ||
534 | } | ||
356 | 535 | ||
357 | /*-------------------------------------------------------------------------*/ | 536 | /*-------------------------------------------------------------------------*/ |
358 | 537 | ||