usb: typec: tipd: Supply also I2C driver data
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Tue, 21 Nov 2023 11:46:47 +0000 (13:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Nov 2023 14:31:40 +0000 (15:31 +0100)
If there is no fwnode, device_get_match_data() does not
return anything making the probe to always fail. Using
i2c_get_match_data() when there is no fwnode to fix that.

Fixes: 5bd4853da049 ("USB: typec: tps6598x: Add device data to of_device_id")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20231121114647.2005011-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tipd/core.c

index b0184be06c3d0e0bf578a3680700f2077087be3d..196535ad996d080ff50340472e32e00e2445b257 100644 (file)
@@ -1227,7 +1227,10 @@ static int tps6598x_probe(struct i2c_client *client)
                        TPS_REG_INT_PLUG_EVENT;
        }
 
-       tps->data = device_get_match_data(tps->dev);
+       if (dev_fwnode(tps->dev))
+               tps->data = device_get_match_data(tps->dev);
+       else
+               tps->data = i2c_get_match_data(client);
        if (!tps->data)
                return -EINVAL;
 
@@ -1426,7 +1429,7 @@ static const struct of_device_id tps6598x_of_match[] = {
 MODULE_DEVICE_TABLE(of, tps6598x_of_match);
 
 static const struct i2c_device_id tps6598x_id[] = {
-       { "tps6598x" },
+       { "tps6598x", (kernel_ulong_t)&tps6598x_data },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, tps6598x_id);