[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200812291625.39383.david-b@pacbell.net>
Date: Mon, 29 Dec 2008 16:25:39 -0800
From: David Brownell <david-b@...bell.net>
To: Julia Lawall <julia@...u.dk>
Cc: gregkh@...e.de, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] include/linux: Move definitions from usb.h to usb/ch9.h
On Monday 29 December 2008, Julia Lawall wrote:
> From: Julia Lawall <julia@...u.dk>
>
> 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.
... "constants and structures", to be a bit more exact. :)
>
> Signed-off-by: Julia Lawall <julia@...u.dk>
Acked-by: David Brownell <dbrownell@...rs.sourceforge.net>
>
> ---
> include/linux/usb.h | 180 ------------------------------------------------
> include/linux/usb/ch9.h | 179 +++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 179 insertions(+), 180 deletions(-)
>
> diff -u -p a/include/linux/usb.h b/include/linux/usb.h
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -641,186 +641,6 @@ static inline int usb_make_path(struct u
>
> /*-------------------------------------------------------------------------*/
>
> -/**
> - * usb_endpoint_num - get the endpoint's number
> - * @epd: endpoint to be checked
> - *
> - * Returns @epd's number: 0 to 15.
> - */
> -static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
> -{
> - return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
> -}
> -
> -/**
> - * usb_endpoint_type - get the endpoint's transfer type
> - * @epd: endpoint to be checked
> - *
> - * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
> - * to @epd's transfer type.
> - */
> -static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
> -{
> - return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
> -}
> -
> -/**
> - * usb_endpoint_dir_in - check if the endpoint has IN direction
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type IN, otherwise it returns false.
> - */
> -static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
> -}
> -
> -/**
> - * usb_endpoint_dir_out - check if the endpoint has OUT direction
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type OUT, otherwise it returns false.
> - */
> -static inline int usb_endpoint_dir_out(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
> -}
> -
> -/**
> - * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type bulk, otherwise it returns false.
> - */
> -static inline int usb_endpoint_xfer_bulk(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> - USB_ENDPOINT_XFER_BULK);
> -}
> -
> -/**
> - * usb_endpoint_xfer_control - check if the endpoint has control transfer type
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type control, otherwise it returns false.
> - */
> -static inline int usb_endpoint_xfer_control(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> - USB_ENDPOINT_XFER_CONTROL);
> -}
> -
> -/**
> - * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type interrupt, otherwise it returns
> - * false.
> - */
> -static inline int usb_endpoint_xfer_int(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> - USB_ENDPOINT_XFER_INT);
> -}
> -
> -/**
> - * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint is of type isochronous, otherwise it returns
> - * false.
> - */
> -static inline int usb_endpoint_xfer_isoc(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> - USB_ENDPOINT_XFER_ISOC);
> -}
> -
> -/**
> - * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has bulk transfer type and IN direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_bulk_in(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
> -}
> -
> -/**
> - * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has bulk transfer type and OUT direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_bulk_out(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
> -}
> -
> -/**
> - * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has interrupt transfer type and IN direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_int_in(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
> -}
> -
> -/**
> - * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has interrupt transfer type and OUT direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_int_out(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
> -}
> -
> -/**
> - * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has isochronous transfer type and IN direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_isoc_in(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
> -}
> -
> -/**
> - * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
> - * @epd: endpoint to be checked
> - *
> - * Returns true if the endpoint has isochronous transfer type and OUT direction,
> - * otherwise it returns false.
> - */
> -static inline int usb_endpoint_is_isoc_out(
> - const struct usb_endpoint_descriptor *epd)
> -{
> - return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
> -}
> -
> -/*-------------------------------------------------------------------------*/
> -
> #define USB_DEVICE_ID_MATCH_DEVICE \
> (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
> #define USB_DEVICE_ID_MATCH_DEV_RANGE \
> diff -u -p a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
> --- a/include/linux/usb/ch9.h
> +++ b/include/linux/usb/ch9.h
> @@ -353,6 +353,185 @@ struct usb_endpoint_descriptor {
> #define USB_ENDPOINT_XFER_INT 3
> #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
>
> +/*-------------------------------------------------------------------------*/
> +
> +/**
> + * usb_endpoint_num - get the endpoint's number
> + * @epd: endpoint to be checked
> + *
> + * Returns @epd's number: 0 to 15.
> + */
> +static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
> +{
> + return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
> +}
> +
> +/**
> + * usb_endpoint_type - get the endpoint's transfer type
> + * @epd: endpoint to be checked
> + *
> + * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
> + * to @epd's transfer type.
> + */
> +static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
> +{
> + return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
> +}
> +
> +/**
> + * usb_endpoint_dir_in - check if the endpoint has IN direction
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type IN, otherwise it returns false.
> + */
> +static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
> +}
> +
> +/**
> + * usb_endpoint_dir_out - check if the endpoint has OUT direction
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type OUT, otherwise it returns false.
> + */
> +static inline int usb_endpoint_dir_out(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
> +}
> +
> +/**
> + * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type bulk, otherwise it returns false.
> + */
> +static inline int usb_endpoint_xfer_bulk(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> + USB_ENDPOINT_XFER_BULK);
> +}
> +
> +/**
> + * usb_endpoint_xfer_control - check if the endpoint has control transfer type
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type control, otherwise it returns false.
> + */
> +static inline int usb_endpoint_xfer_control(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> + USB_ENDPOINT_XFER_CONTROL);
> +}
> +
> +/**
> + * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type interrupt, otherwise it returns
> + * false.
> + */
> +static inline int usb_endpoint_xfer_int(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> + USB_ENDPOINT_XFER_INT);
> +}
> +
> +/**
> + * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint is of type isochronous, otherwise it returns
> + * false.
> + */
> +static inline int usb_endpoint_xfer_isoc(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
> + USB_ENDPOINT_XFER_ISOC);
> +}
> +
> +/**
> + * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has bulk transfer type and IN direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_bulk_in(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
> +}
> +
> +/**
> + * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has bulk transfer type and OUT direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_bulk_out(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
> +}
> +
> +/**
> + * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has interrupt transfer type and IN direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_int_in(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
> +}
> +
> +/**
> + * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has interrupt transfer type and OUT direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_int_out(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
> +}
> +
> +/**
> + * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has isochronous transfer type and IN direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_isoc_in(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
> +}
> +
> +/**
> + * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
> + * @epd: endpoint to be checked
> + *
> + * Returns true if the endpoint has isochronous transfer type and OUT direction,
> + * otherwise it returns false.
> + */
> +static inline int usb_endpoint_is_isoc_out(
> + const struct usb_endpoint_descriptor *epd)
> +{
> + return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
> +}
>
> /*-------------------------------------------------------------------------*/
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists