pinctrl: nomadik: use gpiochip data pointer

This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Linus Walleij 2015-12-03 15:44:46 +01:00
Родитель 827c93dae7
Коммит 68ab012600
1 изменённых файлов: 10 добавлений и 15 удалений

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

@ -646,7 +646,7 @@ static inline int nmk_gpio_get_bitmask(int gpio)
static void nmk_gpio_irq_ack(struct irq_data *d) static void nmk_gpio_irq_ack(struct irq_data *d)
{ {
struct gpio_chip *chip = irq_data_get_irq_chip_data(d); struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
clk_enable(nmk_chip->clk); clk_enable(nmk_chip->clk);
writel(nmk_gpio_get_bitmask(d->hwirq), nmk_chip->addr + NMK_GPIO_IC); writel(nmk_gpio_get_bitmask(d->hwirq), nmk_chip->addr + NMK_GPIO_IC);
@ -863,7 +863,7 @@ static void __nmk_gpio_irq_handler(struct irq_desc *desc, u32 status)
static void nmk_gpio_irq_handler(struct irq_desc *desc) static void nmk_gpio_irq_handler(struct irq_desc *desc)
{ {
struct gpio_chip *chip = irq_desc_get_handler_data(desc); struct gpio_chip *chip = irq_desc_get_handler_data(desc);
struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
u32 status; u32 status;
clk_enable(nmk_chip->clk); clk_enable(nmk_chip->clk);
@ -876,7 +876,7 @@ static void nmk_gpio_irq_handler(struct irq_desc *desc)
static void nmk_gpio_latent_irq_handler(struct irq_desc *desc) static void nmk_gpio_latent_irq_handler(struct irq_desc *desc)
{ {
struct gpio_chip *chip = irq_desc_get_handler_data(desc); struct gpio_chip *chip = irq_desc_get_handler_data(desc);
struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
u32 status = nmk_chip->get_latent_status(nmk_chip->bank); u32 status = nmk_chip->get_latent_status(nmk_chip->bank);
__nmk_gpio_irq_handler(desc, status); __nmk_gpio_irq_handler(desc, status);
@ -886,8 +886,7 @@ static void nmk_gpio_latent_irq_handler(struct irq_desc *desc)
static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
{ {
struct nmk_gpio_chip *nmk_chip = struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
container_of(chip, struct nmk_gpio_chip, chip);
clk_enable(nmk_chip->clk); clk_enable(nmk_chip->clk);
@ -900,8 +899,7 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
{ {
struct nmk_gpio_chip *nmk_chip = struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
container_of(chip, struct nmk_gpio_chip, chip);
u32 bit = 1 << offset; u32 bit = 1 << offset;
int value; int value;
@ -917,8 +915,7 @@ static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
int val) int val)
{ {
struct nmk_gpio_chip *nmk_chip = struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
container_of(chip, struct nmk_gpio_chip, chip);
clk_enable(nmk_chip->clk); clk_enable(nmk_chip->clk);
@ -930,8 +927,7 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
int val) int val)
{ {
struct nmk_gpio_chip *nmk_chip = struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
container_of(chip, struct nmk_gpio_chip, chip);
clk_enable(nmk_chip->clk); clk_enable(nmk_chip->clk);
@ -951,8 +947,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
unsigned offset, unsigned gpio) unsigned offset, unsigned gpio)
{ {
const char *label = gpiochip_is_requested(chip, offset); const char *label = gpiochip_is_requested(chip, offset);
struct nmk_gpio_chip *nmk_chip = struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
container_of(chip, struct nmk_gpio_chip, chip);
int mode; int mode;
bool is_out; bool is_out;
bool data_out; bool data_out;
@ -1278,7 +1273,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
clk_disable(nmk_chip->clk); clk_disable(nmk_chip->clk);
chip->of_node = np; chip->of_node = np;
ret = gpiochip_add(chip); ret = gpiochip_add_data(chip, nmk_chip);
if (ret) if (ret)
return ret; return ret;
@ -1789,7 +1784,7 @@ static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
return -EINVAL; return -EINVAL;
} }
chip = range->gc; chip = range->gc;
nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); nmk_chip = gpiochip_get_data(chip);
dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset); dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset);