gpiolib: acpi: Consolidate debug output in acpi_gpio_update_gpiod_flags()

We have the duplicated debug strings printed whenever
acpi_gpio_update_gpiod_flags() fails. Instead of doing this by callers,
move the debug output inside function.

In one case convert almost useless pr_debug() to dev_dbg() where
actual consumer of GPIO resource is disclosed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Andy Shevchenko 2017-11-10 15:40:31 +02:00 коммит произвёл Linus Walleij
Родитель 5870cff47b
Коммит 5c34b6c146
3 изменённых файлов: 19 добавлений и 12 удалений

Просмотреть файл

@ -461,8 +461,8 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio)
} }
} }
int static int
acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update) __acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
{ {
int ret = 0; int ret = 0;
@ -489,6 +489,19 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
return ret; return ret;
} }
int
acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
{
struct device *dev = &info->adev->dev;
int ret;
ret = __acpi_gpio_update_gpiod_flags(flags, info->flags);
if (ret)
dev_dbg(dev, "Override GPIO initialization flags\n");
return ret;
}
struct acpi_gpio_lookup { struct acpi_gpio_lookup {
struct acpi_gpio_info info; struct acpi_gpio_info info;
int index; int index;
@ -661,7 +674,6 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
struct acpi_gpio_info info; struct acpi_gpio_info info;
struct gpio_desc *desc; struct gpio_desc *desc;
char propname[32]; char propname[32];
int err;
int i; int i;
/* Try first from _DSD */ /* Try first from _DSD */
@ -700,10 +712,7 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
if (info.polarity == GPIO_ACTIVE_LOW) if (info.polarity == GPIO_ACTIVE_LOW)
*lookupflags |= GPIO_ACTIVE_LOW; *lookupflags |= GPIO_ACTIVE_LOW;
err = acpi_gpio_update_gpiod_flags(dflags, info.flags); acpi_gpio_update_gpiod_flags(dflags, &info);
if (err)
dev_dbg(dev, "Override GPIO initialization flags\n");
return desc; return desc;
} }

Просмотреть файл

@ -3681,9 +3681,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
desc = acpi_node_get_gpiod(fwnode, propname, index, &info); desc = acpi_node_get_gpiod(fwnode, propname, index, &info);
if (!IS_ERR(desc)) { if (!IS_ERR(desc)) {
active_low = info.polarity == GPIO_ACTIVE_LOW; active_low = info.polarity == GPIO_ACTIVE_LOW;
ret = acpi_gpio_update_gpiod_flags(&dflags, info.flags); acpi_gpio_update_gpiod_flags(&dflags, &info);
if (ret)
pr_debug("Override GPIO initialization flags\n");
} }
} }

Просмотреть файл

@ -126,7 +126,7 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, int acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags,
enum gpiod_flags update); struct acpi_gpio_info *info);
struct gpio_desc *acpi_find_gpio(struct device *dev, struct gpio_desc *acpi_find_gpio(struct device *dev,
const char *con_id, const char *con_id,
@ -151,7 +151,7 @@ static inline void
acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
static inline int static inline int
acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update) acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *info)
{ {
return 0; return 0;
} }