Skip to contentSkip to conversation

mfd: core: Preserve PLATFORM_DEVID_NONE

PATCH In review Andy Shevchenko 2 participants 6 messages Mar 16, 2017 – Mar 27, 2017 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: core: Preserve PLATFORM_DEVID_NONE

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

---
 drivers/mfd/mfd-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +1 -1
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device *parent, int id,
 	int platform_id;
 	int r;
 
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)
 		platform_id = id;
 	else
 		platform_id = id + cell->id;
Signature · 1 line
2.11.0
#1 lore raw
Quoted 4 lines · Andy Shevchenko

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

This is a substantial change to a pretty tried and tested piece of sub-system code. Can you put some more meat on the bones in the commit log, and include examples.

Quoted 18 lines
---
 drivers/mfd/mfd-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +1 -1
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device *parent, int id,
 	int platform_id;
 	int r;
 
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)
 		platform_id = id;
 	else
 		platform_id = id + cell->id;
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 10 lines · Lee Jones
Quoted 4 lines · Andy Shevchenko

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

This is a substantial change to a pretty tried and tested piece of sub-system code.  Can you put some more meat on the bones in the commit log, and include examples.

Example in pseudo code:

cells = {
[0] = { .id = 0, .name = "moduleX", },
[1] = { .id = 1, .name = "moduleY", },
[2] = { .id = 2, .name = "moduleZ", },
...
};

mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells), ...);

Output (names of the devices in the drivers):
"moduleX"
"moduleY.0"
"moduleX.1"

Desired output:
"moduleX"
"moduleY"
"moduleZ"

Is it by design?

Quoted 22 lines
Quoted 20 lines

---
 drivers/mfd/mfd-core.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +0 -0
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device *parent,
 int id,
  	int platform_id;
  	int r;

drivers/mfd/mfd-core.c +1 -1
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)

  platform_id = id;
  else
  platform_id = id + cell->id;

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw
Quoted 29 lines · Andy Shevchenko
Quoted 10 lines · Lee Jones
Quoted 4 lines · Andy Shevchenko

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

This is a substantial change to a pretty tried and tested piece of sub-system code.  Can you put some more meat on the bones in the commit log, and include examples.

Example in pseudo code:

cells = {
[0] = { .id = 0, .name = "moduleX", },
[1] = { .id = 1, .name = "moduleY", },
[2] = { .id = 2, .name = "moduleZ", },
...
};

mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells), ...);

Output (names of the devices in the drivers):
"moduleX"
"moduleY.0"
"moduleX.1"

Quoted 4 lines

Desired output:
"moduleX"
"moduleY"
"moduleZ"

Then what would be your reason for populating the 'id' attribute?

Quoted 25 lines

Is it by design?

Quoted 22 lines
Quoted 20 lines

---
 drivers/mfd/mfd-core.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +0 -0
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device *parent,
 int id,
  	int platform_id;
  	int r;

drivers/mfd/mfd-core.c +1 -1
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)

  platform_id = id;
  else
  platform_id = id + cell->id;

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 31 lines · Lee Jones
Quoted 29 lines · Andy Shevchenko
Quoted 10 lines · Lee Jones
Quoted 4 lines · Andy Shevchenko

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

This is a substantial change to a pretty tried and tested piece of sub-system code.  Can you put some more meat on the bones in the commit log, and include examples.

Example in pseudo code:

cells = {
 [0] = { .id = 0, .name = "moduleX", },
 [1] = { .id = 1, .name = "moduleY", },
 [2] = { .id = 2, .name = "moduleZ", },
 ...
};

mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells), ...);

Output (names of the devices in the drivers):
"moduleX"
"moduleY.0"
"moduleX.1"

Quoted 6 lines
Quoted 4 lines

Desired output:
"moduleX"
"moduleY"
"moduleZ"

Then what would be your reason for populating the 'id' attribute?

That's a gray area. If I remember correctly I come to above patch through looking some incremental change.

I'm fine with no patch applied if this is documented somewhere, otherwise we might update documentation to cover such cases explicitly.

Quoted 29 lines
Quoted 27 lines

Is it by design?

Quoted 24 lines
Quoted 22 lines

m>
---
 drivers/mfd/mfd-core.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +0 -0
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device
 *parent,
 int id,
  	int platform_id;
  	int r;

drivers/mfd/mfd-core.c +1 -1
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)

  platform_id = id;
  else
  platform_id = id + cell->id;

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw
Quoted 37 lines · Andy Shevchenko
Quoted 36 lines · Lee Jones
Quoted 33 lines · Andy Shevchenko
Quoted 10 lines · Lee Jones
Quoted 4 lines · Andy Shevchenko

There is a potential flaw if cell has id > 0 and is going to be registered with PLATFORM_DEVID_NONE.

Ignore if PLATFORM_DEVID_NONE is supplied.

This is a substantial change to a pretty tried and tested piece of sub-system code.  Can you put some more meat on the bones in the commit log, and include examples.

Example in pseudo code:

cells = {
 [0] = { .id = 0, .name = "moduleX", },
 [1] = { .id = 1, .name = "moduleY", },
 [2] = { .id = 2, .name = "moduleZ", },
 ...
};

mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells), ...);

Output (names of the devices in the drivers):
"moduleX"
"moduleY.0"
"moduleX.1"

Desired output:
"moduleX"
"moduleY"
"moduleZ"

Quoted 7 lines
Quoted 1 line

Then what would be your reason for populating the 'id' attribute?

That's a gray area. If I remember correctly I come to above patch through looking some incremental change.

I'm fine with no patch applied if this is documented somewhere, otherwise we might update documentation to cover such cases explicitly.

I'd be happy to review any proposal you put forward. :)

Quoted 29 lines
Quoted 28 lines
Quoted 26 lines

Is it by design?

Quoted 24 lines
Quoted 22 lines

m>
---
 drivers/mfd/mfd-core.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mfd-core.c +0 -0
index c57e407020f1..c9583f895058 100644
@@ -149,7 +149,7 @@ static int mfd_add_device(struct device
 *parent,
 int id,
  	int platform_id;
  	int r;

drivers/mfd/mfd-core.c +1 -1
-	if (id == PLATFORM_DEVID_AUTO)
+	if (id < 0)

  platform_id = id;
  else
  platform_id = id + cell->id;

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog