lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] [RFC] usb: gadget: avoid unusual inline assembly
On Mon, Sep 27, 2021 at 5:38 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang does not understand the "mrc%?" syntax:
>
> drivers/usb/gadget/udc/pxa25x_udc.c:2330:11: error: invalid % escape in inline assembly string
>
> I don't understand it either, but removing the %? here gets it to build.
> This is probably wrong and someone else should do a proper patch.
>
> Any suggestions?

https://gcc.gnu.org/onlinedocs/gccint/Output-Template.html says:
>> ‘%’ followed by a punctuation character specifies a substitution that does not use an operand. Only one case is standard: ‘%%’ outputs a ‘%’ into the assembler code.

I don't think the intention was to have `mrc?` in the emitted
assembler (is that even valid?), so it's not clear to me what this
point of `%?` was. Patch LGTM.

>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/usb/gadget/udc/pxa25x_udc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index a09ec1d826b2..52cdfd8212d6 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -2325,7 +2325,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
> pr_info("%s: version %s\n", driver_name, DRIVER_VERSION);
>
> /* insist on Intel/ARM/XScale */
> - asm("mrc%? p15, 0, %0, c0, c0" : "=r" (chiprev));
> + asm("mrc p15, 0, %0, c0, c0" : "=r" (chiprev));
> if ((chiprev & CP15R0_VENDOR_MASK) != CP15R0_XSCALE_VALUE) {
> pr_err("%s: not XScale!\n", driver_name);
> return -ENODEV;
> --
> 2.29.2
>


--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2021-10-13 20:37    [W:0.064 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site