Skip to content

Commit

Permalink
Merge tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/paulg/linux

Pull <linux/device.h> avoidance patches from Paul Gortmaker:
 "Nearly every subsystem has some kind of header with a proto like:

	void foo(struct device *dev);

  and yet there is no reason for most of these guys to care about the
  sub fields within the device struct.  This allows us to significantly
  reduce the scope of headers including headers.  For this instance, a
  reduction of about 40% is achieved by replacing the include with the
  simple fact that the device is some kind of a struct.

  Unlike the much larger module.h cleanup, this one is simply two
  commits.  One to fix the implicit <linux/device.h> users, and then one
  to delete the device.h includes from the linux/include/ dir wherever
  possible."

* tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
  device.h: audit and cleanup users in main include dir
  device.h: cleanup users outside of linux/include (C files)
  • Loading branch information
torvalds committed Mar 24, 2012
2 parents 11bcb32 + 313162d commit 250f671
Show file tree
Hide file tree
Showing 73 changed files with 91 additions and 52 deletions.
1 change: 1 addition & 0 deletions drivers/base/power/clock_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <linux/pm_clock.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/power/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/pm_clock.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/power/opp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/cpufreq.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/regcache-lzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/slab.h>
#include <linux/device.h>
#include <linux/lzo.h>

#include "internal.h"
Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/regcache-rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/slab.h>
#include <linux/device.h>
#include <linux/debugfs.h>
#include <linux/rbtree.h>
#include <linux/seq_file.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <linux/slab.h>
#include <linux/export.h>
#include <linux/device.h>
#include <trace/events/regmap.h>
#include <linux/bsearch.h>
#include <linux/sort.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/regmap-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/mutex.h>
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/device.h>

#include "internal.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/base/regmap/regmap-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/export.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/edac/edac_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/edac.h>
#include <linux/atomic.h>
#include <linux/device.h>
#include <asm/edac.h>

int edac_op_state = EDAC_OPSTATE_INVAL;
Expand Down
1 change: 1 addition & 0 deletions drivers/edac/mce_amd_inj.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/edac.h>
#include <linux/module.h>
#include <asm/mce.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/mfd/wm8994-regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/mfd/wm8994/core.h>
#include <linux/mfd/wm8994/registers.h>
#include <linux/regmap.h>
#include <linux/device.h>

#include "wm8994.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/power/apm_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include <linux/module.h>
#include <linux/device.h>
#include <linux/power_supply.h>
#include <linux/apm-emulation.h>

Expand Down
4 changes: 4 additions & 0 deletions drivers/power/power_supply.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* You may use this code as per GPL version 2
*/

struct device;
struct device_type;
struct power_supply;

#ifdef CONFIG_SYSFS

extern void power_supply_init_attrs(struct device_type *dev_type);
Expand Down
1 change: 1 addition & 0 deletions drivers/power/power_supply_leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/power_supply.h>
#include <linux/slab.h>

Expand Down
1 change: 1 addition & 0 deletions drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include <linux/ctype.h>
#include <linux/device.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#include <linux/stat.h>
Expand Down
2 changes: 0 additions & 2 deletions include/linux/amba/pl022.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#ifndef _SSP_PL022_H
#define _SSP_PL022_H

#include <linux/device.h>

/**
* whether SSP is in loopback mode or not
*/
Expand Down
2 changes: 1 addition & 1 deletion include/linux/atmdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -250,6 +249,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
Expand Down
3 changes: 2 additions & 1 deletion include/linux/attribute_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/linux/c2port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 0 additions & 1 deletion include/linux/cdrom.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion include/linux/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 0 additions & 1 deletion include/linux/crash_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion include/linux/dma-buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion include/linux/edac.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion include/linux/firewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -65,6 +64,8 @@
#define CSR_MODEL 0x17
#define CSR_DIRECTORY_ID 0x20

struct device;

struct fw_csr_iterator {
const u32 *p;
const u32 *end;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/hwmon-sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/hwmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef _HWMON_H_
#define _HWMON_H_

#include <linux/device.h>
struct device;

struct device *hwmon_device_register(struct device *dev);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/hwspinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion include/linux/ipmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
3 changes: 2 additions & 1 deletion include/linux/ipmi_smi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
2 changes: 1 addition & 1 deletion include/linux/jz4740-adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/linux/maple.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#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 */
Expand Down
3 changes: 2 additions & 1 deletion include/linux/mfd/abx500.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* Author: Rickard Andersson <[email protected]>
*/

#include <linux/device.h>
#include <linux/regulator/machine.h>

struct device;

#ifndef MFD_ABX500_H
#define MFD_ABX500_H

Expand Down
2 changes: 1 addition & 1 deletion include/linux/mfd/abx500/ab5500.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef MFD_AB5500_H
#define MFD_AB5500_H

#include <linux/device.h>
struct device;

enum ab5500_devid {
AB5500_DEVID_ADC,
Expand Down
4 changes: 3 additions & 1 deletion include/linux/mfd/abx500/ab8500.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/linux/mfd/pm8xxx/pm8921.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 250f671

Please sign in to comment.