diff options
author | Maggie <xmzhang@brocade.com> | 2010-11-29 21:21:32 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:24:16 -0500 |
commit | 52f94b6fd0d1ff9d935c52f8a6360834ed871d92 (patch) | |
tree | 09a71f556a01fa71f37aacdc1da37bf60131f0d6 /drivers/scsi | |
parent | 3db86353abba4549f665fbdde8572d619566afbb (diff) |
[SCSI] bfa: fix regular sparse check warnings.
Fix all sparse check warnings from make C=2.
Signed-off-by: Maggie <xmzhang@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_lport.c | 6 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_rport.c | 8 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_cb.c | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_ct.c | 2 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 4 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_attr.c | 8 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_debugfs.c | 42 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_drv.h | 6 |
9 files changed, 52 insertions, 28 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 8d651309302b..30665c744462 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -2103,7 +2103,7 @@ bfa_fcs_lport_fdmi_timeout(void *arg) | |||
2103 | bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT); | 2103 | bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT); |
2104 | } | 2104 | } |
2105 | 2105 | ||
2106 | void | 2106 | static void |
2107 | bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | 2107 | bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, |
2108 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr) | 2108 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr) |
2109 | { | 2109 | { |
@@ -2147,7 +2147,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2147 | hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); | 2147 | hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | void | 2150 | static void |
2151 | bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | 2151 | bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, |
2152 | struct bfa_fcs_fdmi_port_attr_s *port_attr) | 2152 | struct bfa_fcs_fdmi_port_attr_s *port_attr) |
2153 | { | 2153 | { |
@@ -4150,7 +4150,7 @@ bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port) | |||
4150 | bfa_sm_send_event(ns, NSSM_EVENT_NS_QUERY); | 4150 | bfa_sm_send_event(ns, NSSM_EVENT_NS_QUERY); |
4151 | } | 4151 | } |
4152 | 4152 | ||
4153 | void | 4153 | static void |
4154 | bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) | 4154 | bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) |
4155 | { | 4155 | { |
4156 | 4156 | ||
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index cf4a6e73e60d..60f2ddf23ebc 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -2359,14 +2359,6 @@ bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport) | |||
2359 | bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); | 2359 | bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); |
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | /* | ||
2363 | * Called by fcptm to notify that the ITN cleanup is done. | ||
2364 | */ | ||
2365 | void | ||
2366 | bfa_fcs_rport_tin_ack(struct bfa_fcs_rport_s *rport) | ||
2367 | { | ||
2368 | bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); | ||
2369 | } | ||
2370 | 2362 | ||
2371 | /* | 2363 | /* |
2372 | * brief | 2364 | * brief |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 9c407a87a1a1..eb1b005e5bc7 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -421,7 +421,7 @@ bfa_cb_image_get_chunk(int type, u32 off) | |||
421 | return bfi_image_ct_cna_get_chunk(off); break; | 421 | return bfi_image_ct_cna_get_chunk(off); break; |
422 | case BFI_IMAGE_CB_FC: | 422 | case BFI_IMAGE_CB_FC: |
423 | return bfi_image_cb_fc_get_chunk(off); break; | 423 | return bfi_image_cb_fc_get_chunk(off); break; |
424 | default: return 0; | 424 | default: return NULL; |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index 909945043850..61f03cbe5431 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c | |||
@@ -32,7 +32,7 @@ static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | |||
32 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); | 32 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); |
33 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); | 33 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); |
34 | 34 | ||
35 | struct bfa_ioc_hwif_s hwif_cb; | 35 | static struct bfa_ioc_hwif_s hwif_cb; |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * Called from bfa_ioc_attach() to map asic specific calls. | 38 | * Called from bfa_ioc_attach() to map asic specific calls. |
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 115730c0aa77..79fb31203636 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -32,7 +32,7 @@ static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | |||
32 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); | 32 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); |
33 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); | 33 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); |
34 | 34 | ||
35 | struct bfa_ioc_hwif_s hwif_ct; | 35 | static struct bfa_ioc_hwif_s hwif_ct; |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * Called from bfa_ioc_attach() to map asic specific calls. | 38 | * Called from bfa_ioc_attach() to map asic specific calls. |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 6797720213b2..4239fdf0d2d1 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -61,12 +61,12 @@ int msix_disable_cb = 0, msix_disable_ct = 0; | |||
61 | u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; | 61 | u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; |
62 | u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; | 62 | u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; |
63 | 63 | ||
64 | const char *msix_name_ct[] = { | 64 | static const char *msix_name_ct[] = { |
65 | "cpe0", "cpe1", "cpe2", "cpe3", | 65 | "cpe0", "cpe1", "cpe2", "cpe3", |
66 | "rme0", "rme1", "rme2", "rme3", | 66 | "rme0", "rme1", "rme2", "rme3", |
67 | "ctrl" }; | 67 | "ctrl" }; |
68 | 68 | ||
69 | const char *msix_name_cb[] = { | 69 | static const char *msix_name_cb[] = { |
70 | "cpe0", "cpe1", "cpe2", "cpe3", | 70 | "cpe0", "cpe1", "cpe2", "cpe3", |
71 | "rme0", "rme1", "rme2", "rme3", | 71 | "rme0", "rme1", "rme2", "rme3", |
72 | "eemc", "elpu0", "elpu1", "epss", "mlpu" }; | 72 | "eemc", "elpu0", "elpu1", "epss", "mlpu" }; |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index ed9fff440b5c..d727f055bd8a 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* | 25 | /* |
26 | * FC transport template entry, get SCSI target port ID. | 26 | * FC transport template entry, get SCSI target port ID. |
27 | */ | 27 | */ |
28 | void | 28 | static void |
29 | bfad_im_get_starget_port_id(struct scsi_target *starget) | 29 | bfad_im_get_starget_port_id(struct scsi_target *starget) |
30 | { | 30 | { |
31 | struct Scsi_Host *shost; | 31 | struct Scsi_Host *shost; |
@@ -51,7 +51,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget) | |||
51 | /* | 51 | /* |
52 | * FC transport template entry, get SCSI target nwwn. | 52 | * FC transport template entry, get SCSI target nwwn. |
53 | */ | 53 | */ |
54 | void | 54 | static void |
55 | bfad_im_get_starget_node_name(struct scsi_target *starget) | 55 | bfad_im_get_starget_node_name(struct scsi_target *starget) |
56 | { | 56 | { |
57 | struct Scsi_Host *shost; | 57 | struct Scsi_Host *shost; |
@@ -77,7 +77,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget) | |||
77 | /* | 77 | /* |
78 | * FC transport template entry, get SCSI target pwwn. | 78 | * FC transport template entry, get SCSI target pwwn. |
79 | */ | 79 | */ |
80 | void | 80 | static void |
81 | bfad_im_get_starget_port_name(struct scsi_target *starget) | 81 | bfad_im_get_starget_port_name(struct scsi_target *starget) |
82 | { | 82 | { |
83 | struct Scsi_Host *shost; | 83 | struct Scsi_Host *shost; |
@@ -103,7 +103,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget) | |||
103 | /* | 103 | /* |
104 | * FC transport template entry, get SCSI host port ID. | 104 | * FC transport template entry, get SCSI host port ID. |
105 | */ | 105 | */ |
106 | void | 106 | static void |
107 | bfad_im_get_host_port_id(struct Scsi_Host *shost) | 107 | bfad_im_get_host_port_id(struct Scsi_Host *shost) |
108 | { | 108 | { |
109 | struct bfad_im_port_s *im_port = | 109 | struct bfad_im_port_s *im_port = |
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 1fedeeb4ac1f..0fbd620474c7 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c | |||
@@ -208,7 +208,7 @@ bfad_debugfs_read(struct file *file, char __user *buf, | |||
208 | if (!debug || !debug->debug_buffer) | 208 | if (!debug || !debug->debug_buffer) |
209 | return 0; | 209 | return 0; |
210 | 210 | ||
211 | return memory_read_from_buffer(buf, nbytes, pos, | 211 | return simple_read_from_buffer(buf, nbytes, pos, |
212 | debug->debug_buffer, debug->buffer_len); | 212 | debug->debug_buffer, debug->buffer_len); |
213 | } | 213 | } |
214 | 214 | ||
@@ -254,7 +254,7 @@ bfad_debugfs_read_regrd(struct file *file, char __user *buf, | |||
254 | if (!bfad->regdata) | 254 | if (!bfad->regdata) |
255 | return 0; | 255 | return 0; |
256 | 256 | ||
257 | rc = memory_read_from_buffer(buf, nbytes, pos, | 257 | rc = simple_read_from_buffer(buf, nbytes, pos, |
258 | bfad->regdata, bfad->reglen); | 258 | bfad->regdata, bfad->reglen); |
259 | 259 | ||
260 | if ((*pos + nbytes) >= bfad->reglen) { | 260 | if ((*pos + nbytes) >= bfad->reglen) { |
@@ -279,15 +279,31 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf, | |||
279 | u32 *regbuf; | 279 | u32 *regbuf; |
280 | void __iomem *rb, *reg_addr; | 280 | void __iomem *rb, *reg_addr; |
281 | unsigned long flags; | 281 | unsigned long flags; |
282 | void *kern_buf; | ||
282 | 283 | ||
283 | rc = sscanf(buf, "%x:%x", &addr, &len); | 284 | kern_buf = kzalloc(nbytes, GFP_KERNEL); |
285 | |||
286 | if (!kern_buf) { | ||
287 | printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n", | ||
288 | bfad->inst_no); | ||
289 | return -ENOMEM; | ||
290 | } | ||
291 | |||
292 | if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { | ||
293 | kfree(kern_buf); | ||
294 | return -ENOMEM; | ||
295 | } | ||
296 | |||
297 | rc = sscanf(kern_buf, "%x:%x", &addr, &len); | ||
284 | if (rc < 2) { | 298 | if (rc < 2) { |
285 | printk(KERN_INFO | 299 | printk(KERN_INFO |
286 | "bfad[%d]: %s failed to read user buf\n", | 300 | "bfad[%d]: %s failed to read user buf\n", |
287 | bfad->inst_no, __func__); | 301 | bfad->inst_no, __func__); |
302 | kfree(kern_buf); | ||
288 | return -EINVAL; | 303 | return -EINVAL; |
289 | } | 304 | } |
290 | 305 | ||
306 | kfree(kern_buf); | ||
291 | kfree(bfad->regdata); | 307 | kfree(bfad->regdata); |
292 | bfad->regdata = NULL; | 308 | bfad->regdata = NULL; |
293 | bfad->reglen = 0; | 309 | bfad->reglen = 0; |
@@ -339,14 +355,30 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf, | |||
339 | int addr, val, rc; | 355 | int addr, val, rc; |
340 | void __iomem *reg_addr; | 356 | void __iomem *reg_addr; |
341 | unsigned long flags; | 357 | unsigned long flags; |
358 | void *kern_buf; | ||
359 | |||
360 | kern_buf = kzalloc(nbytes, GFP_KERNEL); | ||
361 | |||
362 | if (!kern_buf) { | ||
363 | printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n", | ||
364 | bfad->inst_no); | ||
365 | return -ENOMEM; | ||
366 | } | ||
367 | |||
368 | if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { | ||
369 | kfree(kern_buf); | ||
370 | return -ENOMEM; | ||
371 | } | ||
342 | 372 | ||
343 | rc = sscanf(buf, "%x:%x", &addr, &val); | 373 | rc = sscanf(kern_buf, "%x:%x", &addr, &val); |
344 | if (rc < 2) { | 374 | if (rc < 2) { |
345 | printk(KERN_INFO | 375 | printk(KERN_INFO |
346 | "bfad[%d]: %s failed to read user buf\n", | 376 | "bfad[%d]: %s failed to read user buf\n", |
347 | bfad->inst_no, __func__); | 377 | bfad->inst_no, __func__); |
378 | kfree(kern_buf); | ||
348 | return -EINVAL; | 379 | return -EINVAL; |
349 | } | 380 | } |
381 | kfree(kern_buf); | ||
350 | 382 | ||
351 | addr &= BFA_REG_ADDRMSK(bfa); /* offset only 17 bit and word align */ | 383 | addr &= BFA_REG_ADDRMSK(bfa); /* offset only 17 bit and word align */ |
352 | 384 | ||
@@ -359,7 +391,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf, | |||
359 | return -EINVAL; | 391 | return -EINVAL; |
360 | } | 392 | } |
361 | 393 | ||
362 | reg_addr = (u32 *) ((u8 *) bfa_ioc_bar0(ioc) + addr); | 394 | reg_addr = (bfa_ioc_bar0(ioc)) + addr; |
363 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 395 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
364 | writel(val, reg_addr); | 396 | writel(val, reg_addr); |
365 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 397 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index d5ce2349ac59..b9bcb0b99b8a 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -263,10 +263,10 @@ struct bfad_hal_comp { | |||
263 | */ | 263 | */ |
264 | #define nextLowerInt(x) \ | 264 | #define nextLowerInt(x) \ |
265 | do { \ | 265 | do { \ |
266 | int i; \ | 266 | int __i; \ |
267 | (*x)--; \ | 267 | (*x)--; \ |
268 | for (i = 1; i < (sizeof(int)*8); i <<= 1) \ | 268 | for (__i = 1; __i < (sizeof(int)*8); __i <<= 1) \ |
269 | (*x) = (*x) | (*x) >> i; \ | 269 | (*x) = (*x) | (*x) >> __i; \ |
270 | (*x)++; \ | 270 | (*x)++; \ |
271 | (*x) = (*x) >> 1; \ | 271 | (*x) = (*x) >> 1; \ |
272 | } while (0) | 272 | } while (0) |