All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH -next] staging: comedi: Remove unused variable ‘min_full_scale’
  2021-05-13 13:34 [PATCH -next] staging: comedi: Remove unused variable ‘min_full_scale’ Bixuan Cui
@ 2021-05-13 12:34 ` Greg KH
  2021-05-14  3:08   ` Bixuan Cui
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-05-13 12:34 UTC (permalink / raw)
  To: Bixuan Cui; +Cc: linux-kernel, abbotti, hsweeten, grandmaster, john.wanghui

On Thu, May 13, 2021 at 09:34:58PM +0800, Bixuan Cui wrote:
> 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)
>                           ^~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
> ---
>  drivers/comedi/drivers/jr3_pci.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/comedi/drivers/jr3_pci.c b/drivers/comedi/drivers/jr3_pci.c
> index 7a02c4fa3cda..122b95dc2bf9 100644
> --- a/drivers/comedi/drivers/jr3_pci.c
> +++ b/drivers/comedi/drivers/jr3_pci.c
> @@ -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.

>  {
>  	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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH -next] staging: comedi: Remove unused variable ‘min_full_scale’
@ 2021-05-13 13:34 Bixuan Cui
  2021-05-13 12:34 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Bixuan Cui @ 2021-05-13 13:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: abbotti, hsweeten, gregkh, grandmaster, john.wanghui

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)
                          ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
 drivers/comedi/drivers/jr3_pci.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/comedi/drivers/jr3_pci.c b/drivers/comedi/drivers/jr3_pci.c
index 7a02c4fa3cda..122b95dc2bf9 100644
--- a/drivers/comedi/drivers/jr3_pci.c
+++ b/drivers/comedi/drivers/jr3_pci.c
@@ -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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] staging: comedi: Remove unused variable ‘min_full_scale’
  2021-05-13 12:34 ` Greg KH
@ 2021-05-14  3:08   ` Bixuan Cui
  0 siblings, 0 replies; 3+ messages in thread
From: Bixuan Cui @ 2021-05-14  3:08 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, abbotti, hsweeten, grandmaster, john.wanghui



On 2021/5/13 20:34, Greg KH wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-14  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 13:34 [PATCH -next] staging: comedi: Remove unused variable ‘min_full_scale’ Bixuan Cui
2021-05-13 12:34 ` Greg KH
2021-05-14  3:08   ` Bixuan Cui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.