Skip to contentSkip to conversation

Staging: comedi: drivers: Remove unused functions

PATCH Superseded Bhumika Goyal 2 participants 5 messages Sep 15, 2016 2 messages not in the archive Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: comedi: drivers: Remove unused functions

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 change was 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;
@@
func

@script:python depends on !r@
func << r1.func;
p << r1.p;
@@
display(func,p)

---
Changes in v2:
* Simplify coccinelle script by removing func(...) and adding spaces around "<<".

 drivers/staging/comedi/drivers/s626.c | 51 -----------------------------------
 1 file changed, 51 deletions(-)
drivers/staging/comedi/drivers/s626.c +0 -51
index 6d89ca0..670d55c 100644
@@ -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)
 {
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 133 lines · Ian Abbott
Quoted 132 lines · 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 change was 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;
@@
func

@script:python depends on !r@
func << r1.func;
p << r1.p;
@@
display(func,p)

---
Changes in v2:
* Simplify coccinelle script by removing func(...) and adding spaces around "<<".

 drivers/staging/comedi/drivers/s626.c | 51
-----------------------------------
 1 file changed, 51 deletions(-)
drivers/staging/comedi/drivers/s626.c +0 -8
index 6d89ca0..670d55c 100644
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -13
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -15
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -15
@@ -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,
Quoted 9 lines
Quoted 3 lines
drivers/staging/comedi/drivers/s626.c +0 -0
                                   unsigned int chan)

{

It will be better to get rid of all the #ifdef'ed out functions in one go, rather than just few at a time. Your commit dda68765d757c7da878b093a87f24d6a1d4cfb64 in February removed a few more unused functions from this driver.

Ok, I will remove all the #ifdef'ed functions together. But should I send a v3 for that or a new patch?
Thanks for the input.

Thanks,
Bhumika

Quoted 3 lines

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 25 lines · Ian Abbott
Quoted 10 lines · Bhumika Goyal
Quoted 8 lines · Ian Abbott
Quoted 6 lines · 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 change was done by hand.

[snip]

Quoted 10 lines
Quoted 7 lines

It will be better to get rid of all the #ifdef'ed out functions in one go,
rather than just few at a time. Your commit dda68765d757c7da878b093a87f24d6a1d4cfb64 in February removed a few more unused functions from this driver.

Ok, I will remove all the #ifdef'ed functions together. But should I send a v3 for that or a new patch?
Thanks for the input.

Quoted 7 lines

I think you can just send it as a new patch, but also mention "s626" in the patch subject, something like:

Staging: comedi: s626: Remove unused functions

(We don't usually bother with the "drivers:" tag after the "comedi:" tag.)

Ok, point noted. Thanks for explaining.

Thanks,
Bhumika

Quoted 7 lines

Thanks,
Ian.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

#5 lore raw
Quoted 29 lines · Bhumika Goyal
Quoted 28 lines · Ian Abbott
Quoted 10 lines · Bhumika Goyal
Quoted 8 lines · Ian Abbott
Quoted 6 lines · 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 change was done by hand.

[snip]

Quoted 10 lines
Quoted 7 lines

It will be better to get rid of all the #ifdef'ed out functions in one go,
rather than just few at a time. Your commit dda68765d757c7da878b093a87f24d6a1d4cfb64 in February removed a few more unused functions from this driver.

Ok, I will remove all the #ifdef'ed functions together. But should I send a v3 for that or a new patch?
Thanks for the input.

I think you can just send it as a new patch, but also mention "s626" in the patch subject, something like:

Quoted 6 lines
Quoted 4 lines

Staging: comedi: s626: Remove unused functions

(We don't usually bother with the "drivers:" tag after the "comedi:" tag.)

Ok, point noted. Thanks for explaining.

Run git log --oneline for the affected file and see what people have commonly done.

julia

Quoted 19 lines

Thanks,
Bhumika

Quoted 7 lines

Thanks,
Ian.

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAOH%2B1jH7DWRuQDqrhep%3Dp1Ztypak0LEuhOVBfXBcDUoLLKvV2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw
In reply to Bhumika Goyal
Quoted 143 lines · Bhumika Goyal
Quoted 133 lines · Ian Abbott
Quoted 132 lines · 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 change was 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;
@@
func

@script:python depends on !r@
func << r1.func;
p << r1.p;
@@
display(func,p)

---
Changes in v2:
* Simplify coccinelle script by removing func(...) and adding spaces around "<<".

 drivers/staging/comedi/drivers/s626.c | 51
-----------------------------------
 1 file changed, 51 deletions(-)
drivers/staging/comedi/drivers/s626.c +0 -8
index 6d89ca0..670d55c 100644
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -13
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -15
@@ -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,

drivers/staging/comedi/drivers/s626.c +0 -15
@@ -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,
Quoted 9 lines
Quoted 3 lines
drivers/staging/comedi/drivers/s626.c +0 -0
                                   unsigned int chan)

{

It will be better to get rid of all the #ifdef'ed out functions in one go, rather than just few at a time. Your commit dda68765d757c7da878b093a87f24d6a1d4cfb64 in February removed a few more unused functions from this driver.

Quoted 3 lines

Ok, I will remove all the #ifdef'ed functions together. But should I send a v3 for that or a new patch?
Thanks for the input.

v3. Then Greg will know what is the latest version of the patch for this file.

julia

Quoted 14 lines

Thanks,
Bhumika

Quoted 3 lines

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAOH%2B1jGH%2B4vvRYvFXEnRVF%2BFSK3KwEn-duxFLcqFvUNTNEK_4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.