lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 28 Feb 2024 11:22:13 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Zhi Mao (毛智) <zhi.mao@...iatek.com>
Cc: "heiko@...ech.de" <heiko@...ech.de>, 
	"tomi.valkeinen@...asonboard.com" <tomi.valkeinen@...asonboard.com>, "robh+dt@...nel.org" <robh+dt@...nel.org>, 
	"yunkec@...omium.org" <yunkec@...omium.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
	"dan.scally@...asonboard.com" <dan.scally@...asonboard.com>, 
	"gerald.loacker@...fvision.net" <gerald.loacker@...fvision.net>, 
	Shengnan Wang (王圣男) <shengnan.wang@...iatek.com>, 
	"hdegoede@...hat.com" <hdegoede@...hat.com>, 
	"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>, 
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>, 
	"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, 
	Yaya Chang (張雅清) <Yaya.Chang@...iatek.com>, 
	"mchehab@...nel.org" <mchehab@...nel.org>, 
	"jacopo.mondi@...asonboard.com" <jacopo.mondi@...asonboard.com>, 
	"jernej.skrabec@...il.com" <jernej.skrabec@...il.com>, 
	"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>, 
	"bingbu.cao@...el.com" <bingbu.cao@...el.com>, 
	"sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>, 
	Project_Global_Chrome_Upstream_Group <Project_Global_Chrome_Upstream_Group@...iatek.com>, 
	"10572168@...com" <10572168@...com>, "conor+dt@...nel.org" <conor+dt@...nel.org>, 
	"hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>, 
	"krzysztof.kozlowski+dt@...aro.org" <krzysztof.kozlowski+dt@...aro.org>, 
	"matthias.bgg@...il.com" <matthias.bgg@...il.com>, 
	"laurent.pinchart@...asonboard.com" <laurent.pinchart@...asonboard.com>, 
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>, 
	"angelogioacchino.delregno@...labora.com" <angelogioacchino.delregno@...labora.com>, 
	"macromorgan@...mail.com" <macromorgan@...mail.com>
Subject: Re: [PATCH v6 2/2] media: i2c: Add GC08A3 image sensor driver

On Wed, Feb 28, 2024 at 5:19 AM Zhi Mao (毛智) <zhi.mao@...iatek.com> wrote:
> On Tue, 2024-02-27 at 14:46 +0200, Andy Shevchenko wrote:
> >  On Tue, Feb 27, 2024 at 3:33 AM Zhi Mao <zhi.mao@...iatek.com>
> > wrote:

..

> > > +#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.

That's bad. You should read again what the IWYU principle means.

> If we add these header files which mentioned above, I am afraid it will
> cause "repeated inclusion header file" issue.

How would it be possible? Are some headers broken?

> As this driver code can be compiled pass, so there is not miss any
> header files.

There are _a lot_ of missing headers. Your compilation works by luck.

> Another, I also reviewed some other sensor driver code(such as
> gc0a08/gc2145 and imx/ov), they are all the same.

They are also problematic. So what?

> Can we keep this coding style and follow with most of those
> image sensor driver?

Why? We do NOT want to continue developers to avoid decreasing their
technical debts.

..

> > > +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?

It depends on what type of sleep you want to provide. There are
different types of DEFINE_*() macros in the PM headers.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ