Skip to contentSkip to conversation

staging: comedi: ni_mio_common.c: local functions should be static

PATCH In review H Hartley Sweeten 2 participants 4 messages Jun 5, 2012 – Jun 6, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: comedi: ni_mio_common.c: local functions should be static

Local functions should be marked static to prevent them from being exposed globally.

This quiets the following sparse warnings:

warning: symbol 'ni_release_gpct_mite_channel' was not declared. Should it be static?
warning: symbol 'ni_prime_channelgain_list' was not declared. Should it be static?

Cc Ian Abbott <[email protected]>
Cc Mori Hess <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

---

drivers/staging/comedi/drivers/ni_mio_common.c +2 -2
index fd232bc..3b3a0b1 100644
@@ -644,7 +644,7 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
 #endif /*  PCIDMA */
 }
 
-void ni_release_gpct_mite_channel(struct comedi_device *dev,
+static void ni_release_gpct_mite_channel(struct comedi_device *dev,
 				  unsigned gpct_index)
 {
 #ifdef PCIDMA
@@ -1880,7 +1880,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
 	return insn->n;
 }
 
-void ni_prime_channelgain_list(struct comedi_device *dev)
+static void ni_prime_channelgain_list(struct comedi_device *dev)
 {
 	int i;
 	devpriv->stc_writew(dev, AI_CONVERT_Pulse, AI_Command_1_Register);
#1 lore raw
Quoted 29 lines · H Hartley Sweeten

Local functions should be marked static to prevent them from being exposed globally.

This quiets the following sparse warnings:

warning: symbol 'ni_release_gpct_mite_channel' was not declared. Should it be static?
warning: symbol 'ni_prime_channelgain_list' was not declared. Should it be static?

Cc Ian Abbott<[email protected]>
Cc Mori Hess<[email protected]>
Cc Greg Kroah-Hartman<[email protected]>

---

drivers/staging/comedi/drivers/ni_mio_common.c +1 -1
index fd232bc..3b3a0b1 100644
@@ -644,7 +644,7 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
  #endif /*  PCIDMA */
  }
 
-void ni_release_gpct_mite_channel(struct comedi_device *dev,
+static void ni_release_gpct_mite_channel(struct comedi_device *dev,
  				  unsigned gpct_index)
  {
  #ifdef PCIDMA

drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_insn_read(struct comedi_device *dev, · line 1881

Quoted 2 lines
drivers/staging/comedi/drivers/ni_mio_common.c +0 -0
@@ -1880,7 +1880,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
  	return insn->n;
  }

This results in a compiler warning about the unused function ni_release_gpct_mite_channel when compiling ni_atmio.c. It was unused before of course, but now it is static, the compiler realizes it!

It could be fixed for now by moving the '#ifdef PCIDMA' and matching '#endif' to surround the whole function, though I guess we want to try and get rid of the #ifdef's eventually. It's tricky because ni_mio_common.c isn't a standalone compilation unit, it's #include'd by some other .c files. We might need to have a go at splitting it up at some point.

Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
#2 lore raw
Quoted 24 lines · Ian Abbott
Quoted 23 lines · H Hartley Sweeten

Local functions should be marked static to prevent them from being exposed globally.

This quiets the following sparse warnings:

warning: symbol 'ni_release_gpct_mite_channel' was not declared. Should it be static?
warning: symbol 'ni_prime_channelgain_list' was not declared. Should it be static?

Cc Ian Abbott<[email protected]>
Cc Mori Hess<[email protected]>
Cc Greg Kroah-Hartman<[email protected]>

---

drivers/staging/comedi/drivers/ni_mio_common.c +0 -0
index fd232bc..3b3a0b1 100644
@@ -644,7 +644,7 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
  #endif /*  PCIDMA */
  }
 
Quoted 12 lines

drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_insn_read(struct comedi_device *dev, · line 1881

Quoted 8 lines
drivers/staging/comedi/drivers/ni_mio_common.c +1 -1
-void ni_release_gpct_mite_channel(struct comedi_device *dev,
+static void ni_release_gpct_mite_channel(struct comedi_device *dev,
  				  unsigned gpct_index)
  {
  #ifdef PCIDMA
@@ -1880,7 +1880,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
  	return insn->n;
  }

This results in a compiler warning about the unused function ni_release_gpct_mite_channel when compiling ni_atmio.c. It was unused before of course, but now it is static, the compiler realizes it!

Ugh... c code including c code... I didn't notice that until now.

Quoted 6 lines

It could be fixed for now by moving the '#ifdef PCIDMA' and matching '#endif' to surround the whole function, though I guess we want to try and get rid of the #ifdef's eventually. It's tricky because ni_mio_common.c isn't a standalone compilation unit, it's #include'd by some other .c files. We might need to have a go at splitting it up at some point.

The ni_mio_common.c file should just get turned into a library module.

Right now it's a bit of a mess. The individual drivers define PCIDMA before including ni_mio_common.c. The only one that sets the define is ni_pcimio but it's also included by ni_atmio and ni_mio_cs.

I'll look it over and see what might be done to fix it.

Regards,
Hartley

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#3 lore raw
Quoted 47 lines · H Hartley Sweeten
Quoted 24 lines · Ian Abbott
Quoted 23 lines · H Hartley Sweeten

Local functions should be marked static to prevent them from being exposed globally.

This quiets the following sparse warnings:

warning: symbol 'ni_release_gpct_mite_channel' was not declared. Should it be static?
warning: symbol 'ni_prime_channelgain_list' was not declared. Should it be static?

Cc Ian Abbott<[email protected]>
Cc Mori Hess<[email protected]>
Cc Greg Kroah-Hartman<[email protected]>

---

drivers/staging/comedi/drivers/ni_mio_common.c +0 -0
index fd232bc..3b3a0b1 100644
@@ -644,7 +644,7 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
   #endif /*  PCIDMA */
   }
 
Quoted 12 lines

drivers/staging/comedi/drivers/ni_mio_common.c static int ni_ai_insn_read(struct comedi_device *dev, · line 1881

Quoted 8 lines
drivers/staging/comedi/drivers/ni_mio_common.c +1 -1
-void ni_release_gpct_mite_channel(struct comedi_device *dev,
+static void ni_release_gpct_mite_channel(struct comedi_device *dev,
   				  unsigned gpct_index)
   {
   #ifdef PCIDMA
@@ -1880,7 +1880,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
   	return insn->n;
   }

This results in a compiler warning about the unused function ni_release_gpct_mite_channel when compiling ni_atmio.c. It was unused before of course, but now it is static, the compiler realizes it!

Ugh... c code including c code... I didn't notice that until now.

Quoted 6 lines

It could be fixed for now by moving the '#ifdef PCIDMA' and matching '#endif' to surround the whole function, though I guess we want to try and get rid of the #ifdef's eventually. It's tricky because ni_mio_common.c isn't a standalone compilation unit, it's #include'd by some other .c files. We might need to have a go at splitting it up at some point.

Quoted 7 lines

The ni_mio_common.c file should just get turned into a library module.

Right now it's a bit of a mess. The individual drivers define PCIDMA before including ni_mio_common.c. The only one that sets the define is ni_pcimio but it's also included by ni_atmio and ni_mio_cs.

I'll look it over and see what might be done to fix it.

You have to be careful with module dependencies if doing that, as you don't want the ni_atmio module to depend on the mite and ni_tiocmd modules for example.

Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-