lkml.org 
[lkml]   [2021]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 2/3] hwmon: da9063: HWMON driver
Date
On 7/10/21 9:44 PM, Vincent Pelletier wrote:
> On Sun, 11 Jul 2021 02:55:02 +0000, Vincent Pelletier <plr.vincent@gmail.com> wrote:
>> On Sat, 10 Jul 2021 09:08:13 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
>>> Unnecessary include.
>> [...]
>>> I don't immediately see where this include is needed. Is this a
>>> leftover ?
>> [...]
>>> Same here.
>>
>> Are there ways to systematically tell which includes are useless
>> besides commenting them out all and uncommenting until it compiles ?
>> (if that is even a good idea)
>
> I tried this, just to get a baseline: the module compiles with just
> linux/hwmon.h
> linux/mfd/da9063/core.h
> linux/module.h
> linux/platform_device.h
> linux/regmap.h
>
> Beyond what you suggested this also gets rid of:
> - seems reasonable:
> - linux/delay.h
> - linux/init.h
> - linux/slab.h

... except that slab.h was probably originally included for kzalloc().
The driver now uses devm_kzalloc() which is defined in linux/device.h,
so you'll need to include that instead.

> - looks suspicious to me:
> - linux/err.h, which means the error constants are indirectly
> imported. Removing it feels brittle.

It also defines PTR_ERR_OR_ZERO(), so it is definitely needed.

Guenter

> - linux/kernel.h, although to my surprise a lot of c files do not
> include it.
>
> By default I'll drop the former and keep the latter in the
> next version, please let me know if another combination is preferred.
>

\
 
 \ /
  Last update: 2021-07-11 07:46    [W:0.060 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site