aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2013-03-27 09:02:27 -0400
committerJiri Kosina <jkosina@suse.cz>2013-03-27 09:02:27 -0400
commitb3fecf8cab6441527ab057c99d7e6a6d7f6713e5 (patch)
treed327499840a25fbd1f81e49d5cb6769bdad382f5 /include/linux
parent5b62efd8250d6a751c31d1972e96bfccd19c4679 (diff)
parent83a44ac8bf4a8e6cbbf0c00ff281a482778f708a (diff)
Merge branch 'for-3.10/hid-driver-transport-cleanups' into for-3.10/mt-hybrid-finger-pen
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi_gpio.h4
-rw-r--r--include/linux/amba/pl080.h146
-rw-r--r--include/linux/bcm47xx_wdt.h9
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h1
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/bootmem.h6
-rw-r--r--include/linux/btrfs.h6
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/ceph/ceph_features.h38
-rw-r--r--include/linux/ceph/ceph_fs.h32
-rw-r--r--include/linux/ceph/decode.h29
-rw-r--r--include/linux/ceph/libceph.h16
-rw-r--r--include/linux/ceph/mdsmap.h4
-rw-r--r--include/linux/ceph/messenger.h2
-rw-r--r--include/linux/ceph/osd_client.h74
-rw-r--r--include/linux/ceph/osdmap.h30
-rw-r--r--include/linux/ceph/rados.h158
-rw-r--r--include/linux/coda_psdev.h2
-rw-r--r--include/linux/compaction.h5
-rw-r--r--include/linux/compat.h53
-rw-r--r--include/linux/completion.h3
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/crush/crush.h2
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/debug_locks.h4
-rw-r--r--include/linux/device-mapper.h49
-rw-r--r--include/linux/dm-kcopyd.h25
-rw-r--r--include/linux/dma-buf.h4
-rw-r--r--include/linux/dmaengine.h64
-rw-r--r--include/linux/dw_dmac.h40
-rw-r--r--include/linux/ecryptfs.h12
-rw-r--r--include/linux/edac.h79
-rw-r--r--include/linux/elevator.h5
-rw-r--r--include/linux/elf.h4
-rw-r--r--include/linux/eventfd.h2
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/firmware-map.h6
-rw-r--r--include/linux/freezer.h3
-rw-r--r--include/linux/fs.h15
-rw-r--r--include/linux/fs_struct.h4
-rw-r--r--include/linux/fsl/bestcomm/ata.h30
-rw-r--r--include/linux/fsl/bestcomm/bestcomm.h213
-rw-r--r--include/linux/fsl/bestcomm/bestcomm_priv.h350
-rw-r--r--include/linux/fsl/bestcomm/fec.h61
-rw-r--r--include/linux/fsl/bestcomm/gen_bd.h53
-rw-r--r--include/linux/fsl/bestcomm/sram.h54
-rw-r--r--include/linux/fsnotify.h2
-rw-r--r--include/linux/genhd.h10
-rw-r--r--include/linux/gpio.h28
-rw-r--r--include/linux/hardirq.h2
-rw-r--r--include/linux/hashtable.h40
-rw-r--r--include/linux/hdmi.h231
-rw-r--r--include/linux/hid.h53
-rw-r--r--include/linux/highmem.h6
-rw-r--r--include/linux/hsi/hsi.h6
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/i2c/twl.h84
-rw-r--r--include/linux/idr.h172
-rw-r--r--include/linux/if_team.h6
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/iommu.h30
-rw-r--r--include/linux/ipmi.h4
-rw-r--r--include/linux/irqchip/metag-ext.h33
-rw-r--r--include/linux/irqchip/metag.h24
-rw-r--r--include/linux/jbd2.h44
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kexec.h3
-rw-r--r--include/linux/ksm.h18
-rw-r--r--include/linux/kvm_host.h30
-rw-r--r--include/linux/leds-lp5521.h73
-rw-r--r--include/linux/leds-lp5523.h49
-rw-r--r--include/linux/leds_pwm.h2
-rw-r--r--include/linux/libata.h3
-rw-r--r--include/linux/list.h49
-rw-r--r--include/linux/llist.h25
-rw-r--r--include/linux/lockd/lockd.h5
-rw-r--r--include/linux/lockdep.h2
-rw-r--r--include/linux/lzo.h15
-rw-r--r--include/linux/memblock.h1
-rw-r--r--include/linux/memcontrol.h7
-rw-r--r--include/linux/memory_hotplug.h20
-rw-r--r--include/linux/mfd/88pm80x.h2
-rw-r--r--include/linux/mfd/abx500.h2
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h5
-rw-r--r--include/linux/mfd/abx500/ab8500.h12
-rw-r--r--include/linux/mfd/arizona/pdata.h12
-rw-r--r--include/linux/mfd/arizona/registers.h16
-rw-r--r--include/linux/mfd/dbx500-prcmu.h12
-rw-r--r--include/linux/mfd/lp8788.h24
-rw-r--r--include/linux/mfd/max8925.h3
-rw-r--r--include/linux/mfd/palmas.h52
-rw-r--r--include/linux/mfd/rtsx_pci.h9
-rw-r--r--include/linux/mfd/tmio.h18
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/mlx4/device.h22
-rw-r--r--include/linux/mlx4/qp.h19
-rw-r--r--include/linux/mm.h163
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mman.h4
-rw-r--r--include/linux/mmc/card.h22
-rw-r--r--include/linux/mmc/core.h7
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h61
-rw-r--r--include/linux/mmc/mmc.h15
-rw-r--r--include/linux/mmc/sdhci.h1
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h2
-rw-r--r--include/linux/mmzone.h58
-rw-r--r--include/linux/mod_devicetable.h58
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mtd/map.h9
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h4
-rw-r--r--include/linux/nfs4.h6
-rw-r--r--include/linux/nfs_idmap.h9
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/of_dma.h74
-rw-r--r--include/linux/opp.h18
-rw-r--r--include/linux/page-flags-layout.h88
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/page-isolation.h19
-rw-r--r--include/linux/path.h4
-rw-r--r--include/linux/pci.h15
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pid.h3
-rw-r--r--include/linux/platform_data/dma-ste-dma40.h13
-rw-r--r--include/linux/platform_data/elm.h54
-rw-r--r--include/linux/platform_data/exynos_thermal.h3
-rw-r--r--include/linux/platform_data/leds-lp55xx.h87
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/mmc-sdhci-tegra.h28
-rw-r--r--include/linux/platform_data/sh_ipmmu.h18
-rw-r--r--include/linux/platform_data/usb-omap.h1
-rw-r--r--include/linux/platform_data/ux500_wdt.h19
-rw-r--r--include/linux/pm.h1
-rw-r--r--include/linux/pm_runtime.h3
-rw-r--r--include/linux/pwm.h30
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/rculist.h56
-rw-r--r--include/linux/regulator/driver.h2
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/scatterlist.h41
-rw-r--r--include/linux/sched.h40
-rw-r--r--include/linux/sched/rt.h6
-rw-r--r--include/linux/sched/sysctl.h6
-rw-r--r--include/linux/seqlock.h193
-rw-r--r--include/linux/signal.h52
-rw-r--r--include/linux/smpboot.h4
-rw-r--r--include/linux/stmp3xxx_rtc_wdt.h15
-rw-r--r--include/linux/sunrpc/addr.h170
-rw-r--r--include/linux/sunrpc/auth.h7
-rw-r--r--include/linux/sunrpc/cache.h10
-rw-r--r--include/linux/sunrpc/clnt.h153
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/svcauth.h4
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/swap.h49
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h25
-rw-r--r--include/linux/thermal.h10
-rw-r--r--include/linux/user_namespace.h10
-rw-r--r--include/linux/vexpress.h8
-rw-r--r--include/linux/virtio.h11
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmstat.h2
-rw-r--r--include/linux/vt_kern.h3
-rw-r--r--include/linux/watchdog.h9
-rw-r--r--include/linux/writeback.h6
170 files changed, 3549 insertions, 1331 deletions
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
index 91615a389b65..b76ebd08ff8e 100644
--- a/include/linux/acpi_gpio.h
+++ b/include/linux/acpi_gpio.h
@@ -2,10 +2,12 @@
2#define _LINUX_ACPI_GPIO_H_ 2#define _LINUX_ACPI_GPIO_H_
3 3
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/gpio.h>
5 6
6#ifdef CONFIG_GPIO_ACPI 7#ifdef CONFIG_GPIO_ACPI
7 8
8int acpi_get_gpio(char *path, int pin); 9int acpi_get_gpio(char *path, int pin);
10void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
9 11
10#else /* CONFIG_GPIO_ACPI */ 12#else /* CONFIG_GPIO_ACPI */
11 13
@@ -14,6 +16,8 @@ static inline int acpi_get_gpio(char *path, int pin)
14 return -ENODEV; 16 return -ENODEV;
15} 17}
16 18
19static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
20
17#endif /* CONFIG_GPIO_ACPI */ 21#endif /* CONFIG_GPIO_ACPI */
18 22
19#endif /* _LINUX_ACPI_GPIO_H_ */ 23#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h
new file mode 100644
index 000000000000..3e7b62fbefbd
--- /dev/null
+++ b/include/linux/amba/pl080.h
@@ -0,0 +1,146 @@
1/* include/linux/amba/pl080.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * ARM PrimeCell PL080 DMA controller
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/* Note, there are some Samsung updates to this controller block which
16 * make it not entierly compatible with the PL080 specification from
17 * ARM. When in doubt, check the Samsung documentation first.
18 *
19 * The Samsung defines are PL080S, and add an extra control register,
20 * the ability to move more than 2^11 counts of data and some extra
21 * OneNAND features.
22*/
23
24#ifndef ASM_PL080_H
25#define ASM_PL080_H
26
27#define PL080_INT_STATUS (0x00)
28#define PL080_TC_STATUS (0x04)
29#define PL080_TC_CLEAR (0x08)
30#define PL080_ERR_STATUS (0x0C)
31#define PL080_ERR_CLEAR (0x10)
32#define PL080_RAW_TC_STATUS (0x14)
33#define PL080_RAW_ERR_STATUS (0x18)
34#define PL080_EN_CHAN (0x1c)
35#define PL080_SOFT_BREQ (0x20)
36#define PL080_SOFT_SREQ (0x24)
37#define PL080_SOFT_LBREQ (0x28)
38#define PL080_SOFT_LSREQ (0x2C)
39
40#define PL080_CONFIG (0x30)
41#define PL080_CONFIG_M2_BE (1 << 2)
42#define PL080_CONFIG_M1_BE (1 << 1)
43#define PL080_CONFIG_ENABLE (1 << 0)
44
45#define PL080_SYNC (0x34)
46
47/* Per channel configuration registers */
48
49#define PL080_Cx_STRIDE (0x20)
50#define PL080_Cx_BASE(x) ((0x100 + (x * 0x20)))
51#define PL080_Cx_SRC_ADDR(x) ((0x100 + (x * 0x20)))
52#define PL080_Cx_DST_ADDR(x) ((0x104 + (x * 0x20)))
53#define PL080_Cx_LLI(x) ((0x108 + (x * 0x20)))
54#define PL080_Cx_CONTROL(x) ((0x10C + (x * 0x20)))
55#define PL080_Cx_CONFIG(x) ((0x110 + (x * 0x20)))
56#define PL080S_Cx_CONTROL2(x) ((0x110 + (x * 0x20)))
57#define PL080S_Cx_CONFIG(x) ((0x114 + (x * 0x20)))
58
59#define PL080_CH_SRC_ADDR (0x00)
60#define PL080_CH_DST_ADDR (0x04)
61#define PL080_CH_LLI (0x08)
62#define PL080_CH_CONTROL (0x0C)
63#define PL080_CH_CONFIG (0x10)
64#define PL080S_CH_CONTROL2 (0x10)
65#define PL080S_CH_CONFIG (0x14)
66
67#define PL080_LLI_ADDR_MASK (0x3fffffff << 2)
68#define PL080_LLI_ADDR_SHIFT (2)
69#define PL080_LLI_LM_AHB2 (1 << 0)
70
71#define PL080_CONTROL_TC_IRQ_EN (1 << 31)
72#define PL080_CONTROL_PROT_MASK (0x7 << 28)
73#define PL080_CONTROL_PROT_SHIFT (28)
74#define PL080_CONTROL_PROT_CACHE (1 << 30)
75#define PL080_CONTROL_PROT_BUFF (1 << 29)
76#define PL080_CONTROL_PROT_SYS (1 << 28)
77#define PL080_CONTROL_DST_INCR (1 << 27)
78#define PL080_CONTROL_SRC_INCR (1 << 26)
79#define PL080_CONTROL_DST_AHB2 (1 << 25)
80#define PL080_CONTROL_SRC_AHB2 (1 << 24)
81#define PL080_CONTROL_DWIDTH_MASK (0x7 << 21)
82#define PL080_CONTROL_DWIDTH_SHIFT (21)
83#define PL080_CONTROL_SWIDTH_MASK (0x7 << 18)
84#define PL080_CONTROL_SWIDTH_SHIFT (18)
85#define PL080_CONTROL_DB_SIZE_MASK (0x7 << 15)
86#define PL080_CONTROL_DB_SIZE_SHIFT (15)
87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12)
88#define PL080_CONTROL_SB_SIZE_SHIFT (12)
89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0)
90#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0)
91
92#define PL080_BSIZE_1 (0x0)
93#define PL080_BSIZE_4 (0x1)
94#define PL080_BSIZE_8 (0x2)
95#define PL080_BSIZE_16 (0x3)
96#define PL080_BSIZE_32 (0x4)
97#define PL080_BSIZE_64 (0x5)
98#define PL080_BSIZE_128 (0x6)
99#define PL080_BSIZE_256 (0x7)
100
101#define PL080_WIDTH_8BIT (0x0)
102#define PL080_WIDTH_16BIT (0x1)
103#define PL080_WIDTH_32BIT (0x2)
104
105#define PL080N_CONFIG_ITPROT (1 << 20)
106#define PL080N_CONFIG_SECPROT (1 << 19)
107#define PL080_CONFIG_HALT (1 << 18)
108#define PL080_CONFIG_ACTIVE (1 << 17) /* RO */
109#define PL080_CONFIG_LOCK (1 << 16)
110#define PL080_CONFIG_TC_IRQ_MASK (1 << 15)
111#define PL080_CONFIG_ERR_IRQ_MASK (1 << 14)
112#define PL080_CONFIG_FLOW_CONTROL_MASK (0x7 << 11)
113#define PL080_CONFIG_FLOW_CONTROL_SHIFT (11)
114#define PL080_CONFIG_DST_SEL_MASK (0xf << 6)
115#define PL080_CONFIG_DST_SEL_SHIFT (6)
116#define PL080_CONFIG_SRC_SEL_MASK (0xf << 1)
117#define PL080_CONFIG_SRC_SEL_SHIFT (1)
118#define PL080_CONFIG_ENABLE (1 << 0)
119
120#define PL080_FLOW_MEM2MEM (0x0)
121#define PL080_FLOW_MEM2PER (0x1)
122#define PL080_FLOW_PER2MEM (0x2)
123#define PL080_FLOW_SRC2DST (0x3)
124#define PL080_FLOW_SRC2DST_DST (0x4)
125#define PL080_FLOW_MEM2PER_PER (0x5)
126#define PL080_FLOW_PER2MEM_PER (0x6)
127#define PL080_FLOW_SRC2DST_SRC (0x7)
128
129/* DMA linked list chain structure */
130
131struct pl080_lli {
132 u32 src_addr;
133 u32 dst_addr;
134 u32 next_lli;
135 u32 control0;
136};
137
138struct pl080s_lli {
139 u32 src_addr;
140 u32 dst_addr;
141 u32 next_lli;
142 u32 control0;
143 u32 control1;
144};
145
146#endif /* ASM_PL080_H */
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
index e5dfc256485b..b708786d4cbf 100644
--- a/include/linux/bcm47xx_wdt.h
+++ b/include/linux/bcm47xx_wdt.h
@@ -1,7 +1,10 @@
1#ifndef LINUX_BCM47XX_WDT_H_ 1#ifndef LINUX_BCM47XX_WDT_H_
2#define LINUX_BCM47XX_WDT_H_ 2#define LINUX_BCM47XX_WDT_H_
3 3
4#include <linux/notifier.h>
5#include <linux/timer.h>
4#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/watchdog.h>
5 8
6 9
7struct bcm47xx_wdt { 10struct bcm47xx_wdt {
@@ -10,6 +13,12 @@ struct bcm47xx_wdt {
10 u32 max_timer_ms; 13 u32 max_timer_ms;
11 14
12 void *driver_data; 15 void *driver_data;
16
17 struct watchdog_device wdd;
18 struct notifier_block notifier;
19
20 struct timer_list soft_timer;
21 atomic_t soft_ticks;
13}; 22};
14 23
15static inline void *bcm47xx_wdt_get_drvdata(struct bcm47xx_wdt *wdt) 24static inline void *bcm47xx_wdt_get_drvdata(struct bcm47xx_wdt *wdt)
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1d002b58b60b..8390c474f69a 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -528,6 +528,7 @@ struct bcma_sflash {
528 u32 size; 528 u32 size;
529 529
530 struct mtd_info *mtd; 530 struct mtd_info *mtd;
531 void *priv;
531}; 532};
532#endif 533#endif
533 534
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 0530b9860359..c3a09149f793 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -111,7 +111,6 @@ extern int suid_dumpable;
111extern int setup_arg_pages(struct linux_binprm * bprm, 111extern int setup_arg_pages(struct linux_binprm * bprm,
112 unsigned long stack_top, 112 unsigned long stack_top,
113 int executable_stack); 113 int executable_stack);
114extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); 114extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
116extern int copy_strings_kernel(int argc, const char *const *argv, 115extern int copy_strings_kernel(int argc, const char *const *argv,
117 struct linux_binprm *bprm); 116 struct linux_binprm *bprm);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f94bc83011ed..78feda9bbae2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -19,6 +19,7 @@
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/bsg.h> 20#include <linux/bsg.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/rcupdate.h>
22 23
23#include <asm/scatterlist.h> 24#include <asm/scatterlist.h>
24 25
@@ -437,6 +438,7 @@ struct request_queue {
437 /* Throttle data */ 438 /* Throttle data */
438 struct throtl_data *td; 439 struct throtl_data *td;
439#endif 440#endif
441 struct rcu_head rcu_head;
440}; 442};
441 443
442#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 444#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -974,7 +976,6 @@ struct blk_plug {
974 unsigned long magic; /* detect uninitialized use-cases */ 976 unsigned long magic; /* detect uninitialized use-cases */
975 struct list_head list; /* requests */ 977 struct list_head list; /* requests */
976 struct list_head cb_list; /* md requires an unplug callback */ 978 struct list_head cb_list; /* md requires an unplug callback */
977 unsigned int should_sort; /* list to be sorted before flushing? */
978}; 979};
979#define BLK_MAX_REQUEST_COUNT 16 980#define BLK_MAX_REQUEST_COUNT 16
980 981
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7c2e030e72f1..0ea61e07a91c 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -12,6 +12,7 @@
12 12
13struct blk_trace { 13struct blk_trace {
14 int trace_state; 14 int trace_state;
15 bool rq_based;
15 struct rchan *rchan; 16 struct rchan *rchan;
16 unsigned long __percpu *sequence; 17 unsigned long __percpu *sequence;
17 unsigned char __percpu *msg_data; 18 unsigned char __percpu *msg_data;
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 3f778c27f825..cdc3bab01832 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -53,6 +53,7 @@ extern void free_bootmem_node(pg_data_t *pgdat,
53 unsigned long size); 53 unsigned long size);
54extern void free_bootmem(unsigned long physaddr, unsigned long size); 54extern void free_bootmem(unsigned long physaddr, unsigned long size);
55extern void free_bootmem_late(unsigned long physaddr, unsigned long size); 55extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
56extern void __free_pages_bootmem(struct page *page, unsigned int order);
56 57
57/* 58/*
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 59 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
@@ -99,6 +100,9 @@ void *___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
99extern void *__alloc_bootmem_low(unsigned long size, 100extern void *__alloc_bootmem_low(unsigned long size,
100 unsigned long align, 101 unsigned long align,
101 unsigned long goal); 102 unsigned long goal);
103void *__alloc_bootmem_low_nopanic(unsigned long size,
104 unsigned long align,
105 unsigned long goal);
102extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, 106extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
103 unsigned long size, 107 unsigned long size,
104 unsigned long align, 108 unsigned long align,
@@ -132,6 +136,8 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
132 136
133#define alloc_bootmem_low(x) \ 137#define alloc_bootmem_low(x) \
134 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) 138 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
139#define alloc_bootmem_low_pages_nopanic(x) \
140 __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)
135#define alloc_bootmem_low_pages(x) \ 141#define alloc_bootmem_low_pages(x) \
136 __alloc_bootmem_low(x, PAGE_SIZE, 0) 142 __alloc_bootmem_low(x, PAGE_SIZE, 0)
137#define alloc_bootmem_low_pages_node(pgdat, x) \ 143#define alloc_bootmem_low_pages_node(pgdat, x) \
diff --git a/include/linux/btrfs.h b/include/linux/btrfs.h
new file mode 100644
index 000000000000..22d799147db2
--- /dev/null
+++ b/include/linux/btrfs.h
@@ -0,0 +1,6 @@
1#ifndef _LINUX_BTRFS_H
2#define _LINUX_BTRFS_H
3
4#include <uapi/linux/btrfs.h>
5
6#endif /* _LINUX_BTRFS_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 458f497738a4..5afc4f94d110 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -126,7 +126,6 @@ BUFFER_FNS(Write_EIO, write_io_error)
126BUFFER_FNS(Unwritten, unwritten) 126BUFFER_FNS(Unwritten, unwritten)
127 127
128#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 128#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
129#define touch_buffer(bh) mark_page_accessed(bh->b_page)
130 129
131/* If we *know* page->private refers to buffer_heads */ 130/* If we *know* page->private refers to buffer_heads */
132#define page_buffers(page) \ 131#define page_buffers(page) \
@@ -142,6 +141,7 @@ BUFFER_FNS(Unwritten, unwritten)
142 141
143void mark_buffer_dirty(struct buffer_head *bh); 142void mark_buffer_dirty(struct buffer_head *bh);
144void init_buffer(struct buffer_head *, bh_end_io_t *, void *); 143void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
144void touch_buffer(struct buffer_head *bh);
145void set_bh_page(struct buffer_head *bh, 145void set_bh_page(struct buffer_head *bh,
146 struct page *page, unsigned long offset); 146 struct page *page, unsigned long offset);
147int try_to_free_buffers(struct page *); 147int try_to_free_buffers(struct page *);
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index dad579b0c0e6..76554cecaab2 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -12,16 +12,46 @@
12#define CEPH_FEATURE_MONNAMES (1<<5) 12#define CEPH_FEATURE_MONNAMES (1<<5)
13#define CEPH_FEATURE_RECONNECT_SEQ (1<<6) 13#define CEPH_FEATURE_RECONNECT_SEQ (1<<6)
14#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7) 14#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
15/* bits 8-17 defined by user-space; not supported yet here */ 15#define CEPH_FEATURE_OBJECTLOCATOR (1<<8)
16#define CEPH_FEATURE_PGID64 (1<<9)
17#define CEPH_FEATURE_INCSUBOSDMAP (1<<10)
18#define CEPH_FEATURE_PGPOOL3 (1<<11)
19#define CEPH_FEATURE_OSDREPLYMUX (1<<12)
20#define CEPH_FEATURE_OSDENC (1<<13)
21#define CEPH_FEATURE_OMAP (1<<14)
22#define CEPH_FEATURE_MONENC (1<<15)
23#define CEPH_FEATURE_QUERY_T (1<<16)
24#define CEPH_FEATURE_INDEP_PG_MAP (1<<17)
16#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18) 25#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18)
26#define CEPH_FEATURE_CHUNKY_SCRUB (1<<19)
27#define CEPH_FEATURE_MON_NULLROUTE (1<<20)
28#define CEPH_FEATURE_MON_GV (1<<21)
29#define CEPH_FEATURE_BACKFILL_RESERVATION (1<<22)
30#define CEPH_FEATURE_MSG_AUTH (1<<23)
31#define CEPH_FEATURE_RECOVERY_RESERVATION (1<<24)
32#define CEPH_FEATURE_CRUSH_TUNABLES2 (1<<25)
33#define CEPH_FEATURE_CREATEPOOLID (1<<26)
34#define CEPH_FEATURE_REPLY_CREATE_INODE (1<<27)
35#define CEPH_FEATURE_OSD_HBMSGS (1<<28)
36#define CEPH_FEATURE_MDSENC (1<<29)
37#define CEPH_FEATURE_OSDHASHPSPOOL (1<<30)
17 38
18/* 39/*
19 * Features supported. 40 * Features supported.
20 */ 41 */
21#define CEPH_FEATURES_SUPPORTED_DEFAULT \ 42#define CEPH_FEATURES_SUPPORTED_DEFAULT \
22 (CEPH_FEATURE_NOSRCADDR | \ 43 (CEPH_FEATURE_NOSRCADDR | \
23 CEPH_FEATURE_CRUSH_TUNABLES) 44 CEPH_FEATURE_PGID64 | \
45 CEPH_FEATURE_PGPOOL3 | \
46 CEPH_FEATURE_OSDENC | \
47 CEPH_FEATURE_CRUSH_TUNABLES | \
48 CEPH_FEATURE_CRUSH_TUNABLES2 | \
49 CEPH_FEATURE_REPLY_CREATE_INODE | \
50 CEPH_FEATURE_OSDHASHPSPOOL)
24 51
25#define CEPH_FEATURES_REQUIRED_DEFAULT \ 52#define CEPH_FEATURES_REQUIRED_DEFAULT \
26 (CEPH_FEATURE_NOSRCADDR) 53 (CEPH_FEATURE_NOSRCADDR | \
54 CEPH_FEATURE_PGID64 | \
55 CEPH_FEATURE_PGPOOL3 | \
56 CEPH_FEATURE_OSDENC)
27#endif 57#endif
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index cf6f4d998a76..2ad7b860f062 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -21,16 +21,14 @@
21 * internal cluster protocols separately from the public, 21 * internal cluster protocols separately from the public,
22 * client-facing protocol. 22 * client-facing protocol.
23 */ 23 */
24#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
25#define CEPH_MDS_PROTOCOL 12 /* cluster internal */
26#define CEPH_MON_PROTOCOL 5 /* cluster internal */
27#define CEPH_OSDC_PROTOCOL 24 /* server/client */ 24#define CEPH_OSDC_PROTOCOL 24 /* server/client */
28#define CEPH_MDSC_PROTOCOL 32 /* server/client */ 25#define CEPH_MDSC_PROTOCOL 32 /* server/client */
29#define CEPH_MONC_PROTOCOL 15 /* server/client */ 26#define CEPH_MONC_PROTOCOL 15 /* server/client */
30 27
31 28
32#define CEPH_INO_ROOT 1 29#define CEPH_INO_ROOT 1
33#define CEPH_INO_CEPH 2 /* hidden .ceph dir */ 30#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
31#define CEPH_INO_DOTDOT 3 /* used by ceph fuse for parent (..) */
34 32
35/* arbitrary limit on max # of monitors (cluster of 3 is typical) */ 33/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
36#define CEPH_MAX_MON 31 34#define CEPH_MAX_MON 31
@@ -51,7 +49,7 @@ struct ceph_file_layout {
51 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */ 49 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
52 50
53 /* object -> pg layout */ 51 /* object -> pg layout */
54 __le32 fl_unused; /* unused; used to be preferred primary (-1) */ 52 __le32 fl_unused; /* unused; used to be preferred primary for pg (-1 for none) */
55 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ 53 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
56} __attribute__ ((packed)); 54} __attribute__ ((packed));
57 55
@@ -101,6 +99,8 @@ struct ceph_dir_layout {
101#define CEPH_MSG_MON_SUBSCRIBE_ACK 16 99#define CEPH_MSG_MON_SUBSCRIBE_ACK 16
102#define CEPH_MSG_AUTH 17 100#define CEPH_MSG_AUTH 17
103#define CEPH_MSG_AUTH_REPLY 18 101#define CEPH_MSG_AUTH_REPLY 18
102#define CEPH_MSG_MON_GET_VERSION 19
103#define CEPH_MSG_MON_GET_VERSION_REPLY 20
104 104
105/* client <-> mds */ 105/* client <-> mds */
106#define CEPH_MSG_MDS_MAP 21 106#define CEPH_MSG_MDS_MAP 21
@@ -221,6 +221,11 @@ struct ceph_mon_subscribe_ack {
221} __attribute__ ((packed)); 221} __attribute__ ((packed));
222 222
223/* 223/*
224 * mdsmap flags
225 */
226#define CEPH_MDSMAP_DOWN (1<<0) /* cluster deliberately down */
227
228/*
224 * mds states 229 * mds states
225 * > 0 -> in 230 * > 0 -> in
226 * <= 0 -> out 231 * <= 0 -> out
@@ -233,6 +238,7 @@ struct ceph_mon_subscribe_ack {
233#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */ 238#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
234#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */ 239#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
235#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */ 240#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
241#define CEPH_MDS_STATE_REPLAYONCE -9 /* up, replaying an active node's journal */
236 242
237#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */ 243#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
238#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed 244#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
@@ -264,6 +270,7 @@ extern const char *ceph_mds_state_name(int s);
264#define CEPH_LOCK_IXATTR 2048 270#define CEPH_LOCK_IXATTR 2048
265#define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */ 271#define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */
266#define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */ 272#define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */
273#define CEPH_LOCK_IPOLICY 16384 /* policy lock on dirs. MDS internal */
267 274
268/* client_session ops */ 275/* client_session ops */
269enum { 276enum {
@@ -338,6 +345,12 @@ extern const char *ceph_mds_op_name(int op);
338#define CEPH_SETATTR_SIZE 32 345#define CEPH_SETATTR_SIZE 32
339#define CEPH_SETATTR_CTIME 64 346#define CEPH_SETATTR_CTIME 64
340 347
348/*
349 * Ceph setxattr request flags.
350 */
351#define CEPH_XATTR_CREATE 1
352#define CEPH_XATTR_REPLACE 2
353
341union ceph_mds_request_args { 354union ceph_mds_request_args {
342 struct { 355 struct {
343 __le32 mask; /* CEPH_CAP_* */ 356 __le32 mask; /* CEPH_CAP_* */
@@ -522,14 +535,17 @@ int ceph_flags_to_mode(int flags);
522#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */ 535#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
523#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */ 536#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
524 537
538#define CEPH_CAP_SIMPLE_BITS 2
539#define CEPH_CAP_FILE_BITS 8
540
525/* per-lock shift */ 541/* per-lock shift */
526#define CEPH_CAP_SAUTH 2 542#define CEPH_CAP_SAUTH 2
527#define CEPH_CAP_SLINK 4 543#define CEPH_CAP_SLINK 4
528#define CEPH_CAP_SXATTR 6 544#define CEPH_CAP_SXATTR 6
529#define CEPH_CAP_SFILE 8 545#define CEPH_CAP_SFILE 8
530#define CEPH_CAP_SFLOCK 20 546#define CEPH_CAP_SFLOCK 20
531 547
532#define CEPH_CAP_BITS 22 548#define CEPH_CAP_BITS 22
533 549
534/* composed values */ 550/* composed values */
535#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH) 551#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 63d092822bad..360d9d08ca9e 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -52,10 +52,10 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
52 return end >= *p && n <= end - *p; 52 return end >= *p && n <= end - *p;
53} 53}
54 54
55#define ceph_decode_need(p, end, n, bad) \ 55#define ceph_decode_need(p, end, n, bad) \
56 do { \ 56 do { \
57 if (!likely(ceph_has_room(p, end, n))) \ 57 if (!likely(ceph_has_room(p, end, n))) \
58 goto bad; \ 58 goto bad; \
59 } while (0) 59 } while (0)
60 60
61#define ceph_decode_64_safe(p, end, v, bad) \ 61#define ceph_decode_64_safe(p, end, v, bad) \
@@ -99,8 +99,8 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
99 * 99 *
100 * There are two possible failures: 100 * There are two possible failures:
101 * - converting the string would require accessing memory at or 101 * - converting the string would require accessing memory at or
102 * beyond the "end" pointer provided (-E 102 * beyond the "end" pointer provided (-ERANGE)
103 * - memory could not be allocated for the result 103 * - memory could not be allocated for the result (-ENOMEM)
104 */ 104 */
105static inline char *ceph_extract_encoded_string(void **p, void *end, 105static inline char *ceph_extract_encoded_string(void **p, void *end,
106 size_t *lenp, gfp_t gfp) 106 size_t *lenp, gfp_t gfp)
@@ -217,10 +217,10 @@ static inline void ceph_encode_string(void **p, void *end,
217 *p += len; 217 *p += len;
218} 218}
219 219
220#define ceph_encode_need(p, end, n, bad) \ 220#define ceph_encode_need(p, end, n, bad) \
221 do { \ 221 do { \
222 if (!likely(ceph_has_room(p, end, n))) \ 222 if (!likely(ceph_has_room(p, end, n))) \
223 goto bad; \ 223 goto bad; \
224 } while (0) 224 } while (0)
225 225
226#define ceph_encode_64_safe(p, end, v, bad) \ 226#define ceph_encode_64_safe(p, end, v, bad) \
@@ -231,12 +231,17 @@ static inline void ceph_encode_string(void **p, void *end,
231#define ceph_encode_32_safe(p, end, v, bad) \ 231#define ceph_encode_32_safe(p, end, v, bad) \
232 do { \ 232 do { \
233 ceph_encode_need(p, end, sizeof(u32), bad); \ 233 ceph_encode_need(p, end, sizeof(u32), bad); \
234 ceph_encode_32(p, v); \ 234 ceph_encode_32(p, v); \
235 } while (0) 235 } while (0)
236#define ceph_encode_16_safe(p, end, v, bad) \ 236#define ceph_encode_16_safe(p, end, v, bad) \
237 do { \ 237 do { \
238 ceph_encode_need(p, end, sizeof(u16), bad); \ 238 ceph_encode_need(p, end, sizeof(u16), bad); \
239 ceph_encode_16(p, v); \ 239 ceph_encode_16(p, v); \
240 } while (0)
241#define ceph_encode_8_safe(p, end, v, bad) \
242 do { \
243 ceph_encode_need(p, end, sizeof(u8), bad); \
244 ceph_encode_8(p, v); \
240 } while (0) 245 } while (0)
241 246
242#define ceph_encode_copy_safe(p, end, pv, n, bad) \ 247#define ceph_encode_copy_safe(p, end, pv, n, bad) \
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 084d3c622b12..29818fc3fa49 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -193,6 +193,8 @@ static inline int calc_pages_for(u64 off, u64 len)
193} 193}
194 194
195/* ceph_common.c */ 195/* ceph_common.c */
196extern bool libceph_compatible(void *data);
197
196extern const char *ceph_msg_type_name(int type); 198extern const char *ceph_msg_type_name(int type);
197extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); 199extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
198extern struct kmem_cache *ceph_inode_cachep; 200extern struct kmem_cache *ceph_inode_cachep;
@@ -220,7 +222,7 @@ extern int ceph_open_session(struct ceph_client *client);
220/* pagevec.c */ 222/* pagevec.c */
221extern void ceph_release_page_vector(struct page **pages, int num_pages); 223extern void ceph_release_page_vector(struct page **pages, int num_pages);
222 224
223extern struct page **ceph_get_direct_page_vector(const char __user *data, 225extern struct page **ceph_get_direct_page_vector(const void __user *data,
224 int num_pages, 226 int num_pages,
225 bool write_page); 227 bool write_page);
226extern void ceph_put_page_vector(struct page **pages, int num_pages, 228extern void ceph_put_page_vector(struct page **pages, int num_pages,
@@ -228,15 +230,15 @@ extern void ceph_put_page_vector(struct page **pages, int num_pages,
228extern void ceph_release_page_vector(struct page **pages, int num_pages); 230extern void ceph_release_page_vector(struct page **pages, int num_pages);
229extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 231extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
230extern int ceph_copy_user_to_page_vector(struct page **pages, 232extern int ceph_copy_user_to_page_vector(struct page **pages,
231 const char __user *data, 233 const void __user *data,
232 loff_t off, size_t len); 234 loff_t off, size_t len);
233extern int ceph_copy_to_page_vector(struct page **pages, 235extern void ceph_copy_to_page_vector(struct page **pages,
234 const char *data, 236 const void *data,
235 loff_t off, size_t len); 237 loff_t off, size_t len);
236extern int ceph_copy_from_page_vector(struct page **pages, 238extern void ceph_copy_from_page_vector(struct page **pages,
237 char *data, 239 void *data,
238 loff_t off, size_t len); 240 loff_t off, size_t len);
239extern int ceph_copy_page_vector_to_user(struct page **pages, char __user *data, 241extern int ceph_copy_page_vector_to_user(struct page **pages, void __user *data,
240 loff_t off, size_t len); 242 loff_t off, size_t len);
241extern void ceph_zero_page_vector_range(int off, int len, struct page **pages); 243extern void ceph_zero_page_vector_range(int off, int len, struct page **pages);
242 244
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index cb15b5d867c7..87ed09f54800 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -29,8 +29,8 @@ struct ceph_mdsmap {
29 29
30 /* which object pools file data can be stored in */ 30 /* which object pools file data can be stored in */
31 int m_num_data_pg_pools; 31 int m_num_data_pg_pools;
32 u32 *m_data_pg_pools; 32 u64 *m_data_pg_pools;
33 u32 m_cas_pg_pool; 33 u64 m_cas_pg_pool;
34}; 34};
35 35
36static inline struct ceph_entity_addr * 36static inline struct ceph_entity_addr *
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 14ba5ee738a9..60903e0f665c 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -83,9 +83,11 @@ struct ceph_msg {
83 struct list_head list_head; 83 struct list_head list_head;
84 84
85 struct kref kref; 85 struct kref kref;
86#ifdef CONFIG_BLOCK
86 struct bio *bio; /* instead of pages/pagelist */ 87 struct bio *bio; /* instead of pages/pagelist */
87 struct bio *bio_iter; /* bio iterator */ 88 struct bio *bio_iter; /* bio iterator */
88 int bio_seg; /* current bio segment */ 89 int bio_seg; /* current bio segment */
90#endif /* CONFIG_BLOCK */
89 struct ceph_pagelist *trail; /* the trailing part of the data */ 91 struct ceph_pagelist *trail; /* the trailing part of the data */
90 bool front_is_vmalloc; 92 bool front_is_vmalloc;
91 bool more_to_follow; 93 bool more_to_follow;
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index d9b880e977e6..1dd5d466b6f9 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -10,6 +10,7 @@
10#include <linux/ceph/osdmap.h> 10#include <linux/ceph/osdmap.h>
11#include <linux/ceph/messenger.h> 11#include <linux/ceph/messenger.h>
12#include <linux/ceph/auth.h> 12#include <linux/ceph/auth.h>
13#include <linux/ceph/pagelist.h>
13 14
14/* 15/*
15 * Maximum object name size 16 * Maximum object name size
@@ -22,7 +23,6 @@ struct ceph_snap_context;
22struct ceph_osd_request; 23struct ceph_osd_request;
23struct ceph_osd_client; 24struct ceph_osd_client;
24struct ceph_authorizer; 25struct ceph_authorizer;
25struct ceph_pagelist;
26 26
27/* 27/*
28 * completion callback for async writepages 28 * completion callback for async writepages
@@ -47,6 +47,9 @@ struct ceph_osd {
47 struct list_head o_keepalive_item; 47 struct list_head o_keepalive_item;
48}; 48};
49 49
50
51#define CEPH_OSD_MAX_OP 10
52
50/* an in-flight request */ 53/* an in-flight request */
51struct ceph_osd_request { 54struct ceph_osd_request {
52 u64 r_tid; /* unique for this client */ 55 u64 r_tid; /* unique for this client */
@@ -63,9 +66,23 @@ struct ceph_osd_request {
63 struct ceph_connection *r_con_filling_msg; 66 struct ceph_connection *r_con_filling_msg;
64 67
65 struct ceph_msg *r_request, *r_reply; 68 struct ceph_msg *r_request, *r_reply;
66 int r_result;
67 int r_flags; /* any additional flags for the osd */ 69 int r_flags; /* any additional flags for the osd */
68 u32 r_sent; /* >0 if r_request is sending/sent */ 70 u32 r_sent; /* >0 if r_request is sending/sent */
71 int r_num_ops;
72
73 /* encoded message content */
74 struct ceph_osd_op *r_request_ops;
75 /* these are updated on each send */
76 __le32 *r_request_osdmap_epoch;
77 __le32 *r_request_flags;
78 __le64 *r_request_pool;
79 void *r_request_pgid;
80 __le32 *r_request_attempts;
81 struct ceph_eversion *r_request_reassert_version;
82
83 int r_result;
84 int r_reply_op_len[CEPH_OSD_MAX_OP];
85 s32 r_reply_op_result[CEPH_OSD_MAX_OP];
69 int r_got_reply; 86 int r_got_reply;
70 int r_linger; 87 int r_linger;
71 88
@@ -82,6 +99,7 @@ struct ceph_osd_request {
82 99
83 char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ 100 char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */
84 int r_oid_len; 101 int r_oid_len;
102 u64 r_snapid;
85 unsigned long r_stamp; /* send OR check time */ 103 unsigned long r_stamp; /* send OR check time */
86 104
87 struct ceph_file_layout r_file_layout; 105 struct ceph_file_layout r_file_layout;
@@ -95,7 +113,7 @@ struct ceph_osd_request {
95 struct bio *r_bio; /* instead of pages */ 113 struct bio *r_bio; /* instead of pages */
96#endif 114#endif
97 115
98 struct ceph_pagelist *r_trail; /* trailing part of the data */ 116 struct ceph_pagelist r_trail; /* trailing part of the data */
99}; 117};
100 118
101struct ceph_osd_event { 119struct ceph_osd_event {
@@ -107,7 +125,6 @@ struct ceph_osd_event {
107 struct rb_node node; 125 struct rb_node node;
108 struct list_head osd_node; 126 struct list_head osd_node;
109 struct kref kref; 127 struct kref kref;
110 struct completion completion;
111}; 128};
112 129
113struct ceph_osd_event_work { 130struct ceph_osd_event_work {
@@ -157,7 +174,7 @@ struct ceph_osd_client {
157 174
158struct ceph_osd_req_op { 175struct ceph_osd_req_op {
159 u16 op; /* CEPH_OSD_OP_* */ 176 u16 op; /* CEPH_OSD_OP_* */
160 u32 flags; /* CEPH_OSD_FLAG_* */ 177 u32 payload_len;
161 union { 178 union {
162 struct { 179 struct {
163 u64 offset, length; 180 u64 offset, length;
@@ -166,23 +183,24 @@ struct ceph_osd_req_op {
166 } extent; 183 } extent;
167 struct { 184 struct {
168 const char *name; 185 const char *name;
169 u32 name_len;
170 const char *val; 186 const char *val;
187 u32 name_len;
171 u32 value_len; 188 u32 value_len;
172 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */ 189 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
173 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ 190 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
174 } xattr; 191 } xattr;
175 struct { 192 struct {
176 const char *class_name; 193 const char *class_name;
177 __u8 class_len;
178 const char *method_name; 194 const char *method_name;
179 __u8 method_len;
180 __u8 argc;
181 const char *indata; 195 const char *indata;
182 u32 indata_len; 196 u32 indata_len;
197 __u8 class_len;
198 __u8 method_len;
199 __u8 argc;
183 } cls; 200 } cls;
184 struct { 201 struct {
185 u64 cookie, count; 202 u64 cookie;
203 u64 count;
186 } pgls; 204 } pgls;
187 struct { 205 struct {
188 u64 snapid; 206 u64 snapid;
@@ -190,12 +208,11 @@ struct ceph_osd_req_op {
190 struct { 208 struct {
191 u64 cookie; 209 u64 cookie;
192 u64 ver; 210 u64 ver;
193 __u8 flag;
194 u32 prot_ver; 211 u32 prot_ver;
195 u32 timeout; 212 u32 timeout;
213 __u8 flag;
196 } watch; 214 } watch;
197 }; 215 };
198 u32 payload_len;
199}; 216};
200 217
201extern int ceph_osdc_init(struct ceph_osd_client *osdc, 218extern int ceph_osdc_init(struct ceph_osd_client *osdc,
@@ -207,29 +224,19 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 224extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
208 struct ceph_msg *msg); 225 struct ceph_msg *msg);
209 226
210extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
211 struct ceph_file_layout *layout,
212 u64 snapid,
213 u64 off, u64 *plen, u64 *bno,
214 struct ceph_osd_request *req,
215 struct ceph_osd_req_op *op);
216
217extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 227extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
218 int flags,
219 struct ceph_snap_context *snapc, 228 struct ceph_snap_context *snapc,
220 struct ceph_osd_req_op *ops, 229 unsigned int num_op,
221 bool use_mempool, 230 bool use_mempool,
222 gfp_t gfp_flags, 231 gfp_t gfp_flags);
223 struct page **pages,
224 struct bio *bio);
225 232
226extern void ceph_osdc_build_request(struct ceph_osd_request *req, 233extern void ceph_osdc_build_request(struct ceph_osd_request *req,
227 u64 off, u64 *plen, 234 u64 off, u64 len,
235 unsigned int num_op,
228 struct ceph_osd_req_op *src_ops, 236 struct ceph_osd_req_op *src_ops,
229 struct ceph_snap_context *snapc, 237 struct ceph_snap_context *snapc,
230 struct timespec *mtime, 238 u64 snap_id,
231 const char *oid, 239 struct timespec *mtime);
232 int oid_len);
233 240
234extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, 241extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
235 struct ceph_file_layout *layout, 242 struct ceph_file_layout *layout,
@@ -239,8 +246,7 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
239 int do_sync, u32 truncate_seq, 246 int do_sync, u32 truncate_seq,
240 u64 truncate_size, 247 u64 truncate_size,
241 struct timespec *mtime, 248 struct timespec *mtime,
242 bool use_mempool, int num_reply, 249 bool use_mempool, int page_align);
243 int page_align);
244 250
245extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 251extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
246 struct ceph_osd_request *req); 252 struct ceph_osd_request *req);
@@ -279,17 +285,13 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
279 u64 off, u64 len, 285 u64 off, u64 len,
280 u32 truncate_seq, u64 truncate_size, 286 u32 truncate_seq, u64 truncate_size,
281 struct timespec *mtime, 287 struct timespec *mtime,
282 struct page **pages, int nr_pages, 288 struct page **pages, int nr_pages);
283 int flags, int do_sync, bool nofail);
284 289
285/* watch/notify events */ 290/* watch/notify events */
286extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, 291extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
287 void (*event_cb)(u64, u64, u8, void *), 292 void (*event_cb)(u64, u64, u8, void *),
288 int one_shot, void *data, 293 void *data, struct ceph_osd_event **pevent);
289 struct ceph_osd_event **pevent);
290extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); 294extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
291extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
292 unsigned long timeout);
293extern void ceph_osdc_put_event(struct ceph_osd_event *event); 295extern void ceph_osdc_put_event(struct ceph_osd_event *event);
294#endif 296#endif
295 297
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 10a417f9f76f..c819190d1642 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -18,14 +18,31 @@
18 * The map can be updated either via an incremental map (diff) describing 18 * The map can be updated either via an incremental map (diff) describing
19 * the change between two successive epochs, or as a fully encoded map. 19 * the change between two successive epochs, or as a fully encoded map.
20 */ 20 */
21struct ceph_pg {
22 uint64_t pool;
23 uint32_t seed;
24};
25
26#define CEPH_POOL_FLAG_HASHPSPOOL 1
27
21struct ceph_pg_pool_info { 28struct ceph_pg_pool_info {
22 struct rb_node node; 29 struct rb_node node;
23 int id; 30 s64 id;
24 struct ceph_pg_pool v; 31 u8 type;
25 int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask; 32 u8 size;
33 u8 crush_ruleset;
34 u8 object_hash;
35 u32 pg_num, pgp_num;
36 int pg_num_mask, pgp_num_mask;
37 u64 flags;
26 char *name; 38 char *name;
27}; 39};
28 40
41struct ceph_object_locator {
42 uint64_t pool;
43 char *key;
44};
45
29struct ceph_pg_mapping { 46struct ceph_pg_mapping {
30 struct rb_node node; 47 struct rb_node node;
31 struct ceph_pg pgid; 48 struct ceph_pg pgid;
@@ -110,15 +127,16 @@ extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
110 127
111/* calculate mapping of a file extent to an object */ 128/* calculate mapping of a file extent to an object */
112extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 129extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
113 u64 off, u64 *plen, 130 u64 off, u64 len,
114 u64 *bno, u64 *oxoff, u64 *oxlen); 131 u64 *bno, u64 *oxoff, u64 *oxlen);
115 132
116/* calculate mapping of object to a placement group */ 133/* calculate mapping of object to a placement group */
117extern int ceph_calc_object_layout(struct ceph_object_layout *ol, 134extern int ceph_calc_object_layout(struct ceph_pg *pg,
118 const char *oid, 135 const char *oid,
119 struct ceph_file_layout *fl, 136 struct ceph_file_layout *fl,
120 struct ceph_osdmap *osdmap); 137 struct ceph_osdmap *osdmap);
121extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid, 138extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
139 struct ceph_pg pgid,
122 int *acting); 140 int *acting);
123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 141extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
124 struct ceph_pg pgid); 142 struct ceph_pg pgid);
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 2c04afeead1c..68c96a508ac2 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -9,14 +9,6 @@
9#include <linux/ceph/msgr.h> 9#include <linux/ceph/msgr.h>
10 10
11/* 11/*
12 * osdmap encoding versions
13 */
14#define CEPH_OSDMAP_INC_VERSION 5
15#define CEPH_OSDMAP_INC_VERSION_EXT 6
16#define CEPH_OSDMAP_VERSION 5
17#define CEPH_OSDMAP_VERSION_EXT 6
18
19/*
20 * fs id 12 * fs id
21 */ 13 */
22struct ceph_fsid { 14struct ceph_fsid {
@@ -64,7 +56,7 @@ struct ceph_timespec {
64 * placement group. 56 * placement group.
65 * we encode this into one __le64. 57 * we encode this into one __le64.
66 */ 58 */
67struct ceph_pg { 59struct ceph_pg_v1 {
68 __le16 preferred; /* preferred primary osd */ 60 __le16 preferred; /* preferred primary osd */
69 __le16 ps; /* placement seed */ 61 __le16 ps; /* placement seed */
70 __le32 pool; /* object pool */ 62 __le32 pool; /* object pool */
@@ -91,21 +83,6 @@ struct ceph_pg {
91 83
92#define CEPH_PG_TYPE_REP 1 84#define CEPH_PG_TYPE_REP 1
93#define CEPH_PG_TYPE_RAID4 2 85#define CEPH_PG_TYPE_RAID4 2
94#define CEPH_PG_POOL_VERSION 2
95struct ceph_pg_pool {
96 __u8 type; /* CEPH_PG_TYPE_* */
97 __u8 size; /* number of osds in each pg */
98 __u8 crush_ruleset; /* crush placement rule */
99 __u8 object_hash; /* hash mapping object name to ps */
100 __le32 pg_num, pgp_num; /* number of pg's */
101 __le32 lpg_num, lpgp_num; /* number of localized pg's */
102 __le32 last_change; /* most recent epoch changed */
103 __le64 snap_seq; /* seq for per-pool snapshot */
104 __le32 snap_epoch; /* epoch of last snap */
105 __le32 num_snaps;
106 __le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
107 __le64 auid; /* who owns the pg */
108} __attribute__ ((packed));
109 86
110/* 87/*
111 * stable_mod func is used to control number of placement groups. 88 * stable_mod func is used to control number of placement groups.
@@ -128,7 +105,7 @@ static inline int ceph_stable_mod(int x, int b, int bmask)
128 * object layout - how a given object should be stored. 105 * object layout - how a given object should be stored.
129 */ 106 */
130struct ceph_object_layout { 107struct ceph_object_layout {
131 struct ceph_pg ol_pgid; /* raw pg, with _full_ ps precision. */ 108 struct ceph_pg_v1 ol_pgid; /* raw pg, with _full_ ps precision. */
132 __le32 ol_stripe_unit; /* for per-object parity, if any */ 109 __le32 ol_stripe_unit; /* for per-object parity, if any */
133} __attribute__ ((packed)); 110} __attribute__ ((packed));
134 111
@@ -145,8 +122,12 @@ struct ceph_eversion {
145 */ 122 */
146 123
147/* status bits */ 124/* status bits */
148#define CEPH_OSD_EXISTS 1 125#define CEPH_OSD_EXISTS (1<<0)
149#define CEPH_OSD_UP 2 126#define CEPH_OSD_UP (1<<1)
127#define CEPH_OSD_AUTOOUT (1<<2) /* osd was automatically marked out */
128#define CEPH_OSD_NEW (1<<3) /* osd is new, never marked in */
129
130extern const char *ceph_osd_state_name(int s);
150 131
151/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */ 132/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
152#define CEPH_OSD_IN 0x10000 133#define CEPH_OSD_IN 0x10000
@@ -161,9 +142,25 @@ struct ceph_eversion {
161#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */ 142#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
162#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */ 143#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
163#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */ 144#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
145#define CEPH_OSDMAP_NOUP (1<<5) /* block osd boot */
146#define CEPH_OSDMAP_NODOWN (1<<6) /* block osd mark-down/failure */
147#define CEPH_OSDMAP_NOOUT (1<<7) /* block osd auto mark-out */
148#define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */
149#define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */
150#define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */
151
152/*
153 * The error code to return when an OSD can't handle a write
154 * because it is too large.
155 */
156#define OSD_WRITETOOBIG EMSGSIZE
164 157
165/* 158/*
166 * osd ops 159 * osd ops
160 *
161 * WARNING: do not use these op codes directly. Use the helpers
162 * defined below instead. In certain cases, op code behavior was
163 * redefined, resulting in special-cases in the helpers.
167 */ 164 */
168#define CEPH_OSD_OP_MODE 0xf000 165#define CEPH_OSD_OP_MODE 0xf000
169#define CEPH_OSD_OP_MODE_RD 0x1000 166#define CEPH_OSD_OP_MODE_RD 0x1000
@@ -177,6 +174,7 @@ struct ceph_eversion {
177#define CEPH_OSD_OP_TYPE_ATTR 0x0300 174#define CEPH_OSD_OP_TYPE_ATTR 0x0300
178#define CEPH_OSD_OP_TYPE_EXEC 0x0400 175#define CEPH_OSD_OP_TYPE_EXEC 0x0400
179#define CEPH_OSD_OP_TYPE_PG 0x0500 176#define CEPH_OSD_OP_TYPE_PG 0x0500
177#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
180 178
181enum { 179enum {
182 /** data **/ 180 /** data **/
@@ -217,6 +215,23 @@ enum {
217 215
218 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15, 216 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
219 217
218 /* omap */
219 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
220 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
221 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
222 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
223 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
224 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
225 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
226 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
227 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
228 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
229
230 /** multi **/
231 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
232 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
233 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
234
220 /** attrs **/ 235 /** attrs **/
221 /* read */ 236 /* read */
222 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 237 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -238,6 +253,7 @@ enum {
238 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6, 253 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
239 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7, 254 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
240 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8, 255 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
256 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
241 257
242 /** lock **/ 258 /** lock **/
243 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, 259 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
@@ -248,10 +264,12 @@ enum {
248 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6, 264 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
249 265
250 /** exec **/ 266 /** exec **/
267 /* note: the RD bit here is wrong; see special-case below in helper */
251 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1, 268 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
252 269
253 /** pg **/ 270 /** pg **/
254 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1, 271 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
272 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
255}; 273};
256 274
257static inline int ceph_osd_op_type_lock(int op) 275static inline int ceph_osd_op_type_lock(int op)
@@ -274,6 +292,10 @@ static inline int ceph_osd_op_type_pg(int op)
274{ 292{
275 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG; 293 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
276} 294}
295static inline int ceph_osd_op_type_multi(int op)
296{
297 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_MULTI;
298}
277 299
278static inline int ceph_osd_op_mode_subop(int op) 300static inline int ceph_osd_op_mode_subop(int op)
279{ 301{
@@ -281,11 +303,12 @@ static inline int ceph_osd_op_mode_subop(int op)
281} 303}
282static inline int ceph_osd_op_mode_read(int op) 304static inline int ceph_osd_op_mode_read(int op)
283{ 305{
284 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_RD; 306 return (op & CEPH_OSD_OP_MODE_RD) &&
307 op != CEPH_OSD_OP_CALL;
285} 308}
286static inline int ceph_osd_op_mode_modify(int op) 309static inline int ceph_osd_op_mode_modify(int op)
287{ 310{
288 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_WR; 311 return op & CEPH_OSD_OP_MODE_WR;
289} 312}
290 313
291/* 314/*
@@ -294,34 +317,38 @@ static inline int ceph_osd_op_mode_modify(int op)
294 */ 317 */
295#define CEPH_OSD_TMAP_HDR 'h' 318#define CEPH_OSD_TMAP_HDR 'h'
296#define CEPH_OSD_TMAP_SET 's' 319#define CEPH_OSD_TMAP_SET 's'
320#define CEPH_OSD_TMAP_CREATE 'c' /* create key */
297#define CEPH_OSD_TMAP_RM 'r' 321#define CEPH_OSD_TMAP_RM 'r'
322#define CEPH_OSD_TMAP_RMSLOPPY 'R'
298 323
299extern const char *ceph_osd_op_name(int op); 324extern const char *ceph_osd_op_name(int op);
300 325
301
302/* 326/*
303 * osd op flags 327 * osd op flags
304 * 328 *
305 * An op may be READ, WRITE, or READ|WRITE. 329 * An op may be READ, WRITE, or READ|WRITE.
306 */ 330 */
307enum { 331enum {
308 CEPH_OSD_FLAG_ACK = 1, /* want (or is) "ack" ack */ 332 CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
309 CEPH_OSD_FLAG_ONNVRAM = 2, /* want (or is) "onnvram" ack */ 333 CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
310 CEPH_OSD_FLAG_ONDISK = 4, /* want (or is) "ondisk" ack */ 334 CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
311 CEPH_OSD_FLAG_RETRY = 8, /* resend attempt */ 335 CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
312 CEPH_OSD_FLAG_READ = 16, /* op may read */ 336 CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
313 CEPH_OSD_FLAG_WRITE = 32, /* op may write */ 337 CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
314 CEPH_OSD_FLAG_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */ 338 CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
315 CEPH_OSD_FLAG_PEERSTAT = 128, /* msg includes osd_peer_stat */ 339 CEPH_OSD_FLAG_PEERSTAT_OLD = 0x0080, /* DEPRECATED msg includes osd_peer_stat */
316 CEPH_OSD_FLAG_BALANCE_READS = 256, 340 CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
317 CEPH_OSD_FLAG_PARALLELEXEC = 512, /* execute op in parallel */ 341 CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
318 CEPH_OSD_FLAG_PGOP = 1024, /* pg op, no object */ 342 CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
319 CEPH_OSD_FLAG_EXEC = 2048, /* op may exec */ 343 CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
320 CEPH_OSD_FLAG_EXEC_PUBLIC = 4096, /* op may exec (public) */ 344 CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* DEPRECATED op may exec (public) */
345 CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
346 CEPH_OSD_FLAG_RWORDERED = 0x4000, /* order wrt concurrent reads */
321}; 347};
322 348
323enum { 349enum {
324 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */ 350 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
351 CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
325}; 352};
326 353
327#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/ 354#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
@@ -381,48 +408,13 @@ struct ceph_osd_op {
381 __le64 ver; 408 __le64 ver;
382 __u8 flag; /* 0 = unwatch, 1 = watch */ 409 __u8 flag; /* 0 = unwatch, 1 = watch */
383 } __attribute__ ((packed)) watch; 410 } __attribute__ ((packed)) watch;
384}; 411 struct {
412 __le64 offset, length;
413 __le64 src_offset;
414 } __attribute__ ((packed)) clonerange;
415 };
385 __le32 payload_len; 416 __le32 payload_len;
386} __attribute__ ((packed)); 417} __attribute__ ((packed));
387 418
388/*
389 * osd request message header. each request may include multiple
390 * ceph_osd_op object operations.
391 */
392struct ceph_osd_request_head {
393 __le32 client_inc; /* client incarnation */
394 struct ceph_object_layout layout; /* pgid */
395 __le32 osdmap_epoch; /* client's osdmap epoch */
396
397 __le32 flags;
398
399 struct ceph_timespec mtime; /* for mutations only */
400 struct ceph_eversion reassert_version; /* if we are replaying op */
401
402 __le32 object_len; /* length of object name */
403
404 __le64 snapid; /* snapid to read */
405 __le64 snap_seq; /* writer's snap context */
406 __le32 num_snaps;
407
408 __le16 num_ops;
409 struct ceph_osd_op ops[]; /* followed by ops[], obj, ticket, snaps */
410} __attribute__ ((packed));
411
412struct ceph_osd_reply_head {
413 __le32 client_inc; /* client incarnation */
414 __le32 flags;
415 struct ceph_object_layout layout;
416 __le32 osdmap_epoch;
417 struct ceph_eversion reassert_version; /* for replaying uncommitted */
418
419 __le32 result; /* result code */
420
421 __le32 object_len; /* length of object name */
422 __le32 num_ops;
423 struct ceph_osd_op ops[0]; /* ops[], object */
424} __attribute__ ((packed));
425
426
427 419
428#endif 420#endif
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8031d6eef102..5b8721efa948 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -34,7 +34,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid,
34 const char *name, int length, int *type, 34 const char *name, int length, int *type,
35 struct CodaFid *resfid); 35 struct CodaFid *resfid);
36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, 36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
37 vuid_t uid); 37 kuid_t uid);
38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, 38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
39 struct file **f); 39 struct file **f);
40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, 40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index cc7bddeaf553..091d72e70d8a 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -23,7 +23,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended); 25 bool sync, bool *contended);
26extern int compact_pgdat(pg_data_t *pgdat, int order); 26extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 27extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
29 29
@@ -80,9 +80,8 @@ static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
80 return COMPACT_CONTINUE; 80 return COMPACT_CONTINUE;
81} 81}
82 82
83static inline int compact_pgdat(pg_data_t *pgdat, int order) 83static inline void compact_pgdat(pg_data_t *pgdat, int order)
84{ 84{
85 return COMPACT_CONTINUE;
86} 85}
87 86
88static inline void reset_isolation_suitable(pg_data_t *pgdat) 87static inline void reset_isolation_suitable(pg_data_t *pgdat)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dec7e2d18875..76a87fb57ac2 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -68,7 +68,6 @@
68#ifndef compat_user_stack_pointer 68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif 70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */ 71#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack { 72typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp; 73 compat_uptr_t ss_sp;
@@ -76,7 +75,6 @@ typedef struct compat_sigaltstack {
76 compat_size_t ss_size; 75 compat_size_t ss_size;
77} compat_stack_t; 76} compat_stack_t;
78#endif 77#endif
79#endif
80 78
81#define compat_jiffies_to_clock_t(x) \ 79#define compat_jiffies_to_clock_t(x) \
82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 80 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
@@ -142,6 +140,20 @@ typedef struct {
142 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 140 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
143} compat_sigset_t; 141} compat_sigset_t;
144 142
143struct compat_sigaction {
144#ifndef __ARCH_HAS_ODD_SIGACTION
145 compat_uptr_t sa_handler;
146 compat_ulong_t sa_flags;
147#else
148 compat_ulong_t sa_flags;
149 compat_uptr_t sa_handler;
150#endif
151#ifdef __ARCH_HAS_SA_RESTORER
152 compat_uptr_t sa_restorer;
153#endif
154 compat_sigset_t sa_mask __packed;
155};
156
145/* 157/*
146 * These functions operate strictly on struct compat_time* 158 * These functions operate strictly on struct compat_time*
147 */ 159 */
@@ -283,6 +295,15 @@ struct compat_robust_list_head {
283 compat_uptr_t list_op_pending; 295 compat_uptr_t list_op_pending;
284}; 296};
285 297
298#ifdef CONFIG_COMPAT_OLD_SIGACTION
299struct compat_old_sigaction {
300 compat_uptr_t sa_handler;
301 compat_old_sigset_t sa_mask;
302 compat_ulong_t sa_flags;
303 compat_uptr_t sa_restorer;
304};
305#endif
306
286struct compat_statfs; 307struct compat_statfs;
287struct compat_statfs64; 308struct compat_statfs64;
288struct compat_old_linux_dirent; 309struct compat_old_linux_dirent;
@@ -338,6 +359,7 @@ asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
338asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, 359asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
339 const struct compat_iovec __user *vec, 360 const struct compat_iovec __user *vec,
340 unsigned long vlen, u32 pos_low, u32 pos_high); 361 unsigned long vlen, u32 pos_low, u32 pos_high);
362asmlinkage long comat_sys_lseek(unsigned int, compat_off_t, unsigned int);
341 363
342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 364asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
343 const compat_uptr_t __user *envp); 365 const compat_uptr_t __user *envp);
@@ -367,6 +389,11 @@ int get_compat_sigevent(struct sigevent *event,
367 const struct compat_sigevent __user *u_event); 389 const struct compat_sigevent __user *u_event);
368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, 390long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
369 struct compat_siginfo __user *uinfo); 391 struct compat_siginfo __user *uinfo);
392#ifdef CONFIG_COMPAT_OLD_SIGACTION
393asmlinkage long compat_sys_sigaction(int sig,
394 const struct compat_old_sigaction __user *act,
395 struct compat_old_sigaction __user *oact);
396#endif
370 397
371static inline int compat_timeval_compare(struct compat_timeval *lhs, 398static inline int compat_timeval_compare(struct compat_timeval *lhs,
372 struct compat_timeval *rhs) 399 struct compat_timeval *rhs)
@@ -401,7 +428,8 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
401asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 428asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
402 429
403extern int compat_printk(const char *fmt, ...); 430extern int compat_printk(const char *fmt, ...);
404extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); 431extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
432extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
405 433
406asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, 434asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
407 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 435 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
@@ -503,11 +531,13 @@ asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
503 unsigned int nr_segs, unsigned int flags); 531 unsigned int nr_segs, unsigned int flags);
504asmlinkage long compat_sys_open(const char __user *filename, int flags, 532asmlinkage long compat_sys_open(const char __user *filename, int flags,
505 umode_t mode); 533 umode_t mode);
506asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 534asmlinkage long compat_sys_openat(int dfd, const char __user *filename,
507 int flags, umode_t mode); 535 int flags, umode_t mode);
508asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 536asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
509 struct file_handle __user *handle, 537 struct file_handle __user *handle,
510 int flags); 538 int flags);
539asmlinkage long compat_sys_truncate(const char __user *, compat_off_t);
540asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t);
511asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 541asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
512 compat_ulong_t __user *outp, 542 compat_ulong_t __user *outp,
513 compat_ulong_t __user *exp, 543 compat_ulong_t __user *exp,
@@ -592,6 +622,19 @@ asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
592 struct compat_timespec __user *uts, compat_size_t sigsetsize); 622 struct compat_timespec __user *uts, compat_size_t sigsetsize);
593asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, 623asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
594 compat_size_t sigsetsize); 624 compat_size_t sigsetsize);
625asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
626 compat_sigset_t __user *oset,
627 compat_size_t sigsetsize);
628asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
629 compat_size_t sigsetsize);
630#ifndef CONFIG_ODD_RT_SIGACTION
631asmlinkage long compat_sys_rt_sigaction(int,
632 const struct compat_sigaction __user *,
633 struct compat_sigaction __user *,
634 compat_size_t);
635#endif
636asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
637 struct compat_siginfo __user *uinfo);
595asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); 638asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
596asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 639asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
597 unsigned long arg); 640 unsigned long arg);
@@ -642,13 +685,11 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
642 685
643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 686asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
644 compat_off_t __user *offset, compat_size_t count); 687 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 688asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr); 689 compat_stack_t __user *uoss_ptr);
648 690
649int compat_restore_altstack(const compat_stack_t __user *uss); 691int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long); 692int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
652 693
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 694asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval); 695 struct compat_timespec __user *interval);
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 51494e6b5548..33f0280fd533 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -77,10 +77,13 @@ static inline void init_completion(struct completion *x)
77} 77}
78 78
79extern void wait_for_completion(struct completion *); 79extern void wait_for_completion(struct completion *);
80extern void wait_for_completion_io(struct completion *);
80extern int wait_for_completion_interruptible(struct completion *x); 81extern int wait_for_completion_interruptible(struct completion *x);
81extern int wait_for_completion_killable(struct completion *x); 82extern int wait_for_completion_killable(struct completion *x);
82extern unsigned long wait_for_completion_timeout(struct completion *x, 83extern unsigned long wait_for_completion_timeout(struct completion *x,
83 unsigned long timeout); 84 unsigned long timeout);
85extern unsigned long wait_for_completion_io_timeout(struct completion *x,
86 unsigned long timeout);
84extern long wait_for_completion_interruptible_timeout( 87extern long wait_for_completion_interruptible_timeout(
85 struct completion *x, unsigned long timeout); 88 struct completion *x, unsigned long timeout);
86extern long wait_for_completion_killable_timeout( 89extern long wait_for_completion_killable_timeout(
diff --git a/include/linux/console.h b/include/linux/console.h
index 3b709da1786e..29680a8cda99 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -77,7 +77,9 @@ extern const struct consw prom_con; /* SPARC PROM console */
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); 78int register_con_driver(const struct consw *csw, int first, int last);
79int unregister_con_driver(const struct consw *csw); 79int unregister_con_driver(const struct consw *csw);
80int do_unregister_con_driver(const struct consw *csw);
80int take_over_console(const struct consw *sw, int first, int last, int deflt); 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);
81void give_up_console(const struct consw *sw); 83void give_up_console(const struct consw *sw);
82#ifdef CONFIG_HW_CONSOLE 84#ifdef CONFIG_HW_CONSOLE
83int con_debug_enter(struct vc_data *vc); 85int con_debug_enter(struct vc_data *vc);
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 25baa287cff7..6a1101f24cfb 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -162,6 +162,8 @@ struct crush_map {
162 __u32 choose_local_fallback_tries; 162 __u32 choose_local_fallback_tries;
163 /* choose attempts before giving up */ 163 /* choose attempts before giving up */
164 __u32 choose_total_tries; 164 __u32 choose_total_tries;
165 /* attempt chooseleaf inner descent once; on failure retry outer descent */
166 __u32 chooseleaf_descend_once;
165}; 167};
166 168
167 169
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c1754b59ddd3..1a6bb81f0fe5 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -145,6 +145,7 @@ enum dentry_d_lock_class
145 145
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int);
148 int (*d_hash)(const struct dentry *, const struct inode *, 149 int (*d_hash)(const struct dentry *, const struct inode *,
149 struct qstr *); 150 struct qstr *);
150 int (*d_compare)(const struct dentry *, const struct inode *, 151 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -192,6 +193,8 @@ struct dentry_operations {
192#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x0200
193#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x0400
194 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800
197
195#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x1000
196 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
197 * dput() */ 200 * dput() */
@@ -293,9 +296,9 @@ extern void d_move(struct dentry *, struct dentry *);
293extern struct dentry *d_ancestor(struct dentry *, struct dentry *); 296extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
294 297
295/* appendix may either be NULL or be used for transname suffixes */ 298/* appendix may either be NULL or be used for transname suffixes */
296extern struct dentry *d_lookup(struct dentry *, struct qstr *); 299extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
297extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
298extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
299extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 302extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
300 const struct qstr *name, 303 const struct qstr *name,
301 unsigned *seq, struct inode *inode); 304 unsigned *seq, struct inode *inode);
@@ -333,7 +336,6 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
333extern char *__d_path(const struct path *, const struct path *, char *, int); 336extern char *__d_path(const struct path *, const struct path *, char *, int);
334extern char *d_absolute_path(const struct path *, char *, int); 337extern char *d_absolute_path(const struct path *, char *, int);
335extern char *d_path(const struct path *, char *, int); 338extern char *d_path(const struct path *, char *, int);
336extern char *d_path_with_unreachable(const struct path *, char *, int);
337extern char *dentry_path_raw(struct dentry *, char *, int); 339extern char *dentry_path_raw(struct dentry *, char *, int);
338extern char *dentry_path(struct dentry *, char *, int); 340extern char *dentry_path(struct dentry *, char *, int);
339 341
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 3bd46f766751..a975de1ff59f 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
51extern void debug_show_all_locks(void); 51extern void debug_show_all_locks(void);
52extern void debug_show_held_locks(struct task_struct *task); 52extern void debug_show_held_locks(struct task_struct *task);
53extern void debug_check_no_locks_freed(const void *from, unsigned long len); 53extern void debug_check_no_locks_freed(const void *from, unsigned long len);
54extern void debug_check_no_locks_held(struct task_struct *task); 54extern void debug_check_no_locks_held(void);
55#else 55#else
56static inline void debug_show_all_locks(void) 56static inline void debug_show_all_locks(void)
57{ 57{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
67} 67}
68 68
69static inline void 69static inline void
70debug_check_no_locks_held(struct task_struct *task) 70debug_check_no_locks_held(void)
71{ 71{
72} 72}
73#endif 73#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index bf6afa2fc432..1e483fa7afb4 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -68,8 +68,8 @@ typedef void (*dm_postsuspend_fn) (struct dm_target *ti);
68typedef int (*dm_preresume_fn) (struct dm_target *ti); 68typedef int (*dm_preresume_fn) (struct dm_target *ti);
69typedef void (*dm_resume_fn) (struct dm_target *ti); 69typedef void (*dm_resume_fn) (struct dm_target *ti);
70 70
71typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, 71typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
72 unsigned status_flags, char *result, unsigned maxlen); 72 unsigned status_flags, char *result, unsigned maxlen);
73 73
74typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 74typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
75 75
@@ -175,6 +175,14 @@ struct target_type {
175#define DM_TARGET_IMMUTABLE 0x00000004 175#define DM_TARGET_IMMUTABLE 0x00000004
176#define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE) 176#define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE)
177 177
178/*
179 * Some targets need to be sent the same WRITE bio severals times so
180 * that they can send copies of it to different devices. This function
181 * examines any supplied bio and returns the number of copies of it the
182 * target requires.
183 */
184typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio);
185
178struct dm_target { 186struct dm_target {
179 struct dm_table *table; 187 struct dm_table *table;
180 struct target_type *type; 188 struct target_type *type;
@@ -187,26 +195,26 @@ struct dm_target {
187 uint32_t max_io_len; 195 uint32_t max_io_len;
188 196
189 /* 197 /*
190 * A number of zero-length barrier requests that will be submitted 198 * A number of zero-length barrier bios that will be submitted
191 * to the target for the purpose of flushing cache. 199 * to the target for the purpose of flushing cache.
192 * 200 *
193 * The request number can be accessed with dm_bio_get_target_request_nr. 201 * The bio number can be accessed with dm_bio_get_target_bio_nr.
194 * It is a responsibility of the target driver to remap these requests 202 * It is a responsibility of the target driver to remap these bios
195 * to the real underlying devices. 203 * to the real underlying devices.
196 */ 204 */
197 unsigned num_flush_requests; 205 unsigned num_flush_bios;
198 206
199 /* 207 /*
200 * The number of discard requests that will be submitted to the target. 208 * The number of discard bios that will be submitted to the target.
201 * The request number can be accessed with dm_bio_get_target_request_nr. 209 * The bio number can be accessed with dm_bio_get_target_bio_nr.
202 */ 210 */
203 unsigned num_discard_requests; 211 unsigned num_discard_bios;
204 212
205 /* 213 /*
206 * The number of WRITE SAME requests that will be submitted to the target. 214 * The number of WRITE SAME bios that will be submitted to the target.
207 * The request number can be accessed with dm_bio_get_target_request_nr. 215 * The bio number can be accessed with dm_bio_get_target_bio_nr.
208 */ 216 */
209 unsigned num_write_same_requests; 217 unsigned num_write_same_bios;
210 218
211 /* 219 /*
212 * The minimum number of extra bytes allocated in each bio for the 220 * The minimum number of extra bytes allocated in each bio for the
@@ -214,6 +222,13 @@ struct dm_target {
214 */ 222 */
215 unsigned per_bio_data_size; 223 unsigned per_bio_data_size;
216 224
225 /*
226 * If defined, this function is called to find out how many
227 * duplicate bios should be sent to the target when writing
228 * data.
229 */
230 dm_num_write_bios_fn num_write_bios;
231
217 /* target specific data */ 232 /* target specific data */
218 void *private; 233 void *private;
219 234
@@ -233,10 +248,10 @@ struct dm_target {
233 bool discards_supported:1; 248 bool discards_supported:1;
234 249
235 /* 250 /*
236 * Set if the target required discard request to be split 251 * Set if the target required discard bios to be split
237 * on max_io_len boundary. 252 * on max_io_len boundary.
238 */ 253 */
239 bool split_discard_requests:1; 254 bool split_discard_bios:1;
240 255
241 /* 256 /*
242 * Set if this target does not return zeroes on discarded blocks. 257 * Set if this target does not return zeroes on discarded blocks.
@@ -261,7 +276,7 @@ struct dm_target_io {
261 struct dm_io *io; 276 struct dm_io *io;
262 struct dm_target *ti; 277 struct dm_target *ti;
263 union map_info info; 278 union map_info info;
264 unsigned target_request_nr; 279 unsigned target_bio_nr;
265 struct bio clone; 280 struct bio clone;
266}; 281};
267 282
@@ -275,9 +290,9 @@ static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
275 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone)); 290 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
276} 291}
277 292
278static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio) 293static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio)
279{ 294{
280 return container_of(bio, struct dm_target_io, clone)->target_request_nr; 295 return container_of(bio, struct dm_target_io, clone)->target_bio_nr;
281} 296}
282 297
283int dm_register_target(struct target_type *t); 298int dm_register_target(struct target_type *t);
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
index 47d9d376e4e7..f486d636b82e 100644
--- a/include/linux/dm-kcopyd.h
+++ b/include/linux/dm-kcopyd.h
@@ -21,11 +21,34 @@
21 21
22#define DM_KCOPYD_IGNORE_ERROR 1 22#define DM_KCOPYD_IGNORE_ERROR 1
23 23
24struct dm_kcopyd_throttle {
25 unsigned throttle;
26 unsigned num_io_jobs;
27 unsigned io_period;
28 unsigned total_period;
29 unsigned last_jiffies;
30};
31
32/*
33 * kcopyd clients that want to support throttling must pass an initialised
34 * dm_kcopyd_throttle struct into dm_kcopyd_client_create().
35 * Two or more clients may share the same instance of this struct between
36 * them if they wish to be throttled as a group.
37 *
38 * This macro also creates a corresponding module parameter to configure
39 * the amount of throttling.
40 */
41#define DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(name, description) \
42static struct dm_kcopyd_throttle dm_kcopyd_throttle = { 100, 0, 0, 0, 0 }; \
43module_param_named(name, dm_kcopyd_throttle.throttle, uint, 0644); \
44MODULE_PARM_DESC(name, description)
45
24/* 46/*
25 * To use kcopyd you must first create a dm_kcopyd_client object. 47 * To use kcopyd you must first create a dm_kcopyd_client object.
48 * throttle can be NULL if you don't want any throttling.
26 */ 49 */
27struct dm_kcopyd_client; 50struct dm_kcopyd_client;
28struct dm_kcopyd_client *dm_kcopyd_client_create(void); 51struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle);
29void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); 52void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
30 53
31/* 54/*
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 3d754a394e92..9978b614a1aa 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -119,8 +119,10 @@ struct dma_buf {
119 struct file *file; 119 struct file *file;
120 struct list_head attachments; 120 struct list_head attachments;
121 const struct dma_buf_ops *ops; 121 const struct dma_buf_ops *ops;
122 /* mutex to serialize list manipulation and attach/detach */ 122 /* mutex to serialize list manipulation, attach/detach and vmap/unmap */
123 struct mutex lock; 123 struct mutex lock;
124 unsigned vmapping_counter;
125 void *vmap_ptr;
124 void *priv; 126 void *priv;
125}; 127};
126 128
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index d3201e438d16..91ac8da25020 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -608,7 +608,10 @@ static inline int dmaengine_device_control(struct dma_chan *chan,
608 enum dma_ctrl_cmd cmd, 608 enum dma_ctrl_cmd cmd,
609 unsigned long arg) 609 unsigned long arg)
610{ 610{
611 return chan->device->device_control(chan, cmd, arg); 611 if (chan->device->device_control)
612 return chan->device->device_control(chan, cmd, arg);
613
614 return -ENOSYS;
612} 615}
613 616
614static inline int dmaengine_slave_config(struct dma_chan *chan, 617static inline int dmaengine_slave_config(struct dma_chan *chan,
@@ -618,6 +621,11 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
618 (unsigned long)config); 621 (unsigned long)config);
619} 622}
620 623
624static inline bool is_slave_direction(enum dma_transfer_direction direction)
625{
626 return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
627}
628
621static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( 629static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
622 struct dma_chan *chan, dma_addr_t buf, size_t len, 630 struct dma_chan *chan, dma_addr_t buf, size_t len,
623 enum dma_transfer_direction dir, unsigned long flags) 631 enum dma_transfer_direction dir, unsigned long flags)
@@ -660,6 +668,13 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
660 period_len, dir, flags, NULL); 668 period_len, dir, flags, NULL);
661} 669}
662 670
671static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
672 struct dma_chan *chan, struct dma_interleaved_template *xt,
673 unsigned long flags)
674{
675 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
676}
677
663static inline int dmaengine_terminate_all(struct dma_chan *chan) 678static inline int dmaengine_terminate_all(struct dma_chan *chan)
664{ 679{
665 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); 680 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
@@ -849,20 +864,6 @@ static inline bool async_tx_test_ack(struct dma_async_tx_descriptor *tx)
849 return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK; 864 return (tx->flags & DMA_CTRL_ACK) == DMA_CTRL_ACK;
850} 865}
851 866
852#define first_dma_cap(mask) __first_dma_cap(&(mask))
853static inline int __first_dma_cap(const dma_cap_mask_t *srcp)
854{
855 return min_t(int, DMA_TX_TYPE_END,
856 find_first_bit(srcp->bits, DMA_TX_TYPE_END));
857}
858
859#define next_dma_cap(n, mask) __next_dma_cap((n), &(mask))
860static inline int __next_dma_cap(int n, const dma_cap_mask_t *srcp)
861{
862 return min_t(int, DMA_TX_TYPE_END,
863 find_next_bit(srcp->bits, DMA_TX_TYPE_END, n+1));
864}
865
866#define dma_cap_set(tx, mask) __dma_cap_set((tx), &(mask)) 867#define dma_cap_set(tx, mask) __dma_cap_set((tx), &(mask))
867static inline void 868static inline void
868__dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp) 869__dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
@@ -891,9 +892,7 @@ __dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp)
891} 892}
892 893
893#define for_each_dma_cap_mask(cap, mask) \ 894#define for_each_dma_cap_mask(cap, mask) \
894 for ((cap) = first_dma_cap(mask); \ 895 for_each_set_bit(cap, mask.bits, DMA_TX_TYPE_END)
895 (cap) < DMA_TX_TYPE_END; \
896 (cap) = next_dma_cap((cap), (mask)))
897 896
898/** 897/**
899 * dma_async_issue_pending - flush pending transactions to HW 898 * dma_async_issue_pending - flush pending transactions to HW
@@ -907,8 +906,6 @@ static inline void dma_async_issue_pending(struct dma_chan *chan)
907 chan->device->device_issue_pending(chan); 906 chan->device->device_issue_pending(chan);
908} 907}
909 908
910#define dma_async_memcpy_issue_pending(chan) dma_async_issue_pending(chan)
911
912/** 909/**
913 * dma_async_is_tx_complete - poll for transaction completion 910 * dma_async_is_tx_complete - poll for transaction completion
914 * @chan: DMA channel 911 * @chan: DMA channel
@@ -934,16 +931,13 @@ static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan,
934 return status; 931 return status;
935} 932}
936 933
937#define dma_async_memcpy_complete(chan, cookie, last, used)\
938 dma_async_is_tx_complete(chan, cookie, last, used)
939
940/** 934/**
941 * dma_async_is_complete - test a cookie against chan state 935 * dma_async_is_complete - test a cookie against chan state
942 * @cookie: transaction identifier to test status of 936 * @cookie: transaction identifier to test status of
943 * @last_complete: last know completed transaction 937 * @last_complete: last know completed transaction
944 * @last_used: last cookie value handed out 938 * @last_used: last cookie value handed out
945 * 939 *
946 * dma_async_is_complete() is used in dma_async_memcpy_complete() 940 * dma_async_is_complete() is used in dma_async_is_tx_complete()
947 * the test logic is separated for lightweight testing of multiple cookies 941 * the test logic is separated for lightweight testing of multiple cookies
948 */ 942 */
949static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie, 943static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
@@ -974,6 +968,7 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
974enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 968enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
975void dma_issue_pending_all(void); 969void dma_issue_pending_all(void);
976struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); 970struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
971struct dma_chan *dma_request_slave_channel(struct device *dev, char *name);
977void dma_release_channel(struct dma_chan *chan); 972void dma_release_channel(struct dma_chan *chan);
978#else 973#else
979static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 974static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
@@ -988,6 +983,11 @@ static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask,
988{ 983{
989 return NULL; 984 return NULL;
990} 985}
986static inline struct dma_chan *dma_request_slave_channel(struct device *dev,
987 char *name)
988{
989 return NULL;
990}
991static inline void dma_release_channel(struct dma_chan *chan) 991static inline void dma_release_channel(struct dma_chan *chan)
992{ 992{
993} 993}
@@ -1001,6 +1001,22 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
1001struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 1001struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
1002struct dma_chan *net_dma_find_channel(void); 1002struct dma_chan *net_dma_find_channel(void);
1003#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1003#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1004#define dma_request_slave_channel_compat(mask, x, y, dev, name) \
1005 __dma_request_slave_channel_compat(&(mask), x, y, dev, name)
1006
1007static inline struct dma_chan
1008*__dma_request_slave_channel_compat(dma_cap_mask_t *mask, dma_filter_fn fn,
1009 void *fn_param, struct device *dev,
1010 char *name)
1011{
1012 struct dma_chan *chan;
1013
1014 chan = dma_request_slave_channel(dev, name);
1015 if (chan)
1016 return chan;
1017
1018 return __dma_request_channel(mask, fn, fn_param);
1019}
1004 1020
1005/* --- Helper iov-locking functions --- */ 1021/* --- Helper iov-locking functions --- */
1006 1022
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index e1c8c9e919ac..481ab2345d6b 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -15,14 +15,37 @@
15#include <linux/dmaengine.h> 15#include <linux/dmaengine.h>
16 16
17/** 17/**
18 * struct dw_dma_slave - Controller-specific information about a slave
19 *
20 * @dma_dev: required DMA master device. Depricated.
21 * @bus_id: name of this device channel, not just a device name since
22 * devices may have more than one channel e.g. "foo_tx"
23 * @cfg_hi: Platform-specific initializer for the CFG_HI register
24 * @cfg_lo: Platform-specific initializer for the CFG_LO register
25 * @src_master: src master for transfers on allocated channel.
26 * @dst_master: dest master for transfers on allocated channel.
27 */
28struct dw_dma_slave {
29 struct device *dma_dev;
30 u32 cfg_hi;
31 u32 cfg_lo;
32 u8 src_master;
33 u8 dst_master;
34};
35
36/**
18 * struct dw_dma_platform_data - Controller configuration parameters 37 * struct dw_dma_platform_data - Controller configuration parameters
19 * @nr_channels: Number of channels supported by hardware (max 8) 38 * @nr_channels: Number of channels supported by hardware (max 8)
20 * @is_private: The device channels should be marked as private and not for 39 * @is_private: The device channels should be marked as private and not for
21 * by the general purpose DMA channel allocator. 40 * by the general purpose DMA channel allocator.
41 * @chan_allocation_order: Allocate channels starting from 0 or 7
42 * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0.
22 * @block_size: Maximum block size supported by the controller 43 * @block_size: Maximum block size supported by the controller
23 * @nr_masters: Number of AHB masters supported by the controller 44 * @nr_masters: Number of AHB masters supported by the controller
24 * @data_width: Maximum data width supported by hardware per AHB master 45 * @data_width: Maximum data width supported by hardware per AHB master
25 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) 46 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
47 * @sd: slave specific data. Used for configuring channels
48 * @sd_count: count of slave data structures passed.
26 */ 49 */
27struct dw_dma_platform_data { 50struct dw_dma_platform_data {
28 unsigned int nr_channels; 51 unsigned int nr_channels;
@@ -50,23 +73,6 @@ enum dw_dma_msize {
50 DW_DMA_MSIZE_256, 73 DW_DMA_MSIZE_256,
51}; 74};
52 75
53/**
54 * struct dw_dma_slave - Controller-specific information about a slave
55 *
56 * @dma_dev: required DMA master device
57 * @cfg_hi: Platform-specific initializer for the CFG_HI register
58 * @cfg_lo: Platform-specific initializer for the CFG_LO register
59 * @src_master: src master for transfers on allocated channel.
60 * @dst_master: dest master for transfers on allocated channel.
61 */
62struct dw_dma_slave {
63 struct device *dma_dev;
64 u32 cfg_hi;
65 u32 cfg_lo;
66 u8 src_master;
67 u8 dst_master;
68};
69
70/* Platform-configurable bits in CFG_HI */ 76/* Platform-configurable bits in CFG_HI */
71#define DWC_CFGH_FCMODE (1 << 0) 77#define DWC_CFGH_FCMODE (1 << 0)
72#define DWC_CFGH_FIFO_MODE (1 << 1) 78#define DWC_CFGH_FIFO_MODE (1 << 1)
diff --git a/include/linux/ecryptfs.h b/include/linux/ecryptfs.h
index 2224a8c0cb64..8d5ab998a222 100644
--- a/include/linux/ecryptfs.h
+++ b/include/linux/ecryptfs.h
@@ -6,9 +6,8 @@
6#define ECRYPTFS_VERSION_MINOR 0x04 6#define ECRYPTFS_VERSION_MINOR 0x04
7#define ECRYPTFS_SUPPORTED_FILE_VERSION 0x03 7#define ECRYPTFS_SUPPORTED_FILE_VERSION 0x03
8/* These flags indicate which features are supported by the kernel 8/* These flags indicate which features are supported by the kernel
9 * module; userspace tools such as the mount helper read 9 * module; userspace tools such as the mount helper read the feature
10 * ECRYPTFS_VERSIONING_MASK from a sysfs handle in order to determine 10 * bits from a sysfs handle in order to determine how to behave. */
11 * how to behave. */
12#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001 11#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
13#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002 12#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
14#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004 13#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
@@ -19,13 +18,6 @@
19#define ECRYPTFS_VERSIONING_HMAC 0x00000080 18#define ECRYPTFS_VERSIONING_HMAC 0x00000080
20#define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100 19#define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100
21#define ECRYPTFS_VERSIONING_GCM 0x00000200 20#define ECRYPTFS_VERSIONING_GCM 0x00000200
22#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
23 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
24 | ECRYPTFS_VERSIONING_PUBKEY \
25 | ECRYPTFS_VERSIONING_XATTR \
26 | ECRYPTFS_VERSIONING_MULTKEY \
27 | ECRYPTFS_VERSIONING_DEVMISC \
28 | ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION)
29#define ECRYPTFS_MAX_PASSWORD_LENGTH 64 21#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
30#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH 22#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
31#define ECRYPTFS_SALT_SIZE 8 23#define ECRYPTFS_SALT_SIZE 8
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 1b8c02b36f76..4fd4999ccb5b 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -14,7 +14,6 @@
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/kobject.h>
18#include <linux/completion.h> 17#include <linux/completion.h>
19#include <linux/workqueue.h> 18#include <linux/workqueue.h>
20#include <linux/debugfs.h> 19#include <linux/debugfs.h>
@@ -48,8 +47,17 @@ static inline void opstate_init(void)
48 return; 47 return;
49} 48}
50 49
50/* Max length of a DIMM label*/
51#define EDAC_MC_LABEL_LEN 31 51#define EDAC_MC_LABEL_LEN 31
52#define MC_PROC_NAME_MAX_LEN 7 52
53/* Maximum size of the location string */
54#define LOCATION_SIZE 80
55
56/* Defines the maximum number of labels that can be reported */
57#define EDAC_MAX_LABELS 8
58
59/* String used to join two or more labels */
60#define OTHER_LABEL " or "
53 61
54/** 62/**
55 * enum dev_type - describe the type of memory DRAM chips used at the stick 63 * enum dev_type - describe the type of memory DRAM chips used at the stick
@@ -101,8 +109,24 @@ enum hw_event_mc_err_type {
101 HW_EVENT_ERR_CORRECTED, 109 HW_EVENT_ERR_CORRECTED,
102 HW_EVENT_ERR_UNCORRECTED, 110 HW_EVENT_ERR_UNCORRECTED,
103 HW_EVENT_ERR_FATAL, 111 HW_EVENT_ERR_FATAL,
112 HW_EVENT_ERR_INFO,
104}; 113};
105 114
115static inline char *mc_event_error_type(const unsigned int err_type)
116{
117 switch (err_type) {
118 case HW_EVENT_ERR_CORRECTED:
119 return "Corrected";
120 case HW_EVENT_ERR_UNCORRECTED:
121 return "Uncorrected";
122 case HW_EVENT_ERR_FATAL:
123 return "Fatal";
124 default:
125 case HW_EVENT_ERR_INFO:
126 return "Info";
127 }
128}
129
106/** 130/**
107 * enum mem_type - memory types. For a more detailed reference, please see 131 * enum mem_type - memory types. For a more detailed reference, please see
108 * http://en.wikipedia.org/wiki/DRAM 132 * http://en.wikipedia.org/wiki/DRAM
@@ -376,6 +400,9 @@ enum scrub_type {
376 * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel" 400 * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel"
377 * @EDAC_MC_LAYER_SLOT: memory layer is named "slot" 401 * @EDAC_MC_LAYER_SLOT: memory layer is named "slot"
378 * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select" 402 * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select"
403 * @EDAC_MC_LAYER_ALL_MEM: memory layout is unknown. All memory is mapped
404 * as a single memory area. This is used when
405 * retrieving errors from a firmware driven driver.
379 * 406 *
380 * This enum is used by the drivers to tell edac_mc_sysfs what name should 407 * This enum is used by the drivers to tell edac_mc_sysfs what name should
381 * be used when describing a memory stick location. 408 * be used when describing a memory stick location.
@@ -385,6 +412,7 @@ enum edac_mc_layer_type {
385 EDAC_MC_LAYER_CHANNEL, 412 EDAC_MC_LAYER_CHANNEL,
386 EDAC_MC_LAYER_SLOT, 413 EDAC_MC_LAYER_SLOT,
387 EDAC_MC_LAYER_CHIP_SELECT, 414 EDAC_MC_LAYER_CHIP_SELECT,
415 EDAC_MC_LAYER_ALL_MEM,
388}; 416};
389 417
390/** 418/**
@@ -551,6 +579,46 @@ struct errcount_attribute_data {
551 int layer0, layer1, layer2; 579 int layer0, layer1, layer2;
552}; 580};
553 581
582/**
583 * edac_raw_error_desc - Raw error report structure
584 * @grain: minimum granularity for an error report, in bytes
585 * @error_count: number of errors of the same type
586 * @top_layer: top layer of the error (layer[0])
587 * @mid_layer: middle layer of the error (layer[1])
588 * @low_layer: low layer of the error (layer[2])
589 * @page_frame_number: page where the error happened
590 * @offset_in_page: page offset
591 * @syndrome: syndrome of the error (or 0 if unknown or if
592 * the syndrome is not applicable)
593 * @msg: error message
594 * @location: location of the error
595 * @label: label of the affected DIMM(s)
596 * @other_detail: other driver-specific detail about the error
597 * @enable_per_layer_report: if false, the error affects all layers
598 * (typically, a memory controller error)
599 */
600struct edac_raw_error_desc {
601 /*
602 * NOTE: everything before grain won't be cleaned by
603 * edac_raw_error_desc_clean()
604 */
605 char location[LOCATION_SIZE];
606 char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS];
607 long grain;
608
609 /* the vars below and grain will be cleaned on every new error report */
610 u16 error_count;
611 int top_layer;
612 int mid_layer;
613 int low_layer;
614 unsigned long page_frame_number;
615 unsigned long offset_in_page;
616 unsigned long syndrome;
617 const char *msg;
618 const char *other_detail;
619 bool enable_per_layer_report;
620};
621
554/* MEMORY controller information structure 622/* MEMORY controller information structure
555 */ 623 */
556struct mem_ctl_info { 624struct mem_ctl_info {
@@ -630,7 +698,6 @@ struct mem_ctl_info {
630 const char *mod_ver; 698 const char *mod_ver;
631 const char *ctl_name; 699 const char *ctl_name;
632 const char *dev_name; 700 const char *dev_name;
633 char proc_name[MC_PROC_NAME_MAX_LEN + 1];
634 void *pvt_info; 701 void *pvt_info;
635 unsigned long start_time; /* mci load start time (in jiffies) */ 702 unsigned long start_time; /* mci load start time (in jiffies) */
636 703
@@ -659,6 +726,12 @@ struct mem_ctl_info {
659 /* work struct for this MC */ 726 /* work struct for this MC */
660 struct delayed_work work; 727 struct delayed_work work;
661 728
729 /*
730 * Used to report an error - by being at the global struct
731 * makes the memory allocated by the EDAC core
732 */
733 struct edac_raw_error_desc error_desc;
734
662 /* the internal state of this controller instance */ 735 /* the internal state of this controller instance */
663 int op_state; 736 int op_state;
664 737
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 186620631750..acd0312d46fb 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -2,6 +2,7 @@
2#define _LINUX_ELEVATOR_H 2#define _LINUX_ELEVATOR_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/hashtable.h>
5 6
6#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
7 8
@@ -96,6 +97,8 @@ struct elevator_type
96 struct list_head list; 97 struct list_head list;
97}; 98};
98 99
100#define ELV_HASH_BITS 6
101
99/* 102/*
100 * each queue has an elevator_queue associated with it 103 * each queue has an elevator_queue associated with it
101 */ 104 */
@@ -105,8 +108,8 @@ struct elevator_queue
105 void *elevator_data; 108 void *elevator_data;
106 struct kobject kobj; 109 struct kobject kobj;
107 struct mutex sysfs_lock; 110 struct mutex sysfs_lock;
108 struct hlist_head *hash;
109 unsigned int registered:1; 111 unsigned int registered:1;
112 DECLARE_HASHTABLE(hash, ELV_HASH_BITS);
110}; 113};
111 114
112/* 115/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8c9048e33463..40a3c0e01b2b 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -10,6 +10,10 @@
10 Override in asm/elf.h as needed. */ 10 Override in asm/elf.h as needed. */
11# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 11# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
12#endif 12#endif
13#ifndef SET_PERSONALITY
14#define SET_PERSONALITY(ex) \
15 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
16#endif
13 17
14#if ELF_CLASS == ELFCLASS32 18#if ELF_CLASS == ELFCLASS32
15 19
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 3c3ef19a625a..cf5d2af61b81 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -13,7 +13,7 @@
13#include <linux/wait.h> 13#include <linux/wait.h>
14 14
15/* 15/*
16 * CAREFUL: Check include/asm-generic/fcntl.h when defining 16 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining
17 * new flags, since they might collide with O_* ones. We want 17 * new flags, since they might collide with O_* ones. We want
18 * to re-use O_* flags that couldn't possibly have a meaning 18 * to re-use O_* flags that couldn't possibly have a meaning
19 * from eventfd, in order to leave a free define-space for 19 * from eventfd, in order to leave a free define-space for
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a95714b1fe..58b98606ac26 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -19,6 +19,8 @@ struct vm_area_struct;
19struct fb_info; 19struct fb_info;
20struct device; 20struct device;
21struct file; 21struct file;
22struct videomode;
23struct device_node;
22 24
23/* Definitions below are used in the parsed monitor specs */ 25/* Definitions below are used in the parsed monitor specs */
24#define FB_DPMS_ACTIVE_OFF 1 26#define FB_DPMS_ACTIVE_OFF 1
@@ -714,6 +716,12 @@ extern void fb_destroy_modedb(struct fb_videomode *modedb);
714extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); 716extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
715extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); 717extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
716 718
719extern int of_get_fb_videomode(struct device_node *np,
720 struct fb_videomode *fb,
721 int index);
722extern int fb_videomode_from_videomode(const struct videomode *vm,
723 struct fb_videomode *fbmode);
724
717/* drivers/video/modedb.c */ 725/* drivers/video/modedb.c */
718#define VESA_MODEDB_SIZE 34 726#define VESA_MODEDB_SIZE 34
719extern void fb_var_to_videomode(struct fb_videomode *mode, 727extern void fb_var_to_videomode(struct fb_videomode *mode,
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index 43fe52fcef0f..71d4fa721db9 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -25,6 +25,7 @@
25 25
26int firmware_map_add_early(u64 start, u64 end, const char *type); 26int firmware_map_add_early(u64 start, u64 end, const char *type);
27int firmware_map_add_hotplug(u64 start, u64 end, const char *type); 27int firmware_map_add_hotplug(u64 start, u64 end, const char *type);
28int firmware_map_remove(u64 start, u64 end, const char *type);
28 29
29#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
30 31
@@ -38,6 +39,11 @@ static inline int firmware_map_add_hotplug(u64 start, u64 end, const char *type)
38 return 0; 39 return 0;
39} 40}
40 41
42static inline int firmware_map_remove(u64 start, u64 end, const char *type)
43{
44 return 0;
45}
46
41#endif /* CONFIG_FIRMWARE_MEMMAP */ 47#endif /* CONFIG_FIRMWARE_MEMMAP */
42 48
43#endif /* _LINUX_FIRMWARE_MAP_H */ 49#endif /* _LINUX_FIRMWARE_MAP_H */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e70df40d84f6..043a5cf8b5ba 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
3#ifndef FREEZER_H_INCLUDED 3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/debug_locks.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/wait.h> 8#include <linux/wait.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
@@ -48,6 +49,8 @@ extern void thaw_kernel_threads(void);
48 49
49static inline bool try_to_freeze(void) 50static inline bool try_to_freeze(void)
50{ 51{
52 if (!(current->flags & PF_NOFREEZE))
53 debug_check_no_locks_held();
51 might_sleep(); 54 might_sleep();
52 if (likely(!freezing(current))) 55 if (likely(!freezing(current)))
53 return false; 56 return false;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7d2e893ec3d1..74a907b8b950 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -769,7 +769,7 @@ struct file {
769 } f_u; 769 } f_u;
770 struct path f_path; 770 struct path f_path;
771#define f_dentry f_path.dentry 771#define f_dentry f_path.dentry
772#define f_vfsmnt f_path.mnt 772 struct inode *f_inode; /* cached value */
773 const struct file_operations *f_op; 773 const struct file_operations *f_op;
774 774
775 /* 775 /*
@@ -1807,7 +1807,6 @@ struct file_system_type {
1807#define FS_HAS_SUBTYPE 4 1807#define FS_HAS_SUBTYPE 4
1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ 1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ 1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
1810#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1811#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 1810#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1812 struct dentry *(*mount) (struct file_system_type *, int, 1811 struct dentry *(*mount) (struct file_system_type *, int,
1813 const char *, void *); 1812 const char *, void *);
@@ -2217,6 +2216,11 @@ static inline bool execute_ok(struct inode *inode)
2217 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2216 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2218} 2217}
2219 2218
2219static inline struct inode *file_inode(struct file *f)
2220{
2221 return f->f_inode;
2222}
2223
2220/* 2224/*
2221 * get_write_access() gets write permission for a file. 2225 * get_write_access() gets write permission for a file.
2222 * put_write_access() releases this write permission. 2226 * put_write_access() releases this write permission.
@@ -2239,7 +2243,7 @@ static inline int get_write_access(struct inode *inode)
2239} 2243}
2240static inline int deny_write_access(struct file *file) 2244static inline int deny_write_access(struct file *file)
2241{ 2245{
2242 struct inode *inode = file->f_path.dentry->d_inode; 2246 struct inode *inode = file_inode(file);
2243 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; 2247 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY;
2244} 2248}
2245static inline void put_write_access(struct inode * inode) 2249static inline void put_write_access(struct inode * inode)
@@ -2249,7 +2253,7 @@ static inline void put_write_access(struct inode * inode)
2249static inline void allow_write_access(struct file *file) 2253static inline void allow_write_access(struct file *file)
2250{ 2254{
2251 if (file) 2255 if (file)
2252 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2256 atomic_inc(&file_inode(file)->i_writecount);
2253} 2257}
2254#ifdef CONFIG_IMA 2258#ifdef CONFIG_IMA
2255static inline void i_readcount_dec(struct inode *inode) 2259static inline void i_readcount_dec(struct inode *inode)
@@ -2274,6 +2278,7 @@ static inline void i_readcount_inc(struct inode *inode)
2274extern int do_pipe_flags(int *, int); 2278extern int do_pipe_flags(int *, int);
2275 2279
2276extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2280extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2281extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2277extern struct file * open_exec(const char *); 2282extern struct file * open_exec(const char *);
2278 2283
2279/* fs/dcache.c -- generic fs support functions */ 2284/* fs/dcache.c -- generic fs support functions */
@@ -2463,7 +2468,7 @@ extern int page_symlink(struct inode *inode, const char *symname, int len);
2463extern const struct inode_operations page_symlink_inode_operations; 2468extern const struct inode_operations page_symlink_inode_operations;
2464extern int generic_readlink(struct dentry *, char __user *, int); 2469extern int generic_readlink(struct dentry *, char __user *, int);
2465extern void generic_fillattr(struct inode *, struct kstat *); 2470extern void generic_fillattr(struct inode *, struct kstat *);
2466extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2471extern int vfs_getattr(struct path *, struct kstat *);
2467void __inode_add_bytes(struct inode *inode, loff_t bytes); 2472void __inode_add_bytes(struct inode *inode, loff_t bytes);
2468void inode_add_bytes(struct inode *inode, loff_t bytes); 2473void inode_add_bytes(struct inode *inode, loff_t bytes);
2469void inode_sub_bytes(struct inode *inode, loff_t bytes); 2474void inode_sub_bytes(struct inode *inode, loff_t bytes);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index d0ae3a84bcfb..729eded4b24f 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -17,8 +17,8 @@ struct fs_struct {
17extern struct kmem_cache *fs_cachep; 17extern struct kmem_cache *fs_cachep;
18 18
19extern void exit_fs(struct task_struct *); 19extern void exit_fs(struct task_struct *);
20extern void set_fs_root(struct fs_struct *, struct path *); 20extern void set_fs_root(struct fs_struct *, const struct path *);
21extern void set_fs_pwd(struct fs_struct *, struct path *); 21extern void set_fs_pwd(struct fs_struct *, const struct path *);
22extern struct fs_struct *copy_fs_struct(struct fs_struct *); 22extern struct fs_struct *copy_fs_struct(struct fs_struct *);
23extern void free_fs_struct(struct fs_struct *); 23extern void free_fs_struct(struct fs_struct *);
24extern int unshare_fs_struct(void); 24extern int unshare_fs_struct(void);
diff --git a/include/linux/fsl/bestcomm/ata.h b/include/linux/fsl/bestcomm/ata.h
new file mode 100644
index 000000000000..0b2371811334
--- /dev/null
+++ b/include/linux/fsl/bestcomm/ata.h
@@ -0,0 +1,30 @@
1/*
2 * Header for Bestcomm ATA task driver
3 *
4 *
5 * Copyright (C) 2006 Freescale - John Rigby
6 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#ifndef __BESTCOMM_ATA_H__
14#define __BESTCOMM_ATA_H__
15
16
17struct bcom_ata_bd {
18 u32 status;
19 u32 src_pa;
20 u32 dst_pa;
21};
22
23extern struct bcom_task * bcom_ata_init(int queue_len, int maxbufsize);
24extern void bcom_ata_rx_prepare(struct bcom_task *tsk);
25extern void bcom_ata_tx_prepare(struct bcom_task *tsk);
26extern void bcom_ata_reset_bd(struct bcom_task *tsk);
27extern void bcom_ata_release(struct bcom_task *tsk);
28
29#endif /* __BESTCOMM_ATA_H__ */
30
diff --git a/include/linux/fsl/bestcomm/bestcomm.h b/include/linux/fsl/bestcomm/bestcomm.h
new file mode 100644
index 000000000000..a0e2e6b19b57
--- /dev/null
+++ b/include/linux/fsl/bestcomm/bestcomm.h
@@ -0,0 +1,213 @@
1/*
2 * Public header for the MPC52xx processor BestComm driver
3 *
4 *
5 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2005 Varma Electronics Oy,
7 * ( by Andrey Volkov <avolkov@varma-el.com> )
8 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
9 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#ifndef __BESTCOMM_H__
17#define __BESTCOMM_H__
18
19/**
20 * struct bcom_bd - Structure describing a generic BestComm buffer descriptor
21 * @status: The current status of this buffer. Exact meaning depends on the
22 * task type
23 * @data: An array of u32 extra data. Size of array is task dependent.
24 *
25 * Note: Don't dereference a bcom_bd pointer as an array. The size of the
26 * bcom_bd is variable. Use bcom_get_bd() instead.
27 */
28struct bcom_bd {
29 u32 status;
30 u32 data[0]; /* variable payload size */
31};
32
33/* ======================================================================== */
34/* Generic task management */
35/* ======================================================================== */
36
37/**
38 * struct bcom_task - Structure describing a loaded BestComm task
39 *
40 * This structure is never built by the driver it self. It's built and
41 * filled the intermediate layer of the BestComm API, the task dependent
42 * support code.
43 *
44 * Most likely you don't need to poke around inside this structure. The
45 * fields are exposed in the header just for the sake of inline functions
46 */
47struct bcom_task {
48 unsigned int tasknum;
49 unsigned int flags;
50 int irq;
51
52 struct bcom_bd *bd;
53 phys_addr_t bd_pa;
54 void **cookie;
55 unsigned short index;
56 unsigned short outdex;
57 unsigned int num_bd;
58 unsigned int bd_size;
59
60 void* priv;
61};
62
63#define BCOM_FLAGS_NONE 0x00000000ul
64#define BCOM_FLAGS_ENABLE_TASK (1ul << 0)
65
66/**
67 * bcom_enable - Enable a BestComm task
68 * @tsk: The BestComm task structure
69 *
70 * This function makes sure the given task is enabled and can be run
71 * by the BestComm engine as needed
72 */
73extern void bcom_enable(struct bcom_task *tsk);
74
75/**
76 * bcom_disable - Disable a BestComm task
77 * @tsk: The BestComm task structure
78 *
79 * This function disable a given task, making sure it's not executed
80 * by the BestComm engine.
81 */
82extern void bcom_disable(struct bcom_task *tsk);
83
84
85/**
86 * bcom_get_task_irq - Returns the irq number of a BestComm task
87 * @tsk: The BestComm task structure
88 */
89static inline int
90bcom_get_task_irq(struct bcom_task *tsk) {
91 return tsk->irq;
92}
93
94/* ======================================================================== */
95/* BD based tasks helpers */
96/* ======================================================================== */
97
98#define BCOM_BD_READY 0x40000000ul
99
100/** _bcom_next_index - Get next input index.
101 * @tsk: pointer to task structure
102 *
103 * Support function; Device drivers should not call this
104 */
105static inline int
106_bcom_next_index(struct bcom_task *tsk)
107{
108 return ((tsk->index + 1) == tsk->num_bd) ? 0 : tsk->index + 1;
109}
110
111/** _bcom_next_outdex - Get next output index.
112 * @tsk: pointer to task structure
113 *
114 * Support function; Device drivers should not call this
115 */
116static inline int
117_bcom_next_outdex(struct bcom_task *tsk)
118{
119 return ((tsk->outdex + 1) == tsk->num_bd) ? 0 : tsk->outdex + 1;
120}
121
122/**
123 * bcom_queue_empty - Checks if a BestComm task BD queue is empty
124 * @tsk: The BestComm task structure
125 */
126static inline int
127bcom_queue_empty(struct bcom_task *tsk)
128{
129 return tsk->index == tsk->outdex;
130}
131
132/**
133 * bcom_queue_full - Checks if a BestComm task BD queue is full
134 * @tsk: The BestComm task structure
135 */
136static inline int
137bcom_queue_full(struct bcom_task *tsk)
138{
139 return tsk->outdex == _bcom_next_index(tsk);
140}
141
142/**
143 * bcom_get_bd - Get a BD from the queue
144 * @tsk: The BestComm task structure
145 * index: Index of the BD to fetch
146 */
147static inline struct bcom_bd
148*bcom_get_bd(struct bcom_task *tsk, unsigned int index)
149{
150 /* A cast to (void*) so the address can be incremented by the
151 * real size instead of by sizeof(struct bcom_bd) */
152 return ((void *)tsk->bd) + (index * tsk->bd_size);
153}
154
155/**
156 * bcom_buffer_done - Checks if a BestComm
157 * @tsk: The BestComm task structure
158 */
159static inline int
160bcom_buffer_done(struct bcom_task *tsk)
161{
162 struct bcom_bd *bd;
163 if (bcom_queue_empty(tsk))
164 return 0;
165
166 bd = bcom_get_bd(tsk, tsk->outdex);
167 return !(bd->status & BCOM_BD_READY);
168}
169
170/**
171 * bcom_prepare_next_buffer - clear status of next available buffer.
172 * @tsk: The BestComm task structure
173 *
174 * Returns pointer to next buffer descriptor
175 */
176static inline struct bcom_bd *
177bcom_prepare_next_buffer(struct bcom_task *tsk)
178{
179 struct bcom_bd *bd;
180
181 bd = bcom_get_bd(tsk, tsk->index);
182 bd->status = 0; /* cleanup last status */
183 return bd;
184}
185
186static inline void
187bcom_submit_next_buffer(struct bcom_task *tsk, void *cookie)
188{
189 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->index);
190
191 tsk->cookie[tsk->index] = cookie;
192 mb(); /* ensure the bd is really up-to-date */
193 bd->status |= BCOM_BD_READY;
194 tsk->index = _bcom_next_index(tsk);
195 if (tsk->flags & BCOM_FLAGS_ENABLE_TASK)
196 bcom_enable(tsk);
197}
198
199static inline void *
200bcom_retrieve_buffer(struct bcom_task *tsk, u32 *p_status, struct bcom_bd **p_bd)
201{
202 void *cookie = tsk->cookie[tsk->outdex];
203 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->outdex);
204
205 if (p_status)
206 *p_status = bd->status;
207 if (p_bd)
208 *p_bd = bd;
209 tsk->outdex = _bcom_next_outdex(tsk);
210 return cookie;
211}
212
213#endif /* __BESTCOMM_H__ */
diff --git a/include/linux/fsl/bestcomm/bestcomm_priv.h b/include/linux/fsl/bestcomm/bestcomm_priv.h
new file mode 100644
index 000000000000..3b52f3ffbdf8
--- /dev/null
+++ b/include/linux/fsl/bestcomm/bestcomm_priv.h
@@ -0,0 +1,350 @@
1/*
2 * Private header for the MPC52xx processor BestComm driver
3 *
4 * By private, we mean that driver should not use it directly. It's meant
5 * to be used by the BestComm engine driver itself and by the intermediate
6 * layer between the core and the drivers.
7 *
8 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
9 * Copyright (C) 2005 Varma Electronics Oy,
10 * ( by Andrey Volkov <avolkov@varma-el.com> )
11 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
12 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
13 *
14 * This file is licensed under the terms of the GNU General Public License
15 * version 2. This program is licensed "as is" without any warranty of any
16 * kind, whether express or implied.
17 */
18
19#ifndef __BESTCOMM_PRIV_H__
20#define __BESTCOMM_PRIV_H__
21
22#include <linux/spinlock.h>
23#include <linux/of.h>
24#include <asm/io.h>
25#include <asm/mpc52xx.h>
26
27#include "sram.h"
28
29
30/* ======================================================================== */
31/* Engine related stuff */
32/* ======================================================================== */
33
34/* Zones sizes and needed alignments */
35#define BCOM_MAX_TASKS 16
36#define BCOM_MAX_VAR 24
37#define BCOM_MAX_INC 8
38#define BCOM_MAX_FDT 64
39#define BCOM_MAX_CTX 20
40#define BCOM_CTX_SIZE (BCOM_MAX_CTX * sizeof(u32))
41#define BCOM_CTX_ALIGN 0x100
42#define BCOM_VAR_SIZE (BCOM_MAX_VAR * sizeof(u32))
43#define BCOM_INC_SIZE (BCOM_MAX_INC * sizeof(u32))
44#define BCOM_VAR_ALIGN 0x80
45#define BCOM_FDT_SIZE (BCOM_MAX_FDT * sizeof(u32))
46#define BCOM_FDT_ALIGN 0x100
47
48/**
49 * struct bcom_tdt - Task Descriptor Table Entry
50 *
51 */
52struct bcom_tdt {
53 u32 start;
54 u32 stop;
55 u32 var;
56 u32 fdt;
57 u32 exec_status; /* used internally by BestComm engine */
58 u32 mvtp; /* used internally by BestComm engine */
59 u32 context;
60 u32 litbase;
61};
62
63/**
64 * struct bcom_engine
65 *
66 * This holds all info needed globaly to handle the engine
67 */
68struct bcom_engine {
69 struct device_node *ofnode;
70 struct mpc52xx_sdma __iomem *regs;
71 phys_addr_t regs_base;
72
73 struct bcom_tdt *tdt;
74 u32 *ctx;
75 u32 *var;
76 u32 *fdt;
77
78 spinlock_t lock;
79};
80
81extern struct bcom_engine *bcom_eng;
82
83
84/* ======================================================================== */
85/* Tasks related stuff */
86/* ======================================================================== */
87
88/* Tasks image header */
89#define BCOM_TASK_MAGIC 0x4243544B /* 'BCTK' */
90
91struct bcom_task_header {
92 u32 magic;
93 u8 desc_size; /* the size fields */
94 u8 var_size; /* are given in number */
95 u8 inc_size; /* of 32-bits words */
96 u8 first_var;
97 u8 reserved[8];
98};
99
100/* Descriptors structure & co */
101#define BCOM_DESC_NOP 0x000001f8
102#define BCOM_LCD_MASK 0x80000000
103#define BCOM_DRD_EXTENDED 0x40000000
104#define BCOM_DRD_INITIATOR_SHIFT 21
105
106/* Tasks pragma */
107#define BCOM_PRAGMA_BIT_RSV 7 /* reserved pragma bit */
108#define BCOM_PRAGMA_BIT_PRECISE_INC 6 /* increment 0=when possible, */
109 /* 1=iter end */
110#define BCOM_PRAGMA_BIT_RST_ERROR_NO 5 /* don't reset errors on */
111 /* task enable */
112#define BCOM_PRAGMA_BIT_PACK 4 /* pack data enable */
113#define BCOM_PRAGMA_BIT_INTEGER 3 /* data alignment */
114 /* 0=frac(msb), 1=int(lsb) */
115#define BCOM_PRAGMA_BIT_SPECREAD 2 /* XLB speculative read */
116#define BCOM_PRAGMA_BIT_CW 1 /* write line buffer enable */
117#define BCOM_PRAGMA_BIT_RL 0 /* read line buffer enable */
118
119 /* Looks like XLB speculative read generates XLB errors when a buffer
120 * is at the end of the physical memory. i.e. when accessing the
121 * lasts words, the engine tries to prefetch the next but there is no
122 * next ...
123 */
124#define BCOM_STD_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
125 (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
126 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
127 (0 << BCOM_PRAGMA_BIT_PACK) | \
128 (0 << BCOM_PRAGMA_BIT_INTEGER) | \
129 (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
130 (1 << BCOM_PRAGMA_BIT_CW) | \
131 (1 << BCOM_PRAGMA_BIT_RL))
132
133#define BCOM_PCI_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
134 (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
135 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
136 (0 << BCOM_PRAGMA_BIT_PACK) | \
137 (1 << BCOM_PRAGMA_BIT_INTEGER) | \
138 (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
139 (1 << BCOM_PRAGMA_BIT_CW) | \
140 (1 << BCOM_PRAGMA_BIT_RL))
141
142#define BCOM_ATA_PRAGMA BCOM_STD_PRAGMA
143#define BCOM_CRC16_DP_0_PRAGMA BCOM_STD_PRAGMA
144#define BCOM_CRC16_DP_1_PRAGMA BCOM_STD_PRAGMA
145#define BCOM_FEC_RX_BD_PRAGMA BCOM_STD_PRAGMA
146#define BCOM_FEC_TX_BD_PRAGMA BCOM_STD_PRAGMA
147#define BCOM_GEN_DP_0_PRAGMA BCOM_STD_PRAGMA
148#define BCOM_GEN_DP_1_PRAGMA BCOM_STD_PRAGMA
149#define BCOM_GEN_DP_2_PRAGMA BCOM_STD_PRAGMA
150#define BCOM_GEN_DP_3_PRAGMA BCOM_STD_PRAGMA
151#define BCOM_GEN_DP_BD_0_PRAGMA BCOM_STD_PRAGMA
152#define BCOM_GEN_DP_BD_1_PRAGMA BCOM_STD_PRAGMA
153#define BCOM_GEN_RX_BD_PRAGMA BCOM_STD_PRAGMA
154#define BCOM_GEN_TX_BD_PRAGMA BCOM_STD_PRAGMA
155#define BCOM_GEN_LPC_PRAGMA BCOM_STD_PRAGMA
156#define BCOM_PCI_RX_PRAGMA BCOM_PCI_PRAGMA
157#define BCOM_PCI_TX_PRAGMA BCOM_PCI_PRAGMA
158
159/* Initiators number */
160#define BCOM_INITIATOR_ALWAYS 0
161#define BCOM_INITIATOR_SCTMR_0 1
162#define BCOM_INITIATOR_SCTMR_1 2
163#define BCOM_INITIATOR_FEC_RX 3
164#define BCOM_INITIATOR_FEC_TX 4
165#define BCOM_INITIATOR_ATA_RX 5
166#define BCOM_INITIATOR_ATA_TX 6
167#define BCOM_INITIATOR_SCPCI_RX 7
168#define BCOM_INITIATOR_SCPCI_TX 8
169#define BCOM_INITIATOR_PSC3_RX 9
170#define BCOM_INITIATOR_PSC3_TX 10
171#define BCOM_INITIATOR_PSC2_RX 11
172#define BCOM_INITIATOR_PSC2_TX 12
173#define BCOM_INITIATOR_PSC1_RX 13
174#define BCOM_INITIATOR_PSC1_TX 14
175#define BCOM_INITIATOR_SCTMR_2 15
176#define BCOM_INITIATOR_SCLPC 16
177#define BCOM_INITIATOR_PSC5_RX 17
178#define BCOM_INITIATOR_PSC5_TX 18
179#define BCOM_INITIATOR_PSC4_RX 19
180#define BCOM_INITIATOR_PSC4_TX 20
181#define BCOM_INITIATOR_I2C2_RX 21
182#define BCOM_INITIATOR_I2C2_TX 22
183#define BCOM_INITIATOR_I2C1_RX 23
184#define BCOM_INITIATOR_I2C1_TX 24
185#define BCOM_INITIATOR_PSC6_RX 25
186#define BCOM_INITIATOR_PSC6_TX 26
187#define BCOM_INITIATOR_IRDA_RX 25
188#define BCOM_INITIATOR_IRDA_TX 26
189#define BCOM_INITIATOR_SCTMR_3 27
190#define BCOM_INITIATOR_SCTMR_4 28
191#define BCOM_INITIATOR_SCTMR_5 29
192#define BCOM_INITIATOR_SCTMR_6 30
193#define BCOM_INITIATOR_SCTMR_7 31
194
195/* Initiators priorities */
196#define BCOM_IPR_ALWAYS 7
197#define BCOM_IPR_SCTMR_0 2
198#define BCOM_IPR_SCTMR_1 2
199#define BCOM_IPR_FEC_RX 6
200#define BCOM_IPR_FEC_TX 5
201#define BCOM_IPR_ATA_RX 7
202#define BCOM_IPR_ATA_TX 7
203#define BCOM_IPR_SCPCI_RX 2
204#define BCOM_IPR_SCPCI_TX 2
205#define BCOM_IPR_PSC3_RX 2
206#define BCOM_IPR_PSC3_TX 2
207#define BCOM_IPR_PSC2_RX 2
208#define BCOM_IPR_PSC2_TX 2
209#define BCOM_IPR_PSC1_RX 2
210#define BCOM_IPR_PSC1_TX 2
211#define BCOM_IPR_SCTMR_2 2
212#define BCOM_IPR_SCLPC 2
213#define BCOM_IPR_PSC5_RX 2
214#define BCOM_IPR_PSC5_TX 2
215#define BCOM_IPR_PSC4_RX 2
216#define BCOM_IPR_PSC4_TX 2
217#define BCOM_IPR_I2C2_RX 2
218#define BCOM_IPR_I2C2_TX 2
219#define BCOM_IPR_I2C1_RX 2
220#define BCOM_IPR_I2C1_TX 2
221#define BCOM_IPR_PSC6_RX 2
222#define BCOM_IPR_PSC6_TX 2
223#define BCOM_IPR_IRDA_RX 2
224#define BCOM_IPR_IRDA_TX 2
225#define BCOM_IPR_SCTMR_3 2
226#define BCOM_IPR_SCTMR_4 2
227#define BCOM_IPR_SCTMR_5 2
228#define BCOM_IPR_SCTMR_6 2
229#define BCOM_IPR_SCTMR_7 2
230
231
232/* ======================================================================== */
233/* API */
234/* ======================================================================== */
235
236extern struct bcom_task *bcom_task_alloc(int bd_count, int bd_size, int priv_size);
237extern void bcom_task_free(struct bcom_task *tsk);
238extern int bcom_load_image(int task, u32 *task_image);
239extern void bcom_set_initiator(int task, int initiator);
240
241
242#define TASK_ENABLE 0x8000
243
244/**
245 * bcom_disable_prefetch - Hook to disable bus prefetching
246 *
247 * ATA DMA and the original MPC5200 need this due to silicon bugs. At the
248 * moment disabling prefetch is a one-way street. There is no mechanism
249 * in place to turn prefetch back on after it has been disabled. There is
250 * no reason it couldn't be done, it would just be more complex to implement.
251 */
252static inline void bcom_disable_prefetch(void)
253{
254 u16 regval;
255
256 regval = in_be16(&bcom_eng->regs->PtdCntrl);
257 out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
258};
259
260static inline void
261bcom_enable_task(int task)
262{
263 u16 reg;
264 reg = in_be16(&bcom_eng->regs->tcr[task]);
265 out_be16(&bcom_eng->regs->tcr[task], reg | TASK_ENABLE);
266}
267
268static inline void
269bcom_disable_task(int task)
270{
271 u16 reg = in_be16(&bcom_eng->regs->tcr[task]);
272 out_be16(&bcom_eng->regs->tcr[task], reg & ~TASK_ENABLE);
273}
274
275
276static inline u32 *
277bcom_task_desc(int task)
278{
279 return bcom_sram_pa2va(bcom_eng->tdt[task].start);
280}
281
282static inline int
283bcom_task_num_descs(int task)
284{
285 return (bcom_eng->tdt[task].stop - bcom_eng->tdt[task].start)/sizeof(u32) + 1;
286}
287
288static inline u32 *
289bcom_task_var(int task)
290{
291 return bcom_sram_pa2va(bcom_eng->tdt[task].var);
292}
293
294static inline u32 *
295bcom_task_inc(int task)
296{
297 return &bcom_task_var(task)[BCOM_MAX_VAR];
298}
299
300
301static inline int
302bcom_drd_is_extended(u32 desc)
303{
304 return (desc) & BCOM_DRD_EXTENDED;
305}
306
307static inline int
308bcom_desc_is_drd(u32 desc)
309{
310 return !(desc & BCOM_LCD_MASK) && desc != BCOM_DESC_NOP;
311}
312
313static inline int
314bcom_desc_initiator(u32 desc)
315{
316 return (desc >> BCOM_DRD_INITIATOR_SHIFT) & 0x1f;
317}
318
319static inline void
320bcom_set_desc_initiator(u32 *desc, int initiator)
321{
322 *desc = (*desc & ~(0x1f << BCOM_DRD_INITIATOR_SHIFT)) |
323 ((initiator & 0x1f) << BCOM_DRD_INITIATOR_SHIFT);
324}
325
326
327static inline void
328bcom_set_task_pragma(int task, int pragma)
329{
330 u32 *fdt = &bcom_eng->tdt[task].fdt;
331 *fdt = (*fdt & ~0xff) | pragma;
332}
333
334static inline void
335bcom_set_task_auto_start(int task, int next_task)
336{
337 u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
338 out_be16(tcr, (in_be16(tcr) & ~0xff) | 0x00c0 | next_task);
339}
340
341static inline void
342bcom_set_tcr_initiator(int task, int initiator)
343{
344 u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
345 out_be16(tcr, (in_be16(tcr) & ~0x1f00) | ((initiator & 0x1f) << 8));
346}
347
348
349#endif /* __BESTCOMM_PRIV_H__ */
350
diff --git a/include/linux/fsl/bestcomm/fec.h b/include/linux/fsl/bestcomm/fec.h
new file mode 100644
index 000000000000..ee565d94d503
--- /dev/null
+++ b/include/linux/fsl/bestcomm/fec.h
@@ -0,0 +1,61 @@
1/*
2 * Header for Bestcomm FEC tasks driver
3 *
4 *
5 * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
7 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14#ifndef __BESTCOMM_FEC_H__
15#define __BESTCOMM_FEC_H__
16
17
18struct bcom_fec_bd {
19 u32 status;
20 u32 skb_pa;
21};
22
23#define BCOM_FEC_TX_BD_TFD 0x08000000ul /* transmit frame done */
24#define BCOM_FEC_TX_BD_TC 0x04000000ul /* transmit CRC */
25#define BCOM_FEC_TX_BD_ABC 0x02000000ul /* append bad CRC */
26
27#define BCOM_FEC_RX_BD_L 0x08000000ul /* buffer is last in frame */
28#define BCOM_FEC_RX_BD_BC 0x00800000ul /* DA is broadcast */
29#define BCOM_FEC_RX_BD_MC 0x00400000ul /* DA is multicast and not broadcast */
30#define BCOM_FEC_RX_BD_LG 0x00200000ul /* Rx frame length violation */
31#define BCOM_FEC_RX_BD_NO 0x00100000ul /* Rx non-octet aligned frame */
32#define BCOM_FEC_RX_BD_CR 0x00040000ul /* Rx CRC error */
33#define BCOM_FEC_RX_BD_OV 0x00020000ul /* overrun */
34#define BCOM_FEC_RX_BD_TR 0x00010000ul /* Rx frame truncated */
35#define BCOM_FEC_RX_BD_LEN_MASK 0x000007fful /* mask for length of received frame */
36#define BCOM_FEC_RX_BD_ERRORS (BCOM_FEC_RX_BD_LG | BCOM_FEC_RX_BD_NO | \
37 BCOM_FEC_RX_BD_CR | BCOM_FEC_RX_BD_OV | BCOM_FEC_RX_BD_TR)
38
39
40extern struct bcom_task *
41bcom_fec_rx_init(int queue_len, phys_addr_t fifo, int maxbufsize);
42
43extern int
44bcom_fec_rx_reset(struct bcom_task *tsk);
45
46extern void
47bcom_fec_rx_release(struct bcom_task *tsk);
48
49
50extern struct bcom_task *
51bcom_fec_tx_init(int queue_len, phys_addr_t fifo);
52
53extern int
54bcom_fec_tx_reset(struct bcom_task *tsk);
55
56extern void
57bcom_fec_tx_release(struct bcom_task *tsk);
58
59
60#endif /* __BESTCOMM_FEC_H__ */
61
diff --git a/include/linux/fsl/bestcomm/gen_bd.h b/include/linux/fsl/bestcomm/gen_bd.h
new file mode 100644
index 000000000000..de47260e69da
--- /dev/null
+++ b/include/linux/fsl/bestcomm/gen_bd.h
@@ -0,0 +1,53 @@
1/*
2 * Header for Bestcomm General Buffer Descriptor tasks driver
3 *
4 *
5 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2006 AppSpec Computer Technologies Corp.
7 * Jeff Gibbons <jeff.gibbons@appspec.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 *
14 */
15
16#ifndef __BESTCOMM_GEN_BD_H__
17#define __BESTCOMM_GEN_BD_H__
18
19struct bcom_gen_bd {
20 u32 status;
21 u32 buf_pa;
22};
23
24
25extern struct bcom_task *
26bcom_gen_bd_rx_init(int queue_len, phys_addr_t fifo,
27 int initiator, int ipr, int maxbufsize);
28
29extern int
30bcom_gen_bd_rx_reset(struct bcom_task *tsk);
31
32extern void
33bcom_gen_bd_rx_release(struct bcom_task *tsk);
34
35
36extern struct bcom_task *
37bcom_gen_bd_tx_init(int queue_len, phys_addr_t fifo,
38 int initiator, int ipr);
39
40extern int
41bcom_gen_bd_tx_reset(struct bcom_task *tsk);
42
43extern void
44bcom_gen_bd_tx_release(struct bcom_task *tsk);
45
46
47/* PSC support utility wrappers */
48struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len,
49 phys_addr_t fifo, int maxbufsize);
50struct bcom_task * bcom_psc_gen_bd_tx_init(unsigned psc_num, int queue_len,
51 phys_addr_t fifo);
52#endif /* __BESTCOMM_GEN_BD_H__ */
53
diff --git a/include/linux/fsl/bestcomm/sram.h b/include/linux/fsl/bestcomm/sram.h
new file mode 100644
index 000000000000..b6d668963cce
--- /dev/null
+++ b/include/linux/fsl/bestcomm/sram.h
@@ -0,0 +1,54 @@
1/*
2 * Handling of a sram zone for bestcomm
3 *
4 *
5 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef __BESTCOMM_SRAM_H__
13#define __BESTCOMM_SRAM_H__
14
15#include <asm/rheap.h>
16#include <asm/mmu.h>
17#include <linux/spinlock.h>
18
19
20/* Structure used internally */
21 /* The internals are here for the inline functions
22 * sake, certainly not for the user to mess with !
23 */
24struct bcom_sram {
25 phys_addr_t base_phys;
26 void *base_virt;
27 unsigned int size;
28 rh_info_t *rh;
29 spinlock_t lock;
30};
31
32extern struct bcom_sram *bcom_sram;
33
34
35/* Public API */
36extern int bcom_sram_init(struct device_node *sram_node, char *owner);
37extern void bcom_sram_cleanup(void);
38
39extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
40extern void bcom_sram_free(void *ptr);
41
42static inline phys_addr_t bcom_sram_va2pa(void *va) {
43 return bcom_sram->base_phys +
44 (unsigned long)(va - bcom_sram->base_virt);
45}
46
47static inline void *bcom_sram_pa2va(phys_addr_t pa) {
48 return bcom_sram->base_virt +
49 (unsigned long)(pa - bcom_sram->base_phys);
50}
51
52
53#endif /* __BESTCOMM_SRAM_H__ */
54
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 0fbfb4646d1b..a78680a92dba 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -244,7 +244,7 @@ static inline void fsnotify_open(struct file *file)
244static inline void fsnotify_close(struct file *file) 244static inline void fsnotify_close(struct file *file)
245{ 245{
246 struct path *path = &file->f_path; 246 struct path *path = &file->f_path;
247 struct inode *inode = file->f_path.dentry->d_inode; 247 struct inode *inode = file_inode(file);
248 fmode_t mode = file->f_mode; 248 fmode_t mode = file->f_mode;
249 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 249 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
250 250
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 79b8bba19363..9f3c275e053e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -231,6 +231,12 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
231 } 231 }
232} 232}
233 233
234static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
235{
236 part_pack_uuid(uuid_str, to);
237 return 0;
238}
239
234static inline int disk_max_parts(struct gendisk *disk) 240static inline int disk_max_parts(struct gendisk *disk)
235{ 241{
236 if (disk->flags & GENHD_FL_EXT_DEVT) 242 if (disk->flags & GENHD_FL_EXT_DEVT)
@@ -718,6 +724,10 @@ static inline dev_t blk_lookup_devt(const char *name, int partno)
718 return devt; 724 return devt;
719} 725}
720 726
727static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
728{
729 return -EINVAL;
730}
721#endif /* CONFIG_BLOCK */ 731#endif /* CONFIG_BLOCK */
722 732
723#endif /* _LINUX_GENHD_H */ 733#endif /* _LINUX_GENHD_H */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index bfe665621536..f6c7ae3e223b 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -94,24 +94,12 @@ static inline int gpio_request(unsigned gpio, const char *label)
94 return -ENOSYS; 94 return -ENOSYS;
95} 95}
96 96
97static inline int devm_gpio_request(struct device *dev, unsigned gpio,
98 const char *label)
99{
100 return -ENOSYS;
101}
102
103static inline int gpio_request_one(unsigned gpio, 97static inline int gpio_request_one(unsigned gpio,
104 unsigned long flags, const char *label) 98 unsigned long flags, const char *label)
105{ 99{
106 return -ENOSYS; 100 return -ENOSYS;
107} 101}
108 102
109static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
110 unsigned long flags, const char *label)
111{
112 return -ENOSYS;
113}
114
115static inline int gpio_request_array(const struct gpio *array, size_t num) 103static inline int gpio_request_array(const struct gpio *array, size_t num)
116{ 104{
117 return -ENOSYS; 105 return -ENOSYS;
@@ -125,14 +113,6 @@ static inline void gpio_free(unsigned gpio)
125 WARN_ON(1); 113 WARN_ON(1);
126} 114}
127 115
128static inline void devm_gpio_free(struct device *dev, unsigned gpio)
129{
130 might_sleep();
131
132 /* GPIO can never have been requested */
133 WARN_ON(1);
134}
135
136static inline void gpio_free_array(const struct gpio *array, size_t num) 116static inline void gpio_free_array(const struct gpio *array, size_t num)
137{ 117{
138 might_sleep(); 118 might_sleep();
@@ -248,4 +228,12 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
248 228
249#endif /* ! CONFIG_GENERIC_GPIO */ 229#endif /* ! CONFIG_GENERIC_GPIO */
250 230
231struct device;
232
233/* bindings for managed devices that want to request gpios */
234int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
235int devm_gpio_request_one(struct device *dev, unsigned gpio,
236 unsigned long flags, const char *label);
237void devm_gpio_free(struct device *dev, unsigned int gpio);
238
251#endif /* __LINUX_GPIO_H */ 239#endif /* __LINUX_GPIO_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 29eb805ea4a6..c1d6555d2567 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -118,10 +118,8 @@
118 118
119#ifdef CONFIG_PREEMPT_COUNT 119#ifdef CONFIG_PREEMPT_COUNT
120# define preemptible() (preempt_count() == 0 && !irqs_disabled()) 120# define preemptible() (preempt_count() == 0 && !irqs_disabled())
121# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
122#else 121#else
123# define preemptible() 0 122# define preemptible() 0
124# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
125#endif 123#endif
126 124
127#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS) 125#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 227c62424f3c..a9df51f5d54c 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -115,51 +115,50 @@ static inline void hash_del_rcu(struct hlist_node *node)
115 * hash_for_each - iterate over a hashtable 115 * hash_for_each - iterate over a hashtable
116 * @name: hashtable to iterate 116 * @name: hashtable to iterate
117 * @bkt: integer to use as bucket loop cursor 117 * @bkt: integer to use as bucket loop cursor
118 * @node: the &struct list_head to use as a loop cursor for each entry
119 * @obj: the type * to use as a loop cursor for each entry 118 * @obj: the type * to use as a loop cursor for each entry
120 * @member: the name of the hlist_node within the struct 119 * @member: the name of the hlist_node within the struct
121 */ 120 */
122#define hash_for_each(name, bkt, node, obj, member) \ 121#define hash_for_each(name, bkt, obj, member) \
123 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 122 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
124 hlist_for_each_entry(obj, node, &name[bkt], member) 123 (bkt)++)\
124 hlist_for_each_entry(obj, &name[bkt], member)
125 125
126/** 126/**
127 * hash_for_each_rcu - iterate over a rcu enabled hashtable 127 * hash_for_each_rcu - iterate over a rcu enabled hashtable
128 * @name: hashtable to iterate 128 * @name: hashtable to iterate
129 * @bkt: integer to use as bucket loop cursor 129 * @bkt: integer to use as bucket loop cursor
130 * @node: the &struct list_head to use as a loop cursor for each entry
131 * @obj: the type * to use as a loop cursor for each entry 130 * @obj: the type * to use as a loop cursor for each entry
132 * @member: the name of the hlist_node within the struct 131 * @member: the name of the hlist_node within the struct
133 */ 132 */
134#define hash_for_each_rcu(name, bkt, node, obj, member) \ 133#define hash_for_each_rcu(name, bkt, obj, member) \
135 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 134 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
136 hlist_for_each_entry_rcu(obj, node, &name[bkt], member) 135 (bkt)++)\
136 hlist_for_each_entry_rcu(obj, &name[bkt], member)
137 137
138/** 138/**
139 * hash_for_each_safe - iterate over a hashtable safe against removal of 139 * hash_for_each_safe - iterate over a hashtable safe against removal of
140 * hash entry 140 * hash entry
141 * @name: hashtable to iterate 141 * @name: hashtable to iterate
142 * @bkt: integer to use as bucket loop cursor 142 * @bkt: integer to use as bucket loop cursor
143 * @node: the &struct list_head to use as a loop cursor for each entry
144 * @tmp: a &struct used for temporary storage 143 * @tmp: a &struct used for temporary storage
145 * @obj: the type * to use as a loop cursor for each entry 144 * @obj: the type * to use as a loop cursor for each entry
146 * @member: the name of the hlist_node within the struct 145 * @member: the name of the hlist_node within the struct
147 */ 146 */
148#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ 147#define hash_for_each_safe(name, bkt, tmp, obj, member) \
149 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 148 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
150 hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) 149 (bkt)++)\
150 hlist_for_each_entry_safe(obj, tmp, &name[bkt], member)
151 151
152/** 152/**
153 * hash_for_each_possible - iterate over all possible objects hashing to the 153 * hash_for_each_possible - iterate over all possible objects hashing to the
154 * same bucket 154 * same bucket
155 * @name: hashtable to iterate 155 * @name: hashtable to iterate
156 * @obj: the type * to use as a loop cursor for each entry 156 * @obj: the type * to use as a loop cursor for each entry
157 * @node: the &struct list_head to use as a loop cursor for each entry
158 * @member: the name of the hlist_node within the struct 157 * @member: the name of the hlist_node within the struct
159 * @key: the key of the objects to iterate over 158 * @key: the key of the objects to iterate over
160 */ 159 */
161#define hash_for_each_possible(name, obj, node, member, key) \ 160#define hash_for_each_possible(name, obj, member, key) \
162 hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 161 hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
163 162
164/** 163/**
165 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the 164 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
@@ -167,25 +166,24 @@ static inline void hash_del_rcu(struct hlist_node *node)
167 * in a rcu enabled hashtable 166 * in a rcu enabled hashtable
168 * @name: hashtable to iterate 167 * @name: hashtable to iterate
169 * @obj: the type * to use as a loop cursor for each entry 168 * @obj: the type * to use as a loop cursor for each entry
170 * @node: the &struct list_head to use as a loop cursor for each entry
171 * @member: the name of the hlist_node within the struct 169 * @member: the name of the hlist_node within the struct
172 * @key: the key of the objects to iterate over 170 * @key: the key of the objects to iterate over
173 */ 171 */
174#define hash_for_each_possible_rcu(name, obj, node, member, key) \ 172#define hash_for_each_possible_rcu(name, obj, member, key) \
175 hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 173 hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))],\
174 member)
176 175
177/** 176/**
178 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
179 * same bucket safe against removals 178 * same bucket safe against removals
180 * @name: hashtable to iterate 179 * @name: hashtable to iterate
181 * @obj: the type * to use as a loop cursor for each entry 180 * @obj: the type * to use as a loop cursor for each entry
182 * @node: the &struct list_head to use as a loop cursor for each entry
183 * @tmp: a &struct used for temporary storage 181 * @tmp: a &struct used for temporary storage
184 * @member: the name of the hlist_node within the struct 182 * @member: the name of the hlist_node within the struct
185 * @key: the key of the objects to iterate over 183 * @key: the key of the objects to iterate over
186 */ 184 */
187#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ 185#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
188 hlist_for_each_entry_safe(obj, node, tmp, \ 186 hlist_for_each_entry_safe(obj, tmp,\
189 &name[hash_min(key, HASH_BITS(name))], member) 187 &name[hash_min(key, HASH_BITS(name))], member)
190 188
191 189
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
new file mode 100644
index 000000000000..3b589440ecfe
--- /dev/null
+++ b/include/linux/hdmi.h
@@ -0,0 +1,231 @@
1/*
2 * Copyright (C) 2012 Avionic Design GmbH
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_HDMI_H_
10#define __LINUX_HDMI_H_
11
12#include <linux/types.h>
13
14enum hdmi_infoframe_type {
15 HDMI_INFOFRAME_TYPE_VENDOR = 0x81,
16 HDMI_INFOFRAME_TYPE_AVI = 0x82,
17 HDMI_INFOFRAME_TYPE_SPD = 0x83,
18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
19};
20
21#define HDMI_INFOFRAME_HEADER_SIZE 4
22#define HDMI_AVI_INFOFRAME_SIZE 13
23#define HDMI_SPD_INFOFRAME_SIZE 25
24#define HDMI_AUDIO_INFOFRAME_SIZE 10
25
26enum hdmi_colorspace {
27 HDMI_COLORSPACE_RGB,
28 HDMI_COLORSPACE_YUV422,
29 HDMI_COLORSPACE_YUV444,
30};
31
32enum hdmi_scan_mode {
33 HDMI_SCAN_MODE_NONE,
34 HDMI_SCAN_MODE_OVERSCAN,
35 HDMI_SCAN_MODE_UNDERSCAN,
36};
37
38enum hdmi_colorimetry {
39 HDMI_COLORIMETRY_NONE,
40 HDMI_COLORIMETRY_ITU_601,
41 HDMI_COLORIMETRY_ITU_709,
42 HDMI_COLORIMETRY_EXTENDED,
43};
44
45enum hdmi_picture_aspect {
46 HDMI_PICTURE_ASPECT_NONE,
47 HDMI_PICTURE_ASPECT_4_3,
48 HDMI_PICTURE_ASPECT_16_9,
49};
50
51enum hdmi_active_aspect {
52 HDMI_ACTIVE_ASPECT_16_9_TOP = 2,
53 HDMI_ACTIVE_ASPECT_14_9_TOP = 3,
54 HDMI_ACTIVE_ASPECT_16_9_CENTER = 4,
55 HDMI_ACTIVE_ASPECT_PICTURE = 8,
56 HDMI_ACTIVE_ASPECT_4_3 = 9,
57 HDMI_ACTIVE_ASPECT_16_9 = 10,
58 HDMI_ACTIVE_ASPECT_14_9 = 11,
59 HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13,
60 HDMI_ACTIVE_ASPECT_16_9_SP_14_9 = 14,
61 HDMI_ACTIVE_ASPECT_16_9_SP_4_3 = 15,
62};
63
64enum hdmi_extended_colorimetry {
65 HDMI_EXTENDED_COLORIMETRY_XV_YCC_601,
66 HDMI_EXTENDED_COLORIMETRY_XV_YCC_709,
67 HDMI_EXTENDED_COLORIMETRY_S_YCC_601,
68 HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601,
69 HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB,
70};
71
72enum hdmi_quantization_range {
73 HDMI_QUANTIZATION_RANGE_DEFAULT,
74 HDMI_QUANTIZATION_RANGE_LIMITED,
75 HDMI_QUANTIZATION_RANGE_FULL,
76};
77
78/* non-uniform picture scaling */
79enum hdmi_nups {
80 HDMI_NUPS_UNKNOWN,
81 HDMI_NUPS_HORIZONTAL,
82 HDMI_NUPS_VERTICAL,
83 HDMI_NUPS_BOTH,
84};
85
86enum hdmi_ycc_quantization_range {
87 HDMI_YCC_QUANTIZATION_RANGE_LIMITED,
88 HDMI_YCC_QUANTIZATION_RANGE_FULL,
89};
90
91enum hdmi_content_type {
92 HDMI_CONTENT_TYPE_NONE,
93 HDMI_CONTENT_TYPE_PHOTO,
94 HDMI_CONTENT_TYPE_CINEMA,
95 HDMI_CONTENT_TYPE_GAME,
96};
97
98struct hdmi_avi_infoframe {
99 enum hdmi_infoframe_type type;
100 unsigned char version;
101 unsigned char length;
102 enum hdmi_colorspace colorspace;
103 bool active_info_valid;
104 bool horizontal_bar_valid;
105 bool vertical_bar_valid;
106 enum hdmi_scan_mode scan_mode;
107 enum hdmi_colorimetry colorimetry;
108 enum hdmi_picture_aspect picture_aspect;
109 enum hdmi_active_aspect active_aspect;
110 bool itc;
111 enum hdmi_extended_colorimetry extended_colorimetry;
112 enum hdmi_quantization_range quantization_range;
113 enum hdmi_nups nups;
114 unsigned char video_code;
115 enum hdmi_ycc_quantization_range ycc_quantization_range;
116 enum hdmi_content_type content_type;
117 unsigned char pixel_repeat;
118 unsigned short top_bar;
119 unsigned short bottom_bar;
120 unsigned short left_bar;
121 unsigned short right_bar;
122};
123
124int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
125ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
126 size_t size);
127
128enum hdmi_spd_sdi {
129 HDMI_SPD_SDI_UNKNOWN,
130 HDMI_SPD_SDI_DSTB,
131 HDMI_SPD_SDI_DVDP,
132 HDMI_SPD_SDI_DVHS,
133 HDMI_SPD_SDI_HDDVR,
134 HDMI_SPD_SDI_DVC,
135 HDMI_SPD_SDI_DSC,
136 HDMI_SPD_SDI_VCD,
137 HDMI_SPD_SDI_GAME,
138 HDMI_SPD_SDI_PC,
139 HDMI_SPD_SDI_BD,
140 HDMI_SPD_SDI_SACD,
141 HDMI_SPD_SDI_HDDVD,
142 HDMI_SPD_SDI_PMP,
143};
144
145struct hdmi_spd_infoframe {
146 enum hdmi_infoframe_type type;
147 unsigned char version;
148 unsigned char length;
149 char vendor[8];
150 char product[16];
151 enum hdmi_spd_sdi sdi;
152};
153
154int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame,
155 const char *vendor, const char *product);
156ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer,
157 size_t size);
158
159enum hdmi_audio_coding_type {
160 HDMI_AUDIO_CODING_TYPE_STREAM,
161 HDMI_AUDIO_CODING_TYPE_PCM,
162 HDMI_AUDIO_CODING_TYPE_AC3,
163 HDMI_AUDIO_CODING_TYPE_MPEG1,
164 HDMI_AUDIO_CODING_TYPE_MP3,
165 HDMI_AUDIO_CODING_TYPE_MPEG2,
166 HDMI_AUDIO_CODING_TYPE_AAC_LC,
167 HDMI_AUDIO_CODING_TYPE_DTS,
168 HDMI_AUDIO_CODING_TYPE_ATRAC,
169 HDMI_AUDIO_CODING_TYPE_DSD,
170 HDMI_AUDIO_CODING_TYPE_EAC3,
171 HDMI_AUDIO_CODING_TYPE_DTS_HD,
172 HDMI_AUDIO_CODING_TYPE_MLP,
173 HDMI_AUDIO_CODING_TYPE_DST,
174 HDMI_AUDIO_CODING_TYPE_WMA_PRO,
175};
176
177enum hdmi_audio_sample_size {
178 HDMI_AUDIO_SAMPLE_SIZE_STREAM,
179 HDMI_AUDIO_SAMPLE_SIZE_16,
180 HDMI_AUDIO_SAMPLE_SIZE_20,
181 HDMI_AUDIO_SAMPLE_SIZE_24,
182};
183
184enum hdmi_audio_sample_frequency {
185 HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
186 HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
187 HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
188 HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
189 HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
190 HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
191 HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
192 HDMI_AUDIO_SAMPLE_FREQUENCY_192000,
193};
194
195enum hdmi_audio_coding_type_ext {
196 HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
197 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
198 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
199 HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
200};
201
202struct hdmi_audio_infoframe {
203 enum hdmi_infoframe_type type;
204 unsigned char version;
205 unsigned char length;
206 unsigned char channels;
207 enum hdmi_audio_coding_type coding_type;
208 enum hdmi_audio_sample_size sample_size;
209 enum hdmi_audio_sample_frequency sample_frequency;
210 enum hdmi_audio_coding_type_ext coding_type_ext;
211 unsigned char channel_allocation;
212 unsigned char level_shift_value;
213 bool downmix_inhibit;
214
215};
216
217int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame);
218ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
219 void *buffer, size_t size);
220
221struct hdmi_vendor_infoframe {
222 enum hdmi_infoframe_type type;
223 unsigned char version;
224 unsigned char length;
225 u8 data[27];
226};
227
228ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
229 void *buffer, size_t size);
230
231#endif /* _DRM_HDMI_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index e14b465b1146..863744c38ddc 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -662,6 +662,9 @@ struct hid_driver {
662 * @hidinput_input_event: event input event (e.g. ff or leds) 662 * @hidinput_input_event: event input event (e.g. ff or leds)
663 * @parse: this method is called only once to parse the device data, 663 * @parse: this method is called only once to parse the device data,
664 * shouldn't allocate anything to not leak memory 664 * shouldn't allocate anything to not leak memory
665 * @request: send report request to device (e.g. feature report)
666 * @wait: wait for buffered io to complete (send/recv reports)
667 * @idle: send idle request to device
665 */ 668 */
666struct hid_ll_driver { 669struct hid_ll_driver {
667 int (*start)(struct hid_device *hdev); 670 int (*start)(struct hid_device *hdev);
@@ -676,6 +679,13 @@ struct hid_ll_driver {
676 unsigned int code, int value); 679 unsigned int code, int value);
677 680
678 int (*parse)(struct hid_device *hdev); 681 int (*parse)(struct hid_device *hdev);
682
683 void (*request)(struct hid_device *hdev,
684 struct hid_report *report, int reqtype);
685
686 int (*wait)(struct hid_device *hdev);
687 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
688
679}; 689};
680 690
681#define PM_HINT_FULLON 1<<5 691#define PM_HINT_FULLON 1<<5
@@ -883,6 +893,49 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
883 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; 893 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
884} 894}
885 895
896
897/**
898 * hid_hw_request - send report request to device
899 *
900 * @hdev: hid device
901 * @report: report to send
902 * @reqtype: hid request type
903 */
904static inline void hid_hw_request(struct hid_device *hdev,
905 struct hid_report *report, int reqtype)
906{
907 if (hdev->ll_driver->request)
908 hdev->ll_driver->request(hdev, report, reqtype);
909}
910
911/**
912 * hid_hw_idle - send idle request to device
913 *
914 * @hdev: hid device
915 * @report: report to control
916 * @idle: idle state
917 * @reqtype: hid request type
918 */
919static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
920 int reqtype)
921{
922 if (hdev->ll_driver->idle)
923 return hdev->ll_driver->idle(hdev, report, idle, reqtype);
924
925 return 0;
926}
927
928/**
929 * hid_hw_wait - wait for buffered io to complete
930 *
931 * @hdev: hid device
932 */
933static inline void hid_hw_wait(struct hid_device *hdev)
934{
935 if (hdev->ll_driver->wait)
936 hdev->ll_driver->wait(hdev);
937}
938
886int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 939int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
887 int interrupt); 940 int interrupt);
888 941
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index ef788b5b4a35..7fb31da45d03 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -219,12 +219,6 @@ static inline void zero_user(struct page *page,
219 zero_user_segments(page, start, start + size, 0, 0); 219 zero_user_segments(page, start, start + size, 0, 0);
220} 220}
221 221
222static inline void __deprecated memclear_highpage_flush(struct page *page,
223 unsigned int offset, unsigned int size)
224{
225 zero_user(page, offset, size);
226}
227
228#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE 222#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE
229 223
230static inline void copy_user_highpage(struct page *to, struct page *from, 224static inline void copy_user_highpage(struct page *to, struct page *from,
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 56fae865e272..0dca785288cf 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -121,9 +121,9 @@ static inline int hsi_register_board_info(struct hsi_board_info const *info,
121 * @device: Driver model representation of the device 121 * @device: Driver model representation of the device
122 * @tx_cfg: HSI TX configuration 122 * @tx_cfg: HSI TX configuration
123 * @rx_cfg: HSI RX configuration 123 * @rx_cfg: HSI RX configuration
124 * @e_handler: Callback for handling port events (RX Wake High/Low) 124 * e_handler: Callback for handling port events (RX Wake High/Low)
125 * @pclaimed: Keeps tracks if the clients claimed its associated HSI port 125 * pclaimed: Keeps tracks if the clients claimed its associated HSI port
126 * @nb: Notifier block for port events 126 * nb: Notifier block for port events
127 */ 127 */
128struct hsi_client { 128struct hsi_client {
129 struct device device; 129 struct device device;
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 1d76f8ca90f0..ee1c244a62a1 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -113,7 +113,7 @@ extern void __split_huge_page_pmd(struct vm_area_struct *vma,
113 do { \ 113 do { \
114 pmd_t *____pmd = (__pmd); \ 114 pmd_t *____pmd = (__pmd); \
115 anon_vma_lock_write(__anon_vma); \ 115 anon_vma_lock_write(__anon_vma); \
116 anon_vma_unlock(__anon_vma); \ 116 anon_vma_unlock_write(__anon_vma); \
117 BUG_ON(pmd_trans_splitting(*____pmd) || \ 117 BUG_ON(pmd_trans_splitting(*____pmd) || \
118 pmd_trans_huge(*____pmd)); \ 118 pmd_trans_huge(*____pmd)); \
119 } while (0) 119 } while (0)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0c80d3f57a5b..16e4e9a643fb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -43,9 +43,9 @@ int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
43#endif 43#endif
44 44
45int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 45int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
46int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, 46long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
47 struct page **, struct vm_area_struct **, 47 struct page **, struct vm_area_struct **,
48 unsigned long *, int *, int, unsigned int flags); 48 unsigned long *, unsigned long *, long, unsigned int);
49void unmap_hugepage_range(struct vm_area_struct *, 49void unmap_hugepage_range(struct vm_area_struct *,
50 unsigned long, unsigned long, struct page *); 50 unsigned long, unsigned long, struct page *);
51void __unmap_hugepage_range_final(struct mmu_gather *tlb, 51void __unmap_hugepage_range_final(struct mmu_gather *tlb,
@@ -281,7 +281,7 @@ static inline struct hstate *hstate_inode(struct inode *i)
281 281
282static inline struct hstate *hstate_file(struct file *f) 282static inline struct hstate *hstate_file(struct file *f)
283{ 283{
284 return hstate_inode(f->f_dentry->d_inode); 284 return hstate_inode(file_inode(f));
285} 285}
286 286
287static inline struct hstate *hstate_vma(struct vm_area_struct *vma) 287static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1ff54b114efc..488debbef895 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -39,51 +39,55 @@
39 * address each module uses within a given i2c slave. 39 * address each module uses within a given i2c slave.
40 */ 40 */
41 41
42/* Module IDs for similar functionalities found in twl4030/twl6030 */
43enum twl_module_ids {
44 TWL_MODULE_USB,
45 TWL_MODULE_PIH,
46 TWL_MODULE_MAIN_CHARGE,
47 TWL_MODULE_PM_MASTER,
48 TWL_MODULE_PM_RECEIVER,
49
50 TWL_MODULE_RTC,
51 TWL_MODULE_PWM,
52 TWL_MODULE_LED,
53 TWL_MODULE_SECURED_REG,
54
55 TWL_MODULE_LAST,
56};
57
58/* Modules only available in twl4030 series */
42enum twl4030_module_ids { 59enum twl4030_module_ids {
43 TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */ 60 TWL4030_MODULE_AUDIO_VOICE = TWL_MODULE_LAST,
44 TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */
45 TWL4030_MODULE_GPIO, 61 TWL4030_MODULE_GPIO,
46 TWL4030_MODULE_INTBR, 62 TWL4030_MODULE_INTBR,
47 TWL4030_MODULE_PIH,
48
49 TWL4030_MODULE_TEST, 63 TWL4030_MODULE_TEST,
50 TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */ 64 TWL4030_MODULE_KEYPAD,
65
51 TWL4030_MODULE_MADC, 66 TWL4030_MODULE_MADC,
52 TWL4030_MODULE_INTERRUPTS, 67 TWL4030_MODULE_INTERRUPTS,
53 TWL4030_MODULE_LED,
54
55 TWL4030_MODULE_MAIN_CHARGE,
56 TWL4030_MODULE_PRECHARGE, 68 TWL4030_MODULE_PRECHARGE,
57 TWL4030_MODULE_PWM0, 69 TWL4030_MODULE_BACKUP,
58 TWL4030_MODULE_PWM1, 70 TWL4030_MODULE_INT,
59 TWL4030_MODULE_PWMA,
60 71
61 TWL4030_MODULE_PWMB,
62 TWL5031_MODULE_ACCESSORY, 72 TWL5031_MODULE_ACCESSORY,
63 TWL5031_MODULE_INTERRUPTS, 73 TWL5031_MODULE_INTERRUPTS,
64 TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */
65 TWL4030_MODULE_INT,
66 74
67 TWL4030_MODULE_PM_MASTER,
68 TWL4030_MODULE_PM_RECEIVER,
69 TWL4030_MODULE_RTC,
70 TWL4030_MODULE_SECURED_REG,
71 TWL4030_MODULE_LAST, 75 TWL4030_MODULE_LAST,
72}; 76};
73 77
74/* Similar functionalities implemented in TWL4030/6030 */ 78/* Modules only available in twl6030 series */
75#define TWL_MODULE_USB TWL4030_MODULE_USB 79enum twl6030_module_ids {
76#define TWL_MODULE_PIH TWL4030_MODULE_PIH 80 TWL6030_MODULE_ID0 = TWL_MODULE_LAST,
77#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE 81 TWL6030_MODULE_ID1,
78#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 82 TWL6030_MODULE_ID2,
79#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 83 TWL6030_MODULE_GPADC,
80#define TWL_MODULE_RTC TWL4030_MODULE_RTC 84 TWL6030_MODULE_GASGAUGE,
81#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 85
82#define TWL_MODULE_LED TWL4030_MODULE_LED 86 TWL6030_MODULE_LAST,
87};
83 88
84#define TWL6030_MODULE_ID0 13 89/* Until the clients has been converted to use TWL_MODULE_LED */
85#define TWL6030_MODULE_ID1 14 90#define TWL4030_MODULE_LED TWL_MODULE_LED
86#define TWL6030_MODULE_ID2 15
87 91
88#define GPIO_INTR_OFFSET 0 92#define GPIO_INTR_OFFSET 0
89#define KEYPAD_INTR_OFFSET 1 93#define KEYPAD_INTR_OFFSET 1
@@ -171,20 +175,22 @@ TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
171TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 175TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
172 176
173/* 177/*
174 * Read and write single 8-bit registers
175 */
176int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
177int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
178
179/*
180 * Read and write several 8-bit registers at once. 178 * Read and write several 8-bit registers at once.
181 *
182 * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1
183 * for the value, and populate your data starting at offset 1.
184 */ 179 */
185int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 180int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
186int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 181int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
187 182
183/*
184 * Read and write single 8-bit registers
185 */
186static inline int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg) {
187 return twl_i2c_write(mod_no, &val, reg, 1);
188}
189
190static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
191 return twl_i2c_read(mod_no, val, reg, 1);
192}
193
188int twl_get_type(void); 194int twl_get_type(void);
189int twl_get_version(void); 195int twl_get_version(void);
190int twl_get_hfclk_rate(void); 196int twl_get_hfclk_rate(void);
diff --git a/include/linux/idr.h b/include/linux/idr.h
index de7e190f1af4..a6f38b5c34e4 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -17,69 +17,40 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20#if BITS_PER_LONG == 32 20/*
21# define IDR_BITS 5 21 * We want shallower trees and thus more bits covered at each layer. 8
22# define IDR_FULL 0xfffffffful 22 * bits gives us large enough first layer for most use cases and maximum
23/* We can only use two of the bits in the top level because there is 23 * tree depth of 4. Each idr_layer is slightly larger than 2k on 64bit and
24 only one possible bit in the top level (5 bits * 7 levels = 35 24 * 1k on 32bit.
25 bits, but you only use 31 bits in the id). */ 25 */
26# define TOP_LEVEL_FULL (IDR_FULL >> 30) 26#define IDR_BITS 8
27#elif BITS_PER_LONG == 64
28# define IDR_BITS 6
29# define IDR_FULL 0xfffffffffffffffful
30/* We can only use two of the bits in the top level because there is
31 only one possible bit in the top level (6 bits * 6 levels = 36
32 bits, but you only use 31 bits in the id). */
33# define TOP_LEVEL_FULL (IDR_FULL >> 62)
34#else
35# error "BITS_PER_LONG is not 32 or 64"
36#endif
37
38#define IDR_SIZE (1 << IDR_BITS) 27#define IDR_SIZE (1 << IDR_BITS)
39#define IDR_MASK ((1 << IDR_BITS)-1) 28#define IDR_MASK ((1 << IDR_BITS)-1)
40 29
41#define MAX_IDR_SHIFT (sizeof(int)*8 - 1)
42#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
43#define MAX_IDR_MASK (MAX_IDR_BIT - 1)
44
45/* Leave the possibility of an incomplete final layer */
46#define MAX_IDR_LEVEL ((MAX_IDR_SHIFT + IDR_BITS - 1) / IDR_BITS)
47
48/* Number of id_layer structs to leave in free list */
49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
50
51struct idr_layer { 30struct idr_layer {
52 unsigned long bitmap; /* A zero bit means "space here" */ 31 int prefix; /* the ID prefix of this idr_layer */
32 DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */
53 struct idr_layer __rcu *ary[1<<IDR_BITS]; 33 struct idr_layer __rcu *ary[1<<IDR_BITS];
54 int count; /* When zero, we can release it */ 34 int count; /* When zero, we can release it */
55 int layer; /* distance from leaf */ 35 int layer; /* distance from leaf */
56 struct rcu_head rcu_head; 36 struct rcu_head rcu_head;
57}; 37};
58 38
59struct idr { 39struct idr {
60 struct idr_layer __rcu *top; 40 struct idr_layer __rcu *hint; /* the last layer allocated from */
61 struct idr_layer *id_free; 41 struct idr_layer __rcu *top;
62 int layers; /* only valid without concurrent changes */ 42 struct idr_layer *id_free;
63 int id_free_cnt; 43 int layers; /* only valid w/o concurrent changes */
64 spinlock_t lock; 44 int id_free_cnt;
45 spinlock_t lock;
65}; 46};
66 47
67#define IDR_INIT(name) \ 48#define IDR_INIT(name) \
68{ \ 49{ \
69 .top = NULL, \ 50 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70 .id_free = NULL, \
71 .layers = 0, \
72 .id_free_cnt = 0, \
73 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
74} 51}
75#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 52#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
76 53
77/* Actions to be taken after a call to _idr_sub_alloc */
78#define IDR_NEED_TO_GROW -2
79#define IDR_NOMORE_SPACE -3
80
81#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC)
82
83/** 54/**
84 * DOC: idr sync 55 * DOC: idr sync
85 * idr synchronization (stolen from radix-tree.h) 56 * idr synchronization (stolen from radix-tree.h)
@@ -101,19 +72,90 @@ struct idr {
101 * This is what we export. 72 * This is what we export.
102 */ 73 */
103 74
104void *idr_find(struct idr *idp, int id); 75void *idr_find_slowpath(struct idr *idp, int id);
105int idr_pre_get(struct idr *idp, gfp_t gfp_mask); 76int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
106int idr_get_new(struct idr *idp, void *ptr, int *id);
107int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 77int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
78void idr_preload(gfp_t gfp_mask);
79int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask);
108int idr_for_each(struct idr *idp, 80int idr_for_each(struct idr *idp,
109 int (*fn)(int id, void *p, void *data), void *data); 81 int (*fn)(int id, void *p, void *data), void *data);
110void *idr_get_next(struct idr *idp, int *nextid); 82void *idr_get_next(struct idr *idp, int *nextid);
111void *idr_replace(struct idr *idp, void *ptr, int id); 83void *idr_replace(struct idr *idp, void *ptr, int id);
112void idr_remove(struct idr *idp, int id); 84void idr_remove(struct idr *idp, int id);
113void idr_remove_all(struct idr *idp); 85void idr_free(struct idr *idp, int id);
114void idr_destroy(struct idr *idp); 86void idr_destroy(struct idr *idp);
115void idr_init(struct idr *idp); 87void idr_init(struct idr *idp);
116 88
89/**
90 * idr_preload_end - end preload section started with idr_preload()
91 *
92 * Each idr_preload() should be matched with an invocation of this
93 * function. See idr_preload() for details.
94 */
95static inline void idr_preload_end(void)
96{
97 preempt_enable();
98}
99
100/**
101 * idr_find - return pointer for given id
102 * @idp: idr handle
103 * @id: lookup key
104 *
105 * Return the pointer given the id it has been registered with. A %NULL
106 * return indicates that @id is not valid or you passed %NULL in
107 * idr_get_new().
108 *
109 * This function can be called under rcu_read_lock(), given that the leaf
110 * pointers lifetimes are correctly managed.
111 */
112static inline void *idr_find(struct idr *idr, int id)
113{
114 struct idr_layer *hint = rcu_dereference_raw(idr->hint);
115
116 if (hint && (id & ~IDR_MASK) == hint->prefix)
117 return rcu_dereference_raw(hint->ary[id & IDR_MASK]);
118
119 return idr_find_slowpath(idr, id);
120}
121
122/**
123 * idr_get_new - allocate new idr entry
124 * @idp: idr handle
125 * @ptr: pointer you want associated with the id
126 * @id: pointer to the allocated handle
127 *
128 * Simple wrapper around idr_get_new_above() w/ @starting_id of zero.
129 */
130static inline int idr_get_new(struct idr *idp, void *ptr, int *id)
131{
132 return idr_get_new_above(idp, ptr, 0, id);
133}
134
135/**
136 * idr_for_each_entry - iterate over an idr's elements of a given type
137 * @idp: idr handle
138 * @entry: the type * to use as cursor
139 * @id: id entry's key
140 */
141#define idr_for_each_entry(idp, entry, id) \
142 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
143 entry != NULL; \
144 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
145
146void __idr_remove_all(struct idr *idp); /* don't use */
147
148/**
149 * idr_remove_all - remove all ids from the given idr tree
150 * @idp: idr handle
151 *
152 * If you're trying to destroy @idp, calling idr_destroy() is enough.
153 * This is going away. Don't use.
154 */
155static inline void __deprecated idr_remove_all(struct idr *idp)
156{
157 __idr_remove_all(idp);
158}
117 159
118/* 160/*
119 * IDA - IDR based id allocator, use when translation from id to 161 * IDA - IDR based id allocator, use when translation from id to
@@ -136,12 +178,11 @@ struct ida {
136 struct ida_bitmap *free_bitmap; 178 struct ida_bitmap *free_bitmap;
137}; 179};
138 180
139#define IDA_INIT(name) { .idr = IDR_INIT(name), .free_bitmap = NULL, } 181#define IDA_INIT(name) { .idr = IDR_INIT((name).idr), .free_bitmap = NULL, }
140#define DEFINE_IDA(name) struct ida name = IDA_INIT(name) 182#define DEFINE_IDA(name) struct ida name = IDA_INIT(name)
141 183
142int ida_pre_get(struct ida *ida, gfp_t gfp_mask); 184int ida_pre_get(struct ida *ida, gfp_t gfp_mask);
143int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); 185int ida_get_new_above(struct ida *ida, int starting_id, int *p_id);
144int ida_get_new(struct ida *ida, int *p_id);
145void ida_remove(struct ida *ida, int id); 186void ida_remove(struct ida *ida, int id);
146void ida_destroy(struct ida *ida); 187void ida_destroy(struct ida *ida);
147void ida_init(struct ida *ida); 188void ida_init(struct ida *ida);
@@ -150,17 +191,18 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
150 gfp_t gfp_mask); 191 gfp_t gfp_mask);
151void ida_simple_remove(struct ida *ida, unsigned int id); 192void ida_simple_remove(struct ida *ida, unsigned int id);
152 193
153void __init idr_init_cache(void);
154
155/** 194/**
156 * idr_for_each_entry - iterate over an idr's elements of a given type 195 * ida_get_new - allocate new ID
157 * @idp: idr handle 196 * @ida: idr handle
158 * @entry: the type * to use as cursor 197 * @p_id: pointer to the allocated handle
159 * @id: id entry's key 198 *
199 * Simple wrapper around ida_get_new_above() w/ @starting_id of zero.
160 */ 200 */
161#define idr_for_each_entry(idp, entry, id) \ 201static inline int ida_get_new(struct ida *ida, int *p_id)
162 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ 202{
163 entry != NULL; \ 203 return ida_get_new_above(ida, 0, p_id);
164 ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) 204}
205
206void __init idr_init_cache(void);
165 207
166#endif /* __IDR_H__ */ 208#endif /* __IDR_H__ */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 4648d8021244..cfd21e3d5506 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -216,11 +216,10 @@ static inline struct hlist_head *team_port_index_hash(struct team *team,
216static inline struct team_port *team_get_port_by_index(struct team *team, 216static inline struct team_port *team_get_port_by_index(struct team *team,
217 int port_index) 217 int port_index)
218{ 218{
219 struct hlist_node *p;
220 struct team_port *port; 219 struct team_port *port;
221 struct hlist_head *head = team_port_index_hash(team, port_index); 220 struct hlist_head *head = team_port_index_hash(team, port_index);
222 221
223 hlist_for_each_entry(port, p, head, hlist) 222 hlist_for_each_entry(port, head, hlist)
224 if (port->index == port_index) 223 if (port->index == port_index)
225 return port; 224 return port;
226 return NULL; 225 return NULL;
@@ -228,11 +227,10 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 227static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
229 int port_index) 228 int port_index)
230{ 229{
231 struct hlist_node *p;
232 struct team_port *port; 230 struct team_port *port;
233 struct hlist_head *head = team_port_index_hash(team, port_index); 231 struct hlist_head *head = team_port_index_hash(team, port_index);
234 232
235 hlist_for_each_entry_rcu(port, p, head, hlist) 233 hlist_for_each_entry_rcu(port, head, hlist)
236 if (port->index == port_index) 234 if (port->index == port_index)
237 return port; 235 return port;
238 return NULL; 236 return NULL;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d06cc5c8f58c..218a3b686d90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
331 struct vlan_hdr *vhdr) 331 struct vlan_hdr *vhdr)
332{ 332{
333 __be16 proto; 333 __be16 proto;
334 unsigned char *rawp; 334 unsigned short *rawp;
335 335
336 /* 336 /*
337 * Was a VLAN packet, grab the encapsulated protocol, which the layer 337 * Was a VLAN packet, grab the encapsulated protocol, which the layer
@@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
344 return; 344 return;
345 } 345 }
346 346
347 rawp = skb->data; 347 rawp = (unsigned short *)(vhdr + 1);
348 if (*(unsigned short *) rawp == 0xFFFF) 348 if (*rawp == 0xFFFF)
349 /* 349 /*
350 * This is a magic hack to spot IPX packets. Older Novell 350 * This is a magic hack to spot IPX packets. Older Novell
351 * breaks the protocol design and runs IPX over 802.3 without 351 * breaks the protocol design and runs IPX over 802.3 without
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index f3b99e1c1042..ba3b8a98a049 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -58,8 +58,10 @@ struct iommu_domain {
58#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 58#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
59 59
60enum iommu_attr { 60enum iommu_attr {
61 DOMAIN_ATTR_MAX,
62 DOMAIN_ATTR_GEOMETRY, 61 DOMAIN_ATTR_GEOMETRY,
62 DOMAIN_ATTR_PAGING,
63 DOMAIN_ATTR_WINDOWS,
64 DOMAIN_ATTR_MAX,
63}; 65};
64 66
65#ifdef CONFIG_IOMMU_API 67#ifdef CONFIG_IOMMU_API
@@ -100,6 +102,16 @@ struct iommu_ops {
100 enum iommu_attr attr, void *data); 102 enum iommu_attr attr, void *data);
101 int (*domain_set_attr)(struct iommu_domain *domain, 103 int (*domain_set_attr)(struct iommu_domain *domain,
102 enum iommu_attr attr, void *data); 104 enum iommu_attr attr, void *data);
105
106 /* Window handling functions */
107 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
108 phys_addr_t paddr, u64 size);
109 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
110 /* Set the numer of window per domain */
111 int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
112 /* Get the numer of window per domain */
113 u32 (*domain_get_windows)(struct iommu_domain *domain);
114
103 unsigned long pgsize_bitmap; 115 unsigned long pgsize_bitmap;
104}; 116};
105 117
@@ -157,6 +169,10 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
157extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, 169extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
158 void *data); 170 void *data);
159 171
172/* Window handling function prototypes */
173extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
174 phys_addr_t offset, u64 size);
175extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
160/** 176/**
161 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 177 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
162 * @domain: the iommu domain where the fault has happened 178 * @domain: the iommu domain where the fault has happened
@@ -239,6 +255,18 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
239 return -ENODEV; 255 return -ENODEV;
240} 256}
241 257
258static inline int iommu_domain_window_enable(struct iommu_domain *domain,
259 u32 wnd_nr, phys_addr_t paddr,
260 u64 size)
261{
262 return -ENODEV;
263}
264
265static inline void iommu_domain_window_disable(struct iommu_domain *domain,
266 u32 wnd_nr)
267{
268}
269
242static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 270static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
243 unsigned long iova) 271 unsigned long iova)
244{ 272{
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 1487e7906bbd..1f9f56e28851 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -35,10 +35,6 @@
35 35
36#include <uapi/linux/ipmi.h> 36#include <uapi/linux/ipmi.h>
37 37
38
39/*
40 * The in-kernel interface.
41 */
42#include <linux/list.h> 38#include <linux/list.h>
43#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
44 40
diff --git a/include/linux/irqchip/metag-ext.h b/include/linux/irqchip/metag-ext.h
new file mode 100644
index 000000000000..697af0fe7c5a
--- /dev/null
+++ b/include/linux/irqchip/metag-ext.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2012 Imagination Technologies
3 */
4
5#ifndef _LINUX_IRQCHIP_METAG_EXT_H_
6#define _LINUX_IRQCHIP_METAG_EXT_H_
7
8struct irq_data;
9struct platform_device;
10
11/* called from core irq code at init */
12int init_external_IRQ(void);
13
14/*
15 * called from SoC init_irq() callback to dynamically indicate the lack of
16 * HWMASKEXT registers.
17 */
18void meta_intc_no_mask(void);
19
20/*
21 * These allow SoCs to specialise the interrupt controller from their init_irq
22 * callbacks.
23 */
24
25extern struct irq_chip meta_intc_edge_chip;
26extern struct irq_chip meta_intc_level_chip;
27
28/* this should be called in the mask callback */
29void meta_intc_mask_irq_simple(struct irq_data *data);
30/* this should be called in the unmask callback */
31void meta_intc_unmask_irq_simple(struct irq_data *data);
32
33#endif /* _LINUX_IRQCHIP_METAG_EXT_H_ */
diff --git a/include/linux/irqchip/metag.h b/include/linux/irqchip/metag.h
new file mode 100644
index 000000000000..4ebdfb3101ab
--- /dev/null
+++ b/include/linux/irqchip/metag.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2011 Imagination Technologies
3 */
4
5#ifndef _LINUX_IRQCHIP_METAG_H_
6#define _LINUX_IRQCHIP_METAG_H_
7
8#include <linux/errno.h>
9
10#ifdef CONFIG_METAG_PERFCOUNTER_IRQS
11extern int init_internal_IRQ(void);
12extern int internal_irq_map(unsigned int hw);
13#else
14static inline int init_internal_IRQ(void)
15{
16 return 0;
17}
18static inline int internal_irq_map(unsigned int hw)
19{
20 return -EINVAL;
21}
22#endif
23
24#endif /* _LINUX_IRQCHIP_METAG_H_ */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index e30b66346942..50e5a5e6a712 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -20,7 +20,6 @@
20#ifndef __KERNEL__ 20#ifndef __KERNEL__
21#include "jfs_compat.h" 21#include "jfs_compat.h"
22#define JBD2_DEBUG 22#define JBD2_DEBUG
23#define jfs_debug jbd_debug
24#else 23#else
25 24
26#include <linux/types.h> 25#include <linux/types.h>
@@ -57,7 +56,7 @@
57 * CONFIG_JBD2_DEBUG is on. 56 * CONFIG_JBD2_DEBUG is on.
58 */ 57 */
59#define JBD2_EXPENSIVE_CHECKING 58#define JBD2_EXPENSIVE_CHECKING
60extern u8 jbd2_journal_enable_debug; 59extern ushort jbd2_journal_enable_debug;
61 60
62#define jbd_debug(n, f, a...) \ 61#define jbd_debug(n, f, a...) \
63 do { \ 62 do { \
@@ -397,35 +396,18 @@ struct jbd2_journal_handle
397 int h_err; 396 int h_err;
398 397
399 /* Flags [no locking] */ 398 /* Flags [no locking] */
400 unsigned int h_sync:1; /* sync-on-close */ 399 unsigned int h_sync: 1; /* sync-on-close */
401 unsigned int h_jdata:1; /* force data journaling */ 400 unsigned int h_jdata: 1; /* force data journaling */
402 unsigned int h_aborted:1; /* fatal error on handle */ 401 unsigned int h_aborted: 1; /* fatal error on handle */
403 unsigned int h_cowing:1; /* COWing block to snapshot */ 402 unsigned int h_type: 8; /* for handle statistics */
404 403 unsigned int h_line_no: 16; /* for handle statistics */
405 /* Number of buffers requested by user:
406 * (before adding the COW credits factor) */
407 unsigned int h_base_credits:14;
408
409 /* Number of buffers the user is allowed to dirty:
410 * (counts only buffers dirtied when !h_cowing) */
411 unsigned int h_user_credits:14;
412 404
405 unsigned long h_start_jiffies;
406 unsigned int h_requested_credits;
413 407
414#ifdef CONFIG_DEBUG_LOCK_ALLOC 408#ifdef CONFIG_DEBUG_LOCK_ALLOC
415 struct lockdep_map h_lockdep_map; 409 struct lockdep_map h_lockdep_map;
416#endif 410#endif
417
418#ifdef CONFIG_JBD2_DEBUG
419 /* COW debugging counters: */
420 unsigned int h_cow_moved; /* blocks moved to snapshot */
421 unsigned int h_cow_copied; /* blocks copied to snapshot */
422 unsigned int h_cow_ok_jh; /* blocks already COWed during current
423 transaction */
424 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
425 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
426 unsigned int h_cow_bitmaps; /* COW bitmaps created */
427 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
428#endif
429}; 411};
430 412
431 413
@@ -581,6 +563,11 @@ struct transaction_s
581 unsigned long t_start; 563 unsigned long t_start;
582 564
583 /* 565 /*
566 * When commit was requested
567 */
568 unsigned long t_requested;
569
570 /*
584 * Checkpointing stats [j_checkpoint_sem] 571 * Checkpointing stats [j_checkpoint_sem]
585 */ 572 */
586 struct transaction_chp_stats_s t_chp_stats; 573 struct transaction_chp_stats_s t_chp_stats;
@@ -637,6 +624,7 @@ struct transaction_s
637 624
638struct transaction_run_stats_s { 625struct transaction_run_stats_s {
639 unsigned long rs_wait; 626 unsigned long rs_wait;
627 unsigned long rs_request_delay;
640 unsigned long rs_running; 628 unsigned long rs_running;
641 unsigned long rs_locked; 629 unsigned long rs_locked;
642 unsigned long rs_flushing; 630 unsigned long rs_flushing;
@@ -649,6 +637,7 @@ struct transaction_run_stats_s {
649 637
650struct transaction_stats_s { 638struct transaction_stats_s {
651 unsigned long ts_tid; 639 unsigned long ts_tid;
640 unsigned long ts_requested;
652 struct transaction_run_stats_s run; 641 struct transaction_run_stats_s run;
653}; 642};
654 643
@@ -1086,7 +1075,8 @@ static inline handle_t *journal_current_handle(void)
1086 */ 1075 */
1087 1076
1088extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1077extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1089extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask); 1078extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask,
1079 unsigned int type, unsigned int line_no);
1090extern int jbd2_journal_restart(handle_t *, int nblocks); 1080extern int jbd2_journal_restart(handle_t *, int nblocks);
1091extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); 1081extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask);
1092extern int jbd2_journal_extend (handle_t *, int nblocks); 1082extern int jbd2_journal_extend (handle_t *, int nblocks);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index c566927efcbd..80d36874689b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -398,7 +398,11 @@ extern int panic_on_unrecovered_nmi;
398extern int panic_on_io_nmi; 398extern int panic_on_io_nmi;
399extern int sysctl_panic_on_stackoverflow; 399extern int sysctl_panic_on_stackoverflow;
400extern const char *print_tainted(void); 400extern const char *print_tainted(void);
401extern void add_taint(unsigned flag); 401enum lockdep_ok {
402 LOCKDEP_STILL_OK,
403 LOCKDEP_NOW_UNRELIABLE
404};
405extern void add_taint(unsigned flag, enum lockdep_ok);
402extern int test_taint(unsigned flag); 406extern int test_taint(unsigned flag);
403extern unsigned long get_taint(void); 407extern unsigned long get_taint(void);
404extern int root_mountflags; 408extern int root_mountflags;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d0b8458a703a..d2e6927bbaae 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -191,6 +191,7 @@ extern struct kimage *kexec_crash_image;
191/* Location of a reserved region to hold the crash kernel. 191/* Location of a reserved region to hold the crash kernel.
192 */ 192 */
193extern struct resource crashk_res; 193extern struct resource crashk_res;
194extern struct resource crashk_low_res;
194typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; 195typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
195extern note_buf_t __percpu *crash_notes; 196extern note_buf_t __percpu *crash_notes;
196extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; 197extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
@@ -199,6 +200,8 @@ extern size_t vmcoreinfo_max_size;
199 200
200int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, 201int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
201 unsigned long long *crash_size, unsigned long long *crash_base); 202 unsigned long long *crash_size, unsigned long long *crash_base);
203int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
204 unsigned long long *crash_size, unsigned long long *crash_base);
202int crash_shrink_memory(unsigned long new_size); 205int crash_shrink_memory(unsigned long new_size);
203size_t crash_get_memory_size(void); 206size_t crash_get_memory_size(void);
204void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 207void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 3319a6967626..45c9b6a17bcb 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -16,9 +16,6 @@
16struct stable_node; 16struct stable_node;
17struct mem_cgroup; 17struct mem_cgroup;
18 18
19struct page *ksm_does_need_to_copy(struct page *page,
20 struct vm_area_struct *vma, unsigned long address);
21
22#ifdef CONFIG_KSM 19#ifdef CONFIG_KSM
23int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 20int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end, int advice, unsigned long *vm_flags); 21 unsigned long end, int advice, unsigned long *vm_flags);
@@ -73,15 +70,8 @@ static inline void set_page_stable_node(struct page *page,
73 * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, 70 * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE,
74 * but what if the vma was unmerged while the page was swapped out? 71 * but what if the vma was unmerged while the page was swapped out?
75 */ 72 */
76static inline int ksm_might_need_to_copy(struct page *page, 73struct page *ksm_might_need_to_copy(struct page *page,
77 struct vm_area_struct *vma, unsigned long address) 74 struct vm_area_struct *vma, unsigned long address);
78{
79 struct anon_vma *anon_vma = page_anon_vma(page);
80
81 return anon_vma &&
82 (anon_vma->root != vma->anon_vma->root ||
83 page->index != linear_page_index(vma, address));
84}
85 75
86int page_referenced_ksm(struct page *page, 76int page_referenced_ksm(struct page *page,
87 struct mem_cgroup *memcg, unsigned long *vm_flags); 77 struct mem_cgroup *memcg, unsigned long *vm_flags);
@@ -113,10 +103,10 @@ static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
113 return 0; 103 return 0;
114} 104}
115 105
116static inline int ksm_might_need_to_copy(struct page *page, 106static inline struct page *ksm_might_need_to_copy(struct page *page,
117 struct vm_area_struct *vma, unsigned long address) 107 struct vm_area_struct *vma, unsigned long address)
118{ 108{
119 return 0; 109 return page;
120} 110}
121 111
122static inline int page_referenced_ksm(struct page *page, 112static inline int page_referenced_ksm(struct page *page,
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b7996a768eb2..cad77fe09d77 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -123,6 +123,8 @@ static inline bool is_error_page(struct page *page)
123#define KVM_REQ_WATCHDOG 18 123#define KVM_REQ_WATCHDOG 18
124#define KVM_REQ_MASTERCLOCK_UPDATE 19 124#define KVM_REQ_MASTERCLOCK_UPDATE 19
125#define KVM_REQ_MCLOCK_INPROGRESS 20 125#define KVM_REQ_MCLOCK_INPROGRESS 20
126#define KVM_REQ_EPR_EXIT 21
127#define KVM_REQ_EOIBITMAP 22
126 128
127#define KVM_USERSPACE_IRQ_SOURCE_ID 0 129#define KVM_USERSPACE_IRQ_SOURCE_ID 0
128#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 130#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -267,12 +269,11 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
267struct kvm_memory_slot { 269struct kvm_memory_slot {
268 gfn_t base_gfn; 270 gfn_t base_gfn;
269 unsigned long npages; 271 unsigned long npages;
270 unsigned long flags;
271 unsigned long *dirty_bitmap; 272 unsigned long *dirty_bitmap;
272 struct kvm_arch_memory_slot arch; 273 struct kvm_arch_memory_slot arch;
273 unsigned long userspace_addr; 274 unsigned long userspace_addr;
274 int user_alloc; 275 u32 flags;
275 int id; 276 short id;
276}; 277};
277 278
278static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) 279static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
@@ -314,8 +315,12 @@ struct kvm_irq_routing_table {};
314 315
315#endif 316#endif
316 317
318#ifndef KVM_PRIVATE_MEM_SLOTS
319#define KVM_PRIVATE_MEM_SLOTS 0
320#endif
321
317#ifndef KVM_MEM_SLOTS_NUM 322#ifndef KVM_MEM_SLOTS_NUM
318#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) 323#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
319#endif 324#endif
320 325
321/* 326/*
@@ -327,7 +332,7 @@ struct kvm_memslots {
327 u64 generation; 332 u64 generation;
328 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; 333 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
329 /* The mapping table from slot id to the index in memslots[]. */ 334 /* The mapping table from slot id to the index in memslots[]. */
330 int id_to_index[KVM_MEM_SLOTS_NUM]; 335 short id_to_index[KVM_MEM_SLOTS_NUM];
331}; 336};
332 337
333struct kvm { 338struct kvm {
@@ -425,7 +430,8 @@ void kvm_exit(void);
425 430
426void kvm_get_kvm(struct kvm *kvm); 431void kvm_get_kvm(struct kvm *kvm);
427void kvm_put_kvm(struct kvm *kvm); 432void kvm_put_kvm(struct kvm *kvm);
428void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new); 433void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new,
434 u64 last_generation);
429 435
430static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 436static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
431{ 437{
@@ -448,10 +454,10 @@ id_to_memslot(struct kvm_memslots *slots, int id)
448 454
449int kvm_set_memory_region(struct kvm *kvm, 455int kvm_set_memory_region(struct kvm *kvm,
450 struct kvm_userspace_memory_region *mem, 456 struct kvm_userspace_memory_region *mem,
451 int user_alloc); 457 bool user_alloc);
452int __kvm_set_memory_region(struct kvm *kvm, 458int __kvm_set_memory_region(struct kvm *kvm,
453 struct kvm_userspace_memory_region *mem, 459 struct kvm_userspace_memory_region *mem,
454 int user_alloc); 460 bool user_alloc);
455void kvm_arch_free_memslot(struct kvm_memory_slot *free, 461void kvm_arch_free_memslot(struct kvm_memory_slot *free,
456 struct kvm_memory_slot *dont); 462 struct kvm_memory_slot *dont);
457int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 463int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
@@ -459,11 +465,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
459 struct kvm_memory_slot *memslot, 465 struct kvm_memory_slot *memslot,
460 struct kvm_memory_slot old, 466 struct kvm_memory_slot old,
461 struct kvm_userspace_memory_region *mem, 467 struct kvm_userspace_memory_region *mem,
462 int user_alloc); 468 bool user_alloc);
463void kvm_arch_commit_memory_region(struct kvm *kvm, 469void kvm_arch_commit_memory_region(struct kvm *kvm,
464 struct kvm_userspace_memory_region *mem, 470 struct kvm_userspace_memory_region *mem,
465 struct kvm_memory_slot old, 471 struct kvm_memory_slot old,
466 int user_alloc); 472 bool user_alloc);
467bool kvm_largepages_enabled(void); 473bool kvm_largepages_enabled(void);
468void kvm_disable_largepages(void); 474void kvm_disable_largepages(void);
469/* flush all memory translations */ 475/* flush all memory translations */
@@ -533,6 +539,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
533void kvm_flush_remote_tlbs(struct kvm *kvm); 539void kvm_flush_remote_tlbs(struct kvm *kvm);
534void kvm_reload_remote_mmus(struct kvm *kvm); 540void kvm_reload_remote_mmus(struct kvm *kvm);
535void kvm_make_mclock_inprogress_request(struct kvm *kvm); 541void kvm_make_mclock_inprogress_request(struct kvm *kvm);
542void kvm_make_update_eoibitmap_request(struct kvm *kvm);
536 543
537long kvm_arch_dev_ioctl(struct file *filp, 544long kvm_arch_dev_ioctl(struct file *filp,
538 unsigned int ioctl, unsigned long arg); 545 unsigned int ioctl, unsigned long arg);
@@ -550,7 +557,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
550int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, 557int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
551 struct 558 struct
552 kvm_userspace_memory_region *mem, 559 kvm_userspace_memory_region *mem,
553 int user_alloc); 560 bool user_alloc);
554int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level); 561int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level);
555long kvm_arch_vm_ioctl(struct file *filp, 562long kvm_arch_vm_ioctl(struct file *filp,
556 unsigned int ioctl, unsigned long arg); 563 unsigned int ioctl, unsigned long arg);
@@ -686,6 +693,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
686int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); 693int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
687int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, 694int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
688 int irq_source_id, int level); 695 int irq_source_id, int level);
696bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
689void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 697void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
690void kvm_register_irq_ack_notifier(struct kvm *kvm, 698void kvm_register_irq_ack_notifier(struct kvm *kvm,
691 struct kvm_irq_ack_notifier *kian); 699 struct kvm_irq_ack_notifier *kian);
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
deleted file mode 100644
index 3f071ec019b2..000000000000
--- a/include/linux/leds-lp5521.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * LP5521 LED chip driver.
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5521_H
24#define __LINUX_LP5521_H
25
26/* See Documentation/leds/leds-lp5521.txt */
27
28struct lp5521_led_config {
29 char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35struct lp5521_led_pattern {
36 u8 *r;
37 u8 *g;
38 u8 *b;
39 u8 size_r;
40 u8 size_g;
41 u8 size_b;
42};
43
44#define LP5521_CLOCK_AUTO 0
45#define LP5521_CLOCK_INT 1
46#define LP5521_CLOCK_EXT 2
47
48/* Bits in CONFIG register */
49#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
50#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
51#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
52#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
53#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
54#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
55#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
56#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
57#define LP5521_CLK_INT 1 /* Internal clock */
58#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
59
60struct lp5521_platform_data {
61 struct lp5521_led_config *led_config;
62 u8 num_channels;
63 u8 clock_mode;
64 int (*setup_resources)(void);
65 void (*release_resources)(void);
66 void (*enable)(bool state);
67 const char *label;
68 u8 update_config;
69 struct lp5521_led_pattern *patterns;
70 int num_patterns;
71};
72
73#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
deleted file mode 100644
index 727877fb406d..000000000000
--- a/include/linux/leds-lp5523.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * LP5523 LED Driver
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5523_H
24#define __LINUX_LP5523_H
25
26/* See Documentation/leds/leds-lp5523.txt */
27
28struct lp5523_led_config {
29 const char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35#define LP5523_CLOCK_AUTO 0
36#define LP5523_CLOCK_INT 1
37#define LP5523_CLOCK_EXT 2
38
39struct lp5523_platform_data {
40 struct lp5523_led_config *led_config;
41 u8 num_channels;
42 u8 clock_mode;
43 int (*setup_resources)(void);
44 void (*release_resources)(void);
45 void (*enable)(bool state);
46 const char *label;
47};
48
49#endif /* __LINUX_LP5523_H */
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
index 33a071167489..a65e9646e4b1 100644
--- a/include/linux/leds_pwm.h
+++ b/include/linux/leds_pwm.h
@@ -7,7 +7,7 @@
7struct led_pwm { 7struct led_pwm {
8 const char *name; 8 const char *name;
9 const char *default_trigger; 9 const char *default_trigger;
10 unsigned pwm_id; 10 unsigned pwm_id __deprecated;
11 u8 active_low; 11 u8 active_low;
12 unsigned max_brightness; 12 unsigned max_brightness;
13 unsigned pwm_period_ns; 13 unsigned pwm_period_ns;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 649e5f86b5f0..91c9d109e5f1 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -620,6 +620,9 @@ struct ata_device {
620 union acpi_object *gtf_cache; 620 union acpi_object *gtf_cache;
621 unsigned int gtf_filter; 621 unsigned int gtf_filter;
622#endif 622#endif
623#ifdef CONFIG_SATA_ZPODD
624 void *zpodd;
625#endif
623 struct device tdev; 626 struct device tdev;
624 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ 627 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
625 u64 n_sectors; /* size of device, if ATA */ 628 u64 n_sectors; /* size of device, if ATA */
diff --git a/include/linux/list.h b/include/linux/list.h
index cc6d2aa6b415..d991cc147c98 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -666,54 +666,49 @@ static inline void hlist_move_list(struct hlist_head *old,
666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
667 pos = n) 667 pos = n)
668 668
669#define hlist_entry_safe(ptr, type, member) \
670 (ptr) ? hlist_entry(ptr, type, member) : NULL
671
669/** 672/**
670 * hlist_for_each_entry - iterate over list of given type 673 * hlist_for_each_entry - iterate over list of given type
671 * @tpos: the type * to use as a loop cursor. 674 * @pos: the type * to use as a loop cursor.
672 * @pos: the &struct hlist_node to use as a loop cursor.
673 * @head: the head for your list. 675 * @head: the head for your list.
674 * @member: the name of the hlist_node within the struct. 676 * @member: the name of the hlist_node within the struct.
675 */ 677 */
676#define hlist_for_each_entry(tpos, pos, head, member) \ 678#define hlist_for_each_entry(pos, head, member) \
677 for (pos = (head)->first; \ 679 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
678 pos && \ 680 pos; \
679 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 681 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
680 pos = pos->next)
681 682
682/** 683/**
683 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point 684 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
684 * @tpos: the type * to use as a loop cursor. 685 * @pos: the type * to use as a loop cursor.
685 * @pos: the &struct hlist_node to use as a loop cursor.
686 * @member: the name of the hlist_node within the struct. 686 * @member: the name of the hlist_node within the struct.
687 */ 687 */
688#define hlist_for_each_entry_continue(tpos, pos, member) \ 688#define hlist_for_each_entry_continue(pos, member) \
689 for (pos = (pos)->next; \ 689 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
690 pos && \ 690 pos; \
691 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 691 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
692 pos = pos->next)
693 692
694/** 693/**
695 * hlist_for_each_entry_from - iterate over a hlist continuing from current point 694 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
696 * @tpos: the type * to use as a loop cursor. 695 * @pos: the type * to use as a loop cursor.
697 * @pos: the &struct hlist_node to use as a loop cursor.
698 * @member: the name of the hlist_node within the struct. 696 * @member: the name of the hlist_node within the struct.
699 */ 697 */
700#define hlist_for_each_entry_from(tpos, pos, member) \ 698#define hlist_for_each_entry_from(pos, member) \
701 for (; pos && \ 699 for (; pos; \
702 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 700 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
703 pos = pos->next)
704 701
705/** 702/**
706 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 703 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
707 * @tpos: the type * to use as a loop cursor. 704 * @pos: the type * to use as a loop cursor.
708 * @pos: the &struct hlist_node to use as a loop cursor.
709 * @n: another &struct hlist_node to use as temporary storage 705 * @n: another &struct hlist_node to use as temporary storage
710 * @head: the head for your list. 706 * @head: the head for your list.
711 * @member: the name of the hlist_node within the struct. 707 * @member: the name of the hlist_node within the struct.
712 */ 708 */
713#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ 709#define hlist_for_each_entry_safe(pos, n, head, member) \
714 for (pos = (head)->first; \ 710 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
715 pos && ({ n = pos->next; 1; }) && \ 711 pos && ({ n = pos->member.next; 1; }); \
716 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 712 pos = hlist_entry_safe(n, typeof(*pos), member))
717 pos = n)
718 713
719#endif 714#endif
diff --git a/include/linux/llist.h b/include/linux/llist.h
index d0ab98f73d38..a5199f6d0e82 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -125,31 +125,6 @@ static inline void init_llist_head(struct llist_head *list)
125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
126 126
127/** 127/**
128 * llist_for_each_entry_safe - iterate safely against remove over some entries
129 * of lock-less list of given type.
130 * @pos: the type * to use as a loop cursor.
131 * @n: another type * to use as a temporary storage.
132 * @node: the fist entry of deleted list entries.
133 * @member: the name of the llist_node with the struct.
134 *
135 * In general, some entries of the lock-less list can be traversed
136 * safely only after being removed from list, so start with an entry
137 * instead of list head. This variant allows removal of entries
138 * as we iterate.
139 *
140 * If being used on entries deleted from lock-less list directly, the
141 * traverse order is from the newest to the oldest added entry. If
142 * you want to traverse from the oldest to the newest, you must
143 * reverse the order by yourself before traversing.
144 */
145#define llist_for_each_entry_safe(pos, n, node, member) \
146 for ((pos) = llist_entry((node), typeof(*(pos)), member), \
147 (n) = (pos)->member.next; \
148 &(pos)->member != NULL; \
149 (pos) = llist_entry(n, typeof(*(pos)), member), \
150 (n) = (&(pos)->member != NULL) ? (pos)->member.next : NULL)
151
152/**
153 * llist_empty - tests whether a lock-less list is empty 128 * llist_empty - tests whether a lock-less list is empty
154 * @head: the list to test 129 * @head: the list to test
155 * 130 *
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index f5a051a79273..dcaad79f54ed 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -212,7 +212,8 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
212__be32 nlmclnt_grant(const struct sockaddr *addr, 212__be32 nlmclnt_grant(const struct sockaddr *addr,
213 const struct nlm_lock *lock); 213 const struct nlm_lock *lock);
214void nlmclnt_recovery(struct nlm_host *); 214void nlmclnt_recovery(struct nlm_host *);
215int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 215int nlmclnt_reclaim(struct nlm_host *, struct file_lock *,
216 struct nlm_rqst *);
216void nlmclnt_next_cookie(struct nlm_cookie *); 217void nlmclnt_next_cookie(struct nlm_cookie *);
217 218
218/* 219/*
@@ -291,7 +292,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
291 292
292static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 293static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
293{ 294{
294 return file->f_file->f_path.dentry->d_inode; 295 return file_inode(file->f_file);
295} 296}
296 297
297static inline int __nlm_privileged_request4(const struct sockaddr *sap) 298static inline int __nlm_privileged_request4(const struct sockaddr *sap)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index bfe88c4aa251..f1e877b79ed8 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -412,7 +412,7 @@ struct lock_class_key { };
412 412
413#define lockdep_depth(tsk) (0) 413#define lockdep_depth(tsk) (0)
414 414
415#define lockdep_assert_held(l) do { } while (0) 415#define lockdep_assert_held(l) do { (void)(l); } while (0)
416 416
417#define lockdep_recursing(tsk) (0) 417#define lockdep_recursing(tsk) (0)
418 418
diff --git a/include/linux/lzo.h b/include/linux/lzo.h
index d793497ec1ca..a0848d9377e5 100644
--- a/include/linux/lzo.h
+++ b/include/linux/lzo.h
@@ -4,28 +4,28 @@
4 * LZO Public Kernel Interface 4 * LZO Public Kernel Interface
5 * A mini subset of the LZO real-time data compression library 5 * A mini subset of the LZO real-time data compression library
6 * 6 *
7 * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com> 7 * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
8 * 8 *
9 * The full LZO package can be found at: 9 * The full LZO package can be found at:
10 * http://www.oberhumer.com/opensource/lzo/ 10 * http://www.oberhumer.com/opensource/lzo/
11 * 11 *
12 * Changed for kernel use by: 12 * Changed for Linux kernel use by:
13 * Nitin Gupta <nitingupta910@gmail.com> 13 * Nitin Gupta <nitingupta910@gmail.com>
14 * Richard Purdie <rpurdie@openedhand.com> 14 * Richard Purdie <rpurdie@openedhand.com>
15 */ 15 */
16 16
17#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *)) 17#define LZO1X_1_MEM_COMPRESS (8192 * sizeof(unsigned short))
18#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS 18#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
19 19
20#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3) 20#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
21 21
22/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */ 22/* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
23int lzo1x_1_compress(const unsigned char *src, size_t src_len, 23int lzo1x_1_compress(const unsigned char *src, size_t src_len,
24 unsigned char *dst, size_t *dst_len, void *wrkmem); 24 unsigned char *dst, size_t *dst_len, void *wrkmem);
25 25
26/* safe decompression with overrun testing */ 26/* safe decompression with overrun testing */
27int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, 27int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
28 unsigned char *dst, size_t *dst_len); 28 unsigned char *dst, size_t *dst_len);
29 29
30/* 30/*
31 * Return values (< 0 = Error) 31 * Return values (< 0 = Error)
@@ -40,5 +40,6 @@ int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
40#define LZO_E_EOF_NOT_FOUND (-7) 40#define LZO_E_EOF_NOT_FOUND (-7)
41#define LZO_E_INPUT_NOT_CONSUMED (-8) 41#define LZO_E_INPUT_NOT_CONSUMED (-8)
42#define LZO_E_NOT_YET_IMPLEMENTED (-9) 42#define LZO_E_NOT_YET_IMPLEMENTED (-9)
43#define LZO_E_INVALID_ARGUMENT (-10)
43 44
44#endif 45#endif
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index d452ee191066..f388203db7e8 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -155,6 +155,7 @@ phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
155phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, 155phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
156 phys_addr_t max_addr); 156 phys_addr_t max_addr);
157phys_addr_t memblock_phys_mem_size(void); 157phys_addr_t memblock_phys_mem_size(void);
158phys_addr_t memblock_mem_size(unsigned long limit_pfn);
158phys_addr_t memblock_start_of_DRAM(void); 159phys_addr_t memblock_start_of_DRAM(void);
159phys_addr_t memblock_end_of_DRAM(void); 160phys_addr_t memblock_end_of_DRAM(void);
160void memblock_enforce_memory_limit(phys_addr_t memory_limit); 161void memblock_enforce_memory_limit(phys_addr_t memory_limit);
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 28bd5fa2ff2e..d6183f06d8c1 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -116,7 +116,6 @@ void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
116 * For memory reclaim. 116 * For memory reclaim.
117 */ 117 */
118int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec); 118int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec);
119int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec);
120int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 119int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
121unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list); 120unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
122void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 121void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
@@ -321,12 +320,6 @@ mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
321 return 1; 320 return 1;
322} 321}
323 322
324static inline int
325mem_cgroup_inactive_file_is_low(struct lruvec *lruvec)
326{
327 return 1;
328}
329
330static inline unsigned long 323static inline unsigned long
331mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) 324mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
332{ 325{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 4a45c4e50025..b6a3be7d47bf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -96,6 +96,7 @@ extern void __online_page_free(struct page *page);
96 96
97#ifdef CONFIG_MEMORY_HOTREMOVE 97#ifdef CONFIG_MEMORY_HOTREMOVE
98extern bool is_pageblock_removable_nolock(struct page *page); 98extern bool is_pageblock_removable_nolock(struct page *page);
99extern int arch_remove_memory(u64 start, u64 size);
99#endif /* CONFIG_MEMORY_HOTREMOVE */ 100#endif /* CONFIG_MEMORY_HOTREMOVE */
100 101
101/* reasonably generic interface to expand the physical pages in a zone */ 102/* reasonably generic interface to expand the physical pages in a zone */
@@ -173,17 +174,16 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
173#endif /* CONFIG_NUMA */ 174#endif /* CONFIG_NUMA */
174#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ 175#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
175 176
176#ifdef CONFIG_SPARSEMEM_VMEMMAP 177#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
178extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
179#else
177static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) 180static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
178{ 181{
179} 182}
180static inline void put_page_bootmem(struct page *page)
181{
182}
183#else
184extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
185extern void put_page_bootmem(struct page *page);
186#endif 183#endif
184extern void put_page_bootmem(struct page *page);
185extern void get_page_bootmem(unsigned long ingo, struct page *page,
186 unsigned long type);
187 187
188/* 188/*
189 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug 189 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug
@@ -233,6 +233,7 @@ static inline void unlock_memory_hotplug(void) {}
233#ifdef CONFIG_MEMORY_HOTREMOVE 233#ifdef CONFIG_MEMORY_HOTREMOVE
234 234
235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236extern void try_offline_node(int nid);
236 237
237#else 238#else
238static inline int is_mem_section_removable(unsigned long pfn, 239static inline int is_mem_section_removable(unsigned long pfn,
@@ -240,6 +241,8 @@ static inline int is_mem_section_removable(unsigned long pfn,
240{ 241{
241 return 0; 242 return 0;
242} 243}
244
245static inline void try_offline_node(int nid) {}
243#endif /* CONFIG_MEMORY_HOTREMOVE */ 246#endif /* CONFIG_MEMORY_HOTREMOVE */
244 247
245extern int mem_online_node(int nid); 248extern int mem_online_node(int nid);
@@ -247,7 +250,8 @@ extern int add_memory(int nid, u64 start, u64 size);
247extern int arch_add_memory(int nid, u64 start, u64 size); 250extern int arch_add_memory(int nid, u64 start, u64 size);
248extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 251extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
249extern int offline_memory_block(struct memory_block *mem); 252extern int offline_memory_block(struct memory_block *mem);
250extern int remove_memory(u64 start, u64 size); 253extern bool is_memblock_offlined(struct memory_block *mem);
254extern int remove_memory(int nid, u64 start, u64 size);
251extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 255extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
252 int nr_pages); 256 int nr_pages);
253extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 257extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index 478672ed0c3d..e94537befabd 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -365,5 +365,5 @@ static inline int pm80x_dev_resume(struct device *dev)
365 365
366extern int pm80x_init(struct i2c_client *client, 366extern int pm80x_init(struct i2c_client *client,
367 const struct i2c_device_id *id); 367 const struct i2c_device_id *id);
368extern int pm80x_deinit(struct i2c_client *client); 368extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 369#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 80e3b8683a84..9ead60bc66b7 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -311,6 +311,7 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
311int abx500_get_chip_id(struct device *dev); 311int abx500_get_chip_id(struct device *dev);
312int abx500_event_registers_startup_state_get(struct device *dev, u8 *event); 312int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
313int abx500_startup_irq_enabled(struct device *dev, unsigned int irq); 313int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
314void abx500_dump_all_banks(void);
314 315
315struct abx500_ops { 316struct abx500_ops {
316 int (*get_chip_id) (struct device *); 317 int (*get_chip_id) (struct device *);
@@ -321,6 +322,7 @@ struct abx500_ops {
321 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8); 322 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8);
322 int (*event_registers_startup_state_get) (struct device *, u8 *); 323 int (*event_registers_startup_state_get) (struct device *, u8 *);
323 int (*startup_irq_enabled) (struct device *, unsigned int); 324 int (*startup_irq_enabled) (struct device *, unsigned int);
325 void (*dump_all_banks) (struct device *);
324}; 326};
325 327
326int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops); 328int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10eb50973c39..ebf12e793db9 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -37,6 +37,11 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
37 return ab8500_sysctrl_write(reg, bits, 0); 37 return ab8500_sysctrl_write(reg, bits, 0);
38} 38}
39 39
40/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
41struct ab8500_sysctrl_platform_data {
42 u8 initial_req_buf_config[8];
43};
44
40/* Registers */ 45/* Registers */
41#define AB8500_TURNONSTATUS 0x100 46#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101 47#define AB8500_RESETSTATUS 0x101
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index fc0534483c72..9db0bda446a0 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -368,10 +368,12 @@ struct regulator_reg_init;
368struct regulator_init_data; 368struct regulator_init_data;
369struct ab8500_gpio_platform_data; 369struct ab8500_gpio_platform_data;
370struct ab8500_codec_platform_data; 370struct ab8500_codec_platform_data;
371struct ab8500_sysctrl_platform_data;
371 372
372/** 373/**
373 * struct ab8500_platform_data - AB8500 platform data 374 * struct ab8500_platform_data - AB8500 platform data
374 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 375 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
376 * @pm_power_off: Should machine pm power off hook be registered or not
375 * @init: board-specific initialization after detection of ab8500 377 * @init: board-specific initialization after detection of ab8500
376 * @num_regulator_reg_init: number of regulator init registers 378 * @num_regulator_reg_init: number of regulator init registers
377 * @regulator_reg_init: regulator init registers 379 * @regulator_reg_init: regulator init registers
@@ -380,6 +382,7 @@ struct ab8500_codec_platform_data;
380 */ 382 */
381struct ab8500_platform_data { 383struct ab8500_platform_data {
382 int irq_base; 384 int irq_base;
385 bool pm_power_off;
383 void (*init) (struct ab8500 *); 386 void (*init) (struct ab8500 *);
384 int num_regulator_reg_init; 387 int num_regulator_reg_init;
385 struct ab8500_regulator_reg_init *regulator_reg_init; 388 struct ab8500_regulator_reg_init *regulator_reg_init;
@@ -387,6 +390,7 @@ struct ab8500_platform_data {
387 struct regulator_init_data *regulator; 390 struct regulator_init_data *regulator;
388 struct abx500_gpio_platform_data *gpio; 391 struct abx500_gpio_platform_data *gpio;
389 struct ab8500_codec_platform_data *codec; 392 struct ab8500_codec_platform_data *codec;
393 struct ab8500_sysctrl_platform_data *sysctrl;
390}; 394};
391 395
392extern int ab8500_init(struct ab8500 *ab8500, 396extern int ab8500_init(struct ab8500 *ab8500,
@@ -508,4 +512,12 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
508 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0)); 512 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));
509} 513}
510 514
515#ifdef CONFIG_AB8500_DEBUG
516void ab8500_dump_all_banks(struct device *dev);
517void ab8500_debug_register_interrupt(int line);
518#else
519static inline void ab8500_dump_all_banks(struct device *dev) {}
520static inline void ab8500_debug_register_interrupt(int line) {}
521#endif
522
511#endif /* MFD_AB8500_H */ 523#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 96d64f2b8d78..455c51d22d6b 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -56,6 +56,8 @@
56#define ARIZONA_DMIC_MICBIAS2 2 56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3 57#define ARIZONA_DMIC_MICBIAS3 3
58 58
59#define ARIZONA_MAX_MICBIAS 3
60
59#define ARIZONA_INMODE_DIFF 0 61#define ARIZONA_INMODE_DIFF 0
60#define ARIZONA_INMODE_SE 1 62#define ARIZONA_INMODE_SE 1
61#define ARIZONA_INMODE_DMIC 2 63#define ARIZONA_INMODE_DMIC 2
@@ -71,6 +73,13 @@
71 73
72struct regulator_init_data; 74struct regulator_init_data;
73 75
76struct arizona_micbias {
77 int mV; /** Regulated voltage */
78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */
81};
82
74struct arizona_micd_config { 83struct arizona_micd_config {
75 unsigned int src; 84 unsigned int src;
76 unsigned int bias; 85 unsigned int bias;
@@ -136,6 +145,9 @@ struct arizona_pdata {
136 /** Reference voltage for DMIC inputs */ 145 /** Reference voltage for DMIC inputs */
137 int dmic_ref[ARIZONA_MAX_INPUT]; 146 int dmic_ref[ARIZONA_MAX_INPUT];
138 147
148 /** MICBIAS configurations */
149 struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
150
139 /** Mode of input structures */ 151 /** Mode of input structures */
140 int inmode[ARIZONA_MAX_INPUT]; 152 int inmode[ARIZONA_MAX_INPUT];
141 153
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 188d89abd963..340355136069 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -984,18 +984,34 @@
984#define ARIZONA_DSP1_STATUS_1 0x1104 984#define ARIZONA_DSP1_STATUS_1 0x1104
985#define ARIZONA_DSP1_STATUS_2 0x1105 985#define ARIZONA_DSP1_STATUS_2 0x1105
986#define ARIZONA_DSP1_STATUS_3 0x1106 986#define ARIZONA_DSP1_STATUS_3 0x1106
987#define ARIZONA_DSP1_SCRATCH_0 0x1140
988#define ARIZONA_DSP1_SCRATCH_1 0x1141
989#define ARIZONA_DSP1_SCRATCH_2 0x1142
990#define ARIZONA_DSP1_SCRATCH_3 0x1143
987#define ARIZONA_DSP2_CONTROL_1 0x1200 991#define ARIZONA_DSP2_CONTROL_1 0x1200
988#define ARIZONA_DSP2_CLOCKING_1 0x1201 992#define ARIZONA_DSP2_CLOCKING_1 0x1201
989#define ARIZONA_DSP2_STATUS_1 0x1204 993#define ARIZONA_DSP2_STATUS_1 0x1204
990#define ARIZONA_DSP2_STATUS_2 0x1205 994#define ARIZONA_DSP2_STATUS_2 0x1205
995#define ARIZONA_DSP2_SCRATCH_0 0x1240
996#define ARIZONA_DSP2_SCRATCH_1 0x1241
997#define ARIZONA_DSP2_SCRATCH_2 0x1242
998#define ARIZONA_DSP2_SCRATCH_3 0x1243
991#define ARIZONA_DSP3_CONTROL_1 0x1300 999#define ARIZONA_DSP3_CONTROL_1 0x1300
992#define ARIZONA_DSP3_CLOCKING_1 0x1301 1000#define ARIZONA_DSP3_CLOCKING_1 0x1301
993#define ARIZONA_DSP3_STATUS_1 0x1304 1001#define ARIZONA_DSP3_STATUS_1 0x1304
994#define ARIZONA_DSP3_STATUS_2 0x1305 1002#define ARIZONA_DSP3_STATUS_2 0x1305
1003#define ARIZONA_DSP3_SCRATCH_0 0x1340
1004#define ARIZONA_DSP3_SCRATCH_1 0x1341
1005#define ARIZONA_DSP3_SCRATCH_2 0x1342
1006#define ARIZONA_DSP3_SCRATCH_3 0x1343
995#define ARIZONA_DSP4_CONTROL_1 0x1400 1007#define ARIZONA_DSP4_CONTROL_1 0x1400
996#define ARIZONA_DSP4_CLOCKING_1 0x1401 1008#define ARIZONA_DSP4_CLOCKING_1 0x1401
997#define ARIZONA_DSP4_STATUS_1 0x1404 1009#define ARIZONA_DSP4_STATUS_1 0x1404
998#define ARIZONA_DSP4_STATUS_2 0x1405 1010#define ARIZONA_DSP4_STATUS_2 0x1405
1011#define ARIZONA_DSP4_SCRATCH_0 0x1440
1012#define ARIZONA_DSP4_SCRATCH_1 0x1441
1013#define ARIZONA_DSP4_SCRATCH_2 0x1442
1014#define ARIZONA_DSP4_SCRATCH_3 0x1443
999 1015
1000/* 1016/*
1001 * Field Definitions. 1017 * Field Definitions.
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index f8bac7cfc25f..3abcca91eecd 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -151,6 +151,18 @@ enum prcmu_clock {
151}; 151};
152 152
153/** 153/**
154 * enum prcmu_wdog_id - PRCMU watchdog IDs
155 * @PRCMU_WDOG_ALL: use all timers
156 * @PRCMU_WDOG_CPU1: use first CPU timer only
157 * @PRCMU_WDOG_CPU2: use second CPU timer conly
158 */
159enum prcmu_wdog_id {
160 PRCMU_WDOG_ALL = 0x00,
161 PRCMU_WDOG_CPU1 = 0x01,
162 PRCMU_WDOG_CPU2 = 0x02,
163};
164
165/**
154 * enum ape_opp - APE OPP states definition 166 * enum ape_opp - APE OPP states definition
155 * @APE_OPP_INIT: 167 * @APE_OPP_INIT:
156 * @APE_NO_CHANGE: The APE operating point is unchanged 168 * @APE_NO_CHANGE: The APE operating point is unchanged
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
index 2a32b16f79cb..786bf6679a28 100644
--- a/include/linux/mfd/lp8788.h
+++ b/include/linux/mfd/lp8788.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/irqdomain.h> 18#include <linux/irqdomain.h>
19#include <linux/pwm.h>
19#include <linux/regmap.h> 20#include <linux/regmap.h>
20 21
21#define LP8788_DEV_BUCK "lp8788-buck" 22#define LP8788_DEV_BUCK "lp8788-buck"
@@ -124,11 +125,6 @@ enum lp8788_bl_ramp_step {
124 LP8788_RAMP_65538us, 125 LP8788_RAMP_65538us,
125}; 126};
126 127
127enum lp8788_bl_pwm_polarity {
128 LP8788_PWM_ACTIVE_HIGH,
129 LP8788_PWM_ACTIVE_LOW,
130};
131
132enum lp8788_isink_scale { 128enum lp8788_isink_scale {
133 LP8788_ISINK_SCALE_100mA, 129 LP8788_ISINK_SCALE_100mA,
134 LP8788_ISINK_SCALE_120mA, 130 LP8788_ISINK_SCALE_120mA,
@@ -229,16 +225,6 @@ struct lp8788_charger_platform_data {
229}; 225};
230 226
231/* 227/*
232 * struct lp8788_bl_pwm_data
233 * @pwm_set_intensity : set duty of pwm
234 * @pwm_get_intensity : get current duty of pwm
235 */
236struct lp8788_bl_pwm_data {
237 void (*pwm_set_intensity) (int brightness, int max_brightness);
238 int (*pwm_get_intensity) (int max_brightness);
239};
240
241/*
242 * struct lp8788_backlight_platform_data 228 * struct lp8788_backlight_platform_data
243 * @name : backlight driver name. (default: "lcd-backlight") 229 * @name : backlight driver name. (default: "lcd-backlight")
244 * @initial_brightness : initial value of backlight brightness 230 * @initial_brightness : initial value of backlight brightness
@@ -248,8 +234,8 @@ struct lp8788_bl_pwm_data {
248 * @rise_time : brightness ramp up step time 234 * @rise_time : brightness ramp up step time
249 * @fall_time : brightness ramp down step time 235 * @fall_time : brightness ramp down step time
250 * @pwm_pol : pwm polarity setting when bl_mode is pwm based 236 * @pwm_pol : pwm polarity setting when bl_mode is pwm based
251 * @pwm_data : platform specific pwm generation functions 237 * @period_ns : platform specific pwm period value. unit is nano.
252 * only valid when bl_mode is pwm based 238 Only valid when bl_mode is LP8788_BL_COMB_PWM_BASED
253 */ 239 */
254struct lp8788_backlight_platform_data { 240struct lp8788_backlight_platform_data {
255 char *name; 241 char *name;
@@ -259,8 +245,8 @@ struct lp8788_backlight_platform_data {
259 enum lp8788_bl_full_scale_current full_scale; 245 enum lp8788_bl_full_scale_current full_scale;
260 enum lp8788_bl_ramp_step rise_time; 246 enum lp8788_bl_ramp_step rise_time;
261 enum lp8788_bl_ramp_step fall_time; 247 enum lp8788_bl_ramp_step fall_time;
262 enum lp8788_bl_pwm_polarity pwm_pol; 248 enum pwm_polarity pwm_pol;
263 struct lp8788_bl_pwm_data pwm_data; 249 unsigned int period_ns;
264}; 250};
265 251
266/* 252/*
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 74d8e2969630..ce8502e9e7dc 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -190,6 +190,8 @@ enum {
190 MAX8925_NR_IRQS, 190 MAX8925_NR_IRQS,
191}; 191};
192 192
193
194
193struct max8925_chip { 195struct max8925_chip {
194 struct device *dev; 196 struct device *dev;
195 struct i2c_client *i2c; 197 struct i2c_client *i2c;
@@ -201,7 +203,6 @@ struct max8925_chip {
201 int irq_base; 203 int irq_base;
202 int core_irq; 204 int core_irq;
203 int tsc_irq; 205 int tsc_irq;
204
205 unsigned int wakeup_flag; 206 unsigned int wakeup_flag;
206}; 207};
207 208
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 29f6616e12f0..a4d13d7cd001 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -2789,4 +2789,56 @@ enum usb_irq_events {
2789#define PALMAS_GPADC_TRIM15 0xE 2789#define PALMAS_GPADC_TRIM15 0xE
2790#define PALMAS_GPADC_TRIM16 0xF 2790#define PALMAS_GPADC_TRIM16 0xF
2791 2791
2792static inline int palmas_read(struct palmas *palmas, unsigned int base,
2793 unsigned int reg, unsigned int *val)
2794{
2795 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2796 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2797
2798 return regmap_read(palmas->regmap[slave_id], addr, val);
2799}
2800
2801static inline int palmas_write(struct palmas *palmas, unsigned int base,
2802 unsigned int reg, unsigned int value)
2803{
2804 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2805 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2806
2807 return regmap_write(palmas->regmap[slave_id], addr, value);
2808}
2809
2810static inline int palmas_bulk_write(struct palmas *palmas, unsigned int base,
2811 unsigned int reg, const void *val, size_t val_count)
2812{
2813 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2814 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2815
2816 return regmap_bulk_write(palmas->regmap[slave_id], addr,
2817 val, val_count);
2818}
2819
2820static inline int palmas_bulk_read(struct palmas *palmas, unsigned int base,
2821 unsigned int reg, void *val, size_t val_count)
2822{
2823 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2824 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2825
2826 return regmap_bulk_read(palmas->regmap[slave_id], addr,
2827 val, val_count);
2828}
2829
2830static inline int palmas_update_bits(struct palmas *palmas, unsigned int base,
2831 unsigned int reg, unsigned int mask, unsigned int val)
2832{
2833 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2834 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2835
2836 return regmap_update_bits(palmas->regmap[slave_id], addr, mask, val);
2837}
2838
2839static inline int palmas_irq_get_virq(struct palmas *palmas, int irq)
2840{
2841 return regmap_irq_get_virq(palmas->irq_data, irq);
2842}
2843
2792#endif /* __LINUX_MFD_PALMAS_H */ 2844#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 4b117a3f54d4..26ea7f1b7caf 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -465,7 +465,7 @@
465#define SD_RSP_TYPE_R6 0x01 465#define SD_RSP_TYPE_R6 0x01
466#define SD_RSP_TYPE_R7 0x01 466#define SD_RSP_TYPE_R7 0x01
467 467
468/* SD_CONFIURE3 */ 468/* SD_CONFIGURE3 */
469#define SD_RSP_80CLK_TIMEOUT_EN 0x01 469#define SD_RSP_80CLK_TIMEOUT_EN 0x01
470 470
471/* Card Transfer Reset Register */ 471/* Card Transfer Reset Register */
@@ -581,8 +581,11 @@
581#define CARD_GPIO_DIR 0xFD57 581#define CARD_GPIO_DIR 0xFD57
582#define CARD_GPIO 0xFD58 582#define CARD_GPIO 0xFD58
583#define CARD_DATA_SOURCE 0xFD5B 583#define CARD_DATA_SOURCE 0xFD5B
584#define SD30_CLK_DRIVE_SEL 0xFD5A
584#define CARD_SELECT 0xFD5C 585#define CARD_SELECT 0xFD5C
585#define SD30_DRIVE_SEL 0xFD5E 586#define SD30_DRIVE_SEL 0xFD5E
587#define SD30_CMD_DRIVE_SEL 0xFD5E
588#define SD30_DAT_DRIVE_SEL 0xFD5F
586#define CARD_CLK_EN 0xFD69 589#define CARD_CLK_EN 0xFD69
587#define SDIO_CTRL 0xFD6B 590#define SDIO_CTRL 0xFD6B
588#define CD_PAD_CTL 0xFD73 591#define CD_PAD_CTL 0xFD73
@@ -655,6 +658,8 @@
655#define MSGTXDATA3 0xFE47 658#define MSGTXDATA3 0xFE47
656#define MSGTXCTL 0xFE48 659#define MSGTXCTL 0xFE48
657#define PETXCFG 0xFE49 660#define PETXCFG 0xFE49
661#define LTR_CTL 0xFE4A
662#define OBFF_CFG 0xFE4C
658 663
659#define CDRESUMECTL 0xFE52 664#define CDRESUMECTL 0xFE52
660#define WAKE_SEL_CTL 0xFE54 665#define WAKE_SEL_CTL 0xFE54
@@ -735,6 +740,7 @@ struct rtsx_pcr {
735 740
736 unsigned int card_inserted; 741 unsigned int card_inserted;
737 unsigned int card_removed; 742 unsigned int card_removed;
743 unsigned int card_exist;
738 744
739 struct delayed_work carddet_work; 745 struct delayed_work carddet_work;
740 struct delayed_work idle_work; 746 struct delayed_work idle_work;
@@ -799,6 +805,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
799 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); 805 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
800int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); 806int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
801int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); 807int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
808int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card);
802int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage); 809int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage);
803unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); 810unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
804void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); 811void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index d83af39815ab..99bf3e665997 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -65,12 +65,6 @@
65 */ 65 */
66#define TMIO_MMC_SDIO_IRQ (1 << 2) 66#define TMIO_MMC_SDIO_IRQ (1 << 2)
67/* 67/*
68 * Some platforms can detect card insertion events with controller powered
69 * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
70 * and cd_flags fields of struct tmio_mmc_data.
71 */
72#define TMIO_MMC_HAS_COLD_CD (1 << 3)
73/*
74 * Some controllers require waiting for the SD bus to become 68 * Some controllers require waiting for the SD bus to become
75 * idle before writing to some registers. 69 * idle before writing to some registers.
76 */ 70 */
@@ -117,18 +111,6 @@ struct tmio_mmc_data {
117}; 111};
118 112
119/* 113/*
120 * This function is deprecated and will be removed soon. Please, convert your
121 * platform to use drivers/mmc/core/cd-gpio.c
122 */
123#include <linux/mmc/host.h>
124static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
125{
126 if (pdata)
127 mmc_detect_change(dev_get_drvdata(pdata->dev),
128 msecs_to_jiffies(100));
129}
130
131/*
132 * data for the NAND controller 114 * data for the NAND controller
133 */ 115 */
134struct tmio_nand_data { 116struct tmio_nand_data {
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 1e9f627967a3..a405d3dc0f61 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -40,11 +40,9 @@ extern void putback_movable_pages(struct list_head *l);
40extern int migrate_page(struct address_space *, 40extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
42extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
43 unsigned long private, bool offlining, 43 unsigned long private, enum migrate_mode mode, int reason);
44 enum migrate_mode mode, int reason);
45extern int migrate_huge_page(struct page *, new_page_t x, 44extern int migrate_huge_page(struct page *, new_page_t x,
46 unsigned long private, bool offlining, 45 unsigned long private, enum migrate_mode mode);
47 enum migrate_mode mode);
48 46
49extern int fail_migrate_page(struct address_space *, 47extern int fail_migrate_page(struct address_space *,
50 struct page *, struct page *); 48 struct page *, struct page *);
@@ -62,11 +60,11 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
62static inline void putback_lru_pages(struct list_head *l) {} 60static inline void putback_lru_pages(struct list_head *l) {}
63static inline void putback_movable_pages(struct list_head *l) {} 61static inline void putback_movable_pages(struct list_head *l) {}
64static inline int migrate_pages(struct list_head *l, new_page_t x, 62static inline int migrate_pages(struct list_head *l, new_page_t x,
65 unsigned long private, bool offlining, 63 unsigned long private, enum migrate_mode mode, int reason)
66 enum migrate_mode mode, int reason) { return -ENOSYS; } 64 { return -ENOSYS; }
67static inline int migrate_huge_page(struct page *page, new_page_t x, 65static inline int migrate_huge_page(struct page *page, new_page_t x,
68 unsigned long private, bool offlining, 66 unsigned long private, enum migrate_mode mode)
69 enum migrate_mode mode) { return -ENOSYS; } 67 { return -ENOSYS; }
70 68
71static inline int migrate_prep(void) { return -ENOSYS; } 69static inline int migrate_prep(void) { return -ENOSYS; }
72static inline int migrate_prep_local(void) { return -ENOSYS; } 70static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6d48fce06b4a..811f91cf5e8c 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -171,6 +171,7 @@ enum {
171#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 171#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
172 172
173enum { 173enum {
174 MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1,
174 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, 175 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6,
175 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, 176 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7,
176 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 177 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
@@ -238,7 +239,8 @@ enum {
238 MLX4_PERM_LOCAL_WRITE = 1 << 11, 239 MLX4_PERM_LOCAL_WRITE = 1 << 11,
239 MLX4_PERM_REMOTE_READ = 1 << 12, 240 MLX4_PERM_REMOTE_READ = 1 << 12,
240 MLX4_PERM_REMOTE_WRITE = 1 << 13, 241 MLX4_PERM_REMOTE_WRITE = 1 << 13,
241 MLX4_PERM_ATOMIC = 1 << 14 242 MLX4_PERM_ATOMIC = 1 << 14,
243 MLX4_PERM_BIND_MW = 1 << 15,
242}; 244};
243 245
244enum { 246enum {
@@ -504,6 +506,18 @@ struct mlx4_mr {
504 int enabled; 506 int enabled;
505}; 507};
506 508
509enum mlx4_mw_type {
510 MLX4_MW_TYPE_1 = 1,
511 MLX4_MW_TYPE_2 = 2,
512};
513
514struct mlx4_mw {
515 u32 key;
516 u32 pd;
517 enum mlx4_mw_type type;
518 int enabled;
519};
520
507struct mlx4_fmr { 521struct mlx4_fmr {
508 struct mlx4_mr mr; 522 struct mlx4_mr mr;
509 struct mlx4_mpt_entry *mpt; 523 struct mlx4_mpt_entry *mpt;
@@ -802,8 +816,12 @@ u64 mlx4_mtt_addr(struct mlx4_dev *dev, struct mlx4_mtt *mtt);
802 816
803int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, 817int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
804 int npages, int page_shift, struct mlx4_mr *mr); 818 int npages, int page_shift, struct mlx4_mr *mr);
805void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr); 819int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr);
806int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr); 820int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr);
821int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type,
822 struct mlx4_mw *mw);
823void mlx4_mw_free(struct mlx4_dev *dev, struct mlx4_mw *mw);
824int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
807int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 825int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
808 int start_index, int npages, u64 *page_list); 826 int start_index, int npages, u64 *page_list);
809int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 827int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 4b4ad6ffef92..67f46ad6920a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -265,6 +265,11 @@ struct mlx4_wqe_lso_seg {
265 __be32 header[0]; 265 __be32 header[0];
266}; 266};
267 267
268enum mlx4_wqe_bind_seg_flags2 {
269 MLX4_WQE_BIND_ZERO_BASED = (1 << 30),
270 MLX4_WQE_BIND_TYPE_2 = (1 << 31),
271};
272
268struct mlx4_wqe_bind_seg { 273struct mlx4_wqe_bind_seg {
269 __be32 flags1; 274 __be32 flags1;
270 __be32 flags2; 275 __be32 flags2;
@@ -277,9 +282,9 @@ struct mlx4_wqe_bind_seg {
277enum { 282enum {
278 MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27, 283 MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
279 MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, 284 MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
280 MLX4_WQE_FMR_PERM_REMOTE_READ = 1 << 29, 285 MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ = 1 << 29,
281 MLX4_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30, 286 MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE = 1 << 30,
282 MLX4_WQE_FMR_PERM_ATOMIC = 1 << 31 287 MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1 << 31
283}; 288};
284 289
285struct mlx4_wqe_fmr_seg { 290struct mlx4_wqe_fmr_seg {
@@ -304,12 +309,10 @@ struct mlx4_wqe_fmr_ext_seg {
304}; 309};
305 310
306struct mlx4_wqe_local_inval_seg { 311struct mlx4_wqe_local_inval_seg {
307 __be32 flags; 312 u64 reserved1;
308 u32 reserved1;
309 __be32 mem_key; 313 __be32 mem_key;
310 u32 reserved2[2]; 314 u32 reserved2;
311 __be32 guest_id; 315 u64 reserved3[2];
312 __be64 pa;
313}; 316};
314 317
315struct mlx4_wqe_raddr_seg { 318struct mlx4_wqe_raddr_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 66e2f7c61e5c..7acc9dc73c9f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -87,6 +87,7 @@ extern unsigned int kobjsize(const void *objp);
87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
89 89
90#define VM_POPULATE 0x00001000
90#define VM_LOCKED 0x00002000 91#define VM_LOCKED 0x00002000
91#define VM_IO 0x00004000 /* Memory mapped I/O or similar */ 92#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
92 93
@@ -114,6 +115,8 @@ extern unsigned int kobjsize(const void *objp);
114# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ 115# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */
115#elif defined(CONFIG_PARISC) 116#elif defined(CONFIG_PARISC)
116# define VM_GROWSUP VM_ARCH_1 117# define VM_GROWSUP VM_ARCH_1
118#elif defined(CONFIG_METAG)
119# define VM_GROWSUP VM_ARCH_1
117#elif defined(CONFIG_IA64) 120#elif defined(CONFIG_IA64)
118# define VM_GROWSUP VM_ARCH_1 121# define VM_GROWSUP VM_ARCH_1
119#elif !defined(CONFIG_MMU) 122#elif !defined(CONFIG_MMU)
@@ -366,7 +369,7 @@ static inline struct page *compound_head(struct page *page)
366 * both from it and to it can be tracked, using atomic_inc_and_test 369 * both from it and to it can be tracked, using atomic_inc_and_test
367 * and atomic_add_negative(-1). 370 * and atomic_add_negative(-1).
368 */ 371 */
369static inline void reset_page_mapcount(struct page *page) 372static inline void page_mapcount_reset(struct page *page)
370{ 373{
371 atomic_set(&(page)->_mapcount, -1); 374 atomic_set(&(page)->_mapcount, -1);
372} 375}
@@ -580,50 +583,11 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
580 * sets it, so none of the operations on it need to be atomic. 583 * sets it, so none of the operations on it need to be atomic.
581 */ 584 */
582 585
583 586/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_NID] | ... | FLAGS | */
584/*
585 * page->flags layout:
586 *
587 * There are three possibilities for how page->flags get
588 * laid out. The first is for the normal case, without
589 * sparsemem. The second is for sparsemem when there is
590 * plenty of space for node and section. The last is when
591 * we have run out of space and have to fall back to an
592 * alternate (slower) way of determining the node.
593 *
594 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
595 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
596 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
597 */
598#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
599#define SECTIONS_WIDTH SECTIONS_SHIFT
600#else
601#define SECTIONS_WIDTH 0
602#endif
603
604#define ZONES_WIDTH ZONES_SHIFT
605
606#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
607#define NODES_WIDTH NODES_SHIFT
608#else
609#ifdef CONFIG_SPARSEMEM_VMEMMAP
610#error "Vmemmap: No space for nodes field in page flags"
611#endif
612#define NODES_WIDTH 0
613#endif
614
615/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
616#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) 587#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
617#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) 588#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
618#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) 589#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
619 590#define LAST_NID_PGOFF (ZONES_PGOFF - LAST_NID_WIDTH)
620/*
621 * We are going to use the flags for the page to node mapping if its in
622 * there. This includes the case where there is no node, so it is implicit.
623 */
624#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
625#define NODE_NOT_IN_PAGE_FLAGS
626#endif
627 591
628/* 592/*
629 * Define the bit shifts to access each section. For non-existent 593 * Define the bit shifts to access each section. For non-existent
@@ -633,6 +597,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
633#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) 597#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
634#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 598#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
635#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 599#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
600#define LAST_NID_PGSHIFT (LAST_NID_PGOFF * (LAST_NID_WIDTH != 0))
636 601
637/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */ 602/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
638#ifdef NODE_NOT_IN_PAGE_FLAGS 603#ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -654,6 +619,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
654#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 619#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
655#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 620#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
656#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 621#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
622#define LAST_NID_MASK ((1UL << LAST_NID_WIDTH) - 1)
657#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 623#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
658 624
659static inline enum zone_type page_zonenum(const struct page *page) 625static inline enum zone_type page_zonenum(const struct page *page)
@@ -661,6 +627,10 @@ static inline enum zone_type page_zonenum(const struct page *page)
661 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 627 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
662} 628}
663 629
630#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
631#define SECTION_IN_PAGE_FLAGS
632#endif
633
664/* 634/*
665 * The identification function is only used by the buddy allocator for 635 * The identification function is only used by the buddy allocator for
666 * determining if two pages could be buddies. We are not really 636 * determining if two pages could be buddies. We are not really
@@ -693,31 +663,48 @@ static inline int page_to_nid(const struct page *page)
693#endif 663#endif
694 664
695#ifdef CONFIG_NUMA_BALANCING 665#ifdef CONFIG_NUMA_BALANCING
696static inline int page_xchg_last_nid(struct page *page, int nid) 666#ifdef LAST_NID_NOT_IN_PAGE_FLAGS
667static inline int page_nid_xchg_last(struct page *page, int nid)
697{ 668{
698 return xchg(&page->_last_nid, nid); 669 return xchg(&page->_last_nid, nid);
699} 670}
700 671
701static inline int page_last_nid(struct page *page) 672static inline int page_nid_last(struct page *page)
702{ 673{
703 return page->_last_nid; 674 return page->_last_nid;
704} 675}
705static inline void reset_page_last_nid(struct page *page) 676static inline void page_nid_reset_last(struct page *page)
706{ 677{
707 page->_last_nid = -1; 678 page->_last_nid = -1;
708} 679}
709#else 680#else
710static inline int page_xchg_last_nid(struct page *page, int nid) 681static inline int page_nid_last(struct page *page)
682{
683 return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK;
684}
685
686extern int page_nid_xchg_last(struct page *page, int nid);
687
688static inline void page_nid_reset_last(struct page *page)
689{
690 int nid = (1 << LAST_NID_SHIFT) - 1;
691
692 page->flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT);
693 page->flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT;
694}
695#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
696#else
697static inline int page_nid_xchg_last(struct page *page, int nid)
711{ 698{
712 return page_to_nid(page); 699 return page_to_nid(page);
713} 700}
714 701
715static inline int page_last_nid(struct page *page) 702static inline int page_nid_last(struct page *page)
716{ 703{
717 return page_to_nid(page); 704 return page_to_nid(page);
718} 705}
719 706
720static inline void reset_page_last_nid(struct page *page) 707static inline void page_nid_reset_last(struct page *page)
721{ 708{
722} 709}
723#endif 710#endif
@@ -727,7 +714,7 @@ static inline struct zone *page_zone(const struct page *page)
727 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 714 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
728} 715}
729 716
730#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 717#ifdef SECTION_IN_PAGE_FLAGS
731static inline void set_page_section(struct page *page, unsigned long section) 718static inline void set_page_section(struct page *page, unsigned long section)
732{ 719{
733 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); 720 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
@@ -757,7 +744,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
757{ 744{
758 set_page_zone(page, zone); 745 set_page_zone(page, zone);
759 set_page_node(page, node); 746 set_page_node(page, node);
760#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 747#ifdef SECTION_IN_PAGE_FLAGS
761 set_page_section(page, pfn_to_section_nr(pfn)); 748 set_page_section(page, pfn_to_section_nr(pfn));
762#endif 749#endif
763} 750}
@@ -817,18 +804,7 @@ void page_address_init(void);
817#define PAGE_MAPPING_KSM 2 804#define PAGE_MAPPING_KSM 2
818#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) 805#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
819 806
820extern struct address_space swapper_space; 807extern struct address_space *page_mapping(struct page *page);
821static inline struct address_space *page_mapping(struct page *page)
822{
823 struct address_space *mapping = page->mapping;
824
825 VM_BUG_ON(PageSlab(page));
826 if (unlikely(PageSwapCache(page)))
827 mapping = &swapper_space;
828 else if ((unsigned long)mapping & PAGE_MAPPING_ANON)
829 mapping = NULL;
830 return mapping;
831}
832 808
833/* Neutral page->mapping pointer to address_space or anon_vma or other */ 809/* Neutral page->mapping pointer to address_space or anon_vma or other */
834static inline void *page_rmapping(struct page *page) 810static inline void *page_rmapping(struct page *page)
@@ -1035,18 +1011,18 @@ static inline int fixup_user_fault(struct task_struct *tsk,
1035} 1011}
1036#endif 1012#endif
1037 1013
1038extern int make_pages_present(unsigned long addr, unsigned long end);
1039extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 1014extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
1040extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, 1015extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
1041 void *buf, int len, int write); 1016 void *buf, int len, int write);
1042 1017
1043int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1018long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1044 unsigned long start, int len, unsigned int foll_flags, 1019 unsigned long start, unsigned long nr_pages,
1045 struct page **pages, struct vm_area_struct **vmas, 1020 unsigned int foll_flags, struct page **pages,
1046 int *nonblocking); 1021 struct vm_area_struct **vmas, int *nonblocking);
1047int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1022long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1048 unsigned long start, int nr_pages, int write, int force, 1023 unsigned long start, unsigned long nr_pages,
1049 struct page **pages, struct vm_area_struct **vmas); 1024 int write, int force, struct page **pages,
1025 struct vm_area_struct **vmas);
1050int get_user_pages_fast(unsigned long start, int nr_pages, int write, 1026int get_user_pages_fast(unsigned long start, int nr_pages, int write,
1051 struct page **pages); 1027 struct page **pages);
1052struct kvec; 1028struct kvec;
@@ -1386,7 +1362,6 @@ extern void __init mmap_init(void);
1386extern void show_mem(unsigned int flags); 1362extern void show_mem(unsigned int flags);
1387extern void si_meminfo(struct sysinfo * val); 1363extern void si_meminfo(struct sysinfo * val);
1388extern void si_meminfo_node(struct sysinfo *val, int nid); 1364extern void si_meminfo_node(struct sysinfo *val, int nid);
1389extern int after_bootmem;
1390 1365
1391extern __printf(3, 4) 1366extern __printf(3, 4)
1392void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...); 1367void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
@@ -1396,6 +1371,9 @@ extern void setup_per_cpu_pageset(void);
1396extern void zone_pcp_update(struct zone *zone); 1371extern void zone_pcp_update(struct zone *zone);
1397extern void zone_pcp_reset(struct zone *zone); 1372extern void zone_pcp_reset(struct zone *zone);
1398 1373
1374/* page_alloc.c */
1375extern int min_free_kbytes;
1376
1399/* nommu.c */ 1377/* nommu.c */
1400extern atomic_long_t mmap_pages_allocated; 1378extern atomic_long_t mmap_pages_allocated;
1401extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); 1379extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
@@ -1473,13 +1451,24 @@ extern int install_special_mapping(struct mm_struct *mm,
1473extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1451extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1474 1452
1475extern unsigned long mmap_region(struct file *file, unsigned long addr, 1453extern unsigned long mmap_region(struct file *file, unsigned long addr,
1476 unsigned long len, unsigned long flags, 1454 unsigned long len, vm_flags_t vm_flags, unsigned long pgoff);
1477 vm_flags_t vm_flags, unsigned long pgoff); 1455extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1478extern unsigned long do_mmap_pgoff(struct file *, unsigned long, 1456 unsigned long len, unsigned long prot, unsigned long flags,
1479 unsigned long, unsigned long, 1457 unsigned long pgoff, unsigned long *populate);
1480 unsigned long, unsigned long);
1481extern int do_munmap(struct mm_struct *, unsigned long, size_t); 1458extern int do_munmap(struct mm_struct *, unsigned long, size_t);
1482 1459
1460#ifdef CONFIG_MMU
1461extern int __mm_populate(unsigned long addr, unsigned long len,
1462 int ignore_errors);
1463static inline void mm_populate(unsigned long addr, unsigned long len)
1464{
1465 /* Ignore errors */
1466 (void) __mm_populate(addr, len, 1);
1467}
1468#else
1469static inline void mm_populate(unsigned long addr, unsigned long len) {}
1470#endif
1471
1483/* These take the mm semaphore themselves */ 1472/* These take the mm semaphore themselves */
1484extern unsigned long vm_brk(unsigned long, unsigned long); 1473extern unsigned long vm_brk(unsigned long, unsigned long);
1485extern int vm_munmap(unsigned long, size_t); 1474extern int vm_munmap(unsigned long, size_t);
@@ -1624,8 +1613,17 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1624int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, 1613int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
1625 unsigned long pfn); 1614 unsigned long pfn);
1626 1615
1627struct page *follow_page(struct vm_area_struct *, unsigned long address, 1616struct page *follow_page_mask(struct vm_area_struct *vma,
1628 unsigned int foll_flags); 1617 unsigned long address, unsigned int foll_flags,
1618 unsigned int *page_mask);
1619
1620static inline struct page *follow_page(struct vm_area_struct *vma,
1621 unsigned long address, unsigned int foll_flags)
1622{
1623 unsigned int unused_page_mask;
1624 return follow_page_mask(vma, address, foll_flags, &unused_page_mask);
1625}
1626
1629#define FOLL_WRITE 0x01 /* check pte is writable */ 1627#define FOLL_WRITE 0x01 /* check pte is writable */
1630#define FOLL_TOUCH 0x02 /* mark page accessed */ 1628#define FOLL_TOUCH 0x02 /* mark page accessed */
1631#define FOLL_GET 0x04 /* do get_page on page */ 1629#define FOLL_GET 0x04 /* do get_page on page */
@@ -1637,6 +1635,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1637#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1635#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1638#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1636#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1639#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 1637#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1638#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
1640 1639
1641typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1640typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1642 void *data); 1641 void *data);
@@ -1708,7 +1707,11 @@ int vmemmap_populate_basepages(struct page *start_page,
1708 unsigned long pages, int node); 1707 unsigned long pages, int node);
1709int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1708int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1710void vmemmap_populate_print_last(void); 1709void vmemmap_populate_print_last(void);
1711 1710#ifdef CONFIG_MEMORY_HOTPLUG
1711void vmemmap_free(struct page *memmap, unsigned long nr_pages);
1712#endif
1713void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
1714 unsigned long size);
1712 1715
1713enum mf_flags { 1716enum mf_flags {
1714 MF_COUNT_INCREASED = 1 << 0, 1717 MF_COUNT_INCREASED = 1 << 0,
@@ -1721,7 +1724,7 @@ extern int unpoison_memory(unsigned long pfn);
1721extern int sysctl_memory_failure_early_kill; 1724extern int sysctl_memory_failure_early_kill;
1722extern int sysctl_memory_failure_recovery; 1725extern int sysctl_memory_failure_recovery;
1723extern void shake_page(struct page *p, int access); 1726extern void shake_page(struct page *p, int access);
1724extern atomic_long_t mce_bad_pages; 1727extern atomic_long_t num_poisoned_pages;
1725extern int soft_offline_page(struct page *page, int flags); 1728extern int soft_offline_page(struct page *page, int flags);
1726 1729
1727extern void dump_page(struct page *page); 1730extern void dump_page(struct page *page);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index f8f5162a3571..ace9a5f01c64 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/page-debug-flags.h> 13#include <linux/page-debug-flags.h>
14#include <linux/uprobes.h> 14#include <linux/uprobes.h>
15#include <linux/page-flags-layout.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/mmu.h> 17#include <asm/mmu.h>
17 18
@@ -173,7 +174,7 @@ struct page {
173 void *shadow; 174 void *shadow;
174#endif 175#endif
175 176
176#ifdef CONFIG_NUMA_BALANCING 177#ifdef LAST_NID_NOT_IN_PAGE_FLAGS
177 int _last_nid; 178 int _last_nid;
178#endif 179#endif
179} 180}
@@ -414,9 +415,9 @@ struct mm_struct {
414#endif 415#endif
415#ifdef CONFIG_NUMA_BALANCING 416#ifdef CONFIG_NUMA_BALANCING
416 /* 417 /*
417 * numa_next_scan is the next time when the PTEs will me marked 418 * numa_next_scan is the next time that the PTEs will be marked
418 * pte_numa to gather statistics and migrate pages to new nodes 419 * pte_numa. NUMA hinting faults will gather statistics and migrate
419 * if necessary 420 * pages to new nodes if necessary.
420 */ 421 */
421 unsigned long numa_next_scan; 422 unsigned long numa_next_scan;
422 423
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9aa863da287f..61c7a87e5d2b 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -79,6 +79,8 @@ calc_vm_flag_bits(unsigned long flags)
79{ 79{
80 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | 80 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
81 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 81 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
82 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 82 ((flags & MAP_LOCKED) ? (VM_LOCKED | VM_POPULATE) : 0) |
83 (((flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE) ?
84 VM_POPULATE : 0);
83} 85}
84#endif /* _LINUX_MMAN_H */ 86#endif /* _LINUX_MMAN_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 5c69315d60cc..61b2c30c903b 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -53,6 +53,9 @@ struct mmc_ext_csd {
53 u8 part_config; 53 u8 part_config;
54 u8 cache_ctrl; 54 u8 cache_ctrl;
55 u8 rst_n_function; 55 u8 rst_n_function;
56 u8 max_packed_writes;
57 u8 max_packed_reads;
58 u8 packed_event_en;
56 unsigned int part_time; /* Units: ms */ 59 unsigned int part_time; /* Units: ms */
57 unsigned int sa_timeout; /* Units: 100ns */ 60 unsigned int sa_timeout; /* Units: 100ns */
58 unsigned int generic_cmd6_time; /* Units: 10ms */ 61 unsigned int generic_cmd6_time; /* Units: 10ms */
@@ -83,7 +86,7 @@ struct mmc_ext_csd {
83 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */ 86 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */
84 unsigned int boot_ro_lock; /* ro lock support */ 87 unsigned int boot_ro_lock; /* ro lock support */
85 bool boot_ro_lockable; 88 bool boot_ro_lockable;
86 u8 raw_exception_status; /* 53 */ 89 u8 raw_exception_status; /* 54 */
87 u8 raw_partition_support; /* 160 */ 90 u8 raw_partition_support; /* 160 */
88 u8 raw_rpmb_size_mult; /* 168 */ 91 u8 raw_rpmb_size_mult; /* 168 */
89 u8 raw_erased_mem_count; /* 181 */ 92 u8 raw_erased_mem_count; /* 181 */
@@ -187,6 +190,18 @@ struct sdio_func_tuple;
187 190
188#define SDIO_MAX_FUNCS 7 191#define SDIO_MAX_FUNCS 7
189 192
193enum mmc_blk_status {
194 MMC_BLK_SUCCESS = 0,
195 MMC_BLK_PARTIAL,
196 MMC_BLK_CMD_ERR,
197 MMC_BLK_RETRY,
198 MMC_BLK_ABORT,
199 MMC_BLK_DATA_ERR,
200 MMC_BLK_ECC_ERR,
201 MMC_BLK_NOMEDIUM,
202 MMC_BLK_NEW_REQUEST,
203};
204
190/* The number of MMC physical partitions. These consist of: 205/* The number of MMC physical partitions. These consist of:
191 * boot partitions (2), general purpose partitions (4) in MMC v4.4. 206 * boot partitions (2), general purpose partitions (4) in MMC v4.4.
192 */ 207 */
@@ -295,6 +310,11 @@ static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
295 card->nr_parts++; 310 card->nr_parts++;
296} 311}
297 312
313static inline bool mmc_large_sector(struct mmc_card *card)
314{
315 return card->ext_csd.data_sector_size == 4096;
316}
317
298/* 318/*
299 * The world is not perfect and supplies us with broken mmc/sdio devices. 319 * The world is not perfect and supplies us with broken mmc/sdio devices.
300 * For at least some of these bugs we need a work-around. 320 * For at least some of these bugs we need a work-around.
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 5bf7c2274fcb..39613b9a6fc5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -18,6 +18,9 @@ struct mmc_request;
18struct mmc_command { 18struct mmc_command {
19 u32 opcode; 19 u32 opcode;
20 u32 arg; 20 u32 arg;
21#define MMC_CMD23_ARG_REL_WR (1 << 31)
22#define MMC_CMD23_ARG_PACKED ((0 << 31) | (1 << 30))
23#define MMC_CMD23_ARG_TAG_REQ (1 << 29)
21 u32 resp[4]; 24 u32 resp[4];
22 unsigned int flags; /* expected response type */ 25 unsigned int flags; /* expected response type */
23#define MMC_RSP_PRESENT (1 << 0) 26#define MMC_RSP_PRESENT (1 << 0)
@@ -120,6 +123,7 @@ struct mmc_data {
120 s32 host_cookie; /* host private data */ 123 s32 host_cookie; /* host private data */
121}; 124};
122 125
126struct mmc_host;
123struct mmc_request { 127struct mmc_request {
124 struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */ 128 struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */
125 struct mmc_command *cmd; 129 struct mmc_command *cmd;
@@ -128,9 +132,9 @@ struct mmc_request {
128 132
129 struct completion completion; 133 struct completion completion;
130 void (*done)(struct mmc_request *);/* completion function */ 134 void (*done)(struct mmc_request *);/* completion function */
135 struct mmc_host *host;
131}; 136};
132 137
133struct mmc_host;
134struct mmc_card; 138struct mmc_card;
135struct mmc_async_req; 139struct mmc_async_req;
136 140
@@ -147,6 +151,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
147extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 151extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
148extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool); 152extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool);
149extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 153extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
154extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
150 155
151#define MMC_ERASE_ARG 0x00000000 156#define MMC_ERASE_ARG 0x00000000
152#define MMC_SECURE_ERASE_ARG 0x80000000 157#define MMC_SECURE_ERASE_ARG 0x80000000
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 34be4f47293c..198f0fa44e9f 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -209,8 +209,10 @@ struct dw_mci_dma_ops {
209#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 209#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
210/* Unreliable card detection */ 210/* Unreliable card detection */
211#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 211#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
212/* Write Protect detection not available */ 212
213#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4) 213/* Slot level quirks */
214/* This slot has no write protect */
215#define DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT BIT(0)
214 216
215struct dma_pdata; 217struct dma_pdata;
216 218
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 61a10c17aabd..d6f20cc6415e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -131,9 +131,11 @@ struct mmc_host_ops {
131 131
132 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 132 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
133 133
134 /* Check if the card is pulling dat[0:3] low */
135 int (*card_busy)(struct mmc_host *host);
136
134 /* The tuning command opcode value is different for SD and eMMC cards */ 137 /* The tuning command opcode value is different for SD and eMMC cards */
135 int (*execute_tuning)(struct mmc_host *host, u32 opcode); 138 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
136 void (*enable_preset_value)(struct mmc_host *host, bool enable);
137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
138 void (*hw_reset)(struct mmc_host *host); 140 void (*hw_reset)(struct mmc_host *host);
139 void (*card_event)(struct mmc_host *host); 141 void (*card_event)(struct mmc_host *host);
@@ -170,6 +172,22 @@ struct mmc_slot {
170 void *handler_priv; 172 void *handler_priv;
171}; 173};
172 174
175/**
176 * mmc_context_info - synchronization details for mmc context
177 * @is_done_rcv wake up reason was done request
178 * @is_new_req wake up reason was new request
179 * @is_waiting_last_req mmc context waiting for single running request
180 * @wait wait queue
181 * @lock lock to protect data fields
182 */
183struct mmc_context_info {
184 bool is_done_rcv;
185 bool is_new_req;
186 bool is_waiting_last_req;
187 wait_queue_head_t wait;
188 spinlock_t lock;
189};
190
173struct regulator; 191struct regulator;
174 192
175struct mmc_supply { 193struct mmc_supply {
@@ -258,6 +276,10 @@ struct mmc_host {
258#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
259#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
260#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
279#define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */
280#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR)
261 283
262 mmc_pm_flag_t pm_caps; /* supported pm features */ 284 mmc_pm_flag_t pm_caps; /* supported pm features */
263 285
@@ -331,6 +353,7 @@ struct mmc_host {
331 struct dentry *debugfs_root; 353 struct dentry *debugfs_root;
332 354
333 struct mmc_async_req *areq; /* active async req */ 355 struct mmc_async_req *areq; /* active async req */
356 struct mmc_context_info context_info; /* async synchronization info */
334 357
335#ifdef CONFIG_FAIL_MMC_REQUEST 358#ifdef CONFIG_FAIL_MMC_REQUEST
336 struct fault_attr fail_mmc_request; 359 struct fault_attr fail_mmc_request;
@@ -341,10 +364,11 @@ struct mmc_host {
341 unsigned long private[0] ____cacheline_aligned; 364 unsigned long private[0] ____cacheline_aligned;
342}; 365};
343 366
344extern struct mmc_host *mmc_alloc_host(int extra, struct device *); 367struct mmc_host *mmc_alloc_host(int extra, struct device *);
345extern int mmc_add_host(struct mmc_host *); 368int mmc_add_host(struct mmc_host *);
346extern void mmc_remove_host(struct mmc_host *); 369void mmc_remove_host(struct mmc_host *);
347extern void mmc_free_host(struct mmc_host *); 370void mmc_free_host(struct mmc_host *);
371void mmc_of_parse(struct mmc_host *host);
348 372
349static inline void *mmc_priv(struct mmc_host *host) 373static inline void *mmc_priv(struct mmc_host *host)
350{ 374{
@@ -357,16 +381,16 @@ static inline void *mmc_priv(struct mmc_host *host)
357#define mmc_classdev(x) (&(x)->class_dev) 381#define mmc_classdev(x) (&(x)->class_dev)
358#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 382#define mmc_hostname(x) (dev_name(&(x)->class_dev))
359 383
360extern int mmc_suspend_host(struct mmc_host *); 384int mmc_suspend_host(struct mmc_host *);
361extern int mmc_resume_host(struct mmc_host *); 385int mmc_resume_host(struct mmc_host *);
362 386
363extern int mmc_power_save_host(struct mmc_host *host); 387int mmc_power_save_host(struct mmc_host *host);
364extern int mmc_power_restore_host(struct mmc_host *host); 388int mmc_power_restore_host(struct mmc_host *host);
365 389
366extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 390void mmc_detect_change(struct mmc_host *, unsigned long delay);
367extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 391void mmc_request_done(struct mmc_host *, struct mmc_request *);
368 392
369extern int mmc_cache_ctrl(struct mmc_host *, u8); 393int mmc_cache_ctrl(struct mmc_host *, u8);
370 394
371static inline void mmc_signal_sdio_irq(struct mmc_host *host) 395static inline void mmc_signal_sdio_irq(struct mmc_host *host)
372{ 396{
@@ -434,6 +458,19 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
434 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 458 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
435} 459}
436 460
461static inline int mmc_host_uhs(struct mmc_host *host)
462{
463 return host->caps &
464 (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
465 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
466 MMC_CAP_UHS_DDR50);
467}
468
469static inline int mmc_host_packed_wr(struct mmc_host *host)
470{
471 return host->caps2 & MMC_CAP2_PACKED_WR;
472}
473
437#ifdef CONFIG_MMC_CLKGATE 474#ifdef CONFIG_MMC_CLKGATE
438void mmc_host_clk_hold(struct mmc_host *host); 475void mmc_host_clk_hold(struct mmc_host *host);
439void mmc_host_clk_release(struct mmc_host *host); 476void mmc_host_clk_release(struct mmc_host *host);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 94d532e41c61..50bcde3677ca 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -139,7 +139,7 @@ static inline bool mmc_op_multi(u32 opcode)
139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
142#define R1_EXCEPTION_EVENT (1 << 6) /* sx, a */ 142#define R1_EXCEPTION_EVENT (1 << 6) /* sr, a */
143#define R1_APP_CMD (1 << 5) /* sr, c */ 143#define R1_APP_CMD (1 << 5) /* sr, c */
144 144
145#define R1_STATE_IDLE 0 145#define R1_STATE_IDLE 0
@@ -275,7 +275,10 @@ struct _mmc_csd {
275#define EXT_CSD_FLUSH_CACHE 32 /* W */ 275#define EXT_CSD_FLUSH_CACHE 32 /* W */
276#define EXT_CSD_CACHE_CTRL 33 /* R/W */ 276#define EXT_CSD_CACHE_CTRL 33 /* R/W */
277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ 277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
278#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO */ 278#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */
279#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */
280#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
279#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 282#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
280#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 283#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
281#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 284#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
@@ -324,6 +327,8 @@ struct _mmc_csd {
324#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
325#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 328#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
326#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 329#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
330#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
331#define EXT_CSD_MAX_PACKED_READS 501 /* RO */
327#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */ 332#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
328#define EXT_CSD_HPI_FEATURES 503 /* RO */ 333#define EXT_CSD_HPI_FEATURES 503 /* RO */
329 334
@@ -385,6 +390,9 @@ struct _mmc_csd {
385#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */ 390#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */
386#define EXT_CSD_PWR_CL_8BIT_SHIFT 4 391#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
387#define EXT_CSD_PWR_CL_4BIT_SHIFT 0 392#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
393
394#define EXT_CSD_PACKED_EVENT_EN BIT(3)
395
388/* 396/*
389 * EXCEPTION_EVENT_STATUS field 397 * EXCEPTION_EVENT_STATUS field
390 */ 398 */
@@ -393,6 +401,9 @@ struct _mmc_csd {
393#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2) 401#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2)
394#define EXT_CSD_PACKED_FAILURE BIT(3) 402#define EXT_CSD_PACKED_FAILURE BIT(3)
395 403
404#define EXT_CSD_PACKED_GENERIC_ERROR BIT(0)
405#define EXT_CSD_PACKED_INDEXED_ERROR BIT(1)
406
396/* 407/*
397 * BKOPS status level 408 * BKOPS status level
398 */ 409 */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 4bbc3301fbbf..b838ffc49e4a 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -94,6 +94,7 @@ struct sdhci_host {
94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1) 94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
97 98
98 int irq; /* Device IRQ */ 99 int irq; /* Device IRQ */
99 void __iomem *ioaddr; /* Mapped address */ 100 void __iomem *ioaddr; /* Mapped address */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index b65679ffa880..b76bcf0621f6 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -4,7 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct platform_device; 6struct platform_device;
7struct tmio_mmc_data;
8 7
9#define SH_MOBILE_SDHI_IRQ_CARD_DETECT "card_detect" 8#define SH_MOBILE_SDHI_IRQ_CARD_DETECT "card_detect"
10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 9#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
@@ -26,7 +25,6 @@ struct sh_mobile_sdhi_info {
26 unsigned long tmio_caps2; 25 unsigned long tmio_caps2;
27 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
28 unsigned int cd_gpio; 27 unsigned int cd_gpio;
29 struct tmio_mmc_data *pdata;
30 void (*set_pwr)(struct platform_device *pdev, int state); 28 void (*set_pwr)(struct platform_device *pdev, int state);
31 int (*get_cd)(struct platform_device *pdev); 29 int (*get_cd)(struct platform_device *pdev);
32 30
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 73b64a38b984..ede274957e05 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -15,7 +15,7 @@
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 17#include <linux/pageblock-flags.h>
18#include <generated/bounds.h> 18#include <linux/page-flags-layout.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <asm/page.h> 20#include <asm/page.h>
21 21
@@ -57,7 +57,9 @@ enum {
57 */ 57 */
58 MIGRATE_CMA, 58 MIGRATE_CMA,
59#endif 59#endif
60#ifdef CONFIG_MEMORY_ISOLATION
60 MIGRATE_ISOLATE, /* can't allocate from here */ 61 MIGRATE_ISOLATE, /* can't allocate from here */
62#endif
61 MIGRATE_TYPES 63 MIGRATE_TYPES
62}; 64};
63 65
@@ -308,24 +310,6 @@ enum zone_type {
308 310
309#ifndef __GENERATING_BOUNDS_H 311#ifndef __GENERATING_BOUNDS_H
310 312
311/*
312 * When a memory allocation must conform to specific limitations (such
313 * as being suitable for DMA) the caller will pass in hints to the
314 * allocator in the gfp_mask, in the zone modifier bits. These bits
315 * are used to select a priority ordered list of memory zones which
316 * match the requested limits. See gfp_zone() in include/linux/gfp.h
317 */
318
319#if MAX_NR_ZONES < 2
320#define ZONES_SHIFT 0
321#elif MAX_NR_ZONES <= 2
322#define ZONES_SHIFT 1
323#elif MAX_NR_ZONES <= 4
324#define ZONES_SHIFT 2
325#else
326#error ZONES_SHIFT -- too many zones configured adjust calculation
327#endif
328
329struct zone { 313struct zone {
330 /* Fields commonly accessed by the page allocator */ 314 /* Fields commonly accessed by the page allocator */
331 315
@@ -543,6 +527,26 @@ static inline int zone_is_oom_locked(const struct zone *zone)
543 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 527 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
544} 528}
545 529
530static inline unsigned zone_end_pfn(const struct zone *zone)
531{
532 return zone->zone_start_pfn + zone->spanned_pages;
533}
534
535static inline bool zone_spans_pfn(const struct zone *zone, unsigned long pfn)
536{
537 return zone->zone_start_pfn <= pfn && pfn < zone_end_pfn(zone);
538}
539
540static inline bool zone_is_initialized(struct zone *zone)
541{
542 return !!zone->wait_table;
543}
544
545static inline bool zone_is_empty(struct zone *zone)
546{
547 return zone->spanned_pages == 0;
548}
549
546/* 550/*
547 * The "priority" of VM scanning is how much of the queues we will scan in one 551 * The "priority" of VM scanning is how much of the queues we will scan in one
548 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 552 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -752,11 +756,17 @@ typedef struct pglist_data {
752#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) 756#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr))
753 757
754#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 758#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
759#define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid))
755 760
756#define node_end_pfn(nid) ({\ 761static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat)
757 pg_data_t *__pgdat = NODE_DATA(nid);\ 762{
758 __pgdat->node_start_pfn + __pgdat->node_spanned_pages;\ 763 return pgdat->node_start_pfn + pgdat->node_spanned_pages;
759}) 764}
765
766static inline bool pgdat_is_empty(pg_data_t *pgdat)
767{
768 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
769}
760 770
761#include <linux/memory_hotplug.h> 771#include <linux/memory_hotplug.h>
762 772
@@ -1053,8 +1063,6 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
1053 * PA_SECTION_SHIFT physical address to/from section number 1063 * PA_SECTION_SHIFT physical address to/from section number
1054 * PFN_SECTION_SHIFT pfn to/from section number 1064 * PFN_SECTION_SHIFT pfn to/from section number
1055 */ 1065 */
1056#define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
1057
1058#define PA_SECTION_SHIFT (SECTION_SIZE_BITS) 1066#define PA_SECTION_SHIFT (SECTION_SIZE_BITS)
1059#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT) 1067#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT)
1060 1068
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index fed3def62818..779cf7c4a3d1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -33,8 +33,7 @@ struct ieee1394_device_id {
33 __u32 model_id; 33 __u32 model_id;
34 __u32 specifier_id; 34 __u32 specifier_id;
35 __u32 version; 35 __u32 version;
36 kernel_ulong_t driver_data 36 kernel_ulong_t driver_data;
37 __attribute__((aligned(sizeof(kernel_ulong_t))));
38}; 37};
39 38
40 39
@@ -148,8 +147,7 @@ struct hid_device_id {
148 __u16 group; 147 __u16 group;
149 __u32 vendor; 148 __u32 vendor;
150 __u32 product; 149 __u32 product;
151 kernel_ulong_t driver_data 150 kernel_ulong_t driver_data;
152 __attribute__((aligned(sizeof(kernel_ulong_t))));
153}; 151};
154 152
155/* s390 CCW devices */ 153/* s390 CCW devices */
@@ -173,8 +171,6 @@ struct ccw_device_id {
173struct ap_device_id { 171struct ap_device_id {
174 __u16 match_flags; /* which fields to match against */ 172 __u16 match_flags; /* which fields to match against */
175 __u8 dev_type; /* device type */ 173 __u8 dev_type; /* device type */
176 __u8 pad1;
177 __u32 pad2;
178 kernel_ulong_t driver_info; 174 kernel_ulong_t driver_info;
179}; 175};
180 176
@@ -184,13 +180,10 @@ struct ap_device_id {
184struct css_device_id { 180struct css_device_id {
185 __u8 match_flags; 181 __u8 match_flags;
186 __u8 type; /* subchannel type */ 182 __u8 type; /* subchannel type */
187 __u16 pad2;
188 __u32 pad3;
189 kernel_ulong_t driver_data; 183 kernel_ulong_t driver_data;
190}; 184};
191 185
192#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ 186#define ACPI_ID_LEN 9
193 /* to workaround crosscompile issues */
194 187
195struct acpi_device_id { 188struct acpi_device_id {
196 __u8 id[ACPI_ID_LEN]; 189 __u8 id[ACPI_ID_LEN];
@@ -231,11 +224,7 @@ struct of_device_id
231 char name[32]; 224 char name[32];
232 char type[32]; 225 char type[32];
233 char compatible[128]; 226 char compatible[128];
234#ifdef __KERNEL__
235 const void *data; 227 const void *data;
236#else
237 kernel_ulong_t data;
238#endif
239}; 228};
240 229
241/* VIO */ 230/* VIO */
@@ -260,24 +249,14 @@ struct pcmcia_device_id {
260 /* for pseudo multi-function devices */ 249 /* for pseudo multi-function devices */
261 __u8 device_no; 250 __u8 device_no;
262 251
263 __u32 prod_id_hash[4] 252 __u32 prod_id_hash[4];
264 __attribute__((aligned(sizeof(__u32))));
265 253
266 /* not matched against in kernelspace*/ 254 /* not matched against in kernelspace*/
267#ifdef __KERNEL__
268 const char * prod_id[4]; 255 const char * prod_id[4];
269#else
270 kernel_ulong_t prod_id[4]
271 __attribute__((aligned(sizeof(kernel_ulong_t))));
272#endif
273 256
274 /* not matched against */ 257 /* not matched against */
275 kernel_ulong_t driver_info; 258 kernel_ulong_t driver_info;
276#ifdef __KERNEL__
277 char * cisfile; 259 char * cisfile;
278#else
279 kernel_ulong_t cisfile;
280#endif
281}; 260};
282 261
283#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 262#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
@@ -373,8 +352,7 @@ struct sdio_device_id {
373 __u8 class; /* Standard interface or SDIO_ANY_ID */ 352 __u8 class; /* Standard interface or SDIO_ANY_ID */
374 __u16 vendor; /* Vendor or SDIO_ANY_ID */ 353 __u16 vendor; /* Vendor or SDIO_ANY_ID */
375 __u16 device; /* Device ID or SDIO_ANY_ID */ 354 __u16 device; /* Device ID or SDIO_ANY_ID */
376 kernel_ulong_t driver_data /* Data private to the driver */ 355 kernel_ulong_t driver_data; /* Data private to the driver */
377 __attribute__((aligned(sizeof(kernel_ulong_t))));
378}; 356};
379 357
380/* SSB core, see drivers/ssb/ */ 358/* SSB core, see drivers/ssb/ */
@@ -420,8 +398,7 @@ struct virtio_device_id {
420 */ 398 */
421struct hv_vmbus_device_id { 399struct hv_vmbus_device_id {
422 __u8 guid[16]; 400 __u8 guid[16];
423 kernel_ulong_t driver_data /* Data private to the driver */ 401 kernel_ulong_t driver_data; /* Data private to the driver */
424 __attribute__((aligned(sizeof(kernel_ulong_t))));
425}; 402};
426 403
427/* rpmsg */ 404/* rpmsg */
@@ -440,8 +417,7 @@ struct rpmsg_device_id {
440 417
441struct i2c_device_id { 418struct i2c_device_id {
442 char name[I2C_NAME_SIZE]; 419 char name[I2C_NAME_SIZE];
443 kernel_ulong_t driver_data /* Data private to the driver */ 420 kernel_ulong_t driver_data; /* Data private to the driver */
444 __attribute__((aligned(sizeof(kernel_ulong_t))));
445}; 421};
446 422
447/* spi */ 423/* spi */
@@ -451,8 +427,7 @@ struct i2c_device_id {
451 427
452struct spi_device_id { 428struct spi_device_id {
453 char name[SPI_NAME_SIZE]; 429 char name[SPI_NAME_SIZE];
454 kernel_ulong_t driver_data /* Data private to the driver */ 430 kernel_ulong_t driver_data; /* Data private to the driver */
455 __attribute__((aligned(sizeof(kernel_ulong_t))));
456}; 431};
457 432
458/* dmi */ 433/* dmi */
@@ -484,15 +459,6 @@ struct dmi_strmatch {
484 char substr[79]; 459 char substr[79];
485}; 460};
486 461
487#ifndef __KERNEL__
488struct dmi_system_id {
489 kernel_ulong_t callback;
490 kernel_ulong_t ident;
491 struct dmi_strmatch matches[4];
492 kernel_ulong_t driver_data
493 __attribute__((aligned(sizeof(kernel_ulong_t))));
494};
495#else
496struct dmi_system_id { 462struct dmi_system_id {
497 int (*callback)(const struct dmi_system_id *); 463 int (*callback)(const struct dmi_system_id *);
498 const char *ident; 464 const char *ident;
@@ -506,7 +472,6 @@ struct dmi_system_id {
506 * error: storage size of '__mod_dmi_device_table' isn't known 472 * error: storage size of '__mod_dmi_device_table' isn't known
507 */ 473 */
508#define dmi_device_id dmi_system_id 474#define dmi_device_id dmi_system_id
509#endif
510 475
511#define DMI_MATCH(a, b) { a, b } 476#define DMI_MATCH(a, b) { a, b }
512 477
@@ -515,8 +480,7 @@ struct dmi_system_id {
515 480
516struct platform_device_id { 481struct platform_device_id {
517 char name[PLATFORM_NAME_SIZE]; 482 char name[PLATFORM_NAME_SIZE];
518 kernel_ulong_t driver_data 483 kernel_ulong_t driver_data;
519 __attribute__((aligned(sizeof(kernel_ulong_t))));
520}; 484};
521 485
522#define MDIO_MODULE_PREFIX "mdio:" 486#define MDIO_MODULE_PREFIX "mdio:"
@@ -572,11 +536,7 @@ struct isapnp_device_id {
572struct amba_id { 536struct amba_id {
573 unsigned int id; 537 unsigned int id;
574 unsigned int mask; 538 unsigned int mask;
575#ifndef __KERNEL__
576 kernel_ulong_t data;
577#else
578 void *data; 539 void *data;
579#endif
580}; 540};
581 541
582/* 542/*
diff --git a/include/linux/module.h b/include/linux/module.h
index 1375ee3f03aa..ead1b5719a12 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -396,13 +396,13 @@ bool is_module_address(unsigned long addr);
396bool is_module_percpu_address(unsigned long addr); 396bool is_module_percpu_address(unsigned long addr);
397bool is_module_text_address(unsigned long addr); 397bool is_module_text_address(unsigned long addr);
398 398
399static inline int within_module_core(unsigned long addr, struct module *mod) 399static inline int within_module_core(unsigned long addr, const struct module *mod)
400{ 400{
401 return (unsigned long)mod->module_core <= addr && 401 return (unsigned long)mod->module_core <= addr &&
402 addr < (unsigned long)mod->module_core + mod->core_size; 402 addr < (unsigned long)mod->module_core + mod->core_size;
403} 403}
404 404
405static inline int within_module_init(unsigned long addr, struct module *mod) 405static inline int within_module_init(unsigned long addr, const struct module *mod)
406{ 406{
407 return (unsigned long)mod->module_init <= addr && 407 return (unsigned long)mod->module_init <= addr &&
408 addr < (unsigned long)mod->module_init + mod->init_size; 408 addr < (unsigned long)mod->module_init + mod->init_size;
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index f6eb4332ac92..4b02512e421c 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -245,6 +245,7 @@ struct map_info {
245 unsigned long pfow_base; 245 unsigned long pfow_base;
246 unsigned long map_priv_1; 246 unsigned long map_priv_1;
247 unsigned long map_priv_2; 247 unsigned long map_priv_2;
248 struct device_node *device_node;
248 void *fldrv_priv; 249 void *fldrv_priv;
249 struct mtd_chip_driver *fldrv; 250 struct mtd_chip_driver *fldrv;
250}; 251};
@@ -328,7 +329,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word
328 329
329static inline map_word map_word_load(struct map_info *map, const void *ptr) 330static inline map_word map_word_load(struct map_info *map, const void *ptr)
330{ 331{
331 map_word r = {{0} }; 332 map_word r;
332 333
333 if (map_bankwidth_is_1(map)) 334 if (map_bankwidth_is_1(map))
334 r.x[0] = *(unsigned char *)ptr; 335 r.x[0] = *(unsigned char *)ptr;
@@ -342,6 +343,8 @@ static inline map_word map_word_load(struct map_info *map, const void *ptr)
342#endif 343#endif
343 else if (map_bankwidth_is_large(map)) 344 else if (map_bankwidth_is_large(map))
344 memcpy(r.x, ptr, map->bankwidth); 345 memcpy(r.x, ptr, map->bankwidth);
346 else
347 BUG();
345 348
346 return r; 349 return r;
347} 350}
@@ -391,7 +394,7 @@ static inline map_word map_word_ff(struct map_info *map)
391 394
392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 395static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
393{ 396{
394 map_word uninitialized_var(r); 397 map_word r;
395 398
396 if (map_bankwidth_is_1(map)) 399 if (map_bankwidth_is_1(map))
397 r.x[0] = __raw_readb(map->virt + ofs); 400 r.x[0] = __raw_readb(map->virt + ofs);
@@ -425,6 +428,8 @@ static inline void inline_map_write(struct map_info *map, const map_word datum,
425#endif 428#endif
426 else if (map_bankwidth_is_large(map)) 429 else if (map_bankwidth_is_large(map))
427 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth); 430 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
431 else
432 BUG();
428 mb(); 433 mb();
429} 434}
430 435
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index ef9acd3c8450..01d25e6fc792 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -854,6 +854,8 @@ type_pf_tresize(struct ip_set *set, bool retried)
854retry: 854retry:
855 ret = 0; 855 ret = 0;
856 htable_bits++; 856 htable_bits++;
857 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
858 set->name, orig->htable_bits, htable_bits, orig);
857 if (!htable_bits) { 859 if (!htable_bits) {
858 /* In case we have plenty of memory :-) */ 860 /* In case we have plenty of memory :-) */
859 pr_warning("Cannot increase the hashsize of set %s further\n", 861 pr_warning("Cannot increase the hashsize of set %s further\n",
@@ -873,7 +875,7 @@ retry:
873 data = ahash_tdata(n, j); 875 data = ahash_tdata(n, j);
874 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 876 m = hbucket(t, HKEY(data, h->initval, htable_bits));
875 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, 877 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0,
876 type_pf_data_timeout(data)); 878 ip_set_timeout_get(type_pf_data_timeout(data)));
877 if (ret < 0) { 879 if (ret < 0) {
878 read_unlock_bh(&set->lock); 880 read_unlock_bh(&set->lock);
879 ahash_destroy(t); 881 ahash_destroy(t);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e111fa419a4e..7b8fc73810ad 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -13,6 +13,7 @@
13#define _LINUX_NFS4_H 13#define _LINUX_NFS4_H
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/uidgid.h>
16#include <uapi/linux/nfs4.h> 17#include <uapi/linux/nfs4.h>
17 18
18struct nfs4_ace { 19struct nfs4_ace {
@@ -20,7 +21,10 @@ struct nfs4_ace {
20 uint32_t flag; 21 uint32_t flag;
21 uint32_t access_mask; 22 uint32_t access_mask;
22 int whotype; 23 int whotype;
23 uid_t who; 24 union {
25 kuid_t who_uid;
26 kgid_t who_gid;
27 };
24}; 28};
25 29
26struct nfs4_acl { 30struct nfs4_acl {
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 2dcef3ab58b6..0f4b79da6584 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -36,6 +36,7 @@
36#ifndef NFS_IDMAP_H 36#ifndef NFS_IDMAP_H
37#define NFS_IDMAP_H 37#define NFS_IDMAP_H
38 38
39#include <linux/uidgid.h>
39#include <uapi/linux/nfs_idmap.h> 40#include <uapi/linux/nfs_idmap.h>
40 41
41 42
@@ -67,10 +68,10 @@ void nfs_fattr_init_names(struct nfs_fattr *fattr,
67void nfs_fattr_free_names(struct nfs_fattr *); 68void nfs_fattr_free_names(struct nfs_fattr *);
68void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *); 69void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
69 70
70int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); 71int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, kuid_t *);
71int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); 72int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, kgid_t *);
72int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); 73int nfs_map_uid_to_name(const struct nfs_server *, kuid_t, char *, size_t);
73int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t); 74int nfs_map_gid_to_group(const struct nfs_server *, kgid_t, char *, size_t);
74 75
75extern unsigned int nfs_idmap_cache_timeout; 76extern unsigned int nfs_idmap_cache_timeout;
76#endif /* NFS_IDMAP_H */ 77#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 29adb12c7ecf..4b993d358dad 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -48,8 +48,8 @@ struct nfs_fattr {
48 unsigned int valid; /* which fields are valid */ 48 unsigned int valid; /* which fields are valid */
49 umode_t mode; 49 umode_t mode;
50 __u32 nlink; 50 __u32 nlink;
51 __u32 uid; 51 kuid_t uid;
52 __u32 gid; 52 kgid_t gid;
53 dev_t rdev; 53 dev_t rdev;
54 __u64 size; 54 __u64 size;
55 union { 55 union {
@@ -233,6 +233,7 @@ struct nfs4_layoutget_args {
233 struct inode *inode; 233 struct inode *inode;
234 struct nfs_open_context *ctx; 234 struct nfs_open_context *ctx;
235 nfs4_stateid stateid; 235 nfs4_stateid stateid;
236 unsigned long timestamp;
236 struct nfs4_layoutdriver_data layout; 237 struct nfs4_layoutdriver_data layout;
237}; 238};
238 239
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 24c139288db4..7898c997dfea 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -49,8 +49,8 @@ struct svc_export {
49 struct auth_domain * ex_client; 49 struct auth_domain * ex_client;
50 int ex_flags; 50 int ex_flags;
51 struct path ex_path; 51 struct path ex_path;
52 uid_t ex_anon_uid; 52 kuid_t ex_anon_uid;
53 gid_t ex_anon_gid; 53 kgid_t ex_anon_gid;
54 int ex_fsid; 54 int ex_fsid;
55 unsigned char * ex_uuid; /* 16 byte fsid */ 55 unsigned char * ex_uuid; /* 16 byte fsid */
56 struct nfsd4_fs_locations ex_fslocs; 56 struct nfsd4_fs_locations ex_fslocs;
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
new file mode 100644
index 000000000000..d15073e080dd
--- /dev/null
+++ b/include/linux/of_dma.h
@@ -0,0 +1,74 @@
1/*
2 * OF helpers for DMA request / controller
3 *
4 * Based on of_gpio.h
5 *
6 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __LINUX_OF_DMA_H
14#define __LINUX_OF_DMA_H
15
16#include <linux/of.h>
17#include <linux/dmaengine.h>
18
19struct device_node;
20
21struct of_dma {
22 struct list_head of_dma_controllers;
23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data;
28 int use_count;
29};
30
31struct of_dma_filter_info {
32 dma_cap_mask_t dma_cap;
33 dma_filter_fn filter_fn;
34};
35
36#ifdef CONFIG_OF
37extern int of_dma_controller_register(struct device_node *np,
38 struct dma_chan *(*of_dma_xlate)
39 (struct of_phandle_args *, struct of_dma *),
40 void *data);
41extern int of_dma_controller_free(struct device_node *np);
42extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
43 char *name);
44extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma);
46#else
47static inline int of_dma_controller_register(struct device_node *np,
48 struct dma_chan *(*of_dma_xlate)
49 (struct of_phandle_args *, struct of_dma *),
50 void *data)
51{
52 return -ENODEV;
53}
54
55static inline int of_dma_controller_free(struct device_node *np)
56{
57 return -ENODEV;
58}
59
60static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
61 char *name)
62{
63 return NULL;
64}
65
66static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
67 struct of_dma *ofdma)
68{
69 return NULL;
70}
71
72#endif
73
74#endif /* __LINUX_OF_DMA_H */
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 214e0ebcb84d..3aca2b8def33 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -47,15 +47,6 @@ int opp_enable(struct device *dev, unsigned long freq);
47int opp_disable(struct device *dev, unsigned long freq); 47int opp_disable(struct device *dev, unsigned long freq);
48 48
49struct srcu_notifier_head *opp_get_notifier(struct device *dev); 49struct srcu_notifier_head *opp_get_notifier(struct device *dev);
50
51#ifdef CONFIG_OF
52int of_init_opp_table(struct device *dev);
53#else
54static inline int of_init_opp_table(struct device *dev)
55{
56 return -EINVAL;
57}
58#endif /* CONFIG_OF */
59#else 50#else
60static inline unsigned long opp_get_voltage(struct opp *opp) 51static inline unsigned long opp_get_voltage(struct opp *opp)
61{ 52{
@@ -112,6 +103,15 @@ static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev)
112} 103}
113#endif /* CONFIG_PM_OPP */ 104#endif /* CONFIG_PM_OPP */
114 105
106#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
107int of_init_opp_table(struct device *dev);
108#else
109static inline int of_init_opp_table(struct device *dev)
110{
111 return -EINVAL;
112}
113#endif
114
115#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) 115#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
116int opp_init_cpufreq_table(struct device *dev, 116int opp_init_cpufreq_table(struct device *dev,
117 struct cpufreq_frequency_table **table); 117 struct cpufreq_frequency_table **table);
diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
new file mode 100644
index 000000000000..93506a114034
--- /dev/null
+++ b/include/linux/page-flags-layout.h
@@ -0,0 +1,88 @@
1#ifndef PAGE_FLAGS_LAYOUT_H
2#define PAGE_FLAGS_LAYOUT_H
3
4#include <linux/numa.h>
5#include <generated/bounds.h>
6
7/*
8 * When a memory allocation must conform to specific limitations (such
9 * as being suitable for DMA) the caller will pass in hints to the
10 * allocator in the gfp_mask, in the zone modifier bits. These bits
11 * are used to select a priority ordered list of memory zones which
12 * match the requested limits. See gfp_zone() in include/linux/gfp.h
13 */
14#if MAX_NR_ZONES < 2
15#define ZONES_SHIFT 0
16#elif MAX_NR_ZONES <= 2
17#define ZONES_SHIFT 1
18#elif MAX_NR_ZONES <= 4
19#define ZONES_SHIFT 2
20#else
21#error ZONES_SHIFT -- too many zones configured adjust calculation
22#endif
23
24#ifdef CONFIG_SPARSEMEM
25#include <asm/sparsemem.h>
26
27/* SECTION_SHIFT #bits space required to store a section # */
28#define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
29
30#endif /* CONFIG_SPARSEMEM */
31
32/*
33 * page->flags layout:
34 *
35 * There are five possibilities for how page->flags get laid out. The first
36 * pair is for the normal case without sparsemem. The second pair is for
37 * sparsemem when there is plenty of space for node and section information.
38 * The last is when there is insufficient space in page->flags and a separate
39 * lookup is necessary.
40 *
41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
42 * " plus space for last_nid: | NODE | ZONE | LAST_NID ... | FLAGS |
43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
44 * " plus space for last_nid: | SECTION | NODE | ZONE | LAST_NID ... | FLAGS |
45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
46 */
47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
48#define SECTIONS_WIDTH SECTIONS_SHIFT
49#else
50#define SECTIONS_WIDTH 0
51#endif
52
53#define ZONES_WIDTH ZONES_SHIFT
54
55#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
56#define NODES_WIDTH NODES_SHIFT
57#else
58#ifdef CONFIG_SPARSEMEM_VMEMMAP
59#error "Vmemmap: No space for nodes field in page flags"
60#endif
61#define NODES_WIDTH 0
62#endif
63
64#ifdef CONFIG_NUMA_BALANCING
65#define LAST_NID_SHIFT NODES_SHIFT
66#else
67#define LAST_NID_SHIFT 0
68#endif
69
70#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_NID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
71#define LAST_NID_WIDTH LAST_NID_SHIFT
72#else
73#define LAST_NID_WIDTH 0
74#endif
75
76/*
77 * We are going to use the flags for the page to node mapping if its in
78 * there. This includes the case where there is no node, so it is implicit.
79 */
80#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
81#define NODE_NOT_IN_PAGE_FLAGS
82#endif
83
84#if defined(CONFIG_NUMA_BALANCING) && LAST_NID_WIDTH == 0
85#define LAST_NID_NOT_IN_PAGE_FLAGS
86#endif
87
88#endif /* _LINUX_PAGE_FLAGS_LAYOUT */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 70473da47b3f..6d53675c2b54 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -303,21 +303,13 @@ static inline void __SetPageUptodate(struct page *page)
303 303
304static inline void SetPageUptodate(struct page *page) 304static inline void SetPageUptodate(struct page *page)
305{ 305{
306#ifdef CONFIG_S390
307 if (!test_and_set_bit(PG_uptodate, &page->flags))
308 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY, 0);
309#else
310 /* 306 /*
311 * Memory barrier must be issued before setting the PG_uptodate bit, 307 * Memory barrier must be issued before setting the PG_uptodate bit,
312 * so that all previous stores issued in order to bring the page 308 * so that all previous stores issued in order to bring the page
313 * uptodate are actually visible before PageUptodate becomes true. 309 * uptodate are actually visible before PageUptodate becomes true.
314 *
315 * s390 doesn't need an explicit smp_wmb here because the test and
316 * set bit already provides full barriers.
317 */ 310 */
318 smp_wmb(); 311 smp_wmb();
319 set_bit(PG_uptodate, &(page)->flags); 312 set_bit(PG_uptodate, &(page)->flags);
320#endif
321} 313}
322 314
323CLEARPAGEFLAG(Uptodate, uptodate) 315CLEARPAGEFLAG(Uptodate, uptodate)
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index a92061e08d48..3fff8e774067 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -1,6 +1,25 @@
1#ifndef __LINUX_PAGEISOLATION_H 1#ifndef __LINUX_PAGEISOLATION_H
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool is_migrate_isolate_page(struct page *page)
6{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
8}
9static inline bool is_migrate_isolate(int migratetype)
10{
11 return migratetype == MIGRATE_ISOLATE;
12}
13#else
14static inline bool is_migrate_isolate_page(struct page *page)
15{
16 return false;
17}
18static inline bool is_migrate_isolate(int migratetype)
19{
20 return false;
21}
22#endif
4 23
5bool has_unmovable_pages(struct zone *zone, struct page *page, int count, 24bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
6 bool skip_hwpoisoned_pages); 25 bool skip_hwpoisoned_pages);
diff --git a/include/linux/path.h b/include/linux/path.h
index edc98dec6266..d1372186f431 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -9,8 +9,8 @@ struct path {
9 struct dentry *dentry; 9 struct dentry *dentry;
10}; 10};
11 11
12extern void path_get(struct path *); 12extern void path_get(const struct path *);
13extern void path_put(struct path *); 13extern void path_put(const struct path *);
14 14
15static inline int path_equal(const struct path *path1, const struct path *path2) 15static inline int path_equal(const struct path *path1, const struct path *path2)
16{ 16{
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6fa4dd2a3b9e..2461033a7987 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -286,6 +286,7 @@ struct pci_dev {
286 unsigned int irq; 286 unsigned int irq;
287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
288 288
289 bool match_driver; /* Skip attaching driver */
289 /* These fields are used by common fixups */ 290 /* These fields are used by common fixups */
290 unsigned int transparent:1; /* Transparent PCI bridge */ 291 unsigned int transparent:1; /* Transparent PCI bridge */
291 unsigned int multifunction:1;/* Part of multi-function device */ 292 unsigned int multifunction:1;/* Part of multi-function device */
@@ -378,6 +379,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
378 void (*release_fn)(struct pci_host_bridge *), 379 void (*release_fn)(struct pci_host_bridge *),
379 void *release_data); 380 void *release_data);
380 381
382int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
383
381/* 384/*
382 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 385 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
383 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 386 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
@@ -674,6 +677,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
674/* Some device drivers need know if pci is initiated */ 677/* Some device drivers need know if pci is initiated */
675extern int no_pci_devices(void); 678extern int no_pci_devices(void);
676 679
680void pcibios_resource_survey_bus(struct pci_bus *bus);
677void pcibios_fixup_bus(struct pci_bus *); 681void pcibios_fixup_bus(struct pci_bus *);
678int __must_check pcibios_enable_device(struct pci_dev *, int mask); 682int __must_check pcibios_enable_device(struct pci_dev *, int mask);
679/* Architecture specific versions may override this (weak) */ 683/* Architecture specific versions may override this (weak) */
@@ -1700,12 +1704,21 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
1700} 1704}
1701 1705
1702/** 1706/**
1707 * pcie_caps_reg - get the PCIe Capabilities Register
1708 * @dev: PCI device
1709 */
1710static inline u16 pcie_caps_reg(const struct pci_dev *dev)
1711{
1712 return dev->pcie_flags_reg;
1713}
1714
1715/**
1703 * pci_pcie_type - get the PCIe device/port type 1716 * pci_pcie_type - get the PCIe device/port type
1704 * @dev: PCI device 1717 * @dev: PCI device
1705 */ 1718 */
1706static inline int pci_pcie_type(const struct pci_dev *dev) 1719static inline int pci_pcie_type(const struct pci_dev *dev)
1707{ 1720{
1708 return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4; 1721 return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
1709} 1722}
1710 1723
1711void pci_request_acs(void); 1724void pci_request_acs(void);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 31717bd287fd..f11c1c2609d5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2802,6 +2802,7 @@
2802#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 2802#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0
2803#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2803#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2804#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2804#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2805#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3
2805#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2806#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
2806#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 2807#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6
2807#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030 2808#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 2381c973d897..a089a3c447fc 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -176,9 +176,8 @@ pid_t pid_vnr(struct pid *pid);
176 176
177#define do_each_pid_task(pid, type, task) \ 177#define do_each_pid_task(pid, type, task) \
178 do { \ 178 do { \
179 struct hlist_node *pos___; \
180 if ((pid) != NULL) \ 179 if ((pid) != NULL) \
181 hlist_for_each_entry_rcu((task), pos___, \ 180 hlist_for_each_entry_rcu((task), \
182 &(pid)->tasks[type], pids[type].node) { 181 &(pid)->tasks[type], pids[type].node) {
183 182
184 /* 183 /*
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
index 9ff93b065686..4b781014b0a0 100644
--- a/include/linux/platform_data/dma-ste-dma40.h
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -147,6 +147,16 @@ struct stedma40_chan_cfg {
147 * @memcpy_conf_log: default configuration of logical channel memcpy 147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels 148 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver. 149 * that are for different reasons not available for the driver.
150 * @soft_lli_chans: A vector, that marks physical channels will use LLI by SW
151 * which avoids HW bug that exists in some versions of the controller.
152 * SoftLLI introduces relink overhead that could impact performace for
153 * certain use cases.
154 * @num_of_soft_lli_chans: The number of channels that needs to be configured
155 * to use SoftLLI.
156 * @use_esram_lcla: flag for mapping the lcla into esram region
157 * @num_of_phy_chans: The number of physical channels implemented in HW.
158 * 0 means reading the number of channels from DMA HW but this is only valid
159 * for 'multiple of 4' channels, like 8.
150 */ 160 */
151struct stedma40_platform_data { 161struct stedma40_platform_data {
152 u32 dev_len; 162 u32 dev_len;
@@ -157,7 +167,10 @@ struct stedma40_platform_data {
157 struct stedma40_chan_cfg *memcpy_conf_phy; 167 struct stedma40_chan_cfg *memcpy_conf_phy;
158 struct stedma40_chan_cfg *memcpy_conf_log; 168 struct stedma40_chan_cfg *memcpy_conf_log;
159 int disabled_channels[STEDMA40_MAX_PHYS]; 169 int disabled_channels[STEDMA40_MAX_PHYS];
170 int *soft_lli_chans;
171 int num_of_soft_lli_chans;
160 bool use_esram_lcla; 172 bool use_esram_lcla;
173 int num_of_phy_chans;
161}; 174};
162 175
163#ifdef CONFIG_STE_DMA40 176#ifdef CONFIG_STE_DMA40
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
new file mode 100644
index 000000000000..1bd5244d1dcd
--- /dev/null
+++ b/include/linux/platform_data/elm.h
@@ -0,0 +1,54 @@
1/*
2 * BCH Error Location Module
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ELM_H
19#define __ELM_H
20
21enum bch_ecc {
22 BCH4_ECC = 0,
23 BCH8_ECC,
24};
25
26/* ELM support 8 error syndrome process */
27#define ERROR_VECTOR_MAX 8
28
29#define BCH8_ECC_OOB_BYTES 13
30#define BCH4_ECC_OOB_BYTES 7
31/* RBL requires 14 byte even though BCH8 uses only 13 byte */
32#define BCH8_SIZE (BCH8_ECC_OOB_BYTES + 1)
33/* Uses 1 extra byte to handle erased pages */
34#define BCH4_SIZE (BCH4_ECC_OOB_BYTES + 1)
35
36/**
37 * struct elm_errorvec - error vector for elm
38 * @error_reported: set true for vectors error is reported
39 * @error_uncorrectable: number of uncorrectable errors
40 * @error_count: number of correctable errors in the sector
41 * @error_loc: buffer for error location
42 *
43 */
44struct elm_errorvec {
45 bool error_reported;
46 bool error_uncorrectable;
47 int error_count;
48 int error_loc[ERROR_VECTOR_MAX];
49};
50
51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
52 struct elm_errorvec *err_vec);
53void elm_config(struct device *dev, enum bch_ecc bch_type);
54#endif /* __ELM_H */
diff --git a/include/linux/platform_data/exynos_thermal.h b/include/linux/platform_data/exynos_thermal.h
index a7bdb2f63b73..da7e6274b175 100644
--- a/include/linux/platform_data/exynos_thermal.h
+++ b/include/linux/platform_data/exynos_thermal.h
@@ -53,6 +53,8 @@ struct freq_clip_table {
53 * struct exynos_tmu_platform_data 53 * struct exynos_tmu_platform_data
54 * @threshold: basic temperature for generating interrupt 54 * @threshold: basic temperature for generating interrupt
55 * 25 <= threshold <= 125 [unit: degree Celsius] 55 * 25 <= threshold <= 125 [unit: degree Celsius]
56 * @threshold_falling: differntial value for setting threshold
57 * of temperature falling interrupt.
56 * @trigger_levels: array for each interrupt levels 58 * @trigger_levels: array for each interrupt levels
57 * [unit: degree Celsius] 59 * [unit: degree Celsius]
58 * 0: temperature for trigger_level0 interrupt 60 * 0: temperature for trigger_level0 interrupt
@@ -97,6 +99,7 @@ struct freq_clip_table {
97 */ 99 */
98struct exynos_tmu_platform_data { 100struct exynos_tmu_platform_data {
99 u8 threshold; 101 u8 threshold;
102 u8 threshold_falling;
100 u8 trigger_levels[4]; 103 u8 trigger_levels[4];
101 bool trigger_level0_en; 104 bool trigger_level0_en;
102 bool trigger_level1_en; 105 bool trigger_level1_en;
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
new file mode 100644
index 000000000000..1509570d5a3f
--- /dev/null
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -0,0 +1,87 @@
1/*
2 * LP55XX Platform Data Header
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * Derived from leds-lp5521.h, leds-lp5523.h
13 */
14
15#ifndef _LEDS_LP55XX_H
16#define _LEDS_LP55XX_H
17
18/* Clock configuration */
19#define LP55XX_CLOCK_AUTO 0
20#define LP55XX_CLOCK_INT 1
21#define LP55XX_CLOCK_EXT 2
22
23/* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */
24#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
25#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
26#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
27#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
28#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
29#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
30#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
31#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
32#define LP5521_CLK_INT 1 /* Internal clock */
33#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
34
35struct lp55xx_led_config {
36 const char *name;
37 u8 chan_nr;
38 u8 led_current; /* mA x10, 0 if led is not connected */
39 u8 max_current;
40};
41
42struct lp55xx_predef_pattern {
43 u8 *r;
44 u8 *g;
45 u8 *b;
46 u8 size_r;
47 u8 size_g;
48 u8 size_b;
49};
50
51/*
52 * struct lp55xx_platform_data
53 * @led_config : Configurable led class device
54 * @num_channels : Number of LED channels
55 * @label : Used for naming LEDs
56 * @clock_mode : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
57 * @setup_resources : Platform specific function before enabling the chip
58 * @release_resources : Platform specific function after disabling the chip
59 * @enable : EN pin control by platform side
60 * @patterns : Predefined pattern data for RGB channels
61 * @num_patterns : Number of patterns
62 * @update_config : Value of CONFIG register
63 */
64struct lp55xx_platform_data {
65
66 /* LED channel configuration */
67 struct lp55xx_led_config *led_config;
68 u8 num_channels;
69 const char *label;
70
71 /* Clock configuration */
72 u8 clock_mode;
73
74 /* Platform specific functions */
75 int (*setup_resources)(void);
76 void (*release_resources)(void);
77 void (*enable)(bool state);
78
79 /* Predefined pattern data */
80 struct lp55xx_predef_pattern *patterns;
81 unsigned int num_patterns;
82
83 /* _CONFIG register */
84 u8 update_config;
85};
86
87#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index aaf97481f413..b4a0521ce411 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -39,5 +39,6 @@ struct esdhc_platform_data {
39 unsigned int cd_gpio; 39 unsigned int cd_gpio;
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width;
42}; 43};
43#endif /* __ASM_ARCH_IMX_ESDHC_H */ 44#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-sdhci-tegra.h b/include/linux/platform_data/mmc-sdhci-tegra.h
deleted file mode 100644
index 8f8430697686..000000000000
--- a/include/linux/platform_data/mmc-sdhci-tegra.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2009 Palm, Inc.
3 * Author: Yvonne Yip <y@palm.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef __PLATFORM_DATA_TEGRA_SDHCI_H
16#define __PLATFORM_DATA_TEGRA_SDHCI_H
17
18#include <linux/mmc/host.h>
19
20struct tegra_sdhci_platform_data {
21 int cd_gpio;
22 int wp_gpio;
23 int power_gpio;
24 int is_8bit;
25 int pm_flags;
26};
27
28#endif
diff --git a/include/linux/platform_data/sh_ipmmu.h b/include/linux/platform_data/sh_ipmmu.h
new file mode 100644
index 000000000000..39f7405cdac5
--- /dev/null
+++ b/include/linux/platform_data/sh_ipmmu.h
@@ -0,0 +1,18 @@
1/* sh_ipmmu.h
2 *
3 * Copyright (C) 2012 Hideki EIRAKU
4 *
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; version 2 of the License.
8 */
9
10#ifndef __SH_IPMMU_H__
11#define __SH_IPMMU_H__
12
13struct shmobile_ipmmu_platform_data {
14 const char * const *dev_names;
15 unsigned int num_dev_names;
16};
17
18#endif /* __SH_IPMMU_H__ */
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
index e697c85ad3bc..fa579b4c666b 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -55,6 +55,7 @@ struct ohci_hcd_omap_platform_data {
55}; 55};
56 56
57struct usbhs_omap_platform_data { 57struct usbhs_omap_platform_data {
58 int nports;
58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; 59 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
59 int reset_gpio_port[OMAP3_HS_USB_PORTS]; 60 int reset_gpio_port[OMAP3_HS_USB_PORTS];
60 struct regulator *regulator[OMAP3_HS_USB_PORTS]; 61 struct regulator *regulator[OMAP3_HS_USB_PORTS];
diff --git a/include/linux/platform_data/ux500_wdt.h b/include/linux/platform_data/ux500_wdt.h
new file mode 100644
index 000000000000..1689ff4c3bfd
--- /dev/null
+++ b/include/linux/platform_data/ux500_wdt.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) ST Ericsson SA 2011
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * STE Ux500 Watchdog platform data
7 */
8#ifndef __UX500_WDT_H
9#define __UX500_WDT_H
10
11/**
12 * struct ux500_wdt_data
13 */
14struct ux500_wdt_data {
15 unsigned int timeout;
16 bool has_28_bits_resolution;
17};
18
19#endif /* __UX500_WDT_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 97bcf23e045a..e5d7230332a4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -537,6 +537,7 @@ struct dev_pm_info {
537 unsigned int irq_safe:1; 537 unsigned int irq_safe:1;
538 unsigned int use_autosuspend:1; 538 unsigned int use_autosuspend:1;
539 unsigned int timer_autosuspends:1; 539 unsigned int timer_autosuspends:1;
540 unsigned int memalloc_noio:1;
540 enum rpm_request request; 541 enum rpm_request request;
541 enum rpm_status runtime_status; 542 enum rpm_status runtime_status;
542 int runtime_error; 543 int runtime_error;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index c785c215abfc..7d7e09efff9b 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -47,6 +47,7 @@ extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
48extern void pm_runtime_update_max_time_suspended(struct device *dev, 48extern void pm_runtime_update_max_time_suspended(struct device *dev,
49 s64 delta_ns); 49 s64 delta_ns);
50extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
50 51
51static inline bool pm_children_suspended(struct device *dev) 52static inline bool pm_children_suspended(struct device *dev)
52{ 53{
@@ -156,6 +157,8 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
156 int delay) {} 157 int delay) {}
157static inline unsigned long pm_runtime_autosuspend_expiration( 158static inline unsigned long pm_runtime_autosuspend_expiration(
158 struct device *dev) { return 0; } 159 struct device *dev) { return 0; }
160static inline void pm_runtime_set_memalloc_noio(struct device *dev,
161 bool enable){}
159 162
160#endif /* !CONFIG_PM_RUNTIME */ 163#endif /* !CONFIG_PM_RUNTIME */
161 164
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 6d661f32e0e4..a4df2042b79c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -146,6 +146,8 @@ struct pwm_ops {
146 * @base: number of first PWM controlled by this chip 146 * @base: number of first PWM controlled by this chip
147 * @npwm: number of PWMs controlled by this chip 147 * @npwm: number of PWMs controlled by this chip
148 * @pwms: array of PWM devices allocated by the framework 148 * @pwms: array of PWM devices allocated by the framework
149 * @can_sleep: must be true if the .config(), .enable() or .disable()
150 * operations may sleep
149 */ 151 */
150struct pwm_chip { 152struct pwm_chip {
151 struct device *dev; 153 struct device *dev;
@@ -159,6 +161,7 @@ struct pwm_chip {
159 struct pwm_device * (*of_xlate)(struct pwm_chip *pc, 161 struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
160 const struct of_phandle_args *args); 162 const struct of_phandle_args *args);
161 unsigned int of_pwm_n_cells; 163 unsigned int of_pwm_n_cells;
164 bool can_sleep;
162}; 165};
163 166
164#if IS_ENABLED(CONFIG_PWM) 167#if IS_ENABLED(CONFIG_PWM)
@@ -174,11 +177,16 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc, 177struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
175 const struct of_phandle_args *args); 178 const struct of_phandle_args *args);
176 179
177struct pwm_device *pwm_get(struct device *dev, const char *consumer); 180struct pwm_device *pwm_get(struct device *dev, const char *con_id);
181struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
178void pwm_put(struct pwm_device *pwm); 182void pwm_put(struct pwm_device *pwm);
179 183
180struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer); 184struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
185struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
186 const char *con_id);
181void devm_pwm_put(struct device *dev, struct pwm_device *pwm); 187void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
188
189bool pwm_can_sleep(struct pwm_device *pwm);
182#else 190#else
183static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data) 191static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
184{ 192{
@@ -213,6 +221,12 @@ static inline struct pwm_device *pwm_get(struct device *dev,
213 return ERR_PTR(-ENODEV); 221 return ERR_PTR(-ENODEV);
214} 222}
215 223
224static inline struct pwm_device *of_pwm_get(struct device_node *np,
225 const char *con_id)
226{
227 return ERR_PTR(-ENODEV);
228}
229
216static inline void pwm_put(struct pwm_device *pwm) 230static inline void pwm_put(struct pwm_device *pwm)
217{ 231{
218} 232}
@@ -223,9 +237,21 @@ static inline struct pwm_device *devm_pwm_get(struct device *dev,
223 return ERR_PTR(-ENODEV); 237 return ERR_PTR(-ENODEV);
224} 238}
225 239
240static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
241 struct device_node *np,
242 const char *con_id)
243{
244 return ERR_PTR(-ENODEV);
245}
246
226static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) 247static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
227{ 248{
228} 249}
250
251static inline bool pwm_can_sleep(struct pwm_device *pwm)
252{
253 return false;
254}
229#endif 255#endif
230 256
231struct pwm_lookup { 257struct pwm_lookup {
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 58fdef125252..d13371134c59 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -405,6 +405,7 @@ struct quota_module_name {
405#define INIT_QUOTA_MODULE_NAMES {\ 405#define INIT_QUOTA_MODULE_NAMES {\
406 {QFMT_VFS_OLD, "quota_v1"},\ 406 {QFMT_VFS_OLD, "quota_v1"},\
407 {QFMT_VFS_V0, "quota_v2"},\ 407 {QFMT_VFS_V0, "quota_v2"},\
408 {QFMT_VFS_V1, "quota_v2"},\
408 {0, NULL}} 409 {0, NULL}}
409 410
410#endif /* _QUOTA_ */ 411#endif /* _QUOTA_ */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index c92dd28eaa6c..8089e35d47ac 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -445,8 +445,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
445 445
446/** 446/**
447 * hlist_for_each_entry_rcu - iterate over rcu list of given type 447 * hlist_for_each_entry_rcu - iterate over rcu list of given type
448 * @tpos: the type * to use as a loop cursor. 448 * @pos: the type * to use as a loop cursor.
449 * @pos: the &struct hlist_node to use as a loop cursor.
450 * @head: the head for your list. 449 * @head: the head for your list.
451 * @member: the name of the hlist_node within the struct. 450 * @member: the name of the hlist_node within the struct.
452 * 451 *
@@ -454,16 +453,16 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
454 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 453 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
455 * as long as the traversal is guarded by rcu_read_lock(). 454 * as long as the traversal is guarded by rcu_read_lock().
456 */ 455 */
457#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 456#define hlist_for_each_entry_rcu(pos, head, member) \
458 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \ 457 for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
459 pos && \ 458 typeof(*(pos)), member); \
460 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 459 pos; \
461 pos = rcu_dereference_raw(hlist_next_rcu(pos))) 460 pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
461 &(pos)->member)), typeof(*(pos)), member))
462 462
463/** 463/**
464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type 464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
465 * @tpos: the type * to use as a loop cursor. 465 * @pos: the type * to use as a loop cursor.
466 * @pos: the &struct hlist_node to use as a loop cursor.
467 * @head: the head for your list. 466 * @head: the head for your list.
468 * @member: the name of the hlist_node within the struct. 467 * @member: the name of the hlist_node within the struct.
469 * 468 *
@@ -471,35 +470,36 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
471 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 470 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
472 * as long as the traversal is guarded by rcu_read_lock(). 471 * as long as the traversal is guarded by rcu_read_lock().
473 */ 472 */
474#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \ 473#define hlist_for_each_entry_rcu_bh(pos, head, member) \
475 for (pos = rcu_dereference_bh((head)->first); \ 474 for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_first_rcu(head)),\
476 pos && \ 475 typeof(*(pos)), member); \
477 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 476 pos; \
478 pos = rcu_dereference_bh(pos->next)) 477 pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(\
478 &(pos)->member)), typeof(*(pos)), member))
479 479
480/** 480/**
481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point 481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
482 * @tpos: the type * to use as a loop cursor. 482 * @pos: the type * to use as a loop cursor.
483 * @pos: the &struct hlist_node to use as a loop cursor.
484 * @member: the name of the hlist_node within the struct. 483 * @member: the name of the hlist_node within the struct.
485 */ 484 */
486#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \ 485#define hlist_for_each_entry_continue_rcu(pos, member) \
487 for (pos = rcu_dereference((pos)->next); \ 486 for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
488 pos && \ 487 typeof(*(pos)), member); \
489 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 488 pos; \
490 pos = rcu_dereference(pos->next)) 489 pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
490 typeof(*(pos)), member))
491 491
492/** 492/**
493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point 493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
494 * @tpos: the type * to use as a loop cursor. 494 * @pos: the type * to use as a loop cursor.
495 * @pos: the &struct hlist_node to use as a loop cursor.
496 * @member: the name of the hlist_node within the struct. 495 * @member: the name of the hlist_node within the struct.
497 */ 496 */
498#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \ 497#define hlist_for_each_entry_continue_rcu_bh(pos, member) \
499 for (pos = rcu_dereference_bh((pos)->next); \ 498 for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
500 pos && \ 499 typeof(*(pos)), member); \
501 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 500 pos; \
502 pos = rcu_dereference_bh(pos->next)) 501 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
502 typeof(*(pos)), member))
503 503
504 504
505#endif /* __KERNEL__ */ 505#endif /* __KERNEL__ */
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 23070fd83872..7df93f52db08 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -199,6 +199,8 @@ enum regulator_type {
199 * output when using regulator_set_voltage_sel_regmap 199 * output when using regulator_set_voltage_sel_regmap
200 * @enable_reg: Register for control when using regmap enable/disable ops 200 * @enable_reg: Register for control when using regmap enable/disable ops
201 * @enable_mask: Mask for control when using regmap enable/disable ops 201 * @enable_mask: Mask for control when using regmap enable/disable ops
202 * @bypass_reg: Register for control when using regmap set_bypass
203 * @bypass_mask: Mask for control when using regmap set_bypass
202 * 204 *
203 * @enable_time: Time taken for initial enable of regulator (in uS). 205 * @enable_time: Time taken for initial enable of regulator (in uS).
204 */ 206 */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index c20635c527a9..6dacb93a6d94 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -123,7 +123,7 @@ static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
123 down_write(&anon_vma->root->rwsem); 123 down_write(&anon_vma->root->rwsem);
124} 124}
125 125
126static inline void anon_vma_unlock(struct anon_vma *anon_vma) 126static inline void anon_vma_unlock_write(struct anon_vma *anon_vma)
127{ 127{
128 up_write(&anon_vma->root->rwsem); 128 up_write(&anon_vma->root->rwsem);
129} 129}
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 4bd6c06eb28e..2d8bdaef9611 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -231,6 +231,41 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
231 */ 231 */
232#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) 232#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
233 233
234/*
235 * sg page iterator
236 *
237 * Iterates over sg entries page-by-page. On each successful iteration,
238 * @piter->page points to the current page, @piter->sg to the sg holding this
239 * page and @piter->sg_pgoffset to the page's page offset within the sg. The
240 * iteration will stop either when a maximum number of sg entries was reached
241 * or a terminating sg (sg_last(sg) == true) was reached.
242 */
243struct sg_page_iter {
244 struct page *page; /* current page */
245 struct scatterlist *sg; /* sg holding the page */
246 unsigned int sg_pgoffset; /* page offset within the sg */
247
248 /* these are internal states, keep away */
249 unsigned int __nents; /* remaining sg entries */
250 int __pg_advance; /* nr pages to advance at the
251 * next step */
252};
253
254bool __sg_page_iter_next(struct sg_page_iter *piter);
255void __sg_page_iter_start(struct sg_page_iter *piter,
256 struct scatterlist *sglist, unsigned int nents,
257 unsigned long pgoffset);
258
259/**
260 * for_each_sg_page - iterate over the pages of the given sg list
261 * @sglist: sglist to iterate over
262 * @piter: page iterator to hold current page, sg, sg_pgoffset
263 * @nents: maximum number of sg entries to iterate over
264 * @pgoffset: starting page offset
265 */
266#define for_each_sg_page(sglist, piter, nents, pgoffset) \
267 for (__sg_page_iter_start((piter), (sglist), (nents), (pgoffset)); \
268 __sg_page_iter_next(piter);)
234 269
235/* 270/*
236 * Mapping sg iterator 271 * Mapping sg iterator
@@ -258,11 +293,11 @@ struct sg_mapping_iter {
258 void *addr; /* pointer to the mapped area */ 293 void *addr; /* pointer to the mapped area */
259 size_t length; /* length of the mapped area */ 294 size_t length; /* length of the mapped area */
260 size_t consumed; /* number of consumed bytes */ 295 size_t consumed; /* number of consumed bytes */
296 struct sg_page_iter piter; /* page iterator */
261 297
262 /* these are internal states, keep away */ 298 /* these are internal states, keep away */
263 struct scatterlist *__sg; /* current entry */ 299 unsigned int __offset; /* offset within page */
264 unsigned int __nents; /* nr of remaining entries */ 300 unsigned int __remaining; /* remaining bytes on page */
265 unsigned int __offset; /* offset within sg */
266 unsigned int __flags; 301 unsigned int __flags;
267}; 302};
268 303
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e4112aad2964..d35d2b6ddbfb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -51,6 +51,7 @@ struct sched_param {
51#include <linux/cred.h> 51#include <linux/cred.h>
52#include <linux/llist.h> 52#include <linux/llist.h>
53#include <linux/uidgid.h> 53#include <linux/uidgid.h>
54#include <linux/gfp.h>
54 55
55#include <asm/processor.h> 56#include <asm/processor.h>
56 57
@@ -98,7 +99,6 @@ extern int nr_threads;
98DECLARE_PER_CPU(unsigned long, process_counts); 99DECLARE_PER_CPU(unsigned long, process_counts);
99extern int nr_processes(void); 100extern int nr_processes(void);
100extern unsigned long nr_running(void); 101extern unsigned long nr_running(void);
101extern unsigned long nr_uninterruptible(void);
102extern unsigned long nr_iowait(void); 102extern unsigned long nr_iowait(void);
103extern unsigned long nr_iowait_cpu(int cpu); 103extern unsigned long nr_iowait_cpu(int cpu);
104extern unsigned long this_cpu_load(void); 104extern unsigned long this_cpu_load(void);
@@ -346,11 +346,6 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
346extern void set_dumpable(struct mm_struct *mm, int value); 346extern void set_dumpable(struct mm_struct *mm, int value);
347extern int get_dumpable(struct mm_struct *mm); 347extern int get_dumpable(struct mm_struct *mm);
348 348
349/* get/set_dumpable() values */
350#define SUID_DUMPABLE_DISABLED 0
351#define SUID_DUMPABLE_ENABLED 1
352#define SUID_DUMPABLE_SAFE 2
353
354/* mm flags */ 349/* mm flags */
355/* dumpable bits */ 350/* dumpable bits */
356#define MMF_DUMPABLE 0 /* core dump is permitted */ 351#define MMF_DUMPABLE 0 /* core dump is permitted */
@@ -1791,6 +1786,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1791#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1786#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1792#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1787#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1793#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1788#define PF_KSWAPD 0x00040000 /* I am kswapd */
1789#define PF_MEMALLOC_NOIO 0x00080000 /* Allocating memory without IO involved */
1794#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1790#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1795#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1791#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1796#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1792#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1828,6 +1824,26 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1828#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1824#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1829#define used_math() tsk_used_math(current) 1825#define used_math() tsk_used_math(current)
1830 1826
1827/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */
1828static inline gfp_t memalloc_noio_flags(gfp_t flags)
1829{
1830 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
1831 flags &= ~__GFP_IO;
1832 return flags;
1833}
1834
1835static inline unsigned int memalloc_noio_save(void)
1836{
1837 unsigned int flags = current->flags & PF_MEMALLOC_NOIO;
1838 current->flags |= PF_MEMALLOC_NOIO;
1839 return flags;
1840}
1841
1842static inline void memalloc_noio_restore(unsigned int flags)
1843{
1844 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
1845}
1846
1831/* 1847/*
1832 * task->jobctl flags 1848 * task->jobctl flags
1833 */ 1849 */
@@ -2160,7 +2176,6 @@ extern struct sigqueue *sigqueue_alloc(void);
2160extern void sigqueue_free(struct sigqueue *); 2176extern void sigqueue_free(struct sigqueue *);
2161extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 2177extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
2162extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 2178extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
2163extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
2164 2179
2165static inline void restore_saved_sigmask(void) 2180static inline void restore_saved_sigmask(void)
2166{ 2181{
@@ -2206,6 +2221,17 @@ static inline int sas_ss_flags(unsigned long sp)
2206 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2221 : on_sig_stack(sp) ? SS_ONSTACK : 0);
2207} 2222}
2208 2223
2224static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
2225{
2226 if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
2227#ifdef CONFIG_STACK_GROWSUP
2228 return current->sas_ss_sp;
2229#else
2230 return current->sas_ss_sp + current->sas_ss_size;
2231#endif
2232 return sp;
2233}
2234
2209/* 2235/*
2210 * Routines for handling mm_structs 2236 * Routines for handling mm_structs
2211 */ 2237 */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 94e19ea28fc3..440434df3627 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -55,4 +55,10 @@ static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
55extern void normalize_rt_tasks(void); 55extern void normalize_rt_tasks(void);
56 56
57 57
58/*
59 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
60 * Timeslices get refilled after they expire.
61 */
62#define RR_TIMESLICE (100 * HZ / 1000)
63
58#endif /* _SCHED_RT_H */ 64#endif /* _SCHED_RT_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index d2bb0ae979d0..bf8086b2506e 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -91,12 +91,6 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice;
91extern unsigned int sysctl_sched_autogroup_enabled; 91extern unsigned int sysctl_sched_autogroup_enabled;
92#endif 92#endif
93 93
94/*
95 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
96 * Timeslices get refilled after they expire.
97 */
98#define RR_TIMESLICE (100 * HZ / 1000)
99
100extern int sched_rr_timeslice; 94extern int sched_rr_timeslice;
101 95
102extern int sched_rr_handler(struct ctl_table *table, int write, 96extern int sched_rr_handler(struct ctl_table *table, int write,
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 600060e25ec6..18299057402f 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -30,92 +30,12 @@
30#include <linux/preempt.h> 30#include <linux/preempt.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32 32
33typedef struct {
34 unsigned sequence;
35 spinlock_t lock;
36} seqlock_t;
37
38/*
39 * These macros triggered gcc-3.x compile-time problems. We think these are
40 * OK now. Be cautious.
41 */
42#define __SEQLOCK_UNLOCKED(lockname) \
43 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
44
45#define seqlock_init(x) \
46 do { \
47 (x)->sequence = 0; \
48 spin_lock_init(&(x)->lock); \
49 } while (0)
50
51#define DEFINE_SEQLOCK(x) \
52 seqlock_t x = __SEQLOCK_UNLOCKED(x)
53
54/* Lock out other writers and update the count.
55 * Acts like a normal spin_lock/unlock.
56 * Don't need preempt_disable() because that is in the spin_lock already.
57 */
58static inline void write_seqlock(seqlock_t *sl)
59{
60 spin_lock(&sl->lock);
61 ++sl->sequence;
62 smp_wmb();
63}
64
65static inline void write_sequnlock(seqlock_t *sl)
66{
67 smp_wmb();
68 sl->sequence++;
69 spin_unlock(&sl->lock);
70}
71
72static inline int write_tryseqlock(seqlock_t *sl)
73{
74 int ret = spin_trylock(&sl->lock);
75
76 if (ret) {
77 ++sl->sequence;
78 smp_wmb();
79 }
80 return ret;
81}
82
83/* Start of read calculation -- fetch last complete writer token */
84static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
85{
86 unsigned ret;
87
88repeat:
89 ret = ACCESS_ONCE(sl->sequence);
90 if (unlikely(ret & 1)) {
91 cpu_relax();
92 goto repeat;
93 }
94 smp_rmb();
95
96 return ret;
97}
98
99/*
100 * Test if reader processed invalid data.
101 *
102 * If sequence value changed then writer changed data while in section.
103 */
104static __always_inline int read_seqretry(const seqlock_t *sl, unsigned start)
105{
106 smp_rmb();
107
108 return unlikely(sl->sequence != start);
109}
110
111
112/* 33/*
113 * Version using sequence counter only. 34 * Version using sequence counter only.
114 * This can be used when code has its own mutex protecting the 35 * This can be used when code has its own mutex protecting the
115 * updating starting before the write_seqcountbeqin() and ending 36 * updating starting before the write_seqcountbeqin() and ending
116 * after the write_seqcount_end(). 37 * after the write_seqcount_end().
117 */ 38 */
118
119typedef struct seqcount { 39typedef struct seqcount {
120 unsigned sequence; 40 unsigned sequence;
121} seqcount_t; 41} seqcount_t;
@@ -218,7 +138,6 @@ static inline int __read_seqcount_retry(const seqcount_t *s, unsigned start)
218static inline int read_seqcount_retry(const seqcount_t *s, unsigned start) 138static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
219{ 139{
220 smp_rmb(); 140 smp_rmb();
221
222 return __read_seqcount_retry(s, start); 141 return __read_seqcount_retry(s, start);
223} 142}
224 143
@@ -252,31 +171,101 @@ static inline void write_seqcount_barrier(seqcount_t *s)
252 s->sequence+=2; 171 s->sequence+=2;
253} 172}
254 173
174typedef struct {
175 struct seqcount seqcount;
176 spinlock_t lock;
177} seqlock_t;
178
255/* 179/*
256 * Possible sw/hw IRQ protected versions of the interfaces. 180 * These macros triggered gcc-3.x compile-time problems. We think these are
181 * OK now. Be cautious.
257 */ 182 */
258#define write_seqlock_irqsave(lock, flags) \ 183#define __SEQLOCK_UNLOCKED(lockname) \
259 do { local_irq_save(flags); write_seqlock(lock); } while (0) 184 { \
260#define write_seqlock_irq(lock) \ 185 .seqcount = SEQCNT_ZERO, \
261 do { local_irq_disable(); write_seqlock(lock); } while (0) 186 .lock = __SPIN_LOCK_UNLOCKED(lockname) \
262#define write_seqlock_bh(lock) \ 187 }
263 do { local_bh_disable(); write_seqlock(lock); } while (0) 188
189#define seqlock_init(x) \
190 do { \
191 seqcount_init(&(x)->seqcount); \
192 spin_lock_init(&(x)->lock); \
193 } while (0)
264 194
265#define write_sequnlock_irqrestore(lock, flags) \ 195#define DEFINE_SEQLOCK(x) \
266 do { write_sequnlock(lock); local_irq_restore(flags); } while(0) 196 seqlock_t x = __SEQLOCK_UNLOCKED(x)
267#define write_sequnlock_irq(lock) \
268 do { write_sequnlock(lock); local_irq_enable(); } while(0)
269#define write_sequnlock_bh(lock) \
270 do { write_sequnlock(lock); local_bh_enable(); } while(0)
271 197
272#define read_seqbegin_irqsave(lock, flags) \ 198/*
273 ({ local_irq_save(flags); read_seqbegin(lock); }) 199 * Read side functions for starting and finalizing a read side section.
200 */
201static inline unsigned read_seqbegin(const seqlock_t *sl)
202{
203 return read_seqcount_begin(&sl->seqcount);
204}
274 205
275#define read_seqretry_irqrestore(lock, iv, flags) \ 206static inline unsigned read_seqretry(const seqlock_t *sl, unsigned start)
276 ({ \ 207{
277 int ret = read_seqretry(lock, iv); \ 208 return read_seqcount_retry(&sl->seqcount, start);
278 local_irq_restore(flags); \ 209}
279 ret; \ 210
280 }) 211/*
212 * Lock out other writers and update the count.
213 * Acts like a normal spin_lock/unlock.
214 * Don't need preempt_disable() because that is in the spin_lock already.
215 */
216static inline void write_seqlock(seqlock_t *sl)
217{
218 spin_lock(&sl->lock);
219 write_seqcount_begin(&sl->seqcount);
220}
221
222static inline void write_sequnlock(seqlock_t *sl)
223{
224 write_seqcount_end(&sl->seqcount);
225 spin_unlock(&sl->lock);
226}
227
228static inline void write_seqlock_bh(seqlock_t *sl)
229{
230 spin_lock_bh(&sl->lock);
231 write_seqcount_begin(&sl->seqcount);
232}
233
234static inline void write_sequnlock_bh(seqlock_t *sl)
235{
236 write_seqcount_end(&sl->seqcount);
237 spin_unlock_bh(&sl->lock);
238}
239
240static inline void write_seqlock_irq(seqlock_t *sl)
241{
242 spin_lock_irq(&sl->lock);
243 write_seqcount_begin(&sl->seqcount);
244}
245
246static inline void write_sequnlock_irq(seqlock_t *sl)
247{
248 write_seqcount_end(&sl->seqcount);
249 spin_unlock_irq(&sl->lock);
250}
251
252static inline unsigned long __write_seqlock_irqsave(seqlock_t *sl)
253{
254 unsigned long flags;
255
256 spin_lock_irqsave(&sl->lock, flags);
257 write_seqcount_begin(&sl->seqcount);
258 return flags;
259}
260
261#define write_seqlock_irqsave(lock, flags) \
262 do { flags = __write_seqlock_irqsave(lock); } while (0)
263
264static inline void
265write_sequnlock_irqrestore(seqlock_t *sl, unsigned long flags)
266{
267 write_seqcount_end(&sl->seqcount);
268 spin_unlock_irqrestore(&sl->lock, flags);
269}
281 270
282#endif /* __LINUX_SEQLOCK_H */ 271#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 0a89ffc48466..a2dcb94ea49d 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -241,9 +241,6 @@ extern int do_send_sig_info(int sig, struct siginfo *info,
241 struct task_struct *p, bool group); 241 struct task_struct *p, bool group);
242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
244extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
245 siginfo_t *info);
246extern long do_sigpending(void __user *, unsigned long);
247extern int do_sigtimedwait(const sigset_t *, siginfo_t *, 244extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
248 const struct timespec *); 245 const struct timespec *);
249extern int sigprocmask(int, sigset_t *, sigset_t *); 246extern int sigprocmask(int, sigset_t *, sigset_t *);
@@ -252,10 +249,59 @@ extern void __set_current_blocked(const sigset_t *);
252extern int show_unhandled_signals; 249extern int show_unhandled_signals;
253extern int sigsuspend(sigset_t *); 250extern int sigsuspend(sigset_t *);
254 251
252struct sigaction {
253#ifndef __ARCH_HAS_ODD_SIGACTION
254 __sighandler_t sa_handler;
255 unsigned long sa_flags;
256#else
257 unsigned long sa_flags;
258 __sighandler_t sa_handler;
259#endif
260#ifdef __ARCH_HAS_SA_RESTORER
261 __sigrestore_t sa_restorer;
262#endif
263 sigset_t sa_mask; /* mask last for extensibility */
264};
265
266struct k_sigaction {
267 struct sigaction sa;
268#ifdef __ARCH_HAS_KA_RESTORER
269 __sigrestore_t ka_restorer;
270#endif
271};
272
273#ifdef CONFIG_OLD_SIGACTION
274struct old_sigaction {
275 __sighandler_t sa_handler;
276 old_sigset_t sa_mask;
277 unsigned long sa_flags;
278 __sigrestore_t sa_restorer;
279};
280#endif
281
282struct ksignal {
283 struct k_sigaction ka;
284 siginfo_t info;
285 int sig;
286};
287
255extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 288extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
289extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
256extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); 290extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
257extern void exit_signals(struct task_struct *tsk); 291extern void exit_signals(struct task_struct *tsk);
258 292
293/*
294 * Eventually that'll replace get_signal_to_deliver(); macro for now,
295 * to avoid nastiness with include order.
296 */
297#define get_signal(ksig) \
298({ \
299 struct ksignal *p = (ksig); \
300 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
301 signal_pt_regs(), NULL);\
302 p->sig > 0; \
303})
304
259extern struct kmem_cache *sighand_cachep; 305extern struct kmem_cache *sighand_cachep;
260 306
261int unhandled_signal(struct task_struct *tsk, int sig); 307int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index c65dee059913..13e929679550 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -24,6 +24,9 @@ struct smpboot_thread_data;
24 * parked (cpu offline) 24 * parked (cpu offline)
25 * @unpark: Optional unpark function, called when the thread is 25 * @unpark: Optional unpark function, called when the thread is
26 * unparked (cpu online) 26 * unparked (cpu online)
27 * @pre_unpark: Optional unpark function, called before the thread is
28 * unparked (cpu online). This is not guaranteed to be
29 * called on the target cpu of the thread. Careful!
27 * @selfparking: Thread is not parked by the park function. 30 * @selfparking: Thread is not parked by the park function.
28 * @thread_comm: The base name of the thread 31 * @thread_comm: The base name of the thread
29 */ 32 */
@@ -37,6 +40,7 @@ struct smp_hotplug_thread {
37 void (*cleanup)(unsigned int cpu, bool online); 40 void (*cleanup)(unsigned int cpu, bool online);
38 void (*park)(unsigned int cpu); 41 void (*park)(unsigned int cpu);
39 void (*unpark)(unsigned int cpu); 42 void (*unpark)(unsigned int cpu);
43 void (*pre_unpark)(unsigned int cpu);
40 bool selfparking; 44 bool selfparking;
41 const char *thread_comm; 45 const char *thread_comm;
42}; 46};
diff --git a/include/linux/stmp3xxx_rtc_wdt.h b/include/linux/stmp3xxx_rtc_wdt.h
new file mode 100644
index 000000000000..1dd12c96231b
--- /dev/null
+++ b/include/linux/stmp3xxx_rtc_wdt.h
@@ -0,0 +1,15 @@
1/*
2 * stmp3xxx_rtc_wdt.h
3 *
4 * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
5 *
6 * This file is released under the GPLv2.
7 */
8#ifndef __LINUX_STMP3XXX_RTC_WDT_H
9#define __LINUX_STMP3XXX_RTC_WDT_H
10
11struct stmp3xxx_wdt_pdata {
12 void (*wdt_set_timeout)(struct device *dev, u32 timeout);
13};
14
15#endif /* __LINUX_STMP3XXX_RTC_WDT_H */
diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h
new file mode 100644
index 000000000000..07d8e53bedfc
--- /dev/null
+++ b/include/linux/sunrpc/addr.h
@@ -0,0 +1,170 @@
1/*
2 * linux/include/linux/sunrpc/addr.h
3 *
4 * Various routines for copying and comparing sockaddrs and for
5 * converting them to and from presentation format.
6 */
7#ifndef _LINUX_SUNRPC_ADDR_H
8#define _LINUX_SUNRPC_ADDR_H
9
10#include <linux/socket.h>
11#include <linux/in.h>
12#include <linux/in6.h>
13#include <net/ipv6.h>
14
15size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
16size_t rpc_pton(struct net *, const char *, const size_t,
17 struct sockaddr *, const size_t);
18char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
19size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
20 struct sockaddr *, const size_t);
21
22static inline unsigned short rpc_get_port(const struct sockaddr *sap)
23{
24 switch (sap->sa_family) {
25 case AF_INET:
26 return ntohs(((struct sockaddr_in *)sap)->sin_port);
27 case AF_INET6:
28 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
29 }
30 return 0;
31}
32
33static inline void rpc_set_port(struct sockaddr *sap,
34 const unsigned short port)
35{
36 switch (sap->sa_family) {
37 case AF_INET:
38 ((struct sockaddr_in *)sap)->sin_port = htons(port);
39 break;
40 case AF_INET6:
41 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
42 break;
43 }
44}
45
46#define IPV6_SCOPE_DELIMITER '%'
47#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
48
49static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
50 const struct sockaddr *sap2)
51{
52 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
53 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
54
55 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
56}
57
58static inline bool __rpc_copy_addr4(struct sockaddr *dst,
59 const struct sockaddr *src)
60{
61 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
62 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
63
64 dsin->sin_family = ssin->sin_family;
65 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
66 return true;
67}
68
69#if IS_ENABLED(CONFIG_IPV6)
70static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
71 const struct sockaddr *sap2)
72{
73 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
74 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
75
76 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
77 return false;
78 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
79 return sin1->sin6_scope_id == sin2->sin6_scope_id;
80
81 return true;
82}
83
84static inline bool __rpc_copy_addr6(struct sockaddr *dst,
85 const struct sockaddr *src)
86{
87 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
88 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
89
90 dsin6->sin6_family = ssin6->sin6_family;
91 dsin6->sin6_addr = ssin6->sin6_addr;
92 dsin6->sin6_scope_id = ssin6->sin6_scope_id;
93 return true;
94}
95#else /* !(IS_ENABLED(CONFIG_IPV6) */
96static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
97 const struct sockaddr *sap2)
98{
99 return false;
100}
101
102static inline bool __rpc_copy_addr6(struct sockaddr *dst,
103 const struct sockaddr *src)
104{
105 return false;
106}
107#endif /* !(IS_ENABLED(CONFIG_IPV6) */
108
109/**
110 * rpc_cmp_addr - compare the address portion of two sockaddrs.
111 * @sap1: first sockaddr
112 * @sap2: second sockaddr
113 *
114 * Just compares the family and address portion. Ignores port, but
115 * compares the scope if it's a link-local address.
116 *
117 * Returns true if the addrs are equal, false if they aren't.
118 */
119static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
120 const struct sockaddr *sap2)
121{
122 if (sap1->sa_family == sap2->sa_family) {
123 switch (sap1->sa_family) {
124 case AF_INET:
125 return __rpc_cmp_addr4(sap1, sap2);
126 case AF_INET6:
127 return __rpc_cmp_addr6(sap1, sap2);
128 }
129 }
130 return false;
131}
132
133/**
134 * rpc_copy_addr - copy the address portion of one sockaddr to another
135 * @dst: destination sockaddr
136 * @src: source sockaddr
137 *
138 * Just copies the address portion and family. Ignores port, scope, etc.
139 * Caller is responsible for making certain that dst is large enough to hold
140 * the address in src. Returns true if address family is supported. Returns
141 * false otherwise.
142 */
143static inline bool rpc_copy_addr(struct sockaddr *dst,
144 const struct sockaddr *src)
145{
146 switch (src->sa_family) {
147 case AF_INET:
148 return __rpc_copy_addr4(dst, src);
149 case AF_INET6:
150 return __rpc_copy_addr6(dst, src);
151 }
152 return false;
153}
154
155/**
156 * rpc_get_scope_id - return scopeid for a given sockaddr
157 * @sa: sockaddr to get scopeid from
158 *
159 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
160 * not an AF_INET6 address.
161 */
162static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
163{
164 if (sa->sa_family != AF_INET6)
165 return 0;
166
167 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
168}
169
170#endif /* _LINUX_SUNRPC_ADDR_H */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index f25ba922baaf..58fda1c3c783 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -17,14 +17,15 @@
17 17
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
20#include <linux/uidgid.h>
20 21
21/* size of the nodename buffer */ 22/* size of the nodename buffer */
22#define UNX_MAXNODENAME 32 23#define UNX_MAXNODENAME 32
23 24
24/* Work around the lack of a VFS credential */ 25/* Work around the lack of a VFS credential */
25struct auth_cred { 26struct auth_cred {
26 uid_t uid; 27 kuid_t uid;
27 gid_t gid; 28 kgid_t gid;
28 struct group_info *group_info; 29 struct group_info *group_info;
29 const char *principal; 30 const char *principal;
30 unsigned char machine_cred : 1; 31 unsigned char machine_cred : 1;
@@ -48,7 +49,7 @@ struct rpc_cred {
48 unsigned long cr_flags; /* various flags */ 49 unsigned long cr_flags; /* various flags */
49 atomic_t cr_count; /* ref count */ 50 atomic_t cr_count; /* ref count */
50 51
51 uid_t cr_uid; 52 kuid_t cr_uid;
52 53
53 /* per-flavor data */ 54 /* per-flavor data */
54}; 55};
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5dc9ee4d616e..303399b1ba59 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -83,6 +83,10 @@ struct cache_detail {
83 int (*cache_upcall)(struct cache_detail *, 83 int (*cache_upcall)(struct cache_detail *,
84 struct cache_head *); 84 struct cache_head *);
85 85
86 void (*cache_request)(struct cache_detail *cd,
87 struct cache_head *ch,
88 char **bpp, int *blen);
89
86 int (*cache_parse)(struct cache_detail *, 90 int (*cache_parse)(struct cache_detail *,
87 char *buf, int len); 91 char *buf, int len);
88 92
@@ -157,11 +161,7 @@ sunrpc_cache_update(struct cache_detail *detail,
157 struct cache_head *new, struct cache_head *old, int hash); 161 struct cache_head *new, struct cache_head *old, int hash);
158 162
159extern int 163extern int
160sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h, 164sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h);
161 void (*cache_request)(struct cache_detail *,
162 struct cache_head *,
163 char **,
164 int *));
165 165
166 166
167extern void cache_clean_deferred(void *owner); 167extern void cache_clean_deferred(void *owner);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 34206b84d8da..2cf4ffaa3cd4 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -160,162 +160,11 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
160int rpc_protocol(struct rpc_clnt *); 160int rpc_protocol(struct rpc_clnt *);
161struct net * rpc_net_ns(struct rpc_clnt *); 161struct net * rpc_net_ns(struct rpc_clnt *);
162size_t rpc_max_payload(struct rpc_clnt *); 162size_t rpc_max_payload(struct rpc_clnt *);
163unsigned long rpc_get_timeout(struct rpc_clnt *clnt);
163void rpc_force_rebind(struct rpc_clnt *); 164void rpc_force_rebind(struct rpc_clnt *);
164size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 165size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
165const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 166const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
166int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); 167int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
167 168
168size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
169size_t rpc_pton(struct net *, const char *, const size_t,
170 struct sockaddr *, const size_t);
171char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
172size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
173 struct sockaddr *, const size_t);
174
175static inline unsigned short rpc_get_port(const struct sockaddr *sap)
176{
177 switch (sap->sa_family) {
178 case AF_INET:
179 return ntohs(((struct sockaddr_in *)sap)->sin_port);
180 case AF_INET6:
181 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
182 }
183 return 0;
184}
185
186static inline void rpc_set_port(struct sockaddr *sap,
187 const unsigned short port)
188{
189 switch (sap->sa_family) {
190 case AF_INET:
191 ((struct sockaddr_in *)sap)->sin_port = htons(port);
192 break;
193 case AF_INET6:
194 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
195 break;
196 }
197}
198
199#define IPV6_SCOPE_DELIMITER '%'
200#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
201
202static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
203 const struct sockaddr *sap2)
204{
205 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
206 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
207
208 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
209}
210
211static inline bool __rpc_copy_addr4(struct sockaddr *dst,
212 const struct sockaddr *src)
213{
214 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
215 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
216
217 dsin->sin_family = ssin->sin_family;
218 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
219 return true;
220}
221
222#if IS_ENABLED(CONFIG_IPV6)
223static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
224 const struct sockaddr *sap2)
225{
226 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
227 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
228
229 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
230 return false;
231 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
232 return sin1->sin6_scope_id == sin2->sin6_scope_id;
233
234 return true;
235}
236
237static inline bool __rpc_copy_addr6(struct sockaddr *dst,
238 const struct sockaddr *src)
239{
240 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
241 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
242
243 dsin6->sin6_family = ssin6->sin6_family;
244 dsin6->sin6_addr = ssin6->sin6_addr;
245 return true;
246}
247#else /* !(IS_ENABLED(CONFIG_IPV6) */
248static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
249 const struct sockaddr *sap2)
250{
251 return false;
252}
253
254static inline bool __rpc_copy_addr6(struct sockaddr *dst,
255 const struct sockaddr *src)
256{
257 return false;
258}
259#endif /* !(IS_ENABLED(CONFIG_IPV6) */
260
261/**
262 * rpc_cmp_addr - compare the address portion of two sockaddrs.
263 * @sap1: first sockaddr
264 * @sap2: second sockaddr
265 *
266 * Just compares the family and address portion. Ignores port, scope, etc.
267 * Returns true if the addrs are equal, false if they aren't.
268 */
269static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
270 const struct sockaddr *sap2)
271{
272 if (sap1->sa_family == sap2->sa_family) {
273 switch (sap1->sa_family) {
274 case AF_INET:
275 return __rpc_cmp_addr4(sap1, sap2);
276 case AF_INET6:
277 return __rpc_cmp_addr6(sap1, sap2);
278 }
279 }
280 return false;
281}
282
283/**
284 * rpc_copy_addr - copy the address portion of one sockaddr to another
285 * @dst: destination sockaddr
286 * @src: source sockaddr
287 *
288 * Just copies the address portion and family. Ignores port, scope, etc.
289 * Caller is responsible for making certain that dst is large enough to hold
290 * the address in src. Returns true if address family is supported. Returns
291 * false otherwise.
292 */
293static inline bool rpc_copy_addr(struct sockaddr *dst,
294 const struct sockaddr *src)
295{
296 switch (src->sa_family) {
297 case AF_INET:
298 return __rpc_copy_addr4(dst, src);
299 case AF_INET6:
300 return __rpc_copy_addr6(dst, src);
301 }
302 return false;
303}
304
305/**
306 * rpc_get_scope_id - return scopeid for a given sockaddr
307 * @sa: sockaddr to get scopeid from
308 *
309 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
310 * not an AF_INET6 address.
311 */
312static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
313{
314 if (sa->sa_family != AF_INET6)
315 return 0;
316
317 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
318}
319
320#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
321#endif /* _LINUX_SUNRPC_CLNT_H */ 170#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 676ddf53b3ee..1f0216b9a6c9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -50,6 +50,7 @@ struct svc_pool {
50 unsigned int sp_nrthreads; /* # of threads in pool */ 50 unsigned int sp_nrthreads; /* # of threads in pool */
51 struct list_head sp_all_threads; /* all server threads */ 51 struct list_head sp_all_threads; /* all server threads */
52 struct svc_pool_stats sp_stats; /* statistics on pool operation */ 52 struct svc_pool_stats sp_stats; /* statistics on pool operation */
53 int sp_task_pending;/* has pending task */
53} ____cacheline_aligned_in_smp; 54} ____cacheline_aligned_in_smp;
54 55
55/* 56/*
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index dd74084a9799..ff374ab30839 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -18,8 +18,8 @@
18#include <linux/cred.h> 18#include <linux/cred.h>
19 19
20struct svc_cred { 20struct svc_cred {
21 uid_t cr_uid; 21 kuid_t cr_uid;
22 gid_t cr_gid; 22 kgid_t cr_gid;
23 struct group_info *cr_group_info; 23 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 24 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 25 char *cr_principal; /* for gss */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 63988990bd36..15f9204ee70b 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -56,7 +56,7 @@ struct xdr_buf {
56 struct kvec head[1], /* RPC header + non-page data */ 56 struct kvec head[1], /* RPC header + non-page data */
57 tail[1]; /* Appended after page data */ 57 tail[1]; /* Appended after page data */
58 58
59 struct page ** pages; /* Array of contiguous pages */ 59 struct page ** pages; /* Array of pages */
60 unsigned int page_base, /* Start of page data */ 60 unsigned int page_base, /* Start of page data */
61 page_len, /* Length of page data */ 61 page_len, /* Length of page data */
62 flags; /* Flags for data disposition */ 62 flags; /* Flags for data disposition */
@@ -152,6 +152,7 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p)
152extern void xdr_shift_buf(struct xdr_buf *, size_t); 152extern void xdr_shift_buf(struct xdr_buf *, size_t);
153extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); 153extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
154extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int); 154extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
155extern void xdr_buf_trim(struct xdr_buf *, unsigned int);
155extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int); 156extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int);
156extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); 157extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
157extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); 158extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 68df9c17fbbb..2818a123f3ea 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -8,7 +8,7 @@
8#include <linux/memcontrol.h> 8#include <linux/memcontrol.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/node.h> 10#include <linux/node.h>
11 11#include <linux/fs.h>
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <asm/page.h> 13#include <asm/page.h>
14 14
@@ -156,7 +156,7 @@ enum {
156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
157}; 157};
158 158
159#define SWAP_CLUSTER_MAX 32 159#define SWAP_CLUSTER_MAX 32UL
160#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 160#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
161 161
162/* 162/*
@@ -202,6 +202,18 @@ struct swap_info_struct {
202 unsigned long *frontswap_map; /* frontswap in-use, one bit per page */ 202 unsigned long *frontswap_map; /* frontswap in-use, one bit per page */
203 atomic_t frontswap_pages; /* frontswap pages in-use counter */ 203 atomic_t frontswap_pages; /* frontswap pages in-use counter */
204#endif 204#endif
205 spinlock_t lock; /*
206 * protect map scan related fields like
207 * swap_map, lowest_bit, highest_bit,
208 * inuse_pages, cluster_next,
209 * cluster_nr, lowest_alloc and
210 * highest_alloc. other fields are only
211 * changed at swapon/swapoff, so are
212 * protected by swap_lock. changing
213 * flags need hold this lock and
214 * swap_lock. If both locks need hold,
215 * hold swap_lock first.
216 */
205}; 217};
206 218
207struct swap_list_t { 219struct swap_list_t {
@@ -209,15 +221,12 @@ struct swap_list_t {
209 int next; /* swapfile to be used next */ 221 int next; /* swapfile to be used next */
210}; 222};
211 223
212/* Swap 50% full? Release swapcache more aggressively.. */
213#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
214
215/* linux/mm/page_alloc.c */ 224/* linux/mm/page_alloc.c */
216extern unsigned long totalram_pages; 225extern unsigned long totalram_pages;
217extern unsigned long totalreserve_pages; 226extern unsigned long totalreserve_pages;
218extern unsigned long dirty_balance_reserve; 227extern unsigned long dirty_balance_reserve;
219extern unsigned int nr_free_buffer_pages(void); 228extern unsigned long nr_free_buffer_pages(void);
220extern unsigned int nr_free_pagecache_pages(void); 229extern unsigned long nr_free_pagecache_pages(void);
221 230
222/* Definition of global_page_state not available yet */ 231/* Definition of global_page_state not available yet */
223#define nr_free_pages() global_page_state(NR_FREE_PAGES) 232#define nr_free_pages() global_page_state(NR_FREE_PAGES)
@@ -266,7 +275,7 @@ extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
266extern unsigned long shrink_all_memory(unsigned long nr_pages); 275extern unsigned long shrink_all_memory(unsigned long nr_pages);
267extern int vm_swappiness; 276extern int vm_swappiness;
268extern int remove_mapping(struct address_space *mapping, struct page *page); 277extern int remove_mapping(struct address_space *mapping, struct page *page);
269extern long vm_total_pages; 278extern unsigned long vm_total_pages;
270 279
271#ifdef CONFIG_NUMA 280#ifdef CONFIG_NUMA
272extern int zone_reclaim_mode; 281extern int zone_reclaim_mode;
@@ -330,8 +339,9 @@ int generic_swapfile_activate(struct swap_info_struct *, struct file *,
330 sector_t *); 339 sector_t *);
331 340
332/* linux/mm/swap_state.c */ 341/* linux/mm/swap_state.c */
333extern struct address_space swapper_space; 342extern struct address_space swapper_spaces[];
334#define total_swapcache_pages swapper_space.nrpages 343#define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])
344extern unsigned long total_swapcache_pages(void);
335extern void show_swap_cache_info(void); 345extern void show_swap_cache_info(void);
336extern int add_to_swap(struct page *); 346extern int add_to_swap(struct page *);
337extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); 347extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
@@ -346,8 +356,20 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
346 struct vm_area_struct *vma, unsigned long addr); 356 struct vm_area_struct *vma, unsigned long addr);
347 357
348/* linux/mm/swapfile.c */ 358/* linux/mm/swapfile.c */
349extern long nr_swap_pages; 359extern atomic_long_t nr_swap_pages;
350extern long total_swap_pages; 360extern long total_swap_pages;
361
362/* Swap 50% full? Release swapcache more aggressively.. */
363static inline bool vm_swap_full(void)
364{
365 return atomic_long_read(&nr_swap_pages) * 2 < total_swap_pages;
366}
367
368static inline long get_nr_swap_pages(void)
369{
370 return atomic_long_read(&nr_swap_pages);
371}
372
351extern void si_swapinfo(struct sysinfo *); 373extern void si_swapinfo(struct sysinfo *);
352extern swp_entry_t get_swap_page(void); 374extern swp_entry_t get_swap_page(void);
353extern swp_entry_t get_swap_page_of_type(int); 375extern swp_entry_t get_swap_page_of_type(int);
@@ -380,9 +402,10 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
380 402
381#else /* CONFIG_SWAP */ 403#else /* CONFIG_SWAP */
382 404
383#define nr_swap_pages 0L 405#define get_nr_swap_pages() 0L
384#define total_swap_pages 0L 406#define total_swap_pages 0L
385#define total_swapcache_pages 0UL 407#define total_swapcache_pages() 0UL
408#define vm_swap_full() 0
386 409
387#define si_swapinfo(val) \ 410#define si_swapinfo(val) \
388 do { (val)->freeswap = (val)->totalswap = 0; } while (0) 411 do { (val)->freeswap = (val)->totalswap = 0; } while (0)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 071d62c214a6..2de42f9401d2 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -23,7 +23,7 @@ extern int swiotlb_force;
23#define IO_TLB_SHIFT 11 23#define IO_TLB_SHIFT 11
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swiotlb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs); 28extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
29 29
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 45e2db270255..313a8e0a6553 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -68,11 +68,11 @@ struct sigaltstack;
68#include <linux/types.h> 68#include <linux/types.h>
69#include <linux/aio_abi.h> 69#include <linux/aio_abi.h>
70#include <linux/capability.h> 70#include <linux/capability.h>
71#include <linux/signal.h>
71#include <linux/list.h> 72#include <linux/list.h>
72#include <linux/bug.h> 73#include <linux/bug.h>
73#include <linux/sem.h> 74#include <linux/sem.h>
74#include <asm/siginfo.h> 75#include <asm/siginfo.h>
75#include <asm/signal.h>
76#include <linux/unistd.h> 76#include <linux/unistd.h>
77#include <linux/quota.h> 77#include <linux/quota.h>
78#include <linux/key.h> 78#include <linux/key.h>
@@ -300,10 +300,8 @@ asmlinkage long sys_personality(unsigned int personality);
300asmlinkage long sys_sigpending(old_sigset_t __user *set); 300asmlinkage long sys_sigpending(old_sigset_t __user *set);
301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
302 old_sigset_t __user *oset); 302 old_sigset_t __user *oset);
303#ifdef CONFIG_GENERIC_SIGALTSTACK
304asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss, 303asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
305 struct sigaltstack __user *uoss); 304 struct sigaltstack __user *uoss);
306#endif
307 305
308asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 306asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
309asmlinkage long sys_setitimer(int which, 307asmlinkage long sys_setitimer(int which,
@@ -377,6 +375,27 @@ asmlinkage long sys_init_module(void __user *umod, unsigned long len,
377asmlinkage long sys_delete_module(const char __user *name_user, 375asmlinkage long sys_delete_module(const char __user *name_user,
378 unsigned int flags); 376 unsigned int flags);
379 377
378#ifdef CONFIG_OLD_SIGSUSPEND
379asmlinkage long sys_sigsuspend(old_sigset_t mask);
380#endif
381
382#ifdef CONFIG_OLD_SIGSUSPEND3
383asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
384#endif
385
386asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
387
388#ifdef CONFIG_OLD_SIGACTION
389asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
390 struct old_sigaction __user *);
391#endif
392
393#ifndef CONFIG_ODD_RT_SIGACTION
394asmlinkage long sys_rt_sigaction(int,
395 const struct sigaction __user *,
396 struct sigaction __user *,
397 size_t);
398#endif
380asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set, 399asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
381 sigset_t __user *oset, size_t sigsetsize); 400 sigset_t __user *oset, size_t sigsetsize);
382asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); 401asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fe82022478e7..f0bd7f90a90d 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -74,6 +74,8 @@ enum thermal_trend {
74 THERMAL_TREND_STABLE, /* temperature is stable */ 74 THERMAL_TREND_STABLE, /* temperature is stable */
75 THERMAL_TREND_RAISING, /* temperature is raising */ 75 THERMAL_TREND_RAISING, /* temperature is raising */
76 THERMAL_TREND_DROPPING, /* temperature is dropping */ 76 THERMAL_TREND_DROPPING, /* temperature is dropping */
77 THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */
78 THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */
77}; 79};
78 80
79/* Events supported by Thermal Netlink */ 81/* Events supported by Thermal Netlink */
@@ -121,6 +123,7 @@ struct thermal_zone_device_ops {
121 int (*set_trip_hyst) (struct thermal_zone_device *, int, 123 int (*set_trip_hyst) (struct thermal_zone_device *, int,
122 unsigned long); 124 unsigned long);
123 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 125 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
126 int (*set_emul_temp) (struct thermal_zone_device *, unsigned long);
124 int (*get_trend) (struct thermal_zone_device *, int, 127 int (*get_trend) (struct thermal_zone_device *, int,
125 enum thermal_trend *); 128 enum thermal_trend *);
126 int (*notify) (struct thermal_zone_device *, int, 129 int (*notify) (struct thermal_zone_device *, int,
@@ -163,6 +166,7 @@ struct thermal_zone_device {
163 int polling_delay; 166 int polling_delay;
164 int temperature; 167 int temperature;
165 int last_temperature; 168 int last_temperature;
169 int emul_temperature;
166 int passive; 170 int passive;
167 unsigned int forced_passive; 171 unsigned int forced_passive;
168 const struct thermal_zone_device_ops *ops; 172 const struct thermal_zone_device_ops *ops;
@@ -244,9 +248,11 @@ int thermal_register_governor(struct thermal_governor *);
244void thermal_unregister_governor(struct thermal_governor *); 248void thermal_unregister_governor(struct thermal_governor *);
245 249
246#ifdef CONFIG_NET 250#ifdef CONFIG_NET
247extern int thermal_generate_netlink_event(u32 orig, enum events event); 251extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
252 enum events event);
248#else 253#else
249static inline int thermal_generate_netlink_event(u32 orig, enum events event) 254static int thermal_generate_netlink_event(struct thermal_zone_device *tz,
255 enum events event)
250{ 256{
251 return 0; 257 return 0;
252} 258}
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b9bd2e6c73cc..4ce009324933 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -21,7 +21,7 @@ struct user_namespace {
21 struct uid_gid_map uid_map; 21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map; 22 struct uid_gid_map gid_map;
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 struct kref kref; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 kuid_t owner; 26 kuid_t owner;
27 kgid_t group; 27 kgid_t group;
@@ -35,18 +35,18 @@ extern struct user_namespace init_user_ns;
35static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 35static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
36{ 36{
37 if (ns) 37 if (ns)
38 kref_get(&ns->kref); 38 atomic_inc(&ns->count);
39 return ns; 39 return ns;
40} 40}
41 41
42extern int create_user_ns(struct cred *new); 42extern int create_user_ns(struct cred *new);
43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred); 43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred);
44extern void free_user_ns(struct kref *kref); 44extern void free_user_ns(struct user_namespace *ns);
45 45
46static inline void put_user_ns(struct user_namespace *ns) 46static inline void put_user_ns(struct user_namespace *ns)
47{ 47{
48 if (ns) 48 if (ns && atomic_dec_and_test(&ns->count))
49 kref_put(&ns->kref, free_user_ns); 49 free_user_ns(ns);
50} 50}
51 51
52struct seq_operations; 52struct seq_operations;
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index c52215ff4245..75818744ab59 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -27,6 +27,14 @@
27#define VEXPRESS_GPIO_MMC_CARDIN 0 27#define VEXPRESS_GPIO_MMC_CARDIN 0
28#define VEXPRESS_GPIO_MMC_WPROT 1 28#define VEXPRESS_GPIO_MMC_WPROT 1
29#define VEXPRESS_GPIO_FLASH_WPn 2 29#define VEXPRESS_GPIO_FLASH_WPn 2
30#define VEXPRESS_GPIO_LED0 3
31#define VEXPRESS_GPIO_LED1 4
32#define VEXPRESS_GPIO_LED2 5
33#define VEXPRESS_GPIO_LED3 6
34#define VEXPRESS_GPIO_LED4 7
35#define VEXPRESS_GPIO_LED5 8
36#define VEXPRESS_GPIO_LED6 9
37#define VEXPRESS_GPIO_LED7 10
30 38
31#define VEXPRESS_RES_FUNC(_site, _func) \ 39#define VEXPRESS_RES_FUNC(_site, _func) \
32{ \ 40{ \
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index cf8adb1f5b2c..ff6714e6d0f5 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -78,7 +78,7 @@ struct virtio_device {
78 int index; 78 int index;
79 struct device dev; 79 struct device dev;
80 struct virtio_device_id id; 80 struct virtio_device_id id;
81 struct virtio_config_ops *config; 81 const struct virtio_config_ops *config;
82 struct list_head vqs; 82 struct list_head vqs;
83 /* Note that this is a Linux set_bit-style bitmap. */ 83 /* Note that this is a Linux set_bit-style bitmap. */
84 unsigned long features[1]; 84 unsigned long features[1];
@@ -126,4 +126,13 @@ static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
126 126
127int register_virtio_driver(struct virtio_driver *drv); 127int register_virtio_driver(struct virtio_driver *drv);
128void unregister_virtio_driver(struct virtio_driver *drv); 128void unregister_virtio_driver(struct virtio_driver *drv);
129
130/* module_virtio_driver() - Helper macro for drivers that don't do
131 * anything special in module init/exit. This eliminates a lot of
132 * boilerplate. Each module may only use this macro once, and
133 * calling it replaces module_init() and module_exit()
134 */
135#define module_virtio_driver(__virtio_driver) \
136 module_driver(__virtio_driver, register_virtio_driver, \
137 unregister_virtio_driver)
129#endif /* _LINUX_VIRTIO_H */ 138#endif /* _LINUX_VIRTIO_H */
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index fce0a2799d43..bd6cf61142be 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -36,7 +36,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36#endif 36#endif
37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, 37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 KSWAPD_SKIP_CONGESTION_WAIT,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 39 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_NUMA_BALANCING 40#ifdef CONFIG_NUMA_BALANCING
42 NUMA_PTE_UPDATES, 41 NUMA_PTE_UPDATES,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index a13291f7da88..5fd71a7d0dfd 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -85,7 +85,7 @@ static inline void vm_events_fold_cpu(int cpu)
85#define count_vm_numa_events(x, y) count_vm_events(x, y) 85#define count_vm_numa_events(x, y) count_vm_events(x, y)
86#else 86#else
87#define count_vm_numa_event(x) do {} while (0) 87#define count_vm_numa_event(x) do {} while (0)
88#define count_vm_numa_events(x, y) do {} while (0) 88#define count_vm_numa_events(x, y) do { (void)(y); } while (0)
89#endif /* CONFIG_NUMA_BALANCING */ 89#endif /* CONFIG_NUMA_BALANCING */
90 90
91#define __count_zone_vm_events(item, zone, delta) \ 91#define __count_zone_vm_events(item, zone, delta) \
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 50ae7d0c279e..e8d65718560b 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -47,6 +47,7 @@ int con_set_cmap(unsigned char __user *cmap);
47int con_get_cmap(unsigned char __user *cmap); 47int con_get_cmap(unsigned char __user *cmap);
48void scrollback(struct vc_data *vc, int lines); 48void scrollback(struct vc_data *vc, int lines);
49void scrollfront(struct vc_data *vc, int lines); 49void scrollfront(struct vc_data *vc, int lines);
50void clear_buffer_attributes(struct vc_data *vc);
50void update_region(struct vc_data *vc, unsigned long start, int count); 51void update_region(struct vc_data *vc, unsigned long start, int count);
51void redraw_screen(struct vc_data *vc, int is_switch); 52void redraw_screen(struct vc_data *vc, int is_switch);
52#define update_screen(x) redraw_screen(x, 0) 53#define update_screen(x) redraw_screen(x, 0)
@@ -130,6 +131,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
130int vt_waitactive(int n); 131int vt_waitactive(int n);
131void change_console(struct vc_data *new_vc); 132void change_console(struct vc_data *new_vc);
132void 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,
135 int deflt);
133extern int unbind_con_driver(const struct consw *csw, int first, int last, 136extern int unbind_con_driver(const struct consw *csw, int first, int last,
134 int deflt); 137 int deflt);
135int vty_init(const struct file_operations *console_fops); 138int vty_init(const struct file_operations *console_fops);
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 3a9df2f43be6..2a3038ee17a3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -118,6 +118,13 @@ static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool noway
118 set_bit(WDOG_NO_WAY_OUT, &wdd->status); 118 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
119} 119}
120 120
121/* Use the following function to check if a timeout value is invalid */
122static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t)
123{
124 return ((wdd->max_timeout != 0) &&
125 (t < wdd->min_timeout || t > wdd->max_timeout));
126}
127
121/* Use the following functions to manipulate watchdog driver specific data */ 128/* Use the following functions to manipulate watchdog driver specific data */
122static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 129static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
123{ 130{
@@ -130,6 +137,8 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
130} 137}
131 138
132/* drivers/watchdog/watchdog_core.c */ 139/* drivers/watchdog/watchdog_core.c */
140extern int watchdog_init_timeout(struct watchdog_device *wdd,
141 unsigned int timeout_parm, struct device *dev);
133extern int watchdog_register_device(struct watchdog_device *); 142extern int watchdog_register_device(struct watchdog_device *);
134extern void watchdog_unregister_device(struct watchdog_device *); 143extern void watchdog_unregister_device(struct watchdog_device *);
135 144
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b82a83aba311..9a9367c0c076 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -87,9 +87,9 @@ int inode_wait(void *);
87void writeback_inodes_sb(struct super_block *, enum wb_reason reason); 87void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
88void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 88void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
89 enum wb_reason reason); 89 enum wb_reason reason);
90int writeback_inodes_sb_if_idle(struct super_block *, enum wb_reason reason); 90int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason);
91int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr, 91int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
92 enum wb_reason reason); 92 enum wb_reason reason);
93void sync_inodes_sb(struct super_block *); 93void sync_inodes_sb(struct super_block *);
94long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, 94long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
95 enum wb_reason reason); 95 enum wb_reason reason);