diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-06-01 11:30:55 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-06-01 13:16:24 +0200 |
commit | 53364c7ba4b25d6e3f428605254c50d5dfaaa430 (patch) | |
tree | 5528ac3f88246b9eb000a39d7539fe016938e059 /drivers/staging | |
parent | 1e2735fe1b49cfa5dd668f61778aaaa46c6fe1c8 (diff) | |
download | linux-53364c7ba4b25d6e3f428605254c50d5dfaaa430.tar.bz2 |
staging: mt7621-gpio: change gc_map to don't use pointers
There is no special gain in using pointers for 'gc_map' inside
'mtk_data' structure. We know the number of banks which is fixed
to MTK_BANK_CNT and we can just statically allocate them without
using kernel allocators.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/mt7621-gpio/gpio-mt7621.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c index 390cc56b3ac4..3192fc8616b6 100644 --- a/drivers/staging/mt7621-gpio/gpio-mt7621.c +++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c @@ -45,7 +45,7 @@ struct mtk_data { void __iomem *gpio_membase; int gpio_irq; struct irq_domain *gpio_irq_domain; - struct mtk_gc *gc_map[MTK_BANK_CNT]; + struct mtk_gc gc_map[MTK_BANK_CNT]; }; static inline struct mtk_gc * @@ -152,11 +152,8 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node *bank) if (!id || be32_to_cpu(*id) >= MTK_BANK_CNT) return -EINVAL; - rg = devm_kzalloc(&pdev->dev, sizeof(struct mtk_gc), GFP_KERNEL); - if (!rg) - return -ENOMEM; - - gpio_data->gc_map[be32_to_cpu(*id)] = rg; + rg = &gpio_data->gc_map[be32_to_cpu(*id)]; + memset(rg, 0, sizeof(*rg)); spin_lock_init(&rg->lock); @@ -196,7 +193,7 @@ mediatek_gpio_irq_handler(struct irq_desc *desc) int i; for (i = 0; i < MTK_BANK_CNT; i++) { - struct mtk_gc *rg = gpio_data->gc_map[i]; + struct mtk_gc *rg = &gpio_data->gc_map[i]; unsigned long pending; int bit; @@ -221,7 +218,7 @@ mediatek_gpio_irq_unmask(struct irq_data *d) struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d); int pin = d->hwirq; int bank = pin / MTK_BANK_WIDTH; - struct mtk_gc *rg = gpio_data->gc_map[bank]; + struct mtk_gc *rg = &gpio_data->gc_map[bank]; unsigned long flags; u32 rise, fall; @@ -242,7 +239,7 @@ mediatek_gpio_irq_mask(struct irq_data *d) struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d); int pin = d->hwirq; int bank = pin / MTK_BANK_WIDTH; - struct mtk_gc *rg = gpio_data->gc_map[bank]; + struct mtk_gc *rg = &gpio_data->gc_map[bank]; unsigned long flags; u32 rise, fall; @@ -263,7 +260,7 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type) struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d); int pin = d->hwirq; int bank = pin / MTK_BANK_WIDTH; - struct mtk_gc *rg = gpio_data->gc_map[bank]; + struct mtk_gc *rg = &gpio_data->gc_map[bank]; u32 mask = PIN_MASK(pin); if (!rg) |