RE: [PATCH 3/4] usb: cdns2: Add tracepoints for CDNS2 driver
From: Pawel Laszczak
Date: Thu Feb 16 2023 - 06:36:54 EST
>
>On Thu, Feb 16, 2023 at 05:54:10AM -0500, Pawel Laszczak wrote:
>> Patch adds the series of tracepoints that can be used for debugging
>> issues detected in driver.
>>
>> Signed-off-by: Pawel Laszczak <pawell@xxxxxxxxxxx>
>> ---
>> drivers/usb/gadget/udc/cdns2/Makefile | 2 +
>> drivers/usb/gadget/udc/cdns2/cdns2-debug.h | 200 +++++++
>> drivers/usb/gadget/udc/cdns2/cdns2-ep0.c | 26 +-
>> drivers/usb/gadget/udc/cdns2/cdns2-gadget.c | 52 +-
>> drivers/usb/gadget/udc/cdns2/cdns2-trace.c | 11 +
>> drivers/usb/gadget/udc/cdns2/cdns2-trace.h | 609 ++++++++++++++++++++
>> 6 files changed, 897 insertions(+), 3 deletions(-) create mode
>> 100644 drivers/usb/gadget/udc/cdns2/cdns2-debug.h
>> create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-trace.c
>> create mode 100644 drivers/usb/gadget/udc/cdns2/cdns2-trace.h
>>
>> diff --git a/drivers/usb/gadget/udc/cdns2/Makefile
>> b/drivers/usb/gadget/udc/cdns2/Makefile
>> index 7c746e6d53c2..a1ffbbe2e768 100644
>> --- a/drivers/usb/gadget/udc/cdns2/Makefile
>> +++ b/drivers/usb/gadget/udc/cdns2/Makefile
>> @@ -1,5 +1,7 @@
>> # SPDX-License-Identifier: GPL-2.0
>> # define_trace.h needs to know how to find our header
>> +CFLAGS_cdns2-trace.o := -I$(src)
>>
>> obj-$(CONFIG_USB_CDNS2_UDC) += cdns2-udc-pci.o
>> cdns2-udc-pci-$(CONFIG_USB_CDNS2_UDC) += cdns2-pci.o cdns2-gadget.o
>cdns2-ep0.o
>> +cdns2-udc-pci-$(CONFIG_TRACING) += cdns2-trace.o
>> diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-debug.h
>> b/drivers/usb/gadget/udc/cdns2/cdns2-debug.h
>> new file mode 100644
>> index 000000000000..3a80f3fbdcd3
>> --- /dev/null
>> +++ b/drivers/usb/gadget/udc/cdns2/cdns2-debug.h
>> @@ -0,0 +1,200 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/*
>> + * Cadence USBHS-DEV Driver.
>> + * Debug header file.
>> + *
>> + * Copyright (C) 2023 Cadence.
>> + *
>> + * Author: Pawel Laszczak <pawell@xxxxxxxxxxx> */
>> +
>> +#ifndef __LINUX_CDNS2_DEBUG
>> +#define __LINUX_CDNS2_DEBUG
>> +
>> +static inline const char *cdns2_decode_usb_irq(char *str, size_t size,
>> + u8 usb_irq, u8 ext_irq)
>
><snip>
>
>Why are all of these big functions declared as inline? Do they really work as
>inline functions if you only reference them in a trace callback?
>
Yes, driver reference them only in trace callback.
The big function are used only once in code, so it seems reasonable to use them as inline.
I don't know how they will be used by compiler.
Thanks,
Pawel Laszczak