From: Jakub Sitnicki <jsitnicki@gmail.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: Re: [PATCH 5/6] staging: rtl8188eu: stop using DBG_88E
Date: Sat, 18 Jul 2015 20:03:27 +0200 [thread overview]
Message-ID: <87lhedjqc0.fsf@frog.home> (raw)
In-Reply-To: <20150718044607.GA14213@sudip-PC>
On Sat, Jul 18, 2015 at 06:46 AM CEST, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> On Fri, Jul 17, 2015 at 05:33:55PM +0200, Jakub Sitnicki wrote:
>> On Thu, Jul 16, 2015 at 01:28 PM CEST, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
>> > Stop using DBG_88E which is a custom macro for printing debugging
>> > messages. Instead start using pr_debug and in the process define
>> > pr_fmt.
>>
>> In the end, don't we want to use netdev_dbg() everywhere where we work
>> with a struct net_device? And use dev_dbg() everywhere where we work
>> with a struct device (or a struct usb_interface)?
> Looks like in some places we can get net_device from usb_interface.
>
> struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
> struct adapter *padapter = dvobj->if1;
> struct net_device *pnetdev = padapter->pnetdev;
You're right providing that the net_device has been successfully
allocated and hasn't been deallocated yet. There are at least a couple
of pr_debug() calls that couldn't be converted to netdev_dbg(), one in
rtw_drv_init() and another in rtw_dev_remove(), because the net_device
is not available, if I'm not wrong.
>> At least that's how I understand commit 8f26b8376faa ("checkpatch:
>> update suggested printk conversions") description:
>>
>> Direct conversion of printk(KERN_<LEVEL>... to pr_<level> isn't the
>> preferred conversion when a struct net_device or struct device is
>> available.
>>
>> Do you think it is worth going straight for netdev_dbg()/dev_dbg() to
>> avoid redoing it later?
> At the end it should be netdev_* or dev_* and if both are not available
> then pr_*. Here my main intention was to remove the custom defined
> macro. And while doing this it is easier to use a script to reduce the
> chances of error. Now that the custom macro is out of the way we can
> concentrate on converting it to netdev_* or dev_*.
>>
>> >
> <snip>
>> >
>> > +#define pr_fmt(fmt) "R8188EU: " fmt
>> > #include <osdep_service.h>
>> > #include <drv_types.h>
>> > #include <recv_osdep.h>
>>
>> If we're going to stay with pr_debug(), using KBUILD_MODNAME seems to be
>> the convention among drivers when defining pr_fmt():
>>
>> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> yes, KBUILD_MODNAME is the usual convention but you will also find many
> places where that has not been used. Here I have used R8188EU to keep it
> same for all the messages that will be printed from the other files of
> this driver else it might be confusing for the user.
I see your point. If consistent log prefix is the goal do you think it
would make sense to change it to:
#define pr_fmt(fmt) DRIVER_PREFIX ": " fmt
... so the prefix is not defined in two places?
Cheers,
Jakub
next prev parent reply other threads:[~2015-07-18 18:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 11:28 [PATCH 1/6] staging: rtl8188eu: remove unused function Sudip Mukherjee
2015-07-16 11:28 ` [PATCH 2/6] staging: rtl8188eu: remove redundant NULL check Sudip Mukherjee
2015-07-16 11:28 ` [PATCH 3/6] staging: rtl8188eu: remove goto label Sudip Mukherjee
2015-07-17 11:03 ` Dan Carpenter
2015-07-17 11:25 ` Sudip Mukherjee
2015-07-17 11:47 ` Dan Carpenter
2015-07-17 12:03 ` Sudip Mukherjee
2015-07-16 11:28 ` [PATCH 4/6] staging: rtl8188eu: remove unneeded variable Sudip Mukherjee
2015-07-16 11:28 ` [PATCH 5/6] staging: rtl8188eu: stop using DBG_88E Sudip Mukherjee
2015-07-17 15:33 ` Jakub Sitnicki
2015-07-18 4:46 ` Sudip Mukherjee
2015-07-18 18:03 ` Jakub Sitnicki [this message]
2015-07-20 5:29 ` Sudip Mukherjee
2015-07-16 11:28 ` [PATCH 6/6] staging: rtl8188eu: remove unneeded ret Sudip Mukherjee
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=87lhedjqc0.fsf@frog.home \
--to=jsitnicki@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).