Skip to contentSkip to conversation

pwm: pxa: Use of_match_ptr()

PATCH In review Jingoo Han 2 participants 2 messages Apr 3, 2014 – Apr 4, 2014 PWM

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH v2 1/1 pwm: pxa: Use of_match_ptr()

Use of_match_ptr(), because of_match_ptr() returns NULL pointer when CONFIG_OF is disabled.

---
Changes since v1:
- Add of_match_ptr() to of_match_device() in order to fix compile error when CONFIG_OF=n.

 drivers/pwm/pwm-pxa.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/pwm/pwm-pxa.c +3 -4
index cd356d8..024e6a4 100644
@@ -140,14 +140,13 @@ static const struct of_device_id pwm_of_match[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pwm_of_match);
-#else
-#define pwm_of_match NULL
 #endif
 
 static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
 {
-	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
+	const struct of_device_id *id;
 
+	id = of_match_device(of_match_ptr(pwm_of_match), dev);
 	return id ? id->data : NULL;
 }
 
@@ -228,7 +227,7 @@ static struct platform_driver pwm_driver = {
 	.driver		= {
 		.name	= "pxa25x-pwm",
 		.owner	= THIS_MODULE,
-		.of_match_table = pwm_of_match,
+		.of_match_table = of_match_ptr(pwm_of_match),
 	},
 	.probe		= pwm_probe,
 	.remove		= pwm_remove,
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · Jingoo Han

Use of_match_ptr(), because of_match_ptr() returns NULL pointer when CONFIG_OF is disabled.

---
Changes since v1:
- Add of_match_ptr() to of_match_device() in order to fix compile error when CONFIG_OF=n.

 drivers/pwm/pwm-pxa.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

I already fixed this in the PWM tree before submitting the 3.15 pull request. What I did was rather revert the original patch because given the use in pxa_pwm_get_id_dt() there isn't any real advantages to using of_match_ptr() anymore.

Thierry