From 8c939402e43b21ea8ac031b7f751fa0c6b0faf00 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 12 Dec 2011 15:04:29 -0800 Subject: [PATCH 01/10] unicore32: standardize /proc/iomem "Kernel code" name All other ports use "Kernel code" to identify the Kernel text segment in /proc/iomem. Change the unicore32 resources to do the same. Signed-off-by: Kees Cook Acked-by: Arnd Bergmann --- arch/unicore32/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c index 673d7a89d8ff..87adbf5ebfe0 100644 --- a/arch/unicore32/kernel/setup.c +++ b/arch/unicore32/kernel/setup.c @@ -65,7 +65,7 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; */ static struct resource mem_res[] = { { - .name = "Kernel text", + .name = "Kernel code", .start = 0, .end = 0, .flags = IORESOURCE_MEM From eb52d5801302a3515506891c13338fbaa7222f36 Mon Sep 17 00:00:00 2001 From: Yu Yue Date: Fri, 26 Aug 2011 18:03:42 +0800 Subject: [PATCH 02/10] of: add include asm/setup.h in drivers/of/fdt.c In the file drivers/of/fdt.c, it uses the COMMAND_LINE_SIZE which is stated in asm/setup.h, so asm/setup.h should be included in drivers/of/fdt.c. Signed-off-by: Yu Yue Signed-off-by: Guan Xuetao Cc: Grant Likerly Cc: devicetree-discuss@lists.ozlabs.org Cc: Arnd Bergmann --- drivers/of/fdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 91a375fb6ae6..ea2bd1be2640 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -23,6 +23,7 @@ #include #endif /* CONFIG_PPC */ +#include #include char *of_fdt_get_string(struct boot_param_header *blob, u32 offset) From 62439a2954b9027c9ec481e1d39cd5d63f7c1b17 Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Thu, 18 Aug 2011 15:43:10 +0800 Subject: [PATCH 03/10] unicore32: delete specified xlate_dev_mem_ptr For the commit has changed xlate_dev_mem_ptr definition in asm-generic/io.h for the systems with an MMU, so delete it from unicore32 specified io.h. Signed-off-by: Guan Xuetao Cc: Arnd Bergmann Cc: Jonas Bonn --- arch/unicore32/include/asm/io.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h index 1a5c5a5eb39c..a75ad0b117cc 100644 --- a/arch/unicore32/include/asm/io.h +++ b/arch/unicore32/include/asm/io.h @@ -39,13 +39,6 @@ extern void __uc32_iounmap(volatile void __iomem *addr); #define ioremap_cached(cookie, size) __uc32_ioremap_cached(cookie, size) #define iounmap(cookie) __uc32_iounmap(cookie) -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access - */ -#undef xlate_dev_mem_ptr -#define xlate_dev_mem_ptr(p) __va(p) - #define HAVE_ARCH_PIO_SIZE #define PIO_OFFSET (unsigned int)(PCI_IOBASE) #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) From a50e4213e71adc7dde0d514aabd8af7275fee39f Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Thu, 18 Aug 2011 15:38:05 +0800 Subject: [PATCH 04/10] unicore32: add ioremap_nocache definition Bugfix for following error messages: lib/iomap.c: In function 'pci_iomap': lib/iomap.c:274: error: implicit declaration of function 'ioremap_nocache' lib/iomap.c:274: warning: return makes pointer from integer without a cast Also see commit it will hide the ioremap_nocache function for systems with an MMU Signed-off-by: Guan Xuetao Cc: Arnd Bergmann Cc: Jonas Bonn --- arch/unicore32/include/asm/io.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h index a75ad0b117cc..adddf6d64077 100644 --- a/arch/unicore32/include/asm/io.h +++ b/arch/unicore32/include/asm/io.h @@ -37,6 +37,7 @@ extern void __uc32_iounmap(volatile void __iomem *addr); */ #define ioremap(cookie, size) __uc32_ioremap(cookie, size) #define ioremap_cached(cookie, size) __uc32_ioremap_cached(cookie, size) +#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size) #define iounmap(cookie) __uc32_iounmap(cookie) #define HAVE_ARCH_PIO_SIZE From 7037bd803e24d4fdaa87f27456e686aafb061277 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Thu, 11 Aug 2011 14:57:06 +0100 Subject: [PATCH 05/10] unicore32: Use set_current_blocked() As described in e6fa16ab ("signal: sigprocmask() should do retarget_shared_pending()") the modification of current->blocked is incorrect as we need to check whether the signal we're about to block is pending in the shared queue. Cc: Oleg Nesterov Cc: Guan Xuetao Signed-off-by: Matt Fleming Cc: Arnd Bergmann Acked-by: Guan Xuetao --- arch/unicore32/kernel/signal.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/unicore32/kernel/signal.c b/arch/unicore32/kernel/signal.c index b163fca56789..911b549a6df5 100644 --- a/arch/unicore32/kernel/signal.c +++ b/arch/unicore32/kernel/signal.c @@ -63,10 +63,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); if (err == 0) { sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); + set_current_blocked(&set); } err |= __get_user(regs->UCreg_00, &sf->uc.uc_mcontext.regs.UCreg_00); @@ -321,6 +318,7 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, { struct thread_info *thread = current_thread_info(); struct task_struct *tsk = current; + sigset_t blocked; int usig = sig; int ret; @@ -372,13 +370,10 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, /* * Block the signal if we were successful. */ - spin_lock_irq(&tsk->sighand->siglock); - sigorsets(&tsk->blocked, &tsk->blocked, - &ka->sa.sa_mask); + sigorsets(&blocked, &tsk->blocked, &ka->sa.sa_mask); if (!(ka->sa.sa_flags & SA_NODEFER)) - sigaddset(&tsk->blocked, sig); - recalc_sigpending(); - spin_unlock_irq(&tsk->sighand->siglock); + sigaddset(&blocked, sig); + set_current_blocked(&blocked); return 0; } From 86abc23ed146522b276f63032574f358bcfe0392 Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Wed, 7 Sep 2011 16:10:19 +0800 Subject: [PATCH 06/10] unicore32: Remove IRQF_DISABLED This flag is a NOOP and can be removed now. Signed-off-by: Yong Zhang --- arch/unicore32/kernel/puv3-nb0916.c | 4 ++-- arch/unicore32/kernel/time.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c index 37b12a06b499..181108b8ecce 100644 --- a/arch/unicore32/kernel/puv3-nb0916.c +++ b/arch/unicore32/kernel/puv3-nb0916.c @@ -123,7 +123,7 @@ int __init mach_nb0916_init(void) if (request_irq(gpio_to_irq(GPI_LCD_CASE_OFF), &nb0916_lcdcaseoff_handler, - IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "NB0916 lcd case off", NULL) < 0) { printk(KERN_DEBUG "LCD-Case-OFF IRQ %d not available\n", @@ -131,7 +131,7 @@ int __init mach_nb0916_init(void) } if (request_irq(gpio_to_irq(GPI_OTP_INT), &nb0916_overheat_handler, - IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "NB0916 overheating protection", NULL) < 0) { printk(KERN_DEBUG "Overheating Protection IRQ %d not available\n", diff --git a/arch/unicore32/kernel/time.c b/arch/unicore32/kernel/time.c index 080710c09241..d3824b2ff644 100644 --- a/arch/unicore32/kernel/time.c +++ b/arch/unicore32/kernel/time.c @@ -86,7 +86,7 @@ static struct clocksource cksrc_puv3_oscr = { static struct irqaction puv3_timer_irq = { .name = "ost0", - .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, + .flags = IRQF_TIMER | IRQF_IRQPOLL, .handler = puv3_ost0_interrupt, .dev_id = &ckevt_puv3_osmr0, }; From a9196b0bd3284fa3388998c9208a708a8f2e4c83 Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Fri, 23 Dec 2011 09:15:39 +0800 Subject: [PATCH 07/10] rtc-puv3: irq: remove IRQF_DISABLED This flag is deprecated, so is removed now. Signed-off-by: Yong Zhang Signed-off-by: Guan Xuetao --- drivers/rtc/rtc-puv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index e4b6880aabd0..540ead3cb3c7 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c @@ -164,7 +164,7 @@ static int puv3_rtc_open(struct device *dev) int ret; ret = request_irq(puv3_rtc_alarmno, puv3_rtc_alarmirq, - IRQF_DISABLED, "pkunity-rtc alarm", rtc_dev); + 0, "pkunity-rtc alarm", rtc_dev); if (ret) { dev_err(dev, "IRQ%d error %d\n", puv3_rtc_alarmno, ret); @@ -172,7 +172,7 @@ static int puv3_rtc_open(struct device *dev) } ret = request_irq(puv3_rtc_tickno, puv3_rtc_tickirq, - IRQF_DISABLED, "pkunity-rtc tick", rtc_dev); + 0, "pkunity-rtc tick", rtc_dev); if (ret) { dev_err(dev, "IRQ%d error %d\n", puv3_rtc_tickno, ret); From 858af58f67d4aba8afb02438e74292b9273cdb10 Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Mon, 26 Dec 2011 16:59:34 +0800 Subject: [PATCH 08/10] i2c-puv3: using module_platform_driver() This patch converts the driver to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Signed-off-by: Guan Xuetao --- drivers/i2c/busses/i2c-puv3.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c index fac673940849..93709fbe30eb 100644 --- a/drivers/i2c/busses/i2c-puv3.c +++ b/drivers/i2c/busses/i2c-puv3.c @@ -276,8 +276,6 @@ static int puv3_i2c_resume(struct platform_device *dev) #define puv3_i2c_resume NULL #endif -MODULE_ALIAS("platform:puv3_i2c"); - static struct platform_driver puv3_i2c_driver = { .probe = puv3_i2c_probe, .remove = __devexit_p(puv3_i2c_remove), @@ -289,18 +287,8 @@ static struct platform_driver puv3_i2c_driver = { } }; -static int __init puv3_i2c_init(void) -{ - return platform_driver_register(&puv3_i2c_driver); -} - -static void __exit puv3_i2c_exit(void) -{ - platform_driver_unregister(&puv3_i2c_driver); -} - -module_init(puv3_i2c_init); -module_exit(puv3_i2c_exit); +module_platform_driver(puv3_i2c_driver); MODULE_DESCRIPTION("PKUnity v3 I2C driver"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:puv3_i2c"); From 60e2b00ea200e1527668bfb766ecbdf578ad7de8 Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Mon, 26 Dec 2011 17:03:50 +0800 Subject: [PATCH 09/10] rtc-puv3: using module_platform_driver() This patch converts the driver to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Signed-off-by: Guan Xuetao --- drivers/rtc/rtc-puv3.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index 540ead3cb3c7..6490a02b1703 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c @@ -337,21 +337,7 @@ static struct platform_driver puv3_rtcdrv = { } }; -static char __initdata banner[] = "PKUnity-v3 RTC, (c) 2009 PKUnity Co.\n"; - -static int __init puv3_rtc_init(void) -{ - printk(banner); - return platform_driver_register(&puv3_rtcdrv); -} - -static void __exit puv3_rtc_exit(void) -{ - platform_driver_unregister(&puv3_rtcdrv); -} - -module_init(puv3_rtc_init); -module_exit(puv3_rtc_exit); +module_platform_driver(puv3_rtcdrv); MODULE_DESCRIPTION("RTC Driver for the PKUnity v3 chip"); MODULE_AUTHOR("Hu Dongliang"); From b3a0aa3ae1c0889ffe8abb2e326d5c74c7c9c097 Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Wed, 28 Dec 2011 09:24:29 +0800 Subject: [PATCH 10/10] rtc-puv3: solve section mismatch in rtc-puv3.c The patch renames puv3_rtcdrv to puv3_rtc_driver, so that modpost will know that this is simply a list of pointers to driver functions, in which case the section mismatch is OK. (Thanks Michal Marek) Cc: Axel Lin Cc: Michal Marek Cc: Arnd Bergmann Cc: Alessandro Zummo Cc: rtc-linux@googlegroups.com Signed-off-by: Guan Xuetao -- Section mismatch warning information: WARNING: drivers/rtc/built-in.o(.data+0x90): Section mismatch in reference from the variable puv3_rtcdrv to the function .devinit.text:puv3_rtc_probe() The variable puv3_rtcdrv references the function __devinit puv3_rtc_probe() If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: drivers/rtc/built-in.o(.data+0x94): Section mismatch in reference from the variable puv3_rtcdrv to the function .devexit.text:puv3_rtc_remove() The variable puv3_rtcdrv references the function __devexit puv3_rtc_remove() If the reference is valid then annotate the variable with __exit* (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: drivers/built-in.o(.data+0x6c04): Section mismatch in reference from the variable puv3_rtcdrv to the function .devinit.text:puv3_rtc_probe() The variable puv3_rtcdrv references the function __devinit puv3_rtc_probe() If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: drivers/built-in.o(.data+0x6c08): Section mismatch in reference from the variable puv3_rtcdrv to the function .devexit.text:puv3_rtc_remove() The variable puv3_rtcdrv references the function __devexit puv3_rtc_remove() If the reference is valid then annotate the variable with __exit* (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: vmlinux.o(.data+0x1126c): Section mismatch in reference from the variable puv3_rtcdrv to the function .devinit.text:puv3_rtc_probe() The variable puv3_rtcdrv references the function __devinit puv3_rtc_probe() If the reference is valid then annotate the variable with __init* or __refdata (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console WARNING: vmlinux.o(.data+0x11270): Section mismatch in reference from the variable puv3_rtcdrv to the function .devexit.text:puv3_rtc_remove() The variable puv3_rtcdrv references the function __devexit puv3_rtc_remove() If the reference is valid then annotate the variable with __exit* (see linux/init.h) or name the variable: *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console --- drivers/rtc/rtc-puv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index 6490a02b1703..ab0acaeb2371 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c @@ -326,7 +326,7 @@ static int puv3_rtc_resume(struct platform_device *pdev) #define puv3_rtc_resume NULL #endif -static struct platform_driver puv3_rtcdrv = { +static struct platform_driver puv3_rtc_driver = { .probe = puv3_rtc_probe, .remove = __devexit_p(puv3_rtc_remove), .suspend = puv3_rtc_suspend, @@ -337,7 +337,7 @@ static struct platform_driver puv3_rtcdrv = { } }; -module_platform_driver(puv3_rtcdrv); +module_platform_driver(puv3_rtc_driver); MODULE_DESCRIPTION("RTC Driver for the PKUnity v3 chip"); MODULE_AUTHOR("Hu Dongliang");