Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: Rfkill rewrite
@ 2009-07-18 15:46 Alan Jenkins
  2009-07-18 17:40 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Jenkins @ 2009-07-18 15:46 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org

On 4/18/09, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Sat, 2009-04-18 at 14:29 +0100, Alan Jenkins wrote:
>
>> API nit:
>> 
>>  * This function tells the rfkill core that the device is capable of
>>  * remembering soft blocks (which it is notified of via the set_block
>>  * method) -- this means that the driver may ignore the return value
>>  * from rfkill_set_hw_state().
>> 
>> Doesn't this conflict with the declaration of rfkill_set_hw_state() as
>> __must_check?
>
> Yeah, in a way it does, but I figure it's rare enough that those who
> really can ignore it can write
> 	(void) rfkill_set_hw_state(...)
>
> Don't really have a strong opinion, it just seemed the mistake in the
> other direction would be more common.

It seems my GCC has a stronger definition of "must" than you do :-).  I can't get rid of the warning by casting it to void.  So I'm not sure __must_check is really appropriate here.

drivers/platform/x86/hp-wmi.c: In function ‘hp_wmi_bios_setup’:
drivers/platform/x86/hp-wmi.c:467: warning: ignoring return value of ‘rfkill_set_hw_state’, declared with attribute warn_unused_result

$ grep -n rfkill_set_hw_state drivers/platform/x86/hp-wmi.c
467:            (void) rfkill_set_hw_state(wifi_rfkill,

$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)


Thanks
Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Rfkill rewrite
  2009-07-18 15:46 Rfkill rewrite Alan Jenkins
@ 2009-07-18 17:40 ` Johannes Berg
  2009-07-18 18:20   ` [PATCH] rfkill: remove too-strict __must_check Alan Jenkins
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2009-07-18 17:40 UTC (permalink / raw)
  To: Alan Jenkins; +Cc: linux-wireless@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

On Sat, 2009-07-18 at 16:46 +0100, Alan Jenkins wrote:

> It seems my GCC has a stronger definition of "must" than you do :-).
> I can't get rid of the warning by casting it to void.  So I'm not sure
> __must_check is really appropriate here.

Heh, my gcc agrees with you :)
I'm happy to remove it -- want to send a patch?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] rfkill: remove too-strict __must_check
  2009-07-18 17:40 ` Johannes Berg
@ 2009-07-18 18:20   ` Alan Jenkins
  2009-07-18 18:22     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Jenkins @ 2009-07-18 18:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org

Some drivers don't need the return value of rfkill_set_hw_state(),
so it should not be marked as __must_check.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
---
 include/linux/rfkill.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index f3d5812..1020290 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -238,7 +238,7 @@ void rfkill_destroy(struct rfkill *rfkill);
  * should be blocked) so that drivers need not keep track of the soft
  * block state -- which they might not be able to.
  */
-bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
+bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
 
 /**
  * rfkill_set_sw_state - Set the internal rfkill software block state
-- 
1.6.3.2




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rfkill: remove too-strict __must_check
  2009-07-18 18:20   ` [PATCH] rfkill: remove too-strict __must_check Alan Jenkins
@ 2009-07-18 18:22     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2009-07-18 18:22 UTC (permalink / raw)
  To: Alan Jenkins; +Cc: linux-wireless@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

On Sat, 2009-07-18 at 19:20 +0100, Alan Jenkins wrote:
> Some drivers don't need the return value of rfkill_set_hw_state(),
> so it should not be marked as __must_check.
> 
> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

Thanks.

> ---
>  include/linux/rfkill.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
> index f3d5812..1020290 100644
> --- a/include/linux/rfkill.h
> +++ b/include/linux/rfkill.h
> @@ -238,7 +238,7 @@ void rfkill_destroy(struct rfkill *rfkill);
>   * should be blocked) so that drivers need not keep track of the soft
>   * block state -- which they might not be able to.
>   */
> -bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
> +bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
>  
>  /**
>   * rfkill_set_sw_state - Set the internal rfkill software block state

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-18 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-18 15:46 Rfkill rewrite Alan Jenkins
2009-07-18 17:40 ` Johannes Berg
2009-07-18 18:20   ` [PATCH] rfkill: remove too-strict __must_check Alan Jenkins
2009-07-18 18:22     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox