aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-09-28 08:29:59 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-09-28 08:29:59 -0400
commit185a257f2f73bcd89050ad02da5bedbc28fc43fa (patch)
tree5e32586114534ed3f2165614cba3d578f5d87307 /include/linux
parent3f1a9aaeffd8d1cbc5ab9776c45cbd66af1c9699 (diff)
parenta77c64c1a641950626181b4857abb701d8f38ccc (diff)
Merge branch 'master' into gfs2
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/bootmem.h100
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/compiler.h5
-rw-r--r--include/linux/console.h5
-rw-r--r--include/linux/cpu.h8
-rw-r--r--include/linux/dccp.h14
-rw-r--r--include/linux/device.h99
-rw-r--r--include/linux/edd.h1
-rw-r--r--include/linux/eisa.h8
-rw-r--r--include/linux/elf-em.h1
-rw-r--r--include/linux/elfnote.h90
-rw-r--r--include/linux/err.h4
-rw-r--r--include/linux/ext3_fs.h4
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/ext3_jbd.h10
-rw-r--r--include/linux/fs.h14
-rw-r--r--include/linux/getcpu.h16
-rw-r--r--include/linux/gfp.h41
-rw-r--r--include/linux/hdlc.h201
-rw-r--r--include/linux/hdlc/ioctl.h33
-rw-r--r--include/linux/highmem.h5
-rw-r--r--include/linux/i2c-algo-bit.h1
-rw-r--r--include/linux/i2c-algo-pcf.h1
-rw-r--r--include/linux/i2c-algo-sibyte.h33
-rw-r--r--include/linux/i2c.h14
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/irq.h6
-rw-r--r--include/linux/jbd.h70
-rw-r--r--include/linux/jiffies.h15
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/kobject.h16
-rw-r--r--include/linux/libata.h8
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/mempolicy.h4
-rw-r--r--include/linux/mm.h249
-rw-r--r--include/linux/mm_types.h67
-rw-r--r--include/linux/mmzone.h137
-rw-r--r--include/linux/mod_devicetable.h12
-rw-r--r--include/linux/netdevice.h8
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/nfsd/nfsfh.h10
-rw-r--r--include/linux/page-flags.h35
-rw-r--r--include/linux/pagemap.h15
-rw-r--r--include/linux/pci.h41
-rw-r--r--include/linux/pci_ids.h4
-rw-r--r--include/linux/pci_regs.h2
-rw-r--r--include/linux/pcieport_if.h6
-rw-r--r--include/linux/percpu.h89
-rw-r--r--include/linux/pid.h2
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm.h63
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/resume-trace.h24
-rw-r--r--include/linux/rmap.h14
-rw-r--r--include/linux/sched.h14
-rw-r--r--include/linux/selinux.h29
-rw-r--r--include/linux/slab.h33
-rw-r--r--include/linux/smb.h1
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/linux/stacktrace.h7
-rw-r--r--include/linux/suspend.h32
-rw-r--r--include/linux/swap.h12
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/sysfs.h28
-rw-r--r--include/linux/uaccess.h22
-rw-r--r--include/linux/usb.h156
-rw-r--r--include/linux/usb/audio.h53
-rw-r--r--include/linux/usb/midi.h112
-rw-r--r--include/linux/usb/otg.h (renamed from include/linux/usb_otg.h)4
-rw-r--r--include/linux/usb_usual.h3
-rw-r--r--include/linux/vermagic.h4
-rw-r--r--include/linux/vmalloc.h3
-rw-r--r--include/linux/vmstat.h18
-rw-r--r--include/linux/wireless.h24
-rw-r--r--include/linux/writeback.h1
79 files changed, 1498 insertions, 726 deletions
diff --git a/include/linux/aer.h b/include/linux/aer.h
new file mode 100644
index 000000000000..402e178b38eb
--- /dev/null
+++ b/include/linux/aer.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2006 Intel Corp.
3 * Tom Long Nguyen (tom.l.nguyen@intel.com)
4 * Zhang Yanmin (yanmin.zhang@intel.com)
5 */
6
7#ifndef _AER_H_
8#define _AER_H_
9
10#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(struct pci_dev *dev);
14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16#else
17#define pci_enable_pcie_error_reporting(dev) do { } while (0)
18#define pci_find_aer_capability(dev) do { } while (0)
19#define pci_disable_pcie_error_reporting(dev) do { } while (0)
20#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0)
21#endif
22
23#endif //_AER_H_
24
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index e319c649e4fd..31e9abb6d977 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -4,11 +4,8 @@
4#ifndef _LINUX_BOOTMEM_H 4#ifndef _LINUX_BOOTMEM_H
5#define _LINUX_BOOTMEM_H 5#define _LINUX_BOOTMEM_H
6 6
7#include <asm/pgtable.h>
8#include <asm/dma.h>
9#include <linux/cache.h>
10#include <linux/init.h>
11#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <asm/dma.h>
12 9
13/* 10/*
14 * simple boot-time physical memory area allocator. 11 * simple boot-time physical memory area allocator.
@@ -41,45 +38,64 @@ typedef struct bootmem_data {
41 struct list_head list; 38 struct list_head list;
42} bootmem_data_t; 39} bootmem_data_t;
43 40
44extern unsigned long __init bootmem_bootmap_pages (unsigned long); 41extern unsigned long bootmem_bootmap_pages(unsigned long);
45extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 42extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
46extern void __init free_bootmem (unsigned long addr, unsigned long size); 43extern void free_bootmem(unsigned long addr, unsigned long size);
47extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); 44extern void *__alloc_bootmem(unsigned long size,
48extern void * __init __alloc_bootmem_nopanic (unsigned long size, unsigned long align, unsigned long goal); 45 unsigned long align,
49extern void * __init __alloc_bootmem_low(unsigned long size, 46 unsigned long goal);
50 unsigned long align, 47extern void *__alloc_bootmem_nopanic(unsigned long size,
51 unsigned long goal); 48 unsigned long align,
52extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, 49 unsigned long goal);
53 unsigned long size, 50extern void *__alloc_bootmem_low(unsigned long size,
54 unsigned long align, 51 unsigned long align,
55 unsigned long goal); 52 unsigned long goal);
56extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata, 53extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
57 unsigned long size, unsigned long align, unsigned long goal, 54 unsigned long size,
58 unsigned long limit); 55 unsigned long align,
56 unsigned long goal);
57extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
58 unsigned long size,
59 unsigned long align,
60 unsigned long goal,
61 unsigned long limit);
62
59#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
60extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 64extern void reserve_bootmem(unsigned long addr, unsigned long size);
61#define alloc_bootmem(x) \ 65#define alloc_bootmem(x) \
62 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 66 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
63#define alloc_bootmem_low(x) \ 67#define alloc_bootmem_low(x) \
64 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0) 68 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
65#define alloc_bootmem_pages(x) \ 69#define alloc_bootmem_pages(x) \
66 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 70 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
67#define alloc_bootmem_low_pages(x) \ 71#define alloc_bootmem_low_pages(x) \
68 __alloc_bootmem_low((x), PAGE_SIZE, 0) 72 __alloc_bootmem_low(x, PAGE_SIZE, 0)
69#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 73#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
70extern unsigned long __init free_all_bootmem (void); 74
71extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); 75extern unsigned long free_all_bootmem(void);
72extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 76extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
73extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 77extern void *__alloc_bootmem_node(pg_data_t *pgdat,
74extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 78 unsigned long size,
75extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 79 unsigned long align,
80 unsigned long goal);
81extern unsigned long init_bootmem_node(pg_data_t *pgdat,
82 unsigned long freepfn,
83 unsigned long startpfn,
84 unsigned long endpfn);
85extern void reserve_bootmem_node(pg_data_t *pgdat,
86 unsigned long physaddr,
87 unsigned long size);
88extern void free_bootmem_node(pg_data_t *pgdat,
89 unsigned long addr,
90 unsigned long size);
91
76#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 92#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
77#define alloc_bootmem_node(pgdat, x) \ 93#define alloc_bootmem_node(pgdat, x) \
78 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 94 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
79#define alloc_bootmem_pages_node(pgdat, x) \ 95#define alloc_bootmem_pages_node(pgdat, x) \
80 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 96 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
81#define alloc_bootmem_low_pages_node(pgdat, x) \ 97#define alloc_bootmem_low_pages_node(pgdat, x) \
82 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0) 98 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
83#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 99#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
84 100
85#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 101#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -89,19 +105,19 @@ static inline void *alloc_remap(int nid, unsigned long size)
89{ 105{
90 return NULL; 106 return NULL;
91} 107}
92#endif 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
93 109
94extern unsigned long __meminitdata nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
95extern unsigned long nr_all_pages; 111extern unsigned long nr_all_pages;
96 112
97extern void *__init alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
98 unsigned long bucketsize, 114 unsigned long bucketsize,
99 unsigned long numentries, 115 unsigned long numentries,
100 int scale, 116 int scale,
101 int flags, 117 int flags,
102 unsigned int *_hash_shift, 118 unsigned int *_hash_shift,
103 unsigned int *_hash_mask, 119 unsigned int *_hash_mask,
104 unsigned long limit); 120 unsigned long limit);
105 121
106#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ 122#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */
107#define HASH_EARLY 0x00000002 /* Allocating during early boot? */ 123#define HASH_EARLY 0x00000002 /* Allocating during early boot? */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 2216638962d2..ee5f53f2ca15 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -23,5 +23,7 @@ void cdev_del(struct cdev *);
23 23
24void cd_forget(struct inode *); 24void cd_forget(struct inode *);
25 25
26extern struct backing_dev_info directly_mappable_cdev_bdi;
27
26#endif 28#endif
27#endif 29#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 9b4f11094937..060b96112ec6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -99,6 +99,11 @@ extern void __chk_io_ptr(void __iomem *);
99#define __must_check 99#define __must_check
100#endif 100#endif
101 101
102#ifndef CONFIG_ENABLE_MUST_CHECK
103#undef __must_check
104#define __must_check
105#endif
106
102/* 107/*
103 * Allow us to avoid 'defined but not used' warnings on functions and data, 108 * Allow us to avoid 'defined but not used' warnings on functions and data,
104 * as well as force them to be emitted to the assembly file. 109 * as well as force them to be emitted to the assembly file.
diff --git a/include/linux/console.h b/include/linux/console.h
index 3bdf2155e565..76a1807726eb 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -120,9 +120,14 @@ extern void console_stop(struct console *);
120extern void console_start(struct console *); 120extern void console_start(struct console *);
121extern int is_console_locked(void); 121extern int is_console_locked(void);
122 122
123#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND
123/* Suspend and resume console messages over PM events */ 124/* Suspend and resume console messages over PM events */
124extern void suspend_console(void); 125extern void suspend_console(void);
125extern void resume_console(void); 126extern void resume_console(void);
127#else
128static inline void suspend_console(void) {}
129static inline void resume_console(void) {}
130#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
126 131
127/* Some debug stub to catch some of the obvious races in the VT code */ 132/* Some debug stub to catch some of the obvious races in the VT code */
128#if 1 133#if 1
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 8fb344a9abd8..3fef7d67aedc 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -89,4 +89,12 @@ int cpu_down(unsigned int cpu);
89static inline int cpu_is_offline(int cpu) { return 0; } 89static inline int cpu_is_offline(int cpu) { return 0; }
90#endif 90#endif
91 91
92#ifdef CONFIG_SUSPEND_SMP
93extern int disable_nonboot_cpus(void);
94extern void enable_nonboot_cpus(void);
95#else
96static inline int disable_nonboot_cpus(void) { return 0; }
97static inline void enable_nonboot_cpus(void) {}
98#endif
99
92#endif /* _LINUX_CPU_H_ */ 100#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 2d7671c92c0b..d6f4ec467a4b 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -169,6 +169,12 @@ enum {
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171 171
172/* DCCP CCIDS */
173enum {
174 DCCPC_CCID2 = 2,
175 DCCPC_CCID3 = 3,
176};
177
172/* DCCP features */ 178/* DCCP features */
173enum { 179enum {
174 DCCPF_RESERVED = 0, 180 DCCPF_RESERVED = 0,
@@ -320,7 +326,7 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
320/* initial values for each feature */ 326/* initial values for each feature */
321#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 327#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
322#define DCCPF_INITIAL_ACK_RATIO 2 328#define DCCPF_INITIAL_ACK_RATIO 2
323#define DCCPF_INITIAL_CCID 2 329#define DCCPF_INITIAL_CCID DCCPC_CCID2
324#define DCCPF_INITIAL_SEND_ACK_VECTOR 1 330#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
325/* FIXME: for now we're default to 1 but it should really be 0 */ 331/* FIXME: for now we're default to 1 but it should really be 0 */
326#define DCCPF_INITIAL_SEND_NDP_COUNT 1 332#define DCCPF_INITIAL_SEND_NDP_COUNT 1
@@ -404,6 +410,7 @@ struct dccp_service_list {
404}; 410};
405 411
406#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) 412#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
413#define DCCP_SERVICE_CODE_IS_ABSENT 0
407 414
408static inline int dccp_list_has_service(const struct dccp_service_list *sl, 415static inline int dccp_list_has_service(const struct dccp_service_list *sl,
409 const __be32 service) 416 const __be32 service)
@@ -484,11 +491,6 @@ static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
484 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock; 491 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
485} 492}
486 493
487static inline int dccp_service_not_initialized(const struct sock *sk)
488{
489 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
490}
491
492static inline const char *dccp_role(const struct sock *sk) 494static inline const char *dccp_role(const struct sock *sk)
493{ 495{
494 switch (dccp_sk(sk)->dccps_role) { 496 switch (dccp_sk(sk)->dccps_role) {
diff --git a/include/linux/device.h b/include/linux/device.h
index 1e5f30da98bc..662e6a10144e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -15,6 +15,7 @@
15#include <linux/kobject.h> 15#include <linux/kobject.h>
16#include <linux/klist.h> 16#include <linux/klist.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/compiler.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/pm.h> 21#include <linux/pm.h>
@@ -51,14 +52,17 @@ struct bus_type {
51 int (*probe)(struct device * dev); 52 int (*probe)(struct device * dev);
52 int (*remove)(struct device * dev); 53 int (*remove)(struct device * dev);
53 void (*shutdown)(struct device * dev); 54 void (*shutdown)(struct device * dev);
54 int (*suspend)(struct device * dev, pm_message_t state); 55
55 int (*resume)(struct device * dev); 56 int (*suspend)(struct device * dev, pm_message_t state);
57 int (*suspend_late)(struct device * dev, pm_message_t state);
58 int (*resume_early)(struct device * dev);
59 int (*resume)(struct device * dev);
56}; 60};
57 61
58extern int bus_register(struct bus_type * bus); 62extern int __must_check bus_register(struct bus_type * bus);
59extern void bus_unregister(struct bus_type * bus); 63extern void bus_unregister(struct bus_type * bus);
60 64
61extern void bus_rescan_devices(struct bus_type * bus); 65extern int __must_check bus_rescan_devices(struct bus_type * bus);
62 66
63/* iterator helpers for buses */ 67/* iterator helpers for buses */
64 68
@@ -67,9 +71,9 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
67struct device * bus_find_device(struct bus_type *bus, struct device *start, 71struct device * bus_find_device(struct bus_type *bus, struct device *start,
68 void *data, int (*match)(struct device *, void *)); 72 void *data, int (*match)(struct device *, void *));
69 73
70int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, 74int __must_check bus_for_each_drv(struct bus_type *bus,
71 void * data, int (*fn)(struct device_driver *, void *)); 75 struct device_driver *start, void *data,
72 76 int (*fn)(struct device_driver *, void *));
73 77
74/* driverfs interface for exporting bus attributes */ 78/* driverfs interface for exporting bus attributes */
75 79
@@ -82,7 +86,8 @@ struct bus_attribute {
82#define BUS_ATTR(_name,_mode,_show,_store) \ 86#define BUS_ATTR(_name,_mode,_show,_store) \
83struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 87struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
84 88
85extern int bus_create_file(struct bus_type *, struct bus_attribute *); 89extern int __must_check bus_create_file(struct bus_type *,
90 struct bus_attribute *);
86extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 91extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
87 92
88struct device_driver { 93struct device_driver {
@@ -101,16 +106,18 @@ struct device_driver {
101 void (*shutdown) (struct device * dev); 106 void (*shutdown) (struct device * dev);
102 int (*suspend) (struct device * dev, pm_message_t state); 107 int (*suspend) (struct device * dev, pm_message_t state);
103 int (*resume) (struct device * dev); 108 int (*resume) (struct device * dev);
109
110 unsigned int multithread_probe:1;
104}; 111};
105 112
106 113
107extern int driver_register(struct device_driver * drv); 114extern int __must_check driver_register(struct device_driver * drv);
108extern void driver_unregister(struct device_driver * drv); 115extern void driver_unregister(struct device_driver * drv);
109 116
110extern struct device_driver * get_driver(struct device_driver * drv); 117extern struct device_driver * get_driver(struct device_driver * drv);
111extern void put_driver(struct device_driver * drv); 118extern void put_driver(struct device_driver * drv);
112extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 119extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
113 120extern int driver_probe_done(void);
114 121
115/* driverfs interface for exporting driver attributes */ 122/* driverfs interface for exporting driver attributes */
116 123
@@ -123,16 +130,17 @@ struct driver_attribute {
123#define DRIVER_ATTR(_name,_mode,_show,_store) \ 130#define DRIVER_ATTR(_name,_mode,_show,_store) \
124struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 131struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store)
125 132
126extern int driver_create_file(struct device_driver *, struct driver_attribute *); 133extern int __must_check driver_create_file(struct device_driver *,
134 struct driver_attribute *);
127extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 135extern void driver_remove_file(struct device_driver *, struct driver_attribute *);
128 136
129extern int driver_for_each_device(struct device_driver * drv, struct device * start, 137extern int __must_check driver_for_each_device(struct device_driver * drv,
130 void * data, int (*fn)(struct device *, void *)); 138 struct device *start, void *data,
139 int (*fn)(struct device *, void *));
131struct device * driver_find_device(struct device_driver *drv, 140struct device * driver_find_device(struct device_driver *drv,
132 struct device *start, void *data, 141 struct device *start, void *data,
133 int (*match)(struct device *, void *)); 142 int (*match)(struct device *, void *));
134 143
135
136/* 144/*
137 * device classes 145 * device classes
138 */ 146 */
@@ -146,17 +154,26 @@ struct class {
146 struct list_head interfaces; 154 struct list_head interfaces;
147 struct semaphore sem; /* locks both the children and interfaces lists */ 155 struct semaphore sem; /* locks both the children and interfaces lists */
148 156
157 struct kobject *virtual_dir;
158
149 struct class_attribute * class_attrs; 159 struct class_attribute * class_attrs;
150 struct class_device_attribute * class_dev_attrs; 160 struct class_device_attribute * class_dev_attrs;
161 struct device_attribute * dev_attrs;
151 162
152 int (*uevent)(struct class_device *dev, char **envp, 163 int (*uevent)(struct class_device *dev, char **envp,
153 int num_envp, char *buffer, int buffer_size); 164 int num_envp, char *buffer, int buffer_size);
165 int (*dev_uevent)(struct device *dev, char **envp, int num_envp,
166 char *buffer, int buffer_size);
154 167
155 void (*release)(struct class_device *dev); 168 void (*release)(struct class_device *dev);
156 void (*class_release)(struct class *class); 169 void (*class_release)(struct class *class);
170 void (*dev_release)(struct device *dev);
171
172 int (*suspend)(struct device *, pm_message_t state);
173 int (*resume)(struct device *);
157}; 174};
158 175
159extern int class_register(struct class *); 176extern int __must_check class_register(struct class *);
160extern void class_unregister(struct class *); 177extern void class_unregister(struct class *);
161 178
162 179
@@ -169,7 +186,8 @@ struct class_attribute {
169#define CLASS_ATTR(_name,_mode,_show,_store) \ 186#define CLASS_ATTR(_name,_mode,_show,_store) \
170struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 187struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store)
171 188
172extern int class_create_file(struct class *, const struct class_attribute *); 189extern int __must_check class_create_file(struct class *,
190 const struct class_attribute *);
173extern void class_remove_file(struct class *, const struct class_attribute *); 191extern void class_remove_file(struct class *, const struct class_attribute *);
174 192
175struct class_device_attribute { 193struct class_device_attribute {
@@ -182,7 +200,7 @@ struct class_device_attribute {
182struct class_device_attribute class_device_attr_##_name = \ 200struct class_device_attribute class_device_attr_##_name = \
183 __ATTR(_name,_mode,_show,_store) 201 __ATTR(_name,_mode,_show,_store)
184 202
185extern int class_device_create_file(struct class_device *, 203extern int __must_check class_device_create_file(struct class_device *,
186 const struct class_device_attribute *); 204 const struct class_device_attribute *);
187 205
188/** 206/**
@@ -242,10 +260,10 @@ class_set_devdata (struct class_device *dev, void *data)
242} 260}
243 261
244 262
245extern int class_device_register(struct class_device *); 263extern int __must_check class_device_register(struct class_device *);
246extern void class_device_unregister(struct class_device *); 264extern void class_device_unregister(struct class_device *);
247extern void class_device_initialize(struct class_device *); 265extern void class_device_initialize(struct class_device *);
248extern int class_device_add(struct class_device *); 266extern int __must_check class_device_add(struct class_device *);
249extern void class_device_del(struct class_device *); 267extern void class_device_del(struct class_device *);
250 268
251extern int class_device_rename(struct class_device *, char *); 269extern int class_device_rename(struct class_device *, char *);
@@ -255,7 +273,7 @@ extern void class_device_put(struct class_device *);
255 273
256extern void class_device_remove_file(struct class_device *, 274extern void class_device_remove_file(struct class_device *,
257 const struct class_device_attribute *); 275 const struct class_device_attribute *);
258extern int class_device_create_bin_file(struct class_device *, 276extern int __must_check class_device_create_bin_file(struct class_device *,
259 struct bin_attribute *); 277 struct bin_attribute *);
260extern void class_device_remove_bin_file(struct class_device *, 278extern void class_device_remove_bin_file(struct class_device *,
261 struct bin_attribute *); 279 struct bin_attribute *);
@@ -266,22 +284,23 @@ struct class_interface {
266 284
267 int (*add) (struct class_device *, struct class_interface *); 285 int (*add) (struct class_device *, struct class_interface *);
268 void (*remove) (struct class_device *, struct class_interface *); 286 void (*remove) (struct class_device *, struct class_interface *);
287 int (*add_dev) (struct device *, struct class_interface *);
288 void (*remove_dev) (struct device *, struct class_interface *);
269}; 289};
270 290
271extern int class_interface_register(struct class_interface *); 291extern int __must_check class_interface_register(struct class_interface *);
272extern void class_interface_unregister(struct class_interface *); 292extern void class_interface_unregister(struct class_interface *);
273 293
274extern struct class *class_create(struct module *owner, char *name); 294extern struct class *class_create(struct module *owner, const char *name);
275extern void class_destroy(struct class *cls); 295extern void class_destroy(struct class *cls);
276extern struct class_device *class_device_create(struct class *cls, 296extern struct class_device *class_device_create(struct class *cls,
277 struct class_device *parent, 297 struct class_device *parent,
278 dev_t devt, 298 dev_t devt,
279 struct device *device, 299 struct device *device,
280 char *fmt, ...) 300 const char *fmt, ...)
281 __attribute__((format(printf,5,6))); 301 __attribute__((format(printf,5,6)));
282extern void class_device_destroy(struct class *cls, dev_t devt); 302extern void class_device_destroy(struct class *cls, dev_t devt);
283 303
284
285/* interface for exporting device attributes */ 304/* interface for exporting device attributes */
286struct device_attribute { 305struct device_attribute {
287 struct attribute attr; 306 struct attribute attr;
@@ -294,8 +313,13 @@ struct device_attribute {
294#define DEVICE_ATTR(_name,_mode,_show,_store) \ 313#define DEVICE_ATTR(_name,_mode,_show,_store) \
295struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 314struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store)
296 315
297extern int device_create_file(struct device *device, struct device_attribute * entry); 316extern int __must_check device_create_file(struct device *device,
317 struct device_attribute * entry);
298extern void device_remove_file(struct device * dev, struct device_attribute * attr); 318extern void device_remove_file(struct device * dev, struct device_attribute * attr);
319extern int __must_check device_create_bin_file(struct device *dev,
320 struct bin_attribute *attr);
321extern void device_remove_bin_file(struct device *dev,
322 struct bin_attribute *attr);
299struct device { 323struct device {
300 struct klist klist_children; 324 struct klist klist_children;
301 struct klist_node knode_parent; /* node in sibling list */ 325 struct klist_node knode_parent; /* node in sibling list */
@@ -305,6 +329,7 @@ struct device {
305 329
306 struct kobject kobj; 330 struct kobject kobj;
307 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 331 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
332 unsigned is_registered:1;
308 struct device_attribute uevent_attr; 333 struct device_attribute uevent_attr;
309 struct device_attribute *devt_attr; 334 struct device_attribute *devt_attr;
310 335
@@ -338,6 +363,7 @@ struct device {
338 struct list_head node; 363 struct list_head node;
339 struct class *class; /* optional*/ 364 struct class *class; /* optional*/
340 dev_t devt; /* dev_t, creates the sysfs "dev" */ 365 dev_t devt; /* dev_t, creates the sysfs "dev" */
366 struct attribute_group **groups; /* optional groups */
341 367
342 void (*release)(struct device * dev); 368 void (*release)(struct device * dev);
343}; 369};
@@ -356,38 +382,41 @@ dev_set_drvdata (struct device *dev, void *data)
356 382
357static inline int device_is_registered(struct device *dev) 383static inline int device_is_registered(struct device *dev)
358{ 384{
359 return klist_node_attached(&dev->knode_bus); 385 return dev->is_registered;
360} 386}
361 387
362/* 388/*
363 * High level routines for use by the bus drivers 389 * High level routines for use by the bus drivers
364 */ 390 */
365extern int device_register(struct device * dev); 391extern int __must_check device_register(struct device * dev);
366extern void device_unregister(struct device * dev); 392extern void device_unregister(struct device * dev);
367extern void device_initialize(struct device * dev); 393extern void device_initialize(struct device * dev);
368extern int device_add(struct device * dev); 394extern int __must_check device_add(struct device * dev);
369extern void device_del(struct device * dev); 395extern void device_del(struct device * dev);
370extern int device_for_each_child(struct device *, void *, 396extern int __must_check device_for_each_child(struct device *, void *,
371 int (*fn)(struct device *, void *)); 397 int (*fn)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name);
372 399
373/* 400/*
374 * Manual binding of a device to driver. See drivers/base/bus.c 401 * Manual binding of a device to driver. See drivers/base/bus.c
375 * for information on use. 402 * for information on use.
376 */ 403 */
377extern void device_bind_driver(struct device * dev); 404extern int __must_check device_bind_driver(struct device *dev);
378extern void device_release_driver(struct device * dev); 405extern void device_release_driver(struct device * dev);
379extern int device_attach(struct device * dev); 406extern int __must_check device_attach(struct device * dev);
380extern void driver_attach(struct device_driver * drv); 407extern int __must_check driver_attach(struct device_driver *drv);
381extern void device_reprobe(struct device *dev); 408extern int __must_check device_reprobe(struct device *dev);
382 409
383/* 410/*
384 * Easy functions for dynamically creating devices on the fly 411 * Easy functions for dynamically creating devices on the fly
385 */ 412 */
386extern struct device *device_create(struct class *cls, struct device *parent, 413extern struct device *device_create(struct class *cls, struct device *parent,
387 dev_t devt, char *fmt, ...) 414 dev_t devt, const char *fmt, ...)
388 __attribute__((format(printf,4,5))); 415 __attribute__((format(printf,4,5)));
389extern void device_destroy(struct class *cls, dev_t devt); 416extern void device_destroy(struct class *cls, dev_t devt);
390 417
418extern int virtual_device_parent(struct device *dev);
419
391/* 420/*
392 * Platform "fixup" functions - allow the platform to have their say 421 * Platform "fixup" functions - allow the platform to have their say
393 * about devices and actions that the general device layer doesn't 422 * about devices and actions that the general device layer doesn't
@@ -412,7 +441,7 @@ extern void device_shutdown(void);
412 441
413 442
414/* drivers/base/firmware.c */ 443/* drivers/base/firmware.c */
415extern int firmware_register(struct subsystem *); 444extern int __must_check firmware_register(struct subsystem *);
416extern void firmware_unregister(struct subsystem *); 445extern void firmware_unregister(struct subsystem *);
417 446
418/* debugging and troubleshooting/diagnostic helpers. */ 447/* debugging and troubleshooting/diagnostic helpers. */
diff --git a/include/linux/edd.h b/include/linux/edd.h
index 162512b886f7..b2b3e68aa512 100644
--- a/include/linux/edd.h
+++ b/include/linux/edd.h
@@ -52,6 +52,7 @@
52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ 52#define EDD_CL_EQUALS 0x3d646465 /* "edd=" */
53#define EDD_CL_OFF 0x666f /* "of" for off */ 53#define EDD_CL_OFF 0x666f /* "of" for off */
54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ 54#define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */
55#define EDD_CL_ON 0x6e6f /* "on" for on */
55 56
56#ifndef __ASSEMBLY__ 57#ifndef __ASSEMBLY__
57 58
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index 4079242dced8..1ff7c1392525 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -3,8 +3,8 @@
3 3
4#include <linux/ioport.h> 4#include <linux/ioport.h>
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/mod_devicetable.h>
6 7
7#define EISA_SIG_LEN 8
8#define EISA_MAX_SLOTS 8 8#define EISA_MAX_SLOTS 8
9 9
10#define EISA_MAX_RESOURCES 4 10#define EISA_MAX_RESOURCES 4
@@ -27,12 +27,6 @@
27#define EISA_CONFIG_ENABLED 1 27#define EISA_CONFIG_ENABLED 1
28#define EISA_CONFIG_FORCED 2 28#define EISA_CONFIG_FORCED 2
29 29
30/* The EISA signature, in ASCII form, null terminated */
31struct eisa_device_id {
32 char sig[EISA_SIG_LEN];
33 unsigned long driver_data;
34};
35
36/* There is not much we can say about an EISA device, apart from 30/* There is not much we can say about an EISA device, apart from
37 * signature, slot number, and base address. dma_mask is set by 31 * signature, slot number, and base address. dma_mask is set by
38 * default to parent device mask..*/ 32 * default to parent device mask..*/
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 6a5796c81c90..666e0a5f00fc 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -31,6 +31,7 @@
31#define EM_M32R 88 /* Renesas M32R */ 31#define EM_M32R 88 /* Renesas M32R */
32#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 32#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
33#define EM_FRV 0x5441 /* Fujitsu FR-V */ 33#define EM_FRV 0x5441 /* Fujitsu FR-V */
34#define EM_AVR32 0x18ad /* Atmel AVR32 */
34 35
35/* 36/*
36 * This is an interim value that we will use until the committee comes 37 * This is an interim value that we will use until the committee comes
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
new file mode 100644
index 000000000000..67396db141e8
--- /dev/null
+++ b/include/linux/elfnote.h
@@ -0,0 +1,90 @@
1#ifndef _LINUX_ELFNOTE_H
2#define _LINUX_ELFNOTE_H
3/*
4 * Helper macros to generate ELF Note structures, which are put into a
5 * PT_NOTE segment of the final vmlinux image. These are useful for
6 * including name-value pairs of metadata into the kernel binary (or
7 * modules?) for use by external programs.
8 *
9 * Each note has three parts: a name, a type and a desc. The name is
10 * intended to distinguish the note's originator, so it would be a
11 * company, project, subsystem, etc; it must be in a suitable form for
12 * use in a section name. The type is an integer which is used to tag
13 * the data, and is considered to be within the "name" namespace (so
14 * "FooCo"'s type 42 is distinct from "BarProj"'s type 42). The
15 * "desc" field is the actual data. There are no constraints on the
16 * desc field's contents, though typically they're fairly small.
17 *
18 * All notes from a given NAME are put into a section named
19 * .note.NAME. When the kernel image is finally linked, all the notes
20 * are packed into a single .notes section, which is mapped into the
21 * PT_NOTE segment. Because notes for a given name are grouped into
22 * the same section, they'll all be adjacent the output file.
23 *
24 * This file defines macros for both C and assembler use. Their
25 * syntax is slightly different, but they're semantically similar.
26 *
27 * See the ELF specification for more detail about ELF notes.
28 */
29
30#ifdef __ASSEMBLER__
31/*
32 * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
33 * turn out to be the same size and shape), followed by the name and
34 * desc data with appropriate padding. The 'desctype' argument is the
35 * assembler pseudo op defining the type of the data e.g. .asciz while
36 * 'descdata' is the data itself e.g. "hello, world".
37 *
38 * e.g. ELFNOTE(XYZCo, 42, .asciz, "forty-two")
39 * ELFNOTE(XYZCo, 12, .long, 0xdeadbeef)
40 */
41#define ELFNOTE(name, type, desctype, descdata) \
42.pushsection .note.name ; \
43 .align 4 ; \
44 .long 2f - 1f /* namesz */ ; \
45 .long 4f - 3f /* descsz */ ; \
46 .long type ; \
471:.asciz "name" ; \
482:.align 4 ; \
493:desctype descdata ; \
504:.align 4 ; \
51.popsection ;
52#else /* !__ASSEMBLER__ */
53#include <linux/elf.h>
54/*
55 * Use an anonymous structure which matches the shape of
56 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and
57 * type of name and desc depend on the macro arguments. "name" must
58 * be a literal string, and "desc" must be passed by value. You may
59 * only define one note per line, since __LINE__ is used to generate
60 * unique symbols.
61 */
62#define _ELFNOTE_PASTE(a,b) a##b
63#define _ELFNOTE(size, name, unique, type, desc) \
64 static const struct { \
65 struct elf##size##_note _nhdr; \
66 unsigned char _name[sizeof(name)] \
67 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
68 typeof(desc) _desc \
69 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
70 } _ELFNOTE_PASTE(_note_, unique) \
71 __attribute_used__ \
72 __attribute__((section(".note." name), \
73 aligned(sizeof(Elf##size##_Word)), \
74 unused)) = { \
75 { \
76 sizeof(name), \
77 sizeof(desc), \
78 type, \
79 }, \
80 name, \
81 desc \
82 }
83#define ELFNOTE(size, name, type, desc) \
84 _ELFNOTE(size, name, __LINE__, type, desc)
85
86#define ELFNOTE32(name, type, desc) ELFNOTE(32, name, type, desc)
87#define ELFNOTE64(name, type, desc) ELFNOTE(64, name, type, desc)
88#endif /* __ASSEMBLER__ */
89
90#endif /* _LINUX_ELFNOTE_H */
diff --git a/include/linux/err.h b/include/linux/err.h
index cd3b367f7445..1ab1d44f8d3b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#define MAX_ERRNO 4095 16#define MAX_ERRNO 4095
17 17
18#ifndef __ASSEMBLY__
19
18#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) 20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
19 21
20static inline void *ERR_PTR(long error) 22static inline void *ERR_PTR(long error)
@@ -32,4 +34,6 @@ static inline long IS_ERR(const void *ptr)
32 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
33} 35}
34 36
37#endif
38
35#endif /* _LINUX_ERR_H */ 39#endif /* _LINUX_ERR_H */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 0eed918b3816..cc08f56750da 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -460,7 +460,7 @@ struct ext3_super_block {
460 */ 460 */
461 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ 461 __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
462 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ 462 __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
463 __u16 s_reserved_gdt_blocks; /* Per group desc for online growth */ 463 __le16 s_reserved_gdt_blocks; /* Per group desc for online growth */
464 /* 464 /*
465 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. 465 * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
466 */ 466 */
@@ -473,7 +473,7 @@ struct ext3_super_block {
473 __u8 s_reserved_char_pad; 473 __u8 s_reserved_char_pad;
474 __u16 s_reserved_word_pad; 474 __u16 s_reserved_word_pad;
475 __le32 s_default_mount_opts; 475 __le32 s_default_mount_opts;
476 __le32 s_first_meta_bg; /* First metablock block group */ 476 __le32 s_first_meta_bg; /* First metablock block group */
477 __u32 s_reserved[190]; /* Padding to the end of the block */ 477 __u32 s_reserved[190]; /* Padding to the end of the block */
478}; 478};
479 479
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 2f18b9511f21..4395e5206746 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -35,7 +35,7 @@ struct ext3_reserve_window {
35}; 35};
36 36
37struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
38 struct rb_node rsv_node; 38 struct rb_node rsv_node;
39 __u32 rsv_goal_size; 39 __u32 rsv_goal_size;
40 __u32 rsv_alloc_hit; 40 __u32 rsv_alloc_hit;
41 struct ext3_reserve_window rsv_window; 41 struct ext3_reserve_window rsv_window;
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index c8307c02dd07..ce0e6109aff0 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -23,7 +23,7 @@
23 23
24/* Define the number of blocks we need to account to a transaction to 24/* Define the number of blocks we need to account to a transaction to
25 * modify one block of data. 25 * modify one block of data.
26 * 26 *
27 * We may have to touch one inode, one bitmap buffer, up to three 27 * We may have to touch one inode, one bitmap buffer, up to three
28 * indirection blocks, the group and superblock summaries, and the data 28 * indirection blocks, the group and superblock summaries, and the data
29 * block to complete the transaction. */ 29 * block to complete the transaction. */
@@ -88,16 +88,16 @@
88#endif 88#endif
89 89
90int 90int
91ext3_mark_iloc_dirty(handle_t *handle, 91ext3_mark_iloc_dirty(handle_t *handle,
92 struct inode *inode, 92 struct inode *inode,
93 struct ext3_iloc *iloc); 93 struct ext3_iloc *iloc);
94 94
95/* 95/*
96 * On success, We end up with an outstanding reference count against 96 * On success, We end up with an outstanding reference count against
97 * iloc->bh. This _must_ be cleaned up later. 97 * iloc->bh. This _must_ be cleaned up later.
98 */ 98 */
99 99
100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, 100int ext3_reserve_inode_write(handle_t *handle, struct inode *inode,
101 struct ext3_iloc *iloc); 101 struct ext3_iloc *iloc);
102 102
103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); 103int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1d3e601ece73..8f74dfbb2edd 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -512,7 +512,6 @@ struct inode {
512 struct timespec i_mtime; 512 struct timespec i_mtime;
513 struct timespec i_ctime; 513 struct timespec i_ctime;
514 unsigned int i_blkbits; 514 unsigned int i_blkbits;
515 unsigned long i_blksize;
516 unsigned long i_version; 515 unsigned long i_version;
517 blkcnt_t i_blocks; 516 blkcnt_t i_blocks;
518 unsigned short i_bytes; 517 unsigned short i_bytes;
@@ -528,11 +527,12 @@ struct inode {
528#ifdef CONFIG_QUOTA 527#ifdef CONFIG_QUOTA
529 struct dquot *i_dquot[MAXQUOTAS]; 528 struct dquot *i_dquot[MAXQUOTAS];
530#endif 529#endif
531 /* These three should probably be a union */
532 struct list_head i_devices; 530 struct list_head i_devices;
533 struct pipe_inode_info *i_pipe; 531 union {
534 struct block_device *i_bdev; 532 struct pipe_inode_info *i_pipe;
535 struct cdev *i_cdev; 533 struct block_device *i_bdev;
534 struct cdev *i_cdev;
535 };
536 int i_cindex; 536 int i_cindex;
537 537
538 __u32 i_generation; 538 __u32 i_generation;
@@ -554,9 +554,7 @@ struct inode {
554 554
555 atomic_t i_writecount; 555 atomic_t i_writecount;
556 void *i_security; 556 void *i_security;
557 union { 557 void *i_private; /* fs or device private pointer */
558 void *generic_ip;
559 } u;
560#ifdef __NEED_I_SIZE_ORDERED 558#ifdef __NEED_I_SIZE_ORDERED
561 seqcount_t i_size_seqcount; 559 seqcount_t i_size_seqcount;
562#endif 560#endif
diff --git a/include/linux/getcpu.h b/include/linux/getcpu.h
new file mode 100644
index 000000000000..031ed3780e45
--- /dev/null
+++ b/include/linux/getcpu.h
@@ -0,0 +1,16 @@
1#ifndef _LINUX_GETCPU_H
2#define _LINUX_GETCPU_H 1
3
4/* Cache for getcpu() to speed it up. Results might be upto a jiffie
5 out of date, but will be faster.
6 User programs should not refer to the contents of this structure.
7 It is only a cache for vgetcpu(). It might change in future kernels.
8 The user program must store this information per thread (__thread)
9 If you want 100% accurate information pass NULL instead. */
10struct getcpu_cache {
11 unsigned long t0;
12 unsigned long t1;
13 unsigned long res[4];
14};
15
16#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index cc9e60844484..bf2b6bc3f6fd 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -9,17 +9,16 @@ struct vm_area_struct;
9 9
10/* 10/*
11 * GFP bitmasks.. 11 * GFP bitmasks..
12 *
13 * Zone modifiers (see linux/mmzone.h - low three bits)
14 *
15 * Do not put any conditional on these. If necessary modify the definitions
16 * without the underscores and use the consistently. The definitions here may
17 * be used in bit comparisons.
12 */ 18 */
13/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
14#define __GFP_DMA ((__force gfp_t)0x01u) 19#define __GFP_DMA ((__force gfp_t)0x01u)
15#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 20#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
16#ifdef CONFIG_DMA_IS_DMA32 21#define __GFP_DMA32 ((__force gfp_t)0x04u)
17#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
18#elif BITS_PER_LONG < 64
19#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
20#else
21#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
22#endif
23 22
24/* 23/*
25 * Action modifiers - doesn't change the zoning 24 * Action modifiers - doesn't change the zoning
@@ -46,6 +45,7 @@ struct vm_area_struct;
46#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ 45#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */
47#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */ 46#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
48#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 47#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
48#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
49 49
50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */ 50#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 51#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
@@ -54,7 +54,7 @@ struct vm_area_struct;
54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \ 54#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \ 55 __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 56 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
57 __GFP_NOMEMALLOC|__GFP_HARDWALL) 57 __GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE)
58 58
59/* This equals 0, but use constants in case they ever change */ 59/* This equals 0, but use constants in case they ever change */
60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) 60#define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH)
@@ -67,6 +67,13 @@ struct vm_area_struct;
67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \ 67#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
68 __GFP_HIGHMEM) 68 __GFP_HIGHMEM)
69 69
70#ifdef CONFIG_NUMA
71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
72#else
73#define GFP_THISNODE 0
74#endif
75
76
70/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some 77/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
71 platforms, used as appropriate on others */ 78 platforms, used as appropriate on others */
72 79
@@ -76,11 +83,19 @@ struct vm_area_struct;
76#define GFP_DMA32 __GFP_DMA32 83#define GFP_DMA32 __GFP_DMA32
77 84
78 85
79static inline int gfp_zone(gfp_t gfp) 86static inline enum zone_type gfp_zone(gfp_t flags)
80{ 87{
81 int zone = GFP_ZONEMASK & (__force int) gfp; 88 if (flags & __GFP_DMA)
82 BUG_ON(zone >= GFP_ZONETYPES); 89 return ZONE_DMA;
83 return zone; 90#ifdef CONFIG_ZONE_DMA32
91 if (flags & __GFP_DMA32)
92 return ZONE_DMA32;
93#endif
94#ifdef CONFIG_HIGHMEM
95 if (flags & __GFP_HIGHMEM)
96 return ZONE_HIGHMEM;
97#endif
98 return ZONE_NORMAL;
84} 99}
85 100
86/* 101/*
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d5ebbb29aeae..d4b333938f73 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -11,95 +11,46 @@
11#ifndef __HDLC_H 11#ifndef __HDLC_H
12#define __HDLC_H 12#define __HDLC_H
13 13
14#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
15
16#define CLOCK_DEFAULT 0 /* Default setting */
17#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
18#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
19#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
20#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
21
22
23#define ENCODING_DEFAULT 0 /* Default setting */
24#define ENCODING_NRZ 1
25#define ENCODING_NRZI 2
26#define ENCODING_FM_MARK 3
27#define ENCODING_FM_SPACE 4
28#define ENCODING_MANCHESTER 5
29
30
31#define PARITY_DEFAULT 0 /* Default setting */
32#define PARITY_NONE 1 /* No parity */
33#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
34#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
35#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
36#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
37#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
38#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
39
40#define LMI_DEFAULT 0 /* Default setting */
41#define LMI_NONE 1 /* No LMI, all PVCs are static */
42#define LMI_ANSI 2 /* ANSI Annex D */
43#define LMI_CCITT 3 /* ITU-T Annex A */
44#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
45 14
46#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */ 15#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
16#if 0
47#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */ 17#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
18#else
19#define HDLC_MAX_MRU 1600 /* as required for FR network */
20#endif
48 21
49 22
50#ifdef __KERNEL__ 23#ifdef __KERNEL__
51 24
52#include <linux/skbuff.h> 25#include <linux/skbuff.h>
53#include <linux/netdevice.h> 26#include <linux/netdevice.h>
54#include <net/syncppp.h>
55#include <linux/hdlc/ioctl.h> 27#include <linux/hdlc/ioctl.h>
56 28
57 29
58typedef struct { /* Used in Cisco and PPP mode */ 30/* Used by all network devices here, pointed to by netdev_priv(dev) */
59 u8 address; 31struct hdlc_device_desc {
60 u8 control; 32 int (*netif_rx)(struct sk_buff *skb);
61 u16 protocol;
62}__attribute__ ((packed)) hdlc_header;
63
64
65
66typedef struct {
67 u32 type; /* code */
68 u32 par1;
69 u32 par2;
70 u16 rel; /* reliability */
71 u32 time;
72}__attribute__ ((packed)) cisco_packet;
73#define CISCO_PACKET_LEN 18
74#define CISCO_BIG_PACKET_LEN 20
75
76
77
78typedef struct pvc_device_struct {
79 struct net_device *master;
80 struct net_device *main;
81 struct net_device *ether; /* bridged Ethernet interface */
82 struct pvc_device_struct *next; /* Sorted in ascending DLCI order */
83 int dlci;
84 int open_count;
85
86 struct {
87 unsigned int new: 1;
88 unsigned int active: 1;
89 unsigned int exist: 1;
90 unsigned int deleted: 1;
91 unsigned int fecn: 1;
92 unsigned int becn: 1;
93 unsigned int bandwidth; /* Cisco LMI reporting only */
94 }state;
95}pvc_device;
96
97
98
99typedef struct hdlc_device_struct {
100 /* To be initialized by hardware driver */
101 struct net_device_stats stats; 33 struct net_device_stats stats;
102 34};
35
36/* This structure is a private property of HDLC protocols.
37 Hardware drivers have no interest here */
38
39struct hdlc_proto {
40 int (*open)(struct net_device *dev);
41 void (*close)(struct net_device *dev);
42 void (*start)(struct net_device *dev); /* if open & DCD */
43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb,
47 struct net_device *dev);
48 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */
50};
51
52
53typedef struct hdlc_device {
103 /* used by HDLC layer to take control over HDLC device from hw driver*/ 54 /* used by HDLC layer to take control over HDLC device from hw driver*/
104 int (*attach)(struct net_device *dev, 55 int (*attach)(struct net_device *dev,
105 unsigned short encoding, unsigned short parity); 56 unsigned short encoding, unsigned short parity);
@@ -107,82 +58,18 @@ typedef struct hdlc_device_struct {
107 /* hardware driver must handle this instead of dev->hard_start_xmit */ 58 /* hardware driver must handle this instead of dev->hard_start_xmit */
108 int (*xmit)(struct sk_buff *skb, struct net_device *dev); 59 int (*xmit)(struct sk_buff *skb, struct net_device *dev);
109 60
110
111 /* Things below are for HDLC layer internal use only */ 61 /* Things below are for HDLC layer internal use only */
112 struct { 62 const struct hdlc_proto *proto;
113 int (*open)(struct net_device *dev);
114 void (*close)(struct net_device *dev);
115
116 /* if open & DCD */
117 void (*start)(struct net_device *dev);
118 /* if open & !DCD */
119 void (*stop)(struct net_device *dev);
120
121 void (*detach)(struct hdlc_device_struct *hdlc);
122 int (*netif_rx)(struct sk_buff *skb);
123 unsigned short (*type_trans)(struct sk_buff *skb,
124 struct net_device *dev);
125 int id; /* IF_PROTO_HDLC/CISCO/FR/etc. */
126 }proto;
127
128 int carrier; 63 int carrier;
129 int open; 64 int open;
130 spinlock_t state_lock; 65 spinlock_t state_lock;
131 66 void *state;
132 union {
133 struct {
134 fr_proto settings;
135 pvc_device *first_pvc;
136 int dce_pvc_count;
137
138 struct timer_list timer;
139 unsigned long last_poll;
140 int reliable;
141 int dce_changed;
142 int request;
143 int fullrep_sent;
144 u32 last_errors; /* last errors bit list */
145 u8 n391cnt;
146 u8 txseq; /* TX sequence number */
147 u8 rxseq; /* RX sequence number */
148 }fr;
149
150 struct {
151 cisco_proto settings;
152
153 struct timer_list timer;
154 unsigned long last_poll;
155 int up;
156 int request_sent;
157 u32 txseq; /* TX sequence number */
158 u32 rxseq; /* RX sequence number */
159 }cisco;
160
161 struct {
162 raw_hdlc_proto settings;
163 }raw_hdlc;
164
165 struct {
166 struct ppp_device pppdev;
167 struct ppp_device *syncppp_ptr;
168 int (*old_change_mtu)(struct net_device *dev,
169 int new_mtu);
170 }ppp;
171 }state;
172 void *priv; 67 void *priv;
173}hdlc_device; 68}hdlc_device;
174 69
175 70
176 71
177int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr); 72/* Exported from hdlc module */
178int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr);
179int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr);
180int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr);
181int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr);
182int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr);
183
184
185/* Exported from hdlc.o */
186 73
187/* Called by hardware driver when a user requests HDLC service */ 74/* Called by hardware driver when a user requests HDLC service */
188int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 75int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -191,17 +78,21 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
191#define register_hdlc_device(dev) register_netdev(dev) 78#define register_hdlc_device(dev) register_netdev(dev)
192void unregister_hdlc_device(struct net_device *dev); 79void unregister_hdlc_device(struct net_device *dev);
193 80
81
82void register_hdlc_protocol(struct hdlc_proto *proto);
83void unregister_hdlc_protocol(struct hdlc_proto *proto);
84
194struct net_device *alloc_hdlcdev(void *priv); 85struct net_device *alloc_hdlcdev(void *priv);
195 86
196static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) 87
88static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev)
197{ 89{
198 return netdev_priv(dev); 90 return netdev_priv(dev);
199} 91}
200 92
201 93static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev)
202static __inline__ pvc_device* dev_to_pvc(struct net_device *dev)
203{ 94{
204 return (pvc_device*)dev->priv; 95 return netdev_priv(dev) + sizeof(struct hdlc_device_desc);
205} 96}
206 97
207 98
@@ -225,18 +116,14 @@ int hdlc_open(struct net_device *dev);
225/* Must be called by hardware driver when HDLC device is being closed */ 116/* Must be called by hardware driver when HDLC device is being closed */
226void hdlc_close(struct net_device *dev); 117void hdlc_close(struct net_device *dev);
227 118
119int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
120 int (*rx)(struct sk_buff *skb), size_t size);
228/* May be used by hardware driver to gain control over HDLC device */ 121/* May be used by hardware driver to gain control over HDLC device */
229static __inline__ void hdlc_proto_detach(hdlc_device *hdlc) 122void detach_hdlc_protocol(struct net_device *dev);
230{
231 if (hdlc->proto.detach)
232 hdlc->proto.detach(hdlc);
233 hdlc->proto.detach = NULL;
234}
235
236 123
237static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) 124static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev)
238{ 125{
239 return &dev_to_hdlc(dev)->stats; 126 return &dev_to_desc(dev)->stats;
240} 127}
241 128
242 129
@@ -248,8 +135,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
248 skb->mac.raw = skb->data; 135 skb->mac.raw = skb->data;
249 skb->dev = dev; 136 skb->dev = dev;
250 137
251 if (hdlc->proto.type_trans) 138 if (hdlc->proto->type_trans)
252 return hdlc->proto.type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
253 else 140 else
254 return htons(ETH_P_HDLC); 141 return htons(ETH_P_HDLC);
255} 142}
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h
index 78430ba3ea69..583972364357 100644
--- a/include/linux/hdlc/ioctl.h
+++ b/include/linux/hdlc/ioctl.h
@@ -1,6 +1,39 @@
1#ifndef __HDLC_IOCTL_H__ 1#ifndef __HDLC_IOCTL_H__
2#define __HDLC_IOCTL_H__ 2#define __HDLC_IOCTL_H__
3 3
4
5#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
6
7#define CLOCK_DEFAULT 0 /* Default setting */
8#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
9#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
10#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
11#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
12
13
14#define ENCODING_DEFAULT 0 /* Default setting */
15#define ENCODING_NRZ 1
16#define ENCODING_NRZI 2
17#define ENCODING_FM_MARK 3
18#define ENCODING_FM_SPACE 4
19#define ENCODING_MANCHESTER 5
20
21
22#define PARITY_DEFAULT 0 /* Default setting */
23#define PARITY_NONE 1 /* No parity */
24#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
25#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
26#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
27#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
28#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
29#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
30
31#define LMI_DEFAULT 0 /* Default setting */
32#define LMI_NONE 1 /* No LMI, all PVCs are static */
33#define LMI_ANSI 2 /* ANSI Annex D */
34#define LMI_CCITT 3 /* ITU-T Annex A */
35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
36
4typedef struct { 37typedef struct {
5 unsigned int clock_rate; /* bits per second */ 38 unsigned int clock_rate; /* bits per second */
6 unsigned int clock_type; /* internal, external, TX-internal etc. */ 39 unsigned int clock_type; /* internal, external, TX-internal etc. */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 85ce7ef9a512..fd7d12daa94f 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -24,11 +24,15 @@ static inline void flush_kernel_dcache_page(struct page *page)
24 24
25/* declarations for linux/mm/highmem.c */ 25/* declarations for linux/mm/highmem.c */
26unsigned int nr_free_highpages(void); 26unsigned int nr_free_highpages(void);
27extern unsigned long totalhigh_pages;
27 28
28#else /* CONFIG_HIGHMEM */ 29#else /* CONFIG_HIGHMEM */
29 30
30static inline unsigned int nr_free_highpages(void) { return 0; } 31static inline unsigned int nr_free_highpages(void) { return 0; }
31 32
33#define totalhigh_pages 0
34
35#ifndef ARCH_HAS_KMAP
32static inline void *kmap(struct page *page) 36static inline void *kmap(struct page *page)
33{ 37{
34 might_sleep(); 38 might_sleep();
@@ -41,6 +45,7 @@ static inline void *kmap(struct page *page)
41#define kunmap_atomic(addr, idx) do { } while (0) 45#define kunmap_atomic(addr, idx) do { } while (0)
42#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) 46#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
43#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 47#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
48#endif
44 49
45#endif /* CONFIG_HIGHMEM */ 50#endif /* CONFIG_HIGHMEM */
46 51
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index c0e7fab28ce3..c8f8df25c7e0 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -40,7 +40,6 @@ struct i2c_algo_bit_data {
40 /* local settings */ 40 /* local settings */
41 int udelay; /* half-clock-cycle time in microsecs */ 41 int udelay; /* half-clock-cycle time in microsecs */
42 /* i.e. clock is (500 / udelay) KHz */ 42 /* i.e. clock is (500 / udelay) KHz */
43 int mdelay; /* in millisecs, unused */
44 int timeout; /* in jiffies */ 43 int timeout; /* in jiffies */
45}; 44};
46 45
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 18b0adf57a3d..9908f3fc4839 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -35,7 +35,6 @@ struct i2c_algo_pcf_data {
35 35
36 /* local settings */ 36 /* local settings */
37 int udelay; 37 int udelay;
38 int mdelay;
39 int timeout; 38 int timeout;
40}; 39};
41 40
diff --git a/include/linux/i2c-algo-sibyte.h b/include/linux/i2c-algo-sibyte.h
deleted file mode 100644
index 03914ded8614..000000000000
--- a/include/linux/i2c-algo-sibyte.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2001,2002,2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef I2C_ALGO_SIBYTE_H
20#define I2C_ALGO_SIBYTE_H 1
21
22#include <linux/i2c.h>
23
24struct i2c_algo_sibyte_data {
25 void *data; /* private data */
26 int bus; /* which bus */
27 void *reg_base; /* CSR base */
28};
29
30int i2c_sibyte_add_bus(struct i2c_adapter *, int speed);
31int i2c_sibyte_del_bus(struct i2c_adapter *);
32
33#endif /* I2C_ALGO_SIBYTE_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index eb0628a7ecc6..9b5d04768c2c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -64,14 +64,6 @@ extern int i2c_master_recv(struct i2c_client *,char* ,int);
64 */ 64 */
65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); 65extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
66 66
67/*
68 * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
69 * This is not tested/implemented yet and will change in the future.
70 */
71extern int i2c_slave_send(struct i2c_client *,char*,int);
72extern int i2c_slave_recv(struct i2c_client *,char*,int);
73
74
75 67
76/* This is the very generalized SMBus access routine. You probably do not 68/* This is the very generalized SMBus access routine. You probably do not
77 want to use this, though; one of the functions below may be much easier, 69 want to use this, though; one of the functions below may be much easier,
@@ -201,10 +193,6 @@ struct i2c_algorithm {
201 unsigned short flags, char read_write, 193 unsigned short flags, char read_write,
202 u8 command, int size, union i2c_smbus_data * data); 194 u8 command, int size, union i2c_smbus_data * data);
203 195
204 /* --- these optional/future use for some adapter types.*/
205 int (*slave_send)(struct i2c_adapter *,char*,int);
206 int (*slave_recv)(struct i2c_adapter *,char*,int);
207
208 /* --- ioctl like call to set div. parameters. */ 196 /* --- ioctl like call to set div. parameters. */
209 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long); 197 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
210 198
@@ -220,7 +208,7 @@ struct i2c_adapter {
220 struct module *owner; 208 struct module *owner;
221 unsigned int id; 209 unsigned int id;
222 unsigned int class; 210 unsigned int class;
223 struct i2c_algorithm *algo;/* the algorithm to access the bus */ 211 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
224 void *algo_data; 212 void *algo_data;
225 213
226 /* --- administration stuff. */ 214 /* --- administration stuff. */
diff --git a/include/linux/if.h b/include/linux/if.h
index cd080d765324..8018c2e22c0c 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -59,6 +59,8 @@
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */ 59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */ 60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
62 64
63#define IF_GET_IFACE 0x0001 /* for querying only */ 65#define IF_GET_IFACE 0x0001 /* for querying only */
64#define IF_GET_PROTO 0x0002 66#define IF_GET_PROTO 0x0002
diff --git a/include/linux/init.h b/include/linux/init.h
index 6667785dd1ff..e92b1455d7af 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -68,6 +68,7 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
68 68
69/* Defined in init/main.c */ 69/* Defined in init/main.c */
70extern char saved_command_line[]; 70extern char saved_command_line[];
71extern unsigned int reset_devices;
71 72
72/* used by init/main.c */ 73/* used by init/main.c */
73extern void setup_arch(char **); 74extern void setup_arch(char **);
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fbf6d901e9c2..48d3cb3b6a47 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -320,7 +320,9 @@ handle_irq_name(void fastcall (*handle)(unsigned int, struct irq_desc *,
320 * Monolithic do_IRQ implementation. 320 * Monolithic do_IRQ implementation.
321 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) 321 * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly)
322 */ 322 */
323#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
323extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); 324extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
325#endif
324 326
325/* 327/*
326 * Architectures call this to let the generic IRQ layer 328 * Architectures call this to let the generic IRQ layer
@@ -332,10 +334,14 @@ static inline void generic_handle_irq(unsigned int irq, struct pt_regs *regs)
332{ 334{
333 struct irq_desc *desc = irq_desc + irq; 335 struct irq_desc *desc = irq_desc + irq;
334 336
337#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
338 desc->handle_irq(irq, desc, regs);
339#else
335 if (likely(desc->handle_irq)) 340 if (likely(desc->handle_irq))
336 desc->handle_irq(irq, desc, regs); 341 desc->handle_irq(irq, desc, regs);
337 else 342 else
338 __do_IRQ(irq, regs); 343 __do_IRQ(irq, regs);
344#endif
339} 345}
340 346
341/* Handling of unhandled and spurious interrupts: */ 347/* Handling of unhandled and spurious interrupts: */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index a04c154c5207..a6d9daa38c6d 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * linux/include/linux/jbd.h 2 * linux/include/linux/jbd.h
3 * 3 *
4 * Written by Stephen C. Tweedie <sct@redhat.com> 4 * Written by Stephen C. Tweedie <sct@redhat.com>
5 * 5 *
6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved 6 * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
@@ -64,7 +64,7 @@ extern int journal_enable_debug;
64 if ((n) <= journal_enable_debug) { \ 64 if ((n) <= journal_enable_debug) { \
65 printk (KERN_DEBUG "(%s, %d): %s: ", \ 65 printk (KERN_DEBUG "(%s, %d): %s: ", \
66 __FILE__, __LINE__, __FUNCTION__); \ 66 __FILE__, __LINE__, __FUNCTION__); \
67 printk (f, ## a); \ 67 printk (f, ## a); \
68 } \ 68 } \
69 } while (0) 69 } while (0)
70#else 70#else
@@ -97,8 +97,8 @@ extern void jbd_slab_free(void *ptr, size_t size);
97 * number of outstanding buffers possible at any time. When the 97 * number of outstanding buffers possible at any time. When the
98 * operation completes, any buffer credits not used are credited back to 98 * operation completes, any buffer credits not used are credited back to
99 * the transaction, so that at all times we know how many buffers the 99 * the transaction, so that at all times we know how many buffers the
100 * outstanding updates on a transaction might possibly touch. 100 * outstanding updates on a transaction might possibly touch.
101 * 101 *
102 * This is an opaque datatype. 102 * This is an opaque datatype.
103 **/ 103 **/
104typedef struct handle_s handle_t; /* Atomic operation type */ 104typedef struct handle_s handle_t; /* Atomic operation type */
@@ -108,7 +108,7 @@ typedef struct handle_s handle_t; /* Atomic operation type */
108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem. 108 * typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
109 * 109 *
110 * journal_t is linked to from the fs superblock structure. 110 * journal_t is linked to from the fs superblock structure.
111 * 111 *
112 * We use the journal_t to keep track of all outstanding transaction 112 * We use the journal_t to keep track of all outstanding transaction
113 * activity on the filesystem, and to manage the state of the log 113 * activity on the filesystem, and to manage the state of the log
114 * writing process. 114 * writing process.
@@ -128,7 +128,7 @@ typedef struct journal_s journal_t; /* Journal control structure */
128 * On-disk structures 128 * On-disk structures
129 */ 129 */
130 130
131/* 131/*
132 * Descriptor block types: 132 * Descriptor block types:
133 */ 133 */
134 134
@@ -149,8 +149,8 @@ typedef struct journal_header_s
149} journal_header_t; 149} journal_header_t;
150 150
151 151
152/* 152/*
153 * The block tag: used to describe a single buffer in the journal 153 * The block tag: used to describe a single buffer in the journal
154 */ 154 */
155typedef struct journal_block_tag_s 155typedef struct journal_block_tag_s
156{ 156{
@@ -158,9 +158,9 @@ typedef struct journal_block_tag_s
158 __be32 t_flags; /* See below */ 158 __be32 t_flags; /* See below */
159} journal_block_tag_t; 159} journal_block_tag_t;
160 160
161/* 161/*
162 * The revoke descriptor: used on disk to describe a series of blocks to 162 * The revoke descriptor: used on disk to describe a series of blocks to
163 * be revoked from the log 163 * be revoked from the log
164 */ 164 */
165typedef struct journal_revoke_header_s 165typedef struct journal_revoke_header_s
166{ 166{
@@ -201,9 +201,9 @@ typedef struct journal_superblock_s
201 201
202/* 0x0024 */ 202/* 0x0024 */
203 /* Remaining fields are only valid in a version-2 superblock */ 203 /* Remaining fields are only valid in a version-2 superblock */
204 __be32 s_feature_compat; /* compatible feature set */ 204 __be32 s_feature_compat; /* compatible feature set */
205 __be32 s_feature_incompat; /* incompatible feature set */ 205 __be32 s_feature_incompat; /* incompatible feature set */
206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */ 206 __be32 s_feature_ro_compat; /* readonly-compatible feature set */
207/* 0x0030 */ 207/* 0x0030 */
208 __u8 s_uuid[16]; /* 128-bit uuid for journal */ 208 __u8 s_uuid[16]; /* 128-bit uuid for journal */
209 209
@@ -374,10 +374,10 @@ struct jbd_revoke_table_s;
374 **/ 374 **/
375 375
376/* Docbook can't yet cope with the bit fields, but will leave the documentation 376/* Docbook can't yet cope with the bit fields, but will leave the documentation
377 * in so it can be fixed later. 377 * in so it can be fixed later.
378 */ 378 */
379 379
380struct handle_s 380struct handle_s
381{ 381{
382 /* Which compound transaction is this update a part of? */ 382 /* Which compound transaction is this update a part of? */
383 transaction_t *h_transaction; 383 transaction_t *h_transaction;
@@ -435,7 +435,7 @@ struct handle_s
435 * 435 *
436 */ 436 */
437 437
438struct transaction_s 438struct transaction_s
439{ 439{
440 /* Pointer to the journal for this transaction. [no locking] */ 440 /* Pointer to the journal for this transaction. [no locking] */
441 journal_t *t_journal; 441 journal_t *t_journal;
@@ -455,7 +455,7 @@ struct transaction_s
455 T_RUNDOWN, 455 T_RUNDOWN,
456 T_FLUSH, 456 T_FLUSH,
457 T_COMMIT, 457 T_COMMIT,
458 T_FINISHED 458 T_FINISHED
459 } t_state; 459 } t_state;
460 460
461 /* 461 /*
@@ -569,7 +569,7 @@ struct transaction_s
569 * journal_t. 569 * journal_t.
570 * @j_flags: General journaling state flags 570 * @j_flags: General journaling state flags
571 * @j_errno: Is there an outstanding uncleared error on the journal (from a 571 * @j_errno: Is there an outstanding uncleared error on the journal (from a
572 * prior abort)? 572 * prior abort)?
573 * @j_sb_buffer: First part of superblock buffer 573 * @j_sb_buffer: First part of superblock buffer
574 * @j_superblock: Second part of superblock buffer 574 * @j_superblock: Second part of superblock buffer
575 * @j_format_version: Version of the superblock format 575 * @j_format_version: Version of the superblock format
@@ -583,7 +583,7 @@ struct transaction_s
583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 583 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
584 * to start committing, or for a barrier lock to be released 584 * to start committing, or for a barrier lock to be released
585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete 585 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
586 * @j_wait_done_commit: Wait queue for waiting for commit to complete 586 * @j_wait_done_commit: Wait queue for waiting for commit to complete
587 * @j_wait_checkpoint: Wait queue to trigger checkpointing 587 * @j_wait_checkpoint: Wait queue to trigger checkpointing
588 * @j_wait_commit: Wait queue to trigger commit 588 * @j_wait_commit: Wait queue to trigger commit
589 * @j_wait_updates: Wait queue to wait for updates to complete 589 * @j_wait_updates: Wait queue to wait for updates to complete
@@ -592,7 +592,7 @@ struct transaction_s
592 * @j_tail: Journal tail - identifies the oldest still-used block in the 592 * @j_tail: Journal tail - identifies the oldest still-used block in the
593 * journal. 593 * journal.
594 * @j_free: Journal free - how many free blocks are there in the journal? 594 * @j_free: Journal free - how many free blocks are there in the journal?
595 * @j_first: The block number of the first usable block 595 * @j_first: The block number of the first usable block
596 * @j_last: The block number one beyond the last usable block 596 * @j_last: The block number one beyond the last usable block
597 * @j_dev: Device where we store the journal 597 * @j_dev: Device where we store the journal
598 * @j_blocksize: blocksize for the location where we store the journal. 598 * @j_blocksize: blocksize for the location where we store the journal.
@@ -604,12 +604,12 @@ struct transaction_s
604 * @j_list_lock: Protects the buffer lists and internal buffer state. 604 * @j_list_lock: Protects the buffer lists and internal buffer state.
605 * @j_inode: Optional inode where we store the journal. If present, all journal 605 * @j_inode: Optional inode where we store the journal. If present, all journal
606 * block numbers are mapped into this inode via bmap(). 606 * block numbers are mapped into this inode via bmap().
607 * @j_tail_sequence: Sequence number of the oldest transaction in the log 607 * @j_tail_sequence: Sequence number of the oldest transaction in the log
608 * @j_transaction_sequence: Sequence number of the next transaction to grant 608 * @j_transaction_sequence: Sequence number of the next transaction to grant
609 * @j_commit_sequence: Sequence number of the most recently committed 609 * @j_commit_sequence: Sequence number of the most recently committed
610 * transaction 610 * transaction
611 * @j_commit_request: Sequence number of the most recent transaction wanting 611 * @j_commit_request: Sequence number of the most recent transaction wanting
612 * commit 612 * commit
613 * @j_uuid: Uuid of client object. 613 * @j_uuid: Uuid of client object.
614 * @j_task: Pointer to the current commit thread for this journal 614 * @j_task: Pointer to the current commit thread for this journal
615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 615 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
@@ -699,7 +699,7 @@ struct journal_s
699 wait_queue_head_t j_wait_updates; 699 wait_queue_head_t j_wait_updates;
700 700
701 /* Semaphore for locking against concurrent checkpoints */ 701 /* Semaphore for locking against concurrent checkpoints */
702 struct mutex j_checkpoint_mutex; 702 struct mutex j_checkpoint_mutex;
703 703
704 /* 704 /*
705 * Journal head: identifies the first unused block in the journal. 705 * Journal head: identifies the first unused block in the journal.
@@ -732,7 +732,7 @@ struct journal_s
732 */ 732 */
733 struct block_device *j_dev; 733 struct block_device *j_dev;
734 int j_blocksize; 734 int j_blocksize;
735 unsigned int j_blk_offset; 735 unsigned long j_blk_offset;
736 736
737 /* 737 /*
738 * Device which holds the client fs. For internal journal this will be 738 * Device which holds the client fs. For internal journal this will be
@@ -823,8 +823,8 @@ struct journal_s
823 void *j_private; 823 void *j_private;
824}; 824};
825 825
826/* 826/*
827 * Journal flag definitions 827 * Journal flag definitions
828 */ 828 */
829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ 829#define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */
830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ 830#define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */
@@ -833,7 +833,7 @@ struct journal_s
833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 833#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
834#define JFS_BARRIER 0x020 /* Use IDE barriers */ 834#define JFS_BARRIER 0x020 /* Use IDE barriers */
835 835
836/* 836/*
837 * Function declarations for the journaling transaction and buffer 837 * Function declarations for the journaling transaction and buffer
838 * management 838 * management
839 */ 839 */
@@ -862,11 +862,11 @@ int __journal_remove_checkpoint(struct journal_head *);
862void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 862void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
863 863
864/* Buffer IO */ 864/* Buffer IO */
865extern int 865extern int
866journal_write_metadata_buffer(transaction_t *transaction, 866journal_write_metadata_buffer(transaction_t *transaction,
867 struct journal_head *jh_in, 867 struct journal_head *jh_in,
868 struct journal_head **jh_out, 868 struct journal_head **jh_out,
869 int blocknr); 869 unsigned long blocknr);
870 870
871/* Transaction locking */ 871/* Transaction locking */
872extern void __wait_on_journal (journal_t *); 872extern void __wait_on_journal (journal_t *);
@@ -890,7 +890,7 @@ static inline handle_t *journal_current_handle(void)
890/* The journaling code user interface: 890/* The journaling code user interface:
891 * 891 *
892 * Create and destroy handles 892 * Create and destroy handles
893 * Register buffer modifications against the current transaction. 893 * Register buffer modifications against the current transaction.
894 */ 894 */
895 895
896extern handle_t *journal_start(journal_t *, int nblocks); 896extern handle_t *journal_start(journal_t *, int nblocks);
@@ -917,11 +917,11 @@ extern journal_t * journal_init_dev(struct block_device *bdev,
917 int start, int len, int bsize); 917 int start, int len, int bsize);
918extern journal_t * journal_init_inode (struct inode *); 918extern journal_t * journal_init_inode (struct inode *);
919extern int journal_update_format (journal_t *); 919extern int journal_update_format (journal_t *);
920extern int journal_check_used_features 920extern int journal_check_used_features
921 (journal_t *, unsigned long, unsigned long, unsigned long); 921 (journal_t *, unsigned long, unsigned long, unsigned long);
922extern int journal_check_available_features 922extern int journal_check_available_features
923 (journal_t *, unsigned long, unsigned long, unsigned long); 923 (journal_t *, unsigned long, unsigned long, unsigned long);
924extern int journal_set_features 924extern int journal_set_features
925 (journal_t *, unsigned long, unsigned long, unsigned long); 925 (journal_t *, unsigned long, unsigned long, unsigned long);
926extern int journal_create (journal_t *); 926extern int journal_create (journal_t *);
927extern int journal_load (journal_t *journal); 927extern int journal_load (journal_t *journal);
@@ -1015,7 +1015,7 @@ do { \
1015 * bit, when set, indicates that we have had a fatal error somewhere, 1015 * bit, when set, indicates that we have had a fatal error somewhere,
1016 * either inside the journaling layer or indicated to us by the client 1016 * either inside the journaling layer or indicated to us by the client
1017 * (eg. ext3), and that we and should not commit any further 1017 * (eg. ext3), and that we and should not commit any further
1018 * transactions. 1018 * transactions.
1019 */ 1019 */
1020 1020
1021static inline int is_journal_aborted(journal_t *journal) 1021static inline int is_journal_aborted(journal_t *journal)
@@ -1082,7 +1082,7 @@ static inline int jbd_space_needed(journal_t *journal)
1082#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1082#define BJ_Reserved 7 /* Buffer is reserved for access by journal */
1083#define BJ_Locked 8 /* Locked for I/O during commit */ 1083#define BJ_Locked 8 /* Locked for I/O during commit */
1084#define BJ_Types 9 1084#define BJ_Types 9
1085 1085
1086extern int jbd_blocks_per_page(struct inode *inode); 1086extern int jbd_blocks_per_page(struct inode *inode);
1087 1087
1088#ifdef __KERNEL__ 1088#ifdef __KERNEL__
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 329ebcffa106..c8d5f207c3d4 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -115,6 +115,21 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 115 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 116#define time_before_eq(a,b) time_after_eq(b,a)
117 117
118/* Same as above, but does so with platform independent 64bit types.
119 * These must be used when utilizing jiffies_64 (i.e. return value of
120 * get_jiffies_64() */
121#define time_after64(a,b) \
122 (typecheck(__u64, a) && \
123 typecheck(__u64, b) && \
124 ((__s64)(b) - (__s64)(a) < 0))
125#define time_before64(a,b) time_after64(b,a)
126
127#define time_after_eq64(a,b) \
128 (typecheck(__u64, a) && \
129 typecheck(__u64, b) && \
130 ((__s64)(a) - (__s64)(b) >= 0))
131#define time_before_eq64(a,b) time_after_eq64(b,a)
132
118/* 133/*
119 * Have the 32 bit jiffies value wrap 5 minutes after boot 134 * Have the 32 bit jiffies value wrap 5 minutes after boot
120 * so jiffies wrap bugs show up earlier. 135 * so jiffies wrap bugs show up earlier.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e44a37e2c71c..4d00988dad03 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -187,6 +187,7 @@ extern void bust_spinlocks(int yes);
187extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 187extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
188extern int panic_timeout; 188extern int panic_timeout;
189extern int panic_on_oops; 189extern int panic_on_oops;
190extern int panic_on_unrecovered_nmi;
190extern int tainted; 191extern int tainted;
191extern const char *print_tainted(void); 192extern const char *print_tainted(void);
192extern void add_taint(unsigned); 193extern void add_taint(unsigned);
@@ -349,4 +350,11 @@ struct sysinfo {
349/* Trap pasters of __FUNCTION__ at compile-time */ 350/* Trap pasters of __FUNCTION__ at compile-time */
350#define __FUNCTION__ (__func__) 351#define __FUNCTION__ (__func__)
351 352
353/* This helps us to avoid #ifdef CONFIG_NUMA */
354#ifdef CONFIG_NUMA
355#define NUMA_BUILD 1
356#else
357#define NUMA_BUILD 0
358#endif
359
352#endif 360#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 2d229327959e..bcd9cd173c2c 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -20,6 +20,7 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/sysfs.h> 22#include <linux/sysfs.h>
23#include <linux/compiler.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
24#include <linux/rwsem.h> 25#include <linux/rwsem.h>
25#include <linux/kref.h> 26#include <linux/kref.h>
@@ -71,12 +72,12 @@ static inline const char * kobject_name(const struct kobject * kobj)
71extern void kobject_init(struct kobject *); 72extern void kobject_init(struct kobject *);
72extern void kobject_cleanup(struct kobject *); 73extern void kobject_cleanup(struct kobject *);
73 74
74extern int kobject_add(struct kobject *); 75extern int __must_check kobject_add(struct kobject *);
75extern void kobject_del(struct kobject *); 76extern void kobject_del(struct kobject *);
76 77
77extern int kobject_rename(struct kobject *, const char *new_name); 78extern int __must_check kobject_rename(struct kobject *, const char *new_name);
78 79
79extern int kobject_register(struct kobject *); 80extern int __must_check kobject_register(struct kobject *);
80extern void kobject_unregister(struct kobject *); 81extern void kobject_unregister(struct kobject *);
81 82
82extern struct kobject * kobject_get(struct kobject *); 83extern struct kobject * kobject_get(struct kobject *);
@@ -128,8 +129,8 @@ struct kset {
128 129
129 130
130extern void kset_init(struct kset * k); 131extern void kset_init(struct kset * k);
131extern int kset_add(struct kset * k); 132extern int __must_check kset_add(struct kset * k);
132extern int kset_register(struct kset * k); 133extern int __must_check kset_register(struct kset * k);
133extern void kset_unregister(struct kset * k); 134extern void kset_unregister(struct kset * k);
134 135
135static inline struct kset * to_kset(struct kobject * kobj) 136static inline struct kset * to_kset(struct kobject * kobj)
@@ -239,7 +240,7 @@ extern struct subsystem hypervisor_subsys;
239 (obj)->subsys.kset.kobj.kset = &(_subsys).kset 240 (obj)->subsys.kset.kobj.kset = &(_subsys).kset
240 241
241extern void subsystem_init(struct subsystem *); 242extern void subsystem_init(struct subsystem *);
242extern int subsystem_register(struct subsystem *); 243extern int __must_check subsystem_register(struct subsystem *);
243extern void subsystem_unregister(struct subsystem *); 244extern void subsystem_unregister(struct subsystem *);
244 245
245static inline struct subsystem * subsys_get(struct subsystem * s) 246static inline struct subsystem * subsys_get(struct subsystem * s)
@@ -258,7 +259,8 @@ struct subsys_attribute {
258 ssize_t (*store)(struct subsystem *, const char *, size_t); 259 ssize_t (*store)(struct subsystem *, const char *, size_t);
259}; 260};
260 261
261extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 262extern int __must_check subsys_create_file(struct subsystem * ,
263 struct subsys_attribute *);
262 264
263#if defined(CONFIG_HOTPLUG) 265#if defined(CONFIG_HOTPLUG)
264void kobject_uevent(struct kobject *kobj, enum kobject_action action); 266void kobject_uevent(struct kobject *kobj, enum kobject_action action);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1ef3d3901b47..d6a3d4b345fc 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -36,7 +36,15 @@
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38 38
39/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard
41 * not a legacy or ISA standard.
42 */
43#ifdef CONFIG_ATA_NONSTANDARD
39#include <asm/libata-portmap.h> 44#include <asm/libata-portmap.h>
45#else
46#include <asm-generic/libata-portmap.h>
47#endif
40 48
41/* 49/*
42 * compile-time options: to be removed as soon as all the drivers are 50 * compile-time options: to be removed as soon as all the drivers are
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 932021f872d5..6c9873f88287 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -35,9 +35,13 @@
35#endif 35#endif
36 36
37#define KPROBE_ENTRY(name) \ 37#define KPROBE_ENTRY(name) \
38 .section .kprobes.text, "ax"; \ 38 .pushsection .kprobes.text, "ax"; \
39 ENTRY(name) 39 ENTRY(name)
40 40
41#define KPROBE_END(name) \
42 END(name); \
43 .popsection
44
41#ifndef END 45#ifndef END
42#define END(name) \ 46#define END(name) \
43 .size name, .-name 47 .size name, .-name
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 72440f0a443d..09f0f575ddff 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -162,9 +162,9 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
162 unsigned long addr); 162 unsigned long addr);
163extern unsigned slab_node(struct mempolicy *policy); 163extern unsigned slab_node(struct mempolicy *policy);
164 164
165extern int policy_zone; 165extern enum zone_type policy_zone;
166 166
167static inline void check_highest_zone(int k) 167static inline void check_highest_zone(enum zone_type k)
168{ 168{
169 if (k > policy_zone) 169 if (k > policy_zone)
170 policy_zone = k; 170 policy_zone = k;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 224178a000d2..7b703b6d4358 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -15,6 +15,8 @@
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/debug_locks.h> 17#include <linux/debug_locks.h>
18#include <linux/backing-dev.h>
19#include <linux/mm_types.h>
18 20
19struct mempolicy; 21struct mempolicy;
20struct anon_vma; 22struct anon_vma;
@@ -197,6 +199,7 @@ struct vm_operations_struct {
197 void (*open)(struct vm_area_struct * area); 199 void (*open)(struct vm_area_struct * area);
198 void (*close)(struct vm_area_struct * area); 200 void (*close)(struct vm_area_struct * area);
199 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type); 201 struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type);
202 unsigned long (*nopfn)(struct vm_area_struct * area, unsigned long address);
200 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock); 203 int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
201 204
202 /* notification that a previously read-only page is about to become 205 /* notification that a previously read-only page is about to become
@@ -214,61 +217,6 @@ struct vm_operations_struct {
214struct mmu_gather; 217struct mmu_gather;
215struct inode; 218struct inode;
216 219
217/*
218 * Each physical page in the system has a struct page associated with
219 * it to keep track of whatever it is we are using the page for at the
220 * moment. Note that we have no way to track which tasks are using
221 * a page.
222 */
223struct page {
224 unsigned long flags; /* Atomic flags, some possibly
225 * updated asynchronously */
226 atomic_t _count; /* Usage count, see below. */
227 atomic_t _mapcount; /* Count of ptes mapped in mms,
228 * to show when page is mapped
229 * & limit reverse map searches.
230 */
231 union {
232 struct {
233 unsigned long private; /* Mapping-private opaque data:
234 * usually used for buffer_heads
235 * if PagePrivate set; used for
236 * swp_entry_t if PageSwapCache;
237 * indicates order in the buddy
238 * system if PG_buddy is set.
239 */
240 struct address_space *mapping; /* If low bit clear, points to
241 * inode address_space, or NULL.
242 * If page mapped as anonymous
243 * memory, low bit is set, and
244 * it points to anon_vma object:
245 * see PAGE_MAPPING_ANON below.
246 */
247 };
248#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
249 spinlock_t ptl;
250#endif
251 };
252 pgoff_t index; /* Our offset within mapping. */
253 struct list_head lru; /* Pageout list, eg. active_list
254 * protected by zone->lru_lock !
255 */
256 /*
257 * On machines where all RAM is mapped into kernel address space,
258 * we can simply calculate the virtual address. On machines with
259 * highmem some memory is mapped into kernel virtual memory
260 * dynamically, so we need a place to store that address.
261 * Note that this field could be 16 bits on x86 ... ;)
262 *
263 * Architectures with slow multiplication can define
264 * WANT_PAGE_VIRTUAL in asm/page.h
265 */
266#if defined(WANT_PAGE_VIRTUAL)
267 void *virtual; /* Kernel virtual address (NULL if
268 not kmapped, ie. highmem) */
269#endif /* WANT_PAGE_VIRTUAL */
270};
271
272#define page_private(page) ((page)->private) 220#define page_private(page) ((page)->private)
273#define set_page_private(page, v) ((page)->private = (v)) 221#define set_page_private(page, v) ((page)->private = (v))
274 222
@@ -278,6 +226,12 @@ struct page {
278 */ 226 */
279#include <linux/page-flags.h> 227#include <linux/page-flags.h>
280 228
229#ifdef CONFIG_DEBUG_VM
230#define VM_BUG_ON(cond) BUG_ON(cond)
231#else
232#define VM_BUG_ON(condition) do { } while(0)
233#endif
234
281/* 235/*
282 * Methods to modify the page usage count. 236 * Methods to modify the page usage count.
283 * 237 *
@@ -292,12 +246,11 @@ struct page {
292 */ 246 */
293 247
294/* 248/*
295 * Drop a ref, return true if the logical refcount fell to zero (the page has 249 * Drop a ref, return true if the refcount fell to zero (the page has no users)
296 * no users)
297 */ 250 */
298static inline int put_page_testzero(struct page *page) 251static inline int put_page_testzero(struct page *page)
299{ 252{
300 BUG_ON(atomic_read(&page->_count) == 0); 253 VM_BUG_ON(atomic_read(&page->_count) == 0);
301 return atomic_dec_and_test(&page->_count); 254 return atomic_dec_and_test(&page->_count);
302} 255}
303 256
@@ -307,11 +260,10 @@ static inline int put_page_testzero(struct page *page)
307 */ 260 */
308static inline int get_page_unless_zero(struct page *page) 261static inline int get_page_unless_zero(struct page *page)
309{ 262{
263 VM_BUG_ON(PageCompound(page));
310 return atomic_inc_not_zero(&page->_count); 264 return atomic_inc_not_zero(&page->_count);
311} 265}
312 266
313extern void FASTCALL(__page_cache_release(struct page *));
314
315static inline int page_count(struct page *page) 267static inline int page_count(struct page *page)
316{ 268{
317 if (unlikely(PageCompound(page))) 269 if (unlikely(PageCompound(page)))
@@ -323,6 +275,7 @@ static inline void get_page(struct page *page)
323{ 275{
324 if (unlikely(PageCompound(page))) 276 if (unlikely(PageCompound(page)))
325 page = (struct page *)page_private(page); 277 page = (struct page *)page_private(page);
278 VM_BUG_ON(atomic_read(&page->_count) == 0);
326 atomic_inc(&page->_count); 279 atomic_inc(&page->_count);
327} 280}
328 281
@@ -349,43 +302,55 @@ void split_page(struct page *page, unsigned int order);
349 * For the non-reserved pages, page_count(page) denotes a reference count. 302 * For the non-reserved pages, page_count(page) denotes a reference count.
350 * page_count() == 0 means the page is free. page->lru is then used for 303 * page_count() == 0 means the page is free. page->lru is then used for
351 * freelist management in the buddy allocator. 304 * freelist management in the buddy allocator.
352 * page_count() == 1 means the page is used for exactly one purpose 305 * page_count() > 0 means the page has been allocated.
353 * (e.g. a private data page of one process). 306 *
307 * Pages are allocated by the slab allocator in order to provide memory
308 * to kmalloc and kmem_cache_alloc. In this case, the management of the
309 * page, and the fields in 'struct page' are the responsibility of mm/slab.c
310 * unless a particular usage is carefully commented. (the responsibility of
311 * freeing the kmalloc memory is the caller's, of course).
354 * 312 *
355 * A page may be used for kmalloc() or anyone else who does a 313 * A page may be used by anyone else who does a __get_free_page().
356 * __get_free_page(). In this case the page_count() is at least 1, and 314 * In this case, page_count still tracks the references, and should only
357 * all other fields are unused but should be 0 or NULL. The 315 * be used through the normal accessor functions. The top bits of page->flags
358 * management of this page is the responsibility of the one who uses 316 * and page->virtual store page management information, but all other fields
359 * it. 317 * are unused and could be used privately, carefully. The management of this
318 * page is the responsibility of the one who allocated it, and those who have
319 * subsequently been given references to it.
360 * 320 *
361 * The other pages (we may call them "process pages") are completely 321 * The other pages (we may call them "pagecache pages") are completely
362 * managed by the Linux memory manager: I/O, buffers, swapping etc. 322 * managed by the Linux memory manager: I/O, buffers, swapping etc.
363 * The following discussion applies only to them. 323 * The following discussion applies only to them.
364 * 324 *
365 * A page may belong to an inode's memory mapping. In this case, 325 * A pagecache page contains an opaque `private' member, which belongs to the
366 * page->mapping is the pointer to the inode, and page->index is the 326 * page's address_space. Usually, this is the address of a circular list of
367 * file offset of the page, in units of PAGE_CACHE_SIZE. 327 * the page's disk buffers. PG_private must be set to tell the VM to call
328 * into the filesystem to release these pages.
368 * 329 *
369 * A page contains an opaque `private' member, which belongs to the 330 * A page may belong to an inode's memory mapping. In this case, page->mapping
370 * page's address_space. Usually, this is the address of a circular 331 * is the pointer to the inode, and page->index is the file offset of the page,
371 * list of the page's disk buffers. 332 * in units of PAGE_CACHE_SIZE.
372 * 333 *
373 * For pages belonging to inodes, the page_count() is the number of 334 * If pagecache pages are not associated with an inode, they are said to be
374 * attaches, plus 1 if `private' contains something, plus one for 335 * anonymous pages. These may become associated with the swapcache, and in that
375 * the page cache itself. 336 * case PG_swapcache is set, and page->private is an offset into the swapcache.
376 * 337 *
377 * Instead of keeping dirty/clean pages in per address-space lists, we instead 338 * In either case (swapcache or inode backed), the pagecache itself holds one
378 * now tag pages as dirty/under writeback in the radix tree. 339 * reference to the page. Setting PG_private should also increment the
340 * refcount. The each user mapping also has a reference to the page.
379 * 341 *
380 * There is also a per-mapping radix tree mapping index to the page 342 * The pagecache pages are stored in a per-mapping radix tree, which is
381 * in memory if present. The tree is rooted at mapping->root. 343 * rooted at mapping->page_tree, and indexed by offset.
344 * Where 2.4 and early 2.6 kernels kept dirty/clean pages in per-address_space
345 * lists, we instead now tag pages as dirty/writeback in the radix tree.
382 * 346 *
383 * All process pages can do I/O: 347 * All pagecache pages may be subject to I/O:
384 * - inode pages may need to be read from disk, 348 * - inode pages may need to be read from disk,
385 * - inode pages which have been modified and are MAP_SHARED may need 349 * - inode pages which have been modified and are MAP_SHARED may need
386 * to be written to disk, 350 * to be written back to the inode on disk,
387 * - private pages which have been modified may need to be swapped out 351 * - anonymous pages (including MAP_PRIVATE file mappings) which have been
388 * to swap space and (later) to be read back into memory. 352 * modified may need to be swapped out to swap space and (later) to be read
353 * back into memory.
389 */ 354 */
390 355
391/* 356/*
@@ -463,7 +428,7 @@ void split_page(struct page *page, unsigned int order);
463#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 428#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
464#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) 429#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1)
465 430
466static inline unsigned long page_zonenum(struct page *page) 431static inline enum zone_type page_zonenum(struct page *page)
467{ 432{
468 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 433 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
469} 434}
@@ -480,23 +445,33 @@ static inline struct zone *page_zone(struct page *page)
480 return zone_table[page_zone_id(page)]; 445 return zone_table[page_zone_id(page)];
481} 446}
482 447
448static inline unsigned long zone_to_nid(struct zone *zone)
449{
450#ifdef CONFIG_NUMA
451 return zone->node;
452#else
453 return 0;
454#endif
455}
456
483static inline unsigned long page_to_nid(struct page *page) 457static inline unsigned long page_to_nid(struct page *page)
484{ 458{
485 if (FLAGS_HAS_NODE) 459 if (FLAGS_HAS_NODE)
486 return (page->flags >> NODES_PGSHIFT) & NODES_MASK; 460 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
487 else 461 else
488 return page_zone(page)->zone_pgdat->node_id; 462 return zone_to_nid(page_zone(page));
489} 463}
490static inline unsigned long page_to_section(struct page *page) 464static inline unsigned long page_to_section(struct page *page)
491{ 465{
492 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 466 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
493} 467}
494 468
495static inline void set_page_zone(struct page *page, unsigned long zone) 469static inline void set_page_zone(struct page *page, enum zone_type zone)
496{ 470{
497 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT); 471 page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
498 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT; 472 page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
499} 473}
474
500static inline void set_page_node(struct page *page, unsigned long node) 475static inline void set_page_node(struct page *page, unsigned long node)
501{ 476{
502 page->flags &= ~(NODES_MASK << NODES_PGSHIFT); 477 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
@@ -508,7 +483,7 @@ static inline void set_page_section(struct page *page, unsigned long section)
508 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; 483 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
509} 484}
510 485
511static inline void set_page_links(struct page *page, unsigned long zone, 486static inline void set_page_links(struct page *page, enum zone_type zone,
512 unsigned long node, unsigned long pfn) 487 unsigned long node, unsigned long pfn)
513{ 488{
514 set_page_zone(page, zone); 489 set_page_zone(page, zone);
@@ -521,11 +496,6 @@ static inline void set_page_links(struct page *page, unsigned long zone,
521 */ 496 */
522#include <linux/vmstat.h> 497#include <linux/vmstat.h>
523 498
524#ifndef CONFIG_DISCONTIGMEM
525/* The array of struct pages - for discontigmem use pgdat->lmem_map */
526extern struct page *mem_map;
527#endif
528
529static __always_inline void *lowmem_page_address(struct page *page) 499static __always_inline void *lowmem_page_address(struct page *page)
530{ 500{
531 return __va(page_to_pfn(page) << PAGE_SHIFT); 501 return __va(page_to_pfn(page) << PAGE_SHIFT);
@@ -625,6 +595,12 @@ static inline int page_mapped(struct page *page)
625#define NOPAGE_OOM ((struct page *) (-1)) 595#define NOPAGE_OOM ((struct page *) (-1))
626 596
627/* 597/*
598 * Error return values for the *_nopfn functions
599 */
600#define NOPFN_SIGBUS ((unsigned long) -1)
601#define NOPFN_OOM ((unsigned long) -2)
602
603/*
628 * Different kinds of faults, as returned by handle_mm_fault(). 604 * Different kinds of faults, as returned by handle_mm_fault().
629 * Used to decide whether a process gets delivered SIGBUS or 605 * Used to decide whether a process gets delivered SIGBUS or
630 * just gets major/minor fault counters bumped up. 606 * just gets major/minor fault counters bumped up.
@@ -802,6 +778,39 @@ struct shrinker;
802extern struct shrinker *set_shrinker(int, shrinker_t); 778extern struct shrinker *set_shrinker(int, shrinker_t);
803extern void remove_shrinker(struct shrinker *shrinker); 779extern void remove_shrinker(struct shrinker *shrinker);
804 780
781/*
782 * Some shared mappigns will want the pages marked read-only
783 * to track write events. If so, we'll downgrade vm_page_prot
784 * to the private version (using protection_map[] without the
785 * VM_SHARED bit).
786 */
787static inline int vma_wants_writenotify(struct vm_area_struct *vma)
788{
789 unsigned int vm_flags = vma->vm_flags;
790
791 /* If it was private or non-writable, the write bit is already clear */
792 if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
793 return 0;
794
795 /* The backer wishes to know when pages are first written to? */
796 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
797 return 1;
798
799 /* The open routine did something to the protections already? */
800 if (pgprot_val(vma->vm_page_prot) !=
801 pgprot_val(protection_map[vm_flags &
802 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
803 return 0;
804
805 /* Specialty mapping? */
806 if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
807 return 0;
808
809 /* Can the mapping track the dirty pages? */
810 return vma->vm_file && vma->vm_file->f_mapping &&
811 mapping_cap_account_dirty(vma->vm_file->f_mapping);
812}
813
805extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl)); 814extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
806 815
807int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address); 816int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
@@ -879,6 +888,56 @@ extern void free_area_init(unsigned long * zones_size);
879extern void free_area_init_node(int nid, pg_data_t *pgdat, 888extern void free_area_init_node(int nid, pg_data_t *pgdat,
880 unsigned long * zones_size, unsigned long zone_start_pfn, 889 unsigned long * zones_size, unsigned long zone_start_pfn,
881 unsigned long *zholes_size); 890 unsigned long *zholes_size);
891#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
892/*
893 * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its
894 * zones, allocate the backing mem_map and account for memory holes in a more
895 * architecture independent manner. This is a substitute for creating the
896 * zone_sizes[] and zholes_size[] arrays and passing them to
897 * free_area_init_node()
898 *
899 * An architecture is expected to register range of page frames backed by
900 * physical memory with add_active_range() before calling
901 * free_area_init_nodes() passing in the PFN each zone ends at. At a basic
902 * usage, an architecture is expected to do something like
903 *
904 * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn,
905 * max_highmem_pfn};
906 * for_each_valid_physical_page_range()
907 * add_active_range(node_id, start_pfn, end_pfn)
908 * free_area_init_nodes(max_zone_pfns);
909 *
910 * If the architecture guarantees that there are no holes in the ranges
911 * registered with add_active_range(), free_bootmem_active_regions()
912 * will call free_bootmem_node() for each registered physical page range.
913 * Similarly sparse_memory_present_with_active_regions() calls
914 * memory_present() for each range when SPARSEMEM is enabled.
915 *
916 * See mm/page_alloc.c for more information on each function exposed by
917 * CONFIG_ARCH_POPULATES_NODE_MAP
918 */
919extern void free_area_init_nodes(unsigned long *max_zone_pfn);
920extern void add_active_range(unsigned int nid, unsigned long start_pfn,
921 unsigned long end_pfn);
922extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
923 unsigned long new_end_pfn);
924extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
925 unsigned long end_pfn);
926extern void remove_all_active_ranges(void);
927extern unsigned long absent_pages_in_range(unsigned long start_pfn,
928 unsigned long end_pfn);
929extern void get_pfn_range_for_nid(unsigned int nid,
930 unsigned long *start_pfn, unsigned long *end_pfn);
931extern unsigned long find_min_pfn_with_active_regions(void);
932extern unsigned long find_max_pfn_with_active_regions(void);
933extern void free_bootmem_with_active_regions(int nid,
934 unsigned long max_low_pfn);
935extern void sparse_memory_present_with_active_regions(int nid);
936#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
937extern int early_pfn_to_nid(unsigned long pfn);
938#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
939#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
940extern void set_dma_reserve(unsigned long new_dma_reserve);
882extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); 941extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
883extern void setup_per_zone_pages_min(void); 942extern void setup_per_zone_pages_min(void);
884extern void mem_init(void); 943extern void mem_init(void);
@@ -1072,7 +1131,7 @@ void drop_slab(void);
1072extern int randomize_va_space; 1131extern int randomize_va_space;
1073#endif 1132#endif
1074 1133
1075const char *arch_vma_name(struct vm_area_struct *vma); 1134__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma);
1076 1135
1077#endif /* __KERNEL__ */ 1136#endif /* __KERNEL__ */
1078#endif /* _LINUX_MM_H */ 1137#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
new file mode 100644
index 000000000000..c3852fd4a1cc
--- /dev/null
+++ b/include/linux/mm_types.h
@@ -0,0 +1,67 @@
1#ifndef _LINUX_MM_TYPES_H
2#define _LINUX_MM_TYPES_H
3
4#include <linux/types.h>
5#include <linux/threads.h>
6#include <linux/list.h>
7#include <linux/spinlock.h>
8
9struct address_space;
10
11/*
12 * Each physical page in the system has a struct page associated with
13 * it to keep track of whatever it is we are using the page for at the
14 * moment. Note that we have no way to track which tasks are using
15 * a page, though if it is a pagecache page, rmap structures can tell us
16 * who is mapping it.
17 */
18struct page {
19 unsigned long flags; /* Atomic flags, some possibly
20 * updated asynchronously */
21 atomic_t _count; /* Usage count, see below. */
22 atomic_t _mapcount; /* Count of ptes mapped in mms,
23 * to show when page is mapped
24 * & limit reverse map searches.
25 */
26 union {
27 struct {
28 unsigned long private; /* Mapping-private opaque data:
29 * usually used for buffer_heads
30 * if PagePrivate set; used for
31 * swp_entry_t if PageSwapCache;
32 * indicates order in the buddy
33 * system if PG_buddy is set.
34 */
35 struct address_space *mapping; /* If low bit clear, points to
36 * inode address_space, or NULL.
37 * If page mapped as anonymous
38 * memory, low bit is set, and
39 * it points to anon_vma object:
40 * see PAGE_MAPPING_ANON below.
41 */
42 };
43#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
44 spinlock_t ptl;
45#endif
46 };
47 pgoff_t index; /* Our offset within mapping. */
48 struct list_head lru; /* Pageout list, eg. active_list
49 * protected by zone->lru_lock !
50 */
51 /*
52 * On machines where all RAM is mapped into kernel address space,
53 * we can simply calculate the virtual address. On machines with
54 * highmem some memory is mapped into kernel virtual memory
55 * dynamically, so we need a place to store that address.
56 * Note that this field could be 16 bits on x86 ... ;)
57 *
58 * Architectures with slow multiplication can define
59 * WANT_PAGE_VIRTUAL in asm/page.h
60 */
61#if defined(WANT_PAGE_VIRTUAL)
62 void *virtual; /* Kernel virtual address (NULL if
63 not kmapped, ie. highmem) */
64#endif /* WANT_PAGE_VIRTUAL */
65};
66
67#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index f45163c528e8..59855b8718a0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -51,12 +51,14 @@ enum zone_stat_item {
51 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 51 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
52 only modified from process context */ 52 only modified from process context */
53 NR_FILE_PAGES, 53 NR_FILE_PAGES,
54 NR_SLAB, /* Pages used by slab allocator */ 54 NR_SLAB_RECLAIMABLE,
55 NR_SLAB_UNRECLAIMABLE,
55 NR_PAGETABLE, /* used for pagetables */ 56 NR_PAGETABLE, /* used for pagetables */
56 NR_FILE_DIRTY, 57 NR_FILE_DIRTY,
57 NR_WRITEBACK, 58 NR_WRITEBACK,
58 NR_UNSTABLE_NFS, /* NFS unstable pages */ 59 NR_UNSTABLE_NFS, /* NFS unstable pages */
59 NR_BOUNCE, 60 NR_BOUNCE,
61 NR_VMSCAN_WRITE,
60#ifdef CONFIG_NUMA 62#ifdef CONFIG_NUMA
61 NUMA_HIT, /* allocated in intended node */ 63 NUMA_HIT, /* allocated in intended node */
62 NUMA_MISS, /* allocated in non intended node */ 64 NUMA_MISS, /* allocated in non intended node */
@@ -88,53 +90,68 @@ struct per_cpu_pageset {
88#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 90#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
89#endif 91#endif
90 92
91#define ZONE_DMA 0 93enum zone_type {
92#define ZONE_DMA32 1 94 /*
93#define ZONE_NORMAL 2 95 * ZONE_DMA is used when there are devices that are not able
94#define ZONE_HIGHMEM 3 96 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
95 97 * carve out the portion of memory that is needed for these devices.
96#define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ 98 * The range is arch specific.
97#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ 99 *
98 100 * Some examples
101 *
102 * Architecture Limit
103 * ---------------------------
104 * parisc, ia64, sparc <4G
105 * s390 <2G
106 * arm26 <48M
107 * arm Various
108 * alpha Unlimited or 0-16MB.
109 *
110 * i386, x86_64 and multiple other arches
111 * <16M.
112 */
113 ZONE_DMA,
114#ifdef CONFIG_ZONE_DMA32
115 /*
116 * x86_64 needs two ZONE_DMAs because it supports devices that are
117 * only able to do DMA to the lower 16M but also 32 bit devices that
118 * can only do DMA areas below 4G.
119 */
120 ZONE_DMA32,
121#endif
122 /*
123 * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
124 * performed on pages in ZONE_NORMAL if the DMA devices support
125 * transfers to all addressable memory.
126 */
127 ZONE_NORMAL,
128#ifdef CONFIG_HIGHMEM
129 /*
130 * A memory area that is only addressable by the kernel through
131 * mapping portions into its own address space. This is for example
132 * used by i386 to allow the kernel to address the memory beyond
133 * 900MB. The kernel will set up special mappings (page
134 * table entries on i386) for each page that the kernel needs to
135 * access.
136 */
137 ZONE_HIGHMEM,
138#endif
139 MAX_NR_ZONES
140};
99 141
100/* 142/*
101 * When a memory allocation must conform to specific limitations (such 143 * When a memory allocation must conform to specific limitations (such
102 * as being suitable for DMA) the caller will pass in hints to the 144 * as being suitable for DMA) the caller will pass in hints to the
103 * allocator in the gfp_mask, in the zone modifier bits. These bits 145 * allocator in the gfp_mask, in the zone modifier bits. These bits
104 * are used to select a priority ordered list of memory zones which 146 * are used to select a priority ordered list of memory zones which
105 * match the requested limits. GFP_ZONEMASK defines which bits within 147 * match the requested limits. See gfp_zone() in include/linux/gfp.h
106 * the gfp_mask should be considered as zone modifiers. Each valid
107 * combination of the zone modifier bits has a corresponding list
108 * of zones (in node_zonelists). Thus for two zone modifiers there
109 * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will
110 * be 8 (2 ** 3) zonelists. GFP_ZONETYPES defines the number of possible
111 * combinations of zone modifiers in "zone modifier space".
112 *
113 * As an optimisation any zone modifier bits which are only valid when
114 * no other zone modifier bits are set (loners) should be placed in
115 * the highest order bits of this field. This allows us to reduce the
116 * extent of the zonelists thus saving space. For example in the case
117 * of three zone modifier bits, we could require up to eight zonelists.
118 * If the left most zone modifier is a "loner" then the highest valid
119 * zonelist would be four allowing us to allocate only five zonelists.
120 * Use the first form for GFP_ZONETYPES when the left most bit is not
121 * a "loner", otherwise use the second.
122 *
123 * NOTE! Make sure this matches the zones in <linux/gfp.h>
124 */ 148 */
125#define GFP_ZONEMASK 0x07
126/* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */
127#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
128 149
129/* 150#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM)
130 * On machines where it is needed (eg PCs) we divide physical memory 151#define ZONES_SHIFT 1
131 * into multiple physical zones. On a 32bit PC we have 4 zones: 152#else
132 * 153#define ZONES_SHIFT 2
133 * ZONE_DMA < 16 MB ISA DMA capable memory 154#endif
134 * ZONE_DMA32 0 MB Empty
135 * ZONE_NORMAL 16-896 MB direct mapped by the kernel
136 * ZONE_HIGHMEM > 896 MB only page cache and user processes
137 */
138 155
139struct zone { 156struct zone {
140 /* Fields commonly accessed by the page allocator */ 157 /* Fields commonly accessed by the page allocator */
@@ -151,10 +168,12 @@ struct zone {
151 unsigned long lowmem_reserve[MAX_NR_ZONES]; 168 unsigned long lowmem_reserve[MAX_NR_ZONES];
152 169
153#ifdef CONFIG_NUMA 170#ifdef CONFIG_NUMA
171 int node;
154 /* 172 /*
155 * zone reclaim becomes active if more unmapped pages exist. 173 * zone reclaim becomes active if more unmapped pages exist.
156 */ 174 */
157 unsigned long min_unmapped_ratio; 175 unsigned long min_unmapped_pages;
176 unsigned long min_slab_pages;
158 struct per_cpu_pageset *pageset[NR_CPUS]; 177 struct per_cpu_pageset *pageset[NR_CPUS];
159#else 178#else
160 struct per_cpu_pageset pageset[NR_CPUS]; 179 struct per_cpu_pageset pageset[NR_CPUS];
@@ -266,7 +285,6 @@ struct zone {
266 char *name; 285 char *name;
267} ____cacheline_internodealigned_in_smp; 286} ____cacheline_internodealigned_in_smp;
268 287
269
270/* 288/*
271 * The "priority" of VM scanning is how much of the queues we will scan in one 289 * The "priority" of VM scanning is how much of the queues we will scan in one
272 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 290 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -289,6 +307,18 @@ struct zonelist {
289 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited 307 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
290}; 308};
291 309
310#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
311struct node_active_region {
312 unsigned long start_pfn;
313 unsigned long end_pfn;
314 int nid;
315};
316#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
317
318#ifndef CONFIG_DISCONTIGMEM
319/* The array of struct pages - for discontigmem use pgdat->lmem_map */
320extern struct page *mem_map;
321#endif
292 322
293/* 323/*
294 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM 324 * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -304,7 +334,7 @@ struct zonelist {
304struct bootmem_data; 334struct bootmem_data;
305typedef struct pglist_data { 335typedef struct pglist_data {
306 struct zone node_zones[MAX_NR_ZONES]; 336 struct zone node_zones[MAX_NR_ZONES];
307 struct zonelist node_zonelists[GFP_ZONETYPES]; 337 struct zonelist node_zonelists[MAX_NR_ZONES];
308 int nr_zones; 338 int nr_zones;
309#ifdef CONFIG_FLAT_NODE_MEM_MAP 339#ifdef CONFIG_FLAT_NODE_MEM_MAP
310 struct page *node_mem_map; 340 struct page *node_mem_map;
@@ -373,12 +403,16 @@ static inline int populated_zone(struct zone *zone)
373 return (!!zone->present_pages); 403 return (!!zone->present_pages);
374} 404}
375 405
376static inline int is_highmem_idx(int idx) 406static inline int is_highmem_idx(enum zone_type idx)
377{ 407{
408#ifdef CONFIG_HIGHMEM
378 return (idx == ZONE_HIGHMEM); 409 return (idx == ZONE_HIGHMEM);
410#else
411 return 0;
412#endif
379} 413}
380 414
381static inline int is_normal_idx(int idx) 415static inline int is_normal_idx(enum zone_type idx)
382{ 416{
383 return (idx == ZONE_NORMAL); 417 return (idx == ZONE_NORMAL);
384} 418}
@@ -391,7 +425,11 @@ static inline int is_normal_idx(int idx)
391 */ 425 */
392static inline int is_highmem(struct zone *zone) 426static inline int is_highmem(struct zone *zone)
393{ 427{
428#ifdef CONFIG_HIGHMEM
394 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM; 429 return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
430#else
431 return 0;
432#endif
395} 433}
396 434
397static inline int is_normal(struct zone *zone) 435static inline int is_normal(struct zone *zone)
@@ -401,7 +439,11 @@ static inline int is_normal(struct zone *zone)
401 439
402static inline int is_dma32(struct zone *zone) 440static inline int is_dma32(struct zone *zone)
403{ 441{
442#ifdef CONFIG_ZONE_DMA32
404 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; 443 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
444#else
445 return 0;
446#endif
405} 447}
406 448
407static inline int is_dma(struct zone *zone) 449static inline int is_dma(struct zone *zone)
@@ -421,6 +463,8 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file
421 void __user *, size_t *, loff_t *); 463 void __user *, size_t *, loff_t *);
422int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int, 464int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,
423 struct file *, void __user *, size_t *, loff_t *); 465 struct file *, void __user *, size_t *, loff_t *);
466int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int,
467 struct file *, void __user *, size_t *, loff_t *);
424 468
425#include <linux/topology.h> 469#include <linux/topology.h>
426/* Returns the number of the current Node. */ 470/* Returns the number of the current Node. */
@@ -488,7 +532,8 @@ extern struct zone *next_zone(struct zone *zone);
488 532
489#endif 533#endif
490 534
491#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 535#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
536 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
492#define early_pfn_to_nid(nid) (0UL) 537#define early_pfn_to_nid(nid) (0UL)
493#endif 538#endif
494 539
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f7ca0b09075d..e0c393cc7240 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -308,4 +308,16 @@ struct input_device_id {
308 kernel_ulong_t driver_info; 308 kernel_ulong_t driver_info;
309}; 309};
310 310
311/* EISA */
312
313#define EISA_SIG_LEN 8
314
315/* The EISA signature, in ASCII form, null terminated */
316struct eisa_device_id {
317 char sig[EISA_SIG_LEN];
318 kernel_ulong_t driver_data;
319};
320
321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
322
311#endif /* LINUX_MOD_DEVICETABLE_H */ 323#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 43289127b458..13d6d4eb8b3a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -334,7 +334,6 @@ struct net_device
334 334
335 335
336 struct net_device_stats* (*get_stats)(struct net_device *dev); 336 struct net_device_stats* (*get_stats)(struct net_device *dev);
337 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
338 337
339 /* List of functions to handle Wireless Extensions (instead of ioctl). 338 /* List of functions to handle Wireless Extensions (instead of ioctl).
340 * See <net/iw_handler.h> for details. Jean II */ 339 * See <net/iw_handler.h> for details. Jean II */
@@ -1016,7 +1015,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1016} 1015}
1017 1016
1018/* On bonding slaves other than the currently active slave, suppress 1017/* On bonding slaves other than the currently active slave, suppress
1019 * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast. 1018 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1019 * ARP on active-backup slaves with arp_validate enabled.
1020 */ 1020 */
1021static inline int skb_bond_should_drop(struct sk_buff *skb) 1021static inline int skb_bond_should_drop(struct sk_buff *skb)
1022{ 1022{
@@ -1025,6 +1025,10 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1025 1025
1026 if (master && 1026 if (master &&
1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1027 (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
1028 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1029 skb->protocol == __constant_htons(ETH_P_ARP))
1030 return 0;
1031
1028 if (master->priv_flags & IFF_MASTER_ALB) { 1032 if (master->priv_flags & IFF_MASTER_ALB) {
1029 if (skb->pkt_type != PACKET_BROADCAST && 1033 if (skb->pkt_type != PACKET_BROADCAST &&
1030 skb->pkt_type != PACKET_MULTICAST) 1034 skb->pkt_type != PACKET_MULTICAST)
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 9a285cecf249..312bd2ffee33 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -10,6 +10,8 @@ header-y += xt_connmark.h
10header-y += xt_CONNMARK.h 10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h 11header-y += xt_conntrack.h
12header-y += xt_dccp.h 12header-y += xt_dccp.h
13header-y += xt_dscp.h
14header-y += xt_DSCP.h
13header-y += xt_esp.h 15header-y += xt_esp.h
14header-y += xt_helper.h 16header-y += xt_helper.h
15header-y += xt_length.h 17header-y += xt_length.h
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 36f5bcf513b0..98c9b9f667a5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -315,10 +315,6 @@ extern void nfs_end_data_update(struct inode *);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 316extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 317extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
318extern struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
319 const struct dentry *dentry,
320 struct nfs_fh *fh,
321 struct nfs_fattr *fattr);
322 318
323/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 319/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
324extern u32 root_nfs_parse_addr(char *name); /*__init*/ 320extern u32 root_nfs_parse_addr(char *name); /*__init*/
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f9edcd2ff3c8..31a3cb617ce0 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -269,14 +269,8 @@ fill_post_wcc(struct svc_fh *fhp)
269 fhp->fh_post_uid = inode->i_uid; 269 fhp->fh_post_uid = inode->i_uid;
270 fhp->fh_post_gid = inode->i_gid; 270 fhp->fh_post_gid = inode->i_gid;
271 fhp->fh_post_size = inode->i_size; 271 fhp->fh_post_size = inode->i_size;
272 if (inode->i_blksize) { 272 fhp->fh_post_blksize = BLOCK_SIZE;
273 fhp->fh_post_blksize = inode->i_blksize; 273 fhp->fh_post_blocks = inode->i_blocks;
274 fhp->fh_post_blocks = inode->i_blocks;
275 } else {
276 fhp->fh_post_blksize = BLOCK_SIZE;
277 /* how much do we care for accuracy with MinixFS? */
278 fhp->fh_post_blocks = (inode->i_size+511) >> 9;
279 }
280 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode)); 274 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
281 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode)); 275 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
282 fhp->fh_post_atime = inode->i_atime; 276 fhp->fh_post_atime = inode->i_atime;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5748642e9f36..9d7921dd50f0 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -13,24 +13,25 @@
13 * PG_reserved is set for special pages, which can never be swapped out. Some 13 * PG_reserved is set for special pages, which can never be swapped out. Some
14 * of them might not even exist (eg empty_bad_page)... 14 * of them might not even exist (eg empty_bad_page)...
15 * 15 *
16 * The PG_private bitflag is set if page->private contains a valid value. 16 * The PG_private bitflag is set on pagecache pages if they contain filesystem
17 * specific data (which is normally at page->private). It can be used by
18 * private allocations for its own usage.
17 * 19 *
18 * During disk I/O, PG_locked is used. This bit is set before I/O and 20 * During initiation of disk I/O, PG_locked is set. This bit is set before I/O
19 * reset when I/O completes. page_waitqueue(page) is a wait queue of all tasks 21 * and cleared when writeback _starts_ or when read _completes_. PG_writeback
20 * waiting for the I/O on this page to complete. 22 * is set before writeback starts and cleared when it finishes.
23 *
24 * PG_locked also pins a page in pagecache, and blocks truncation of the file
25 * while it is held.
26 *
27 * page_waitqueue(page) is a wait queue of all tasks waiting for the page
28 * to become unlocked.
21 * 29 *
22 * PG_uptodate tells whether the page's contents is valid. When a read 30 * PG_uptodate tells whether the page's contents is valid. When a read
23 * completes, the page becomes uptodate, unless a disk I/O error happened. 31 * completes, the page becomes uptodate, unless a disk I/O error happened.
24 * 32 *
25 * For choosing which pages to swap out, inode pages carry a PG_referenced bit, 33 * PG_referenced, PG_reclaim are used for page reclaim for anonymous and
26 * which is set any time the system accesses that page through the (mapping, 34 * file-backed pagecache (see mm/vmscan.c).
27 * index) hash table. This referenced bit, together with the referenced bit
28 * in the page tables, is used to manipulate page->age and move the page across
29 * the active, inactive_dirty and inactive_clean lists.
30 *
31 * Note that the referenced bit, the page->lru list_head and the active,
32 * inactive_dirty and inactive_clean lists are protected by the
33 * zone->lru_lock, and *NOT* by the usual PG_locked bit!
34 * 35 *
35 * PG_error is set to indicate that an I/O error occurred on this page. 36 * PG_error is set to indicate that an I/O error occurred on this page.
36 * 37 *
@@ -42,6 +43,10 @@
42 * space, they need to be kmapped separately for doing IO on the pages. The 43 * space, they need to be kmapped separately for doing IO on the pages. The
43 * struct page (these bits with information) are always mapped into kernel 44 * struct page (these bits with information) are always mapped into kernel
44 * address space... 45 * address space...
46 *
47 * PG_buddy is set to indicate that the page is free and in the buddy system
48 * (see mm/page_alloc.c).
49 *
45 */ 50 */
46 51
47/* 52/*
@@ -74,7 +79,7 @@
74#define PG_checked 8 /* kill me in 2.5.<early>. */ 79#define PG_checked 8 /* kill me in 2.5.<early>. */
75#define PG_arch_1 9 80#define PG_arch_1 9
76#define PG_reserved 10 81#define PG_reserved 10
77#define PG_private 11 /* Has something at ->private */ 82#define PG_private 11 /* If pagecache, has fs-private data */
78 83
79#define PG_writeback 12 /* Page is under writeback */ 84#define PG_writeback 12 /* Page is under writeback */
80#define PG_nosave 13 /* Used for system suspend/resume */ 85#define PG_nosave 13 /* Used for system suspend/resume */
@@ -83,7 +88,7 @@
83 88
84#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
85#define PG_reclaim 17 /* To be reclaimed asap */ 90#define PG_reclaim 17 /* To be reclaimed asap */
86#define PG_nosave_free 18 /* Free, should not be written */ 91#define PG_nosave_free 18 /* Used for system suspend/resume */
87#define PG_buddy 19 /* Page is free, on buddy lists */ 92#define PG_buddy 19 /* Page is free, on buddy lists */
88 93
89 94
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0a2f5d27f60e..64f950925151 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -130,14 +130,29 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
130} 130}
131 131
132extern void FASTCALL(__lock_page(struct page *page)); 132extern void FASTCALL(__lock_page(struct page *page));
133extern void FASTCALL(__lock_page_nosync(struct page *page));
133extern void FASTCALL(unlock_page(struct page *page)); 134extern void FASTCALL(unlock_page(struct page *page));
134 135
136/*
137 * lock_page may only be called if we have the page's inode pinned.
138 */
135static inline void lock_page(struct page *page) 139static inline void lock_page(struct page *page)
136{ 140{
137 might_sleep(); 141 might_sleep();
138 if (TestSetPageLocked(page)) 142 if (TestSetPageLocked(page))
139 __lock_page(page); 143 __lock_page(page);
140} 144}
145
146/*
147 * lock_page_nosync should only be used if we can't pin the page's inode.
148 * Doesn't play quite so well with block device plugging.
149 */
150static inline void lock_page_nosync(struct page *page)
151{
152 might_sleep();
153 if (TestSetPageLocked(page))
154 __lock_page_nosync(page);
155}
141 156
142/* 157/*
143 * This is exported only for wait_on_page_locked/wait_on_page_writeback. 158 * This is exported only for wait_on_page_locked/wait_on_page_writeback.
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8565b81d7fbc..5c3a4176eb64 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -49,6 +49,7 @@
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/ioport.h> 50#include <linux/ioport.h>
51#include <linux/list.h> 51#include <linux/list.h>
52#include <linux/compiler.h>
52#include <linux/errno.h> 53#include <linux/errno.h>
53#include <linux/device.h> 54#include <linux/device.h>
54 55
@@ -346,6 +347,8 @@ struct pci_driver {
346 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ 347 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
347 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 348 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
348 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ 349 int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */
350 int (*suspend_late) (struct pci_dev *dev, pm_message_t state);
351 int (*resume_early) (struct pci_dev *dev);
349 int (*resume) (struct pci_dev *dev); /* Device woken up */ 352 int (*resume) (struct pci_dev *dev); /* Device woken up */
350 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 353 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
351 void (*shutdown) (struct pci_dev *dev); 354 void (*shutdown) (struct pci_dev *dev);
@@ -353,6 +356,8 @@ struct pci_driver {
353 struct pci_error_handlers *err_handler; 356 struct pci_error_handlers *err_handler;
354 struct device_driver driver; 357 struct device_driver driver;
355 struct pci_dynids dynids; 358 struct pci_dynids dynids;
359
360 int multithread_probe;
356}; 361};
357 362
358#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 363#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)
@@ -401,7 +406,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
401extern struct list_head pci_devices; /* list of all devices */ 406extern struct list_head pci_devices; /* list of all devices */
402 407
403void pcibios_fixup_bus(struct pci_bus *); 408void pcibios_fixup_bus(struct pci_bus *);
404int pcibios_enable_device(struct pci_dev *, int mask); 409int __must_check pcibios_enable_device(struct pci_dev *, int mask);
405char *pcibios_setup (char *str); 410char *pcibios_setup (char *str);
406 411
407/* Used only when drivers/pci/setup.c is used */ 412/* Used only when drivers/pci/setup.c is used */
@@ -428,7 +433,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
428struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 433struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
429void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 434void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
430unsigned int pci_scan_child_bus(struct pci_bus *bus); 435unsigned int pci_scan_child_bus(struct pci_bus *bus);
431void pci_bus_add_device(struct pci_dev *dev); 436int __must_check pci_bus_add_device(struct pci_dev *dev);
432void pci_read_bridge_bases(struct pci_bus *child); 437void pci_read_bridge_bases(struct pci_bus *child);
433struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 438struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res);
434int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 439int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
@@ -436,6 +441,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
436extern void pci_dev_put(struct pci_dev *dev); 441extern void pci_dev_put(struct pci_dev *dev);
437extern void pci_remove_bus(struct pci_bus *b); 442extern void pci_remove_bus(struct pci_bus *b);
438extern void pci_remove_bus_device(struct pci_dev *dev); 443extern void pci_remove_bus_device(struct pci_dev *dev);
444extern void pci_stop_bus_device(struct pci_dev *dev);
439void pci_setup_cardbus(struct pci_bus *bus); 445void pci_setup_cardbus(struct pci_bus *bus);
440 446
441/* Generic PCI functions exported to card drivers */ 447/* Generic PCI functions exported to card drivers */
@@ -488,19 +494,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
488 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 494 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val);
489} 495}
490 496
491int pci_enable_device(struct pci_dev *dev); 497int __must_check pci_enable_device(struct pci_dev *dev);
492int pci_enable_device_bars(struct pci_dev *dev, int mask); 498int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
493void pci_disable_device(struct pci_dev *dev); 499void pci_disable_device(struct pci_dev *dev);
494void pci_set_master(struct pci_dev *dev); 500void pci_set_master(struct pci_dev *dev);
495#define HAVE_PCI_SET_MWI 501#define HAVE_PCI_SET_MWI
496int pci_set_mwi(struct pci_dev *dev); 502int __must_check pci_set_mwi(struct pci_dev *dev);
497void pci_clear_mwi(struct pci_dev *dev); 503void pci_clear_mwi(struct pci_dev *dev);
498void pci_intx(struct pci_dev *dev, int enable); 504void pci_intx(struct pci_dev *dev, int enable);
499int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 505int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
500int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 506int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
501void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 507void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
502int pci_assign_resource(struct pci_dev *dev, int i); 508int __must_check pci_assign_resource(struct pci_dev *dev, int i);
503int pci_assign_resource_fixed(struct pci_dev *dev, int i); 509int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
504void pci_restore_bars(struct pci_dev *dev); 510void pci_restore_bars(struct pci_dev *dev);
505 511
506/* ROM control related routines */ 512/* ROM control related routines */
@@ -526,23 +532,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
526void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 532void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
527 int (*)(struct pci_dev *, u8, u8)); 533 int (*)(struct pci_dev *, u8, u8));
528#define HAVE_PCI_REQ_REGIONS 2 534#define HAVE_PCI_REQ_REGIONS 2
529int pci_request_regions(struct pci_dev *, const char *); 535int __must_check pci_request_regions(struct pci_dev *, const char *);
530void pci_release_regions(struct pci_dev *); 536void pci_release_regions(struct pci_dev *);
531int pci_request_region(struct pci_dev *, int, const char *); 537int __must_check pci_request_region(struct pci_dev *, int, const char *);
532void pci_release_region(struct pci_dev *, int); 538void pci_release_region(struct pci_dev *, int);
533 539
534/* drivers/pci/bus.c */ 540/* drivers/pci/bus.c */
535int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 541int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
536 resource_size_t size, resource_size_t align, 542 struct resource *res, resource_size_t size,
537 resource_size_t min, unsigned int type_mask, 543 resource_size_t align, resource_size_t min,
538 void (*alignf)(void *, struct resource *, 544 unsigned int type_mask,
539 resource_size_t, resource_size_t), 545 void (*alignf)(void *, struct resource *,
540 void *alignf_data); 546 resource_size_t, resource_size_t),
547 void *alignf_data);
541void pci_enable_bridges(struct pci_bus *bus); 548void pci_enable_bridges(struct pci_bus *bus);
542 549
543/* Proper probing supporting hot-pluggable devices */ 550/* Proper probing supporting hot-pluggable devices */
544int __pci_register_driver(struct pci_driver *, struct module *); 551int __must_check __pci_register_driver(struct pci_driver *, struct module *);
545static inline int pci_register_driver(struct pci_driver *driver) 552static inline int __must_check pci_register_driver(struct pci_driver *driver)
546{ 553{
547 return __pci_register_driver(driver, THIS_MODULE); 554 return __pci_register_driver(driver, THIS_MODULE);
548} 555}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6a1e09834559..ab032ceafa84 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1411,6 +1411,7 @@
1411#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1411#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1412#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1412#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1413#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1413#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1414#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1414#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1415#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1415#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1416#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1416#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1417#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
@@ -1482,9 +1483,6 @@
1482#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1483#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1483#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1484#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1484#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1485#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1485#define PCI_DEVICE_ID_MARVELL_GT96100 0x9652
1486#define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653
1487
1488 1486
1489#define PCI_VENDOR_ID_V3 0x11b0 1487#define PCI_VENDOR_ID_V3 0x11b0
1490#define PCI_DEVICE_ID_V3_V960 0x0001 1488#define PCI_DEVICE_ID_V3_V960 0x0001
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 96930cb5927c..7d0e26cba420 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,7 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ 199#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 200#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */
201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 201#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 202#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index b44e01a70914..6cd91e3f9820 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -62,6 +62,12 @@ struct pcie_port_service_driver {
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev, pm_message_t state);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */
66 struct pci_error_handlers *err_handler;
67
68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70
65 const struct pcie_port_service_id *id_table; 71 const struct pcie_port_service_id *id_table;
66 struct device_driver driver; 72 struct device_driver driver;
67}; 73};
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cb9039a21f2a..3835a9642f13 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -1,9 +1,12 @@
1#ifndef __LINUX_PERCPU_H 1#ifndef __LINUX_PERCPU_H
2#define __LINUX_PERCPU_H 2#define __LINUX_PERCPU_H
3
3#include <linux/spinlock.h> /* For preempt_disable() */ 4#include <linux/spinlock.h> /* For preempt_disable() */
4#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
5#include <linux/smp.h> 6#include <linux/smp.h>
6#include <linux/string.h> /* For memset() */ 7#include <linux/string.h> /* For memset() */
8#include <linux/cpumask.h>
9
7#include <asm/percpu.h> 10#include <asm/percpu.h>
8 11
9/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
@@ -11,8 +14,14 @@
11#define PERCPU_ENOUGH_ROOM 32768 14#define PERCPU_ENOUGH_ROOM 32768
12#endif 15#endif
13 16
14/* Must be an lvalue. */ 17/*
15#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) 18 * Must be an lvalue. Since @var must be a simple identifier,
19 * we force a syntax error here if it isn't.
20 */
21#define get_cpu_var(var) (*({ \
22 extern int simple_indentifier_##var(void); \
23 preempt_disable(); \
24 &__get_cpu_var(var); }))
16#define put_cpu_var(var) preempt_enable() 25#define put_cpu_var(var) preempt_enable()
17 26
18#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
@@ -21,39 +30,77 @@ struct percpu_data {
21 void *ptrs[NR_CPUS]; 30 void *ptrs[NR_CPUS];
22}; 31};
23 32
33#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
24/* 34/*
25 * Use this to get to a cpu's version of the per-cpu object allocated using 35 * Use this to get to a cpu's version of the per-cpu object dynamically
26 * alloc_percpu. Non-atomic access to the current CPU's version should 36 * allocated. Non-atomic access to the current CPU's version should
27 * probably be combined with get_cpu()/put_cpu(). 37 * probably be combined with get_cpu()/put_cpu().
28 */ 38 */
29#define per_cpu_ptr(ptr, cpu) \ 39#define percpu_ptr(ptr, cpu) \
30({ \ 40({ \
31 struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \ 41 struct percpu_data *__p = __percpu_disguise(ptr); \
32 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 42 (__typeof__(ptr))__p->ptrs[(cpu)]; \
33}) 43})
34 44
35extern void *__alloc_percpu(size_t size); 45extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
36extern void free_percpu(const void *); 46extern void percpu_depopulate(void *__pdata, int cpu);
47extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
48 cpumask_t *mask);
49extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
50extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
51extern void percpu_free(void *__pdata);
37 52
38#else /* CONFIG_SMP */ 53#else /* CONFIG_SMP */
39 54
40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 55#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
56
57static inline void percpu_depopulate(void *__pdata, int cpu)
58{
59}
60
61static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
62{
63}
41 64
42static inline void *__alloc_percpu(size_t size) 65static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
66 int cpu)
43{ 67{
44 void *ret = kmalloc(size, GFP_KERNEL); 68 return percpu_ptr(__pdata, cpu);
45 if (ret)
46 memset(ret, 0, size);
47 return ret;
48} 69}
49static inline void free_percpu(const void *ptr) 70
50{ 71static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
51 kfree(ptr); 72 cpumask_t *mask)
73{
74 return 0;
75}
76
77static inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
78{
79 return kzalloc(size, gfp);
80}
81
82static inline void percpu_free(void *__pdata)
83{
84 kfree(__pdata);
52} 85}
53 86
54#endif /* CONFIG_SMP */ 87#endif /* CONFIG_SMP */
55 88
56/* Simple wrapper for the common case: zeros memory. */ 89#define percpu_populate_mask(__pdata, size, gfp, mask) \
57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type)))) 90 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
91#define percpu_depopulate_mask(__pdata, mask) \
92 __percpu_depopulate_mask((__pdata), &(mask))
93#define percpu_alloc_mask(size, gfp, mask) \
94 __percpu_alloc_mask((size), (gfp), &(mask))
95
96#define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map)
97
98/* (legacy) interface for use without CPU hotplug handling */
99
100#define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \
101 cpu_possible_map)
102#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type))
103#define free_percpu(ptr) percpu_free((ptr))
104#define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu))
58 105
59#endif /* __LINUX_PERCPU_H */ 106#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 29960b03bef7..93da7e2d9f30 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -76,6 +76,8 @@ extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr)); 76 enum pid_type type, int nr));
77 77
78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
79extern void FASTCALL(transfer_pid(struct task_struct *old,
80 struct task_struct *new, enum pid_type));
79 81
80/* 82/*
81 * look up a PID in the hash table. Must be called with the tasklist_lock 83 * look up a PID in the hash table. Must be called with the tasklist_lock
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 782090c68932..29cd6dee13db 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -49,6 +49,8 @@ struct platform_driver {
49 int (*remove)(struct platform_device *); 49 int (*remove)(struct platform_device *);
50 void (*shutdown)(struct platform_device *); 50 void (*shutdown)(struct platform_device *);
51 int (*suspend)(struct platform_device *, pm_message_t state); 51 int (*suspend)(struct platform_device *, pm_message_t state);
52 int (*suspend_late)(struct platform_device *, pm_message_t state);
53 int (*resume_early)(struct platform_device *);
52 int (*resume)(struct platform_device *); 54 int (*resume)(struct platform_device *);
53 struct device_driver driver; 55 struct device_driver driver;
54}; 56};
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 658c1b93d5bb..6b27e07aef19 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -142,29 +142,61 @@ typedef struct pm_message {
142} pm_message_t; 142} pm_message_t;
143 143
144/* 144/*
145 * There are 4 important states driver can be in: 145 * Several driver power state transitions are externally visible, affecting
146 * ON -- driver is working 146 * the state of pending I/O queues and (for drivers that touch hardware)
147 * FREEZE -- stop operations and apply whatever policy is applicable to a 147 * interrupts, wakeups, DMA, and other hardware state. There may also be
148 * suspended driver of that class, freeze queues for block like IDE 148 * internal transitions to various low power modes, which are transparent
149 * does, drop packets for ethernet, etc... stop DMA engine too etc... 149 * to the rest of the driver stack (such as a driver that's ON gating off
150 * so a consistent image can be saved; but do not power any hardware 150 * clocks which are not in active use).
151 * down.
152 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
153 * possible. Roughly pci D3.
154 * 151 *
155 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3 152 * One transition is triggered by resume(), after a suspend() call; the
156 * (SUSPEND). We'll need to fix the drivers. So yes, putting 3 to all different 153 * message is implicit:
157 * defines is intentional, and will go away as soon as drivers are fixed. Also 154 *
158 * note that typedef is neccessary, we'll probably want to switch to 155 * ON Driver starts working again, responding to hardware events
159 * typedef struct pm_message_t { int event; int flags; } pm_message_t 156 * and software requests. The hardware may have gone through
160 * or something similar soon. 157 * a power-off reset, or it may have maintained state from the
158 * previous suspend() which the driver will rely on while
159 * resuming. On most platforms, there are no restrictions on
160 * availability of resources like clocks during resume().
161 *
162 * Other transitions are triggered by messages sent using suspend(). All
163 * these transitions quiesce the driver, so that I/O queues are inactive.
164 * That commonly entails turning off IRQs and DMA; there may be rules
165 * about how to quiesce that are specific to the bus or the device's type.
166 * (For example, network drivers mark the link state.) Other details may
167 * differ according to the message:
168 *
169 * SUSPEND Quiesce, enter a low power device state appropriate for
170 * the upcoming system state (such as PCI_D3hot), and enable
171 * wakeup events as appropriate.
172 *
173 * FREEZE Quiesce operations so that a consistent image can be saved;
174 * but do NOT otherwise enter a low power device state, and do
175 * NOT emit system wakeup events.
176 *
177 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
178 * the system from a snapshot taken after an earlier FREEZE.
179 * Some drivers will need to reset their hardware state instead
180 * of preserving it, to ensure that it's never mistaken for the
181 * state which that earlier snapshot had set up.
182 *
183 * A minimally power-aware driver treats all messages as SUSPEND, fully
184 * reinitializes its device during resume() -- whether or not it was reset
185 * during the suspend/resume cycle -- and can't issue wakeup events.
186 *
187 * More power-aware drivers may also use low power states at runtime as
188 * well as during system sleep states like PM_SUSPEND_STANDBY. They may
189 * be able to use wakeup events to exit from runtime low-power states,
190 * or from system low-power states such as standby or suspend-to-RAM.
161 */ 191 */
162 192
163#define PM_EVENT_ON 0 193#define PM_EVENT_ON 0
164#define PM_EVENT_FREEZE 1 194#define PM_EVENT_FREEZE 1
165#define PM_EVENT_SUSPEND 2 195#define PM_EVENT_SUSPEND 2
196#define PM_EVENT_PRETHAW 3
166 197
167#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) 198#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
199#define PMSG_PRETHAW ((struct pm_message){ .event = PM_EVENT_PRETHAW, })
168#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) 200#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
169#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) 201#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
170 202
@@ -190,6 +222,7 @@ extern void device_resume(void);
190extern suspend_disk_method_t pm_disk_mode; 222extern suspend_disk_method_t pm_disk_mode;
191 223
192extern int device_suspend(pm_message_t state); 224extern int device_suspend(pm_message_t state);
225extern int device_prepare_suspend(pm_message_t state);
193 226
194#define device_set_wakeup_enable(dev,val) \ 227#define device_set_wakeup_enable(dev,val) \
195 ((dev)->power.should_wakeup = !!(val)) 228 ((dev)->power.should_wakeup = !!(val))
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 3435ca38dd14..57f70bc8b24b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -268,7 +268,9 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
268struct proc_maps_private { 268struct proc_maps_private {
269 struct pid *pid; 269 struct pid *pid;
270 struct task_struct *task; 270 struct task_struct *task;
271#ifdef CONFIG_MMU
271 struct vm_area_struct *tail_vma; 272 struct vm_area_struct *tail_vma;
273#endif
272}; 274};
273 275
274#endif /* _LINUX_PROC_FS_H */ 276#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index a376bd4ade39..81e9299ca148 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -3,21 +3,25 @@
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5 5
6extern int pm_trace_enabled;
7
6struct device; 8struct device;
7extern void set_trace_device(struct device *); 9extern void set_trace_device(struct device *);
8extern void generate_resume_trace(void *tracedata, unsigned int user); 10extern void generate_resume_trace(void *tracedata, unsigned int user);
9 11
10#define TRACE_DEVICE(dev) set_trace_device(dev) 12#define TRACE_DEVICE(dev) set_trace_device(dev)
11#define TRACE_RESUME(user) do { \ 13#define TRACE_RESUME(user) do { \
12 void *tracedata; \ 14 if (pm_trace_enabled) { \
13 asm volatile("movl $1f,%0\n" \ 15 void *tracedata; \
14 ".section .tracedata,\"a\"\n" \ 16 asm volatile("movl $1f,%0\n" \
15 "1:\t.word %c1\n" \ 17 ".section .tracedata,\"a\"\n" \
16 "\t.long %c2\n" \ 18 "1:\t.word %c1\n" \
17 ".previous" \ 19 "\t.long %c2\n" \
18 :"=r" (tracedata) \ 20 ".previous" \
19 : "i" (__LINE__), "i" (__FILE__)); \ 21 :"=r" (tracedata) \
20 generate_resume_trace(tracedata, user); \ 22 : "i" (__LINE__), "i" (__FILE__)); \
23 generate_resume_trace(tracedata, user); \
24 } \
21} while (0) 25} while (0)
22 26
23#else 27#else
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bf97b0900014..db2c1df4fef9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -103,6 +103,14 @@ pte_t *page_check_address(struct page *, struct mm_struct *,
103 */ 103 */
104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); 104unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 105
106/*
107 * Cleans the PTEs of shared mappings.
108 * (and since clean PTEs should also be readonly, write protects them too)
109 *
110 * returns the number of cleaned PTEs.
111 */
112int page_mkclean(struct page *);
113
106#else /* !CONFIG_MMU */ 114#else /* !CONFIG_MMU */
107 115
108#define anon_vma_init() do {} while (0) 116#define anon_vma_init() do {} while (0)
@@ -112,6 +120,12 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
112#define page_referenced(page,l) TestClearPageReferenced(page) 120#define page_referenced(page,l) TestClearPageReferenced(page)
113#define try_to_unmap(page, refs) SWAP_FAIL 121#define try_to_unmap(page, refs) SWAP_FAIL
114 122
123static inline int page_mkclean(struct page *page)
124{
125 return 0;
126}
127
128
115#endif /* CONFIG_MMU */ 129#endif /* CONFIG_MMU */
116 130
117/* 131/*
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 34ed0d99b1bd..9d4aa7f95bc8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -819,6 +819,11 @@ struct task_struct {
819 unsigned did_exec:1; 819 unsigned did_exec:1;
820 pid_t pid; 820 pid_t pid;
821 pid_t tgid; 821 pid_t tgid;
822
823#ifdef CONFIG_CC_STACKPROTECTOR
824 /* Canary value for the -fstack-protector gcc feature */
825 unsigned long stack_canary;
826#endif
822 /* 827 /*
823 * pointers to (original) parent process, youngest child, younger sibling, 828 * pointers to (original) parent process, youngest child, younger sibling,
824 * older sibling, respectively. (p->father can be replaced with 829 * older sibling, respectively. (p->father can be replaced with
@@ -865,6 +870,15 @@ struct task_struct {
865 struct key *thread_keyring; /* keyring private to this thread */ 870 struct key *thread_keyring; /* keyring private to this thread */
866 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 871 unsigned char jit_keyring; /* default keyring to attach requested keys to */
867#endif 872#endif
873 /*
874 * fpu_counter contains the number of consecutive context switches
875 * that the FPU is used. If this is over a threshold, the lazy fpu
876 * saving becomes unlazy to save the trap. This is an unsigned char
877 * so that after 256 times the counter wraps and the behavior turns
878 * lazy again; this to deal with bursty apps that only use FPU for
879 * a short time
880 */
881 unsigned char fpu_counter;
868 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 882 int oomkilladj; /* OOM kill score adjustment (bit shift). */
869 char comm[TASK_COMM_LEN]; /* executable name excluding path 883 char comm[TASK_COMM_LEN]; /* executable name excluding path
870 - access with [gs]et_task_comm (which lock 884 - access with [gs]et_task_comm (which lock
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index aad4e390d6a5..d1b7ca6c1c57 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -46,7 +46,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
46 46
47/** 47/**
48 * selinux_audit_rule_match - determine if a context ID matches a rule. 48 * selinux_audit_rule_match - determine if a context ID matches a rule.
49 * @ctxid: the context ID to check 49 * @sid: the context ID to check
50 * @field: the field this rule refers to 50 * @field: the field this rule refers to
51 * @op: the operater the rule uses 51 * @op: the operater the rule uses
52 * @rule: pointer to the audit rule to check against 52 * @rule: pointer to the audit rule to check against
@@ -55,7 +55,7 @@ void selinux_audit_rule_free(struct selinux_audit_rule *rule);
55 * Returns 1 if the context id matches the rule, 0 if it does not, and 55 * Returns 1 if the context id matches the rule, 0 if it does not, and
56 * -errno on failure. 56 * -errno on failure.
57 */ 57 */
58int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 58int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
59 struct selinux_audit_rule *rule, 59 struct selinux_audit_rule *rule,
60 struct audit_context *actx); 60 struct audit_context *actx);
61 61
@@ -70,18 +70,8 @@ int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op,
70void selinux_audit_set_callback(int (*callback)(void)); 70void selinux_audit_set_callback(int (*callback)(void));
71 71
72/** 72/**
73 * selinux_task_ctxid - determine a context ID for a process. 73 * selinux_sid_to_string - map a security context ID to a string
74 * @tsk: the task object 74 * @sid: security context ID to be converted.
75 * @ctxid: ID value returned via this
76 *
77 * On return, ctxid will contain an ID for the context. This value
78 * should only be used opaquely.
79 */
80void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
81
82/**
83 * selinux_ctxid_to_string - map a security context ID to a string
84 * @ctxid: security context ID to be converted.
85 * @ctx: address of context string to be returned 75 * @ctx: address of context string to be returned
86 * @ctxlen: length of returned context string. 76 * @ctxlen: length of returned context string.
87 * 77 *
@@ -89,7 +79,7 @@ void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid);
89 * string will be allocated internally, and the caller must call 79 * string will be allocated internally, and the caller must call
90 * kfree() on it after use. 80 * kfree() on it after use.
91 */ 81 */
92int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen); 82int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen);
93 83
94/** 84/**
95 * selinux_get_inode_sid - get the inode's security context ID 85 * selinux_get_inode_sid - get the inode's security context ID
@@ -154,7 +144,7 @@ static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
154 return; 144 return;
155} 145}
156 146
157static inline int selinux_audit_rule_match(u32 ctxid, u32 field, u32 op, 147static inline int selinux_audit_rule_match(u32 sid, u32 field, u32 op,
158 struct selinux_audit_rule *rule, 148 struct selinux_audit_rule *rule,
159 struct audit_context *actx) 149 struct audit_context *actx)
160{ 150{
@@ -166,12 +156,7 @@ static inline void selinux_audit_set_callback(int (*callback)(void))
166 return; 156 return;
167} 157}
168 158
169static inline void selinux_task_ctxid(struct task_struct *tsk, u32 *ctxid) 159static inline int selinux_sid_to_string(u32 sid, char **ctx, u32 *ctxlen)
170{
171 *ctxid = 0;
172}
173
174static inline int selinux_ctxid_to_string(u32 ctxid, char **ctx, u32 *ctxlen)
175{ 160{
176 *ctx = NULL; 161 *ctx = NULL;
177 *ctxlen = 0; 162 *ctxlen = 0;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 45ad55b70d1c..a96fd9310d55 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -60,14 +60,13 @@ extern void __init kmem_cache_init(void);
60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, 60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long,
61 void (*)(void *, kmem_cache_t *, unsigned long), 61 void (*)(void *, kmem_cache_t *, unsigned long),
62 void (*)(void *, kmem_cache_t *, unsigned long)); 62 void (*)(void *, kmem_cache_t *, unsigned long));
63extern int kmem_cache_destroy(kmem_cache_t *); 63extern void kmem_cache_destroy(kmem_cache_t *);
64extern int kmem_cache_shrink(kmem_cache_t *); 64extern int kmem_cache_shrink(kmem_cache_t *);
65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
67extern void kmem_cache_free(kmem_cache_t *, void *); 67extern void kmem_cache_free(kmem_cache_t *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 68extern unsigned int kmem_cache_size(kmem_cache_t *);
69extern const char *kmem_cache_name(kmem_cache_t *); 69extern const char *kmem_cache_name(kmem_cache_t *);
70extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags);
71 70
72/* Size description struct for general caches. */ 71/* Size description struct for general caches. */
73struct cache_sizes { 72struct cache_sizes {
@@ -203,7 +202,30 @@ extern int slab_is_available(void);
203 202
204#ifdef CONFIG_NUMA 203#ifdef CONFIG_NUMA
205extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 204extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
206extern void *kmalloc_node(size_t size, gfp_t flags, int node); 205extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
206
207static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
208{
209 if (__builtin_constant_p(size)) {
210 int i = 0;
211#define CACHE(x) \
212 if (size <= x) \
213 goto found; \
214 else \
215 i++;
216#include "kmalloc_sizes.h"
217#undef CACHE
218 {
219 extern void __you_cannot_kmalloc_that_much(void);
220 __you_cannot_kmalloc_that_much();
221 }
222found:
223 return kmem_cache_alloc_node((flags & GFP_DMA) ?
224 malloc_sizes[i].cs_dmacachep :
225 malloc_sizes[i].cs_cachep, flags, node);
226 }
227 return __kmalloc_node(size, flags, node);
228}
207#else 229#else
208static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 230static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node)
209{ 231{
@@ -223,12 +245,11 @@ extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
223/* SLOB allocator routines */ 245/* SLOB allocator routines */
224 246
225void kmem_cache_init(void); 247void kmem_cache_init(void);
226struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
227struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, 248struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
228 unsigned long, 249 unsigned long,
229 void (*)(void *, struct kmem_cache *, unsigned long), 250 void (*)(void *, struct kmem_cache *, unsigned long),
230 void (*)(void *, struct kmem_cache *, unsigned long)); 251 void (*)(void *, struct kmem_cache *, unsigned long));
231int kmem_cache_destroy(struct kmem_cache *c); 252void kmem_cache_destroy(struct kmem_cache *c);
232void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 253void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
233void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 254void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
234void kmem_cache_free(struct kmem_cache *c, void *b); 255void kmem_cache_free(struct kmem_cache *c, void *b);
@@ -263,8 +284,6 @@ extern kmem_cache_t *fs_cachep;
263extern kmem_cache_t *sighand_cachep; 284extern kmem_cache_t *sighand_cachep;
264extern kmem_cache_t *bio_cachep; 285extern kmem_cache_t *bio_cachep;
265 286
266extern atomic_t slab_reclaim_pages;
267
268#endif /* __KERNEL__ */ 287#endif /* __KERNEL__ */
269 288
270#endif /* _LINUX_SLAB_H */ 289#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/smb.h b/include/linux/smb.h
index 6df3b1501559..f098dff93f6b 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -89,7 +89,6 @@ struct smb_fattr {
89 struct timespec f_atime; 89 struct timespec f_atime;
90 struct timespec f_mtime; 90 struct timespec f_mtime;
91 struct timespec f_ctime; 91 struct timespec f_ctime;
92 unsigned long f_blksize;
93 unsigned long f_blocks; 92 unsigned long f_blocks;
94 int f_unix; 93 int f_unix;
95}; 94};
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 837e8bce1349..51649987f691 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -53,6 +53,9 @@ extern void smp_cpus_done(unsigned int max_cpus);
53 */ 53 */
54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); 54int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
55 55
56int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
57 int retry, int wait);
58
56/* 59/*
57 * Call a function on all processors 60 * Call a function on all processors
58 */ 61 */
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 9cc81e572224..50e2b01e517c 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -5,15 +5,16 @@
5struct stack_trace { 5struct stack_trace {
6 unsigned int nr_entries, max_entries; 6 unsigned int nr_entries, max_entries;
7 unsigned long *entries; 7 unsigned long *entries;
8 int skip; /* input argument: How many entries to skip */
9 int all_contexts; /* input argument: if true do than one stack */
8}; 10};
9 11
10extern void save_stack_trace(struct stack_trace *trace, 12extern void save_stack_trace(struct stack_trace *trace,
11 struct task_struct *task, int all_contexts, 13 struct task_struct *task);
12 unsigned int skip);
13 14
14extern void print_stack_trace(struct stack_trace *trace, int spaces); 15extern void print_stack_trace(struct stack_trace *trace, int spaces);
15#else 16#else
16# define save_stack_trace(trace, task, all, skip) do { } while (0) 17# define save_stack_trace(trace, task) do { } while (0)
17# define print_stack_trace(trace) do { } while (0) 18# define print_stack_trace(trace) do { } while (0)
18#endif 19#endif
19 20
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 96e31aa64cc7..b1237f16ecde 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -10,29 +10,11 @@
10#include <linux/pm.h> 10#include <linux/pm.h>
11 11
12/* page backup entry */ 12/* page backup entry */
13typedef struct pbe { 13struct pbe {
14 unsigned long address; /* address of the copy */ 14 unsigned long address; /* address of the copy */
15 unsigned long orig_address; /* original address of page */ 15 unsigned long orig_address; /* original address of page */
16 struct pbe *next; 16 struct pbe *next;
17} suspend_pagedir_t; 17};
18
19#define for_each_pbe(pbe, pblist) \
20 for (pbe = pblist ; pbe ; pbe = pbe->next)
21
22#define PBES_PER_PAGE (PAGE_SIZE/sizeof(struct pbe))
23#define PB_PAGE_SKIP (PBES_PER_PAGE-1)
24
25#define for_each_pb_page(pbe, pblist) \
26 for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)
27
28
29#define SWAP_FILENAME_MAXLENGTH 32
30
31
32extern dev_t swsusp_resume_device;
33
34/* mm/vmscan.c */
35extern int shrink_mem(void);
36 18
37/* mm/page_alloc.c */ 19/* mm/page_alloc.c */
38extern void drain_local_pages(void); 20extern void drain_local_pages(void);
@@ -53,18 +35,10 @@ static inline void pm_restore_console(void) {}
53static inline int software_suspend(void) 35static inline int software_suspend(void)
54{ 36{
55 printk("Warning: fake suspend called\n"); 37 printk("Warning: fake suspend called\n");
56 return -EPERM; 38 return -ENOSYS;
57} 39}
58#endif /* CONFIG_PM */ 40#endif /* CONFIG_PM */
59 41
60#ifdef CONFIG_SUSPEND_SMP
61extern void disable_nonboot_cpus(void);
62extern void enable_nonboot_cpus(void);
63#else
64static inline void disable_nonboot_cpus(void) {}
65static inline void enable_nonboot_cpus(void) {}
66#endif
67
68void save_processor_state(void); 42void save_processor_state(void);
69void restore_processor_state(void); 43void restore_processor_state(void);
70struct saved_context; 44struct saved_context;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 5e59184c9096..e7c36ba2a2db 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -10,6 +10,10 @@
10#include <asm/atomic.h> 10#include <asm/atomic.h>
11#include <asm/page.h> 11#include <asm/page.h>
12 12
13struct notifier_block;
14
15struct bio;
16
13#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ 17#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
14#define SWAP_FLAG_PRIO_MASK 0x7fff 18#define SWAP_FLAG_PRIO_MASK 0x7fff
15#define SWAP_FLAG_PRIO_SHIFT 0 19#define SWAP_FLAG_PRIO_SHIFT 0
@@ -156,13 +160,14 @@ struct swap_list_t {
156 160
157/* linux/mm/oom_kill.c */ 161/* linux/mm/oom_kill.c */
158extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 162extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
163extern int register_oom_notifier(struct notifier_block *nb);
164extern int unregister_oom_notifier(struct notifier_block *nb);
159 165
160/* linux/mm/memory.c */ 166/* linux/mm/memory.c */
161extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 167extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
162 168
163/* linux/mm/page_alloc.c */ 169/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 170extern unsigned long totalram_pages;
165extern unsigned long totalhigh_pages;
166extern unsigned long totalreserve_pages; 171extern unsigned long totalreserve_pages;
167extern long nr_swap_pages; 172extern long nr_swap_pages;
168extern unsigned int nr_free_pages(void); 173extern unsigned int nr_free_pages(void);
@@ -190,6 +195,7 @@ extern long vm_total_pages;
190#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
191extern int zone_reclaim_mode; 196extern int zone_reclaim_mode;
192extern int sysctl_min_unmapped_ratio; 197extern int sysctl_min_unmapped_ratio;
198extern int sysctl_min_slab_ratio;
193extern int zone_reclaim(struct zone *, gfp_t, unsigned int); 199extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
194#else 200#else
195#define zone_reclaim_mode 0 201#define zone_reclaim_mode 0
@@ -212,7 +218,9 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
212/* linux/mm/page_io.c */ 218/* linux/mm/page_io.c */
213extern int swap_readpage(struct file *, struct page *); 219extern int swap_readpage(struct file *, struct page *);
214extern int swap_writepage(struct page *page, struct writeback_control *wbc); 220extern int swap_writepage(struct page *page, struct writeback_control *wbc);
215extern int rw_swap_page_sync(int, swp_entry_t, struct page *); 221extern int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
222 struct bio **bio_chain);
223extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err);
216 224
217/* linux/mm/swap_state.c */ 225/* linux/mm/swap_state.c */
218extern struct address_space swapper_space; 226extern struct address_space swapper_space;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 008f04c56737..3f0f716225ec 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -53,6 +53,7 @@ struct mq_attr;
53struct compat_stat; 53struct compat_stat;
54struct compat_timeval; 54struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache;
56 57
57#include <linux/types.h> 58#include <linux/types.h>
58#include <linux/aio_abi.h> 59#include <linux/aio_abi.h>
@@ -596,5 +597,6 @@ asmlinkage long sys_get_robust_list(int pid,
596 size_t __user *len_ptr); 597 size_t __user *len_ptr);
597asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, 598asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
598 size_t len); 599 size_t len);
600asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *cache);
599 601
600#endif 602#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 736ed917a4f8..1b24bd45e080 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -150,6 +150,8 @@ enum
150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ 150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */ 151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
152 KERN_MAX_LOCK_DEPTH=74, 152 KERN_MAX_LOCK_DEPTH=74,
153 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
154 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
153}; 155};
154 156
155 157
@@ -191,6 +193,7 @@ enum
191 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */ 193 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
192 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 194 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
193 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 195 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
196 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
194}; 197};
195 198
196 199
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 1ea5d3cda6ae..6d5c43d31dec 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -10,6 +10,7 @@
10#ifndef _SYSFS_H_ 10#ifndef _SYSFS_H_
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15struct kobject; 16struct kobject;
@@ -86,40 +87,44 @@ struct sysfs_dirent {
86 87
87#ifdef CONFIG_SYSFS 88#ifdef CONFIG_SYSFS
88 89
89extern int 90extern int __must_check
90sysfs_create_dir(struct kobject *); 91sysfs_create_dir(struct kobject *);
91 92
92extern void 93extern void
93sysfs_remove_dir(struct kobject *); 94sysfs_remove_dir(struct kobject *);
94 95
95extern int 96extern int __must_check
96sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
97 98
98extern int 99extern int __must_check
99sysfs_create_file(struct kobject *, const struct attribute *); 100sysfs_create_file(struct kobject *, const struct attribute *);
100 101
101extern int 102extern int __must_check
102sysfs_update_file(struct kobject *, const struct attribute *); 103sysfs_update_file(struct kobject *, const struct attribute *);
103 104
104extern int 105extern int __must_check
105sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); 106sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode);
106 107
107extern void 108extern void
108sysfs_remove_file(struct kobject *, const struct attribute *); 109sysfs_remove_file(struct kobject *, const struct attribute *);
109 110
110extern int 111extern int __must_check
111sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); 112sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
112 113
113extern void 114extern void
114sysfs_remove_link(struct kobject *, const char * name); 115sysfs_remove_link(struct kobject *, const char * name);
115 116
116int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); 117int __must_check sysfs_create_bin_file(struct kobject *kobj,
117int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); 118 struct bin_attribute *attr);
119void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
118 120
119int sysfs_create_group(struct kobject *, const struct attribute_group *); 121int __must_check sysfs_create_group(struct kobject *,
122 const struct attribute_group *);
120void sysfs_remove_group(struct kobject *, const struct attribute_group *); 123void sysfs_remove_group(struct kobject *, const struct attribute_group *);
121void sysfs_notify(struct kobject * k, char *dir, char *attr); 124void sysfs_notify(struct kobject * k, char *dir, char *attr);
122 125
126extern int __must_check sysfs_init(void);
127
123#else /* CONFIG_SYSFS */ 128#else /* CONFIG_SYSFS */
124 129
125static inline int sysfs_create_dir(struct kobject * k) 130static inline int sysfs_create_dir(struct kobject * k)
@@ -191,6 +196,11 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
191{ 196{
192} 197}
193 198
199static inline int __must_check sysfs_init(void)
200{
201 return 0;
202}
203
194#endif /* CONFIG_SYSFS */ 204#endif /* CONFIG_SYSFS */
195 205
196#endif /* _SYSFS_H_ */ 206#endif /* _SYSFS_H_ */
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 391e7ed1eb3f..a48d7f11c7be 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -19,4 +19,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,
19 19
20#endif /* ARCH_HAS_NOCACHE_UACCESS */ 20#endif /* ARCH_HAS_NOCACHE_UACCESS */
21 21
22/**
23 * probe_kernel_address(): safely attempt to read from a location
24 * @addr: address to read from - its type is type typeof(retval)*
25 * @retval: read into this variable
26 *
27 * Safely read from address @addr into variable @revtal. If a kernel fault
28 * happens, handle that and return -EFAULT.
29 * We ensure that the __get_user() is executed in atomic context so that
30 * do_page_fault() doesn't attempt to take mmap_sem. This makes
31 * probe_kernel_address() suitable for use within regions where the caller
32 * already holds mmap_sem, or other locks which nest inside mmap_sem.
33 */
34#define probe_kernel_address(addr, retval) \
35 ({ \
36 long ret; \
37 \
38 inc_preempt_count(); \
39 ret = __get_user(retval, addr); \
40 dec_preempt_count(); \
41 ret; \
42 })
43
22#endif /* __LINUX_UACCESS_H__ */ 44#endif /* __LINUX_UACCESS_H__ */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d2bd0c8e0154..0da15b0b02be 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -19,6 +19,7 @@
19#include <linux/fs.h> /* for struct file_operations */ 19#include <linux/fs.h> /* for struct file_operations */
20#include <linux/completion.h> /* for struct completion */ 20#include <linux/completion.h> /* for struct completion */
21#include <linux/sched.h> /* for current && schedule_timeout */ 21#include <linux/sched.h> /* for current && schedule_timeout */
22#include <linux/mutex.h> /* for struct mutex */
22 23
23struct usb_device; 24struct usb_device;
24struct usb_driver; 25struct usb_driver;
@@ -102,8 +103,13 @@ enum usb_interface_condition {
102 * number from the USB core by calling usb_register_dev(). 103 * number from the USB core by calling usb_register_dev().
103 * @condition: binding state of the interface: not bound, binding 104 * @condition: binding state of the interface: not bound, binding
104 * (in probe()), bound to a driver, or unbinding (in disconnect()) 105 * (in probe()), bound to a driver, or unbinding (in disconnect())
106 * @is_active: flag set when the interface is bound and not suspended.
107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
108 * capability during autosuspend.
105 * @dev: driver model's view of this device 109 * @dev: driver model's view of this device
106 * @class_dev: driver model's class view of this device. 110 * @class_dev: driver model's class view of this device.
111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0.
107 * 113 *
108 * USB device drivers attach to interfaces on a physical device. Each 114 * USB device drivers attach to interfaces on a physical device. Each
109 * interface encapsulates a single high level function, such as feeding 115 * interface encapsulates a single high level function, such as feeding
@@ -142,8 +148,12 @@ struct usb_interface {
142 int minor; /* minor number this interface is 148 int minor; /* minor number this interface is
143 * bound to */ 149 * bound to */
144 enum usb_interface_condition condition; /* state of binding */ 150 enum usb_interface_condition condition; /* state of binding */
151 unsigned is_active:1; /* the interface is not suspended */
152 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
153
145 struct device dev; /* interface specific device info */ 154 struct device dev; /* interface specific device info */
146 struct class_device *class_dev; 155 struct class_device *class_dev;
156 int pm_usage_cnt; /* usage counter for autosuspend */
147}; 157};
148#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 158#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
149#define interface_to_usbdev(intf) \ 159#define interface_to_usbdev(intf) \
@@ -254,8 +264,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
254 264
255/* ----------------------------------------------------------------------- */ 265/* ----------------------------------------------------------------------- */
256 266
257struct usb_operations;
258
259/* USB device number allocation bitmap */ 267/* USB device number allocation bitmap */
260struct usb_devmap { 268struct usb_devmap {
261 unsigned long devicemap[128 / (8*sizeof(unsigned long))]; 269 unsigned long devicemap[128 / (8*sizeof(unsigned long))];
@@ -268,6 +276,7 @@ struct usb_bus {
268 struct device *controller; /* host/master side hardware */ 276 struct device *controller; /* host/master side hardware */
269 int busnum; /* Bus number (in order of reg) */ 277 int busnum; /* Bus number (in order of reg) */
270 char *bus_name; /* stable id (PCI slot_name etc) */ 278 char *bus_name; /* stable id (PCI slot_name etc) */
279 u8 uses_dma; /* Does the host controller use DMA? */
271 u8 otg_port; /* 0, or number of OTG/HNP port */ 280 u8 otg_port; /* 0, or number of OTG/HNP port */
272 unsigned is_b_host:1; /* true during some HNP roleswitches */ 281 unsigned is_b_host:1; /* true during some HNP roleswitches */
273 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 282 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
@@ -276,10 +285,8 @@ struct usb_bus {
276 * round-robin allocation */ 285 * round-robin allocation */
277 286
278 struct usb_devmap devmap; /* device address allocation map */ 287 struct usb_devmap devmap; /* device address allocation map */
279 struct usb_operations *op; /* Operations (specific to the HC) */
280 struct usb_device *root_hub; /* Root hub */ 288 struct usb_device *root_hub; /* Root hub */
281 struct list_head bus_list; /* list of busses */ 289 struct list_head bus_list; /* list of busses */
282 void *hcpriv; /* Host Controller private data */
283 290
284 int bandwidth_allocated; /* on this bus: how much of the time 291 int bandwidth_allocated; /* on this bus: how much of the time
285 * reserved for periodic (intr/iso) 292 * reserved for periodic (intr/iso)
@@ -294,8 +301,6 @@ struct usb_bus {
294 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 301 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
295 302
296 struct class_device *class_dev; /* class device for this bus */ 303 struct class_device *class_dev; /* class device for this bus */
297 struct kref kref; /* reference counting for this bus */
298 void (*release)(struct usb_bus *bus);
299 304
300#if defined(CONFIG_USB_MON) 305#if defined(CONFIG_USB_MON)
301 struct mon_bus *mon_bus; /* non-null when associated */ 306 struct mon_bus *mon_bus; /* non-null when associated */
@@ -350,6 +355,7 @@ struct usb_device {
350 355
351 unsigned short bus_mA; /* Current available from the bus */ 356 unsigned short bus_mA; /* Current available from the bus */
352 u8 portnum; /* Parent port number (origin 1) */ 357 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */
353 359
354 int have_langid; /* whether string_langid is valid */ 360 int have_langid; /* whether string_langid is valid */
355 int string_langid; /* language ID for strings */ 361 int string_langid; /* language ID for strings */
@@ -373,6 +379,15 @@ struct usb_device {
373 379
374 int maxchild; /* Number of ports if hub */ 380 int maxchild; /* Number of ports if hub */
375 struct usb_device *children[USB_MAXCHILDREN]; 381 struct usb_device *children[USB_MAXCHILDREN];
382
383#ifdef CONFIG_PM
384 struct work_struct autosuspend; /* for delayed autosuspends */
385 struct mutex pm_mutex; /* protects PM operations */
386 int pm_usage_cnt; /* usage counter for autosuspend */
387
388 unsigned auto_pm:1; /* autosuspend/resume in progress */
389 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
390#endif
376}; 391};
377#define to_usb_device(d) container_of(d, struct usb_device, dev) 392#define to_usb_device(d) container_of(d, struct usb_device, dev)
378 393
@@ -384,7 +399,7 @@ extern void usb_put_dev(struct usb_device *dev);
384#define usb_unlock_device(udev) up(&(udev)->dev.sem) 399#define usb_unlock_device(udev) up(&(udev)->dev.sem)
385#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem) 400#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
386extern int usb_lock_device_for_reset(struct usb_device *udev, 401extern int usb_lock_device_for_reset(struct usb_device *udev,
387 struct usb_interface *iface); 402 const struct usb_interface *iface);
388 403
389/* USB port reset for device reinitialization */ 404/* USB port reset for device reinitialization */
390extern int usb_reset_device(struct usb_device *dev); 405extern int usb_reset_device(struct usb_device *dev);
@@ -393,6 +408,17 @@ extern int usb_reset_composite_device(struct usb_device *dev,
393 408
394extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 409extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
395 410
411/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND
413extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf);
415
416#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420
421
396/*-------------------------------------------------------------------------*/ 422/*-------------------------------------------------------------------------*/
397 423
398/* for drivers using iso endpoints */ 424/* for drivers using iso endpoints */
@@ -423,10 +449,10 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
423 449
424extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 450extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
425 int minor); 451 int minor);
426extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, 452extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
427 unsigned ifnum); 453 unsigned ifnum);
428extern struct usb_host_interface *usb_altnum_to_altsetting( 454extern struct usb_host_interface *usb_altnum_to_altsetting(
429 struct usb_interface *intf, unsigned int altnum); 455 const struct usb_interface *intf, unsigned int altnum);
430 456
431 457
432/** 458/**
@@ -464,6 +490,20 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
464 490
465/*-------------------------------------------------------------------------*/ 491/*-------------------------------------------------------------------------*/
466 492
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd);
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd);
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd);
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd);
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd);
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd);
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd);
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd);
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd);
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd);
504
505/*-------------------------------------------------------------------------*/
506
467#define USB_DEVICE_ID_MATCH_DEVICE \ 507#define USB_DEVICE_ID_MATCH_DEVICE \
468 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 508 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
469#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 509#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -540,7 +580,17 @@ struct usb_dynids {
540}; 580};
541 581
542/** 582/**
543 * struct usb_driver - identifies USB driver to usbcore 583 * struct usbdrv_wrap - wrapper for driver-model structure
584 * @driver: The driver-model core driver structure.
585 * @for_devices: Non-zero for device drivers, 0 for interface drivers.
586 */
587struct usbdrv_wrap {
588 struct device_driver driver;
589 int for_devices;
590};
591
592/**
593 * struct usb_driver - identifies USB interface driver to usbcore
544 * @name: The driver name should be unique among USB drivers, 594 * @name: The driver name should be unique among USB drivers,
545 * and should normally be the same as the module name. 595 * and should normally be the same as the module name.
546 * @probe: Called to see if the driver is willing to manage a particular 596 * @probe: Called to see if the driver is willing to manage a particular
@@ -567,12 +617,14 @@ struct usb_dynids {
567 * or your driver's probe function will never get called. 617 * or your driver's probe function will never get called.
568 * @dynids: used internally to hold the list of dynamically added device 618 * @dynids: used internally to hold the list of dynamically added device
569 * ids for this driver. 619 * ids for this driver.
570 * @driver: the driver model core driver structure. 620 * @drvwrap: Driver-model core structure wrapper.
571 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be 621 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
572 * added to this driver by preventing the sysfs file from being created. 622 * added to this driver by preventing the sysfs file from being created.
623 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
624 * for interfaces bound to this driver.
573 * 625 *
574 * USB drivers must provide a name, probe() and disconnect() methods, 626 * USB interface drivers must provide a name, probe() and disconnect()
575 * and an id_table. Other driver fields are optional. 627 * methods, and an id_table. Other driver fields are optional.
576 * 628 *
577 * The id_table is used in hotplugging. It holds a set of descriptors, 629 * The id_table is used in hotplugging. It holds a set of descriptors,
578 * and specialized data may be associated with each entry. That table 630 * and specialized data may be associated with each entry. That table
@@ -606,10 +658,44 @@ struct usb_driver {
606 const struct usb_device_id *id_table; 658 const struct usb_device_id *id_table;
607 659
608 struct usb_dynids dynids; 660 struct usb_dynids dynids;
609 struct device_driver driver; 661 struct usbdrv_wrap drvwrap;
610 unsigned int no_dynamic_id:1; 662 unsigned int no_dynamic_id:1;
663 unsigned int supports_autosuspend:1;
611}; 664};
612#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 665#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
666
667/**
668 * struct usb_device_driver - identifies USB device driver to usbcore
669 * @name: The driver name should be unique among USB drivers,
670 * and should normally be the same as the module name.
671 * @probe: Called to see if the driver is willing to manage a particular
672 * device. If it is, probe returns zero and uses dev_set_drvdata()
673 * to associate driver-specific data with the device. If unwilling
674 * to manage the device, return a negative errno value.
675 * @disconnect: Called when the device is no longer accessible, usually
676 * because it has been (or is being) disconnected or the driver's
677 * module is being unloaded.
678 * @suspend: Called when the device is going to be suspended by the system.
679 * @resume: Called when the device is being resumed by the system.
680 * @drvwrap: Driver-model core structure wrapper.
681 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
682 * for devices bound to this driver.
683 *
684 * USB drivers must provide all the fields listed above except drvwrap.
685 */
686struct usb_device_driver {
687 const char *name;
688
689 int (*probe) (struct usb_device *udev);
690 void (*disconnect) (struct usb_device *udev);
691
692 int (*suspend) (struct usb_device *udev, pm_message_t message);
693 int (*resume) (struct usb_device *udev);
694 struct usbdrv_wrap drvwrap;
695 unsigned int supports_autosuspend:1;
696};
697#define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \
698 drvwrap.driver)
613 699
614extern struct bus_type usb_bus_type; 700extern struct bus_type usb_bus_type;
615 701
@@ -633,13 +719,17 @@ struct usb_class_driver {
633 * use these in module_init()/module_exit() 719 * use these in module_init()/module_exit()
634 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 720 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
635 */ 721 */
636int usb_register_driver(struct usb_driver *, struct module *); 722extern int usb_register_driver(struct usb_driver *, struct module *);
637static inline int usb_register(struct usb_driver *driver) 723static inline int usb_register(struct usb_driver *driver)
638{ 724{
639 return usb_register_driver(driver, THIS_MODULE); 725 return usb_register_driver(driver, THIS_MODULE);
640} 726}
641extern void usb_deregister(struct usb_driver *); 727extern void usb_deregister(struct usb_driver *);
642 728
729extern int usb_register_device_driver(struct usb_device_driver *,
730 struct module *);
731extern void usb_deregister_device_driver(struct usb_device_driver *);
732
643extern int usb_register_dev(struct usb_interface *intf, 733extern int usb_register_dev(struct usb_interface *intf,
644 struct usb_class_driver *class_driver); 734 struct usb_class_driver *class_driver);
645extern void usb_deregister_dev(struct usb_interface *intf, 735extern void usb_deregister_dev(struct usb_interface *intf,
@@ -885,7 +975,7 @@ struct urb
885 * @setup_packet: pointer to the setup_packet buffer 975 * @setup_packet: pointer to the setup_packet buffer
886 * @transfer_buffer: pointer to the transfer buffer 976 * @transfer_buffer: pointer to the transfer buffer
887 * @buffer_length: length of the transfer buffer 977 * @buffer_length: length of the transfer buffer
888 * @complete: pointer to the usb_complete_t function 978 * @complete_fn: pointer to the usb_complete_t function
889 * @context: what to set the urb context to. 979 * @context: what to set the urb context to.
890 * 980 *
891 * Initializes a control urb with the proper information needed to submit 981 * Initializes a control urb with the proper information needed to submit
@@ -897,7 +987,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
897 unsigned char *setup_packet, 987 unsigned char *setup_packet,
898 void *transfer_buffer, 988 void *transfer_buffer,
899 int buffer_length, 989 int buffer_length,
900 usb_complete_t complete, 990 usb_complete_t complete_fn,
901 void *context) 991 void *context)
902{ 992{
903 spin_lock_init(&urb->lock); 993 spin_lock_init(&urb->lock);
@@ -906,7 +996,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
906 urb->setup_packet = setup_packet; 996 urb->setup_packet = setup_packet;
907 urb->transfer_buffer = transfer_buffer; 997 urb->transfer_buffer = transfer_buffer;
908 urb->transfer_buffer_length = buffer_length; 998 urb->transfer_buffer_length = buffer_length;
909 urb->complete = complete; 999 urb->complete = complete_fn;
910 urb->context = context; 1000 urb->context = context;
911} 1001}
912 1002
@@ -917,7 +1007,7 @@ static inline void usb_fill_control_urb (struct urb *urb,
917 * @pipe: the endpoint pipe 1007 * @pipe: the endpoint pipe
918 * @transfer_buffer: pointer to the transfer buffer 1008 * @transfer_buffer: pointer to the transfer buffer
919 * @buffer_length: length of the transfer buffer 1009 * @buffer_length: length of the transfer buffer
920 * @complete: pointer to the usb_complete_t function 1010 * @complete_fn: pointer to the usb_complete_t function
921 * @context: what to set the urb context to. 1011 * @context: what to set the urb context to.
922 * 1012 *
923 * Initializes a bulk urb with the proper information needed to submit it 1013 * Initializes a bulk urb with the proper information needed to submit it
@@ -928,7 +1018,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
928 unsigned int pipe, 1018 unsigned int pipe,
929 void *transfer_buffer, 1019 void *transfer_buffer,
930 int buffer_length, 1020 int buffer_length,
931 usb_complete_t complete, 1021 usb_complete_t complete_fn,
932 void *context) 1022 void *context)
933{ 1023{
934 spin_lock_init(&urb->lock); 1024 spin_lock_init(&urb->lock);
@@ -936,7 +1026,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
936 urb->pipe = pipe; 1026 urb->pipe = pipe;
937 urb->transfer_buffer = transfer_buffer; 1027 urb->transfer_buffer = transfer_buffer;
938 urb->transfer_buffer_length = buffer_length; 1028 urb->transfer_buffer_length = buffer_length;
939 urb->complete = complete; 1029 urb->complete = complete_fn;
940 urb->context = context; 1030 urb->context = context;
941} 1031}
942 1032
@@ -947,7 +1037,7 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
947 * @pipe: the endpoint pipe 1037 * @pipe: the endpoint pipe
948 * @transfer_buffer: pointer to the transfer buffer 1038 * @transfer_buffer: pointer to the transfer buffer
949 * @buffer_length: length of the transfer buffer 1039 * @buffer_length: length of the transfer buffer
950 * @complete: pointer to the usb_complete_t function 1040 * @complete_fn: pointer to the usb_complete_t function
951 * @context: what to set the urb context to. 1041 * @context: what to set the urb context to.
952 * @interval: what to set the urb interval to, encoded like 1042 * @interval: what to set the urb interval to, encoded like
953 * the endpoint descriptor's bInterval value. 1043 * the endpoint descriptor's bInterval value.
@@ -963,7 +1053,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
963 unsigned int pipe, 1053 unsigned int pipe,
964 void *transfer_buffer, 1054 void *transfer_buffer,
965 int buffer_length, 1055 int buffer_length,
966 usb_complete_t complete, 1056 usb_complete_t complete_fn,
967 void *context, 1057 void *context,
968 int interval) 1058 int interval)
969{ 1059{
@@ -972,7 +1062,7 @@ static inline void usb_fill_int_urb (struct urb *urb,
972 urb->pipe = pipe; 1062 urb->pipe = pipe;
973 urb->transfer_buffer = transfer_buffer; 1063 urb->transfer_buffer = transfer_buffer;
974 urb->transfer_buffer_length = buffer_length; 1064 urb->transfer_buffer_length = buffer_length;
975 urb->complete = complete; 1065 urb->complete = complete_fn;
976 urb->context = context; 1066 urb->context = context;
977 if (dev->speed == USB_SPEED_HIGH) 1067 if (dev->speed == USB_SPEED_HIGH)
978 urb->interval = 1 << (interval - 1); 1068 urb->interval = 1 << (interval - 1);
@@ -990,7 +1080,6 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
990extern int usb_unlink_urb(struct urb *urb); 1080extern int usb_unlink_urb(struct urb *urb);
991extern void usb_kill_urb(struct urb *urb); 1081extern void usb_kill_urb(struct urb *urb);
992 1082
993#define HAVE_USB_BUFFERS
994void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1083void *usb_buffer_alloc (struct usb_device *dev, size_t size,
995 gfp_t mem_flags, dma_addr_t *dma); 1084 gfp_t mem_flags, dma_addr_t *dma);
996void usb_buffer_free (struct usb_device *dev, size_t size, 1085void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1003,14 +1092,14 @@ void usb_buffer_unmap (struct urb *urb);
1003#endif 1092#endif
1004 1093
1005struct scatterlist; 1094struct scatterlist;
1006int usb_buffer_map_sg (struct usb_device *dev, unsigned pipe, 1095int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe,
1007 struct scatterlist *sg, int nents); 1096 struct scatterlist *sg, int nents);
1008#if 0 1097#if 0
1009void usb_buffer_dmasync_sg (struct usb_device *dev, unsigned pipe, 1098void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe,
1010 struct scatterlist *sg, int n_hw_ents); 1099 struct scatterlist *sg, int n_hw_ents);
1011#endif 1100#endif
1012void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe, 1101void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe,
1013 struct scatterlist *sg, int n_hw_ents); 1102 struct scatterlist *sg, int n_hw_ents);
1014 1103
1015/*-------------------------------------------------------------------* 1104/*-------------------------------------------------------------------*
1016 * SYNCHRONOUS CALL SUPPORT * 1105 * SYNCHRONOUS CALL SUPPORT *
@@ -1038,6 +1127,9 @@ extern int usb_clear_halt(struct usb_device *dev, int pipe);
1038extern int usb_reset_configuration(struct usb_device *dev); 1127extern int usb_reset_configuration(struct usb_device *dev);
1039extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); 1128extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
1040 1129
1130/* this request isn't really synchronous, but it belongs with the others */
1131extern int usb_driver_set_configuration(struct usb_device *udev, int config);
1132
1041/* 1133/*
1042 * timeouts, in milliseconds, used for sending/receiving control messages 1134 * timeouts, in milliseconds, used for sending/receiving control messages
1043 * they typically complete within a few frames (msec) after they're issued 1135 * they typically complete within a few frames (msec) after they're issued
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
new file mode 100644
index 000000000000..6bd235994dc2
--- /dev/null
+++ b/include/linux/usb/audio.h
@@ -0,0 +1,53 @@
1/*
2 * <linux/usb/audio.h> -- USB Audio definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for Audio Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 */
17
18#ifndef __LINUX_USB_AUDIO_H
19#define __LINUX_USB_AUDIO_H
20
21#include <linux/types.h>
22
23/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03
27
28/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor {
30 __u8 bLength; // 8+n
31 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
32 __u8 bDescriptorSubtype; // USB_MS_HEADER
33 __le16 bcdADC; // 0x0100
34 __le16 wTotalLength; // includes Unit and Terminal desc.
35 __u8 bInCollection; // n
36 __u8 baInterfaceNr[]; // [n]
37} __attribute__ ((packed));
38
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
40
41/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
43struct usb_ac_header_descriptor_##n { \
44 __u8 bLength; \
45 __u8 bDescriptorType; \
46 __u8 bDescriptorSubtype; \
47 __le16 bcdADC; \
48 __le16 wTotalLength; \
49 __u8 bInCollection; \
50 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed))
52
53#endif
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
new file mode 100644
index 000000000000..11a97d5ffd34
--- /dev/null
+++ b/include/linux/usb/midi.h
@@ -0,0 +1,112 @@
1/*
2 * <linux/usb/midi.h> -- USB MIDI definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for MIDI Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/midi10.pdf
16 */
17
18#ifndef __LINUX_USB_MIDI_H
19#define __LINUX_USB_MIDI_H
20
21#include <linux/types.h>
22
23/* A.1 MS Class-Specific Interface Descriptor Subtypes */
24#define USB_MS_HEADER 0x01
25#define USB_MS_MIDI_IN_JACK 0x02
26#define USB_MS_MIDI_OUT_JACK 0x03
27#define USB_MS_ELEMENT 0x04
28
29/* A.2 MS Class-Specific Endpoint Descriptor Subtypes */
30#define USB_MS_GENERAL 0x01
31
32/* A.3 MS MIDI IN and OUT Jack Types */
33#define USB_MS_EMBEDDED 0x01
34#define USB_MS_EXTERNAL 0x02
35
36/* 6.1.2.1 Class-Specific MS Interface Header Descriptor */
37struct usb_ms_header_descriptor {
38 __u8 bLength;
39 __u8 bDescriptorType;
40 __u8 bDescriptorSubtype;
41 __le16 bcdMSC;
42 __le16 wTotalLength;
43} __attribute__ ((packed));
44
45#define USB_DT_MS_HEADER_SIZE 7
46
47/* 6.1.2.2 MIDI IN Jack Descriptor */
48struct usb_midi_in_jack_descriptor {
49 __u8 bLength;
50 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
51 __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK
52 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
53 __u8 bJackID;
54 __u8 iJack;
55} __attribute__ ((packed));
56
57#define USB_DT_MIDI_IN_SIZE 6
58
59struct usb_midi_source_pin {
60 __u8 baSourceID;
61 __u8 baSourcePin;
62} __attribute__ ((packed));
63
64/* 6.1.2.3 MIDI OUT Jack Descriptor */
65struct usb_midi_out_jack_descriptor {
66 __u8 bLength;
67 __u8 bDescriptorType; // USB_DT_CS_INTERFACE
68 __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK
69 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL
70 __u8 bJackID;
71 __u8 bNrInputPins; // p
72 struct usb_midi_source_pin pins[]; // [p]
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74} __attribute__ ((packed));
75
76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
77
78/* As above, but more useful for defining your own descriptors: */
79#define DECLARE_USB_MIDI_OUT_JACK_DESCRIPTOR(p) \
80struct usb_midi_out_jack_descriptor_##p { \
81 __u8 bLength; \
82 __u8 bDescriptorType; \
83 __u8 bDescriptorSubtype; \
84 __u8 bJackType; \
85 __u8 bJackID; \
86 __u8 bNrInputPins; \
87 struct usb_midi_source_pin pins[p]; \
88 __u8 iJack; \
89} __attribute__ ((packed))
90
91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92struct usb_ms_endpoint_descriptor {
93 __u8 bLength; // 4+n
94 __u8 bDescriptorType; // USB_DT_CS_ENDPOINT
95 __u8 bDescriptorSubtype; // USB_MS_GENERAL
96 __u8 bNumEmbMIDIJack; // n
97 __u8 baAssocJackID[]; // [n]
98} __attribute__ ((packed));
99
100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
101
102/* As above, but more useful for defining your own descriptors: */
103#define DECLARE_USB_MS_ENDPOINT_DESCRIPTOR(n) \
104struct usb_ms_endpoint_descriptor_##n { \
105 __u8 bLength; \
106 __u8 bDescriptorType; \
107 __u8 bDescriptorSubtype; \
108 __u8 bNumEmbMIDIJack; \
109 __u8 baAssocJackID[n]; \
110} __attribute__ ((packed))
111
112#endif
diff --git a/include/linux/usb_otg.h b/include/linux/usb/otg.h
index f827f6e203c2..9897f7a818c5 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb/otg.h
@@ -1,4 +1,4 @@
1// include/linux/usb_otg.h 1// include/linux/usb/otg.h
2 2
3/* 3/*
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
@@ -52,7 +52,7 @@ struct otg_transceiver {
52 u16 port_change; 52 u16 port_change;
53 53
54 /* bind/unbind the host controller */ 54 /* bind/unbind the host controller */
55 int (*set_host)(struct otg_transceiver *otg, 55 int (*set_host)(struct otg_transceiver *otg,
56 struct usb_bus *host); 56 struct usb_bus *host);
57 57
58 /* bind/unbind the peripheral controller */ 58 /* bind/unbind the peripheral controller */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index e7fc5fed5b98..2ae76fe52ff7 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -108,6 +108,9 @@ enum { US_DO_ALL_FLAGS };
108#ifdef CONFIG_USB_STORAGE_ALAUDA 108#ifdef CONFIG_USB_STORAGE_ALAUDA
109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 109#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
110#endif 110#endif
111#ifdef CONFIG_USB_STORAGE_KARMA
112#define US_PR_KARMA 0xf5 /* Rio Karma */
113#endif
111 114
112#define US_PR_DEVICE 0xff /* Use device's value */ 115#define US_PR_DEVICE 0xff /* Use device's value */
113 116
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index 46919f9f5eb3..4d0909e53595 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -24,5 +24,5 @@
24#define VERMAGIC_STRING \ 24#define VERMAGIC_STRING \
25 UTS_RELEASE " " \ 25 UTS_RELEASE " " \
26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \
27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \ 27 MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC
28 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 28
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 71b6363caaaf..ce5f1482e6be 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -44,8 +44,6 @@ extern void *vmalloc_32_user(unsigned long size);
44extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); 44extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
45extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, 45extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask,
46 pgprot_t prot); 46 pgprot_t prot);
47extern void *__vmalloc_node(unsigned long size, gfp_t gfp_mask,
48 pgprot_t prot, int node);
49extern void vfree(void *addr); 47extern void vfree(void *addr);
50 48
51extern void *vmap(struct page **pages, unsigned int count, 49extern void *vmap(struct page **pages, unsigned int count,
@@ -64,7 +62,6 @@ extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
64extern struct vm_struct *get_vm_area_node(unsigned long size, 62extern struct vm_struct *get_vm_area_node(unsigned long size,
65 unsigned long flags, int node); 63 unsigned long flags, int node);
66extern struct vm_struct *remove_vm_area(void *addr); 64extern struct vm_struct *remove_vm_area(void *addr);
67extern struct vm_struct *__remove_vm_area(void *addr);
68extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 65extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
69 struct page ***pages); 66 struct page ***pages);
70extern void unmap_vm_area(struct vm_struct *area); 67extern void unmap_vm_area(struct vm_struct *area);
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 2d9b1b60798a..176c7f797339 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -18,7 +18,19 @@
18 * generated will simply be the increment of a global address. 18 * generated will simply be the increment of a global address.
19 */ 19 */
20 20
21#define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL, x##_HIGH 21#ifdef CONFIG_ZONE_DMA32
22#define DMA32_ZONE(xx) xx##_DMA32,
23#else
24#define DMA32_ZONE(xx)
25#endif
26
27#ifdef CONFIG_HIGHMEM
28#define HIGHMEM_ZONE(xx) , xx##_HIGH
29#else
30#define HIGHMEM_ZONE(xx)
31#endif
32
33#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
22 34
23enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 35enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
24 FOR_ALL_ZONES(PGALLOC), 36 FOR_ALL_ZONES(PGALLOC),
@@ -124,12 +136,10 @@ static inline unsigned long node_page_state(int node,
124 struct zone *zones = NODE_DATA(node)->node_zones; 136 struct zone *zones = NODE_DATA(node)->node_zones;
125 137
126 return 138 return
127#ifndef CONFIG_DMA_IS_NORMAL 139#ifdef CONFIG_ZONE_DMA32
128#if !defined(CONFIG_DMA_IS_DMA32) && BITS_PER_LONG >= 64
129 zone_page_state(&zones[ZONE_DMA32], item) + 140 zone_page_state(&zones[ZONE_DMA32], item) +
130#endif 141#endif
131 zone_page_state(&zones[ZONE_NORMAL], item) + 142 zone_page_state(&zones[ZONE_NORMAL], item) +
132#endif
133#ifdef CONFIG_HIGHMEM 143#ifdef CONFIG_HIGHMEM
134 zone_page_state(&zones[ZONE_HIGHMEM], item) + 144 zone_page_state(&zones[ZONE_HIGHMEM], item) +
135#endif 145#endif
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 13588564b42b..a50a0130fd9e 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 20 17.2.06 4 * Version : 21 14.3.06
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
@@ -69,9 +69,14 @@
69 69
70/***************************** INCLUDES *****************************/ 70/***************************** INCLUDES *****************************/
71 71
72/* This header is used in user-space, therefore need to be sanitised
73 * for that purpose. Those includes are usually not compatible with glibc.
74 * To know which includes to use in user-space, check iwlib.h. */
75#ifdef __KERNEL__
72#include <linux/types.h> /* for "caddr_t" et al */ 76#include <linux/types.h> /* for "caddr_t" et al */
73#include <linux/socket.h> /* for "struct sockaddr" et al */ 77#include <linux/socket.h> /* for "struct sockaddr" et al */
74#include <linux/if.h> /* for IFNAMSIZ and co... */ 78#include <linux/if.h> /* for IFNAMSIZ and co... */
79#endif /* __KERNEL__ */
75 80
76/***************************** VERSION *****************************/ 81/***************************** VERSION *****************************/
77/* 82/*
@@ -80,7 +85,7 @@
80 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
82 */ 87 */
83#define WIRELESS_EXT 20 88#define WIRELESS_EXT 21
84 89
85/* 90/*
86 * Changes : 91 * Changes :
@@ -208,6 +213,14 @@
208 * V19 to V20 213 * V19 to V20
209 * ---------- 214 * ----------
210 * - RtNetlink requests support (SET/GET) 215 * - RtNetlink requests support (SET/GET)
216 *
217 * V20 to V21
218 * ----------
219 * - Remove (struct net_device *)->get_wireless_stats()
220 * - Change length in ESSID and NICK to strlen() instead of strlen()+1
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
211 */ 224 */
212 225
213/**************************** CONSTANTS ****************************/ 226/**************************** CONSTANTS ****************************/
@@ -448,6 +461,7 @@
448#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ 461#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
449#define IW_QUAL_LEVEL_INVALID 0x20 462#define IW_QUAL_LEVEL_INVALID 0x20
450#define IW_QUAL_NOISE_INVALID 0x40 463#define IW_QUAL_NOISE_INVALID 0x40
464#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */
451#define IW_QUAL_ALL_INVALID 0x70 465#define IW_QUAL_ALL_INVALID 0x70
452 466
453/* Frequency flags */ 467/* Frequency flags */
@@ -500,10 +514,12 @@
500#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ 514#define IW_RETRY_TYPE 0xF000 /* Type of parameter */
501#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ 515#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
502#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ 516#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
503#define IW_RETRY_MODIFIER 0x000F /* Modify a parameter */ 517#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */
504#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ 518#define IW_RETRY_MIN 0x0001 /* Value is a minimum */
505#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ 519#define IW_RETRY_MAX 0x0002 /* Value is a maximum */
506#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ 520#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
521#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */
522#define IW_RETRY_LONG 0x0020 /* Value is for long packets */
507 523
508/* Scanning request flags */ 524/* Scanning request flags */
509#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ 525#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */
@@ -1017,7 +1033,7 @@ struct iw_range
1017 /* Note : this frequency list doesn't need to fit channel numbers, 1033 /* Note : this frequency list doesn't need to fit channel numbers,
1018 * because each entry contain its channel index */ 1034 * because each entry contain its channel index */
1019 1035
1020 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ 1036 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
1021}; 1037};
1022 1038
1023/* 1039/*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 0422036af4eb..56a23a0e7f2e 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -116,6 +116,7 @@ int sync_page_range(struct inode *inode, struct address_space *mapping,
116 loff_t pos, loff_t count); 116 loff_t pos, loff_t count);
117int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, 117int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
118 loff_t pos, loff_t count); 118 loff_t pos, loff_t count);
119void set_page_dirty_balance(struct page *page);
119 120
120/* pdflush.c */ 121/* pdflush.c */
121extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 122extern int nr_pdflush_threads; /* Global so it can be exported to sysctl