Skip to content

Commit 36b94e0

Browse files
newearth-ssopsiff
authored andcommitted
gpio: phytium: Add irq clear macro and delete redundant code
Add irq clear macro definitions as 0xffffffff to make the code more standardized. And delete the redundant code about "is_resuming" variable initialization. Mainline: Open-Source Signed-off-by: Cui Fulong <cuifulong2112@phytium.com.cn> Signed-off-by: Li Yuze <liyuze@phytium.com.cn> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
1 parent 1265540 commit 36b94e0

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/gpio/gpio-phytium-core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define NGPIO_DEFAULT 8
3333
#define NGPIO_MAX 32
3434
#define GPIO_PORT_STRIDE (GPIO_EXT_PORTB - GPIO_EXT_PORTA)
35+
#define GPIO_CLEAR_IRQ 0xffffffff
3536

3637
#define PHYTIUM_GPIO_DRIVER_VERSION "1.1.2"
3738

drivers/gpio/gpio-phytium-pci.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static int phytium_gpio_pci_probe(struct pci_dev *pdev, const struct pci_device_
7474
raw_spin_lock_init(&gpio->lock);
7575

7676
writel(0, gpio->regs + GPIO_INTEN);
77-
writel(0xffffffff, gpio->regs + GPIO_PORTA_EOI);
77+
writel(GPIO_CLEAR_IRQ, gpio->regs + GPIO_PORTA_EOI);
7878

7979
gpio->gc.base = -1;
8080
gpio->gc.get_direction = phytium_gpio_get_direction;
@@ -90,7 +90,6 @@ static int phytium_gpio_pci_probe(struct pci_dev *pdev, const struct pci_device_
9090
girq = &gpio->gc.irq;
9191
girq->handler = handle_bad_irq;
9292
girq->default_type = IRQ_TYPE_NONE;
93-
gpio->is_resuming = 0;
9493

9594
girq->num_parents = 1;
9695
girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
@@ -171,7 +170,7 @@ static int phytium_gpio_pci_resume(struct device *dev)
171170
writel(gpio->ctx.int_polarity, gpio->regs + GPIO_INT_POLARITY);
172171
writel(gpio->ctx.debounce, gpio->regs + GPIO_DEBOUNCE);
173172

174-
writel(0xffffffff, gpio->regs + GPIO_PORTA_EOI);
173+
writel(GPIO_CLEAR_IRQ, gpio->regs + GPIO_PORTA_EOI);
175174

176175
writel(gpio->ctx.inten, gpio->regs + GPIO_INTEN);
177176
gpio->is_resuming = 0;

drivers/gpio/gpio-phytium-platform.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int phytium_gpio_probe(struct platform_device *pdev)
9393
raw_spin_lock_init(&gpio->lock);
9494

9595
writel(0, gpio->regs + GPIO_INTEN);
96-
writel(0xffffffff, gpio->regs + GPIO_PORTA_EOI);
96+
writel(GPIO_CLEAR_IRQ, gpio->regs + GPIO_PORTA_EOI);
9797

9898
gpio->gc.base = -1;
9999
gpio->gc.get_direction = phytium_gpio_get_direction;
@@ -109,7 +109,6 @@ static int phytium_gpio_probe(struct platform_device *pdev)
109109
girq = &gpio->gc.irq;
110110
girq->handler = handle_bad_irq;
111111
girq->default_type = IRQ_TYPE_NONE;
112-
gpio->is_resuming = 0;
113112

114113
for (irq_count = 0; irq_count < platform_irq_count(pdev); irq_count++) {
115114
gpio->irq[irq_count] = -ENXIO;
@@ -187,7 +186,7 @@ static int phytium_gpio_resume(struct device *dev)
187186
writel(gpio->ctx.int_polarity, gpio->regs + GPIO_INT_POLARITY);
188187
writel(gpio->ctx.debounce, gpio->regs + GPIO_DEBOUNCE);
189188

190-
writel(0xffffffff, gpio->regs + GPIO_PORTA_EOI);
189+
writel(GPIO_CLEAR_IRQ, gpio->regs + GPIO_PORTA_EOI);
191190

192191
writel(gpio->ctx.inten, gpio->regs + GPIO_INTEN);
193192
gpio->is_resuming = 0;

0 commit comments

Comments
 (0)