lkml.org 
[lkml]   [2018]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v5 02/12] [media] cxd2880-spi: Add support for CXD2880 SPI interface
Date
Hi, Mauro

> > + u8 send_data[BURST_WRITE_MAX + 4];
> > + const u8 *write_data_top = NULL;
> > + int ret = 0;
> > +
> > + if (!spi || !data) {
> > + pr_err("invalid arg\n");
> > + return -EINVAL;
> > + }
> > + if (size > BURST_WRITE_MAX) {
> > + pr_err("data size > WRITE_MAX\n");
> > + return -EINVAL;
> > + }
> > +
> > + if (sub_address + size > 0x100) {
> > + pr_err("out of range\n");
> > + return -EINVAL;
> > + }
>
> It is better to use dev_err(spi->dev, ...) instead of pr_err().

I got comment for this previous version patch as below
--------------------------------------------------------------------------------------
The best would be to se dev_err() & friends for printing messages, as they print the device's name as filled at struct device.
If you don't use, please add a define that will print the name at the logs, like:

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

either at the begining of the driver or at some header file.

Btw, I'm noticing that you're also using dev_err() on other places of the code.
Please standardize. OK, on a few places, you may still need to use pr_err(), if you need to print a message before initializing struct device, but I suspect that you can init
--------------------------------------------------------------------------------------

You pointed out here before. Because dev_foo () and pr_foo () were mixed.
We standardize with pr_foo() because the logs is outputted before getting the device structure.
Is it better to use dev_foo() where we can use it?

Takiguchi

\
 
 \ /
  Last update: 2018-04-06 02:29    [W:0.065 / U:1.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site