aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/console.h3
-rw-r--r--include/linux/context_tracking.h35
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/f2fs_fs.h4
-rw-r--r--include/linux/firmware.h11
-rw-r--r--include/linux/fmc-sdb.h36
-rw-r--r--include/linux/fmc.h237
-rw-r--r--include/linux/fs.h51
-rw-r--r--include/linux/fscache-cache.h175
-rw-r--r--include/linux/hyperv.h70
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_vlan.h2
-rw-r--r--include/linux/iio/common/st_sensors.h24
-rw-r--r--include/linux/iio/frequency/adf4350.h4
-rw-r--r--include/linux/ipmi-fru.h135
-rw-r--r--include/linux/irqchip.h4
-rw-r--r--include/linux/jbd.h28
-rw-r--r--include/linux/jbd2.h175
-rw-r--r--include/linux/jbd_common.h26
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/kvm_host.h37
-rw-r--r--include/linux/loop.h85
-rw-r--r--include/linux/mfd/palmas.h26
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/perf_event.h3
-rw-r--r--include/linux/platform_data/ad7303.h21
-rw-r--r--include/linux/platform_data/omap_ocp2scp.h31
-rw-r--r--include/linux/platform_data/usb3503.h5
-rw-r--r--include/linux/platform_device.h8
-rw-r--r--include/linux/preempt.h18
-rw-r--r--include/linux/sdb.h159
-rw-r--r--include/linux/serial_core.h7
-rw-r--r--include/linux/skbuff.h1
-rw-r--r--include/linux/splice.h1
-rw-r--r--include/linux/tty.h3
-rw-r--r--include/linux/tty_ldisc.h52
-rw-r--r--include/linux/usb.h21
-rw-r--r--include/linux/usb/chipidea.h31
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/of.h32
-rw-r--r--include/linux/usb/otg.h7
-rw-r--r--include/linux/usb/phy.h9
-rw-r--r--include/linux/usb/serial.h15
-rw-r--r--include/linux/usb/tegra_usb_phy.h9
-rw-r--r--include/linux/usb/wusb-wa.h17
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/vtime.h4
-rw-r--r--include/linux/wait.h24
-rw-r--r--include/linux/writeback.h1
52 files changed, 1247 insertions, 418 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 9e52b0626b39..f5a3b838ddb0 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -198,7 +198,8 @@ extern int buffer_heads_over_limit;
198 * Generic address_space_operations implementations for buffer_head-backed 198 * Generic address_space_operations implementations for buffer_head-backed
199 * address_spaces. 199 * address_spaces.
200 */ 200 */
201void block_invalidatepage(struct page *page, unsigned long offset); 201void block_invalidatepage(struct page *page, unsigned int offset,
202 unsigned int length);
202int block_write_full_page(struct page *page, get_block_t *get_block, 203int block_write_full_page(struct page *page, get_block_t *get_block,
203 struct writeback_control *wbc); 204 struct writeback_control *wbc);
204int block_write_full_page_endio(struct page *page, get_block_t *get_block, 205int block_write_full_page_endio(struct page *page, get_block_t *get_block,
diff --git a/include/linux/console.h b/include/linux/console.h
index 73bab0f58af5..7571a16bd653 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -75,10 +75,7 @@ extern const struct consw newport_con; /* SGI Newport console */
75extern const struct consw prom_con; /* SPARC PROM console */ 75extern const struct consw prom_con; /* SPARC PROM console */
76 76
77int con_is_bound(const struct consw *csw); 77int con_is_bound(const struct consw *csw);
78int register_con_driver(const struct consw *csw, int first, int last);
79int unregister_con_driver(const struct consw *csw);
80int do_unregister_con_driver(const struct consw *csw); 78int do_unregister_con_driver(const struct consw *csw);
81int take_over_console(const struct consw *sw, int first, int last, int deflt);
82int do_take_over_console(const struct consw *sw, int first, int last, int deflt); 79int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
83void give_up_console(const struct consw *sw); 80void give_up_console(const struct consw *sw);
84#ifdef CONFIG_HW_CONSOLE 81#ifdef CONFIG_HW_CONSOLE
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 365f4a61bf04..fc09d7b0dacf 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <linux/vtime.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
7 8
8struct context_tracking { 9struct context_tracking {
@@ -19,6 +20,26 @@ struct context_tracking {
19 } state; 20 } state;
20}; 21};
21 22
23static inline void __guest_enter(void)
24{
25 /*
26 * This is running in ioctl context so we can avoid
27 * the call to vtime_account() with its unnecessary idle check.
28 */
29 vtime_account_system(current);
30 current->flags |= PF_VCPU;
31}
32
33static inline void __guest_exit(void)
34{
35 /*
36 * This is running in ioctl context so we can avoid
37 * the call to vtime_account() with its unnecessary idle check.
38 */
39 vtime_account_system(current);
40 current->flags &= ~PF_VCPU;
41}
42
22#ifdef CONFIG_CONTEXT_TRACKING 43#ifdef CONFIG_CONTEXT_TRACKING
23DECLARE_PER_CPU(struct context_tracking, context_tracking); 44DECLARE_PER_CPU(struct context_tracking, context_tracking);
24 45
@@ -35,6 +56,9 @@ static inline bool context_tracking_active(void)
35extern void user_enter(void); 56extern void user_enter(void);
36extern void user_exit(void); 57extern void user_exit(void);
37 58
59extern void guest_enter(void);
60extern void guest_exit(void);
61
38static inline enum ctx_state exception_enter(void) 62static inline enum ctx_state exception_enter(void)
39{ 63{
40 enum ctx_state prev_ctx; 64 enum ctx_state prev_ctx;
@@ -57,6 +81,17 @@ extern void context_tracking_task_switch(struct task_struct *prev,
57static inline bool context_tracking_in_user(void) { return false; } 81static inline bool context_tracking_in_user(void) { return false; }
58static inline void user_enter(void) { } 82static inline void user_enter(void) { }
59static inline void user_exit(void) { } 83static inline void user_exit(void) { }
84
85static inline void guest_enter(void)
86{
87 __guest_enter();
88}
89
90static inline void guest_exit(void)
91{
92 __guest_exit();
93}
94
60static inline enum ctx_state exception_enter(void) { return 0; } 95static inline enum ctx_state exception_enter(void) { return 0; }
61static inline void exception_exit(enum ctx_state prev_ctx) { } 96static inline void exception_exit(enum ctx_state prev_ctx) { }
62static inline void context_tracking_task_switch(struct task_struct *prev, 97static inline void context_tracking_task_switch(struct task_struct *prev,
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 63f2465807d4..d68b4ea7343c 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -79,6 +79,8 @@ struct dentry *debugfs_create_x64(const char *name, umode_t mode,
79 struct dentry *parent, u64 *value); 79 struct dentry *parent, u64 *value);
80struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 80struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
81 struct dentry *parent, size_t *value); 81 struct dentry *parent, size_t *value);
82struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
83 struct dentry *parent, atomic_t *value);
82struct dentry *debugfs_create_bool(const char *name, umode_t mode, 84struct dentry *debugfs_create_bool(const char *name, umode_t mode,
83 struct dentry *parent, u32 *value); 85 struct dentry *parent, u32 *value);
84 86
diff --git a/include/linux/device.h b/include/linux/device.h
index c0a126125325..9d4835a8f8b8 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -80,6 +80,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
80 * bus-specific setup 80 * bus-specific setup
81 * @p: The private data of the driver core, only the driver core can 81 * @p: The private data of the driver core, only the driver core can
82 * touch this. 82 * touch this.
83 * @lock_key: Lock class key for use by the lock validator
83 * 84 *
84 * A bus is a channel between the processor and one or more devices. For the 85 * A bus is a channel between the processor and one or more devices. For the
85 * purposes of the device model, all devices are connected via a bus, even if 86 * purposes of the device model, all devices are connected via a bus, even if
@@ -635,6 +636,7 @@ struct acpi_dev_node {
635 * segment limitations. 636 * segment limitations.
636 * @dma_pools: Dma pools (if dma'ble device). 637 * @dma_pools: Dma pools (if dma'ble device).
637 * @dma_mem: Internal for coherent mem override. 638 * @dma_mem: Internal for coherent mem override.
639 * @cma_area: Contiguous memory area for dma allocations
638 * @archdata: For arch-specific additions. 640 * @archdata: For arch-specific additions.
639 * @of_node: Associated device tree node. 641 * @of_node: Associated device tree node.
640 * @acpi_node: Associated ACPI device node. 642 * @acpi_node: Associated ACPI device node.
@@ -648,6 +650,7 @@ struct acpi_dev_node {
648 * @release: Callback to free the device after all references have 650 * @release: Callback to free the device after all references have
649 * gone away. This should be set by the allocator of the 651 * gone away. This should be set by the allocator of the
650 * device (i.e. the bus driver that discovered the device). 652 * device (i.e. the bus driver that discovered the device).
653 * @iommu_group: IOMMU group the device belongs to.
651 * 654 *
652 * At the lowest level, every device in a Linux system is represented by an 655 * At the lowest level, every device in a Linux system is represented by an
653 * instance of struct device. The device structure contains the information 656 * instance of struct device. The device structure contains the information
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index df6fab82f87e..383d5e39b280 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -20,8 +20,8 @@
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22 22
23#define NULL_ADDR 0x0U 23#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
24#define NEW_ADDR -1U 24#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
25 25
26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num) 26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num) 27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e4279fedb93a..e154c1005cd1 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -47,8 +47,6 @@ int request_firmware_nowait(
47 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
48 48
49void release_firmware(const struct firmware *fw); 49void release_firmware(const struct firmware *fw);
50int cache_firmware(const char *name);
51int uncache_firmware(const char *name);
52#else 50#else
53static inline int request_firmware(const struct firmware **fw, 51static inline int request_firmware(const struct firmware **fw,
54 const char *name, 52 const char *name,
@@ -68,15 +66,6 @@ static inline void release_firmware(const struct firmware *fw)
68{ 66{
69} 67}
70 68
71static inline int cache_firmware(const char *name)
72{
73 return -ENOENT;
74}
75
76static inline int uncache_firmware(const char *name)
77{
78 return -EINVAL;
79}
80#endif 69#endif
81 70
82#endif 71#endif
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h
new file mode 100644
index 000000000000..1974317a9b3d
--- /dev/null
+++ b/include/linux/fmc-sdb.h
@@ -0,0 +1,36 @@
1/*
2 * This file is separate from sdb.h, because I want that one to remain
3 * unchanged (as far as possible) from the official sdb distribution
4 *
5 * This file and associated functionality are a playground for me to
6 * understand stuff which will later be implemented in more generic places.
7 */
8#include <linux/sdb.h>
9
10/* This is the union of all currently defined types */
11union sdb_record {
12 struct sdb_interconnect ic;
13 struct sdb_device dev;
14 struct sdb_bridge bridge;
15 struct sdb_integration integr;
16 struct sdb_empty empty;
17};
18
19struct fmc_device;
20
21/* Every sdb table is turned into this structure */
22struct sdb_array {
23 int len;
24 int level;
25 unsigned long baseaddr;
26 struct fmc_device *fmc; /* the device that hosts it */
27 struct sdb_array *parent; /* NULL at root */
28 union sdb_record *record; /* copies of the struct */
29 struct sdb_array **subtree; /* only valid for bridge items */
30};
31
32extern int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
33extern void fmc_show_sdb_tree(const struct fmc_device *fmc);
34extern signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
35 uint32_t device, unsigned long *sz);
36extern int fmc_free_sdb_tree(struct fmc_device *fmc);
diff --git a/include/linux/fmc.h b/include/linux/fmc.h
new file mode 100644
index 000000000000..a5f0aa5c2a8d
--- /dev/null
+++ b/include/linux/fmc.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_FMC_H__
11#define __LINUX_FMC_H__
12#include <linux/types.h>
13#include <linux/moduleparam.h>
14#include <linux/device.h>
15#include <linux/list.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18
19struct fmc_device;
20struct fmc_driver;
21
22/*
23 * This bus abstraction is developed separately from drivers, so we need
24 * to check the version of the data structures we receive.
25 */
26
27#define FMC_MAJOR 3
28#define FMC_MINOR 0
29#define FMC_VERSION ((FMC_MAJOR << 16) | FMC_MINOR)
30#define __FMC_MAJOR(x) ((x) >> 16)
31#define __FMC_MINOR(x) ((x) & 0xffff)
32
33/*
34 * The device identification, as defined by the IPMI FRU (Field Replaceable
35 * Unit) includes four different strings to describe the device. Here we
36 * only match the "Board Manufacturer" and the "Board Product Name",
37 * ignoring the "Board Serial Number" and "Board Part Number". All 4 are
38 * expected to be strings, so they are treated as zero-terminated C strings.
39 * Unspecified string (NULL) means "any", so if both are unspecified this
40 * is a catch-all driver. So null entries are allowed and we use array
41 * and length. This is unlike pci and usb that use null-terminated arrays
42 */
43struct fmc_fru_id {
44 char *manufacturer;
45 char *product_name;
46};
47
48/*
49 * If the FPGA is already programmed (think Etherbone or the second
50 * SVEC slot), we can match on SDB devices in the memory image. This
51 * match uses an array of devices that must all be present, and the
52 * match is based on vendor and device only. Further checks are expected
53 * to happen in the probe function. Zero means "any" and catch-all is allowed.
54 */
55struct fmc_sdb_one_id {
56 uint64_t vendor;
57 uint32_t device;
58};
59struct fmc_sdb_id {
60 struct fmc_sdb_one_id *cores;
61 int cores_nr;
62};
63
64struct fmc_device_id {
65 struct fmc_fru_id *fru_id;
66 int fru_id_nr;
67 struct fmc_sdb_id *sdb_id;
68 int sdb_id_nr;
69};
70
71/* This sizes the module_param_array used by generic module parameters */
72#define FMC_MAX_CARDS 32
73
74/* The driver is a pretty simple thing */
75struct fmc_driver {
76 unsigned long version;
77 struct device_driver driver;
78 int (*probe)(struct fmc_device *);
79 int (*remove)(struct fmc_device *);
80 const struct fmc_device_id id_table;
81 /* What follows is for generic module parameters */
82 int busid_n;
83 int busid_val[FMC_MAX_CARDS];
84 int gw_n;
85 char *gw_val[FMC_MAX_CARDS];
86};
87#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
88
89/* These are the generic parameters, that drivers may instantiate */
90#define FMC_PARAM_BUSID(_d) \
91 module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
92#define FMC_PARAM_GATEWARE(_d) \
93 module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
94
95/*
96 * Drivers may need to configure gpio pins in the carrier. To read input
97 * (a very uncommon operation, and definitely not in the hot paths), just
98 * configure one gpio only and get 0 or 1 as retval of the config method
99 */
100struct fmc_gpio {
101 char *carrier_name; /* name or NULL for virtual pins */
102 int gpio;
103 int _gpio; /* internal use by the carrier */
104 int mode; /* GPIOF_DIR_OUT etc, from <linux/gpio.h> */
105 int irqmode; /* IRQF_TRIGGER_LOW and so on */
106};
107
108/* The numbering of gpio pins allows access to raw pins or virtual roles */
109#define FMC_GPIO_RAW(x) (x) /* 4096 of them */
110#define __FMC_GPIO_IS_RAW(x) ((x) < 0x1000)
111#define FMC_GPIO_IRQ(x) ((x) + 0x1000) /* 256 of them */
112#define FMC_GPIO_LED(x) ((x) + 0x1100) /* 256 of them */
113#define FMC_GPIO_KEY(x) ((x) + 0x1200) /* 256 of them */
114#define FMC_GPIO_TP(x) ((x) + 0x1300) /* 256 of them */
115#define FMC_GPIO_USER(x) ((x) + 0x1400) /* 256 of them */
116/* We may add SCL and SDA, or other roles if the need arises */
117
118/* GPIOF_DIR_IN etc are missing before 3.0. copy from <linux/gpio.h> */
119#ifndef GPIOF_DIR_IN
120# define GPIOF_DIR_OUT (0 << 0)
121# define GPIOF_DIR_IN (1 << 0)
122# define GPIOF_INIT_LOW (0 << 1)
123# define GPIOF_INIT_HIGH (1 << 1)
124#endif
125
126/*
127 * The operations are offered by each carrier and should make driver
128 * design completely independent of the carrier. Named GPIO pins may be
129 * the exception.
130 */
131struct fmc_operations {
132 uint32_t (*read32)(struct fmc_device *fmc, int offset);
133 void (*write32)(struct fmc_device *fmc, uint32_t value, int offset);
134 int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv);
135 int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw);
136 int (*irq_request)(struct fmc_device *fmc, irq_handler_t h,
137 char *name, int flags);
138 void (*irq_ack)(struct fmc_device *fmc);
139 int (*irq_free)(struct fmc_device *fmc);
140 int (*gpio_config)(struct fmc_device *fmc, struct fmc_gpio *gpio,
141 int ngpio);
142 int (*read_ee)(struct fmc_device *fmc, int pos, void *d, int l);
143 int (*write_ee)(struct fmc_device *fmc, int pos, const void *d, int l);
144};
145
146/* Prefer this helper rather than calling of fmc->reprogram directly */
147extern int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
148 int sdb_entry);
149
150/*
151 * The device reports all information needed to access hw.
152 *
153 * If we have eeprom_len and not contents, the core reads it.
154 * Then, parsing of identifiers is done by the core which fills fmc_fru_id..
155 * Similarly a device that must be matched based on SDB cores must
156 * fill the entry point and the core will scan the bus (FIXME: sdb match)
157 */
158struct fmc_device {
159 unsigned long version;
160 unsigned long flags;
161 struct module *owner; /* char device must pin it */
162 struct fmc_fru_id id; /* for EEPROM-based match */
163 struct fmc_operations *op; /* carrier-provided */
164 int irq; /* according to host bus. 0 == none */
165 int eeprom_len; /* Usually 8kB, may be less */
166 int eeprom_addr; /* 0x50, 0x52 etc */
167 uint8_t *eeprom; /* Full contents or leading part */
168 char *carrier_name; /* "SPEC" or similar, for special use */
169 void *carrier_data; /* "struct spec *" or equivalent */
170 __iomem void *fpga_base; /* May be NULL (Etherbone) */
171 __iomem void *slot_base; /* Set by the driver */
172 struct fmc_device **devarray; /* Allocated by the bus */
173 int slot_id; /* Index in the slot array */
174 int nr_slots; /* Number of slots in this carrier */
175 unsigned long memlen; /* Used for the char device */
176 struct device dev; /* For Linux use */
177 struct device *hwdev; /* The underlying hardware device */
178 unsigned long sdbfs_entry;
179 struct sdb_array *sdb;
180 uint32_t device_id; /* Filled by the device */
181 char *mezzanine_name; /* Defaults to ``fmc'' */
182 void *mezzanine_data;
183};
184#define to_fmc_device(x) container_of((x), struct fmc_device, dev)
185
186#define FMC_DEVICE_HAS_GOLDEN 1
187#define FMC_DEVICE_HAS_CUSTOM 2
188#define FMC_DEVICE_NO_MEZZANINE 4
189#define FMC_DEVICE_MATCH_SDB 8 /* fmc-core must scan sdb in fpga */
190
191/*
192 * If fpga_base can be used, the carrier offers no readl/writel methods, and
193 * this expands to a single, fast, I/O access.
194 */
195static inline uint32_t fmc_readl(struct fmc_device *fmc, int offset)
196{
197 if (unlikely(fmc->op->read32))
198 return fmc->op->read32(fmc, offset);
199 return readl(fmc->fpga_base + offset);
200}
201static inline void fmc_writel(struct fmc_device *fmc, uint32_t val, int off)
202{
203 if (unlikely(fmc->op->write32))
204 fmc->op->write32(fmc, val, off);
205 else
206 writel(val, fmc->fpga_base + off);
207}
208
209/* pci-like naming */
210static inline void *fmc_get_drvdata(const struct fmc_device *fmc)
211{
212 return dev_get_drvdata(&fmc->dev);
213}
214
215static inline void fmc_set_drvdata(struct fmc_device *fmc, void *data)
216{
217 dev_set_drvdata(&fmc->dev, data);
218}
219
220/* The 4 access points */
221extern int fmc_driver_register(struct fmc_driver *drv);
222extern void fmc_driver_unregister(struct fmc_driver *drv);
223extern int fmc_device_register(struct fmc_device *tdev);
224extern void fmc_device_unregister(struct fmc_device *tdev);
225
226/* Two more for device sets, all driven by the same FPGA */
227extern int fmc_device_register_n(struct fmc_device **devs, int n);
228extern void fmc_device_unregister_n(struct fmc_device **devs, int n);
229
230/* Internal cross-calls between files; not exported to other modules */
231extern int fmc_match(struct device *dev, struct device_driver *drv);
232extern int fmc_fill_id_info(struct fmc_device *fmc);
233extern void fmc_free_id_info(struct fmc_device *fmc);
234extern void fmc_dump_eeprom(const struct fmc_device *fmc);
235extern void fmc_dump_sdb(const struct fmc_device *fmc);
236
237#endif /* __LINUX_FMC_H__ */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 43db02e9c9fa..f8a5240541b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -364,7 +364,7 @@ struct address_space_operations {
364 364
365 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 365 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
366 sector_t (*bmap)(struct address_space *, sector_t); 366 sector_t (*bmap)(struct address_space *, sector_t);
367 void (*invalidatepage) (struct page *, unsigned long); 367 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
368 int (*releasepage) (struct page *, gfp_t); 368 int (*releasepage) (struct page *, gfp_t);
369 void (*freepage)(struct page *); 369 void (*freepage)(struct page *);
370 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 370 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
@@ -1506,6 +1506,11 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1506 * to have different dirent layouts depending on the binary type. 1506 * to have different dirent layouts depending on the binary type.
1507 */ 1507 */
1508typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1508typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1509struct dir_context {
1510 const filldir_t actor;
1511 loff_t pos;
1512};
1513
1509struct block_device_operations; 1514struct block_device_operations;
1510 1515
1511/* These macros are for out of kernel modules to test that 1516/* These macros are for out of kernel modules to test that
@@ -1521,7 +1526,7 @@ struct file_operations {
1521 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1526 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1522 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1527 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1523 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1528 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1524 int (*readdir) (struct file *, void *, filldir_t); 1529 int (*iterate) (struct file *, struct dir_context *);
1525 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1530 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1526 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1531 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1527 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1532 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
@@ -2414,8 +2419,6 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
2414 struct file *, loff_t *, size_t, unsigned int); 2419 struct file *, loff_t *, size_t, unsigned int);
2415extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2420extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2416 struct file *out, loff_t *, size_t len, unsigned int flags); 2421 struct file *out, loff_t *, size_t len, unsigned int flags);
2417extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2418 size_t len, unsigned int flags);
2419 2422
2420extern void 2423extern void
2421file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2424file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
@@ -2496,6 +2499,7 @@ loff_t inode_get_bytes(struct inode *inode);
2496void inode_set_bytes(struct inode *inode, loff_t bytes); 2499void inode_set_bytes(struct inode *inode, loff_t bytes);
2497 2500
2498extern int vfs_readdir(struct file *, filldir_t, void *); 2501extern int vfs_readdir(struct file *, filldir_t, void *);
2502extern int iterate_dir(struct file *, struct dir_context *);
2499 2503
2500extern int vfs_stat(const char __user *, struct kstat *); 2504extern int vfs_stat(const char __user *, struct kstat *);
2501extern int vfs_lstat(const char __user *, struct kstat *); 2505extern int vfs_lstat(const char __user *, struct kstat *);
@@ -2526,7 +2530,7 @@ extern void iterate_supers_type(struct file_system_type *,
2526extern int dcache_dir_open(struct inode *, struct file *); 2530extern int dcache_dir_open(struct inode *, struct file *);
2527extern int dcache_dir_close(struct inode *, struct file *); 2531extern int dcache_dir_close(struct inode *, struct file *);
2528extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2532extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2529extern int dcache_readdir(struct file *, void *, filldir_t); 2533extern int dcache_readdir(struct file *, struct dir_context *);
2530extern int simple_setattr(struct dentry *, struct iattr *); 2534extern int simple_setattr(struct dentry *, struct iattr *);
2531extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2535extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2532extern int simple_statfs(struct dentry *, struct kstatfs *); 2536extern int simple_statfs(struct dentry *, struct kstatfs *);
@@ -2690,4 +2694,41 @@ static inline void inode_has_no_xattr(struct inode *inode)
2690 inode->i_flags |= S_NOSEC; 2694 inode->i_flags |= S_NOSEC;
2691} 2695}
2692 2696
2697static inline bool dir_emit(struct dir_context *ctx,
2698 const char *name, int namelen,
2699 u64 ino, unsigned type)
2700{
2701 return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0;
2702}
2703static inline bool dir_emit_dot(struct file *file, struct dir_context *ctx)
2704{
2705 return ctx->actor(ctx, ".", 1, ctx->pos,
2706 file->f_path.dentry->d_inode->i_ino, DT_DIR) == 0;
2707}
2708static inline bool dir_emit_dotdot(struct file *file, struct dir_context *ctx)
2709{
2710 return ctx->actor(ctx, "..", 2, ctx->pos,
2711 parent_ino(file->f_path.dentry), DT_DIR) == 0;
2712}
2713static inline bool dir_emit_dots(struct file *file, struct dir_context *ctx)
2714{
2715 if (ctx->pos == 0) {
2716 if (!dir_emit_dot(file, ctx))
2717 return false;
2718 ctx->pos = 1;
2719 }
2720 if (ctx->pos == 1) {
2721 if (!dir_emit_dotdot(file, ctx))
2722 return false;
2723 ctx->pos = 2;
2724 }
2725 return true;
2726}
2727static inline bool dir_relax(struct inode *inode)
2728{
2729 mutex_unlock(&inode->i_mutex);
2730 mutex_lock(&inode->i_mutex);
2731 return !IS_DEADDIR(inode);
2732}
2733
2693#endif /* _LINUX_FS_H */ 2734#endif /* _LINUX_FS_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 5dfa0aa216b6..a9ff9a36b86d 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -97,7 +97,8 @@ struct fscache_operation {
97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */ 99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */
100#define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */ 100#define FSCACHE_OP_UNUSE_COOKIE 7 /* call fscache_unuse_cookie() on completion */
101#define FSCACHE_OP_KEEP_FLAGS 0x00f0 /* flags to keep when repurposing an op */
101 102
102 enum fscache_operation_state state; 103 enum fscache_operation_state state;
103 atomic_t usage; 104 atomic_t usage;
@@ -150,7 +151,7 @@ struct fscache_retrieval {
150 void *context; /* netfs read context (pinned) */ 151 void *context; /* netfs read context (pinned) */
151 struct list_head to_do; /* list of things to be done by the backend */ 152 struct list_head to_do; /* list of things to be done by the backend */
152 unsigned long start_time; /* time at which retrieval started */ 153 unsigned long start_time; /* time at which retrieval started */
153 unsigned n_pages; /* number of pages to be retrieved */ 154 atomic_t n_pages; /* number of pages to be retrieved */
154}; 155};
155 156
156typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, 157typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
@@ -194,15 +195,14 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
194static inline void fscache_retrieval_complete(struct fscache_retrieval *op, 195static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
195 int n_pages) 196 int n_pages)
196{ 197{
197 op->n_pages -= n_pages; 198 atomic_sub(n_pages, &op->n_pages);
198 if (op->n_pages <= 0) 199 if (atomic_read(&op->n_pages) <= 0)
199 fscache_op_complete(&op->op, true); 200 fscache_op_complete(&op->op, true);
200} 201}
201 202
202/** 203/**
203 * fscache_put_retrieval - Drop a reference to a retrieval operation 204 * fscache_put_retrieval - Drop a reference to a retrieval operation
204 * @op: The retrieval operation affected 205 * @op: The retrieval operation affected
205 * @n_pages: The number of pages to account for
206 * 206 *
207 * Drop a reference to a retrieval operation. 207 * Drop a reference to a retrieval operation.
208 */ 208 */
@@ -314,6 +314,7 @@ struct fscache_cache_ops {
314struct fscache_cookie { 314struct fscache_cookie {
315 atomic_t usage; /* number of users of this cookie */ 315 atomic_t usage; /* number of users of this cookie */
316 atomic_t n_children; /* number of children of this cookie */ 316 atomic_t n_children; /* number of children of this cookie */
317 atomic_t n_active; /* number of active users of netfs ptrs */
317 spinlock_t lock; 318 spinlock_t lock;
318 spinlock_t stores_lock; /* lock on page store tree */ 319 spinlock_t stores_lock; /* lock on page store tree */
319 struct hlist_head backing_objects; /* object(s) backing this file/index */ 320 struct hlist_head backing_objects; /* object(s) backing this file/index */
@@ -326,13 +327,11 @@ struct fscache_cookie {
326 327
327 unsigned long flags; 328 unsigned long flags;
328#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */ 329#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
329#define FSCACHE_COOKIE_CREATING 1 /* T if non-index object being created still */ 330#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
330#define FSCACHE_COOKIE_NO_DATA_YET 2 /* T if new object with no cached data yet */ 331#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
331#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ 332#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
332#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ 333#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
333#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ 334#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
334#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
335#define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */
336}; 335};
337 336
338extern struct fscache_cookie fscache_fsdef_index; 337extern struct fscache_cookie fscache_fsdef_index;
@@ -341,45 +340,40 @@ extern struct fscache_cookie fscache_fsdef_index;
341 * Event list for fscache_object::{event_mask,events} 340 * Event list for fscache_object::{event_mask,events}
342 */ 341 */
343enum { 342enum {
344 FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */ 343 FSCACHE_OBJECT_EV_NEW_CHILD, /* T if object has a new child */
344 FSCACHE_OBJECT_EV_PARENT_READY, /* T if object's parent is ready */
345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */ 345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */ 346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */ 347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */ 348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349 FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */ 349 FSCACHE_OBJECT_EV_KILL, /* T if netfs relinquished or cache withdrew object */
350 FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351 FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352 NR_FSCACHE_OBJECT_EVENTS 350 NR_FSCACHE_OBJECT_EVENTS
353}; 351};
354 352
355#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1) 353#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356 354
357/* 355/*
356 * States for object state machine.
357 */
358struct fscache_transition {
359 unsigned long events;
360 const struct fscache_state *transit_to;
361};
362
363struct fscache_state {
364 char name[24];
365 char short_name[8];
366 const struct fscache_state *(*work)(struct fscache_object *object,
367 int event);
368 const struct fscache_transition transitions[];
369};
370
371/*
358 * on-disk cache file or index handle 372 * on-disk cache file or index handle
359 */ 373 */
360struct fscache_object { 374struct fscache_object {
361 enum fscache_object_state { 375 const struct fscache_state *state; /* Object state machine state */
362 FSCACHE_OBJECT_INIT, /* object in initial unbound state */ 376 const struct fscache_transition *oob_table; /* OOB state transition table */
363 FSCACHE_OBJECT_LOOKING_UP, /* looking up object */
364 FSCACHE_OBJECT_CREATING, /* creating object */
365
366 /* active states */
367 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
368 FSCACHE_OBJECT_ACTIVE, /* object is usable */
369 FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */
370 FSCACHE_OBJECT_UPDATING, /* object is updating */
371
372 /* terminal states */
373 FSCACHE_OBJECT_DYING, /* object waiting for accessors to finish */
374 FSCACHE_OBJECT_LC_DYING, /* object cleaning up after lookup/create */
375 FSCACHE_OBJECT_ABORT_INIT, /* abort the init state */
376 FSCACHE_OBJECT_RELEASING, /* releasing object */
377 FSCACHE_OBJECT_RECYCLING, /* retiring object */
378 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
379 FSCACHE_OBJECT_DEAD, /* object is now dead */
380 FSCACHE_OBJECT__NSTATES
381 } state;
382
383 int debug_id; /* debugging ID */ 377 int debug_id; /* debugging ID */
384 int n_children; /* number of child objects */ 378 int n_children; /* number of child objects */
385 int n_ops; /* number of extant ops on object */ 379 int n_ops; /* number of extant ops on object */
@@ -390,6 +384,7 @@ struct fscache_object {
390 spinlock_t lock; /* state and operations lock */ 384 spinlock_t lock; /* state and operations lock */
391 385
392 unsigned long lookup_jif; /* time at which lookup started */ 386 unsigned long lookup_jif; /* time at which lookup started */
387 unsigned long oob_event_mask; /* OOB events this object is interested in */
393 unsigned long event_mask; /* events this object is interested in */ 388 unsigned long event_mask; /* events this object is interested in */
394 unsigned long events; /* events to be processed by this object 389 unsigned long events; /* events to be processed by this object
395 * (order is important - using fls) */ 390 * (order is important - using fls) */
@@ -398,6 +393,9 @@ struct fscache_object {
398#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 393#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
399#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */ 394#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */
400#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */ 395#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */
396#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
397#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
398#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
401 399
402 struct list_head cache_link; /* link in cache->object_list */ 400 struct list_head cache_link; /* link in cache->object_list */
403 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 401 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -415,62 +413,40 @@ struct fscache_object {
415 loff_t store_limit_l; /* current storage limit */ 413 loff_t store_limit_l; /* current storage limit */
416}; 414};
417 415
418extern const char *fscache_object_states[]; 416extern void fscache_object_init(struct fscache_object *, struct fscache_cookie *,
417 struct fscache_cache *);
418extern void fscache_object_destroy(struct fscache_object *);
419 419
420#define fscache_object_is_active(obj) \ 420extern void fscache_object_lookup_negative(struct fscache_object *object);
421 (!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 421extern void fscache_obtained_object(struct fscache_object *object);
422 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
423 (obj)->state < FSCACHE_OBJECT_DYING)
424 422
425#define fscache_object_is_dead(obj) \ 423static inline bool fscache_object_is_live(struct fscache_object *object)
426 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 424{
427 (obj)->state >= FSCACHE_OBJECT_DYING) 425 return test_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
426}
428 427
429extern void fscache_object_work_func(struct work_struct *work); 428static inline bool fscache_object_is_dying(struct fscache_object *object)
429{
430 return !fscache_object_is_live(object);
431}
430 432
431/** 433static inline bool fscache_object_is_available(struct fscache_object *object)
432 * fscache_object_init - Initialise a cache object description
433 * @object: Object description
434 *
435 * Initialise a cache object description to its basic values.
436 *
437 * See Documentation/filesystems/caching/backend-api.txt for a complete
438 * description.
439 */
440static inline
441void fscache_object_init(struct fscache_object *object,
442 struct fscache_cookie *cookie,
443 struct fscache_cache *cache)
444{ 434{
445 atomic_inc(&cache->object_count); 435 return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags);
446
447 object->state = FSCACHE_OBJECT_INIT;
448 spin_lock_init(&object->lock);
449 INIT_LIST_HEAD(&object->cache_link);
450 INIT_HLIST_NODE(&object->cookie_link);
451 INIT_WORK(&object->work, fscache_object_work_func);
452 INIT_LIST_HEAD(&object->dependents);
453 INIT_LIST_HEAD(&object->dep_link);
454 INIT_LIST_HEAD(&object->pending_ops);
455 object->n_children = 0;
456 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
457 object->events = object->event_mask = 0;
458 object->flags = 0;
459 object->store_limit = 0;
460 object->store_limit_l = 0;
461 object->cache = cache;
462 object->cookie = cookie;
463 object->parent = NULL;
464} 436}
465 437
466extern void fscache_object_lookup_negative(struct fscache_object *object); 438static inline bool fscache_object_is_active(struct fscache_object *object)
467extern void fscache_obtained_object(struct fscache_object *object); 439{
440 return fscache_object_is_available(object) &&
441 fscache_object_is_live(object) &&
442 !test_bit(FSCACHE_IOERROR, &object->cache->flags);
443}
468 444
469#ifdef CONFIG_FSCACHE_OBJECT_LIST 445static inline bool fscache_object_is_dead(struct fscache_object *object)
470extern void fscache_object_destroy(struct fscache_object *object); 446{
471#else 447 return fscache_object_is_dying(object) &&
472#define fscache_object_destroy(object) do {} while(0) 448 test_bit(FSCACHE_IOERROR, &object->cache->flags);
473#endif 449}
474 450
475/** 451/**
476 * fscache_object_destroyed - Note destruction of an object in a cache 452 * fscache_object_destroyed - Note destruction of an object in a cache
@@ -531,6 +507,33 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
531 op->end_io_func(page, op->context, error); 507 op->end_io_func(page, op->context, error);
532} 508}
533 509
510/**
511 * fscache_use_cookie - Request usage of cookie attached to an object
512 * @object: Object description
513 *
514 * Request usage of the cookie attached to an object. NULL is returned if the
515 * relinquishment had reduced the cookie usage count to 0.
516 */
517static inline bool fscache_use_cookie(struct fscache_object *object)
518{
519 struct fscache_cookie *cookie = object->cookie;
520 return atomic_inc_not_zero(&cookie->n_active) != 0;
521}
522
523/**
524 * fscache_unuse_cookie - Cease usage of cookie attached to an object
525 * @object: Object description
526 *
527 * Cease usage of the cookie attached to an object. When the users count
528 * reaches zero then the cookie relinquishment will be permitted to proceed.
529 */
530static inline void fscache_unuse_cookie(struct fscache_object *object)
531{
532 struct fscache_cookie *cookie = object->cookie;
533 if (atomic_dec_and_test(&cookie->n_active))
534 wake_up_atomic_t(&cookie->n_active);
535}
536
534/* 537/*
535 * out-of-line cache backend functions 538 * out-of-line cache backend functions
536 */ 539 */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index c2559847d7ee..fae8bac907ef 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -909,6 +909,7 @@ enum vmbus_channel_state {
909 CHANNEL_OFFER_STATE, 909 CHANNEL_OFFER_STATE,
910 CHANNEL_OPENING_STATE, 910 CHANNEL_OPENING_STATE,
911 CHANNEL_OPEN_STATE, 911 CHANNEL_OPEN_STATE,
912 CHANNEL_OPENED_STATE,
912}; 913};
913 914
914struct vmbus_channel_debug_info { 915struct vmbus_channel_debug_info {
@@ -1046,6 +1047,38 @@ struct vmbus_channel {
1046 * preserve the earlier behavior. 1047 * preserve the earlier behavior.
1047 */ 1048 */
1048 u32 target_vp; 1049 u32 target_vp;
1050 /*
1051 * Support for sub-channels. For high performance devices,
1052 * it will be useful to have multiple sub-channels to support
1053 * a scalable communication infrastructure with the host.
1054 * The support for sub-channels is implemented as an extention
1055 * to the current infrastructure.
1056 * The initial offer is considered the primary channel and this
1057 * offer message will indicate if the host supports sub-channels.
1058 * The guest is free to ask for sub-channels to be offerred and can
1059 * open these sub-channels as a normal "primary" channel. However,
1060 * all sub-channels will have the same type and instance guids as the
1061 * primary channel. Requests sent on a given channel will result in a
1062 * response on the same channel.
1063 */
1064
1065 /*
1066 * Sub-channel creation callback. This callback will be called in
1067 * process context when a sub-channel offer is received from the host.
1068 * The guest can open the sub-channel in the context of this callback.
1069 */
1070 void (*sc_creation_callback)(struct vmbus_channel *new_sc);
1071
1072 spinlock_t sc_lock;
1073 /*
1074 * All Sub-channels of a primary channel are linked here.
1075 */
1076 struct list_head sc_list;
1077 /*
1078 * The primary channel this sub-channel belongs to.
1079 * This will be NULL for the primary channel.
1080 */
1081 struct vmbus_channel *primary_channel;
1049}; 1082};
1050 1083
1051static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 1084static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1057,6 +1090,34 @@ void vmbus_onmessage(void *context);
1057 1090
1058int vmbus_request_offers(void); 1091int vmbus_request_offers(void);
1059 1092
1093/*
1094 * APIs for managing sub-channels.
1095 */
1096
1097void vmbus_set_sc_create_callback(struct vmbus_channel *primary_channel,
1098 void (*sc_cr_cb)(struct vmbus_channel *new_sc));
1099
1100/*
1101 * Retrieve the (sub) channel on which to send an outgoing request.
1102 * When a primary channel has multiple sub-channels, we choose a
1103 * channel whose VCPU binding is closest to the VCPU on which
1104 * this call is being made.
1105 */
1106struct vmbus_channel *vmbus_get_outgoing_channel(struct vmbus_channel *primary);
1107
1108/*
1109 * Check if sub-channels have already been offerred. This API will be useful
1110 * when the driver is unloaded after establishing sub-channels. In this case,
1111 * when the driver is re-loaded, the driver would have to check if the
1112 * subchannels have already been established before attempting to request
1113 * the creation of sub-channels.
1114 * This function returns TRUE to indicate that subchannels have already been
1115 * created.
1116 * This function should be invoked after setting the callback function for
1117 * sub-channel creation.
1118 */
1119bool vmbus_are_subchannels_present(struct vmbus_channel *primary);
1120
1060/* The format must be the same as struct vmdata_gpa_direct */ 1121/* The format must be the same as struct vmdata_gpa_direct */
1061struct vmbus_channel_packet_page_buffer { 1122struct vmbus_channel_packet_page_buffer {
1062 u16 type; 1123 u16 type;
@@ -1327,6 +1388,15 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1327 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ 1388 0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \
1328 } 1389 }
1329 1390
1391/*
1392 * Synthetic FC GUID
1393 * {2f9bcc4a-0069-4af3-b76b-6fd0be528cda}
1394 */
1395#define HV_SYNTHFC_GUID \
1396 .guid = { \
1397 0x4A, 0xCC, 0x9B, 0x2F, 0x69, 0x00, 0xF3, 0x4A, \
1398 0xB7, 0x6B, 0x6F, 0xD0, 0xBE, 0x52, 0x8C, 0xDA \
1399 }
1330 1400
1331/* 1401/*
1332 * Common header for Hyper-V ICs 1402 * Common header for Hyper-V ICs
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 12b4d55a02af..d5569734f672 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -30,7 +30,6 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
30 30
31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 31int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
32 32
33int mac_pton(const char *s, u8 *mac);
34extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 33extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
35 34
36#endif /* _LINUX_IF_ETHER_H */ 35#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 52bd03b38962..637fa71de0c7 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -44,7 +44,7 @@ struct vlan_hdr {
44 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr) 44 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
45 * @h_dest: destination ethernet address 45 * @h_dest: destination ethernet address
46 * @h_source: source ethernet address 46 * @h_source: source ethernet address
47 * @h_vlan_proto: ethernet protocol (always 0x8100) 47 * @h_vlan_proto: ethernet protocol
48 * @h_vlan_TCI: priority and VLAN ID 48 * @h_vlan_TCI: priority and VLAN ID
49 * @h_vlan_encapsulated_proto: packet type ID or len 49 * @h_vlan_encapsulated_proto: packet type ID or len
50 */ 50 */
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 172c5b23cb84..72b26940730d 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -24,14 +24,10 @@
24#define ST_SENSORS_FULLSCALE_AVL_MAX 10 24#define ST_SENSORS_FULLSCALE_AVL_MAX 10
25 25
26#define ST_SENSORS_NUMBER_ALL_CHANNELS 4 26#define ST_SENSORS_NUMBER_ALL_CHANNELS 4
27#define ST_SENSORS_NUMBER_DATA_CHANNELS 3
28#define ST_SENSORS_ENABLE_ALL_AXIS 0x07 27#define ST_SENSORS_ENABLE_ALL_AXIS 0x07
29#define ST_SENSORS_BYTE_FOR_CHANNEL 2
30#define ST_SENSORS_SCAN_X 0 28#define ST_SENSORS_SCAN_X 0
31#define ST_SENSORS_SCAN_Y 1 29#define ST_SENSORS_SCAN_Y 1
32#define ST_SENSORS_SCAN_Z 2 30#define ST_SENSORS_SCAN_Z 2
33#define ST_SENSORS_DEFAULT_12_REALBITS 12
34#define ST_SENSORS_DEFAULT_16_REALBITS 16
35#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01 31#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01
36#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00 32#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00
37#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f 33#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f
@@ -42,20 +38,20 @@
42#define ST_SENSORS_MAX_NAME 17 38#define ST_SENSORS_MAX_NAME 17
43#define ST_SENSORS_MAX_4WAI 7 39#define ST_SENSORS_MAX_4WAI 7
44 40
45#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \ 41#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
42 ch2, s, endian, rbits, sbits, addr) \
46{ \ 43{ \
47 .type = device_type, \ 44 .type = device_type, \
48 .modified = 1, \ 45 .modified = mod, \
49 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 46 .info_mask_separate = mask, \
50 BIT(IIO_CHAN_INFO_SCALE), \
51 .scan_index = index, \ 47 .scan_index = index, \
52 .channel2 = mod, \ 48 .channel2 = ch2, \
53 .address = addr, \ 49 .address = addr, \
54 .scan_type = { \ 50 .scan_type = { \
55 .sign = 's', \ 51 .sign = s, \
56 .realbits = bits, \ 52 .realbits = rbits, \
57 .shift = 16 - bits, \ 53 .shift = sbits - rbits, \
58 .storagebits = 16, \ 54 .storagebits = sbits, \
59 .endianness = endian, \ 55 .endianness = endian, \
60 }, \ 56 }, \
61} 57}
@@ -204,6 +200,7 @@ struct st_sensors {
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 200 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 201 * @buffer_data: Data used by buffer part.
206 * @odr: Output data rate of the sensor [Hz]. 202 * @odr: Output data rate of the sensor [Hz].
203 * num_data_channels: Number of data channels used in buffer.
207 * @get_irq_data_ready: Function to get the IRQ used for data ready signal. 204 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
208 * @tf: Transfer function structure used by I/O operations. 205 * @tf: Transfer function structure used by I/O operations.
209 * @tb: Transfer buffers and mutex used by I/O operations. 206 * @tb: Transfer buffers and mutex used by I/O operations.
@@ -220,6 +217,7 @@ struct st_sensor_data {
220 char *buffer_data; 217 char *buffer_data;
221 218
222 unsigned int odr; 219 unsigned int odr;
220 unsigned int num_data_channels;
223 221
224 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); 222 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
225 223
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index be91f344d5fc..ffd8c8f90928 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * ADF4350/ADF4351 SPI PLL driver 2 * ADF4350/ADF4351 SPI PLL driver
3 * 3 *
4 * Copyright 2012 Analog Devices Inc. 4 * Copyright 2012-2013 Analog Devices Inc.
5 * 5 *
6 * Licensed under the GPL-2. 6 * Licensed under the GPL-2.
7 */ 7 */
@@ -41,7 +41,7 @@
41#define ADF4350_REG2_RDIV2_EN (1 << 24) 41#define ADF4350_REG2_RDIV2_EN (1 << 24)
42#define ADF4350_REG2_RMULT2_EN (1 << 25) 42#define ADF4350_REG2_RMULT2_EN (1 << 25)
43#define ADF4350_REG2_MUXOUT(x) ((x) << 26) 43#define ADF4350_REG2_MUXOUT(x) ((x) << 26)
44#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29) 44#define ADF4350_REG2_NOISE_MODE(x) (((unsigned)(x)) << 29)
45#define ADF4350_MUXOUT_THREESTATE 0 45#define ADF4350_MUXOUT_THREESTATE 0
46#define ADF4350_MUXOUT_DVDD 1 46#define ADF4350_MUXOUT_DVDD 1
47#define ADF4350_MUXOUT_GND 2 47#define ADF4350_MUXOUT_GND 2
diff --git a/include/linux/ipmi-fru.h b/include/linux/ipmi-fru.h
new file mode 100644
index 000000000000..4d3a76380e32
--- /dev/null
+++ b/include/linux/ipmi-fru.h
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 2012 CERN (www.cern.ch)
3 * Author: Alessandro Rubini <rubini@gnudd.com>
4 *
5 * Released according to the GNU GPL, version 2 or any later version.
6 *
7 * This work is part of the White Rabbit project, a research effort led
8 * by CERN, the European Institute for Nuclear Research.
9 */
10#ifndef __LINUX_IPMI_FRU_H__
11#define __LINUX_IPMI_FRU_H__
12#ifdef __KERNEL__
13# include <linux/types.h>
14# include <linux/string.h>
15#else
16# include <stdint.h>
17# include <string.h>
18#endif
19
20/*
21 * These structures match the unaligned crap we have in FRU1011.pdf
22 * (http://download.intel.com/design/servers/ipmi/FRU1011.pdf)
23 */
24
25/* chapter 8, page 5 */
26struct fru_common_header {
27 uint8_t format; /* 0x01 */
28 uint8_t internal_use_off; /* multiple of 8 bytes */
29 uint8_t chassis_info_off; /* multiple of 8 bytes */
30 uint8_t board_area_off; /* multiple of 8 bytes */
31 uint8_t product_area_off; /* multiple of 8 bytes */
32 uint8_t multirecord_off; /* multiple of 8 bytes */
33 uint8_t pad; /* must be 0 */
34 uint8_t checksum; /* sum modulo 256 must be 0 */
35};
36
37/* chapter 9, page 5 -- internal_use: not used by us */
38
39/* chapter 10, page 6 -- chassis info: not used by us */
40
41/* chapter 13, page 9 -- used by board_info_area below */
42struct fru_type_length {
43 uint8_t type_length;
44 uint8_t data[0];
45};
46
47/* chapter 11, page 7 */
48struct fru_board_info_area {
49 uint8_t format; /* 0x01 */
50 uint8_t area_len; /* multiple of 8 bytes */
51 uint8_t language; /* I hope it's 0 */
52 uint8_t mfg_date[3]; /* LSB, minutes since 1996-01-01 */
53 struct fru_type_length tl[0]; /* type-length stuff follows */
54
55 /*
56 * the TL there are in order:
57 * Board Manufacturer
58 * Board Product Name
59 * Board Serial Number
60 * Board Part Number
61 * FRU File ID (may be null)
62 * more manufacturer-specific stuff
63 * 0xc1 as a terminator
64 * 0x00 pad to a multiple of 8 bytes - 1
65 * checksum (sum of all stuff module 256 must be zero)
66 */
67};
68
69enum fru_type {
70 FRU_TYPE_BINARY = 0x00,
71 FRU_TYPE_BCDPLUS = 0x40,
72 FRU_TYPE_ASCII6 = 0x80,
73 FRU_TYPE_ASCII = 0xc0, /* not ascii: depends on language */
74};
75
76/*
77 * some helpers
78 */
79static inline struct fru_board_info_area *fru_get_board_area(
80 const struct fru_common_header *header)
81{
82 /* we know for sure that the header is 8 bytes in size */
83 return (struct fru_board_info_area *)(header + header->board_area_off);
84}
85
86static inline int fru_type(struct fru_type_length *tl)
87{
88 return tl->type_length & 0xc0;
89}
90
91static inline int fru_length(struct fru_type_length *tl)
92{
93 return (tl->type_length & 0x3f) + 1; /* len of whole record */
94}
95
96/* assume ascii-latin1 encoding */
97static inline int fru_strlen(struct fru_type_length *tl)
98{
99 return fru_length(tl) - 1;
100}
101
102static inline char *fru_strcpy(char *dest, struct fru_type_length *tl)
103{
104 int len = fru_strlen(tl);
105 memcpy(dest, tl->data, len);
106 dest[len] = '\0';
107 return dest;
108}
109
110static inline struct fru_type_length *fru_next_tl(struct fru_type_length *tl)
111{
112 return tl + fru_length(tl);
113}
114
115static inline int fru_is_eof(struct fru_type_length *tl)
116{
117 return tl->type_length == 0xc1;
118}
119
120/*
121 * External functions defined in fru-parse.c.
122 */
123extern int fru_header_cksum_ok(struct fru_common_header *header);
124extern int fru_bia_cksum_ok(struct fru_board_info_area *bia);
125
126/* All these 4 return allocated strings by calling fru_alloc() */
127extern char *fru_get_board_manufacturer(struct fru_common_header *header);
128extern char *fru_get_product_name(struct fru_common_header *header);
129extern char *fru_get_serial_number(struct fru_common_header *header);
130extern char *fru_get_part_number(struct fru_common_header *header);
131
132/* This must be defined by the caller of the above functions */
133extern void *fru_alloc(size_t size);
134
135#endif /* __LINUX_IMPI_FRU_H__ */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index e0006f1d35a0..14d79131f53d 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -11,6 +11,10 @@
11#ifndef _LINUX_IRQCHIP_H 11#ifndef _LINUX_IRQCHIP_H
12#define _LINUX_IRQCHIP_H 12#define _LINUX_IRQCHIP_H
13 13
14#ifdef CONFIG_IRQCHIP
14void irqchip_init(void); 15void irqchip_init(void);
16#else
17static inline void irqchip_init(void) {}
18#endif
15 19
16#endif 20#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 7e0b622503c4..8685d1be12c7 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -27,7 +27,6 @@
27#include <linux/buffer_head.h> 27#include <linux/buffer_head.h>
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 30#include <linux/mutex.h>
32#include <linux/timer.h> 31#include <linux/timer.h>
33#include <linux/lockdep.h> 32#include <linux/lockdep.h>
@@ -244,6 +243,31 @@ typedef struct journal_superblock_s
244 243
245#include <linux/fs.h> 244#include <linux/fs.h>
246#include <linux/sched.h> 245#include <linux/sched.h>
246
247enum jbd_state_bits {
248 BH_JBD /* Has an attached ext3 journal_head */
249 = BH_PrivateStart,
250 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
251 BH_Freed, /* Has been freed (truncated) */
252 BH_Revoked, /* Has been revoked from the log */
253 BH_RevokeValid, /* Revoked flag is valid */
254 BH_JBDDirty, /* Is dirty but journaled */
255 BH_State, /* Pins most journal_head state */
256 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
257 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
258 BH_JBDPrivateStart, /* First bit available for private use by FS */
259};
260
261BUFFER_FNS(JBD, jbd)
262BUFFER_FNS(JWrite, jwrite)
263BUFFER_FNS(JBDDirty, jbddirty)
264TAS_BUFFER_FNS(JBDDirty, jbddirty)
265BUFFER_FNS(Revoked, revoked)
266TAS_BUFFER_FNS(Revoked, revoked)
267BUFFER_FNS(RevokeValid, revokevalid)
268TAS_BUFFER_FNS(RevokeValid, revokevalid)
269BUFFER_FNS(Freed, freed)
270
247#include <linux/jbd_common.h> 271#include <linux/jbd_common.h>
248 272
249#define J_ASSERT(assert) BUG_ON(!(assert)) 273#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -840,7 +864,7 @@ extern void journal_release_buffer (handle_t *, struct buffer_head *);
840extern int journal_forget (handle_t *, struct buffer_head *); 864extern int journal_forget (handle_t *, struct buffer_head *);
841extern void journal_sync_buffer (struct buffer_head *); 865extern void journal_sync_buffer (struct buffer_head *);
842extern void journal_invalidatepage(journal_t *, 866extern void journal_invalidatepage(journal_t *,
843 struct page *, unsigned long); 867 struct page *, unsigned int, unsigned int);
844extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 868extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
845extern int journal_stop(handle_t *); 869extern int journal_stop(handle_t *);
846extern int journal_flush (journal_t *); 870extern int journal_flush (journal_t *);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 6e051f472edb..d5b50a19463c 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -26,7 +26,6 @@
26#include <linux/buffer_head.h> 26#include <linux/buffer_head.h>
27#include <linux/journal-head.h> 27#include <linux/journal-head.h>
28#include <linux/stddef.h> 28#include <linux/stddef.h>
29#include <linux/bit_spinlock.h>
30#include <linux/mutex.h> 29#include <linux/mutex.h>
31#include <linux/timer.h> 30#include <linux/timer.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
@@ -57,17 +56,13 @@
57 */ 56 */
58#define JBD2_EXPENSIVE_CHECKING 57#define JBD2_EXPENSIVE_CHECKING
59extern ushort jbd2_journal_enable_debug; 58extern ushort jbd2_journal_enable_debug;
59void __jbd2_debug(int level, const char *file, const char *func,
60 unsigned int line, const char *fmt, ...);
60 61
61#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, fmt, a...) \
62 do { \ 63 __jbd2_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
63 if ((n) <= jbd2_journal_enable_debug) { \
64 printk (KERN_DEBUG "(%s, %d): %s: ", \
65 __FILE__, __LINE__, __func__); \
66 printk (f, ## a); \
67 } \
68 } while (0)
69#else 64#else
70#define jbd_debug(f, a...) /**/ 65#define jbd_debug(n, fmt, a...) /**/
71#endif 66#endif
72 67
73extern void *jbd2_alloc(size_t size, gfp_t flags); 68extern void *jbd2_alloc(size_t size, gfp_t flags);
@@ -302,6 +297,34 @@ typedef struct journal_superblock_s
302 297
303#include <linux/fs.h> 298#include <linux/fs.h>
304#include <linux/sched.h> 299#include <linux/sched.h>
300
301enum jbd_state_bits {
302 BH_JBD /* Has an attached ext3 journal_head */
303 = BH_PrivateStart,
304 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
305 BH_Freed, /* Has been freed (truncated) */
306 BH_Revoked, /* Has been revoked from the log */
307 BH_RevokeValid, /* Revoked flag is valid */
308 BH_JBDDirty, /* Is dirty but journaled */
309 BH_State, /* Pins most journal_head state */
310 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
311 BH_Shadow, /* IO on shadow buffer is running */
312 BH_Verified, /* Metadata block has been verified ok */
313 BH_JBDPrivateStart, /* First bit available for private use by FS */
314};
315
316BUFFER_FNS(JBD, jbd)
317BUFFER_FNS(JWrite, jwrite)
318BUFFER_FNS(JBDDirty, jbddirty)
319TAS_BUFFER_FNS(JBDDirty, jbddirty)
320BUFFER_FNS(Revoked, revoked)
321TAS_BUFFER_FNS(Revoked, revoked)
322BUFFER_FNS(RevokeValid, revokevalid)
323TAS_BUFFER_FNS(RevokeValid, revokevalid)
324BUFFER_FNS(Freed, freed)
325BUFFER_FNS(Shadow, shadow)
326BUFFER_FNS(Verified, verified)
327
305#include <linux/jbd_common.h> 328#include <linux/jbd_common.h>
306 329
307#define J_ASSERT(assert) BUG_ON(!(assert)) 330#define J_ASSERT(assert) BUG_ON(!(assert))
@@ -382,8 +405,15 @@ struct jbd2_revoke_table_s;
382 405
383struct jbd2_journal_handle 406struct jbd2_journal_handle
384{ 407{
385 /* Which compound transaction is this update a part of? */ 408 union {
386 transaction_t *h_transaction; 409 /* Which compound transaction is this update a part of? */
410 transaction_t *h_transaction;
411 /* Which journal handle belongs to - used iff h_reserved set */
412 journal_t *h_journal;
413 };
414
415 /* Handle reserved for finishing the logical operation */
416 handle_t *h_rsv_handle;
387 417
388 /* Number of remaining buffers we are allowed to dirty: */ 418 /* Number of remaining buffers we are allowed to dirty: */
389 int h_buffer_credits; 419 int h_buffer_credits;
@@ -398,6 +428,7 @@ struct jbd2_journal_handle
398 /* Flags [no locking] */ 428 /* Flags [no locking] */
399 unsigned int h_sync: 1; /* sync-on-close */ 429 unsigned int h_sync: 1; /* sync-on-close */
400 unsigned int h_jdata: 1; /* force data journaling */ 430 unsigned int h_jdata: 1; /* force data journaling */
431 unsigned int h_reserved: 1; /* handle with reserved credits */
401 unsigned int h_aborted: 1; /* fatal error on handle */ 432 unsigned int h_aborted: 1; /* fatal error on handle */
402 unsigned int h_type: 8; /* for handle statistics */ 433 unsigned int h_type: 8; /* for handle statistics */
403 unsigned int h_line_no: 16; /* for handle statistics */ 434 unsigned int h_line_no: 16; /* for handle statistics */
@@ -524,12 +555,6 @@ struct transaction_s
524 struct journal_head *t_checkpoint_io_list; 555 struct journal_head *t_checkpoint_io_list;
525 556
526 /* 557 /*
527 * Doubly-linked circular list of temporary buffers currently undergoing
528 * IO in the log [j_list_lock]
529 */
530 struct journal_head *t_iobuf_list;
531
532 /*
533 * Doubly-linked circular list of metadata buffers being shadowed by log 558 * Doubly-linked circular list of metadata buffers being shadowed by log
534 * IO. The IO buffers on the iobuf list and the shadow buffers on this 559 * IO. The IO buffers on the iobuf list and the shadow buffers on this
535 * list match each other one for one at all times. [j_list_lock] 560 * list match each other one for one at all times. [j_list_lock]
@@ -537,12 +562,6 @@ struct transaction_s
537 struct journal_head *t_shadow_list; 562 struct journal_head *t_shadow_list;
538 563
539 /* 564 /*
540 * Doubly-linked circular list of control buffers being written to the
541 * log. [j_list_lock]
542 */
543 struct journal_head *t_log_list;
544
545 /*
546 * List of inodes whose data we've modified in data=ordered mode. 565 * List of inodes whose data we've modified in data=ordered mode.
547 * [j_list_lock] 566 * [j_list_lock]
548 */ 567 */
@@ -671,11 +690,10 @@ jbd2_time_diff(unsigned long start, unsigned long end)
671 * waiting for checkpointing 690 * waiting for checkpointing
672 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 691 * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
673 * to start committing, or for a barrier lock to be released 692 * to start committing, or for a barrier lock to be released
674 * @j_wait_logspace: Wait queue for waiting for checkpointing to complete
675 * @j_wait_done_commit: Wait queue for waiting for commit to complete 693 * @j_wait_done_commit: Wait queue for waiting for commit to complete
676 * @j_wait_checkpoint: Wait queue to trigger checkpointing
677 * @j_wait_commit: Wait queue to trigger commit 694 * @j_wait_commit: Wait queue to trigger commit
678 * @j_wait_updates: Wait queue to wait for updates to complete 695 * @j_wait_updates: Wait queue to wait for updates to complete
696 * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
679 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints 697 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
680 * @j_head: Journal head - identifies the first unused block in the journal 698 * @j_head: Journal head - identifies the first unused block in the journal
681 * @j_tail: Journal tail - identifies the oldest still-used block in the 699 * @j_tail: Journal tail - identifies the oldest still-used block in the
@@ -689,6 +707,7 @@ jbd2_time_diff(unsigned long start, unsigned long end)
689 * journal 707 * journal
690 * @j_fs_dev: Device which holds the client fs. For internal journal this will 708 * @j_fs_dev: Device which holds the client fs. For internal journal this will
691 * be equal to j_dev 709 * be equal to j_dev
710 * @j_reserved_credits: Number of buffers reserved from the running transaction
692 * @j_maxlen: Total maximum capacity of the journal region on disk. 711 * @j_maxlen: Total maximum capacity of the journal region on disk.
693 * @j_list_lock: Protects the buffer lists and internal buffer state. 712 * @j_list_lock: Protects the buffer lists and internal buffer state.
694 * @j_inode: Optional inode where we store the journal. If present, all journal 713 * @j_inode: Optional inode where we store the journal. If present, all journal
@@ -778,21 +797,18 @@ struct journal_s
778 */ 797 */
779 wait_queue_head_t j_wait_transaction_locked; 798 wait_queue_head_t j_wait_transaction_locked;
780 799
781 /* Wait queue for waiting for checkpointing to complete */
782 wait_queue_head_t j_wait_logspace;
783
784 /* Wait queue for waiting for commit to complete */ 800 /* Wait queue for waiting for commit to complete */
785 wait_queue_head_t j_wait_done_commit; 801 wait_queue_head_t j_wait_done_commit;
786 802
787 /* Wait queue to trigger checkpointing */
788 wait_queue_head_t j_wait_checkpoint;
789
790 /* Wait queue to trigger commit */ 803 /* Wait queue to trigger commit */
791 wait_queue_head_t j_wait_commit; 804 wait_queue_head_t j_wait_commit;
792 805
793 /* Wait queue to wait for updates to complete */ 806 /* Wait queue to wait for updates to complete */
794 wait_queue_head_t j_wait_updates; 807 wait_queue_head_t j_wait_updates;
795 808
809 /* Wait queue to wait for reserved buffer credits to drop */
810 wait_queue_head_t j_wait_reserved;
811
796 /* Semaphore for locking against concurrent checkpoints */ 812 /* Semaphore for locking against concurrent checkpoints */
797 struct mutex j_checkpoint_mutex; 813 struct mutex j_checkpoint_mutex;
798 814
@@ -847,6 +863,9 @@ struct journal_s
847 /* Total maximum capacity of the journal region on disk. */ 863 /* Total maximum capacity of the journal region on disk. */
848 unsigned int j_maxlen; 864 unsigned int j_maxlen;
849 865
866 /* Number of buffers reserved from the running transaction */
867 atomic_t j_reserved_credits;
868
850 /* 869 /*
851 * Protects the buffer lists and internal buffer state. 870 * Protects the buffer lists and internal buffer state.
852 */ 871 */
@@ -991,9 +1010,17 @@ extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, i
991extern void __journal_free_buffer(struct journal_head *bh); 1010extern void __journal_free_buffer(struct journal_head *bh);
992extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int); 1011extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
993extern void __journal_clean_data_list(transaction_t *transaction); 1012extern void __journal_clean_data_list(transaction_t *transaction);
1013static inline void jbd2_file_log_bh(struct list_head *head, struct buffer_head *bh)
1014{
1015 list_add_tail(&bh->b_assoc_buffers, head);
1016}
1017static inline void jbd2_unfile_log_bh(struct buffer_head *bh)
1018{
1019 list_del_init(&bh->b_assoc_buffers);
1020}
994 1021
995/* Log buffer allocation */ 1022/* Log buffer allocation */
996extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 1023struct buffer_head *jbd2_journal_get_descriptor_buffer(journal_t *journal);
997int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 1024int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
998int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, 1025int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
999 unsigned long *block); 1026 unsigned long *block);
@@ -1039,11 +1066,10 @@ extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1039 struct jbd2_buffer_trigger_type *triggers); 1066 struct jbd2_buffer_trigger_type *triggers);
1040 1067
1041/* Buffer IO */ 1068/* Buffer IO */
1042extern int 1069extern int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1043jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1070 struct journal_head *jh_in,
1044 struct journal_head *jh_in, 1071 struct buffer_head **bh_out,
1045 struct journal_head **jh_out, 1072 sector_t blocknr);
1046 unsigned long long blocknr);
1047 1073
1048/* Transaction locking */ 1074/* Transaction locking */
1049extern void __wait_on_journal (journal_t *); 1075extern void __wait_on_journal (journal_t *);
@@ -1076,10 +1102,14 @@ static inline handle_t *journal_current_handle(void)
1076 */ 1102 */
1077 1103
1078extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1104extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1079extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask, 1105extern handle_t *jbd2__journal_start(journal_t *, int blocks, int rsv_blocks,
1080 unsigned int type, unsigned int line_no); 1106 gfp_t gfp_mask, unsigned int type,
1107 unsigned int line_no);
1081extern int jbd2_journal_restart(handle_t *, int nblocks); 1108extern int jbd2_journal_restart(handle_t *, int nblocks);
1082extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); 1109extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask);
1110extern int jbd2_journal_start_reserved(handle_t *handle,
1111 unsigned int type, unsigned int line_no);
1112extern void jbd2_journal_free_reserved(handle_t *handle);
1083extern int jbd2_journal_extend (handle_t *, int nblocks); 1113extern int jbd2_journal_extend (handle_t *, int nblocks);
1084extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1114extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1085extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1115extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1090,7 +1120,7 @@ extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1090extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1120extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1091extern void journal_sync_buffer (struct buffer_head *); 1121extern void journal_sync_buffer (struct buffer_head *);
1092extern int jbd2_journal_invalidatepage(journal_t *, 1122extern int jbd2_journal_invalidatepage(journal_t *,
1093 struct page *, unsigned long); 1123 struct page *, unsigned int, unsigned int);
1094extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1124extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1095extern int jbd2_journal_stop(handle_t *); 1125extern int jbd2_journal_stop(handle_t *);
1096extern int jbd2_journal_flush (journal_t *); 1126extern int jbd2_journal_flush (journal_t *);
@@ -1125,6 +1155,7 @@ extern void jbd2_journal_ack_err (journal_t *);
1125extern int jbd2_journal_clear_err (journal_t *); 1155extern int jbd2_journal_clear_err (journal_t *);
1126extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1156extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1127extern int jbd2_journal_force_commit(journal_t *); 1157extern int jbd2_journal_force_commit(journal_t *);
1158extern int jbd2_journal_force_commit_nested(journal_t *);
1128extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); 1159extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1129extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, 1160extern int jbd2_journal_begin_ordered_truncate(journal_t *journal,
1130 struct jbd2_inode *inode, loff_t new_size); 1161 struct jbd2_inode *inode, loff_t new_size);
@@ -1178,8 +1209,10 @@ extern int jbd2_journal_init_revoke_caches(void);
1178extern void jbd2_journal_destroy_revoke(journal_t *); 1209extern void jbd2_journal_destroy_revoke(journal_t *);
1179extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); 1210extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
1180extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); 1211extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
1181extern void jbd2_journal_write_revoke_records(journal_t *, 1212extern void jbd2_journal_write_revoke_records(journal_t *journal,
1182 transaction_t *, int); 1213 transaction_t *transaction,
1214 struct list_head *log_bufs,
1215 int write_op);
1183 1216
1184/* Recovery revoke support */ 1217/* Recovery revoke support */
1185extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t); 1218extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
@@ -1195,11 +1228,9 @@ extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1195 * transitions on demand. 1228 * transitions on demand.
1196 */ 1229 */
1197 1230
1198int __jbd2_log_space_left(journal_t *); /* Called with journal locked */
1199int jbd2_log_start_commit(journal_t *journal, tid_t tid); 1231int jbd2_log_start_commit(journal_t *journal, tid_t tid);
1200int __jbd2_log_start_commit(journal_t *journal, tid_t tid); 1232int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
1201int jbd2_journal_start_commit(journal_t *journal, tid_t *tid); 1233int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
1202int jbd2_journal_force_commit_nested(journal_t *journal);
1203int jbd2_log_wait_commit(journal_t *journal, tid_t tid); 1234int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1204int jbd2_complete_transaction(journal_t *journal, tid_t tid); 1235int jbd2_complete_transaction(journal_t *journal, tid_t tid);
1205int jbd2_log_do_checkpoint(journal_t *journal); 1236int jbd2_log_do_checkpoint(journal_t *journal);
@@ -1235,7 +1266,7 @@ static inline int is_journal_aborted(journal_t *journal)
1235 1266
1236static inline int is_handle_aborted(handle_t *handle) 1267static inline int is_handle_aborted(handle_t *handle)
1237{ 1268{
1238 if (handle->h_aborted) 1269 if (handle->h_aborted || !handle->h_transaction)
1239 return 1; 1270 return 1;
1240 return is_journal_aborted(handle->h_transaction->t_journal); 1271 return is_journal_aborted(handle->h_transaction->t_journal);
1241} 1272}
@@ -1266,16 +1297,37 @@ extern int jbd2_journal_blocks_per_page(struct inode *inode);
1266extern size_t journal_tag_bytes(journal_t *journal); 1297extern size_t journal_tag_bytes(journal_t *journal);
1267 1298
1268/* 1299/*
1300 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
1301 * transaction control blocks.
1302 */
1303#define JBD2_CONTROL_BLOCKS_SHIFT 5
1304
1305/*
1269 * Return the minimum number of blocks which must be free in the journal 1306 * Return the minimum number of blocks which must be free in the journal
1270 * before a new transaction may be started. Must be called under j_state_lock. 1307 * before a new transaction may be started. Must be called under j_state_lock.
1271 */ 1308 */
1272static inline int jbd_space_needed(journal_t *journal) 1309static inline int jbd2_space_needed(journal_t *journal)
1273{ 1310{
1274 int nblocks = journal->j_max_transaction_buffers; 1311 int nblocks = journal->j_max_transaction_buffers;
1275 if (journal->j_committing_transaction) 1312 return nblocks + (nblocks >> JBD2_CONTROL_BLOCKS_SHIFT);
1276 nblocks += atomic_read(&journal->j_committing_transaction-> 1313}
1277 t_outstanding_credits); 1314
1278 return nblocks; 1315/*
1316 * Return number of free blocks in the log. Must be called under j_state_lock.
1317 */
1318static inline unsigned long jbd2_log_space_left(journal_t *journal)
1319{
1320 /* Allow for rounding errors */
1321 unsigned long free = journal->j_free - 32;
1322
1323 if (journal->j_committing_transaction) {
1324 unsigned long committing = atomic_read(&journal->
1325 j_committing_transaction->t_outstanding_credits);
1326
1327 /* Transaction + control blocks */
1328 free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT);
1329 }
1330 return free;
1279} 1331}
1280 1332
1281/* 1333/*
@@ -1286,11 +1338,9 @@ static inline int jbd_space_needed(journal_t *journal)
1286#define BJ_None 0 /* Not journaled */ 1338#define BJ_None 0 /* Not journaled */
1287#define BJ_Metadata 1 /* Normal journaled metadata */ 1339#define BJ_Metadata 1 /* Normal journaled metadata */
1288#define BJ_Forget 2 /* Buffer superseded by this transaction */ 1340#define BJ_Forget 2 /* Buffer superseded by this transaction */
1289#define BJ_IO 3 /* Buffer is for temporary IO use */ 1341#define BJ_Shadow 3 /* Buffer contents being shadowed to the log */
1290#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */ 1342#define BJ_Reserved 4 /* Buffer is reserved for access by journal */
1291#define BJ_LogCtl 5 /* Buffer contains log descriptors */ 1343#define BJ_Types 5
1292#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1293#define BJ_Types 7
1294 1344
1295extern int jbd_blocks_per_page(struct inode *inode); 1345extern int jbd_blocks_per_page(struct inode *inode);
1296 1346
@@ -1319,6 +1369,19 @@ static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
1319 return *(u32 *)desc.ctx; 1369 return *(u32 *)desc.ctx;
1320} 1370}
1321 1371
1372/* Return most recent uncommitted transaction */
1373static inline tid_t jbd2_get_latest_transaction(journal_t *journal)
1374{
1375 tid_t tid;
1376
1377 read_lock(&journal->j_state_lock);
1378 tid = journal->j_commit_request;
1379 if (journal->j_running_transaction)
1380 tid = journal->j_running_transaction->t_tid;
1381 read_unlock(&journal->j_state_lock);
1382 return tid;
1383}
1384
1322#ifdef __KERNEL__ 1385#ifdef __KERNEL__
1323 1386
1324#define buffer_trace_init(bh) do {} while (0) 1387#define buffer_trace_init(bh) do {} while (0)
diff --git a/include/linux/jbd_common.h b/include/linux/jbd_common.h
index 6133679bc4c0..3dc53432355f 100644
--- a/include/linux/jbd_common.h
+++ b/include/linux/jbd_common.h
@@ -1,31 +1,7 @@
1#ifndef _LINUX_JBD_STATE_H 1#ifndef _LINUX_JBD_STATE_H
2#define _LINUX_JBD_STATE_H 2#define _LINUX_JBD_STATE_H
3 3
4enum jbd_state_bits { 4#include <linux/bit_spinlock.h>
5 BH_JBD /* Has an attached ext3 journal_head */
6 = BH_PrivateStart,
7 BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
8 BH_Freed, /* Has been freed (truncated) */
9 BH_Revoked, /* Has been revoked from the log */
10 BH_RevokeValid, /* Revoked flag is valid */
11 BH_JBDDirty, /* Is dirty but journaled */
12 BH_State, /* Pins most journal_head state */
13 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
14 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
15 BH_Verified, /* Metadata block has been verified ok */
16 BH_JBDPrivateStart, /* First bit available for private use by FS */
17};
18
19BUFFER_FNS(JBD, jbd)
20BUFFER_FNS(JWrite, jwrite)
21BUFFER_FNS(JBDDirty, jbddirty)
22TAS_BUFFER_FNS(JBDDirty, jbddirty)
23BUFFER_FNS(Revoked, revoked)
24TAS_BUFFER_FNS(Revoked, revoked)
25BUFFER_FNS(RevokeValid, revokevalid)
26TAS_BUFFER_FNS(RevokeValid, revokevalid)
27BUFFER_FNS(Freed, freed)
28BUFFER_FNS(Verified, verified)
29 5
30static inline struct buffer_head *jh2bh(struct journal_head *jh) 6static inline struct buffer_head *jh2bh(struct journal_head *jh)
31{ 7{
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e9ef6d6b51d5..3afb969441d1 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -450,6 +450,8 @@ static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
450extern int hex_to_bin(char ch); 450extern int hex_to_bin(char ch);
451extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); 451extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
452 452
453int mac_pton(const char *s, u8 *mac);
454
453/* 455/*
454 * General tracing related utility functions - trace_printk(), 456 * General tracing related utility functions - trace_printk(),
455 * tracing_on/tracing_off and tracing_start()/tracing_stop 457 * tracing_on/tracing_off and tracing_start()/tracing_stop
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f0eea07d2c2b..8db53cfaccdb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -23,6 +23,7 @@
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/irqflags.h> 25#include <linux/irqflags.h>
26#include <linux/context_tracking.h>
26#include <asm/signal.h> 27#include <asm/signal.h>
27 28
28#include <linux/kvm.h> 29#include <linux/kvm.h>
@@ -760,42 +761,6 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
760} 761}
761#endif 762#endif
762 763
763static inline void __guest_enter(void)
764{
765 /*
766 * This is running in ioctl context so we can avoid
767 * the call to vtime_account() with its unnecessary idle check.
768 */
769 vtime_account_system(current);
770 current->flags |= PF_VCPU;
771}
772
773static inline void __guest_exit(void)
774{
775 /*
776 * This is running in ioctl context so we can avoid
777 * the call to vtime_account() with its unnecessary idle check.
778 */
779 vtime_account_system(current);
780 current->flags &= ~PF_VCPU;
781}
782
783#ifdef CONFIG_CONTEXT_TRACKING
784extern void guest_enter(void);
785extern void guest_exit(void);
786
787#else /* !CONFIG_CONTEXT_TRACKING */
788static inline void guest_enter(void)
789{
790 __guest_enter();
791}
792
793static inline void guest_exit(void)
794{
795 __guest_exit();
796}
797#endif /* !CONFIG_CONTEXT_TRACKING */
798
799static inline void kvm_guest_enter(void) 764static inline void kvm_guest_enter(void)
800{ 765{
801 unsigned long flags; 766 unsigned long flags;
diff --git a/include/linux/loop.h b/include/linux/loop.h
deleted file mode 100644
index 460b60fa7adf..000000000000
--- a/include/linux/loop.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * include/linux/loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
11
12#include <linux/bio.h>
13#include <linux/blkdev.h>
14#include <linux/spinlock.h>
15#include <linux/mutex.h>
16#include <uapi/linux/loop.h>
17
18/* Possible states of device */
19enum {
20 Lo_unbound,
21 Lo_bound,
22 Lo_rundown,
23};
24
25struct loop_func_table;
26
27struct loop_device {
28 int lo_number;
29 int lo_refcnt;
30 loff_t lo_offset;
31 loff_t lo_sizelimit;
32 int lo_flags;
33 int (*transfer)(struct loop_device *, int cmd,
34 struct page *raw_page, unsigned raw_off,
35 struct page *loop_page, unsigned loop_off,
36 int size, sector_t real_block);
37 char lo_file_name[LO_NAME_SIZE];
38 char lo_crypt_name[LO_NAME_SIZE];
39 char lo_encrypt_key[LO_KEY_SIZE];
40 int lo_encrypt_key_size;
41 struct loop_func_table *lo_encryption;
42 __u32 lo_init[2];
43 kuid_t lo_key_owner; /* Who set the key */
44 int (*ioctl)(struct loop_device *, int cmd,
45 unsigned long arg);
46
47 struct file * lo_backing_file;
48 struct block_device *lo_device;
49 unsigned lo_blocksize;
50 void *key_data;
51
52 gfp_t old_gfp_mask;
53
54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
57 int lo_state;
58 struct mutex lo_ctl_mutex;
59 struct task_struct *lo_thread;
60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
63
64 struct request_queue *lo_queue;
65 struct gendisk *lo_disk;
66};
67
68/* Support for loadable transfer modules */
69struct loop_func_table {
70 int number; /* filter type */
71 int (*transfer)(struct loop_device *lo, int cmd,
72 struct page *raw_page, unsigned raw_off,
73 struct page *loop_page, unsigned loop_off,
74 int size, sector_t real_block);
75 int (*init)(struct loop_device *, const struct loop_info64 *);
76 /* release is called from loop_unregister_transfer or clr_fd */
77 int (*release)(struct loop_device *);
78 int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
79 struct module *owner;
80};
81
82int loop_register_transfer(struct loop_func_table *funcs);
83int loop_unregister_transfer(int number);
84
85#endif
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 8f21daf62fb5..9b81b2bdc46b 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -20,6 +20,8 @@
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/regmap.h> 21#include <linux/regmap.h>
22#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
23#include <linux/extcon.h>
24#include <linux/usb/phy_companion.h>
23 25
24#define PALMAS_NUM_CLIENTS 3 26#define PALMAS_NUM_CLIENTS 3
25 27
@@ -37,6 +39,12 @@ struct palmas_gpadc;
37struct palmas_resource; 39struct palmas_resource;
38struct palmas_usb; 40struct palmas_usb;
39 41
42enum palmas_usb_state {
43 PALMAS_USB_STATE_DISCONNECT,
44 PALMAS_USB_STATE_VBUS,
45 PALMAS_USB_STATE_ID,
46};
47
40struct palmas { 48struct palmas {
41 struct device *dev; 49 struct device *dev;
42 50
@@ -180,9 +188,6 @@ struct palmas_pmic_platform_data {
180}; 188};
181 189
182struct palmas_usb_platform_data { 190struct palmas_usb_platform_data {
183 /* Set this if platform wishes its own vbus control */
184 int no_control_vbus;
185
186 /* Do we enable the wakeup comparator on probe */ 191 /* Do we enable the wakeup comparator on probe */
187 int wakeup; 192 int wakeup;
188}; 193};
@@ -350,22 +355,19 @@ struct palmas_usb {
350 struct palmas *palmas; 355 struct palmas *palmas;
351 struct device *dev; 356 struct device *dev;
352 357
353 /* for vbus reporting with irqs disabled */ 358 struct extcon_dev edev;
354 spinlock_t lock;
355
356 struct regulator *vbus_reg;
357 359
358 /* used to set vbus, in atomic path */ 360 /* used to set vbus, in atomic path */
359 struct work_struct set_vbus_work; 361 struct work_struct set_vbus_work;
360 362
361 int irq1; 363 int id_otg_irq;
362 int irq2; 364 int id_irq;
363 int irq3; 365 int vbus_otg_irq;
364 int irq4; 366 int vbus_irq;
365 367
366 int vbus_enable; 368 int vbus_enable;
367 369
368 u8 linkstat; 370 enum palmas_usb_state linkstat;
369}; 371};
370 372
371#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 373#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e0c8528a41a4..66d881f1d576 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1041,7 +1041,8 @@ int get_kernel_page(unsigned long start, int write, struct page **pages);
1041struct page *get_dump_page(unsigned long addr); 1041struct page *get_dump_page(unsigned long addr);
1042 1042
1043extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 1043extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
1044extern void do_invalidatepage(struct page *page, unsigned long offset); 1044extern void do_invalidatepage(struct page *page, unsigned int offset,
1045 unsigned int length);
1045 1046
1046int __set_page_dirty_nobuffers(struct page *page); 1047int __set_page_dirty_nobuffers(struct page *page);
1047int __set_page_dirty_no_writeback(struct page *page); 1048int __set_page_dirty_no_writeback(struct page *page);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60584b185a0c..96e4c21e15e0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1695,6 +1695,7 @@ extern int init_dummy_netdev(struct net_device *dev);
1695extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1695extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1696extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1696extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1697extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1697extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1698extern int netdev_get_name(struct net *net, char *name, int ifindex);
1698extern int dev_restart(struct net_device *dev); 1699extern int dev_restart(struct net_device *dev);
1699#ifdef CONFIG_NETPOLL_TRAP 1700#ifdef CONFIG_NETPOLL_TRAP
1700extern int netpoll_trap(void); 1701extern int netpoll_trap(void);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f463a46424e2..c5b6dbf9c2fc 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -389,8 +389,7 @@ struct perf_event {
389 /* mmap bits */ 389 /* mmap bits */
390 struct mutex mmap_mutex; 390 struct mutex mmap_mutex;
391 atomic_t mmap_count; 391 atomic_t mmap_count;
392 int mmap_locked; 392
393 struct user_struct *mmap_user;
394 struct ring_buffer *rb; 393 struct ring_buffer *rb;
395 struct list_head rb_entry; 394 struct list_head rb_entry;
396 395
diff --git a/include/linux/platform_data/ad7303.h b/include/linux/platform_data/ad7303.h
new file mode 100644
index 000000000000..de6a7a6b4bbf
--- /dev/null
+++ b/include/linux/platform_data/ad7303.h
@@ -0,0 +1,21 @@
1/*
2 * Analog Devices AD7303 DAC driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#ifndef __IIO_ADC_AD7303_H__
10#define __IIO_ADC_AD7303_H__
11
12/**
13 * struct ad7303_platform_data - AD7303 platform data
14 * @use_external_ref: If set to true use an external voltage reference connected
15 * to the REF pin, otherwise use the internal reference derived from Vdd.
16 */
17struct ad7303_platform_data {
18 bool use_external_ref;
19};
20
21#endif
diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
deleted file mode 100644
index 5c6c3939355f..000000000000
--- a/include/linux/platform_data/omap_ocp2scp.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * omap_ocp2scp.h -- ocp2scp header file
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __DRIVERS_OMAP_OCP2SCP_H
20#define __DRIVERS_OMAP_OCP2SCP_H
21
22struct omap_ocp2scp_dev {
23 const char *drv_name;
24 struct resource *res;
25};
26
27struct omap_ocp2scp_platform_data {
28 int dev_cnt;
29 struct omap_ocp2scp_dev **devices;
30};
31#endif /* __DRIVERS_OMAP_OCP2SCP_H */
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
index 85dcc709f7e9..1d1b6ef871f6 100644
--- a/include/linux/platform_data/usb3503.h
+++ b/include/linux/platform_data/usb3503.h
@@ -3,6 +3,10 @@
3 3
4#define USB3503_I2C_NAME "usb3503" 4#define USB3503_I2C_NAME "usb3503"
5 5
6#define USB3503_OFF_PORT1 (1 << 1)
7#define USB3503_OFF_PORT2 (1 << 2)
8#define USB3503_OFF_PORT3 (1 << 3)
9
6enum usb3503_mode { 10enum usb3503_mode {
7 USB3503_MODE_UNKNOWN, 11 USB3503_MODE_UNKNOWN,
8 USB3503_MODE_HUB, 12 USB3503_MODE_HUB,
@@ -11,6 +15,7 @@ enum usb3503_mode {
11 15
12struct usb3503_platform_data { 16struct usb3503_platform_data {
13 enum usb3503_mode initial_mode; 17 enum usb3503_mode initial_mode;
18 u8 port_off_mask;
14 int gpio_intn; 19 int gpio_intn;
15 int gpio_connect; 20 int gpio_connect;
16 int gpio_reset; 21 int gpio_reset;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9abf1db6aea6..cd46ee58b9dc 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -180,7 +180,13 @@ struct platform_driver {
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181}; 181};
182 182
183extern int platform_driver_register(struct platform_driver *); 183/*
184 * use a macro to avoid include chaining to get THIS_MODULE
185 */
186#define platform_driver_register(drv) \
187 __platform_driver_register(drv, THIS_MODULE)
188extern int __platform_driver_register(struct platform_driver *,
189 struct module *);
184extern void platform_driver_unregister(struct platform_driver *); 190extern void platform_driver_unregister(struct platform_driver *);
185 191
186/* non-hotpluggable platform devices may use this so that probe() and 192/* non-hotpluggable platform devices may use this so that probe() and
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 87a03c746f17..f5d4723cdb3d 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -33,9 +33,25 @@ do { \
33 preempt_schedule(); \ 33 preempt_schedule(); \
34} while (0) 34} while (0)
35 35
36#ifdef CONFIG_CONTEXT_TRACKING
37
38void preempt_schedule_context(void);
39
40#define preempt_check_resched_context() \
41do { \
42 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
43 preempt_schedule_context(); \
44} while (0)
45#else
46
47#define preempt_check_resched_context() preempt_check_resched()
48
49#endif /* CONFIG_CONTEXT_TRACKING */
50
36#else /* !CONFIG_PREEMPT */ 51#else /* !CONFIG_PREEMPT */
37 52
38#define preempt_check_resched() do { } while (0) 53#define preempt_check_resched() do { } while (0)
54#define preempt_check_resched_context() do { } while (0)
39 55
40#endif /* CONFIG_PREEMPT */ 56#endif /* CONFIG_PREEMPT */
41 57
@@ -88,7 +104,7 @@ do { \
88do { \ 104do { \
89 preempt_enable_no_resched_notrace(); \ 105 preempt_enable_no_resched_notrace(); \
90 barrier(); \ 106 barrier(); \
91 preempt_check_resched(); \ 107 preempt_check_resched_context(); \
92} while (0) 108} while (0)
93 109
94#else /* !CONFIG_PREEMPT_COUNT */ 110#else /* !CONFIG_PREEMPT_COUNT */
diff --git a/include/linux/sdb.h b/include/linux/sdb.h
new file mode 100644
index 000000000000..fbb76a46c8a5
--- /dev/null
+++ b/include/linux/sdb.h
@@ -0,0 +1,159 @@
1/*
2 * This is the official version 1.1 of sdb.h
3 */
4#ifndef __SDB_H__
5#define __SDB_H__
6#ifdef __KERNEL__
7#include <linux/types.h>
8#else
9#include <stdint.h>
10#endif
11
12/*
13 * All structures are 64 bytes long and are expected
14 * to live in an array, one for each interconnect.
15 * Most fields of the structures are shared among the
16 * various types, and most-specific fields are at the
17 * beginning (for alignment reasons, and to keep the
18 * magic number at the head of the interconnect record
19 */
20
21/* Product, 40 bytes at offset 24, 8-byte aligned
22 *
23 * device_id is vendor-assigned; version is device-specific,
24 * date is hex (e.g 0x20120501), name is UTF-8, blank-filled
25 * and not terminated with a 0 byte.
26 */
27struct sdb_product {
28 uint64_t vendor_id; /* 0x18..0x1f */
29 uint32_t device_id; /* 0x20..0x23 */
30 uint32_t version; /* 0x24..0x27 */
31 uint32_t date; /* 0x28..0x2b */
32 uint8_t name[19]; /* 0x2c..0x3e */
33 uint8_t record_type; /* 0x3f */
34};
35
36/*
37 * Component, 56 bytes at offset 8, 8-byte aligned
38 *
39 * The address range is first to last, inclusive
40 * (for example 0x100000 - 0x10ffff)
41 */
42struct sdb_component {
43 uint64_t addr_first; /* 0x08..0x0f */
44 uint64_t addr_last; /* 0x10..0x17 */
45 struct sdb_product product; /* 0x18..0x3f */
46};
47
48/* Type of the SDB record */
49enum sdb_record_type {
50 sdb_type_interconnect = 0x00,
51 sdb_type_device = 0x01,
52 sdb_type_bridge = 0x02,
53 sdb_type_integration = 0x80,
54 sdb_type_repo_url = 0x81,
55 sdb_type_synthesis = 0x82,
56 sdb_type_empty = 0xFF,
57};
58
59/* Type 0: interconnect (first of the array)
60 *
61 * sdb_records is the length of the table including this first
62 * record, version is 1. The bus type is enumerated later.
63 */
64#define SDB_MAGIC 0x5344422d /* "SDB-" */
65struct sdb_interconnect {
66 uint32_t sdb_magic; /* 0x00-0x03 */
67 uint16_t sdb_records; /* 0x04-0x05 */
68 uint8_t sdb_version; /* 0x06 */
69 uint8_t sdb_bus_type; /* 0x07 */
70 struct sdb_component sdb_component; /* 0x08-0x3f */
71};
72
73/* Type 1: device
74 *
75 * class is 0 for "custom device", other values are
76 * to be standardized; ABI version is for the driver,
77 * bus-specific bits are defined by each bus (see below)
78 */
79struct sdb_device {
80 uint16_t abi_class; /* 0x00-0x01 */
81 uint8_t abi_ver_major; /* 0x02 */
82 uint8_t abi_ver_minor; /* 0x03 */
83 uint32_t bus_specific; /* 0x04-0x07 */
84 struct sdb_component sdb_component; /* 0x08-0x3f */
85};
86
87/* Type 2: bridge
88 *
89 * child is the address of the nested SDB table
90 */
91struct sdb_bridge {
92 uint64_t sdb_child; /* 0x00-0x07 */
93 struct sdb_component sdb_component; /* 0x08-0x3f */
94};
95
96/* Type 0x80: integration
97 *
98 * all types with bit 7 set are meta-information, so
99 * software can ignore the types it doesn't know. Here we
100 * just provide product information for an aggregate device
101 */
102struct sdb_integration {
103 uint8_t reserved[24]; /* 0x00-0x17 */
104 struct sdb_product product; /* 0x08-0x3f */
105};
106
107/* Type 0x81: Top module repository url
108 *
109 * again, an informative field that software can ignore
110 */
111struct sdb_repo_url {
112 uint8_t repo_url[63]; /* 0x00-0x3e */
113 uint8_t record_type; /* 0x3f */
114};
115
116/* Type 0x82: Synthesis tool information
117 *
118 * this informative record
119 */
120struct sdb_synthesis {
121 uint8_t syn_name[16]; /* 0x00-0x0f */
122 uint8_t commit_id[16]; /* 0x10-0x1f */
123 uint8_t tool_name[8]; /* 0x20-0x27 */
124 uint32_t tool_version; /* 0x28-0x2b */
125 uint32_t date; /* 0x2c-0x2f */
126 uint8_t user_name[15]; /* 0x30-0x3e */
127 uint8_t record_type; /* 0x3f */
128};
129
130/* Type 0xff: empty
131 *
132 * this allows keeping empty slots during development,
133 * so they can be filled later with minimal efforts and
134 * no misleading description is ever shipped -- hopefully.
135 * It can also be used to pad a table to a desired length.
136 */
137struct sdb_empty {
138 uint8_t reserved[63]; /* 0x00-0x3e */
139 uint8_t record_type; /* 0x3f */
140};
141
142/* The type of bus, for bus-specific flags */
143enum sdb_bus_type {
144 sdb_wishbone = 0x00,
145 sdb_data = 0x01,
146};
147
148#define SDB_WB_WIDTH_MASK 0x0f
149#define SDB_WB_ACCESS8 0x01
150#define SDB_WB_ACCESS16 0x02
151#define SDB_WB_ACCESS32 0x04
152#define SDB_WB_ACCESS64 0x08
153#define SDB_WB_LITTLE_ENDIAN 0x80
154
155#define SDB_DATA_READ 0x04
156#define SDB_DATA_WRITE 0x02
157#define SDB_DATA_EXEC 0x01
158
159#endif /* __SDB_H__ */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 87d4bbc773fc..b98291ac7f14 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -31,6 +31,13 @@
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <uapi/linux/serial_core.h> 32#include <uapi/linux/serial_core.h>
33 33
34#ifdef CONFIG_SERIAL_CORE_CONSOLE
35#define uart_console(port) \
36 ((port)->cons && (port)->cons->index == (port)->line)
37#else
38#define uart_console(port) (0)
39#endif
40
34struct uart_port; 41struct uart_port;
35struct serial_struct; 42struct serial_struct;
36struct device; 43struct device;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9c676eae3968..dec1748cd002 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -627,6 +627,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
627} 627}
628 628
629extern void kfree_skb(struct sk_buff *skb); 629extern void kfree_skb(struct sk_buff *skb);
630extern void kfree_skb_list(struct sk_buff *segs);
630extern void skb_tx_error(struct sk_buff *skb); 631extern void skb_tx_error(struct sk_buff *skb);
631extern void consume_skb(struct sk_buff *skb); 632extern void consume_skb(struct sk_buff *skb);
632extern void __kfree_skb(struct sk_buff *skb); 633extern void __kfree_skb(struct sk_buff *skb);
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 09a545a7dfa3..74575cbf2d6f 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -35,6 +35,7 @@ struct splice_desc {
35 void *data; /* cookie */ 35 void *data; /* cookie */
36 } u; 36 } u;
37 loff_t pos; /* file position */ 37 loff_t pos; /* file position */
38 loff_t *opos; /* sendfile: output position */
38 size_t num_spliced; /* number of bytes already spliced */ 39 size_t num_spliced; /* number of bytes already spliced */
39 bool need_wakeup; /* need to wake up writer */ 40 bool need_wakeup; /* need to wake up writer */
40}; 41};
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8780bd2a272a..01ac30efd6a6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -272,7 +272,6 @@ struct tty_struct {
272#define N_TTY_BUF_SIZE 4096 272#define N_TTY_BUF_SIZE 4096
273 273
274 unsigned char closing:1; 274 unsigned char closing:1;
275 unsigned short minimum_to_wake;
276 unsigned char *write_buf; 275 unsigned char *write_buf;
277 int write_cnt; 276 int write_cnt;
278 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
@@ -309,8 +308,6 @@ struct tty_file_private {
309#define TTY_LDISC 9 /* Line discipline attached */ 308#define TTY_LDISC 9 /* Line discipline attached */
310#define TTY_LDISC_CHANGING 10 /* Line discipline changing */ 309#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
311#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 310#define TTY_LDISC_OPEN 11 /* Line discipline is open */
312#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
313#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
314#define TTY_PTY_LOCK 16 /* pty private */ 311#define TTY_PTY_LOCK 16 /* pty private */
315#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 312#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
316#define TTY_HUPPED 18 /* Post driver->hangup() */ 313#define TTY_HUPPED 18 /* Post driver->hangup() */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 58390c73df8b..a1b048999821 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -100,6 +100,11 @@
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*fasync)(struct tty_struct *, int on)
104 *
105 * Notify line discipline when signal-driven I/O is enabled or
106 * disabled.
107 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status) 108 * void (*dcd_change)(struct tty_struct *tty, unsigned int status)
104 * 109 *
105 * Tells the discipline that the DCD pin has changed its status. 110 * Tells the discipline that the DCD pin has changed its status.
@@ -110,6 +115,52 @@
110#include <linux/wait.h> 115#include <linux/wait.h>
111#include <linux/wait.h> 116#include <linux/wait.h>
112 117
118
119/*
120 * the semaphore definition
121 */
122struct ld_semaphore {
123 long count;
124 raw_spinlock_t wait_lock;
125 unsigned int wait_readers;
126 struct list_head read_wait;
127 struct list_head write_wait;
128#ifdef CONFIG_DEBUG_LOCK_ALLOC
129 struct lockdep_map dep_map;
130#endif
131};
132
133extern void __init_ldsem(struct ld_semaphore *sem, const char *name,
134 struct lock_class_key *key);
135
136#define init_ldsem(sem) \
137do { \
138 static struct lock_class_key __key; \
139 \
140 __init_ldsem((sem), #sem, &__key); \
141} while (0)
142
143
144extern int ldsem_down_read(struct ld_semaphore *sem, long timeout);
145extern int ldsem_down_read_trylock(struct ld_semaphore *sem);
146extern int ldsem_down_write(struct ld_semaphore *sem, long timeout);
147extern int ldsem_down_write_trylock(struct ld_semaphore *sem);
148extern void ldsem_up_read(struct ld_semaphore *sem);
149extern void ldsem_up_write(struct ld_semaphore *sem);
150
151#ifdef CONFIG_DEBUG_LOCK_ALLOC
152extern int ldsem_down_read_nested(struct ld_semaphore *sem, int subclass,
153 long timeout);
154extern int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
155 long timeout);
156#else
157# define ldsem_down_read_nested(sem, subclass, timeout) \
158 ldsem_down_read(sem, timeout)
159# define ldsem_down_write_nested(sem, subclass, timeout) \
160 ldsem_down_write(sem, timeout)
161#endif
162
163
113struct tty_ldisc_ops { 164struct tty_ldisc_ops {
114 int magic; 165 int magic;
115 char *name; 166 char *name;
@@ -143,6 +194,7 @@ struct tty_ldisc_ops {
143 char *fp, int count); 194 char *fp, int count);
144 void (*write_wakeup)(struct tty_struct *); 195 void (*write_wakeup)(struct tty_struct *);
145 void (*dcd_change)(struct tty_struct *, unsigned int); 196 void (*dcd_change)(struct tty_struct *, unsigned int);
197 void (*fasync)(struct tty_struct *tty, int on);
146 198
147 struct module *owner; 199 struct module *owner;
148 200
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a0bee5a28d1a..a232b7ece1f6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -394,6 +394,22 @@ enum usb_port_connect_type {
394}; 394};
395 395
396/* 396/*
397 * USB 2.0 Link Power Management (LPM) parameters.
398 */
399struct usb2_lpm_parameters {
400 /* Best effort service latency indicate how long the host will drive
401 * resume on an exit from L1.
402 */
403 unsigned int besl;
404
405 /* Timeout value in microseconds for the L1 inactivity (LPM) timer.
406 * When the timer counts to zero, the parent hub will initiate a LPM
407 * transition to L1.
408 */
409 int timeout;
410};
411
412/*
397 * USB 3.0 Link Power Management (LPM) parameters. 413 * USB 3.0 Link Power Management (LPM) parameters.
398 * 414 *
399 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit. 415 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
@@ -468,6 +484,7 @@ struct usb3_lpm_parameters {
468 * @wusb: device is Wireless USB 484 * @wusb: device is Wireless USB
469 * @lpm_capable: device supports LPM 485 * @lpm_capable: device supports LPM
470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 486 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
487 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 488 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
472 * @usb3_lpm_enabled: USB3 hardware LPM enabled 489 * @usb3_lpm_enabled: USB3 hardware LPM enabled
473 * @string_langid: language ID for strings 490 * @string_langid: language ID for strings
@@ -487,6 +504,7 @@ struct usb3_lpm_parameters {
487 * specific data for the device. 504 * specific data for the device.
488 * @slot_id: Slot ID assigned by xHCI 505 * @slot_id: Slot ID assigned by xHCI
489 * @removable: Device can be physically removed from this port 506 * @removable: Device can be physically removed from this port
507 * @l1_params: best effor service latency for USB2 L1 LPM state, and L1 timeout.
490 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 508 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
491 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 509 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
492 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm() 510 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
@@ -538,6 +556,7 @@ struct usb_device {
538 unsigned wusb:1; 556 unsigned wusb:1;
539 unsigned lpm_capable:1; 557 unsigned lpm_capable:1;
540 unsigned usb2_hw_lpm_capable:1; 558 unsigned usb2_hw_lpm_capable:1;
559 unsigned usb2_hw_lpm_besl_capable:1;
541 unsigned usb2_hw_lpm_enabled:1; 560 unsigned usb2_hw_lpm_enabled:1;
542 unsigned usb3_lpm_enabled:1; 561 unsigned usb3_lpm_enabled:1;
543 int string_langid; 562 int string_langid;
@@ -566,6 +585,7 @@ struct usb_device {
566 struct wusb_dev *wusb_dev; 585 struct wusb_dev *wusb_dev;
567 int slot_id; 586 int slot_id;
568 enum usb_device_removable removable; 587 enum usb_device_removable removable;
588 struct usb2_lpm_parameters l1_params;
569 struct usb3_lpm_parameters u1_params; 589 struct usb3_lpm_parameters u1_params;
570 struct usb3_lpm_parameters u2_params; 590 struct usb3_lpm_parameters u2_params;
571 unsigned lpm_disable_count; 591 unsigned lpm_disable_count;
@@ -717,6 +737,7 @@ const struct usb_device_id *usb_match_id(struct usb_interface *interface,
717extern int usb_match_one_id(struct usb_interface *interface, 737extern int usb_match_one_id(struct usb_interface *interface,
718 const struct usb_device_id *id); 738 const struct usb_device_id *id);
719 739
740extern int usb_for_each_dev(void *data, int (*fn)(struct usb_device *, void *));
720extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 741extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
721 int minor); 742 int minor);
722extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, 743extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 544825dde823..25629948c842 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -7,32 +7,33 @@
7 7
8#include <linux/usb/otg.h> 8#include <linux/usb/otg.h>
9 9
10struct ci13xxx; 10struct ci_hdrc;
11struct ci13xxx_platform_data { 11struct ci_hdrc_platform_data {
12 const char *name; 12 const char *name;
13 /* offset of the capability registers */ 13 /* offset of the capability registers */
14 uintptr_t capoffset; 14 uintptr_t capoffset;
15 unsigned power_budget; 15 unsigned power_budget;
16 struct usb_phy *phy; 16 struct usb_phy *phy;
17 enum usb_phy_interface phy_mode;
17 unsigned long flags; 18 unsigned long flags;
18#define CI13XXX_REGS_SHARED BIT(0) 19#define CI_HDRC_REGS_SHARED BIT(0)
19#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) 20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
20#define CI13XXX_PULLUP_ON_VBUS BIT(2) 21#define CI_HDRC_PULLUP_ON_VBUS BIT(2)
21#define CI13XXX_DISABLE_STREAMING BIT(3) 22#define CI_HDRC_DISABLE_STREAMING BIT(3)
22 23 enum usb_dr_mode dr_mode;
23#define CI13XXX_CONTROLLER_RESET_EVENT 0 24#define CI_HDRC_CONTROLLER_RESET_EVENT 0
24#define CI13XXX_CONTROLLER_STOPPED_EVENT 1 25#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
25 void (*notify_event) (struct ci13xxx *ci, unsigned event); 26 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
26}; 27};
27 28
28/* Default offset of capability registers */ 29/* Default offset of capability registers */
29#define DEF_CAPOFFSET 0x100 30#define DEF_CAPOFFSET 0x100
30 31
31/* Add ci13xxx device */ 32/* Add ci hdrc device */
32struct platform_device *ci13xxx_add_device(struct device *dev, 33struct platform_device *ci_hdrc_add_device(struct device *dev,
33 struct resource *res, int nres, 34 struct resource *res, int nres,
34 struct ci13xxx_platform_data *platdata); 35 struct ci_hdrc_platform_data *platdata);
35/* Remove ci13xxx device */ 36/* Remove ci hdrc device */
36void ci13xxx_remove_device(struct platform_device *pdev); 37void ci_hdrc_remove_device(struct platform_device *pdev);
37 38
38#endif 39#endif
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index f5f5c7dfda90..1e88377e22f4 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -218,6 +218,7 @@ struct hc_driver {
218#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ 218#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
219#define HCD_USB11 0x0010 /* USB 1.1 */ 219#define HCD_USB11 0x0010 /* USB 1.1 */
220#define HCD_USB2 0x0020 /* USB 2.0 */ 220#define HCD_USB2 0x0020 /* USB 2.0 */
221#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
221#define HCD_USB3 0x0040 /* USB 3.0 */ 222#define HCD_USB3 0x0040 /* USB 3.0 */
222#define HCD_MASK 0x0070 223#define HCD_MASK 0x0070
223 224
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
new file mode 100644
index 000000000000..a0ef405368b8
--- /dev/null
+++ b/include/linux/usb/of.h
@@ -0,0 +1,32 @@
1/*
2 * OF helpers for usb devices.
3 *
4 * This file is released under the GPLv2
5 */
6
7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H
9
10#include <linux/usb/otg.h>
11#include <linux/usb/phy.h>
12
13#if IS_ENABLED(CONFIG_OF)
14enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
15#else
16static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
17{
18 return USB_DR_MODE_UNKNOWN;
19}
20#endif
21
22#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_PHY)
23enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
24#else
25static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
26{
27 return USBPHY_INTERFACE_MODE_UNKNOWN;
28}
29
30#endif
31
32#endif /* __LINUX_USB_OF_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 291e01ba32e5..154332b7c8c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -92,4 +92,11 @@ otg_start_srp(struct usb_otg *otg)
92/* for OTG controller drivers (and maybe other stuff) */ 92/* for OTG controller drivers (and maybe other stuff) */
93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 93extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
94 94
95enum usb_dr_mode {
96 USB_DR_MODE_UNKNOWN,
97 USB_DR_MODE_HOST,
98 USB_DR_MODE_PERIPHERAL,
99 USB_DR_MODE_OTG,
100};
101
95#endif /* __LINUX_USB_OTG_H */ 102#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6b5978f57633..44036808bf0f 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -12,6 +12,15 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h> 13#include <linux/usb.h>
14 14
15enum usb_phy_interface {
16 USBPHY_INTERFACE_MODE_UNKNOWN,
17 USBPHY_INTERFACE_MODE_UTMI,
18 USBPHY_INTERFACE_MODE_UTMIW,
19 USBPHY_INTERFACE_MODE_ULPI,
20 USBPHY_INTERFACE_MODE_SERIAL,
21 USBPHY_INTERFACE_MODE_HSIC,
22};
23
15enum usb_phy_events { 24enum usb_phy_events {
16 USB_EVENT_NONE, /* no events or cable disconnected */ 25 USB_EVENT_NONE, /* no events or cable disconnected */
17 USB_EVENT_VBUS, /* vbus valid event */ 26 USB_EVENT_VBUS, /* vbus valid event */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 302ddf55d2da..d528b8045150 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -19,10 +19,6 @@
19#include <linux/sysrq.h> 19#include <linux/sysrq.h>
20#include <linux/kfifo.h> 20#include <linux/kfifo.h>
21 21
22#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
23#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
24#define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */
25
26/* The maximum number of ports one device can grab at once */ 22/* The maximum number of ports one device can grab at once */
27#define MAX_NUM_PORTS 8 23#define MAX_NUM_PORTS 8
28 24
@@ -37,7 +33,8 @@
37 * @serial: pointer back to the struct usb_serial owner of this port. 33 * @serial: pointer back to the struct usb_serial owner of this port.
38 * @port: pointer to the corresponding tty_port for this port. 34 * @port: pointer to the corresponding tty_port for this port.
39 * @lock: spinlock to grab when updating portions of this structure. 35 * @lock: spinlock to grab when updating portions of this structure.
40 * @number: the number of the port (the minor number). 36 * @minor: the minor number of the port
37 * @port_number: the struct usb_serial port number of this port (starts at 0)
41 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 38 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
42 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 39 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
43 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe 40 * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe
@@ -80,7 +77,8 @@ struct usb_serial_port {
80 struct usb_serial *serial; 77 struct usb_serial *serial;
81 struct tty_port port; 78 struct tty_port port;
82 spinlock_t lock; 79 spinlock_t lock;
83 unsigned char number; 80 u32 minor;
81 u8 port_number;
84 82
85 unsigned char *interrupt_in_buffer; 83 unsigned char *interrupt_in_buffer;
86 struct urb *interrupt_in_urb; 84 struct urb *interrupt_in_urb;
@@ -140,7 +138,6 @@ static inline void usb_set_serial_port_data(struct usb_serial_port *port,
140 * @dev: pointer to the struct usb_device for this device 138 * @dev: pointer to the struct usb_device for this device
141 * @type: pointer to the struct usb_serial_driver for this device 139 * @type: pointer to the struct usb_serial_driver for this device
142 * @interface: pointer to the struct usb_interface for this device 140 * @interface: pointer to the struct usb_interface for this device
143 * @minor: the starting minor number for this device
144 * @num_ports: the number of ports this device has 141 * @num_ports: the number of ports this device has
145 * @num_interrupt_in: number of interrupt in endpoints we have 142 * @num_interrupt_in: number of interrupt in endpoints we have
146 * @num_interrupt_out: number of interrupt out endpoints we have 143 * @num_interrupt_out: number of interrupt out endpoints we have
@@ -159,7 +156,7 @@ struct usb_serial {
159 unsigned char disconnected:1; 156 unsigned char disconnected:1;
160 unsigned char suspending:1; 157 unsigned char suspending:1;
161 unsigned char attached:1; 158 unsigned char attached:1;
162 unsigned char minor; 159 unsigned char minors_reserved:1;
163 unsigned char num_ports; 160 unsigned char num_ports;
164 unsigned char num_port_pointers; 161 unsigned char num_port_pointers;
165 char num_interrupt_in; 162 char num_interrupt_in;
@@ -319,7 +316,7 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
319#endif 316#endif
320 317
321/* Functions needed by other parts of the usbserial core */ 318/* Functions needed by other parts of the usbserial core */
322extern struct usb_serial *usb_serial_get_by_index(unsigned int minor); 319extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
323extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
324extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
325 struct usb_serial_port *port); 322 struct usb_serial_port *port);
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 1b7519a8c0bf..d2ca919a5b73 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -42,6 +42,7 @@ enum tegra_usb_phy_port_speed {
42enum tegra_usb_phy_mode { 42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE, 43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST, 44 TEGRA_USB_PHY_MODE_HOST,
45 TEGRA_USB_PHY_MODE_OTG,
45}; 46};
46 47
47struct tegra_xtal_freq; 48struct tegra_xtal_freq;
@@ -61,14 +62,10 @@ struct tegra_usb_phy {
61 struct device *dev; 62 struct device *dev;
62 bool is_legacy_phy; 63 bool is_legacy_phy;
63 bool is_ulpi_phy; 64 bool is_ulpi_phy;
64 void (*set_pts)(struct usb_phy *x, u8 pts_val); 65 int reset_gpio;
65 void (*set_phcd)(struct usb_phy *x, bool enable);
66}; 66};
67 67
68struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 68struct usb_phy *tegra_usb_get_phy(struct device_node *dn);
69 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode,
70 void (*set_pts)(struct usb_phy *x, u8 pts_val),
71 void (*set_phcd)(struct usb_phy *x, bool enable));
72 69
73void tegra_usb_phy_preresume(struct usb_phy *phy); 70void tegra_usb_phy_preresume(struct usb_phy *phy);
74 71
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index f9dec37f617b..6be985b2a434 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -92,11 +92,20 @@ struct usb_rpipe_descriptor {
92 __le16 wRPipeIndex; 92 __le16 wRPipeIndex;
93 __le16 wRequests; 93 __le16 wRequests;
94 __le16 wBlocks; /* rw if 0 */ 94 __le16 wBlocks; /* rw if 0 */
95 __le16 wMaxPacketSize; /* rw? */ 95 __le16 wMaxPacketSize; /* rw */
96 u8 bHSHubAddress; /* reserved: 0 */ 96 union {
97 u8 bHSHubPort; /* ??? FIXME ??? */ 97 u8 dwa_bHSHubAddress; /* rw: DWA. */
98 u8 hwa_bMaxBurst; /* rw: HWA. */
99 };
100 union {
101 u8 dwa_bHSHubPort; /* rw: DWA. */
102 u8 hwa_bDeviceInfoIndex; /* rw: HWA. */
103 };
98 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */ 104 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
99 u8 bDeviceAddress; /* rw: Target device address */ 105 union {
106 u8 dwa_bDeviceAddress; /* rw: DWA Target device address. */
107 u8 hwa_reserved; /* rw: HWA. */
108 };
100 u8 bEndpointAddress; /* rw: Target EP address */ 109 u8 bEndpointAddress; /* rw: Target EP address */
101 u8 bDataSequence; /* ro: Current Data sequence */ 110 u8 bDataSequence; /* ro: Current Data sequence */
102 __le32 dwCurrentWindow; /* ro */ 111 __le32 dwCurrentWindow; /* ro */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 0d33fca48774..8d7634247fb4 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -133,8 +133,6 @@ void change_console(struct vc_data *new_vc);
133void reset_vc(struct vc_data *vc); 133void reset_vc(struct vc_data *vc);
134extern int do_unbind_con_driver(const struct consw *csw, int first, int last, 134extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
135 int deflt); 135 int deflt);
136extern int unbind_con_driver(const struct consw *csw, int first, int last,
137 int deflt);
138int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
139 137
140static inline bool vt_force_oops_output(struct vc_data *vc) 138static inline bool vt_force_oops_output(struct vc_data *vc)
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index 71a5782d8c59..b1dd2db80076 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -34,7 +34,7 @@ static inline void vtime_user_exit(struct task_struct *tsk)
34} 34}
35extern void vtime_guest_enter(struct task_struct *tsk); 35extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk); 36extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk); 37extern void vtime_init_idle(struct task_struct *tsk, int cpu);
38#else 38#else
39static inline void vtime_account_irq_exit(struct task_struct *tsk) 39static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{ 40{
@@ -45,7 +45,7 @@ static inline void vtime_user_enter(struct task_struct *tsk) { }
45static inline void vtime_user_exit(struct task_struct *tsk) { } 45static inline void vtime_user_exit(struct task_struct *tsk) { }
46static inline void vtime_guest_enter(struct task_struct *tsk) { } 46static inline void vtime_guest_enter(struct task_struct *tsk) { }
47static inline void vtime_guest_exit(struct task_struct *tsk) { } 47static inline void vtime_guest_exit(struct task_struct *tsk) { }
48static inline void vtime_init_idle(struct task_struct *tsk) { } 48static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
49#endif 49#endif
50 50
51#ifdef CONFIG_IRQ_TIME_ACCOUNTING 51#ifdef CONFIG_IRQ_TIME_ACCOUNTING
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1133695eb067..f487a4750b7f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -23,6 +23,7 @@ struct __wait_queue {
23struct wait_bit_key { 23struct wait_bit_key {
24 void *flags; 24 void *flags;
25 int bit_nr; 25 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1
26}; 27};
27 28
28struct wait_bit_queue { 29struct wait_bit_queue {
@@ -60,6 +61,9 @@ struct task_struct;
60#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ 61#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
61 { .flags = word, .bit_nr = bit, } 62 { .flags = word, .bit_nr = bit, }
62 63
64#define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \
65 { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
66
63extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *); 67extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct lock_class_key *);
64 68
65#define init_waitqueue_head(q) \ 69#define init_waitqueue_head(q) \
@@ -146,8 +150,10 @@ void __wake_up_bit(wait_queue_head_t *, void *, int);
146int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 150int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
147int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 151int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
148void wake_up_bit(void *, int); 152void wake_up_bit(void *, int);
153void wake_up_atomic_t(atomic_t *);
149int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned); 154int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
150int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned); 155int out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned);
156int out_of_line_wait_on_atomic_t(atomic_t *, int (*)(atomic_t *), unsigned);
151wait_queue_head_t *bit_waitqueue(void *, int); 157wait_queue_head_t *bit_waitqueue(void *, int);
152 158
153#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 159#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
@@ -902,5 +908,23 @@ static inline int wait_on_bit_lock(void *word, int bit,
902 return 0; 908 return 0;
903 return out_of_line_wait_on_bit_lock(word, bit, action, mode); 909 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
904} 910}
911
912/**
913 * wait_on_atomic_t - Wait for an atomic_t to become 0
914 * @val: The atomic value being waited on, a kernel virtual address
915 * @action: the function used to sleep, which may take special actions
916 * @mode: the task state to sleep in
917 *
918 * Wait for an atomic_t to become 0. We abuse the bit-wait waitqueue table for
919 * the purpose of getting a waitqueue, but we set the key to a bit number
920 * outside of the target 'word'.
921 */
922static inline
923int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
924{
925 if (atomic_read(val) == 0)
926 return 0;
927 return out_of_line_wait_on_atomic_t(val, action, mode);
928}
905 929
906#endif 930#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 579a5007c696..abfe11787af3 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -78,6 +78,7 @@ struct writeback_control {
78 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 78 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
79 unsigned for_reclaim:1; /* Invoked from the page allocator */ 79 unsigned for_reclaim:1; /* Invoked from the page allocator */
80 unsigned range_cyclic:1; /* range_start is cyclic */ 80 unsigned range_cyclic:1; /* range_start is cyclic */
81 unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */
81}; 82};
82 83
83/* 84/*