Skip to content

Commit 313162d

Browse files
author
Paul Gortmaker
committed
device.h: audit and cleanup users in main include dir
The <linux/device.h> header includes a lot of stuff, and it in turn gets a lot of use just for the basic "struct device" which appears so often. Clean up the users as follows: 1) For those headers only needing "struct device" as a pointer in fcn args, replace the include with exactly that. 2) For headers not really using anything from device.h, simply delete the include altogether. 3) For headers relying on getting device.h implicitly before being included themselves, now explicitly include device.h 4) For files in which doing #1 or #2 uncovers an implicit dependency on some other header, fix by explicitly adding the required header(s). Any C files that were implicitly relying on device.h to be present have already been dealt with in advance. Total removals from #1 and #2: 51. Total additions coming from #3: 9. Total other implicit dependencies from #4: 7. As of 3.3-rc1, there were 110, so a net removal of 42 gives about a 38% reduction in device.h presence in include/* Signed-off-by: Paul Gortmaker <[email protected]>
1 parent 51990e8 commit 313162d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+68
-52
lines changed

include/linux/amba/pl022.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#ifndef _SSP_PL022_H
2626
#define _SSP_PL022_H
2727

28-
#include <linux/device.h>
29-
3028
/**
3129
* whether SSP is in loopback mode or not
3230
*/

include/linux/atmdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ struct atm_cirange {
213213

214214
#ifdef __KERNEL__
215215

216-
#include <linux/device.h>
217216
#include <linux/wait.h> /* wait_queue_head_t */
218217
#include <linux/time.h> /* struct timeval */
219218
#include <linux/net.h>
@@ -249,6 +248,7 @@ struct k_atm_dev_stats {
249248
struct k_atm_aal_stats aal5;
250249
};
251250

251+
struct device;
252252

253253
enum {
254254
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared

include/linux/attribute_container.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
#ifndef _ATTRIBUTE_CONTAINER_H_
1010
#define _ATTRIBUTE_CONTAINER_H_
1111

12-
#include <linux/device.h>
1312
#include <linux/list.h>
1413
#include <linux/klist.h>
1514

15+
struct device;
16+
1617
struct attribute_container {
1718
struct list_head node;
1819
struct klist containers;

include/linux/c2port.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
* the Free Software Foundation
1010
*/
1111

12-
#include <linux/device.h>
1312
#include <linux/kmemcheck.h>
1413

1514
#define C2PORT_NAME_LEN 32
1615

16+
struct device;
17+
1718
/*
1819
* C2 port basic structs
1920
*/

include/linux/cdrom.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,6 @@ struct mode_page_header {
910910

911911
#ifdef __KERNEL__
912912
#include <linux/fs.h> /* not really needed, later.. */
913-
#include <linux/device.h>
914913
#include <linux/list.h>
915914

916915
struct packet_command

include/linux/cpu.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
#ifndef _LINUX_CPU_H_
1515
#define _LINUX_CPU_H_
1616

17-
#include <linux/device.h>
1817
#include <linux/node.h>
1918
#include <linux/compiler.h>
2019
#include <linux/cpumask.h>
2120

21+
struct device;
22+
2223
struct cpu {
2324
int node_id; /* The node which contains the CPU */
2425
int hotpluggable; /* creates sysfs control file if hotpluggable */

include/linux/cpufreq.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/mutex.h>
1515
#include <linux/notifier.h>
1616
#include <linux/threads.h>
17-
#include <linux/device.h>
1817
#include <linux/kobject.h>
1918
#include <linux/sysfs.h>
2019
#include <linux/completion.h>

include/linux/crash_dump.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#ifdef CONFIG_CRASH_DUMP
55
#include <linux/kexec.h>
6-
#include <linux/device.h>
76
#include <linux/proc_fs.h>
87
#include <linux/elf.h>
98

include/linux/dma-buf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626

2727
#include <linux/file.h>
2828
#include <linux/err.h>
29-
#include <linux/device.h>
3029
#include <linux/scatterlist.h>
3130
#include <linux/list.h>
3231
#include <linux/dma-mapping.h>
3332

33+
struct device;
3434
struct dma_buf;
3535
struct dma_buf_attachment;
3636

include/linux/edac.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#define _LINUX_EDAC_H_
1414

1515
#include <linux/atomic.h>
16-
#include <linux/device.h>
16+
#include <linux/kobject.h>
17+
#include <linux/completion.h>
18+
#include <linux/workqueue.h>
19+
20+
struct device;
1721

1822
#define EDAC_OPSTATE_INVAL -1
1923
#define EDAC_OPSTATE_POLL 0

include/linux/fb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ struct fb_cursor {
407407

408408
#include <linux/fs.h>
409409
#include <linux/init.h>
410-
#include <linux/device.h>
411410
#include <linux/workqueue.h>
412411
#include <linux/notifier.h>
413412
#include <linux/list.h>

include/linux/firewire.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define _LINUX_FIREWIRE_H
33

44
#include <linux/completion.h>
5-
#include <linux/device.h>
65
#include <linux/dma-mapping.h>
76
#include <linux/kernel.h>
87
#include <linux/kref.h>
@@ -68,6 +67,8 @@
6867
#define CSR_MODEL 0x17
6968
#define CSR_DIRECTORY_ID 0x20
7069

70+
struct device;
71+
7172
struct fw_csr_iterator {
7273
const u32 *p;
7374
const u32 *end;

include/linux/hwmon-sysfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#ifndef _LINUX_HWMON_SYSFS_H
2121
#define _LINUX_HWMON_SYSFS_H
2222

23+
#include <linux/device.h>
24+
2325
struct sensor_device_attribute{
2426
struct device_attribute dev_attr;
2527
int index;

include/linux/hwmon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#ifndef _HWMON_H_
1515
#define _HWMON_H_
1616

17-
#include <linux/device.h>
17+
struct device;
1818

1919
struct device *hwmon_device_register(struct device *dev);
2020

include/linux/hwspinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
#include <linux/err.h>
2222
#include <linux/sched.h>
23-
#include <linux/device.h>
2423

2524
/* hwspinlock mode argument */
2625
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
2726
#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
2827

28+
struct device;
2929
struct hwspinlock;
3030
struct hwspinlock_device;
3131
struct hwspinlock_ops;

include/linux/ide.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/bitops.h>
1616
#include <linux/bio.h>
17-
#include <linux/device.h>
1817
#include <linux/pci.h>
1918
#include <linux/completion.h>
2019
#include <linux/pm.h>
@@ -43,6 +42,8 @@
4342
#define ERROR_RESET 3 /* Reset controller every 4th retry */
4443
#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
4544

45+
struct device;
46+
4647
/* Error codes returned in rq->errors to the higher part of the driver. */
4748
enum {
4849
IDE_DRV_ERROR_GENERAL = 101,

include/linux/ipmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ struct kernel_ipmi_msg {
220220
* The in-kernel interface.
221221
*/
222222
#include <linux/list.h>
223-
#include <linux/device.h>
224223
#include <linux/proc_fs.h>
225224

226225
struct module;
226+
struct device;
227227

228228
/* Opaque type for a IPMI message user. One of these is needed to
229229
send and receive messages. */

include/linux/ipmi_smi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@
3636

3737
#include <linux/ipmi_msgdefs.h>
3838
#include <linux/proc_fs.h>
39-
#include <linux/device.h>
4039
#include <linux/platform_device.h>
4140
#include <linux/ipmi.h>
4241

42+
struct device;
43+
4344
/* This files describes the interface for IPMI system management interface
4445
drivers to bind into the IPMI message handler. */
4546

include/linux/jz4740-adc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef __LINUX_JZ4740_ADC
33
#define __LINUX_JZ4740_ADC
44

5-
#include <linux/device.h>
5+
struct device;
66

77
/*
88
* jz4740_adc_set_config - Configure a JZ4740 adc device

include/linux/maple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef __LINUX_MAPLE_H
22
#define __LINUX_MAPLE_H
33

4-
#include <linux/device.h>
54
#include <mach/maple.h>
65

6+
struct device;
77
extern struct bus_type maple_bus_type;
88

99
/* Maple Bus command and response codes */

include/linux/mfd/abx500.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
* Author: Rickard Andersson <[email protected]>
1515
*/
1616

17-
#include <linux/device.h>
1817
#include <linux/regulator/machine.h>
1918

19+
struct device;
20+
2021
#ifndef MFD_ABX500_H
2122
#define MFD_ABX500_H
2223

include/linux/mfd/abx500/ab5500.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef MFD_AB5500_H
77
#define MFD_AB5500_H
88

9-
#include <linux/device.h>
9+
struct device;
1010

1111
enum ab5500_devid {
1212
AB5500_DEVID_ADC,

include/linux/mfd/abx500/ab8500.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#ifndef MFD_AB8500_H
88
#define MFD_AB8500_H
99

10-
#include <linux/device.h>
10+
#include <linux/mutex.h>
11+
12+
struct device;
1113

1214
/*
1315
* AB8500 bank addresses

include/linux/mfd/pm8xxx/pm8921.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#ifndef __MFD_PM8921_H
1919
#define __MFD_PM8921_H
2020

21-
#include <linux/device.h>
2221
#include <linux/mfd/pm8xxx/irq.h>
2322

2423
#define PM8921_NR_IRQS 256

include/linux/mfd/stmpe.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#ifndef __LINUX_MFD_STMPE_H
99
#define __LINUX_MFD_STMPE_H
1010

11-
#include <linux/device.h>
11+
#include <linux/mutex.h>
12+
13+
struct device;
1214

1315
enum stmpe_block {
1416
STMPE_BLOCK_GPIO = 1 << 0,

include/linux/mfd/tc3589x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ifndef __LINUX_MFD_TC3589x_H
88
#define __LINUX_MFD_TC3589x_H
99

10-
#include <linux/device.h>
10+
struct device;
1111

1212
enum tx3589x_block {
1313
TC3589x_BLOCK_GPIO = 1 << 0,

include/linux/mlx4/driver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#ifndef MLX4_DRIVER_H
3434
#define MLX4_DRIVER_H
3535

36-
#include <linux/device.h>
3736
#include <linux/mlx4/device.h>
3837

3938
struct mlx4_dev;

include/linux/mmc/card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef LINUX_MMC_CARD_H
1111
#define LINUX_MMC_CARD_H
1212

13+
#include <linux/device.h>
1314
#include <linux/mmc/core.h>
1415
#include <linux/mod_devicetable.h>
1516

include/linux/mmc/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define LINUX_MMC_CORE_H
1010

1111
#include <linux/interrupt.h>
12-
#include <linux/device.h>
12+
#include <linux/completion.h>
1313

1414
struct request;
1515
struct mmc_data;

include/linux/mmc/host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/leds.h>
1414
#include <linux/sched.h>
15+
#include <linux/device.h>
1516
#include <linux/fault-inject.h>
1617

1718
#include <linux/mmc/core.h>

include/linux/netdevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <asm/cache.h>
3939
#include <asm/byteorder.h>
4040

41-
#include <linux/device.h>
4241
#include <linux/percpu.h>
4342
#include <linux/rculist.h>
4443
#include <linux/dmaengine.h>
@@ -56,6 +55,7 @@
5655
#include <linux/netdev_features.h>
5756

5857
struct netpoll_info;
58+
struct device;
5959
struct phy_device;
6060
/* 802.11 specific */
6161
struct wireless_dev;

include/linux/of_device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
#include <linux/of_platform.h> /* temporary until merge */
66

77
#ifdef CONFIG_OF_DEVICE
8-
#include <linux/device.h>
98
#include <linux/of.h>
109
#include <linux/mod_devicetable.h>
1110

11+
struct device;
12+
1213
extern const struct of_device_id *of_match_device(
1314
const struct of_device_id *matches, const struct device *dev);
1415
extern void of_device_make_bus_id(struct device *dev);

include/linux/opp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/notifier.h>
2020

2121
struct opp;
22+
struct device;
2223

2324
enum opp_event {
2425
OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,

include/linux/phy.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#define __PHY_H
2020

2121
#include <linux/spinlock.h>
22-
#include <linux/device.h>
2322
#include <linux/ethtool.h>
2423
#include <linux/mii.h>
2524
#include <linux/timer.h>
@@ -88,6 +87,9 @@ typedef enum {
8887
IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
8988
#define MII_ADDR_C45 (1<<30)
9089

90+
struct device;
91+
struct sk_buff;
92+
9193
/*
9294
* The Bus class for PHYs. Devices which provide access to
9395
* PHYs should register using this structure
@@ -241,7 +243,6 @@ enum phy_state {
241243
PHY_RESUMING
242244
};
243245

244-
struct sk_buff;
245246

246247
/* phy_device: An instance of a PHY
247248
*

include/linux/pm_domain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#define _LINUX_PM_DOMAIN_H
1111

1212
#include <linux/device.h>
13+
#include <linux/mutex.h>
14+
#include <linux/pm.h>
1315
#include <linux/err.h>
1416

1517
enum gpd_status {

0 commit comments

Comments
 (0)