aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-pxa.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 1e88e8d66c55..ea6d45d1dcd6 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1053,16 +1053,13 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
1053 struct device_node *np = pdev->dev.of_node; 1053 struct device_node *np = pdev->dev.of_node;
1054 const struct of_device_id *of_id = 1054 const struct of_device_id *of_id =
1055 of_match_device(i2c_pxa_dt_ids, &pdev->dev); 1055 of_match_device(i2c_pxa_dt_ids, &pdev->dev);
1056 int ret;
1057 1056
1058 if (!of_id) 1057 if (!of_id)
1059 return 1; 1058 return 1;
1060 ret = of_alias_get_id(np, "i2c"); 1059
1061 if (ret < 0) { 1060 /* For device tree we always use the dynamic or alias-assigned ID */
1062 dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret); 1061 i2c->adap.nr = -1;
1063 return ret; 1062
1064 }
1065 pdev->id = ret;
1066 if (of_get_property(np, "mrvl,i2c-polling", NULL)) 1063 if (of_get_property(np, "mrvl,i2c-polling", NULL))
1067 i2c->use_pio = 1; 1064 i2c->use_pio = 1;
1068 if (of_get_property(np, "mrvl,i2c-fast-mode", NULL)) 1065 if (of_get_property(np, "mrvl,i2c-fast-mode", NULL))
@@ -1100,6 +1097,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
1100 goto emalloc; 1097 goto emalloc;
1101 } 1098 }
1102 1099
1100 /* Default adapter num to device id; i2c_pxa_probe_dt can override. */
1101 i2c->adap.nr = dev->id;
1102
1103 ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type); 1103 ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type);
1104 if (ret > 0) 1104 if (ret > 0)
1105 ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type); 1105 ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
@@ -1124,9 +1124,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
1124 spin_lock_init(&i2c->lock); 1124 spin_lock_init(&i2c->lock);
1125 init_waitqueue_head(&i2c->wait); 1125 init_waitqueue_head(&i2c->wait);
1126 1126
1127 i2c->adap.nr = dev->id; 1127 strlcpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name));
1128 snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
1129 i2c->adap.nr);
1130 1128
1131 i2c->clk = clk_get(&dev->dev, NULL); 1129 i2c->clk = clk_get(&dev->dev, NULL);
1132 if (IS_ERR(i2c->clk)) { 1130 if (IS_ERR(i2c->clk)) {
@@ -1169,7 +1167,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
1169 } else { 1167 } else {
1170 i2c->adap.algo = &i2c_pxa_algorithm; 1168 i2c->adap.algo = &i2c_pxa_algorithm;
1171 ret = request_irq(irq, i2c_pxa_handler, IRQF_SHARED, 1169 ret = request_irq(irq, i2c_pxa_handler, IRQF_SHARED,
1172 i2c->adap.name, i2c); 1170 dev_name(&dev->dev), i2c);
1173 if (ret) 1171 if (ret)
1174 goto ereqirq; 1172 goto ereqirq;
1175 } 1173 }