Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2988114pxb; Fri, 5 Nov 2021 08:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWDdONIfW/FCUJdkotCYLhfZCcelHsS60yNptbT/ZjhQQmCbrc7llT8sb1/WngxikJs687 X-Received: by 2002:a17:906:4bcf:: with SMTP id x15mr48785563ejv.493.1636124405956; Fri, 05 Nov 2021 08:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636124405; cv=none; d=google.com; s=arc-20160816; b=qrGfWrlKSvV40QYPsJTN9gWdstZtk4XgsJRRvYqRgGvftJcw2X5YIYiGH1+5W6TLYp 7sLL0+XN1XBW4xqKRXlUF9/q/kKlygEMS3U/7rabQM6BknpuMktxUw06DiLjGMGSFkMI 6uFjilf0110pCHcLs4e092ShHeuqWgHPuKwx6NoUAFVTDVjwE8Xn8WaTA6xCMdAskBV2 chwyYVFm6smjdyo9fzj6Tvjyim4HsjqnNy3uXpw8zLEmI+Yj/tTDBNIQ3mUQjByd48GD oWIVs7CXAO0P1ZCXhokjs+Rl1OuRnx1UoWMoEq4ve3uInrOOGm6b//3eOvrYvj6243t/ 5G4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UeQXChELVLM0OsrXSnaxObM4rRjEfdRu9NkQfcxSAX0=; b=lHmy1xcey27XGKydfULnIy6k6WmTaYtSnMYoMOE9RwyFdCVNPo464xsyG8yAtymIlk UQ0RmYHGTwrby6Ga9lBBoX32iQQw3N+hnT8iDynLH2WP+HufEHUjm2jQOBkq/2TfXEjJ eeMQomNPPVQUqQtEfrNEKRVPIe9zkNp573P3WwiyRxXEZgQwvX3dYXa8LwqovsZnIECL XSAeKaPP89NQYV/h+cPeEE7S+y11iif4brz+kumMDzM+3/4cv0Yq0gqP+ICuaPb1/PMT uPoPFixnOMhbGTPxkkruxd8gvM8OnYqife1i14pVzm8zmal8dg9cU1Y6qF4Ivxz9TXwZ 66/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n0VMZWrH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si13277448edc.216.2021.11.05.07.59.39; Fri, 05 Nov 2021 08:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n0VMZWrH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233305AbhKEO7F (ORCPT + 99 others); Fri, 5 Nov 2021 10:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:51650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233278AbhKEO7F (ORCPT ); Fri, 5 Nov 2021 10:59:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F0896120E; Fri, 5 Nov 2021 14:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636124185; bh=o/e3Kg4XQetn+fV8ykmX1Wv4U8T/q0l5MdvRDWYx79g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n0VMZWrHUHHqJINgGjRtwz6b9NlqlkxOTYeTvEXgxgPF50k491UbCwZPePjrehBcY LvB7IQTZefNIDSJhpyXy80uuxPEQft2ho7QazhOOkExulyRntyQN+wMS8ExQPviMwi LLXK4WACNA+nM2IjZk4Xyfl6X6zMMpHGurq6C4pdiCij49ftRC9wi9SA59yAHKAYYi TO03gV5Df4Yso7q2bVju4clQdqP+Glim1OsCF97pv0HOsHcHuZkUkhC92qb24kkbUL ofQ0t20/JYa9BJGkrdRGrQRS00SQHOQQXApjWOmuzDmKl3Rzev7cEYu6kqyXJCTpZN /l1bp9mJl/VhA== Date: Fri, 5 Nov 2021 07:56:17 -0700 From: Nathan Chancellor To: John Keeping Cc: Minas Harutyunyan , Greg Kroah-Hartman , Nick Desaulniers , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] usb: dwc2: hcd_queue: Fix use of floating point literal Message-ID: References: <20211104215923.719785-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 05, 2021 at 01:08:48PM +0000, John Keeping wrote: > On Thu, Nov 04, 2021 at 02:59:23PM -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 USEC_PER_SEC, 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://github.com/ClangBuiltLinux/linux/issues/1497 > > Link: https://github.com/llvm/llvm-project/commit/a8083d42b1c346e21623a1d36d1f0cadd7801d83 > > Signed-off-by: Nathan Chancellor > > --- > > 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..bdf1927e1be1 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 * USEC_PER_SEC) > > Using USEC_PER_SEC here seems quite weird. This is used as: > > delay = ktime_set(0, DWC2_RETRY_WAIT_DELAY); > > so the units are nanoseconds. > > Maybe NSEC_PER_MSEC would better indicate the intent here? Yes, that seems reasonable. I will send a v2. Cheers, Nathan