From: Linus Walleij Date: Tue, 20 Nov 2012 13:54:18 +0000 (+0100) Subject: pinctrl: make range registration defer properly X-Git-Tag: v3.8-rc1~188^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfa9751548444caadda2d6de1a2b67e05b34c2aa;p=thirdparty%2Fkernel%2Flinux.git pinctrl: make range registration defer properly This makes the pinctrl_find_and_add_gpio_range() return -EPROBE_DEFER if the range hosting pin controller cannot be located. We may assume that the common case for why adding a range fails is that the targe pin controller device has not probed yet. Reviewed-by: Stephen Warren Reviewed-by: Viresh Kumar Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 15f5ac864f14f..33af811a6a3cd 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -350,8 +350,13 @@ struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname, { struct pinctrl_dev *pctldev = get_pinctrl_dev_from_devname(devname); + /* + * If we can't find this device, let's assume that is because + * it has not probed yet, so the driver trying to register this + * range need to defer probing. + */ if (!pctldev) - return NULL; + return ERR_PTR(-EPROBE_DEFER); pinctrl_add_gpio_range(pctldev, range); return pctldev;