Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234445 > unrolled thread

[PATCH] staging: comedi: ni_tiocmd: remove unused code

Started byLuis de Bethencourt <luisbg@osg.samsung.com>
First post2015-09-28 23:00 +0200
Last post2015-09-29 03:50 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: comedi: ni_tiocmd: remove unused code Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-28 23:00 +0200
    [PATCH] staging: comedi: cb_pcidas64: remove unused code Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-28 23:20 +0200
      Re: [PATCH] staging: comedi: cb_pcidas64: remove unused code Greg KH <gregkh@linuxfoundation.org> - 2015-09-29 03:50 +0200
        Re: [PATCH] staging: comedi: cb_pcidas64: remove unused code Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-29 12:00 +0200
    [PATCH] staging: rtl8712: remove dead code Luis de Bethencourt <luisbg@osg.samsung.com> - 2015-09-29 00:00 +0200
      Re: [PATCH] staging: rtl8712: remove dead code Joshua Clayton <stillcompiling@gmail.com> - 2015-09-30 07:40 +0200
    Re: [PATCH] staging: comedi: ni_tiocmd: remove unused code Greg KH <gregkh@linuxfoundation.org> - 2015-09-29 03:50 +0200

#1234445 — [PATCH] staging: comedi: ni_tiocmd: remove unused code

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2015-09-28 23:00 +0200
Subject[PATCH] staging: comedi: ni_tiocmd: remove unused code
Message-ID<qdNGG-2fW-9@gated-at.bofh.it>
Remove the unused code, which isn't implemented yet, using #if 0.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---

Hi,

The code after the return is dead code. My understanding is that it is
there for when the output commands are implemented in the future.
Meanwhile it would be clearer if the code is removed with #if 0.

Thanks,
Luis

 drivers/staging/comedi/drivers/ni_tiocmd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 9b124b0..728c7f4 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -158,11 +158,13 @@ static int ni_tio_output_cmd(struct comedi_subdevice *s)
 		"output commands not yet implemented.\n");
 	return -ENOTSUPP;
 
+#if 0 /* unused */
 	counter->mite_chan->dir = COMEDI_OUTPUT;
 	mite_prep_dma(counter->mite_chan, 32, 32);
 	ni_tio_configure_dma(counter, true, false);
 	mite_dma_arm(counter->mite_chan);
 	return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+#endif
 }
 
 static int ni_tio_cmd_setup(struct comedi_subdevice *s)
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1234481 — [PATCH] staging: comedi: cb_pcidas64: remove unused code

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2015-09-28 23:20 +0200
Subject[PATCH] staging: comedi: cb_pcidas64: remove unused code
Message-ID<qdO04-2Tc-41@gated-at.bofh.it>
In reply to#1234445
Remove the disabled code, for now, with #if 0.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---

Hi,

The code after the return is dead code. There is a comment saying it is
disabled for now, it would be good if the code is removed with #if 0 as
well.

Thanks,
Luis

 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index d33b8fe..f86ea9f 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -2233,10 +2233,12 @@ static int use_hw_sample_counter(struct comedi_cmd *cmd)
 /* disable for now until I work out a race */
 	return 0;
 
+#if 0
 	if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg <= max_counter_value)
 		return 1;
 
 	return 0;
+#endif
 }
 
 static void setup_sample_counters(struct comedi_device *dev,
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234631 — Re: [PATCH] staging: comedi: cb_pcidas64: remove unused code

FromGreg KH <gregkh@linuxfoundation.org>
Date2015-09-29 03:50 +0200
SubjectRe: [PATCH] staging: comedi: cb_pcidas64: remove unused code
Message-ID<qdSdj-kl-1@gated-at.bofh.it>
In reply to#1234481
On Mon, Sep 28, 2015 at 10:10:42PM +0100, Luis de Bethencourt wrote:
> Remove the disabled code, for now, with #if 0.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> 
> Hi,
> 
> The code after the return is dead code. There is a comment saying it is
> disabled for now, it would be good if the code is removed with #if 0 as
> well.

The compiler doesn't add it anyway, so this is the same as what you just
did, so I don't think it's needed.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234932 — Re: [PATCH] staging: comedi: cb_pcidas64: remove unused code

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2015-09-29 12:00 +0200
SubjectRe: [PATCH] staging: comedi: cb_pcidas64: remove unused code
Message-ID<qdZRw-2U9-5@gated-at.bofh.it>
In reply to#1234631
On 29/09/15 02:23, Greg KH wrote:
> On Mon, Sep 28, 2015 at 10:10:42PM +0100, Luis de Bethencourt wrote:
>> Remove the disabled code, for now, with #if 0.
>>
>> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
>> ---
>>
>> Hi,
>>
>> The code after the return is dead code. There is a comment saying it is
>> disabled for now, it would be good if the code is removed with #if 0 as
>> well.
> 
> The compiler doesn't add it anyway, so this is the same as what you just
> did, so I don't think it's needed.
> 
> thanks,
> 
> greg k-h
> 

Hi Greg,

I thought it would be easier to read if the code was explicitly marked as
dead/uncompiled.
You are correct though, it is probably not worth it.

Thanks for the review,
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234542 — [PATCH] staging: rtl8712: remove dead code

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2015-09-29 00:00 +0200
Subject[PATCH] staging: rtl8712: remove dead code
Message-ID<qdOCK-3CX-7@gated-at.bofh.it>
In reply to#1234445
The while() loop will only exit in a return or a goto ask_for_joinbss,
which means it will never break and execute the return after it.
Removing return _FAIL since it is dead code.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index fc5dbea..fbcb248 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -1190,7 +1190,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 			}
 		}
 	}
-	return _FAIL;
+
 ask_for_joinbss:
 	return r8712_joinbss_cmd(adapter, pnetwork);
 }
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235760 — Re: [PATCH] staging: rtl8712: remove dead code

FromJoshua Clayton <stillcompiling@gmail.com>
Date2015-09-30 07:40 +0200
SubjectRe: [PATCH] staging: rtl8712: remove dead code
Message-ID<qeihs-44N-5@gated-at.bofh.it>
In reply to#1234542
On Monday, September 28, 2015 10:52:33 PM Luis de Bethencourt wrote:
> The while() loop will only exit in a return or a goto ask_for_joinbss,
> which means it will never break and execute the return after it.
> Removing return _FAIL since it is dead code.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
>  drivers/staging/rtl8712/rtl871x_mlme.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
> index fc5dbea..fbcb248 100644
> --- a/drivers/staging/rtl8712/rtl871x_mlme.c
> +++ b/drivers/staging/rtl8712/rtl871x_mlme.c
> @@ -1190,7 +1190,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
>  			}
>  		}
>  	}
> -	return _FAIL;
> +
>  ask_for_joinbss:
>  	return r8712_joinbss_cmd(adapter, pnetwork);
>  }
> 

Yes, that line is unreachable, (no breaks, only returns and gotos to get out of the loop).

but ugh, that function is an abomination.
removing the return _FAIL does little to improve the code flow or
readability. 

perhaps a nicer fix would be to change it to follow the convention
of gotos for the failure path, so instead of 5 levels of nesting, 
it would flow naturally toward r8712_joinbss_cmd();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234633

FromGreg KH <gregkh@linuxfoundation.org>
Date2015-09-29 03:50 +0200
Message-ID<qdSdk-kl-9@gated-at.bofh.it>
In reply to#1234445
On Mon, Sep 28, 2015 at 09:54:45PM +0100, Luis de Bethencourt wrote:
> Remove the unused code, which isn't implemented yet, using #if 0.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> 
> Hi,
> 
> The code after the return is dead code. My understanding is that it is
> there for when the output commands are implemented in the future.
> Meanwhile it would be clearer if the code is removed with #if 0.
> 
> Thanks,
> Luis
> 
>  drivers/staging/comedi/drivers/ni_tiocmd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c
> index 9b124b0..728c7f4 100644
> --- a/drivers/staging/comedi/drivers/ni_tiocmd.c
> +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
> @@ -158,11 +158,13 @@ static int ni_tio_output_cmd(struct comedi_subdevice *s)
>  		"output commands not yet implemented.\n");
>  	return -ENOTSUPP;
>  
> +#if 0 /* unused */
>  	counter->mite_chan->dir = COMEDI_OUTPUT;
>  	mite_prep_dma(counter->mite_chan, 32, 32);
>  	ni_tio_configure_dma(counter, true, false);
>  	mite_dma_arm(counter->mite_chan);
>  	return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
> +#endif

That's not clear at all, if the code isn't needed, let's just delete it,
why is it here at all?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web