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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 06 Jun 2013 14:23:08 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	Johannes Schilling <of82ecuq@....cs.fau.de>,
	devel@...verdev.osuosl.org, Kurt Kanzenbach <shifty91@...il.com>,
	linux-kernel@...cs.fau.de,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, Al Cho <acho@...ell.com>,
	Amarjargal Gundjalam <amarjargal16@...il.com>,
	Laura Lawniczak <laura.lawniczak@...glemail.com>
Subject: Re: [PATCH 3/6] keucr: migrate printk to dev_dbg/info/warn/err

On Fri, 2013-06-07 at 00:11 +0300, Dan Carpenter wrote:
> On Thu, Jun 06, 2013 at 10:53:20AM -0700, Joe Perches wrote:
> > On Thu, 2013-06-06 at 18:10 +0200, Johannes Schilling wrote:
> > > From: Laura Lawniczak <laura.lawniczak@...glemail.com>
> > []
> > > diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c
> > []
> > > @@ -19,13 +19,13 @@ int ENE_InitMedia(struct us_data *us)
> > []
> > > -	printk(KERN_INFO "MiscReg03 = %x\n", MiscReg03);
> > > +	dev_info(&us->pusb_dev->dev, "MiscReg03 = %x\n", MiscReg03);
> > 
> > I suggest adding a few convenience macros to make
> > this a bit shorter and more likely to fit on a single
> > line without exceeding 80 cols.
> > 
> > Adding something like:
> > 
> > #define us_<level>(us, fmt, ...)				\
> > 	dev_<level>(&us->pusb_dev->dev, fmt, ##__VA_ARGS__)
> > 
> > so these uses become
> > 
> > 	us_info(us, "MiscReg03\n", MiscReg03);
> > 
> > which is shorter and more readable.
> > 
> 
> Wait what?  That's not a readable example.  Why are we passing the
> MiscReg03 variable when there is no %d in the string?

'cause I forgot to add in the  " = %x",  Oops.

> You're a big fan of custom printk macros but it's better if people
> can stick the to the normal ones if possible.  In this case, just
> using a local variable is enough:
> 
> 	dev_dbg(us_dev, "scsi cmd %X --- SCSIOP_ALLOW_MEDIUM_REMOVAL\n", cmd);
> 
> 79 characters.

<shrug>  Now you need another line to set the local var
in each function.  If there's only a few functions that'd
be fine.

> Anyway this could fixed in a later patch.

True, but if there are a lot of files patched separately,
putting the macro in an appropriate header first saves a
lot of follow up patches.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ