Skip to contentSkip to conversation

staging: gpib: remove unused variables

PATCH In review Gaston Gonzalez 2 participants 7 messages Feb 14, 2025 – Feb 16, 2025 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: gpib: remove unused variables

Remove some unused variables found compiling with W=1.

v1 -> v2:

Address Kees Bakker review:

- Keep the post increment expression (i++) in patch 3.
- Keep the call to nec7210_update_status_nolock() in patch 4.

Gaston Gonzalez (5):
staging: gpib: cb7210: remove unused variable
staging: gpib: eastwood: remove unused variable
staging: gpib: ni_usb: remove unused variable
staging: gpib: tnt4882: remove unused variable
staging: gpib: ines: remove unused variable

 drivers/staging/gpib/cb7210/cb7210.c        | 2 --
 drivers/staging/gpib/eastwood/fluke_gpib.c  | 2 --
 drivers/staging/gpib/ines/ines_gpib.c       | 2 --
 drivers/staging/gpib/ni_usb/ni_usb_gpib.c   | 3 +--
 drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 3 +--
 5 files changed, 2 insertions(+), 10 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH v2 1/5 staging: gpib: cb7210: remove unused variable

Remove unused variable 'nec_priv' in function 'cb7210_line_status'.

This removes the following warning found compiling with W=1:

warning: variable ‘nec_priv’ set but not used [-Wunused-but-set-variable]

---
v2: no changes in this patch.

 drivers/staging/gpib/cb7210/cb7210.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/gpib/cb7210/cb7210.c +0 -2
index 381c508f62eb..5c2b2c382df3 100644
@@ -383,10 +383,8 @@ static int cb7210_line_status(const gpib_board_t *board)
 	int status = ValidALL;
 	int bsr_bits;
 	struct cb7210_priv *cb_priv;
-	struct nec7210_priv *nec_priv;
 
 	cb_priv = board->private_data;
-	nec_priv = &cb_priv->nec7210_priv;
 
 	bsr_bits = cb7210_paged_read_byte(cb_priv, BUS_STATUS, BUS_STATUS_PAGE);
 
Signature · 1 line
2.48.1
#2 lore raw

PATCH v2 2/5 staging: gpib: eastwood: remove unused variable

In reply to Gaston Gonzalez

Remove unused variable 'nec_priv' in function 'fluke_line_status'.

This removes the following warning found compiling with W=1:

warning: variable ‘nec_priv’ set but not used [-Wunused-but-set-variable]

---
v2: no changes in this patch.

 drivers/staging/gpib/eastwood/fluke_gpib.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/gpib/eastwood/fluke_gpib.c +0 -2
index d5b1a03abf11..65bb79a8fd3c 100644
@@ -194,10 +194,8 @@ static int fluke_line_status(const gpib_board_t *board)
 	int status = ValidALL;
 	int bsr_bits;
 	struct fluke_priv *e_priv;
-	struct nec7210_priv *nec_priv;
 
 	e_priv = board->private_data;
-	nec_priv = &e_priv->nec7210_priv;
 
 	bsr_bits = fluke_paged_read_byte(e_priv, BUS_STATUS, BUS_STATUS_PAGE);
 
Signature · 1 line
2.48.1
#3 lore raw

PATCH v2 3/5 staging: gpib: ni_usb: remove unused variable

In reply to Gaston Gonzalez

Remove unused variable 'adr1_bits' in function 'parse_board_ibrd_readback'

Since the value of the variable 'i' is increased when 'adr1_bits' is set, the 'i++' post-increment was added in order to keep the value of 'i' right.

This change removes the following warning:

warning: variable ‘adr1_bits’ set but not used [-Wunused-but-set-variable]

---
v2: added post-increment 'i++'.

 drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +1 -2
index d0656dc520f5..41d9cccdaf10 100644
@@ -427,7 +427,6 @@ static int parse_board_ibrd_readback(const u8 *raw_data, struct ni_usb_status_bl
 	int i = 0;
 	int j = 0;
 	int k;
-	unsigned int adr1_bits;
 	int num_data_blocks = 0;
 	struct ni_usb_status_block register_write_status;
 	int unexpected = 0;
@@ -460,7 +459,7 @@ static int parse_board_ibrd_readback(const u8 *raw_data, struct ni_usb_status_bl
 		pr_err("%s: bug: status->id=%i, != ibrd_status_id\n", __func__, status->id);
 		return -EIO;
 	}
-	adr1_bits = raw_data[i++];
+	i++;
 	if (num_data_blocks) {
 		*actual_bytes_read = (num_data_blocks - 1) * data_block_length + raw_data[i++];
 	} else {
Signature · 1 line
2.48.1
#4 lore raw

PATCH v2 4/5 staging: gpib: tnt4882: remove unused variable

In reply to Gaston Gonzalez

Remove unused variable 'retval' in function 'tnt4882_update_status'.

A call to nec7210_update_status_nolock() is added as the status bits are written to board->status in that function.

This change removes the following warning:

warning: variable ‘retval’ set but not used [-Wunused-but-set-variable]

---
v2: add call to nec7210_update_status_nolock() function.

 drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +1 -2
index 2e1c3cbebaca..19f6d798f09c 100644
@@ -704,12 +704,11 @@ static unsigned int tnt4882_update_status(gpib_board_t *board, unsigned int clea
 {
 	unsigned long flags;
 	u8 line_status;
-	unsigned int retval;
 	struct tnt4882_priv *priv = board->private_data;
 
 	spin_lock_irqsave(&board->spinlock, flags);
 	board->status &= ~clear_mask;
-	retval = nec7210_update_status_nolock(board, &priv->nec7210_priv);
+	nec7210_update_status_nolock(board, &priv->nec7210_priv);
 	/* set / clear SRQ state since it is not cleared by interrupt */
 	line_status = tnt_readb(priv, BSR);
 	if (line_status & BCSR_SRQ_BIT)
Signature · 1 line
2.48.1
#5 lore raw

PATCH v2 5/5 staging: gpib: ines: remove unused variable

In reply to Gaston Gonzalez

Remove unused variable 'nec_priv' in function 'ines_line_status'.

This change removes the following warning:

warning: variable ‘nec_priv’ set but not used [-Wunused-but-set-variable]

---
v2: no changes in this patch.

 drivers/staging/gpib/ines/ines_gpib.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/gpib/ines/ines_gpib.c +0 -2
index 22a05a287bce..ba07dfb0697a 100644
@@ -26,10 +26,8 @@ int ines_line_status(const gpib_board_t *board)
 	int status = ValidALL;
 	int bcm_bits;
 	struct ines_priv *ines_priv;
-	struct nec7210_priv *nec_priv;
 
 	ines_priv = board->private_data;
-	nec_priv = &ines_priv->nec7210_priv;
 
 	bcm_bits = ines_inb(ines_priv, BUS_CONTROL_MONITOR);
 
Signature · 1 line
2.48.1