Skip to contentSkip to conversation

phy: omap-control: Remove unneeded ifdef CONFIG_OF guard and of_match_ptr

PATCH In review Axel Lin 3 participants 7 messages Mar 5, 2015 – Mar 9, 2015 Generic PHY framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/3 phy: omap-control: Remove unneeded ifdef CONFIG_OF guard and of_match_ptr

if !CONFIG_OF, the probe fails.
This is a dt-only driver, so the ifdef CONFIG_OF guard and of_match_ptr are not needed.

---
 drivers/phy/phy-omap-control.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/phy/phy-omap-control.c +2 -8
index efe724f..a7653d9 100644
@@ -216,7 +216,6 @@ void omap_control_usb_set_mode(struct device *dev,
 		return;
 
 	ctrl_phy = dev_get_drvdata(dev);
-
 	if (!ctrl_phy) {
 		dev_err(dev, "Invalid control phy device\n");
 		return;
@@ -241,8 +240,6 @@ void omap_control_usb_set_mode(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
 
-#ifdef CONFIG_OF
-
 static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
 static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
 static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
@@ -278,8 +275,6 @@ static const struct of_device_id omap_control_phy_id_table[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
-#endif
-
 
 static int omap_control_phy_probe(struct platform_device *pdev)
 {
@@ -287,8 +282,7 @@ static int omap_control_phy_probe(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	struct omap_control_phy *control_phy;
 
-	of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
-				&pdev->dev);
+	of_id = of_match_device(omap_control_phy_id_table, &pdev->dev);
 	if (!of_id)
 		return -EINVAL;
 
@@ -344,7 +338,7 @@ static struct platform_driver omap_control_phy_driver = {
 	.probe		= omap_control_phy_probe,
 	.driver		= {
 		.name	= "omap-control-phy",
-		.of_match_table = of_match_ptr(omap_control_phy_id_table),
+		.of_match_table = omap_control_phy_id_table,
 	},
 };
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 phy: omap-usb2: Remove unneeded ifdef CONFIG_OF guard and of_match_ptr

if !CONFIG_OF, the probe fails.
This is a dt-only driver, so the ifdef CONFIG_OF guard and of_match_ptr are not needed.

---
 drivers/phy/phy-omap-usb2.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/phy/phy-omap-usb2.c +2 -4
index 6f4aef3..18b33ce 100644
@@ -144,7 +144,6 @@ static struct phy_ops ops = {
 	.owner		= THIS_MODULE,
 };
 
-#ifdef CONFIG_OF
 static const struct usb_phy_data omap_usb2_data = {
 	.label = "omap_usb2",
 	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
@@ -185,7 +184,6 @@ static const struct of_device_id omap_usb2_id_table[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, omap_usb2_id_table);
-#endif
 
 static int omap_usb2_probe(struct platform_device *pdev)
 {
@@ -200,7 +198,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	struct usb_phy_data *phy_data;
 
-	of_id = of_match_device(of_match_ptr(omap_usb2_id_table), &pdev->dev);
+	of_id = of_match_device(omap_usb2_id_table, &pdev->dev);
 
 	if (!of_id)
 		return -EINVAL;
@@ -377,7 +375,7 @@ static struct platform_driver omap_usb2_driver = {
 	.driver		= {
 		.name	= "omap-usb2",
 		.pm	= DEV_PM_OPS,
-		.of_match_table = of_match_ptr(omap_usb2_id_table),
+		.of_match_table = omap_usb2_id_table,
 	},
 };
 
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 3/3 phy: ti-pipe3: Remove unneeded ifdef CONFIG_OF guard and of_match_ptr

In reply to Axel Lin

if !CONFIG_OF, the probe fails.
This is a dt-only driver, so the ifdef CONFIG_OF guard and of_match_ptr are not needed.

---
 drivers/phy/phy-ti-pipe3.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/phy/phy-ti-pipe3.c +2 -7
index 95c88f9..ad3fbc8 100644
@@ -291,9 +291,7 @@ static struct phy_ops ops = {
 	.owner		= THIS_MODULE,
 };
 
-#ifdef CONFIG_OF
 static const struct of_device_id ti_pipe3_id_table[];
-#endif
 
 static int ti_pipe3_probe(struct platform_device *pdev)
 {
@@ -315,8 +313,7 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 	spin_lock_init(&phy->lock);
 
 	if (!of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
-		match = of_match_device(of_match_ptr(ti_pipe3_id_table),
-					&pdev->dev);
+		match = of_match_device(ti_pipe3_id_table, &pdev->dev);
 		if (!match)
 			return -EINVAL;
 
@@ -574,7 +571,6 @@ static const struct dev_pm_ops ti_pipe3_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(ti_pipe3_suspend, ti_pipe3_resume)
 };
 
-#ifdef CONFIG_OF
 static const struct of_device_id ti_pipe3_id_table[] = {
 	{
 		.compatible = "ti,phy-usb3",
@@ -594,7 +590,6 @@ static const struct of_device_id ti_pipe3_id_table[] = {
 	{}
 };
 MODULE_DEVICE_TABLE(of, ti_pipe3_id_table);
-#endif
 
 static struct platform_driver ti_pipe3_driver = {
 	.probe		= ti_pipe3_probe,
@@ -602,7 +597,7 @@ static struct platform_driver ti_pipe3_driver = {
 	.driver		= {
 		.name	= "ti-pipe3",
 		.pm	= &ti_pipe3_pm_ops,
-		.of_match_table = of_match_ptr(ti_pipe3_id_table),
+		.of_match_table = ti_pipe3_id_table,
 	},
 };
 
Signature · 1 line
1.9.1
#3 lore raw
In reply to Axel Lin

Hi Alex,

Quoted 31 lines · Axel Lin

if !CONFIG_OF, the probe fails.
This is a dt-only driver, so the ifdef CONFIG_OF guard and of_match_ptr are not needed.

---
 drivers/phy/phy-omap-control.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/phy/phy-omap-control.c +0 -3
index efe724f..a7653d9 100644
@@ -216,7 +216,6 @@ void omap_control_usb_set_mode(struct device *dev,
 		return;
 
 	ctrl_phy = dev_get_drvdata(dev);
-
 	if (!ctrl_phy) {
 		dev_err(dev, "Invalid control phy device\n");
 		return;
@@ -241,8 +240,6 @@ void omap_control_usb_set_mode(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
 
-#ifdef CONFIG_OF
-
 static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
 static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
 static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;

drivers/phy/phy-omap-control.c static const struct of_device_id omap_control_phy_id_table[] = { · line 282

Quoted 5 lines
drivers/phy/phy-omap-control.c +0 -2
@@ -278,8 +275,6 @@ static const struct of_device_id omap_control_phy_id_table[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
-#endif
-

Since we're anyways going to fail probe for !CONFIG_OF, why do you want to add the unnecessary device table to the kernel?

what are you benefiting from this change?

Quoted 15 lines
drivers/phy/phy-omap-control.c +1 -2
 static int omap_control_phy_probe(struct platform_device *pdev)
 {
@@ -287,8 +282,7 @@ static int omap_control_phy_probe(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	struct omap_control_phy *control_phy;
 
-	of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
-				&pdev->dev);
+	of_id = of_match_device(omap_control_phy_id_table, &pdev->dev);
 	if (!of_id)
 		return -EINVAL;
 

drivers/phy/phy-omap-control.c static struct platform_driver omap_control_phy_driver = { · line 344

Quoted 8 lines
drivers/phy/phy-omap-control.c +1 -1
@@ -344,7 +338,7 @@ static struct platform_driver omap_control_phy_driver = {
 	.probe		= omap_control_phy_probe,
 	.driver		= {
 		.name	= "omap-control-phy",
-		.of_match_table = of_match_ptr(omap_control_phy_id_table),
+		.of_match_table = omap_control_phy_id_table,
 	},
 };
 

cheers,
-roger

author
#4 lore raw

2015-03-05 18:48 GMT+08:00 Roger Quadros <[email protected]>:

Quoted 1 line

Hi Alex,

It's Axel.

Quoted 5 lines

Since we're anyways going to fail probe for !CONFIG_OF, why do you want to add the unnecessary device table to the kernel?

what are you benefiting from this change?

If the driver works for both dt case and non-dt case, using the ifdef CONFIG_OF guard can save a few memory for non-dt case.
For dt-only driver it is not required because you cannot use the driver if !CONFIG_OF. Which means you should not build this driver at all if !CONFIG_OF unless you just want to do compile test.

Regards,
Axel

#5 lore raw
Quoted 3 lines · Axel Lin

2015-03-05 18:48 GMT+08:00 Roger Quadros <[email protected]>:

Quoted 1 line

Hi Alex,

It's Axel.

My apologies Axel.

Quoted 5 lines
Quoted 5 lines

Since we're anyways going to fail probe for !CONFIG_OF, why do you want to add the unnecessary device table to the kernel?

Quoted 7 lines
Quoted 1 line

what are you benefiting from this change?

If the driver works for both dt case and non-dt case, using the ifdef CONFIG_OF guard can save a few memory for non-dt case.
For dt-only driver it is not required because you cannot use the driver if !CONFIG_OF. Which means you should not build this driver at all if !CONFIG_OF unless you just want to do compile test.

I agree. Kishon do we really need to build these drivers if !CONFIG_OF?

cheers,
-roger

#6 lore raw

Hi,

Quoted 14 lines · Roger Quadros
Quoted 3 lines · Axel Lin

2015-03-05 18:48 GMT+08:00 Roger Quadros <[email protected]>:

Quoted 1 line

Hi Alex,

It's Axel.

My apologies Axel.

Quoted 7 lines
Quoted 6 lines

Since we're anyways going to fail probe for !CONFIG_OF, why do you want to add the unnecessary device table to the kernel?

what are you benefiting from this change?

Quoted 7 lines
Quoted 5 lines

If the driver works for both dt case and non-dt case, using the ifdef CONFIG_OF guard can save a few memory for non-dt case.
For dt-only driver it is not required because you cannot use the driver if !CONFIG_OF. Which means you should not build this driver at all if !CONFIG_OF unless you just want to do compile test.

I agree. Kishon do we really need to build these drivers if !CONFIG_OF?

We can stop building these drivers for !CONFIG_OF since none of the platforms which uses these drivers support non-dt anyway.

Cheers
Kishon