All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Manish Narani <manish.narani@xilinx.com>
Cc: mathias.nyman@intel.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, anuragku@xilinx.com,
	punnaia@xilinx.com, anirudh@xilinx.com, mnarani@xilinx.com
Subject: Re: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call
Date: Wed, 14 Dec 2016 12:58:47 -0800	[thread overview]
Message-ID: <20161214205847.GA16930@kroah.com> (raw)
In-Reply-To: <1481741708-7946-1-git-send-email-mnarani@xilinx.com>

On Thu, Dec 15, 2016 at 12:25:08AM +0530, Manish Narani wrote:
> This patch will add support for OTG host initialization. This will
> help OTG drivers to populate their host subsystem.
> 
> Signed-off-by: Manish Narani <mnarani@xilinx.com>
> ---
>  drivers/usb/host/xhci-plat.c |   35 +++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index ddfab30..b4cadbd 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -20,6 +20,10 @@
>  #include <linux/slab.h>
>  #include <linux/acpi.h>
>  
> +#ifdef CONFIG_USB_OTG
> +#include <linux/usb/otg.h>
> +#endif

never use a #ifdef in a .c file if at all possible.  Here you don't need
it at all.

> +
>  #include "xhci.h"
>  #include "xhci-plat.h"
>  #include "xhci-mvebu.h"
> @@ -255,6 +259,24 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto dealloc_usb2_hcd;
>  
> +#ifdef CONFIG_USB_OTG
> +	hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB3);
> +	if (!IS_ERR_OR_NULL(hcd->usb_phy) && hcd->usb_phy->otg) {
> +		dev_dbg(&pdev->dev, "%s otg support available\n", __func__);
> +		ret = otg_set_host(hcd->usb_phy->otg, &hcd->self);
> +		if (ret) {
> +			dev_err(&pdev->dev, "%s otg_set_host failed\n",
> +					__func__);
> +			usb_put_phy(hcd->usb_phy);
> +			hcd->usb_phy = NULL;
> +			goto dealloc_usb2_hcd;
> +		}
> +	} else {
> +		usb_put_phy(hcd->usb_phy);
> +		hcd->usb_phy = NULL;
> +	}
> +#endif

Can't you wrap this in a function to get rid of this #ifdef mess?

> +
>  	return 0;
>  
>  
> @@ -283,6 +305,19 @@ static int xhci_plat_remove(struct platform_device *dev)
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
>  	struct clk *clk = xhci->clk;
>  
> +#ifdef CONFIG_USB_OTG
> +	if (hcd->usb_phy) {
> +		if (!IS_ERR(hcd->usb_phy)) {
> +			if (hcd->usb_phy->otg)
> +				otg_set_host(hcd->usb_phy->otg, NULL);
> +			usb_put_phy(hcd->usb_phy);
> +		}
> +		hcd->usb_phy = NULL;
> +		if (xhci->shared_hcd)
> +			xhci->shared_hcd->usb_phy = NULL;
> +	}
> +#endif

same here.

thanks,

greg k-h

  reply	other threads:[~2016-12-14 20:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 18:55 [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call Manish Narani
2016-12-14 20:58 ` Greg KH [this message]
2016-12-15 12:10   ` Manish Narani
  -- strict thread matches above, loose matches on Subject: below --
2016-12-15  7:53 Manish Narani
2017-01-02  6:30 ` Manish Narani
2017-01-02  9:22   ` gregkh
2017-01-02  9:35     ` Manish Narani
2017-01-02  9:59       ` gregkh
2017-01-04 13:22 [RFC PATCH] arch: arm64: dts: add USB OTG interrupts support in ZynqMP device tree Manish Narani
2017-01-04 13:23 ` [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call Manish Narani
2017-01-04 13:23   ` Manish Narani
2017-01-04 13:23   ` Manish Narani

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=20161214205847.GA16930@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=anirudh@xilinx.com \
    --cc=anuragku@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=manish.narani@xilinx.com \
    --cc=mathias.nyman@intel.com \
    --cc=mnarani@xilinx.com \
    --cc=punnaia@xilinx.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.