diff mbox series

[1/7] eeprom: at24: don't explicitely include header files which are implicitely included

Message ID 5fd1ad39-db94-e774-b77c-8081bfed7817@gmail.com
State Rejected
Delegated to: Bartosz Golaszewski
Headers show
Series eeprom: at24: series with smaller improvements | expand

Commit Message

Heiner Kallweit Nov. 30, 2017, 6:48 a.m. UTC
Don't explicitely include header files which are implicitely included.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/misc/eeprom/at24.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Peter Rosin Nov. 30, 2017, 3:56 p.m. UTC | #1
On 2017-11-30 07:48, Heiner Kallweit wrote:
> Don't explicitely include header files which are implicitely included.

That's backwards. It hinders future header rearrangement. Things that
are used directly (e.g. the BIT macro) should have its respective
include specified (bitops.h in that case).

It's not a competition for the shortest file, the goal is easy
maintenance.

Cheers,
Peter

> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/misc/eeprom/at24.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index cd87f1b21..c75bb9b45 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -10,15 +10,10 @@
>   * (at your option) any later version.
>   */
>  #include <linux/kernel.h>
> -#include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/of_device.h>
>  #include <linux/slab.h>
>  #include <linux/delay.h>
> -#include <linux/mutex.h>
> -#include <linux/mod_devicetable.h>
> -#include <linux/log2.h>
> -#include <linux/bitops.h>
>  #include <linux/jiffies.h>
>  #include <linux/property.h>
>  #include <linux/acpi.h>
>
Heiner Kallweit Nov. 30, 2017, 7:32 p.m. UTC | #2
Am 30.11.2017 um 16:56 schrieb Peter Rosin:
> On 2017-11-30 07:48, Heiner Kallweit wrote:
>> Don't explicitely include header files which are implicitely included.
> 
> That's backwards. It hinders future header rearrangement. Things that
> are used directly (e.g. the BIT macro) should have its respective
> include specified (bitops.h in that case).
> 
> It's not a competition for the shortest file, the goal is easy
> maintenance.
> 
Understood ..

@Bartosz: then you can ignore this one.

Rgds, Heiner


> Cheers,
> Peter
> 
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/misc/eeprom/at24.c | 5 -----
>>  1 file changed, 5 deletions(-)
>>
>> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
>> index cd87f1b21..c75bb9b45 100644
>> --- a/drivers/misc/eeprom/at24.c
>> +++ b/drivers/misc/eeprom/at24.c
>> @@ -10,15 +10,10 @@
>>   * (at your option) any later version.
>>   */
>>  #include <linux/kernel.h>
>> -#include <linux/init.h>
>>  #include <linux/module.h>
>>  #include <linux/of_device.h>
>>  #include <linux/slab.h>
>>  #include <linux/delay.h>
>> -#include <linux/mutex.h>
>> -#include <linux/mod_devicetable.h>
>> -#include <linux/log2.h>
>> -#include <linux/bitops.h>
>>  #include <linux/jiffies.h>
>>  #include <linux/property.h>
>>  #include <linux/acpi.h>
>>
> 
>
Bartosz Golaszewski Dec. 1, 2017, 10:09 a.m. UTC | #3
2017-11-30 20:32 GMT+01:00 Heiner Kallweit <hkallweit1@gmail.com>:
> Am 30.11.2017 um 16:56 schrieb Peter Rosin:
>> On 2017-11-30 07:48, Heiner Kallweit wrote:
>>> Don't explicitely include header files which are implicitely included.
>>
>> That's backwards. It hinders future header rearrangement. Things that
>> are used directly (e.g. the BIT macro) should have its respective
>> include specified (bitops.h in that case).
>>
>> It's not a competition for the shortest file, the goal is easy
>> maintenance.
>>
> Understood ..
>
> @Bartosz: then you can ignore this one.
>
> Rgds, Heiner
>
>
>> Cheers,
>> Peter
>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> ---
>>>  drivers/misc/eeprom/at24.c | 5 -----
>>>  1 file changed, 5 deletions(-)
>>>
>>> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
>>> index cd87f1b21..c75bb9b45 100644
>>> --- a/drivers/misc/eeprom/at24.c
>>> +++ b/drivers/misc/eeprom/at24.c
>>> @@ -10,15 +10,10 @@
>>>   * (at your option) any later version.
>>>   */
>>>  #include <linux/kernel.h>
>>> -#include <linux/init.h>
>>>  #include <linux/module.h>
>>>  #include <linux/of_device.h>
>>>  #include <linux/slab.h>
>>>  #include <linux/delay.h>
>>> -#include <linux/mutex.h>
>>> -#include <linux/mod_devicetable.h>
>>> -#include <linux/log2.h>
>>> -#include <linux/bitops.h>
>>>  #include <linux/jiffies.h>
>>>  #include <linux/property.h>
>>>  #include <linux/acpi.h>
>>>
>>
>>
>

Yep, whenever we use anything from some header, we want to have it
included directly. Otherwise any rearrangement would cause us pain.

Thanks,
Bartosz
diff mbox series

Patch

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index cd87f1b21..c75bb9b45 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -10,15 +10,10 @@ 
  * (at your option) any later version.
  */
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
-#include <linux/mutex.h>
-#include <linux/mod_devicetable.h>
-#include <linux/log2.h>
-#include <linux/bitops.h>
 #include <linux/jiffies.h>
 #include <linux/property.h>
 #include <linux/acpi.h>