RE: [PATCH v5 02/12] [media] cxd2880-spi: Add support for CXD2880 SPI interface

From: Yasunari.Takiguchi
Date: Thu Apr 05 2018 - 20:29:07 EST


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