All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [RFC] Unify messaging in gadget functions
Date: Mon, 5 Dec 2022 16:07:04 +0100	[thread overview]
Message-ID: <Y44JGJb+LA66lPbP@kroah.com> (raw)
In-Reply-To: <5a44f991-fd77-09bf-658b-398d5545297a@collabora.com>

On Mon, Dec 05, 2022 at 03:13:46PM +0100, Andrzej Pietrasiewicz wrote:
> Hi Greg,
> 
> W dniu 5.12.2022 o 13:20, Greg KH pisze:
> > On Mon, Dec 05, 2022 at 01:14:21PM +0100, Andrzej Pietrasiewicz wrote:
> > > Hi All,
> > > 
> > > include/linux/usb/composite.h contains:
> > > 
> > > /* messaging utils */
> > > #define DBG(d, fmt, args...) \
> > > 	dev_dbg(&(d)->gadget->dev , fmt , ## args)
> > > #define VDBG(d, fmt, args...) \
> > > 	dev_vdbg(&(d)->gadget->dev , fmt , ## args)
> > > #define ERROR(d, fmt, args...) \
> > > 	dev_err(&(d)->gadget->dev , fmt , ## args)
> > > #define WARNING(d, fmt, args...) \
> > > 	dev_warn(&(d)->gadget->dev , fmt , ## args)
> > > #define INFO(d, fmt, args...) \
> > > 	dev_info(&(d)->gadget->dev , fmt , ## args)
> > > 
> > > Gadget functions do use these, but not consistently:
> 
> <snip>
> 
> > > Questions:
> > > 
> > > 1) Should we make them use the messaging utils consitently?
> > 
> > Yes, converting to use the dev_*() calls is good to do.
> 
> Heh, I sent this RFC to prevent learning the hard way (by actually creating
> incorrect patches), that we want to be consistent, but using dev_*() calls
> rather than composite.h utils. That's ok.
> 
> Which brings an interesting question: should the ultimate goal be to remove the
> messaging utils altogether from composite.h? It _seems_ their purpose is mainly
> to wrap dereferencing a pointer two pointers away: &(d)->gadget->dev to make
> invocations shorter. With the default of 100 columns in checkpatch nowadays it
> is maybe a less important goal? Or maybe we should prevent such long
> dereferencing by introducing helper variables just like below in
> u_audio_start_capture()?

Yes, that should be the ultimate goal.  We did that in the USB drivers a
decade or so ago, but no one spent the time to do the same for the USB
gadget code.

thanks,

greg k-h

      reply	other threads:[~2022-12-05 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 12:14 [RFC] Unify messaging in gadget functions Andrzej Pietrasiewicz
2022-12-05 12:20 ` Greg KH
2022-12-05 14:13   ` Andrzej Pietrasiewicz
2022-12-05 15:07     ` Greg KH [this message]

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=Y44JGJb+LA66lPbP@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andrzej.p@collabora.com \
    --cc=linux-usb@vger.kernel.org \
    /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.