Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+68 -52
-2
include/linux/amba/pl022.h
··· 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 */
+1 -1
include/linux/atmdev.h
··· 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> ··· 248 249 struct k_atm_aal_stats aal5; 249 250 }; 250 251 252 + struct device; 251 253 252 254 enum { 253 255 ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
+2 -1
include/linux/attribute_container.h
··· 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;
+2 -1
include/linux/c2port.h
··· 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
-1
include/linux/cdrom.h
··· 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
+2 -1
include/linux/cpu.h
··· 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 */
-1
include/linux/cpufreq.h
··· 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>
-1
include/linux/crash_dump.h
··· 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
+1 -1
include/linux/dma-buf.h
··· 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
+5 -1
include/linux/edac.h
··· 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
-1
include/linux/fb.h
··· 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>
+2 -1
include/linux/firewire.h
··· 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> ··· 66 67 #define CSR_DEPENDENT_INFO 0x14 67 68 #define CSR_MODEL 0x17 68 69 #define CSR_DIRECTORY_ID 0x20 70 + 71 + struct device; 69 72 70 73 struct fw_csr_iterator { 71 74 const u32 *p;
+2
include/linux/hwmon-sysfs.h
··· 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;
+1 -1
include/linux/hwmon.h
··· 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
+1 -1
include/linux/hwspinlock.h
··· 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;
+2 -1
include/linux/ide.h
··· 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> ··· 41 42 #define ERROR_MAX 8 /* Max read/write errors per sector */ 42 43 #define ERROR_RESET 3 /* Reset controller every 4th retry */ 43 44 #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 45 + 46 + struct device; 44 47 45 48 /* Error codes returned in rq->errors to the higher part of the driver. */ 46 49 enum {
+1 -1
include/linux/ipmi.h
··· 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. */
+2 -1
include/linux/ipmi_smi.h
··· 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. */
+1 -1
include/linux/jz4740-adc.h
··· 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
+1 -1
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 */
+2 -1
include/linux/mfd/abx500.h
··· 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
+1 -1
include/linux/mfd/abx500/ab5500.h
··· 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,
+3 -1
include/linux/mfd/abx500/ab8500.h
··· 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
-1
include/linux/mfd/pm8xxx/pm8921.h
··· 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
+3 -1
include/linux/mfd/stmpe.h
··· 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,
+1 -1
include/linux/mfd/tc3589x.h
··· 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,
-1
include/linux/mlx4/driver.h
··· 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;
+1
include/linux/mmc/card.h
··· 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
+1 -1
include/linux/mmc/core.h
··· 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;
+1
include/linux/mmc/host.h
··· 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>
+1 -1
include/linux/netdevice.h
··· 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> ··· 55 56 #include <linux/netdev_features.h> 56 57 57 58 struct netpoll_info; 59 + struct device; 58 60 struct phy_device; 59 61 /* 802.11 specific */ 60 62 struct wireless_dev;
+2 -1
include/linux/of_device.h
··· 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);
+1
include/linux/opp.h
··· 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,
+3 -2
include/linux/phy.h
··· 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> ··· 86 87 /* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit 87 88 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ 88 89 #define MII_ADDR_C45 (1<<30) 90 + 91 + struct device; 92 + struct sk_buff; 89 93 90 94 /* 91 95 * The Bus class for PHYs. Devices which provide access to ··· 243 241 PHY_RESUMING 244 242 }; 245 243 246 - struct sk_buff; 247 244 248 245 /* phy_device: An instance of a PHY 249 246 *
+2
include/linux/pm_domain.h
··· 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 {
+2 -1
include/linux/power_supply.h
··· 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,
+1 -1
include/linux/regmap.h
··· 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
+2 -1
include/linux/regulator/consumer.h
··· 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.
+1 -1
include/linux/rfkill.h
··· 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
-1
include/linux/rio_drv.h
··· 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
-1
include/linux/serial_pnx8xxx.h
··· 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
+1 -1
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
+1 -1
include/linux/wimax/debug.h
··· 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
+2 -1
include/media/media-device.h
··· 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
-1
include/media/v4l2-ctrls.h
··· 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 */
-1
include/media/v4l2-ioctl.h
··· 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>
+2 -1
include/net/mac80211.h
··· 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> ··· 85 86 * All work performed on the mac80211 workqueue must not acquire the RTNL lock. 86 87 * 87 88 */ 89 + 90 + struct device; 88 91 89 92 /** 90 93 * enum ieee80211_max_queues - maximum number of queues
+1 -1
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> ··· 8 9 #include <scsi/scsi.h> 9 10 #include <linux/atomic.h> 10 11 12 + struct device; 11 13 struct request_queue; 12 14 struct scsi_cmnd; 13 15 struct scsi_lun;
+2 -3
include/sound/core.h
··· 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 */ ··· 38 39 #define CONFIG_SND_MAJOR 116 /* standard configuration */ 39 40 40 41 /* forward declarations */ 41 - #ifdef CONFIG_PCI 42 42 struct pci_dev; 43 - #endif 44 43 struct module; 44 + struct device; 45 + struct device_attribute; 45 46 46 47 /* device allocation stuff */ 47 48
+2 -1
include/sound/soc-dapm.h
··· 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
+1 -1
include/trace/events/regmap.h
··· 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 /*
+2 -1
include/trace/events/rpm.h
··· 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
-1
include/trace/events/writeback.h
··· 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) \