All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
To: "johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "milo.kim-l0cyMroinI0@public.gmane.org"
	<milo.kim-l0cyMroinI0@public.gmane.org>,
	"tomislav.denis-jb26L5wWkzc@public.gmane.org"
	<tomislav.denis-jb26L5wWkzc@public.gmane.org>,
	"dan-d1oNz5vA2fxXqviUI+FSNg@public.gmane.org"
	<dan-d1oNz5vA2fxXqviUI+FSNg@public.gmane.org>,
	"heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org"
	<heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	"linux-aspeed-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<linux-aspeed-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	"linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"eajames-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org"
	<eajames-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	"platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org"
	<paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org>,
	"lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"fabrice.gasnier-qxv4g6HH51o@public.gmane.org"
	<fabrice.gasnier-qxv4g6HH51o@public.gmane.org>,
	"srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
	<srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8@public.gmane.org"
	<linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8@public.gmane.org>,
	"devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org"
	<devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org>,
	linux-samsung-soc@vger
Subject: Re: [PATCH 4/5] iio: light: lm3533-als: remove explicit parent assignment
Date: Fri, 29 May 2020 11:08:38 +0000	[thread overview]
Message-ID: <05500c815f4881a6aa86c809c5ac53e8af3f3e91.camel@analog.com> (raw)
In-Reply-To: <20200529101608.GC19480@localhost>

On Fri, 2020-05-29 at 12:16 +0200, Johan Hovold wrote:
> [External]
> 
> On Fri, May 22, 2020 at 11:22:07AM +0300, Alexandru Ardelean wrote:
> > This assignment is the more peculiar of the bunch as it assigns the parent
> > of the platform-device's device (i.e. pdev->dev.parent) as the IIO device's
> > parent.
> > 
> > It's unclear whether this is intentional or not.
> > Hence it is in it's own patch.
> 
> Yeah, we have a few mfd drivers whose child drivers registers their
> class devices directly under the parent mfd device rather than the
> corresponding child platform device.
> 
> Since it's done consistently I think you need to update them all if you
> really want to change this. 
> 
> And it may not be worth it since at least in theory someone could now be
> relying on this topology.

Thanks for the feedback.
I guess, it could make sense to do here:
      devm_iio_device_alloc(pdev->dev.parent, ...)

Currently it's:
      devm_iio_device_alloc(&pdev->dev, ...)

That would make it slightly more consistent.
i.e. the life-time of the object would be attached to the parent of the platform
device, versus the platform-device.

Currently, as it is, the allocation [of the IIO device] is tied the platform-
device, and the IIO registration to the parent (of the platform-device).
I'm not super-familiar with the internals here, but does this sound a bit wrong?
Is there a chance where the IIO device could be de-allocated, while registered?


> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/iio/light/lm3533-als.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> > index bc196c212881..0f380ec8d30c 100644
> > --- a/drivers/iio/light/lm3533-als.c
> > +++ b/drivers/iio/light/lm3533-als.c
> > @@ -852,7 +852,6 @@ static int lm3533_als_probe(struct platform_device
> > *pdev)
> >  	indio_dev->channels = lm3533_als_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
> >  	indio_dev->name = dev_name(&pdev->dev);
> > -	indio_dev->dev.parent = pdev->dev.parent;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> >  	als = iio_priv(indio_dev);
> 
> Johan

WARNING: multiple messages have this Message-ID (diff)
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "johan@kernel.org" <johan@kernel.org>
Cc: "milo.kim@ti.com" <milo.kim@ti.com>,
	"tomislav.denis@avl.com" <tomislav.denis@avl.com>,
	"dan@dlrobertson.com" <dan@dlrobertson.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"eajames@linux.ibm.com" <eajames@linux.ibm.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"paul@crapouillou.net" <paul@crapouillou.net>,
	"lorenzo.bianconi83@gmail.com" <lorenzo.bianconi83@gmail.com>,
	"fabrice.gasnier@st.com" <fabrice.gasnier@st.com>,
	"srinivas.pandruvada@linux.intel.com"
	<srinivas.pandruvada@linux.intel.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"zhang.lyra@gmail.com" <zhang.lyra@gmail.com>,
	"tduszyns@gmail.com" <tduszyns@gmail.com>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"linux-rockchip@lists.infradead.org"
	<linux-rockchip@lists.infradead.org>,
	"wens@csie.org" <wens@csie.org>,
	"kgene@kernel.org" <kgene@kernel.org>,
	"bcm-kernel-feedback-list@broadcom.com"
	<bcm-kernel-feedback-list@broadcom.com>,
	"agross@kernel.org" <agross@kernel.org>,
	"slemieux.tyco@gmail.com" <slemieux.tyco@gmail.com>,
	"orsonzhai@gmail.com" <orsonzhai@gmail.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"alexandre.torgue@st.com" <alexandre.torgue@st.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"rjui@broadcom.com" <rjui@broadcom.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"jikos@kernel.org" <jikos@kernel.org>,
	"vilhelm.gray@gmail.com" <vilhelm.gray@gmail.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"vz@mleia.com" <vz@mleia.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"ak@it-klinger.de" <ak@it-klinger.de>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-amlogic@lists.infradead.org"
	<linux-amlogic@lists.infradead.org>,
	"coproscefalo@gmail.com" <coproscefalo@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"sbranden@broadcom.com" <sbranden@broadcom.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"syednwaris@gmail.com" <syednwaris@gmail.com>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"songqiang1304521@gmail.com" <songqiang1304521@gmail.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"khilman@baylibre.com" <khilman@baylibre.com>,
	"baolin.wang7@gmail.com" <baolin.wang7@gmail.com>,
	"ktsai@capellamicro.com" <ktsai@capellamicro.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"peda@axentia.se" <peda@axentia.se>,
	"jic23@kernel.org" <jic23@kernel.org>
Subject: Re: [PATCH 4/5] iio: light: lm3533-als: remove explicit parent assignment
Date: Fri, 29 May 2020 11:08:38 +0000	[thread overview]
Message-ID: <05500c815f4881a6aa86c809c5ac53e8af3f3e91.camel@analog.com> (raw)
In-Reply-To: <20200529101608.GC19480@localhost>

On Fri, 2020-05-29 at 12:16 +0200, Johan Hovold wrote:
> [External]
> 
> On Fri, May 22, 2020 at 11:22:07AM +0300, Alexandru Ardelean wrote:
> > This assignment is the more peculiar of the bunch as it assigns the parent
> > of the platform-device's device (i.e. pdev->dev.parent) as the IIO device's
> > parent.
> > 
> > It's unclear whether this is intentional or not.
> > Hence it is in it's own patch.
> 
> Yeah, we have a few mfd drivers whose child drivers registers their
> class devices directly under the parent mfd device rather than the
> corresponding child platform device.
> 
> Since it's done consistently I think you need to update them all if you
> really want to change this. 
> 
> And it may not be worth it since at least in theory someone could now be
> relying on this topology.

Thanks for the feedback.
I guess, it could make sense to do here:
      devm_iio_device_alloc(pdev->dev.parent, ...)

Currently it's:
      devm_iio_device_alloc(&pdev->dev, ...)

That would make it slightly more consistent.
i.e. the life-time of the object would be attached to the parent of the platform
device, versus the platform-device.

Currently, as it is, the allocation [of the IIO device] is tied the platform-
device, and the IIO registration to the parent (of the platform-device).
I'm not super-familiar with the internals here, but does this sound a bit wrong?
Is there a chance where the IIO device could be de-allocated, while registered?


> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/light/lm3533-als.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> > index bc196c212881..0f380ec8d30c 100644
> > --- a/drivers/iio/light/lm3533-als.c
> > +++ b/drivers/iio/light/lm3533-als.c
> > @@ -852,7 +852,6 @@ static int lm3533_als_probe(struct platform_device
> > *pdev)
> >  	indio_dev->channels = lm3533_als_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
> >  	indio_dev->name = dev_name(&pdev->dev);
> > -	indio_dev->dev.parent = pdev->dev.parent;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> >  	als = iio_priv(indio_dev);
> 
> Johan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "johan@kernel.org" <johan@kernel.org>
Cc: "milo.kim@ti.com" <milo.kim@ti.com>,
	"tomislav.denis@avl.com" <tomislav.denis@avl.com>,
	"dan@dlrobertson.com" <dan@dlrobertson.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"eajames@linux.ibm.com" <eajames@linux.ibm.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"paul@crapouillou.net" <paul@crapouillou.net>,
	"lorenzo.bianconi83@gmail.com" <lorenzo.bianconi83@gmail.com>,
	"fabrice.gasnier@st.com" <fabrice.gasnier@st.com>,
	"srinivas.pandruvada@linux.intel.com"
	<srinivas.pandruvada@linux.intel.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"zhang.lyra@gmail.com" <zhang.lyra@gmail.com>,
	"tduszyns@gmail.com" <tduszyns@gmail.com>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"linux-rockchip@lists.infradead.org"
	<linux-rockchip@lists.infradead.org>,
	"wens@csie.org" <wens@csie.org>,
	"kgene@kernel.org" <kgene@kernel.org>,
	"bcm-kernel-feedback-list@broadcom.com"
	<bcm-kernel-feedback-list@broadcom.com>,
	"agross@kernel.org" <agross@kernel.org>,
	"slemieux.tyco@gmail.com" <slemieux.tyco@gmail.com>,
	"orsonzhai@gmail.com" <orsonzhai@gmail.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"alexandre.torgue@st.com" <alexandre.torgue@st.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"rjui@broadcom.com" <rjui@broadcom.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"jikos@kernel.org" <jikos@kernel.org>,
	"vilhelm.gray@gmail.com" <vilhelm.gray@gmail.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"vz@mleia.com" <vz@mleia.com>,
	"rmfrfs@gmail.com" <rmfrfs@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"ak@it-klinger.de" <ak@it-klinger.de>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-amlogic@lists.infradead.org"
	<linux-amlogic@lists.infradead.org>,
	"coproscefalo@gmail.com" <coproscefalo@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"sbranden@broadcom.com" <sbranden@broadcom.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"syednwaris@gmail.com" <syednwaris@gmail.com>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"songqiang1304521@gmail.com" <songqiang1304521@gmail.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"khilman@baylibre.com" <khilman@baylibre.com>,
	"baolin.wang7@gmail.com" <baolin.wang7@gmail.com>,
	"ktsai@capellamicro.com" <ktsai@capellamicro.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"peda@axentia.se" <peda@axentia.se>,
	"jic23@kernel.org" <jic23@kernel.org>
Subject: Re: [PATCH 4/5] iio: light: lm3533-als: remove explicit parent assignment
Date: Fri, 29 May 2020 11:08:38 +0000	[thread overview]
Message-ID: <05500c815f4881a6aa86c809c5ac53e8af3f3e91.camel@analog.com> (raw)
In-Reply-To: <20200529101608.GC19480@localhost>

On Fri, 2020-05-29 at 12:16 +0200, Johan Hovold wrote:
> [External]
> 
> On Fri, May 22, 2020 at 11:22:07AM +0300, Alexandru Ardelean wrote:
> > This assignment is the more peculiar of the bunch as it assigns the parent
> > of the platform-device's device (i.e. pdev->dev.parent) as the IIO device's
> > parent.
> > 
> > It's unclear whether this is intentional or not.
> > Hence it is in it's own patch.
> 
> Yeah, we have a few mfd drivers whose child drivers registers their
> class devices directly under the parent mfd device rather than the
> corresponding child platform device.
> 
> Since it's done consistently I think you need to update them all if you
> really want to change this. 
> 
> And it may not be worth it since at least in theory someone could now be
> relying on this topology.

Thanks for the feedback.
I guess, it could make sense to do here:
      devm_iio_device_alloc(pdev->dev.parent, ...)

Currently it's:
      devm_iio_device_alloc(&pdev->dev, ...)

That would make it slightly more consistent.
i.e. the life-time of the object would be attached to the parent of the platform
device, versus the platform-device.

Currently, as it is, the allocation [of the IIO device] is tied the platform-
device, and the IIO registration to the parent (of the platform-device).
I'm not super-familiar with the internals here, but does this sound a bit wrong?
Is there a chance where the IIO device could be de-allocated, while registered?


> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/light/lm3533-als.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> > index bc196c212881..0f380ec8d30c 100644
> > --- a/drivers/iio/light/lm3533-als.c
> > +++ b/drivers/iio/light/lm3533-als.c
> > @@ -852,7 +852,6 @@ static int lm3533_als_probe(struct platform_device
> > *pdev)
> >  	indio_dev->channels = lm3533_als_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
> >  	indio_dev->name = dev_name(&pdev->dev);
> > -	indio_dev->dev.parent = pdev->dev.parent;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> >  	als = iio_priv(indio_dev);
> 
> Johan
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "johan@kernel.org" <johan@kernel.org>
Cc: "milo.kim@ti.com" <milo.kim@ti.com>,
	"tomislav.denis@avl.com" <tomislav.denis@avl.com>,
	"dan@dlrobertson.com" <dan@dlrobertson.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"eajames@linux.ibm.com" <eajames@linux.ibm.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"paul@crapouillou.net" <paul@crapouillou.net>,
	"lorenzo.bianconi83@gmail.com" <lorenzo.bianconi83@gmail.com>,
	"fabrice.gasnier@st.com" <fabrice.gasnier@st.com>,
	"srinivas.pandruvada@linux.intel.com"
	<srinivas.pandruvada@linux.intel.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"zhang.lyra@gmail.com" <zhang.lyra@gmail.com>,
	"tduszyns@gmail.com" <tduszyns@gmail.com>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"linux-rockchip@lists.infradead.org"
	<linux-rockchip@lists.infradead.org>,
	"wens@csie.org" <wens@csie.org>,
	"kgene@kernel.org" <kgene@kernel.org>,
	"bcm-kernel-feedback-list@broadcom.com"
	<bcm-kernel-feedback-list@broadcom.com>,
	"agross@kernel.org" <agross@kernel.org>,
	"slemieux.tyco@gmail.com" <slemieux.tyco@gmail.com>,
	"orsonzhai@gmail.com" <orsonzhai@gmail.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"alexandre.torgue@st.com" <alexandre.torgue@st.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"rjui@broadcom.com" <rjui@broadcom.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"jikos@kernel.org" <jikos@kernel.org>,
	"vilhelm.gray@gmail.com" <vilhelm.gray@gmail.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"vz@mleia.com" <vz@mleia.com>,
	"rmfrfs@gmail.com" <rmfrfs@gmail.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"ak@it-klinger.de" <ak@it-klinger.de>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"linux-amlogic@lists.infradead.org"
	<linux-amlogic@lists.infradead.org>,
	"coproscefalo@gmail.com" <coproscefalo@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"sbranden@broadcom.com" <sbranden@broadcom.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"syednwaris@gmail.com" <syednwaris@gmail.com>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"songqiang1304521@gmail.com" <songqiang1304521@gmail.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"mcoquelin.stm32@gmail.com" <mcoquelin.stm32@gmail.com>,
	"khilman@baylibre.com" <khilman@baylibre.com>,
	"baolin.wang7@gmail.com" <baolin.wang7@gmail.com>,
	"ktsai@capellamicro.com" <ktsai@capellamicro.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"peda@axentia.se" <peda@axentia.se>,
	"jic23@kernel.org" <jic23@kernel.org>
Subject: Re: [PATCH 4/5] iio: light: lm3533-als: remove explicit parent assignment
Date: Fri, 29 May 2020 11:08:38 +0000	[thread overview]
Message-ID: <05500c815f4881a6aa86c809c5ac53e8af3f3e91.camel@analog.com> (raw)
In-Reply-To: <20200529101608.GC19480@localhost>

On Fri, 2020-05-29 at 12:16 +0200, Johan Hovold wrote:
> [External]
> 
> On Fri, May 22, 2020 at 11:22:07AM +0300, Alexandru Ardelean wrote:
> > This assignment is the more peculiar of the bunch as it assigns the parent
> > of the platform-device's device (i.e. pdev->dev.parent) as the IIO device's
> > parent.
> > 
> > It's unclear whether this is intentional or not.
> > Hence it is in it's own patch.
> 
> Yeah, we have a few mfd drivers whose child drivers registers their
> class devices directly under the parent mfd device rather than the
> corresponding child platform device.
> 
> Since it's done consistently I think you need to update them all if you
> really want to change this. 
> 
> And it may not be worth it since at least in theory someone could now be
> relying on this topology.

Thanks for the feedback.
I guess, it could make sense to do here:
      devm_iio_device_alloc(pdev->dev.parent, ...)

Currently it's:
      devm_iio_device_alloc(&pdev->dev, ...)

That would make it slightly more consistent.
i.e. the life-time of the object would be attached to the parent of the platform
device, versus the platform-device.

Currently, as it is, the allocation [of the IIO device] is tied the platform-
device, and the IIO registration to the parent (of the platform-device).
I'm not super-familiar with the internals here, but does this sound a bit wrong?
Is there a chance where the IIO device could be de-allocated, while registered?


> 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/light/lm3533-als.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
> > index bc196c212881..0f380ec8d30c 100644
> > --- a/drivers/iio/light/lm3533-als.c
> > +++ b/drivers/iio/light/lm3533-als.c
> > @@ -852,7 +852,6 @@ static int lm3533_als_probe(struct platform_device
> > *pdev)
> >  	indio_dev->channels = lm3533_als_channels;
> >  	indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
> >  	indio_dev->name = dev_name(&pdev->dev);
> > -	indio_dev->dev.parent = pdev->dev.parent;
> >  	indio_dev->modes = INDIO_DIRECT_MODE;
> >  
> >  	als = iio_priv(indio_dev);
> 
> Johan
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2020-05-29 11:08 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  8:22 [PATCH 1/5] iio: core: pass parent device as parameter during allocation Alexandru Ardelean
2020-05-22  8:22 ` Alexandru Ardelean
2020-05-22  8:22 ` Alexandru Ardelean
2020-05-22  8:22 ` Alexandru Ardelean
2020-05-22  8:22 ` Alexandru Ardelean
2020-05-22  8:22 ` [PATCH 2/5] iio: remove explicit IIO device parent assignment Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22 ` [PATCH 3/5] iio: remove left-over comments about " Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22 ` [PATCH 4/5] iio: light: lm3533-als: remove explicit " Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-29 10:16   ` Johan Hovold
2020-05-29 10:16     ` Johan Hovold
2020-05-29 10:16     ` Johan Hovold
2020-05-29 10:16     ` Johan Hovold
2020-05-29 10:16     ` Johan Hovold
2020-05-29 11:08     ` Ardelean, Alexandru [this message]
2020-05-29 11:08       ` Ardelean, Alexandru
2020-05-29 11:08       ` Ardelean, Alexandru
2020-05-29 11:08       ` Ardelean, Alexandru
2020-05-29 13:45       ` Johan Hovold
2020-05-31 14:54         ` Jonathan Cameron
2020-06-02 14:32           ` Ardelean, Alexandru
2020-05-22  8:22 ` [PATCH 5/5] iio: remove left-over parent assignments Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
2020-05-22  8:22   ` Alexandru Ardelean
     [not found]   ` <20200522082208.383631-5-alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
2020-05-22  8:53     ` Andy Shevchenko
2020-05-22  8:53       ` Andy Shevchenko
2020-05-22  8:53       ` Andy Shevchenko
2020-05-22  8:53       ` Andy Shevchenko
     [not found] ` <20200522082208.383631-1-alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
2020-05-22  8:56   ` [PATCH 1/5] iio: core: pass parent device as parameter during allocation Andy Shevchenko
2020-05-22  8:56     ` Andy Shevchenko
2020-05-22  8:56     ` Andy Shevchenko
2020-05-22  8:56     ` Andy Shevchenko
     [not found]     ` <CAHp75VfqxJxa1Uk3h4vfzQOdZDRr8Lqvt3Z5vzpp5NAw=u_ZPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-05-24 14:12       ` Jonathan Cameron
2020-05-24 14:12         ` Jonathan Cameron
2020-05-24 14:12         ` Jonathan Cameron
2020-05-24 14:12         ` Jonathan Cameron

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=05500c815f4881a6aa86c809c5ac53e8af3f3e91.camel@analog.com \
    --to=alexandru.ardelean-oylxuock7orqt0dzr+alfa@public.gmane.org \
    --cc=dan-d1oNz5vA2fxXqviUI+FSNg@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=eajames-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=fabrice.gasnier-qxv4g6HH51o@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-aspeed-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-samsung-soc@vger \
    --cc=linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8@public.gmane.org \
    --cc=lorenzo.bianconi83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=milo.kim-l0cyMroinI0@public.gmane.org \
    --cc=paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org \
    --cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=tomislav.denis-jb26L5wWkzc@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.