Skip to contentSkip to conversation

usb: phy: isp1301: Add OF device ID table

PATCH In review Javier Martinez Canillas 2 participants 3 messages Mar 15, 2017 – Mar 28, 2017 USB

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: phy: isp1301: Add OF device ID table

The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF.

---

Changes in v2:
- Don't use of_match_ptr() to avoid build warning when CONFIG_OF is disabled.

 drivers/usb/phy/phy-isp1301.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/usb/phy/phy-isp1301.c +7 -0
index db68156568e6..f333024660b4 100644
@@ -33,6 +33,12 @@ static const struct i2c_device_id isp1301_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, isp1301_id);
 
+static const struct of_device_id isp1301_of_match[] = {
+	{.compatible = "nxp,isp1301" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, isp1301_of_match);
+
 static struct i2c_client *isp1301_i2c_client;
 
 static int __isp1301_write(struct isp1301 *isp, u8 reg, u8 value, u8 clear)
@@ -130,6 +136,7 @@ static int isp1301_remove(struct i2c_client *client)
 static struct i2c_driver isp1301_driver = {
 	.driver = {
 		.name = DRV_NAME,
+		.of_match_table = isp1301_of_match,
 	},
 	.probe = isp1301_probe,
 	.remove = isp1301_remove,
Signature · 1 line
2.9.3
#1 lore raw

Hi,

Quoted 9 lines · Javier Martinez Canillas

The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF.

this is already upstream. Care to send an incremental diff in case we need this fixed further?

Signature · 1 line
balbi
#2 lore raw

Hello Felipe,

Quoted 9 lines · Felipe Balbi

Hi,

Quoted 5 lines · Javier Martinez Canillas

The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>.

Quoted 8 lines
Quoted 4 lines

But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF.

this is already upstream. Care to send an incremental diff in case we need this fixed further?

Ah, sorry. I missed that was already picked. Sure, I'll post an incremental diff on top of v1. Thanks!

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Open Source Group
Samsung Research America