X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fg_NCR5380.c;h=67f1100f310361708647f4c28952895a608dc82f;hb=6708374178d225ef77571ed23b30e8a93c36add5;hp=45756fa907772c94a068064e031bfcb6e4a067c2;hpb=06d61cbf7c2522f43c09d5bb050acd0bd31812c0;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 45756fa9077..67f1100f310 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -91,7 +91,6 @@ #define AUTOPROBE_IRQ #define AUTOSENSE -#include #ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define NCR53C400_PSEUDO_DMA 1 @@ -127,7 +126,7 @@ static int ncr_53c400a = NCR_NOT_SET; static int dtc_3181e = NCR_NOT_SET; static struct override { - NCR5380_implementation_fields; + NCR5380_map_type NCR5380_map_name; int irq; int dma; int board; /* Use NCR53c400, Ricoh, etc. extensions ? */ @@ -138,10 +137,9 @@ static struct override { [1] __initdata = { { 0,},}; #endif +#define NO_OVERRIDES ARRAY_SIZE(overrides) -#define NO_OVERRIDES (sizeof(overrides) / sizeof(struct override)) - -#ifndef MODULE +#ifndef MODULE /** * internal_setup - handle lilo command string override @@ -210,7 +208,7 @@ static int __init do_NCR5380_setup(char *str) { int ints[10]; - get_options(str, sizeof(ints) / sizeof(int), ints); + get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_NCR5380, str, ints); return 1; } @@ -218,7 +216,7 @@ static int __init do_NCR5380_setup(char *str) /** * do_NCR53C400_setup - set up entry point * @str: unused - * @ints: integer parameters from kernel setup code + * @ints: integer parameters from kernel setup code * * Setup function invoked at boot to parse the ncr53c400= command * line. @@ -228,7 +226,7 @@ static int __init do_NCR53C400_setup(char *str) { int ints[10]; - get_options(str, sizeof(ints) / sizeof(int), ints); + get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_NCR53C400, str, ints); return 1; } @@ -236,7 +234,7 @@ static int __init do_NCR53C400_setup(char *str) /** * do_NCR53C400A_setup - set up entry point * @str: unused - * @ints: integer parameters from kernel setup code + * @ints: integer parameters from kernel setup code * * Setup function invoked at boot to parse the ncr53c400a= command * line. @@ -246,7 +244,7 @@ static int __init do_NCR53C400A_setup(char *str) { int ints[10]; - get_options(str, sizeof(ints) / sizeof(int), ints); + get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_NCR53C400A, str, ints); return 1; } @@ -254,7 +252,7 @@ static int __init do_NCR53C400A_setup(char *str) /** * do_DTC3181E_setup - set up entry point * @str: unused - * @ints: integer parameters from kernel setup code + * @ints: integer parameters from kernel setup code * * Setup function invoked at boot to parse the dtc3181e= command * line. @@ -264,7 +262,7 @@ static int __init do_DTC3181E_setup(char *str) { int ints[10]; - get_options(str, sizeof(ints) / sizeof(int), ints); + get_options(str, ARRAY_SIZE(ints), ints); internal_setup(BOARD_DTC3181E, str, ints); return 1; } @@ -299,6 +297,10 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) }; int flags = 0; struct Scsi_Host *instance; +#ifdef CONFIG_SCSI_G_NCR5380_MEM + unsigned long base; + void __iomem *iomem; +#endif if (ncr_irq != NCR_NOT_SET) overrides[0].irq = ncr_irq; @@ -424,15 +426,22 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) region_size = NCR5380_region_size; } #else - if(!request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380")) + base = overrides[current_override].NCR5380_map_name; + if (!request_mem_region(base, NCR5380_region_size, "ncr5380")) + continue; + iomem = ioremap(base, NCR5380_region_size); + if (!iomem) { + release_mem_region(base, NCR5380_region_size); continue; + } #endif instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata)); if (instance == NULL) { #ifndef CONFIG_SCSI_G_NCR5380_MEM release_region(overrides[current_override].NCR5380_map_name, region_size); #else - release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size); + iounmap(iomem); + release_mem_region(base, NCR5380_region_size); #endif continue; } @@ -440,6 +449,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name; #ifndef CONFIG_SCSI_G_NCR5380_MEM instance->n_io_port = region_size; +#else + ((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem; #endif NCR5380_init(instance, flags); @@ -450,7 +461,7 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) instance->irq = NCR5380_probe_irq(instance, 0xffff); if (instance->irq != SCSI_IRQ_NONE) - if (request_irq(instance->irq, generic_NCR5380_intr, SA_INTERRUPT, "NCR5380", instance)) { + if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; } @@ -509,6 +520,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance) #ifndef CONFIG_SCSI_G_NCR5380_MEM release_region(instance->NCR5380_instance_name, instance->n_io_port); #else + iounmap(((struct NCR5380_hostdata *)instance->hostdata).iomem); release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size); #endif @@ -586,7 +598,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, } #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128); + memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); #endif start += 128; blocks--; @@ -606,7 +618,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, } #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - isa_memcpy_fromio(dst + start, NCR53C400_host_buffer + NCR5380_map_name, 128); + memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); #endif start += 128; blocks--; @@ -671,7 +683,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, } #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128); + memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); #endif start += 128; blocks--; @@ -687,7 +699,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, } #else /* implies CONFIG_SCSI_G_NCR5380_MEM */ - isa_memcpy_toio(NCR53C400_host_buffer + NCR5380_map_name, src + start, 128); + memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); #endif start += 128; blocks--;