Skip to contentSkip to conversation

staging: comedi: Remove unused variable ‘min_full_scale’

PATCH Superseded Bixuan Cui 2 participants 3 messages May 13, 2021 – May 14, 2021 Comedi drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 staging: comedi: Remove unused variable ‘min_full_scale’

Fix the following build warnings:
drivers/comedi/drivers/jr3_pci.c:507:22:
warning: variable ‘min_full_scale’ set but not used

And fix build warnings after removing ‘min_full_scale’:
drivers/comedi/drivers/jr3_pci.c:189:26:
warning: ‘get_min_full_scales’ defined but not used
static struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)

                          ^~~~~~~~~~~~~~~~~~~
---
 drivers/comedi/drivers/jr3_pci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/comedi/drivers/jr3_pci.c +1 -3
index 7a02c4fa3cda..122b95dc2bf9 100644
@@ -186,7 +186,7 @@ static void set_full_scales(struct jr3_sensor __iomem *sensor,
 	set_s16(&sensor->command_word0, 0x0a00);
 }
 
-static struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)
+static __maybe_unused struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)
 {
 	struct six_axis_t result;
 
@@ -504,10 +504,8 @@ jr3_pci_poll_subdevice(struct comedi_subdevice *s)
 			result = poll_delay_min_max(20, 100);
 		} else {
 			/* Set full scale */
-			struct six_axis_t min_full_scale;
 			struct six_axis_t max_full_scale;
 
-			min_full_scale = get_min_full_scales(sensor);
 			max_full_scale = get_max_full_scales(sensor);
 			set_full_scales(sensor, max_full_scale);
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 20 lines · Bixuan Cui

Fix the following build warnings:
drivers/comedi/drivers/jr3_pci.c:507:22:
warning: variable ‘min_full_scale’ set but not used

And fix build warnings after removing ‘min_full_scale’:
drivers/comedi/drivers/jr3_pci.c:189:26:
warning: ‘get_min_full_scales’ defined but not used
static struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)

                          ^~~~~~~~~~~~~~~~~~~
---
 drivers/comedi/drivers/jr3_pci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/comedi/drivers/jr3_pci.c +0 -0
index 7a02c4fa3cda..122b95dc2bf9 100644

drivers/comedi/drivers/jr3_pci.c static void set_full_scales(struct jr3_sensor __iomem *sensor, · line 189

Quoted 5 lines
drivers/comedi/drivers/jr3_pci.c +1 -1
@@ -186,7 +186,7 @@ static void set_full_scales(struct jr3_sensor __iomem *sensor,
 	set_s16(&sensor->command_word0, 0x0a00);
 }
 
-static struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)
+static __maybe_unused struct six_axis_t get_min_full_scales(struct jr3_sensor __iomem *sensor)

If it really is not used, then remove it, don't paper over a compiler warning for no good reason please.

Fix this properly.

drivers/comedi/drivers/jr3_pci.c jr3_pci_poll_subdevice(struct comedi_subdevice *s) · line 509

Quoted 12 lines
drivers/comedi/drivers/jr3_pci.c +0 -2
 {
 	struct six_axis_t result;
 
@@ -504,10 +504,8 @@ jr3_pci_poll_subdevice(struct comedi_subdevice *s)
 			result = poll_delay_min_max(20, 100);
 		} else {
 			/* Set full scale */
-			struct six_axis_t min_full_scale;
 			struct six_axis_t max_full_scale;
 
-			min_full_scale = get_min_full_scales(sensor);
 			max_full_scale = get_max_full_scales(sensor);

Did you just break the driver by messing with the order of reading from the device?

thanks,

greg k-h

author
#2 lore raw
Quoted 4 lines · Greg KH

If it really is not used, then remove it, don't paper over a compiler warning for no good reason please.

Fix this properly.

I will send a new patches.

Thanks
Bixuan Cui