gpio: nomadik: don't print out global GPIO numbers in debugfs callbacks
In order to further limit the number of references to the GPIO base number stored in struct gpio_chip, replace the global GPIO numbers in the output of debugfs callbacks by hardware offsets. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250826-gpio-dbg-show-base-v1-2-7f27cd7f2256@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
246b889c70
commit
ddeb66d2cb
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
|
@ -396,10 +397,10 @@ static int nmk_gpio_get_mode(struct nmk_gpio_chip *nmk_chip, int offset)
|
|||
}
|
||||
|
||||
void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
|
||||
struct gpio_chip *chip, unsigned int offset,
|
||||
unsigned int gpio)
|
||||
struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
|
||||
struct gpio_desc *desc;
|
||||
int mode;
|
||||
bool is_out;
|
||||
bool data_out;
|
||||
|
@ -425,15 +426,15 @@ void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
|
|||
data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset));
|
||||
mode = nmk_gpio_get_mode(nmk_chip, offset);
|
||||
#ifdef CONFIG_PINCTRL_NOMADIK
|
||||
if (mode == NMK_GPIO_ALT_C && pctldev)
|
||||
mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio);
|
||||
if (mode == NMK_GPIO_ALT_C && pctldev) {
|
||||
desc = gpio_device_get_desc(chip->gpiodev, offset);
|
||||
mode = nmk_prcm_gpiocr_get_mode(pctldev, desc_to_gpio(desc));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_out) {
|
||||
seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s",
|
||||
gpio,
|
||||
label ?: "(none)",
|
||||
str_hi_lo(data_out),
|
||||
offset, label ?: "(none)", str_hi_lo(data_out),
|
||||
(mode < 0) ? "unknown" : modes[mode]);
|
||||
} else {
|
||||
int irq = chip->to_irq(chip, offset);
|
||||
|
@ -445,9 +446,7 @@ void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
|
|||
};
|
||||
|
||||
seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s",
|
||||
gpio,
|
||||
label ?: "(none)",
|
||||
pulls[pullidx],
|
||||
offset, label ?: "(none)", pulls[pullidx],
|
||||
(mode < 0) ? "unknown" : modes[mode]);
|
||||
|
||||
val = nmk_gpio_get_input(chip, offset);
|
||||
|
@ -479,10 +478,10 @@ void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
|
|||
|
||||
static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
|
||||
{
|
||||
unsigned int i, gpio = chip->base;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < chip->ngpio; i++, gpio++) {
|
||||
nmk_gpio_dbg_show_one(s, NULL, chip, i, gpio);
|
||||
for (i = 0; i < chip->ngpio; i++) {
|
||||
nmk_gpio_dbg_show_one(s, NULL, chip, i);
|
||||
seq_puts(s, "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -584,7 +584,7 @@ static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
|
|||
seq_printf(s, "invalid pin offset");
|
||||
return;
|
||||
}
|
||||
nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset);
|
||||
nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base);
|
||||
}
|
||||
|
||||
static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned int *reserved_maps,
|
||||
|
|
|
@ -261,8 +261,7 @@ struct platform_device;
|
|||
* true.
|
||||
*/
|
||||
void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
|
||||
struct gpio_chip *chip, unsigned int offset,
|
||||
unsigned int gpio);
|
||||
struct gpio_chip *chip, unsigned int offset);
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in New Issue