public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Zhi Mao (毛智)" <zhi.mao@mediatek.com>
To: "andy.shevchenko@gmail.com" <andy.shevchenko@gmail.com>
Cc: "heiko@sntech.de" <heiko@sntech.de>,
	"tomi.valkeinen@ideasonboard.com"
	<tomi.valkeinen@ideasonboard.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"yunkec@chromium.org" <yunkec@chromium.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dan.scally@ideasonboard.com" <dan.scally@ideasonboard.com>,
	"gerald.loacker@wolfvision.net" <gerald.loacker@wolfvision.net>,
	"Shengnan Wang (王圣男)" <shengnan.wang@mediatek.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Yaya Chang (張雅清)" <Yaya.Chang@mediatek.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"jacopo.mondi@ideasonboard.com" <jacopo.mondi@ideasonboard.com>,
	"jernej.skrabec@gmail.com" <jernej.skrabec@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"bingbu.cao@intel.com" <bingbu.cao@intel.com>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"10572168@qq.com" <10572168@qq.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"macromorgan@hotmail.com" <macromorgan@hotmail.com>
Subject: Re: [PATCH v6 2/2] media: i2c: Add GC08A3 image sensor driver
Date: Sun, 3 Mar 2024 02:46:33 +0000	[thread overview]
Message-ID: <2c8ae94c1477a933ca78ac7b0f2c92f66ed029f7.camel@mediatek.com> (raw)
In-Reply-To: <CAHp75VciCJuoOwC8ozanWYqSCM=vWpiaqymJ2-gQfrSt5Ts6fQ@mail.gmail.com>

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.
> 
> ...
> 
> > +/*
> > + * gc08a3.c - gc08a3 sensor driver
> 
> Drop the filename from the file, it's impractical (esp. if the file
> will be renamed for some reason in the future).
> 
fixed in patch:v7.

> > + *
> > + * Copyright 2023 MediaTek
> > + *
> > + * Zhi Mao <zhi.mao@mediatek.com>
> > + */
> 
> ...
> 
> > +#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.
> 
fixed in patch:v7.

> ...
> 
> > +       /*update crop info to subdev state*/
> 
> Missing spaces.
> 
fixed in patch:v7.

> ...
> 
> > +       /*update fmt info to subdev state*/
> 
> Ditto.
> 
fixed in patch:v7.

> ...
> 
> > +static int gc08a3_test_pattern(struct gc08a3 *gc08a3, u32
> pattern_menu)
> > +{
> > +       u32 pattern = 0;
> 
> No, please use the default case for this assignment.
> 
fixed in patch:v7.

> > +       int ret;
> > +
> > +       if (pattern_menu) {
> > +               switch (pattern_menu) {
> > +               case 1:
> > +                       pattern = 0x00;
> > +                       break;
> > +               case 2:
> > +                       pattern = 0x10;
> > +                       break;
> > +               case 3:
> > +               case 4:
> > +               case 5:
> > +               case 6:
> > +               case 7:
> > +                       pattern = pattern_menu + 1;
> > +                       break;
> > +               }
> > +
> > +               ret = cci_write(gc08a3->regmap,
> GC08A3_REG_TEST_PATTERN_IDX,
> > +                               pattern, NULL);
> > +               if (ret)
> > +                       return ret;
> > +
> 
> > +               ret = cci_write(gc08a3->regmap,
> GC08A3_REG_TEST_PATTERN_EN,
> > +                               GC08A3_TEST_PATTERN_EN, NULL);
> > +               if (ret)
> > +                       return ret;
> > +       } else {
> > +               ret = cci_write(gc08a3->regmap,
> GC08A3_REG_TEST_PATTERN_EN,
> > +                               0x00, NULL);
> > +               if (ret)
> > +                       return ret;
> > +       }
> > +
> > +       return 0;
> 
> 'else' is redundant, but you can deduplicate code above with
> 
>   return cci_write(...);
> } else {
>   return cci_write(...);
> }
> 
> Of course you can go even further, but I think with the above it will
> be balanced to the way that it's easy to understand how branches
> behave ('else' in this case helps to indent semantically coupled
> lines).
> 
fixed in patch:v7.

> > +}
> 
> 
> > +       /*
> > +        * Applying V4L2 control value only happens
> > +        * when power is on for streaming
> > +        */
> 
> Respect English grammar and punctuation, i.e. don't forget periods at
> the end of sentences in multi-line comments.
> 
fixed in patch:v7.

> ...
> 
> > +       endpoint =
> > +               fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0,
> 0,
> >
> +                                               FWNODE_GRAPH_ENDPOINT
> _NEXT);
> > +       if (!endpoint) {
> 
> Strictly speaking dev_fwnode(dev) might be NULL or an error pointer.
> I
> dunno how the graph is implemented there and if it's possible to get
> an error pointer out of it. At least this probably needs to be
> aligned
> there at some point.
> 
Mr.Sakari has explained this comments.
"This is fine---the fwnode API returns errors (for functions that can)
for NULL or error pointer fwnodes."

> > +               dev_err(dev, "endpoint node not found\n");
> > +               return -EINVAL;
> > +       }
> 
> ...
> 
> > +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.
> 
fixed in patch:v7.

> ...
> 
> > +
> 
> Redundant blank line.
> 
fixed in patch:v7.

> > +module_i2c_driver(gc08a3_i2c_driver);
> 
> -- 
> With Best Regards,
> Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2024-03-03  2:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  1:32 [PATCH v6 0/2] media: i2c: Add support for GC08A3 sensor Zhi Mao
2024-02-27  1:32 ` [PATCH v6 1/2] media: dt-bindings: i2c: add GalaxyCore GC08A3 image sensor Zhi Mao
2024-02-27  1:32 ` [PATCH v6 2/2] media: i2c: Add GC08A3 image sensor driver Zhi Mao
2024-02-27 12:46   ` Andy Shevchenko
2024-02-27 13:26     ` Sakari Ailus
2024-02-28  3:19     ` Zhi Mao (毛智)
2024-02-28  9:22       ` Andy Shevchenko
2024-02-28 12:02         ` sakari.ailus
2024-02-28 17:17           ` Andy Shevchenko
     [not found]             ` <170914163823.252503.15921889437591940623@ping.linuxembedded.co.uk>
2024-02-28 18:06               ` Andy Shevchenko
2024-03-03  2:46     ` Zhi Mao (毛智) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c8ae94c1477a933ca78ac7b0f2c92f66ed029f7.camel@mediatek.com \
    --to=zhi.mao@mediatek.com \
    --cc=10572168@qq.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=Yaya.Chang@mediatek.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bingbu.cao@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gerald.loacker@wolfvision.net \
    --cc=hdegoede@redhat.com \
    --cc=heiko@sntech.de \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=macromorgan@hotmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shengnan.wang@mediatek.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=yunkec@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox