Commit 313162d0 authored by Paul Gortmaker's avatar Paul Gortmaker

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: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 51990e82
......@@ -25,8 +25,6 @@
#ifndef _SSP_PL022_H
#define _SSP_PL022_H
#include <linux/device.h>
/**
* whether SSP is in loopback mode or not
*/
......
......@@ -213,7 +213,6 @@ struct atm_cirange {
#ifdef __KERNEL__
#include <linux/device.h>
#include <linux/wait.h> /* wait_queue_head_t */
#include <linux/time.h> /* struct timeval */
#include <linux/net.h>
......@@ -249,6 +248,7 @@ struct k_atm_dev_stats {
struct k_atm_aal_stats aal5;
};
struct device;
enum {
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
......
......@@ -9,10 +9,11 @@
#ifndef _ATTRIBUTE_CONTAINER_H_
#define _ATTRIBUTE_CONTAINER_H_
#include <linux/device.h>
#include <linux/list.h>
#include <linux/klist.h>
struct device;
struct attribute_container {
struct list_head node;
struct klist containers;
......
......@@ -9,11 +9,12 @@
* the Free Software Foundation
*/
#include <linux/device.h>
#include <linux/kmemcheck.h>
#define C2PORT_NAME_LEN 32
struct device;
/*
* C2 port basic structs
*/
......
......@@ -910,7 +910,6 @@ struct mode_page_header {
#ifdef __KERNEL__
#include <linux/fs.h> /* not really needed, later.. */
#include <linux/device.h>
#include <linux/list.h>
struct packet_command
......
......@@ -14,11 +14,12 @@
#ifndef _LINUX_CPU_H_
#define _LINUX_CPU_H_
#include <linux/device.h>
#include <linux/node.h>
#include <linux/compiler.h>
#include <linux/cpumask.h>
struct device;
struct cpu {
int node_id; /* The node which contains the CPU */
int hotpluggable; /* creates sysfs control file if hotpluggable */
......
......@@ -14,7 +14,6 @@
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/threads.h>
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/completion.h>
......
......@@ -3,7 +3,6 @@
#ifdef CONFIG_CRASH_DUMP
#include <linux/kexec.h>
#include <linux/device.h>
#include <linux/proc_fs.h>
#include <linux/elf.h>
......
......@@ -26,11 +26,11 @@
#include <linux/file.h>
#include <linux/err.h>
#include <linux/device.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
#include <linux/dma-mapping.h>
struct device;
struct dma_buf;
struct dma_buf_attachment;
......
......@@ -13,7 +13,11 @@
#define _LINUX_EDAC_H_
#include <linux/atomic.h>
#include <linux/device.h>
#include <linux/kobject.h>
#include <linux/completion.h>
#include <linux/workqueue.h>
struct device;
#define EDAC_OPSTATE_INVAL -1
#define EDAC_OPSTATE_POLL 0
......
......@@ -407,7 +407,6 @@ struct fb_cursor {
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/notifier.h>
#include <linux/list.h>
......
......@@ -2,7 +2,6 @@
#define _LINUX_FIREWIRE_H
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h>
#include <linux/kref.h>
......@@ -68,6 +67,8 @@
#define CSR_MODEL 0x17
#define CSR_DIRECTORY_ID 0x20
struct device;
struct fw_csr_iterator {
const u32 *p;
const u32 *end;
......
......@@ -20,6 +20,8 @@
#ifndef _LINUX_HWMON_SYSFS_H
#define _LINUX_HWMON_SYSFS_H
#include <linux/device.h>
struct sensor_device_attribute{
struct device_attribute dev_attr;
int index;
......
......@@ -14,7 +14,7 @@
#ifndef _HWMON_H_
#define _HWMON_H_
#include <linux/device.h>
struct device;
struct device *hwmon_device_register(struct device *dev);
......
......@@ -20,12 +20,12 @@
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/device.h>
/* hwspinlock mode argument */
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
struct device;
struct hwspinlock;
struct hwspinlock_device;
struct hwspinlock_ops;
......
......@@ -14,7 +14,6 @@
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/bio.h>
#include <linux/device.h>
#include <linux/pci.h>
#include <linux/completion.h>
#include <linux/pm.h>
......@@ -43,6 +42,8 @@
#define ERROR_RESET 3 /* Reset controller every 4th retry */
#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
struct device;
/* Error codes returned in rq->errors to the higher part of the driver. */
enum {
IDE_DRV_ERROR_GENERAL = 101,
......
......@@ -220,10 +220,10 @@ struct kernel_ipmi_msg {
* The in-kernel interface.
*/
#include <linux/list.h>
#include <linux/device.h>
#include <linux/proc_fs.h>
struct module;
struct device;
/* Opaque type for a IPMI message user. One of these is needed to
send and receive messages. */
......
......@@ -36,10 +36,11 @@
#include <linux/ipmi_msgdefs.h>
#include <linux/proc_fs.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/ipmi.h>
struct device;
/* This files describes the interface for IPMI system management interface
drivers to bind into the IPMI message handler. */
......
......@@ -2,7 +2,7 @@
#ifndef __LINUX_JZ4740_ADC
#define __LINUX_JZ4740_ADC
#include <linux/device.h>
struct device;
/*
* jz4740_adc_set_config - Configure a JZ4740 adc device
......
#ifndef __LINUX_MAPLE_H
#define __LINUX_MAPLE_H
#include <linux/device.h>
#include <mach/maple.h>
struct device;
extern struct bus_type maple_bus_type;
/* Maple Bus command and response codes */
......
......@@ -14,9 +14,10 @@
* Author: Rickard Andersson <rickard.andersson@stericsson.com>
*/
#include <linux/device.h>
#include <linux/regulator/machine.h>
struct device;
#ifndef MFD_ABX500_H
#define MFD_ABX500_H
......
......@@ -6,7 +6,7 @@
#ifndef MFD_AB5500_H
#define MFD_AB5500_H
#include <linux/device.h>
struct device;
enum ab5500_devid {
AB5500_DEVID_ADC,
......
......@@ -7,7 +7,9 @@
#ifndef MFD_AB8500_H
#define MFD_AB8500_H
#include <linux/device.h>
#include <linux/mutex.h>
struct device;
/*
* AB8500 bank addresses
......
......@@ -18,7 +18,6 @@
#ifndef __MFD_PM8921_H
#define __MFD_PM8921_H
#include <linux/device.h>
#include <linux/mfd/pm8xxx/irq.h>
#define PM8921_NR_IRQS 256
......
......@@ -8,7 +8,9 @@
#ifndef __LINUX_MFD_STMPE_H
#define __LINUX_MFD_STMPE_H
#include <linux/device.h>
#include <linux/mutex.h>
struct device;
enum stmpe_block {
STMPE_BLOCK_GPIO = 1 << 0,
......
......@@ -7,7 +7,7 @@
#ifndef __LINUX_MFD_TC3589x_H
#define __LINUX_MFD_TC3589x_H
#include <linux/device.h>
struct device;
enum tx3589x_block {
TC3589x_BLOCK_GPIO = 1 << 0,
......
......@@ -33,7 +33,6 @@
#ifndef MLX4_DRIVER_H
#define MLX4_DRIVER_H
#include <linux/device.h>
#include <linux/mlx4/device.h>
struct mlx4_dev;
......
......@@ -10,6 +10,7 @@
#ifndef LINUX_MMC_CARD_H
#define LINUX_MMC_CARD_H
#include <linux/device.h>
#include <linux/mmc/core.h>
#include <linux/mod_devicetable.h>
......
......@@ -9,7 +9,7 @@
#define LINUX_MMC_CORE_H
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/completion.h>
struct request;
struct mmc_data;
......
......@@ -12,6 +12,7 @@
#include <linux/leds.h>
#include <linux/sched.h>
#include <linux/device.h>
#include <linux/fault-inject.h>
#include <linux/mmc/core.h>
......
......@@ -38,7 +38,6 @@
#include <asm/cache.h>
#include <asm/byteorder.h>
#include <linux/device.h>
#include <linux/percpu.h>
#include <linux/rculist.h>
#include <linux/dmaengine.h>
......@@ -56,6 +55,7 @@
#include <linux/netdev_features.h>
struct netpoll_info;
struct device;
struct phy_device;
/* 802.11 specific */
struct wireless_dev;
......
......@@ -5,10 +5,11 @@
#include <linux/of_platform.h> /* temporary until merge */
#ifdef CONFIG_OF_DEVICE
#include <linux/device.h>
#include <linux/of.h>
#include <linux/mod_devicetable.h>
struct device;
extern const struct of_device_id *of_match_device(
const struct of_device_id *matches, const struct device *dev);
extern void of_device_make_bus_id(struct device *dev);
......
......@@ -19,6 +19,7 @@
#include <linux/notifier.h>
struct opp;
struct device;
enum opp_event {
OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
......
......@@ -19,7 +19,6 @@
#define __PHY_H
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/timer.h>
......@@ -88,6 +87,9 @@ typedef enum {
IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
#define MII_ADDR_C45 (1<<30)
struct device;
struct sk_buff;
/*
* The Bus class for PHYs. Devices which provide access to
* PHYs should register using this structure
......@@ -241,7 +243,6 @@ enum phy_state {
PHY_RESUMING
};
struct sk_buff;
/* phy_device: An instance of a PHY
*
......
......@@ -10,6 +10,8 @@
#define _LINUX_PM_DOMAIN_H
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/pm.h>
#include <linux/err.h>
enum gpd_status {
......
......@@ -13,10 +13,11 @@
#ifndef __LINUX_POWER_SUPPLY_H__
#define __LINUX_POWER_SUPPLY_H__
#include <linux/device.h>
#include <linux/workqueue.h>
#include <linux/leds.h>
struct device;
/*
* All voltages, currents, charges, energies, time and temperatures in uV,
* µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
......
......@@ -13,10 +13,10 @@
* published by the Free Software Foundation.
*/
#include <linux/device.h>
#include <linux/list.h>
struct module;
struct device;
struct i2c_client;
struct spi_device;
......
......@@ -35,7 +35,8 @@
#ifndef __LINUX_REGULATOR_CONSUMER_H_
#define __LINUX_REGULATOR_CONSUMER_H_
#include <linux/device.h>
struct device;
struct notifier_block;
/*
* Regulator operating modes.
......
......@@ -117,10 +117,10 @@ enum rfkill_user_states {
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/device.h>
#include <linux/leds.h>
#include <linux/err.h>
struct device;
/* this is opaque */
struct rfkill;
......
......@@ -17,7 +17,6 @@
#include <linux/ioport.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/string.h>
#include <linux/rio.h>
......
......@@ -20,7 +20,6 @@
#define _LINUX_SERIAL_PNX8XXX_H
#include <linux/serial_core.h>
#include <linux/device.h>
#define PNX8XXX_NR_PORTS 2
......
#ifndef __LINUX_SPI_MMC_SPI_H
#define __LINUX_SPI_MMC_SPI_H
#include <linux/device.h>
#include <linux/spi/spi.h>
#include <linux/interrupt.h>
struct device;
struct mmc_host;
/* Put this in platform_data of a device being used to manage an MMC/SD
......
......@@ -154,9 +154,9 @@
#define __debug__h__
#include <linux/types.h>
#include <linux/device.h>
#include <linux/slab.h>
struct device;
/* Backend stuff */
......
......@@ -23,7 +23,6 @@
#ifndef _MEDIA_DEVICE_H
#define _MEDIA_DEVICE_H
#include <linux/device.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
......@@ -31,6 +30,8 @@
#include <media/media-devnode.h>
#include <media/media-entity.h>
struct device;
/**
* struct media_device - Media device
* @dev: Parent device
......
......@@ -22,7 +22,6 @@
#define _V4L2_CTRLS_H
#include <linux/list.h>
#include <linux/device.h>
#include <linux/videodev2.h>
/* forward references */
......
......@@ -11,7 +11,6 @@
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/compiler.h> /* need __user */
#include <linux/videodev2.h>
......
......@@ -16,7 +16,6 @@
#include <linux/kernel.h>
#include <linux/if_ether.h>
#include <linux/skbuff.h>
#include <linux/device.h>
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
#include <asm/unaligned.h>
......@@ -87,6 +86,8 @@
*
*/
struct device;
/**
* enum ieee80211_max_queues - maximum number of queues
*
......
#ifndef _SCSI_SCSI_DEVICE_H
#define _SCSI_SCSI_DEVICE_H
#include <linux/device.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
......@@ -9,6 +8,7 @@
#include <scsi/scsi.h>
#include <linux/atomic.h>
struct device;
struct request_queue;
struct scsi_cmnd;
struct scsi_lun;
......
......@@ -26,7 +26,6 @@
#include <linux/mutex.h> /* struct mutex */
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/pm.h> /* pm_message_t */
#include <linux/device.h>
#include <linux/stringify.h>
/* number of supported soundcards */
......@@ -39,10 +38,10 @@
#define CONFIG_SND_MAJOR 116 /* standard configuration */
/* forward declarations */
#ifdef CONFIG_PCI
struct pci_dev;
#endif
struct module;
struct device;
struct device_attribute;
/* device allocation stuff */
......
......@@ -13,10 +13,11 @@
#ifndef __LINUX_SND_SOC_DAPM_H
#define __LINUX_SND_SOC_DAPM_H
#include <linux/device.h>
#include <linux/types.h>
#include <sound/control.h>
struct device;
/* widget has no PM register bit */
#define SND_SOC_NOPM -1
......
......@@ -4,10 +4,10 @@
#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_REGMAP_H
#include <linux/device.h>
#include <linux/ktime.h>
#include <linux/tracepoint.h>
struct device;
struct regmap;
/*
......
......@@ -7,7 +7,8 @@
#include <linux/ktime.h>
#include <linux/tracepoint.h>
#include <linux/device.h>
struct device;
/*
* The rpm_internal events are used for tracing some important
......
......@@ -5,7 +5,6 @@
#define _TRACE_WRITEBACK_H
#include <linux/backing-dev.h>
#include <linux/device.h>
#include <linux/writeback.h>
#define show_inode_state(state) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment