aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2014-02-13 17:05:28 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-15 15:08:38 -0500
commit0b336cea56ccd9949dc9bd6f24bd3bb9d212ffad (patch)
tree95c6420fd909f80c06f2463b831b08d1d68dfb41 /drivers/w1
parentc9afbb05a9ffbef0976242ab1135af6814ccff0f (diff)
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. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/w1-gpio.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index 9709b8b484ba..1d111e56c8c8 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -89,11 +89,22 @@ static int w1_gpio_probe_dt(struct platform_device *pdev)
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)
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);