* [PATCH] Staging: comedi: drivers: Remove unused functions
@ 2016-09-14 15:09 Bhumika Goyal
2016-09-14 19:18 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Bhumika Goyal @ 2016-09-14 15:09 UTC (permalink / raw)
To: abbotti, hsweeten, gregkh, outreachy-kernel; +Cc: Bhumika Goyal
The functions s626_get_latch_source, s626_get_load_trig,
s626_set_clk_pol and s626_set_index_src are not used anywhere in
the kernel. Therefore, remove them. The static unused functions were
detected using Coccinelle but the changes were done by hand.
Script used :
@initialize:python@
@@
def display(name,p):
print(name,p[0].file)
@r1@
identifier func;
type T;
position p;
@@
static T func@p(...)
{
...
}
@r@
identifier r1.func;
position p;
@@
(
func(...)
|
func
)
@script:python depends on !r@
func<<r1.func;
p<<r1.p;
@@
display(func,p)
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/staging/comedi/drivers/s626.c | 51 -----------------------------------
1 file changed, 51 deletions(-)
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 6d89ca0..670d55c 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1034,14 +1034,6 @@ static uint16_t s626_get_enable(struct comedi_device *dev,
}
#endif
-#ifdef unused
-static uint16_t s626_get_latch_source(struct comedi_device *dev,
- unsigned int chan)
-{
- return S626_GET_CRB_LATCHSRC(s626_debi_read(dev, S626_LP_CRB(chan)));
-}
-#endif
-
/*
* Return/set the event that will trigger transfer of the preload
* register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow,
@@ -1066,19 +1058,6 @@ static void s626_set_load_trig(struct comedi_device *dev,
s626_debi_replace(dev, reg, ~mask, set);
}
-#ifdef unused
-static uint16_t s626_get_load_trig(struct comedi_device *dev,
- unsigned int chan)
-{
- if (chan < 3)
- return S626_GET_CRA_LOADSRC_A(s626_debi_read(dev,
- S626_LP_CRA(chan)));
- else
- return S626_GET_CRB_LOADSRC_B(s626_debi_read(dev,
- S626_LP_CRB(chan)));
-}
-#endif
-
/*
* Return/set counter interrupt source and clear any captured
* index/overflow events. int_source: 0=Disabled, 1=OverflowOnly,
@@ -1168,21 +1147,6 @@ static void s626_set_clk_mult(struct comedi_device *dev,
}
/*
- * Return/set the clock polarity.
- */
-static void s626_set_clk_pol(struct comedi_device *dev,
- unsigned int chan, uint16_t value)
-{
- uint16_t mode;
-
- mode = s626_get_mode(dev, chan);
- mode &= ~S626_STDMSK_CLKPOL;
- mode |= S626_SET_STD_CLKPOL(value);
-
- s626_set_mode(dev, chan, mode, false);
-}
-
-/*
* Return/set the encoder mode.
*/
static void s626_set_enc_mode(struct comedi_device *dev,
@@ -1203,21 +1167,6 @@ static uint16_t s626_get_index_pol(struct comedi_device *dev,
return S626_GET_STD_INDXPOL(s626_get_mode(dev, chan));
}
-/*
- * Return/set the index source.
- */
-static void s626_set_index_src(struct comedi_device *dev,
- unsigned int chan, uint16_t value)
-{
- uint16_t mode;
-
- mode = s626_get_mode(dev, chan);
- mode &= ~S626_STDMSK_INDXSRC;
- mode |= S626_SET_STD_INDXSRC(value != 0);
-
- s626_set_mode(dev, chan, mode, false);
-}
-
static uint16_t s626_get_index_src(struct comedi_device *dev,
unsigned int chan)
{
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: comedi: drivers: Remove unused functions
2016-09-14 15:09 [PATCH] Staging: comedi: drivers: Remove unused functions Bhumika Goyal
@ 2016-09-14 19:18 ` Julia Lawall
2016-09-15 6:26 ` Bhumika Goyal
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-09-14 19:18 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: abbotti, hsweeten, gregkh, outreachy-kernel
On Wed, 14 Sep 2016, Bhumika Goyal wrote:
> The functions s626_get_latch_source, s626_get_load_trig,
> s626_set_clk_pol and s626_set_index_src are not used anywhere in
> the kernel. Therefore, remove them. The static unused functions were
> detected using Coccinelle but the changes were done by hand.
> Script used :
>
> @initialize:python@
> @@
> def display(name,p):
> print(name,p[0].file)
>
> @r1@
> identifier func;
> type T;
> position p;
> @@
> static T func@p(...)
> {
> ...
> }
>
> @r@
> identifier r1.func;
> position p;
> @@
> (
> func(...)
> |
> func
> )
This pattern is unnecessarily complex. The second part (just func), will
also match anything the first part matches. So you can just put func.
>
> @script:python depends on !r@
> func<<r1.func;
> p<<r1.p;
Perhaps it is just my personal taste, but I always put spaces around <<.
Looks good otherwise.
julia
> @@
> display(func,p)
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> drivers/staging/comedi/drivers/s626.c | 51 -----------------------------------
> 1 file changed, 51 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
> index 6d89ca0..670d55c 100644
> --- a/drivers/staging/comedi/drivers/s626.c
> +++ b/drivers/staging/comedi/drivers/s626.c
> @@ -1034,14 +1034,6 @@ static uint16_t s626_get_enable(struct comedi_device *dev,
> }
> #endif
>
> -#ifdef unused
> -static uint16_t s626_get_latch_source(struct comedi_device *dev,
> - unsigned int chan)
> -{
> - return S626_GET_CRB_LATCHSRC(s626_debi_read(dev, S626_LP_CRB(chan)));
> -}
> -#endif
> -
> /*
> * Return/set the event that will trigger transfer of the preload
> * register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow,
> @@ -1066,19 +1058,6 @@ static void s626_set_load_trig(struct comedi_device *dev,
> s626_debi_replace(dev, reg, ~mask, set);
> }
>
> -#ifdef unused
> -static uint16_t s626_get_load_trig(struct comedi_device *dev,
> - unsigned int chan)
> -{
> - if (chan < 3)
> - return S626_GET_CRA_LOADSRC_A(s626_debi_read(dev,
> - S626_LP_CRA(chan)));
> - else
> - return S626_GET_CRB_LOADSRC_B(s626_debi_read(dev,
> - S626_LP_CRB(chan)));
> -}
> -#endif
> -
> /*
> * Return/set counter interrupt source and clear any captured
> * index/overflow events. int_source: 0=Disabled, 1=OverflowOnly,
> @@ -1168,21 +1147,6 @@ static void s626_set_clk_mult(struct comedi_device *dev,
> }
>
> /*
> - * Return/set the clock polarity.
> - */
> -static void s626_set_clk_pol(struct comedi_device *dev,
> - unsigned int chan, uint16_t value)
> -{
> - uint16_t mode;
> -
> - mode = s626_get_mode(dev, chan);
> - mode &= ~S626_STDMSK_CLKPOL;
> - mode |= S626_SET_STD_CLKPOL(value);
> -
> - s626_set_mode(dev, chan, mode, false);
> -}
> -
> -/*
> * Return/set the encoder mode.
> */
> static void s626_set_enc_mode(struct comedi_device *dev,
> @@ -1203,21 +1167,6 @@ static uint16_t s626_get_index_pol(struct comedi_device *dev,
> return S626_GET_STD_INDXPOL(s626_get_mode(dev, chan));
> }
>
> -/*
> - * Return/set the index source.
> - */
> -static void s626_set_index_src(struct comedi_device *dev,
> - unsigned int chan, uint16_t value)
> -{
> - uint16_t mode;
> -
> - mode = s626_get_mode(dev, chan);
> - mode &= ~S626_STDMSK_INDXSRC;
> - mode |= S626_SET_STD_INDXSRC(value != 0);
> -
> - s626_set_mode(dev, chan, mode, false);
> -}
> -
> static uint16_t s626_get_index_src(struct comedi_device *dev,
> unsigned int chan)
> {
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1473865793-20468-1-git-send-email-bhumirks%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] Staging: comedi: drivers: Remove unused functions
2016-09-14 19:18 ` [Outreachy kernel] " Julia Lawall
@ 2016-09-15 6:26 ` Bhumika Goyal
0 siblings, 0 replies; 3+ messages in thread
From: Bhumika Goyal @ 2016-09-15 6:26 UTC (permalink / raw)
To: Julia Lawall; +Cc: Ian Abbott, hsweeten, gregkh, outreachy-kernel
On Thu, Sep 15, 2016 at 12:48 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Wed, 14 Sep 2016, Bhumika Goyal wrote:
>
>> The functions s626_get_latch_source, s626_get_load_trig,
>> s626_set_clk_pol and s626_set_index_src are not used anywhere in
>> the kernel. Therefore, remove them. The static unused functions were
>> detected using Coccinelle but the changes were done by hand.
>> Script used :
>>
>> @initialize:python@
>> @@
>> def display(name,p):
>> print(name,p[0].file)
>>
>> @r1@
>> identifier func;
>> type T;
>> position p;
>> @@
>> static T func@p(...)
>> {
>> ...
>> }
>>
>> @r@
>> identifier r1.func;
>> position p;
>> @@
>> (
>> func(...)
>> |
>> func
>> )
>
> This pattern is unnecessarily complex. The second part (just func), will
> also match anything the first part matches. So you can just put func.
>
Yes, it is really unnecessary to put func(...) here. I will make the
changes and send a v2 for both the patches.
Thank you for the input.
>>
>> @script:python depends on !r@
>> func<<r1.func;
>> p<<r1.p;
>
> Perhaps it is just my personal taste, but I always put spaces around <<.
>
> Looks good otherwise.
>
Ok, I will keep this in mind too :D.
Thanks,
Bhumika
> julia
>
>> @@
>> display(func,p)
>>
>> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
>> ---
>> drivers/staging/comedi/drivers/s626.c | 51 -----------------------------------
>> 1 file changed, 51 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
>> index 6d89ca0..670d55c 100644
>> --- a/drivers/staging/comedi/drivers/s626.c
>> +++ b/drivers/staging/comedi/drivers/s626.c
>> @@ -1034,14 +1034,6 @@ static uint16_t s626_get_enable(struct comedi_device *dev,
>> }
>> #endif
>>
>> -#ifdef unused
>> -static uint16_t s626_get_latch_source(struct comedi_device *dev,
>> - unsigned int chan)
>> -{
>> - return S626_GET_CRB_LATCHSRC(s626_debi_read(dev, S626_LP_CRB(chan)));
>> -}
>> -#endif
>> -
>> /*
>> * Return/set the event that will trigger transfer of the preload
>> * register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow,
>> @@ -1066,19 +1058,6 @@ static void s626_set_load_trig(struct comedi_device *dev,
>> s626_debi_replace(dev, reg, ~mask, set);
>> }
>>
>> -#ifdef unused
>> -static uint16_t s626_get_load_trig(struct comedi_device *dev,
>> - unsigned int chan)
>> -{
>> - if (chan < 3)
>> - return S626_GET_CRA_LOADSRC_A(s626_debi_read(dev,
>> - S626_LP_CRA(chan)));
>> - else
>> - return S626_GET_CRB_LOADSRC_B(s626_debi_read(dev,
>> - S626_LP_CRB(chan)));
>> -}
>> -#endif
>> -
>> /*
>> * Return/set counter interrupt source and clear any captured
>> * index/overflow events. int_source: 0=Disabled, 1=OverflowOnly,
>> @@ -1168,21 +1147,6 @@ static void s626_set_clk_mult(struct comedi_device *dev,
>> }
>>
>> /*
>> - * Return/set the clock polarity.
>> - */
>> -static void s626_set_clk_pol(struct comedi_device *dev,
>> - unsigned int chan, uint16_t value)
>> -{
>> - uint16_t mode;
>> -
>> - mode = s626_get_mode(dev, chan);
>> - mode &= ~S626_STDMSK_CLKPOL;
>> - mode |= S626_SET_STD_CLKPOL(value);
>> -
>> - s626_set_mode(dev, chan, mode, false);
>> -}
>> -
>> -/*
>> * Return/set the encoder mode.
>> */
>> static void s626_set_enc_mode(struct comedi_device *dev,
>> @@ -1203,21 +1167,6 @@ static uint16_t s626_get_index_pol(struct comedi_device *dev,
>> return S626_GET_STD_INDXPOL(s626_get_mode(dev, chan));
>> }
>>
>> -/*
>> - * Return/set the index source.
>> - */
>> -static void s626_set_index_src(struct comedi_device *dev,
>> - unsigned int chan, uint16_t value)
>> -{
>> - uint16_t mode;
>> -
>> - mode = s626_get_mode(dev, chan);
>> - mode &= ~S626_STDMSK_INDXSRC;
>> - mode |= S626_SET_STD_INDXSRC(value != 0);
>> -
>> - s626_set_mode(dev, chan, mode, false);
>> -}
>> -
>> static uint16_t s626_get_index_src(struct comedi_device *dev,
>> unsigned int chan)
>> {
>> --
>> 1.9.1
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1473865793-20468-1-git-send-email-bhumirks%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-15 6:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 15:09 [PATCH] Staging: comedi: drivers: Remove unused functions Bhumika Goyal
2016-09-14 19:18 ` [Outreachy kernel] " Julia Lawall
2016-09-15 6:26 ` Bhumika Goyal
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.