All of lore.kernel.org
 help / color / mirror / Atom feed
* reasonable for a Kconfig variable to be tested only for "_MODULE"?
@ 2012-04-12 11:30 Robert P. J. Day
  2012-04-15 20:07 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2012-04-12 11:30 UTC (permalink / raw)
  To: Linux Kernel Mailing List


  playing with my cleanup scripts this morning and ran across this
output looking for unused CONFIG_ variables under drivers/ata:

$ ../s/find_unused_configs.sh drivers/ata
===== PATA_QDI
drivers/ata/Kconfig:831:config PATA_QDI
===== PATA_WINBOND_VLB
drivers/ata/Kconfig:865:config PATA_WINBOND_VLB
$

  normally, i would flag that as "variables that are defined in a
Kconfig file but are never tested anywhere", but upon further
examination:

$ $ grep -r PATA_QDI *
drivers/ata/Kconfig:config PATA_QDI
drivers/ata/pata_legacy.c:#ifdef CONFIG_PATA_QDI_MODULE
$

so "CONFIG_PATA_QDI" isn't tested, but "CONFIG_PATA_QDI_MODULE" *is*,
which is not something i'd considered.  the Kconfig entry:

config PATA_QDI
        tristate "QDI VLB PATA support"
        depends on ISA
        select PATA_LEGACY
        help
          Support for QDI 6500 and 6580 PATA controllers on VESA local bus.

and the relevant source:

/* Set to probe QDI controllers */
#ifdef CONFIG_PATA_QDI_MODULE
static int qdi = 1;
#else
static int qdi;
#endif

  is that combination reasonable?  to test *only* for
"CONFIG_whatever_MODULE"?  if it is, i'll add that check to avoid
reporting false positives.

  all of the above can be said for PATA_WINBOND_VLB as well.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



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

* Re: reasonable for a Kconfig variable to be tested only for "_MODULE"?
  2012-04-12 11:30 reasonable for a Kconfig variable to be tested only for "_MODULE"? Robert P. J. Day
@ 2012-04-15 20:07 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2012-04-15 20:07 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux Kernel Mailing List

On 04/12/2012 04:30 AM, Robert P. J. Day wrote:

> 
>   playing with my cleanup scripts this morning and ran across this
> output looking for unused CONFIG_ variables under drivers/ata:
> 
> $ ../s/find_unused_configs.sh drivers/ata
> ===== PATA_QDI
> drivers/ata/Kconfig:831:config PATA_QDI
> ===== PATA_WINBOND_VLB
> drivers/ata/Kconfig:865:config PATA_WINBOND_VLB
> $
> 
>   normally, i would flag that as "variables that are defined in a
> Kconfig file but are never tested anywhere", but upon further
> examination:
> 
> $ $ grep -r PATA_QDI *
> drivers/ata/Kconfig:config PATA_QDI
> drivers/ata/pata_legacy.c:#ifdef CONFIG_PATA_QDI_MODULE
> $
> 
> so "CONFIG_PATA_QDI" isn't tested, but "CONFIG_PATA_QDI_MODULE" *is*,
> which is not something i'd considered.  the Kconfig entry:
> 
> config PATA_QDI
>         tristate "QDI VLB PATA support"
>         depends on ISA
>         select PATA_LEGACY
>         help
>           Support for QDI 6500 and 6580 PATA controllers on VESA local bus.
> 
> and the relevant source:
> 
> /* Set to probe QDI controllers */
> #ifdef CONFIG_PATA_QDI_MODULE
> static int qdi = 1;
> #else
> static int qdi;
> #endif
> 
>   is that combination reasonable?  to test *only* for
> "CONFIG_whatever_MODULE"?  if it is, i'll add that check to avoid
> reporting false positives.

Yes, sometimes modules want to behave differently (e.g., initialize
differently) if they are built as a loadable module.
I've seen this other places.


>   all of the above can be said for PATA_WINBOND_VLB as well.
> 
> rday
> 



-- 
~Randy

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

end of thread, other threads:[~2012-04-15 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 11:30 reasonable for a Kconfig variable to be tested only for "_MODULE"? Robert P. J. Day
2012-04-15 20:07 ` Randy Dunlap

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.