Commit c818cb6406815716ab210ae15655ed94a973b15f

Authored by Al Viro
Committed by Linus Torvalds
1 parent ef5a4c8b04

[PATCH] remove ISA legacy functions: drivers/scsi/g_NCR5380.c

switched CONFIG_SCSI_G_NCR5380_MEM code in g_NCR5380 to ioremap(); massaged
g_NCR5380.h accordingly.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 2 changed files with 38 additions and 13 deletions Side-by-side Diff

drivers/scsi/g_NCR5380.c
... ... @@ -127,7 +127,7 @@
127 127 static int dtc_3181e = NCR_NOT_SET;
128 128  
129 129 static struct override {
130   - NCR5380_implementation_fields;
  130 + NCR5380_map_type NCR5380_map_name;
131 131 int irq;
132 132 int dma;
133 133 int board; /* Use NCR53c400, Ricoh, etc. extensions ? */
... ... @@ -299,6 +299,10 @@
299 299 };
300 300 int flags = 0;
301 301 struct Scsi_Host *instance;
  302 +#ifdef CONFIG_SCSI_G_NCR5380_MEM
  303 + unsigned long base;
  304 + void __iomem *iomem;
  305 +#endif
302 306  
303 307 if (ncr_irq != NCR_NOT_SET)
304 308 overrides[0].irq = ncr_irq;
305 309  
306 310  
... ... @@ -424,15 +428,22 @@
424 428 region_size = NCR5380_region_size;
425 429 }
426 430 #else
427   - if(!request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380"))
  431 + base = overrides[current_override].NCR5380_map_name;
  432 + if (!request_mem_region(base, NCR5380_region_size, "ncr5380"))
428 433 continue;
  434 + iomem = ioremap(base, NCR5380_region_size);
  435 + if (!iomem) {
  436 + release_mem_region(base, NCR5380_region_size);
  437 + continue;
  438 + }
429 439 #endif
430 440 instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
431 441 if (instance == NULL) {
432 442 #ifndef CONFIG_SCSI_G_NCR5380_MEM
433 443 release_region(overrides[current_override].NCR5380_map_name, region_size);
434 444 #else
435   - release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
  445 + iounmap(iomem);
  446 + release_mem_region(base, NCR5380_region_size);
436 447 #endif
437 448 continue;
438 449 }
... ... @@ -440,6 +451,8 @@
440 451 instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
441 452 #ifndef CONFIG_SCSI_G_NCR5380_MEM
442 453 instance->n_io_port = region_size;
  454 +#else
  455 + ((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;
443 456 #endif
444 457  
445 458 NCR5380_init(instance, flags);
... ... @@ -509,6 +522,7 @@
509 522 #ifndef CONFIG_SCSI_G_NCR5380_MEM
510 523 release_region(instance->NCR5380_instance_name, instance->n_io_port);
511 524 #else
  525 + iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem);
512 526 release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
513 527 #endif
514 528  
... ... @@ -586,7 +600,7 @@
586 600 }
587 601 #else
588 602 /* implies CONFIG_SCSI_G_NCR5380_MEM */
589   - isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128);
  603 + memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
590 604 #endif
591 605 start += 128;
592 606 blocks--;
... ... @@ -606,7 +620,7 @@
606 620 }
607 621 #else
608 622 /* implies CONFIG_SCSI_G_NCR5380_MEM */
609   - isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128);
  623 + memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
610 624 #endif
611 625 start += 128;
612 626 blocks--;
... ... @@ -671,7 +685,7 @@
671 685 }
672 686 #else
673 687 /* implies CONFIG_SCSI_G_NCR5380_MEM */
674   - isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128);
  688 + memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
675 689 #endif
676 690 start += 128;
677 691 blocks--;
... ... @@ -687,7 +701,7 @@
687 701 }
688 702 #else
689 703 /* implies CONFIG_SCSI_G_NCR5380_MEM */
690   - isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128);
  704 + memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
691 705 #endif
692 706 start += 128;
693 707 blocks--;
drivers/scsi/g_NCR5380.h
... ... @@ -82,6 +82,15 @@
82 82 #define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
83 83 #define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
84 84  
  85 +#define NCR5380_implementation_fields \
  86 + NCR5380_map_type NCR5380_map_name
  87 +
  88 +#define NCR5380_local_declare() \
  89 + register NCR5380_implementation_fields
  90 +
  91 +#define NCR5380_setup(instance) \
  92 + NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
  93 +
85 94 #else
86 95 /* therefore CONFIG_SCSI_G_NCR5380_MEM */
87 96  
88 97  
89 98  
90 99  
... ... @@ -95,18 +104,20 @@
95 104 #define NCR53C400_host_buffer 0x3900
96 105 #define NCR5380_region_size 0x3a00
97 106  
98   -#define NCR5380_read(reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg))
99   -#define NCR5380_write(reg, value) isa_writeb(value, NCR5380_map_name + NCR53C400_mem_base + (reg))
100   -#endif
  107 +#define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg))
  108 +#define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg))
101 109  
102 110 #define NCR5380_implementation_fields \
103   - NCR5380_map_type NCR5380_map_name
  111 + NCR5380_map_type NCR5380_map_name; \
  112 + void __iomem *iomem;
104 113  
105 114 #define NCR5380_local_declare() \
106   - register NCR5380_implementation_fields
  115 + register void __iomem *iomem
107 116  
108 117 #define NCR5380_setup(instance) \
109   - NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
  118 + iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem)
  119 +
  120 +#endif
110 121  
111 122 #define NCR5380_intr generic_NCR5380_intr
112 123 #define NCR5380_queue_command generic_NCR5380_queue_command