linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Peter Geis <pgwipeout@gmail.com>
Subject: Re: [PATCH v1 05/11] cpufreq: tegra20: Clean up included headers
Date: Fri, 18 May 2018 10:57:14 +0200	[thread overview]
Message-ID: <20180518085714.GE14500@ulmo> (raw)
In-Reply-To: <7c3a549b-ad84-5df6-c1d8-7683a3bc2f5d@gmail.com>

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

On Fri, May 18, 2018 at 11:05:58AM +0300, Dmitry Osipenko wrote:
> On 18.05.2018 04:58, Viresh Kumar wrote:
> > On 17-05-18, 21:00, Dmitry Osipenko wrote:
> >> Remove unused/unneeded headers and sort them in the alphabet order.
> >>
> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> >> ---
> >>  drivers/cpufreq/tegra20-cpufreq.c | 11 ++---------
> >>  1 file changed, 2 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cpufreq.c
> >> index 69f033d297e1..61f00d1cba26 100644
> >> --- a/drivers/cpufreq/tegra20-cpufreq.c
> >> +++ b/drivers/cpufreq/tegra20-cpufreq.c
> >> @@ -16,16 +16,9 @@
> >>   *
> >>   */
> >>  
> >> -#include <linux/kernel.h>
> >> -#include <linux/module.h>
> >> -#include <linux/types.h>
> >> -#include <linux/sched.h>
> >> -#include <linux/cpufreq.h>
> >> -#include <linux/delay.h>
> >> -#include <linux/init.h>
> >> -#include <linux/err.h>
> >>  #include <linux/clk.h>
> >> -#include <linux/io.h>
> >> +#include <linux/cpufreq.h>
> >> +#include <linux/module.h>
> > 
> > Ideally you should keep all the headers whose declarations your code
> > is using directly. It may happen that removing above still compiles
> > because cpufreq.h has included the headers indirectly for you. But
> > that will break the day cpufreq.h doesn't need those headers anymore.
> > 
> > So just make sure you aren't using any of them in your code. For
> > example you are using bool in your code and so you shouldn't remove
> > types.h ? Same for init.h as you are using __init and __exit.
> 
> The preference on includes seems to vary among maintainers. I've seen other
> opinion that encouraged to minimize included headers and only add the headers
> when compilation breaks.

I think this probably depends on the type of include. For headers in
include/linux the reasoning is that they can change often as part of
some rework and this has in the past caused unrelated files to break
builds because suddenly a file no longer has all required definitions
available.

It's slightly different for header files that have a narrower exposure
because the chances of breaking things randomly are much lower.

> I'll revisit this patch and keep init.h and others in v2 since you prefer that
> way. Thank you for the review.

With those changes, this is:

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-05-18  8:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 18:00 [PATCH v1 00/11] Clean up Tegra20 cpufreq driver Dmitry Osipenko
2018-05-17 18:00 ` [PATCH v1 01/11] cpufreq: tegra20: Change module description Dmitry Osipenko
2018-05-18  1:53   ` Viresh Kumar
2018-05-18  8:34   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 02/11] cpufreq: tegra20: Clean up whitespaces in the code Dmitry Osipenko
2018-05-18  1:54   ` Viresh Kumar
2018-05-18  8:34   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 03/11] cpufreq: tegra20: Remove EMC clock usage Dmitry Osipenko
2018-05-18  1:54   ` Viresh Kumar
2018-05-18  8:36   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 04/11] cpufreq: tegra20: Release clocks properly Dmitry Osipenko
2018-05-18  1:55   ` Viresh Kumar
2018-05-18  8:37   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 05/11] cpufreq: tegra20: Clean up included headers Dmitry Osipenko
2018-05-18  1:58   ` Viresh Kumar
2018-05-18  8:05     ` Dmitry Osipenko
2018-05-18  8:57       ` Thierry Reding [this message]
2018-05-17 18:00 ` [PATCH v1 06/11] cpufreq: tegra20: Remove unneeded check in tegra_cpu_init Dmitry Osipenko
2018-05-18  1:59   ` Viresh Kumar
2018-05-18  8:57   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 07/11] cpufreq: tegra20: Check if this is Tegra20 machine Dmitry Osipenko
2018-05-18  1:59   ` Viresh Kumar
2018-05-18  8:58   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 08/11] cpufreq: tegra20: Remove unneeded variable initialization Dmitry Osipenko
2018-05-18  2:00   ` Viresh Kumar
2018-05-18  8:58   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 09/11] cpufreq: tegra20: Allow cpufreq driver to be built as loadable module Dmitry Osipenko
2018-05-18  2:00   ` Viresh Kumar
2018-05-18  9:00   ` Thierry Reding
2018-05-17 18:00 ` [PATCH v1 10/11] cpufreq: tegra20: Wrap cpufreq into platform driver Dmitry Osipenko
2018-05-18  2:07   ` Viresh Kumar
2018-05-18  8:09     ` Dmitry Osipenko
2018-05-18  9:04       ` Viresh Kumar
2018-05-18  9:07   ` Thierry Reding
2018-05-18  9:19     ` Dmitry Osipenko
2018-05-17 18:00 ` [PATCH v1 11/11] ARM: tegra: Create platform device for tegra20-cpufreq driver Dmitry Osipenko
2018-05-18  2:07   ` Viresh Kumar
2018-05-18  9:13   ` Thierry Reding
2018-05-18  9:30     ` Dmitry Osipenko
2018-05-18  7:30 ` [PATCH v1 00/11] Clean up Tegra20 cpufreq driver Rafael J. Wysocki
2018-05-18  8:18   ` Dmitry Osipenko

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=20180518085714.GE14500@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=pgwipeout@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).