devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Krogerus, Heikki" <heikki.krogerus@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	USB <linux-usb@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>
Subject: Re: [PATCH v5] usb: gadget: udc: renesas_usb3: Add register of usb role switch
Date: Mon, 28 May 2018 15:47:00 +0300	[thread overview]
Message-ID: <CAHp75VcFNkrBXXgCB+pQJHGvHquik7OMD+W=eZn4Gj9b14799w@mail.gmail.com> (raw)
In-Reply-To: <1527232376-5613-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>

On Fri, May 25, 2018 at 10:12 AM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:

> -static void usb3_set_mode(struct renesas_usb3 *usb3, bool host)

Wouldn't be better to choose another name for a new function?

> +       struct renesas_usb3 *usb3 = container_of(work, struct renesas_usb3,
> +                                                role_work);

Matter of style, though I would rather put entire container_of() on
the next line (see for the existing style in the module and use it).

> +               /* This device_attach() might sleep */
> +               if (device_attach(host) < 0)
> +                       dev_err(dev, "device_attach(usb3_port) failed\n");

can't be "usb3_port" part derived from the host variable somehow and
to some extend?

> +       usb3->role_sw = usb_role_switch_register(&pdev->dev,
> +                                       &renesas_usb3_role_switch_desc);
> +       if (!IS_ERR(usb3->role_sw)) {

> +               usb3->host_dev = usb_of_get_companion_dev(&pdev->dev);

Hmm... Can it possible return -EPROBE_DEFER? If so, would it be better
to use other approach to handle it?

> +               if (IS_ERR_OR_NULL(usb3->host_dev)) {
> +                       /* If not found, this driver will not use a role sw */
> +                       usb_role_switch_unregister(usb3->role_sw);
> +                       usb3->role_sw = NULL;
> +               }
> +       } else {
> +               usb3->role_sw = NULL;
> +       }


-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-05-28 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25  7:12 [PATCH v5] usb: gadget: udc: renesas_usb3: Add register of usb role switch Yoshihiro Shimoda
2018-05-28 12:47 ` Andy Shevchenko [this message]
2018-05-29  2:51   ` Yoshihiro Shimoda
2018-05-28 13:04 ` Heikki Krogerus
2018-05-29  2:52   ` Yoshihiro Shimoda

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='CAHp75VcFNkrBXXgCB+pQJHGvHquik7OMD+W=eZn4Gj9b14799w@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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).