Commit 94ce944b authored by Tomasz Figa's avatar Tomasz Figa

pinctrl: samsung: Constify samsung_pin_bank_type struct

This structure is not intended to be modified at runtime and functions
as constant data shared between multiple pin banks. This patch makes all
instances of it constant across the driver.
Signed-off-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
parent e06deff9
...@@ -46,12 +46,12 @@ static inline struct exynos_irq_chip *to_exynos_irq_chip(struct irq_chip *chip) ...@@ -46,12 +46,12 @@ static inline struct exynos_irq_chip *to_exynos_irq_chip(struct irq_chip *chip)
return container_of(chip, struct exynos_irq_chip, chip); return container_of(chip, struct exynos_irq_chip, chip);
} }
static struct samsung_pin_bank_type bank_type_off = { static const struct samsung_pin_bank_type bank_type_off = {
.fld_width = { 4, 1, 2, 2, 2, 2, }, .fld_width = { 4, 1, 2, 2, 2, 2, },
.reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, }, .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
}; };
static struct samsung_pin_bank_type bank_type_alive = { static const struct samsung_pin_bank_type bank_type_alive = {
.fld_width = { 4, 1, 2, 2, }, .fld_width = { 4, 1, 2, 2, },
.reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
}; };
...@@ -171,7 +171,7 @@ static int exynos_irq_request_resources(struct irq_data *irqd) ...@@ -171,7 +171,7 @@ static int exynos_irq_request_resources(struct irq_data *irqd)
struct irq_chip *chip = irq_data_get_irq_chip(irqd); struct irq_chip *chip = irq_data_get_irq_chip(irqd);
struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip);
struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
struct samsung_pin_bank_type *bank_type = bank->type; const struct samsung_pin_bank_type *bank_type = bank->type;
struct samsung_pinctrl_drv_data *d = bank->drvdata; struct samsung_pinctrl_drv_data *d = bank->drvdata;
unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq;
unsigned long reg_con = our_chip->eint_con + bank->eint_offset; unsigned long reg_con = our_chip->eint_con + bank->eint_offset;
...@@ -210,7 +210,7 @@ static void exynos_irq_release_resources(struct irq_data *irqd) ...@@ -210,7 +210,7 @@ static void exynos_irq_release_resources(struct irq_data *irqd)
struct irq_chip *chip = irq_data_get_irq_chip(irqd); struct irq_chip *chip = irq_data_get_irq_chip(irqd);
struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip);
struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
struct samsung_pin_bank_type *bank_type = bank->type; const struct samsung_pin_bank_type *bank_type = bank->type;
struct samsung_pinctrl_drv_data *d = bank->drvdata; struct samsung_pinctrl_drv_data *d = bank->drvdata;
unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq; unsigned int shift = EXYNOS_EINT_CON_LEN * irqd->hwirq;
unsigned long reg_con = our_chip->eint_con + bank->eint_offset; unsigned long reg_con = our_chip->eint_con + bank->eint_offset;
......
...@@ -44,12 +44,12 @@ ...@@ -44,12 +44,12 @@
#define EINT_EDGE_BOTH 6 #define EINT_EDGE_BOTH 6
#define EINT_MASK 0xf #define EINT_MASK 0xf
static struct samsung_pin_bank_type bank_type_1bit = { static const struct samsung_pin_bank_type bank_type_1bit = {
.fld_width = { 1, 1, }, .fld_width = { 1, 1, },
.reg_offset = { 0x00, 0x04, }, .reg_offset = { 0x00, 0x04, },
}; };
static struct samsung_pin_bank_type bank_type_2bit = { static const struct samsung_pin_bank_type bank_type_2bit = {
.fld_width = { 2, 1, 2, }, .fld_width = { 2, 1, 2, },
.reg_offset = { 0x00, 0x04, 0x08, }, .reg_offset = { 0x00, 0x04, 0x08, },
}; };
...@@ -143,7 +143,7 @@ static void s3c24xx_eint_set_handler(unsigned int irq, unsigned int type) ...@@ -143,7 +143,7 @@ static void s3c24xx_eint_set_handler(unsigned int irq, unsigned int type)
static void s3c24xx_eint_set_function(struct samsung_pinctrl_drv_data *d, static void s3c24xx_eint_set_function(struct samsung_pinctrl_drv_data *d,
struct samsung_pin_bank *bank, int pin) struct samsung_pin_bank *bank, int pin)
{ {
struct samsung_pin_bank_type *bank_type = bank->type; const struct samsung_pin_bank_type *bank_type = bank->type;
unsigned long flags; unsigned long flags;
void __iomem *reg; void __iomem *reg;
u8 shift; u8 shift;
......
...@@ -68,32 +68,32 @@ ...@@ -68,32 +68,32 @@
#define EINT_CON_MASK 0xF #define EINT_CON_MASK 0xF
#define EINT_CON_LEN 4 #define EINT_CON_LEN 4
static struct samsung_pin_bank_type bank_type_4bit_off = { static const struct samsung_pin_bank_type bank_type_4bit_off = {
.fld_width = { 4, 1, 2, 0, 2, 2, }, .fld_width = { 4, 1, 2, 0, 2, 2, },
.reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, }, .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, },
}; };
static struct samsung_pin_bank_type bank_type_4bit_alive = { static const struct samsung_pin_bank_type bank_type_4bit_alive = {
.fld_width = { 4, 1, 2, }, .fld_width = { 4, 1, 2, },
.reg_offset = { 0x00, 0x04, 0x08, }, .reg_offset = { 0x00, 0x04, 0x08, },
}; };
static struct samsung_pin_bank_type bank_type_4bit2_off = { static const struct samsung_pin_bank_type bank_type_4bit2_off = {
.fld_width = { 4, 1, 2, 0, 2, 2, }, .fld_width = { 4, 1, 2, 0, 2, 2, },
.reg_offset = { 0x00, 0x08, 0x0c, 0, 0x10, 0x14, }, .reg_offset = { 0x00, 0x08, 0x0c, 0, 0x10, 0x14, },
}; };
static struct samsung_pin_bank_type bank_type_4bit2_alive = { static const struct samsung_pin_bank_type bank_type_4bit2_alive = {
.fld_width = { 4, 1, 2, }, .fld_width = { 4, 1, 2, },
.reg_offset = { 0x00, 0x08, 0x0c, }, .reg_offset = { 0x00, 0x08, 0x0c, },
}; };
static struct samsung_pin_bank_type bank_type_2bit_off = { static const struct samsung_pin_bank_type bank_type_2bit_off = {
.fld_width = { 2, 1, 2, 0, 2, 2, }, .fld_width = { 2, 1, 2, 0, 2, 2, },
.reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, }, .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, },
}; };
static struct samsung_pin_bank_type bank_type_2bit_alive = { static const struct samsung_pin_bank_type bank_type_2bit_alive = {
.fld_width = { 2, 1, 2, }, .fld_width = { 2, 1, 2, },
.reg_offset = { 0x00, 0x04, 0x08, }, .reg_offset = { 0x00, 0x04, 0x08, },
}; };
...@@ -272,7 +272,7 @@ static void s3c64xx_irq_set_handler(unsigned int irq, unsigned int type) ...@@ -272,7 +272,7 @@ static void s3c64xx_irq_set_handler(unsigned int irq, unsigned int type)
static void s3c64xx_irq_set_function(struct samsung_pinctrl_drv_data *d, static void s3c64xx_irq_set_function(struct samsung_pinctrl_drv_data *d,
struct samsung_pin_bank *bank, int pin) struct samsung_pin_bank *bank, int pin)
{ {
struct samsung_pin_bank_type *bank_type = bank->type; const struct samsung_pin_bank_type *bank_type = bank->type;
unsigned long flags; unsigned long flags;
void __iomem *reg; void __iomem *reg;
u8 shift; u8 shift;
......
...@@ -366,7 +366,7 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -366,7 +366,7 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector,
unsigned group, bool enable) unsigned group, bool enable)
{ {
struct samsung_pinctrl_drv_data *drvdata; struct samsung_pinctrl_drv_data *drvdata;
struct samsung_pin_bank_type *type; const struct samsung_pin_bank_type *type;
struct samsung_pin_bank *bank; struct samsung_pin_bank *bank;
void __iomem *reg; void __iomem *reg;
u32 mask, shift, data, pin_offset; u32 mask, shift, data, pin_offset;
...@@ -422,7 +422,7 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -422,7 +422,7 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin,
unsigned long *config, bool set) unsigned long *config, bool set)
{ {
struct samsung_pinctrl_drv_data *drvdata; struct samsung_pinctrl_drv_data *drvdata;
struct samsung_pin_bank_type *type; const struct samsung_pin_bank_type *type;
struct samsung_pin_bank *bank; struct samsung_pin_bank *bank;
void __iomem *reg_base; void __iomem *reg_base;
enum pincfg_type cfg_type = PINCFG_UNPACK_TYPE(*config); enum pincfg_type cfg_type = PINCFG_UNPACK_TYPE(*config);
...@@ -528,7 +528,7 @@ static const struct pinconf_ops samsung_pinconf_ops = { ...@@ -528,7 +528,7 @@ static const struct pinconf_ops samsung_pinconf_ops = {
static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
{ {
struct samsung_pin_bank *bank = gc_to_pin_bank(gc); struct samsung_pin_bank *bank = gc_to_pin_bank(gc);
struct samsung_pin_bank_type *type = bank->type; const struct samsung_pin_bank_type *type = bank->type;
unsigned long flags; unsigned long flags;
void __iomem *reg; void __iomem *reg;
u32 data; u32 data;
...@@ -552,7 +552,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) ...@@ -552,7 +552,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset)
void __iomem *reg; void __iomem *reg;
u32 data; u32 data;
struct samsung_pin_bank *bank = gc_to_pin_bank(gc); struct samsung_pin_bank *bank = gc_to_pin_bank(gc);
struct samsung_pin_bank_type *type = bank->type; const struct samsung_pin_bank_type *type = bank->type;
reg = bank->drvdata->virt_base + bank->pctl_offset; reg = bank->drvdata->virt_base + bank->pctl_offset;
...@@ -569,7 +569,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) ...@@ -569,7 +569,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset)
static int samsung_gpio_set_direction(struct gpio_chip *gc, static int samsung_gpio_set_direction(struct gpio_chip *gc,
unsigned offset, bool input) unsigned offset, bool input)
{ {
struct samsung_pin_bank_type *type; const struct samsung_pin_bank_type *type;
struct samsung_pin_bank *bank; struct samsung_pin_bank *bank;
struct samsung_pinctrl_drv_data *drvdata; struct samsung_pinctrl_drv_data *drvdata;
void __iomem *reg; void __iomem *reg;
...@@ -1089,9 +1089,8 @@ static void samsung_pinctrl_suspend_dev( ...@@ -1089,9 +1089,8 @@ static void samsung_pinctrl_suspend_dev(
for (i = 0; i < ctrl->nr_banks; i++) { for (i = 0; i < ctrl->nr_banks; i++) {
struct samsung_pin_bank *bank = &ctrl->pin_banks[i]; struct samsung_pin_bank *bank = &ctrl->pin_banks[i];
void __iomem *reg = virt_base + bank->pctl_offset; void __iomem *reg = virt_base + bank->pctl_offset;
const u8 *offs = bank->type->reg_offset;
u8 *offs = bank->type->reg_offset; const u8 *widths = bank->type->fld_width;
u8 *widths = bank->type->fld_width;
enum pincfg_type type; enum pincfg_type type;
/* Registers without a powerdown config aren't lost */ /* Registers without a powerdown config aren't lost */
...@@ -1140,9 +1139,8 @@ static void samsung_pinctrl_resume_dev(struct samsung_pinctrl_drv_data *drvdata) ...@@ -1140,9 +1139,8 @@ static void samsung_pinctrl_resume_dev(struct samsung_pinctrl_drv_data *drvdata)
for (i = 0; i < ctrl->nr_banks; i++) { for (i = 0; i < ctrl->nr_banks; i++) {
struct samsung_pin_bank *bank = &ctrl->pin_banks[i]; struct samsung_pin_bank *bank = &ctrl->pin_banks[i];
void __iomem *reg = virt_base + bank->pctl_offset; void __iomem *reg = virt_base + bank->pctl_offset;
const u8 *offs = bank->type->reg_offset;
u8 *offs = bank->type->reg_offset; const u8 *widths = bank->type->fld_width;
u8 *widths = bank->type->fld_width;
enum pincfg_type type; enum pincfg_type type;
/* Registers without a powerdown config aren't lost */ /* Registers without a powerdown config aren't lost */
......
...@@ -131,7 +131,7 @@ struct samsung_pin_bank_type { ...@@ -131,7 +131,7 @@ struct samsung_pin_bank_type {
* @pm_save: saved register values during suspend * @pm_save: saved register values during suspend
*/ */
struct samsung_pin_bank { struct samsung_pin_bank {
struct samsung_pin_bank_type *type; const struct samsung_pin_bank_type *type;
u32 pctl_offset; u32 pctl_offset;
u32 pin_base; u32 pin_base;
u8 nr_pins; u8 nr_pins;
......
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