aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-12 18:55:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-12 18:55:19 -0500
commit3b1b71950b81c4a20ae63c2322383ab4932cdabd (patch)
tree4ab1907249886ac5f410a81b9be8f2c977a10f7d
parentc69e8839c230c60d3c5f62c8f88bd23d8d6519ee (diff)
parent877d52431f4d3cda4adea077ffbe88f3fd1755d3 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: (30 commits) m68k: Fix --build-id breakage for sun3 m68k: Wire up sys_restart_syscall fbdev: Kill Atari vblank cursor blinking m68k: zorro - Use %pR to print resources m68k: dio - Kill resource_size_t format warnings m68k: dmasound - Kill warn_unused_result warnings m68k: zorro - Kill warn_unused_result warnings m68k: dio - Kill warn_unused_result warnings m68k: atafb - Kill warn_unused_result warnings m68k: amiserial - Kill warn_unused_result warnings m68k: ser_a2232 - Kill warn_unused_result warnings m68k: vme_scc - Kill warn_unused_result warnings m68k: sun3 core - Kill warn_unused_result warnings m68k: mvme147 core - Kill warn_unused_result warnings m68k: mac core - Kill warn_unused_result warnings m68k: hp300 core - Kill warn_unused_result warnings m68k: atari core - Kill warn_unused_result warnings m68k: apollo core - Kill warn_unused_result warnings m68k: amiga core - Kill warn_unused_result warnings m68k: Kill several external declarations in source files ...
-rw-r--r--arch/m68k/amiga/amiints.c12
-rw-r--r--arch/m68k/amiga/cia.c4
-rw-r--r--arch/m68k/amiga/config.c3
-rw-r--r--arch/m68k/apollo/config.c7
-rw-r--r--arch/m68k/atari/atakeyb.c10
-rw-r--r--arch/m68k/atari/stdma.c5
-rw-r--r--arch/m68k/atari/time.c5
-rw-r--r--arch/m68k/bvme6000/config.c1
-rw-r--r--arch/m68k/hp300/time.c3
-rw-r--r--arch/m68k/kernel/.gitignore1
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68k/kernel/setup.c11
-rw-r--r--arch/m68k/kernel/signal.c15
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds1
-rw-r--r--arch/m68k/mac/baboon.c3
-rw-r--r--arch/m68k/mac/config.c12
-rw-r--r--arch/m68k/mac/debug.c1
-rw-r--r--arch/m68k/mac/iop.c10
-rw-r--r--arch/m68k/mac/macints.c15
-rw-r--r--arch/m68k/mac/misc.c1
-rw-r--r--arch/m68k/mac/oss.c25
-rw-r--r--arch/m68k/mac/psc.c12
-rw-r--r--arch/m68k/mac/via.c35
-rw-r--r--arch/m68k/math-emu/fp_log.c1
-rw-r--r--arch/m68k/mm/init.c4
-rw-r--r--arch/m68k/mm/motorola.c7
-rw-r--r--arch/m68k/mvme147/config.c6
-rw-r--r--arch/m68k/mvme16x/config.c1
-rw-r--r--arch/m68k/q40/config.c3
-rw-r--r--arch/m68k/sun3/config.c8
-rw-r--r--arch/m68k/sun3/mmu_emu.c1
-rw-r--r--arch/m68k/sun3/sun3ints.c9
-rw-r--r--arch/m68k/sun3x/config.c1
-rw-r--r--drivers/block/amiflop.c40
-rw-r--r--drivers/char/amiserial.c36
-rw-r--r--drivers/char/ser_a2232.c12
-rw-r--r--drivers/char/vme_scc.c166
-rw-r--r--drivers/dio/dio-sysfs.c19
-rw-r--r--drivers/dio/dio.c18
-rw-r--r--drivers/video/Makefile4
-rw-r--r--drivers/video/amifb.c6
-rw-r--r--drivers/video/atafb.c112
-rw-r--r--drivers/video/c2p.c232
-rw-r--r--drivers/video/c2p.h11
-rw-r--r--drivers/video/c2p_core.h153
-rw-r--r--drivers/video/c2p_iplan2.c153
-rw-r--r--drivers/video/c2p_planar.c156
-rw-r--r--drivers/video/console/fbcon.c38
-rw-r--r--drivers/zorro/.gitignore2
-rw-r--r--drivers/zorro/zorro-sysfs.c20
-rw-r--r--drivers/zorro/zorro.c23
-rw-r--r--drivers/zorro/zorro.h2
-rw-r--r--include/asm-m68k/unistd.h4
-rw-r--r--include/linux/dio.h2
-rw-r--r--sound/oss/dmasound/dmasound_atari.c5
-rw-r--r--sound/oss/dmasound/dmasound_q40.c16
56 files changed, 912 insertions, 553 deletions
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index 907a5533c845..c5b5212cc3f9 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -72,10 +72,14 @@ static struct irq_controller amiga_irq_controller = {
72 72
73void __init amiga_init_IRQ(void) 73void __init amiga_init_IRQ(void)
74{ 74{
75 request_irq(IRQ_AUTO_1, ami_int1, 0, "int1", NULL); 75 if (request_irq(IRQ_AUTO_1, ami_int1, 0, "int1", NULL))
76 request_irq(IRQ_AUTO_3, ami_int3, 0, "int3", NULL); 76 pr_err("Couldn't register int%d\n", 1);
77 request_irq(IRQ_AUTO_4, ami_int4, 0, "int4", NULL); 77 if (request_irq(IRQ_AUTO_3, ami_int3, 0, "int3", NULL))
78 request_irq(IRQ_AUTO_5, ami_int5, 0, "int5", NULL); 78 pr_err("Couldn't register int%d\n", 3);
79 if (request_irq(IRQ_AUTO_4, ami_int4, 0, "int4", NULL))
80 pr_err("Couldn't register int%d\n", 4);
81 if (request_irq(IRQ_AUTO_5, ami_int5, 0, "int5", NULL))
82 pr_err("Couldn't register int%d\n", 5);
79 83
80 m68k_setup_irq_controller(&amiga_irq_controller, IRQ_USER, AMI_STD_IRQS); 84 m68k_setup_irq_controller(&amiga_irq_controller, IRQ_USER, AMI_STD_IRQS);
81 85
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 343fab49bd9a..ecd0f7ca6f0e 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -176,5 +176,7 @@ void __init cia_init_IRQ(struct ciabase *base)
176 /* override auto int and install CIA handler */ 176 /* override auto int and install CIA handler */
177 m68k_setup_irq_controller(&auto_irq_controller, base->handler_irq, 1); 177 m68k_setup_irq_controller(&auto_irq_controller, base->handler_irq, 1);
178 m68k_irq_startup(base->handler_irq); 178 m68k_irq_startup(base->handler_irq);
179 request_irq(base->handler_irq, cia_handler, IRQF_SHARED, base->name, base); 179 if (request_irq(base->handler_irq, cia_handler, IRQF_SHARED,
180 base->name, base))
181 pr_err("Couldn't register %s interrupt\n", base->name);
180} 182}
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index ab9862c3a136..6e562751ad51 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -493,7 +493,8 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
493 * Please don't change this to use ciaa, as it interferes with the 493 * Please don't change this to use ciaa, as it interferes with the
494 * SCSI code. We'll have to take a look at this later 494 * SCSI code. We'll have to take a look at this later
495 */ 495 */
496 request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL); 496 if (request_irq(IRQ_AMIGA_CIAB_TA, timer_routine, 0, "timer", NULL))
497 pr_err("Couldn't register timer interrupt\n");
497 /* start timer */ 498 /* start timer */
498 ciab.cra |= 0x11; 499 ciab.cra |= 0x11;
499} 500}
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 78df98f2029a..8d3eafab1ffe 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -31,10 +31,6 @@ extern unsigned long dn_gettimeoffset(void);
31extern int dn_dummy_hwclk(int, struct rtc_time *); 31extern int dn_dummy_hwclk(int, struct rtc_time *);
32extern int dn_dummy_set_clock_mmss(unsigned long); 32extern int dn_dummy_set_clock_mmss(unsigned long);
33extern void dn_dummy_reset(void); 33extern void dn_dummy_reset(void);
34extern void dn_dummy_waitbut(void);
35extern struct fb_info *dn_fb_init(long *);
36extern void dn_dummy_debug_init(void);
37extern irqreturn_t dn_process_int(int irq, struct pt_regs *fp);
38#ifdef CONFIG_HEARTBEAT 34#ifdef CONFIG_HEARTBEAT
39static void dn_heartbeat(int on); 35static void dn_heartbeat(int on);
40#endif 36#endif
@@ -204,7 +200,8 @@ void dn_sched_init(irq_handler_t timer_routine)
204 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3)); 200 printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3));
205#endif 201#endif
206 202
207 request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine); 203 if (request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine))
204 pr_err("Couldn't register timer interrupt\n");
208} 205}
209 206
210unsigned long dn_gettimeoffset(void) { 207unsigned long dn_gettimeoffset(void) {
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index c038b7c7eff0..a5f33c059979 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -33,7 +33,6 @@
33#include <asm/atari_joystick.h> 33#include <asm/atari_joystick.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35 35
36extern unsigned int keymap_count;
37 36
38/* Hook for MIDI serial driver */ 37/* Hook for MIDI serial driver */
39void (*atari_MIDI_interrupt_hook) (void); 38void (*atari_MIDI_interrupt_hook) (void);
@@ -567,14 +566,19 @@ static int atari_keyb_done = 0;
567 566
568int atari_keyb_init(void) 567int atari_keyb_init(void)
569{ 568{
569 int error;
570
570 if (atari_keyb_done) 571 if (atari_keyb_done)
571 return 0; 572 return 0;
572 573
573 kb_state.state = KEYBOARD; 574 kb_state.state = KEYBOARD;
574 kb_state.len = 0; 575 kb_state.len = 0;
575 576
576 request_irq(IRQ_MFP_ACIA, atari_keyboard_interrupt, IRQ_TYPE_SLOW, 577 error = request_irq(IRQ_MFP_ACIA, atari_keyboard_interrupt,
577 "keyboard/mouse/MIDI", atari_keyboard_interrupt); 578 IRQ_TYPE_SLOW, "keyboard/mouse/MIDI",
579 atari_keyboard_interrupt);
580 if (error)
581 return error;
578 582
579 atari_turnoff_irq(IRQ_MFP_ACIA); 583 atari_turnoff_irq(IRQ_MFP_ACIA);
580 do { 584 do {
diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c
index d1bd029a34ac..604329fafbb8 100644
--- a/arch/m68k/atari/stdma.c
+++ b/arch/m68k/atari/stdma.c
@@ -179,8 +179,9 @@ EXPORT_SYMBOL(stdma_islocked);
179void __init stdma_init(void) 179void __init stdma_init(void)
180{ 180{
181 stdma_isr = NULL; 181 stdma_isr = NULL;
182 request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW | IRQF_SHARED, 182 if (request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW | IRQF_SHARED,
183 "ST-DMA: floppy/ACSI/IDE/Falcon-SCSI", stdma_int); 183 "ST-DMA: floppy/ACSI/IDE/Falcon-SCSI", stdma_int))
184 pr_err("Couldn't register ST-DMA interrupt\n");
184} 185}
185 186
186 187
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index 1edde27fa32d..d076ff8d1b39 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -31,8 +31,9 @@ atari_sched_init(irq_handler_t timer_routine)
31 /* start timer C, div = 1:100 */ 31 /* start timer C, div = 1:100 */
32 mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60; 32 mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60;
33 /* install interrupt service routine for MFP Timer C */ 33 /* install interrupt service routine for MFP Timer C */
34 request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW, 34 if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW,
35 "timer", timer_routine); 35 "timer", timer_routine))
36 pr_err("Couldn't register timer interrupt\n");
36} 37}
37 38
38/* ++andreas: gettimeoffset fixed to check for pending interrupt */ 39/* ++andreas: gettimeoffset fixed to check for pending interrupt */
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index c072595928c0..9fe6fefb5e14 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -43,7 +43,6 @@ extern unsigned long bvme6000_gettimeoffset (void);
43extern int bvme6000_hwclk (int, struct rtc_time *); 43extern int bvme6000_hwclk (int, struct rtc_time *);
44extern int bvme6000_set_clock_mmss (unsigned long); 44extern int bvme6000_set_clock_mmss (unsigned long);
45extern void bvme6000_reset (void); 45extern void bvme6000_reset (void);
46extern void bvme6000_waitbut(void);
47void bvme6000_set_vectors (void); 46void bvme6000_set_vectors (void);
48 47
49/* Save tick handler routine pointer, will point to do_timer() in 48/* Save tick handler routine pointer, will point to do_timer() in
diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
index dd7c8a2583d3..f6312c7d8727 100644
--- a/arch/m68k/hp300/time.c
+++ b/arch/m68k/hp300/time.c
@@ -70,7 +70,8 @@ void __init hp300_sched_init(irq_handler_t vector)
70 70
71 asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE)); 71 asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 72
73 request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector); 73 if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74 pr_err("Couldn't register timer interrupt\n");
74 75
75 out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */ 76 out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
76 out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */ 77 out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */
diff --git a/arch/m68k/kernel/.gitignore b/arch/m68k/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/m68k/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index f28404d9a2bc..5b780826647c 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -424,7 +424,7 @@ resume:
424.data 424.data
425ALIGN 425ALIGN
426sys_call_table: 426sys_call_table:
427 .long sys_ni_syscall /* 0 - old "setup()" system call*/ 427 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
428 .long sys_exit 428 .long sys_exit
429 .long sys_fork 429 .long sys_fork
430 .long sys_read 430 .long sys_read
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 4d97bd2bd573..303730afb1c9 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -26,6 +26,7 @@
26#include <linux/initrd.h> 26#include <linux/initrd.h>
27 27
28#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
29#include <asm/sections.h>
29#include <asm/setup.h> 30#include <asm/setup.h>
30#include <asm/fpu.h> 31#include <asm/fpu.h>
31#include <asm/irq.h> 32#include <asm/irq.h>
@@ -62,7 +63,6 @@ EXPORT_SYMBOL(vme_brdtype);
62int m68k_is040or060; 63int m68k_is040or060;
63EXPORT_SYMBOL(m68k_is040or060); 64EXPORT_SYMBOL(m68k_is040or060);
64 65
65extern int end;
66extern unsigned long availmem; 66extern unsigned long availmem;
67 67
68int m68k_num_memory; 68int m68k_num_memory;
@@ -215,11 +215,10 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
215 215
216void __init setup_arch(char **cmdline_p) 216void __init setup_arch(char **cmdline_p)
217{ 217{
218 extern int _etext, _edata, _end;
219 int i; 218 int i;
220 219
221 /* The bootinfo is located right after the kernel bss */ 220 /* The bootinfo is located right after the kernel bss */
222 m68k_parse_bootinfo((const struct bi_record *)&_end); 221 m68k_parse_bootinfo((const struct bi_record *)_end);
223 222
224 if (CPU_IS_040) 223 if (CPU_IS_040)
225 m68k_is040or060 = 4; 224 m68k_is040or060 = 4;
@@ -252,9 +251,9 @@ void __init setup_arch(char **cmdline_p)
252 } 251 }
253 252
254 init_mm.start_code = PAGE_OFFSET; 253 init_mm.start_code = PAGE_OFFSET;
255 init_mm.end_code = (unsigned long) &_etext; 254 init_mm.end_code = (unsigned long)_etext;
256 init_mm.end_data = (unsigned long) &_edata; 255 init_mm.end_data = (unsigned long)_edata;
257 init_mm.brk = (unsigned long) &_end; 256 init_mm.brk = (unsigned long)_end;
258 257
259 *cmdline_p = m68k_command_line; 258 *cmdline_p = m68k_command_line;
260 memcpy(boot_command_line, *cmdline_p, CL_SIZE); 259 memcpy(boot_command_line, *cmdline_p, CL_SIZE);
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index f9af893cd289..de2d05ddd86d 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -326,6 +326,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __u
326 struct sigcontext context; 326 struct sigcontext context;
327 int err; 327 int err;
328 328
329 /* Always make any pending restarted system calls return -EINTR */
330 current_thread_info()->restart_block.fn = do_no_restart_syscall;
331
329 /* get previous context */ 332 /* get previous context */
330 if (copy_from_user(&context, usc, sizeof(context))) 333 if (copy_from_user(&context, usc, sizeof(context)))
331 goto badframe; 334 goto badframe;
@@ -411,6 +414,9 @@ rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
411 unsigned long usp; 414 unsigned long usp;
412 int err; 415 int err;
413 416
417 /* Always make any pending restarted system calls return -EINTR */
418 current_thread_info()->restart_block.fn = do_no_restart_syscall;
419
414 err = __get_user(temp, &uc->uc_mcontext.version); 420 err = __get_user(temp, &uc->uc_mcontext.version);
415 if (temp != MCONTEXT_VERSION) 421 if (temp != MCONTEXT_VERSION)
416 goto badframe; 422 goto badframe;
@@ -937,6 +943,15 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
937 regs->d0 = -EINTR; 943 regs->d0 = -EINTR;
938 break; 944 break;
939 945
946 case -ERESTART_RESTARTBLOCK:
947 if (!has_handler) {
948 regs->d0 = __NR_restart_syscall;
949 regs->pc -= 2;
950 break;
951 }
952 regs->d0 = -EINTR;
953 break;
954
940 case -ERESTARTSYS: 955 case -ERESTARTSYS:
941 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) { 956 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
942 regs->d0 = -EINTR; 957 regs->d0 = -EINTR;
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 8a4919e4d36a..d9368c0709ba 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -33,6 +33,7 @@ SECTIONS
33 } :data 33 } :data
34 /* End of data goes *here* so that freeing init code works properly. */ 34 /* End of data goes *here* so that freeing init code works properly. */
35 _edata = .; 35 _edata = .;
36 NOTES
36 37
37 /* will be freed after init */ 38 /* will be freed after init */
38 . = ALIGN(PAGE_SIZE); /* Init code and data */ 39 . = ALIGN(PAGE_SIZE); /* Init code and data */
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index 245d16d078ad..2a96bebd8969 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -92,7 +92,8 @@ static irqreturn_t baboon_irq(int irq, void *dev_id)
92void __init baboon_register_interrupts(void) 92void __init baboon_register_interrupts(void)
93{ 93{
94 baboon_disabled = 0; 94 baboon_disabled = 0;
95 request_irq(IRQ_NUBUS_C, baboon_irq, 0, "baboon", (void *)baboon); 95 if (request_irq(IRQ_NUBUS_C, baboon_irq, 0, "baboon", (void *)baboon))
96 pr_err("Couldn't register baboon interrupt\n");
96} 97}
97 98
98/* 99/*
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 8819b97be324..98b6bcfb37bf 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -47,13 +47,6 @@
47 47
48struct mac_booter_data mac_bi_data; 48struct mac_booter_data mac_bi_data;
49 49
50/* New m68k bootinfo stuff and videobase */
51
52extern int m68k_num_memory;
53extern struct mem_info m68k_memory[NUM_MEMINFO];
54
55extern struct mem_info m68k_ramdisk;
56
57/* The phys. video addr. - might be bogus on some machines */ 50/* The phys. video addr. - might be bogus on some machines */
58static unsigned long mac_orig_videoaddr; 51static unsigned long mac_orig_videoaddr;
59 52
@@ -61,7 +54,6 @@ static unsigned long mac_orig_videoaddr;
61extern unsigned long mac_gettimeoffset(void); 54extern unsigned long mac_gettimeoffset(void);
62extern int mac_hwclk(int, struct rtc_time *); 55extern int mac_hwclk(int, struct rtc_time *);
63extern int mac_set_clock_mmss(unsigned long); 56extern int mac_set_clock_mmss(unsigned long);
64extern int show_mac_interrupts(struct seq_file *, void *);
65extern void iop_preinit(void); 57extern void iop_preinit(void);
66extern void iop_init(void); 58extern void iop_init(void);
67extern void via_init(void); 59extern void via_init(void);
@@ -805,10 +797,6 @@ static void __init mac_identify(void)
805 mac_bi_data.boottime, mac_bi_data.gmtbias); 797 mac_bi_data.boottime, mac_bi_data.gmtbias);
806 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", 798 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
807 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 799 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
808#if 0
809 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
810 m68k_ramdisk.addr, m68k_ramdisk.size);
811#endif
812 800
813 iop_init(); 801 iop_init();
814 via_init(); 802 via_init();
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 65dd77a742a3..bce074ceb768 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -27,7 +27,6 @@
27#include <asm/macints.h> 27#include <asm/macints.h>
28 28
29extern unsigned long mac_videobase; 29extern unsigned long mac_videobase;
30extern unsigned long mac_videodepth;
31extern unsigned long mac_rowbytes; 30extern unsigned long mac_rowbytes;
32 31
33extern void mac_serial_print(const char *); 32extern void mac_serial_print(const char *);
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 326fb9978094..1ad4e9d80eba 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -305,14 +305,16 @@ void __init iop_register_interrupts(void)
305{ 305{
306 if (iop_ism_present) { 306 if (iop_ism_present) {
307 if (oss_present) { 307 if (oss_present) {
308 request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq, 308 if (request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq,
309 IRQ_FLG_LOCK, "ISM IOP", 309 IRQ_FLG_LOCK, "ISM IOP",
310 (void *) IOP_NUM_ISM); 310 (void *) IOP_NUM_ISM))
311 pr_err("Couldn't register ISM IOP interrupt\n");
311 oss_irq_enable(IRQ_MAC_ADB); 312 oss_irq_enable(IRQ_MAC_ADB);
312 } else { 313 } else {
313 request_irq(IRQ_VIA2_0, iop_ism_irq, 314 if (request_irq(IRQ_VIA2_0, iop_ism_irq,
314 IRQ_FLG_LOCK|IRQ_FLG_FAST, "ISM IOP", 315 IRQ_FLG_LOCK|IRQ_FLG_FAST, "ISM IOP",
315 (void *) IOP_NUM_ISM); 316 (void *) IOP_NUM_ISM))
317 pr_err("Couldn't register ISM IOP interrupt\n");
316 } 318 }
317 if (!iop_alive(iop_base[IOP_NUM_ISM])) { 319 if (!iop_alive(iop_base[IOP_NUM_ISM])) {
318 printk("IOP: oh my god, they killed the ISM IOP!\n"); 320 printk("IOP: oh my god, they killed the ISM IOP!\n");
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 82e560c076ce..23711074e0e2 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -134,6 +134,7 @@
134#include <asm/errno.h> 134#include <asm/errno.h>
135#include <asm/macints.h> 135#include <asm/macints.h>
136#include <asm/irq_regs.h> 136#include <asm/irq_regs.h>
137#include <asm/mac_oss.h>
137 138
138#define DEBUG_SPURIOUS 139#define DEBUG_SPURIOUS
139#define SHUTUP_SONIC 140#define SHUTUP_SONIC
@@ -146,7 +147,6 @@ static int scc_mask;
146 * VIA/RBV hooks 147 * VIA/RBV hooks
147 */ 148 */
148 149
149extern void via_init(void);
150extern void via_register_interrupts(void); 150extern void via_register_interrupts(void);
151extern void via_irq_enable(int); 151extern void via_irq_enable(int);
152extern void via_irq_disable(int); 152extern void via_irq_disable(int);
@@ -157,9 +157,6 @@ extern int via_irq_pending(int);
157 * OSS hooks 157 * OSS hooks
158 */ 158 */
159 159
160extern int oss_present;
161
162extern void oss_init(void);
163extern void oss_register_interrupts(void); 160extern void oss_register_interrupts(void);
164extern void oss_irq_enable(int); 161extern void oss_irq_enable(int);
165extern void oss_irq_disable(int); 162extern void oss_irq_disable(int);
@@ -170,9 +167,6 @@ extern int oss_irq_pending(int);
170 * PSC hooks 167 * PSC hooks
171 */ 168 */
172 169
173extern int psc_present;
174
175extern void psc_init(void);
176extern void psc_register_interrupts(void); 170extern void psc_register_interrupts(void);
177extern void psc_irq_enable(int); 171extern void psc_irq_enable(int);
178extern void psc_irq_disable(int); 172extern void psc_irq_disable(int);
@@ -191,12 +185,10 @@ extern void iop_register_interrupts(void);
191 185
192extern int baboon_present; 186extern int baboon_present;
193 187
194extern void baboon_init(void);
195extern void baboon_register_interrupts(void); 188extern void baboon_register_interrupts(void);
196extern void baboon_irq_enable(int); 189extern void baboon_irq_enable(int);
197extern void baboon_irq_disable(int); 190extern void baboon_irq_disable(int);
198extern void baboon_irq_clear(int); 191extern void baboon_irq_clear(int);
199extern int baboon_irq_pending(int);
200 192
201/* 193/*
202 * SCC interrupt routines 194 * SCC interrupt routines
@@ -258,8 +250,9 @@ void __init mac_init_IRQ(void)
258 if (baboon_present) 250 if (baboon_present)
259 baboon_register_interrupts(); 251 baboon_register_interrupts();
260 iop_register_interrupts(); 252 iop_register_interrupts();
261 request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI", 253 if (request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
262 mac_nmi_handler); 254 mac_nmi_handler))
255 pr_err("Couldn't register NMI\n");
263#ifdef DEBUG_MACINTS 256#ifdef DEBUG_MACINTS
264 printk("mac_init_IRQ(): Done!\n"); 257 printk("mac_init_IRQ(): Done!\n");
265#endif 258#endif
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index a44c7086ab39..5d818568b343 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -35,7 +35,6 @@
35 35
36#define RTC_OFFSET 2082844800 36#define RTC_OFFSET 2082844800
37 37
38extern struct mac_booter_data mac_bi_data;
39static void (*rom_reset)(void); 38static void (*rom_reset)(void);
40 39
41#ifdef CONFIG_ADB_CUDA 40#ifdef CONFIG_ADB_CUDA
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 8426501119ca..f3d23d6ebcf8 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -66,16 +66,21 @@ void __init oss_init(void)
66 66
67void __init oss_register_interrupts(void) 67void __init oss_register_interrupts(void)
68{ 68{
69 request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK, 69 if (request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK,
70 "scsi", (void *) oss); 70 "scsi", (void *) oss))
71 request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK, 71 pr_err("Couldn't register %s interrupt\n", "scsi");
72 "scc", mac_scc_dispatch); 72 if (request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK,
73 request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK, 73 "scc", mac_scc_dispatch))
74 "nubus", (void *) oss); 74 pr_err("Couldn't register %s interrupt\n", "scc");
75 request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK, 75 if (request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK,
76 "sound", (void *) oss); 76 "nubus", (void *) oss))
77 request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK, 77 pr_err("Couldn't register %s interrupt\n", "nubus");
78 "via1", (void *) via1); 78 if (request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK,
79 "sound", (void *) oss))
80 pr_err("Couldn't register %s interrupt\n", "sound");
81 if (request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK,
82 "via1", (void *) via1))
83 pr_err("Couldn't register %s interrupt\n", "via1");
79} 84}
80 85
81/* 86/*
diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index f84a4dd64f94..ba6ccab64018 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -117,10 +117,14 @@ void __init psc_init(void)
117 117
118void __init psc_register_interrupts(void) 118void __init psc_register_interrupts(void)
119{ 119{
120 request_irq(IRQ_AUTO_3, psc_irq, 0, "psc3", (void *) 0x30); 120 if (request_irq(IRQ_AUTO_3, psc_irq, 0, "psc3", (void *) 0x30))
121 request_irq(IRQ_AUTO_4, psc_irq, 0, "psc4", (void *) 0x40); 121 pr_err("Couldn't register psc%d interrupt\n", 3);
122 request_irq(IRQ_AUTO_5, psc_irq, 0, "psc5", (void *) 0x50); 122 if (request_irq(IRQ_AUTO_4, psc_irq, 0, "psc4", (void *) 0x40))
123 request_irq(IRQ_AUTO_6, psc_irq, 0, "psc6", (void *) 0x60); 123 pr_err("Couldn't register psc%d interrupt\n", 4);
124 if (request_irq(IRQ_AUTO_5, psc_irq, 0, "psc5", (void *) 0x50))
125 pr_err("Couldn't register psc%d interrupt\n", 5);
126 if (request_irq(IRQ_AUTO_6, psc_irq, 0, "psc6", (void *) 0x60))
127 pr_err("Couldn't register psc%d interrupt\n", 6);
124} 128}
125 129
126/* 130/*
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index f01d418e64fe..7d97ba54536e 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -34,6 +34,7 @@
34#include <asm/macints.h> 34#include <asm/macints.h>
35#include <asm/mac_via.h> 35#include <asm/mac_via.h>
36#include <asm/mac_psc.h> 36#include <asm/mac_psc.h>
37#include <asm/mac_oss.h>
37 38
38volatile __u8 *via1, *via2; 39volatile __u8 *via1, *via2;
39int rbv_present; 40int rbv_present;
@@ -84,7 +85,6 @@ void via_irq_disable(int irq);
84void via_irq_clear(int irq); 85void via_irq_clear(int irq);
85 86
86extern irqreturn_t mac_scc_dispatch(int, void *); 87extern irqreturn_t mac_scc_dispatch(int, void *);
87extern int oss_present;
88 88
89/* 89/*
90 * Initialize the VIAs 90 * Initialize the VIAs
@@ -283,7 +283,8 @@ void __init via_init_clock(irq_handler_t func)
283 via1[vT1CL] = MAC_CLOCK_LOW; 283 via1[vT1CL] = MAC_CLOCK_LOW;
284 via1[vT1CH] = MAC_CLOCK_HIGH; 284 via1[vT1CH] = MAC_CLOCK_HIGH;
285 285
286 request_irq(IRQ_MAC_TIMER_1, func, IRQ_FLG_LOCK, "timer", func); 286 if (request_irq(IRQ_MAC_TIMER_1, func, IRQ_FLG_LOCK, "timer", func))
287 pr_err("Couldn't register %s interrupt\n", "timer");
287} 288}
288 289
289/* 290/*
@@ -293,25 +294,31 @@ void __init via_init_clock(irq_handler_t func)
293void __init via_register_interrupts(void) 294void __init via_register_interrupts(void)
294{ 295{
295 if (via_alt_mapping) { 296 if (via_alt_mapping) {
296 request_irq(IRQ_AUTO_1, via1_irq, 297 if (request_irq(IRQ_AUTO_1, via1_irq,
297 IRQ_FLG_LOCK|IRQ_FLG_FAST, "software", 298 IRQ_FLG_LOCK|IRQ_FLG_FAST, "software",
298 (void *) via1); 299 (void *) via1))
299 request_irq(IRQ_AUTO_6, via1_irq, 300 pr_err("Couldn't register %s interrupt\n", "software");
301 if (request_irq(IRQ_AUTO_6, via1_irq,
300 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1", 302 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
301 (void *) via1); 303 (void *) via1))
304 pr_err("Couldn't register %s interrupt\n", "via1");
302 } else { 305 } else {
303 request_irq(IRQ_AUTO_1, via1_irq, 306 if (request_irq(IRQ_AUTO_1, via1_irq,
304 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1", 307 IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
305 (void *) via1); 308 (void *) via1))
309 pr_err("Couldn't register %s interrupt\n", "via1");
306 } 310 }
307 request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, 311 if (request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
308 "via2", (void *) via2); 312 "via2", (void *) via2))
313 pr_err("Couldn't register %s interrupt\n", "via2");
309 if (!psc_present) { 314 if (!psc_present) {
310 request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK, 315 if (request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
311 "scc", mac_scc_dispatch); 316 "scc", mac_scc_dispatch))
317 pr_err("Couldn't register %s interrupt\n", "scc");
312 } 318 }
313 request_irq(IRQ_MAC_NUBUS, via_nubus_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, 319 if (request_irq(IRQ_MAC_NUBUS, via_nubus_irq,
314 "nubus", (void *) via2); 320 IRQ_FLG_LOCK|IRQ_FLG_FAST, "nubus", (void *) via2))
321 pr_err("Couldn't register %s interrupt\n", "nubus");
315} 322}
316 323
317/* 324/*
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index b1033ae0d6f0..367ecee2f981 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -24,7 +24,6 @@ static const struct fp_ext fp_one =
24 24
25extern struct fp_ext *fp_fadd(struct fp_ext *dest, const struct fp_ext *src); 25extern struct fp_ext *fp_fadd(struct fp_ext *dest, const struct fp_ext *src);
26extern struct fp_ext *fp_fdiv(struct fp_ext *dest, const struct fp_ext *src); 26extern struct fp_ext *fp_fdiv(struct fp_ext *dest, const struct fp_ext *src);
27extern struct fp_ext *fp_fmul(struct fp_ext *dest, const struct fp_ext *src);
28 27
29struct fp_ext * 28struct fp_ext *
30fp_fsqrt(struct fp_ext *dest, struct fp_ext *src) 29fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 81bb08ceec18..0007b2adf3a3 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -28,6 +28,7 @@
28#ifdef CONFIG_ATARI 28#ifdef CONFIG_ATARI
29#include <asm/atari_stram.h> 29#include <asm/atari_stram.h>
30#endif 30#endif
31#include <asm/sections.h>
31#include <asm/tlb.h> 32#include <asm/tlb.h>
32 33
33DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 34DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -73,9 +74,6 @@ extern void init_pointer_table(unsigned long ptable);
73 74
74/* References to section boundaries */ 75/* References to section boundaries */
75 76
76extern char _text[], _etext[];
77extern char __init_begin[], __init_end[];
78
79extern pmd_t *zero_pgtable; 77extern pmd_t *zero_pgtable;
80 78
81void __init mem_init(void) 79void __init mem_init(void)
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index c5dbb9bdb322..4665fc84b7dc 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -30,6 +30,7 @@
30#ifdef CONFIG_ATARI 30#ifdef CONFIG_ATARI
31#include <asm/atari_stram.h> 31#include <asm/atari_stram.h>
32#endif 32#endif
33#include <asm/sections.h>
33 34
34#undef DEBUG 35#undef DEBUG
35 36
@@ -301,14 +302,12 @@ void __init paging_init(void)
301 } 302 }
302} 303}
303 304
304extern char __init_begin, __init_end;
305
306void free_initmem(void) 305void free_initmem(void)
307{ 306{
308 unsigned long addr; 307 unsigned long addr;
309 308
310 addr = (unsigned long)&__init_begin; 309 addr = (unsigned long)__init_begin;
311 for (; addr < (unsigned long)&__init_end; addr += PAGE_SIZE) { 310 for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) {
312 virt_to_page(addr)->flags &= ~(1 << PG_reserved); 311 virt_to_page(addr)->flags &= ~(1 << PG_reserved);
313 init_page_count(virt_to_page(addr)); 312 init_page_count(virt_to_page(addr));
314 free_page(addr); 313 free_page(addr);
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 43cdf476ffab..100baaa692a1 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -42,7 +42,6 @@ extern unsigned long mvme147_gettimeoffset (void);
42extern int mvme147_hwclk (int, struct rtc_time *); 42extern int mvme147_hwclk (int, struct rtc_time *);
43extern int mvme147_set_clock_mmss (unsigned long); 43extern int mvme147_set_clock_mmss (unsigned long);
44extern void mvme147_reset (void); 44extern void mvme147_reset (void);
45extern void mvme147_waitbut(void);
46 45
47 46
48static int bcd2int (unsigned char b); 47static int bcd2int (unsigned char b);
@@ -115,8 +114,9 @@ static irqreturn_t mvme147_timer_int (int irq, void *dev_id)
115void mvme147_sched_init (irq_handler_t timer_routine) 114void mvme147_sched_init (irq_handler_t timer_routine)
116{ 115{
117 tick_handler = timer_routine; 116 tick_handler = timer_routine;
118 request_irq (PCC_IRQ_TIMER1, mvme147_timer_int, 117 if (request_irq(PCC_IRQ_TIMER1, mvme147_timer_int, IRQ_FLG_REPLACE,
119 IRQ_FLG_REPLACE, "timer 1", NULL); 118 "timer 1", NULL))
119 pr_err("Couldn't register timer interrupt\n");
120 120
121 /* Init the clock with a value */ 121 /* Init the clock with a value */
122 /* our clock goes off every 6.25us */ 122 /* our clock goes off every 6.25us */
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 1521826fc3c7..11edf61cc2c4 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -48,7 +48,6 @@ extern unsigned long mvme16x_gettimeoffset (void);
48extern int mvme16x_hwclk (int, struct rtc_time *); 48extern int mvme16x_hwclk (int, struct rtc_time *);
49extern int mvme16x_set_clock_mmss (unsigned long); 49extern int mvme16x_set_clock_mmss (unsigned long);
50extern void mvme16x_reset (void); 50extern void mvme16x_reset (void);
51extern void mvme16x_waitbut(void);
52 51
53int bcd2int (unsigned char b); 52int bcd2int (unsigned char b);
54 53
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 7110546e3c00..31ab3f08bbda 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -36,7 +36,6 @@
36#include <asm/machdep.h> 36#include <asm/machdep.h>
37#include <asm/q40_master.h> 37#include <asm/q40_master.h>
38 38
39extern irqreturn_t q40_process_int(int level, struct pt_regs *regs);
40extern void q40_init_IRQ(void); 39extern void q40_init_IRQ(void);
41static void q40_get_model(char *model); 40static void q40_get_model(char *model);
42extern void q40_sched_init(irq_handler_t handler); 41extern void q40_sched_init(irq_handler_t handler);
@@ -47,8 +46,6 @@ static unsigned int q40_get_ss(void);
47static int q40_set_clock_mmss(unsigned long); 46static int q40_set_clock_mmss(unsigned long);
48static int q40_get_rtc_pll(struct rtc_pll_info *pll); 47static int q40_get_rtc_pll(struct rtc_pll_info *pll);
49static int q40_set_rtc_pll(struct rtc_pll_info *pll); 48static int q40_set_rtc_pll(struct rtc_pll_info *pll);
50extern void q40_waitbut(void);
51void q40_set_vectors(void);
52 49
53extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/); 50extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/);
54 51
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 8dfaa201342e..2ca25bd01a96 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -27,23 +27,21 @@
27#include <asm/sun3mmu.h> 27#include <asm/sun3mmu.h>
28#include <asm/rtc.h> 28#include <asm/rtc.h>
29#include <asm/machdep.h> 29#include <asm/machdep.h>
30#include <asm/idprom.h>
30#include <asm/intersil.h> 31#include <asm/intersil.h>
31#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/sections.h>
32#include <asm/segment.h> 34#include <asm/segment.h>
33#include <asm/sun3ints.h> 35#include <asm/sun3ints.h>
34 36
35extern char _text, _end;
36
37char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; 37char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
38 38
39extern unsigned long sun3_gettimeoffset(void); 39extern unsigned long sun3_gettimeoffset(void);
40static void sun3_sched_init(irq_handler_t handler); 40static void sun3_sched_init(irq_handler_t handler);
41extern void sun3_get_model (char* model); 41extern void sun3_get_model (char* model);
42extern void idprom_init (void);
43extern int sun3_hwclk(int set, struct rtc_time *t); 42extern int sun3_hwclk(int set, struct rtc_time *t);
44 43
45volatile char* clock_va; 44volatile char* clock_va;
46extern volatile unsigned char* sun3_intreg;
47extern unsigned long availmem; 45extern unsigned long availmem;
48unsigned long num_pages; 46unsigned long num_pages;
49 47
@@ -149,7 +147,7 @@ void __init config_sun3(void)
149 mach_halt = sun3_halt; 147 mach_halt = sun3_halt;
150 mach_get_hardware_list = sun3_get_hardware_list; 148 mach_get_hardware_list = sun3_get_hardware_list;
151 149
152 memory_start = ((((int)&_end) + 0x2000) & ~0x1fff); 150 memory_start = ((((unsigned long)_end) + 0x2000) & ~0x1fff);
153// PROM seems to want the last couple of physical pages. --m 151// PROM seems to want the last couple of physical pages. --m
154 memory_end = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE; 152 memory_end = *(romvec->pv_sun3mem) + PAGE_OFFSET - 2*PAGE_SIZE;
155 153
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 60f9d4500d72..3cd19390aae5 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -27,7 +27,6 @@
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
28#include <asm/dvma.h> 28#include <asm/dvma.h>
29 29
30extern void prom_reboot (char *) __attribute__ ((__noreturn__));
31 30
32#undef DEBUG_MMU_EMU 31#undef DEBUG_MMU_EMU
33#define DEBUG_PROM_MAPS 32#define DEBUG_PROM_MAPS
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index 7364cd67455e..ad90393a3361 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -105,7 +105,10 @@ void __init sun3_init_IRQ(void)
105 m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7); 105 m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7);
106 m68k_setup_user_interrupt(VEC_USER, 128, NULL); 106 m68k_setup_user_interrupt(VEC_USER, 128, NULL);
107 107
108 request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL); 108 if (request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL))
109 request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL); 109 pr_err("Couldn't register %s interrupt\n", "int5");
110 request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL); 110 if (request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL))
111 pr_err("Couldn't register %s interrupt\n", "int7");
112 if (request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL))
113 pr_err("Couldn't register %s interrupt\n", "vec255");
111} 114}
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index 2b1ca2db070f..fc599fad4a54 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -23,7 +23,6 @@
23#include "time.h" 23#include "time.h"
24 24
25volatile char *clock_va; 25volatile char *clock_va;
26extern volatile unsigned char *sun3_intreg;
27 26
28extern void sun3_get_model(char *model); 27extern void sun3_get_model(char *model);
29 28
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 4b1d4ac960f1..8df436ff7068 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -156,7 +156,7 @@ static volatile int fdc_busy = -1;
156static volatile int fdc_nested; 156static volatile int fdc_nested;
157static DECLARE_WAIT_QUEUE_HEAD(fdc_wait); 157static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);
158 158
159static DECLARE_WAIT_QUEUE_HEAD(motor_wait); 159static DECLARE_COMPLETION(motor_on_completion);
160 160
161static volatile int selected = -1; /* currently selected drive */ 161static volatile int selected = -1; /* currently selected drive */
162 162
@@ -184,8 +184,7 @@ static unsigned char mfmencode[16]={
184static unsigned char mfmdecode[128]; 184static unsigned char mfmdecode[128];
185 185
186/* floppy internal millisecond timer stuff */ 186/* floppy internal millisecond timer stuff */
187static volatile int ms_busy = -1; 187static DECLARE_COMPLETION(ms_wait_completion);
188static DECLARE_WAIT_QUEUE_HEAD(ms_wait);
189#define MS_TICKS ((amiga_eclock+50)/1000) 188#define MS_TICKS ((amiga_eclock+50)/1000)
190 189
191/* 190/*
@@ -211,8 +210,7 @@ static int fd_device[4] = { 0, 0, 0, 0 };
211 210
212static irqreturn_t ms_isr(int irq, void *dummy) 211static irqreturn_t ms_isr(int irq, void *dummy)
213{ 212{
214 ms_busy = -1; 213 complete(&ms_wait_completion);
215 wake_up(&ms_wait);
216 return IRQ_HANDLED; 214 return IRQ_HANDLED;
217} 215}
218 216
@@ -220,19 +218,17 @@ static irqreturn_t ms_isr(int irq, void *dummy)
220 A more generic routine would do a schedule a la timer.device */ 218 A more generic routine would do a schedule a la timer.device */
221static void ms_delay(int ms) 219static void ms_delay(int ms)
222{ 220{
223 unsigned long flags;
224 int ticks; 221 int ticks;
222 static DEFINE_MUTEX(mutex);
223
225 if (ms > 0) { 224 if (ms > 0) {
226 local_irq_save(flags); 225 mutex_lock(&mutex);
227 while (ms_busy == 0)
228 sleep_on(&ms_wait);
229 ms_busy = 0;
230 local_irq_restore(flags);
231 ticks = MS_TICKS*ms-1; 226 ticks = MS_TICKS*ms-1;
232 ciaa.tblo=ticks%256; 227 ciaa.tblo=ticks%256;
233 ciaa.tbhi=ticks/256; 228 ciaa.tbhi=ticks/256;
234 ciaa.crb=0x19; /*count eclock, force load, one-shoot, start */ 229 ciaa.crb=0x19; /*count eclock, force load, one-shoot, start */
235 sleep_on(&ms_wait); 230 wait_for_completion(&ms_wait_completion);
231 mutex_unlock(&mutex);
236 } 232 }
237} 233}
238 234
@@ -254,8 +250,7 @@ static void get_fdc(int drive)
254 printk("get_fdc: drive %d fdc_busy %d fdc_nested %d\n",drive,fdc_busy,fdc_nested); 250 printk("get_fdc: drive %d fdc_busy %d fdc_nested %d\n",drive,fdc_busy,fdc_nested);
255#endif 251#endif
256 local_irq_save(flags); 252 local_irq_save(flags);
257 while (!try_fdc(drive)) 253 wait_event(fdc_wait, try_fdc(drive));
258 sleep_on(&fdc_wait);
259 fdc_busy = drive; 254 fdc_busy = drive;
260 fdc_nested++; 255 fdc_nested++;
261 local_irq_restore(flags); 256 local_irq_restore(flags);
@@ -330,7 +325,7 @@ static void fd_deselect (int drive)
330static void motor_on_callback(unsigned long nr) 325static void motor_on_callback(unsigned long nr)
331{ 326{
332 if (!(ciaa.pra & DSKRDY) || --on_attempts == 0) { 327 if (!(ciaa.pra & DSKRDY) || --on_attempts == 0) {
333 wake_up (&motor_wait); 328 complete_all(&motor_on_completion);
334 } else { 329 } else {
335 motor_on_timer.expires = jiffies + HZ/10; 330 motor_on_timer.expires = jiffies + HZ/10;
336 add_timer(&motor_on_timer); 331 add_timer(&motor_on_timer);
@@ -347,11 +342,12 @@ static int fd_motor_on(int nr)
347 unit[nr].motor = 1; 342 unit[nr].motor = 1;
348 fd_select(nr); 343 fd_select(nr);
349 344
345 INIT_COMPLETION(motor_on_completion);
350 motor_on_timer.data = nr; 346 motor_on_timer.data = nr;
351 mod_timer(&motor_on_timer, jiffies + HZ/2); 347 mod_timer(&motor_on_timer, jiffies + HZ/2);
352 348
353 on_attempts = 10; 349 on_attempts = 10;
354 sleep_on (&motor_wait); 350 wait_for_completion(&motor_on_completion);
355 fd_deselect(nr); 351 fd_deselect(nr);
356 } 352 }
357 353
@@ -582,8 +578,7 @@ static void raw_read(int drive)
582{ 578{
583 drive&=3; 579 drive&=3;
584 get_fdc(drive); 580 get_fdc(drive);
585 while (block_flag) 581 wait_event(wait_fd_block, !block_flag);
586 sleep_on(&wait_fd_block);
587 fd_select(drive); 582 fd_select(drive);
588 /* setup adkcon bits correctly */ 583 /* setup adkcon bits correctly */
589 custom.adkcon = ADK_MSBSYNC; 584 custom.adkcon = ADK_MSBSYNC;
@@ -598,8 +593,7 @@ static void raw_read(int drive)
598 593
599 block_flag = 1; 594 block_flag = 1;
600 595
601 while (block_flag) 596 wait_event(wait_fd_block, !block_flag);
602 sleep_on (&wait_fd_block);
603 597
604 custom.dsklen = 0; 598 custom.dsklen = 0;
605 fd_deselect(drive); 599 fd_deselect(drive);
@@ -616,8 +610,7 @@ static int raw_write(int drive)
616 rel_fdc(); 610 rel_fdc();
617 return 0; 611 return 0;
618 } 612 }
619 while (block_flag) 613 wait_event(wait_fd_block, !block_flag);
620 sleep_on(&wait_fd_block);
621 fd_select(drive); 614 fd_select(drive);
622 /* clear adkcon bits */ 615 /* clear adkcon bits */
623 custom.adkcon = ADK_PRECOMP1|ADK_PRECOMP0|ADK_WORDSYNC|ADK_MSBSYNC; 616 custom.adkcon = ADK_PRECOMP1|ADK_PRECOMP0|ADK_WORDSYNC|ADK_MSBSYNC;
@@ -1294,8 +1287,7 @@ static int non_int_flush_track (unsigned long nr)
1294 writepending = 0; 1287 writepending = 0;
1295 return 0; 1288 return 0;
1296 } 1289 }
1297 while (block_flag == 2) 1290 wait_event(wait_fd_block, block_flag != 2);
1298 sleep_on (&wait_fd_block);
1299 } 1291 }
1300 else { 1292 else {
1301 local_irq_restore(flags); 1293 local_irq_restore(flags);
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 4e0cfdeab146..a58869ea8513 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -1963,6 +1963,7 @@ static int __init rs_init(void)
1963{ 1963{
1964 unsigned long flags; 1964 unsigned long flags;
1965 struct serial_state * state; 1965 struct serial_state * state;
1966 int error;
1966 1967
1967 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_SERIAL)) 1968 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_SERIAL))
1968 return -ENODEV; 1969 return -ENODEV;
@@ -1975,8 +1976,11 @@ static int __init rs_init(void)
1975 * We request SERDAT and SERPER only, because the serial registers are 1976 * We request SERDAT and SERPER only, because the serial registers are
1976 * too spreaded over the custom register space 1977 * too spreaded over the custom register space
1977 */ 1978 */
1978 if (!request_mem_region(CUSTOM_PHYSADDR+0x30, 4, "amiserial [Paula]")) 1979 if (!request_mem_region(CUSTOM_PHYSADDR+0x30, 4,
1979 return -EBUSY; 1980 "amiserial [Paula]")) {
1981 error = -EBUSY;
1982 goto fail_put_tty_driver;
1983 }
1980 1984
1981 IRQ_ports = NULL; 1985 IRQ_ports = NULL;
1982 1986
@@ -1997,8 +2001,9 @@ static int __init rs_init(void)
1997 serial_driver->flags = TTY_DRIVER_REAL_RAW; 2001 serial_driver->flags = TTY_DRIVER_REAL_RAW;
1998 tty_set_operations(serial_driver, &serial_ops); 2002 tty_set_operations(serial_driver, &serial_ops);
1999 2003
2000 if (tty_register_driver(serial_driver)) 2004 error = tty_register_driver(serial_driver);
2001 panic("Couldn't register serial driver\n"); 2005 if (error)
2006 goto fail_release_mem_region;
2002 2007
2003 state = rs_table; 2008 state = rs_table;
2004 state->magic = SSTATE_MAGIC; 2009 state->magic = SSTATE_MAGIC;
@@ -2024,8 +2029,14 @@ static int __init rs_init(void)
2024 local_irq_save(flags); 2029 local_irq_save(flags);
2025 2030
2026 /* set ISRs, and then disable the rx interrupts */ 2031 /* set ISRs, and then disable the rx interrupts */
2027 request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); 2032 error = request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state);
2028 request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED, "serial RX", state); 2033 if (error)
2034 goto fail_unregister;
2035
2036 error = request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED,
2037 "serial RX", state);
2038 if (error)
2039 goto fail_free_irq;
2029 2040
2030 /* turn off Rx and Tx interrupts */ 2041 /* turn off Rx and Tx interrupts */
2031 custom.intena = IF_RBF | IF_TBE; 2042 custom.intena = IF_RBF | IF_TBE;
@@ -2045,6 +2056,16 @@ static int __init rs_init(void)
2045 ciab.ddra &= ~(SER_DCD | SER_CTS | SER_DSR); /* inputs */ 2056 ciab.ddra &= ~(SER_DCD | SER_CTS | SER_DSR); /* inputs */
2046 2057
2047 return 0; 2058 return 0;
2059
2060fail_free_irq:
2061 free_irq(IRQ_AMIGA_TBE, state);
2062fail_unregister:
2063 tty_unregister_driver(serial_driver);
2064fail_release_mem_region:
2065 release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
2066fail_put_tty_driver:
2067 put_tty_driver(serial_driver);
2068 return error;
2048} 2069}
2049 2070
2050static __exit void rs_exit(void) 2071static __exit void rs_exit(void)
@@ -2064,6 +2085,9 @@ static __exit void rs_exit(void)
2064 kfree(info); 2085 kfree(info);
2065 } 2086 }
2066 2087
2088 free_irq(IRQ_AMIGA_TBE, rs_table);
2089 free_irq(IRQ_AMIGA_RBF, rs_table);
2090
2067 release_mem_region(CUSTOM_PHYSADDR+0x30, 4); 2091 release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
2068} 2092}
2069 2093
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index 33872a219df6..33a2b531802e 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -718,6 +718,7 @@ static int __init a2232board_init(void)
718 u_char *from; 718 u_char *from;
719 volatile u_char *to; 719 volatile u_char *to;
720 volatile struct a2232memory *mem; 720 volatile struct a2232memory *mem;
721 int error, i;
721 722
722#ifdef CONFIG_SMP 723#ifdef CONFIG_SMP
723 return -ENODEV; /* This driver is not SMP aware. Is there an SMP ZorroII-bus-machine? */ 724 return -ENODEV; /* This driver is not SMP aware. Is there an SMP ZorroII-bus-machine? */
@@ -797,8 +798,15 @@ static int __init a2232board_init(void)
797 */ 798 */
798 if (a2232_init_drivers()) return -ENODEV; // maybe we should use a different -Exxx? 799 if (a2232_init_drivers()) return -ENODEV; // maybe we should use a different -Exxx?
799 800
800 request_irq(IRQ_AMIGA_VERTB, a2232_vbl_inter, 0, "A2232 serial VBL", a2232_driver_ID); 801 error = request_irq(IRQ_AMIGA_VERTB, a2232_vbl_inter, 0,
801 return 0; 802 "A2232 serial VBL", a2232_driver_ID);
803 if (error) {
804 for (i = 0; i < nr_a2232; i++)
805 zorro_release_device(zd_a2232[i]);
806 tty_unregister_driver(a2232_driver);
807 put_tty_driver(a2232_driver);
808 }
809 return error;
802} 810}
803 811
804static void __exit a2232board_exit(void) 812static void __exit a2232board_exit(void)
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index 0e8234bd0e19..994e1a58b987 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -198,6 +198,7 @@ static void scc_init_portstructs(void)
198static int mvme147_scc_init(void) 198static int mvme147_scc_init(void)
199{ 199{
200 struct scc_port *port; 200 struct scc_port *port;
201 int error;
201 202
202 printk(KERN_INFO "SCC: MVME147 Serial Driver\n"); 203 printk(KERN_INFO "SCC: MVME147 Serial Driver\n");
203 /* Init channel A */ 204 /* Init channel A */
@@ -207,14 +208,23 @@ static int mvme147_scc_init(void)
207 port->datap = port->ctrlp + 1; 208 port->datap = port->ctrlp + 1;
208 port->port_a = &scc_ports[0]; 209 port->port_a = &scc_ports[0];
209 port->port_b = &scc_ports[1]; 210 port->port_b = &scc_ports[1];
210 request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, 211 error = request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
211 "SCC-A TX", port); 212 "SCC-A TX", port);
212 request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, 213 if (error)
214 goto fail;
215 error = request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
213 "SCC-A status", port); 216 "SCC-A status", port);
214 request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, 217 if (error)
218 goto fail_free_a_tx;
219 error = request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
215 "SCC-A RX", port); 220 "SCC-A RX", port);
216 request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, 221 if (error)
217 "SCC-A special cond", port); 222 goto fail_free_a_stat;
223 error = request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int,
224 IRQF_DISABLED, "SCC-A special cond", port);
225 if (error)
226 goto fail_free_a_rx;
227
218 { 228 {
219 SCC_ACCESS_INIT(port); 229 SCC_ACCESS_INIT(port);
220 230
@@ -234,14 +244,23 @@ static int mvme147_scc_init(void)
234 port->datap = port->ctrlp + 1; 244 port->datap = port->ctrlp + 1;
235 port->port_a = &scc_ports[0]; 245 port->port_a = &scc_ports[0];
236 port->port_b = &scc_ports[1]; 246 port->port_b = &scc_ports[1];
237 request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, 247 error = request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
238 "SCC-B TX", port); 248 "SCC-B TX", port);
239 request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, 249 if (error)
250 goto fail_free_a_spcond;
251 error = request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
240 "SCC-B status", port); 252 "SCC-B status", port);
241 request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, 253 if (error)
254 goto fail_free_b_tx;
255 error = request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
242 "SCC-B RX", port); 256 "SCC-B RX", port);
243 request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, 257 if (error)
244 "SCC-B special cond", port); 258 goto fail_free_b_stat;
259 error = request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int,
260 IRQF_DISABLED, "SCC-B special cond", port);
261 if (error)
262 goto fail_free_b_rx;
263
245 { 264 {
246 SCC_ACCESS_INIT(port); 265 SCC_ACCESS_INIT(port);
247 266
@@ -257,6 +276,23 @@ static int mvme147_scc_init(void)
257 scc_init_drivers(); 276 scc_init_drivers();
258 277
259 return 0; 278 return 0;
279
280fail_free_b_rx:
281 free_irq(MVME147_IRQ_SCCB_RX, port);
282fail_free_b_stat:
283 free_irq(MVME147_IRQ_SCCB_STAT, port);
284fail_free_b_tx:
285 free_irq(MVME147_IRQ_SCCB_TX, port);
286fail_free_a_spcond:
287 free_irq(MVME147_IRQ_SCCA_SPCOND, port);
288fail_free_a_rx:
289 free_irq(MVME147_IRQ_SCCA_RX, port);
290fail_free_a_stat:
291 free_irq(MVME147_IRQ_SCCA_STAT, port);
292fail_free_a_tx:
293 free_irq(MVME147_IRQ_SCCA_TX, port);
294fail:
295 return error;
260} 296}
261#endif 297#endif
262 298
@@ -265,6 +301,7 @@ static int mvme147_scc_init(void)
265static int mvme162_scc_init(void) 301static int mvme162_scc_init(void)
266{ 302{
267 struct scc_port *port; 303 struct scc_port *port;
304 int error;
268 305
269 if (!(mvme16x_config & MVME16x_CONFIG_GOT_SCCA)) 306 if (!(mvme16x_config & MVME16x_CONFIG_GOT_SCCA))
270 return (-ENODEV); 307 return (-ENODEV);
@@ -277,14 +314,23 @@ static int mvme162_scc_init(void)
277 port->datap = port->ctrlp + 2; 314 port->datap = port->ctrlp + 2;
278 port->port_a = &scc_ports[0]; 315 port->port_a = &scc_ports[0];
279 port->port_b = &scc_ports[1]; 316 port->port_b = &scc_ports[1];
280 request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, 317 error = request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
281 "SCC-A TX", port); 318 "SCC-A TX", port);
282 request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, 319 if (error)
320 goto fail;
321 error = request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
283 "SCC-A status", port); 322 "SCC-A status", port);
284 request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, 323 if (error)
324 goto fail_free_a_tx;
325 error = request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
285 "SCC-A RX", port); 326 "SCC-A RX", port);
286 request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, 327 if (error)
287 "SCC-A special cond", port); 328 goto fail_free_a_stat;
329 error = request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int,
330 IRQF_DISABLED, "SCC-A special cond", port);
331 if (error)
332 goto fail_free_a_rx;
333
288 { 334 {
289 SCC_ACCESS_INIT(port); 335 SCC_ACCESS_INIT(port);
290 336
@@ -304,14 +350,22 @@ static int mvme162_scc_init(void)
304 port->datap = port->ctrlp + 2; 350 port->datap = port->ctrlp + 2;
305 port->port_a = &scc_ports[0]; 351 port->port_a = &scc_ports[0];
306 port->port_b = &scc_ports[1]; 352 port->port_b = &scc_ports[1];
307 request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, 353 error = request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
308 "SCC-B TX", port); 354 "SCC-B TX", port);
309 request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, 355 if (error)
356 goto fail_free_a_spcond;
357 error = request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
310 "SCC-B status", port); 358 "SCC-B status", port);
311 request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, 359 if (error)
360 goto fail_free_b_tx;
361 error = request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
312 "SCC-B RX", port); 362 "SCC-B RX", port);
313 request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, 363 if (error)
314 "SCC-B special cond", port); 364 goto fail_free_b_stat;
365 error = request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int,
366 IRQF_DISABLED, "SCC-B special cond", port);
367 if (error)
368 goto fail_free_b_rx;
315 369
316 { 370 {
317 SCC_ACCESS_INIT(port); /* Either channel will do */ 371 SCC_ACCESS_INIT(port); /* Either channel will do */
@@ -328,6 +382,23 @@ static int mvme162_scc_init(void)
328 scc_init_drivers(); 382 scc_init_drivers();
329 383
330 return 0; 384 return 0;
385
386fail_free_b_rx:
387 free_irq(MVME162_IRQ_SCCB_RX, port);
388fail_free_b_stat:
389 free_irq(MVME162_IRQ_SCCB_STAT, port);
390fail_free_b_tx:
391 free_irq(MVME162_IRQ_SCCB_TX, port);
392fail_free_a_spcond:
393 free_irq(MVME162_IRQ_SCCA_SPCOND, port);
394fail_free_a_rx:
395 free_irq(MVME162_IRQ_SCCA_RX, port);
396fail_free_a_stat:
397 free_irq(MVME162_IRQ_SCCA_STAT, port);
398fail_free_a_tx:
399 free_irq(MVME162_IRQ_SCCA_TX, port);
400fail:
401 return error;
331} 402}
332#endif 403#endif
333 404
@@ -336,6 +407,7 @@ static int mvme162_scc_init(void)
336static int bvme6000_scc_init(void) 407static int bvme6000_scc_init(void)
337{ 408{
338 struct scc_port *port; 409 struct scc_port *port;
410 int error;
339 411
340 printk(KERN_INFO "SCC: BVME6000 Serial Driver\n"); 412 printk(KERN_INFO "SCC: BVME6000 Serial Driver\n");
341 /* Init channel A */ 413 /* Init channel A */
@@ -345,14 +417,23 @@ static int bvme6000_scc_init(void)
345 port->datap = port->ctrlp + 4; 417 port->datap = port->ctrlp + 4;
346 port->port_a = &scc_ports[0]; 418 port->port_a = &scc_ports[0];
347 port->port_b = &scc_ports[1]; 419 port->port_b = &scc_ports[1];
348 request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, 420 error = request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED,
349 "SCC-A TX", port); 421 "SCC-A TX", port);
350 request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, 422 if (error)
423 goto fail;
424 error = request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED,
351 "SCC-A status", port); 425 "SCC-A status", port);
352 request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, 426 if (error)
427 goto fail_free_a_tx;
428 error = request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED,
353 "SCC-A RX", port); 429 "SCC-A RX", port);
354 request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, 430 if (error)
355 "SCC-A special cond", port); 431 goto fail_free_a_stat;
432 error = request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int,
433 IRQF_DISABLED, "SCC-A special cond", port);
434 if (error)
435 goto fail_free_a_rx;
436
356 { 437 {
357 SCC_ACCESS_INIT(port); 438 SCC_ACCESS_INIT(port);
358 439
@@ -372,14 +453,22 @@ static int bvme6000_scc_init(void)
372 port->datap = port->ctrlp + 4; 453 port->datap = port->ctrlp + 4;
373 port->port_a = &scc_ports[0]; 454 port->port_a = &scc_ports[0];
374 port->port_b = &scc_ports[1]; 455 port->port_b = &scc_ports[1];
375 request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, 456 error = request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED,
376 "SCC-B TX", port); 457 "SCC-B TX", port);
377 request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, 458 if (error)
459 goto fail_free_a_spcond;
460 error = request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED,
378 "SCC-B status", port); 461 "SCC-B status", port);
379 request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, 462 if (error)
463 goto fail_free_b_tx;
464 error = request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED,
380 "SCC-B RX", port); 465 "SCC-B RX", port);
381 request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, 466 if (error)
382 "SCC-B special cond", port); 467 goto fail_free_b_stat;
468 error = request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int,
469 IRQF_DISABLED, "SCC-B special cond", port);
470 if (error)
471 goto fail_free_b_rx;
383 472
384 { 473 {
385 SCC_ACCESS_INIT(port); /* Either channel will do */ 474 SCC_ACCESS_INIT(port); /* Either channel will do */
@@ -393,6 +482,23 @@ static int bvme6000_scc_init(void)
393 scc_init_drivers(); 482 scc_init_drivers();
394 483
395 return 0; 484 return 0;
485
486fail:
487 free_irq(BVME_IRQ_SCCA_STAT, port);
488fail_free_a_tx:
489 free_irq(BVME_IRQ_SCCA_RX, port);
490fail_free_a_stat:
491 free_irq(BVME_IRQ_SCCA_SPCOND, port);
492fail_free_a_rx:
493 free_irq(BVME_IRQ_SCCB_TX, port);
494fail_free_a_spcond:
495 free_irq(BVME_IRQ_SCCB_STAT, port);
496fail_free_b_tx:
497 free_irq(BVME_IRQ_SCCB_RX, port);
498fail_free_b_stat:
499 free_irq(BVME_IRQ_SCCB_SPCOND, port);
500fail_free_b_rx:
501 return error;
396} 502}
397#endif 503#endif
398 504
diff --git a/drivers/dio/dio-sysfs.c b/drivers/dio/dio-sysfs.c
index f46463038847..ee1a3b59bd4e 100644
--- a/drivers/dio/dio-sysfs.c
+++ b/drivers/dio/dio-sysfs.c
@@ -58,20 +58,25 @@ static ssize_t dio_show_resource(struct device *dev, struct device_attribute *at
58 struct dio_dev *d = to_dio_dev(dev); 58 struct dio_dev *d = to_dio_dev(dev);
59 59
60 return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n", 60 return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n",
61 dio_resource_start(d), dio_resource_end(d), 61 (unsigned long)dio_resource_start(d),
62 (unsigned long)dio_resource_end(d),
62 dio_resource_flags(d)); 63 dio_resource_flags(d));
63} 64}
64static DEVICE_ATTR(resource, S_IRUGO, dio_show_resource, NULL); 65static DEVICE_ATTR(resource, S_IRUGO, dio_show_resource, NULL);
65 66
66void dio_create_sysfs_dev_files(struct dio_dev *d) 67int dio_create_sysfs_dev_files(struct dio_dev *d)
67{ 68{
68 struct device *dev = &d->dev; 69 struct device *dev = &d->dev;
70 int error;
69 71
70 /* current configuration's attributes */ 72 /* current configuration's attributes */
71 device_create_file(dev, &dev_attr_id); 73 if ((error = device_create_file(dev, &dev_attr_id)) ||
72 device_create_file(dev, &dev_attr_ipl); 74 (error = device_create_file(dev, &dev_attr_ipl)) ||
73 device_create_file(dev, &dev_attr_secid); 75 (error = device_create_file(dev, &dev_attr_secid)) ||
74 device_create_file(dev, &dev_attr_name); 76 (error = device_create_file(dev, &dev_attr_name)) ||
75 device_create_file(dev, &dev_attr_resource); 77 (error = device_create_file(dev, &dev_attr_resource)))
78 return error;
79
80 return 0;
76} 81}
77 82
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 07f274f853d9..10c3c498358c 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -173,6 +173,7 @@ static int __init dio_init(void)
173 mm_segment_t fs; 173 mm_segment_t fs;
174 int i; 174 int i;
175 struct dio_dev *dev; 175 struct dio_dev *dev;
176 int error;
176 177
177 if (!MACH_IS_HP300) 178 if (!MACH_IS_HP300)
178 return 0; 179 return 0;
@@ -182,7 +183,11 @@ static int __init dio_init(void)
182 /* Initialize the DIO bus */ 183 /* Initialize the DIO bus */
183 INIT_LIST_HEAD(&dio_bus.devices); 184 INIT_LIST_HEAD(&dio_bus.devices);
184 strcpy(dio_bus.dev.bus_id, "dio"); 185 strcpy(dio_bus.dev.bus_id, "dio");
185 device_register(&dio_bus.dev); 186 error = device_register(&dio_bus.dev);
187 if (error) {
188 pr_err("DIO: Error registering dio_bus\n");
189 return error;
190 }
186 191
187 /* Request all resources */ 192 /* Request all resources */
188 dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2); 193 dio_bus.num_resources = (hp300_model == HP_320 ? 1 : 2);
@@ -252,8 +257,15 @@ static int __init dio_init(void)
252 257
253 if (scode >= DIOII_SCBASE) 258 if (scode >= DIOII_SCBASE)
254 iounmap(va); 259 iounmap(va);
255 device_register(&dev->dev); 260 error = device_register(&dev->dev);
256 dio_create_sysfs_dev_files(dev); 261 if (error) {
262 pr_err("DIO: Error registering device %s\n",
263 dev->name);
264 continue;
265 }
266 error = dio_create_sysfs_dev_files(dev);
267 if (error)
268 dev_err(&dev->dev, "Error creating sysfs files\n");
257 } 269 }
258 return 0; 270 return 0;
259} 271}
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index e39e33e797da..be2b657546ef 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_FB_DDC) += fb_ddc.o
28obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o 28obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o
29 29
30# Hardware specific drivers go first 30# Hardware specific drivers go first
31obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o 31obj-$(CONFIG_FB_AMIGA) += amifb.o c2p_planar.o
32obj-$(CONFIG_FB_ARC) += arcfb.o 32obj-$(CONFIG_FB_ARC) += arcfb.o
33obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o 33obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o
34obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o 34obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
@@ -72,7 +72,7 @@ obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o
72obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o 72obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o
73obj-$(CONFIG_FB_SGIVW) += sgivwfb.o 73obj-$(CONFIG_FB_SGIVW) += sgivwfb.o
74obj-$(CONFIG_FB_ACORN) += acornfb.o 74obj-$(CONFIG_FB_ACORN) += acornfb.o
75obj-$(CONFIG_FB_ATARI) += atafb.o c2p.o atafb_mfb.o \ 75obj-$(CONFIG_FB_ATARI) += atafb.o c2p_iplan2.o atafb_mfb.o \
76 atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o 76 atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o
77obj-$(CONFIG_FB_MAC) += macfb.o 77obj-$(CONFIG_FB_MAC) += macfb.o
78obj-$(CONFIG_FB_HECUBA) += hecubafb.o 78obj-$(CONFIG_FB_HECUBA) += hecubafb.o
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c
index b8e9a8682f2d..100f23661465 100644
--- a/drivers/video/amifb.c
+++ b/drivers/video/amifb.c
@@ -2159,9 +2159,9 @@ static void amifb_imageblit(struct fb_info *info, const struct fb_image *image)
2159 src += pitch; 2159 src += pitch;
2160 } 2160 }
2161 } else { 2161 } else {
2162 c2p(info->screen_base, image->data, dx, dy, width, height, 2162 c2p_planar(info->screen_base, image->data, dx, dy, width,
2163 par->next_line, par->next_plane, image->width, 2163 height, par->next_line, par->next_plane,
2164 info->var.bits_per_pixel); 2164 image->width, info->var.bits_per_pixel);
2165 } 2165 }
2166} 2166}
2167 2167
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index 77eb8b34fbfa..8058572a7428 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -122,7 +122,6 @@ static struct atafb_par {
122 void *screen_base; 122 void *screen_base;
123 int yres_virtual; 123 int yres_virtual;
124 u_long next_line; 124 u_long next_line;
125 u_long next_plane;
126#if defined ATAFB_TT || defined ATAFB_STE 125#if defined ATAFB_TT || defined ATAFB_STE
127 union { 126 union {
128 struct { 127 struct {
@@ -149,6 +148,7 @@ static struct atafb_par {
149 short mono; 148 short mono;
150 short ste_mode; 149 short ste_mode;
151 short bpp; 150 short bpp;
151 u32 pseudo_palette[16];
152 } falcon; 152 } falcon;
153#endif 153#endif
154 /* Nothing needed for external mode */ 154 /* Nothing needed for external mode */
@@ -614,7 +614,7 @@ static int tt_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
614 fix->xpanstep = 0; 614 fix->xpanstep = 0;
615 fix->ypanstep = 1; 615 fix->ypanstep = 1;
616 fix->ywrapstep = 0; 616 fix->ywrapstep = 0;
617 fix->line_length = 0; 617 fix->line_length = par->next_line;
618 fix->accel = FB_ACCEL_ATARIBLITT; 618 fix->accel = FB_ACCEL_ATARIBLITT;
619 return 0; 619 return 0;
620} 620}
@@ -691,6 +691,7 @@ static int tt_decode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
691 return -EINVAL; 691 return -EINVAL;
692 par->yres_virtual = yres_virtual; 692 par->yres_virtual = yres_virtual;
693 par->screen_base = screen_base + var->yoffset * linelen; 693 par->screen_base = screen_base + var->yoffset * linelen;
694 par->next_line = linelen;
694 return 0; 695 return 0;
695} 696}
696 697
@@ -884,10 +885,6 @@ static int vdl_prescale[4][3] = {
884/* Default hsync timing [mon_type] in picoseconds */ 885/* Default hsync timing [mon_type] in picoseconds */
885static long h_syncs[4] = { 3000000, 4875000, 4000000, 4875000 }; 886static long h_syncs[4] = { 3000000, 4875000, 4000000, 4875000 };
886 887
887#ifdef FBCON_HAS_CFB16
888static u16 fbcon_cfb16_cmap[16];
889#endif
890
891static inline int hxx_prescale(struct falcon_hw *hw) 888static inline int hxx_prescale(struct falcon_hw *hw)
892{ 889{
893 return hw->ste_mode ? 16 890 return hw->ste_mode ? 16
@@ -918,7 +915,7 @@ static int falcon_encode_fix(struct fb_fix_screeninfo *fix,
918 fix->visual = FB_VISUAL_TRUECOLOR; 915 fix->visual = FB_VISUAL_TRUECOLOR;
919 fix->xpanstep = 2; 916 fix->xpanstep = 2;
920 } 917 }
921 fix->line_length = 0; 918 fix->line_length = par->next_line;
922 fix->accel = FB_ACCEL_ATARIBLITT; 919 fix->accel = FB_ACCEL_ATARIBLITT;
923 return 0; 920 return 0;
924} 921}
@@ -1394,14 +1391,7 @@ set_screen_base:
1394 par->screen_base = screen_base + var->yoffset * linelen; 1391 par->screen_base = screen_base + var->yoffset * linelen;
1395 par->hw.falcon.xoffset = 0; 1392 par->hw.falcon.xoffset = 0;
1396 1393
1397 // FIXME!!! sort of works, no crash
1398 //par->next_line = linelen;
1399 //par->next_plane = yres_virtual * linelen;
1400 par->next_line = linelen; 1394 par->next_line = linelen;
1401 par->next_plane = 2;
1402 // crashes
1403 //par->next_plane = linelen;
1404 //par->next_line = yres_virtual * linelen;
1405 1395
1406 return 0; 1396 return 0;
1407} 1397}
@@ -1735,10 +1725,10 @@ static int falcon_setcolreg(unsigned int regno, unsigned int red,
1735 (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) | 1725 (((red & 0xe000) >> 13) | ((red & 0x1000) >> 12) << 8) |
1736 (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) | 1726 (((green & 0xe000) >> 13) | ((green & 0x1000) >> 12) << 4) |
1737 ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12); 1727 ((blue & 0xe000) >> 13) | ((blue & 0x1000) >> 12);
1738#ifdef FBCON_HAS_CFB16 1728#ifdef ATAFB_FALCON
1739 fbcon_cfb16_cmap[regno] = ((red & 0xf800) | 1729 ((u32 *)info->pseudo_palette)[regno] = ((red & 0xf800) |
1740 ((green & 0xfc00) >> 5) | 1730 ((green & 0xfc00) >> 5) |
1741 ((blue & 0xf800) >> 11)); 1731 ((blue & 0xf800) >> 11));
1742#endif 1732#endif
1743 } 1733 }
1744 return 0; 1734 return 0;
@@ -1852,7 +1842,7 @@ static int stste_encode_fix(struct fb_fix_screeninfo *fix,
1852 fix->ypanstep = 0; 1842 fix->ypanstep = 0;
1853 } 1843 }
1854 fix->ywrapstep = 0; 1844 fix->ywrapstep = 0;
1855 fix->line_length = 0; 1845 fix->line_length = par->next_line;
1856 fix->accel = FB_ACCEL_ATARIBLITT; 1846 fix->accel = FB_ACCEL_ATARIBLITT;
1857 return 0; 1847 return 0;
1858} 1848}
@@ -1910,6 +1900,7 @@ static int stste_decode_var(struct fb_var_screeninfo *var,
1910 return -EINVAL; 1900 return -EINVAL;
1911 par->yres_virtual = yres_virtual; 1901 par->yres_virtual = yres_virtual;
1912 par->screen_base = screen_base + var->yoffset * linelen; 1902 par->screen_base = screen_base + var->yoffset * linelen;
1903 par->next_line = linelen;
1913 return 0; 1904 return 0;
1914} 1905}
1915 1906
@@ -2169,7 +2160,7 @@ static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
2169 fix->xpanstep = 0; 2160 fix->xpanstep = 0;
2170 fix->ypanstep = 0; 2161 fix->ypanstep = 0;
2171 fix->ywrapstep = 0; 2162 fix->ywrapstep = 0;
2172 fix->line_length = 0; 2163 fix->line_length = par->next_line;
2173 return 0; 2164 return 0;
2174} 2165}
2175 2166
@@ -2184,6 +2175,8 @@ static int ext_decode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
2184 var->xoffset > 0 || 2175 var->xoffset > 0 ||
2185 var->yoffset > 0) 2176 var->yoffset > 0)
2186 return -EINVAL; 2177 return -EINVAL;
2178
2179 par->next_line = external_xres_virtual * external_depth / 8;
2187 return 0; 2180 return 0;
2188} 2181}
2189 2182
@@ -2443,42 +2436,6 @@ static void atafb_set_disp(struct fb_info *info)
2443 atafb_get_fix(&info->fix, info); 2436 atafb_get_fix(&info->fix, info);
2444 2437
2445 info->screen_base = (void *)info->fix.smem_start; 2438 info->screen_base = (void *)info->fix.smem_start;
2446
2447 switch (info->fix.type) {
2448 case FB_TYPE_INTERLEAVED_PLANES:
2449 switch (info->var.bits_per_pixel) {
2450 case 2:
2451 // display->dispsw = &fbcon_iplan2p2;
2452 break;
2453 case 4:
2454 // display->dispsw = &fbcon_iplan2p4;
2455 break;
2456 case 8:
2457 // display->dispsw = &fbcon_iplan2p8;
2458 break;
2459 }
2460 break;
2461 case FB_TYPE_PACKED_PIXELS:
2462 switch (info->var.bits_per_pixel) {
2463#ifdef FBCON_HAS_MFB
2464 case 1:
2465 // display->dispsw = &fbcon_mfb;
2466 break;
2467#endif
2468#ifdef FBCON_HAS_CFB8
2469 case 8:
2470 // display->dispsw = &fbcon_cfb8;
2471 break;
2472#endif
2473#ifdef FBCON_HAS_CFB16
2474 case 16:
2475 // display->dispsw = &fbcon_cfb16;
2476 // display->dispsw_data = fbcon_cfb16_cmap;
2477 break;
2478#endif
2479 }
2480 break;
2481 }
2482} 2439}
2483 2440
2484static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 2441static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -2549,6 +2506,13 @@ static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
2549 if (!rect->width || !rect->height) 2506 if (!rect->width || !rect->height)
2550 return; 2507 return;
2551 2508
2509#ifdef ATAFB_FALCON
2510 if (info->var.bits_per_pixel == 16) {
2511 cfb_fillrect(info, rect);
2512 return;
2513 }
2514#endif
2515
2552 /* 2516 /*
2553 * We could use hardware clipping but on many cards you get around 2517 * We could use hardware clipping but on many cards you get around
2554 * hardware clipping by writing to framebuffer directly. 2518 * hardware clipping by writing to framebuffer directly.
@@ -2583,6 +2547,13 @@ static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
2583 u32 dx, dy, sx, sy, width, height; 2547 u32 dx, dy, sx, sy, width, height;
2584 int rev_copy = 0; 2548 int rev_copy = 0;
2585 2549
2550#ifdef ATAFB_FALCON
2551 if (info->var.bits_per_pixel == 16) {
2552 cfb_copyarea(info, area);
2553 return;
2554 }
2555#endif
2556
2586 /* clip the destination */ 2557 /* clip the destination */
2587 x2 = area->dx + area->width; 2558 x2 = area->dx + area->width;
2588 y2 = area->dy + area->height; 2559 y2 = area->dy + area->height;
@@ -2632,6 +2603,13 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image)
2632 const char *src; 2603 const char *src;
2633 u32 dx, dy, width, height, pitch; 2604 u32 dx, dy, width, height, pitch;
2634 2605
2606#ifdef ATAFB_FALCON
2607 if (info->var.bits_per_pixel == 16) {
2608 cfb_imageblit(info, image);
2609 return;
2610 }
2611#endif
2612
2635 /* 2613 /*
2636 * We could use hardware clipping but on many cards you get around 2614 * We could use hardware clipping but on many cards you get around
2637 * hardware clipping by writing to framebuffer directly like we are 2615 * hardware clipping by writing to framebuffer directly like we are
@@ -2676,10 +2654,9 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image)
2676 src += pitch; 2654 src += pitch;
2677 } 2655 }
2678 } else { 2656 } else {
2679 // only used for logo; broken 2657 c2p_iplan2(info->screen_base, image->data, dx, dy, width,
2680 c2p(info->screen_base, image->data, dx, dy, width, height, 2658 height, par->next_line, image->width,
2681 par->next_line, par->next_plane, image->width, 2659 info->var.bits_per_pixel);
2682 info->var.bits_per_pixel);
2683 } 2660 }
2684} 2661}
2685 2662
@@ -3098,8 +3075,7 @@ int __init atafb_setup(char *options)
3098 3075
3099int __init atafb_init(void) 3076int __init atafb_init(void)
3100{ 3077{
3101 int pad; 3078 int pad, detected_mode, error;
3102 int detected_mode;
3103 unsigned int defmode = 0; 3079 unsigned int defmode = 0;
3104 unsigned long mem_req; 3080 unsigned long mem_req;
3105 3081
@@ -3139,8 +3115,12 @@ int __init atafb_init(void)
3139 printk("atafb_init: initializing Falcon hw\n"); 3115 printk("atafb_init: initializing Falcon hw\n");
3140 fbhw = &falcon_switch; 3116 fbhw = &falcon_switch;
3141 atafb_ops.fb_setcolreg = &falcon_setcolreg; 3117 atafb_ops.fb_setcolreg = &falcon_setcolreg;
3142 request_irq(IRQ_AUTO_4, falcon_vbl_switcher, IRQ_TYPE_PRIO, 3118 error = request_irq(IRQ_AUTO_4, falcon_vbl_switcher,
3143 "framebuffer/modeswitch", falcon_vbl_switcher); 3119 IRQ_TYPE_PRIO,
3120 "framebuffer/modeswitch",
3121 falcon_vbl_switcher);
3122 if (error)
3123 return error;
3144 defmode = DEFMODE_F30; 3124 defmode = DEFMODE_F30;
3145 break; 3125 break;
3146 } 3126 }
@@ -3225,6 +3205,10 @@ int __init atafb_init(void)
3225 // tries to read from HW which may not be initialized yet 3205 // tries to read from HW which may not be initialized yet
3226 // so set sane var first, then call atafb_set_par 3206 // so set sane var first, then call atafb_set_par
3227 atafb_get_var(&fb_info.var, &fb_info); 3207 atafb_get_var(&fb_info.var, &fb_info);
3208
3209#ifdef ATAFB_FALCON
3210 fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette;
3211#endif
3228 fb_info.flags = FBINFO_FLAG_DEFAULT; 3212 fb_info.flags = FBINFO_FLAG_DEFAULT;
3229 3213
3230 if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, atafb_modedb, 3214 if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, atafb_modedb,
diff --git a/drivers/video/c2p.c b/drivers/video/c2p.c
deleted file mode 100644
index 376bc07ff952..000000000000
--- a/drivers/video/c2p.c
+++ /dev/null
@@ -1,232 +0,0 @@
1/*
2 * Fast C2P (Chunky-to-Planar) Conversion
3 *
4 * Copyright (C) 2003 Geert Uytterhoeven
5 *
6 * NOTES:
7 * - This code was inspired by Scout's C2P tutorial
8 * - It assumes to run on a big endian system
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
12 * for more details.
13 */
14
15#include <linux/module.h>
16#include <linux/string.h>
17#include "c2p.h"
18
19
20 /*
21 * Basic transpose step
22 */
23
24#define _transp(d, i1, i2, shift, mask) \
25 do { \
26 u32 t = (d[i1] ^ (d[i2] >> shift)) & mask; \
27 d[i1] ^= t; \
28 d[i2] ^= t << shift; \
29 } while (0)
30
31static inline u32 get_mask(int n)
32{
33 switch (n) {
34 case 1:
35 return 0x55555555;
36 break;
37
38 case 2:
39 return 0x33333333;
40 break;
41
42 case 4:
43 return 0x0f0f0f0f;
44 break;
45
46 case 8:
47 return 0x00ff00ff;
48 break;
49
50 case 16:
51 return 0x0000ffff;
52 break;
53 }
54 return 0;
55}
56
57#define transp_nx1(d, n) \
58 do { \
59 u32 mask = get_mask(n); \
60 /* First block */ \
61 _transp(d, 0, 1, n, mask); \
62 /* Second block */ \
63 _transp(d, 2, 3, n, mask); \
64 /* Third block */ \
65 _transp(d, 4, 5, n, mask); \
66 /* Fourth block */ \
67 _transp(d, 6, 7, n, mask); \
68 } while (0)
69
70#define transp_nx2(d, n) \
71 do { \
72 u32 mask = get_mask(n); \
73 /* First block */ \
74 _transp(d, 0, 2, n, mask); \
75 _transp(d, 1, 3, n, mask); \
76 /* Second block */ \
77 _transp(d, 4, 6, n, mask); \
78 _transp(d, 5, 7, n, mask); \
79 } while (0)
80
81#define transp_nx4(d, n) \
82 do { \
83 u32 mask = get_mask(n); \
84 _transp(d, 0, 4, n, mask); \
85 _transp(d, 1, 5, n, mask); \
86 _transp(d, 2, 6, n, mask); \
87 _transp(d, 3, 7, n, mask); \
88 } while (0)
89
90#define transp(d, n, m) transp_nx ## m(d, n)
91
92
93 /*
94 * Perform a full C2P step on 32 8-bit pixels, stored in 8 32-bit words
95 * containing
96 * - 32 8-bit chunky pixels on input
97 * - permuted planar data on output
98 */
99
100static void c2p_8bpp(u32 d[8])
101{
102 transp(d, 16, 4);
103 transp(d, 8, 2);
104 transp(d, 4, 1);
105 transp(d, 2, 4);
106 transp(d, 1, 2);
107}
108
109
110 /*
111 * Array containing the permution indices of the planar data after c2p
112 */
113
114static const int perm_c2p_8bpp[8] = { 7, 5, 3, 1, 6, 4, 2, 0 };
115
116
117 /*
118 * Compose two values, using a bitmask as decision value
119 * This is equivalent to (a & mask) | (b & ~mask)
120 */
121
122static inline unsigned long comp(unsigned long a, unsigned long b,
123 unsigned long mask)
124{
125 return ((a ^ b) & mask) ^ b;
126}
127
128
129 /*
130 * Store a full block of planar data after c2p conversion
131 */
132
133static inline void store_planar(char *dst, u32 dst_inc, u32 bpp, u32 d[8])
134{
135 int i;
136
137 for (i = 0; i < bpp; i++, dst += dst_inc)
138 *(u32 *)dst = d[perm_c2p_8bpp[i]];
139}
140
141
142 /*
143 * Store a partial block of planar data after c2p conversion
144 */
145
146static inline void store_planar_masked(char *dst, u32 dst_inc, u32 bpp,
147 u32 d[8], u32 mask)
148{
149 int i;
150
151 for (i = 0; i < bpp; i++, dst += dst_inc)
152 *(u32 *)dst = comp(d[perm_c2p_8bpp[i]], *(u32 *)dst, mask);
153}
154
155
156 /*
157 * c2p - Copy 8-bit chunky image data to a planar frame buffer
158 * @dst: Starting address of the planar frame buffer
159 * @dx: Horizontal destination offset (in pixels)
160 * @dy: Vertical destination offset (in pixels)
161 * @width: Image width (in pixels)
162 * @height: Image height (in pixels)
163 * @dst_nextline: Frame buffer offset to the next line (in bytes)
164 * @dst_nextplane: Frame buffer offset to the next plane (in bytes)
165 * @src_nextline: Image offset to the next line (in bytes)
166 * @bpp: Bits per pixel of the planar frame buffer (1-8)
167 */
168
169void c2p(u8 *dst, const u8 *src, u32 dx, u32 dy, u32 width, u32 height,
170 u32 dst_nextline, u32 dst_nextplane, u32 src_nextline, u32 bpp)
171{
172 int dst_idx;
173 u32 d[8], first, last, w;
174 const u8 *c;
175 u8 *p;
176
177 dst += dy*dst_nextline+(dx & ~31);
178 dst_idx = dx % 32;
179 first = ~0UL >> dst_idx;
180 last = ~(~0UL >> ((dst_idx+width) % 32));
181 while (height--) {
182 c = src;
183 p = dst;
184 w = width;
185 if (dst_idx+width <= 32) {
186 /* Single destination word */
187 first &= last;
188 memset(d, 0, sizeof(d));
189 memcpy((u8 *)d+dst_idx, c, width);
190 c += width;
191 c2p_8bpp(d);
192 store_planar_masked(p, dst_nextplane, bpp, d, first);
193 p += 4;
194 } else {
195 /* Multiple destination words */
196 w = width;
197 /* Leading bits */
198 if (dst_idx) {
199 w = 32 - dst_idx;
200 memset(d, 0, dst_idx);
201 memcpy((u8 *)d+dst_idx, c, w);
202 c += w;
203 c2p_8bpp(d);
204 store_planar_masked(p, dst_nextplane, bpp, d, first);
205 p += 4;
206 w = width-w;
207 }
208 /* Main chunk */
209 while (w >= 32) {
210 memcpy(d, c, 32);
211 c += 32;
212 c2p_8bpp(d);
213 store_planar(p, dst_nextplane, bpp, d);
214 p += 4;
215 w -= 32;
216 }
217 /* Trailing bits */
218 w %= 32;
219 if (w > 0) {
220 memcpy(d, c, w);
221 memset((u8 *)d+w, 0, 32-w);
222 c2p_8bpp(d);
223 store_planar_masked(p, dst_nextplane, bpp, d, last);
224 }
225 }
226 src += src_nextline;
227 dst += dst_nextline;
228 }
229}
230EXPORT_SYMBOL_GPL(c2p);
231
232MODULE_LICENSE("GPL");
diff --git a/drivers/video/c2p.h b/drivers/video/c2p.h
index c77cbf17e043..6c38d40427d8 100644
--- a/drivers/video/c2p.h
+++ b/drivers/video/c2p.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Fast C2P (Chunky-to-Planar) Conversion 2 * Fast C2P (Chunky-to-Planar) Conversion
3 * 3 *
4 * Copyright (C) 2003 Geert Uytterhoeven 4 * Copyright (C) 2003-2008 Geert Uytterhoeven
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive 7 * License. See the file COPYING in the main directory of this archive
@@ -10,7 +10,10 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13extern void c2p(u8 *dst, const u8 *src, u32 dx, u32 dy, u32 width, u32 height, 13extern void c2p_planar(void *dst, const void *src, u32 dx, u32 dy, u32 width,
14 u32 dst_nextline, u32 dst_nextplane, u32 src_nextline, 14 u32 height, u32 dst_nextline, u32 dst_nextplane,
15 u32 bpp); 15 u32 src_nextline, u32 bpp);
16 16
17extern void c2p_iplan2(void *dst, const void *src, u32 dx, u32 dy, u32 width,
18 u32 height, u32 dst_nextline, u32 src_nextline,
19 u32 bpp);
diff --git a/drivers/video/c2p_core.h b/drivers/video/c2p_core.h
new file mode 100644
index 000000000000..e1035a865fb9
--- /dev/null
+++ b/drivers/video/c2p_core.h
@@ -0,0 +1,153 @@
1/*
2 * Fast C2P (Chunky-to-Planar) Conversion
3 *
4 * Copyright (C) 2003-2008 Geert Uytterhoeven
5 *
6 * NOTES:
7 * - This code was inspired by Scout's C2P tutorial
8 * - It assumes to run on a big endian system
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive
12 * for more details.
13 */
14
15
16 /*
17 * Basic transpose step
18 */
19
20static inline void _transp(u32 d[], unsigned int i1, unsigned int i2,
21 unsigned int shift, u32 mask)
22{
23 u32 t = (d[i1] ^ (d[i2] >> shift)) & mask;
24
25 d[i1] ^= t;
26 d[i2] ^= t << shift;
27}
28
29
30extern void c2p_unsupported(void);
31
32static inline u32 get_mask(unsigned int n)
33{
34 switch (n) {
35 case 1:
36 return 0x55555555;
37
38 case 2:
39 return 0x33333333;
40
41 case 4:
42 return 0x0f0f0f0f;
43
44 case 8:
45 return 0x00ff00ff;
46
47 case 16:
48 return 0x0000ffff;
49 }
50
51 c2p_unsupported();
52 return 0;
53}
54
55
56 /*
57 * Transpose operations on 8 32-bit words
58 */
59
60static inline void transp8(u32 d[], unsigned int n, unsigned int m)
61{
62 u32 mask = get_mask(n);
63
64 switch (m) {
65 case 1:
66 /* First n x 1 block */
67 _transp(d, 0, 1, n, mask);
68 /* Second n x 1 block */
69 _transp(d, 2, 3, n, mask);
70 /* Third n x 1 block */
71 _transp(d, 4, 5, n, mask);
72 /* Fourth n x 1 block */
73 _transp(d, 6, 7, n, mask);
74 return;
75
76 case 2:
77 /* First n x 2 block */
78 _transp(d, 0, 2, n, mask);
79 _transp(d, 1, 3, n, mask);
80 /* Second n x 2 block */
81 _transp(d, 4, 6, n, mask);
82 _transp(d, 5, 7, n, mask);
83 return;
84
85 case 4:
86 /* Single n x 4 block */
87 _transp(d, 0, 4, n, mask);
88 _transp(d, 1, 5, n, mask);
89 _transp(d, 2, 6, n, mask);
90 _transp(d, 3, 7, n, mask);
91 return;
92 }
93
94 c2p_unsupported();
95}
96
97
98 /*
99 * Transpose operations on 4 32-bit words
100 */
101
102static inline void transp4(u32 d[], unsigned int n, unsigned int m)
103{
104 u32 mask = get_mask(n);
105
106 switch (m) {
107 case 1:
108 /* First n x 1 block */
109 _transp(d, 0, 1, n, mask);
110 /* Second n x 1 block */
111 _transp(d, 2, 3, n, mask);
112 return;
113
114 case 2:
115 /* Single n x 2 block */
116 _transp(d, 0, 2, n, mask);
117 _transp(d, 1, 3, n, mask);
118 return;
119 }
120
121 c2p_unsupported();
122}
123
124
125 /*
126 * Transpose operations on 4 32-bit words (reverse order)
127 */
128
129static inline void transp4x(u32 d[], unsigned int n, unsigned int m)
130{
131 u32 mask = get_mask(n);
132
133 switch (m) {
134 case 2:
135 /* Single n x 2 block */
136 _transp(d, 2, 0, n, mask);
137 _transp(d, 3, 1, n, mask);
138 return;
139 }
140
141 c2p_unsupported();
142}
143
144
145 /*
146 * Compose two values, using a bitmask as decision value
147 * This is equivalent to (a & mask) | (b & ~mask)
148 */
149
150static inline u32 comp(u32 a, u32 b, u32 mask)
151{
152 return ((a ^ b) & mask) ^ b;
153}
diff --git a/drivers/video/c2p_iplan2.c b/drivers/video/c2p_iplan2.c
new file mode 100644
index 000000000000..19156dc6158c
--- /dev/null
+++ b/drivers/video/c2p_iplan2.c
@@ -0,0 +1,153 @@
1/*
2 * Fast C2P (Chunky-to-Planar) Conversion
3 *
4 * Copyright (C) 2003-2008 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/string.h>
13
14#include <asm/unaligned.h>
15
16#include "c2p.h"
17#include "c2p_core.h"
18
19
20 /*
21 * Perform a full C2P step on 16 8-bit pixels, stored in 4 32-bit words
22 * containing
23 * - 16 8-bit chunky pixels on input
24 * - permutated planar data (2 planes per 32-bit word) on output
25 */
26
27static void c2p_16x8(u32 d[4])
28{
29 transp4(d, 8, 2);
30 transp4(d, 1, 2);
31 transp4x(d, 16, 2);
32 transp4x(d, 2, 2);
33 transp4(d, 4, 1);
34}
35
36
37 /*
38 * Array containing the permutation indices of the planar data after c2p
39 */
40
41static const int perm_c2p_16x8[4] = { 1, 3, 0, 2 };
42
43
44 /*
45 * Store a full block of iplan2 data after c2p conversion
46 */
47
48static inline void store_iplan2(void *dst, u32 bpp, u32 d[4])
49{
50 int i;
51
52 for (i = 0; i < bpp/2; i++, dst += 4)
53 put_unaligned_be32(d[perm_c2p_16x8[i]], dst);
54}
55
56
57 /*
58 * Store a partial block of iplan2 data after c2p conversion
59 */
60
61static inline void store_iplan2_masked(void *dst, u32 bpp, u32 d[4], u32 mask)
62{
63 int i;
64
65 for (i = 0; i < bpp/2; i++, dst += 4)
66 put_unaligned_be32(comp(d[perm_c2p_16x8[i]],
67 get_unaligned_be32(dst), mask),
68 dst);
69}
70
71
72 /*
73 * c2p_iplan2 - Copy 8-bit chunky image data to an interleaved planar
74 * frame buffer with 2 bytes of interleave
75 * @dst: Starting address of the planar frame buffer
76 * @dx: Horizontal destination offset (in pixels)
77 * @dy: Vertical destination offset (in pixels)
78 * @width: Image width (in pixels)
79 * @height: Image height (in pixels)
80 * @dst_nextline: Frame buffer offset to the next line (in bytes)
81 * @src_nextline: Image offset to the next line (in bytes)
82 * @bpp: Bits per pixel of the planar frame buffer (2, 4, or 8)
83 */
84
85void c2p_iplan2(void *dst, const void *src, u32 dx, u32 dy, u32 width,
86 u32 height, u32 dst_nextline, u32 src_nextline, u32 bpp)
87{
88 union {
89 u8 pixels[16];
90 u32 words[4];
91 } d;
92 u32 dst_idx, first, last, w;
93 const u8 *c;
94 void *p;
95
96 dst += dy*dst_nextline+(dx & ~15)*bpp;
97 dst_idx = dx % 16;
98 first = 0xffffU >> dst_idx;
99 first |= first << 16;
100 last = 0xffffU ^ (0xffffU >> ((dst_idx+width) % 16));
101 last |= last << 16;
102 while (height--) {
103 c = src;
104 p = dst;
105 w = width;
106 if (dst_idx+width <= 16) {
107 /* Single destination word */
108 first &= last;
109 memset(d.pixels, 0, sizeof(d));
110 memcpy(d.pixels+dst_idx, c, width);
111 c += width;
112 c2p_16x8(d.words);
113 store_iplan2_masked(p, bpp, d.words, first);
114 p += bpp*2;
115 } else {
116 /* Multiple destination words */
117 w = width;
118 /* Leading bits */
119 if (dst_idx) {
120 w = 16 - dst_idx;
121 memset(d.pixels, 0, dst_idx);
122 memcpy(d.pixels+dst_idx, c, w);
123 c += w;
124 c2p_16x8(d.words);
125 store_iplan2_masked(p, bpp, d.words, first);
126 p += bpp*2;
127 w = width-w;
128 }
129 /* Main chunk */
130 while (w >= 16) {
131 memcpy(d.pixels, c, 16);
132 c += 16;
133 c2p_16x8(d.words);
134 store_iplan2(p, bpp, d.words);
135 p += bpp*2;
136 w -= 16;
137 }
138 /* Trailing bits */
139 w %= 16;
140 if (w > 0) {
141 memcpy(d.pixels, c, w);
142 memset(d.pixels+w, 0, 16-w);
143 c2p_16x8(d.words);
144 store_iplan2_masked(p, bpp, d.words, last);
145 }
146 }
147 src += src_nextline;
148 dst += dst_nextline;
149 }
150}
151EXPORT_SYMBOL_GPL(c2p_iplan2);
152
153MODULE_LICENSE("GPL");
diff --git a/drivers/video/c2p_planar.c b/drivers/video/c2p_planar.c
new file mode 100644
index 000000000000..ec7ac8526f06
--- /dev/null
+++ b/drivers/video/c2p_planar.c
@@ -0,0 +1,156 @@
1/*
2 * Fast C2P (Chunky-to-Planar) Conversion
3 *
4 * Copyright (C) 2003-2008 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/string.h>
13
14#include <asm/unaligned.h>
15
16#include "c2p.h"
17#include "c2p_core.h"
18
19
20 /*
21 * Perform a full C2P step on 32 8-bit pixels, stored in 8 32-bit words
22 * containing
23 * - 32 8-bit chunky pixels on input
24 * - permutated planar data (1 plane per 32-bit word) on output
25 */
26
27static void c2p_32x8(u32 d[8])
28{
29 transp8(d, 16, 4);
30 transp8(d, 8, 2);
31 transp8(d, 4, 1);
32 transp8(d, 2, 4);
33 transp8(d, 1, 2);
34}
35
36
37 /*
38 * Array containing the permutation indices of the planar data after c2p
39 */
40
41static const int perm_c2p_32x8[8] = { 7, 5, 3, 1, 6, 4, 2, 0 };
42
43
44 /*
45 * Store a full block of planar data after c2p conversion
46 */
47
48static inline void store_planar(void *dst, u32 dst_inc, u32 bpp, u32 d[8])
49{
50 int i;
51
52 for (i = 0; i < bpp; i++, dst += dst_inc)
53 put_unaligned_be32(d[perm_c2p_32x8[i]], dst);
54}
55
56
57 /*
58 * Store a partial block of planar data after c2p conversion
59 */
60
61static inline void store_planar_masked(void *dst, u32 dst_inc, u32 bpp,
62 u32 d[8], u32 mask)
63{
64 int i;
65
66 for (i = 0; i < bpp; i++, dst += dst_inc)
67 put_unaligned_be32(comp(d[perm_c2p_32x8[i]],
68 get_unaligned_be32(dst), mask),
69 dst);
70}
71
72
73 /*
74 * c2p_planar - Copy 8-bit chunky image data to a planar frame buffer
75 * @dst: Starting address of the planar frame buffer
76 * @dx: Horizontal destination offset (in pixels)
77 * @dy: Vertical destination offset (in pixels)
78 * @width: Image width (in pixels)
79 * @height: Image height (in pixels)
80 * @dst_nextline: Frame buffer offset to the next line (in bytes)
81 * @dst_nextplane: Frame buffer offset to the next plane (in bytes)
82 * @src_nextline: Image offset to the next line (in bytes)
83 * @bpp: Bits per pixel of the planar frame buffer (1-8)
84 */
85
86void c2p_planar(void *dst, const void *src, u32 dx, u32 dy, u32 width,
87 u32 height, u32 dst_nextline, u32 dst_nextplane,
88 u32 src_nextline, u32 bpp)
89{
90 union {
91 u8 pixels[32];
92 u32 words[8];
93 } d;
94 u32 dst_idx, first, last, w;
95 const u8 *c;
96 void *p;
97
98 dst += dy*dst_nextline+(dx & ~31);
99 dst_idx = dx % 32;
100 first = 0xffffffffU >> dst_idx;
101 last = ~(0xffffffffU >> ((dst_idx+width) % 32));
102 while (height--) {
103 c = src;
104 p = dst;
105 w = width;
106 if (dst_idx+width <= 32) {
107 /* Single destination word */
108 first &= last;
109 memset(d.pixels, 0, sizeof(d));
110 memcpy(d.pixels+dst_idx, c, width);
111 c += width;
112 c2p_32x8(d.words);
113 store_planar_masked(p, dst_nextplane, bpp, d.words,
114 first);
115 p += 4;
116 } else {
117 /* Multiple destination words */
118 w = width;
119 /* Leading bits */
120 if (dst_idx) {
121 w = 32 - dst_idx;
122 memset(d.pixels, 0, dst_idx);
123 memcpy(d.pixels+dst_idx, c, w);
124 c += w;
125 c2p_32x8(d.words);
126 store_planar_masked(p, dst_nextplane, bpp,
127 d.words, first);
128 p += 4;
129 w = width-w;
130 }
131 /* Main chunk */
132 while (w >= 32) {
133 memcpy(d.pixels, c, 32);
134 c += 32;
135 c2p_32x8(d.words);
136 store_planar(p, dst_nextplane, bpp, d.words);
137 p += 4;
138 w -= 32;
139 }
140 /* Trailing bits */
141 w %= 32;
142 if (w > 0) {
143 memcpy(d.pixels, c, w);
144 memset(d.pixels+w, 0, 32-w);
145 c2p_32x8(d.words);
146 store_planar_masked(p, dst_nextplane, bpp,
147 d.words, last);
148 }
149 }
150 src += src_nextline;
151 dst += dst_nextline;
152 }
153}
154EXPORT_SYMBOL_GPL(c2p_planar);
155
156MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 4bcff81b50e0..1657b9608b04 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -78,13 +78,6 @@
78#include <asm/fb.h> 78#include <asm/fb.h>
79#include <asm/irq.h> 79#include <asm/irq.h>
80#include <asm/system.h> 80#include <asm/system.h>
81#ifdef CONFIG_ATARI
82#include <asm/atariints.h>
83#endif
84#if defined(__mc68000__)
85#include <asm/machdep.h>
86#include <asm/setup.h>
87#endif
88 81
89#include "fbcon.h" 82#include "fbcon.h"
90 83
@@ -155,9 +148,6 @@ static int fbcon_set_origin(struct vc_data *);
155 148
156#define CURSOR_DRAW_DELAY (1) 149#define CURSOR_DRAW_DELAY (1)
157 150
158/* # VBL ints between cursor state changes */
159#define ATARI_CURSOR_BLINK_RATE (42)
160
161static int vbl_cursor_cnt; 151static int vbl_cursor_cnt;
162static int fbcon_cursor_noblink; 152static int fbcon_cursor_noblink;
163 153
@@ -403,20 +393,6 @@ static void fb_flashcursor(struct work_struct *work)
403 release_console_sem(); 393 release_console_sem();
404} 394}
405 395
406#ifdef CONFIG_ATARI
407static int cursor_blink_rate;
408static irqreturn_t fb_vbl_handler(int irq, void *dev_id)
409{
410 struct fb_info *info = dev_id;
411
412 if (vbl_cursor_cnt && --vbl_cursor_cnt == 0) {
413 schedule_work(&info->queue);
414 vbl_cursor_cnt = cursor_blink_rate;
415 }
416 return IRQ_HANDLED;
417}
418#endif
419
420static void cursor_timer_handler(unsigned long dev_addr) 396static void cursor_timer_handler(unsigned long dev_addr)
421{ 397{
422 struct fb_info *info = (struct fb_info *) dev_addr; 398 struct fb_info *info = (struct fb_info *) dev_addr;
@@ -1017,15 +993,6 @@ static const char *fbcon_startup(void)
1017 info->var.yres, 993 info->var.yres,
1018 info->var.bits_per_pixel); 994 info->var.bits_per_pixel);
1019 995
1020#ifdef CONFIG_ATARI
1021 if (MACH_IS_ATARI) {
1022 cursor_blink_rate = ATARI_CURSOR_BLINK_RATE;
1023 (void)request_irq(IRQ_AUTO_4, fb_vbl_handler,
1024 IRQ_TYPE_PRIO, "framebuffer vbl",
1025 info);
1026 }
1027#endif /* CONFIG_ATARI */
1028
1029 fbcon_add_cursor_timer(info); 996 fbcon_add_cursor_timer(info);
1030 fbcon_has_exited = 0; 997 fbcon_has_exited = 0;
1031 return display_desc; 998 return display_desc;
@@ -3454,11 +3421,6 @@ static void fbcon_exit(void)
3454 if (fbcon_has_exited) 3421 if (fbcon_has_exited)
3455 return; 3422 return;
3456 3423
3457#ifdef CONFIG_ATARI
3458 if (MACH_IS_ATARI)
3459 free_irq(IRQ_AUTO_4, fb_vbl_handler);
3460#endif
3461
3462 kfree((void *)softback_buf); 3424 kfree((void *)softback_buf);
3463 softback_buf = 0UL; 3425 softback_buf = 0UL;
3464 3426
diff --git a/drivers/zorro/.gitignore b/drivers/zorro/.gitignore
new file mode 100644
index 000000000000..34f980bd8ff6
--- /dev/null
+++ b/drivers/zorro/.gitignore
@@ -0,0 +1,2 @@
1devlist.h
2gen-devlist
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 5290552d2ef7..1d2a772ea14c 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -77,17 +77,21 @@ static struct bin_attribute zorro_config_attr = {
77 .read = zorro_read_config, 77 .read = zorro_read_config,
78}; 78};
79 79
80void zorro_create_sysfs_dev_files(struct zorro_dev *z) 80int zorro_create_sysfs_dev_files(struct zorro_dev *z)
81{ 81{
82 struct device *dev = &z->dev; 82 struct device *dev = &z->dev;
83 int error;
83 84
84 /* current configuration's attributes */ 85 /* current configuration's attributes */
85 device_create_file(dev, &dev_attr_id); 86 if ((error = device_create_file(dev, &dev_attr_id)) ||
86 device_create_file(dev, &dev_attr_type); 87 (error = device_create_file(dev, &dev_attr_type)) ||
87 device_create_file(dev, &dev_attr_serial); 88 (error = device_create_file(dev, &dev_attr_serial)) ||
88 device_create_file(dev, &dev_attr_slotaddr); 89 (error = device_create_file(dev, &dev_attr_slotaddr)) ||
89 device_create_file(dev, &dev_attr_slotsize); 90 (error = device_create_file(dev, &dev_attr_slotsize)) ||
90 device_create_file(dev, &dev_attr_resource); 91 (error = device_create_file(dev, &dev_attr_resource)) ||
91 sysfs_create_bin_file(&dev->kobj, &zorro_config_attr); 92 (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr)))
93 return error;
94
95 return 0;
92} 96}
93 97
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index dff16d9767d8..a1585d6f6486 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -130,6 +130,7 @@ static int __init zorro_init(void)
130{ 130{
131 struct zorro_dev *z; 131 struct zorro_dev *z;
132 unsigned int i; 132 unsigned int i;
133 int error;
133 134
134 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) 135 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
135 return 0; 136 return 0;
@@ -140,7 +141,11 @@ static int __init zorro_init(void)
140 /* Initialize the Zorro bus */ 141 /* Initialize the Zorro bus */
141 INIT_LIST_HEAD(&zorro_bus.devices); 142 INIT_LIST_HEAD(&zorro_bus.devices);
142 strcpy(zorro_bus.dev.bus_id, "zorro"); 143 strcpy(zorro_bus.dev.bus_id, "zorro");
143 device_register(&zorro_bus.dev); 144 error = device_register(&zorro_bus.dev);
145 if (error) {
146 pr_err("Zorro: Error registering zorro_bus\n");
147 return error;
148 }
144 149
145 /* Request the resources */ 150 /* Request the resources */
146 zorro_bus.num_resources = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2; 151 zorro_bus.num_resources = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
@@ -160,15 +165,19 @@ static int __init zorro_init(void)
160 zorro_name_device(z); 165 zorro_name_device(z);
161 z->resource.name = z->name; 166 z->resource.name = z->name;
162 if (request_resource(zorro_find_parent_resource(z), &z->resource)) 167 if (request_resource(zorro_find_parent_resource(z), &z->resource))
163 printk(KERN_ERR "Zorro: Address space collision on device %s " 168 pr_err("Zorro: Address space collision on device %s %pR\n",
164 "[%lx:%lx]\n", 169 z->name, &z->resource);
165 z->name, (unsigned long)zorro_resource_start(z),
166 (unsigned long)zorro_resource_end(z));
167 sprintf(z->dev.bus_id, "%02x", i); 170 sprintf(z->dev.bus_id, "%02x", i);
168 z->dev.parent = &zorro_bus.dev; 171 z->dev.parent = &zorro_bus.dev;
169 z->dev.bus = &zorro_bus_type; 172 z->dev.bus = &zorro_bus_type;
170 device_register(&z->dev); 173 error = device_register(&z->dev);
171 zorro_create_sysfs_dev_files(z); 174 if (error) {
175 pr_err("Zorro: Error registering device %s\n", z->name);
176 continue;
177 }
178 error = zorro_create_sysfs_dev_files(z);
179 if (error)
180 dev_err(&z->dev, "Error creating sysfs files\n");
172 } 181 }
173 182
174 /* Mark all available Zorro II memory */ 183 /* Mark all available Zorro II memory */
diff --git a/drivers/zorro/zorro.h b/drivers/zorro/zorro.h
index 5c91adac4df1..b682d5ccd63f 100644
--- a/drivers/zorro/zorro.h
+++ b/drivers/zorro/zorro.h
@@ -1,4 +1,4 @@
1 1
2extern void zorro_name_device(struct zorro_dev *z); 2extern void zorro_name_device(struct zorro_dev *z);
3extern void zorro_create_sysfs_dev_files(struct zorro_dev *z); 3extern int zorro_create_sysfs_dev_files(struct zorro_dev *z);
4 4
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 965abb8bc7ff..3c19027331fa 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -5,6 +5,7 @@
5 * This file contains the system call numbers. 5 * This file contains the system call numbers.
6 */ 6 */
7 7
8#define __NR_restart_syscall 0
8#define __NR_exit 1 9#define __NR_exit 1
9#define __NR_fork 2 10#define __NR_fork 2
10#define __NR_read 3 11#define __NR_read 3
@@ -359,9 +360,6 @@
359#define __ARCH_WANT_SYS_SIGPROCMASK 360#define __ARCH_WANT_SYS_SIGPROCMASK
360#define __ARCH_WANT_SYS_RT_SIGACTION 361#define __ARCH_WANT_SYS_RT_SIGACTION
361 362
362/* whitelist for checksyscalls */
363#define __IGNORE_restart_syscall
364
365/* 363/*
366 * "Conditional" syscalls 364 * "Conditional" syscalls
367 * 365 *
diff --git a/include/linux/dio.h b/include/linux/dio.h
index 1e65ebc2a3db..b2dd31ca1710 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -241,7 +241,7 @@ struct dio_driver {
241 241
242extern int dio_find(int deviceid); 242extern int dio_find(int deviceid);
243extern unsigned long dio_scodetophysaddr(int scode); 243extern unsigned long dio_scodetophysaddr(int scode);
244extern void dio_create_sysfs_dev_files(struct dio_dev *); 244extern int dio_create_sysfs_dev_files(struct dio_dev *);
245 245
246/* New-style probing */ 246/* New-style probing */
247extern int dio_register_driver(struct dio_driver *); 247extern int dio_register_driver(struct dio_driver *);
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c
index 4d45bd63718b..57d9f154c88b 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -851,8 +851,9 @@ static int __init AtaIrqInit(void)
851 mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ 851 mfp.tim_dt_a = 1; /* Cause interrupt after first event. */
852 mfp.tim_ct_a = 8; /* Turn on event counting. */ 852 mfp.tim_ct_a = 8; /* Turn on event counting. */
853 /* Register interrupt handler. */ 853 /* Register interrupt handler. */
854 request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", 854 if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound",
855 AtaInterrupt); 855 AtaInterrupt))
856 return 0;
856 mfp.int_en_a |= 0x20; /* Turn interrupt on. */ 857 mfp.int_en_a |= 0x20; /* Turn interrupt on. */
857 mfp.int_mk_a |= 0x20; 858 mfp.int_mk_a |= 0x20;
858 return 1; 859 return 1;
diff --git a/sound/oss/dmasound/dmasound_q40.c b/sound/oss/dmasound/dmasound_q40.c
index 1855b14d90c3..99bcb21c2281 100644
--- a/sound/oss/dmasound/dmasound_q40.c
+++ b/sound/oss/dmasound/dmasound_q40.c
@@ -371,8 +371,9 @@ static void Q40Free(void *ptr, unsigned int size)
371static int __init Q40IrqInit(void) 371static int __init Q40IrqInit(void)
372{ 372{
373 /* Register interrupt handler. */ 373 /* Register interrupt handler. */
374 request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, 374 if (request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
375 "DMA sound", Q40Interrupt); 375 "DMA sound", Q40Interrupt))
376 return 0;
376 377
377 return(1); 378 return(1);
378} 379}
@@ -401,6 +402,7 @@ static void Q40PlayNextFrame(int index)
401 u_char *start; 402 u_char *start;
402 u_long size; 403 u_long size;
403 u_char speed; 404 u_char speed;
405 int error;
404 406
405 /* used by Q40Play() if all doubts whether there really is something 407 /* used by Q40Play() if all doubts whether there really is something
406 * to be played are already wiped out. 408 * to be played are already wiped out.
@@ -419,11 +421,13 @@ static void Q40PlayNextFrame(int index)
419 master_outb( 0,SAMPLE_ENABLE_REG); 421 master_outb( 0,SAMPLE_ENABLE_REG);
420 free_irq(Q40_IRQ_SAMPLE, Q40Interrupt); 422 free_irq(Q40_IRQ_SAMPLE, Q40Interrupt);
421 if (dmasound.soft.stereo) 423 if (dmasound.soft.stereo)
422 request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0, 424 error = request_irq(Q40_IRQ_SAMPLE, Q40StereoInterrupt, 0,
423 "Q40 sound", Q40Interrupt); 425 "Q40 sound", Q40Interrupt);
424 else 426 else
425 request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0, 427 error = request_irq(Q40_IRQ_SAMPLE, Q40MonoInterrupt, 0,
426 "Q40 sound", Q40Interrupt); 428 "Q40 sound", Q40Interrupt);
429 if (error && printk_ratelimit())
430 pr_err("Couldn't register sound interrupt\n");
427 431
428 master_outb( speed, SAMPLE_RATE_REG); 432 master_outb( speed, SAMPLE_RATE_REG);
429 master_outb( 1,SAMPLE_CLEAR_REG); 433 master_outb( 1,SAMPLE_CLEAR_REG);