From 2712a643ad9e99856f6e33ff3f35c5fa263d92fe Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 19 Jun 2011 11:13:31 +0200 Subject: m68k: Remove unused MAX_NOINT_IPL definition Signed-off-by: Geert Uytterhoeven --- arch/m68k/include/asm/entry.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch') diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h index 622138dc7288..5d8b21c713e2 100644 --- a/arch/m68k/include/asm/entry.h +++ b/arch/m68k/include/asm/entry.h @@ -35,11 +35,9 @@ #if defined(MACH_ATARI_ONLY) /* block out HSYNC on the atari */ #define ALLOWINT (~0x400) -#define MAX_NOINT_IPL 3 #else /* portable version */ #define ALLOWINT (~0x700) -#define MAX_NOINT_IPL 0 #endif /* machine compilation types */ #ifdef __ASSEMBLY__ -- cgit v1.2.3 From 943ce30806b93f69736270e5948e694e715f57a5 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 22 Jan 2012 12:25:55 +0100 Subject: m68k/amiga: Mark z_dev_present() __init It's called from amiga_init_devices() only, which is __init. Signed-off-by: Geert Uytterhoeven --- arch/m68k/amiga/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c index 7fd8b41723ea..1b8db5cc3c5a 100644 --- a/arch/m68k/amiga/platform.c +++ b/arch/m68k/amiga/platform.c @@ -57,7 +57,7 @@ static int __init amiga_init_bus(void) subsys_initcall(amiga_init_bus); -static int z_dev_present(zorro_id id) +static int __init z_dev_present(zorro_id id) { unsigned int i; -- cgit v1.2.3 From eeed227966daed8c4171fe8bdd4e2275ab2cf94d Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 22 Jan 2012 12:44:25 +0100 Subject: m68k/amiga: Add error checks when registering platform devices Signed-off-by: Geert Uytterhoeven --- arch/m68k/amiga/platform.c | 122 +++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 32 deletions(-) (limited to 'arch') diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c index 1b8db5cc3c5a..28728918b295 100644 --- a/arch/m68k/amiga/platform.c +++ b/arch/m68k/amiga/platform.c @@ -6,6 +6,7 @@ * for more details. */ +#include #include #include #include @@ -46,11 +47,18 @@ static const struct resource zorro_resources[] __initconst = { static int __init amiga_init_bus(void) { + struct platform_device *pdev; + unsigned int n; + if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) return -ENODEV; - platform_device_register_simple("amiga-zorro", -1, zorro_resources, - AMIGAHW_PRESENT(ZORRO3) ? 4 : 2); + n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2; + pdev = platform_device_register_simple("amiga-zorro", -1, + zorro_resources, n); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + return 0; } @@ -126,70 +134,120 @@ static const struct resource amiga_rtc_resource __initconst = { static int __init amiga_init_devices(void) { struct platform_device *pdev; + int error; if (!MACH_IS_AMIGA) return -ENODEV; /* video hardware */ - if (AMIGAHW_PRESENT(AMI_VIDEO)) - platform_device_register_simple("amiga-video", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_VIDEO)) { + pdev = platform_device_register_simple("amiga-video", -1, NULL, + 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } /* sound hardware */ - if (AMIGAHW_PRESENT(AMI_AUDIO)) - platform_device_register_simple("amiga-audio", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_AUDIO)) { + pdev = platform_device_register_simple("amiga-audio", -1, NULL, + 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } /* storage interfaces */ - if (AMIGAHW_PRESENT(AMI_FLOPPY)) - platform_device_register_simple("amiga-floppy", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_FLOPPY)) { + pdev = platform_device_register_simple("amiga-floppy", -1, + NULL, 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(A3000_SCSI)) - platform_device_register_simple("amiga-a3000-scsi", -1, - &a3000_scsi_resource, 1); + if (AMIGAHW_PRESENT(A3000_SCSI)) { + pdev = platform_device_register_simple("amiga-a3000-scsi", -1, + &a3000_scsi_resource, 1); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(A4000_SCSI)) - platform_device_register_simple("amiga-a4000t-scsi", -1, - &a4000t_scsi_resource, 1); + if (AMIGAHW_PRESENT(A4000_SCSI)) { + pdev = platform_device_register_simple("amiga-a4000t-scsi", -1, + &a4000t_scsi_resource, + 1); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } if (AMIGAHW_PRESENT(A1200_IDE) || z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) { pdev = platform_device_register_simple("amiga-gayle-ide", -1, &a1200_ide_resource, 1); - platform_device_add_data(pdev, &a1200_ide_pdata, - sizeof(a1200_ide_pdata)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + error = platform_device_add_data(pdev, &a1200_ide_pdata, + sizeof(a1200_ide_pdata)); + if (error) + return error; } if (AMIGAHW_PRESENT(A4000_IDE)) { pdev = platform_device_register_simple("amiga-gayle-ide", -1, &a4000_ide_resource, 1); - platform_device_add_data(pdev, &a4000_ide_pdata, - sizeof(a4000_ide_pdata)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + error = platform_device_add_data(pdev, &a4000_ide_pdata, + sizeof(a4000_ide_pdata)); + if (error) + return error; } /* other I/O hardware */ - if (AMIGAHW_PRESENT(AMI_KEYBOARD)) - platform_device_register_simple("amiga-keyboard", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_KEYBOARD)) { + pdev = platform_device_register_simple("amiga-keyboard", -1, + NULL, 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(AMI_MOUSE)) - platform_device_register_simple("amiga-mouse", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_MOUSE)) { + pdev = platform_device_register_simple("amiga-mouse", -1, NULL, + 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(AMI_SERIAL)) - platform_device_register_simple("amiga-serial", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_SERIAL)) { + pdev = platform_device_register_simple("amiga-serial", -1, + NULL, 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(AMI_PARALLEL)) - platform_device_register_simple("amiga-parallel", -1, NULL, 0); + if (AMIGAHW_PRESENT(AMI_PARALLEL)) { + pdev = platform_device_register_simple("amiga-parallel", -1, + NULL, 0); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } /* real time clocks */ - if (AMIGAHW_PRESENT(A2000_CLK)) - platform_device_register_simple("rtc-msm6242", -1, - &amiga_rtc_resource, 1); + if (AMIGAHW_PRESENT(A2000_CLK)) { + pdev = platform_device_register_simple("rtc-msm6242", -1, + &amiga_rtc_resource, 1); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } - if (AMIGAHW_PRESENT(A3000_CLK)) - platform_device_register_simple("rtc-rp5c01", -1, - &amiga_rtc_resource, 1); + if (AMIGAHW_PRESENT(A3000_CLK)) { + pdev = platform_device_register_simple("rtc-rp5c01", -1, + &amiga_rtc_resource, 1); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + } return 0; } -- cgit v1.2.3 From e2b56288af0c0b97c63aaaa667f2f3165971e911 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 22 Jan 2012 12:45:45 +0100 Subject: m68k/amiga: Use arch_initcall() for registering platform devices module_init() maps to device_initcall(), opening the possibility of race conditions between platform_driver_probe() and registering platform devices. Signed-off-by: Geert Uytterhoeven --- arch/m68k/amiga/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c index 28728918b295..80076d368b7e 100644 --- a/arch/m68k/amiga/platform.c +++ b/arch/m68k/amiga/platform.c @@ -252,4 +252,4 @@ static int __init amiga_init_devices(void) return 0; } -device_initcall(amiga_init_devices); +arch_initcall(amiga_init_devices); -- cgit v1.2.3 From 44883eb0231f4a5ce56926fdee185cba867ac121 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 18 Aug 2011 20:01:51 +0200 Subject: m68k/atari: Change VME irq numbers from unsigned long to unsigned int Device interrupts numbers were changed to unsigned int in 1997, the year IRQ_MACHSPEC was killed as well. Also kill a related cast while we're at it. Signed-off-by: Geert Uytterhoeven Cc: netdev@vger.kernel.org --- arch/m68k/atari/ataints.c | 4 ++-- arch/m68k/include/asm/atariints.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index 783d8f02360d..3f41092d1b70 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c @@ -206,7 +206,7 @@ void __init atari_init_IRQ(void) * hardware with a programmable int vector (probably a VME board). */ -unsigned long atari_register_vme_int(void) +unsigned int atari_register_vme_int(void) { int i; @@ -223,7 +223,7 @@ unsigned long atari_register_vme_int(void) EXPORT_SYMBOL(atari_register_vme_int); -void atari_unregister_vme_int(unsigned long irq) +void atari_unregister_vme_int(unsigned int irq) { if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) { irq -= VME_SOURCE_BASE; diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h index 656bbbf5a6ff..5fc13bdf9044 100644 --- a/arch/m68k/include/asm/atariints.h +++ b/arch/m68k/include/asm/atariints.h @@ -198,7 +198,7 @@ static inline int atari_irq_pending( unsigned irq ) return( get_mfp_bit( irq, MFP_PENDING ) ); } -unsigned long atari_register_vme_int( void ); -void atari_unregister_vme_int( unsigned long ); +unsigned int atari_register_vme_int(void); +void atari_unregister_vme_int(unsigned int); #endif /* linux/atariints.h */ -- cgit v1.2.3 From b637a6b16731d806ae2c8b9619a5619a2f283f15 Mon Sep 17 00:00:00 2001 From: Kautuk Consul Date: Sun, 25 Mar 2012 06:37:48 -0400 Subject: m68k/mm: Port OOM changes to do_page_fault() Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99 (mm: retry page fault when blocking on disk transfer) and commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb (x86,mm: make pagefault killable) The above commits introduced changes into the x86 pagefault handler for making the page fault handler retryable as well as killable. These changes reduce the mmap_sem hold time, which is crucial during OOM killer invocation. Port these changes to m68k. Signed-off-by: Kautuk Consul Signed-off-by: Geert Uytterhoeven --- arch/m68k/mm/fault.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'arch') diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index 6b020a8461e7..aeebbb7b30f0 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c @@ -72,7 +72,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, { struct mm_struct *mm = current->mm; struct vm_area_struct * vma; - int write, fault; + int fault; + unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; #ifdef DEBUG printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n", @@ -87,6 +88,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, if (in_atomic() || !mm) goto no_context; +retry: down_read(&mm->mmap_sem); vma = find_vma(mm, address); @@ -117,14 +119,13 @@ good_area: #ifdef DEBUG printk("do_page_fault: good_area\n"); #endif - write = 0; switch (error_code & 3) { default: /* 3: write, present */ /* fall through */ case 2: /* write, not present */ if (!(vma->vm_flags & VM_WRITE)) goto acc_err; - write++; + flags |= FAULT_FLAG_WRITE; break; case 1: /* read, present */ goto acc_err; @@ -139,10 +140,14 @@ good_area: * the fault. */ - fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); + fault = handle_mm_fault(mm, vma, address, flags); #ifdef DEBUG printk("handle_mm_fault returns %d\n",fault); #endif + + if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) + return 0; + if (unlikely(fault & VM_FAULT_ERROR)) { if (fault & VM_FAULT_OOM) goto out_of_memory; @@ -150,10 +155,31 @@ good_area: goto bus_err; BUG(); } - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; + + /* + * Major/minor page fault accounting is only done on the + * initial attempt. If we go through a retry, it is extremely + * likely that the page will be found in page cache at that point. + */ + if (flags & FAULT_FLAG_ALLOW_RETRY) { + if (fault & VM_FAULT_MAJOR) + current->maj_flt++; + else + current->min_flt++; + if (fault & VM_FAULT_RETRY) { + /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk + * of starvation. */ + flags &= ~FAULT_FLAG_ALLOW_RETRY; + + /* + * No need to up_read(&mm->mmap_sem) as we would + * have already released it in __lock_page_or_retry + * in mm/filemap.c. + */ + + goto retry; + } + } up_read(&mm->mmap_sem); return 0; -- cgit v1.2.3 From f5db9c6a3dd94033a113a6bd9ccce9f8c28c70b1 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 15 Apr 2012 20:37:39 +0200 Subject: m68k: Make sure {read,write}s[bwl]() are always defined drivers/usb/musb/musb_io.h provides default implementations for {read,write}s[bwl]() on most platforms, some of which will conflict soon with platform-specific counterparts on m68k. To avoid having to add more platform-specific checks to musb_io.h later, make sure {read,write}s[bwl]() are always defined on m68k, and disable the default implementations in musb_io.h on m68k, like is already done for several other architectures. Signed-off-by: Geert Uytterhoeven Acked-by: Felipe Balbi --- arch/m68k/include/asm/io_mm.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch') diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index 0fb3468000e7..fa4324bcf566 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h @@ -278,6 +278,13 @@ static inline void isa_delay(void) #define readl(addr) in_le32(addr) #define writel(val,addr) out_le32((addr),(val)) +#define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr)) +#define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr)) +#define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr)) +#define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr)) +#define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr)) +#define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr)) + #define mmiowb() static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) -- cgit v1.2.3 From 5c3f968712cec168fa9775e8af0c0d6650e4bd47 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 18 Apr 2012 11:45:17 +0200 Subject: m68k/video: Create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For now, it just contains the hack for cirrusfb on Amiga, which is moved out of