aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2018-03-11 23:38:28 -0400
committerGeert Uytterhoeven <geert@linux-m68k.org>2018-03-26 08:10:21 -0400
commit31b1c780177d02d470109bdcf9899a3433c9fa93 (patch)
tree401a753ce29bf9d6aca0ed016460dd8ffb828fbd
parent51fd62769d415d343efd993d124f5551cfe5fcba (diff)
m68k/mac: Clean up whitespace and remove redundant parentheses
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
-rw-r--r--arch/m68k/mac/misc.c64
1 files changed, 37 insertions, 27 deletions
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 4956edaac926..50387638557d 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -43,18 +43,19 @@ static long cuda_read_time(void)
43 while (!req.complete) 43 while (!req.complete)
44 cuda_poll(); 44 cuda_poll();
45 45
46 time = (req.reply[3] << 24) | (req.reply[4] << 16) 46 time = (req.reply[3] << 24) | (req.reply[4] << 16) |
47 | (req.reply[5] << 8) | req.reply[6]; 47 (req.reply[5] << 8) | req.reply[6];
48 return time - RTC_OFFSET; 48 return time - RTC_OFFSET;
49} 49}
50 50
51static void cuda_write_time(long data) 51static void cuda_write_time(long data)
52{ 52{
53 struct adb_request req; 53 struct adb_request req;
54
54 data += RTC_OFFSET; 55 data += RTC_OFFSET;
55 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, 56 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
56 (data >> 24) & 0xFF, (data >> 16) & 0xFF, 57 (data >> 24) & 0xFF, (data >> 16) & 0xFF,
57 (data >> 8) & 0xFF, data & 0xFF) < 0) 58 (data >> 8) & 0xFF, data & 0xFF) < 0)
58 return; 59 return;
59 while (!req.complete) 60 while (!req.complete)
60 cuda_poll(); 61 cuda_poll();
@@ -63,8 +64,9 @@ static void cuda_write_time(long data)
63static __u8 cuda_read_pram(int offset) 64static __u8 cuda_read_pram(int offset)
64{ 65{
65 struct adb_request req; 66 struct adb_request req;
67
66 if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM, 68 if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
67 (offset >> 8) & 0xFF, offset & 0xFF) < 0) 69 (offset >> 8) & 0xFF, offset & 0xFF) < 0)
68 return 0; 70 return 0;
69 while (!req.complete) 71 while (!req.complete)
70 cuda_poll(); 72 cuda_poll();
@@ -74,8 +76,9 @@ static __u8 cuda_read_pram(int offset)
74static void cuda_write_pram(int offset, __u8 data) 76static void cuda_write_pram(int offset, __u8 data)
75{ 77{
76 struct adb_request req; 78 struct adb_request req;
79
77 if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM, 80 if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
78 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) 81 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
79 return; 82 return;
80 while (!req.complete) 83 while (!req.complete)
81 cuda_poll(); 84 cuda_poll();
@@ -98,14 +101,15 @@ static long pmu_read_time(void)
98 while (!req.complete) 101 while (!req.complete)
99 pmu_poll(); 102 pmu_poll();
100 103
101 time = (req.reply[1] << 24) | (req.reply[2] << 16) 104 time = (req.reply[1] << 24) | (req.reply[2] << 16) |
102 | (req.reply[3] << 8) | req.reply[4]; 105 (req.reply[3] << 8) | req.reply[4];
103 return time - RTC_OFFSET; 106 return time - RTC_OFFSET;
104} 107}
105 108
106static void pmu_write_time(long data) 109static void pmu_write_time(long data)
107{ 110{
108 struct adb_request req; 111 struct adb_request req;
112
109 data += RTC_OFFSET; 113 data += RTC_OFFSET;
110 if (pmu_request(&req, NULL, 5, PMU_SET_RTC, 114 if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
111 (data >> 24) & 0xFF, (data >> 16) & 0xFF, 115 (data >> 24) & 0xFF, (data >> 16) & 0xFF,
@@ -118,6 +122,7 @@ static void pmu_write_time(long data)
118static __u8 pmu_read_pram(int offset) 122static __u8 pmu_read_pram(int offset)
119{ 123{
120 struct adb_request req; 124 struct adb_request req;
125
121 if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM, 126 if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM,
122 (offset >> 8) & 0xFF, offset & 0xFF) < 0) 127 (offset >> 8) & 0xFF, offset & 0xFF) < 0)
123 return 0; 128 return 0;
@@ -129,6 +134,7 @@ static __u8 pmu_read_pram(int offset)
129static void pmu_write_pram(int offset, __u8 data) 134static void pmu_write_pram(int offset, __u8 data)
130{ 135{
131 struct adb_request req; 136 struct adb_request req;
137
132 if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM, 138 if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM,
133 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) 139 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
134 return; 140 return;
@@ -151,8 +157,8 @@ static void pmu_write_pram(int offset, __u8 data)
151 157
152static __u8 via_pram_readbyte(void) 158static __u8 via_pram_readbyte(void)
153{ 159{
154 int i,reg; 160 int i, reg;
155 __u8 data; 161 __u8 data;
156 162
157 reg = via1[vBufB] & ~VIA1B_vRTCClk; 163 reg = via1[vBufB] & ~VIA1B_vRTCClk;
158 164
@@ -178,7 +184,7 @@ static __u8 via_pram_readbyte(void)
178 184
179static void via_pram_writebyte(__u8 data) 185static void via_pram_writebyte(__u8 data)
180{ 186{
181 int i,reg,bit; 187 int i, reg, bit;
182 188
183 reg = via1[vBufB] & ~(VIA1B_vRTCClk | VIA1B_vRTCData); 189 reg = via1[vBufB] & ~(VIA1B_vRTCClk | VIA1B_vRTCData);
184 190
@@ -204,7 +210,7 @@ static void via_pram_writebyte(__u8 data)
204static void via_pram_command(int command, __u8 *data) 210static void via_pram_command(int command, __u8 *data)
205{ 211{
206 unsigned long flags; 212 unsigned long flags;
207 int is_read; 213 int is_read;
208 214
209 local_irq_save(flags); 215 local_irq_save(flags);
210 216
@@ -298,10 +304,10 @@ static long via_read_time(void)
298static void via_write_time(long time) 304static void via_write_time(long time)
299{ 305{
300 union { 306 union {
301 __u8 cdata[4]; 307 __u8 cdata[4];
302 long idata; 308 long idata;
303 } data; 309 } data;
304 __u8 temp; 310 __u8 temp;
305 311
306 /* Clear the write protect bit */ 312 /* Clear the write protect bit */
307 313
@@ -343,10 +349,10 @@ static void oss_shutdown(void)
343} 349}
344 350
345#ifdef CONFIG_ADB_CUDA 351#ifdef CONFIG_ADB_CUDA
346
347static void cuda_restart(void) 352static void cuda_restart(void)
348{ 353{
349 struct adb_request req; 354 struct adb_request req;
355
350 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0) 356 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0)
351 return; 357 return;
352 while (!req.complete) 358 while (!req.complete)
@@ -356,6 +362,7 @@ static void cuda_restart(void)
356static void cuda_shutdown(void) 362static void cuda_shutdown(void)
357{ 363{
358 struct adb_request req; 364 struct adb_request req;
365
359 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0) 366 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0)
360 return; 367 return;
361 368
@@ -372,7 +379,6 @@ static void cuda_shutdown(void)
372 while (!req.complete) 379 while (!req.complete)
373 cuda_poll(); 380 cuda_poll();
374} 381}
375
376#endif /* CONFIG_ADB_CUDA */ 382#endif /* CONFIG_ADB_CUDA */
377 383
378#ifdef CONFIG_ADB_PMU68K 384#ifdef CONFIG_ADB_PMU68K
@@ -419,13 +425,15 @@ void mac_pram_read(int offset, __u8 *buffer, int len)
419 __u8 (*func)(int); 425 __u8 (*func)(int);
420 int i; 426 int i;
421 427
422 switch(macintosh_config->adb_type) { 428 switch (macintosh_config->adb_type) {
423 case MAC_ADB_PB1: 429 case MAC_ADB_PB1:
424 case MAC_ADB_PB2: 430 case MAC_ADB_PB2:
425 func = pmu_read_pram; break; 431 func = pmu_read_pram;
432 break;
426 case MAC_ADB_EGRET: 433 case MAC_ADB_EGRET:
427 case MAC_ADB_CUDA: 434 case MAC_ADB_CUDA:
428 func = cuda_read_pram; break; 435 func = cuda_read_pram;
436 break;
429 default: 437 default:
430 func = via_read_pram; 438 func = via_read_pram;
431 } 439 }
@@ -441,13 +449,15 @@ void mac_pram_write(int offset, __u8 *buffer, int len)
441 void (*func)(int, __u8); 449 void (*func)(int, __u8);
442 int i; 450 int i;
443 451
444 switch(macintosh_config->adb_type) { 452 switch (macintosh_config->adb_type) {
445 case MAC_ADB_PB1: 453 case MAC_ADB_PB1:
446 case MAC_ADB_PB2: 454 case MAC_ADB_PB2:
447 func = pmu_write_pram; break; 455 func = pmu_write_pram;
456 break;
448 case MAC_ADB_EGRET: 457 case MAC_ADB_EGRET:
449 case MAC_ADB_CUDA: 458 case MAC_ADB_CUDA:
450 func = cuda_write_pram; break; 459 func = cuda_write_pram;
460 break;
451 default: 461 default:
452 func = via_write_pram; 462 func = via_write_pram;
453 } 463 }
@@ -531,6 +541,7 @@ void mac_reset(void)
531 unsigned long phys = virt_to_phys(mac_reset); 541 unsigned long phys = virt_to_phys(mac_reset);
532 unsigned long addr = (phys&0xFF000000)|0x8777; 542 unsigned long addr = (phys&0xFF000000)|0x8777;
533 unsigned long offset = phys-virt; 543 unsigned long offset = phys-virt;
544
534 local_irq_disable(); /* lets not screw this up, ok? */ 545 local_irq_disable(); /* lets not screw this up, ok? */
535 __asm__ __volatile__(".chip 68030\n\t" 546 __asm__ __volatile__(".chip 68030\n\t"
536 "pmove %0,%/tt0\n\t" 547 "pmove %0,%/tt0\n\t"
@@ -538,7 +549,7 @@ void mac_reset(void)
538 : : "m" (addr)); 549 : : "m" (addr));
539 /* Now jump to physical address so we can disable MMU */ 550 /* Now jump to physical address so we can disable MMU */
540 __asm__ __volatile__( 551 __asm__ __volatile__(
541 ".chip 68030\n\t" 552 ".chip 68030\n\t"
542 "lea %/pc@(1f),%/a0\n\t" 553 "lea %/pc@(1f),%/a0\n\t"
543 "addl %0,%/a0\n\t"/* fixup target address and stack ptr */ 554 "addl %0,%/a0\n\t"/* fixup target address and stack ptr */
544 "addl %0,%/sp\n\t" 555 "addl %0,%/sp\n\t"
@@ -627,9 +638,8 @@ static void unmktime(unsigned long time, long offset,
627 long int yg = y + days / 365 - (days % 365 < 0); 638 long int yg = y + days / 365 - (days % 365 < 0);
628 639
629 /* Adjust DAYS and Y to match the guessed year. */ 640 /* Adjust DAYS and Y to match the guessed year. */
630 days -= ((yg - y) * 365 641 days -= (yg - y) * 365 +
631 + LEAPS_THRU_END_OF (yg - 1) 642 LEAPS_THRU_END_OF(yg - 1) - LEAPS_THRU_END_OF(y - 1);
632 - LEAPS_THRU_END_OF (y - 1));
633 y = yg; 643 y = yg;
634 } 644 }
635 *yearp = y - 1900; 645 *yearp = y - 1900;