* [PATCH] staging: comedi: ni_mio_common.c: local functions should be static
@ 2012-06-05 18:20 H Hartley Sweeten
2012-06-06 10:16 ` Ian Abbott
0 siblings, 1 reply; 4+ messages in thread
From: H Hartley Sweeten @ 2012-06-05 18:20 UTC (permalink / raw)
To: Linux Kernel; +Cc: devel, abbotti, fmhess, gregkh
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?
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index fd232bc..3b3a0b1 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -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);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: comedi: ni_mio_common.c: local functions should be static
2012-06-05 18:20 [PATCH] staging: comedi: ni_mio_common.c: local functions should be static H Hartley Sweeten
@ 2012-06-06 10:16 ` Ian Abbott
2012-06-06 16:22 ` H Hartley Sweeten
0 siblings, 1 reply; 4+ messages in thread
From: Ian Abbott @ 2012-06-06 10:16 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: Linux Kernel, devel, Ian Abbott, fmhess, gregkh
On 2012-06-05 19:20, H Hartley Sweeten wrote:
> 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?
>
> Signed-off-by: H Hartley Sweeten<hsweeten@visionengravers.com>
> Cc: Ian Abbott<abbotti@mev.co.uk>
> Cc: Mori Hess<fmhess@users.sourceforge.net>
> Cc: Greg Kroah-Hartman<gregkh@linuxfoundation.org>
>
> ---
>
> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
> index fd232bc..3b3a0b1 100644
> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> @@ -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;
> }
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.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] staging: comedi: ni_mio_common.c: local functions should be static
2012-06-06 10:16 ` Ian Abbott
@ 2012-06-06 16:22 ` H Hartley Sweeten
2012-06-06 17:01 ` Ian Abbott
0 siblings, 1 reply; 4+ messages in thread
From: H Hartley Sweeten @ 2012-06-06 16:22 UTC (permalink / raw)
To: Ian Abbott; +Cc: Linux Kernel, devel, Ian Abbott, fmhess, gregkh
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2486 bytes --]
On Wednesday, June 06, 2012 3:17 AM, Ian Abbott wrote:
> On 2012-06-05 19:20, H Hartley Sweeten wrote:
>> 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?
>>
>> Signed-off-by: H Hartley Sweeten<hsweeten@visionengravers.com>
>> Cc: Ian Abbott<abbotti@mev.co.uk>
>> Cc: Mori Hess<fmhess@users.sourceforge.net>
>> Cc: Greg Kroah-Hartman<gregkh@linuxfoundation.org>
>>
>> ---
>>
>> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
>> index fd232bc..3b3a0b1 100644
>> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
>> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
>> @@ -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;
>> }
>
> 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.
> 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Ç+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: comedi: ni_mio_common.c: local functions should be static
2012-06-06 16:22 ` H Hartley Sweeten
@ 2012-06-06 17:01 ` Ian Abbott
0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2012-06-06 17:01 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: Ian Abbott, Linux Kernel, devel, fmhess, gregkh
On 2012-06-06 17:22, H Hartley Sweeten wrote:
> On Wednesday, June 06, 2012 3:17 AM, Ian Abbott wrote:
>> On 2012-06-05 19:20, H Hartley Sweeten wrote:
>>> 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?
>>>
>>> Signed-off-by: H Hartley Sweeten<hsweeten@visionengravers.com>
>>> Cc: Ian Abbott<abbotti@mev.co.uk>
>>> Cc: Mori Hess<fmhess@users.sourceforge.net>
>>> Cc: Greg Kroah-Hartman<gregkh@linuxfoundation.org>
>>>
>>> ---
>>>
>>> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
>>> index fd232bc..3b3a0b1 100644
>>> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
>>> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
>>> @@ -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;
>>> }
>>
>> 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.
>
>> 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.
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.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-06 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 18:20 [PATCH] staging: comedi: ni_mio_common.c: local functions should be static H Hartley Sweeten
2012-06-06 10:16 ` Ian Abbott
2012-06-06 16:22 ` H Hartley Sweeten
2012-06-06 17:01 ` Ian Abbott
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.