[OpenWrt-Devel] [PATCH 2/8] ramips: mt7621-gpio: Sync staging cleanup commits
Rosen Penev
rosenp at gmail.com
Wed May 30 02:36:33 EDT 2018
remove redundant owner assignments of drivers
mt7621: make symbol gc_map static
Include the right header
prefer unsigned int to bare unsigned
fix some warnings because of lines exceeded 80 characters
add SPDX identifier
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
.../files-4.14/drivers/gpio/gpio-mt7621.c | 42 ++++++++++---------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c b/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
index 9ee4a0ea42..a57738125b 100644
--- a/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
+++ b/target/linux/ramips/files-4.14/drivers/gpio/gpio-mt7621.c
@@ -1,15 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
/*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
* Copyright (C) 2009-2011 Gabor Juhos <juhosg at openwrt.org>
* Copyright (C) 2013 John Crispin <blogic at openwrt.org>
*/
#include <linux/io.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
#include <linux/module.h>
#include <linux/of_irq.h>
#include <linux/spinlock.h>
@@ -37,9 +34,8 @@ enum mediatek_gpio_reg {
static void __iomem *mediatek_gpio_membase;
static int mediatek_gpio_irq;
static struct irq_domain *mediatek_gpio_irq_domain;
-static atomic_t irq_refcount = ATOMIC_INIT(0);
-struct mtk_gc {
+static struct mtk_gc {
struct gpio_chip chip;
spinlock_t lock;
int bank;
@@ -66,11 +62,13 @@ mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val)
static inline u32
mtk_gpio_r32(struct mtk_gc *rg, u8 reg)
{
- return ioread32(mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 0x4));
+ u32 offset = (reg * 0x10) + (rg->bank * 0x4);
+
+ return ioread32(mediatek_gpio_membase + offset);
}
static void
-mediatek_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+mediatek_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
@@ -78,7 +76,7 @@ mediatek_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
}
static int
-mediatek_gpio_get(struct gpio_chip *chip, unsigned offset)
+mediatek_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
@@ -86,7 +84,7 @@ mediatek_gpio_get(struct gpio_chip *chip, unsigned offset)
}
static int
-mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
+mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
unsigned long flags;
@@ -103,7 +101,7 @@ mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int
mediatek_gpio_direction_output(struct gpio_chip *chip,
- unsigned offset, int value)
+ unsigned int offset, int value)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
unsigned long flags;
@@ -120,7 +118,7 @@ mediatek_gpio_direction_output(struct gpio_chip *chip,
}
static int
-mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
+mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
unsigned long flags;
@@ -137,11 +135,12 @@ mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
}
static int
-mediatek_gpio_to_irq(struct gpio_chip *chip, unsigned pin)
+mediatek_gpio_to_irq(struct gpio_chip *chip, unsigned int pin)
{
struct mtk_gc *rg = to_mediatek_gpio(chip);
- return irq_create_mapping(mediatek_gpio_irq_domain, pin + (rg->bank * MTK_BANK_WIDTH));
+ return irq_create_mapping(mediatek_gpio_irq_domain,
+ pin + (rg->bank * MTK_BANK_WIDTH));
}
static int
@@ -198,7 +197,8 @@ mediatek_gpio_irq_handler(struct irq_desc *desc)
pending = mtk_gpio_r32(rg, GPIO_REG_STAT);
for_each_set_bit(bit, &pending, MTK_BANK_WIDTH) {
- u32 map = irq_find_mapping(mediatek_gpio_irq_domain, (MTK_BANK_WIDTH * i) + bit);
+ u32 map = irq_find_mapping(mediatek_gpio_irq_domain,
+ (MTK_BANK_WIDTH * i) + bit);
generic_handle_irq(map);
mtk_gpio_w32(rg, GPIO_REG_STAT, BIT(bit));
@@ -288,9 +288,11 @@ static struct irq_chip mediatek_gpio_irq_chip = {
};
static int
-mediatek_gpio_gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
+mediatek_gpio_gpio_map(struct irq_domain *d, unsigned int irq,
+ irq_hw_number_t hw)
{
- irq_set_chip_and_handler(irq, &mediatek_gpio_irq_chip, handle_level_irq);
+ irq_set_chip_and_handler(irq, &mediatek_gpio_irq_chip,
+ handle_level_irq);
irq_set_handler_data(irq, d);
return 0;
@@ -325,7 +327,8 @@ mediatek_gpio_probe(struct platform_device *pdev)
mediatek_gpio_bank_probe(pdev, bank);
if (mediatek_gpio_irq_domain)
- irq_set_chained_handler(mediatek_gpio_irq, mediatek_gpio_irq_handler);
+ irq_set_chained_handler(mediatek_gpio_irq,
+ mediatek_gpio_irq_handler);
return 0;
}
@@ -340,7 +343,6 @@ static struct platform_driver mediatek_gpio_driver = {
.probe = mediatek_gpio_probe,
.driver = {
.name = "mt7621_gpio",
- .owner = THIS_MODULE,
.of_match_table = mediatek_gpio_match,
},
};
--
2.17.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list