All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Fishman <avifishman70@gmail.com>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-watchdog@vger.kernel.org,
	Patrick Venture <venture@google.com>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Tomer Maimon <tmaimon77@gmail.com>,
	Tali Perry <tali.perry1@gmail.com>,
	Wim Van Sebroeck <wim@iguana.be>,
	Linus Walleij <linus.walleij@linaro.org>,
	Benjamin Fair <benjaminfair@google.com>
Subject: Re: [PATCH 0/5] wdt: clean up unused modular infrastructure
Date: Sun, 12 May 2019 18:43:29 +0300	[thread overview]
Message-ID: <CAKKbWA5ydScNecjU1C4z72o=6ZiX1D2ik4nUe7VoiFaSF=z9nw@mail.gmail.com> (raw)
In-Reply-To: <1556034515-28792-1-git-send-email-paul.gortmaker@windriver.com>

I saw many drivers that are putting "#ifdef MODULE" around module specific code.
I think it answers all 4 concerns above.
It also covers the case where a developer made the driver available to
be compiled as a module and in the Kconfig didn't make it tristate.
What do you think?

On Thu, May 9, 2019 at 9:17 AM Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
>
> People can embed modular includes and modular exit functions into code
> that never use any of it, and they won't get any errors or warnings.
>
> Using modular infrastructure in non-modules might seem harmless, but some
> of the downfalls this leads to are:
>
>  (1) it is easy to accidentally write unused module_exit/remove code
>  (2) it can be misleading when reading the source, thinking a driver can
>      be modular when the Makefile and/or Kconfig prohibit it
>  (3) an unused include of the module.h header file will in turn
>      include nearly everything else; adding a lot to CPP overhead.
>  (4) it gets copied/replicated into other drivers and can spread.
>
> As a data point for #3 above, an empty C file that just includes the
> module.h header generates over 750kB of CPP output.  Repeating the same
> experiment with init.h and the result is less than 12kB; with export.h
> it is only about 1/2kB; with both it still is less than 12kB.
>
> Here, In this series, we do what has been done for other subsystems,
> like, net, x86, mfd, iommu....  and audit for uses of modular
> infrastructure inside code that currently can't be built as a module.
>
> As always, the option exists for driver authors to convert their code
> to tristate, if there is a valid use case for it to be so.  But since
> I don't have the context for each driver to know if such a use case
> exists, I limit myself to simply removing the unused code in order to
> make the driver consistent with the Makefile/Kconfig settings that
> control it.
>
> Paul.
>
> ---
>
> Cc: Benjamin Fair <benjaminfair@google.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-watchdog@vger.kernel.org
> Cc: Nancy Yuen <yuenn@google.com>
> Cc: openbmc@lists.ozlabs.org
> Cc: Patrick Venture <venture@google.com>
> Cc: Tali Perry <tali.perry1@gmail.com>
> Cc: Tomer Maimon <tmaimon77@gmail.com>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
>
>
> Paul Gortmaker (5):
>   watchdog: rtd119x: drop unused module.h include
>   watchdog: watchdog_core: make it explicitly non-modular
>   watchdog: npcm: make it explicitly non-modular
>   watchdog: intel_scu: make it explicitly non-modular
>   watchdog: coh901327: make it explicitly non-modular
>
>  drivers/watchdog/coh901327_wdt.c      | 24 ++++--------------------
>  drivers/watchdog/intel_scu_watchdog.c | 18 ------------------
>  drivers/watchdog/npcm_wdt.c           | 13 ++++++-------
>  drivers/watchdog/rtd119x_wdt.c        |  1 -
>  drivers/watchdog/watchdog_core.c      | 15 +--------------
>  5 files changed, 11 insertions(+), 60 deletions(-)
>
> --
> 2.7.4
>


-- 
Regards,
Avi

  parent reply	other threads:[~2019-05-12 15:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 15:48 [PATCH 0/5] wdt: clean up unused modular infrastructure Paul Gortmaker
2019-04-23 16:40 ` Paul Gortmaker
2019-04-23 15:48 ` [PATCH 1/5] watchdog: rtd119x: drop unused module.h include Paul Gortmaker
2019-04-29 16:38   ` Guenter Roeck
2019-04-23 15:48 ` [PATCH 2/5] watchdog: watchdog_core: make it explicitly non-modular Paul Gortmaker
2019-04-24  1:22   ` Guenter Roeck
2019-04-24 15:37     ` Paul Gortmaker
2019-04-24 21:05       ` Guenter Roeck
2019-04-27  9:48         ` Wim Van Sebroeck
2019-04-29 16:28           ` Guenter Roeck
2019-04-23 15:48 ` [PATCH 3/5] watchdog: npcm: " Paul Gortmaker
2019-04-23 16:40   ` Paul Gortmaker
2019-04-29 16:40   ` Guenter Roeck
2019-04-29 18:21     ` Paul Gortmaker
2019-04-23 15:48 ` [PATCH 4/5] watchdog: intel_scu: " Paul Gortmaker
2019-04-29 16:37   ` Guenter Roeck
2019-04-23 15:48 ` [PATCH 5/5] watchdog: coh901327: " Paul Gortmaker
2019-04-23 21:29   ` Linus Walleij
2019-04-29 16:37   ` Guenter Roeck
2019-05-12 15:43 ` Avi Fishman [this message]
2019-05-12 15:43   ` [PATCH 0/5] wdt: clean up unused modular infrastructure Avi Fishman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKKbWA5ydScNecjU1C4z72o=6ZiX1D2ik4nUe7VoiFaSF=z9nw@mail.gmail.com' \
    --to=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=openbmc@lists.ozlabs.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=wim@iguana.be \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.