ncr5380: Remove redundant volatile qualifiers
[deliverable/linux.git] / drivers / scsi / dmx3191d.c
CommitLineData
1da177e4
LT
1/*
2 dmx3191d.c - driver for the Domex DMX3191D SCSI card.
3 Copyright (C) 2000 by Massimo Piccioni <dafastidio@libero.it>
4 Portions Copyright (C) 2004 by Christoph Hellwig <hch@lst.de>
5
6 Based on the generic NCR5380 driver by Drew Eckhardt et al.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include <linux/init.h>
24#include <linux/ioport.h>
25#include <linux/kernel.h>
26#include <linux/module.h>
27#include <linux/pci.h>
28#include <linux/interrupt.h>
29#include <asm/io.h>
30
31#include <scsi/scsi_host.h>
32
33/*
6070d81e 34 * Definitions for the generic 5380 driver.
1da177e4 35 */
1da177e4 36
fd9cd67c
FT
37#define DONT_USE_INTR
38
54d8fe44
FT
39#define NCR5380_read(reg) inb(instance->io_port + reg)
40#define NCR5380_write(reg, value) outb(value, instance->io_port + reg)
1da177e4 41
acfc8cad 42#define NCR5380_implementation_fields /* none */
1da177e4 43
1da177e4
LT
44#include "NCR5380.h"
45#include "NCR5380.c"
46
47#define DMX3191D_DRIVER_NAME "dmx3191d"
48#define DMX3191D_REGION_LEN 8
49
50
51static struct scsi_host_template dmx3191d_driver_template = {
aa2e2cb1 52 .module = THIS_MODULE,
1da177e4
LT
53 .proc_name = DMX3191D_DRIVER_NAME,
54 .name = "Domex DMX3191D",
8c32513b 55 .info = NCR5380_info,
1da177e4
LT
56 .queuecommand = NCR5380_queue_command,
57 .eh_abort_handler = NCR5380_abort,
58 .eh_bus_reset_handler = NCR5380_bus_reset,
1da177e4
LT
59 .can_queue = 32,
60 .this_id = 7,
61 .sg_tablesize = SG_ALL,
62 .cmd_per_lun = 2,
63 .use_clustering = DISABLE_CLUSTERING,
64};
65
6f039790
GKH
66static int dmx3191d_probe_one(struct pci_dev *pdev,
67 const struct pci_device_id *id)
1da177e4
LT
68{
69 struct Scsi_Host *shost;
70 unsigned long io;
71 int error = -ENODEV;
72
73 if (pci_enable_device(pdev))
74 goto out;
75
76 io = pci_resource_start(pdev, 0);
77 if (!request_region(io, DMX3191D_REGION_LEN, DMX3191D_DRIVER_NAME)) {
78 printk(KERN_ERR "dmx3191: region 0x%lx-0x%lx already reserved\n",
79 io, io + DMX3191D_REGION_LEN);
80 goto out_disable_device;
81 }
82
83 shost = scsi_host_alloc(&dmx3191d_driver_template,
84 sizeof(struct NCR5380_hostdata));
85 if (!shost)
86 goto out_release_region;
87 shost->io_port = io;
1da177e4 88
fd9cd67c
FT
89 /* This card does not seem to raise an interrupt on pdev->irq.
90 * Steam-powered SCSI controllers run without an IRQ anyway.
91 */
92 shost->irq = NO_IRQ;
1da177e4 93
be3f4121 94 error = NCR5380_init(shost, FLAG_NO_PSEUDO_DMA);
0ad0eff9
FT
95 if (error)
96 goto out_host_put;
1da177e4 97
b6488f97
FT
98 NCR5380_maybe_reset_bus(shost);
99
1da177e4
LT
100 pci_set_drvdata(pdev, shost);
101
102 error = scsi_add_host(shost, &pdev->dev);
103 if (error)
0ad0eff9 104 goto out_exit;
1da177e4
LT
105
106 scsi_scan_host(shost);
107 return 0;
108
0ad0eff9
FT
109out_exit:
110 NCR5380_exit(shost);
111out_host_put:
112 scsi_host_put(shost);
1da177e4 113 out_release_region:
c3c026ba 114 release_region(io, DMX3191D_REGION_LEN);
1da177e4
LT
115 out_disable_device:
116 pci_disable_device(pdev);
117 out:
118 return error;
119}
120
6f039790 121static void dmx3191d_remove_one(struct pci_dev *pdev)
1da177e4
LT
122{
123 struct Scsi_Host *shost = pci_get_drvdata(pdev);
0ad0eff9 124 unsigned long io = shost->io_port;
1da177e4
LT
125
126 scsi_remove_host(shost);
127
128 NCR5380_exit(shost);
1da177e4 129 scsi_host_put(shost);
0ad0eff9
FT
130 release_region(io, DMX3191D_REGION_LEN);
131 pci_disable_device(pdev);
1da177e4
LT
132}
133
134static struct pci_device_id dmx3191d_pci_tbl[] = {
135 {PCI_VENDOR_ID_DOMEX, PCI_DEVICE_ID_DOMEX_DMX3191D,
136 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
137 { }
138};
139MODULE_DEVICE_TABLE(pci, dmx3191d_pci_tbl);
140
141static struct pci_driver dmx3191d_pci_driver = {
142 .name = DMX3191D_DRIVER_NAME,
143 .id_table = dmx3191d_pci_tbl,
144 .probe = dmx3191d_probe_one,
6f039790 145 .remove = dmx3191d_remove_one,
1da177e4
LT
146};
147
148static int __init dmx3191d_init(void)
149{
dcbccbde 150 return pci_register_driver(&dmx3191d_pci_driver);
1da177e4
LT
151}
152
153static void __exit dmx3191d_exit(void)
154{
155 pci_unregister_driver(&dmx3191d_pci_driver);
156}
157
158module_init(dmx3191d_init);
159module_exit(dmx3191d_exit);
160
161MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
162MODULE_DESCRIPTION("Domex DMX3191D SCSI driver");
163MODULE_LICENSE("GPL");
This page took 1.355267 seconds and 5 git commands to generate.