提交 322b86e7 编写于 作者: A Andy Shevchenko 提交者: Bartosz Golaszewski

gpiolib: Use short form of ternary operator in gpiod_get_index()

Instead of repeating first argument for true branch, use short
form of the ternary operator, i.e. ?:.

While at it, fix a typo in the comment.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NBartosz Golaszewski <brgl@bgdev.pl>
上级 80c78fbe
...@@ -3931,19 +3931,18 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, ...@@ -3931,19 +3931,18 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
* If a connection label was passed use that, else attempt to use * If a connection label was passed use that, else attempt to use
* the device name as label * the device name as label
*/ */
ret = gpiod_request(desc, con_id ? con_id : devname); ret = gpiod_request(desc, con_id ?: devname);
if (ret) { if (ret) {
if (ret == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) { if (ret == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) {
/* /*
* This happens when there are several consumers for * This happens when there are several consumers for
* the same GPIO line: we just return here without * the same GPIO line: we just return here without
* further initialization. It is a bit if a hack. * further initialization. It is a bit of a hack.
* This is necessary to support fixed regulators. * This is necessary to support fixed regulators.
* *
* FIXME: Make this more sane and safe. * FIXME: Make this more sane and safe.
*/ */
dev_info(dev, "nonexclusive access to GPIO for %s\n", dev_info(dev, "nonexclusive access to GPIO for %s\n", con_id ?: devname);
con_id ? con_id : devname);
return desc; return desc;
} else { } else {
return ERR_PTR(ret); return ERR_PTR(ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册