aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/calc64.h49
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/compat.h3
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/fdtable.h99
-rw-r--r--include/linux/file.h86
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/math64.h84
-rw-r--r--include/linux/module.h19
-rw-r--r--include/linux/mtd/jedec.h66
-rw-r--r--include/linux/mtd/mtd.h6
-rw-r--r--include/linux/mtd/pmc551.h5
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/poll.h2
-rw-r--r--include/linux/quota.h3
-rw-r--r--include/linux/rio.h2
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sysfs.h6
-rw-r--r--include/linux/timex.h46
-rw-r--r--include/linux/usb/c67x00.h48
-rw-r--r--include/linux/usb/ch9.h12
-rw-r--r--include/linux/usb/gadget.h21
-rw-r--r--include/linux/virtio.h7
-rw-r--r--include/linux/virtio_blk.h14
-rw-r--r--include/linux/virtio_config.h81
-rw-r--r--include/linux/virtio_net.h13
30 files changed, 405 insertions, 293 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 78fade0a1e35..b7d81b2a9041 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -346,6 +346,11 @@ unifdef-y += videodev.h
346unifdef-y += virtio_config.h 346unifdef-y += virtio_config.h
347unifdef-y += virtio_blk.h 347unifdef-y += virtio_blk.h
348unifdef-y += virtio_net.h 348unifdef-y += virtio_net.h
349unifdef-y += virtio_9p.h
350unifdef-y += virtio_balloon.h
351unifdef-y += virtio_console.h
352unifdef-y += virtio_pci.h
353unifdef-y += virtio_ring.h
349unifdef-y += vt.h 354unifdef-y += vt.h
350unifdef-y += wait.h 355unifdef-y += wait.h
351unifdef-y += wanrouter.h 356unifdef-y += wanrouter.h
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index b2e1ba325b9a..6129e58ca7c9 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,8 +8,7 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, 11int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 const char *name, const struct file_operations *fops,
13 void *priv); 12 void *priv);
14 13
15#endif /* _LINUX_ANON_INODES_H */ 14#endif /* _LINUX_ANON_INODES_H */
diff --git a/include/linux/calc64.h b/include/linux/calc64.h
deleted file mode 100644
index ebf4b8f38d88..000000000000
--- a/include/linux/calc64.h
+++ /dev/null
@@ -1,49 +0,0 @@
1#ifndef _LINUX_CALC64_H
2#define _LINUX_CALC64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7/*
8 * This is a generic macro which is used when the architecture
9 * specific div64.h does not provide a optimized one.
10 *
11 * The 64bit dividend is divided by the divisor (data type long), the
12 * result is returned and the remainder stored in the variable
13 * referenced by remainder (data type long *). In contrast to the
14 * do_div macro the dividend is kept intact.
15 */
16#ifndef div_long_long_rem
17#define div_long_long_rem(dividend, divisor, remainder) \
18 do_div_llr((dividend), divisor, remainder)
19
20static inline unsigned long do_div_llr(const long long dividend,
21 const long divisor, long *remainder)
22{
23 u64 result = dividend;
24
25 *(remainder) = do_div(result, divisor);
26 return (unsigned long) result;
27}
28#endif
29
30/*
31 * Sign aware variation of the above. On some architectures a
32 * negative dividend leads to an divide overflow exception, which
33 * is avoided by the sign check.
34 */
35static inline long div_long_long_rem_signed(const long long dividend,
36 const long divisor, long *remainder)
37{
38 long res;
39
40 if (unlikely(dividend < 0)) {
41 res = -div_long_long_rem(-dividend, divisor, remainder);
42 *remainder = -(*remainder);
43 } else
44 res = div_long_long_rem(dividend, divisor, remainder);
45
46 return res;
47}
48
49#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 35094479ca55..55e434feec99 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -93,6 +93,8 @@ struct clocksource {
93#endif 93#endif
94}; 94};
95 95
96extern struct clocksource *clock; /* current clocksource */
97
96/* 98/*
97 * Clock source flags bits:: 99 * Clock source flags bits::
98 */ 100 */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 8fa7857e153b..cf8d11cad5ae 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -65,10 +65,11 @@ struct compat_timex {
65 compat_long_t calcnt; 65 compat_long_t calcnt;
66 compat_long_t errcnt; 66 compat_long_t errcnt;
67 compat_long_t stbcnt; 67 compat_long_t stbcnt;
68 compat_int_t tai;
68 69
69 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; 72 compat_int_t :32; compat_int_t :32; compat_int_t :32;
72}; 73};
73 74
74#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) 75#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
diff --git a/include/linux/device.h b/include/linux/device.h
index 832fb0eb2933..8c23e3dfe3ac 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -380,6 +380,12 @@ struct device {
380/* Get the wakeup routines, which depend on struct device */ 380/* Get the wakeup routines, which depend on struct device */
381#include <linux/pm_wakeup.h> 381#include <linux/pm_wakeup.h>
382 382
383static inline const char *dev_name(struct device *dev)
384{
385 /* will be changed into kobject_name(&dev->kobj) in the near future */
386 return dev->bus_id;
387}
388
383#ifdef CONFIG_NUMA 389#ifdef CONFIG_NUMA
384static inline int dev_to_node(struct device *dev) 390static inline int dev_to_node(struct device *dev)
385{ 391{
@@ -478,7 +484,7 @@ extern void sysdev_shutdown(void);
478extern const char *dev_driver_string(struct device *dev); 484extern const char *dev_driver_string(struct device *dev);
479#define dev_printk(level, dev, format, arg...) \ 485#define dev_printk(level, dev, format, arg...) \
480 printk(level "%s %s: " format , dev_driver_string(dev) , \ 486 printk(level "%s %s: " format , dev_driver_string(dev) , \
481 (dev)->bus_id , ## arg) 487 dev_name(dev) , ## arg)
482 488
483#define dev_emerg(dev, format, arg...) \ 489#define dev_emerg(dev, format, arg...) \
484 dev_printk(KERN_EMERG , dev , format , ## arg) 490 dev_printk(KERN_EMERG , dev , format , ## arg)
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
new file mode 100644
index 000000000000..a118f3c0b240
--- /dev/null
+++ b/include/linux/fdtable.h
@@ -0,0 +1,99 @@
1/*
2 * descriptor table internals; you almost certainly want file.h instead.
3 */
4
5#ifndef __LINUX_FDTABLE_H
6#define __LINUX_FDTABLE_H
7
8#include <asm/atomic.h>
9#include <linux/posix_types.h>
10#include <linux/compiler.h>
11#include <linux/spinlock.h>
12#include <linux/rcupdate.h>
13#include <linux/types.h>
14
15/*
16 * The default fd array needs to be at least BITS_PER_LONG,
17 * as this is the granularity returned by copy_fdset().
18 */
19#define NR_OPEN_DEFAULT BITS_PER_LONG
20
21/*
22 * The embedded_fd_set is a small fd_set,
23 * suitable for most tasks (which open <= BITS_PER_LONG files)
24 */
25struct embedded_fd_set {
26 unsigned long fds_bits[1];
27};
28
29struct fdtable {
30 unsigned int max_fds;
31 struct file ** fd; /* current fd array */
32 fd_set *close_on_exec;
33 fd_set *open_fds;
34 struct rcu_head rcu;
35 struct fdtable *next;
36};
37
38/*
39 * Open file table structure
40 */
41struct files_struct {
42 /*
43 * read mostly part
44 */
45 atomic_t count;
46 struct fdtable *fdt;
47 struct fdtable fdtab;
48 /*
49 * written part on a separate cache line in SMP
50 */
51 spinlock_t file_lock ____cacheline_aligned_in_smp;
52 int next_fd;
53 struct embedded_fd_set close_on_exec_init;
54 struct embedded_fd_set open_fds_init;
55 struct file * fd_array[NR_OPEN_DEFAULT];
56};
57
58#define files_fdtable(files) (rcu_dereference((files)->fdt))
59
60extern struct kmem_cache *filp_cachep;
61
62struct file_operations;
63struct vfsmount;
64struct dentry;
65
66extern int expand_files(struct files_struct *, int nr);
67extern void free_fdtable_rcu(struct rcu_head *rcu);
68extern void __init files_defer_init(void);
69
70static inline void free_fdtable(struct fdtable *fdt)
71{
72 call_rcu(&fdt->rcu, free_fdtable_rcu);
73}
74
75static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
76{
77 struct file * file = NULL;
78 struct fdtable *fdt = files_fdtable(files);
79
80 if (fd < fdt->max_fds)
81 file = rcu_dereference(fdt->fd[fd]);
82 return file;
83}
84
85/*
86 * Check whether the specified fd has an open file.
87 */
88#define fcheck(fd) fcheck_files(current->files, fd)
89
90struct task_struct;
91
92struct files_struct *get_files_struct(struct task_struct *);
93void put_files_struct(struct files_struct *fs);
94void reset_files_struct(struct files_struct *);
95int unshare_files(struct files_struct **);
96
97extern struct kmem_cache *files_cachep;
98
99#endif /* __LINUX_FDTABLE_H */
diff --git a/include/linux/file.h b/include/linux/file.h
index 69baf5a4f0a5..27c64bdc68c9 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -5,59 +5,11 @@
5#ifndef __LINUX_FILE_H 5#ifndef __LINUX_FILE_H
6#define __LINUX_FILE_H 6#define __LINUX_FILE_H
7 7
8#include <asm/atomic.h>
9#include <linux/posix_types.h>
10#include <linux/compiler.h> 8#include <linux/compiler.h>
11#include <linux/spinlock.h>
12#include <linux/rcupdate.h>
13#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/posix_types.h>
14 11
15/* 12struct file;
16 * The default fd array needs to be at least BITS_PER_LONG,
17 * as this is the granularity returned by copy_fdset().
18 */
19#define NR_OPEN_DEFAULT BITS_PER_LONG
20
21/*
22 * The embedded_fd_set is a small fd_set,
23 * suitable for most tasks (which open <= BITS_PER_LONG files)
24 */
25struct embedded_fd_set {
26 unsigned long fds_bits[1];
27};
28
29struct fdtable {
30 unsigned int max_fds;
31 struct file ** fd; /* current fd array */
32 fd_set *close_on_exec;
33 fd_set *open_fds;
34 struct rcu_head rcu;
35 struct fdtable *next;
36};
37
38/*
39 * Open file table structure
40 */
41struct files_struct {
42 /*
43 * read mostly part
44 */
45 atomic_t count;
46 struct fdtable *fdt;
47 struct fdtable fdtab;
48 /*
49 * written part on a separate cache line in SMP
50 */
51 spinlock_t file_lock ____cacheline_aligned_in_smp;
52 int next_fd;
53 struct embedded_fd_set close_on_exec_init;
54 struct embedded_fd_set open_fds_init;
55 struct file * fd_array[NR_OPEN_DEFAULT];
56};
57
58#define files_fdtable(files) (rcu_dereference((files)->fdt))
59
60extern struct kmem_cache *filp_cachep;
61 13
62extern void __fput(struct file *); 14extern void __fput(struct file *);
63extern void fput(struct file *); 15extern void fput(struct file *);
@@ -85,41 +37,7 @@ extern void put_filp(struct file *);
85extern int get_unused_fd(void); 37extern int get_unused_fd(void);
86extern int get_unused_fd_flags(int flags); 38extern int get_unused_fd_flags(int flags);
87extern void put_unused_fd(unsigned int fd); 39extern void put_unused_fd(unsigned int fd);
88struct kmem_cache;
89
90extern int expand_files(struct files_struct *, int nr);
91extern void free_fdtable_rcu(struct rcu_head *rcu);
92extern void __init files_defer_init(void);
93
94static inline void free_fdtable(struct fdtable *fdt)
95{
96 call_rcu(&fdt->rcu, free_fdtable_rcu);
97}
98
99static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
100{
101 struct file * file = NULL;
102 struct fdtable *fdt = files_fdtable(files);
103
104 if (fd < fdt->max_fds)
105 file = rcu_dereference(fdt->fd[fd]);
106 return file;
107}
108
109/*
110 * Check whether the specified fd has an open file.
111 */
112#define fcheck(fd) fcheck_files(current->files, fd)
113 40
114extern void fd_install(unsigned int fd, struct file *file); 41extern void fd_install(unsigned int fd, struct file *file);
115 42
116struct task_struct;
117
118struct files_struct *get_files_struct(struct task_struct *);
119void put_files_struct(struct files_struct *fs);
120void reset_files_struct(struct files_struct *);
121int unshare_files(struct files_struct **);
122
123extern struct kmem_cache *files_cachep;
124
125#endif /* __LINUX_FILE_H */ 43#endif /* __LINUX_FILE_H */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index bf6b8a61f8db..b24c2875aa05 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX__INIT_TASK_H 1#ifndef _LINUX__INIT_TASK_H
2#define _LINUX__INIT_TASK_H 2#define _LINUX__INIT_TASK_H
3 3
4#include <linux/file.h> 4#include <linux/fdtable.h>
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6#include <linux/irqflags.h> 6#include <linux/irqflags.h>
7#include <linux/utsname.h> 7#include <linux/utsname.h>
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 1883a85625dd..552e0ec269c9 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -61,6 +61,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
61#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ 61#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */
62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
64#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
64 65
65#ifdef CONFIG_IRQ_PER_CPU 66#ifdef CONFIG_IRQ_PER_CPU
66# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 67# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 33ef710dac24..abb6ac639e8e 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_JIFFIES_H 1#ifndef _LINUX_JIFFIES_H
2#define _LINUX_JIFFIES_H 2#define _LINUX_JIFFIES_H
3 3
4#include <linux/calc64.h> 4#include <linux/math64.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/time.h> 7#include <linux/time.h>
diff --git a/include/linux/math64.h b/include/linux/math64.h
new file mode 100644
index 000000000000..c1a5f81501ff
--- /dev/null
+++ b/include/linux/math64.h
@@ -0,0 +1,84 @@
1#ifndef _LINUX_MATH64_H
2#define _LINUX_MATH64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7#if BITS_PER_LONG == 64
8
9/**
10 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
11 *
12 * This is commonly provided by 32bit archs to provide an optimized 64bit
13 * divide.
14 */
15static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
16{
17 *remainder = dividend % divisor;
18 return dividend / divisor;
19}
20
21/**
22 * div_s64_rem - signed 64bit divide with 32bit divisor with remainder
23 */
24static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
25{
26 *remainder = dividend % divisor;
27 return dividend / divisor;
28}
29
30/**
31 * div64_u64 - unsigned 64bit divide with 64bit divisor
32 */
33static inline u64 div64_u64(u64 dividend, u64 divisor)
34{
35 return dividend / divisor;
36}
37
38#elif BITS_PER_LONG == 32
39
40#ifndef div_u64_rem
41static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
42{
43 *remainder = do_div(dividend, divisor);
44 return dividend;
45}
46#endif
47
48#ifndef div_s64_rem
49extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
50#endif
51
52#ifndef div64_u64
53extern u64 div64_u64(u64 dividend, u64 divisor);
54#endif
55
56#endif /* BITS_PER_LONG */
57
58/**
59 * div_u64 - unsigned 64bit divide with 32bit divisor
60 *
61 * This is the most common 64bit divide and should be used if possible,
62 * as many 32bit archs can optimize this variant better than a full 64bit
63 * divide.
64 */
65#ifndef div_u64
66static inline u64 div_u64(u64 dividend, u32 divisor)
67{
68 u32 remainder;
69 return div_u64_rem(dividend, divisor, &remainder);
70}
71#endif
72
73/**
74 * div_s64 - signed 64bit divide with 32bit divisor
75 */
76#ifndef div_s64
77static inline s64 div_s64(s64 dividend, s32 divisor)
78{
79 s32 remainder;
80 return div_s64_rem(dividend, divisor, &remainder);
81}
82#endif
83
84#endif /* _LINUX_MATH64_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 819c4e889bf1..3e03b1acbc94 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbol);
190 extern typeof(sym) sym; \ 190 extern typeof(sym) sym; \
191 __CRC_SYMBOL(sym, sec) \ 191 __CRC_SYMBOL(sym, sec) \
192 static const char __kstrtab_##sym[] \ 192 static const char __kstrtab_##sym[] \
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"), aligned(1))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __used \ 196 __used \
@@ -229,23 +229,6 @@ enum module_state
229 MODULE_STATE_GOING, 229 MODULE_STATE_GOING,
230}; 230};
231 231
232/* Similar stuff for section attributes. */
233struct module_sect_attr
234{
235 struct module_attribute mattr;
236 char *name;
237 unsigned long address;
238};
239
240struct module_sect_attrs
241{
242 struct attribute_group grp;
243 int nsections;
244 struct module_sect_attr attrs[0];
245};
246
247struct module_param_attrs;
248
249struct module 232struct module
250{ 233{
251 enum module_state state; 234 enum module_state state;
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h
deleted file mode 100644
index 9006feb218b9..000000000000
--- a/include/linux/mtd/jedec.h
+++ /dev/null
@@ -1,66 +0,0 @@
1
2/* JEDEC Flash Interface.
3 * This is an older type of interface for self programming flash. It is
4 * commonly use in older AMD chips and is obsolete compared with CFI.
5 * It is called JEDEC because the JEDEC association distributes the ID codes
6 * for the chips.
7 *
8 * See the AMD flash databook for information on how to operate the interface.
9 *
10 * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $
11 */
12
13#ifndef __LINUX_MTD_JEDEC_H__
14#define __LINUX_MTD_JEDEC_H__
15
16#include <linux/types.h>
17
18#define MAX_JEDEC_CHIPS 16
19
20// Listing of all supported chips and their information
21struct JEDECTable
22{
23 __u16 jedec;
24 char *name;
25 unsigned long size;
26 unsigned long sectorsize;
27 __u32 capabilities;
28};
29
30// JEDEC being 0 is the end of the chip array
31struct jedec_flash_chip
32{
33 __u16 jedec;
34 unsigned long size;
35 unsigned long sectorsize;
36
37 // *(__u8*)(base + (adder << addrshift)) = data << datashift
38 // Address size = size << addrshift
39 unsigned long base; // Byte 0 of the flash, will be unaligned
40 unsigned int datashift; // Useful for 32bit/16bit accesses
41 unsigned int addrshift;
42 unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash
43
44 __u32 capabilities;
45
46 // These markers are filled in by the flash_chip_scan function
47 unsigned long start;
48 unsigned long length;
49};
50
51struct jedec_private
52{
53 unsigned long size; // Total size of all the devices
54
55 /* Bank handling. If sum(bank_fill) == size then this is linear flash.
56 Otherwise the mapping has holes in it. bank_fill may be used to
57 find the holes, but in the common symetric case
58 bank_fill[0] == bank_fill[*], thus addresses may be computed
59 mathmatically. bank_fill must be powers of two */
60 unsigned is_banked;
61 unsigned long bank_fill[MAX_JEDEC_CHIPS];
62
63 struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
64};
65
66#endif
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0a13bb35f044..245f9098e171 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -143,10 +143,12 @@ struct mtd_info {
143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
144 144
145 /* This stuff for eXecute-In-Place */ 145 /* This stuff for eXecute-In-Place */
146 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 146 /* phys is optional and may be set to NULL */
147 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
148 size_t *retlen, void **virt, resource_size_t *phys);
147 149
148 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 150 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
149 void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); 151 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
150 152
151 153
152 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 154 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
index a7f6d20ad407..5cc070c24d88 100644
--- a/include/linux/mtd/pmc551.h
+++ b/include/linux/mtd/pmc551.h
@@ -36,8 +36,9 @@ struct mypriv {
36 * Function Prototypes 36 * Function Prototypes
37 */ 37 */
38static int pmc551_erase(struct mtd_info *, struct erase_info *); 38static int pmc551_erase(struct mtd_info *, struct erase_info *);
39static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); 39static void pmc551_unpoint(struct mtd_info *, loff_t, size_t);
40static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 40static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
41 size_t *retlen, void **virt, resource_size_t *phys);
41static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); 42static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
42static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 43static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
43 44
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e5a53daf17f1..cf6dbd759395 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1429,6 +1429,7 @@
1429#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 1429#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9
1430#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA 1430#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
1431#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB 1431#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB
1432#define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4
1432 1433
1433#define PCI_VENDOR_ID_XIRCOM 0x115d 1434#define PCI_VENDOR_ID_XIRCOM 0x115d
1434#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 1435#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 16d813b364ef..ef453828877a 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -117,6 +117,8 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
117extern int do_select(int n, fd_set_bits *fds, s64 *timeout); 117extern int do_select(int n, fd_set_bits *fds, s64 *timeout);
118extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, 118extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
119 s64 *timeout); 119 s64 *timeout);
120extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
121 fd_set __user *exp, s64 *timeout);
120 122
121#endif /* KERNEL */ 123#endif /* KERNEL */
122 124
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 52e49dce6584..dcddfb200947 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -347,6 +347,9 @@ struct quota_info {
347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ 347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) 348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
349 349
350#define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \
351 sb_has_quota_suspended(sb, GRPQUOTA))
352
350int register_quota_format(struct quota_format_type *fmt); 353int register_quota_format(struct quota_format_type *fmt);
351void unregister_quota_format(struct quota_format_type *fmt); 354void unregister_quota_format(struct quota_format_type *fmt);
352 355
diff --git a/include/linux/rio.h b/include/linux/rio.h
index c1c99c9643d3..dc0c75556c63 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -161,6 +161,8 @@ enum rio_phy_type {
161 * @ops: configuration space functions 161 * @ops: configuration space functions
162 * @id: Port ID, unique among all ports 162 * @id: Port ID, unique among all ports
163 * @index: Port index, unique among all port interfaces of the same type 163 * @index: Port index, unique among all port interfaces of the same type
164 * @sys_size: RapidIO common transport system size
165 * @phy_type: RapidIO phy type
164 * @name: Port name string 166 * @name: Port name string
165 * @priv: Master port private data 167 * @priv: Master port private data
166 */ 168 */
diff --git a/include/linux/string.h b/include/linux/string.h
index c5d3fcad7b57..efdc44593b52 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
109extern char **argv_split(gfp_t gfp, const char *str, int *argcp); 109extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
110extern void argv_free(char **argv); 110extern void argv_free(char **argv);
111 111
112extern bool sysfs_streq(const char *s1, const char *s2);
113
112#endif 114#endif
113#endif /* _LINUX_STRING_H_ */ 115#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 7858eac40aa7..27bad59dae79 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -196,6 +196,12 @@ static inline int sysfs_update_group(struct kobject *kobj,
196 return 0; 196 return 0;
197} 197}
198 198
199static inline int sysfs_update_group(struct kobject *kobj,
200 const struct attribute_group *grp)
201{
202 return 0;
203}
204
199static inline void sysfs_remove_group(struct kobject *kobj, 205static inline void sysfs_remove_group(struct kobject *kobj,
200 const struct attribute_group *grp) 206 const struct attribute_group *grp)
201{ 207{
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 8ea3e71ba7fa..fc6035d29d56 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -58,6 +58,8 @@
58 58
59#include <asm/param.h> 59#include <asm/param.h>
60 60
61#define NTP_API 4 /* NTP API version */
62
61/* 63/*
62 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 64 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
63 * for a slightly underdamped convergence characteristic. SHIFT_KH 65 * for a slightly underdamped convergence characteristic. SHIFT_KH
@@ -74,24 +76,22 @@
74#define MAXTC 10 /* maximum time constant (shift) */ 76#define MAXTC 10 /* maximum time constant (shift) */
75 77
76/* 78/*
77 * The SHIFT_UPDATE define establishes the decimal point of the
78 * time_offset variable which represents the current offset with
79 * respect to standard time.
80 *
81 * SHIFT_USEC defines the scaling (shift) of the time_freq and 79 * SHIFT_USEC defines the scaling (shift) of the time_freq and
82 * time_tolerance variables, which represent the current frequency 80 * time_tolerance variables, which represent the current frequency
83 * offset and maximum frequency tolerance. 81 * offset and maximum frequency tolerance.
84 */ 82 */
85#define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */
86#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 83#define SHIFT_USEC 16 /* frequency offset scale (shift) */
87#define SHIFT_NSEC 12 /* kernel frequency offset scale */ 84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
88 85#define PPM_SCALE_INV_SHIFT 20
89#define MAXPHASE 512000L /* max phase error (us) */ 86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
90#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 87 PPM_SCALE + 1)
91#define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ 88
89#define MAXPHASE 500000000l /* max phase error (ns) */
90#define MAXFREQ 500000 /* max frequency error (ns/s) */
91#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
92#define MINSEC 256 /* min interval between updates (s) */ 92#define MINSEC 256 /* min interval between updates (s) */
93#define MAXSEC 2048 /* max interval between updates (s) */ 93#define MAXSEC 2048 /* max interval between updates (s) */
94#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 94#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
95 95
96/* 96/*
97 * syscall interface - used (mainly by NTP daemon) 97 * syscall interface - used (mainly by NTP daemon)
@@ -121,9 +121,11 @@ struct timex {
121 long errcnt; /* calibration errors (ro) */ 121 long errcnt; /* calibration errors (ro) */
122 long stbcnt; /* stability limit exceeded (ro) */ 122 long stbcnt; /* stability limit exceeded (ro) */
123 123
124 int tai; /* TAI offset (ro) */
125
124 int :32; int :32; int :32; int :32; 126 int :32; int :32; int :32; int :32;
125 int :32; int :32; int :32; int :32; 127 int :32; int :32; int :32; int :32;
126 int :32; int :32; int :32; int :32; 128 int :32; int :32; int :32;
127}; 129};
128 130
129/* 131/*
@@ -135,6 +137,9 @@ struct timex {
135#define ADJ_ESTERROR 0x0008 /* estimated time error */ 137#define ADJ_ESTERROR 0x0008 /* estimated time error */
136#define ADJ_STATUS 0x0010 /* clock status */ 138#define ADJ_STATUS 0x0010 /* clock status */
137#define ADJ_TIMECONST 0x0020 /* pll time constant */ 139#define ADJ_TIMECONST 0x0020 /* pll time constant */
140#define ADJ_TAI 0x0080 /* set TAI offset */
141#define ADJ_MICRO 0x1000 /* select microsecond resolution */
142#define ADJ_NANO 0x2000 /* select nanosecond resolution */
138#define ADJ_TICK 0x4000 /* tick value */ 143#define ADJ_TICK 0x4000 /* tick value */
139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 144#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
140#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ 145#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
@@ -146,8 +151,6 @@ struct timex {
146#define MOD_ESTERROR ADJ_ESTERROR 151#define MOD_ESTERROR ADJ_ESTERROR
147#define MOD_STATUS ADJ_STATUS 152#define MOD_STATUS ADJ_STATUS
148#define MOD_TIMECONST ADJ_TIMECONST 153#define MOD_TIMECONST ADJ_TIMECONST
149#define MOD_CLKB ADJ_TICK
150#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
151 154
152 155
153/* 156/*
@@ -169,9 +172,13 @@ struct timex {
169#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ 172#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
170 173
171#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ 174#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
175#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
176#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
177#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
172 178
179/* read-only bits */
173#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ 180#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
174 STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ 181 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
175 182
176/* 183/*
177 * Clock states (time_state) 184 * Clock states (time_state)
@@ -203,10 +210,9 @@ extern int time_status; /* clock synchronization status bits */
203extern long time_maxerror; /* maximum error */ 210extern long time_maxerror; /* maximum error */
204extern long time_esterror; /* estimated error */ 211extern long time_esterror; /* estimated error */
205 212
206extern long time_freq; /* frequency offset (scaled ppm) */
207
208extern long time_adjust; /* The amount of adjtime left */ 213extern long time_adjust; /* The amount of adjtime left */
209 214
215extern void ntp_init(void);
210extern void ntp_clear(void); 216extern void ntp_clear(void);
211 217
212/** 218/**
@@ -225,7 +231,7 @@ static inline int ntp_synced(void)
225 __x < 0 ? -(-__x >> __s) : __x >> __s; \ 231 __x < 0 ? -(-__x >> __s) : __x >> __s; \
226}) 232})
227 233
228#define TICK_LENGTH_SHIFT 32 234#define NTP_SCALE_SHIFT 32
229 235
230#ifdef CONFIG_NO_HZ 236#ifdef CONFIG_NO_HZ
231#define NTP_INTERVAL_FREQ (2) 237#define NTP_INTERVAL_FREQ (2)
@@ -234,8 +240,8 @@ static inline int ntp_synced(void)
234#endif 240#endif
235#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 241#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
236 242
237/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 243/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
238extern u64 current_tick_length(void); 244extern u64 tick_length;
239 245
240extern void second_overflow(void); 246extern void second_overflow(void);
241extern void update_ntp_one_tick(void); 247extern void update_ntp_one_tick(void);
diff --git a/include/linux/usb/c67x00.h b/include/linux/usb/c67x00.h
new file mode 100644
index 000000000000..83c6b45470ca
--- /dev/null
+++ b/include/linux/usb/c67x00.h
@@ -0,0 +1,48 @@
1/*
2 * usb_c67x00.h: platform definitions for the Cypress C67X00 USB chip
3 *
4 * Copyright (C) 2006-2008 Barco N.V.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA.
20 */
21
22#ifndef _LINUX_USB_C67X00_H
23#define _LINUX_USB_C67X00_H
24
25/* SIE configuration */
26#define C67X00_SIE_UNUSED 0
27#define C67X00_SIE_HOST 1
28#define C67X00_SIE_PERIPHERAL_A 2 /* peripheral on A port */
29#define C67X00_SIE_PERIPHERAL_B 3 /* peripheral on B port */
30
31#define c67x00_sie_config(config, n) (((config)>>(4*(n)))&0x3)
32
33#define C67X00_SIE1_UNUSED (C67X00_SIE_UNUSED << 0)
34#define C67X00_SIE1_HOST (C67X00_SIE_HOST << 0)
35#define C67X00_SIE1_PERIPHERAL_A (C67X00_SIE_PERIPHERAL_A << 0)
36#define C67X00_SIE1_PERIPHERAL_B (C67X00_SIE_PERIPHERAL_B << 0)
37
38#define C67X00_SIE2_UNUSED (C67X00_SIE_UNUSED << 4)
39#define C67X00_SIE2_HOST (C67X00_SIE_HOST << 4)
40#define C67X00_SIE2_PERIPHERAL_A (C67X00_SIE_PERIPHERAL_A << 4)
41#define C67X00_SIE2_PERIPHERAL_B (C67X00_SIE_PERIPHERAL_B << 4)
42
43struct c67x00_platform_data {
44 int sie_config; /* SIEs config (C67X00_SIEx_*) */
45 unsigned long hpi_regstep; /* Step between HPI registers */
46};
47
48#endif /* _LINUX_USB_C67X00_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 7e0d3084f76c..73a2f4eb1f7a 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -455,7 +455,7 @@ struct usb_encryption_descriptor {
455 455
456/*-------------------------------------------------------------------------*/ 456/*-------------------------------------------------------------------------*/
457 457
458/* USB_DT_BOS: group of wireless capabilities */ 458/* USB_DT_BOS: group of device-level capabilities */
459struct usb_bos_descriptor { 459struct usb_bos_descriptor {
460 __u8 bLength; 460 __u8 bLength;
461 __u8 bDescriptorType; 461 __u8 bDescriptorType;
@@ -501,6 +501,16 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
501 __u8 bReserved; 501 __u8 bReserved;
502} __attribute__((packed)); 502} __attribute__((packed));
503 503
504#define USB_CAP_TYPE_EXT 2
505
506struct usb_ext_cap_descriptor { /* Link Power Management */
507 __u8 bLength;
508 __u8 bDescriptorType;
509 __u8 bDevCapabilityType;
510 __u8 bmAttributes;
511#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
512} __attribute__((packed));
513
504/*-------------------------------------------------------------------------*/ 514/*-------------------------------------------------------------------------*/
505 515
506/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with 516/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index d8128f7102c9..cf468fbdbf8e 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -114,6 +114,8 @@ struct usb_ep_ops {
114 int (*dequeue) (struct usb_ep *ep, struct usb_request *req); 114 int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
115 115
116 int (*set_halt) (struct usb_ep *ep, int value); 116 int (*set_halt) (struct usb_ep *ep, int value);
117 int (*set_wedge) (struct usb_ep *ep);
118
117 int (*fifo_status) (struct usb_ep *ep); 119 int (*fifo_status) (struct usb_ep *ep);
118 void (*fifo_flush) (struct usb_ep *ep); 120 void (*fifo_flush) (struct usb_ep *ep);
119}; 121};
@@ -349,6 +351,25 @@ static inline int usb_ep_clear_halt(struct usb_ep *ep)
349} 351}
350 352
351/** 353/**
354 * usb_ep_set_wedge - sets the halt feature and ignores clear requests
355 * @ep: the endpoint being wedged
356 *
357 * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT)
358 * requests. If the gadget driver clears the halt status, it will
359 * automatically unwedge the endpoint.
360 *
361 * Returns zero on success, else negative errno.
362 */
363static inline int
364usb_ep_set_wedge(struct usb_ep *ep)
365{
366 if (ep->ops->set_wedge)
367 return ep->ops->set_wedge(ep);
368 else
369 return ep->ops->set_halt(ep, 1);
370}
371
372/**
352 * usb_ep_fifo_status - returns number of bytes in fifo, or error 373 * usb_ep_fifo_status - returns number of bytes in fifo, or error
353 * @ep: the endpoint whose fifo status is being checked. 374 * @ep: the endpoint whose fifo status is being checked.
354 * 375 *
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e7d10845b3c1..06005fa9e982 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -76,6 +76,7 @@ struct virtqueue_ops {
76 * @dev: underlying device. 76 * @dev: underlying device.
77 * @id: the device type identification (used to match it with a driver). 77 * @id: the device type identification (used to match it with a driver).
78 * @config: the configuration ops for this device. 78 * @config: the configuration ops for this device.
79 * @features: the features supported by both driver and device.
79 * @priv: private pointer for the driver's use. 80 * @priv: private pointer for the driver's use.
80 */ 81 */
81struct virtio_device 82struct virtio_device
@@ -84,6 +85,8 @@ struct virtio_device
84 struct device dev; 85 struct device dev;
85 struct virtio_device_id id; 86 struct virtio_device_id id;
86 struct virtio_config_ops *config; 87 struct virtio_config_ops *config;
88 /* Note that this is a Linux set_bit-style bitmap. */
89 unsigned long features[1];
87 void *priv; 90 void *priv;
88}; 91};
89 92
@@ -94,6 +97,8 @@ void unregister_virtio_device(struct virtio_device *dev);
94 * virtio_driver - operations for a virtio I/O driver 97 * virtio_driver - operations for a virtio I/O driver
95 * @driver: underlying device driver (populate name and owner). 98 * @driver: underlying device driver (populate name and owner).
96 * @id_table: the ids serviced by this driver. 99 * @id_table: the ids serviced by this driver.
100 * @feature_table: an array of feature numbers supported by this device.
101 * @feature_table_size: number of entries in the feature table array.
97 * @probe: the function to call when a device is found. Returns a token for 102 * @probe: the function to call when a device is found. Returns a token for
98 * remove, or PTR_ERR(). 103 * remove, or PTR_ERR().
99 * @remove: the function when a device is removed. 104 * @remove: the function when a device is removed.
@@ -103,6 +108,8 @@ void unregister_virtio_device(struct virtio_device *dev);
103struct virtio_driver { 108struct virtio_driver {
104 struct device_driver driver; 109 struct device_driver driver;
105 const struct virtio_device_id *id_table; 110 const struct virtio_device_id *id_table;
111 const unsigned int *feature_table;
112 unsigned int feature_table_size;
106 int (*probe)(struct virtio_device *dev); 113 int (*probe)(struct virtio_device *dev);
107 void (*remove)(struct virtio_device *dev); 114 void (*remove)(struct virtio_device *dev);
108 void (*config_changed)(struct virtio_device *dev); 115 void (*config_changed)(struct virtio_device *dev);
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index bca0b10d7947..d4695a3356d0 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -9,6 +9,7 @@
9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ 11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
12#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
12 13
13struct virtio_blk_config 14struct virtio_blk_config
14{ 15{
@@ -18,6 +19,12 @@ struct virtio_blk_config
18 __le32 size_max; 19 __le32 size_max;
19 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ 20 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
20 __le32 seg_max; 21 __le32 seg_max;
22 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
23 struct virtio_blk_geometry {
24 __le16 cylinders;
25 __u8 heads;
26 __u8 sectors;
27 } geometry;
21} __attribute__((packed)); 28} __attribute__((packed));
22 29
23/* These two define direction. */ 30/* These two define direction. */
@@ -41,13 +48,8 @@ struct virtio_blk_outhdr
41 __u64 sector; 48 __u64 sector;
42}; 49};
43 50
51/* And this is the final byte of the write scatter-gather list. */
44#define VIRTIO_BLK_S_OK 0 52#define VIRTIO_BLK_S_OK 0
45#define VIRTIO_BLK_S_IOERR 1 53#define VIRTIO_BLK_S_IOERR 1
46#define VIRTIO_BLK_S_UNSUPP 2 54#define VIRTIO_BLK_S_UNSUPP 2
47
48/* This is the first element of the write scatter-gather list */
49struct virtio_blk_inhdr
50{
51 unsigned char status;
52};
53#endif /* _LINUX_VIRTIO_BLK_H */ 55#endif /* _LINUX_VIRTIO_BLK_H */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index d581b2914b34..50db245c81ad 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -16,27 +16,20 @@
16#define VIRTIO_CONFIG_S_FAILED 0x80 16#define VIRTIO_CONFIG_S_FAILED 0x80
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19struct virtio_device; 19#include <linux/virtio.h>
20 20
21/** 21/**
22 * virtio_config_ops - operations for configuring a virtio device 22 * virtio_config_ops - operations for configuring a virtio device
23 * @feature: search for a feature in this config
24 * vdev: the virtio_device
25 * bit: the feature bit
26 * Returns true if the feature is supported. Acknowledges the feature
27 * so the host can see it.
28 * @get: read the value of a configuration field 23 * @get: read the value of a configuration field
29 * vdev: the virtio_device 24 * vdev: the virtio_device
30 * offset: the offset of the configuration field 25 * offset: the offset of the configuration field
31 * buf: the buffer to write the field value into. 26 * buf: the buffer to write the field value into.
32 * len: the length of the buffer 27 * len: the length of the buffer
33 * Note that contents are conventionally little-endian.
34 * @set: write the value of a configuration field 28 * @set: write the value of a configuration field
35 * vdev: the virtio_device 29 * vdev: the virtio_device
36 * offset: the offset of the configuration field 30 * offset: the offset of the configuration field
37 * buf: the buffer to read the field value from. 31 * buf: the buffer to read the field value from.
38 * len: the length of the buffer 32 * len: the length of the buffer
39 * Note that contents are conventionally little-endian.
40 * @get_status: read the status byte 33 * @get_status: read the status byte
41 * vdev: the virtio_device 34 * vdev: the virtio_device
42 * Returns the status byte 35 * Returns the status byte
@@ -52,10 +45,15 @@ struct virtio_device;
52 * callback: the virqtueue callback 45 * callback: the virqtueue callback
53 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). 46 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT).
54 * @del_vq: free a virtqueue found by find_vq(). 47 * @del_vq: free a virtqueue found by find_vq().
48 * @get_features: get the array of feature bits for this device.
49 * vdev: the virtio_device
50 * Returns the first 32 feature bits (all we currently need).
51 * @set_features: confirm what device features we'll be using.
52 * vdev: the virtio_device
53 * feature: the first 32 feature bits
55 */ 54 */
56struct virtio_config_ops 55struct virtio_config_ops
57{ 56{
58 bool (*feature)(struct virtio_device *vdev, unsigned bit);
59 void (*get)(struct virtio_device *vdev, unsigned offset, 57 void (*get)(struct virtio_device *vdev, unsigned offset,
60 void *buf, unsigned len); 58 void *buf, unsigned len);
61 void (*set)(struct virtio_device *vdev, unsigned offset, 59 void (*set)(struct virtio_device *vdev, unsigned offset,
@@ -67,43 +65,52 @@ struct virtio_config_ops
67 unsigned index, 65 unsigned index,
68 void (*callback)(struct virtqueue *)); 66 void (*callback)(struct virtqueue *));
69 void (*del_vq)(struct virtqueue *vq); 67 void (*del_vq)(struct virtqueue *vq);
68 u32 (*get_features)(struct virtio_device *vdev);
69 void (*set_features)(struct virtio_device *vdev, u32 features);
70}; 70};
71 71
72/* If driver didn't advertise the feature, it will never appear. */
73void virtio_check_driver_offered_feature(const struct virtio_device *vdev,
74 unsigned int fbit);
75
72/** 76/**
73 * virtio_config_val - look for a feature and get a single virtio config. 77 * virtio_has_feature - helper to determine if this device has this feature.
74 * @vdev: the virtio device 78 * @vdev: the device
75 * @fbit: the feature bit 79 * @fbit: the feature bit
76 * @offset: the type to search for. 80 */
77 * @val: a pointer to the value to fill in. 81static inline bool virtio_has_feature(const struct virtio_device *vdev,
78 * 82 unsigned int fbit)
79 * The return value is -ENOENT if the feature doesn't exist. Otherwise 83{
80 * the value is endian-corrected and returned in v. */ 84 /* Did you forget to fix assumptions on max features? */
81#define virtio_config_val(vdev, fbit, offset, v) ({ \ 85 if (__builtin_constant_p(fbit))
82 int _err; \ 86 BUILD_BUG_ON(fbit >= 32);
83 if ((vdev)->config->feature((vdev), (fbit))) { \ 87
84 __virtio_config_val((vdev), (offset), (v)); \ 88 virtio_check_driver_offered_feature(vdev, fbit);
85 _err = 0; \ 89 return test_bit(fbit, vdev->features);
86 } else \ 90}
87 _err = -ENOENT; \
88 _err; \
89})
90 91
91/** 92/**
92 * __virtio_config_val - get a single virtio config without feature check. 93 * virtio_config_val - look for a feature and get a virtio config entry.
93 * @vdev: the virtio device 94 * @vdev: the virtio device
95 * @fbit: the feature bit
94 * @offset: the type to search for. 96 * @offset: the type to search for.
95 * @val: a pointer to the value to fill in. 97 * @val: a pointer to the value to fill in.
96 * 98 *
97 * The value is endian-corrected and returned in v. */ 99 * The return value is -ENOENT if the feature doesn't exist. Otherwise
98#define __virtio_config_val(vdev, offset, v) do { \ 100 * the config value is copied into whatever is pointed to by v. */
99 BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ 101#define virtio_config_val(vdev, fbit, offset, v) \
100 && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ 102 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v))
101 (vdev)->config->get((vdev), (offset), (v), sizeof(*(v))); \ 103
102 switch (sizeof(*(v))) { \ 104static inline int virtio_config_buf(struct virtio_device *vdev,
103 case 2: le16_to_cpus((__u16 *) v); break; \ 105 unsigned int fbit,
104 case 4: le32_to_cpus((__u32 *) v); break; \ 106 unsigned int offset,
105 case 8: le64_to_cpus((__u64 *) v); break; \ 107 void *buf, unsigned len)
106 } \ 108{
107} while(0) 109 if (!virtio_has_feature(vdev, fbit))
110 return -ENOENT;
111
112 vdev->config->get(vdev, offset, buf, len);
113 return 0;
114}
108#endif /* __KERNEL__ */ 115#endif /* __KERNEL__ */
109#endif /* _LINUX_VIRTIO_CONFIG_H */ 116#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 1ea3351df609..9405aa6cdf26 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -6,9 +6,18 @@
6#define VIRTIO_ID_NET 1 6#define VIRTIO_ID_NET 1
7 7
8/* The feature bitmap for virtio net */ 8/* The feature bitmap for virtio net */
9#define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */ 9#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
10#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
10#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ 11#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
11#define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */ 12#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
13#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
14#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
15#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
16#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
17#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
18#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
19#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
20#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
12 21
13struct virtio_net_config 22struct virtio_net_config
14{ 23{