Commit 313162d0b83836e2f57e51b9b8650fb4b9c396ea
1 parent
51990e8254
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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 <paul.gortmaker@windriver.com>
Showing 53 changed files with 68 additions and 52 deletions Side-by-side Diff
- include/linux/amba/pl022.h
- include/linux/atmdev.h
- include/linux/attribute_container.h
- include/linux/c2port.h
- include/linux/cdrom.h
- include/linux/cpu.h
- include/linux/cpufreq.h
- include/linux/crash_dump.h
- include/linux/dma-buf.h
- include/linux/edac.h
- include/linux/fb.h
- include/linux/firewire.h
- include/linux/hwmon-sysfs.h
- include/linux/hwmon.h
- include/linux/hwspinlock.h
- include/linux/ide.h
- include/linux/ipmi.h
- include/linux/ipmi_smi.h
- include/linux/jz4740-adc.h
- include/linux/maple.h
- include/linux/mfd/abx500.h
- include/linux/mfd/abx500/ab5500.h
- include/linux/mfd/abx500/ab8500.h
- include/linux/mfd/pm8xxx/pm8921.h
- include/linux/mfd/stmpe.h
- include/linux/mfd/tc3589x.h
- include/linux/mlx4/driver.h
- include/linux/mmc/card.h
- include/linux/mmc/core.h
- include/linux/mmc/host.h
- include/linux/netdevice.h
- include/linux/of_device.h
- include/linux/opp.h
- include/linux/phy.h
- include/linux/pm_domain.h
- include/linux/power_supply.h
- include/linux/regmap.h
- include/linux/regulator/consumer.h
- include/linux/rfkill.h
- include/linux/rio_drv.h
- include/linux/serial_pnx8xxx.h
- include/linux/spi/mmc_spi.h
- include/linux/wimax/debug.h
- include/media/media-device.h
- include/media/v4l2-ctrls.h
- include/media/v4l2-ioctl.h
- include/net/mac80211.h
- include/scsi/scsi_device.h
- include/sound/core.h
- include/sound/soc-dapm.h
- include/trace/events/regmap.h
- include/trace/events/rpm.h
- include/trace/events/writeback.h
include/linux/amba/pl022.h
include/linux/atmdev.h
... | ... | @@ -213,7 +213,6 @@ |
213 | 213 | |
214 | 214 | #ifdef __KERNEL__ |
215 | 215 | |
216 | -#include <linux/device.h> | |
217 | 216 | #include <linux/wait.h> /* wait_queue_head_t */ |
218 | 217 | #include <linux/time.h> /* struct timeval */ |
219 | 218 | #include <linux/net.h> |
... | ... | @@ -249,6 +248,7 @@ |
249 | 248 | struct k_atm_aal_stats aal5; |
250 | 249 | }; |
251 | 250 | |
251 | +struct device; | |
252 | 252 | |
253 | 253 | enum { |
254 | 254 | ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared |
include/linux/attribute_container.h
include/linux/c2port.h
include/linux/cdrom.h
include/linux/cpu.h
... | ... | @@ -14,10 +14,11 @@ |
14 | 14 | #ifndef _LINUX_CPU_H_ |
15 | 15 | #define _LINUX_CPU_H_ |
16 | 16 | |
17 | -#include <linux/device.h> | |
18 | 17 | #include <linux/node.h> |
19 | 18 | #include <linux/compiler.h> |
20 | 19 | #include <linux/cpumask.h> |
20 | + | |
21 | +struct device; | |
21 | 22 | |
22 | 23 | struct cpu { |
23 | 24 | int node_id; /* The node which contains the CPU */ |
include/linux/cpufreq.h
include/linux/crash_dump.h
include/linux/dma-buf.h
... | ... | @@ -26,11 +26,11 @@ |
26 | 26 | |
27 | 27 | #include <linux/file.h> |
28 | 28 | #include <linux/err.h> |
29 | -#include <linux/device.h> | |
30 | 29 | #include <linux/scatterlist.h> |
31 | 30 | #include <linux/list.h> |
32 | 31 | #include <linux/dma-mapping.h> |
33 | 32 | |
33 | +struct device; | |
34 | 34 | struct dma_buf; |
35 | 35 | struct dma_buf_attachment; |
36 | 36 |
include/linux/edac.h
... | ... | @@ -13,7 +13,11 @@ |
13 | 13 | #define _LINUX_EDAC_H_ |
14 | 14 | |
15 | 15 | #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; | |
17 | 21 | |
18 | 22 | #define EDAC_OPSTATE_INVAL -1 |
19 | 23 | #define EDAC_OPSTATE_POLL 0 |
include/linux/fb.h
include/linux/firewire.h
... | ... | @@ -2,7 +2,6 @@ |
2 | 2 | #define _LINUX_FIREWIRE_H |
3 | 3 | |
4 | 4 | #include <linux/completion.h> |
5 | -#include <linux/device.h> | |
6 | 5 | #include <linux/dma-mapping.h> |
7 | 6 | #include <linux/kernel.h> |
8 | 7 | #include <linux/kref.h> |
... | ... | @@ -67,6 +66,8 @@ |
67 | 66 | #define CSR_DEPENDENT_INFO 0x14 |
68 | 67 | #define CSR_MODEL 0x17 |
69 | 68 | #define CSR_DIRECTORY_ID 0x20 |
69 | + | |
70 | +struct device; | |
70 | 71 | |
71 | 72 | struct fw_csr_iterator { |
72 | 73 | const u32 *p; |
include/linux/hwmon-sysfs.h
include/linux/hwmon.h
include/linux/hwspinlock.h
... | ... | @@ -20,12 +20,12 @@ |
20 | 20 | |
21 | 21 | #include <linux/err.h> |
22 | 22 | #include <linux/sched.h> |
23 | -#include <linux/device.h> | |
24 | 23 | |
25 | 24 | /* hwspinlock mode argument */ |
26 | 25 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ |
27 | 26 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ |
28 | 27 | |
28 | +struct device; | |
29 | 29 | struct hwspinlock; |
30 | 30 | struct hwspinlock_device; |
31 | 31 | struct hwspinlock_ops; |
include/linux/ide.h
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | #include <linux/interrupt.h> |
15 | 15 | #include <linux/bitops.h> |
16 | 16 | #include <linux/bio.h> |
17 | -#include <linux/device.h> | |
18 | 17 | #include <linux/pci.h> |
19 | 18 | #include <linux/completion.h> |
20 | 19 | #include <linux/pm.h> |
... | ... | @@ -42,6 +41,8 @@ |
42 | 41 | #define ERROR_MAX 8 /* Max read/write errors per sector */ |
43 | 42 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
44 | 43 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
44 | + | |
45 | +struct device; | |
45 | 46 | |
46 | 47 | /* Error codes returned in rq->errors to the higher part of the driver. */ |
47 | 48 | enum { |
include/linux/ipmi.h
... | ... | @@ -220,10 +220,10 @@ |
220 | 220 | * The in-kernel interface. |
221 | 221 | */ |
222 | 222 | #include <linux/list.h> |
223 | -#include <linux/device.h> | |
224 | 223 | #include <linux/proc_fs.h> |
225 | 224 | |
226 | 225 | struct module; |
226 | +struct device; | |
227 | 227 | |
228 | 228 | /* Opaque type for a IPMI message user. One of these is needed to |
229 | 229 | send and receive messages. */ |
include/linux/ipmi_smi.h
... | ... | @@ -36,9 +36,10 @@ |
36 | 36 | |
37 | 37 | #include <linux/ipmi_msgdefs.h> |
38 | 38 | #include <linux/proc_fs.h> |
39 | -#include <linux/device.h> | |
40 | 39 | #include <linux/platform_device.h> |
41 | 40 | #include <linux/ipmi.h> |
41 | + | |
42 | +struct device; | |
42 | 43 | |
43 | 44 | /* This files describes the interface for IPMI system management interface |
44 | 45 | drivers to bind into the IPMI message handler. */ |
include/linux/jz4740-adc.h
include/linux/maple.h
include/linux/mfd/abx500.h
include/linux/mfd/abx500/ab5500.h
include/linux/mfd/abx500/ab8500.h
include/linux/mfd/pm8xxx/pm8921.h
include/linux/mfd/stmpe.h
include/linux/mfd/tc3589x.h
include/linux/mlx4/driver.h
include/linux/mmc/card.h
include/linux/mmc/core.h
include/linux/mmc/host.h
include/linux/netdevice.h
... | ... | @@ -38,7 +38,6 @@ |
38 | 38 | #include <asm/cache.h> |
39 | 39 | #include <asm/byteorder.h> |
40 | 40 | |
41 | -#include <linux/device.h> | |
42 | 41 | #include <linux/percpu.h> |
43 | 42 | #include <linux/rculist.h> |
44 | 43 | #include <linux/dmaengine.h> |
... | ... | @@ -56,6 +55,7 @@ |
56 | 55 | #include <linux/netdev_features.h> |
57 | 56 | |
58 | 57 | struct netpoll_info; |
58 | +struct device; | |
59 | 59 | struct phy_device; |
60 | 60 | /* 802.11 specific */ |
61 | 61 | struct wireless_dev; |
include/linux/of_device.h
... | ... | @@ -5,9 +5,10 @@ |
5 | 5 | #include <linux/of_platform.h> /* temporary until merge */ |
6 | 6 | |
7 | 7 | #ifdef CONFIG_OF_DEVICE |
8 | -#include <linux/device.h> | |
9 | 8 | #include <linux/of.h> |
10 | 9 | #include <linux/mod_devicetable.h> |
10 | + | |
11 | +struct device; | |
11 | 12 | |
12 | 13 | extern const struct of_device_id *of_match_device( |
13 | 14 | const struct of_device_id *matches, const struct device *dev); |
include/linux/opp.h
include/linux/phy.h
... | ... | @@ -19,7 +19,6 @@ |
19 | 19 | #define __PHY_H |
20 | 20 | |
21 | 21 | #include <linux/spinlock.h> |
22 | -#include <linux/device.h> | |
23 | 22 | #include <linux/ethtool.h> |
24 | 23 | #include <linux/mii.h> |
25 | 24 | #include <linux/timer.h> |
... | ... | @@ -88,6 +87,9 @@ |
88 | 87 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ |
89 | 88 | #define MII_ADDR_C45 (1<<30) |
90 | 89 | |
90 | +struct device; | |
91 | +struct sk_buff; | |
92 | + | |
91 | 93 | /* |
92 | 94 | * The Bus class for PHYs. Devices which provide access to |
93 | 95 | * PHYs should register using this structure |
... | ... | @@ -241,7 +243,6 @@ |
241 | 243 | PHY_RESUMING |
242 | 244 | }; |
243 | 245 | |
244 | -struct sk_buff; | |
245 | 246 | |
246 | 247 | /* phy_device: An instance of a PHY |
247 | 248 | * |
include/linux/pm_domain.h
include/linux/power_supply.h
... | ... | @@ -13,9 +13,10 @@ |
13 | 13 | #ifndef __LINUX_POWER_SUPPLY_H__ |
14 | 14 | #define __LINUX_POWER_SUPPLY_H__ |
15 | 15 | |
16 | -#include <linux/device.h> | |
17 | 16 | #include <linux/workqueue.h> |
18 | 17 | #include <linux/leds.h> |
18 | + | |
19 | +struct device; | |
19 | 20 | |
20 | 21 | /* |
21 | 22 | * All voltages, currents, charges, energies, time and temperatures in uV, |
include/linux/regmap.h
include/linux/regulator/consumer.h
include/linux/rfkill.h
... | ... | @@ -117,10 +117,10 @@ |
117 | 117 | #include <linux/kernel.h> |
118 | 118 | #include <linux/list.h> |
119 | 119 | #include <linux/mutex.h> |
120 | -#include <linux/device.h> | |
121 | 120 | #include <linux/leds.h> |
122 | 121 | #include <linux/err.h> |
123 | 122 | |
123 | +struct device; | |
124 | 124 | /* this is opaque */ |
125 | 125 | struct rfkill; |
126 | 126 |
include/linux/rio_drv.h
include/linux/serial_pnx8xxx.h
include/linux/spi/mmc_spi.h
include/linux/wimax/debug.h
include/media/media-device.h
... | ... | @@ -23,13 +23,14 @@ |
23 | 23 | #ifndef _MEDIA_DEVICE_H |
24 | 24 | #define _MEDIA_DEVICE_H |
25 | 25 | |
26 | -#include <linux/device.h> | |
27 | 26 | #include <linux/list.h> |
28 | 27 | #include <linux/mutex.h> |
29 | 28 | #include <linux/spinlock.h> |
30 | 29 | |
31 | 30 | #include <media/media-devnode.h> |
32 | 31 | #include <media/media-entity.h> |
32 | + | |
33 | +struct device; | |
33 | 34 | |
34 | 35 | /** |
35 | 36 | * struct media_device - Media device |
include/media/v4l2-ctrls.h
include/media/v4l2-ioctl.h
include/net/mac80211.h
... | ... | @@ -16,7 +16,6 @@ |
16 | 16 | #include <linux/kernel.h> |
17 | 17 | #include <linux/if_ether.h> |
18 | 18 | #include <linux/skbuff.h> |
19 | -#include <linux/device.h> | |
20 | 19 | #include <linux/ieee80211.h> |
21 | 20 | #include <net/cfg80211.h> |
22 | 21 | #include <asm/unaligned.h> |
... | ... | @@ -86,6 +85,8 @@ |
86 | 85 | * All work performed on the mac80211 workqueue must not acquire the RTNL lock. |
87 | 86 | * |
88 | 87 | */ |
88 | + | |
89 | +struct device; | |
89 | 90 | |
90 | 91 | /** |
91 | 92 | * enum ieee80211_max_queues - maximum number of queues |
include/scsi/scsi_device.h
1 | 1 | #ifndef _SCSI_SCSI_DEVICE_H |
2 | 2 | #define _SCSI_SCSI_DEVICE_H |
3 | 3 | |
4 | -#include <linux/device.h> | |
5 | 4 | #include <linux/list.h> |
6 | 5 | #include <linux/spinlock.h> |
7 | 6 | #include <linux/workqueue.h> |
... | ... | @@ -9,6 +8,7 @@ |
9 | 8 | #include <scsi/scsi.h> |
10 | 9 | #include <linux/atomic.h> |
11 | 10 | |
11 | +struct device; | |
12 | 12 | struct request_queue; |
13 | 13 | struct scsi_cmnd; |
14 | 14 | struct scsi_lun; |
include/sound/core.h
... | ... | @@ -26,7 +26,6 @@ |
26 | 26 | #include <linux/mutex.h> /* struct mutex */ |
27 | 27 | #include <linux/rwsem.h> /* struct rw_semaphore */ |
28 | 28 | #include <linux/pm.h> /* pm_message_t */ |
29 | -#include <linux/device.h> | |
30 | 29 | #include <linux/stringify.h> |
31 | 30 | |
32 | 31 | /* number of supported soundcards */ |
33 | 32 | |
34 | 33 | |
... | ... | @@ -39,10 +38,10 @@ |
39 | 38 | #define CONFIG_SND_MAJOR 116 /* standard configuration */ |
40 | 39 | |
41 | 40 | /* forward declarations */ |
42 | -#ifdef CONFIG_PCI | |
43 | 41 | struct pci_dev; |
44 | -#endif | |
45 | 42 | struct module; |
43 | +struct device; | |
44 | +struct device_attribute; | |
46 | 45 | |
47 | 46 | /* device allocation stuff */ |
48 | 47 |
include/sound/soc-dapm.h
... | ... | @@ -13,9 +13,10 @@ |
13 | 13 | #ifndef __LINUX_SND_SOC_DAPM_H |
14 | 14 | #define __LINUX_SND_SOC_DAPM_H |
15 | 15 | |
16 | -#include <linux/device.h> | |
17 | 16 | #include <linux/types.h> |
18 | 17 | #include <sound/control.h> |
18 | + | |
19 | +struct device; | |
19 | 20 | |
20 | 21 | /* widget has no PM register bit */ |
21 | 22 | #define SND_SOC_NOPM -1 |
include/trace/events/regmap.h
include/trace/events/rpm.h