Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc fixes and cleanups from Helge Deller:
"Nothing really important in this patchset: fix resource leaks in error
paths, coding style cleanups and code removal"

* 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: Remove flush_user_dcache_range and flush_user_icache_range
parisc: fix a printk
parisc: ccio-dma: Handle return NULL error from ioremap_nocache
parisc: Define access_ok() as macro
parisc: eisa: Fix resource leaks in error paths
parisc: eisa: Remove coding style errors

+83 -88
-2
arch/parisc/include/asm/cacheflush.h
··· 27 27 void flush_kernel_dcache_range_asm(unsigned long, unsigned long); 28 28 void flush_kernel_dcache_page_asm(void *); 29 29 void flush_kernel_icache_page(void *); 30 - void flush_user_dcache_range(unsigned long, unsigned long); 31 - void flush_user_icache_range(unsigned long, unsigned long); 32 30 33 31 /* Cache flush operations */ 34 32
+1 -5
arch/parisc/include/asm/uaccess.h
··· 32 32 * that put_user is the same as __put_user, etc. 33 33 */ 34 34 35 - static inline long access_ok(int type, const void __user * addr, 36 - unsigned long size) 37 - { 38 - return 1; 39 - } 35 + #define access_ok(type, uaddr, size) (1) 40 36 41 37 #define put_user __put_user 42 38 #define get_user __get_user
-18
arch/parisc/kernel/cache.c
··· 574 574 } 575 575 } 576 576 577 - void 578 - flush_user_dcache_range(unsigned long start, unsigned long end) 579 - { 580 - if ((end - start) < parisc_cache_flush_threshold) 581 - flush_user_dcache_range_asm(start,end); 582 - else 583 - flush_data_cache(); 584 - } 585 - 586 - void 587 - flush_user_icache_range(unsigned long start, unsigned long end) 588 - { 589 - if ((end - start) < parisc_cache_flush_threshold) 590 - flush_user_icache_range_asm(start,end); 591 - else 592 - flush_instruction_cache(); 593 - } 594 - 595 577 void flush_cache_range(struct vm_area_struct *vma, 596 578 unsigned long start, unsigned long end) 597 579 {
+7 -6
arch/parisc/kernel/signal.c
··· 233 233 struct rt_sigframe __user *frame; 234 234 unsigned long rp, usp; 235 235 unsigned long haddr, sigframe_size; 236 + unsigned long start, end; 236 237 int err = 0; 237 238 #ifdef CONFIG_64BIT 238 239 struct compat_rt_sigframe __user * compat_frame; ··· 301 300 } 302 301 #endif 303 302 304 - flush_user_dcache_range((unsigned long) &frame->tramp[0], 305 - (unsigned long) &frame->tramp[TRAMP_SIZE]); 306 - flush_user_icache_range((unsigned long) &frame->tramp[0], 307 - (unsigned long) &frame->tramp[TRAMP_SIZE]); 303 + start = (unsigned long) &frame->tramp[0]; 304 + end = (unsigned long) &frame->tramp[TRAMP_SIZE]; 305 + flush_user_dcache_range_asm(start, end); 306 + flush_user_icache_range_asm(start, end); 308 307 309 308 /* TRAMP Words 0-4, Length 5 = SIGRESTARTBLOCK_TRAMP 310 309 * TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP ··· 550 549 WARN_ON(err); 551 550 552 551 /* flush data/instruction cache for new insns */ 553 - flush_user_dcache_range(start, end); 554 - flush_user_icache_range(start, end); 552 + flush_user_dcache_range_asm(start, end); 553 + flush_user_icache_range_asm(start, end); 555 554 556 555 regs->gr[31] = regs->gr[30] + 8; 557 556 return;
+2 -2
arch/parisc/mm/fault.c
··· 239 239 vma ? ',':'\n'); 240 240 241 241 if (vma) 242 - pr_warn(KERN_CONT " vm_start = 0x%08lx, vm_end = 0x%08lx\n", 243 - vma->vm_start, vma->vm_end); 242 + pr_cont(" vm_start = 0x%08lx, vm_end = 0x%08lx\n", 243 + vma->vm_start, vma->vm_end); 244 244 245 245 show_regs(regs); 246 246 }
+5 -1
drivers/parisc/ccio-dma.c
··· 1539 1539 ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL); 1540 1540 if (ioc == NULL) { 1541 1541 printk(KERN_ERR MODULE_NAME ": memory allocation failure\n"); 1542 - return 1; 1542 + return -ENOMEM; 1543 1543 } 1544 1544 1545 1545 ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn"; ··· 1554 1554 1555 1555 ioc->hw_path = dev->hw_path; 1556 1556 ioc->ioc_regs = ioremap_nocache(dev->hpa.start, 4096); 1557 + if (!ioc->ioc_regs) { 1558 + kfree(ioc); 1559 + return -ENOMEM; 1560 + } 1557 1561 ccio_ioc_init(ioc); 1558 1562 ccio_init_resources(ioc); 1559 1563 hppa_dma_ops = &ccio_ops;
+68 -54
drivers/parisc/eisa.c
··· 14 14 * Wax ASIC also includes a PS/2 and RS-232 controller, but those are 15 15 * dealt with elsewhere; this file is concerned only with the EISA portions 16 16 * of Wax. 17 - * 18 - * 17 + * 18 + * 19 19 * HINT: 20 20 * ----- 21 21 * To allow an ISA card to work properly in the EISA slot you need to 22 - * set an edge trigger level. This may be done on the palo command line 23 - * by adding the kernel parameter "eisa_irq_edge=n,n2,[...]]", with 22 + * set an edge trigger level. This may be done on the palo command line 23 + * by adding the kernel parameter "eisa_irq_edge=n,n2,[...]]", with 24 24 * n and n2 as the irq levels you want to use. 25 - * 26 - * Example: "eisa_irq_edge=10,11" allows ISA cards to operate at 25 + * 26 + * Example: "eisa_irq_edge=10,11" allows ISA cards to operate at 27 27 * irq levels 10 and 11. 28 28 */ 29 29 ··· 46 46 #include <asm/eisa_eeprom.h> 47 47 48 48 #if 0 49 - #define EISA_DBG(msg, arg... ) printk(KERN_DEBUG "eisa: " msg , ## arg ) 49 + #define EISA_DBG(msg, arg...) printk(KERN_DEBUG "eisa: " msg, ## arg) 50 50 #else 51 - #define EISA_DBG(msg, arg... ) 51 + #define EISA_DBG(msg, arg...) 52 52 #endif 53 53 54 54 #define SNAKES_EEPROM_BASE_ADDR 0xF0810400 ··· 108 108 109 109 void eisa_out16(unsigned short data, unsigned short port) 110 110 { 111 - if (EISA_bus) 111 + if (EISA_bus) 112 112 gsc_writew(cpu_to_le16(data), eisa_permute(port)); 113 113 } 114 114 ··· 135 135 static int slave_mask; 136 136 137 137 /* the trig level can be set with the 138 - * eisa_irq_edge=n,n,n commandline parameter 139 - * We should really read this from the EEPROM 140 - * in the furure. 138 + * eisa_irq_edge=n,n,n commandline parameter 139 + * We should really read this from the EEPROM 140 + * in the furure. 141 141 */ 142 142 /* irq 13,8,2,1,0 must be edge */ 143 143 static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered */ ··· 170 170 unsigned int irq = d->irq; 171 171 unsigned long flags; 172 172 EISA_DBG("enable irq %d\n", irq); 173 - 173 + 174 174 spin_lock_irqsave(&eisa_irq_lock, flags); 175 175 if (irq & 8) { 176 176 slave_mask &= ~(1 << (irq&7)); ··· 194 194 { 195 195 int irq = gsc_readb(0xfc01f000); /* EISA supports 16 irqs */ 196 196 unsigned long flags; 197 - 197 + 198 198 spin_lock_irqsave(&eisa_irq_lock, flags); 199 199 /* read IRR command */ 200 200 eisa_out8(0x0a, 0x20); ··· 202 202 203 203 EISA_DBG("irq IAR %02x 8259-1 irr %02x 8259-2 irr %02x\n", 204 204 irq, eisa_in8(0x20), eisa_in8(0xa0)); 205 - 205 + 206 206 /* read ISR command */ 207 207 eisa_out8(0x0a, 0x20); 208 208 eisa_out8(0x0a, 0xa0); 209 209 EISA_DBG("irq 8259-1 isr %02x imr %02x 8259-2 isr %02x imr %02x\n", 210 210 eisa_in8(0x20), eisa_in8(0x21), eisa_in8(0xa0), eisa_in8(0xa1)); 211 - 211 + 212 212 irq &= 0xf; 213 - 213 + 214 214 /* mask irq and write eoi */ 215 215 if (irq & 8) { 216 216 slave_mask |= (1 << (irq&7)); 217 217 eisa_out8(slave_mask, 0xa1); 218 218 eisa_out8(0x60 | (irq&7),0xa0);/* 'Specific EOI' to slave */ 219 - eisa_out8(0x62,0x20); /* 'Specific EOI' to master-IRQ2 */ 220 - 219 + eisa_out8(0x62, 0x20); /* 'Specific EOI' to master-IRQ2 */ 220 + 221 221 } else { 222 222 master_mask |= (1 << (irq&7)); 223 223 eisa_out8(master_mask, 0x21); 224 - eisa_out8(0x60|irq,0x20); /* 'Specific EOI' to master */ 224 + eisa_out8(0x60|irq, 0x20); /* 'Specific EOI' to master */ 225 225 } 226 226 spin_unlock_irqrestore(&eisa_irq_lock, flags); 227 227 228 228 generic_handle_irq(irq); 229 - 229 + 230 230 spin_lock_irqsave(&eisa_irq_lock, flags); 231 231 /* unmask */ 232 232 if (irq & 8) { ··· 254 254 static void init_eisa_pic(void) 255 255 { 256 256 unsigned long flags; 257 - 257 + 258 258 spin_lock_irqsave(&eisa_irq_lock, flags); 259 259 260 260 eisa_out8(0xff, 0x21); /* mask during init */ 261 261 eisa_out8(0xff, 0xa1); /* mask during init */ 262 - 262 + 263 263 /* master pic */ 264 - eisa_out8(0x11,0x20); /* ICW1 */ 265 - eisa_out8(0x00,0x21); /* ICW2 */ 266 - eisa_out8(0x04,0x21); /* ICW3 */ 267 - eisa_out8(0x01,0x21); /* ICW4 */ 268 - eisa_out8(0x40,0x20); /* OCW2 */ 269 - 264 + eisa_out8(0x11, 0x20); /* ICW1 */ 265 + eisa_out8(0x00, 0x21); /* ICW2 */ 266 + eisa_out8(0x04, 0x21); /* ICW3 */ 267 + eisa_out8(0x01, 0x21); /* ICW4 */ 268 + eisa_out8(0x40, 0x20); /* OCW2 */ 269 + 270 270 /* slave pic */ 271 - eisa_out8(0x11,0xa0); /* ICW1 */ 272 - eisa_out8(0x08,0xa1); /* ICW2 */ 273 - eisa_out8(0x02,0xa1); /* ICW3 */ 274 - eisa_out8(0x01,0xa1); /* ICW4 */ 275 - eisa_out8(0x40,0xa0); /* OCW2 */ 276 - 271 + eisa_out8(0x11, 0xa0); /* ICW1 */ 272 + eisa_out8(0x08, 0xa1); /* ICW2 */ 273 + eisa_out8(0x02, 0xa1); /* ICW3 */ 274 + eisa_out8(0x01, 0xa1); /* ICW4 */ 275 + eisa_out8(0x40, 0xa0); /* OCW2 */ 276 + 277 277 udelay(100); 278 - 279 - slave_mask = 0xff; 280 - master_mask = 0xfb; 278 + 279 + slave_mask = 0xff; 280 + master_mask = 0xfb; 281 281 eisa_out8(slave_mask, 0xa1); /* OCW1 */ 282 282 eisa_out8(master_mask, 0x21); /* OCW1 */ 283 - 283 + 284 284 /* setup trig level */ 285 285 EISA_DBG("EISA edge/level %04x\n", eisa_irq_level); 286 - 286 + 287 287 eisa_out8(eisa_irq_level&0xff, 0x4d0); /* Set all irq's to edge */ 288 - eisa_out8((eisa_irq_level >> 8) & 0xff, 0x4d1); 289 - 288 + eisa_out8((eisa_irq_level >> 8) & 0xff, 0x4d1); 289 + 290 290 EISA_DBG("pic0 mask %02x\n", eisa_in8(0x21)); 291 291 EISA_DBG("pic1 mask %02x\n", eisa_in8(0xa1)); 292 292 EISA_DBG("pic0 edge/level %02x\n", eisa_in8(0x4d0)); 293 293 EISA_DBG("pic1 edge/level %02x\n", eisa_in8(0x4d1)); 294 - 294 + 295 295 spin_unlock_irqrestore(&eisa_irq_lock, flags); 296 296 } 297 297 ··· 305 305 306 306 char *name = is_mongoose(dev) ? "Mongoose" : "Wax"; 307 307 308 - printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n", 308 + printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n", 309 309 name, (unsigned long)dev->hpa.start); 310 310 311 311 eisa_dev.hba.dev = dev; ··· 334 334 result = request_irq(dev->irq, eisa_irq, IRQF_SHARED, "EISA", &eisa_dev); 335 335 if (result) { 336 336 printk(KERN_ERR "EISA: request_irq failed!\n"); 337 - return result; 337 + goto error_release; 338 338 } 339 - 339 + 340 340 /* Reserve IRQ2 */ 341 341 setup_irq(2, &irq2_action); 342 342 for (i = 0; i < 16; i++) { 343 343 irq_set_chip_and_handler(i, &eisa_interrupt_type, 344 344 handle_simple_irq); 345 345 } 346 - 346 + 347 347 EISA_bus = 1; 348 348 349 349 if (dev->num_addrs) { ··· 358 358 } 359 359 } 360 360 eisa_eeprom_addr = ioremap_nocache(eisa_dev.eeprom_addr, HPEE_MAX_LENGTH); 361 + if (!eisa_eeprom_addr) { 362 + result = -ENOMEM; 363 + printk(KERN_ERR "EISA: ioremap_nocache failed!\n"); 364 + goto error_free_irq; 365 + } 361 366 result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space, 362 367 &eisa_dev.hba.lmmio_space); 363 368 init_eisa_pic(); ··· 377 372 eisa_dev.root.dma_mask = 0xffffffff; /* wild guess */ 378 373 if (eisa_root_register (&eisa_dev.root)) { 379 374 printk(KERN_ERR "EISA: Failed to register EISA root\n"); 380 - return -1; 375 + result = -ENOMEM; 376 + goto error_iounmap; 381 377 } 382 378 } 383 - 379 + 384 380 return 0; 381 + 382 + error_iounmap: 383 + iounmap(eisa_eeprom_addr); 384 + error_free_irq: 385 + free_irq(dev->irq, &eisa_dev); 386 + error_release: 387 + release_resource(&eisa_dev.hba.io_space); 388 + return result; 385 389 } 386 390 387 391 static const struct parisc_device_id eisa_tbl[] = { ··· 418 404 { 419 405 if (eisa_irq_configured& (1<<num)) { 420 406 printk(KERN_WARNING 421 - "IRQ %d polarity configured twice (last to level)\n", 407 + "IRQ %d polarity configured twice (last to level)\n", 422 408 num); 423 409 } 424 410 eisa_irq_level |= (1<<num); /* set the corresponding bit */ ··· 428 414 void eisa_make_irq_edge(int num) 429 415 { 430 416 if (eisa_irq_configured& (1<<num)) { 431 - printk(KERN_WARNING 417 + printk(KERN_WARNING 432 418 "IRQ %d polarity configured twice (last to edge)\n", 433 419 num); 434 420 } ··· 444 430 EISA_DBG("IRQ setup\n"); 445 431 while (cur != NULL) { 446 432 char *pe; 447 - 433 + 448 434 val = (int) simple_strtoul(cur, &pe, 0); 449 435 if (val > 15 || val < 0) { 450 436 printk(KERN_ERR "eisa: EISA irq value are 0-15\n"); 451 437 continue; 452 438 } 453 - if (val == 2) { 439 + if (val == 2) { 454 440 val = 9; 455 441 } 456 442 eisa_make_irq_edge(val); /* clear the corresponding bit */ 457 443 EISA_DBG("setting IRQ %d to edge-triggered mode\n", val); 458 - 444 + 459 445 if ((cur = strchr(cur, ','))) { 460 446 cur++; 461 447 } else {