From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: John Keeping <john@metanate.com>, Nathan Chancellor <nathan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nick Desaulniers <ndesaulniers@google.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"llvm@lists.linux.dev" <llvm@lists.linux.dev>
Subject: Re: [PATCH v2] usb: dwc2: hcd_queue: Fix use of floating point literal
Date: Mon, 8 Nov 2021 07:56:30 +0000 [thread overview]
Message-ID: <6f53980b-cdd9-983e-5278-bdb6f7931ed5@synopsys.com> (raw)
In-Reply-To: <YYVKj/+4snhK6/vs@donbot>
On 11/5/2021 7:15 PM, John Keeping wrote:
> On Fri, Nov 05, 2021 at 07:58:03AM -0700, Nathan Chancellor wrote:
>> A new commit in LLVM causes an error on the use of 'long double' when
>> '-mno-x87' is used, which the kernel does through an alias,
>> '-mno-80387' (see the LLVM commit below for more details around why it
>> does this).
>>
>> drivers/usb/dwc2/hcd_queue.c:1744:25: error: expression requires 'long double' type support, but target 'x86_64-unknown-linux-gnu' does not support it
>> delay = ktime_set(0, DWC2_RETRY_WAIT_DELAY);
>> ^
>> drivers/usb/dwc2/hcd_queue.c:62:34: note: expanded from macro 'DWC2_RETRY_WAIT_DELAY'
>> #define DWC2_RETRY_WAIT_DELAY (1 * 1E6L)
>> ^
>> 1 error generated.
>>
>> This happens due to the use of a 'long double' literal. The 'E6' part of
>> '1E6L' causes the literal to be a 'double' then the 'L' suffix promotes
>> it to 'long double'.
>>
>> There is no visible reason for a floating point value in this driver, as
>> the value is only used as a parameter to a function that expects an
>> integer type. Use NSEC_PER_MSEC, which is the same integer value as
>> '1E6L', to avoid changing functionality but fix the error.
>>
>> Fixes: 6ed30a7d8ec2 ("usb: dwc2: host: use hrtimer for NAK retries")
>> Link: https://urldefense.com/v3/__https://github.com/ClangBuiltLinux/linux/issues/1497__;!!A4F2R9G_pg!KuhWEjrjOQ8CCBd81IpZ5GxP7Sksp_VESbrQ2QTDnLQBOWN7E1YrD0iJCn9fUAU$
>> Link: https://urldefense.com/v3/__https://github.com/llvm/llvm-project/commit/a8083d42b1c346e21623a1d36d1f0cadd7801d83__;!!A4F2R9G_pg!KuhWEjrjOQ8CCBd81IpZ5GxP7Sksp_VESbrQ2QTDnLQBOWN7E1YrD0iJyK66ZHc$
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Reviewed-by: John Keeping <john@metanate.com>
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
>
>> ---
>>
>> v1 -> v2: https://urldefense.com/v3/__https://lore.kernel.org/r/20211104215923.719785-1-nathan@kernel.org/__;!!A4F2R9G_pg!KuhWEjrjOQ8CCBd81IpZ5GxP7Sksp_VESbrQ2QTDnLQBOWN7E1YrD0iJwwZgtI8$
>>
>> * Use NSEC_PER_MSEC instead of USEC_PER_SEC, as the units of the second
>> parameter of ktime_set is nanoseconds. Thanks to John Keeping for
>> pointing this out.
>>
>> * Pick up Nick's review tag.
>>
>> drivers/usb/dwc2/hcd_queue.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
>> index 89a788326c56..24beff610cf2 100644
>> --- a/drivers/usb/dwc2/hcd_queue.c
>> +++ b/drivers/usb/dwc2/hcd_queue.c
>> @@ -59,7 +59,7 @@
>> #define DWC2_UNRESERVE_DELAY (msecs_to_jiffies(5))
>>
>> /* If we get a NAK, wait this long before retrying */
>> -#define DWC2_RETRY_WAIT_DELAY (1 * 1E6L)
>> +#define DWC2_RETRY_WAIT_DELAY (1 * NSEC_PER_MSEC)
>>
>> /**
>> * dwc2_periodic_channel_available() - Checks that a channel is available for a
>>
>> base-commit: d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7
>> --
>> 2.34.0.rc0
>>
prev parent reply other threads:[~2021-11-08 8:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 14:58 [PATCH v2] usb: dwc2: hcd_queue: Fix use of floating point literal Nathan Chancellor
2021-11-05 15:15 ` John Keeping
2021-11-08 7:56 ` Minas Harutyunyan [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=6f53980b-cdd9-983e-5278-bdb6f7931ed5@synopsys.com \
--to=minas.harutyunyan@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=john@metanate.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.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