Skip to content

Commit

Permalink
pinctrl: add more info to error msgs in pin_request
Browse files Browse the repository at this point in the history
Additionally print which pin the request failed for, which entity already
claimed it, and what entity was trying to claim it.

Remove duplicate device name from a debug message.

Clean up some indentation.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Stephen Warren authored and Linus Walleij committed May 7, 2012
1 parent 1772311 commit d470531
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/pinctrl/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ static int pin_request(struct pinctrl_dev *pctldev,
desc = pin_desc_get(pctldev, pin);
if (desc == NULL) {
dev_err(pctldev->dev,
"pin is not registered so it cannot be requested\n");
"pin %d is not registered so it cannot be requested\n",
pin);
goto out;
}

Expand All @@ -103,15 +104,17 @@ static int pin_request(struct pinctrl_dev *pctldev,
/* There's no need to support multiple GPIO requests */
if (desc->gpio_owner) {
dev_err(pctldev->dev,
"pin already requested\n");
"pin %s already requested by %s; cannot claim for %s\n",
desc->name, desc->gpio_owner, owner);
goto out;
}

desc->gpio_owner = owner;
} else {
if (desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
dev_err(pctldev->dev,
"pin already requested\n");
"pin %s already requested by %s; cannot claim for %s\n",
desc->name, desc->mux_owner, owner);
goto out;
}

Expand Down Expand Up @@ -144,8 +147,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
status = 0;

if (status) {
dev_err(pctldev->dev, "request on device %s failed for pin %d\n",
pctldev->desc->name, pin);
dev_err(pctldev->dev, "request() failed for pin %d\n", pin);
module_put(pctldev->owner);
}

Expand All @@ -162,7 +164,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
out:
if (status)
dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
pin, owner, status);
pin, owner, status);

return status;
}
Expand Down

0 comments on commit d470531

Please sign in to comment.