diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-02-01 16:27:57 +0100 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-02-08 10:35:59 +0100 |
commit | 322b86e7a73042300303844c9bc51bf6995a47ef (patch) | |
tree | 8617213c624390837c14382bdc751d3e185910b6 /drivers/gpio/gpiolib.c | |
parent | gpiolib: Introduce for_each_gpio_desc_with_flag() macro (diff) | |
download | linux-322b86e7a73042300303844c9bc51bf6995a47ef.tar.xz linux-322b86e7a73042300303844c9bc51bf6995a47ef.zip |
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e3702bc1b533..daedf8207173 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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 * 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 == -EBUSY && flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE) { /* * This happens when there are several consumers for * 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. * * FIXME: Make this more sane and safe. */ - dev_info(dev, "nonexclusive access to GPIO for %s\n", - con_id ? con_id : devname); + dev_info(dev, "nonexclusive access to GPIO for %s\n", con_id ?: devname); return desc; } else { return ERR_PTR(ret); |