[PATCH 1/2] mtd: nand: generalized error messages with __func__

Artem Bityutskiy dedekind1 at gmail.com
Wed Jun 1 06:30:35 EDT 2011


Hi,

On Tue, 2011-05-31 at 11:52 -0700, Brian Norris wrote:
> > Brian, would you please instead just zap the prints?
> 
> Sure, can do. In general, then, is it best practice to simply 'return
> -ENOMEM' or similar (without any printing) in all MTD code?

Yes.

> > On Thu, 2011-05-26 at 08:14 +0300, Igor Grinberg wrote:
> >> On 05/26/11 00:59, Brian Norris wrote:
> >> pr_err() will save you from the need to define the log level each time.
> >> pr_fmt will save you the need to add %s: and __func__.
> 
> Also, it seems that the second statement is not necessarily true. In
> fact, in include/linux/printk.h, we default to the following
> declaration:
>      #define pr_fmt(fmt) fmt

To be more precise:

#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif

> So it seems that, when we desire to print out the relevant function
> name, we should manually use __func__ instead of relying on
> pr_fmt...or should we define our own pr_fmt in include/linux/mtd.h?

Yes, before you include files.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list