devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Tomasz Figa <tfiga@chromium.org>
Cc: "Dongchun Zhu" <dongchun.zhu@mediatek.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Nicolas Boichat" <drinkcat@chromium.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Bingbu Cao" <bingbu.cao@intel.com>,
	srv_heupstream <srv_heupstream@mediatek.com>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>,
	"Sj Huang" <sj.huang@mediatek.com>,
	"Linux Media Mailing List" <linux-media@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	"Louis Kuo" <louis.kuo@mediatek.com>,
	"Shengnan Wang (王圣男)" <shengnan.wang@mediatek.com>,
	matrix.zhu@aliyun.com
Subject: Re: [PATCH v14 2/2] media: i2c: Add OV02A10 image sensor driver
Date: Mon, 7 Sep 2020 16:51:03 +0300	[thread overview]
Message-ID: <20200907135103.GI1891694@smile.fi.intel.com> (raw)
In-Reply-To: <CAAFQd5BH4NZrhg=abqc=P9Uzf+t4Davn4SP9i3QktS4Q05WtzA@mail.gmail.com>

On Mon, Sep 07, 2020 at 03:15:17PM +0200, Tomasz Figa wrote:
> On Fri, Sep 4, 2020 at 4:06 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Fri, Sep 4, 2020 at 4:48 PM Dongchun Zhu <dongchun.zhu@mediatek.com> wrote:
> > > On Wed, 2020-09-02 at 16:44 +0300, Andy Shevchenko wrote:
> > > > On Wed, Sep 02, 2020 at 08:01:22PM +0800, Dongchun Zhu wrote:

...

> > > > > +   struct i2c_client *client = to_i2c_client(dev);
> > > > > +   struct v4l2_subdev *sd = i2c_get_clientdata(client);
> > > >
> > > >       struct v4l2_subdev *sd = dev_get_drvdata(dev);
> > > >
> > > > Same for the rest similar cases.
> > >
> > > We've discussed the issue in DW9768 V2.
> > >
> > > For V4L2 sub-device drivers, dev_get_drvdata() shouldn't be used
> > > directly.
> > >
> > > More details please check the Google Issue:
> > > https://partnerissuetracker.corp.google.com/issues/147957975
> >
> > This is not a public link. Can you remind me what was the issue?
> >
> 
> v4l2-subdev framework uses dev drvdata for its own purposes. However,
> that problem was about the driver setting its own drvdata and having
> it overridden by the framework. There is nothing wrong in using
> dev_get_drvdata(), assuming the correct type is known and here it's
> guaranteed to be v4l2_subdev for the v4l2-subdev framework.
> 
> In fact i2c_get_clientdata() [1] is just a wrapper that calls
> dev_get_drvdata(&client->dev).

And funny future would be that if we don't do this now we will have plenty of
janitors to DoS attack us with the fix in the future.

> [1] https://elixir.bootlin.com/linux/v5.9-rc3/source/include/linux/i2c.h#L351

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2020-09-07 13:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 12:01 [PATCH v14 0/2] media: i2c: Add support for OV02A10 sensor Dongchun Zhu
2020-09-02 12:01 ` [PATCH v14 1/2] media: dt-bindings: media: i2c: Document OV02A10 bindings Dongchun Zhu
2020-09-03 16:13   ` Rob Herring
2020-09-04  3:24     ` Dongchun Zhu
2020-09-02 12:01 ` [PATCH v14 2/2] media: i2c: Add OV02A10 image sensor driver Dongchun Zhu
2020-09-02 13:44   ` Andy Shevchenko
2020-09-02 13:51     ` Andy Shevchenko
2020-09-04 13:32       ` Dongchun Zhu
2020-09-04 13:55         ` Andy Shevchenko
2020-09-08  9:46           ` Sakari Ailus
2020-09-04 13:22     ` Dongchun Zhu
2020-09-04 14:05       ` Andy Shevchenko
2020-09-07 13:15         ` Tomasz Figa
2020-09-07 13:51           ` Andy Shevchenko [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=20200907135103.GI1891694@smile.fi.intel.com \
    --to=andy.shevchenko@gmail.com \
    --cc=bingbu.cao@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dongchun.zhu@mediatek.com \
    --cc=drinkcat@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=louis.kuo@mediatek.com \
    --cc=mark.rutland@arm.com \
    --cc=matrix.zhu@aliyun.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=sj.huang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@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;
as well as URLs for NNTP newsgroup(s).