From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Felipe Balbi <balbi@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
Date: Thu, 27 May 2021 09:28:27 +0200 [thread overview]
Message-ID: <YK9KG5c96VmdHfF3@kroah.com> (raw)
In-Reply-To: <1621933165-9661-2-git-send-email-chunfeng.yun@mediatek.com>
On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> Add helper to get "role-switch-default-mode", and convert it
> to the corresponding enum usb_dr_mode
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 20 ++++++++++++++++++++
> include/linux/usb/otg.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index fff318597337..78a625a4e526 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(usb_get_dr_mode);
>
> +/**
> + * usb_get_role_switch_default_mode - Get default mode for given device
> + * @dev: Pointer to the given device
> + *
> + * The function gets string from property 'role-switch-default-mode',
> + * and returns the corresponding enum usb_dr_mode.
> + */
> +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> +{
> + const char *str;
> + int ret;
> +
> + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> + if (ret < 0)
> + return USB_DR_MODE_UNKNOWN;
> +
> + return usb_get_dr_mode_from_string(str);
> +}
> +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> +
> /**
> * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> * @epd: The descriptor of the endpoint
> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> index a86ee6aad51b..bde313c97fb6 100644
> --- a/include/linux/usb/otg.h
> +++ b/include/linux/usb/otg.h
> @@ -121,5 +121,6 @@ enum usb_dr_mode {
> };
>
> extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
What other code outside of the dwc3 driver will ever need to call this?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-05-27 7:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 8:59 [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition Chunfeng Yun
2021-05-25 8:59 ` [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Chunfeng Yun
2021-05-27 7:28 ` Greg Kroah-Hartman [this message]
2021-05-27 9:43 ` Chunfeng Yun
2021-05-27 10:01 ` Greg Kroah-Hartman
2021-05-28 2:07 ` Chunfeng Yun
2021-05-25 8:59 ` [PATCH 3/3] usb: dwc3: drd: use " Chunfeng Yun
2021-05-27 7:29 ` [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YK9KG5c96VmdHfF3@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=chunfeng.yun@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).