lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221222162438.4d06bd77@bootlin.com>
Date:   Thu, 22 Dec 2022 16:24:38 +0100
From:   Herve Codina <herve.codina@...tlin.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Geert Uytterhoeven <geert@...ux-m68k.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Magnus Damm <magnus.damm@...il.com>,
        Gareth Williams <gareth.williams.jx@...esas.com>,
        linux-renesas-soc@...r.kernel.org, linux-clk@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>
Subject: Re: [PATCH v4 3/5] usb: gadget: udc: add Renesas RZ/N1 USBF
 controller support

Hi Geert, Greg,

On Wed, 21 Dec 2022 14:07:53 +0100
Greg Kroah-Hartman <gregkh@...uxfoundation.org> wrote:

> On Wed, Dec 21, 2022 at 02:03:43PM +0100, Geert Uytterhoeven wrote:
> > Hi Hervé,
> > 
> > On Tue, Dec 13, 2022 at 2:33 PM Herve Codina <herve.codina@...tlin.com> wrote:  
> > > Add support for the Renesas USBF controller.
> > > This controller is an USB2.0 UDC controller available in the
> > > Renesas r9a06g032 SoC (RZ/N1 family).
> > >
> > > Signed-off-by: Herve Codina <herve.codina@...tlin.com>  
> > 
> > Thanks for your patch!
> >   
> > > --- /dev/null
> > > +++ b/drivers/usb/gadget/udc/renesas_usbf.c  
> >   
> > > +#ifdef DEBUG
> > > +#define TRACE(_fmt, ...) trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__)
> > > +#define USBF_TRACE_EP_MASK 0x0ffff /* All the 16 endpoints */
> > > +#define TRACEEP(_ep, _fmt, ...)                                             \
> > > +       do {                                                                \
> > > +               if ((1 << (_ep)->id) & USBF_TRACE_EP_MASK)                  \
> > > +                       trace_printk("%s: " _fmt, __func__, ##__VA_ARGS__); \
> > > +       } while (0)
> > > +#else
> > > +#define TRACE(_fmt, ...) do { } while (0)
> > > +#define TRACEEP(_ep, _fmt, ...) do { } while (0)  
> > 
> > Please use "no_printk(fmt, ##__VA_ARGS__)" instead of dummy loops,
> > to avoid bad callers going unnoticed if DEBUG is not defined.  
> 
> Even better, do NOT define custom debug/trace macros for a single
> driver, just use the ones that the rest of the kernel uses instead
> please.
> 
> thanks,
> 
> greg k-h

I would like to keep some granularity in debug messages and
also keep the function name automatically added.
I propose 3 kinds of messages:
- general ones,
- specific Endpoint0 ones,
- other Endpoints ones.

So before doing any modification in the source code, what do you
think about:
    /*
     * Suggested tracers:
     * - no_printk:    Disable tracing
     * - trace_printk: Print to trace buffer
     */
    #define usbf_dbg(_fmt, ...) no_printk("%s: " _fmt, __func__, ##__VA_ARGS__)
    #define usbf_dbg_ep0(_fmt, ...) no_printk("%s: " _fmt, __func__, ##__VA_ARGS__)
    #define usbf_dbg_epn(_fmt, ...) no_printk("%s: " _fmt, __func__, ##__VA_ARGS__)

The code will use only these macros instead of the previously
defined TRACE and TRACEEP as follow:
- usbf_dbg() will be called instead of TRACE()
- usbf_dbg_ep0() will be called instead of TRACEEP() for Endpoint0
- usbf_dbg_epn() will be called instead of TRACEEP() for other Endpoints

Is that ok for you ?

Best regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ