mirror of https://github.com/hak5/openwrt.git
ar71xx: add some pending patches
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37849lede-17.01
parent
a4c2853261
commit
dd421c00a2
|
@ -0,0 +1,70 @@
|
||||||
|
From 59a93f8909b8ab5d61e024e8b3771fdf94a774f0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Julia Lawall <Julia.Lawall@lip6.fr>
|
||||||
|
Date: Mon, 19 Aug 2013 10:51:56 +0200
|
||||||
|
Subject: [PATCH] MIPS: ath79: simplify platform_get_resource_byname/devm_ioremap_resource
|
||||||
|
|
||||||
|
Remove unneeded error handling on the result of a call to
|
||||||
|
platform_get_resource_byname when the value is passed to devm_ioremap_resource.
|
||||||
|
|
||||||
|
A simplified version of the semantic patch that makes this change is as
|
||||||
|
follows: (http://coccinelle.lip6.fr/)
|
||||||
|
|
||||||
|
// <smpl>
|
||||||
|
@@
|
||||||
|
expression pdev,res,e,e1;
|
||||||
|
expression ret != 0;
|
||||||
|
identifier l;
|
||||||
|
@@
|
||||||
|
|
||||||
|
res = platform_get_resource_byname(...);
|
||||||
|
- if (res == NULL) { ... \(goto l;\|return ret;\) }
|
||||||
|
e = devm_ioremap_resource(e1, res);
|
||||||
|
// </smpl>
|
||||||
|
|
||||||
|
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
|
||||||
|
Acked-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
---
|
||||||
|
arch/mips/pci/pci-ar71xx.c | 3 ---
|
||||||
|
arch/mips/pci/pci-ar724x.c | 9 ---------
|
||||||
|
2 files changed, 12 deletions(-)
|
||||||
|
|
||||||
|
--- a/arch/mips/pci/pci-ar71xx.c
|
||||||
|
+++ b/arch/mips/pci/pci-ar71xx.c
|
||||||
|
@@ -363,9 +363,6 @@ static int ar71xx_pci_probe(struct platf
|
||||||
|
spin_lock_init(&apc->lock);
|
||||||
|
|
||||||
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
|
||||||
|
- if (!res)
|
||||||
|
- return -EINVAL;
|
||||||
|
-
|
||||||
|
apc->cfg_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(apc->cfg_base))
|
||||||
|
return PTR_ERR(apc->cfg_base);
|
||||||
|
--- a/arch/mips/pci/pci-ar724x.c
|
||||||
|
+++ b/arch/mips/pci/pci-ar724x.c
|
||||||
|
@@ -362,25 +362,16 @@ static int ar724x_pci_probe(struct platf
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
|
||||||
|
- if (!res)
|
||||||
|
- return -EINVAL;
|
||||||
|
-
|
||||||
|
apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(apc->ctrl_base))
|
||||||
|
return PTR_ERR(apc->ctrl_base);
|
||||||
|
|
||||||
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
|
||||||
|
- if (!res)
|
||||||
|
- return -EINVAL;
|
||||||
|
-
|
||||||
|
apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(apc->devcfg_base))
|
||||||
|
return PTR_ERR(apc->devcfg_base);
|
||||||
|
|
||||||
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
|
||||||
|
- if (!res)
|
||||||
|
- return -EINVAL;
|
||||||
|
-
|
||||||
|
apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
if (IS_ERR(apc->crp_base))
|
||||||
|
return PTR_ERR(apc->crp_base);
|
|
@ -0,0 +1,42 @@
|
||||||
|
From 8b7a76e72fc819753878cd5684e243f33f847c79 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Markos Chandras <markos.chandras@imgtec.com>
|
||||||
|
Date: Wed, 21 Aug 2013 11:47:22 +0100
|
||||||
|
Subject: [PATCH] MIPS: ath79: Avoid using unitialized 'reg' variable
|
||||||
|
|
||||||
|
Fixes the following build error:
|
||||||
|
arch/mips/include/asm/mach-ath79/ath79.h:139:20: error: 'reg' may be used
|
||||||
|
uninitialized in this function [-Werror=maybe-uninitialized]
|
||||||
|
arch/mips/ath79/common.c:62:6: note: 'reg' was declared here
|
||||||
|
In file included from arch/mips/ath79/common.c:20:0:
|
||||||
|
arch/mips/ath79/common.c: In function 'ath79_device_reset_clear':
|
||||||
|
arch/mips/include/asm/mach-ath79/ath79.h:139:20:
|
||||||
|
error: 'reg' may be used uninitialized in this function
|
||||||
|
[-Werror=maybe-uninitialized]
|
||||||
|
arch/mips/ath79/common.c:90:6: note: 'reg' was declared here
|
||||||
|
|
||||||
|
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
|
||||||
|
Acked-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
---
|
||||||
|
arch/mips/ath79/common.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/arch/mips/ath79/common.c
|
||||||
|
+++ b/arch/mips/ath79/common.c
|
||||||
|
@@ -75,7 +75,7 @@ void ath79_device_reset_set(u32 mask)
|
||||||
|
else if (soc_is_qca955x())
|
||||||
|
reg = QCA955X_RESET_REG_RESET_MODULE;
|
||||||
|
else
|
||||||
|
- BUG();
|
||||||
|
+ panic("Reset register not defined for this SOC");
|
||||||
|
|
||||||
|
spin_lock_irqsave(&ath79_device_reset_lock, flags);
|
||||||
|
t = ath79_reset_rr(reg);
|
||||||
|
@@ -103,7 +103,7 @@ void ath79_device_reset_clear(u32 mask)
|
||||||
|
else if (soc_is_qca955x())
|
||||||
|
reg = QCA955X_RESET_REG_RESET_MODULE;
|
||||||
|
else
|
||||||
|
- BUG();
|
||||||
|
+ panic("Reset register not defined for this SOC");
|
||||||
|
|
||||||
|
spin_lock_irqsave(&ath79_device_reset_lock, flags);
|
||||||
|
t = ath79_reset_rr(reg);
|
|
@ -0,0 +1,72 @@
|
||||||
|
From f157945cd134e2cfa47ed9bb1f599632d112d94e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
Date: Mon, 29 Jul 2013 19:39:20 +0200
|
||||||
|
Subject: [PATCH] tty: ar933x_uart: convert to use devm_* functions
|
||||||
|
|
||||||
|
Use devm_* functions in order to simplify cleanup
|
||||||
|
paths.
|
||||||
|
|
||||||
|
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||||
|
---
|
||||||
|
drivers/tty/serial/ar933x_uart.c | 26 ++++++++------------------
|
||||||
|
1 file changed, 8 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/tty/serial/ar933x_uart.c
|
||||||
|
+++ b/drivers/tty/serial/ar933x_uart.c
|
||||||
|
@@ -652,19 +652,18 @@ static int ar933x_uart_probe(struct plat
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- up = kzalloc(sizeof(struct ar933x_uart_port), GFP_KERNEL);
|
||||||
|
+ up = devm_kzalloc(&pdev->dev, sizeof(struct ar933x_uart_port),
|
||||||
|
+ GFP_KERNEL);
|
||||||
|
if (!up)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
port = &up->port;
|
||||||
|
- port->mapbase = mem_res->start;
|
||||||
|
|
||||||
|
- port->membase = ioremap(mem_res->start, AR933X_UART_REGS_SIZE);
|
||||||
|
- if (!port->membase) {
|
||||||
|
- ret = -ENOMEM;
|
||||||
|
- goto err_free_up;
|
||||||
|
- }
|
||||||
|
+ port->membase = devm_ioremap_resource(&pdev->dev, mem_res);
|
||||||
|
+ if (IS_ERR(port->membase))
|
||||||
|
+ return PTR_ERR(port->membase);
|
||||||
|
|
||||||
|
+ port->mapbase = mem_res->start;
|
||||||
|
port->line = id;
|
||||||
|
port->irq = irq_res->start;
|
||||||
|
port->dev = &pdev->dev;
|
||||||
|
@@ -686,16 +685,10 @@ static int ar933x_uart_probe(struct plat
|
||||||
|
|
||||||
|
ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
|
||||||
|
if (ret)
|
||||||
|
- goto err_unmap;
|
||||||
|
+ return ret;
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, up);
|
||||||
|
return 0;
|
||||||
|
-
|
||||||
|
-err_unmap:
|
||||||
|
- iounmap(up->port.membase);
|
||||||
|
-err_free_up:
|
||||||
|
- kfree(up);
|
||||||
|
- return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ar933x_uart_remove(struct platform_device *pdev)
|
||||||
|
@@ -705,11 +698,8 @@ static int ar933x_uart_remove(struct pla
|
||||||
|
up = platform_get_drvdata(pdev);
|
||||||
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
|
- if (up) {
|
||||||
|
+ if (up)
|
||||||
|
uart_remove_one_port(&ar933x_uart_driver, &up->port);
|
||||||
|
- iounmap(up->port.membase);
|
||||||
|
- kfree(up);
|
||||||
|
- }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue