[PATCH v2 1/3] mtd: mtdoops: change printk() to counterpart pr_ functions

Joe Perches joe at perches.com
Fri Oct 7 00:09:26 PDT 2022


On Fri, 2022-10-07 at 06:50 +0000, Ray Zhang wrote:
> To comply with latest kernel code requirement, change printk() to
> counterpart pr_ functions in mtdoops driver:
> - change printk(INFO) to pr_info()
> - change printk(DEBUG) to pr_debug()

There is a different behavior with printk(KERN_DEBUG to pr_debug(
as pr_debug is a no-op unless dynamic debugging is enabled or
DEBUG is defined.

And even with dynamic_debug, the output is default disabled unless
DEBUG is defined.

As is, printk(KERN_DEBUG is emitted unless the console level is low.

> diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
[]
> @@ -120,8 +120,8 @@ static void mtdoops_inc_counter(struct mtdoops_context *cxt)
>  		return;
>  	}
>  
> -	printk(KERN_DEBUG "mtdoops: ready %d, %d (no erase)\n",
> -	       cxt->nextpage, cxt->nextcount);
> +	pr_debug("mtdoops: ready %d, %d (no erase)\n",
> +		 cxt->nextpage, cxt->nextcount);
>  }

etc...




More information about the linux-mtd mailing list