Skip to contentSkip to conversation

i2c: core: Allow empty id_table in ACPI case as well

PATCH Applied Andy Shevchenko 3 participants 5 messages Jul 6, 2017 – Jul 8, 2017

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: core: Allow empty id_table in ACPI case as well

For now empty ID table is not allowed with ACPI and prevents driver to be probed.

Add a check to allow empty ID table.

Fixes da10c06a044b ("i2c: Make I2C ID tables non-mandatory for DT'ed devices")
---
 drivers/i2c/i2c-core-base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +2 -1
index c89dac7fd2e7..45231d2257ad 100644
@@ -354,9 +354,10 @@ static int i2c_device_probe(struct device *dev)
 
 	/*
 	 * An I2C ID table is not mandatory, if and only if, a suitable Device
-	 * Tree match table entry is supplied for the probing device.
+	 * Tree or ACPI match table entry is supplied for the probing device.
 	 */
 	if (!driver->id_table &&
+	    !acpi_match_device(dev->driver->acpi_match_table, &client->dev) &&
 	    !i2c_of_match_device(dev->driver->of_match_table, client))
 		return -ENODEV;
 
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Thank you for doing this.

Quoted 7 lines · Andy Shevchenko

For now empty ID table is not allowed with ACPI and prevents driver to be probed.

Add a check to allow empty ID table.

Fixes da10c06a044b ("i2c: Make I2C ID tables non-mandatory for DT'ed devices")

Looks good to me:

Regards,

Hans

Quoted 21 lines
---
  drivers/i2c/i2c-core-base.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +2 -1
index c89dac7fd2e7..45231d2257ad 100644
@@ -354,9 +354,10 @@ static int i2c_device_probe(struct device *dev)
 
  	/*
  	 * An I2C ID table is not mandatory, if and only if, a suitable Device
-	 * Tree match table entry is supplied for the probing device.
+	 * Tree or ACPI match table entry is supplied for the probing device.
  	 */
  	if (!driver->id_table &&
+	    !acpi_match_device(dev->driver->acpi_match_table, &client->dev) &&
  	    !i2c_of_match_device(dev->driver->of_match_table, client))
  		return -ENODEV;
 
#3 lore raw
Quoted 5 lines · Wolfram Sang
Quoted 4 lines · Andy Shevchenko

For now empty ID table is not allowed with ACPI and prevents driver to be
probed.

Quoted 8 lines
Quoted 5 lines

Add a check to allow empty ID table.

Fixes da10c06a044b ("i2c: Make I2C ID tables non-mandatory for

DT'ed devices")

Do we need this for 4.13 already?

Yes (we have NFC chip which relies on it), even better down to stable kernels which have mentioned commit.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy