diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/Kbuild | 5 | ||||
-rw-r--r-- | include/linux/anon_inodes.h | 3 | ||||
-rw-r--r-- | include/linux/device.h | 8 | ||||
-rw-r--r-- | include/linux/fdtable.h | 99 | ||||
-rw-r--r-- | include/linux/file.h | 86 | ||||
-rw-r--r-- | include/linux/ieee80211.h | 2 | ||||
-rw-r--r-- | include/linux/if_bridge.h | 4 | ||||
-rw-r--r-- | include/linux/init_task.h | 2 | ||||
-rw-r--r-- | include/linux/irq.h | 1 | ||||
-rw-r--r-- | include/linux/poll.h | 2 | ||||
-rw-r--r-- | include/linux/rio.h | 2 | ||||
-rw-r--r-- | include/linux/usb/c67x00.h | 48 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 12 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 21 | ||||
-rw-r--r-- | include/linux/virtio.h | 7 | ||||
-rw-r--r-- | include/linux/virtio_blk.h | 14 | ||||
-rw-r--r-- | include/linux/virtio_config.h | 81 | ||||
-rw-r--r-- | include/linux/virtio_net.h | 13 | ||||
-rw-r--r-- | include/linux/wireless.h | 7 |
19 files changed, 275 insertions, 142 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 | |||
346 | unifdef-y += virtio_config.h | 346 | unifdef-y += virtio_config.h |
347 | unifdef-y += virtio_blk.h | 347 | unifdef-y += virtio_blk.h |
348 | unifdef-y += virtio_net.h | 348 | unifdef-y += virtio_net.h |
349 | unifdef-y += virtio_9p.h | ||
350 | unifdef-y += virtio_balloon.h | ||
351 | unifdef-y += virtio_console.h | ||
352 | unifdef-y += virtio_pci.h | ||
353 | unifdef-y += virtio_ring.h | ||
349 | unifdef-y += vt.h | 354 | unifdef-y += vt.h |
350 | unifdef-y += wait.h | 355 | unifdef-y += wait.h |
351 | unifdef-y += wanrouter.h | 356 | unifdef-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 | ||
11 | int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile, | 11 | int 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/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 | ||
383 | static 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 |
384 | static inline int dev_to_node(struct device *dev) | 390 | static inline int dev_to_node(struct device *dev) |
385 | { | 391 | { |
@@ -478,7 +484,7 @@ extern void sysdev_shutdown(void); | |||
478 | extern const char *dev_driver_string(struct device *dev); | 484 | extern 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 | */ | ||
25 | struct embedded_fd_set { | ||
26 | unsigned long fds_bits[1]; | ||
27 | }; | ||
28 | |||
29 | struct 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 | */ | ||
41 | struct 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 | |||
60 | extern struct kmem_cache *filp_cachep; | ||
61 | |||
62 | struct file_operations; | ||
63 | struct vfsmount; | ||
64 | struct dentry; | ||
65 | |||
66 | extern int expand_files(struct files_struct *, int nr); | ||
67 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
68 | extern void __init files_defer_init(void); | ||
69 | |||
70 | static inline void free_fdtable(struct fdtable *fdt) | ||
71 | { | ||
72 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
73 | } | ||
74 | |||
75 | static 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 | |||
90 | struct task_struct; | ||
91 | |||
92 | struct files_struct *get_files_struct(struct task_struct *); | ||
93 | void put_files_struct(struct files_struct *fs); | ||
94 | void reset_files_struct(struct files_struct *); | ||
95 | int unshare_files(struct files_struct **); | ||
96 | |||
97 | extern 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 | /* | 12 | struct 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 | */ | ||
25 | struct embedded_fd_set { | ||
26 | unsigned long fds_bits[1]; | ||
27 | }; | ||
28 | |||
29 | struct 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 | */ | ||
41 | struct 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 | |||
60 | extern struct kmem_cache *filp_cachep; | ||
61 | 13 | ||
62 | extern void __fput(struct file *); | 14 | extern void __fput(struct file *); |
63 | extern void fput(struct file *); | 15 | extern void fput(struct file *); |
@@ -85,41 +37,7 @@ extern void put_filp(struct file *); | |||
85 | extern int get_unused_fd(void); | 37 | extern int get_unused_fd(void); |
86 | extern int get_unused_fd_flags(int flags); | 38 | extern int get_unused_fd_flags(int flags); |
87 | extern void put_unused_fd(unsigned int fd); | 39 | extern void put_unused_fd(unsigned int fd); |
88 | struct kmem_cache; | ||
89 | |||
90 | extern int expand_files(struct files_struct *, int nr); | ||
91 | extern void free_fdtable_rcu(struct rcu_head *rcu); | ||
92 | extern void __init files_defer_init(void); | ||
93 | |||
94 | static inline void free_fdtable(struct fdtable *fdt) | ||
95 | { | ||
96 | call_rcu(&fdt->rcu, free_fdtable_rcu); | ||
97 | } | ||
98 | |||
99 | static 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 | ||
114 | extern void fd_install(unsigned int fd, struct file *file); | 41 | extern void fd_install(unsigned int fd, struct file *file); |
115 | 42 | ||
116 | struct task_struct; | ||
117 | |||
118 | struct files_struct *get_files_struct(struct task_struct *); | ||
119 | void put_files_struct(struct files_struct *fs); | ||
120 | void reset_files_struct(struct files_struct *); | ||
121 | int unshare_files(struct files_struct **); | ||
122 | |||
123 | extern struct kmem_cache *files_cachep; | ||
124 | |||
125 | #endif /* __LINUX_FILE_H */ | 43 | #endif /* __LINUX_FILE_H */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 529f301d9372..0b5e03eae6d2 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -113,7 +113,7 @@ struct ieee80211_hdr { | |||
113 | struct ieee80211s_hdr { | 113 | struct ieee80211s_hdr { |
114 | u8 flags; | 114 | u8 flags; |
115 | u8 ttl; | 115 | u8 ttl; |
116 | u8 seqnum[3]; | 116 | __le32 seqnum; |
117 | u8 eaddr1[6]; | 117 | u8 eaddr1[6]; |
118 | u8 eaddr2[6]; | 118 | u8 eaddr2[6]; |
119 | u8 eaddr3[6]; | 119 | u8 eaddr3[6]; |
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 58e43e566457..950e13d09e06 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
@@ -97,7 +97,9 @@ struct __fdb_entry | |||
97 | __u8 port_no; | 97 | __u8 port_no; |
98 | __u8 is_local; | 98 | __u8 is_local; |
99 | __u32 ageing_timer_value; | 99 | __u32 ageing_timer_value; |
100 | __u32 unused; | 100 | __u8 port_hi; |
101 | __u8 pad0; | ||
102 | __u16 unused; | ||
101 | }; | 103 | }; |
102 | 104 | ||
103 | #ifdef __KERNEL__ | 105 | #ifdef __KERNEL__ |
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/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) | |||
117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); | 117 | extern int do_select(int n, fd_set_bits *fds, s64 *timeout); |
118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, | 118 | extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, |
119 | s64 *timeout); | 119 | s64 *timeout); |
120 | extern 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/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/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 | |||
43 | struct 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 */ |
459 | struct usb_bos_descriptor { | 459 | struct 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 | |||
506 | struct 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 | */ | ||
363 | static inline int | ||
364 | usb_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 | */ |
81 | struct virtio_device | 82 | struct 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); | |||
103 | struct virtio_driver { | 108 | struct 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 | ||
13 | struct virtio_blk_config | 14 | struct 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 */ | ||
49 | struct 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__ |
19 | struct 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 | */ |
56 | struct virtio_config_ops | 55 | struct 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. */ | ||
73 | void 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. | 81 | static 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))) { \ | 104 | static 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 | ||
13 | struct virtio_net_config | 22 | struct virtio_net_config |
14 | { | 23 | { |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 2864b1699ecc..0a9b5b41ed67 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -69,14 +69,9 @@ | |||
69 | 69 | ||
70 | /***************************** INCLUDES *****************************/ | 70 | /***************************** INCLUDES *****************************/ |
71 | 71 | ||
72 | /* This header is used in user-space, therefore need to be sanitised | 72 | #include <linux/types.h> /* for __u* and __s* typedefs */ |
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__ | ||
76 | #include <linux/types.h> /* for "caddr_t" et al */ | ||
77 | #include <linux/socket.h> /* for "struct sockaddr" et al */ | 73 | #include <linux/socket.h> /* for "struct sockaddr" et al */ |
78 | #include <linux/if.h> /* for IFNAMSIZ and co... */ | 74 | #include <linux/if.h> /* for IFNAMSIZ and co... */ |
79 | #endif /* __KERNEL__ */ | ||
80 | 75 | ||
81 | /***************************** VERSION *****************************/ | 76 | /***************************** VERSION *****************************/ |
82 | /* | 77 | /* |