From: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
To: Adam Wallis <awallis-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Mathias Nyman
<mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Matthias Brugger
<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v1] usb: xhci: allow imod-interval to be configurable
Date: Wed, 29 Nov 2017 09:09:41 +0100 [thread overview]
Message-ID: <20171129080941.GA2319@kroah.com> (raw)
In-Reply-To: <22b57b69-3728-d879-42c6-92e87e7c7955-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
On Tue, Nov 28, 2017 at 03:32:29PM -0500, Adam Wallis wrote:
> On 11/28/2017 2:35 PM, Greg Kroah-Hartman wrote:
> > On Tue, Nov 28, 2017 at 12:11:46PM -0500, Adam Wallis wrote:
> >> The xHCI driver currently has the IMOD set to 160, which
> >> translates to an IMOD interval of 40,000ns (160 * 250)ns
> >>
> [..]
> >> --- a/drivers/usb/host/xhci-plat.c
> >> +++ b/drivers/usb/host/xhci-plat.c
> >> @@ -23,6 +23,7 @@
> >> #include "xhci-plat.h"
> >> #include "xhci-mvebu.h"
> >> #include "xhci-rcar.h"
> >> +#include "xhci-mtk.h"
> >>
> >> static struct hc_driver __read_mostly xhci_plat_hc_driver;
> >>
> >> @@ -269,6 +270,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
> >> if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
> >> xhci->quirks |= XHCI_BROKEN_PORT_PED;
> >>
> >> + /* imod interval in nanoseconds */
> >> + if (device_property_read_u32(sysdev,
> >> + "imod-interval", &xhci->imod_interval))
> >> + xhci->imod_interval = 40000;
> >
> > So no matter what value you read, you set it to 40000? Or am I reading
> > this code incorrectly?
>
> I think you may be reading the code incorrectly. device_property_read_u32()
> returns 0 when the property is found and valid...and stored into
> xhci->imod_interval. When 0 is returned in this case, the default value of
> 40,000 is skipped over.
Yes, it is very hard to read :(
> > There's a good reason putting function calls inside if() is considered a
> > bad coding style :)
>
> I do not disagree with you, however, I was trying to maintain style consistency
> with the device property reads with the xhci_plat_probe function.
Ok, maybe it should all be fixed :)
> If I break that consistency, a couple of ways I might write this cleaner
>
> 1) set xhci->imod_interval to 40,000 before the call to
> device_property_read_u32. If the property exists in a firmware node, it will
> update the imod_interval value...if it does not exist, it will not update this
> value and the default will be used. In this case, I would not even check the
> return value. This method is used quite a bit in the kernel.
Sounds like a reasonable way to do it.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1] usb: xhci: allow imod-interval to be configurable
Date: Wed, 29 Nov 2017 09:09:41 +0100 [thread overview]
Message-ID: <20171129080941.GA2319@kroah.com> (raw)
In-Reply-To: <22b57b69-3728-d879-42c6-92e87e7c7955@codeaurora.org>
On Tue, Nov 28, 2017 at 03:32:29PM -0500, Adam Wallis wrote:
> On 11/28/2017 2:35 PM, Greg Kroah-Hartman wrote:
> > On Tue, Nov 28, 2017 at 12:11:46PM -0500, Adam Wallis wrote:
> >> The xHCI driver currently has the IMOD set to 160, which
> >> translates to an IMOD interval of 40,000ns (160 * 250)ns
> >>
> [..]
> >> --- a/drivers/usb/host/xhci-plat.c
> >> +++ b/drivers/usb/host/xhci-plat.c
> >> @@ -23,6 +23,7 @@
> >> #include "xhci-plat.h"
> >> #include "xhci-mvebu.h"
> >> #include "xhci-rcar.h"
> >> +#include "xhci-mtk.h"
> >>
> >> static struct hc_driver __read_mostly xhci_plat_hc_driver;
> >>
> >> @@ -269,6 +270,20 @@ static int xhci_plat_probe(struct platform_device *pdev)
> >> if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped"))
> >> xhci->quirks |= XHCI_BROKEN_PORT_PED;
> >>
> >> + /* imod interval in nanoseconds */
> >> + if (device_property_read_u32(sysdev,
> >> + "imod-interval", &xhci->imod_interval))
> >> + xhci->imod_interval = 40000;
> >
> > So no matter what value you read, you set it to 40000? Or am I reading
> > this code incorrectly?
>
> I think you may be reading the code incorrectly. device_property_read_u32()
> returns 0 when the property is found and valid...and stored into
> xhci->imod_interval. When 0 is returned in this case, the default value of
> 40,000 is skipped over.
Yes, it is very hard to read :(
> > There's a good reason putting function calls inside if() is considered a
> > bad coding style :)
>
> I do not disagree with you, however, I was trying to maintain style consistency
> with the device property reads with the xhci_plat_probe function.
Ok, maybe it should all be fixed :)
> If I break that consistency, a couple of ways I might write this cleaner
>
> 1) set xhci->imod_interval to 40,000 before the call to
> device_property_read_u32. If the property exists in a firmware node, it will
> update the imod_interval value...if it does not exist, it will not update this
> value and the default will be used. In this case, I would not even check the
> return value. This method is used quite a bit in the kernel.
Sounds like a reasonable way to do it.
thanks,
greg k-h
next prev parent reply other threads:[~2017-11-29 8:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 17:11 [PATCH v1] usb: xhci: allow imod-interval to be configurable Adam Wallis
2017-11-28 17:11 ` Adam Wallis
[not found] ` <1511889106-9239-1-git-send-email-awallis-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-11-28 19:35 ` Greg Kroah-Hartman
2017-11-28 19:35 ` Greg Kroah-Hartman
[not found] ` <20171128193500.GA30609-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2017-11-28 20:32 ` Adam Wallis
2017-11-28 20:32 ` Adam Wallis
[not found] ` <22b57b69-3728-d879-42c6-92e87e7c7955-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-11-29 8:09 ` Greg Kroah-Hartman [this message]
2017-11-29 8:09 ` Greg Kroah-Hartman
[not found] ` <20171129080941.GA2319-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2017-12-01 2:01 ` Rob Herring
2017-12-01 2:01 ` Rob Herring
2017-12-01 2:02 ` Rob Herring
2017-12-01 2:02 ` Rob Herring
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=20171129080941.GA2319@kroah.com \
--to=gregkh-hqyy1w1ycw8ekmwlsbkhg0b+6bgklq7r@public.gmane.org \
--cc=awallis-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mathias.nyman-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=timur-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
/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.