All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Gareth Williams <gareth.williams.jx@renesas.com>,
	linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PATCH v4 3/5] usb: gadget: udc: add Renesas RZ/N1 USBF controller support
Date: Thu, 22 Dec 2022 16:24:38 +0100	[thread overview]
Message-ID: <20221222162438.4d06bd77@bootlin.com> (raw)
In-Reply-To: <Y6MFKdOU4IUQo70L@kroah.com>

Hi Geert, Greg,

On Wed, 21 Dec 2022 14:07:53 +0100
Greg Kroah-Hartman <gregkh@linuxfoundation.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@bootlin.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@bootlin.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

  reply	other threads:[~2022-12-22 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 13:32 [PATCH v4 0/5] Add the Renesas USBF controller support Herve Codina
2022-12-13 13:32 ` [PATCH v4 1/5] dt-bindings: usb: add the Renesas RZ/N1 USBF controller Herve Codina
2022-12-14 15:58   ` Rob Herring
2022-12-15 10:01   ` Geert Uytterhoeven
2022-12-13 13:32 ` [PATCH v4 2/5] soc: renesas: r9a06g032-sysctrl: Handle h2mode setting based on USBF presence Herve Codina
2022-12-13 13:33 ` [PATCH v4 3/5] usb: gadget: udc: add Renesas RZ/N1 USBF controller support Herve Codina
2022-12-21 13:03   ` Geert Uytterhoeven
2022-12-21 13:07     ` Greg Kroah-Hartman
2022-12-22 15:24       ` Herve Codina [this message]
2022-12-22 16:28         ` Greg Kroah-Hartman
2022-12-13 13:33 ` [PATCH v4 4/5] ARM: dts: r9a06g032: Add the USBF controller node Herve Codina
2022-12-13 13:33 ` [PATCH v4 5/5] MAINTAINERS: add the Renesas RZ/N1 USBF controller entry Herve Codina

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=20221222162438.4d06bd77@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gareth.williams.jx@renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.