Skip to contentSkip to conversation

Introduce ACPI style match in platform_match

RFC PATCH In review Zhang Rui 2 participants 3 messages Sep 28, 2012 – Oct 1, 2012

Subsystems (3)
lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

RFC PATCH 2/6 Introduce ACPI style match in platform_match

Quoted 1 line

From 5d7ecd12c2994b8c5905d52718c2870c3b62746e Mon Sep 17 00:00:00 2001

From: Zhang Rui <[email protected]>
Date: Fri, 28 Sep 2012 14:51:03 +0800
Subject: [RFC PATCH 2/6] Introduce ACPI style match in platform_match

---
 drivers/base/platform.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/base/platform.c +8 -0
index a1a7225..90e64c6f 100644
@@ -20,6 +20,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <linux/acpi.h>
 
 #include "base.h"
 
@@ -635,6 +636,13 @@ static const struct platform_device_id *platform_match_id(
 			struct platform_device *pdev)
 {
 	while (id->name[0]) {
+#ifdef CONFIG_ACPI
+		/* attempt ACPI style match */
+		if (acpi_match_device_id(&pdev->dev, id->name) == 0) {
+			pdev->id_entry = id;
+			return id;
+		}
+#endif
 		if (strcmp(pdev->name, id->name) == 0) {
 			pdev->id_entry = id;
 			return id;
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 23 lines · Zhang Rui
Quoted 1 line

From 5d7ecd12c2994b8c5905d52718c2870c3b62746e Mon Sep 17 00:00:00 2001

From: Zhang Rui <[email protected]>
Date: Fri, 28 Sep 2012 14:51:03 +0800
Subject: [RFC PATCH 2/6] Introduce ACPI style match in platform_match

---
 drivers/base/platform.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/base/platform.c +1 -0
index a1a7225..90e64c6f 100644
@@ -20,6 +20,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <linux/acpi.h>
 
 #include "base.h"
 

drivers/base/platform.c static const struct platform_device_id *platform_match_id( · line 639

Quoted 4 lines
drivers/base/platform.c +1 -0
@@ -635,6 +636,13 @@ static const struct platform_device_id *platform_match_id(
 			struct platform_device *pdev)
 {
 	while (id->name[0]) {
+#ifdef CONFIG_ACPI

I don't think the above is needed as you stub the acpi_match_device_id() out when !CONFIG_ACPI.

How about I2C and SPI slave devices?

Quoted 19 lines
drivers/base/platform.c +6 -0
+		/* attempt ACPI style match */
+		if (acpi_match_device_id(&pdev->dev, id->name) == 0) {
+			pdev->id_entry = id;
+			return id;
+		}
+#endif
 		if (strcmp(pdev->name, id->name) == 0) {
 			pdev->id_entry = id;
 			return id;
Signature · 9 lines
1.7.7.6



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
author
#2 lore raw
Quoted 39 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Mika Westerberg
Sent: Monday, October 01, 2012 2:47 PM
To: Zhang, Rui
Cc: LKML; linux-pm; linux-i2c; [email protected]; Len, Brown; Rafael J. Wysocki; Grant Likely; Dirk Brandewie
Subject: Re: [RFC PATCH 2/6] Introduce ACPI style match in platform_match
Importance: High

drivers/base/platform.c static const struct platform_device_id

Quoted 24 lines · Zhang Rui
Quoted 2 lines

From 5d7ecd12c2994b8c5905d52718c2870c3b62746e Mon Sep 17 00:00:00 2001

From: Zhang Rui <[email protected]>
Date: Fri, 28 Sep 2012 14:51:03 +0800
Subject: [RFC PATCH 2/6] Introduce ACPI style match in platform_match

---
 drivers/base/platform.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/base/platform.c index renamed from drivers/base/platform.c +0 -0

a1a7225..90e64c6f 100644

drivers/base/platform.c +1 -0
@@ -20,6 +20,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
+#include <linux/acpi.h>
 
 #include "base.h"
 
@@ -635,6 +636,13 @@ static const struct platform_device_id

*platform_match_id(

Quoted 8 lines

drivers/base/platform.c static const struct platform_device_id *platform_match_id( · line 639

Quoted 4 lines
drivers/base/platform.c +1 -0
 			struct platform_device *pdev)
 {
 	while (id->name[0]) {
+#ifdef CONFIG_ACPI

I don't think the above is needed as you stub the acpi_match_device_id() out when !CONFIG_ACPI.

You're right, I'll remove this.

Quoted 2 lines

How about I2C and SPI slave devices?

We're introduce the I2C/SPI bus ACPI binding, and the i2c/spi bus .match method can be redirected to acpi callbacks.

Thanks,
rui