Commit 313162d0b83836e2f57e51b9b8650fb4b9c396ea

Authored by Paul Gortmaker
1 parent 51990e8254

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
... ... @@ -25,8 +25,6 @@
25 25 #ifndef _SSP_PL022_H
26 26 #define _SSP_PL022_H
27 27  
28   -#include <linux/device.h>
29   -
30 28 /**
31 29 * whether SSP is in loopback mode or not
32 30 */
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
... ... @@ -9,9 +9,10 @@
9 9 #ifndef _ATTRIBUTE_CONTAINER_H_
10 10 #define _ATTRIBUTE_CONTAINER_H_
11 11  
12   -#include <linux/device.h>
13 12 #include <linux/list.h>
14 13 #include <linux/klist.h>
  14 +
  15 +struct device;
15 16  
16 17 struct attribute_container {
17 18 struct list_head node;
include/linux/c2port.h
... ... @@ -9,10 +9,11 @@
9 9 * the Free Software Foundation
10 10 */
11 11  
12   -#include <linux/device.h>
13 12 #include <linux/kmemcheck.h>
14 13  
15 14 #define C2PORT_NAME_LEN 32
  15 +
  16 +struct device;
16 17  
17 18 /*
18 19 * C2 port basic structs
include/linux/cdrom.h
... ... @@ -910,7 +910,6 @@
910 910  
911 911 #ifdef __KERNEL__
912 912 #include <linux/fs.h> /* not really needed, later.. */
913   -#include <linux/device.h>
914 913 #include <linux/list.h>
915 914  
916 915 struct packet_command
... ... @@ -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
... ... @@ -14,7 +14,6 @@
14 14 #include <linux/mutex.h>
15 15 #include <linux/notifier.h>
16 16 #include <linux/threads.h>
17   -#include <linux/device.h>
18 17 #include <linux/kobject.h>
19 18 #include <linux/sysfs.h>
20 19 #include <linux/completion.h>
include/linux/crash_dump.h
... ... @@ -3,7 +3,6 @@
3 3  
4 4 #ifdef CONFIG_CRASH_DUMP
5 5 #include <linux/kexec.h>
6   -#include <linux/device.h>
7 6 #include <linux/proc_fs.h>
8 7 #include <linux/elf.h>
9 8  
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
... ... @@ -407,7 +407,6 @@
407 407  
408 408 #include <linux/fs.h>
409 409 #include <linux/init.h>
410   -#include <linux/device.h>
411 410 #include <linux/workqueue.h>
412 411 #include <linux/notifier.h>
413 412 #include <linux/list.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
... ... @@ -20,6 +20,8 @@
20 20 #ifndef _LINUX_HWMON_SYSFS_H
21 21 #define _LINUX_HWMON_SYSFS_H
22 22  
  23 +#include <linux/device.h>
  24 +
23 25 struct sensor_device_attribute{
24 26 struct device_attribute dev_attr;
25 27 int index;
include/linux/hwmon.h
... ... @@ -14,7 +14,7 @@
14 14 #ifndef _HWMON_H_
15 15 #define _HWMON_H_
16 16  
17   -#include <linux/device.h>
  17 +struct device;
18 18  
19 19 struct device *hwmon_device_register(struct device *dev);
20 20  
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;
... ... @@ -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
... ... @@ -2,7 +2,7 @@
2 2 #ifndef __LINUX_JZ4740_ADC
3 3 #define __LINUX_JZ4740_ADC
4 4  
5   -#include <linux/device.h>
  5 +struct device;
6 6  
7 7 /*
8 8 * jz4740_adc_set_config - Configure a JZ4740 adc device
include/linux/maple.h
1 1 #ifndef __LINUX_MAPLE_H
2 2 #define __LINUX_MAPLE_H
3 3  
4   -#include <linux/device.h>
5 4 #include <mach/maple.h>
6 5  
  6 +struct device;
7 7 extern struct bus_type maple_bus_type;
8 8  
9 9 /* Maple Bus command and response codes */
include/linux/mfd/abx500.h
... ... @@ -14,8 +14,9 @@
14 14 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
15 15 */
16 16  
17   -#include <linux/device.h>
18 17 #include <linux/regulator/machine.h>
  18 +
  19 +struct device;
19 20  
20 21 #ifndef MFD_ABX500_H
21 22 #define MFD_ABX500_H
include/linux/mfd/abx500/ab5500.h
... ... @@ -6,7 +6,7 @@
6 6 #ifndef MFD_AB5500_H
7 7 #define MFD_AB5500_H
8 8  
9   -#include <linux/device.h>
  9 +struct device;
10 10  
11 11 enum ab5500_devid {
12 12 AB5500_DEVID_ADC,
include/linux/mfd/abx500/ab8500.h
... ... @@ -7,7 +7,9 @@
7 7 #ifndef MFD_AB8500_H
8 8 #define MFD_AB8500_H
9 9  
10   -#include <linux/device.h>
  10 +#include <linux/mutex.h>
  11 +
  12 +struct device;
11 13  
12 14 /*
13 15 * AB8500 bank addresses
include/linux/mfd/pm8xxx/pm8921.h
... ... @@ -18,7 +18,6 @@
18 18 #ifndef __MFD_PM8921_H
19 19 #define __MFD_PM8921_H
20 20  
21   -#include <linux/device.h>
22 21 #include <linux/mfd/pm8xxx/irq.h>
23 22  
24 23 #define PM8921_NR_IRQS 256
include/linux/mfd/stmpe.h
... ... @@ -8,7 +8,9 @@
8 8 #ifndef __LINUX_MFD_STMPE_H
9 9 #define __LINUX_MFD_STMPE_H
10 10  
11   -#include <linux/device.h>
  11 +#include <linux/mutex.h>
  12 +
  13 +struct device;
12 14  
13 15 enum stmpe_block {
14 16 STMPE_BLOCK_GPIO = 1 << 0,
include/linux/mfd/tc3589x.h
... ... @@ -7,7 +7,7 @@
7 7 #ifndef __LINUX_MFD_TC3589x_H
8 8 #define __LINUX_MFD_TC3589x_H
9 9  
10   -#include <linux/device.h>
  10 +struct device;
11 11  
12 12 enum tx3589x_block {
13 13 TC3589x_BLOCK_GPIO = 1 << 0,
include/linux/mlx4/driver.h
... ... @@ -33,7 +33,6 @@
33 33 #ifndef MLX4_DRIVER_H
34 34 #define MLX4_DRIVER_H
35 35  
36   -#include <linux/device.h>
37 36 #include <linux/mlx4/device.h>
38 37  
39 38 struct mlx4_dev;
include/linux/mmc/card.h
... ... @@ -10,6 +10,7 @@
10 10 #ifndef LINUX_MMC_CARD_H
11 11 #define LINUX_MMC_CARD_H
12 12  
  13 +#include <linux/device.h>
13 14 #include <linux/mmc/core.h>
14 15 #include <linux/mod_devicetable.h>
15 16  
include/linux/mmc/core.h
... ... @@ -9,7 +9,7 @@
9 9 #define LINUX_MMC_CORE_H
10 10  
11 11 #include <linux/interrupt.h>
12   -#include <linux/device.h>
  12 +#include <linux/completion.h>
13 13  
14 14 struct request;
15 15 struct mmc_data;
include/linux/mmc/host.h
... ... @@ -12,6 +12,7 @@
12 12  
13 13 #include <linux/leds.h>
14 14 #include <linux/sched.h>
  15 +#include <linux/device.h>
15 16 #include <linux/fault-inject.h>
16 17  
17 18 #include <linux/mmc/core.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);
... ... @@ -19,6 +19,7 @@
19 19 #include <linux/notifier.h>
20 20  
21 21 struct opp;
  22 +struct device;
22 23  
23 24 enum opp_event {
24 25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
... ... @@ -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
... ... @@ -10,6 +10,8 @@
10 10 #define _LINUX_PM_DOMAIN_H
11 11  
12 12 #include <linux/device.h>
  13 +#include <linux/mutex.h>
  14 +#include <linux/pm.h>
13 15 #include <linux/err.h>
14 16  
15 17 enum gpd_status {
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
... ... @@ -13,10 +13,10 @@
13 13 * published by the Free Software Foundation.
14 14 */
15 15  
16   -#include <linux/device.h>
17 16 #include <linux/list.h>
18 17  
19 18 struct module;
  19 +struct device;
20 20 struct i2c_client;
21 21 struct spi_device;
22 22  
include/linux/regulator/consumer.h
... ... @@ -35,7 +35,8 @@
35 35 #ifndef __LINUX_REGULATOR_CONSUMER_H_
36 36 #define __LINUX_REGULATOR_CONSUMER_H_
37 37  
38   -#include <linux/device.h>
  38 +struct device;
  39 +struct notifier_block;
39 40  
40 41 /*
41 42 * Regulator operating modes.
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
... ... @@ -17,7 +17,6 @@
17 17 #include <linux/ioport.h>
18 18 #include <linux/list.h>
19 19 #include <linux/errno.h>
20   -#include <linux/device.h>
21 20 #include <linux/string.h>
22 21 #include <linux/rio.h>
23 22  
include/linux/serial_pnx8xxx.h
... ... @@ -20,7 +20,6 @@
20 20 #define _LINUX_SERIAL_PNX8XXX_H
21 21  
22 22 #include <linux/serial_core.h>
23   -#include <linux/device.h>
24 23  
25 24 #define PNX8XXX_NR_PORTS 2
26 25  
include/linux/spi/mmc_spi.h
1 1 #ifndef __LINUX_SPI_MMC_SPI_H
2 2 #define __LINUX_SPI_MMC_SPI_H
3 3  
4   -#include <linux/device.h>
5 4 #include <linux/spi/spi.h>
6 5 #include <linux/interrupt.h>
7 6  
  7 +struct device;
8 8 struct mmc_host;
9 9  
10 10 /* Put this in platform_data of a device being used to manage an MMC/SD
include/linux/wimax/debug.h
... ... @@ -154,9 +154,9 @@
154 154 #define __debug__h__
155 155  
156 156 #include <linux/types.h>
157   -#include <linux/device.h>
158 157 #include <linux/slab.h>
159 158  
  159 +struct device;
160 160  
161 161 /* Backend stuff */
162 162  
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
... ... @@ -22,7 +22,6 @@
22 22 #define _V4L2_CTRLS_H
23 23  
24 24 #include <linux/list.h>
25   -#include <linux/device.h>
26 25 #include <linux/videodev2.h>
27 26  
28 27 /* forward references */
include/media/v4l2-ioctl.h
... ... @@ -11,7 +11,6 @@
11 11  
12 12 #include <linux/poll.h>
13 13 #include <linux/fs.h>
14   -#include <linux/device.h>
15 14 #include <linux/mutex.h>
16 15 #include <linux/compiler.h> /* need __user */
17 16 #include <linux/videodev2.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
... ... @@ -4,10 +4,10 @@
4 4 #if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5 5 #define _TRACE_REGMAP_H
6 6  
7   -#include <linux/device.h>
8 7 #include <linux/ktime.h>
9 8 #include <linux/tracepoint.h>
10 9  
  10 +struct device;
11 11 struct regmap;
12 12  
13 13 /*
include/trace/events/rpm.h
... ... @@ -7,7 +7,8 @@
7 7  
8 8 #include <linux/ktime.h>
9 9 #include <linux/tracepoint.h>
10   -#include <linux/device.h>
  10 +
  11 +struct device;
11 12  
12 13 /*
13 14 * The rpm_internal events are used for tracing some important
include/trace/events/writeback.h
... ... @@ -5,7 +5,6 @@
5 5 #define _TRACE_WRITEBACK_H
6 6  
7 7 #include <linux/backing-dev.h>
8   -#include <linux/device.h>
9 8 #include <linux/writeback.h>
10 9  
11 10 #define show_inode_state(state) \