aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-14 07:06:01 -0400
committerJames Bottomley <James.Bottomley@suse.de>2011-03-23 12:36:29 -0400
commit5dd7ed2e811d5cd12f31fb7f0c5ad0107d494a12 (patch)
treef5a9318be8ce5460940e769b710a07cb60026940
parent05aea6e7e497ab418239ae54fe5966d52cbd8550 (diff)
[SCSI] target: Minor sparse warning fixes and annotations
This patch addresses the majority of sparse warnings and adds proper locking annotations. It also fixes the dubious one-bit signed bitfield, for which the signed one-bit types can be 0 or -1 which can cause a problem if someone ever checks if (foo->lu_gp_assoc == 1). The current code is fine because everyone just checks zero vs non-zero. But Sparse complains about it so lets change it. The warnings look like this: include/target/target_core_base.h:228:26: error: dubious one-bit signed bitfield Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Fubo Chen <fubo.chen@gmail.com> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/target/target_core_device.c1
-rw-r--r--drivers/target/target_core_fabric_lib.c1
-rw-r--r--drivers/target/target_core_pscsi.c3
-rw-r--r--drivers/target/target_core_rd.h2
-rw-r--r--drivers/target/target_core_transport.c4
-rw-r--r--include/target/target_core_base.h14
-rw-r--r--include/target/target_core_fabric_ops.h2
-rw-r--r--include/target/target_core_transport.h4
8 files changed, 18 insertions, 13 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 9e182bd245f0..3fb8e32506ed 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -589,6 +589,7 @@ static void core_export_port(
589 * Called with struct se_device->se_port_lock spinlock held. 589 * Called with struct se_device->se_port_lock spinlock held.
590 */ 590 */
591static void core_release_port(struct se_device *dev, struct se_port *port) 591static void core_release_port(struct se_device *dev, struct se_port *port)
592 __releases(&dev->se_port_lock) __acquires(&dev->se_port_lock)
592{ 593{
593 /* 594 /*
594 * Wait for any port reference for PR ALL_TG_PT=1 operation 595 * Wait for any port reference for PR ALL_TG_PT=1 operation
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index a3c695adabec..d57ad672677f 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -34,6 +34,7 @@
34#include <target/target_core_base.h> 34#include <target/target_core_base.h>
35#include <target/target_core_device.h> 35#include <target/target_core_device.h>
36#include <target/target_core_transport.h> 36#include <target/target_core_transport.h>
37#include <target/target_core_fabric_lib.h>
37#include <target/target_core_fabric_ops.h> 38#include <target/target_core_fabric_ops.h>
38#include <target/target_core_configfs.h> 39#include <target/target_core_configfs.h>
39 40
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 51fd309388fc..7ff6a35f26ac 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -441,6 +441,7 @@ static struct se_device *pscsi_create_type_disk(
441 struct pscsi_dev_virt *pdv, 441 struct pscsi_dev_virt *pdv,
442 struct se_subsystem_dev *se_dev, 442 struct se_subsystem_dev *se_dev,
443 struct se_hba *hba) 443 struct se_hba *hba)
444 __releases(sh->host_lock)
444{ 445{
445 struct se_device *dev; 446 struct se_device *dev;
446 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 447 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr;
@@ -488,6 +489,7 @@ static struct se_device *pscsi_create_type_rom(
488 struct pscsi_dev_virt *pdv, 489 struct pscsi_dev_virt *pdv,
489 struct se_subsystem_dev *se_dev, 490 struct se_subsystem_dev *se_dev,
490 struct se_hba *hba) 491 struct se_hba *hba)
492 __releases(sh->host_lock)
491{ 493{
492 struct se_device *dev; 494 struct se_device *dev;
493 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 495 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr;
@@ -522,6 +524,7 @@ static struct se_device *pscsi_create_type_other(
522 struct pscsi_dev_virt *pdv, 524 struct pscsi_dev_virt *pdv,
523 struct se_subsystem_dev *se_dev, 525 struct se_subsystem_dev *se_dev,
524 struct se_hba *hba) 526 struct se_hba *hba)
527 __releases(sh->host_lock)
525{ 528{
526 struct se_device *dev; 529 struct se_device *dev;
527 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; 530 struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr;
diff --git a/drivers/target/target_core_rd.h b/drivers/target/target_core_rd.h
index 13badfbaf9c0..3ea19e29d8ec 100644
--- a/drivers/target/target_core_rd.h
+++ b/drivers/target/target_core_rd.h
@@ -14,8 +14,6 @@
14#define RD_BLOCKSIZE 512 14#define RD_BLOCKSIZE 512
15#define RD_MAX_SECTORS 1024 15#define RD_MAX_SECTORS 1024
16 16
17extern struct kmem_cache *se_mem_cache;
18
19/* Used in target_core_init_configfs() for virtual LUN 0 access */ 17/* Used in target_core_init_configfs() for virtual LUN 0 access */
20int __init rd_module_init(void); 18int __init rd_module_init(void);
21void rd_module_exit(void); 19void rd_module_exit(void);
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ff9ace01e27a..80df4056f9f1 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -227,8 +227,6 @@ static void transport_remove_cmd_from_queue(struct se_cmd *cmd,
227static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); 227static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq);
228static void transport_stop_all_task_timers(struct se_cmd *cmd); 228static void transport_stop_all_task_timers(struct se_cmd *cmd);
229 229
230int transport_emulate_control_cdb(struct se_task *task);
231
232int init_se_global(void) 230int init_se_global(void)
233{ 231{
234 struct se_global *global; 232 struct se_global *global;
@@ -4395,7 +4393,7 @@ out:
4395 return -1; 4393 return -1;
4396} 4394}
4397 4395
4398extern u32 transport_calc_sg_num( 4396u32 transport_calc_sg_num(
4399 struct se_task *task, 4397 struct se_task *task,
4400 struct se_mem *in_se_mem, 4398 struct se_mem *in_se_mem,
4401 u32 task_offset) 4399 u32 task_offset)
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 0828b6c8610a..bc93b7819eba 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -239,7 +239,7 @@ struct t10_alua_lu_gp {
239} ____cacheline_aligned; 239} ____cacheline_aligned;
240 240
241struct t10_alua_lu_gp_member { 241struct t10_alua_lu_gp_member {
242 int lu_gp_assoc:1; 242 bool lu_gp_assoc;
243 atomic_t lu_gp_mem_ref_cnt; 243 atomic_t lu_gp_mem_ref_cnt;
244 spinlock_t lu_gp_mem_lock; 244 spinlock_t lu_gp_mem_lock;
245 struct t10_alua_lu_gp *lu_gp; 245 struct t10_alua_lu_gp *lu_gp;
@@ -271,7 +271,7 @@ struct t10_alua_tg_pt_gp {
271} ____cacheline_aligned; 271} ____cacheline_aligned;
272 272
273struct t10_alua_tg_pt_gp_member { 273struct t10_alua_tg_pt_gp_member {
274 int tg_pt_gp_assoc:1; 274 bool tg_pt_gp_assoc;
275 atomic_t tg_pt_gp_mem_ref_cnt; 275 atomic_t tg_pt_gp_mem_ref_cnt;
276 spinlock_t tg_pt_gp_mem_lock; 276 spinlock_t tg_pt_gp_mem_lock;
277 struct t10_alua_tg_pt_gp *tg_pt_gp; 277 struct t10_alua_tg_pt_gp *tg_pt_gp;
@@ -336,7 +336,7 @@ struct t10_pr_registration {
336 int pr_res_type; 336 int pr_res_type;
337 int pr_res_scope; 337 int pr_res_scope;
338 /* Used for fabric initiator WWPNs using a ISID */ 338 /* Used for fabric initiator WWPNs using a ISID */
339 int isid_present_at_reg:1; 339 bool isid_present_at_reg;
340 u32 pr_res_mapped_lun; 340 u32 pr_res_mapped_lun;
341 u32 pr_aptpl_target_lun; 341 u32 pr_aptpl_target_lun;
342 u32 pr_res_generation; 342 u32 pr_res_generation;
@@ -418,7 +418,7 @@ struct se_transport_task {
418 unsigned long long t_task_lba; 418 unsigned long long t_task_lba;
419 int t_tasks_failed; 419 int t_tasks_failed;
420 int t_tasks_fua; 420 int t_tasks_fua;
421 int t_tasks_bidi:1; 421 bool t_tasks_bidi;
422 u32 t_task_cdbs; 422 u32 t_task_cdbs;
423 u32 t_tasks_check; 423 u32 t_tasks_check;
424 u32 t_tasks_no; 424 u32 t_tasks_no;
@@ -470,7 +470,7 @@ struct se_task {
470 u8 task_flags; 470 u8 task_flags;
471 int task_error_status; 471 int task_error_status;
472 int task_state_flags; 472 int task_state_flags;
473 int task_padded_sg:1; 473 bool task_padded_sg;
474 unsigned long long task_lba; 474 unsigned long long task_lba;
475 u32 task_no; 475 u32 task_no;
476 u32 task_sectors; 476 u32 task_sectors;
@@ -583,7 +583,7 @@ struct se_ua {
583struct se_node_acl { 583struct se_node_acl {
584 char initiatorname[TRANSPORT_IQN_LEN]; 584 char initiatorname[TRANSPORT_IQN_LEN];
585 /* Used to signal demo mode created ACL, disabled by default */ 585 /* Used to signal demo mode created ACL, disabled by default */
586 int dynamic_node_acl:1; 586 bool dynamic_node_acl;
587 u32 queue_depth; 587 u32 queue_depth;
588 u32 acl_index; 588 u32 acl_index;
589 u64 num_cmds; 589 u64 num_cmds;
@@ -632,7 +632,7 @@ struct se_lun_acl {
632} ____cacheline_aligned; 632} ____cacheline_aligned;
633 633
634struct se_dev_entry { 634struct se_dev_entry {
635 int def_pr_registered:1; 635 bool def_pr_registered;
636 /* See transport_lunflags_table */ 636 /* See transport_lunflags_table */
637 u32 lun_flags; 637 u32 lun_flags;
638 u32 deve_cmds; 638 u32 deve_cmds;
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
index f3ac12b019c2..5eb8b1ae59d1 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -8,7 +8,7 @@ struct target_core_fabric_ops {
8 * for scatterlist chaining using transport_do_task_sg_link(), 8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default 9 * disabled by default
10 */ 10 */
11 int task_sg_chaining:1; 11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 12 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 13 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 14 char *(*tpg_get_wwn)(struct se_portal_group *);
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index 2e8ec51f0615..59aa464f6ee2 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -109,6 +109,8 @@
109struct se_mem; 109struct se_mem;
110struct se_subsystem_api; 110struct se_subsystem_api;
111 111
112extern struct kmem_cache *se_mem_cache;
113
112extern int init_se_global(void); 114extern int init_se_global(void);
113extern void release_se_global(void); 115extern void release_se_global(void);
114extern void init_scsi_index_table(void); 116extern void init_scsi_index_table(void);
@@ -190,6 +192,8 @@ extern void transport_generic_process_write(struct se_cmd *);
190extern int transport_generic_do_tmr(struct se_cmd *); 192extern int transport_generic_do_tmr(struct se_cmd *);
191/* From target_core_alua.c */ 193/* From target_core_alua.c */
192extern int core_alua_check_nonop_delay(struct se_cmd *); 194extern int core_alua_check_nonop_delay(struct se_cmd *);
195/* From target_core_cdb.c */
196extern int transport_emulate_control_cdb(struct se_task *);
193 197
194/* 198/*
195 * Each se_transport_task_t can have N number of possible struct se_task's 199 * Each se_transport_task_t can have N number of possible struct se_task's