From: "Peter Chen (CIX)" <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: gregkh@linuxfoundation.org, jun.li@nxp.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH v2 1/3] usb: chipidea: core: refactor ci_usb_role_switch_set()
Date: Wed, 8 Apr 2026 13:24:09 +0800 [thread overview]
Message-ID: <adXmeZoRuOrR7T6w@nchen-desktop> (raw)
In-Reply-To: <20260402071457.2516021-1-xu.yang_2@nxp.com>
On 26-04-02 15:14:55, Xu Yang wrote:
> Current code is redundant, refactor the code, no function change.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Peter
>
> ---
> Changes in v2:
> - new patch
> ---
> drivers/usb/chipidea/core.c | 29 +++++++----------------------
> 1 file changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index fac11f20cf0a..87be716dff3e 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -618,28 +618,13 @@ static int ci_usb_role_switch_set(struct usb_role_switch *sw,
> struct ci_hdrc *ci = usb_role_switch_get_drvdata(sw);
> struct ci_hdrc_cable *cable;
>
> - if (role == USB_ROLE_HOST) {
> - cable = &ci->platdata->id_extcon;
> - cable->changed = true;
> - cable->connected = true;
> - cable = &ci->platdata->vbus_extcon;
> - cable->changed = true;
> - cable->connected = false;
> - } else if (role == USB_ROLE_DEVICE) {
> - cable = &ci->platdata->id_extcon;
> - cable->changed = true;
> - cable->connected = false;
> - cable = &ci->platdata->vbus_extcon;
> - cable->changed = true;
> - cable->connected = true;
> - } else {
> - cable = &ci->platdata->id_extcon;
> - cable->changed = true;
> - cable->connected = false;
> - cable = &ci->platdata->vbus_extcon;
> - cable->changed = true;
> - cable->connected = false;
> - }
> + cable = &ci->platdata->id_extcon;
> + cable->changed = true;
> + cable->connected = (role == USB_ROLE_HOST);
> +
> + cable = &ci->platdata->vbus_extcon;
> + cable->changed = true;
> + cable->connected = (role == USB_ROLE_DEVICE);
>
> ci_irq(ci);
> return 0;
> --
> 2.34.1
>
--
Best regards,
Peter
prev parent reply other threads:[~2026-04-08 5:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 7:14 [PATCH v2 1/3] usb: chipidea: core: refactor ci_usb_role_switch_set() Xu Yang
2026-04-02 7:14 ` [PATCH v2 2/3] usb: chipidea: core: allow ci_irq_handler() handle both ID and VBUS change Xu Yang
2026-04-08 5:39 ` Peter Chen (CIX)
2026-04-09 6:11 ` Xu Yang
2026-04-02 7:14 ` [PATCH v2 3/3] usb: chipidea: otg: not wait vbus drop if use role_switch Xu Yang
2026-04-08 5:24 ` Peter Chen (CIX) [this message]
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=adXmeZoRuOrR7T6w@nchen-desktop \
--to=peter.chen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=xu.yang_2@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.