diff options
author | 2016-04-11 10:41:07 +0300 | |
---|---|---|
committer | 2016-04-13 08:17:18 +0300 | |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/pinctrl/core.c | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/pinctrl/core.c')
-rw-r--r-- | kernel/drivers/pinctrl/core.c | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/kernel/drivers/pinctrl/core.c b/kernel/drivers/pinctrl/core.c index 18ee2089d..2686a4450 100644 --- a/kernel/drivers/pinctrl/core.c +++ b/kernel/drivers/pinctrl/core.c @@ -231,8 +231,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev, pindesc = pin_desc_get(pctldev, number); if (pindesc != NULL) { - pr_err("pin %d already registered on %s\n", number, - pctldev->desc->name); + dev_err(pctldev->dev, "pin %d already registered\n", number); return -EINVAL; } @@ -350,6 +349,9 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) struct pinctrl_gpio_range *range = NULL; struct gpio_chip *chip = gpio_to_chip(gpio); + if (WARN(!chip, "no gpio_chip for gpio%i?", gpio)) + return false; + mutex_lock(&pinctrldev_list_mutex); /* Loop over the pin controllers */ @@ -558,7 +560,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, } /** - * pinctrl_request_gpio() - request a single pin to be used in as GPIO + * pinctrl_request_gpio() - request a single pin to be used as GPIO * @gpio: the GPIO pin number from the GPIO subsystem number space * * This function should *ONLY* be used from gpiolib-based GPIO drivers, @@ -1115,7 +1117,7 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, int i, ret; struct pinctrl_maps *maps_node; - pr_debug("add %d pinmux maps\n", num_maps); + pr_debug("add %u pinctrl maps\n", num_maps); /* First sanity check the new mapping */ for (i = 0; i < num_maps; i++) { @@ -1238,6 +1240,38 @@ int pinctrl_force_default(struct pinctrl_dev *pctldev) } EXPORT_SYMBOL_GPL(pinctrl_force_default); +/** + * pinctrl_init_done() - tell pinctrl probe is done + * + * We'll use this time to switch the pins from "init" to "default" unless the + * driver selected some other state. + * + * @dev: device to that's done probing + */ +int pinctrl_init_done(struct device *dev) +{ + struct dev_pin_info *pins = dev->pins; + int ret; + + if (!pins) + return 0; + + if (IS_ERR(pins->init_state)) + return 0; /* No such state */ + + if (pins->p->state != pins->init_state) + return 0; /* Not at init anyway */ + + if (IS_ERR(pins->default_state)) + return 0; /* No default state */ + + ret = pinctrl_select_state(pins->p, pins->default_state); + if (ret) + dev_err(dev, "failed to activate default pinctrl state\n"); + + return ret; +} + #ifdef CONFIG_PM /** @@ -1704,14 +1738,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, int ret; if (!pctldesc) - return NULL; + return ERR_PTR(-EINVAL); if (!pctldesc->name) - return NULL; + return ERR_PTR(-EINVAL); pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); if (pctldev == NULL) { dev_err(dev, "failed to alloc struct pinctrl_dev\n"); - return NULL; + return ERR_PTR(-ENOMEM); } /* Initialize pin control device struct */ @@ -1724,20 +1758,23 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, mutex_init(&pctldev->mutex); /* check core ops for sanity */ - if (pinctrl_check_ops(pctldev)) { + ret = pinctrl_check_ops(pctldev); + if (ret) { dev_err(dev, "pinctrl ops lacks necessary functions\n"); goto out_err; } /* If we're implementing pinmuxing, check the ops for sanity */ if (pctldesc->pmxops) { - if (pinmux_check_ops(pctldev)) + ret = pinmux_check_ops(pctldev); + if (ret) goto out_err; } /* If we're implementing pinconfig, check the ops for sanity */ if (pctldesc->confops) { - if (pinconf_check_ops(pctldev)) + ret = pinconf_check_ops(pctldev); + if (ret) goto out_err; } @@ -1783,7 +1820,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, out_err: mutex_destroy(&pctldev->mutex); kfree(pctldev); - return NULL; + return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(pinctrl_register); |