mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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
					
				
					 3 changed files with 14 additions and 16 deletions
				
			
		| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#include <linux/cleanup.h>
 | 
					#include <linux/cleanup.h>
 | 
				
			||||||
#include <linux/clk.h>
 | 
					#include <linux/clk.h>
 | 
				
			||||||
 | 
					#include <linux/gpio/consumer.h>
 | 
				
			||||||
#include <linux/gpio/driver.h>
 | 
					#include <linux/gpio/driver.h>
 | 
				
			||||||
#include <linux/interrupt.h>
 | 
					#include <linux/interrupt.h>
 | 
				
			||||||
#include <linux/kernel.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,
 | 
					void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
 | 
				
			||||||
			   struct gpio_chip *chip, unsigned int offset,
 | 
								   struct gpio_chip *chip, unsigned int offset)
 | 
				
			||||||
			   unsigned int gpio)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
 | 
						struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
 | 
				
			||||||
 | 
						struct gpio_desc *desc;
 | 
				
			||||||
	int mode;
 | 
						int mode;
 | 
				
			||||||
	bool is_out;
 | 
						bool is_out;
 | 
				
			||||||
	bool data_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));
 | 
						data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset));
 | 
				
			||||||
	mode = nmk_gpio_get_mode(nmk_chip, offset);
 | 
						mode = nmk_gpio_get_mode(nmk_chip, offset);
 | 
				
			||||||
#ifdef CONFIG_PINCTRL_NOMADIK
 | 
					#ifdef CONFIG_PINCTRL_NOMADIK
 | 
				
			||||||
	if (mode == NMK_GPIO_ALT_C && pctldev)
 | 
						if (mode == NMK_GPIO_ALT_C && pctldev) {
 | 
				
			||||||
		mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio);
 | 
							desc = gpio_device_get_desc(chip->gpiodev, offset);
 | 
				
			||||||
 | 
							mode = nmk_prcm_gpiocr_get_mode(pctldev, desc_to_gpio(desc));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (is_out) {
 | 
						if (is_out) {
 | 
				
			||||||
		seq_printf(s, " gpio-%-3d (%-20.20s) out %s           %s",
 | 
							seq_printf(s, " gpio-%-3d (%-20.20s) out %s           %s",
 | 
				
			||||||
			   gpio,
 | 
								   offset, label ?: "(none)", str_hi_lo(data_out),
 | 
				
			||||||
			   label ?: "(none)",
 | 
					 | 
				
			||||||
			   str_hi_lo(data_out),
 | 
					 | 
				
			||||||
			   (mode < 0) ? "unknown" : modes[mode]);
 | 
								   (mode < 0) ? "unknown" : modes[mode]);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		int irq = chip->to_irq(chip, offset);
 | 
							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",
 | 
							seq_printf(s, " gpio-%-3d (%-20.20s) in  %s %s",
 | 
				
			||||||
			   gpio,
 | 
								   offset, label ?: "(none)", pulls[pullidx],
 | 
				
			||||||
			   label ?: "(none)",
 | 
					 | 
				
			||||||
			   pulls[pullidx],
 | 
					 | 
				
			||||||
			   (mode < 0) ? "unknown" : modes[mode]);
 | 
								   (mode < 0) ? "unknown" : modes[mode]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		val = nmk_gpio_get_input(chip, offset);
 | 
							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)
 | 
					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++) {
 | 
						for (i = 0; i < chip->ngpio; i++) {
 | 
				
			||||||
		nmk_gpio_dbg_show_one(s, NULL, chip, i, gpio);
 | 
							nmk_gpio_dbg_show_one(s, NULL, chip, i);
 | 
				
			||||||
		seq_puts(s, "\n");
 | 
							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");
 | 
							seq_printf(s, "invalid pin offset");
 | 
				
			||||||
		return;
 | 
							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,
 | 
					static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned int *reserved_maps,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -261,8 +261,7 @@ struct platform_device;
 | 
				
			||||||
 * true.
 | 
					 * true.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
 | 
					void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
 | 
				
			||||||
			   struct gpio_chip *chip, unsigned int offset,
 | 
								   struct gpio_chip *chip, unsigned int offset);
 | 
				
			||||||
			   unsigned int gpio);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue