diff options
author | Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> | 2006-10-30 12:53:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:23:29 -0500 |
commit | 0c1ac4f25f894f9df0ffe9b912c165fb6a185a3c (patch) | |
tree | 07242b094efb9c306d7b825f70d9c1660ab95241 /drivers/usb | |
parent | 6f7cd44162ca1bffd54f4090e67b9810bacb5d25 (diff) |
USB: makes usb_endpoint_* functions inline.
We have no benefits of having the usb_endpoint_* functions as functions,
but making them inline saves text and data segment sizes:
text data bss dec hex filename
14893634 3108770 1108840 19111244 1239d4c vmlinux.func
14893185 3108566 1108840 19110591 1239abf vmlinux.inline
This is the result of a 2.6.19-rc3 kernel compiled with GCC 4.1.1 without
CONFIG_MODULES, CONFIG_CC_OPTIMIZE_FOR_SIZE, CONFIG_REGPARM options set.
USB support is fully enabled (while most of the other drivers are not),
and that kernel has most of the USB code ported to use the endpoint
functions.
That happens because a call to those functions are expensive (in terms
of bytes), while the function's size is smaller or have the same 'size' of
the call.
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/usb.c | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 467cb02832f3..a83c2d5065c1 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -537,138 +537,6 @@ int usb_get_current_frame_number(struct usb_device *dev) | |||
537 | return usb_hcd_get_frame_number (dev); | 537 | return usb_hcd_get_frame_number (dev); |
538 | } | 538 | } |
539 | 539 | ||
540 | /** | ||
541 | * usb_endpoint_dir_in - check if the endpoint has IN direction | ||
542 | * @epd: endpoint to be checked | ||
543 | * | ||
544 | * Returns true if the endpoint is of type IN, otherwise it returns false. | ||
545 | */ | ||
546 | int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) | ||
547 | { | ||
548 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); | ||
549 | } | ||
550 | |||
551 | /** | ||
552 | * usb_endpoint_dir_out - check if the endpoint has OUT direction | ||
553 | * @epd: endpoint to be checked | ||
554 | * | ||
555 | * Returns true if the endpoint is of type OUT, otherwise it returns false. | ||
556 | */ | ||
557 | int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) | ||
558 | { | ||
559 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); | ||
560 | } | ||
561 | |||
562 | /** | ||
563 | * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type | ||
564 | * @epd: endpoint to be checked | ||
565 | * | ||
566 | * Returns true if the endpoint is of type bulk, otherwise it returns false. | ||
567 | */ | ||
568 | int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) | ||
569 | { | ||
570 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
571 | USB_ENDPOINT_XFER_BULK); | ||
572 | } | ||
573 | |||
574 | /** | ||
575 | * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type | ||
576 | * @epd: endpoint to be checked | ||
577 | * | ||
578 | * Returns true if the endpoint is of type interrupt, otherwise it returns | ||
579 | * false. | ||
580 | */ | ||
581 | int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) | ||
582 | { | ||
583 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
584 | USB_ENDPOINT_XFER_INT); | ||
585 | } | ||
586 | |||
587 | /** | ||
588 | * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type | ||
589 | * @epd: endpoint to be checked | ||
590 | * | ||
591 | * Returns true if the endpoint is of type isochronous, otherwise it returns | ||
592 | * false. | ||
593 | */ | ||
594 | int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) | ||
595 | { | ||
596 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
597 | USB_ENDPOINT_XFER_ISOC); | ||
598 | } | ||
599 | |||
600 | /** | ||
601 | * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN | ||
602 | * @epd: endpoint to be checked | ||
603 | * | ||
604 | * Returns true if the endpoint has bulk transfer type and IN direction, | ||
605 | * otherwise it returns false. | ||
606 | */ | ||
607 | int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) | ||
608 | { | ||
609 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | ||
610 | } | ||
611 | |||
612 | /** | ||
613 | * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT | ||
614 | * @epd: endpoint to be checked | ||
615 | * | ||
616 | * Returns true if the endpoint has bulk transfer type and OUT direction, | ||
617 | * otherwise it returns false. | ||
618 | */ | ||
619 | int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) | ||
620 | { | ||
621 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | ||
622 | } | ||
623 | |||
624 | /** | ||
625 | * usb_endpoint_is_int_in - check if the endpoint is interrupt IN | ||
626 | * @epd: endpoint to be checked | ||
627 | * | ||
628 | * Returns true if the endpoint has interrupt transfer type and IN direction, | ||
629 | * otherwise it returns false. | ||
630 | */ | ||
631 | int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) | ||
632 | { | ||
633 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | ||
634 | } | ||
635 | |||
636 | /** | ||
637 | * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT | ||
638 | * @epd: endpoint to be checked | ||
639 | * | ||
640 | * Returns true if the endpoint has interrupt transfer type and OUT direction, | ||
641 | * otherwise it returns false. | ||
642 | */ | ||
643 | int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) | ||
644 | { | ||
645 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | ||
646 | } | ||
647 | |||
648 | /** | ||
649 | * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN | ||
650 | * @epd: endpoint to be checked | ||
651 | * | ||
652 | * Returns true if the endpoint has isochronous transfer type and IN direction, | ||
653 | * otherwise it returns false. | ||
654 | */ | ||
655 | int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) | ||
656 | { | ||
657 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | ||
658 | } | ||
659 | |||
660 | /** | ||
661 | * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT | ||
662 | * @epd: endpoint to be checked | ||
663 | * | ||
664 | * Returns true if the endpoint has isochronous transfer type and OUT direction, | ||
665 | * otherwise it returns false. | ||
666 | */ | ||
667 | int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) | ||
668 | { | ||
669 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | ||
670 | } | ||
671 | |||
672 | /*-------------------------------------------------------------------*/ | 540 | /*-------------------------------------------------------------------*/ |
673 | /* | 541 | /* |
674 | * __usb_get_extra_descriptor() finds a descriptor of specific type in the | 542 | * __usb_get_extra_descriptor() finds a descriptor of specific type in the |
@@ -1102,18 +970,6 @@ EXPORT_SYMBOL(__usb_get_extra_descriptor); | |||
1102 | EXPORT_SYMBOL(usb_find_device); | 970 | EXPORT_SYMBOL(usb_find_device); |
1103 | EXPORT_SYMBOL(usb_get_current_frame_number); | 971 | EXPORT_SYMBOL(usb_get_current_frame_number); |
1104 | 972 | ||
1105 | EXPORT_SYMBOL_GPL(usb_endpoint_dir_in); | ||
1106 | EXPORT_SYMBOL_GPL(usb_endpoint_dir_out); | ||
1107 | EXPORT_SYMBOL_GPL(usb_endpoint_xfer_bulk); | ||
1108 | EXPORT_SYMBOL_GPL(usb_endpoint_xfer_int); | ||
1109 | EXPORT_SYMBOL_GPL(usb_endpoint_xfer_isoc); | ||
1110 | EXPORT_SYMBOL_GPL(usb_endpoint_is_bulk_in); | ||
1111 | EXPORT_SYMBOL_GPL(usb_endpoint_is_bulk_out); | ||
1112 | EXPORT_SYMBOL_GPL(usb_endpoint_is_int_in); | ||
1113 | EXPORT_SYMBOL_GPL(usb_endpoint_is_int_out); | ||
1114 | EXPORT_SYMBOL_GPL(usb_endpoint_is_isoc_in); | ||
1115 | EXPORT_SYMBOL_GPL(usb_endpoint_is_isoc_out); | ||
1116 | |||
1117 | EXPORT_SYMBOL (usb_buffer_alloc); | 973 | EXPORT_SYMBOL (usb_buffer_alloc); |
1118 | EXPORT_SYMBOL (usb_buffer_free); | 974 | EXPORT_SYMBOL (usb_buffer_free); |
1119 | 975 | ||