All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 1/2] usb: zynqmp: Add XHCI driver support
Date: Mon, 16 Nov 2015 10:26:01 +0100	[thread overview]
Message-ID: <201511161026.01800.marex@denx.de> (raw)
In-Reply-To: <D6974F69F1104444AD495091953B61F84A11E15C@XAP-PVEXMBX02.xlnx.xilinx.com>

On Monday, November 16, 2015 at 08:23:24 AM, Siva Durga Prasad Paladugu wrote:
> Hi Marek,

Hi,

[...]

> > > +	ctx->hcd = (struct xhci_hccr *)ctr_addr[index];
> > > +	ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) +
> > > +DWC3_REG_OFFSET);
> > 
> > Should be void *, not char * I think. Also, the parenthesis around
> > ctx->hcd are not needed.
> 
> I think keeping char* would be good for easy understanding and readability.

Using bogus casts is never good for anything.

> > > +	ret = board_usb_init(index, USB_INIT_HOST);
> > > +	if (ret != 0) {
> > > +		puts("Failed to initialize board for USB\n");
> > > +		return ret;
> > > +	}
> > > +
> > > +	ret = zynqmp_xhci_core_init(ctx);
> > > +	if (ret < 0) {
> > > +		puts("Failed to initialize xhci\n");
> > > +		return ret;
> > > +	}
> > > +
> > > +	*hccr = (struct xhci_hccr *)ctx->hcd;
> > > +	*hcor = (struct xhci_hcor *)((uint32_t) *hccr
> > > +				+ HC_LENGTH(xhci_readl(&(*hccr)-
> > >
> > >cr_capbase)));
> > 
> > You want to use uintptr_t for the same of 64bit parts.
> 
> Ok
> 
> > > +	debug("zynqmp-xhci: init hccr %x and hcor %x hc_length %d\n",
> > > +	      (uint32_t)*hccr, (uint32_t)*hcor,
> > > +	      (uint32_t)HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)));
> > 
> > We have %p for printing pointers, so drop the casts.
> > 
> > Also, since you're using HC_LENGTH() here twice, you might as well put
> > it's value into temporary variable and use it in both places, it might
> > make the code slightly more readable.
> 
> Ok, will take care in next version

Thanks!

Best regards,
Marek Vasut

      reply	other threads:[~2015-11-16  9:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16  5:59 [U-Boot] [PATCH v5 1/2] usb: zynqmp: Add XHCI driver support Siva Durga Prasad Paladugu
2015-11-16  5:59 ` [U-Boot] [PATCH v5 2/2] usb: zynqmp: Enable USB XHCI support Siva Durga Prasad Paladugu
2015-11-16  6:09 ` [U-Boot] [PATCH v5 1/2] usb: zynqmp: Add XHCI driver support Marek Vasut
2015-11-16  7:23   ` Siva Durga Prasad Paladugu
2015-11-16  9:26     ` Marek Vasut [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=201511161026.01800.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.