diff options
author | Adrian Bunk <bunk@stusta.de> | 2007-05-23 17:41:46 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-24 10:13:51 -0400 |
commit | 6a31a8a651c1d671afc2438cbecb3ee3d610fac8 (patch) | |
tree | 5362b79a2b7e31eddc273ca740f33bd3f534bc9d /drivers/scsi/nsp32.c | |
parent | 702809ce9b1e91400826ec2ff203c06fdad36034 (diff) |
[SCSI] nsp32: remove kernel 2.4 code
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: GOTO Masanori <gotom@sanori.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/nsp32.c')
-rw-r--r-- | drivers/scsi/nsp32.c | 109 |
1 files changed, 13 insertions, 96 deletions
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index f6f561d26bf0..e4dfdfb8af3a 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -49,10 +49,6 @@ | |||
49 | #include <scsi/scsi_host.h> | 49 | #include <scsi/scsi_host.h> |
50 | #include <scsi/scsi_ioctl.h> | 50 | #include <scsi/scsi_ioctl.h> |
51 | 51 | ||
52 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) | ||
53 | # include <linux/blk.h> | ||
54 | #endif | ||
55 | |||
56 | #include "nsp32.h" | 52 | #include "nsp32.h" |
57 | 53 | ||
58 | 54 | ||
@@ -199,17 +195,9 @@ static int __init init_nsp32 (void); | |||
199 | static void __exit exit_nsp32 (void); | 195 | static void __exit exit_nsp32 (void); |
200 | 196 | ||
201 | /* struct struct scsi_host_template */ | 197 | /* struct struct scsi_host_template */ |
202 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
203 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); | 198 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); |
204 | #else | ||
205 | static int nsp32_proc_info (char *, char **, off_t, int, int, int); | ||
206 | #endif | ||
207 | 199 | ||
208 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
209 | static int nsp32_detect (struct pci_dev *pdev); | 200 | static int nsp32_detect (struct pci_dev *pdev); |
210 | #else | ||
211 | static int nsp32_detect (struct scsi_host_template *); | ||
212 | #endif | ||
213 | static int nsp32_queuecommand(struct scsi_cmnd *, | 201 | static int nsp32_queuecommand(struct scsi_cmnd *, |
214 | void (*done)(struct scsi_cmnd *)); | 202 | void (*done)(struct scsi_cmnd *)); |
215 | static const char *nsp32_info (struct Scsi_Host *); | 203 | static const char *nsp32_info (struct Scsi_Host *); |
@@ -296,15 +284,7 @@ static struct scsi_host_template nsp32_template = { | |||
296 | .eh_abort_handler = nsp32_eh_abort, | 284 | .eh_abort_handler = nsp32_eh_abort, |
297 | .eh_bus_reset_handler = nsp32_eh_bus_reset, | 285 | .eh_bus_reset_handler = nsp32_eh_bus_reset, |
298 | .eh_host_reset_handler = nsp32_eh_host_reset, | 286 | .eh_host_reset_handler = nsp32_eh_host_reset, |
299 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,74)) | ||
300 | .detect = nsp32_detect, | ||
301 | .release = nsp32_release, | ||
302 | #endif | ||
303 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,2)) | ||
304 | .use_new_eh_code = 1, | ||
305 | #else | ||
306 | /* .highmem_io = 1, */ | 287 | /* .highmem_io = 1, */ |
307 | #endif | ||
308 | }; | 288 | }; |
309 | 289 | ||
310 | #include "nsp32_io.h" | 290 | #include "nsp32_io.h" |
@@ -1210,13 +1190,9 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id) | |||
1210 | unsigned long flags; | 1190 | unsigned long flags; |
1211 | int ret; | 1191 | int ret; |
1212 | int handled = 0; | 1192 | int handled = 0; |
1213 | |||
1214 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
1215 | struct Scsi_Host *host = data->Host; | 1193 | struct Scsi_Host *host = data->Host; |
1194 | |||
1216 | spin_lock_irqsave(host->host_lock, flags); | 1195 | spin_lock_irqsave(host->host_lock, flags); |
1217 | #else | ||
1218 | spin_lock_irqsave(&io_request_lock, flags); | ||
1219 | #endif | ||
1220 | 1196 | ||
1221 | /* | 1197 | /* |
1222 | * IRQ check, then enable IRQ mask | 1198 | * IRQ check, then enable IRQ mask |
@@ -1480,11 +1456,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id) | |||
1480 | nsp32_write2(base, IRQ_CONTROL, 0); | 1456 | nsp32_write2(base, IRQ_CONTROL, 0); |
1481 | 1457 | ||
1482 | out2: | 1458 | out2: |
1483 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) | ||
1484 | spin_unlock_irqrestore(host->host_lock, flags); | 1459 | spin_unlock_irqrestore(host->host_lock, flags); |
1485 | #else | ||
1486 | spin_unlock_irqrestore(&io_request_lock, flags); | ||
1487 | #endif | ||
1488 | 1460 | ||
1489 | nsp32_dbg(NSP32_DEBUG_INTR, "exit"); | 1461 | nsp32_dbg(NSP32_DEBUG_INTR, "exit"); |
1490 | 1462 | ||
@@ -1499,28 +1471,15 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id) | |||
1499 | nsp32_dbg(NSP32_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | 1471 | nsp32_dbg(NSP32_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ |
1500 | } \ | 1472 | } \ |
1501 | } while(0) | 1473 | } while(0) |
1502 | static int nsp32_proc_info( | 1474 | |
1503 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | 1475 | static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, |
1504 | struct Scsi_Host *host, | 1476 | off_t offset, int length, int inout) |
1505 | #endif | ||
1506 | char *buffer, | ||
1507 | char **start, | ||
1508 | off_t offset, | ||
1509 | int length, | ||
1510 | #if !(LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1511 | int hostno, | ||
1512 | #endif | ||
1513 | int inout) | ||
1514 | { | 1477 | { |
1515 | char *pos = buffer; | 1478 | char *pos = buffer; |
1516 | int thislength; | 1479 | int thislength; |
1517 | unsigned long flags; | 1480 | unsigned long flags; |
1518 | nsp32_hw_data *data; | 1481 | nsp32_hw_data *data; |
1519 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1520 | int hostno; | 1482 | int hostno; |
1521 | #else | ||
1522 | struct Scsi_Host *host; | ||
1523 | #endif | ||
1524 | unsigned int base; | 1483 | unsigned int base; |
1525 | unsigned char mode_reg; | 1484 | unsigned char mode_reg; |
1526 | int id, speed; | 1485 | int id, speed; |
@@ -1531,15 +1490,7 @@ static int nsp32_proc_info( | |||
1531 | return -EINVAL; | 1490 | return -EINVAL; |
1532 | } | 1491 | } |
1533 | 1492 | ||
1534 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
1535 | hostno = host->host_no; | 1493 | hostno = host->host_no; |
1536 | #else | ||
1537 | /* search this HBA host */ | ||
1538 | host = scsi_host_hn_get(hostno); | ||
1539 | if (host == NULL) { | ||
1540 | return -ESRCH; | ||
1541 | } | ||
1542 | #endif | ||
1543 | data = (nsp32_hw_data *)host->hostdata; | 1494 | data = (nsp32_hw_data *)host->hostdata; |
1544 | base = host->io_port; | 1495 | base = host->io_port; |
1545 | 1496 | ||
@@ -2674,17 +2625,7 @@ static void nsp32_sack_negate(nsp32_hw_data *data) | |||
2674 | * 0x900-0xbff: (map same 0x800-0x8ff I/O port image repeatedly) | 2625 | * 0x900-0xbff: (map same 0x800-0x8ff I/O port image repeatedly) |
2675 | * 0xc00-0xfff: CardBus status registers | 2626 | * 0xc00-0xfff: CardBus status registers |
2676 | */ | 2627 | */ |
2677 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
2678 | #define DETECT_OK 0 | ||
2679 | #define DETECT_NG 1 | ||
2680 | #define PCIDEV pdev | ||
2681 | static int nsp32_detect(struct pci_dev *pdev) | 2628 | static int nsp32_detect(struct pci_dev *pdev) |
2682 | #else | ||
2683 | #define DETECT_OK 1 | ||
2684 | #define DETECT_NG 0 | ||
2685 | #define PCIDEV (data->Pci) | ||
2686 | static int nsp32_detect(struct scsi_host_template *sht) | ||
2687 | #endif | ||
2688 | { | 2629 | { |
2689 | struct Scsi_Host *host; /* registered host structure */ | 2630 | struct Scsi_Host *host; /* registered host structure */ |
2690 | struct resource *res; | 2631 | struct resource *res; |
@@ -2697,11 +2638,7 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2697 | /* | 2638 | /* |
2698 | * register this HBA as SCSI device | 2639 | * register this HBA as SCSI device |
2699 | */ | 2640 | */ |
2700 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
2701 | host = scsi_host_alloc(&nsp32_template, sizeof(nsp32_hw_data)); | 2641 | host = scsi_host_alloc(&nsp32_template, sizeof(nsp32_hw_data)); |
2702 | #else | ||
2703 | host = scsi_register(sht, sizeof(nsp32_hw_data)); | ||
2704 | #endif | ||
2705 | if (host == NULL) { | 2642 | if (host == NULL) { |
2706 | nsp32_msg (KERN_ERR, "failed to scsi register"); | 2643 | nsp32_msg (KERN_ERR, "failed to scsi register"); |
2707 | goto err; | 2644 | goto err; |
@@ -2719,9 +2656,6 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2719 | host->unique_id = data->BaseAddress; | 2656 | host->unique_id = data->BaseAddress; |
2720 | host->n_io_port = data->NumAddress; | 2657 | host->n_io_port = data->NumAddress; |
2721 | host->base = (unsigned long)data->MmioAddress; | 2658 | host->base = (unsigned long)data->MmioAddress; |
2722 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,63)) | ||
2723 | scsi_set_pci_device(host, PCIDEV); | ||
2724 | #endif | ||
2725 | 2659 | ||
2726 | data->Host = host; | 2660 | data->Host = host; |
2727 | spin_lock_init(&(data->Lock)); | 2661 | spin_lock_init(&(data->Lock)); |
@@ -2776,7 +2710,7 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2776 | /* | 2710 | /* |
2777 | * setup DMA | 2711 | * setup DMA |
2778 | */ | 2712 | */ |
2779 | if (pci_set_dma_mask(PCIDEV, DMA_32BIT_MASK) != 0) { | 2713 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0) { |
2780 | nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); | 2714 | nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); |
2781 | goto scsi_unregister; | 2715 | goto scsi_unregister; |
2782 | } | 2716 | } |
@@ -2784,7 +2718,7 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2784 | /* | 2718 | /* |
2785 | * allocate autoparam DMA resource. | 2719 | * allocate autoparam DMA resource. |
2786 | */ | 2720 | */ |
2787 | data->autoparam = pci_alloc_consistent(PCIDEV, sizeof(nsp32_autoparam), &(data->auto_paddr)); | 2721 | data->autoparam = pci_alloc_consistent(pdev, sizeof(nsp32_autoparam), &(data->auto_paddr)); |
2788 | if (data->autoparam == NULL) { | 2722 | if (data->autoparam == NULL) { |
2789 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); | 2723 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); |
2790 | goto scsi_unregister; | 2724 | goto scsi_unregister; |
@@ -2793,7 +2727,7 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2793 | /* | 2727 | /* |
2794 | * allocate scatter-gather DMA resource. | 2728 | * allocate scatter-gather DMA resource. |
2795 | */ | 2729 | */ |
2796 | data->sg_list = pci_alloc_consistent(PCIDEV, NSP32_SG_TABLE_SIZE, | 2730 | data->sg_list = pci_alloc_consistent(pdev, NSP32_SG_TABLE_SIZE, |
2797 | &(data->sg_paddr)); | 2731 | &(data->sg_paddr)); |
2798 | if (data->sg_list == NULL) { | 2732 | if (data->sg_list == NULL) { |
2799 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); | 2733 | nsp32_msg(KERN_ERR, "failed to allocate DMA memory"); |
@@ -2883,16 +2817,14 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2883 | goto free_irq; | 2817 | goto free_irq; |
2884 | } | 2818 | } |
2885 | 2819 | ||
2886 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | 2820 | ret = scsi_add_host(host, &pdev->dev); |
2887 | ret = scsi_add_host(host, &PCIDEV->dev); | ||
2888 | if (ret) { | 2821 | if (ret) { |
2889 | nsp32_msg(KERN_ERR, "failed to add scsi host"); | 2822 | nsp32_msg(KERN_ERR, "failed to add scsi host"); |
2890 | goto free_region; | 2823 | goto free_region; |
2891 | } | 2824 | } |
2892 | scsi_scan_host(host); | 2825 | scsi_scan_host(host); |
2893 | #endif | 2826 | pci_set_drvdata(pdev, host); |
2894 | pci_set_drvdata(PCIDEV, host); | 2827 | return 0; |
2895 | return DETECT_OK; | ||
2896 | 2828 | ||
2897 | free_region: | 2829 | free_region: |
2898 | release_region(host->io_port, host->n_io_port); | 2830 | release_region(host->io_port, host->n_io_port); |
@@ -2901,22 +2833,19 @@ static int nsp32_detect(struct scsi_host_template *sht) | |||
2901 | free_irq(host->irq, data); | 2833 | free_irq(host->irq, data); |
2902 | 2834 | ||
2903 | free_sg_list: | 2835 | free_sg_list: |
2904 | pci_free_consistent(PCIDEV, NSP32_SG_TABLE_SIZE, | 2836 | pci_free_consistent(pdev, NSP32_SG_TABLE_SIZE, |
2905 | data->sg_list, data->sg_paddr); | 2837 | data->sg_list, data->sg_paddr); |
2906 | 2838 | ||
2907 | free_autoparam: | 2839 | free_autoparam: |
2908 | pci_free_consistent(PCIDEV, sizeof(nsp32_autoparam), | 2840 | pci_free_consistent(pdev, sizeof(nsp32_autoparam), |
2909 | data->autoparam, data->auto_paddr); | 2841 | data->autoparam, data->auto_paddr); |
2910 | 2842 | ||
2911 | scsi_unregister: | 2843 | scsi_unregister: |
2912 | scsi_host_put(host); | 2844 | scsi_host_put(host); |
2913 | 2845 | ||
2914 | err: | 2846 | err: |
2915 | return DETECT_NG; | 2847 | return 1; |
2916 | } | 2848 | } |
2917 | #undef DETECT_OK | ||
2918 | #undef DETECT_NG | ||
2919 | #undef PCIDEV | ||
2920 | 2849 | ||
2921 | static int nsp32_release(struct Scsi_Host *host) | 2850 | static int nsp32_release(struct Scsi_Host *host) |
2922 | { | 2851 | { |
@@ -3525,11 +3454,7 @@ static int __devinit nsp32_probe(struct pci_dev *pdev, const struct pci_device_i | |||
3525 | 3454 | ||
3526 | pci_set_master(pdev); | 3455 | pci_set_master(pdev); |
3527 | 3456 | ||
3528 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
3529 | ret = nsp32_detect(pdev); | 3457 | ret = nsp32_detect(pdev); |
3530 | #else | ||
3531 | ret = scsi_register_host(&nsp32_template); | ||
3532 | #endif | ||
3533 | 3458 | ||
3534 | nsp32_msg(KERN_INFO, "irq: %i mmio: %p+0x%lx slot: %s model: %s", | 3459 | nsp32_msg(KERN_INFO, "irq: %i mmio: %p+0x%lx slot: %s model: %s", |
3535 | pdev->irq, | 3460 | pdev->irq, |
@@ -3544,25 +3469,17 @@ static int __devinit nsp32_probe(struct pci_dev *pdev, const struct pci_device_i | |||
3544 | 3469 | ||
3545 | static void __devexit nsp32_remove(struct pci_dev *pdev) | 3470 | static void __devexit nsp32_remove(struct pci_dev *pdev) |
3546 | { | 3471 | { |
3547 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
3548 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 3472 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
3549 | #endif | ||
3550 | 3473 | ||
3551 | nsp32_dbg(NSP32_DEBUG_REGISTER, "enter"); | 3474 | nsp32_dbg(NSP32_DEBUG_REGISTER, "enter"); |
3552 | 3475 | ||
3553 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,73)) | ||
3554 | scsi_remove_host(host); | 3476 | scsi_remove_host(host); |
3555 | 3477 | ||
3556 | nsp32_release(host); | 3478 | nsp32_release(host); |
3557 | 3479 | ||
3558 | scsi_host_put(host); | 3480 | scsi_host_put(host); |
3559 | #else | ||
3560 | scsi_unregister_host(&nsp32_template); | ||
3561 | #endif | ||
3562 | } | 3481 | } |
3563 | 3482 | ||
3564 | |||
3565 | |||
3566 | static struct pci_driver nsp32_driver = { | 3483 | static struct pci_driver nsp32_driver = { |
3567 | .name = "nsp32", | 3484 | .name = "nsp32", |
3568 | .id_table = nsp32_pci_table, | 3485 | .id_table = nsp32_pci_table, |