History

w1-gpio: handle of_get_gpio() returning -EPROBE_DEFER better

of_get_gpio() might return -EPROBE_DEFER meaning that the driver providing the gpio isn't ready yet. If that happens for the first gpio the resulting kernel output without this patch is: w1-gpio somename: Failed to parse DT platform somename: Driver w1-gpio requests probe deferral The first message is misleading and so is suppressed with this patch. Further if determining the gpio to switch the external pullup yields -EPROBE_DEFER this error should be passed back to the caller instead of just continuing without pullup.

Uwe Kleine-König committed 12 years ago

Commit 0b336ce1 parent c9afbb01 file · +14 −5Browse files

Unified · Split

drivers/w1/masters/w1-gpio.c+14−5
@@ -89,11 +89,22 @@ static int w1_gpio_probe_dt(struct platform_device *pdev) · 88 unmodified lines
89 pdata->is_open_drain = 1;89 pdata->is_open_drain = 1;
90 90
91 gpio = of_get_gpio(np, 0);91 gpio = of_get_gpio(np, 0);
92 if (gpio < 0)92 if (gpio < 0) {
93 if (gpio != -EPROBE_DEFER)
94 dev_err(&pdev->dev,
95 "Failed to parse gpio property for data pin (%d)\n",
96 gpio);
97
93 return gpio;98 return gpio;
99 }
94 pdata->pin = gpio;100 pdata->pin = gpio;
95 101
96 pdata->ext_pullup_enable_pin = of_get_gpio(np, 1);102 gpio = of_get_gpio(np, 1);
103 if (gpio == -EPROBE_DEFER)
104 return gpio;
105 /* ignore other errors as the pullup gpio is optional */
106 pdata->ext_pullup_enable_pin = gpio;
107
97 pdev->dev.platform_data = pdata;108 pdev->dev.platform_data = pdata;
98 109
99 return 0;110 return 0;
@@ -107,10 +118,8 @@ static int w1_gpio_probe(struct platform_device *pdev) · 7 unmodified lines
107 118
108 if (of_have_populated_dt()) {119 if (of_have_populated_dt()) {
109 err = w1_gpio_probe_dt(pdev);120 err = w1_gpio_probe_dt(pdev);
110 if (err < 0) {121 if (err < 0)
111 dev_err(&pdev->dev, "Failed to parse DT\n");
112 return err;122 return err;
113 }
114 }123 }
115 124
116 pdata = dev_get_platdata(&pdev->dev);125 pdata = dev_get_platdata(&pdev->dev);