Skip to contentSkip to conversation

staging: gpib: remove unused variables

PATCH Superseded Gaston Gonzalez 2 participants 10 messages Feb 7, 2025 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: gpib: remove unused variables

Remove some unused variables found compiling with make W=1.

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   | 2 --
 drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 2 --
 5 files changed, 10 deletions(-)
Signature · 1 line
2.47.2
#1 lore raw

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

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

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

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

---
 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.47.2
#2 lore raw

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

In reply to Gaston Gonzalez

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

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

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

---
 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.47.2
#3 lore raw

PATCH 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'

This change removes the following warning:

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

---
 drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -2
index d0656dc520f5..b7f221def217 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,6 @@ 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++];
 	if (num_data_blocks) {
 		*actual_bytes_read = (num_data_blocks - 1) * data_block_length + raw_data[i++];
 	} else {
Signature · 1 line
2.47.2
#4 lore raw

Re: [PATCH 3/5] staging: gpib: ni_usb: remove unused variable

Op 07-02-2025 om 16:04 schreef Gaston Gonzalez:

Quoted 24 lines

Remove unused variable 'adr1_bits' in function 'parse_board_ibrd_readback'

This change removes the following warning:

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

---
  drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 --
  1 file changed, 2 deletions(-)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -1
index d0656dc520f5..b7f221def217 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;

drivers/staging/gpib/ni_usb/ni_usb_gpib.c static int parse_board_ibrd_readback(const u8 *raw_data, struct ni_usb_status_bl · line 463

Quoted 4 lines
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -1
@@ -460,7 +459,6 @@ 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++];

Careful. You're removing the i++ as well.

Quoted 3 lines
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -0
  	if (num_data_blocks) {
  		*actual_bytes_read = (num_data_blocks - 1) * data_block_length + raw_data[i++];
  	} else {
#5 lore raw

Re: [PATCH 3/5] staging: gpib: ni_usb: remove unused variable

Hi Kees,

Thank you for the review.

Quoted 22 lines · Kees Bakker

Op 07-02-2025 om 16:04 schreef Gaston Gonzalez:

Quoted 21 lines

Remove unused variable 'adr1_bits' in function 'parse_board_ibrd_readback'

This change removes the following warning:

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

---
  drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 --
  1 file changed, 2 deletions(-)
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -1
index d0656dc520f5..b7f221def217 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;
Quoted 8 lines

drivers/staging/gpib/ni_usb/ni_usb_gpib.c static int parse_board_ibrd_readback(const u8 *raw_data, struct ni_usb_status_bl · line 463

Quoted 7 lines
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -1
  	struct ni_usb_status_block register_write_status;
  	int unexpected = 0;
@@ -460,7 +459,6 @@ 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++];

Careful. You're removing the i++ as well.

Ok, you are right. I missed that.. I'll redo the patch.

Quoted 4 lines

drivers/staging/gpib/ni_usb/ni_usb_gpib.c static int parse_board_ibrd_readback(const u8 *raw_data, struct ni_usb_status_bl · line 464

Quoted 3 lines
drivers/staging/gpib/ni_usb/ni_usb_gpib.c +0 -0
  	if (num_data_blocks) {
  		*actual_bytes_read = (num_data_blocks - 1) * data_block_length + raw_data[i++];
  	} else {

regards,

Gaston

#6 lore raw

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

In reply to Gaston Gonzalez

Remove unused variable 'retval' in function 'tnt4882_update_status'

This change removes the following warning:

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

---
 drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -2
index 2e1c3cbebaca..a681bf559b46 100644
@@ -704,12 +704,10 @@ 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);
 	/* 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.47.2
#7 lore raw

Re: [PATCH 4/5] staging: gpib: tnt4882: remove unused variable

Op 07-02-2025 om 16:04 schreef Gaston Gonzalez:

Quoted 16 lines

Remove unused variable 'retval' in function 'tnt4882_update_status'

This change removes the following warning:

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

---
  drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 2 --
  1 file changed, 2 deletions(-)
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -0
index 2e1c3cbebaca..a681bf559b46 100644

drivers/staging/gpib/tnt4882/tnt4882_gpib.c static unsigned int tnt4882_update_status(gpib_board_t *board, unsigned int clea · line 712

Quoted 9 lines
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -2
@@ -704,12 +704,10 @@ 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);

You cannot remove a function call just like that. At least, not without describing that it is OK to do so.

Quoted 3 lines
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -0
  	/* set / clear SRQ state since it is not cleared by interrupt */
  	line_status = tnt_readb(priv, BSR);
  	if (line_status & BCSR_SRQ_BIT)
#8 lore raw

Re: [PATCH 4/5] staging: gpib: tnt4882: remove unused variable

Quoted 12 lines · Kees Bakker

Op 07-02-2025 om 16:04 schreef Gaston Gonzalez:

Quoted 11 lines

Remove unused variable 'retval' in function 'tnt4882_update_status'

This change removes the following warning:

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

---
  drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 2 --
  1 file changed, 2 deletions(-)
Quoted 20 lines

drivers/staging/gpib/tnt4882/tnt4882_gpib.c static unsigned int tnt4882_update_status(gpib_board_t *board, unsigned int clea · line 711

Quoted 13 lines
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -2
index 2e1c3cbebaca..a681bf559b46 100644
@@ -704,12 +704,10 @@ 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);

You cannot remove a function call just like that. At least, not without describing that
it is OK to do so.

Quoted 3 lines
drivers/staging/gpib/tnt4882/tnt4882_gpib.c +0 -0
  	/* set / clear SRQ state since it is not cleared by interrupt */
  	line_status = tnt_readb(priv, BSR);
  	if (line_status & BCSR_SRQ_BIT)

You are obviously right on this one too. I'll look into this one more carefully and I'll send a v2.

Regards,

Gaston

#9 lore raw

PATCH 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]

---
 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.47.2