Re: [PATCH v6 2/2] media: i2c: Add GC08A3 image sensor driver

Zhi Mao (毛智)
2024-02-28T03:20:17Z

Hi Andy,

Thanks for your review.

On Tue, 2024-02-27 at 14:46 +0200, Andy Shevchenko wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> On Tue, Feb 27, 2024 at 3:33 AM Zhi Mao <zhi.mao@mediatek.com>
> wrote:
> >
> > Add a V4L2 sub-device driver for Galaxycore GC08A3 image sensor.
>
> ...
>
>
> > +#include <linux/clk.h>
> > +#include <linux/delay.h>
> > +#include <linux/gpio/consumer.h>
> > +#include <linux/pm_runtime.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <linux/units.h>
>
> This is a semi-random list of inclusions. Please, follow the IWYU
> (Include What You Use) principle. *At least* this list misses the
> following: array_size.h, bits.h, container_of.h, device.h, err.h,
> i2c.h, math64.h, module.h, mod_devicetable.h, property.h, types.h.
>
> ...
After checking these header files, we find:
1."container_of.h" is included by "media-entity.h", while "media-
entity.h" is inculded by "v4l2-subdev.h"
2."device.h" is included by v4l2-dev.h, while "v4l2-dev.h" is inculded
by "v4l2-subdev.h"
3."types.h" is inclded by "v4l2-cci.h"
4.remaining header files which mentioned above are also similar, they
by some other header files
I think we just need include those necessary header files(such as
"v4l2-subdev.h"/"v4l2-cci.h"...) in sensor driver.
If we add these header files which mentioned above, I am afraid it will
cause "repeated inclusion header file" issue.
As this driver code can be compiled pass, so there is not miss any
header files.
Another, I also reviewed some other sensor driver code(such as
gc0a08/gc2145 and imx/ov), they are all the same.
Can we keep this coding style and follow with most of those
image sensor driver?

>
> ...
>
> > +static const struct dev_pm_ops gc08a3_pm_ops = {
> > + RUNTIME_PM_OPS(gc08a3_power_off, gc08a3_power_on, NULL)
> > +};
>
> There is a DEFINE_* PM macro, use it.
>
static DEFINE_SIMPLE_DEV_PM_OPS(gc08a3_pm_ops,
gc08a3_power_off,
gc08a3_power_on);
Do you mean, we shoule use this Macro?
> ...
>
>
>
> --
> With Best Regards,
> Andy Shevchenko