Skip to contentSkip to conversation

target: make one-bit bitfields unsigned

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 15, 2012 – Jan 17, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target: make one-bit bitfields unsigned

Signed bitfields are a problem because instead of being 1 or 0 like you'd expect they are 0 and -1. It doesn't cause a problem in this case but sparse complains:

drivers/target/iscsi/iscsi_target_core.h:564:56: error: dubious one-bit signed bitfield

drivers/target/iscsi/iscsi_target_core.h +2 -2
index f1a02da..ebf81fd 100644
@@ -561,8 +561,8 @@ struct iscsi_conn {
 	struct hash_desc	conn_tx_hash;
 	/* Used for scheduling TX and RX connection kthreads */
 	cpumask_var_t		conn_cpumask;
-	int			conn_rx_reset_cpumask:1;
-	int			conn_tx_reset_cpumask:1;
+	unsigned int		conn_rx_reset_cpumask:1;
+	unsigned int		conn_tx_reset_cpumask:1;
 	/* list_head of struct iscsi_cmd for this connection */
 	struct list_head	conn_cmd_list;
 	struct list_head	immed_queue_list;
#1 lore raw
Quoted 15 lines · Dan Carpenter

Signed bitfields are a problem because instead of being 1 or 0 like you'd expect they are 0 and -1. It doesn't cause a problem in this case but sparse complains:

drivers/target/iscsi/iscsi_target_core.h:564:56: error: dubious one-bit signed bitfield

drivers/target/iscsi/iscsi_target_core.h +0 -0
index f1a02da..ebf81fd 100644
@@ -561,8 +561,8 @@ struct iscsi_conn {
 	struct hash_desc	conn_tx_hash;

drivers/target/iscsi/iscsi_target_core.h struct iscsi_conn {

Quoted 10 lines
drivers/target/iscsi/iscsi_target_core.h +2 -3
 	/* Used for scheduling TX and RX connection kthreads */
 	cpumask_var_t		conn_cpumask;
-	int			conn_rx_reset_cpumask:1;
-	int			conn_tx_reset_cpumask:1;
+	unsigned int		conn_rx_reset_cpumask:1;
+	unsigned int		conn_tx_reset_cpumask:1;
 	/* list_head of struct iscsi_cmd for this connection */
 	struct list_head	conn_cmd_list;
 	struct list_head	immed_queue_list;
--

Applied to lio-core. Thanks Dan!