On 04/15, Alexey Brodkin wrote:
> Hi Stephen,
> 
> On Mon, 2016-04-11 at 15:03 -0700, sb...@codeaurora.org wrote:
> > On 04/11, Alexey Brodkin wrote:
> > > 
> > > On Mon, 2016-04-11 at 11:41 +0100, Jose Abreu wrote:
> > > > 
> > > > + * warranty of any kind, whether express or implied.
> > > > + */
> > > > +
> > > > +#include <linux/platform_device.h>
> > > > +#include <linux/module.h>
> > > > +#include <linux/clk-provider.h>
> > > > +#include <linux/err.h>
> > > > +#include <linux/device.h>
> > > "linux/platform_device.h" includes "linux/device.h" so you may make this 
> > > list of headers
> > > a little bit shorter.
> > > 
> > > > 
> > > > +#include <linux/of_address.h>
> > > > +#include <linux/slab.h>
> > > > +#include <linux/of.h>
> > > "linux/of_address.h" already includes "linux/of.h".
> > It's ok to include things twice. In fact, its better to avoid any
> > implicit includes so that if we ever want to remove includes from
> > other headers we can do so without disturbing this driver.
> 
> IMHO approach with minimal amount of headers is nice just because
> it's easier to check if everything is in place. I mean attempt to compile
> will immediately reveal a missing header.
> 
> So that's what I do - I remove as many inclusions as I may until stuff 
> compiles.

Please don't. People try to break header includes cycles by
moving things in one header to another header, and then those
changes may need to fix random drivers because they are now
missing an implicit include they were relying on, etc.

> 
> But with approach of explicit inclusion it's much easier to include
> much more headers than really needed. The only way to figure out if header is 
> really
> required is to manually check all used functions in the current source
> which is way too unreliable and probably nobody will do it ever anyways.
> And that's how we'll get more stale and pointless inclusions.

Sounds like a job for a script!

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

Reply via email to