2022-06-16 07:34:07

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect provider

From: Peng Fan <[email protected]>

The provider device is created using platform_device_register_data in
imx-bus driver, which not has of_node. With of_node set, it will be
easy to support QoS settings.

Signed-off-by: Peng Fan <[email protected]>
---
drivers/interconnect/imx/imx.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c
index 1f16eedea21c..78557fe6da2c 100644
--- a/drivers/interconnect/imx/imx.c
+++ b/drivers/interconnect/imx/imx.c
@@ -264,6 +264,7 @@ int imx_icc_register(struct platform_device *pdev,
provider->xlate = of_icc_xlate_onecell;
provider->data = data;
provider->dev = dev->parent;
+ provider->dev->of_node = dev->parent->of_node;
platform_set_drvdata(pdev, imx_provider);

ret = icc_provider_add(provider);
--
2.25.1


2022-06-29 15:35:40

by Lucas Stach

[permalink] [raw]
Subject: Re: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect provider

Am Donnerstag, dem 16.06.2022 um 15:33 +0800 schrieb Peng Fan (OSS):
> From: Peng Fan <[email protected]>
>
> The provider device is created using platform_device_register_data in
> imx-bus driver, which not has of_node. With of_node set, it will be
> easy to support QoS settings.
>
That's a bit dangerous, as sharing a of_node between two devices can
lead to some reference counting issues IIRC, but then I also don't see
a good way to do this any differently.

Regards,
Lucas

> Signed-off-by: Peng Fan <[email protected]>
> ---
> drivers/interconnect/imx/imx.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c
> index 1f16eedea21c..78557fe6da2c 100644
> --- a/drivers/interconnect/imx/imx.c
> +++ b/drivers/interconnect/imx/imx.c
> @@ -264,6 +264,7 @@ int imx_icc_register(struct platform_device *pdev,
> provider->xlate = of_icc_xlate_onecell;
> provider->data = data;
> provider->dev = dev->parent;
> + provider->dev->of_node = dev->parent->of_node;
> platform_set_drvdata(pdev, imx_provider);
>
> ret = icc_provider_add(provider);


2022-06-29 18:03:35

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect provider

On Wed, Jun 29, 2022 at 05:08:58PM +0200, Lucas Stach wrote:
> Am Donnerstag, dem 16.06.2022 um 15:33 +0800 schrieb Peng Fan (OSS):
> > From: Peng Fan <[email protected]>
> >
> > The provider device is created using platform_device_register_data in
> > imx-bus driver, which not has of_node. With of_node set, it will be
> > easy to support QoS settings.
> >
> That's a bit dangerous, as sharing a of_node between two devices can
> lead to some reference counting issues IIRC, but then I also don't see
> a good way to do this any differently.
>
> Regards,
> Lucas
>
> > Signed-off-by: Peng Fan <[email protected]>
> > ---
> > drivers/interconnect/imx/imx.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c
> > index 1f16eedea21c..78557fe6da2c 100644
> > --- a/drivers/interconnect/imx/imx.c
> > +++ b/drivers/interconnect/imx/imx.c
> > @@ -264,6 +264,7 @@ int imx_icc_register(struct platform_device *pdev,
> > provider->xlate = of_icc_xlate_onecell;
> > provider->data = data;
> > provider->dev = dev->parent;
> > + provider->dev->of_node = dev->parent->of_node;

Due to the previous line, provider->dev is equal to dev->parent, so
doesn't this essentially do

dev->parent->of_node = dev->parent->of_node;

which is a no-op ?

> > platform_set_drvdata(pdev, imx_provider);
> >
> > ret = icc_provider_add(provider);

--
Regards,

Laurent Pinchart

2022-07-02 12:54:05

by Peng Fan

[permalink] [raw]
Subject: RE: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect provider

> Subject: Re: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect
> provider
>
> Am Donnerstag, dem 16.06.2022 um 15:33 +0800 schrieb Peng Fan (OSS):
> > From: Peng Fan <[email protected]>
> >
> > The provider device is created using platform_device_register_data in
> > imx-bus driver, which not has of_node. With of_node set, it will be
> > easy to support QoS settings.
> >
> That's a bit dangerous, as sharing a of_node between two devices can lead
> to some reference counting issues IIRC, but then I also don't see a good way
> to do this any differently.

I just recalled there is a similar usage in usb code, I not remember the exact
file.

I thought not to let imx-bus.c to register the device, but I wanna to do all
these stuff step by step. The next step is to pick Abel's
https://lore.kernel.org/linux-arm-kernel/20220106164150.3474048-1-
[email protected]/

Abel told me he was trying to decouple imx-bus with icc.

Thanks,
Peng.


>
> Regards,
> Lucas
>
> > Signed-off-by: Peng Fan <[email protected]>
> > ---
> > drivers/interconnect/imx/imx.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/interconnect/imx/imx.c
> > b/drivers/interconnect/imx/imx.c index 1f16eedea21c..78557fe6da2c
> > 100644
> > --- a/drivers/interconnect/imx/imx.c
> > +++ b/drivers/interconnect/imx/imx.c
> > @@ -264,6 +264,7 @@ int imx_icc_register(struct platform_device *pdev,
> > provider->xlate = of_icc_xlate_onecell;
> > provider->data = data;
> > provider->dev = dev->parent;
> > + provider->dev->of_node = dev->parent->of_node;
> > platform_set_drvdata(pdev, imx_provider);
> >
> > ret = icc_provider_add(provider);
>

2022-07-03 08:47:25

by Peng Fan (OSS)

[permalink] [raw]
Subject: Re: [PATCH V2 7/9] interconnect: imx: set of_node for interconnect provider



在 2022/6/30 1:32, Laurent Pinchart 写道:
> On Wed, Jun 29, 2022 at 05:08:58PM +0200, Lucas Stach wrote:
>> Am Donnerstag, dem 16.06.2022 um 15:33 +0800 schrieb Peng Fan (OSS):
>>> From: Peng Fan <[email protected]>
>>>
>>> The provider device is created using platform_device_register_data in
>>> imx-bus driver, which not has of_node. With of_node set, it will be
>>> easy to support QoS settings.
>>>
>> That's a bit dangerous, as sharing a of_node between two devices can
>> lead to some reference counting issues IIRC, but then I also don't see
>> a good way to do this any differently.
>>
>> Regards,
>> Lucas
>>
>>> Signed-off-by: Peng Fan <[email protected]>
>>> ---
>>> drivers/interconnect/imx/imx.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c
>>> index 1f16eedea21c..78557fe6da2c 100644
>>> --- a/drivers/interconnect/imx/imx.c
>>> +++ b/drivers/interconnect/imx/imx.c
>>> @@ -264,6 +264,7 @@ int imx_icc_register(struct platform_device *pdev,
>>> provider->xlate = of_icc_xlate_onecell;
>>> provider->data = data;
>>> provider->dev = dev->parent;
>>> + provider->dev->of_node = dev->parent->of_node;
> Due to the previous line, provider->dev is equal to dev->parent, so
> doesn't this essentially do
>
> dev->parent->of_node = dev->parent->of_node;
>
> which is a no-op ?

hmm. Indeed, I just not able to recall the issue I met before. I'll drop
this patch in V3.

Thanks,
Peng.

>
>>> platform_set_drvdata(pdev, imx_provider);
>>>
>>> ret = icc_provider_add(provider);