mbox series

[00/12] i2c: Adding support for software nodes

Message ID 20210329105047.51033-1-heikki.krogerus@linux.intel.com
Headers show
Series i2c: Adding support for software nodes | expand

Message

Heikki Krogerus March 29, 2021, 10:50 a.m. UTC
Hi,

The old device property API (device_add_properties()) is going to be
removed. These prepare the i2c subsystem and drivers for the change.
The change is fairly trivial in case of i2c. All we need to do is add
complete software nodes to the devices instead of only the device
properties in those nodes.

thanks,

Heikki Krogerus (12):
  i2c: Add support for software nodes
  ARM: davinci: Constify the software nodes
  ARM: omap1: osk: Constify the software node
  ARM: pxa: stargate2: Constify the software node
  ARM: s3c: mini2440: Constify the software node
  platform/x86: intel_cht_int33fe_microb: Constify the software node
  i2c: cht-wc: Constify the software node
  i2c: nvidia-gpu: Constify the software node
  i2c: icy: Constify the software node
  platform/chrome: chromeos_laptop - Prepare complete software nodes
  Input: elantech - Prepare a complete software node for the device
  i2c: Remove support for dangling device properties

 arch/arm/mach-davinci/board-da830-evm.c       |   6 +-
 arch/arm/mach-davinci/board-dm365-evm.c       |   6 +-
 arch/arm/mach-davinci/board-dm644x-evm.c      |   6 +-
 arch/arm/mach-davinci/board-dm646x-evm.c      |   6 +-
 arch/arm/mach-davinci/board-mityomapl138.c    |   6 +-
 arch/arm/mach-davinci/board-sffsdr.c          |   6 +-
 arch/arm/mach-omap1/board-osk.c               |   6 +-
 arch/arm/mach-pxa/stargate2.c                 |   6 +-
 arch/arm/mach-s3c/mach-mini2440.c             |   6 +-
 drivers/i2c/busses/i2c-cht-wc.c               |   6 +-
 drivers/i2c/busses/i2c-icy.c                  |  32 ++----
 drivers/i2c/busses/i2c-nvidia-gpu.c           |   6 +-
 drivers/i2c/i2c-boardinfo.c                   |  11 --
 drivers/i2c/i2c-core-base.c                   |  14 +--
 drivers/input/mouse/elantech.c                |   6 +-
 drivers/platform/chrome/chromeos_laptop.c     | 100 +++++++++++-------
 .../platform/x86/intel_cht_int33fe_microb.c   |   6 +-
 include/linux/i2c.h                           |   4 +-
 18 files changed, 142 insertions(+), 97 deletions(-)

Comments

Krzysztof Kozlowski March 29, 2021, 10:58 a.m. UTC | #1
On 29/03/2021 12:50, Heikki Krogerus wrote:
> Additional device properties are always just a part of a
> software fwnode. If the device properties are constant, the
> software node can also be constant.
> 
Hi,

Thanks for your work.

I did not get the cover letter nor other patches from this set and I
don't see how the i2c uses the swnode. This makes difficult to judge
whether this looks reasonable. At least without the context the title
looks misleading - you add software_node or change to use software_node
instead of constifying it.


Best regards,
Krzysztof
Heikki Krogerus March 29, 2021, 12:32 p.m. UTC | #2
On Mon, Mar 29, 2021 at 12:58:41PM +0200, Krzysztof Kozlowski wrote:
> On 29/03/2021 12:50, Heikki Krogerus wrote:
> > Additional device properties are always just a part of a
> > software fwnode. If the device properties are constant, the
> > software node can also be constant.
> > 
> Hi,
> 
> Thanks for your work.
> 
> I did not get the cover letter nor other patches from this set and I
> don't see how the i2c uses the swnode. This makes difficult to judge
> whether this looks reasonable. At least without the context the title
> looks misleading - you add software_node or change to use software_node
> instead of constifying it.

OK, I'll try to open this up somehow...

Whenever additional device properties are added to devices by using
the old device property API (device_add_properties()) that also i2c
core code uses, in reality a software node is always created to hold
those properties. It's just always dynamically allocated.

The goal of this series is to prepare the i2c subsystem and drivers
for the removal of that old device property API, but I did not see
that as relevant info for this patch, because even if we did not in
the end remove that old API, this change is still useful.

The patch does exactly what the subject says. After this we supply the
device a constant software node instead of a dynamically allocated one.


thanks,
Hans de Goede March 29, 2021, 3:28 p.m. UTC | #3
Hi,

On 3/29/21 12:50 PM, Heikki Krogerus wrote:
> Additional device properties are always just a part of a
> software fwnode. If the device properties are constant, the
> software node can also be constant.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Hans de Goede <hdegoede@redhat.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/i2c/busses/i2c-cht-wc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
> index f80d79e973cd2..08f491ea21ac9 100644
> --- a/drivers/i2c/busses/i2c-cht-wc.c
> +++ b/drivers/i2c/busses/i2c-cht-wc.c
> @@ -280,6 +280,10 @@ static const struct property_entry bq24190_props[] = {
>  	{ }
>  };
>  
> +static const struct software_node bq24190_node = {
> +	.properties = bq24190_props,
> +};
> +
>  static struct regulator_consumer_supply fusb302_consumer = {
>  	.supply = "vbus",
>  	/* Must match fusb302 dev_name in intel_cht_int33fe.c */
> @@ -308,7 +312,7 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
>  		.type = "bq24190",
>  		.addr = 0x6b,
>  		.dev_name = "bq24190",
> -		.properties = bq24190_props,
> +		.swnode = &bq24190_node,
>  		.platform_data = &bq24190_pdata,
>  	};
>  	int ret, reg, irq;
>
Max Staudt March 30, 2021, 1:58 p.m. UTC | #4
This looks great, thank you for constifying this.

Finally it's clean again, yet much more flexible than the original
platform_data approach when I first submitted the driver.



Thanks everyone for your work

Max
Wolfram Sang March 31, 2021, 9:22 a.m. UTC | #5
> The old device property API (device_add_properties()) is going to be

> removed. These prepare the i2c subsystem and drivers for the change.

> The change is fairly trivial in case of i2c. All we need to do is add

> complete software nodes to the devices instead of only the device

> properties in those nodes.


This looks like a nice cleanup!

Reviewed-by: Wolfram Sang <wsa@kernel.org> # for the I2C parts


Which tree should this go into? I can offer I2C but am also fine with
another one...
Heikki Krogerus March 31, 2021, 10:17 a.m. UTC | #6
On Wed, Mar 31, 2021 at 11:22:32AM +0200, Wolfram Sang wrote:
> 

> > The old device property API (device_add_properties()) is going to be

> > removed. These prepare the i2c subsystem and drivers for the change.

> > The change is fairly trivial in case of i2c. All we need to do is add

> > complete software nodes to the devices instead of only the device

> > properties in those nodes.

> 

> This looks like a nice cleanup!

> 

> Reviewed-by: Wolfram Sang <wsa@kernel.org> # for the I2C parts

> 

> Which tree should this go into? I can offer I2C but am also fine with

> another one...


I think these go via I2C tree.

thanks,

-- 
heikki
Krzysztof Kozlowski April 1, 2021, 5:44 p.m. UTC | #7
On 29/03/2021 14:32, Heikki Krogerus wrote:
> On Mon, Mar 29, 2021 at 12:58:41PM +0200, Krzysztof Kozlowski wrote:

>> On 29/03/2021 12:50, Heikki Krogerus wrote:

>>> Additional device properties are always just a part of a

>>> software fwnode. If the device properties are constant, the

>>> software node can also be constant.

>>>

>> Hi,

>>

>> Thanks for your work.

>>

>> I did not get the cover letter nor other patches from this set and I

>> don't see how the i2c uses the swnode. This makes difficult to judge

>> whether this looks reasonable. At least without the context the title

>> looks misleading - you add software_node or change to use software_node

>> instead of constifying it.

> 

> OK, I'll try to open this up somehow...

> 

> Whenever additional device properties are added to devices by using

> the old device property API (device_add_properties()) that also i2c

> core code uses, in reality a software node is always created to hold

> those properties. It's just always dynamically allocated.

> 

> The goal of this series is to prepare the i2c subsystem and drivers

> for the removal of that old device property API, but I did not see

> that as relevant info for this patch, because even if we did not in

> the end remove that old API, this change is still useful.

> 

> The patch does exactly what the subject says. After this we supply the

> device a constant software node instead of a dynamically allocated one.


Thanks for explanation. The follow up question is - can I take it
independently via ARM Samsung/S3C tree?

Best regards,
Krzysztof
Wolfram Sang April 6, 2021, 7:37 p.m. UTC | #8
> I think these go via I2C tree.


Good, I'll apply it this weekend. Until then, let's hope we can get some
more acks.
Wolfram Sang April 6, 2021, 7:40 p.m. UTC | #9
> Thanks for explanation. The follow up question is - can I take it

> independently via ARM Samsung/S3C tree?


Is it possible to just ack it, so I can take this all via I2C? Or will
there be merge conflicts. I can provide an immutable branch, of course.
Krzysztof Kozlowski April 6, 2021, 8:28 p.m. UTC | #10
On 06/04/2021 21:40, Wolfram Sang wrote:
> 

>> Thanks for explanation. The follow up question is - can I take it

>> independently via ARM Samsung/S3C tree?

> 

> Is it possible to just ack it, so I can take this all via I2C? Or will

> there be merge conflicts. I can provide an immutable branch, of course.

> 


Sure, ack is possible (from my currently used email):
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>



Best regards,
Krzysztof
Wolfram Sang April 8, 2021, 9:22 p.m. UTC | #11
On Tue, Mar 30, 2021 at 03:58:56PM +0200, Max Staudt wrote:
> This looks great, thank you for constifying this.

> 

> Finally it's clean again, yet much more flexible than the original

> platform_data approach when I first submitted the driver.


I read this as "Reviewed-by" ;)
Wolfram Sang April 8, 2021, 9:53 p.m. UTC | #12
On Mon, Mar 29, 2021 at 01:50:35PM +0300, Heikki Krogerus wrote:
> Hi,

> 

> The old device property API (device_add_properties()) is going to be

> removed. These prepare the i2c subsystem and drivers for the change.

> The change is fairly trivial in case of i2c. All we need to do is add

> complete software nodes to the devices instead of only the device

> properties in those nodes.

> 

> thanks,

> 

> Heikki Krogerus (12):

>   i2c: Add support for software nodes

>   ARM: davinci: Constify the software nodes

>   ARM: omap1: osk: Constify the software node

>   ARM: pxa: stargate2: Constify the software node

>   ARM: s3c: mini2440: Constify the software node

>   platform/x86: intel_cht_int33fe_microb: Constify the software node

>   i2c: cht-wc: Constify the software node

>   i2c: nvidia-gpu: Constify the software node

>   i2c: icy: Constify the software node

>   platform/chrome: chromeos_laptop - Prepare complete software nodes

>   Input: elantech - Prepare a complete software node for the device

>   i2c: Remove support for dangling device properties


I applied all patches to an immutable branch "i2c/software-nodes" now.
Once buildbot successfully checked this branch, I will merge it into
for-next and advertise it to interested parties.

Thanks for this work!
Max Staudt April 8, 2021, 10:13 p.m. UTC | #13
On Thu, 8 Apr 2021 23:22:51 +0200
Wolfram Sang <wsa@kernel.org> wrote:

> I read this as "Reviewed-by" ;)


Sure, why not :)


Reviewed-by: Max Staudt <max@enpas.org>
Heikki Krogerus April 9, 2021, 9:39 a.m. UTC | #14
On Thu, Apr 08, 2021 at 11:53:23PM +0200, Wolfram Sang wrote:
> On Mon, Mar 29, 2021 at 01:50:35PM +0300, Heikki Krogerus wrote:

> > Hi,

> > 

> > The old device property API (device_add_properties()) is going to be

> > removed. These prepare the i2c subsystem and drivers for the change.

> > The change is fairly trivial in case of i2c. All we need to do is add

> > complete software nodes to the devices instead of only the device

> > properties in those nodes.

> > 

> > thanks,

> > 

> > Heikki Krogerus (12):

> >   i2c: Add support for software nodes

> >   ARM: davinci: Constify the software nodes

> >   ARM: omap1: osk: Constify the software node

> >   ARM: pxa: stargate2: Constify the software node

> >   ARM: s3c: mini2440: Constify the software node

> >   platform/x86: intel_cht_int33fe_microb: Constify the software node

> >   i2c: cht-wc: Constify the software node

> >   i2c: nvidia-gpu: Constify the software node

> >   i2c: icy: Constify the software node

> >   platform/chrome: chromeos_laptop - Prepare complete software nodes

> >   Input: elantech - Prepare a complete software node for the device

> >   i2c: Remove support for dangling device properties

> 

> I applied all patches to an immutable branch "i2c/software-nodes" now.

> Once buildbot successfully checked this branch, I will merge it into

> for-next and advertise it to interested parties.


Thank you!


-- 
heikki
Wolfram Sang April 10, 2021, 7:48 p.m. UTC | #15
On Mon, Mar 29, 2021 at 01:50:35PM +0300, Heikki Krogerus wrote:
> Hi,

> 

> The old device property API (device_add_properties()) is going to be

> removed. These prepare the i2c subsystem and drivers for the change.

> The change is fairly trivial in case of i2c. All we need to do is add

> complete software nodes to the devices instead of only the device

> properties in those nodes.

> 

> thanks,

> 

> Heikki Krogerus (12):

>   i2c: Add support for software nodes

>   ARM: davinci: Constify the software nodes

>   ARM: omap1: osk: Constify the software node

>   ARM: pxa: stargate2: Constify the software node

>   ARM: s3c: mini2440: Constify the software node

>   platform/x86: intel_cht_int33fe_microb: Constify the software node

>   i2c: cht-wc: Constify the software node

>   i2c: nvidia-gpu: Constify the software node

>   i2c: icy: Constify the software node

>   platform/chrome: chromeos_laptop - Prepare complete software nodes

>   Input: elantech - Prepare a complete software node for the device

>   i2c: Remove support for dangling device properties


Merged the immutable branch (with added tag from Robert) to for-next
now. Branch is here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/software-nodes

tag: <i2c-software-nodes-20210410>

Thank you, Heikki and all reviewers!