Commit 1a656a80 authored by Théo Lebrun's avatar Théo Lebrun Committed by Linus Walleij

pinctrl: nomadik: follow type-system kernel coding conventions

Fix strict checkpatch warnings relative to types. Warning types
addressed:

   WARNING: do not add new typedefs
   WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
   WARNING: static const char * array should probably be static const
            char * const

Total messages before: 1 errors, 40 warnings, 39 checks.
Total messages after:  1 errors,  2 warnings, 38 checks.
Signed-off-by: default avatarThéo Lebrun <theo.lebrun@bootlin.com>
Link: https://lore.kernel.org/r/20240228-mbly-gpio-v2-11-3ba757474006@bootlin.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent dfeaf5e7
...@@ -71,8 +71,6 @@ ...@@ -71,8 +71,6 @@
* PIN_CFG - default config with alternate function * PIN_CFG - default config with alternate function
*/ */
typedef unsigned long pin_cfg_t;
#define PIN_NUM_MASK 0x1ff #define PIN_NUM_MASK 0x1ff
#define PIN_NUM(x) ((x) & PIN_NUM_MASK) #define PIN_NUM(x) ((x) & PIN_NUM_MASK)
...@@ -215,7 +213,7 @@ struct nmk_gpio_chip *nmk_gpio_chips[NMK_MAX_BANKS]; ...@@ -215,7 +213,7 @@ struct nmk_gpio_chip *nmk_gpio_chips[NMK_MAX_BANKS];
DEFINE_SPINLOCK(nmk_gpio_slpm_lock); DEFINE_SPINLOCK(nmk_gpio_slpm_lock);
static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip,
unsigned offset, int gpio_mode) unsigned int offset, int gpio_mode)
{ {
u32 afunc, bfunc; u32 afunc, bfunc;
...@@ -230,7 +228,7 @@ static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip, ...@@ -230,7 +228,7 @@ static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip,
} }
static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip,
unsigned offset, enum nmk_gpio_pull pull) unsigned int offset, enum nmk_gpio_pull pull)
{ {
u32 pdis; u32 pdis;
...@@ -254,7 +252,7 @@ static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip, ...@@ -254,7 +252,7 @@ static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip,
} }
static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip,
unsigned offset, bool lowemi) unsigned int offset, bool lowemi)
{ {
bool enabled = nmk_chip->lowemi & BIT(offset); bool enabled = nmk_chip->lowemi & BIT(offset);
...@@ -271,13 +269,13 @@ static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip, ...@@ -271,13 +269,13 @@ static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip,
} }
static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip,
unsigned offset) unsigned int offset)
{ {
writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRC); writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRC);
} }
static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip, static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip,
unsigned offset, int gpio_mode, unsigned int offset, int gpio_mode,
bool glitch) bool glitch)
{ {
u32 rwimsc = nmk_chip->rwimsc; u32 rwimsc = nmk_chip->rwimsc;
...@@ -304,7 +302,7 @@ static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip, ...@@ -304,7 +302,7 @@ static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip,
} }
static void static void
nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset) nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned int offset)
{ {
u32 falling = nmk_chip->fimsc & BIT(offset); u32 falling = nmk_chip->fimsc & BIT(offset);
u32 rising = nmk_chip->rimsc & BIT(offset); u32 rising = nmk_chip->rimsc & BIT(offset);
...@@ -343,7 +341,7 @@ static void nmk_write_masked(void __iomem *reg, u32 mask, u32 value) ...@@ -343,7 +341,7 @@ static void nmk_write_masked(void __iomem *reg, u32 mask, u32 value)
} }
static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct, static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct,
unsigned offset, unsigned alt_num) unsigned int offset, unsigned int alt_num)
{ {
int i; int i;
u16 reg; u16 reg;
...@@ -515,15 +513,15 @@ static int nmk_get_groups_cnt(struct pinctrl_dev *pctldev) ...@@ -515,15 +513,15 @@ static int nmk_get_groups_cnt(struct pinctrl_dev *pctldev)
} }
static const char *nmk_get_group_name(struct pinctrl_dev *pctldev, static const char *nmk_get_group_name(struct pinctrl_dev *pctldev,
unsigned selector) unsigned int selector)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
return npct->soc->groups[selector].grp.name; return npct->soc->groups[selector].grp.name;
} }
static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
const unsigned **pins, const unsigned int **pins,
unsigned int *num_pins) unsigned int *num_pins)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
...@@ -533,7 +531,7 @@ static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -533,7 +531,7 @@ static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned pin) static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned int pin)
{ {
int i; int i;
struct nmk_gpio_chip *nmk_gpio; struct nmk_gpio_chip *nmk_gpio;
...@@ -549,7 +547,7 @@ static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned pin) ...@@ -549,7 +547,7 @@ static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned pin)
return NULL; return NULL;
} }
static struct gpio_chip *find_gc_from_pin(unsigned pin) static struct gpio_chip *find_gc_from_pin(unsigned int pin)
{ {
struct nmk_gpio_chip *nmk_gpio = find_nmk_gpio_from_pin(pin); struct nmk_gpio_chip *nmk_gpio = find_nmk_gpio_from_pin(pin);
...@@ -559,7 +557,7 @@ static struct gpio_chip *find_gc_from_pin(unsigned pin) ...@@ -559,7 +557,7 @@ static struct gpio_chip *find_gc_from_pin(unsigned pin)
} }
static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned offset) unsigned int offset)
{ {
struct gpio_chip *chip = find_gc_from_pin(offset); struct gpio_chip *chip = find_gc_from_pin(offset);
...@@ -570,8 +568,8 @@ static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, ...@@ -570,8 +568,8 @@ static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset); nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset);
} }
static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned int *reserved_maps,
unsigned *num_maps, const char *group, unsigned int *num_maps, const char *group,
const char *function) const char *function)
{ {
if (*num_maps == *reserved_maps) if (*num_maps == *reserved_maps)
...@@ -586,9 +584,9 @@ static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, ...@@ -586,9 +584,9 @@ static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps,
} }
static int nmk_dt_add_map_configs(struct pinctrl_map **map, static int nmk_dt_add_map_configs(struct pinctrl_map **map,
unsigned *reserved_maps, unsigned int *reserved_maps,
unsigned *num_maps, const char *group, unsigned int *num_maps, const char *group,
unsigned long *configs, unsigned num_configs) unsigned long *configs, unsigned int num_configs)
{ {
unsigned long *dup_configs; unsigned long *dup_configs;
...@@ -727,8 +725,8 @@ static bool nmk_pinctrl_dt_get_config(struct device_node *np, ...@@ -727,8 +725,8 @@ static bool nmk_pinctrl_dt_get_config(struct device_node *np,
static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct device_node *np, struct device_node *np,
struct pinctrl_map **map, struct pinctrl_map **map,
unsigned *reserved_maps, unsigned int *reserved_maps,
unsigned *num_maps) unsigned int *num_maps)
{ {
int ret; int ret;
const char *function = NULL; const char *function = NULL;
...@@ -795,9 +793,9 @@ static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, ...@@ -795,9 +793,9 @@ static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
static int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, static int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np_config, struct device_node *np_config,
struct pinctrl_map **map, unsigned *num_maps) struct pinctrl_map **map, unsigned int *num_maps)
{ {
unsigned reserved_maps; unsigned int reserved_maps;
struct device_node *np; struct device_node *np;
int ret; int ret;
...@@ -835,7 +833,7 @@ static int nmk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev) ...@@ -835,7 +833,7 @@ static int nmk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev)
} }
static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev, static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev,
unsigned function) unsigned int function)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
...@@ -843,7 +841,7 @@ static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev, ...@@ -843,7 +841,7 @@ static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev,
} }
static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev, static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev,
unsigned function, unsigned int function,
const char * const **groups, const char * const **groups,
unsigned * const num_groups) unsigned * const num_groups)
{ {
...@@ -855,8 +853,8 @@ static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev, ...@@ -855,8 +853,8 @@ static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function, static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned int function,
unsigned group) unsigned int group)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
const struct nmk_pingroup *g; const struct nmk_pingroup *g;
...@@ -915,7 +913,7 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function, ...@@ -915,7 +913,7 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function,
for (i = 0; i < g->grp.npins; i++) { for (i = 0; i < g->grp.npins; i++) {
struct nmk_gpio_chip *nmk_chip; struct nmk_gpio_chip *nmk_chip;
unsigned bit; unsigned int bit;
nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i]); nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i]);
if (!nmk_chip) { if (!nmk_chip) {
...@@ -968,12 +966,12 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function, ...@@ -968,12 +966,12 @@ static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function,
static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned int offset)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
struct nmk_gpio_chip *nmk_chip; struct nmk_gpio_chip *nmk_chip;
struct gpio_chip *chip; struct gpio_chip *chip;
unsigned bit; unsigned int bit;
if (!range) { if (!range) {
dev_err(npct->dev, "invalid range\n"); dev_err(npct->dev, "invalid range\n");
...@@ -999,7 +997,7 @@ static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, ...@@ -999,7 +997,7 @@ static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev, static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned int offset)
{ {
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
...@@ -1017,30 +1015,30 @@ static const struct pinmux_ops nmk_pinmux_ops = { ...@@ -1017,30 +1015,30 @@ static const struct pinmux_ops nmk_pinmux_ops = {
.strict = true, .strict = true,
}; };
static int nmk_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin, static int nmk_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
unsigned long *config) unsigned long *config)
{ {
/* Not implemented */ /* Not implemented */
return -EINVAL; return -EINVAL;
} }
static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
unsigned long *configs, unsigned num_configs) unsigned long *configs, unsigned int num_configs)
{ {
static const char *pullnames[] = { static const char * const pullnames[] = {
[NMK_GPIO_PULL_NONE] = "none", [NMK_GPIO_PULL_NONE] = "none",
[NMK_GPIO_PULL_UP] = "up", [NMK_GPIO_PULL_UP] = "up",
[NMK_GPIO_PULL_DOWN] = "down", [NMK_GPIO_PULL_DOWN] = "down",
[3] /* illegal */ = "??" [3] /* illegal */ = "??"
}; };
static const char *slpmnames[] = { static const char * const slpmnames[] = {
[NMK_GPIO_SLPM_INPUT] = "input/wakeup", [NMK_GPIO_SLPM_INPUT] = "input/wakeup",
[NMK_GPIO_SLPM_NOCHANGE] = "no-change/no-wakeup", [NMK_GPIO_SLPM_NOCHANGE] = "no-change/no-wakeup",
}; };
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
struct nmk_gpio_chip *nmk_chip; struct nmk_gpio_chip *nmk_chip;
unsigned bit; unsigned int bit;
pin_cfg_t cfg; unsigned long cfg;
int pull, slpm, output, val, i; int pull, slpm, output, val, i;
bool lowemi, gpiomode, sleep; bool lowemi, gpiomode, sleep;
...@@ -1057,7 +1055,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -1057,7 +1055,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
* here we just ignore that part. It's being handled by the * here we just ignore that part. It's being handled by the
* framework and pinmux callback respectively. * framework and pinmux callback respectively.
*/ */
cfg = (pin_cfg_t) configs[i]; cfg = configs[i];
pull = PIN_PULL(cfg); pull = PIN_PULL(cfg);
slpm = PIN_SLPM(cfg); slpm = PIN_SLPM(cfg);
output = PIN_DIR(cfg); output = PIN_DIR(cfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment