Skip to contentSkip to conversation

i2c: core: Don't fail PRP0001 enumeration when no ID table exist

PATCH Applied Andy Shevchenko 3 participants 7 messages Aug 21, 2020 – Aug 25, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i2c: core: Don't fail PRP0001 enumeration when no ID table exist

When commit c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well") fixed the enumeration of I²C devices on ACPI enabled platforms when driver has no ID table, it missed the PRP0001 support.

i2c_device_match() and i2c_acpi_match_device() differently match driver against given device. Use acpi_driver_match_device(), that is used in the former, in i2c_device_probe() and don't fail PRP0001 enumeration when no ID table exist.

Fixes c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well")
---
 drivers/i2c/i2c-core-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +1 -1
index 34a9609f256d..5ec082e2039d 100644
@@ -480,7 +480,7 @@ static int i2c_device_probe(struct device *dev)
 	 * or ACPI ID table is supplied for the probing device.
 	 */
 	if (!driver->id_table &&
-	    !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
+	    !acpi_driver_match_device(dev, dev->driver) &&
 	    !i2c_of_match_device(dev->driver->of_match_table, client)) {
 		status = -ENODEV;
 		goto put_sync_adapter;
Signature · 1 line
2.28.0
#1 lore raw

PATCH 2/2 i2c: acpi: Remove dead code, i.e. i2c_acpi_match_device()

We have no users of i2c_acpi_match_device() anymore and seems will not have them in the future, thus remove dead code.

---
 drivers/i2c/i2c-core-acpi.c | 10 ----------
 drivers/i2c/i2c-core.h      |  9 ---------
 2 files changed, 19 deletions(-)
drivers/i2c/i2c-core-acpi.c +0 -10
index 2ade99b105b9..e627d7b2790f 100644
@@ -276,16 +276,6 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
 		dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
 }
 
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-		      struct i2c_client *client)
-{
-	if (!(client && matches))
-		return NULL;
-
-	return acpi_match_device(matches, &client->dev);
-}
-
 static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
 	/*
 	 * These Silead touchscreen controllers only work at 400KHz, for
drivers/i2c/i2c-core.h +0 -9
index 94ff1693b391..8ce261167a2d 100644
@@ -59,20 +59,11 @@ static inline int __i2c_check_suspended(struct i2c_adapter *adap)
 }
 
 #ifdef CONFIG_ACPI
-const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-		      struct i2c_client *client);
 void i2c_acpi_register_devices(struct i2c_adapter *adap);
 
 int i2c_acpi_get_irq(struct i2c_client *client);
 #else /* CONFIG_ACPI */
 static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { }
-static inline const struct acpi_device_id *
-i2c_acpi_match_device(const struct acpi_device_id *matches,
-		      struct i2c_client *client)
-{
-	return NULL;
-}
 
 static inline int i2c_acpi_get_irq(struct i2c_client *client)
 {
Signature · 1 line
2.28.0
Reviewed-by on v1 1/2
#4 lore raw
In reply to Andy Shevchenko
Quoted 4 lines · Andy Shevchenko

When commit c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well") fixed the enumeration of I²C devices on ACPI enabled platforms when driver has no ID table, it missed the PRP0001 support.

Quoted 8 lines

i2c_device_match() and i2c_acpi_match_device() differently match driver against given device. Use acpi_driver_match_device(), that is used in the former, in i2c_device_probe() and don't fail PRP0001 enumeration when no ID table exist.

Fixes c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well")
Applied
#5 lore raw
In reply to Andy Shevchenko
Quoted 11 lines · Andy Shevchenko

When commit c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well") fixed the enumeration of I²C devices on ACPI enabled platforms when driver has no ID table, it missed the PRP0001 support.

i2c_device_match() and i2c_acpi_match_device() differently match driver against given device. Use acpi_driver_match_device(), that is used in the former, in i2c_device_probe() and don't fail PRP0001 enumeration when no ID table exist.

Fixes c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well")

You are monitoring SO? Nice.

Quoted 1 line

Applied to for-current, thanks!

#6 lore raw
Quoted 10 lines · Wolfram Sang
Quoted 9 lines · Andy Shevchenko

When commit c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well") fixed the enumeration of I²C devices on ACPI enabled platforms when driver has no ID table, it missed the PRP0001 support.

i2c_device_match() and i2c_acpi_match_device() differently match driver against given device. Use acpi_driver_match_device(), that is used in the former, in i2c_device_probe() and don't fail PRP0001 enumeration when no ID table exist.

Quoted 4 lines
Quoted 2 lines
Fixes c64ffff7a9d1 ("i2c: core: Allow empty id_table in ACPI case as well")

You are monitoring SO? Nice.

Monitoring is probably too strong word here, rather sometimes looking for interesting topics (mostly related to ACPI + Linux (kernel) and near to them).

This makes me wonder how many commits are actually referring to SO. The 1st one I found is 8c88f87cb27a ("netfilter: nfnetlink_queue: add NAT TCP sequence adjustment if packet mangled"). Some of them referring stackexchange site, but not many (brief estimation like a couple of dozens at most).

Quoted 3 lines
Quoted 1 line

Applied to for-current, thanks!

Thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko