From fd8bc783821145bace1c64ca9e2d2cc0b453b901 Mon Sep 17 00:00:00 2001 From: juhosg Date: Tue, 27 Aug 2013 18:06:49 +0000 Subject: ar71xx: add some pending patches Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37849 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...simplify-platform_get_resource_byname-dev.patch | 70 +++++++++++++++++++++ ...th79-Avoid-using-unitialized-reg-variable.patch | 42 +++++++++++++ ...r933x_uart-convert-to-use-devm_-functions.patch | 72 ++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 target/linux/ar71xx/patches-3.10/101-MIPS-ath79-simplify-platform_get_resource_byname-dev.patch create mode 100644 target/linux/ar71xx/patches-3.10/102-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch create mode 100644 target/linux/ar71xx/patches-3.10/103-tty-ar933x_uart-convert-to-use-devm_-functions.patch (limited to 'target/linux/ar71xx') diff --git a/target/linux/ar71xx/patches-3.10/101-MIPS-ath79-simplify-platform_get_resource_byname-dev.patch b/target/linux/ar71xx/patches-3.10/101-MIPS-ath79-simplify-platform_get_resource_byname-dev.patch new file mode 100644 index 0000000000..04e2a25467 --- /dev/null +++ b/target/linux/ar71xx/patches-3.10/101-MIPS-ath79-simplify-platform_get_resource_byname-dev.patch @@ -0,0 +1,70 @@ +From 59a93f8909b8ab5d61e024e8b3771fdf94a774f0 Mon Sep 17 00:00:00 2001 +From: Julia Lawall +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/) + +// +@@ +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); +// + +Signed-off-by: Julia Lawall +Acked-by: Gabor Juhos +--- + 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); diff --git a/target/linux/ar71xx/patches-3.10/102-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch b/target/linux/ar71xx/patches-3.10/102-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch new file mode 100644 index 0000000000..79c7ab01ab --- /dev/null +++ b/target/linux/ar71xx/patches-3.10/102-MIPS-ath79-Avoid-using-unitialized-reg-variable.patch @@ -0,0 +1,42 @@ +From 8b7a76e72fc819753878cd5684e243f33f847c79 Mon Sep 17 00:00:00 2001 +From: Markos Chandras +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 +Acked-by: Gabor Juhos +--- + 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); diff --git a/target/linux/ar71xx/patches-3.10/103-tty-ar933x_uart-convert-to-use-devm_-functions.patch b/target/linux/ar71xx/patches-3.10/103-tty-ar933x_uart-convert-to-use-devm_-functions.patch new file mode 100644 index 0000000000..fab6f23416 --- /dev/null +++ b/target/linux/ar71xx/patches-3.10/103-tty-ar933x_uart-convert-to-use-devm_-functions.patch @@ -0,0 +1,72 @@ +From f157945cd134e2cfa47ed9bb1f599632d112d94e Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +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 +--- + 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; + } -- cgit v1.2.3