aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-28 12:31:34 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-28 12:31:34 -0400
commit96b88fb850cc419171f926ad04650ec509e9f543 (patch)
tree5bf9537bde467534608b3acdbfa5f7726ede8c3f /drivers/scsi
parente78a57de94480226f7fc90d0b4837bfc6c99a9e0 (diff)
parent5fadd053d9bb4345ec6f405d24db4e7eb49cf81e (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR5380.c2
-rw-r--r--drivers/scsi/aacraid/aacraid.h2
-rw-r--r--drivers/scsi/ahci.c2
-rw-r--r--drivers/scsi/ata_piix.c4
-rw-r--r--drivers/scsi/eata.c2
-rw-r--r--drivers/scsi/hosts.c3
-rw-r--r--drivers/scsi/libata-core.c106
-rw-r--r--drivers/scsi/libata-scsi.c24
-rw-r--r--drivers/scsi/libata.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c2
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/pdc_adma.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_rscn.c2
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_nv.c2
-rw-r--r--drivers/scsi/sata_promise.c12
-rw-r--r--drivers/scsi/sata_qstor.c2
-rw-r--r--drivers/scsi/sata_sil.c2
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--drivers/scsi/sata_sis.c2
-rw-r--r--drivers/scsi/sata_svw.c4
-rw-r--r--drivers/scsi/sata_sx4.c10
-rw-r--r--drivers/scsi/sata_uli.c2
-rw-r--r--drivers/scsi/sata_via.c2
-rw-r--r--drivers/scsi/sata_vsc.c4
-rw-r--r--drivers/scsi/scsi.c8
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/scsi/scsi_ioctl.c3
-rw-r--r--drivers/scsi/scsi_lib.c9
-rw-r--r--drivers/scsi/scsi_transport_fc.c13
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/st.c6
35 files changed, 132 insertions, 124 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d40ba0bd68a3..23392ae7df8b 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -91,7 +91,7 @@
91#ifndef NDEBUG 91#ifndef NDEBUG
92#define NDEBUG 0 92#define NDEBUG 0
93#endif 93#endif
94#ifndef NDEBUG 94#ifndef NDEBUG_ABORT
95#define NDEBUG_ABORT 0 95#define NDEBUG_ABORT 0
96#endif 96#endif
97 97
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 4a99d2f000f4..d54b1cc88d0d 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -19,7 +19,7 @@
19#define AAC_MAX_LUN (8) 19#define AAC_MAX_LUN (8)
20 20
21#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) 21#define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) 22#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256)
23 23
24/* 24/*
25 * These macros convert from physical channels to virtual channels 25 * These macros convert from physical channels to virtual channels
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index cfa22e4ee547..fe8187d6f58b 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -216,7 +216,7 @@ static Scsi_Host_Template ahci_sht = {
216 .ordered_flush = 1, 216 .ordered_flush = 1,
217}; 217};
218 218
219static struct ata_port_operations ahci_ops = { 219static const struct ata_port_operations ahci_ops = {
220 .port_disable = ata_port_disable, 220 .port_disable = ata_port_disable,
221 221
222 .check_status = ahci_check_status, 222 .check_status = ahci_check_status,
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index d71cef767cec..be021478f416 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -147,7 +147,7 @@ static Scsi_Host_Template piix_sht = {
147 .ordered_flush = 1, 147 .ordered_flush = 1,
148}; 148};
149 149
150static struct ata_port_operations piix_pata_ops = { 150static const struct ata_port_operations piix_pata_ops = {
151 .port_disable = ata_port_disable, 151 .port_disable = ata_port_disable,
152 .set_piomode = piix_set_piomode, 152 .set_piomode = piix_set_piomode,
153 .set_dmamode = piix_set_dmamode, 153 .set_dmamode = piix_set_dmamode,
@@ -177,7 +177,7 @@ static struct ata_port_operations piix_pata_ops = {
177 .host_stop = ata_host_stop, 177 .host_stop = ata_host_stop,
178}; 178};
179 179
180static struct ata_port_operations piix_sata_ops = { 180static const struct ata_port_operations piix_sata_ops = {
181 .port_disable = ata_port_disable, 181 .port_disable = ata_port_disable,
182 182
183 .tf_load = ata_tf_load, 183 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index c10e45b94b62..3d13fdee4fc2 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1357,7 +1357,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
1357 1357
1358 for (i = 0; i < shost->can_queue; i++) { 1358 for (i = 0; i < shost->can_queue; i++) {
1359 size_t sz = shost->sg_tablesize *sizeof(struct sg_list); 1359 size_t sz = shost->sg_tablesize *sizeof(struct sg_list);
1360 unsigned int gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC; 1360 gfp_t gfp_mask = (shost->unchecked_isa_dma ? GFP_DMA : 0) | GFP_ATOMIC;
1361 ha->cp[i].sglist = kmalloc(sz, gfp_mask); 1361 ha->cp[i].sglist = kmalloc(sz, gfp_mask);
1362 if (!ha->cp[i].sglist) { 1362 if (!ha->cp[i].sglist) {
1363 printk 1363 printk
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 02fe371b0ab8..f24d84538fd5 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -287,7 +287,8 @@ static void scsi_host_dev_release(struct device *dev)
287struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) 287struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
288{ 288{
289 struct Scsi_Host *shost; 289 struct Scsi_Host *shost;
290 int gfp_mask = GFP_KERNEL, rval; 290 gfp_t gfp_mask = GFP_KERNEL;
291 int rval;
291 292
292 if (sht->unchecked_isa_dma && privsize) 293 if (sht->unchecked_isa_dma && privsize)
293 gfp_mask |= __GFP_DMA; 294 gfp_mask |= __GFP_DMA;
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 9269fd9b814f..f53d7b8ac33f 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -67,9 +67,9 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); 67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
68static void ata_set_mode(struct ata_port *ap); 68static void ata_set_mode(struct ata_port *ap);
69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); 69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
70static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); 70static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
71static int fgb(u32 bitmap); 71static int fgb(u32 bitmap);
72static int ata_choose_xfer_mode(struct ata_port *ap, 72static int ata_choose_xfer_mode(const struct ata_port *ap,
73 u8 *xfer_mode_out, 73 u8 *xfer_mode_out,
74 unsigned int *xfer_shift_out); 74 unsigned int *xfer_shift_out);
75static void __ata_qc_complete(struct ata_queued_cmd *qc); 75static void __ata_qc_complete(struct ata_queued_cmd *qc);
@@ -87,7 +87,7 @@ MODULE_LICENSE("GPL");
87MODULE_VERSION(DRV_VERSION); 87MODULE_VERSION(DRV_VERSION);
88 88
89/** 89/**
90 * ata_tf_load - send taskfile registers to host controller 90 * ata_tf_load_pio - send taskfile registers to host controller
91 * @ap: Port to which output is sent 91 * @ap: Port to which output is sent
92 * @tf: ATA taskfile register set 92 * @tf: ATA taskfile register set
93 * 93 *
@@ -97,7 +97,7 @@ MODULE_VERSION(DRV_VERSION);
97 * Inherited from caller. 97 * Inherited from caller.
98 */ 98 */
99 99
100static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) 100static void ata_tf_load_pio(struct ata_port *ap, const struct ata_taskfile *tf)
101{ 101{
102 struct ata_ioports *ioaddr = &ap->ioaddr; 102 struct ata_ioports *ioaddr = &ap->ioaddr;
103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -155,7 +155,7 @@ static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf)
155 * Inherited from caller. 155 * Inherited from caller.
156 */ 156 */
157 157
158static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 158static void ata_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
159{ 159{
160 struct ata_ioports *ioaddr = &ap->ioaddr; 160 struct ata_ioports *ioaddr = &ap->ioaddr;
161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -224,7 +224,7 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
224 * LOCKING: 224 * LOCKING:
225 * Inherited from caller. 225 * Inherited from caller.
226 */ 226 */
227void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 227void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
228{ 228{
229 if (ap->flags & ATA_FLAG_MMIO) 229 if (ap->flags & ATA_FLAG_MMIO)
230 ata_tf_load_mmio(ap, tf); 230 ata_tf_load_mmio(ap, tf);
@@ -244,7 +244,7 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
244 * spin_lock_irqsave(host_set lock) 244 * spin_lock_irqsave(host_set lock)
245 */ 245 */
246 246
247static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) 247static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf)
248{ 248{
249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
250 250
@@ -265,7 +265,7 @@ static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf)
265 * spin_lock_irqsave(host_set lock) 265 * spin_lock_irqsave(host_set lock)
266 */ 266 */
267 267
268static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 268static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
269{ 269{
270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
271 271
@@ -285,7 +285,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
285 * LOCKING: 285 * LOCKING:
286 * spin_lock_irqsave(host_set lock) 286 * spin_lock_irqsave(host_set lock)
287 */ 287 */
288void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 288void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
289{ 289{
290 if (ap->flags & ATA_FLAG_MMIO) 290 if (ap->flags & ATA_FLAG_MMIO)
291 ata_exec_command_mmio(ap, tf); 291 ata_exec_command_mmio(ap, tf);
@@ -305,7 +305,7 @@ void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
305 * Obtains host_set lock. 305 * Obtains host_set lock.
306 */ 306 */
307 307
308static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf) 308static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
309{ 309{
310 unsigned long flags; 310 unsigned long flags;
311 311
@@ -328,7 +328,7 @@ static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf)
328 * Obtains host_set lock. 328 * Obtains host_set lock.
329 */ 329 */
330 330
331static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf) 331static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
332{ 332{
333 ap->ops->tf_load(ap, tf); 333 ap->ops->tf_load(ap, tf);
334 334
@@ -348,7 +348,7 @@ static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
348 * spin_lock_irqsave(host_set lock) 348 * spin_lock_irqsave(host_set lock)
349 */ 349 */
350 350
351void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf) 351void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf)
352{ 352{
353 ap->ops->tf_load(ap, tf); 353 ap->ops->tf_load(ap, tf);
354 ap->ops->exec_command(ap, tf); 354 ap->ops->exec_command(ap, tf);
@@ -558,7 +558,7 @@ u8 ata_chk_err(struct ata_port *ap)
558 * Inherited from caller. 558 * Inherited from caller.
559 */ 559 */
560 560
561void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp) 561void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
562{ 562{
563 fis[0] = 0x27; /* Register - Host to Device FIS */ 563 fis[0] = 0x27; /* Register - Host to Device FIS */
564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, 564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number,
@@ -599,7 +599,7 @@ void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
599 * Inherited from caller. 599 * Inherited from caller.
600 */ 600 */
601 601
602void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) 602void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
603{ 603{
604 tf->command = fis[2]; /* status */ 604 tf->command = fis[2]; /* status */
605 tf->feature = fis[3]; /* error */ 605 tf->feature = fis[3]; /* error */
@@ -845,7 +845,7 @@ static unsigned int ata_devchk(struct ata_port *ap,
845 * the event of failure. 845 * the event of failure.
846 */ 846 */
847 847
848unsigned int ata_dev_classify(struct ata_taskfile *tf) 848unsigned int ata_dev_classify(const struct ata_taskfile *tf)
849{ 849{
850 /* Apple's open source Darwin code hints that some devices only 850 /* Apple's open source Darwin code hints that some devices only
851 * put a proper signature into the LBA mid/high registers, 851 * put a proper signature into the LBA mid/high registers,
@@ -937,7 +937,7 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
937 * caller. 937 * caller.
938 */ 938 */
939 939
940void ata_dev_id_string(u16 *id, unsigned char *s, 940void ata_dev_id_string(const u16 *id, unsigned char *s,
941 unsigned int ofs, unsigned int len) 941 unsigned int ofs, unsigned int len)
942{ 942{
943 unsigned int c; 943 unsigned int c;
@@ -1054,7 +1054,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
1054 * caller. 1054 * caller.
1055 */ 1055 */
1056 1056
1057static inline void ata_dump_id(struct ata_device *dev) 1057static inline void ata_dump_id(const struct ata_device *dev)
1058{ 1058{
1059 DPRINTK("49==0x%04x " 1059 DPRINTK("49==0x%04x "
1060 "53==0x%04x " 1060 "53==0x%04x "
@@ -1089,7 +1089,7 @@ static inline void ata_dump_id(struct ata_device *dev)
1089 * FIXME: pre IDE drive timing (do we care ?). 1089 * FIXME: pre IDE drive timing (do we care ?).
1090 */ 1090 */
1091 1091
1092static unsigned int ata_pio_modes(struct ata_device *adev) 1092static unsigned int ata_pio_modes(const struct ata_device *adev)
1093{ 1093{
1094 u16 modes; 1094 u16 modes;
1095 1095
@@ -1352,7 +1352,7 @@ err_out:
1352} 1352}
1353 1353
1354 1354
1355static inline u8 ata_dev_knobble(struct ata_port *ap) 1355static inline u8 ata_dev_knobble(const struct ata_port *ap)
1356{ 1356{
1357 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); 1357 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id)));
1358} 1358}
@@ -1616,7 +1616,7 @@ static const struct ata_timing* ata_timing_find_mode(unsigned short speed)
1616 const struct ata_timing *t; 1616 const struct ata_timing *t;
1617 1617
1618 for (t = ata_timing; t->mode != speed; t++) 1618 for (t = ata_timing; t->mode != speed; t++)
1619 if (t->mode != 0xFF) 1619 if (t->mode == 0xFF)
1620 return NULL; 1620 return NULL;
1621 return t; 1621 return t;
1622} 1622}
@@ -1684,7 +1684,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1684 return 0; 1684 return 0;
1685} 1685}
1686 1686
1687static struct { 1687static const struct {
1688 unsigned int shift; 1688 unsigned int shift;
1689 u8 base; 1689 u8 base;
1690} xfer_mode_classes[] = { 1690} xfer_mode_classes[] = {
@@ -2093,7 +2093,8 @@ err_out:
2093 DPRINTK("EXIT\n"); 2093 DPRINTK("EXIT\n");
2094} 2094}
2095 2095
2096static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev) 2096static void ata_pr_blacklisted(const struct ata_port *ap,
2097 const struct ata_device *dev)
2097{ 2098{
2098 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n", 2099 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n",
2099 ap->id, dev->devno); 2100 ap->id, dev->devno);
@@ -2131,7 +2132,7 @@ static const char * ata_dma_blacklist [] = {
2131 "_NEC DV5800A", 2132 "_NEC DV5800A",
2132}; 2133};
2133 2134
2134static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev) 2135static int ata_dma_blacklisted(const struct ata_device *dev)
2135{ 2136{
2136 unsigned char model_num[40]; 2137 unsigned char model_num[40];
2137 char *s; 2138 char *s;
@@ -2156,9 +2157,9 @@ static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
2156 return 0; 2157 return 0;
2157} 2158}
2158 2159
2159static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) 2160static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift)
2160{ 2161{
2161 struct ata_device *master, *slave; 2162 const struct ata_device *master, *slave;
2162 unsigned int mask; 2163 unsigned int mask;
2163 2164
2164 master = &ap->device[0]; 2165 master = &ap->device[0];
@@ -2170,14 +2171,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2170 mask = ap->udma_mask; 2171 mask = ap->udma_mask;
2171 if (ata_dev_present(master)) { 2172 if (ata_dev_present(master)) {
2172 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff); 2173 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff);
2173 if (ata_dma_blacklisted(ap, master)) { 2174 if (ata_dma_blacklisted(master)) {
2174 mask = 0; 2175 mask = 0;
2175 ata_pr_blacklisted(ap, master); 2176 ata_pr_blacklisted(ap, master);
2176 } 2177 }
2177 } 2178 }
2178 if (ata_dev_present(slave)) { 2179 if (ata_dev_present(slave)) {
2179 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff); 2180 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff);
2180 if (ata_dma_blacklisted(ap, slave)) { 2181 if (ata_dma_blacklisted(slave)) {
2181 mask = 0; 2182 mask = 0;
2182 ata_pr_blacklisted(ap, slave); 2183 ata_pr_blacklisted(ap, slave);
2183 } 2184 }
@@ -2187,14 +2188,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2187 mask = ap->mwdma_mask; 2188 mask = ap->mwdma_mask;
2188 if (ata_dev_present(master)) { 2189 if (ata_dev_present(master)) {
2189 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07); 2190 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07);
2190 if (ata_dma_blacklisted(ap, master)) { 2191 if (ata_dma_blacklisted(master)) {
2191 mask = 0; 2192 mask = 0;
2192 ata_pr_blacklisted(ap, master); 2193 ata_pr_blacklisted(ap, master);
2193 } 2194 }
2194 } 2195 }
2195 if (ata_dev_present(slave)) { 2196 if (ata_dev_present(slave)) {
2196 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07); 2197 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07);
2197 if (ata_dma_blacklisted(ap, slave)) { 2198 if (ata_dma_blacklisted(slave)) {
2198 mask = 0; 2199 mask = 0;
2199 ata_pr_blacklisted(ap, slave); 2200 ata_pr_blacklisted(ap, slave);
2200 } 2201 }
@@ -2258,7 +2259,7 @@ static int fgb(u32 bitmap)
2258 * Zero on success, negative on error. 2259 * Zero on success, negative on error.
2259 */ 2260 */
2260 2261
2261static int ata_choose_xfer_mode(struct ata_port *ap, 2262static int ata_choose_xfer_mode(const struct ata_port *ap,
2262 u8 *xfer_mode_out, 2263 u8 *xfer_mode_out,
2263 unsigned int *xfer_shift_out) 2264 unsigned int *xfer_shift_out)
2264{ 2265{
@@ -2700,13 +2701,13 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
2700 2701
2701/** 2702/**
2702 * ata_pio_poll - 2703 * ata_pio_poll -
2703 * @ap: 2704 * @ap: the target ata_port
2704 * 2705 *
2705 * LOCKING: 2706 * LOCKING:
2706 * None. (executing in kernel thread context) 2707 * None. (executing in kernel thread context)
2707 * 2708 *
2708 * RETURNS: 2709 * RETURNS:
2709 * 2710 * timeout value to use
2710 */ 2711 */
2711 2712
2712static unsigned long ata_pio_poll(struct ata_port *ap) 2713static unsigned long ata_pio_poll(struct ata_port *ap)
@@ -2747,8 +2748,8 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2747} 2748}
2748 2749
2749/** 2750/**
2750 * ata_pio_complete - 2751 * ata_pio_complete - check if drive is busy or idle
2751 * @ap: 2752 * @ap: the target ata_port
2752 * 2753 *
2753 * LOCKING: 2754 * LOCKING:
2754 * None. (executing in kernel thread context) 2755 * None. (executing in kernel thread context)
@@ -2800,7 +2801,7 @@ static int ata_pio_complete (struct ata_port *ap)
2800 2801
2801 2802
2802/** 2803/**
2803 * swap_buf_le16 - 2804 * swap_buf_le16 - swap halves of 16-words in place
2804 * @buf: Buffer to swap 2805 * @buf: Buffer to swap
2805 * @buf_words: Number of 16-bit words in buffer. 2806 * @buf_words: Number of 16-bit words in buffer.
2806 * 2807 *
@@ -2809,6 +2810,7 @@ static int ata_pio_complete (struct ata_port *ap)
2809 * vice-versa. 2810 * vice-versa.
2810 * 2811 *
2811 * LOCKING: 2812 * LOCKING:
2813 * Inherited from caller.
2812 */ 2814 */
2813void swap_buf_le16(u16 *buf, unsigned int buf_words) 2815void swap_buf_le16(u16 *buf, unsigned int buf_words)
2814{ 2816{
@@ -2831,7 +2833,6 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
2831 * 2833 *
2832 * LOCKING: 2834 * LOCKING:
2833 * Inherited from caller. 2835 * Inherited from caller.
2834 *
2835 */ 2836 */
2836 2837
2837static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, 2838static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -2877,7 +2878,6 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf,
2877 * 2878 *
2878 * LOCKING: 2879 * LOCKING:
2879 * Inherited from caller. 2880 * Inherited from caller.
2880 *
2881 */ 2881 */
2882 2882
2883static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf, 2883static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -2917,7 +2917,6 @@ static void ata_pio_data_xfer(struct ata_port *ap, unsigned char *buf,
2917 * 2917 *
2918 * LOCKING: 2918 * LOCKING:
2919 * Inherited from caller. 2919 * Inherited from caller.
2920 *
2921 */ 2920 */
2922 2921
2923static void ata_data_xfer(struct ata_port *ap, unsigned char *buf, 2922static void ata_data_xfer(struct ata_port *ap, unsigned char *buf,
@@ -3070,7 +3069,6 @@ next_sg:
3070 * 3069 *
3071 * LOCKING: 3070 * LOCKING:
3072 * Inherited from caller. 3071 * Inherited from caller.
3073 *
3074 */ 3072 */
3075 3073
3076static void atapi_pio_bytes(struct ata_queued_cmd *qc) 3074static void atapi_pio_bytes(struct ata_queued_cmd *qc)
@@ -3106,8 +3104,8 @@ err_out:
3106} 3104}
3107 3105
3108/** 3106/**
3109 * ata_pio_sector - 3107 * ata_pio_block - start PIO on a block
3110 * @ap: 3108 * @ap: the target ata_port
3111 * 3109 *
3112 * LOCKING: 3110 * LOCKING:
3113 * None. (executing in kernel thread context) 3111 * None. (executing in kernel thread context)
@@ -3119,7 +3117,7 @@ static void ata_pio_block(struct ata_port *ap)
3119 u8 status; 3117 u8 status;
3120 3118
3121 /* 3119 /*
3122 * This is purely hueristic. This is a fast path. 3120 * This is purely heuristic. This is a fast path.
3123 * Sometimes when we enter, BSY will be cleared in 3121 * Sometimes when we enter, BSY will be cleared in
3124 * a chk-status or two. If not, the drive is probably seeking 3122 * a chk-status or two. If not, the drive is probably seeking
3125 * or something. Snooze for a couple msecs, then 3123 * or something. Snooze for a couple msecs, then
@@ -3439,7 +3437,6 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc)
3439 * 3437 *
3440 * LOCKING: 3438 * LOCKING:
3441 * spin_lock_irqsave(host_set lock) 3439 * spin_lock_irqsave(host_set lock)
3442 *
3443 */ 3440 */
3444void ata_qc_free(struct ata_queued_cmd *qc) 3441void ata_qc_free(struct ata_queued_cmd *qc)
3445{ 3442{
@@ -3459,7 +3456,6 @@ void ata_qc_free(struct ata_queued_cmd *qc)
3459 * 3456 *
3460 * LOCKING: 3457 * LOCKING:
3461 * spin_lock_irqsave(host_set lock) 3458 * spin_lock_irqsave(host_set lock)
3462 *
3463 */ 3459 */
3464 3460
3465void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) 3461void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
@@ -3953,7 +3949,6 @@ idle_irq:
3953 * 3949 *
3954 * RETURNS: 3950 * RETURNS:
3955 * IRQ_NONE or IRQ_HANDLED. 3951 * IRQ_NONE or IRQ_HANDLED.
3956 *
3957 */ 3952 */
3958 3953
3959irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 3954irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
@@ -4065,6 +4060,7 @@ err_out:
4065 * May be used as the port_start() entry in ata_port_operations. 4060 * May be used as the port_start() entry in ata_port_operations.
4066 * 4061 *
4067 * LOCKING: 4062 * LOCKING:
4063 * Inherited from caller.
4068 */ 4064 */
4069 4065
4070int ata_port_start (struct ata_port *ap) 4066int ata_port_start (struct ata_port *ap)
@@ -4090,6 +4086,7 @@ int ata_port_start (struct ata_port *ap)
4090 * May be used as the port_stop() entry in ata_port_operations. 4086 * May be used as the port_stop() entry in ata_port_operations.
4091 * 4087 *
4092 * LOCKING: 4088 * LOCKING:
4089 * Inherited from caller.
4093 */ 4090 */
4094 4091
4095void ata_port_stop (struct ata_port *ap) 4092void ata_port_stop (struct ata_port *ap)
@@ -4112,6 +4109,7 @@ void ata_host_stop (struct ata_host_set *host_set)
4112 * @do_unregister: 1 if we fully unregister, 0 to just stop the port 4109 * @do_unregister: 1 if we fully unregister, 0 to just stop the port
4113 * 4110 *
4114 * LOCKING: 4111 * LOCKING:
4112 * Inherited from caller.
4115 */ 4113 */
4116 4114
4117static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister) 4115static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
@@ -4139,12 +4137,11 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
4139 * 4137 *
4140 * LOCKING: 4138 * LOCKING:
4141 * Inherited from caller. 4139 * Inherited from caller.
4142 *
4143 */ 4140 */
4144 4141
4145static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, 4142static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4146 struct ata_host_set *host_set, 4143 struct ata_host_set *host_set,
4147 struct ata_probe_ent *ent, unsigned int port_no) 4144 const struct ata_probe_ent *ent, unsigned int port_no)
4148{ 4145{
4149 unsigned int i; 4146 unsigned int i;
4150 4147
@@ -4200,10 +4197,9 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4200 * 4197 *
4201 * RETURNS: 4198 * RETURNS:
4202 * New ata_port on success, for NULL on error. 4199 * New ata_port on success, for NULL on error.
4203 *
4204 */ 4200 */
4205 4201
4206static struct ata_port * ata_host_add(struct ata_probe_ent *ent, 4202static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4207 struct ata_host_set *host_set, 4203 struct ata_host_set *host_set,
4208 unsigned int port_no) 4204 unsigned int port_no)
4209{ 4205{
@@ -4248,10 +4244,9 @@ err_out:
4248 * 4244 *
4249 * RETURNS: 4245 * RETURNS:
4250 * Number of ports registered. Zero on error (no ports registered). 4246 * Number of ports registered. Zero on error (no ports registered).
4251 *
4252 */ 4247 */
4253 4248
4254int ata_device_add(struct ata_probe_ent *ent) 4249int ata_device_add(const struct ata_probe_ent *ent)
4255{ 4250{
4256 unsigned int count = 0, i; 4251 unsigned int count = 0, i;
4257 struct device *dev = ent->dev; 4252 struct device *dev = ent->dev;
@@ -4380,7 +4375,6 @@ err_out:
4380 * Inherited from calling layer (may sleep). 4375 * Inherited from calling layer (may sleep).
4381 */ 4376 */
4382 4377
4383
4384void ata_host_set_remove(struct ata_host_set *host_set) 4378void ata_host_set_remove(struct ata_host_set *host_set)
4385{ 4379{
4386 struct ata_port *ap; 4380 struct ata_port *ap;
@@ -4470,7 +4464,7 @@ void ata_std_ports(struct ata_ioports *ioaddr)
4470} 4464}
4471 4465
4472static struct ata_probe_ent * 4466static struct ata_probe_ent *
4473ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) 4467ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
4474{ 4468{
4475 struct ata_probe_ent *probe_ent; 4469 struct ata_probe_ent *probe_ent;
4476 4470
@@ -4570,7 +4564,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4570 if (!probe_ent) 4564 if (!probe_ent)
4571 return NULL; 4565 return NULL;
4572 4566
4573
4574 probe_ent->legacy_mode = 1; 4567 probe_ent->legacy_mode = 1;
4575 probe_ent->n_ports = 1; 4568 probe_ent->n_ports = 1;
4576 probe_ent->hard_port_no = port_num; 4569 probe_ent->hard_port_no = port_num;
@@ -4614,7 +4607,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4614 * 4607 *
4615 * RETURNS: 4608 * RETURNS:
4616 * Zero on success, negative on errno-based value on error. 4609 * Zero on success, negative on errno-based value on error.
4617 *
4618 */ 4610 */
4619 4611
4620int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 4612int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
@@ -4762,7 +4754,7 @@ err_out:
4762 * @pdev: PCI device that was removed 4754 * @pdev: PCI device that was removed
4763 * 4755 *
4764 * PCI layer indicates to libata via this hook that 4756 * PCI layer indicates to libata via this hook that
4765 * hot-unplug or module unload event has occured. 4757 * hot-unplug or module unload event has occurred.
4766 * Handle this by unregistering all objects associated 4758 * Handle this by unregistering all objects associated
4767 * with this PCI device. Free those objects. Then finally 4759 * with this PCI device. Free those objects. Then finally
4768 * release PCI resources and disable device. 4760 * release PCI resources and disable device.
@@ -4783,7 +4775,7 @@ void ata_pci_remove_one (struct pci_dev *pdev)
4783} 4775}
4784 4776
4785/* move to PCI subsystem */ 4777/* move to PCI subsystem */
4786int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits) 4778int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
4787{ 4779{
4788 unsigned long tmp = 0; 4780 unsigned long tmp = 0;
4789 4781
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 1ad75d58c30c..b761bd1b9717 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -47,9 +47,9 @@
47 47
48#define SECTOR_SIZE 512 48#define SECTOR_SIZE 512
49 49
50typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, u8 *scsicmd); 50typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
51static struct ata_device * 51static struct ata_device *
52ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev); 52ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
53 53
54 54
55static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 55static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
@@ -710,7 +710,7 @@ int ata_scsi_error(struct Scsi_Host *host)
710 */ 710 */
711 711
712static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc, 712static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc,
713 u8 *scsicmd) 713 const u8 *scsicmd)
714{ 714{
715 struct ata_taskfile *tf = &qc->tf; 715 struct ata_taskfile *tf = &qc->tf;
716 716
@@ -777,7 +777,7 @@ invalid_fld:
777 * Zero on success, non-zero on error. 777 * Zero on success, non-zero on error.
778 */ 778 */
779 779
780static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 780static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
781{ 781{
782 struct ata_taskfile *tf = &qc->tf; 782 struct ata_taskfile *tf = &qc->tf;
783 783
@@ -804,7 +804,7 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
804 * @plen: the transfer length 804 * @plen: the transfer length
805 */ 805 */
806 806
807static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 807static void scsi_6_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
808{ 808{
809 u64 lba = 0; 809 u64 lba = 0;
810 u32 len = 0; 810 u32 len = 0;
@@ -831,7 +831,7 @@ static void scsi_6_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
831 * @plen: the transfer length 831 * @plen: the transfer length
832 */ 832 */
833 833
834static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 834static void scsi_10_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
835{ 835{
836 u64 lba = 0; 836 u64 lba = 0;
837 u32 len = 0; 837 u32 len = 0;
@@ -861,7 +861,7 @@ static void scsi_10_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
861 * @plen: the transfer length 861 * @plen: the transfer length
862 */ 862 */
863 863
864static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen) 864static void scsi_16_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
865{ 865{
866 u64 lba = 0; 866 u64 lba = 0;
867 u32 len = 0; 867 u32 len = 0;
@@ -900,7 +900,7 @@ static void scsi_16_lba_len(u8 *scsicmd, u64 *plba, u32 *plen)
900 * Zero on success, non-zero on error. 900 * Zero on success, non-zero on error.
901 */ 901 */
902 902
903static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 903static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
904{ 904{
905 struct ata_taskfile *tf = &qc->tf; 905 struct ata_taskfile *tf = &qc->tf;
906 struct ata_device *dev = qc->dev; 906 struct ata_device *dev = qc->dev;
@@ -1026,7 +1026,7 @@ nothing_to_do:
1026 * Zero on success, non-zero on error. 1026 * Zero on success, non-zero on error.
1027 */ 1027 */
1028 1028
1029static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 1029static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
1030{ 1030{
1031 struct ata_taskfile *tf = &qc->tf; 1031 struct ata_taskfile *tf = &qc->tf;
1032 struct ata_device *dev = qc->dev; 1032 struct ata_device *dev = qc->dev;
@@ -2010,7 +2010,7 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
2010 * Zero on success, non-zero on failure. 2010 * Zero on success, non-zero on failure.
2011 */ 2011 */
2012 2012
2013static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd) 2013static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
2014{ 2014{
2015 struct scsi_cmnd *cmd = qc->scsicmd; 2015 struct scsi_cmnd *cmd = qc->scsicmd;
2016 struct ata_device *dev = qc->dev; 2016 struct ata_device *dev = qc->dev;
@@ -2079,7 +2079,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
2079 */ 2079 */
2080 2080
2081static struct ata_device * 2081static struct ata_device *
2082ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) 2082ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
2083{ 2083{
2084 struct ata_device *dev; 2084 struct ata_device *dev;
2085 2085
@@ -2378,7 +2378,7 @@ void ata_scsi_simulate(u16 *id,
2378 void (*done)(struct scsi_cmnd *)) 2378 void (*done)(struct scsi_cmnd *))
2379{ 2379{
2380 struct ata_scsi_args args; 2380 struct ata_scsi_args args;
2381 u8 *scsicmd = cmd->cmnd; 2381 const u8 *scsicmd = cmd->cmnd;
2382 2382
2383 args.id = id; 2383 args.id = id;
2384 args.cmd = cmd; 2384 args.cmd = cmd;
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 39cce63dc45d..65c264b91136 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -48,7 +48,7 @@ extern int ata_qc_issue(struct ata_queued_cmd *qc);
48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 48extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
49extern void ata_dev_select(struct ata_port *ap, unsigned int device, 49extern void ata_dev_select(struct ata_port *ap, unsigned int device,
50 unsigned int wait, unsigned int can_sleep); 50 unsigned int wait, unsigned int can_sleep);
51extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf); 51extern void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf);
52extern void swap_buf_le16(u16 *buf, unsigned int buf_words); 52extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
53extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); 53extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
54extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 54extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 0aba13ceaacf..352df47bcaca 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -39,7 +39,7 @@
39#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ 39#define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */
40 40
41static void * 41static void *
42lpfc_pool_kmalloc(unsigned int gfp_flags, void *data) 42lpfc_pool_kmalloc(gfp_t gfp_flags, void *data)
43{ 43{
44 return kmalloc((unsigned long)data, gfp_flags); 44 return kmalloc((unsigned long)data, gfp_flags);
45} 45}
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 3f2f2464fa63..af1133104b3f 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5146,7 +5146,8 @@ static long osst_compat_ioctl(struct file * file, unsigned int cmd_in, unsigned
5146/* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */ 5146/* Try to allocate a new tape buffer skeleton. Caller must not hold os_scsi_tapes_lock */
5147static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg ) 5147static struct osst_buffer * new_tape_buffer( int from_initialization, int need_dma, int max_sg )
5148{ 5148{
5149 int i, priority; 5149 int i;
5150 gfp_t priority;
5150 struct osst_buffer *tb; 5151 struct osst_buffer *tb;
5151 5152
5152 if (from_initialization) 5153 if (from_initialization)
@@ -5178,7 +5179,8 @@ static struct osst_buffer * new_tape_buffer( int from_initialization, int need_d
5178/* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */ 5179/* Try to allocate a temporary (while a user has the device open) enlarged tape buffer */
5179static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) 5180static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma)
5180{ 5181{
5181 int segs, nbr, max_segs, b_size, priority, order, got; 5182 int segs, nbr, max_segs, b_size, order, got;
5183 gfp_t priority;
5182 5184
5183 if (STbuffer->buffer_size >= OS_FRAME_SIZE) 5185 if (STbuffer->buffer_size >= OS_FRAME_SIZE)
5184 return 1; 5186 return 1;
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 53b8db4be1a9..9820f272f889 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -158,7 +158,7 @@ static Scsi_Host_Template adma_ata_sht = {
158 .bios_param = ata_std_bios_param, 158 .bios_param = ata_std_bios_param,
159}; 159};
160 160
161static struct ata_port_operations adma_ata_ops = { 161static const struct ata_port_operations adma_ata_ops = {
162 .port_disable = ata_port_disable, 162 .port_disable = ata_port_disable,
163 .tf_load = ata_tf_load, 163 .tf_load = ata_tf_load,
164 .tf_read = ata_tf_read, 164 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 1ed32e7b5472..e451941ad81d 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -52,7 +52,7 @@ extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *);
52extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *); 52extern int qla24xx_load_risc_flash(scsi_qla_host_t *, uint32_t *);
53extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *); 53extern int qla24xx_load_risc_hotplug(scsi_qla_host_t *, uint32_t *);
54 54
55extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, int); 55extern fc_port_t *qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t);
56 56
57extern int qla2x00_loop_resync(scsi_qla_host_t *); 57extern int qla2x00_loop_resync(scsi_qla_host_t *);
58 58
@@ -277,7 +277,7 @@ extern int qla2x00_fdmi_register(scsi_qla_host_t *);
277/* 277/*
278 * Global Function Prototypes in qla_rscn.c source file. 278 * Global Function Prototypes in qla_rscn.c source file.
279 */ 279 */
280extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, int); 280extern fc_port_t *qla2x00_alloc_rscn_fcport(scsi_qla_host_t *, gfp_t);
281extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *, 281extern int qla2x00_handle_port_rscn(scsi_qla_host_t *, uint32_t, fc_port_t *,
282 int); 282 int);
283extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *); 283extern void qla2x00_process_iodesc(scsi_qla_host_t *, struct mbx_entry *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 23d095d3817b..fbb6feee40cf 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1685,7 +1685,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
1685 * Returns a pointer to the allocated fcport, or NULL, if none available. 1685 * Returns a pointer to the allocated fcport, or NULL, if none available.
1686 */ 1686 */
1687fc_port_t * 1687fc_port_t *
1688qla2x00_alloc_fcport(scsi_qla_host_t *ha, int flags) 1688qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags)
1689{ 1689{
1690 fc_port_t *fcport; 1690 fc_port_t *fcport;
1691 1691
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8982978c42fd..7aec93f9d423 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1325,6 +1325,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1325 ha->brd_info = brd_info; 1325 ha->brd_info = brd_info;
1326 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no); 1326 sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no);
1327 1327
1328 ha->dpc_pid = -1;
1329
1328 /* Configure PCI I/O space */ 1330 /* Configure PCI I/O space */
1329 ret = qla2x00_iospace_config(ha); 1331 ret = qla2x00_iospace_config(ha);
1330 if (ret) 1332 if (ret)
@@ -1448,7 +1450,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info)
1448 */ 1450 */
1449 spin_lock_init(&ha->mbx_reg_lock); 1451 spin_lock_init(&ha->mbx_reg_lock);
1450 1452
1451 ha->dpc_pid = -1;
1452 init_completion(&ha->dpc_inited); 1453 init_completion(&ha->dpc_inited);
1453 init_completion(&ha->dpc_exited); 1454 init_completion(&ha->dpc_exited);
1454 1455
diff --git a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
index 1eba98828636..7534efcc8918 100644
--- a/drivers/scsi/qla2xxx/qla_rscn.c
+++ b/drivers/scsi/qla2xxx/qla_rscn.c
@@ -1066,7 +1066,7 @@ qla2x00_send_login_iocb_cb(scsi_qla_host_t *ha, struct io_descriptor *iodesc,
1066 * Returns a pointer to the allocated RSCN fcport, or NULL, if none available. 1066 * Returns a pointer to the allocated RSCN fcport, or NULL, if none available.
1067 */ 1067 */
1068fc_port_t * 1068fc_port_t *
1069qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, int flags) 1069qla2x00_alloc_rscn_fcport(scsi_qla_host_t *ha, gfp_t flags)
1070{ 1070{
1071 fc_port_t *fcport; 1071 fc_port_t *fcport;
1072 1072
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 9b6213928f7a..422e0b6f603a 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -290,7 +290,7 @@ static Scsi_Host_Template mv_sht = {
290 .ordered_flush = 1, 290 .ordered_flush = 1,
291}; 291};
292 292
293static struct ata_port_operations mv_ops = { 293static const struct ata_port_operations mv_ops = {
294 .port_disable = ata_port_disable, 294 .port_disable = ata_port_disable,
295 295
296 .tf_load = ata_tf_load, 296 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 8866530bc491..1a56d6c79ddd 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -238,7 +238,7 @@ static Scsi_Host_Template nv_sht = {
238 .ordered_flush = 1, 238 .ordered_flush = 1,
239}; 239};
240 240
241static struct ata_port_operations nv_ops = { 241static const struct ata_port_operations nv_ops = {
242 .port_disable = ata_port_disable, 242 .port_disable = ata_port_disable,
243 .tf_load = ata_tf_load, 243 .tf_load = ata_tf_load,
244 .tf_read = ata_tf_read, 244 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 9bf8cbd29901..eee93b0016df 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -87,8 +87,8 @@ static void pdc_port_stop(struct ata_port *ap);
87static void pdc_pata_phy_reset(struct ata_port *ap); 87static void pdc_pata_phy_reset(struct ata_port *ap);
88static void pdc_sata_phy_reset(struct ata_port *ap); 88static void pdc_sata_phy_reset(struct ata_port *ap);
89static void pdc_qc_prep(struct ata_queued_cmd *qc); 89static void pdc_qc_prep(struct ata_queued_cmd *qc);
90static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); 90static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
91static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); 91static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
92static void pdc_irq_clear(struct ata_port *ap); 92static void pdc_irq_clear(struct ata_port *ap);
93static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 93static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
94 94
@@ -113,7 +113,7 @@ static Scsi_Host_Template pdc_ata_sht = {
113 .ordered_flush = 1, 113 .ordered_flush = 1,
114}; 114};
115 115
116static struct ata_port_operations pdc_sata_ops = { 116static const struct ata_port_operations pdc_sata_ops = {
117 .port_disable = ata_port_disable, 117 .port_disable = ata_port_disable,
118 .tf_load = pdc_tf_load_mmio, 118 .tf_load = pdc_tf_load_mmio,
119 .tf_read = ata_tf_read, 119 .tf_read = ata_tf_read,
@@ -136,7 +136,7 @@ static struct ata_port_operations pdc_sata_ops = {
136 .host_stop = ata_pci_host_stop, 136 .host_stop = ata_pci_host_stop,
137}; 137};
138 138
139static struct ata_port_operations pdc_pata_ops = { 139static const struct ata_port_operations pdc_pata_ops = {
140 .port_disable = ata_port_disable, 140 .port_disable = ata_port_disable,
141 .tf_load = pdc_tf_load_mmio, 141 .tf_load = pdc_tf_load_mmio,
142 .tf_read = ata_tf_read, 142 .tf_read = ata_tf_read,
@@ -546,7 +546,7 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
546 return ata_qc_issue_prot(qc); 546 return ata_qc_issue_prot(qc);
547} 547}
548 548
549static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 549static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
550{ 550{
551 WARN_ON (tf->protocol == ATA_PROT_DMA || 551 WARN_ON (tf->protocol == ATA_PROT_DMA ||
552 tf->protocol == ATA_PROT_NODATA); 552 tf->protocol == ATA_PROT_NODATA);
@@ -554,7 +554,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
554} 554}
555 555
556 556
557static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 557static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
558{ 558{
559 WARN_ON (tf->protocol == ATA_PROT_DMA || 559 WARN_ON (tf->protocol == ATA_PROT_DMA ||
560 tf->protocol == ATA_PROT_NODATA); 560 tf->protocol == ATA_PROT_NODATA);
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index e1c1dae27c52..250dafa6bc36 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -147,7 +147,7 @@ static Scsi_Host_Template qs_ata_sht = {
147 .bios_param = ata_std_bios_param, 147 .bios_param = ata_std_bios_param,
148}; 148};
149 149
150static struct ata_port_operations qs_ata_ops = { 150static const struct ata_port_operations qs_ata_ops = {
151 .port_disable = ata_port_disable, 151 .port_disable = ata_port_disable,
152 .tf_load = ata_tf_load, 152 .tf_load = ata_tf_load,
153 .tf_read = ata_tf_read, 153 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index f6f0184e1ac8..3a056173fb95 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -150,7 +150,7 @@ static Scsi_Host_Template sil_sht = {
150 .ordered_flush = 1, 150 .ordered_flush = 1,
151}; 151};
152 152
153static struct ata_port_operations sil_ops = { 153static const struct ata_port_operations sil_ops = {
154 .port_disable = ata_port_disable, 154 .port_disable = ata_port_disable,
155 .dev_config = sil_dev_config, 155 .dev_config = sil_dev_config,
156 .tf_load = ata_tf_load, 156 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 19857814d69f..32d730bd5bb6 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -275,7 +275,7 @@ static Scsi_Host_Template sil24_sht = {
275 .ordered_flush = 1, /* NCQ not supported yet */ 275 .ordered_flush = 1, /* NCQ not supported yet */
276}; 276};
277 277
278static struct ata_port_operations sil24_ops = { 278static const struct ata_port_operations sil24_ops = {
279 .port_disable = ata_port_disable, 279 .port_disable = ata_port_disable,
280 280
281 .check_status = sil24_check_status, 281 .check_status = sil24_check_status,
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 0761a3234fcf..057f7b98b6c4 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -102,7 +102,7 @@ static Scsi_Host_Template sis_sht = {
102 .ordered_flush = 1, 102 .ordered_flush = 1,
103}; 103};
104 104
105static struct ata_port_operations sis_ops = { 105static const struct ata_port_operations sis_ops = {
106 .port_disable = ata_port_disable, 106 .port_disable = ata_port_disable,
107 .tf_load = ata_tf_load, 107 .tf_load = ata_tf_load,
108 .tf_read = ata_tf_read, 108 .tf_read = ata_tf_read,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index d89d968bedac..e0f9570bc6dd 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -102,7 +102,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
102} 102}
103 103
104 104
105static void k2_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 105static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
106{ 106{
107 struct ata_ioports *ioaddr = &ap->ioaddr; 107 struct ata_ioports *ioaddr = &ap->ioaddr;
108 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 108 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -297,7 +297,7 @@ static Scsi_Host_Template k2_sata_sht = {
297}; 297};
298 298
299 299
300static struct ata_port_operations k2_sata_ops = { 300static const struct ata_port_operations k2_sata_ops = {
301 .port_disable = ata_port_disable, 301 .port_disable = ata_port_disable,
302 .tf_load = k2_sata_tf_load, 302 .tf_load = k2_sata_tf_load,
303 .tf_read = k2_sata_tf_read, 303 .tf_read = k2_sata_tf_read,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index d6d350a0b5e9..af08f4f650c1 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -157,8 +157,8 @@ static void pdc_20621_phy_reset (struct ata_port *ap);
157static int pdc_port_start(struct ata_port *ap); 157static int pdc_port_start(struct ata_port *ap);
158static void pdc_port_stop(struct ata_port *ap); 158static void pdc_port_stop(struct ata_port *ap);
159static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 159static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
160static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); 160static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
161static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); 161static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
162static void pdc20621_host_stop(struct ata_host_set *host_set); 162static void pdc20621_host_stop(struct ata_host_set *host_set);
163static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); 163static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
164static int pdc20621_detect_dimm(struct ata_probe_ent *pe); 164static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
@@ -196,7 +196,7 @@ static Scsi_Host_Template pdc_sata_sht = {
196 .ordered_flush = 1, 196 .ordered_flush = 1,
197}; 197};
198 198
199static struct ata_port_operations pdc_20621_ops = { 199static const struct ata_port_operations pdc_20621_ops = {
200 .port_disable = ata_port_disable, 200 .port_disable = ata_port_disable,
201 .tf_load = pdc_tf_load_mmio, 201 .tf_load = pdc_tf_load_mmio,
202 .tf_read = ata_tf_read, 202 .tf_read = ata_tf_read,
@@ -899,7 +899,7 @@ out:
899 DPRINTK("EXIT\n"); 899 DPRINTK("EXIT\n");
900} 900}
901 901
902static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 902static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
903{ 903{
904 WARN_ON (tf->protocol == ATA_PROT_DMA || 904 WARN_ON (tf->protocol == ATA_PROT_DMA ||
905 tf->protocol == ATA_PROT_NODATA); 905 tf->protocol == ATA_PROT_NODATA);
@@ -907,7 +907,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
907} 907}
908 908
909 909
910static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 910static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
911{ 911{
912 WARN_ON (tf->protocol == ATA_PROT_DMA || 912 WARN_ON (tf->protocol == ATA_PROT_DMA ||
913 tf->protocol == ATA_PROT_NODATA); 913 tf->protocol == ATA_PROT_NODATA);
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 9c06f2abe7f7..d68dc7d3422c 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -90,7 +90,7 @@ static Scsi_Host_Template uli_sht = {
90 .ordered_flush = 1, 90 .ordered_flush = 1,
91}; 91};
92 92
93static struct ata_port_operations uli_ops = { 93static const struct ata_port_operations uli_ops = {
94 .port_disable = ata_port_disable, 94 .port_disable = ata_port_disable,
95 95
96 .tf_load = ata_tf_load, 96 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 565872479b9a..80e291a909a9 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -109,7 +109,7 @@ static Scsi_Host_Template svia_sht = {
109 .ordered_flush = 1, 109 .ordered_flush = 1,
110}; 110};
111 111
112static struct ata_port_operations svia_sata_ops = { 112static const struct ata_port_operations svia_sata_ops = {
113 .port_disable = ata_port_disable, 113 .port_disable = ata_port_disable,
114 114
115 .tf_load = ata_tf_load, 115 .tf_load = ata_tf_load,
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 877b9fda3965..5af05fdf8544 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -115,7 +115,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
115} 115}
116 116
117 117
118static void vsc_sata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 118static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
119{ 119{
120 struct ata_ioports *ioaddr = &ap->ioaddr; 120 struct ata_ioports *ioaddr = &ap->ioaddr;
121 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 121 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -231,7 +231,7 @@ static Scsi_Host_Template vsc_sata_sht = {
231}; 231};
232 232
233 233
234static struct ata_port_operations vsc_sata_ops = { 234static const struct ata_port_operations vsc_sata_ops = {
235 .port_disable = ata_port_disable, 235 .port_disable = ata_port_disable,
236 .tf_load = vsc_sata_tf_load, 236 .tf_load = vsc_sata_tf_load,
237 .tf_read = vsc_sata_tf_read, 237 .tf_read = vsc_sata_tf_read,
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f0ebabf6d47..a5711d545d71 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(scsi_device_types);
130 * Returns: Pointer to request block. 130 * Returns: Pointer to request block.
131 */ 131 */
132struct scsi_request *scsi_allocate_request(struct scsi_device *sdev, 132struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
133 int gfp_mask) 133 gfp_t gfp_mask)
134{ 134{
135 const int offset = ALIGN(sizeof(struct scsi_request), 4); 135 const int offset = ALIGN(sizeof(struct scsi_request), 4);
136 const int size = offset + sizeof(struct request); 136 const int size = offset + sizeof(struct request);
@@ -196,7 +196,7 @@ struct scsi_host_cmd_pool {
196 unsigned int users; 196 unsigned int users;
197 char *name; 197 char *name;
198 unsigned int slab_flags; 198 unsigned int slab_flags;
199 unsigned int gfp_mask; 199 gfp_t gfp_mask;
200}; 200};
201 201
202static struct scsi_host_cmd_pool scsi_cmd_pool = { 202static struct scsi_host_cmd_pool scsi_cmd_pool = {
@@ -213,7 +213,7 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = {
213static DECLARE_MUTEX(host_cmd_pool_mutex); 213static DECLARE_MUTEX(host_cmd_pool_mutex);
214 214
215static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, 215static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost,
216 int gfp_mask) 216 gfp_t gfp_mask)
217{ 217{
218 struct scsi_cmnd *cmd; 218 struct scsi_cmnd *cmd;
219 219
@@ -245,7 +245,7 @@ static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost,
245 * 245 *
246 * Returns: The allocated scsi command structure. 246 * Returns: The allocated scsi command structure.
247 */ 247 */
248struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask) 248struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, gfp_t gfp_mask)
249{ 249{
250 struct scsi_cmnd *cmd; 250 struct scsi_cmnd *cmd;
251 251
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 64fc9e21f35b..e69477d1889b 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -185,6 +185,7 @@ static struct {
185 {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 185 {"PIONEER", "CD-ROM DRM-600", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
186 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 186 {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
187 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 187 {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
188 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
188 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, 189 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
189 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, 190 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
190 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ 191 {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index de7f98cc38fe..6a3f6aae8a97 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -205,7 +205,8 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
205 unsigned int inlen, outlen, cmdlen; 205 unsigned int inlen, outlen, cmdlen;
206 unsigned int needed, buf_needed; 206 unsigned int needed, buf_needed;
207 int timeout, retries, result; 207 int timeout, retries, result;
208 int data_direction, gfp_mask = GFP_KERNEL; 208 int data_direction;
209 gfp_t gfp_mask = GFP_KERNEL;
209 210
210 if (!sic) 211 if (!sic)
211 return -EINVAL; 212 return -EINVAL;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index dc9c772bc874..3ff538809786 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -97,7 +97,6 @@ int scsi_insert_special_req(struct scsi_request *sreq, int at_head)
97} 97}
98 98
99static void scsi_run_queue(struct request_queue *q); 99static void scsi_run_queue(struct request_queue *q);
100static void scsi_release_buffers(struct scsi_cmnd *cmd);
101 100
102/* 101/*
103 * Function: scsi_unprep_request() 102 * Function: scsi_unprep_request()
@@ -678,7 +677,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int uptodate,
678 return NULL; 677 return NULL;
679} 678}
680 679
681static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, int gfp_mask) 680static struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
682{ 681{
683 struct scsi_host_sg_pool *sgp; 682 struct scsi_host_sg_pool *sgp;
684 struct scatterlist *sgl; 683 struct scatterlist *sgl;
@@ -1040,8 +1039,10 @@ static int scsi_init_io(struct scsi_cmnd *cmd)
1040 * if sg table allocation fails, requeue request later. 1039 * if sg table allocation fails, requeue request later.
1041 */ 1040 */
1042 sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC); 1041 sgpnt = scsi_alloc_sgtable(cmd, GFP_ATOMIC);
1043 if (unlikely(!sgpnt)) 1042 if (unlikely(!sgpnt)) {
1043 scsi_unprep_request(req);
1044 return BLKPREP_DEFER; 1044 return BLKPREP_DEFER;
1045 }
1045 1046
1046 cmd->request_buffer = (char *) sgpnt; 1047 cmd->request_buffer = (char *) sgpnt;
1047 cmd->request_bufflen = req->nr_sectors << 9; 1048 cmd->request_bufflen = req->nr_sectors << 9;
@@ -1245,8 +1246,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1245 */ 1246 */
1246 ret = scsi_init_io(cmd); 1247 ret = scsi_init_io(cmd);
1247 switch(ret) { 1248 switch(ret) {
1249 /* For BLKPREP_KILL/DEFER the cmd was released */
1248 case BLKPREP_KILL: 1250 case BLKPREP_KILL:
1249 /* BLKPREP_KILL return also releases the command */
1250 goto kill; 1251 goto kill;
1251 case BLKPREP_DEFER: 1252 case BLKPREP_DEFER:
1252 goto defer; 1253 goto defer;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 2cab556b6e82..771e97ef136e 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -819,12 +819,15 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf)
819 return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name); 819 return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name);
820} 820}
821 821
822#define get_list_head_entry(pos, head, member) \
823 pos = list_entry((head)->next, typeof(*pos), member)
824
822static ssize_t 825static ssize_t
823store_fc_private_host_tgtid_bind_type(struct class_device *cdev, 826store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
824 const char *buf, size_t count) 827 const char *buf, size_t count)
825{ 828{
826 struct Scsi_Host *shost = transport_class_to_shost(cdev); 829 struct Scsi_Host *shost = transport_class_to_shost(cdev);
827 struct fc_rport *rport, *next_rport; 830 struct fc_rport *rport;
828 enum fc_tgtid_binding_type val; 831 enum fc_tgtid_binding_type val;
829 unsigned long flags; 832 unsigned long flags;
830 833
@@ -834,9 +837,13 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
834 /* if changing bind type, purge all unused consistent bindings */ 837 /* if changing bind type, purge all unused consistent bindings */
835 if (val != fc_host_tgtid_bind_type(shost)) { 838 if (val != fc_host_tgtid_bind_type(shost)) {
836 spin_lock_irqsave(shost->host_lock, flags); 839 spin_lock_irqsave(shost->host_lock, flags);
837 list_for_each_entry_safe(rport, next_rport, 840 while (!list_empty(&fc_host_rport_bindings(shost))) {
838 &fc_host_rport_bindings(shost), peers) 841 get_list_head_entry(rport,
842 &fc_host_rport_bindings(shost), peers);
843 spin_unlock_irqrestore(shost->host_lock, flags);
839 fc_rport_terminate(rport); 844 fc_rport_terminate(rport);
845 spin_lock_irqsave(shost->host_lock, flags);
846 }
840 spin_unlock_irqrestore(shost->host_lock, flags); 847 spin_unlock_irqrestore(shost->host_lock, flags);
841 } 848 }
842 849
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ad94367df430..fd56b7ec88b6 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2644,7 +2644,7 @@ static char *
2644sg_page_malloc(int rqSz, int lowDma, int *retSzp) 2644sg_page_malloc(int rqSz, int lowDma, int *retSzp)
2645{ 2645{
2646 char *resp = NULL; 2646 char *resp = NULL;
2647 int page_mask; 2647 gfp_t page_mask;
2648 int order, a_size; 2648 int order, a_size;
2649 int resSz = rqSz; 2649 int resSz = rqSz;
2650 2650
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index d001c046551b..927d700f0073 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3577,7 +3577,8 @@ static long st_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
3577static struct st_buffer * 3577static struct st_buffer *
3578 new_tape_buffer(int from_initialization, int need_dma, int max_sg) 3578 new_tape_buffer(int from_initialization, int need_dma, int max_sg)
3579{ 3579{
3580 int i, priority, got = 0, segs = 0; 3580 int i, got = 0, segs = 0;
3581 gfp_t priority;
3581 struct st_buffer *tb; 3582 struct st_buffer *tb;
3582 3583
3583 if (from_initialization) 3584 if (from_initialization)
@@ -3610,7 +3611,8 @@ static struct st_buffer *
3610/* Try to allocate enough space in the tape buffer */ 3611/* Try to allocate enough space in the tape buffer */
3611static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma) 3612static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dma)
3612{ 3613{
3613 int segs, nbr, max_segs, b_size, priority, order, got; 3614 int segs, nbr, max_segs, b_size, order, got;
3615 gfp_t priority;
3614 3616
3615 if (new_size <= STbuffer->buffer_size) 3617 if (new_size <= STbuffer->buffer_size)
3616 return 1; 3618 return 1;