aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/platform/aclinux.h10
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-generic/Kbuild9
-rw-r--r--include/asm-generic/Kbuild.asm67
-rw-r--r--include/asm-generic/atomic.h12
-rw-r--r--include/asm-generic/dma-mapping-broken.h3
-rw-r--r--include/asm-generic/fcntl.h12
-rw-r--r--include/asm-generic/io.h4
-rw-r--r--include/asm-generic/ioctls.h8
-rw-r--r--include/asm-generic/statfs.h9
-rw-r--r--include/asm-generic/syscalls.h6
-rw-r--r--include/asm-generic/termbits.h1
-rw-r--r--include/asm-generic/topology.h20
-rw-r--r--include/asm-generic/unistd.h8
-rw-r--r--include/drm/Kbuild26
-rw-r--r--include/drm/drmP.h22
-rw-r--r--include/drm/drm_core.h2
-rw-r--r--include/drm/drm_crtc.h37
-rw-r--r--include/drm/drm_edid.h6
-rw-r--r--include/linux/Kbuild468
-rw-r--r--include/linux/amba/clcd.h1
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/auto_fs.h1
-rw-r--r--include/linux/backing-dev.h24
-rw-r--r--include/linux/binfmts.h7
-rw-r--r--include/linux/bio.h158
-rw-r--r--include/linux/blk_types.h196
-rw-r--r--include/linux/blkdev.h149
-rw-r--r--include/linux/blktrace_api.h18
-rw-r--r--include/linux/buffer_head.h31
-rw-r--r--include/linux/byteorder/Kbuild4
-rw-r--r--include/linux/coda_psdev.h8
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/compiler-gcc.h3
-rw-r--r--include/linux/console_struct.h4
-rw-r--r--include/linux/cper.h8
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/device-mapper.h16
-rw-r--r--include/linux/dm-ioctl.h5
-rw-r--r--include/linux/dma-mapping.h10
-rw-r--r--include/linux/dmaengine.h71
-rw-r--r--include/linux/dnotify.h1
-rw-r--r--include/linux/drbd.h2
-rw-r--r--include/linux/drbd_nl.h9
-rw-r--r--include/linux/dvb/Kbuild7
-rw-r--r--include/linux/etherdevice.h2
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fanotify.h105
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/flex_array.h5
-rw-r--r--include/linux/fs.h156
-rw-r--r--include/linux/fs_struct.h29
-rw-r--r--include/linux/fsnotify.h166
-rw-r--r--include/linux/fsnotify_backend.h199
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/highmem.h14
-rw-r--r--include/linux/hugetlb.h14
-rw-r--r--include/linux/hugetlb_inline.h22
-rw-r--r--include/linux/i2c-mux.h46
-rw-r--r--include/linux/i2c.h35
-rw-r--r--include/linux/i2c/ltc4245.h21
-rw-r--r--include/linux/i2c/pca954x.h47
-rw-r--r--include/linux/i2c/sx150x.h78
-rw-r--r--include/linux/inotify.h185
-rw-r--r--include/linux/input.h53
-rw-r--r--include/linux/intel_mid_dma.h86
-rw-r--r--include/linux/io-mapping.h3
-rw-r--r--include/linux/iommu-helper.h12
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/jffs2.h3
-rw-r--r--include/linux/jz4740-adc.h32
-rw-r--r--include/linux/kernel.h21
-rw-r--r--include/linux/kfifo.h1195
-rw-r--r--include/linux/ksm.h2
-rw-r--r--include/linux/lglock.h172
-rw-r--r--include/linux/mbcache.h20
-rw-r--r--include/linux/memcontrol.h18
-rw-r--r--include/linux/mempolicy.h13
-rw-r--r--include/linux/mfd/ab8500.h6
-rw-r--r--include/linux/mfd/max8998-private.h112
-rw-r--r--include/linux/mfd/max8998.h78
-rw-r--r--include/linux/mfd/mc13783-private.h220
-rw-r--r--include/linux/mfd/mc13783.h2
-rw-r--r--include/linux/mfd/stmpe.h201
-rw-r--r--include/linux/mfd/tps6586x.h47
-rw-r--r--include/linux/mfd/wm8994/gpio.h4
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mm_types.h2
-rw-r--r--include/linux/mmc/card.h24
-rw-r--r--include/linux/mmc/core.h19
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/mmc/mmc.h25
-rw-r--r--include/linux/mmc/sd.h5
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmzone.h17
-rw-r--r--include/linux/moduleparam.h288
-rw-r--r--include/linux/mount.h7
-rw-r--r--include/linux/mtd/bbm.h24
-rw-r--r--include/linux/mtd/blktrans.h16
-rw-r--r--include/linux/mtd/cfi.h20
-rw-r--r--include/linux/mtd/cfi_endian.h19
-rw-r--r--include/linux/mtd/compatmac.h10
-rw-r--r--include/linux/mtd/concat.h17
-rw-r--r--include/linux/mtd/doc2000.h23
-rw-r--r--include/linux/mtd/flashchip.h21
-rw-r--r--include/linux/mtd/gen_probe.h19
-rw-r--r--include/linux/mtd/map.h19
-rw-r--r--include/linux/mtd/mtd.h19
-rw-r--r--include/linux/mtd/nand.h8
-rw-r--r--include/linux/mtd/nand_ecc.h4
-rw-r--r--include/linux/mtd/nftl.h17
-rw-r--r--include/linux/mtd/onenand.h2
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/netfilter/Kbuild19
-rw-r--r--include/linux/netfilter_arp/Kbuild3
-rw-r--r--include/linux/netfilter_bridge/Kbuild5
-rw-r--r--include/linux/netfilter_ipv4/Kbuild5
-rw-r--r--include/linux/netfilter_ipv6/Kbuild5
-rw-r--r--include/linux/netpoll.h2
-rw-r--r--include/linux/nfsd/Kbuild12
-rw-r--r--include/linux/of_device.h16
-rw-r--r--include/linux/of_platform.h14
-rw-r--r--include/linux/oom.h33
-rw-r--r--include/linux/pagemap.h13
-rw-r--r--include/linux/path.h5
-rw-r--r--include/linux/pch_dma.h37
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu_counter.h11
-rw-r--r--include/linux/poison.h9
-rw-r--r--include/linux/posix-timers.h2
-rw-r--r--include/linux/ppp_channel.h2
-rw-r--r--include/linux/radix-tree.h6
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/regulator/ab8500.h25
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/resource.h9
-rw-r--r--include/linux/rmap.h41
-rw-r--r--include/linux/s3c_adc_battery.h36
-rw-r--r--include/linux/sched.h7
-rw-r--r--include/linux/security.h10
-rw-r--r--include/linux/serial.h9
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h14
-rw-r--r--include/linux/serial_mfd.h47
-rw-r--r--include/linux/serial_reg.h16
-rw-r--r--include/linux/sh_clk.h23
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/slab_def.h4
-rw-r--r--include/linux/slob_def.h4
-rw-r--r--include/linux/slub_def.h8
-rw-r--r--include/linux/spi/max7301.h8
-rw-r--r--include/linux/spi/spi.h15
-rw-r--r--include/linux/spi/spi_gpio.h5
-rw-r--r--include/linux/statfs.h25
-rw-r--r--include/linux/sunrpc/Kbuild2
-rw-r--r--include/linux/swap.h11
-rw-r--r--include/linux/syscalls.h30
-rw-r--r--include/linux/sysv_fs.h11
-rw-r--r--include/linux/time.h4
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/tty.h61
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/ehci_def.h23
-rw-r--r--include/linux/usb/functionfs.h6
-rw-r--r--include/linux/usb/hcd.h31
-rw-r--r--include/linux/usb/otg.h11
-rw-r--r--include/linux/usb/quirks.h4
-rw-r--r--include/linux/usb/ulpi.h40
-rw-r--r--include/linux/vgaarb.h1
-rw-r--r--include/linux/videodev2.h1
-rw-r--r--include/linux/virtio_9p.h1
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/vt_kern.h64
-rw-r--r--include/linux/wm97xx_batt.h16
-rw-r--r--include/linux/writeback.h5
-rw-r--r--include/media/cx2341x.h97
-rw-r--r--include/media/cx25840.h87
-rw-r--r--include/media/ir-core.h41
-rw-r--r--include/media/lirc.h5
-rw-r--r--include/media/rc-map.h1
-rw-r--r--include/media/v4l2-ctrls.h460
-rw-r--r--include/media/v4l2-dev.h4
-rw-r--r--include/media/v4l2-device.h4
-rw-r--r--include/media/v4l2-subdev.h54
-rw-r--r--include/mtd/mtd-abi.h18
-rw-r--r--include/mtd/mtd-user.h17
-rw-r--r--include/mtd/nftl-user.h16
-rw-r--r--include/mtd/ubi-user.h2
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bluetooth/l2cap.h4
-rw-r--r--include/net/sock.h4
-rw-r--r--include/scsi/scsi.h8
-rw-r--r--include/scsi/scsi_netlink.h4
-rw-r--r--include/sound/Kbuild9
-rw-r--r--include/sound/emu10k1.h1
-rw-r--r--include/trace/events/block.h15
-rw-r--r--include/trace/events/gfpflags.h37
-rw-r--r--include/trace/events/kmem.h38
-rw-r--r--include/trace/events/vmscan.h275
-rw-r--r--include/trace/events/workqueue.h62
-rw-r--r--include/trace/events/writeback.h159
-rw-r--r--include/video/Kbuild5
-rw-r--r--include/video/mipi_display.h130
-rw-r--r--include/video/sh_mipi_dsi.h35
-rw-r--r--include/video/sh_mobile_hdmi.h22
-rw-r--r--include/video/sh_mobile_lcdc.h41
-rw-r--r--include/xen/interface/memory.h50
-rw-r--r--include/xen/swiotlb-xen.h65
-rw-r--r--include/xen/xen-ops.h6
215 files changed, 5891 insertions, 2303 deletions
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 81d4f3d4b9fd..c0786d446a00 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -66,7 +66,7 @@ extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_use_default_register_widths; 66extern u8 acpi_gbl_use_default_register_widths;
67extern acpi_name acpi_gbl_trace_method_name; 67extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags; 68extern u32 acpi_gbl_trace_flags;
69extern u8 acpi_gbl_enable_aml_debug_object; 69extern u32 acpi_gbl_enable_aml_debug_object;
70extern u8 acpi_gbl_copy_dsdt_locally; 70extern u8 acpi_gbl_copy_dsdt_locally;
71extern u8 acpi_gbl_truncate_io_addresses; 71extern u8 acpi_gbl_truncate_io_addresses;
72 72
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e5039a2856f8..103f08aca764 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -148,13 +148,17 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
149#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
150 150
151/* Used within ACPICA to show where it is safe to preempt execution */ 151#ifndef CONFIG_PREEMPT
152#include <linux/hardirq.h> 152/*
153 * Used within ACPICA to show where it is safe to preempt execution
154 * when CONFIG_PREEMPT=n
155 */
153#define ACPI_PREEMPTION_POINT() \ 156#define ACPI_PREEMPTION_POINT() \
154 do { \ 157 do { \
155 if (!in_atomic_preempt_off() && !irqs_disabled()) \ 158 if (!irqs_disabled()) \
156 cond_resched(); \ 159 cond_resched(); \
157 } while (0) 160 } while (0)
161#endif
158 162
159#endif /* __KERNEL__ */ 163#endif /* __KERNEL__ */
160 164
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index a68ca8a11a53..1b62102fbb67 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -338,7 +338,6 @@ extern struct cpuidle_driver acpi_idle_driver;
338 338
339/* in processor_thermal.c */ 339/* in processor_thermal.c */
340int acpi_processor_get_limit_info(struct acpi_processor *pr); 340int acpi_processor_get_limit_info(struct acpi_processor *pr);
341extern const struct file_operations acpi_processor_limit_fops;
342extern struct thermal_cooling_device_ops processor_cooling_ops; 341extern struct thermal_cooling_device_ops processor_cooling_ops;
343#ifdef CONFIG_CPU_FREQ 342#ifdef CONFIG_CPU_FREQ
344void acpi_thermal_cpufreq_init(void); 343void acpi_thermal_cpufreq_init(void);
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index eb62334cda29..53f91b1ae53a 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -3,6 +3,8 @@ header-y += bitsperlong.h
3header-y += errno-base.h 3header-y += errno-base.h
4header-y += errno.h 4header-y += errno.h
5header-y += fcntl.h 5header-y += fcntl.h
6header-y += int-l64.h
7header-y += int-ll64.h
6header-y += ioctl.h 8header-y += ioctl.h
7header-y += ioctls.h 9header-y += ioctls.h
8header-y += ipcbuf.h 10header-y += ipcbuf.h
@@ -12,10 +14,12 @@ header-y += msgbuf.h
12header-y += param.h 14header-y += param.h
13header-y += poll.h 15header-y += poll.h
14header-y += posix_types.h 16header-y += posix_types.h
17header-y += resource.h
15header-y += sembuf.h 18header-y += sembuf.h
16header-y += setup.h 19header-y += setup.h
17header-y += shmbuf.h 20header-y += shmbuf.h
18header-y += shmparam.h 21header-y += shmparam.h
22header-y += siginfo.h
19header-y += signal-defs.h 23header-y += signal-defs.h
20header-y += signal.h 24header-y += signal.h
21header-y += socket.h 25header-y += socket.h
@@ -28,8 +32,3 @@ header-y += termios.h
28header-y += types.h 32header-y += types.h
29header-y += ucontext.h 33header-y += ucontext.h
30header-y += unistd.h 34header-y += unistd.h
31
32unifdef-y += int-l64.h
33unifdef-y += int-ll64.h
34unifdef-y += resource.h
35unifdef-y += siginfo.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 96d7c9804dc1..c5d2e5dd871b 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,5 +1,5 @@
1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ 1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
3header-y += kvm.h 3header-y += kvm.h
4endif 4endif
5 5
@@ -9,36 +9,37 @@ header-y += kvm_para.h
9endif 9endif
10 10
11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
13unifdef-y += a.out.h 13header-y += a.out.h
14endif 14endif
15unifdef-y += auxvec.h 15
16unifdef-y += byteorder.h 16header-y += auxvec.h
17unifdef-y += bitsperlong.h 17header-y += bitsperlong.h
18unifdef-y += errno.h 18header-y += byteorder.h
19unifdef-y += fcntl.h 19header-y += errno.h
20unifdef-y += ioctl.h 20header-y += fcntl.h
21unifdef-y += ioctls.h 21header-y += ioctl.h
22unifdef-y += ipcbuf.h 22header-y += ioctls.h
23unifdef-y += mman.h 23header-y += ipcbuf.h
24unifdef-y += msgbuf.h 24header-y += mman.h
25unifdef-y += param.h 25header-y += msgbuf.h
26unifdef-y += poll.h 26header-y += param.h
27unifdef-y += posix_types.h 27header-y += poll.h
28unifdef-y += ptrace.h 28header-y += posix_types.h
29unifdef-y += resource.h 29header-y += ptrace.h
30unifdef-y += sembuf.h 30header-y += resource.h
31unifdef-y += setup.h 31header-y += sembuf.h
32unifdef-y += shmbuf.h 32header-y += setup.h
33unifdef-y += sigcontext.h 33header-y += shmbuf.h
34unifdef-y += siginfo.h 34header-y += sigcontext.h
35unifdef-y += signal.h 35header-y += siginfo.h
36unifdef-y += socket.h 36header-y += signal.h
37unifdef-y += sockios.h 37header-y += socket.h
38unifdef-y += stat.h 38header-y += sockios.h
39unifdef-y += statfs.h 39header-y += stat.h
40unifdef-y += swab.h 40header-y += statfs.h
41unifdef-y += termbits.h 41header-y += swab.h
42unifdef-y += termios.h 42header-y += termbits.h
43unifdef-y += types.h 43header-y += termios.h
44unifdef-y += unistd.h 44header-y += types.h
45header-y += unistd.h
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 058129e9b04c..e53347fbf1da 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -57,11 +57,11 @@ static inline int atomic_add_return(int i, atomic_t *v)
57 unsigned long flags; 57 unsigned long flags;
58 int temp; 58 int temp;
59 59
60 local_irq_save(flags); 60 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
61 temp = v->counter; 61 temp = v->counter;
62 temp += i; 62 temp += i;
63 v->counter = temp; 63 v->counter = temp;
64 local_irq_restore(flags); 64 raw_local_irq_restore(flags);
65 65
66 return temp; 66 return temp;
67} 67}
@@ -78,11 +78,11 @@ static inline int atomic_sub_return(int i, atomic_t *v)
78 unsigned long flags; 78 unsigned long flags;
79 int temp; 79 int temp;
80 80
81 local_irq_save(flags); 81 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
82 temp = v->counter; 82 temp = v->counter;
83 temp -= i; 83 temp -= i;
84 v->counter = temp; 84 v->counter = temp;
85 local_irq_restore(flags); 85 raw_local_irq_restore(flags);
86 86
87 return temp; 87 return temp;
88} 88}
@@ -135,9 +135,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
135 unsigned long flags; 135 unsigned long flags;
136 136
137 mask = ~mask; 137 mask = ~mask;
138 local_irq_save(flags); 138 raw_local_irq_save(flags); /* Don't trace it in a irqsoff handler */
139 *addr &= mask; 139 *addr &= mask;
140 local_irq_restore(flags); 140 raw_local_irq_restore(flags);
141} 141}
142 142
143#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) 143#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index 82cd0cb1c3fe..ccf7b4f34a3c 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -72,9 +72,6 @@ dma_set_mask(struct device *dev, u64 mask);
72extern int 72extern int
73dma_get_cache_alignment(void); 73dma_get_cache_alignment(void);
74 74
75extern int
76dma_is_consistent(struct device *dev, dma_addr_t dma_handle);
77
78extern void 75extern void
79dma_cache_sync(struct device *dev, void *vaddr, size_t size, 76dma_cache_sync(struct device *dev, void *vaddr, size_t size,
80 enum dma_data_direction direction); 77 enum dma_data_direction direction);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index fcd268ce0674..a70b2d2bfc14 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -3,6 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6/*
7 * FMODE_EXEC is 0x20
8 * FMODE_NONOTIFY is 0x1000000
9 * These cannot be used by userspace O_* until internal and external open
10 * flags are split.
11 * -Eric Paris
12 */
13
14/*
15 * When introducing new O_* bits, please check its uniqueness in fcntl_init().
16 */
17
6#define O_ACCMODE 00000003 18#define O_ACCMODE 00000003
7#define O_RDONLY 00000000 19#define O_RDONLY 00000000
8#define O_WRONLY 00000001 20#define O_WRONLY 00000001
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index bcee6365dca0..118601fce92d 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -188,11 +188,15 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
188#ifndef CONFIG_GENERIC_IOMAP 188#ifndef CONFIG_GENERIC_IOMAP
189#define ioread8(addr) readb(addr) 189#define ioread8(addr) readb(addr)
190#define ioread16(addr) readw(addr) 190#define ioread16(addr) readw(addr)
191#define ioread16be(addr) be16_to_cpu(ioread16(addr))
191#define ioread32(addr) readl(addr) 192#define ioread32(addr) readl(addr)
193#define ioread32be(addr) be32_to_cpu(ioread32(addr))
192 194
193#define iowrite8(v, addr) writeb((v), (addr)) 195#define iowrite8(v, addr) writeb((v), (addr))
194#define iowrite16(v, addr) writew((v), (addr)) 196#define iowrite16(v, addr) writew((v), (addr))
197#define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr))
195#define iowrite32(v, addr) writel((v), (addr)) 198#define iowrite32(v, addr) writel((v), (addr))
199#define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr))
196 200
197#define ioread8_rep(p, dst, count) \ 201#define ioread8_rep(p, dst, count) \
198 insb((unsigned long) (p), (dst), (count)) 202 insb((unsigned long) (p), (dst), (count))
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a799e20a769e..8554cb6a81b9 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -69,6 +69,7 @@
69#define TCSETX 0x5433 69#define TCSETX 0x5433
70#define TCSETXF 0x5434 70#define TCSETXF 0x5434
71#define TCSETXW 0x5435 71#define TCSETXW 0x5435
72#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
72 73
73#define FIONCLEX 0x5450 74#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451 75#define FIOCLEX 0x5451
@@ -87,12 +88,10 @@
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 88#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88 89
89/* 90/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for 91 * Some arches already define FIOQSIZE due to a historical
91 * TIOCGHAYESESP on others 92 * conflict with a Hayes modem-specific ioctl value.
92 */ 93 */
93#ifndef FIOQSIZE 94#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460 95# define FIOQSIZE 0x5460
97#endif 96#endif
98 97
@@ -104,6 +103,7 @@
104#define TIOCPKT_START 8 103#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16 104#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32 105#define TIOCPKT_DOSTOP 32
106#define TIOCPKT_IOCTL 64
107 107
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109 109
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 3b4fb3e52f0d..0fd28e028de1 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -33,7 +33,8 @@ struct statfs {
33 __kernel_fsid_t f_fsid; 33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen; 34 __statfs_word f_namelen;
35 __statfs_word f_frsize; 35 __statfs_word f_frsize;
36 __statfs_word f_spare[5]; 36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
37}; 38};
38 39
39/* 40/*
@@ -55,7 +56,8 @@ struct statfs64 {
55 __kernel_fsid_t f_fsid; 56 __kernel_fsid_t f_fsid;
56 __statfs_word f_namelen; 57 __statfs_word f_namelen;
57 __statfs_word f_frsize; 58 __statfs_word f_frsize;
58 __statfs_word f_spare[5]; 59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
59} ARCH_PACK_STATFS64; 61} ARCH_PACK_STATFS64;
60 62
61/* 63/*
@@ -77,7 +79,8 @@ struct compat_statfs64 {
77 __kernel_fsid_t f_fsid; 79 __kernel_fsid_t f_fsid;
78 __u32 f_namelen; 80 __u32 f_namelen;
79 __u32 f_frsize; 81 __u32 f_frsize;
80 __u32 f_spare[5]; 82 __u32 f_flags;
83 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64; 84} ARCH_PACK_COMPAT_STATFS64;
82 85
83#endif 86#endif
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index df84e3b04555..d89dec864d42 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -23,8 +23,10 @@ asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif 23#endif
24 24
25#ifndef sys_execve 25#ifndef sys_execve
26asmlinkage long sys_execve(char __user *filename, char __user * __user *argv, 26asmlinkage long sys_execve(const char __user *filename,
27 char __user * __user *envp, struct pt_regs *regs); 27 const char __user *const __user *argv,
28 const char __user *const __user *envp,
29 struct pt_regs *regs);
28#endif 30#endif
29 31
30#ifndef sys_mmap2 32#ifndef sys_mmap2
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
index 1c9773d48cb0..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/asm-generic/termbits.h
@@ -178,6 +178,7 @@ struct ktermios {
178#define FLUSHO 0010000 178#define FLUSHO 0010000
179#define PENDIN 0040000 179#define PENDIN 0040000
180#define IEXTEN 0100000 180#define IEXTEN 0100000
181#define EXTPROC 0200000
181 182
182/* tcflow() and TCXONC use these */ 183/* tcflow() and TCXONC use these */
183#define TCOOFF 0 184#define TCOOFF 0
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index fd60700503c8..fc824e2828f3 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2002, IBM Corp. 6 * Copyright (C) 2002, IBM Corp.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -34,9 +34,16 @@
34#ifndef cpu_to_node 34#ifndef cpu_to_node
35#define cpu_to_node(cpu) ((void)(cpu),0) 35#define cpu_to_node(cpu) ((void)(cpu),0)
36#endif 36#endif
37#ifndef set_numa_node
38#define set_numa_node(node)
39#endif
40#ifndef set_cpu_numa_node
41#define set_cpu_numa_node(cpu, node)
42#endif
37#ifndef cpu_to_mem 43#ifndef cpu_to_mem
38#define cpu_to_mem(cpu) ((void)(cpu),0) 44#define cpu_to_mem(cpu) ((void)(cpu),0)
39#endif 45#endif
46
40#ifndef parent_node 47#ifndef parent_node
41#define parent_node(node) ((void)(node),0) 48#define parent_node(node) ((void)(node),0)
42#endif 49#endif
@@ -55,4 +62,15 @@
55 62
56#endif /* CONFIG_NUMA */ 63#endif /* CONFIG_NUMA */
57 64
65#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES)
66
67#ifndef set_numa_mem
68#define set_numa_mem(node)
69#endif
70#ifndef set_cpu_numa_mem
71#define set_cpu_numa_mem(cpu, node)
72#endif
73
74#endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */
75
58#endif /* _ASM_GENERIC_TOPOLOGY_H */ 76#endif /* _ASM_GENERIC_TOPOLOGY_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index c17cebc49952..b969770196c2 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -640,9 +640,15 @@ __SYSCALL(__NR_recvmmsg, sys_recvmmsg)
640 640
641#define __NR_wait4 260 641#define __NR_wait4 260
642__SYSCALL(__NR_wait4, sys_wait4) 642__SYSCALL(__NR_wait4, sys_wait4)
643#define __NR_prlimit64 261
644__SYSCALL(__NR_prlimit64, sys_prlimit64)
645#define __NR_fanotify_init 262
646__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
647#define __NR_fanotify_mark 263
648__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
643 649
644#undef __NR_syscalls 650#undef __NR_syscalls
645#define __NR_syscalls 261 651#define __NR_syscalls 264
646 652
647/* 653/*
648 * All syscalls below here should go away really, 654 * All syscalls below here should go away really,
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index bd3a1c2fbdb4..ffec177f3481 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,12 +1,14 @@
1unifdef-y += drm.h drm_sarea.h drm_mode.h 1header-y += drm.h
2unifdef-y += i810_drm.h 2header-y += drm_mode.h
3unifdef-y += i830_drm.h 3header-y += drm_sarea.h
4unifdef-y += i915_drm.h 4header-y += i810_drm.h
5unifdef-y += mga_drm.h 5header-y += i830_drm.h
6unifdef-y += r128_drm.h 6header-y += i915_drm.h
7unifdef-y += radeon_drm.h 7header-y += mga_drm.h
8unifdef-y += sis_drm.h 8header-y += nouveau_drm.h
9unifdef-y += savage_drm.h 9header-y += r128_drm.h
10unifdef-y += vmwgfx_drm.h 10header-y += radeon_drm.h
11unifdef-y += via_drm.h 11header-y += savage_drm.h
12unifdef-y += nouveau_drm.h 12header-y += sis_drm.h
13header-y += via_drm.h
14header-y += vmwgfx_drm.h
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e2a4da7d7fab..2a512bc0d4ab 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1075,7 +1075,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1075 return ((dev->driver->driver_features & feature) ? 1 : 0); 1075 return ((dev->driver->driver_features & feature) ? 1 : 0);
1076} 1076}
1077 1077
1078
1079static inline int drm_dev_to_irq(struct drm_device *dev) 1078static inline int drm_dev_to_irq(struct drm_device *dev)
1080{ 1079{
1081 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1080 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
@@ -1084,11 +1083,22 @@ static inline int drm_dev_to_irq(struct drm_device *dev)
1084 return dev->pdev->irq; 1083 return dev->pdev->irq;
1085} 1084}
1086 1085
1087#ifdef __alpha__ 1086static inline int drm_get_pci_domain(struct drm_device *dev)
1088#define drm_get_pci_domain(dev) dev->hose->index 1087{
1089#else 1088 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1090#define drm_get_pci_domain(dev) 0 1089 return 0;
1091#endif 1090
1091#ifndef __alpha__
1092 /* For historical reasons, drm_get_pci_domain() is busticated
1093 * on most archs and has to remain so for userspace interface
1094 * < 1.4, except on alpha which was right from the beginning
1095 */
1096 if (dev->if_version < 0x10004)
1097 return 0;
1098#endif /* __alpha__ */
1099
1100 return pci_domain_nr(dev->pdev->bus);
1101}
1092 1102
1093#if __OS_HAS_AGP 1103#if __OS_HAS_AGP
1094static inline int drm_core_has_AGP(struct drm_device *dev) 1104static inline int drm_core_has_AGP(struct drm_device *dev)
diff --git a/include/drm/drm_core.h b/include/drm/drm_core.h
index 316739036079..4e7523863a4b 100644
--- a/include/drm/drm_core.h
+++ b/include/drm/drm_core.h
@@ -27,7 +27,7 @@
27#define CORE_DATE "20060810" 27#define CORE_DATE "20060810"
28 28
29#define DRM_IF_MAJOR 1 29#define DRM_IF_MAJOR 1
30#define DRM_IF_MINOR 3 30#define DRM_IF_MINOR 4
31 31
32#define CORE_MAJOR 1 32#define CORE_MAJOR 1
33#define CORE_MINOR 1 33#define CORE_MINOR 1
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c707270bff5a..c9f3cc5949a8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -189,49 +189,16 @@ enum subpixel_order {
189 */ 189 */
190struct drm_display_info { 190struct drm_display_info {
191 char name[DRM_DISPLAY_INFO_LEN]; 191 char name[DRM_DISPLAY_INFO_LEN];
192 /* Input info */ 192
193 bool serration_vsync;
194 bool sync_on_green;
195 bool composite_sync;
196 bool separate_syncs;
197 bool blank_to_black;
198 unsigned char video_level;
199 bool digital;
200 /* Physical size */ 193 /* Physical size */
201 unsigned int width_mm; 194 unsigned int width_mm;
202 unsigned int height_mm; 195 unsigned int height_mm;
203 196
204 /* Display parameters */
205 unsigned char gamma; /* FIXME: storage format */
206 bool gtf_supported;
207 bool standard_color;
208 enum {
209 monochrome = 0,
210 rgb,
211 other,
212 unknown,
213 } display_type;
214 bool active_off_supported;
215 bool suspend_supported;
216 bool standby_supported;
217
218 /* Color info FIXME: storage format */
219 unsigned short redx, redy;
220 unsigned short greenx, greeny;
221 unsigned short bluex, bluey;
222 unsigned short whitex, whitey;
223
224 /* Clock limits FIXME: storage format */ 197 /* Clock limits FIXME: storage format */
225 unsigned int min_vfreq, max_vfreq; 198 unsigned int min_vfreq, max_vfreq;
226 unsigned int min_hfreq, max_hfreq; 199 unsigned int min_hfreq, max_hfreq;
227 unsigned int pixel_clock; 200 unsigned int pixel_clock;
228 201
229 /* White point indices FIXME: storage format */
230 unsigned int wpx1, wpy1;
231 unsigned int wpgamma1;
232 unsigned int wpx2, wpy2;
233 unsigned int wpgamma2;
234
235 enum subpixel_order subpixel_order; 202 enum subpixel_order subpixel_order;
236 203
237 char *raw_edid; /* if any */ 204 char *raw_edid; /* if any */
@@ -342,7 +309,7 @@ struct drm_crtc_funcs {
342 309
343 /* Set gamma on the CRTC */ 310 /* Set gamma on the CRTC */
344 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 311 void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
345 uint32_t size); 312 uint32_t start, uint32_t size);
346 /* Object destroy routine */ 313 /* Object destroy routine */
347 void (*destroy)(struct drm_crtc *crtc); 314 void (*destroy)(struct drm_crtc *crtc);
348 315
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 39e2cc5c7e66..5881fad91faa 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -28,6 +28,12 @@
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30 30
31#define CEA_EXT 0x02
32#define VTB_EXT 0x10
33#define DI_EXT 0x40
34#define LS_EXT 0x50
35#define MI_EXT 0x60
36
31struct est_timings { 37struct est_timings {
32 u8 t1; 38 u8 t1;
33 u8 t2; 39 u8 t2;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 9aa9bcadf869..626b629429ff 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -15,378 +15,380 @@ header-y += netfilter_bridge/
15header-y += netfilter_ipv4/ 15header-y += netfilter_ipv4/
16header-y += netfilter_ipv6/ 16header-y += netfilter_ipv6/
17header-y += usb/ 17header-y += usb/
18header-y += wimax/
19
20objhdr-y += version.h
21
22ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
23 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
24header-y += a.out.h
25endif
26ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
27 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
28header-y += kvm.h
29endif
30ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
31 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
32header-y += kvm_para.h
33endif
18 34
35header-y += acct.h
36header-y += adb.h
37header-y += adfs_fs.h
19header-y += affs_hardblocks.h 38header-y += affs_hardblocks.h
39header-y += agpgart.h
20header-y += aio_abi.h 40header-y += aio_abi.h
41header-y += apm_bios.h
21header-y += arcfb.h 42header-y += arcfb.h
43header-y += atalk.h
44header-y += atm.h
45header-y += atm_eni.h
46header-y += atm_he.h
47header-y += atm_idt77105.h
48header-y += atm_nicstar.h
49header-y += atm_tcp.h
50header-y += atm_zatm.h
22header-y += atmapi.h 51header-y += atmapi.h
23header-y += atmarp.h 52header-y += atmarp.h
24header-y += atmbr2684.h 53header-y += atmbr2684.h
25header-y += atmclip.h 54header-y += atmclip.h
26header-y += atm_eni.h 55header-y += atmdev.h
27header-y += atm_he.h
28header-y += atm_idt77105.h
29header-y += atmioc.h 56header-y += atmioc.h
30header-y += atmlec.h 57header-y += atmlec.h
31header-y += atmmpc.h 58header-y += atmmpc.h
32header-y += atm_nicstar.h
33header-y += atmppp.h 59header-y += atmppp.h
34header-y += atmsap.h 60header-y += atmsap.h
35header-y += atmsvc.h 61header-y += atmsvc.h
36header-y += atm_zatm.h 62header-y += audit.h
63header-y += auto_fs.h
37header-y += auto_fs4.h 64header-y += auto_fs4.h
65header-y += auxvec.h
38header-y += ax25.h 66header-y += ax25.h
39header-y += b1lli.h 67header-y += b1lli.h
40header-y += baycom.h 68header-y += baycom.h
41header-y += bfs_fs.h 69header-y += bfs_fs.h
70header-y += binfmts.h
71header-y += blk_types.h
42header-y += blkpg.h 72header-y += blkpg.h
73header-y += blktrace_api.h
43header-y += bpqether.h 74header-y += bpqether.h
44header-y += bsg.h 75header-y += bsg.h
45header-y += can.h 76header-y += can.h
77header-y += capability.h
78header-y += capi.h
46header-y += cciss_defs.h 79header-y += cciss_defs.h
80header-y += cciss_ioctl.h
47header-y += cdk.h 81header-y += cdk.h
82header-y += cdrom.h
83header-y += cgroupstats.h
48header-y += chio.h 84header-y += chio.h
85header-y += cm4000_cs.h
86header-y += cn_proc.h
87header-y += coda.h
49header-y += coda_psdev.h 88header-y += coda_psdev.h
50header-y += coff.h 89header-y += coff.h
51header-y += comstats.h 90header-y += comstats.h
91header-y += connector.h
52header-y += const.h 92header-y += const.h
53header-y += cgroupstats.h
54header-y += cramfs_fs.h 93header-y += cramfs_fs.h
94header-y += cuda.h
95header-y += cyclades.h
55header-y += cycx_cfm.h 96header-y += cycx_cfm.h
56header-y += dcbnl.h 97header-y += dcbnl.h
57header-y += dlmconstants.h 98header-y += dccp.h
99header-y += dlm.h
58header-y += dlm_device.h 100header-y += dlm_device.h
59header-y += dlm_netlink.h 101header-y += dlm_netlink.h
102header-y += dlm_plock.h
103header-y += dlmconstants.h
60header-y += dm-ioctl.h 104header-y += dm-ioctl.h
61header-y += dm-log-userspace.h 105header-y += dm-log-userspace.h
62header-y += dn.h 106header-y += dn.h
63header-y += dqblk_xfs.h 107header-y += dqblk_xfs.h
108header-y += edd.h
64header-y += efs_fs_sb.h 109header-y += efs_fs_sb.h
65header-y += elf-fdpic.h
66header-y += elf-em.h 110header-y += elf-em.h
111header-y += elf-fdpic.h
112header-y += elf.h
113header-y += elfcore.h
114header-y += errno.h
115header-y += errqueue.h
116header-y += ethtool.h
117header-y += eventpoll.h
118header-y += ext2_fs.h
67header-y += fadvise.h 119header-y += fadvise.h
68header-y += falloc.h 120header-y += falloc.h
121header-y += fanotify.h
122header-y += fb.h
123header-y += fcntl.h
69header-y += fd.h 124header-y += fd.h
70header-y += fdreg.h 125header-y += fdreg.h
71header-y += fib_rules.h 126header-y += fib_rules.h
72header-y += fiemap.h 127header-y += fiemap.h
128header-y += filter.h
73header-y += firewire-cdev.h 129header-y += firewire-cdev.h
74header-y += firewire-constants.h 130header-y += firewire-constants.h
131header-y += flat.h
132header-y += fs.h
75header-y += fuse.h 133header-y += fuse.h
76header-y += genetlink.h 134header-y += futex.h
135header-y += gameport.h
77header-y += gen_stats.h 136header-y += gen_stats.h
137header-y += generic_serial.h
138header-y += genetlink.h
78header-y += gfs2_ondisk.h 139header-y += gfs2_ondisk.h
79header-y += gigaset_dev.h 140header-y += gigaset_dev.h
141header-y += hdlc.h
142header-y += hdlcdrv.h
143header-y += hdreg.h
144header-y += hid.h
145header-y += hiddev.h
146header-y += hidraw.h
147header-y += hpet.h
80header-y += hysdn_if.h 148header-y += hysdn_if.h
149header-y += i2c-dev.h
150header-y += i2c.h
81header-y += i2o-dev.h 151header-y += i2o-dev.h
82header-y += i8k.h 152header-y += i8k.h
153header-y += icmp.h
154header-y += icmpv6.h
155header-y += if.h
156header-y += if_addr.h
83header-y += if_addrlabel.h 157header-y += if_addrlabel.h
84header-y += if_arcnet.h 158header-y += if_arcnet.h
159header-y += if_arp.h
85header-y += if_bonding.h 160header-y += if_bonding.h
161header-y += if_bridge.h
86header-y += if_cablemodem.h 162header-y += if_cablemodem.h
163header-y += if_ec.h
164header-y += if_eql.h
165header-y += if_ether.h
87header-y += if_fc.h 166header-y += if_fc.h
88header-y += if.h 167header-y += if_fddi.h
168header-y += if_frad.h
89header-y += if_hippi.h 169header-y += if_hippi.h
90header-y += if_infiniband.h 170header-y += if_infiniband.h
171header-y += if_link.h
172header-y += if_ltalk.h
91header-y += if_packet.h 173header-y += if_packet.h
174header-y += if_phonet.h
92header-y += if_plip.h 175header-y += if_plip.h
93header-y += if_ppp.h 176header-y += if_ppp.h
177header-y += if_pppol2tp.h
178header-y += if_pppox.h
94header-y += if_slip.h 179header-y += if_slip.h
95header-y += if_strip.h 180header-y += if_strip.h
181header-y += if_tr.h
96header-y += if_tun.h 182header-y += if_tun.h
183header-y += if_tunnel.h
184header-y += if_vlan.h
97header-y += if_x25.h 185header-y += if_x25.h
186header-y += igmp.h
187header-y += in.h
188header-y += in6.h
98header-y += in_route.h 189header-y += in_route.h
190header-y += inet_diag.h
191header-y += inotify.h
192header-y += input.h
99header-y += ioctl.h 193header-y += ioctl.h
194header-y += ip.h
100header-y += ip6_tunnel.h 195header-y += ip6_tunnel.h
196header-y += ip_vs.h
197header-y += ipc.h
198header-y += ipmi.h
101header-y += ipmi_msgdefs.h 199header-y += ipmi_msgdefs.h
102header-y += ipsec.h 200header-y += ipsec.h
103header-y += ip_vs.h 201header-y += ipv6.h
202header-y += ipv6_route.h
104header-y += ipx.h 203header-y += ipx.h
105header-y += irda.h 204header-y += irda.h
205header-y += irqnr.h
206header-y += isdn.h
207header-y += isdn_divertif.h
208header-y += isdn_ppp.h
209header-y += isdnif.h
106header-y += iso_fs.h 210header-y += iso_fs.h
211header-y += ivtv.h
212header-y += ivtvfb.h
107header-y += ixjuser.h 213header-y += ixjuser.h
108header-y += jffs2.h 214header-y += jffs2.h
215header-y += joystick.h
216header-y += kd.h
217header-y += kdev_t.h
218header-y += kernel.h
219header-y += kernelcapi.h
220header-y += keyboard.h
109header-y += keyctl.h 221header-y += keyctl.h
222header-y += l2tp.h
110header-y += limits.h 223header-y += limits.h
224header-y += llc.h
225header-y += loop.h
226header-y += lp.h
111header-y += magic.h 227header-y += magic.h
112header-y += major.h 228header-y += major.h
113header-y += map_to_7segment.h 229header-y += map_to_7segment.h
114header-y += matroxfb.h 230header-y += matroxfb.h
231header-y += mempolicy.h
115header-y += meye.h 232header-y += meye.h
233header-y += mii.h
116header-y += minix_fs.h 234header-y += minix_fs.h
235header-y += mman.h
117header-y += mmtimer.h 236header-y += mmtimer.h
118header-y += mqueue.h 237header-y += mqueue.h
238header-y += mroute.h
239header-y += mroute6.h
240header-y += msdos_fs.h
241header-y += msg.h
119header-y += mtio.h 242header-y += mtio.h
243header-y += n_r3964.h
244header-y += nbd.h
245header-y += ncp.h
246header-y += ncp_fs.h
247header-y += ncp_mount.h
120header-y += ncp_no.h 248header-y += ncp_no.h
121header-y += neighbour.h 249header-y += neighbour.h
250header-y += net.h
122header-y += net_dropmon.h 251header-y += net_dropmon.h
123header-y += net_tstamp.h 252header-y += net_tstamp.h
253header-y += netdevice.h
254header-y += netfilter.h
124header-y += netfilter_arp.h 255header-y += netfilter_arp.h
256header-y += netfilter_bridge.h
257header-y += netfilter_decnet.h
258header-y += netfilter_ipv4.h
259header-y += netfilter_ipv6.h
260header-y += netlink.h
125header-y += netrom.h 261header-y += netrom.h
262header-y += nfs.h
126header-y += nfs2.h 263header-y += nfs2.h
264header-y += nfs3.h
265header-y += nfs4.h
127header-y += nfs4_mount.h 266header-y += nfs4_mount.h
267header-y += nfs_fs.h
268header-y += nfs_idmap.h
128header-y += nfs_mount.h 269header-y += nfs_mount.h
270header-y += nfsacl.h
129header-y += nl80211.h 271header-y += nl80211.h
272header-y += nubus.h
273header-y += nvram.h
130header-y += omapfb.h 274header-y += omapfb.h
275header-y += oom.h
131header-y += param.h 276header-y += param.h
277header-y += parport.h
278header-y += patchkey.h
279header-y += pci.h
132header-y += pci_regs.h 280header-y += pci_regs.h
133header-y += perf_event.h 281header-y += perf_event.h
282header-y += personality.h
134header-y += pfkeyv2.h 283header-y += pfkeyv2.h
135header-y += pg.h 284header-y += pg.h
136header-y += phantom.h 285header-y += phantom.h
137header-y += phonet.h 286header-y += phonet.h
138header-y += pkt_cls.h 287header-y += pkt_cls.h
139header-y += pkt_sched.h 288header-y += pkt_sched.h
289header-y += pktcdvd.h
290header-y += pmu.h
291header-y += poll.h
140header-y += posix_types.h 292header-y += posix_types.h
141header-y += ppdev.h 293header-y += ppdev.h
294header-y += ppp-comp.h
295header-y += ppp_defs.h
296header-y += pps.h
142header-y += prctl.h 297header-y += prctl.h
143header-y += qnxtypes.h 298header-y += ptrace.h
144header-y += qnx4_fs.h 299header-y += qnx4_fs.h
300header-y += qnxtypes.h
301header-y += quota.h
145header-y += radeonfb.h 302header-y += radeonfb.h
303header-y += random.h
146header-y += raw.h 304header-y += raw.h
305header-y += reboot.h
306header-y += reiserfs_fs.h
307header-y += reiserfs_xattr.h
147header-y += resource.h 308header-y += resource.h
309header-y += rfkill.h
148header-y += romfs_fs.h 310header-y += romfs_fs.h
149header-y += rose.h 311header-y += rose.h
312header-y += route.h
313header-y += rtc.h
314header-y += rtnetlink.h
315header-y += scc.h
316header-y += sched.h
317header-y += screen_info.h
318header-y += sdla.h
319header-y += securebits.h
320header-y += selinux_netlink.h
321header-y += sem.h
322header-y += serial.h
323header-y += serial_core.h
150header-y += serial_reg.h 324header-y += serial_reg.h
325header-y += serio.h
326header-y += shm.h
327header-y += signal.h
328header-y += signalfd.h
329header-y += smb.h
330header-y += smb_fs.h
331header-y += smb_mount.h
151header-y += smbno.h 332header-y += smbno.h
152header-y += snmp.h 333header-y += snmp.h
334header-y += socket.h
153header-y += sockios.h 335header-y += sockios.h
154header-y += som.h 336header-y += som.h
337header-y += sonet.h
338header-y += sonypi.h
155header-y += sound.h 339header-y += sound.h
340header-y += soundcard.h
341header-y += stat.h
342header-y += stddef.h
343header-y += string.h
156header-y += suspend_ioctls.h 344header-y += suspend_ioctls.h
345header-y += swab.h
346header-y += synclink.h
347header-y += sysctl.h
157header-y += taskstats.h 348header-y += taskstats.h
349header-y += tcp.h
158header-y += telephony.h 350header-y += telephony.h
159header-y += termios.h 351header-y += termios.h
352header-y += time.h
160header-y += times.h 353header-y += times.h
354header-y += timex.h
161header-y += tiocl.h 355header-y += tiocl.h
162header-y += tipc.h 356header-y += tipc.h
163header-y += tipc_config.h 357header-y += tipc_config.h
164header-y += toshiba.h 358header-y += toshiba.h
359header-y += tty.h
360header-y += types.h
165header-y += udf_fs_i.h 361header-y += udf_fs_i.h
362header-y += udp.h
363header-y += uinput.h
364header-y += uio.h
166header-y += ultrasound.h 365header-y += ultrasound.h
167header-y += un.h 366header-y += un.h
367header-y += unistd.h
368header-y += usbdevice_fs.h
168header-y += utime.h 369header-y += utime.h
370header-y += utsname.h
169header-y += veth.h 371header-y += veth.h
372header-y += vhost.h
373header-y += videodev.h
374header-y += videodev2.h
170header-y += videotext.h 375header-y += videotext.h
171header-y += x25.h 376header-y += virtio_9p.h
172 377header-y += virtio_balloon.h
173unifdef-y += acct.h 378header-y += virtio_blk.h
174unifdef-y += adb.h 379header-y += virtio_config.h
175unifdef-y += adfs_fs.h 380header-y += virtio_console.h
176unifdef-y += agpgart.h 381header-y += virtio_ids.h
177ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 382header-y += virtio_net.h
178 $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 383header-y += virtio_pci.h
179unifdef-y += a.out.h 384header-y += virtio_ring.h
180endif 385header-y += virtio_rng.h
181unifdef-y += apm_bios.h 386header-y += vt.h
182unifdef-y += atalk.h 387header-y += wait.h
183unifdef-y += atmdev.h 388header-y += wanrouter.h
184unifdef-y += atm.h 389header-y += watchdog.h
185unifdef-y += atm_tcp.h
186unifdef-y += audit.h
187unifdef-y += auto_fs.h
188unifdef-y += auxvec.h
189unifdef-y += binfmts.h
190unifdef-y += blktrace_api.h
191unifdef-y += capability.h
192unifdef-y += capi.h
193unifdef-y += cciss_ioctl.h
194unifdef-y += cdrom.h
195unifdef-y += cm4000_cs.h
196unifdef-y += cn_proc.h
197unifdef-y += coda.h
198unifdef-y += connector.h
199unifdef-y += cuda.h
200unifdef-y += cyclades.h
201unifdef-y += dccp.h
202unifdef-y += dlm.h
203unifdef-y += dlm_plock.h
204unifdef-y += edd.h
205unifdef-y += elf.h
206unifdef-y += elfcore.h
207unifdef-y += errno.h
208unifdef-y += errqueue.h
209unifdef-y += ethtool.h
210unifdef-y += eventpoll.h
211unifdef-y += signalfd.h
212unifdef-y += ext2_fs.h
213unifdef-y += fb.h
214unifdef-y += fcntl.h
215unifdef-y += filter.h
216unifdef-y += flat.h
217unifdef-y += futex.h
218unifdef-y += fs.h
219unifdef-y += gameport.h
220unifdef-y += generic_serial.h
221unifdef-y += hdlcdrv.h
222unifdef-y += hdlc.h
223unifdef-y += hdreg.h
224unifdef-y += hid.h
225unifdef-y += hiddev.h
226unifdef-y += hidraw.h
227unifdef-y += hpet.h
228unifdef-y += i2c.h
229unifdef-y += i2c-dev.h
230unifdef-y += icmp.h
231unifdef-y += icmpv6.h
232unifdef-y += if_addr.h
233unifdef-y += if_arp.h
234unifdef-y += if_bridge.h
235unifdef-y += if_ec.h
236unifdef-y += if_eql.h
237unifdef-y += if_ether.h
238unifdef-y += if_fddi.h
239unifdef-y += if_frad.h
240unifdef-y += if_ltalk.h
241unifdef-y += if_link.h
242unifdef-y += if_phonet.h
243unifdef-y += if_pppol2tp.h
244unifdef-y += if_pppox.h
245unifdef-y += if_tr.h
246unifdef-y += if_tunnel.h
247unifdef-y += if_vlan.h
248unifdef-y += igmp.h
249unifdef-y += inet_diag.h
250unifdef-y += in.h
251unifdef-y += in6.h
252unifdef-y += inotify.h
253unifdef-y += input.h
254unifdef-y += ip.h
255unifdef-y += ipc.h
256unifdef-y += ipmi.h
257unifdef-y += ipv6.h
258unifdef-y += ipv6_route.h
259unifdef-y += isdn.h
260unifdef-y += isdnif.h
261unifdef-y += isdn_divertif.h
262unifdef-y += isdn_ppp.h
263unifdef-y += ivtv.h
264unifdef-y += ivtvfb.h
265unifdef-y += joystick.h
266unifdef-y += kdev_t.h
267unifdef-y += kd.h
268unifdef-y += kernelcapi.h
269unifdef-y += kernel.h
270unifdef-y += keyboard.h
271ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
272 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
273unifdef-y += kvm.h
274endif
275ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
276 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
277unifdef-y += kvm_para.h
278endif
279unifdef-y += l2tp.h
280unifdef-y += llc.h
281unifdef-y += loop.h
282unifdef-y += lp.h
283unifdef-y += mempolicy.h
284unifdef-y += mii.h
285unifdef-y += mman.h
286unifdef-y += mroute.h
287unifdef-y += mroute6.h
288unifdef-y += msdos_fs.h
289unifdef-y += msg.h
290unifdef-y += nbd.h
291unifdef-y += ncp_fs.h
292unifdef-y += ncp.h
293unifdef-y += ncp_mount.h
294unifdef-y += netdevice.h
295unifdef-y += netfilter_bridge.h
296unifdef-y += netfilter_decnet.h
297unifdef-y += netfilter.h
298unifdef-y += netfilter_ipv4.h
299unifdef-y += netfilter_ipv6.h
300unifdef-y += net.h
301unifdef-y += netlink.h
302unifdef-y += nfs3.h
303unifdef-y += nfs4.h
304unifdef-y += nfsacl.h
305unifdef-y += nfs_fs.h
306unifdef-y += nfs.h
307unifdef-y += nfs_idmap.h
308unifdef-y += n_r3964.h
309unifdef-y += nubus.h
310unifdef-y += nvram.h
311unifdef-y += oom.h
312unifdef-y += parport.h
313unifdef-y += patchkey.h
314unifdef-y += pci.h
315unifdef-y += personality.h
316unifdef-y += pktcdvd.h
317unifdef-y += pmu.h
318unifdef-y += poll.h
319unifdef-y += ppp_defs.h
320unifdef-y += ppp-comp.h
321unifdef-y += pps.h
322unifdef-y += ptrace.h
323unifdef-y += quota.h
324unifdef-y += random.h
325unifdef-y += rfkill.h
326unifdef-y += irqnr.h
327unifdef-y += reboot.h
328unifdef-y += reiserfs_fs.h
329unifdef-y += reiserfs_xattr.h
330unifdef-y += route.h
331unifdef-y += rtc.h
332unifdef-y += rtnetlink.h
333unifdef-y += scc.h
334unifdef-y += sched.h
335unifdef-y += screen_info.h
336unifdef-y += sdla.h
337unifdef-y += securebits.h
338unifdef-y += selinux_netlink.h
339unifdef-y += sem.h
340unifdef-y += serial_core.h
341unifdef-y += serial.h
342unifdef-y += serio.h
343unifdef-y += shm.h
344unifdef-y += signal.h
345unifdef-y += smb_fs.h
346unifdef-y += smb.h
347unifdef-y += smb_mount.h
348unifdef-y += socket.h
349unifdef-y += sonet.h
350unifdef-y += sonypi.h
351unifdef-y += soundcard.h
352unifdef-y += stat.h
353unifdef-y += stddef.h
354unifdef-y += string.h
355unifdef-y += swab.h
356unifdef-y += synclink.h
357unifdef-y += sysctl.h
358unifdef-y += tcp.h
359unifdef-y += time.h
360unifdef-y += timex.h
361unifdef-y += tty.h
362unifdef-y += types.h
363unifdef-y += udp.h
364unifdef-y += uinput.h
365unifdef-y += uio.h
366unifdef-y += unistd.h
367unifdef-y += usbdevice_fs.h
368unifdef-y += utsname.h
369unifdef-y += vhost.h
370unifdef-y += videodev2.h
371unifdef-y += videodev.h
372unifdef-y += virtio_config.h
373unifdef-y += virtio_ids.h
374unifdef-y += virtio_blk.h
375unifdef-y += virtio_net.h
376unifdef-y += virtio_9p.h
377unifdef-y += virtio_balloon.h
378unifdef-y += virtio_console.h
379unifdef-y += virtio_pci.h
380unifdef-y += virtio_ring.h
381unifdef-y += virtio_rng.h
382unifdef-y += vt.h
383unifdef-y += wait.h
384unifdef-y += wanrouter.h
385unifdef-y += watchdog.h
386unifdef-y += wireless.h
387unifdef-y += xattr.h
388unifdef-y += xfrm.h
389
390objhdr-y += version.h
391header-y += wimax.h 390header-y += wimax.h
392header-y += wimax/ 391header-y += wireless.h
392header-y += x25.h
393header-y += xattr.h
394header-y += xfrm.h
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index ca16c3801a1e..be33b3affc8a 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -150,6 +150,7 @@ struct clcd_fb {
150 u16 off_cntl; 150 u16 off_cntl;
151 u32 clcd_cntl; 151 u32 clcd_cntl;
152 u32 cmap[16]; 152 u32 cmap[16];
153 bool clk_enabled;
153}; 154};
154 155
155static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 156static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f391d45c8aea..e24afabc548f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -544,7 +544,7 @@ extern int audit_signals;
544#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
545#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
546#define __audit_inode_child(i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
547#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { (void)(d); } while (0)
548#define audit_inode_child(i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
549#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
550#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 7b09c8348fd3..da64e15004b6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -79,6 +79,7 @@ struct autofs_packet_expire {
79#define AUTOFS_IOC_FAIL _IO(0x93,0x61) 79#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) 80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) 81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
82#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
82#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) 83#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
83#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) 84#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
84 85
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e9aec0d099df..35b00746c712 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -31,6 +31,7 @@ enum bdi_state {
31 BDI_async_congested, /* The async (write) queue is getting full */ 31 BDI_async_congested, /* The async (write) queue is getting full */
32 BDI_sync_congested, /* The sync queue is getting full */ 32 BDI_sync_congested, /* The sync queue is getting full */
33 BDI_registered, /* bdi_register() was done */ 33 BDI_registered, /* bdi_register() was done */
34 BDI_writeback_running, /* Writeback is in progress */
34 BDI_unused, /* Available bits start here */ 35 BDI_unused, /* Available bits start here */
35}; 36};
36 37
@@ -45,22 +46,21 @@ enum bdi_stat_item {
45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 46#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
46 47
47struct bdi_writeback { 48struct bdi_writeback {
48 struct list_head list; /* hangs off the bdi */ 49 struct backing_dev_info *bdi; /* our parent bdi */
49
50 struct backing_dev_info *bdi; /* our parent bdi */
51 unsigned int nr; 50 unsigned int nr;
52 51
53 unsigned long last_old_flush; /* last old data flush */ 52 unsigned long last_old_flush; /* last old data flush */
53 unsigned long last_active; /* last time bdi thread was active */
54 54
55 struct task_struct *task; /* writeback task */ 55 struct task_struct *task; /* writeback thread */
56 struct list_head b_dirty; /* dirty inodes */ 56 struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
57 struct list_head b_io; /* parked for writeback */ 57 struct list_head b_dirty; /* dirty inodes */
58 struct list_head b_more_io; /* parked for more writeback */ 58 struct list_head b_io; /* parked for writeback */
59 struct list_head b_more_io; /* parked for more writeback */
59}; 60};
60 61
61struct backing_dev_info { 62struct backing_dev_info {
62 struct list_head bdi_list; 63 struct list_head bdi_list;
63 struct rcu_head rcu_head;
64 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 64 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
65 unsigned long state; /* Always use atomic bitops on this */ 65 unsigned long state; /* Always use atomic bitops on this */
66 unsigned int capabilities; /* Device capabilities */ 66 unsigned int capabilities; /* Device capabilities */
@@ -80,8 +80,7 @@ struct backing_dev_info {
80 unsigned int max_ratio, max_prop_frac; 80 unsigned int max_ratio, max_prop_frac;
81 81
82 struct bdi_writeback wb; /* default writeback info for this bdi */ 82 struct bdi_writeback wb; /* default writeback info for this bdi */
83 spinlock_t wb_lock; /* protects update side of wb_list */ 83 spinlock_t wb_lock; /* protects work_list */
84 struct list_head wb_list; /* the flusher threads hanging off this bdi */
85 84
86 struct list_head work_list; 85 struct list_head work_list;
87 86
@@ -105,9 +104,10 @@ void bdi_unregister(struct backing_dev_info *bdi);
105int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 104int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
106void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); 105void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
107void bdi_start_background_writeback(struct backing_dev_info *bdi); 106void bdi_start_background_writeback(struct backing_dev_info *bdi);
108int bdi_writeback_task(struct bdi_writeback *wb); 107int bdi_writeback_thread(void *data);
109int bdi_has_dirty_io(struct backing_dev_info *bdi); 108int bdi_has_dirty_io(struct backing_dev_info *bdi);
110void bdi_arm_supers_timer(void); 109void bdi_arm_supers_timer(void);
110void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
111 111
112extern spinlock_t bdi_lock; 112extern spinlock_t bdi_lock;
113extern struct list_head bdi_list; 113extern struct list_head bdi_list;
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c809e286d213..a065612fc928 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -50,8 +50,8 @@ struct linux_binprm{
50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 50 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
51 unsigned int per_clear; /* bits to clear in current->personality */ 51 unsigned int per_clear; /* bits to clear in current->personality */
52 int argc, envc; 52 int argc, envc;
53 char * filename; /* Name of binary as seen by procps */ 53 const char * filename; /* Name of binary as seen by procps */
54 char * interp; /* Name of the binary really executed. Most 54 const char * interp; /* Name of the binary really executed. Most
55 of the time same as filename, but could be 55 of the time same as filename, but could be
56 different for binfmt_{misc,script} */ 56 different for binfmt_{misc,script} */
57 unsigned interp_flags; 57 unsigned interp_flags;
@@ -126,7 +126,8 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
126 unsigned long stack_top, 126 unsigned long stack_top,
127 int executable_stack); 127 int executable_stack);
128extern int bprm_mm_init(struct linux_binprm *bprm); 128extern int bprm_mm_init(struct linux_binprm *bprm);
129extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 129extern int copy_strings_kernel(int argc, const char *const *argv,
130 struct linux_binprm *bprm);
130extern int prepare_bprm_creds(struct linux_binprm *bprm); 131extern int prepare_bprm_creds(struct linux_binprm *bprm);
131extern void install_exec_creds(struct linux_binprm *bprm); 132extern void install_exec_creds(struct linux_binprm *bprm);
132extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); 133extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7fc5606e6ea5..5274103434ad 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
@@ -28,6 +28,9 @@
28 28
29#include <asm/io.h> 29#include <asm/io.h>
30 30
31/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
32#include <linux/blk_types.h>
33
31#define BIO_DEBUG 34#define BIO_DEBUG
32 35
33#ifdef BIO_DEBUG 36#ifdef BIO_DEBUG
@@ -41,154 +44,6 @@
41#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 44#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
42 45
43/* 46/*
44 * was unsigned short, but we might as well be ready for > 64kB I/O pages
45 */
46struct bio_vec {
47 struct page *bv_page;
48 unsigned int bv_len;
49 unsigned int bv_offset;
50};
51
52struct bio_set;
53struct bio;
54struct bio_integrity_payload;
55typedef void (bio_end_io_t) (struct bio *, int);
56typedef void (bio_destructor_t) (struct bio *);
57
58/*
59 * main unit of I/O for the block layer and lower layers (ie drivers and
60 * stacking drivers)
61 */
62struct bio {
63 sector_t bi_sector; /* device address in 512 byte
64 sectors */
65 struct bio *bi_next; /* request queue link */
66 struct block_device *bi_bdev;
67 unsigned long bi_flags; /* status, command, etc */
68 unsigned long bi_rw; /* bottom bits READ/WRITE,
69 * top bits priority
70 */
71
72 unsigned short bi_vcnt; /* how many bio_vec's */
73 unsigned short bi_idx; /* current index into bvl_vec */
74
75 /* Number of segments in this BIO after
76 * physical address coalescing is performed.
77 */
78 unsigned int bi_phys_segments;
79
80 unsigned int bi_size; /* residual I/O count */
81
82 /*
83 * To keep track of the max segment size, we account for the
84 * sizes of the first and last mergeable segments in this bio.
85 */
86 unsigned int bi_seg_front_size;
87 unsigned int bi_seg_back_size;
88
89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
90
91 unsigned int bi_comp_cpu; /* completion CPU */
92
93 atomic_t bi_cnt; /* pin count */
94
95 struct bio_vec *bi_io_vec; /* the actual vec list */
96
97 bio_end_io_t *bi_end_io;
98
99 void *bi_private;
100#if defined(CONFIG_BLK_DEV_INTEGRITY)
101 struct bio_integrity_payload *bi_integrity; /* data integrity */
102#endif
103
104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
112};
113
114/*
115 * bio flags
116 */
117#define BIO_UPTODATE 0 /* ok after I/O completion */
118#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
119#define BIO_EOF 2 /* out-out-bounds error */
120#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
121#define BIO_CLONED 4 /* doesn't own data */
122#define BIO_BOUNCED 5 /* bio is a bounce bio */
123#define BIO_USER_MAPPED 6 /* contains user pages */
124#define BIO_EOPNOTSUPP 7 /* not supported */
125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
130
131/*
132 * top 4 bits of bio flags indicate the pool this bio came from
133 */
134#define BIO_POOL_BITS (4)
135#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
136#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
137#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
138#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
139
140/*
141 * bio bi_rw flags
142 *
143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- fail fast device errors
146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
150 * Insert a serialization point in the IO queue, forcing previously
151 * submitted IO to be completed before this one is issued.
152 * bit 6 -- synchronous I/O hint.
153 * bit 7 -- Unplug the device immediately after submitting this bio.
154 * bit 8 -- metadata request
155 * Used for tracing to differentiate metadata and data IO. May also
156 * get some preferential treatment in the IO scheduler
157 * bit 9 -- discard sectors
158 * Informs the lower level device that this range of sectors is no longer
159 * used by the file system and may thus be freed by the device. Used
160 * for flash based storage.
161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request.
164 */
165enum bio_rw_flags {
166 BIO_RW,
167 BIO_RW_FAILFAST_DEV,
168 BIO_RW_FAILFAST_TRANSPORT,
169 BIO_RW_FAILFAST_DRIVER,
170 /* above flags must match REQ_* */
171 BIO_RW_AHEAD,
172 BIO_RW_BARRIER,
173 BIO_RW_SYNCIO,
174 BIO_RW_UNPLUG,
175 BIO_RW_META,
176 BIO_RW_DISCARD,
177 BIO_RW_NOIDLE,
178};
179
180/*
181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
182 * that explicit here.
183 */
184#define BIO_RW_RQ_MASK 0xf
185
186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
187{
188 return (bio->bi_rw & (1 << flag)) != 0;
189}
190
191/*
192 * upper 16 bits of bi_rw define the io priority of this bio 47 * upper 16 bits of bi_rw define the io priority of this bio
193 */ 48 */
194#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) 49#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
@@ -211,7 +66,10 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
211#define bio_offset(bio) bio_iovec((bio))->bv_offset 66#define bio_offset(bio) bio_iovec((bio))->bv_offset
212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
213#define bio_sectors(bio) ((bio)->bi_size >> 9) 68#define bio_sectors(bio) ((bio)->bi_size >> 9)
214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD)) 69#define bio_empty_barrier(bio) \
70 ((bio->bi_rw & REQ_HARDBARRIER) && \
71 !bio_has_data(bio) && \
72 !(bio->bi_rw & REQ_DISCARD))
215 73
216static inline unsigned int bio_cur_bytes(struct bio *bio) 74static inline unsigned int bio_cur_bytes(struct bio *bio)
217{ 75{
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
new file mode 100644
index 000000000000..ca83a97c9715
--- /dev/null
+++ b/include/linux/blk_types.h
@@ -0,0 +1,196 @@
1/*
2 * Block data types and constants. Directly include this file only to
3 * break include dependency loop.
4 */
5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H
7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h>
11
12struct bio_set;
13struct bio;
14struct bio_integrity_payload;
15struct page;
16struct block_device;
17typedef void (bio_end_io_t) (struct bio *, int);
18typedef void (bio_destructor_t) (struct bio *);
19
20/*
21 * was unsigned short, but we might as well be ready for > 64kB I/O pages
22 */
23struct bio_vec {
24 struct page *bv_page;
25 unsigned int bv_len;
26 unsigned int bv_offset;
27};
28
29/*
30 * main unit of I/O for the block layer and lower layers (ie drivers and
31 * stacking drivers)
32 */
33struct bio {
34 sector_t bi_sector; /* device address in 512 byte
35 sectors */
36 struct bio *bi_next; /* request queue link */
37 struct block_device *bi_bdev;
38 unsigned long bi_flags; /* status, command, etc */
39 unsigned long bi_rw; /* bottom bits READ/WRITE,
40 * top bits priority
41 */
42
43 unsigned short bi_vcnt; /* how many bio_vec's */
44 unsigned short bi_idx; /* current index into bvl_vec */
45
46 /* Number of segments in this BIO after
47 * physical address coalescing is performed.
48 */
49 unsigned int bi_phys_segments;
50
51 unsigned int bi_size; /* residual I/O count */
52
53 /*
54 * To keep track of the max segment size, we account for the
55 * sizes of the first and last mergeable segments in this bio.
56 */
57 unsigned int bi_seg_front_size;
58 unsigned int bi_seg_back_size;
59
60 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
61
62 unsigned int bi_comp_cpu; /* completion CPU */
63
64 atomic_t bi_cnt; /* pin count */
65
66 struct bio_vec *bi_io_vec; /* the actual vec list */
67
68 bio_end_io_t *bi_end_io;
69
70 void *bi_private;
71#if defined(CONFIG_BLK_DEV_INTEGRITY)
72 struct bio_integrity_payload *bi_integrity; /* data integrity */
73#endif
74
75 bio_destructor_t *bi_destructor; /* destructor */
76
77 /*
78 * We can inline a number of vecs at the end of the bio, to avoid
79 * double allocations for a small number of bio_vecs. This member
80 * MUST obviously be kept at the very end of the bio.
81 */
82 struct bio_vec bi_inline_vecs[0];
83};
84
85/*
86 * bio flags
87 */
88#define BIO_UPTODATE 0 /* ok after I/O completion */
89#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
90#define BIO_EOF 2 /* out-out-bounds error */
91#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
92#define BIO_CLONED 4 /* doesn't own data */
93#define BIO_BOUNCED 5 /* bio is a bounce bio */
94#define BIO_USER_MAPPED 6 /* contains user pages */
95#define BIO_EOPNOTSUPP 7 /* not supported */
96#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
99#define BIO_QUIET 11 /* Make BIO Quiet */
100#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
101
102/*
103 * top 4 bits of bio flags indicate the pool this bio came from
104 */
105#define BIO_POOL_BITS (4)
106#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
107#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
108#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
109#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
110
111#endif /* CONFIG_BLOCK */
112
113/*
114 * Request flags. For use in the cmd_flags field of struct request, and in
115 * bi_rw of struct bio. Note that some flags are only valid in either one.
116 */
117enum rq_flag_bits {
118 /* common flags */
119 __REQ_WRITE, /* not set, read. set, write */
120 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
121 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
122 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
123
124 __REQ_HARDBARRIER, /* may not be passed by drive either */
125 __REQ_SYNC, /* request is sync (sync write or read) */
126 __REQ_META, /* metadata io request */
127 __REQ_DISCARD, /* request to discard sectors */
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
129
130 /* bio only flags */
131 __REQ_UNPLUG, /* unplug the immediately after submission */
132 __REQ_RAHEAD, /* read ahead, can fail anytime */
133
134 /* request only flags */
135 __REQ_SORTED, /* elevator knows about this request */
136 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
137 __REQ_FUA, /* forced unit access */
138 __REQ_NOMERGE, /* don't touch this for merging */
139 __REQ_STARTED, /* drive already may have started this one */
140 __REQ_DONTPREP, /* don't call prep for this one */
141 __REQ_QUEUED, /* uses queueing */
142 __REQ_ELVPRIV, /* elevator private data attached */
143 __REQ_FAILED, /* set if the request failed */
144 __REQ_QUIET, /* don't worry about errors */
145 __REQ_PREEMPT, /* set for "ide_preempt" requests */
146 __REQ_ORDERED_COLOR, /* is before or after barrier */
147 __REQ_ALLOCED, /* request came from our alloc pool */
148 __REQ_COPY_USER, /* contains copies of user pages */
149 __REQ_INTEGRITY, /* integrity metadata has been remapped */
150 __REQ_FLUSH, /* request for cache flush */
151 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
154 __REQ_NR_BITS, /* stops here */
155};
156
157#define REQ_WRITE (1 << __REQ_WRITE)
158#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
159#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
160#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
161#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
162#define REQ_SYNC (1 << __REQ_SYNC)
163#define REQ_META (1 << __REQ_META)
164#define REQ_DISCARD (1 << __REQ_DISCARD)
165#define REQ_NOIDLE (1 << __REQ_NOIDLE)
166
167#define REQ_FAILFAST_MASK \
168 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
169#define REQ_COMMON_MASK \
170 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \
171 REQ_META| REQ_DISCARD | REQ_NOIDLE)
172
173#define REQ_UNPLUG (1 << __REQ_UNPLUG)
174#define REQ_RAHEAD (1 << __REQ_RAHEAD)
175
176#define REQ_SORTED (1 << __REQ_SORTED)
177#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
178#define REQ_FUA (1 << __REQ_FUA)
179#define REQ_NOMERGE (1 << __REQ_NOMERGE)
180#define REQ_STARTED (1 << __REQ_STARTED)
181#define REQ_DONTPREP (1 << __REQ_DONTPREP)
182#define REQ_QUEUED (1 << __REQ_QUEUED)
183#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
184#define REQ_FAILED (1 << __REQ_FAILED)
185#define REQ_QUIET (1 << __REQ_QUIET)
186#define REQ_PREEMPT (1 << __REQ_PREEMPT)
187#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
188#define REQ_ALLOCED (1 << __REQ_ALLOCED)
189#define REQ_COPY_USER (1 << __REQ_COPY_USER)
190#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
191#define REQ_FLUSH (1 << __REQ_FLUSH)
192#define REQ_IO_STAT (1 << __REQ_IO_STAT)
193#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
194#define REQ_SECURE (1 << __REQ_SECURE)
195
196#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 09a840264d6f..2c54906f678f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -60,7 +60,6 @@ enum rq_cmd_type_bits {
60 REQ_TYPE_PM_RESUME, /* resume request */ 60 REQ_TYPE_PM_RESUME, /* resume request */
61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
62 REQ_TYPE_SPECIAL, /* driver defined type */ 62 REQ_TYPE_SPECIAL, /* driver defined type */
63 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
64 /* 63 /*
65 * for ATA/ATAPI devices. this really doesn't belong here, ide should 64 * for ATA/ATAPI devices. this really doesn't belong here, ide should
66 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 65 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
@@ -70,84 +69,6 @@ enum rq_cmd_type_bits {
70 REQ_TYPE_ATA_PC, 69 REQ_TYPE_ATA_PC,
71}; 70};
72 71
73/*
74 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
75 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
76 * SCSI cdb.
77 *
78 * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
79 * typically to differentiate REQ_TYPE_SPECIAL requests.
80 *
81 */
82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85};
86
87/*
88 * request type modified bits. first four bits match BIO_RW* bits, important
89 */
90enum rq_flag_bits {
91 __REQ_RW, /* not set, read. set, write */
92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
99 __REQ_HARDBARRIER, /* may not be passed by drive either */
100 __REQ_FUA, /* forced unit access */
101 __REQ_NOMERGE, /* don't touch this for merging */
102 __REQ_STARTED, /* drive already may have started this one */
103 __REQ_DONTPREP, /* don't call prep for this one */
104 __REQ_QUEUED, /* uses queueing */
105 __REQ_ELVPRIV, /* elevator private data attached */
106 __REQ_FAILED, /* set if the request failed */
107 __REQ_QUIET, /* don't worry about errors */
108 __REQ_PREEMPT, /* set for "ide_preempt" requests */
109 __REQ_ORDERED_COLOR, /* is before or after barrier */
110 __REQ_RW_SYNC, /* request is sync (sync write or read) */
111 __REQ_ALLOCED, /* request came from our alloc pool */
112 __REQ_RW_META, /* metadata io request */
113 __REQ_COPY_USER, /* contains copies of user pages */
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
118 __REQ_NR_BITS, /* stops here */
119};
120
121#define REQ_RW (1 << __REQ_RW)
122#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
123#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
124#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
125#define REQ_DISCARD (1 << __REQ_DISCARD)
126#define REQ_SORTED (1 << __REQ_SORTED)
127#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
128#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
129#define REQ_FUA (1 << __REQ_FUA)
130#define REQ_NOMERGE (1 << __REQ_NOMERGE)
131#define REQ_STARTED (1 << __REQ_STARTED)
132#define REQ_DONTPREP (1 << __REQ_DONTPREP)
133#define REQ_QUEUED (1 << __REQ_QUEUED)
134#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
135#define REQ_FAILED (1 << __REQ_FAILED)
136#define REQ_QUIET (1 << __REQ_QUIET)
137#define REQ_PREEMPT (1 << __REQ_PREEMPT)
138#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
139#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
140#define REQ_ALLOCED (1 << __REQ_ALLOCED)
141#define REQ_RW_META (1 << __REQ_RW_META)
142#define REQ_COPY_USER (1 << __REQ_COPY_USER)
143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
150
151#define BLK_MAX_CDB 16 72#define BLK_MAX_CDB 16
152 73
153/* 74/*
@@ -264,6 +185,7 @@ struct request_pm_state
264typedef void (request_fn_proc) (struct request_queue *q); 185typedef void (request_fn_proc) (struct request_queue *q);
265typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 186typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
266typedef int (prep_rq_fn) (struct request_queue *, struct request *); 187typedef int (prep_rq_fn) (struct request_queue *, struct request *);
188typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
267typedef void (unplug_fn) (struct request_queue *); 189typedef void (unplug_fn) (struct request_queue *);
268 190
269struct bio_vec; 191struct bio_vec;
@@ -275,7 +197,6 @@ struct bvec_merge_data {
275}; 197};
276typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, 198typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
277 struct bio_vec *); 199 struct bio_vec *);
278typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
279typedef void (softirq_done_fn)(struct request *); 200typedef void (softirq_done_fn)(struct request *);
280typedef int (dma_drain_needed_fn)(struct request *); 201typedef int (dma_drain_needed_fn)(struct request *);
281typedef int (lld_busy_fn) (struct request_queue *q); 202typedef int (lld_busy_fn) (struct request_queue *q);
@@ -346,9 +267,9 @@ struct request_queue
346 request_fn_proc *request_fn; 267 request_fn_proc *request_fn;
347 make_request_fn *make_request_fn; 268 make_request_fn *make_request_fn;
348 prep_rq_fn *prep_rq_fn; 269 prep_rq_fn *prep_rq_fn;
270 unprep_rq_fn *unprep_rq_fn;
349 unplug_fn *unplug_fn; 271 unplug_fn *unplug_fn;
350 merge_bvec_fn *merge_bvec_fn; 272 merge_bvec_fn *merge_bvec_fn;
351 prepare_flush_fn *prepare_flush_fn;
352 softirq_done_fn *softirq_done_fn; 273 softirq_done_fn *softirq_done_fn;
353 rq_timed_out_fn *rq_timed_out_fn; 274 rq_timed_out_fn *rq_timed_out_fn;
354 dma_drain_needed_fn *dma_drain_needed; 275 dma_drain_needed_fn *dma_drain_needed;
@@ -467,11 +388,14 @@ struct request_queue
467#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 388#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
468#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 389#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
469#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ 390#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */
391#define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */
392#define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */
470 393
471#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 394#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
472 (1 << QUEUE_FLAG_CLUSTER) | \ 395 (1 << QUEUE_FLAG_CLUSTER) | \
473 (1 << QUEUE_FLAG_STACKABLE) | \ 396 (1 << QUEUE_FLAG_STACKABLE) | \
474 (1 << QUEUE_FLAG_SAME_COMP)) 397 (1 << QUEUE_FLAG_SAME_COMP) | \
398 (1 << QUEUE_FLAG_ADD_RANDOM))
475 399
476static inline int queue_is_locked(struct request_queue *q) 400static inline int queue_is_locked(struct request_queue *q)
477{ 401{
@@ -596,38 +520,28 @@ enum {
596 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 520 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
597#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 521#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
598#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 522#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
523#define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)
599#define blk_queue_flushing(q) ((q)->ordseq) 524#define blk_queue_flushing(q) ((q)->ordseq)
600#define blk_queue_stackable(q) \ 525#define blk_queue_stackable(q) \
601 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 526 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
602#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) 527#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
528#define blk_queue_secdiscard(q) (blk_queue_discard(q) && \
529 test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags))
530
531#define blk_noretry_request(rq) \
532 ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
533 REQ_FAILFAST_DRIVER))
534
535#define blk_account_rq(rq) \
536 (((rq)->cmd_flags & REQ_STARTED) && \
537 ((rq)->cmd_type == REQ_TYPE_FS || \
538 ((rq)->cmd_flags & REQ_DISCARD)))
603 539
604#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
605#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
606#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
607#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
608
609#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV)
610#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT)
611#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER)
612#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \
613 blk_failfast_transport(rq) || \
614 blk_failfast_driver(rq))
615#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
616#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
617#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
618
619#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
620
621#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
622#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
623#define blk_pm_request(rq) \ 540#define blk_pm_request(rq) \
624 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 541 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
542 (rq)->cmd_type == REQ_TYPE_PM_RESUME)
625 543
626#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 544#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
627#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
628#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
629#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
630#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
631#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 545#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
632/* rq->queuelist of dequeued request must be list_empty() */ 546/* rq->queuelist of dequeued request must be list_empty() */
633#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 547#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
@@ -641,7 +555,7 @@ enum {
641 */ 555 */
642static inline bool rw_is_sync(unsigned int rw_flags) 556static inline bool rw_is_sync(unsigned int rw_flags)
643{ 557{
644 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); 558 return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
645} 559}
646 560
647static inline bool rq_is_sync(struct request *rq) 561static inline bool rq_is_sync(struct request *rq)
@@ -649,9 +563,6 @@ static inline bool rq_is_sync(struct request *rq)
649 return rw_is_sync(rq->cmd_flags); 563 return rw_is_sync(rq->cmd_flags);
650} 564}
651 565
652#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
653#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
654
655static inline int blk_queue_full(struct request_queue *q, int sync) 566static inline int blk_queue_full(struct request_queue *q, int sync)
656{ 567{
657 if (sync) 568 if (sync)
@@ -684,7 +595,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
684 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 595 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
685#define rq_mergeable(rq) \ 596#define rq_mergeable(rq) \
686 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 597 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
687 (blk_discard_rq(rq) || blk_fs_request((rq)))) 598 (((rq)->cmd_flags & REQ_DISCARD) || \
599 (rq)->cmd_type == REQ_TYPE_FS))
688 600
689/* 601/*
690 * q->prep_rq_fn return values 602 * q->prep_rq_fn return values
@@ -709,7 +621,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
709#define BLK_BOUNCE_HIGH -1ULL 621#define BLK_BOUNCE_HIGH -1ULL
710#endif 622#endif
711#define BLK_BOUNCE_ANY (-1ULL) 623#define BLK_BOUNCE_ANY (-1ULL)
712#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 624#define BLK_BOUNCE_ISA (DMA_BIT_MASK(24))
713 625
714/* 626/*
715 * default timeout for SG_IO if none specified 627 * default timeout for SG_IO if none specified
@@ -781,6 +693,8 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
781 gfp_t); 693 gfp_t);
782extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 694extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
783extern void blk_requeue_request(struct request_queue *, struct request *); 695extern void blk_requeue_request(struct request_queue *, struct request *);
696extern void blk_add_request_payload(struct request *rq, struct page *page,
697 unsigned int len);
784extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 698extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
785extern int blk_lld_busy(struct request_queue *q); 699extern int blk_lld_busy(struct request_queue *q);
786extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 700extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
@@ -915,6 +829,7 @@ extern void blk_complete_request(struct request *);
915extern void __blk_complete_request(struct request *); 829extern void __blk_complete_request(struct request *);
916extern void blk_abort_request(struct request *); 830extern void blk_abort_request(struct request *);
917extern void blk_abort_queue(struct request_queue *); 831extern void blk_abort_queue(struct request_queue *);
832extern void blk_unprep_request(struct request *);
918 833
919/* 834/*
920 * Access functions for manipulating queue properties 835 * Access functions for manipulating queue properties
@@ -959,6 +874,7 @@ extern int blk_queue_dma_drain(struct request_queue *q,
959extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); 874extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
960extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 875extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
961extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 876extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
877extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn);
962extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 878extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
963extern void blk_queue_dma_alignment(struct request_queue *, int); 879extern void blk_queue_dma_alignment(struct request_queue *, int);
964extern void blk_queue_update_dma_alignment(struct request_queue *, int); 880extern void blk_queue_update_dma_alignment(struct request_queue *, int);
@@ -966,7 +882,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
966extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 882extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
967extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 883extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
968extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 884extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
969extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 885extern int blk_queue_ordered(struct request_queue *, unsigned);
970extern bool blk_do_ordered(struct request_queue *, struct request **); 886extern bool blk_do_ordered(struct request_queue *, struct request **);
971extern unsigned blk_ordered_cur_seq(struct request_queue *); 887extern unsigned blk_ordered_cur_seq(struct request_queue *);
972extern unsigned blk_ordered_req_seq(struct request *); 888extern unsigned blk_ordered_req_seq(struct request *);
@@ -1005,10 +921,12 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
1005} 921}
1006enum{ 922enum{
1007 BLKDEV_WAIT, /* wait for completion */ 923 BLKDEV_WAIT, /* wait for completion */
1008 BLKDEV_BARRIER, /*issue request with barrier */ 924 BLKDEV_BARRIER, /* issue request with barrier */
925 BLKDEV_SECURE, /* secure discard */
1009}; 926};
1010#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) 927#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
1011#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER) 928#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
929#define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE)
1012extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, 930extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
1013 unsigned long); 931 unsigned long);
1014extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, 932extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
@@ -1020,7 +938,7 @@ static inline int sb_issue_discard(struct super_block *sb,
1020{ 938{
1021 block <<= (sb->s_blocksize_bits - 9); 939 block <<= (sb->s_blocksize_bits - 9);
1022 nr_blocks <<= (sb->s_blocksize_bits - 9); 940 nr_blocks <<= (sb->s_blocksize_bits - 9);
1023 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 941 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
1024 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); 942 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1025} 943}
1026 944
@@ -1333,7 +1251,6 @@ static inline int blk_integrity_rq(struct request *rq)
1333struct block_device_operations { 1251struct block_device_operations {
1334 int (*open) (struct block_device *, fmode_t); 1252 int (*open) (struct block_device *, fmode_t);
1335 int (*release) (struct gendisk *, fmode_t); 1253 int (*release) (struct gendisk *, fmode_t);
1336 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1337 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1254 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1338 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1255 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1339 int (*direct_access) (struct block_device *, sector_t, 1256 int (*direct_access) (struct block_device *, sector_t,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 416bf62d6d46..3395cf7130f5 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -5,6 +5,7 @@
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6#include <linux/blkdev.h> 6#include <linux/blkdev.h>
7#include <linux/relay.h> 7#include <linux/relay.h>
8#include <linux/compat.h>
8#endif 9#endif
9 10
10/* 11/*
@@ -220,11 +221,26 @@ static inline int blk_trace_init_sysfs(struct device *dev)
220 221
221#endif /* CONFIG_BLK_DEV_IO_TRACE */ 222#endif /* CONFIG_BLK_DEV_IO_TRACE */
222 223
224#ifdef CONFIG_COMPAT
225
226struct compat_blk_user_trace_setup {
227 char name[32];
228 u16 act_mask;
229 u32 buf_size;
230 u32 buf_nr;
231 compat_u64 start_lba;
232 compat_u64 end_lba;
233 u32 pid;
234};
235#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
236
237#endif
238
223#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) 239#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
224 240
225static inline int blk_cmd_buf_len(struct request *rq) 241static inline int blk_cmd_buf_len(struct request *rq)
226{ 242{
227 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; 243 return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
228} 244}
229 245
230extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1b9ba193b789..ec94c12f21da 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -32,7 +32,6 @@ enum bh_state_bits {
32 BH_Delay, /* Buffer is not yet allocated on disk */ 32 BH_Delay, /* Buffer is not yet allocated on disk */
33 BH_Boundary, /* Block is followed by a discontiguity */ 33 BH_Boundary, /* Block is followed by a discontiguity */
34 BH_Write_EIO, /* I/O error on write */ 34 BH_Write_EIO, /* I/O error on write */
35 BH_Ordered, /* ordered write */
36 BH_Eopnotsupp, /* operation not supported (barrier) */ 35 BH_Eopnotsupp, /* operation not supported (barrier) */
37 BH_Unwritten, /* Buffer is allocated on disk but not written */ 36 BH_Unwritten, /* Buffer is allocated on disk but not written */
38 BH_Quiet, /* Buffer Error Prinks to be quiet */ 37 BH_Quiet, /* Buffer Error Prinks to be quiet */
@@ -125,7 +124,6 @@ BUFFER_FNS(Async_Write, async_write)
125BUFFER_FNS(Delay, delay) 124BUFFER_FNS(Delay, delay)
126BUFFER_FNS(Boundary, boundary) 125BUFFER_FNS(Boundary, boundary)
127BUFFER_FNS(Write_EIO, write_io_error) 126BUFFER_FNS(Write_EIO, write_io_error)
128BUFFER_FNS(Ordered, ordered)
129BUFFER_FNS(Eopnotsupp, eopnotsupp) 127BUFFER_FNS(Eopnotsupp, eopnotsupp)
130BUFFER_FNS(Unwritten, unwritten) 128BUFFER_FNS(Unwritten, unwritten)
131 129
@@ -183,6 +181,8 @@ void unlock_buffer(struct buffer_head *bh);
183void __lock_buffer(struct buffer_head *bh); 181void __lock_buffer(struct buffer_head *bh);
184void ll_rw_block(int, int, struct buffer_head * bh[]); 182void ll_rw_block(int, int, struct buffer_head * bh[]);
185int sync_dirty_buffer(struct buffer_head *bh); 183int sync_dirty_buffer(struct buffer_head *bh);
184int __sync_dirty_buffer(struct buffer_head *bh, int rw);
185void write_dirty_buffer(struct buffer_head *bh, int rw);
186int submit_bh(int, struct buffer_head *); 186int submit_bh(int, struct buffer_head *);
187void write_boundary_block(struct block_device *bdev, 187void write_boundary_block(struct block_device *bdev,
188 sector_t bblock, unsigned blocksize); 188 sector_t bblock, unsigned blocksize);
@@ -203,12 +203,10 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block,
203int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
205 unsigned long from); 205 unsigned long from);
206int block_write_begin_newtrunc(struct file *, struct address_space *, 206int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
207 loff_t, unsigned, unsigned, 207 unsigned flags, struct page **pagep, get_block_t *get_block);
208 struct page **, void **, get_block_t*); 208int __block_write_begin(struct page *page, loff_t pos, unsigned len,
209int block_write_begin(struct file *, struct address_space *, 209 get_block_t *get_block);
210 loff_t, unsigned, unsigned,
211 struct page **, void **, get_block_t*);
212int block_write_end(struct file *, struct address_space *, 210int block_write_end(struct file *, struct address_space *,
213 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
214 struct page *, void *); 212 struct page *, void *);
@@ -217,9 +215,6 @@ int generic_write_end(struct file *, struct address_space *,
217 struct page *, void *); 215 struct page *, void *);
218void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); 216void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
219int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 217int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
220int cont_write_begin_newtrunc(struct file *, struct address_space *, loff_t,
221 unsigned, unsigned, struct page **, void **,
222 get_block_t *, loff_t *);
223int cont_write_begin(struct file *, struct address_space *, loff_t, 218int cont_write_begin(struct file *, struct address_space *, loff_t,
224 unsigned, unsigned, struct page **, void **, 219 unsigned, unsigned, struct page **, void **,
225 get_block_t *, loff_t *); 220 get_block_t *, loff_t *);
@@ -230,12 +225,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
230void block_sync_page(struct page *); 225void block_sync_page(struct page *);
231sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
232int block_truncate_page(struct address_space *, loff_t, get_block_t *); 227int block_truncate_page(struct address_space *, loff_t, get_block_t *);
233int file_fsync(struct file *, int); 228int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
234int nobh_write_begin_newtrunc(struct file *, struct address_space *,
235 loff_t, unsigned, unsigned,
236 struct page **, void **, get_block_t*);
237int nobh_write_begin(struct file *, struct address_space *,
238 loff_t, unsigned, unsigned,
239 struct page **, void **, get_block_t*); 229 struct page **, void **, get_block_t*);
240int nobh_write_end(struct file *, struct address_space *, 230int nobh_write_end(struct file *, struct address_space *,
241 loff_t, unsigned, unsigned, 231 loff_t, unsigned, unsigned,
@@ -314,15 +304,10 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
314 bh->b_size = sb->s_blocksize; 304 bh->b_size = sb->s_blocksize;
315} 305}
316 306
317/*
318 * Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
319 * __wait_on_buffer() just to trip a debug check. Because debug code in inline
320 * functions is bloaty.
321 */
322static inline void wait_on_buffer(struct buffer_head *bh) 307static inline void wait_on_buffer(struct buffer_head *bh)
323{ 308{
324 might_sleep(); 309 might_sleep();
325 if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0) 310 if (buffer_locked(bh))
326 __wait_on_buffer(bh); 311 __wait_on_buffer(bh);
327} 312}
328 313
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 38437225b092..5896e344ba6c 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,2 +1,2 @@
1unifdef-y += big_endian.h 1header-y += big_endian.h
2unifdef-y += little_endian.h 2header-y += little_endian.h
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8859e2ede9fe..284b520934a0 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -86,9 +86,9 @@ struct upc_req {
86 wait_queue_head_t uc_sleep; /* process' wait queue */ 86 wait_queue_head_t uc_sleep; /* process' wait queue */
87}; 87};
88 88
89#define REQ_ASYNC 0x1 89#define CODA_REQ_ASYNC 0x1
90#define REQ_READ 0x2 90#define CODA_REQ_READ 0x2
91#define REQ_WRITE 0x4 91#define CODA_REQ_WRITE 0x4
92#define REQ_ABORT 0x8 92#define CODA_REQ_ABORT 0x8
93 93
94#endif 94#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 168f7daa7bde..9ddc8780e8db 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -331,7 +331,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
331 const compat_sigset_t __user *sigmask, 331 const compat_sigset_t __user *sigmask,
332 compat_size_t sigsetsize); 332 compat_size_t sigsetsize);
333 333
334asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, 334asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename,
335 struct compat_timespec __user *t, int flags); 335 struct compat_timespec __user *t, int flags);
336 336
337asmlinkage long compat_sys_signalfd(int ufd, 337asmlinkage long compat_sys_signalfd(int ufd,
@@ -348,9 +348,9 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page,
348 const int __user *nodes, 348 const int __user *nodes,
349 int __user *status, 349 int __user *status,
350 int flags); 350 int flags);
351asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, 351asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename,
352 struct compat_timeval __user *t); 352 struct compat_timeval __user *t);
353asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename, 353asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename,
354 struct compat_stat __user *statbuf, 354 struct compat_stat __user *statbuf,
355 int flag); 355 int flag);
356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 0da5b187f124..16508bcddacc 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -35,8 +35,7 @@
35 (typeof(ptr)) (__ptr + (off)); }) 35 (typeof(ptr)) (__ptr + (off)); })
36 36
37/* &a[0] degrades to a pointer: a different type from an array */ 37/* &a[0] degrades to a pointer: a different type from an array */
38#define __must_be_array(a) \ 38#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
39 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
40 39
41/* 40/*
42 * Force always-inline if the user requests it so via the .config, 41 * Force always-inline if the user requests it so via the .config,
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59dc89ae..7f0c32908568 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -21,6 +21,8 @@ struct vt_struct;
21#define NPAR 16 21#define NPAR 16
22 22
23struct vc_data { 23struct vc_data {
24 struct tty_port port; /* Upper level data */
25
24 unsigned short vc_num; /* Console number */ 26 unsigned short vc_num; /* Console number */
25 unsigned int vc_cols; /* [#] Console size */ 27 unsigned int vc_cols; /* [#] Console size */
26 unsigned int vc_rows; 28 unsigned int vc_rows;
@@ -56,7 +58,6 @@ struct vc_data {
56 /* VT terminal data */ 58 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 59 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
59 struct tty_struct *vc_tty; /* TTY we are attached to */
60 /* data for manual vt switching */ 61 /* data for manual vt switching */
61 struct vt_mode vt_mode; 62 struct vt_mode vt_mode;
62 struct pid *vt_pid; 63 struct pid *vt_pid;
@@ -105,6 +106,7 @@ struct vc_data {
105 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
106 unsigned long vc_uni_pagedir; 107 unsigned long vc_uni_pagedir;
107 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
108 /* additional information is in vt_kern.h */ 110 /* additional information is in vt_kern.h */
109}; 111};
110 112
diff --git a/include/linux/cper.h b/include/linux/cper.h
index 4b38f905b705..bf972f81e2a7 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -39,10 +39,10 @@
39 * Severity difinition for error_severity in struct cper_record_header 39 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor 40 * and section_severity in struct cper_section_descriptor
41 */ 41 */
42#define CPER_SER_RECOVERABLE 0x0 42#define CPER_SEV_RECOVERABLE 0x0
43#define CPER_SER_FATAL 0x1 43#define CPER_SEV_FATAL 0x1
44#define CPER_SER_CORRECTED 0x2 44#define CPER_SEV_CORRECTED 0x2
45#define CPER_SER_INFORMATIONAL 0x3 45#define CPER_SEV_INFORMATIONAL 0x3
46 46
47/* 47/*
48 * Validation bits difinition for validation_bits in struct 48 * Validation bits difinition for validation_bits in struct
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 55215cce5005..36ca9721a0c2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -52,6 +52,7 @@ struct cpuidle_state {
52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */ 52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */
53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */ 53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */ 54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
55 56
56#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 57#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
57 58
@@ -84,6 +85,7 @@ struct cpuidle_state_kobj {
84struct cpuidle_device { 85struct cpuidle_device {
85 unsigned int registered:1; 86 unsigned int registered:1;
86 unsigned int enabled:1; 87 unsigned int enabled:1;
88 unsigned int power_specified:1;
87 unsigned int cpu; 89 unsigned int cpu;
88 90
89 int last_residency; 91 int last_residency;
@@ -97,6 +99,8 @@ struct cpuidle_device {
97 struct completion kobj_unregister; 99 struct completion kobj_unregister;
98 void *governor_data; 100 void *governor_data;
99 struct cpuidle_state *safe_state; 101 struct cpuidle_state *safe_state;
102
103 int (*prepare) (struct cpuidle_device *dev);
100}; 104};
101 105
102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 106DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index eebb617c17d8..6a4aea30aa09 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -315,6 +315,8 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
315 315
316extern char *__d_path(const struct path *path, struct path *root, char *, int); 316extern char *__d_path(const struct path *path, struct path *root, char *, int);
317extern char *d_path(const struct path *, char *, int); 317extern char *d_path(const struct path *, char *, int);
318extern char *d_path_with_unreachable(const struct path *, char *, int);
319extern char *__dentry_path(struct dentry *, char *, int);
318extern char *dentry_path(struct dentry *, char *, int); 320extern char *dentry_path(struct dentry *, char *, int);
319 321
320/* Allocation counts.. */ 322/* Allocation counts.. */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 1381cd97b4ed..2970022faa63 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -22,7 +22,7 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
22union map_info { 22union map_info {
23 void *ptr; 23 void *ptr;
24 unsigned long long ll; 24 unsigned long long ll;
25 unsigned flush_request; 25 unsigned target_request_nr;
26}; 26};
27 27
28/* 28/*
@@ -174,12 +174,18 @@ struct dm_target {
174 * A number of zero-length barrier requests that will be submitted 174 * A number of zero-length barrier requests that will be submitted
175 * to the target for the purpose of flushing cache. 175 * to the target for the purpose of flushing cache.
176 * 176 *
177 * The request number will be placed in union map_info->flush_request. 177 * The request number will be placed in union map_info->target_request_nr.
178 * It is a responsibility of the target driver to remap these requests 178 * It is a responsibility of the target driver to remap these requests
179 * to the real underlying devices. 179 * to the real underlying devices.
180 */ 180 */
181 unsigned num_flush_requests; 181 unsigned num_flush_requests;
182 182
183 /*
184 * The number of discard requests that will be submitted to the
185 * target. map_info->request_nr is used just like num_flush_requests.
186 */
187 unsigned num_discard_requests;
188
183 /* target specific data */ 189 /* target specific data */
184 void *private; 190 void *private;
185 191
@@ -392,6 +398,12 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
392#define dm_array_too_big(fixed, obj, num) \ 398#define dm_array_too_big(fixed, obj, num) \
393 ((num) > (UINT_MAX - (fixed)) / (obj)) 399 ((num) > (UINT_MAX - (fixed)) / (obj))
394 400
401/*
402 * Sector offset taken relative to the start of the target instead of
403 * relative to the start of the device.
404 */
405#define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
406
395static inline sector_t to_sector(unsigned long n) 407static inline sector_t to_sector(unsigned long n)
396{ 408{
397 return (n >> SECTOR_SHIFT); 409 return (n >> SECTOR_SHIFT);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 2c445e113790..49eab360d5d4 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13#define DM_DIR "mapper" /* Slashes not supported */ 13#define DM_DIR "mapper" /* Slashes not supported */
14#define DM_CONTROL_NODE "control"
14#define DM_MAX_TYPE_NAME 16 15#define DM_MAX_TYPE_NAME 16
15#define DM_NAME_LEN 128 16#define DM_NAME_LEN 128
16#define DM_UUID_LEN 129 17#define DM_UUID_LEN 129
@@ -266,9 +267,9 @@ enum {
266#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
267 268
268#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
269#define DM_VERSION_MINOR 17 270#define DM_VERSION_MINOR 18
270#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
271#define DM_VERSION_EXTRA "-ioctl (2010-03-05)" 272#define DM_VERSION_EXTRA "-ioctl (2010-06-29)"
272 273
273/* Status bits */ 274/* Status bits */
274#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 89b7e1a605b8..ce29b8151198 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -142,6 +142,16 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
142 return -EIO; 142 return -EIO;
143} 143}
144 144
145#ifdef CONFIG_HAS_DMA
146static inline int dma_get_cache_alignment(void)
147{
148#ifdef ARCH_DMA_MINALIGN
149 return ARCH_DMA_MINALIGN;
150#endif
151 return 1;
152}
153#endif
154
145/* flags for the coherent memory api */ 155/* flags for the coherent memory api */
146#define DMA_MEMORY_MAP 0x01 156#define DMA_MEMORY_MAP 0x01
147#define DMA_MEMORY_IO 0x02 157#define DMA_MEMORY_IO 0x02
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 5204f018931b..c61d4ca27bcc 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -114,11 +114,17 @@ enum dma_ctrl_flags {
114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers 114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers
115 * @DMA_PAUSE: pause ongoing transfers 115 * @DMA_PAUSE: pause ongoing transfers
116 * @DMA_RESUME: resume paused transfer 116 * @DMA_RESUME: resume paused transfer
117 * @DMA_SLAVE_CONFIG: this command is only implemented by DMA controllers
118 * that need to runtime reconfigure the slave channels (as opposed to passing
119 * configuration data in statically from the platform). An additional
120 * argument of struct dma_slave_config must be passed in with this
121 * command.
117 */ 122 */
118enum dma_ctrl_cmd { 123enum dma_ctrl_cmd {
119 DMA_TERMINATE_ALL, 124 DMA_TERMINATE_ALL,
120 DMA_PAUSE, 125 DMA_PAUSE,
121 DMA_RESUME, 126 DMA_RESUME,
127 DMA_SLAVE_CONFIG,
122}; 128};
123 129
124/** 130/**
@@ -199,6 +205,71 @@ struct dma_chan_dev {
199 atomic_t *idr_ref; 205 atomic_t *idr_ref;
200}; 206};
201 207
208/**
209 * enum dma_slave_buswidth - defines bus with of the DMA slave
210 * device, source or target buses
211 */
212enum dma_slave_buswidth {
213 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
214 DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
215 DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
216 DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
217 DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
218};
219
220/**
221 * struct dma_slave_config - dma slave channel runtime config
222 * @direction: whether the data shall go in or out on this slave
223 * channel, right now. DMA_TO_DEVICE and DMA_FROM_DEVICE are
224 * legal values, DMA_BIDIRECTIONAL is not acceptable since we
225 * need to differentiate source and target addresses.
226 * @src_addr: this is the physical address where DMA slave data
227 * should be read (RX), if the source is memory this argument is
228 * ignored.
229 * @dst_addr: this is the physical address where DMA slave data
230 * should be written (TX), if the source is memory this argument
231 * is ignored.
232 * @src_addr_width: this is the width in bytes of the source (RX)
233 * register where DMA data shall be read. If the source
234 * is memory this may be ignored depending on architecture.
235 * Legal values: 1, 2, 4, 8.
236 * @dst_addr_width: same as src_addr_width but for destination
237 * target (TX) mutatis mutandis.
238 * @src_maxburst: the maximum number of words (note: words, as in
239 * units of the src_addr_width member, not bytes) that can be sent
240 * in one burst to the device. Typically something like half the
241 * FIFO depth on I/O peripherals so you don't overflow it. This
242 * may or may not be applicable on memory sources.
243 * @dst_maxburst: same as src_maxburst but for destination target
244 * mutatis mutandis.
245 *
246 * This struct is passed in as configuration data to a DMA engine
247 * in order to set up a certain channel for DMA transport at runtime.
248 * The DMA device/engine has to provide support for an additional
249 * command in the channel config interface, DMA_SLAVE_CONFIG
250 * and this struct will then be passed in as an argument to the
251 * DMA engine device_control() function.
252 *
253 * The rationale for adding configuration information to this struct
254 * is as follows: if it is likely that most DMA slave controllers in
255 * the world will support the configuration option, then make it
256 * generic. If not: if it is fixed so that it be sent in static from
257 * the platform data, then prefer to do that. Else, if it is neither
258 * fixed at runtime, nor generic enough (such as bus mastership on
259 * some CPU family and whatnot) then create a custom slave config
260 * struct and pass that, then make this config a member of that
261 * struct, if applicable.
262 */
263struct dma_slave_config {
264 enum dma_data_direction direction;
265 dma_addr_t src_addr;
266 dma_addr_t dst_addr;
267 enum dma_slave_buswidth src_addr_width;
268 enum dma_slave_buswidth dst_addr_width;
269 u32 src_maxburst;
270 u32 dst_maxburst;
271};
272
202static inline const char *dma_chan_name(struct dma_chan *chan) 273static inline const char *dma_chan_name(struct dma_chan *chan)
203{ 274{
204 return dev_name(&chan->dev->device); 275 return dev_name(&chan->dev->device);
diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h
index ecc06286226d..3290555a52ee 100644
--- a/include/linux/dnotify.h
+++ b/include/linux/dnotify.h
@@ -28,6 +28,7 @@ struct dnotify_struct {
28 FS_CREATE | FS_DN_RENAME |\ 28 FS_CREATE | FS_DN_RENAME |\
29 FS_MOVED_FROM | FS_MOVED_TO) 29 FS_MOVED_FROM | FS_MOVED_TO)
30 30
31extern int dir_notify_enable;
31extern void dnotify_flush(struct file *, fl_owner_t); 32extern void dnotify_flush(struct file *, fl_owner_t);
32extern int fcntl_dirnotify(int, struct file *, unsigned long); 33extern int fcntl_dirnotify(int, struct file *, unsigned long);
33 34
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index b8d2516668aa..479ee3a1d901 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,7 +53,7 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.8" 56#define REL_VERSION "8.3.8.1"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 94 59#define PRO_VERSION_MAX 94
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index ce77a746fc9d..5f042810a56c 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -78,10 +78,11 @@ NL_PACKET(syncer_conf, 8,
78 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
79 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81 NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) 81/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) 82 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) 83 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) 84 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
85 * feature will be reimplemented differently with 8.3.9 */
85 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 86 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
86 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 87 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
87 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 88 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
index d97b3a51e227..f4dba8637f98 100644
--- a/include/linux/dvb/Kbuild
+++ b/include/linux/dvb/Kbuild
@@ -1,9 +1,8 @@
1header-y += audio.h
1header-y += ca.h 2header-y += ca.h
3header-y += dmx.h
2header-y += frontend.h 4header-y += frontend.h
3header-y += net.h 5header-y += net.h
4header-y += osd.h 6header-y += osd.h
5header-y += version.h 7header-y += version.h
6 8header-y += video.h
7unifdef-y += audio.h
8unifdef-y += dmx.h
9unifdef-y += video.h
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 848480bc2bf9..2308fbb4523a 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -129,7 +129,7 @@ static inline void random_ether_addr(u8 *addr)
129/** 129/**
130 * dev_hw_addr_random - Create random MAC and set device flag 130 * dev_hw_addr_random - Create random MAC and set device flag
131 * @dev: pointer to net_device structure 131 * @dev: pointer to net_device structure
132 * @addr: Pointer to a six-byte array containing the Ethernet address 132 * @hwaddr: Pointer to a six-byte array containing the Ethernet address
133 * 133 *
134 * Generate random MAC to be used by a device and set addr_assign_type 134 * Generate random MAC to be used by a device and set addr_assign_type
135 * so the state can be read by sysfs and be used by udev. 135 * so the state can be read by sysfs and be used by udev.
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 3d3a9915dde2..6ce1bca01724 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -895,7 +895,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
895extern struct inode *ext3_iget(struct super_block *, unsigned long); 895extern struct inode *ext3_iget(struct super_block *, unsigned long);
896extern int ext3_write_inode (struct inode *, struct writeback_control *); 896extern int ext3_write_inode (struct inode *, struct writeback_control *);
897extern int ext3_setattr (struct dentry *, struct iattr *); 897extern int ext3_setattr (struct dentry *, struct iattr *);
898extern void ext3_delete_inode (struct inode *); 898extern void ext3_evict_inode (struct inode *);
899extern int ext3_sync_inode (handle_t *, struct inode *); 899extern int ext3_sync_inode (handle_t *, struct inode *);
900extern void ext3_discard_reservation (struct inode *); 900extern void ext3_discard_reservation (struct inode *);
901extern void ext3_dirty_inode(struct inode *); 901extern void ext3_dirty_inode(struct inode *);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
new file mode 100644
index 000000000000..f0949a57ca9d
--- /dev/null
+++ b/include/linux/fanotify.h
@@ -0,0 +1,105 @@
1#ifndef _LINUX_FANOTIFY_H
2#define _LINUX_FANOTIFY_H
3
4#include <linux/types.h>
5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
14
15/* FIXME currently Q's have no limit.... */
16#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
17
18#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
19#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
20
21/* helper events */
22#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
23
24/* flags used for fanotify_init() */
25#define FAN_CLOEXEC 0x00000001
26#define FAN_NONBLOCK 0x00000002
27
28#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK)
29
30/* flags used for fanotify_modify_mark() */
31#define FAN_MARK_ADD 0x00000001
32#define FAN_MARK_REMOVE 0x00000002
33#define FAN_MARK_DONT_FOLLOW 0x00000004
34#define FAN_MARK_ONLYDIR 0x00000008
35#define FAN_MARK_MOUNT 0x00000010
36#define FAN_MARK_IGNORED_MASK 0x00000020
37#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
38#define FAN_MARK_FLUSH 0x00000080
39
40#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
41 FAN_MARK_REMOVE |\
42 FAN_MARK_DONT_FOLLOW |\
43 FAN_MARK_ONLYDIR |\
44 FAN_MARK_MOUNT |\
45 FAN_MARK_IGNORED_MASK |\
46 FAN_MARK_IGNORED_SURV_MODIFY)
47
48/*
49 * All of the events - we build the list by hand so that we can add flags in
50 * the future and not break backward compatibility. Apps will get only the
51 * events that they originally wanted. Be sure to add new events here!
52 */
53#define FAN_ALL_EVENTS (FAN_ACCESS |\
54 FAN_MODIFY |\
55 FAN_CLOSE |\
56 FAN_OPEN)
57
58/*
59 * All events which require a permission response from userspace
60 */
61#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
62 FAN_ACCESS_PERM)
63
64#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
65 FAN_ALL_PERM_EVENTS |\
66 FAN_Q_OVERFLOW)
67
68#define FANOTIFY_METADATA_VERSION 1
69
70struct fanotify_event_metadata {
71 __u32 event_len;
72 __u32 vers;
73 __s32 fd;
74 __u64 mask;
75 __s64 pid;
76} __attribute__ ((packed));
77
78struct fanotify_response {
79 __s32 fd;
80 __u32 response;
81} __attribute__ ((packed));
82
83/* Legit userspace responses to a _PERM event */
84#define FAN_ALLOW 0x01
85#define FAN_DENY 0x02
86
87/* Helper functions to deal with fanotify_event_metadata buffers */
88#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
89
90#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
91 (struct fanotify_event_metadata*)(((char *)(meta)) + \
92 (meta)->event_len))
93
94#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
95 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
96 (long)(meta)->event_len <= (long)(len))
97
98#ifdef __KERNEL__
99
100struct fanotify_wait {
101 struct fsnotify_event *event;
102 __s32 fd;
103};
104#endif /* __KERNEL__ */
105#endif /* _LINUX_FANOTIFY_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 0c5659c41b01..f0268deca658 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -825,6 +825,10 @@ struct fb_tile_ops {
825 */ 825 */
826#define FBINFO_BE_MATH 0x100000 826#define FBINFO_BE_MATH 0x100000
827 827
828/* report to the VT layer that this fb driver can accept forced console
829 output like oopses */
830#define FBINFO_CAN_FORCE_OUTPUT 0x200000
831
828struct fb_info { 832struct fb_info {
829 int node; 833 int node;
830 int flags; 834 int flags;
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 1d747f72298b..631b77f2ac70 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -70,4 +70,9 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
70void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa); 71int flex_array_shrink(struct flex_array *fa);
72 72
73#define flex_array_put_ptr(fa, nr, src, gfp) \
74 flex_array_put(fa, nr, &(void *)(src), gfp)
75
76void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr);
77
73#endif /* _FLEX_ARRAY_H */ 78#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e5106e49bd2c..76041b614758 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
11 12
12/* 13/*
13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -91,6 +92,9 @@ struct inodes_stat_t {
91/* Expect random access pattern */ 92/* Expect random access pattern */
92#define FMODE_RANDOM ((__force fmode_t)0x1000) 93#define FMODE_RANDOM ((__force fmode_t)0x1000)
93 94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
97
94/* 98/*
95 * The below are the various read and write types that we support. Some of 99 * The below are the various read and write types that we support. Some of
96 * them include behavioral modifiers that send information down to the 100 * them include behavioral modifiers that send information down to the
@@ -118,12 +122,9 @@ struct inodes_stat_t {
118 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
119 * unplugging. 123 * unplugging.
120 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
121 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
122 * request if it runs into resource problems. 126 * request if it runs into resource problems.
123 * WRITE A normal async write. Device will be plugged. 127 * WRITE A normal async write. Device will be plugged.
124 * SWRITE Like WRITE, but a special case for ll_rw_block() that
125 * tells it to lock the buffer first. Normally a buffer
126 * must be locked before doing IO.
127 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down 128 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down
128 * the hint that someone will be waiting on this IO 129 * the hint that someone will be waiting on this IO
129 * shortly. The device must still be unplugged explicitly, 130 * shortly. The device must still be unplugged explicitly,
@@ -134,10 +135,7 @@ struct inodes_stat_t {
134 * immediately after submission. The write equivalent 135 * immediately after submission. The write equivalent
135 * of READ_SYNC. 136 * of READ_SYNC.
136 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. 137 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
137 * SWRITE_SYNC 138 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
138 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
139 * See SWRITE.
140 * WRITE_BARRIER Like WRITE, but tells the block layer that all
141 * previously submitted writes must be safely on storage 139 * previously submitted writes must be safely on storage
142 * before this one is started. Also guarantees that when 140 * before this one is started. Also guarantees that when
143 * this write is complete, it itself is also safely on 141 * this write is complete, it itself is also safely on
@@ -145,29 +143,29 @@ struct inodes_stat_t {
145 * of this IO. 143 * of this IO.
146 * 144 *
147 */ 145 */
148#define RW_MASK 1 146#define RW_MASK REQ_WRITE
149#define RWA_MASK 2 147#define RWA_MASK REQ_RAHEAD
150#define READ 0 148
151#define WRITE 1 149#define READ 0
152#define READA 2 /* read-ahead - don't block if no resources */ 150#define WRITE RW_MASK
153#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 151#define READA RWA_MASK
154#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 152
155#define READ_META (READ | (1 << BIO_RW_META)) 153#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
156#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 154#define READ_META (READ | REQ_META)
157#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 155#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
158#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 156#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
159#define WRITE_META (WRITE | (1 << BIO_RW_META)) 157#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
160#define SWRITE_SYNC_PLUG \ 158#define WRITE_META (WRITE | REQ_META)
161 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 159#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
162#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 160 REQ_HARDBARRIER)
163#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
164 161
165/* 162/*
166 * These aren't really reads or writes, they pass down information about 163 * These aren't really reads or writes, they pass down information about
167 * parts of device that are now unused by the file system. 164 * parts of device that are now unused by the file system.
168 */ 165 */
169#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 166#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
170#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 167#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
168#define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE)
171 169
172#define SEL_IN 1 170#define SEL_IN 1
173#define SEL_OUT 2 171#define SEL_OUT 2
@@ -210,6 +208,7 @@ struct inodes_stat_t {
210#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 208#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
211#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 209#define MS_I_VERSION (1<<23) /* Update inode I_version field */
212#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 210#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
211#define MS_BORN (1<<29)
213#define MS_ACTIVE (1<<30) 212#define MS_ACTIVE (1<<30)
214#define MS_NOUSER (1<<31) 213#define MS_NOUSER (1<<31)
215 214
@@ -310,6 +309,7 @@ struct inodes_stat_t {
310#define BLKALIGNOFF _IO(0x12,122) 309#define BLKALIGNOFF _IO(0x12,122)
311#define BLKPBSZGET _IO(0x12,123) 310#define BLKPBSZGET _IO(0x12,123)
312#define BLKDISCARDZEROES _IO(0x12,124) 311#define BLKDISCARDZEROES _IO(0x12,124)
312#define BLKSECDISCARD _IO(0x12,125)
313 313
314#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 314#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
315#define FIBMAP _IO(0x00,1) /* bmap access */ 315#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -408,9 +408,6 @@ extern int get_max_files(void);
408extern int sysctl_nr_open; 408extern int sysctl_nr_open;
409extern struct inodes_stat_t inodes_stat; 409extern struct inodes_stat_t inodes_stat;
410extern int leases_enable, lease_break_time; 410extern int leases_enable, lease_break_time;
411#ifdef CONFIG_DNOTIFY
412extern int dir_notify_enable;
413#endif
414 411
415struct buffer_head; 412struct buffer_head;
416typedef int (get_block_t)(struct inode *inode, sector_t iblock, 413typedef int (get_block_t)(struct inode *inode, sector_t iblock,
@@ -687,6 +684,7 @@ struct block_device {
687 */ 684 */
688#define PAGECACHE_TAG_DIRTY 0 685#define PAGECACHE_TAG_DIRTY 0
689#define PAGECACHE_TAG_WRITEBACK 1 686#define PAGECACHE_TAG_WRITEBACK 1
687#define PAGECACHE_TAG_TOWRITE 2
690 688
691int mapping_tagged(struct address_space *mapping, int tag); 689int mapping_tagged(struct address_space *mapping, int tag);
692 690
@@ -770,12 +768,7 @@ struct inode {
770 768
771#ifdef CONFIG_FSNOTIFY 769#ifdef CONFIG_FSNOTIFY
772 __u32 i_fsnotify_mask; /* all events this inode cares about */ 770 __u32 i_fsnotify_mask; /* all events this inode cares about */
773 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 771 struct hlist_head i_fsnotify_marks;
774#endif
775
776#ifdef CONFIG_INOTIFY
777 struct list_head inotify_watches; /* watches on this inode */
778 struct mutex inotify_mutex; /* protects the watches list */
779#endif 772#endif
780 773
781 unsigned long i_state; 774 unsigned long i_state;
@@ -927,6 +920,9 @@ struct file {
927#define f_vfsmnt f_path.mnt 920#define f_vfsmnt f_path.mnt
928 const struct file_operations *f_op; 921 const struct file_operations *f_op;
929 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ 922 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
923#ifdef CONFIG_SMP
924 int f_sb_list_cpu;
925#endif
930 atomic_long_t f_count; 926 atomic_long_t f_count;
931 unsigned int f_flags; 927 unsigned int f_flags;
932 fmode_t f_mode; 928 fmode_t f_mode;
@@ -951,9 +947,6 @@ struct file {
951 unsigned long f_mnt_write_state; 947 unsigned long f_mnt_write_state;
952#endif 948#endif
953}; 949};
954extern spinlock_t files_lock;
955#define file_list_lock() spin_lock(&files_lock);
956#define file_list_unlock() spin_unlock(&files_lock);
957 950
958#define get_file(x) atomic_long_inc(&(x)->f_count) 951#define get_file(x) atomic_long_inc(&(x)->f_count)
959#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 952#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
@@ -1344,7 +1337,11 @@ struct super_block {
1344 1337
1345 struct list_head s_inodes; /* all inodes */ 1338 struct list_head s_inodes; /* all inodes */
1346 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1339 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1340#ifdef CONFIG_SMP
1341 struct list_head __percpu *s_files;
1342#else
1347 struct list_head s_files; 1343 struct list_head s_files;
1344#endif
1348 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1345 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
1349 struct list_head s_dentry_lru; /* unused dentry lru */ 1346 struct list_head s_dentry_lru; /* unused dentry lru */
1350 int s_nr_dentry_unused; /* # of dentry on lru */ 1347 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1481,8 +1478,8 @@ struct block_device_operations;
1481 1478
1482/* 1479/*
1483 * NOTE: 1480 * NOTE:
1484 * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl 1481 * all file operations except setlease can be called without
1485 * can be called without the big kernel lock held in all filesystems. 1482 * the big kernel lock held in all filesystems.
1486 */ 1483 */
1487struct file_operations { 1484struct file_operations {
1488 struct module *owner; 1485 struct module *owner;
@@ -1493,7 +1490,6 @@ struct file_operations {
1493 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1490 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1494 int (*readdir) (struct file *, void *, filldir_t); 1491 int (*readdir) (struct file *, void *, filldir_t);
1495 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1492 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1496 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
1497 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1493 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1498 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1494 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1499 int (*mmap) (struct file *, struct vm_area_struct *); 1495 int (*mmap) (struct file *, struct vm_area_struct *);
@@ -1563,8 +1559,8 @@ struct super_operations {
1563 1559
1564 void (*dirty_inode) (struct inode *); 1560 void (*dirty_inode) (struct inode *);
1565 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1561 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1566 void (*drop_inode) (struct inode *); 1562 int (*drop_inode) (struct inode *);
1567 void (*delete_inode) (struct inode *); 1563 void (*evict_inode) (struct inode *);
1568 void (*put_super) (struct super_block *); 1564 void (*put_super) (struct super_block *);
1569 void (*write_super) (struct super_block *); 1565 void (*write_super) (struct super_block *);
1570 int (*sync_fs)(struct super_block *sb, int wait); 1566 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1572,7 +1568,6 @@ struct super_operations {
1572 int (*unfreeze_fs) (struct super_block *); 1568 int (*unfreeze_fs) (struct super_block *);
1573 int (*statfs) (struct dentry *, struct kstatfs *); 1569 int (*statfs) (struct dentry *, struct kstatfs *);
1574 int (*remount_fs) (struct super_block *, int *, char *); 1570 int (*remount_fs) (struct super_block *, int *, char *);
1575 void (*clear_inode) (struct inode *);
1576 void (*umount_begin) (struct super_block *); 1571 void (*umount_begin) (struct super_block *);
1577 1572
1578 int (*show_options)(struct seq_file *, struct vfsmount *); 1573 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1617,8 +1612,8 @@ struct super_operations {
1617 * I_FREEING Set when inode is about to be freed but still has dirty 1612 * I_FREEING Set when inode is about to be freed but still has dirty
1618 * pages or buffers attached or the inode itself is still 1613 * pages or buffers attached or the inode itself is still
1619 * dirty. 1614 * dirty.
1620 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1615 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1621 * and can be destroyed. 1616 * and can be destroyed. Inode keeps I_FREEING.
1622 * 1617 *
1623 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1618 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1624 * prohibited for many purposes. iget() must wait for 1619 * prohibited for many purposes. iget() must wait for
@@ -1815,7 +1810,8 @@ extern struct vfsmount *collect_mounts(struct path *);
1815extern void drop_collected_mounts(struct vfsmount *); 1810extern void drop_collected_mounts(struct vfsmount *);
1816extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1811extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1817 struct vfsmount *); 1812 struct vfsmount *);
1818extern int vfs_statfs(struct dentry *, struct kstatfs *); 1813extern int vfs_statfs(struct path *, struct kstatfs *);
1814extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1819extern int freeze_super(struct super_block *super); 1815extern int freeze_super(struct super_block *super);
1820extern int thaw_super(struct super_block *super); 1816extern int thaw_super(struct super_block *super);
1821 1817
@@ -2165,9 +2161,8 @@ extern void iput(struct inode *);
2165extern struct inode * igrab(struct inode *); 2161extern struct inode * igrab(struct inode *);
2166extern ino_t iunique(struct super_block *, ino_t); 2162extern ino_t iunique(struct super_block *, ino_t);
2167extern int inode_needs_sync(struct inode *inode); 2163extern int inode_needs_sync(struct inode *inode);
2168extern void generic_delete_inode(struct inode *inode); 2164extern int generic_delete_inode(struct inode *inode);
2169extern void generic_drop_inode(struct inode *inode); 2165extern int generic_drop_inode(struct inode *inode);
2170extern int generic_detach_inode(struct inode *inode);
2171 2166
2172extern struct inode *ilookup5_nowait(struct super_block *sb, 2167extern struct inode *ilookup5_nowait(struct super_block *sb,
2173 unsigned long hashval, int (*test)(struct inode *, void *), 2168 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2184,7 +2179,7 @@ extern void unlock_new_inode(struct inode *);
2184 2179
2185extern void __iget(struct inode * inode); 2180extern void __iget(struct inode * inode);
2186extern void iget_failed(struct inode *); 2181extern void iget_failed(struct inode *);
2187extern void clear_inode(struct inode *); 2182extern void end_writeback(struct inode *);
2188extern void destroy_inode(struct inode *); 2183extern void destroy_inode(struct inode *);
2189extern void __destroy_inode(struct inode *); 2184extern void __destroy_inode(struct inode *);
2190extern struct inode *new_inode(struct super_block *); 2185extern struct inode *new_inode(struct super_block *);
@@ -2197,10 +2192,7 @@ static inline void insert_inode_hash(struct inode *inode) {
2197 __insert_inode_hash(inode, inode->i_ino); 2192 __insert_inode_hash(inode, inode->i_ino);
2198} 2193}
2199 2194
2200extern void file_move(struct file *f, struct list_head *list);
2201extern void file_kill(struct file *f);
2202#ifdef CONFIG_BLOCK 2195#ifdef CONFIG_BLOCK
2203struct bio;
2204extern void submit_bio(int, struct bio *); 2196extern void submit_bio(int, struct bio *);
2205extern int bdev_read_only(struct block_device *); 2197extern int bdev_read_only(struct block_device *);
2206#endif 2198#endif
@@ -2267,19 +2259,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2267#endif 2259#endif
2268 2260
2269#ifdef CONFIG_BLOCK 2261#ifdef CONFIG_BLOCK
2270struct bio;
2271typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, 2262typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2272 loff_t file_offset); 2263 loff_t file_offset);
2273void dio_end_io(struct bio *bio, int error);
2274
2275ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2276 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2277 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2278 dio_submit_t submit_io, int lock_type);
2279ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2280 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2281 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2282 dio_submit_t submit_io, int lock_type);
2283 2264
2284enum { 2265enum {
2285 /* need locking between buffered and direct access */ 2266 /* need locking between buffered and direct access */
@@ -2289,24 +2270,13 @@ enum {
2289 DIO_SKIP_HOLES = 0x02, 2270 DIO_SKIP_HOLES = 0x02,
2290}; 2271};
2291 2272
2292static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, 2273void dio_end_io(struct bio *bio, int error);
2293 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2274
2294 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2275ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2295 dio_iodone_t end_io) 2276 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2296{ 2277 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2297 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, 2278 dio_submit_t submit_io, int flags);
2298 nr_segs, get_block, end_io, NULL,
2299 DIO_LOCKING | DIO_SKIP_HOLES);
2300}
2301 2279
2302static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2303 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2304 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2305 dio_iodone_t end_io)
2306{
2307 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2308 nr_segs, get_block, end_io, NULL, 0);
2309}
2310static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2280static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2311 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2281 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2312 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2282 loff_t offset, unsigned long nr_segs, get_block_t get_block,
@@ -2316,15 +2286,6 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2316 nr_segs, get_block, end_io, NULL, 2286 nr_segs, get_block, end_io, NULL,
2317 DIO_LOCKING | DIO_SKIP_HOLES); 2287 DIO_LOCKING | DIO_SKIP_HOLES);
2318} 2288}
2319
2320static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2321 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2322 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2323 dio_iodone_t end_io)
2324{
2325 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2326 nr_segs, get_block, end_io, NULL, 0);
2327}
2328#endif 2289#endif
2329 2290
2330extern const struct file_operations generic_ro_fops; 2291extern const struct file_operations generic_ro_fops;
@@ -2351,10 +2312,10 @@ void inode_set_bytes(struct inode *inode, loff_t bytes);
2351 2312
2352extern int vfs_readdir(struct file *, filldir_t, void *); 2313extern int vfs_readdir(struct file *, filldir_t, void *);
2353 2314
2354extern int vfs_stat(char __user *, struct kstat *); 2315extern int vfs_stat(const char __user *, struct kstat *);
2355extern int vfs_lstat(char __user *, struct kstat *); 2316extern int vfs_lstat(const char __user *, struct kstat *);
2356extern int vfs_fstat(unsigned int, struct kstat *); 2317extern int vfs_fstat(unsigned int, struct kstat *);
2357extern int vfs_fstatat(int , char __user *, struct kstat *, int); 2318extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
2358 2319
2359extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2320extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2360 unsigned long arg); 2321 unsigned long arg);
@@ -2386,7 +2347,6 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2386extern int simple_unlink(struct inode *, struct dentry *); 2347extern int simple_unlink(struct inode *, struct dentry *);
2387extern int simple_rmdir(struct inode *, struct dentry *); 2348extern int simple_rmdir(struct inode *, struct dentry *);
2388extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2349extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2389extern int simple_setsize(struct inode *, loff_t);
2390extern int noop_fsync(struct file *, int); 2350extern int noop_fsync(struct file *, int);
2391extern int simple_empty(struct dentry *); 2351extern int simple_empty(struct dentry *);
2392extern int simple_readpage(struct file *file, struct page *page); 2352extern int simple_readpage(struct file *file, struct page *page);
@@ -2423,8 +2383,7 @@ extern int buffer_migrate_page(struct address_space *,
2423 2383
2424extern int inode_change_ok(const struct inode *, struct iattr *); 2384extern int inode_change_ok(const struct inode *, struct iattr *);
2425extern int inode_newsize_ok(const struct inode *, loff_t offset); 2385extern int inode_newsize_ok(const struct inode *, loff_t offset);
2426extern int __must_check inode_setattr(struct inode *, const struct iattr *); 2386extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2427extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2428 2387
2429extern void file_update_time(struct file *file); 2388extern void file_update_time(struct file *file);
2430 2389
@@ -2515,7 +2474,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2515int __init get_filesystem_list(char *buf); 2474int __init get_filesystem_list(char *buf);
2516 2475
2517#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2476#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2518#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2477#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2478 (flag & FMODE_NONOTIFY)))
2519 2479
2520#endif /* __KERNEL__ */ 2480#endif /* __KERNEL__ */
2521#endif /* _LINUX_FS_H */ 2481#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 78a05bfcd8eb..a42b5bf02f8b 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -5,7 +5,7 @@
5 5
6struct fs_struct { 6struct fs_struct {
7 int users; 7 int users;
8 rwlock_t lock; 8 spinlock_t lock;
9 int umask; 9 int umask;
10 int in_exec; 10 int in_exec;
11 struct path root, pwd; 11 struct path root, pwd;
@@ -21,4 +21,31 @@ extern void free_fs_struct(struct fs_struct *);
21extern void daemonize_fs_struct(void); 21extern void daemonize_fs_struct(void);
22extern int unshare_fs_struct(void); 22extern int unshare_fs_struct(void);
23 23
24static inline void get_fs_root(struct fs_struct *fs, struct path *root)
25{
26 spin_lock(&fs->lock);
27 *root = fs->root;
28 path_get(root);
29 spin_unlock(&fs->lock);
30}
31
32static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
33{
34 spin_lock(&fs->lock);
35 *pwd = fs->pwd;
36 path_get(pwd);
37 spin_unlock(&fs->lock);
38}
39
40static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
41 struct path *pwd)
42{
43 spin_lock(&fs->lock);
44 *root = fs->root;
45 path_get(root);
46 *pwd = fs->pwd;
47 path_get(pwd);
48 spin_unlock(&fs->lock);
49}
50
24#endif /* _LINUX_FS_STRUCT_H */ 51#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 01755909ce81..59d0df43ff9d 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#include <linux/dnotify.h>
15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 15#include <linux/audit.h>
18#include <linux/slab.h> 16#include <linux/slab.h>
@@ -21,35 +19,53 @@
21 * fsnotify_d_instantiate - instantiate a dentry for inode 19 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held. 20 * Called with dcache_lock held.
23 */ 21 */
24static inline void fsnotify_d_instantiate(struct dentry *entry, 22static inline void fsnotify_d_instantiate(struct dentry *dentry,
25 struct inode *inode) 23 struct inode *inode)
26{ 24{
27 __fsnotify_d_instantiate(entry, inode); 25 __fsnotify_d_instantiate(dentry, inode);
28
29 inotify_d_instantiate(entry, inode);
30} 26}
31 27
32/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
33static inline void fsnotify_parent(struct dentry *dentry, __u32 mask) 29static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
34{ 30{
35 __fsnotify_parent(dentry, mask); 31 if (!dentry)
32 dentry = path->dentry;
33
34 __fsnotify_parent(path, dentry, mask);
35}
36 36
37 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 37/* simple call site for access decisions */
38static inline int fsnotify_perm(struct file *file, int mask)
39{
40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode;
42 __u32 fsnotify_mask = 0;
43
44 if (file->f_mode & FMODE_NONOTIFY)
45 return 0;
46 if (!(mask & (MAY_READ | MAY_OPEN)))
47 return 0;
48 if (mask & MAY_OPEN)
49 fsnotify_mask = FS_OPEN_PERM;
50 else if (mask & MAY_READ)
51 fsnotify_mask = FS_ACCESS_PERM;
52 else
53 BUG();
54
55 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
38} 56}
39 57
40/* 58/*
41 * fsnotify_d_move - entry has been moved 59 * fsnotify_d_move - dentry has been moved
42 * Called with dcache_lock and entry->d_lock held. 60 * Called with dcache_lock and dentry->d_lock held.
43 */ 61 */
44static inline void fsnotify_d_move(struct dentry *entry) 62static inline void fsnotify_d_move(struct dentry *dentry)
45{ 63{
46 /* 64 /*
47 * On move we need to update entry->d_flags to indicate if the new parent 65 * On move we need to update dentry->d_flags to indicate if the new parent
48 * cares about events from this entry. 66 * cares about events from this dentry.
49 */ 67 */
50 __fsnotify_update_dcache_flags(entry); 68 __fsnotify_update_dcache_flags(dentry);
51
52 inotify_d_move(entry);
53} 69}
54 70
55/* 71/*
@@ -57,8 +73,6 @@ static inline void fsnotify_d_move(struct dentry *entry)
57 */ 73 */
58static inline void fsnotify_link_count(struct inode *inode) 74static inline void fsnotify_link_count(struct inode *inode)
59{ 75{
60 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
61
62 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 76 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
63} 77}
64 78
@@ -66,45 +80,31 @@ static inline void fsnotify_link_count(struct inode *inode)
66 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 80 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
67 */ 81 */
68static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 82static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
69 const char *old_name, 83 const unsigned char *old_name,
70 int isdir, struct inode *target, struct dentry *moved) 84 int isdir, struct inode *target, struct dentry *moved)
71{ 85{
72 struct inode *source = moved->d_inode; 86 struct inode *source = moved->d_inode;
73 u32 in_cookie = inotify_get_cookie();
74 u32 fs_cookie = fsnotify_get_cookie(); 87 u32 fs_cookie = fsnotify_get_cookie();
75 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 88 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
76 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 89 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
77 const char *new_name = moved->d_name.name; 90 const unsigned char *new_name = moved->d_name.name;
78 91
79 if (old_dir == new_dir) 92 if (old_dir == new_dir)
80 old_dir_mask |= FS_DN_RENAME; 93 old_dir_mask |= FS_DN_RENAME;
81 94
82 if (isdir) { 95 if (isdir) {
83 isdir = IN_ISDIR;
84 old_dir_mask |= FS_IN_ISDIR; 96 old_dir_mask |= FS_IN_ISDIR;
85 new_dir_mask |= FS_IN_ISDIR; 97 new_dir_mask |= FS_IN_ISDIR;
86 } 98 }
87 99
88 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
89 source);
90 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
91 source);
92
93 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); 100 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
94 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); 101 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
95 102
96 if (target) { 103 if (target)
97 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
98 inotify_inode_is_dead(target);
99
100 /* this is really a link_count change not a removal */
101 fsnotify_link_count(target); 104 fsnotify_link_count(target);
102 }
103 105
104 if (source) { 106 if (source)
105 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 107 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
107 }
108 audit_inode_child(moved, new_dir); 108 audit_inode_child(moved, new_dir);
109} 109}
110 110
@@ -117,6 +117,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
117} 117}
118 118
119/* 119/*
120 * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
121 */
122static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
123{
124 __fsnotify_vfsmount_delete(mnt);
125}
126
127/*
120 * fsnotify_nameremove - a filename was removed from a directory 128 * fsnotify_nameremove - a filename was removed from a directory
121 */ 129 */
122static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 130static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
@@ -126,7 +134,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
126 if (isdir) 134 if (isdir)
127 mask |= FS_IN_ISDIR; 135 mask |= FS_IN_ISDIR;
128 136
129 fsnotify_parent(dentry, mask); 137 fsnotify_parent(NULL, dentry, mask);
130} 138}
131 139
132/* 140/*
@@ -134,9 +142,6 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
134 */ 142 */
135static inline void fsnotify_inoderemove(struct inode *inode) 143static inline void fsnotify_inoderemove(struct inode *inode)
136{ 144{
137 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
138 inotify_inode_is_dead(inode);
139
140 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 145 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
141 __fsnotify_inode_delete(inode); 146 __fsnotify_inode_delete(inode);
142} 147}
@@ -146,8 +151,6 @@ static inline void fsnotify_inoderemove(struct inode *inode)
146 */ 151 */
147static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 152static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
148{ 153{
149 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
150 dentry->d_inode);
151 audit_inode_child(dentry, inode); 154 audit_inode_child(dentry, inode);
152 155
153 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 156 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -160,8 +163,6 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
160 */ 163 */
161static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 164static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
162{ 165{
163 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
164 inode);
165 fsnotify_link_count(inode); 166 fsnotify_link_count(inode);
166 audit_inode_child(new_dentry, dir); 167 audit_inode_child(new_dentry, dir);
167 168
@@ -176,7 +177,6 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176 __u32 mask = (FS_CREATE | FS_IN_ISDIR); 177 __u32 mask = (FS_CREATE | FS_IN_ISDIR);
177 struct inode *d_inode = dentry->d_inode; 178 struct inode *d_inode = dentry->d_inode;
178 179
179 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
180 audit_inode_child(dentry, inode); 180 audit_inode_child(dentry, inode);
181 181
182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -185,52 +185,55 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
185/* 185/*
186 * fsnotify_access - file was read 186 * fsnotify_access - file was read
187 */ 187 */
188static inline void fsnotify_access(struct dentry *dentry) 188static inline void fsnotify_access(struct file *file)
189{ 189{
190 struct inode *inode = dentry->d_inode; 190 struct path *path = &file->f_path;
191 struct inode *inode = path->dentry->d_inode;
191 __u32 mask = FS_ACCESS; 192 __u32 mask = FS_ACCESS;
192 193
193 if (S_ISDIR(inode->i_mode)) 194 if (S_ISDIR(inode->i_mode))
194 mask |= FS_IN_ISDIR; 195 mask |= FS_IN_ISDIR;
195 196
196 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 197 if (!(file->f_mode & FMODE_NONOTIFY)) {
197 198 fsnotify_parent(path, NULL, mask);
198 fsnotify_parent(dentry, mask); 199 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
199 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 200 }
200} 201}
201 202
202/* 203/*
203 * fsnotify_modify - file was modified 204 * fsnotify_modify - file was modified
204 */ 205 */
205static inline void fsnotify_modify(struct dentry *dentry) 206static inline void fsnotify_modify(struct file *file)
206{ 207{
207 struct inode *inode = dentry->d_inode; 208 struct path *path = &file->f_path;
209 struct inode *inode = path->dentry->d_inode;
208 __u32 mask = FS_MODIFY; 210 __u32 mask = FS_MODIFY;
209 211
210 if (S_ISDIR(inode->i_mode)) 212 if (S_ISDIR(inode->i_mode))
211 mask |= FS_IN_ISDIR; 213 mask |= FS_IN_ISDIR;
212 214
213 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 215 if (!(file->f_mode & FMODE_NONOTIFY)) {
214 216 fsnotify_parent(path, NULL, mask);
215 fsnotify_parent(dentry, mask); 217 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
216 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 218 }
217} 219}
218 220
219/* 221/*
220 * fsnotify_open - file was opened 222 * fsnotify_open - file was opened
221 */ 223 */
222static inline void fsnotify_open(struct dentry *dentry) 224static inline void fsnotify_open(struct file *file)
223{ 225{
224 struct inode *inode = dentry->d_inode; 226 struct path *path = &file->f_path;
227 struct inode *inode = path->dentry->d_inode;
225 __u32 mask = FS_OPEN; 228 __u32 mask = FS_OPEN;
226 229
227 if (S_ISDIR(inode->i_mode)) 230 if (S_ISDIR(inode->i_mode))
228 mask |= FS_IN_ISDIR; 231 mask |= FS_IN_ISDIR;
229 232
230 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 233 if (!(file->f_mode & FMODE_NONOTIFY)) {
231 234 fsnotify_parent(path, NULL, mask);
232 fsnotify_parent(dentry, mask); 235 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
233 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 236 }
234} 237}
235 238
236/* 239/*
@@ -238,18 +241,18 @@ static inline void fsnotify_open(struct dentry *dentry)
238 */ 241 */
239static inline void fsnotify_close(struct file *file) 242static inline void fsnotify_close(struct file *file)
240{ 243{
241 struct dentry *dentry = file->f_path.dentry; 244 struct path *path = &file->f_path;
242 struct inode *inode = dentry->d_inode; 245 struct inode *inode = file->f_path.dentry->d_inode;
243 fmode_t mode = file->f_mode; 246 fmode_t mode = file->f_mode;
244 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 247 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
245 248
246 if (S_ISDIR(inode->i_mode)) 249 if (S_ISDIR(inode->i_mode))
247 mask |= FS_IN_ISDIR; 250 mask |= FS_IN_ISDIR;
248 251
249 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 252 if (!(file->f_mode & FMODE_NONOTIFY)) {
250 253 fsnotify_parent(path, NULL, mask);
251 fsnotify_parent(dentry, mask); 254 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
252 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 255 }
253} 256}
254 257
255/* 258/*
@@ -263,9 +266,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
263 if (S_ISDIR(inode->i_mode)) 266 if (S_ISDIR(inode->i_mode))
264 mask |= FS_IN_ISDIR; 267 mask |= FS_IN_ISDIR;
265 268
266 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 269 fsnotify_parent(NULL, dentry, mask);
267
268 fsnotify_parent(dentry, mask);
269 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 270 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
270} 271}
271 272
@@ -299,19 +300,18 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
299 if (mask) { 300 if (mask) {
300 if (S_ISDIR(inode->i_mode)) 301 if (S_ISDIR(inode->i_mode))
301 mask |= FS_IN_ISDIR; 302 mask |= FS_IN_ISDIR;
302 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
303 303
304 fsnotify_parent(dentry, mask); 304 fsnotify_parent(NULL, dentry, mask);
305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
306 } 306 }
307} 307}
308 308
309#if defined(CONFIG_INOTIFY) || defined(CONFIG_FSNOTIFY) /* notify helpers */ 309#if defined(CONFIG_FSNOTIFY) /* notify helpers */
310 310
311/* 311/*
312 * fsnotify_oldname_init - save off the old filename before we change it 312 * fsnotify_oldname_init - save off the old filename before we change it
313 */ 313 */
314static inline const char *fsnotify_oldname_init(const char *name) 314static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name)
315{ 315{
316 return kstrdup(name, GFP_KERNEL); 316 return kstrdup(name, GFP_KERNEL);
317} 317}
@@ -319,22 +319,22 @@ static inline const char *fsnotify_oldname_init(const char *name)
319/* 319/*
320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init 320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
321 */ 321 */
322static inline void fsnotify_oldname_free(const char *old_name) 322static inline void fsnotify_oldname_free(const unsigned char *old_name)
323{ 323{
324 kfree(old_name); 324 kfree(old_name);
325} 325}
326 326
327#else /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */ 327#else /* CONFIG_FSNOTIFY */
328 328
329static inline const char *fsnotify_oldname_init(const char *name) 329static inline const char *fsnotify_oldname_init(const unsigned char *name)
330{ 330{
331 return NULL; 331 return NULL;
332} 332}
333 333
334static inline void fsnotify_oldname_free(const char *old_name) 334static inline void fsnotify_oldname_free(const unsigned char *old_name)
335{ 335{
336} 336}
337 337
338#endif /* ! CONFIG_INOTIFY */ 338#endif /* CONFIG_FSNOTIFY */
339 339
340#endif /* _LINUX_FS_NOTIFY_H */ 340#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 4d6f47b51189..ed36fb57c426 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -41,6 +41,10 @@
41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ 41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */ 42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */
43 43
44#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
46
47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
44#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */ 48#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */
45#define FS_IN_ONESHOT 0x80000000 /* only send event once */ 49#define FS_IN_ONESHOT 0x80000000 /* only send event once */
46 50
@@ -58,13 +62,20 @@
58 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ 62 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
59 FS_DELETE) 63 FS_DELETE)
60 64
61/* listeners that hard code group numbers near the top */ 65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
62#define DNOTIFY_GROUP_NUM UINT_MAX 66
63#define INOTIFY_GROUP_NUM (DNOTIFY_GROUP_NUM-1) 67#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
68 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
69 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
70 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
71 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
72 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
73 FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
74 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
64 75
65struct fsnotify_group; 76struct fsnotify_group;
66struct fsnotify_event; 77struct fsnotify_event;
67struct fsnotify_mark_entry; 78struct fsnotify_mark;
68struct fsnotify_event_private_data; 79struct fsnotify_event_private_data;
69 80
70/* 81/*
@@ -80,10 +91,16 @@ struct fsnotify_event_private_data;
80 * valid group and inode to use to clean up. 91 * valid group and inode to use to clean up.
81 */ 92 */
82struct fsnotify_ops { 93struct fsnotify_ops {
83 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask); 94 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); 95 struct fsnotify_mark *inode_mark,
96 struct fsnotify_mark *vfsmount_mark,
97 __u32 mask, void *data, int data_type);
98 int (*handle_event)(struct fsnotify_group *group,
99 struct fsnotify_mark *inode_mark,
100 struct fsnotify_mark *vfsmount_mark,
101 struct fsnotify_event *event);
85 void (*free_group_priv)(struct fsnotify_group *group); 102 void (*free_group_priv)(struct fsnotify_group *group);
86 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group); 103 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
87 void (*free_event_priv)(struct fsnotify_event_private_data *priv); 104 void (*free_event_priv)(struct fsnotify_event_private_data *priv);
88}; 105};
89 106
@@ -95,22 +112,6 @@ struct fsnotify_ops {
95 */ 112 */
96struct fsnotify_group { 113struct fsnotify_group {
97 /* 114 /*
98 * global list of all groups receiving events from fsnotify.
99 * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex
100 * or fsnotify_grp_srcu depending on write vs read.
101 */
102 struct list_head group_list;
103
104 /*
105 * Defines all of the event types in which this group is interested.
106 * This mask is a bitwise OR of the FS_* events from above. Each time
107 * this mask changes for a group (if it changes) the correct functions
108 * must be called to update the global structures which indicate global
109 * interest in event types.
110 */
111 __u32 mask;
112
113 /*
114 * How the refcnt is used is up to each group. When the refcnt hits 0 115 * How the refcnt is used is up to each group. When the refcnt hits 0
115 * fsnotify will clean up all of the resources associated with this group. 116 * fsnotify will clean up all of the resources associated with this group.
116 * As an example, the dnotify group will always have a refcnt=1 and that 117 * As an example, the dnotify group will always have a refcnt=1 and that
@@ -119,7 +120,6 @@ struct fsnotify_group {
119 * closed. 120 * closed.
120 */ 121 */
121 atomic_t refcnt; /* things with interest in this group */ 122 atomic_t refcnt; /* things with interest in this group */
122 unsigned int group_num; /* simply prevents accidental group collision */
123 123
124 const struct fsnotify_ops *ops; /* how this group handles things */ 124 const struct fsnotify_ops *ops; /* how this group handles things */
125 125
@@ -130,15 +130,12 @@ struct fsnotify_group {
130 unsigned int q_len; /* events on the queue */ 130 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */ 131 unsigned int max_events; /* maximum events allowed on the list */
132 132
133 /* stores all fastapth entries assoc with this group so they can be cleaned on unregister */ 133 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect mark_entries list */ 134 spinlock_t mark_lock; /* protect marks_list */
135 atomic_t num_marks; /* 1 for each mark entry and 1 for not being 135 atomic_t num_marks; /* 1 for each mark and 1 for not being
136 * past the point of no return when freeing 136 * past the point of no return when freeing
137 * a group */ 137 * a group */
138 struct list_head mark_entries; /* all inode mark entries for this group */ 138 struct list_head marks_list; /* all inode marks for this group */
139
140 /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */
141 bool on_group_list;
142 139
143 /* groups can define private fields here or use the void *private */ 140 /* groups can define private fields here or use the void *private */
144 union { 141 union {
@@ -152,6 +149,17 @@ struct fsnotify_group {
152 struct user_struct *user; 149 struct user_struct *user;
153 } inotify_data; 150 } inotify_data;
154#endif 151#endif
152#ifdef CONFIG_FANOTIFY
153 struct fanotify_group_private_data {
154#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
155 /* allows a group to block waiting for a userspace response */
156 struct mutex access_mutex;
157 struct list_head access_list;
158 wait_queue_head_t access_waitq;
159#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
160 int f_flags;
161 } fanotify_data;
162#endif /* CONFIG_FANOTIFY */
155 }; 163 };
156}; 164};
157 165
@@ -210,20 +218,42 @@ struct fsnotify_event {
210#define FSNOTIFY_EVENT_NONE 0 218#define FSNOTIFY_EVENT_NONE 0
211#define FSNOTIFY_EVENT_PATH 1 219#define FSNOTIFY_EVENT_PATH 1
212#define FSNOTIFY_EVENT_INODE 2 220#define FSNOTIFY_EVENT_INODE 2
213#define FSNOTIFY_EVENT_FILE 3
214 int data_type; /* which of the above union we have */ 221 int data_type; /* which of the above union we have */
215 atomic_t refcnt; /* how many groups still are using/need to send this event */ 222 atomic_t refcnt; /* how many groups still are using/need to send this event */
216 __u32 mask; /* the type of access, bitwise OR for FS_* event types */ 223 __u32 mask; /* the type of access, bitwise OR for FS_* event types */
217 224
218 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 225 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
219 char *file_name; 226 const unsigned char *file_name;
220 size_t name_len; 227 size_t name_len;
228 struct pid *tgid;
229
230#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
231 __u32 response; /* userspace answer to question */
232#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
221 233
222 struct list_head private_data_list; /* groups can store private data here */ 234 struct list_head private_data_list; /* groups can store private data here */
223}; 235};
224 236
225/* 237/*
226 * a mark is simply an entry attached to an in core inode which allows an 238 * Inode specific fields in an fsnotify_mark
239 */
240struct fsnotify_inode_mark {
241 struct inode *inode; /* inode this mark is associated with */
242 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */
243 struct list_head free_i_list; /* tmp list used when freeing this mark */
244};
245
246/*
247 * Mount point specific fields in an fsnotify_mark
248 */
249struct fsnotify_vfsmount_mark {
250 struct vfsmount *mnt; /* vfsmount this mark is associated with */
251 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */
252 struct list_head free_m_list; /* tmp list used when freeing this mark */
253};
254
255/*
256 * a mark is simply an object attached to an in core inode which allows an
227 * fsnotify listener to indicate they are either no longer interested in events 257 * fsnotify listener to indicate they are either no longer interested in events
228 * of a type matching mask or only interested in those events. 258 * of a type matching mask or only interested in those events.
229 * 259 *
@@ -232,19 +262,28 @@ struct fsnotify_event {
232 * (such as dnotify) will flush these when the open fd is closed and not at 262 * (such as dnotify) will flush these when the open fd is closed and not at
233 * inode eviction or modification. 263 * inode eviction or modification.
234 */ 264 */
235struct fsnotify_mark_entry { 265struct fsnotify_mark {
236 __u32 mask; /* mask this mark entry is for */ 266 __u32 mask; /* mask this mark is for */
237 /* we hold ref for each i_list and g_list. also one ref for each 'thing' 267 /* we hold ref for each i_list and g_list. also one ref for each 'thing'
238 * in kernel that found and may be using this mark. */ 268 * in kernel that found and may be using this mark. */
239 atomic_t refcnt; /* active things looking at this mark */ 269 atomic_t refcnt; /* active things looking at this mark */
240 struct inode *inode; /* inode this entry is associated with */ 270 struct fsnotify_group *group; /* group this mark is for */
241 struct fsnotify_group *group; /* group this mark entry is for */ 271 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */
242 struct hlist_node i_list; /* list of mark_entries by inode->i_fsnotify_mark_entries */ 272 spinlock_t lock; /* protect group and inode */
243 struct list_head g_list; /* list of mark_entries by group->i_fsnotify_mark_entries */ 273 union {
244 spinlock_t lock; /* protect group, inode, and killme */ 274 struct fsnotify_inode_mark i;
245 struct list_head free_i_list; /* tmp list used when freeing this mark */ 275 struct fsnotify_vfsmount_mark m;
276 };
277 __u32 ignored_mask; /* events types to ignore */
246 struct list_head free_g_list; /* tmp list used when freeing this mark */ 278 struct list_head free_g_list; /* tmp list used when freeing this mark */
247 void (*free_mark)(struct fsnotify_mark_entry *entry); /* called on final put+free */ 279#define FSNOTIFY_MARK_FLAG_INODE 0x01
280#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
281#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
282#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
283#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
284 unsigned int flags; /* vfsmount or inode mark? */
285 struct list_head destroy_list;
286 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
248}; 287};
249 288
250#ifdef CONFIG_FSNOTIFY 289#ifdef CONFIG_FSNOTIFY
@@ -252,10 +291,11 @@ struct fsnotify_mark_entry {
252/* called from the vfs helpers */ 291/* called from the vfs helpers */
253 292
254/* main fsnotify call to send events */ 293/* main fsnotify call to send events */
255extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 294extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
256 const char *name, u32 cookie); 295 const unsigned char *name, u32 cookie);
257extern void __fsnotify_parent(struct dentry *dentry, __u32 mask); 296extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask);
258extern void __fsnotify_inode_delete(struct inode *inode); 297extern void __fsnotify_inode_delete(struct inode *inode);
298extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
259extern u32 fsnotify_get_cookie(void); 299extern u32 fsnotify_get_cookie(void);
260 300
261static inline int fsnotify_inode_watches_children(struct inode *inode) 301static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -304,15 +344,9 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
304 344
305/* called from fsnotify listeners, such as fanotify or dnotify */ 345/* called from fsnotify listeners, such as fanotify or dnotify */
306 346
307/* must call when a group changes its ->mask */
308extern void fsnotify_recalc_global_mask(void);
309/* get a reference to an existing or create a new group */ 347/* get a reference to an existing or create a new group */
310extern struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, 348extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
311 __u32 mask, 349/* drop reference on a group from fsnotify_alloc_group */
312 const struct fsnotify_ops *ops);
313/* run all marks associated with this group and update group->mask */
314extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
315/* drop reference on a group from fsnotify_obtain_group */
316extern void fsnotify_put_group(struct fsnotify_group *group); 350extern void fsnotify_put_group(struct fsnotify_group *group);
317 351
318/* take a reference to an event */ 352/* take a reference to an event */
@@ -323,8 +357,11 @@ extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struc
323 struct fsnotify_event *event); 357 struct fsnotify_event *event);
324 358
325/* attach the event to the group notification queue */ 359/* attach the event to the group notification queue */
326extern int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_event *event, 360extern struct fsnotify_event *fsnotify_add_notify_event(struct fsnotify_group *group,
327 struct fsnotify_event_private_data *priv); 361 struct fsnotify_event *event,
362 struct fsnotify_event_private_data *priv,
363 struct fsnotify_event *(*merge)(struct list_head *,
364 struct fsnotify_event *));
328/* true if the group notification queue is empty */ 365/* true if the group notification queue is empty */
329extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 366extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
330/* return, but do not dequeue the first event on the notification queue */ 367/* return, but do not dequeue the first event on the notification queue */
@@ -334,38 +371,66 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group
334 371
335/* functions used to manipulate the marks attached to inodes */ 372/* functions used to manipulate the marks attached to inodes */
336 373
374/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */
375extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt);
337/* run all marks associated with an inode and update inode->i_fsnotify_mask */ 376/* run all marks associated with an inode and update inode->i_fsnotify_mask */
338extern void fsnotify_recalc_inode_mask(struct inode *inode); 377extern void fsnotify_recalc_inode_mask(struct inode *inode);
339extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry)); 378extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
340/* find (and take a reference) to a mark associated with group and inode */ 379/* find (and take a reference) to a mark associated with group and inode */
341extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode); 380extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
381/* find (and take a reference) to a mark associated with group and vfsmount */
382extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
383/* copy the values from old into new */
384extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
385/* set the ignored_mask of a mark */
386extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
387/* set the mask of a mark (might pin the object into memory */
388extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
342/* attach the mark to both the group and the inode */ 389/* attach the mark to both the group and the inode */
343extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode); 390extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
391 struct inode *inode, struct vfsmount *mnt, int allow_dups);
344/* given a mark, flag it to be freed when all references are dropped */ 392/* given a mark, flag it to be freed when all references are dropped */
345extern void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry); 393extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
394/* run all the marks in a group, and clear all of the vfsmount marks */
395extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
396/* run all the marks in a group, and clear all of the inode marks */
397extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group);
398/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/
399extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags);
346/* run all the marks in a group, and flag them to be freed */ 400/* run all the marks in a group, and flag them to be freed */
347extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); 401extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
348extern void fsnotify_get_mark(struct fsnotify_mark_entry *entry); 402extern void fsnotify_get_mark(struct fsnotify_mark *mark);
349extern void fsnotify_put_mark(struct fsnotify_mark_entry *entry); 403extern void fsnotify_put_mark(struct fsnotify_mark *mark);
350extern void fsnotify_unmount_inodes(struct list_head *list); 404extern void fsnotify_unmount_inodes(struct list_head *list);
351 405
352/* put here because inotify does some weird stuff when destroying watches */ 406/* put here because inotify does some weird stuff when destroying watches */
353extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, 407extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
354 void *data, int data_is, const char *name, 408 void *data, int data_is,
409 const unsigned char *name,
355 u32 cookie, gfp_t gfp); 410 u32 cookie, gfp_t gfp);
356 411
412/* fanotify likes to change events after they are on lists... */
413extern struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event);
414extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
415 struct fsnotify_event *new_event);
416
357#else 417#else
358 418
359static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 419static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
360 const char *name, u32 cookie) 420 const unsigned char *name, u32 cookie)
361{} 421{
422 return 0;
423}
362 424
363static inline void __fsnotify_parent(struct dentry *dentry, __u32 mask) 425static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
364{} 426{}
365 427
366static inline void __fsnotify_inode_delete(struct inode *inode) 428static inline void __fsnotify_inode_delete(struct inode *inode)
367{} 429{}
368 430
431static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
432{}
433
369static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) 434static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
370{} 435{}
371 436
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index cd0b3f30f48e..ce73a30113b4 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -17,6 +17,8 @@ struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 19 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev);
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index caafd0561aa1..e3060ef85b6d 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -2,6 +2,7 @@
2#define _LINUX_HIGHMEM_H 2#define _LINUX_HIGHMEM_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/uaccess.h> 7#include <linux/uaccess.h>
7 8
@@ -72,7 +73,11 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
72} 73}
73#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 74#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
74 75
75#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0) 76static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx)
77{
78 pagefault_enable();
79}
80
76#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 81#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
77#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 82#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
78 83
@@ -81,6 +86,13 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
81 86
82#endif /* CONFIG_HIGHMEM */ 87#endif /* CONFIG_HIGHMEM */
83 88
89/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */
90/* kunmap_atomic() should get the return value of kmap_atomic, not the page. */
91#define kunmap_atomic(addr, idx) do { \
92 BUILD_BUG_ON(__same_type((addr), struct page *)); \
93 kunmap_atomic_notypecheck((addr), (idx)); \
94 } while (0)
95
84/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 96/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
85#ifndef clear_user_highpage 97#ifndef clear_user_highpage
86static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 98static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 78b4bc64c006..f479700df61b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -2,6 +2,7 @@
2#define _LINUX_HUGETLB_H 2#define _LINUX_HUGETLB_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/hugetlb_inline.h>
5 6
6struct ctl_table; 7struct ctl_table;
7struct user_struct; 8struct user_struct;
@@ -14,11 +15,6 @@ struct user_struct;
14 15
15int PageHuge(struct page *page); 16int PageHuge(struct page *page);
16 17
17static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
18{
19 return vma->vm_flags & VM_HUGETLB;
20}
21
22void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 18void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
23int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
24int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); 20int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
@@ -47,6 +43,7 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
47 struct vm_area_struct *vma, 43 struct vm_area_struct *vma,
48 int acctflags); 44 int acctflags);
49void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 45void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
46void __isolate_hwpoisoned_huge_page(struct page *page);
50 47
51extern unsigned long hugepages_treat_as_movable; 48extern unsigned long hugepages_treat_as_movable;
52extern const unsigned long hugetlb_zero, hugetlb_infinity; 49extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -77,11 +74,6 @@ static inline int PageHuge(struct page *page)
77 return 0; 74 return 0;
78} 75}
79 76
80static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
81{
82 return 0;
83}
84
85static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma) 77static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
86{ 78{
87} 79}
@@ -108,6 +100,8 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
108#define is_hugepage_only_range(mm, addr, len) 0 100#define is_hugepage_only_range(mm, addr, len) 0
109#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 101#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
110#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) 102#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
103#define huge_pte_offset(mm, address) 0
104#define __isolate_hwpoisoned_huge_page(page) 0
111 105
112#define hugetlb_change_protection(vma, address, end, newprot) 106#define hugetlb_change_protection(vma, address, end, newprot)
113 107
diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h
new file mode 100644
index 000000000000..6931489a5c14
--- /dev/null
+++ b/include/linux/hugetlb_inline.h
@@ -0,0 +1,22 @@
1#ifndef _LINUX_HUGETLB_INLINE_H
2#define _LINUX_HUGETLB_INLINE_H
3
4#ifdef CONFIG_HUGETLB_PAGE
5
6#include <linux/mm.h>
7
8static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
9{
10 return vma->vm_flags & VM_HUGETLB;
11}
12
13#else
14
15static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
16{
17 return 0;
18}
19
20#endif
21
22#endif
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
new file mode 100644
index 000000000000..34536effd652
--- /dev/null
+++ b/include/linux/i2c-mux.h
@@ -0,0 +1,46 @@
1/*
2 *
3 * i2c-mux.h - functions for the i2c-bus mux support
4 *
5 * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
6 * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
7 * Michael Lawnick <michael.lawnick.ext@nsn.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _LINUX_I2C_MUX_H
25#define _LINUX_I2C_MUX_H
26
27#ifdef __KERNEL__
28
29/*
30 * Called to create a i2c bus on a multiplexed bus segment.
31 * The mux_dev and chan_id parameters are passed to the select
32 * and deselect callback functions to perform hardware-specific
33 * mux control.
34 */
35struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
36 void *mux_dev, u32 force_nr, u32 chan_id,
37 int (*select) (struct i2c_adapter *,
38 void *mux_dev, u32 chan_id),
39 int (*deselect) (struct i2c_adapter *,
40 void *mux_dev, u32 chan_id));
41
42int i2c_del_mux_adapter(struct i2c_adapter *adap);
43
44#endif /* __KERNEL__ */
45
46#endif /* _LINUX_I2C_MUX_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 21067b418536..4bae0b72ed3c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -37,6 +37,7 @@
37#include <linux/of.h> /* for struct device_node */ 37#include <linux/of.h> /* for struct device_node */
38 38
39extern struct bus_type i2c_bus_type; 39extern struct bus_type i2c_bus_type;
40extern struct device_type i2c_adapter_type;
40 41
41/* --- General options ------------------------------------------------ */ 42/* --- General options ------------------------------------------------ */
42 43
@@ -108,6 +109,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
108 * @shutdown: Callback for device shutdown 109 * @shutdown: Callback for device shutdown
109 * @suspend: Callback for device suspend 110 * @suspend: Callback for device suspend
110 * @resume: Callback for device resume 111 * @resume: Callback for device resume
112 * @alert: Alert callback, for example for the SMBus alert protocol
111 * @command: Callback for bus-wide signaling (optional) 113 * @command: Callback for bus-wide signaling (optional)
112 * @driver: Device driver model driver 114 * @driver: Device driver model driver
113 * @id_table: List of I2C devices supported by this driver 115 * @id_table: List of I2C devices supported by this driver
@@ -233,6 +235,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
233 * @addr: stored in i2c_client.addr 235 * @addr: stored in i2c_client.addr
234 * @platform_data: stored in i2c_client.dev.platform_data 236 * @platform_data: stored in i2c_client.dev.platform_data
235 * @archdata: copied into i2c_client.dev.archdata 237 * @archdata: copied into i2c_client.dev.archdata
238 * @of_node: pointer to OpenFirmware device node
236 * @irq: stored in i2c_client.irq 239 * @irq: stored in i2c_client.irq
237 * 240 *
238 * I2C doesn't actually support hardware probing, although controllers and 241 * I2C doesn't actually support hardware probing, although controllers and
@@ -282,12 +285,18 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
282 285
283/* If you don't know the exact address of an I2C device, use this variant 286/* If you don't know the exact address of an I2C device, use this variant
284 * instead, which can probe for device presence in a list of possible 287 * instead, which can probe for device presence in a list of possible
285 * addresses. 288 * addresses. The "probe" callback function is optional. If it is provided,
289 * it must return 1 on successful probe, 0 otherwise. If it is not provided,
290 * a default probing method is used.
286 */ 291 */
287extern struct i2c_client * 292extern struct i2c_client *
288i2c_new_probed_device(struct i2c_adapter *adap, 293i2c_new_probed_device(struct i2c_adapter *adap,
289 struct i2c_board_info *info, 294 struct i2c_board_info *info,
290 unsigned short const *addr_list); 295 unsigned short const *addr_list,
296 int (*probe)(struct i2c_adapter *, unsigned short addr));
297
298/* Common custom probe functions */
299extern int i2c_probe_func_quick_read(struct i2c_adapter *, unsigned short addr);
291 300
292/* For devices that use several addresses, use i2c_new_dummy() to make 301/* For devices that use several addresses, use i2c_new_dummy() to make
293 * client handles for the extra addresses. 302 * client handles for the extra addresses.
@@ -360,6 +369,7 @@ struct i2c_adapter {
360 char name[48]; 369 char name[48];
361 struct completion dev_released; 370 struct completion dev_released;
362 371
372 struct mutex userspace_clients_lock;
363 struct list_head userspace_clients; 373 struct list_head userspace_clients;
364}; 374};
365#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 375#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
@@ -374,23 +384,16 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
374 dev_set_drvdata(&dev->dev, data); 384 dev_set_drvdata(&dev->dev, data);
375} 385}
376 386
377/** 387static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
378 * i2c_lock_adapter - Prevent access to an I2C bus segment
379 * @adapter: Target I2C bus segment
380 */
381static inline void i2c_lock_adapter(struct i2c_adapter *adapter)
382{ 388{
383 rt_mutex_lock(&adapter->bus_lock); 389 return adapter->dev.parent != NULL
390 && adapter->dev.parent->bus == &i2c_bus_type
391 && adapter->dev.parent->type == &i2c_adapter_type;
384} 392}
385 393
386/** 394/* Adapter locking functions, exported for shared pin cases */
387 * i2c_unlock_adapter - Reauthorize access to an I2C bus segment 395void i2c_lock_adapter(struct i2c_adapter *);
388 * @adapter: Target I2C bus segment 396void i2c_unlock_adapter(struct i2c_adapter *);
389 */
390static inline void i2c_unlock_adapter(struct i2c_adapter *adapter)
391{
392 rt_mutex_unlock(&adapter->bus_lock);
393}
394 397
395/*flags for the client struct: */ 398/*flags for the client struct: */
396#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 399#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
diff --git a/include/linux/i2c/ltc4245.h b/include/linux/i2c/ltc4245.h
new file mode 100644
index 000000000000..56bda4be0016
--- /dev/null
+++ b/include/linux/i2c/ltc4245.h
@@ -0,0 +1,21 @@
1/*
2 * Platform Data for LTC4245 hardware monitor chip
3 *
4 * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef LINUX_LTC4245_H
13#define LINUX_LTC4245_H
14
15#include <linux/types.h>
16
17struct ltc4245_platform_data {
18 bool use_extra_gpios;
19};
20
21#endif /* LINUX_LTC4245_H */
diff --git a/include/linux/i2c/pca954x.h b/include/linux/i2c/pca954x.h
new file mode 100644
index 000000000000..28f1f8d5ab1f
--- /dev/null
+++ b/include/linux/i2c/pca954x.h
@@ -0,0 +1,47 @@
1/*
2 *
3 * pca954x.h - I2C multiplexer/switch support
4 *
5 * Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
6 * Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
7 * Michael Lawnick <michael.lawnick.ext@nsn.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24
25#ifndef _LINUX_I2C_PCA954X_H
26#define _LINUX_I2C_PCA954X_H
27
28/* Platform data for the PCA954x I2C multiplexers */
29
30/* Per channel initialisation data:
31 * @adap_id: bus number for the adapter. 0 = don't care
32 * @deselect_on_exit: set this entry to 1, if your H/W needs deselection
33 * of this channel after transaction.
34 *
35 */
36struct pca954x_platform_mode {
37 int adap_id;
38 unsigned int deselect_on_exit:1;
39};
40
41/* Per mux/switch data, used with i2c_register_board_info */
42struct pca954x_platform_data {
43 struct pca954x_platform_mode *modes;
44 int num_modes;
45};
46
47#endif /* _LINUX_I2C_PCA954X_H */
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h
new file mode 100644
index 000000000000..ee3049cb9ba5
--- /dev/null
+++ b/include/linux/i2c/sx150x.h
@@ -0,0 +1,78 @@
1/*
2 * Driver for the Semtech SX150x I2C GPIO Expanders
3 *
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
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 version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20#ifndef __LINUX_I2C_SX150X_H
21#define __LINUX_I2C_SX150X_H
22
23/**
24 * struct sx150x_platform_data - config data for SX150x driver
25 * @gpio_base: The index number of the first GPIO assigned to this
26 * GPIO expander. The expander will create a block of
27 * consecutively numbered gpios beginning at the given base,
28 * with the size of the block depending on the model of the
29 * expander chip.
30 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
31 * instead of as an oscillator, increasing the size of the
32 * GP(I)O pool created by this expander by one. The
33 * output-only GPO pin will be added at the end of the block.
34 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
35 * for each IO line in the expander. Setting the bit at
36 * position n will enable the pull-up for the IO at
37 * the corresponding offset. For chips with fewer than
38 * 16 IO pins, high-end bits are ignored.
39 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
40 * resistor for each IO line in the expander. Setting the
41 * bit at position n will enable the pull-down for the IO at
42 * the corresponding offset. For chips with fewer than
43 * 16 IO pins, high-end bits are ignored.
44 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
45 * operation for each IO line in the expander. Setting the
46 * bit at position n enables open-drain operation for
47 * the IO at the corresponding offset. Clearing the bit
48 * enables regular push-pull operation for that IO.
49 * For chips with fewer than 16 IO pins, high-end bits
50 * are ignored.
51 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
52 * in the expander. Setting the bit at position n inverts
53 * the polarity of that IO line, while clearing it results
54 * in normal polarity. For chips with fewer than 16 IO pins,
55 * high-end bits are ignored.
56 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
57 * is connected, via which it reports interrupt events
58 * across all GPIO lines. This must be a real,
59 * pre-existing IRQ line.
60 * Setting this value < 0 disables the irq_chip functionality
61 * of the driver.
62 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
63 * IRQ lines will appear. Similarly to gpio_base, the expander
64 * will create a block of irqs beginning at this number.
65 * This value is ignored if irq_summary is < 0.
66 */
67struct sx150x_platform_data {
68 unsigned gpio_base;
69 bool oscio_is_gpo;
70 u16 io_pullup_ena;
71 u16 io_pulldn_ena;
72 u16 io_open_drain_ena;
73 u16 io_polarity;
74 int irq_summary;
75 unsigned irq_base;
76};
77
78#endif /* __LINUX_I2C_SX150X_H */
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 37ea2894b3c0..d33041e2a42a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -51,6 +51,7 @@ struct inotify_event {
51/* special flags */ 51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ 52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ 53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
54#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ 55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
55#define IN_ISDIR 0x40000000 /* event occurred against dir */ 56#define IN_ISDIR 0x40000000 /* event occurred against dir */
56#define IN_ONESHOT 0x80000000 /* only send event once */ 57#define IN_ONESHOT 0x80000000 /* only send event once */
@@ -70,177 +71,17 @@ struct inotify_event {
70#define IN_NONBLOCK O_NONBLOCK 71#define IN_NONBLOCK O_NONBLOCK
71 72
72#ifdef __KERNEL__ 73#ifdef __KERNEL__
73 74#include <linux/sysctl.h>
74#include <linux/dcache.h> 75extern struct ctl_table inotify_table[]; /* for sysctl */
75#include <linux/fs.h> 76
76 77#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
77/* 78 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
78 * struct inotify_watch - represents a watch request on a specific inode 79 IN_MOVED_TO | IN_CREATE | IN_DELETE | \
79 * 80 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
80 * h_list is protected by ih->mutex of the associated inotify_handle. 81 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
81 * i_list, mask are protected by inode->inotify_mutex of the associated inode. 82 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
82 * ih, inode, and wd are never written to once the watch is created. 83 IN_ISDIR | IN_ONESHOT)
83 * 84
84 * Callers must use the established inotify interfaces to access inotify_watch 85#endif
85 * contents. The content of this structure is private to the inotify
86 * implementation.
87 */
88struct inotify_watch {
89 struct list_head h_list; /* entry in inotify_handle's list */
90 struct list_head i_list; /* entry in inode's list */
91 atomic_t count; /* reference count */
92 struct inotify_handle *ih; /* associated inotify handle */
93 struct inode *inode; /* associated inode */
94 __s32 wd; /* watch descriptor */
95 __u32 mask; /* event mask for this watch */
96};
97
98struct inotify_operations {
99 void (*handle_event)(struct inotify_watch *, u32, u32, u32,
100 const char *, struct inode *);
101 void (*destroy_watch)(struct inotify_watch *);
102};
103
104#ifdef CONFIG_INOTIFY
105
106/* Kernel API for producing events */
107
108extern void inotify_d_instantiate(struct dentry *, struct inode *);
109extern void inotify_d_move(struct dentry *);
110extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
111 const char *, struct inode *);
112extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
113 const char *);
114extern void inotify_unmount_inodes(struct list_head *);
115extern void inotify_inode_is_dead(struct inode *);
116extern u32 inotify_get_cookie(void);
117
118/* Kernel Consumer API */
119
120extern struct inotify_handle *inotify_init(const struct inotify_operations *);
121extern void inotify_init_watch(struct inotify_watch *);
122extern void inotify_destroy(struct inotify_handle *);
123extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
124 struct inotify_watch **);
125extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
126 u32);
127extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
128 struct inode *, __u32);
129extern __s32 inotify_clone_watch(struct inotify_watch *, struct inotify_watch *);
130extern void inotify_evict_watch(struct inotify_watch *);
131extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
132extern int inotify_rm_wd(struct inotify_handle *, __u32);
133extern void inotify_remove_watch_locked(struct inotify_handle *,
134 struct inotify_watch *);
135extern void get_inotify_watch(struct inotify_watch *);
136extern void put_inotify_watch(struct inotify_watch *);
137extern int pin_inotify_watch(struct inotify_watch *);
138extern void unpin_inotify_watch(struct inotify_watch *);
139
140#else
141
142static inline void inotify_d_instantiate(struct dentry *dentry,
143 struct inode *inode)
144{
145}
146
147static inline void inotify_d_move(struct dentry *dentry)
148{
149}
150
151static inline void inotify_inode_queue_event(struct inode *inode,
152 __u32 mask, __u32 cookie,
153 const char *filename,
154 struct inode *n_inode)
155{
156}
157
158static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
159 __u32 mask, __u32 cookie,
160 const char *filename)
161{
162}
163
164static inline void inotify_unmount_inodes(struct list_head *list)
165{
166}
167
168static inline void inotify_inode_is_dead(struct inode *inode)
169{
170}
171
172static inline u32 inotify_get_cookie(void)
173{
174 return 0;
175}
176
177static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops)
178{
179 return ERR_PTR(-EOPNOTSUPP);
180}
181
182static inline void inotify_init_watch(struct inotify_watch *watch)
183{
184}
185
186static inline void inotify_destroy(struct inotify_handle *ih)
187{
188}
189
190static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
191 struct inotify_watch **watchp)
192{
193 return -EOPNOTSUPP;
194}
195
196static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
197 struct inode *inode, u32 mask)
198{
199 return -EOPNOTSUPP;
200}
201
202static inline __s32 inotify_add_watch(struct inotify_handle *ih,
203 struct inotify_watch *watch,
204 struct inode *inode, __u32 mask)
205{
206 return -EOPNOTSUPP;
207}
208
209static inline int inotify_rm_watch(struct inotify_handle *ih,
210 struct inotify_watch *watch)
211{
212 return -EOPNOTSUPP;
213}
214
215static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
216{
217 return -EOPNOTSUPP;
218}
219
220static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
221 struct inotify_watch *watch)
222{
223}
224
225static inline void get_inotify_watch(struct inotify_watch *watch)
226{
227}
228
229static inline void put_inotify_watch(struct inotify_watch *watch)
230{
231}
232
233extern inline int pin_inotify_watch(struct inotify_watch *watch)
234{
235 return 0;
236}
237
238extern inline void unpin_inotify_watch(struct inotify_watch *watch)
239{
240}
241
242#endif /* CONFIG_INOTIFY */
243
244#endif /* __KERNEL __ */
245 86
246#endif /* _LINUX_INOTIFY_H */ 87#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 339d043ccb53..896a92227bc4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -776,6 +776,7 @@ struct input_absinfo {
776#define REP_DELAY 0x00 776#define REP_DELAY 0x00
777#define REP_PERIOD 0x01 777#define REP_PERIOD 0x01
778#define REP_MAX 0x01 778#define REP_MAX 0x01
779#define REP_CNT (REP_MAX+1)
779 780
780/* 781/*
781 * Sounds 782 * Sounds
@@ -1099,21 +1100,18 @@ struct input_mt_slot {
1099 * @repeat_key: stores key code of the last key pressed; used to implement 1100 * @repeat_key: stores key code of the last key pressed; used to implement
1100 * software autorepeat 1101 * software autorepeat
1101 * @timer: timer for software autorepeat 1102 * @timer: timer for software autorepeat
1102 * @abs: current values for reports from absolute axes
1103 * @rep: current values for autorepeat parameters (delay, rate) 1103 * @rep: current values for autorepeat parameters (delay, rate)
1104 * @mt: pointer to array of struct input_mt_slot holding current values 1104 * @mt: pointer to array of struct input_mt_slot holding current values
1105 * of tracked contacts 1105 * of tracked contacts
1106 * @mtsize: number of MT slots the device uses 1106 * @mtsize: number of MT slots the device uses
1107 * @slot: MT slot currently being transmitted 1107 * @slot: MT slot currently being transmitted
1108 * @absinfo: array of &struct absinfo elements holding information
1109 * about absolute axes (current value, min, max, flat, fuzz,
1110 * resolution)
1108 * @key: reflects current state of device's keys/buttons 1111 * @key: reflects current state of device's keys/buttons
1109 * @led: reflects current state of device's LEDs 1112 * @led: reflects current state of device's LEDs
1110 * @snd: reflects current state of sound effects 1113 * @snd: reflects current state of sound effects
1111 * @sw: reflects current state of device's switches 1114 * @sw: reflects current state of device's switches
1112 * @absmax: maximum values for events coming from absolute axes
1113 * @absmin: minimum values for events coming from absolute axes
1114 * @absfuzz: describes noisiness for axes
1115 * @absflat: size of the center flat position (used by joydev)
1116 * @absres: resolution used for events coming form absolute axes
1117 * @open: this method is called when the very first user calls 1115 * @open: this method is called when the very first user calls
1118 * input_open_device(). The driver must prepare the device 1116 * input_open_device(). The driver must prepare the device
1119 * to start generating events (start polling thread, 1117 * to start generating events (start polling thread,
@@ -1180,24 +1178,19 @@ struct input_dev {
1180 unsigned int repeat_key; 1178 unsigned int repeat_key;
1181 struct timer_list timer; 1179 struct timer_list timer;
1182 1180
1183 int abs[ABS_CNT]; 1181 int rep[REP_CNT];
1184 int rep[REP_MAX + 1];
1185 1182
1186 struct input_mt_slot *mt; 1183 struct input_mt_slot *mt;
1187 int mtsize; 1184 int mtsize;
1188 int slot; 1185 int slot;
1189 1186
1187 struct input_absinfo *absinfo;
1188
1190 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1189 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1191 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1190 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1192 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1191 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1193 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1192 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1194 1193
1195 int absmax[ABS_CNT];
1196 int absmin[ABS_CNT];
1197 int absfuzz[ABS_CNT];
1198 int absflat[ABS_CNT];
1199 int absres[ABS_CNT];
1200
1201 int (*open)(struct input_dev *dev); 1194 int (*open)(struct input_dev *dev);
1202 void (*close)(struct input_dev *dev); 1195 void (*close)(struct input_dev *dev);
1203 int (*flush)(struct input_dev *dev, struct file *file); 1196 int (*flush)(struct input_dev *dev, struct file *file);
@@ -1459,16 +1452,32 @@ static inline void input_set_events_per_packet(struct input_dev *dev, int n_even
1459 dev->hint_events_per_packet = n_events; 1452 dev->hint_events_per_packet = n_events;
1460} 1453}
1461 1454
1462static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1455void input_alloc_absinfo(struct input_dev *dev);
1463{ 1456void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1464 dev->absmin[axis] = min; 1457 int min, int max, int fuzz, int flat);
1465 dev->absmax[axis] = max; 1458
1466 dev->absfuzz[axis] = fuzz; 1459#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1467 dev->absflat[axis] = flat; 1460static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1468 1461 unsigned int axis) \
1469 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1462{ \
1463 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1464} \
1465 \
1466static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1467 unsigned int axis, int val) \
1468{ \
1469 input_alloc_absinfo(dev); \
1470 if (dev->absinfo) \
1471 dev->absinfo[axis]._item = val; \
1470} 1472}
1471 1473
1474INPUT_GENERATE_ABS_ACCESSORS(val, value)
1475INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1476INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1477INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1478INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1479INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1480
1472int input_get_keycode(struct input_dev *dev, 1481int input_get_keycode(struct input_dev *dev,
1473 unsigned int scancode, unsigned int *keycode); 1482 unsigned int scancode, unsigned int *keycode);
1474int input_set_keycode(struct input_dev *dev, 1483int input_set_keycode(struct input_dev *dev,
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
new file mode 100644
index 000000000000..d9d08b6269b6
--- /dev/null
+++ b/include/linux/intel_mid_dma.h
@@ -0,0 +1,86 @@
1/*
2 * intel_mid_dma.h - Intel MID DMA Drivers
3 *
4 * Copyright (C) 2008-10 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 as published by
10 * the Free Software Foundation; version 2 of the License.
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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 *
23 *
24 */
25#ifndef __INTEL_MID_DMA_H__
26#define __INTEL_MID_DMA_H__
27
28#include <linux/dmaengine.h>
29
30/*DMA transaction width, src and dstn width would be same
31The DMA length must be width aligned,
32for 32 bit width the length must be 32 bit (4bytes) aligned only*/
33enum intel_mid_dma_width {
34 LNW_DMA_WIDTH_8BIT = 0x0,
35 LNW_DMA_WIDTH_16BIT = 0x1,
36 LNW_DMA_WIDTH_32BIT = 0x2,
37};
38
39/*DMA mode configurations*/
40enum intel_mid_dma_mode {
41 LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/
42 LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/
43 LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/
44};
45
46/*DMA handshaking*/
47enum intel_mid_dma_hs_mode {
48 LNW_DMA_HW_HS = 0, /*HW Handshaking only*/
49 LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/
50};
51
52/*Burst size configuration*/
53enum intel_mid_dma_msize {
54 LNW_DMA_MSIZE_1 = 0x0,
55 LNW_DMA_MSIZE_4 = 0x1,
56 LNW_DMA_MSIZE_8 = 0x2,
57 LNW_DMA_MSIZE_16 = 0x3,
58 LNW_DMA_MSIZE_32 = 0x4,
59 LNW_DMA_MSIZE_64 = 0x5,
60};
61
62/**
63 * struct intel_mid_dma_slave - DMA slave structure
64 *
65 * @dirn: DMA trf direction
66 * @src_width: tx register width
67 * @dst_width: rx register width
68 * @hs_mode: HW/SW handshaking mode
69 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
70 * @src_msize: Source DMA burst size
71 * @dst_msize: Dst DMA burst size
72 * @device_instance: DMA peripheral device instance, we can have multiple
73 * peripheral device connected to single DMAC
74 */
75struct intel_mid_dma_slave {
76 enum dma_data_direction dirn;
77 enum intel_mid_dma_width src_width; /*width of DMA src txn*/
78 enum intel_mid_dma_width dst_width; /*width of DMA dst txn*/
79 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
80 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
81 enum intel_mid_dma_msize src_msize; /*size if src burst*/
82 enum intel_mid_dma_msize dst_msize; /*size of dst burst*/
83 unsigned int device_instance; /*0, 1 for periphral instance*/
84};
85
86#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index e0ea40f6c515..0a6b3d5c490c 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -22,7 +22,6 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/iomap.h>
26 25
27/* 26/*
28 * The io_mapping mechanism provides an abstraction for mapping 27 * The io_mapping mechanism provides an abstraction for mapping
@@ -33,6 +32,8 @@
33 32
34#ifdef CONFIG_HAVE_ATOMIC_IOMAP 33#ifdef CONFIG_HAVE_ATOMIC_IOMAP
35 34
35#include <asm/iomap.h>
36
36struct io_mapping { 37struct io_mapping {
37 resource_size_t base; 38 resource_size_t base;
38 unsigned long size; 39 unsigned long size;
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index 64d1b638745d..86bdeffe43ad 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_IOMMU_HELPER_H 1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H 2#define _LINUX_IOMMU_HELPER_H
3 3
4#include <linux/kernel.h>
5
4static inline unsigned long iommu_device_max_index(unsigned long size, 6static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset, 7 unsigned long offset,
6 u64 dma_mask) 8 u64 dma_mask)
@@ -20,7 +22,13 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
20 unsigned long boundary_size, 22 unsigned long boundary_size,
21 unsigned long align_mask); 23 unsigned long align_mask);
22 24
23extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, 25static inline unsigned long iommu_num_pages(unsigned long addr,
24 unsigned long io_page_size); 26 unsigned long len,
27 unsigned long io_page_size)
28{
29 unsigned long size = (addr & (io_page_size - 1)) + len;
30
31 return DIV_ROUND_UP(size, io_page_size);
32}
25 33
26#endif 34#endif
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 7faca98c7d14..ad700a60c158 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -86,7 +86,7 @@ struct stlibrd {
86 unsigned long magic; 86 unsigned long magic;
87 unsigned int brdnr; 87 unsigned int brdnr;
88 unsigned int brdtype; 88 unsigned int brdtype;
89 unsigned int state; 89 unsigned long state;
90 unsigned int nrpanels; 90 unsigned int nrpanels;
91 unsigned int nrports; 91 unsigned int nrports;
92 unsigned int nrdevs; 92 unsigned int nrdevs;
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index edb9231f1898..a18b719f49d4 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
5 * 6 *
6 * Created by David Woodhouse <dwmw2@infradead.org> 7 * Created by David Woodhouse <dwmw2@infradead.org>
7 * 8 *
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h
new file mode 100644
index 000000000000..9053f95e9687
--- /dev/null
+++ b/include/linux/jz4740-adc.h
@@ -0,0 +1,32 @@
1
2#ifndef __LINUX_JZ4740_ADC
3#define __LINUX_JZ4740_ADC
4
5#include <linux/device.h>
6
7/*
8 * jz4740_adc_set_config - Configure a JZ4740 adc device
9 * @dev: Pointer to a jz4740-adc device
10 * @mask: Mask for the config value to be set
11 * @val: Value to be set
12 *
13 * This function can be used by the JZ4740 ADC mfd cells to configure their
14 * options in the shared config register.
15*/
16int jz4740_adc_set_config(struct device *dev, uint32_t mask, uint32_t val);
17
18#define JZ_ADC_CONFIG_SPZZ BIT(31)
19#define JZ_ADC_CONFIG_EX_IN BIT(30)
20#define JZ_ADC_CONFIG_DNUM_MASK (0x7 << 16)
21#define JZ_ADC_CONFIG_DMA_ENABLE BIT(15)
22#define JZ_ADC_CONFIG_XYZ_MASK (0x2 << 13)
23#define JZ_ADC_CONFIG_SAMPLE_NUM_MASK (0x7 << 10)
24#define JZ_ADC_CONFIG_CLKDIV_MASK (0xf << 5)
25#define JZ_ADC_CONFIG_BAT_MB BIT(4)
26
27#define JZ_ADC_CONFIG_DNUM(dnum) ((dnum) << 16)
28#define JZ_ADC_CONFIG_XYZ_OFFSET(dnum) ((xyz) << 13)
29#define JZ_ADC_CONFIG_SAMPLE_NUM(x) ((x) << 10)
30#define JZ_ADC_CONFIG_CLKDIV(div) ((div) << 5)
31
32#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7d5b10ff63e0..2b0a35e6bc69 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -177,11 +177,12 @@ struct va_format {
177}; 177};
178 178
179extern struct atomic_notifier_head panic_notifier_list; 179extern struct atomic_notifier_head panic_notifier_list;
180extern long (*panic_blink)(long time); 180extern long (*panic_blink)(int state);
181NORET_TYPE void panic(const char * fmt, ...) 181NORET_TYPE void panic(const char * fmt, ...)
182 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 182 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
183extern void oops_enter(void); 183extern void oops_enter(void);
184extern void oops_exit(void); 184extern void oops_exit(void);
185void print_oops_end_marker(void);
185extern int oops_may_print(void); 186extern int oops_may_print(void);
186NORET_TYPE void do_exit(long error_code) 187NORET_TYPE void do_exit(long error_code)
187 ATTRIB_NORET; 188 ATTRIB_NORET;
@@ -305,6 +306,13 @@ static inline void log_buf_kexec_setup(void)
305} 306}
306#endif 307#endif
307 308
309/*
310 * Dummy printk for disabled debugging statements to use whilst maintaining
311 * gcc's format and side-effect checking.
312 */
313static inline __attribute__ ((format (printf, 1, 2)))
314int no_printk(const char *s, ...) { return 0; }
315
308extern int printk_needs_cpu(int cpu); 316extern int printk_needs_cpu(int cpu);
309extern void printk_tick(void); 317extern void printk_tick(void);
310 318
@@ -616,17 +624,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
616#endif /* CONFIG_TRACING */ 624#endif /* CONFIG_TRACING */
617 625
618/* 626/*
619 * Display an IP address in readable format.
620 */
621
622#define NIPQUAD(addr) \
623 ((unsigned char *)&addr)[0], \
624 ((unsigned char *)&addr)[1], \
625 ((unsigned char *)&addr)[2], \
626 ((unsigned char *)&addr)[3]
627#define NIPQUAD_FMT "%u.%u.%u.%u"
628
629/*
630 * min()/max()/clamp() macros that also do 627 * min()/max()/clamp() macros that also do
631 * strict type-checking.. See the 628 * strict type-checking.. See the
632 * "unnecessary" pointer comparison. 629 * "unnecessary" pointer comparison.
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 9fad0527344f..4aa95f203f3e 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -1,8 +1,7 @@
1/* 1/*
2 * A generic kernel FIFO implementation. 2 * A generic kernel FIFO implementation
3 * 3 *
4 * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> 4 * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net>
5 * Copyright (C) 2004 Stelian Pop <stelian@popies.net>
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -20,8 +19,11 @@
20 * 19 *
21 */ 20 */
22 21
22#ifndef _LINUX_KFIFO_H
23#define _LINUX_KFIFO_H
24
23/* 25/*
24 * Howto porting drivers to the new generic fifo API: 26 * How to porting drivers to the new generic FIFO API:
25 * 27 *
26 * - Modify the declaration of the "struct kfifo *" object into a 28 * - Modify the declaration of the "struct kfifo *" object into a
27 * in-place "struct kfifo" object 29 * in-place "struct kfifo" object
@@ -30,586 +32,815 @@
30 * passed as the first argument to this functions 32 * passed as the first argument to this functions
31 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get 33 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get
32 * into kfifo_out 34 * into kfifo_out
33 * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get 35 * - Replace the use of kfifo_put into kfifo_in_spinlocked and kfifo_get
34 * into kfifo_out_locked 36 * into kfifo_out_spinlocked
35 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc 37 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc
36 * must be passed now to the kfifo_in_locked and kfifo_out_locked 38 * must be passed now to the kfifo_in_spinlocked and kfifo_out_spinlocked
37 * as the last parameter. 39 * as the last parameter
38 * - All formerly name __kfifo_* functions has been renamed into kfifo_* 40 * - The formerly __kfifo_* functions are renamed into kfifo_*
39 */ 41 */
40 42
41#ifndef _LINUX_KFIFO_H 43/*
42#define _LINUX_KFIFO_H 44 * Note about locking : There is no locking required until only * one reader
45 * and one writer is using the fifo and no kfifo_reset() will be * called
46 * kfifo_reset_out() can be safely used, until it will be only called
47 * in the reader thread.
48 * For multiple writer and one reader there is only a need to lock the writer.
49 * And vice versa for only one writer and multiple reader there is only a need
50 * to lock the reader.
51 */
43 52
44#include <linux/kernel.h> 53#include <linux/kernel.h>
45#include <linux/spinlock.h> 54#include <linux/spinlock.h>
46 55#include <linux/stddef.h>
47struct kfifo { 56#include <linux/scatterlist.h>
48 unsigned char *buffer; /* the buffer holding the data */ 57
49 unsigned int size; /* the size of the allocated buffer */ 58struct __kfifo {
50 unsigned int in; /* data is added at offset (in % size) */ 59 unsigned int in;
51 unsigned int out; /* data is extracted from off. (out % size) */ 60 unsigned int out;
61 unsigned int mask;
62 unsigned int esize;
63 void *data;
52}; 64};
53 65
54/* 66#define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \
55 * Macros for declaration and initialization of the kfifo datatype 67 union { \
56 */ 68 struct __kfifo kfifo; \
57 69 datatype *type; \
58/* helper macro */ 70 char (*rectype)[recsize]; \
59#define __kfifo_initializer(s, b) \ 71 ptrtype *ptr; \
60 (struct kfifo) { \ 72 const ptrtype *ptr_const; \
61 .size = s, \
62 .in = 0, \
63 .out = 0, \
64 .buffer = b \
65 } 73 }
66 74
67/** 75#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \
68 * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer 76{ \
69 * @name: name of the declared kfifo datatype 77 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
70 * @size: size of the fifo buffer. Must be a power of two. 78 type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \
71 *
72 * Note1: the macro can be used inside struct or union declaration
73 * Note2: the macro creates two objects:
74 * A kfifo object with the given name and a buffer for the kfifo
75 * object named name##kfifo_buffer
76 */
77#define DECLARE_KFIFO(name, size) \
78union { \
79 struct kfifo name; \
80 unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \
81} 79}
82 80
83/** 81#define STRUCT_KFIFO(type, size) \
84 * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO 82 struct __STRUCT_KFIFO(type, size, 0, type)
85 * @name: name of the declared kfifo datatype 83
84#define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \
85{ \
86 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
87 type buf[0]; \
88}
89
90#define STRUCT_KFIFO_PTR(type) \
91 struct __STRUCT_KFIFO_PTR(type, 0, type)
92
93/*
94 * define compatibility "struct kfifo" for dynamic allocated fifos
86 */ 95 */
87#define INIT_KFIFO(name) \ 96struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void);
88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
89 sizeof(struct kfifo), \
90 name##kfifo_buffer + sizeof(struct kfifo))
91 97
92/** 98#define STRUCT_KFIFO_REC_1(size) \
93 * DEFINE_KFIFO - macro to define and initialize a kfifo 99 struct __STRUCT_KFIFO(unsigned char, size, 1, void)
94 * @name: name of the declared kfifo datatype 100
95 * @size: size of the fifo buffer. Must be a power of two. 101#define STRUCT_KFIFO_REC_2(size) \
96 * 102 struct __STRUCT_KFIFO(unsigned char, size, 2, void)
97 * Note1: the macro can be used for global and local kfifo data type variables 103
98 * Note2: the macro creates two objects: 104/*
99 * A kfifo object with the given name and a buffer for the kfifo 105 * define kfifo_rec types
100 * object named name##kfifo_buffer
101 */ 106 */
102#define DEFINE_KFIFO(name, size) \ 107struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void);
103 unsigned char name##kfifo_buffer[size]; \ 108struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
104 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
105 109
106extern void kfifo_init(struct kfifo *fifo, void *buffer, 110/*
107 unsigned int size); 111 * helper macro to distinguish between real in place fifo where the fifo
108extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, 112 * array is a part of the structure and the fifo type where the array is
109 gfp_t gfp_mask); 113 * outside of the fifo structure.
110extern void kfifo_free(struct kfifo *fifo); 114 */
111extern unsigned int kfifo_in(struct kfifo *fifo, 115#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo))
112 const void *from, unsigned int len);
113extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
114 void *to, unsigned int len);
115extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
116 void *to, unsigned int len, unsigned offset);
117 116
118/** 117/**
119 * kfifo_initialized - Check if kfifo is initialized. 118 * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object
120 * @fifo: fifo to check 119 * @fifo: name of the declared fifo
121 * Return %true if FIFO is initialized, otherwise %false. 120 * @type: type of the fifo elements
122 * Assumes the fifo was 0 before.
123 */ 121 */
124static inline bool kfifo_initialized(struct kfifo *fifo) 122#define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
125{
126 return fifo->buffer != NULL;
127}
128 123
129/** 124/**
130 * kfifo_reset - removes the entire FIFO contents 125 * DECLARE_KFIFO - macro to declare a fifo object
131 * @fifo: the fifo to be emptied. 126 * @fifo: name of the declared fifo
127 * @type: type of the fifo elements
128 * @size: the number of elements in the fifo, this must be a power of 2
132 */ 129 */
133static inline void kfifo_reset(struct kfifo *fifo) 130#define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo
134{
135 fifo->in = fifo->out = 0;
136}
137 131
138/** 132/**
139 * kfifo_reset_out - skip FIFO contents 133 * INIT_KFIFO - Initialize a fifo declared by DECLARE_KFIFO
140 * @fifo: the fifo to be emptied. 134 * @fifo: name of the declared fifo datatype
141 */ 135 */
142static inline void kfifo_reset_out(struct kfifo *fifo) 136#define INIT_KFIFO(fifo) \
143{ 137(void)({ \
144 smp_mb(); 138 typeof(&(fifo)) __tmp = &(fifo); \
145 fifo->out = fifo->in; 139 struct __kfifo *__kfifo = &__tmp->kfifo; \
146} 140 __kfifo->in = 0; \
141 __kfifo->out = 0; \
142 __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\
143 __kfifo->esize = sizeof(*__tmp->buf); \
144 __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \
145})
147 146
148/** 147/**
149 * kfifo_size - returns the size of the fifo in bytes 148 * DEFINE_KFIFO - macro to define and initialize a fifo
150 * @fifo: the fifo to be used. 149 * @fifo: name of the declared fifo datatype
151 */ 150 * @type: type of the fifo elements
152static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) 151 * @size: the number of elements in the fifo, this must be a power of 2
152 *
153 * Note: the macro can be used for global and local fifo data type variables.
154 */
155#define DEFINE_KFIFO(fifo, type, size) \
156 DECLARE_KFIFO(fifo, type, size) = \
157 (typeof(fifo)) { \
158 { \
159 { \
160 .in = 0, \
161 .out = 0, \
162 .mask = __is_kfifo_ptr(&(fifo)) ? \
163 0 : \
164 ARRAY_SIZE((fifo).buf) - 1, \
165 .esize = sizeof(*(fifo).buf), \
166 .data = __is_kfifo_ptr(&(fifo)) ? \
167 NULL : \
168 (fifo).buf, \
169 } \
170 } \
171 }
172
173
174static inline unsigned int __must_check
175__kfifo_must_check_helper(unsigned int val)
153{ 176{
154 return fifo->size; 177 return val;
155} 178}
156 179
157/** 180/**
158 * kfifo_len - returns the number of used bytes in the FIFO 181 * kfifo_initialized - Check if the fifo is initialized
159 * @fifo: the fifo to be used. 182 * @fifo: address of the fifo to check
183 *
184 * Return %true if fifo is initialized, otherwise %false.
185 * Assumes the fifo was 0 before.
160 */ 186 */
161static inline unsigned int kfifo_len(struct kfifo *fifo) 187#define kfifo_initialized(fifo) ((fifo)->kfifo.mask)
162{
163 register unsigned int out;
164
165 out = fifo->out;
166 smp_rmb();
167 return fifo->in - out;
168}
169 188
170/** 189/**
171 * kfifo_is_empty - returns true if the fifo is empty 190 * kfifo_esize - returns the size of the element managed by the fifo
172 * @fifo: the fifo to be used. 191 * @fifo: address of the fifo to be used
173 */ 192 */
174static inline __must_check int kfifo_is_empty(struct kfifo *fifo) 193#define kfifo_esize(fifo) ((fifo)->kfifo.esize)
175{
176 return fifo->in == fifo->out;
177}
178 194
179/** 195/**
180 * kfifo_is_full - returns true if the fifo is full 196 * kfifo_recsize - returns the size of the record length field
181 * @fifo: the fifo to be used. 197 * @fifo: address of the fifo to be used
182 */ 198 */
183static inline __must_check int kfifo_is_full(struct kfifo *fifo) 199#define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype))
184{
185 return kfifo_len(fifo) == kfifo_size(fifo);
186}
187 200
188/** 201/**
189 * kfifo_avail - returns the number of bytes available in the FIFO 202 * kfifo_size - returns the size of the fifo in elements
190 * @fifo: the fifo to be used. 203 * @fifo: address of the fifo to be used
191 */ 204 */
192static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) 205#define kfifo_size(fifo) ((fifo)->kfifo.mask + 1)
193{
194 return kfifo_size(fifo) - kfifo_len(fifo);
195}
196 206
197/** 207/**
198 * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking 208 * kfifo_reset - removes the entire fifo content
199 * @fifo: the fifo to be used. 209 * @fifo: address of the fifo to be used
200 * @from: the data to be added.
201 * @n: the length of the data to be added.
202 * @lock: pointer to the spinlock to use for locking.
203 * 210 *
204 * This function copies at most @n bytes from the @from buffer into 211 * Note: usage of kfifo_reset() is dangerous. It should be only called when the
205 * the FIFO depending on the free space, and returns the number of 212 * fifo is exclusived locked or when it is secured that no other thread is
206 * bytes copied. 213 * accessing the fifo.
207 */ 214 */
208static inline unsigned int kfifo_in_locked(struct kfifo *fifo, 215#define kfifo_reset(fifo) \
209 const void *from, unsigned int n, spinlock_t *lock) 216(void)({ \
210{ 217 typeof(fifo + 1) __tmp = (fifo); \
211 unsigned long flags; 218 __tmp->kfifo.in = __tmp->kfifo.out = 0; \
212 unsigned int ret; 219})
213
214 spin_lock_irqsave(lock, flags);
215
216 ret = kfifo_in(fifo, from, n);
217
218 spin_unlock_irqrestore(lock, flags);
219
220 return ret;
221}
222 220
223/** 221/**
224 * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking 222 * kfifo_reset_out - skip fifo content
225 * @fifo: the fifo to be used. 223 * @fifo: address of the fifo to be used
226 * @to: where the data must be copied.
227 * @n: the size of the destination buffer.
228 * @lock: pointer to the spinlock to use for locking.
229 * 224 *
230 * This function copies at most @n bytes from the FIFO into the 225 * Note: The usage of kfifo_reset_out() is safe until it will be only called
231 * @to buffer and returns the number of copied bytes. 226 * from the reader thread and there is only one concurrent reader. Otherwise
232 */ 227 * it is dangerous and must be handled in the same way as kfifo_reset().
233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
234 void *to, unsigned int n, spinlock_t *lock)
235{
236 unsigned long flags;
237 unsigned int ret;
238
239 spin_lock_irqsave(lock, flags);
240
241 ret = kfifo_out(fifo, to, n);
242
243 spin_unlock_irqrestore(lock, flags);
244
245 return ret;
246}
247
248extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
249
250extern __must_check int kfifo_from_user(struct kfifo *fifo,
251 const void __user *from, unsigned int n, unsigned *lenout);
252
253extern __must_check int kfifo_to_user(struct kfifo *fifo,
254 void __user *to, unsigned int n, unsigned *lenout);
255
256/*
257 * __kfifo_add_out internal helper function for updating the out offset
258 */ 228 */
259static inline void __kfifo_add_out(struct kfifo *fifo, 229#define kfifo_reset_out(fifo) \
260 unsigned int off) 230(void)({ \
261{ 231 typeof(fifo + 1) __tmp = (fifo); \
262 smp_mb(); 232 __tmp->kfifo.out = __tmp->kfifo.in; \
263 fifo->out += off; 233})
264}
265 234
266/* 235/**
267 * __kfifo_add_in internal helper function for updating the in offset 236 * kfifo_len - returns the number of used elements in the fifo
237 * @fifo: address of the fifo to be used
268 */ 238 */
269static inline void __kfifo_add_in(struct kfifo *fifo, 239#define kfifo_len(fifo) \
270 unsigned int off) 240({ \
271{ 241 typeof(fifo + 1) __tmpl = (fifo); \
272 smp_wmb(); 242 __tmpl->kfifo.in - __tmpl->kfifo.out; \
273 fifo->in += off; 243})
274}
275 244
276/* 245/**
277 * __kfifo_off internal helper function for calculating the index of a 246 * kfifo_is_empty - returns true if the fifo is empty
278 * given offeset 247 * @fifo: address of the fifo to be used
279 */ 248 */
280static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) 249#define kfifo_is_empty(fifo) \
281{ 250({ \
282 return off & (fifo->size - 1); 251 typeof(fifo + 1) __tmpq = (fifo); \
283} 252 __tmpq->kfifo.in == __tmpq->kfifo.out; \
253})
284 254
285/* 255/**
286 * __kfifo_peek_n internal helper function for determinate the length of 256 * kfifo_is_full - returns true if the fifo is full
287 * the next record in the fifo 257 * @fifo: address of the fifo to be used
288 */ 258 */
289static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, 259#define kfifo_is_full(fifo) \
290 unsigned int recsize) 260({ \
291{ 261 typeof(fifo + 1) __tmpq = (fifo); \
292#define __KFIFO_GET(fifo, off, shift) \ 262 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \
293 ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) 263})
294 264
295 unsigned int l; 265/**
266 * kfifo_avail - returns the number of unused elements in the fifo
267 * @fifo: address of the fifo to be used
268 */
269#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \
271({ \
272 typeof(fifo + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \
274 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \
275 (__recsize) ? ((__avail <= __recsize) ? 0 : \
276 __kfifo_max_r(__avail - __recsize, __recsize)) : \
277 __avail; \
278}) \
279)
296 280
297 l = __KFIFO_GET(fifo, 0, 0); 281/**
282 * kfifo_skip - skip output data
283 * @fifo: address of the fifo to be used
284 */
285#define kfifo_skip(fifo) \
286(void)({ \
287 typeof(fifo + 1) __tmp = (fifo); \
288 const size_t __recsize = sizeof(*__tmp->rectype); \
289 struct __kfifo *__kfifo = &__tmp->kfifo; \
290 if (__recsize) \
291 __kfifo_skip_r(__kfifo, __recsize); \
292 else \
293 __kfifo->out++; \
294})
298 295
299 if (--recsize) 296/**
300 l |= __KFIFO_GET(fifo, 1, 8); 297 * kfifo_peek_len - gets the size of the next fifo record
298 * @fifo: address of the fifo to be used
299 *
300 * This function returns the size of the next fifo record in number of bytes.
301 */
302#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \
304({ \
305 typeof(fifo + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \
307 struct __kfifo *__kfifo = &__tmp->kfifo; \
308 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \
309 __kfifo_len_r(__kfifo, __recsize); \
310}) \
311)
301 312
302 return l; 313/**
303#undef __KFIFO_GET 314 * kfifo_alloc - dynamically allocates a new fifo buffer
304} 315 * @fifo: pointer to the fifo
316 * @size: the number of elements in the fifo, this must be a power of 2
317 * @gfp_mask: get_free_pages mask, passed to kmalloc()
318 *
319 * This macro dynamically allocates a new fifo buffer.
320 *
321 * The numer of elements will be rounded-up to a power of 2.
322 * The fifo will be release with kfifo_free().
323 * Return 0 if no error, otherwise an error code.
324 */
325#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \
327({ \
328 typeof(fifo + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \
330 __is_kfifo_ptr(__tmp) ? \
331 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \
332 -EINVAL; \
333}) \
334)
305 335
306/* 336/**
307 * __kfifo_poke_n internal helper function for storing the length of 337 * kfifo_free - frees the fifo
308 * the next record into the fifo 338 * @fifo: the fifo to be freed
309 */ 339 */
310static inline void __kfifo_poke_n(struct kfifo *fifo, 340#define kfifo_free(fifo) \
311 unsigned int recsize, unsigned int n) 341({ \
312{ 342 typeof(fifo + 1) __tmp = (fifo); \
313#define __KFIFO_PUT(fifo, off, val, shift) \ 343 struct __kfifo *__kfifo = &__tmp->kfifo; \
314 ( \ 344 if (__is_kfifo_ptr(__tmp)) \
315 (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ 345 __kfifo_free(__kfifo); \
316 (unsigned char)((val) >> (shift)) \ 346})
317 )
318 347
319 __KFIFO_PUT(fifo, 0, n, 0); 348/**
349 * kfifo_init - initialize a fifo using a preallocated buffer
350 * @fifo: the fifo to assign the buffer
351 * @buffer: the preallocated buffer to be used
352 * @size: the size of the internal buffer, this have to be a power of 2
353 *
354 * This macro initialize a fifo using a preallocated buffer.
355 *
356 * The numer of elements will be rounded-up to a power of 2.
357 * Return 0 if no error, otherwise an error code.
358 */
359#define kfifo_init(fifo, buffer, size) \
360({ \
361 typeof(fifo + 1) __tmp = (fifo); \
362 struct __kfifo *__kfifo = &__tmp->kfifo; \
363 __is_kfifo_ptr(__tmp) ? \
364 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \
365 -EINVAL; \
366})
320 367
321 if (--recsize) 368/**
322 __KFIFO_PUT(fifo, 1, n, 8); 369 * kfifo_put - put data into the fifo
323#undef __KFIFO_PUT 370 * @fifo: address of the fifo to be used
324} 371 * @val: the data to be added
372 *
373 * This macro copies the given value into the fifo.
374 * It returns 0 if the fifo was full. Otherwise it returns the number
375 * processed elements.
376 *
377 * Note that with only one concurrent reader and one concurrent
378 * writer, you don't need extra locking to use these macro.
379 */
380#define kfifo_put(fifo, val) \
381({ \
382 typeof(fifo + 1) __tmp = (fifo); \
383 typeof(val + 1) __val = (val); \
384 unsigned int __ret; \
385 const size_t __recsize = sizeof(*__tmp->rectype); \
386 struct __kfifo *__kfifo = &__tmp->kfifo; \
387 if (0) { \
388 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
389 __dummy = (typeof(__val))NULL; \
390 } \
391 if (__recsize) \
392 __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \
393 __recsize); \
394 else { \
395 __ret = !kfifo_is_full(__tmp); \
396 if (__ret) { \
397 (__is_kfifo_ptr(__tmp) ? \
398 ((typeof(__tmp->type))__kfifo->data) : \
399 (__tmp->buf) \
400 )[__kfifo->in & __tmp->kfifo.mask] = \
401 *(typeof(__tmp->type))__val; \
402 smp_wmb(); \
403 __kfifo->in++; \
404 } \
405 } \
406 __ret; \
407})
325 408
326/* 409/**
327 * __kfifo_in_... internal functions for put date into the fifo 410 * kfifo_get - get data from the fifo
328 * do not call it directly, use kfifo_in_rec() instead 411 * @fifo: address of the fifo to be used
329 */ 412 * @val: the var where to store the data to be added
330extern unsigned int __kfifo_in_n(struct kfifo *fifo, 413 *
331 const void *from, unsigned int n, unsigned int recsize); 414 * This macro reads the data from the fifo.
415 * It returns 0 if the fifo was empty. Otherwise it returns the number
416 * processed elements.
417 *
418 * Note that with only one concurrent reader and one concurrent
419 * writer, you don't need extra locking to use these macro.
420 */
421#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \
423({ \
424 typeof(fifo + 1) __tmp = (fifo); \
425 typeof(val + 1) __val = (val); \
426 unsigned int __ret; \
427 const size_t __recsize = sizeof(*__tmp->rectype); \
428 struct __kfifo *__kfifo = &__tmp->kfifo; \
429 if (0) \
430 __val = (typeof(__tmp->ptr))0; \
431 if (__recsize) \
432 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \
433 __recsize); \
434 else { \
435 __ret = !kfifo_is_empty(__tmp); \
436 if (__ret) { \
437 *(typeof(__tmp->type))__val = \
438 (__is_kfifo_ptr(__tmp) ? \
439 ((typeof(__tmp->type))__kfifo->data) : \
440 (__tmp->buf) \
441 )[__kfifo->out & __tmp->kfifo.mask]; \
442 smp_wmb(); \
443 __kfifo->out++; \
444 } \
445 } \
446 __ret; \
447}) \
448)
332 449
333extern unsigned int __kfifo_in_generic(struct kfifo *fifo, 450/**
334 const void *from, unsigned int n, unsigned int recsize); 451 * kfifo_peek - get data from the fifo without removing
452 * @fifo: address of the fifo to be used
453 * @val: the var where to store the data to be added
454 *
455 * This reads the data from the fifo without removing it from the fifo.
456 * It returns 0 if the fifo was empty. Otherwise it returns the number
457 * processed elements.
458 *
459 * Note that with only one concurrent reader and one concurrent
460 * writer, you don't need extra locking to use these macro.
461 */
462#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \
464({ \
465 typeof(fifo + 1) __tmp = (fifo); \
466 typeof(val + 1) __val = (val); \
467 unsigned int __ret; \
468 const size_t __recsize = sizeof(*__tmp->rectype); \
469 struct __kfifo *__kfifo = &__tmp->kfifo; \
470 if (0) \
471 __val = (typeof(__tmp->ptr))NULL; \
472 if (__recsize) \
473 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \
474 __recsize); \
475 else { \
476 __ret = !kfifo_is_empty(__tmp); \
477 if (__ret) { \
478 *(typeof(__tmp->type))__val = \
479 (__is_kfifo_ptr(__tmp) ? \
480 ((typeof(__tmp->type))__kfifo->data) : \
481 (__tmp->buf) \
482 )[__kfifo->out & __tmp->kfifo.mask]; \
483 smp_wmb(); \
484 } \
485 } \
486 __ret; \
487}) \
488)
335 489
336static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, 490/**
337 const void *from, unsigned int n, unsigned int recsize) 491 * kfifo_in - put data into the fifo
338{ 492 * @fifo: address of the fifo to be used
339 unsigned int ret; 493 * @buf: the data to be added
494 * @n: number of elements to be added
495 *
496 * This macro copies the given buffer into the fifo and returns the
497 * number of copied elements.
498 *
499 * Note that with only one concurrent reader and one concurrent
500 * writer, you don't need extra locking to use these macro.
501 */
502#define kfifo_in(fifo, buf, n) \
503({ \
504 typeof(fifo + 1) __tmp = (fifo); \
505 typeof(buf + 1) __buf = (buf); \
506 unsigned long __n = (n); \
507 const size_t __recsize = sizeof(*__tmp->rectype); \
508 struct __kfifo *__kfifo = &__tmp->kfifo; \
509 if (0) { \
510 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
511 __dummy = (typeof(__buf))NULL; \
512 } \
513 (__recsize) ?\
514 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \
515 __kfifo_in(__kfifo, __buf, __n); \
516})
340 517
341 ret = __kfifo_in_n(fifo, from, n, recsize); 518/**
519 * kfifo_in_spinlocked - put data into the fifo using a spinlock for locking
520 * @fifo: address of the fifo to be used
521 * @buf: the data to be added
522 * @n: number of elements to be added
523 * @lock: pointer to the spinlock to use for locking
524 *
525 * This macro copies the given values buffer into the fifo and returns the
526 * number of copied elements.
527 */
528#define kfifo_in_spinlocked(fifo, buf, n, lock) \
529({ \
530 unsigned long __flags; \
531 unsigned int __ret; \
532 spin_lock_irqsave(lock, __flags); \
533 __ret = kfifo_in(fifo, buf, n); \
534 spin_unlock_irqrestore(lock, __flags); \
535 __ret; \
536})
537
538/* alias for kfifo_in_spinlocked, will be removed in a future release */
539#define kfifo_in_locked(fifo, buf, n, lock) \
540 kfifo_in_spinlocked(fifo, buf, n, lock)
342 541
343 if (likely(ret == 0)) { 542/**
344 if (recsize) 543 * kfifo_out - get data from the fifo
345 __kfifo_poke_n(fifo, recsize, n); 544 * @fifo: address of the fifo to be used
346 __kfifo_add_in(fifo, n + recsize); 545 * @buf: pointer to the storage buffer
347 } 546 * @n: max. number of elements to get
348 return ret; 547 *
349} 548 * This macro get some data from the fifo and return the numbers of elements
549 * copied.
550 *
551 * Note that with only one concurrent reader and one concurrent
552 * writer, you don't need extra locking to use these macro.
553 */
554#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \
556({ \
557 typeof(fifo + 1) __tmp = (fifo); \
558 typeof(buf + 1) __buf = (buf); \
559 unsigned long __n = (n); \
560 const size_t __recsize = sizeof(*__tmp->rectype); \
561 struct __kfifo *__kfifo = &__tmp->kfifo; \
562 if (0) { \
563 typeof(__tmp->ptr) __dummy = NULL; \
564 __buf = __dummy; \
565 } \
566 (__recsize) ?\
567 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \
568 __kfifo_out(__kfifo, __buf, __n); \
569}) \
570)
571
572/**
573 * kfifo_out_spinlocked - get data from the fifo using a spinlock for locking
574 * @fifo: address of the fifo to be used
575 * @buf: pointer to the storage buffer
576 * @n: max. number of elements to get
577 * @lock: pointer to the spinlock to use for locking
578 *
579 * This macro get the data from the fifo and return the numbers of elements
580 * copied.
581 */
582#define kfifo_out_spinlocked(fifo, buf, n, lock) \
583__kfifo_must_check_helper( \
584({ \
585 unsigned long __flags; \
586 unsigned int __ret; \
587 spin_lock_irqsave(lock, __flags); \
588 __ret = kfifo_out(fifo, buf, n); \
589 spin_unlock_irqrestore(lock, __flags); \
590 __ret; \
591}) \
592)
593
594/* alias for kfifo_out_spinlocked, will be removed in a future release */
595#define kfifo_out_locked(fifo, buf, n, lock) \
596 kfifo_out_spinlocked(fifo, buf, n, lock)
350 597
351/** 598/**
352 * kfifo_in_rec - puts some record data into the FIFO 599 * kfifo_from_user - puts some data from user space into the fifo
353 * @fifo: the fifo to be used. 600 * @fifo: address of the fifo to be used
354 * @from: the data to be added. 601 * @from: pointer to the data to be added
355 * @n: the length of the data to be added. 602 * @len: the length of the data to be added
356 * @recsize: size of record field 603 * @copied: pointer to output variable to store the number of copied bytes
357 * 604 *
358 * This function copies @n bytes from the @from into the FIFO and returns 605 * This macro copies at most @len bytes from the @from into the
359 * the number of bytes which cannot be copied. 606 * fifo, depending of the available space and returns -EFAULT/0.
360 * A returned value greater than the @n value means that the record doesn't
361 * fit into the buffer.
362 * 607 *
363 * Note that with only one concurrent reader and one concurrent 608 * Note that with only one concurrent reader and one concurrent
364 * writer, you don't need extra locking to use these functions. 609 * writer, you don't need extra locking to use these macro.
365 */ 610 */
366static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, 611#define kfifo_from_user(fifo, from, len, copied) \
367 void *from, unsigned int n, unsigned int recsize) 612__kfifo_must_check_helper( \
368{ 613({ \
369 if (!__builtin_constant_p(recsize)) 614 typeof(fifo + 1) __tmp = (fifo); \
370 return __kfifo_in_generic(fifo, from, n, recsize); 615 const void __user *__from = (from); \
371 return __kfifo_in_rec(fifo, from, n, recsize); 616 unsigned int __len = (len); \
372} 617 unsigned int *__copied = (copied); \
618 const size_t __recsize = sizeof(*__tmp->rectype); \
619 struct __kfifo *__kfifo = &__tmp->kfifo; \
620 (__recsize) ? \
621 __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \
622 __kfifo_from_user(__kfifo, __from, __len, __copied); \
623}) \
624)
373 625
374/* 626/**
375 * __kfifo_out_... internal functions for get date from the fifo 627 * kfifo_to_user - copies data from the fifo into user space
376 * do not call it directly, use kfifo_out_rec() instead 628 * @fifo: address of the fifo to be used
377 */ 629 * @to: where the data must be copied
378extern unsigned int __kfifo_out_n(struct kfifo *fifo, 630 * @len: the size of the destination buffer
379 void *to, unsigned int reclen, unsigned int recsize); 631 * @copied: pointer to output variable to store the number of copied bytes
632 *
633 * This macro copies at most @len bytes from the fifo into the
634 * @to buffer and returns -EFAULT/0.
635 *
636 * Note that with only one concurrent reader and one concurrent
637 * writer, you don't need extra locking to use these macro.
638 */
639#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \
641({ \
642 typeof(fifo + 1) __tmp = (fifo); \
643 void __user *__to = (to); \
644 unsigned int __len = (len); \
645 unsigned int *__copied = (copied); \
646 const size_t __recsize = sizeof(*__tmp->rectype); \
647 struct __kfifo *__kfifo = &__tmp->kfifo; \
648 (__recsize) ? \
649 __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \
650 __kfifo_to_user(__kfifo, __to, __len, __copied); \
651}) \
652)
653
654/**
655 * kfifo_dma_in_prepare - setup a scatterlist for DMA input
656 * @fifo: address of the fifo to be used
657 * @sgl: pointer to the scatterlist array
658 * @nents: number of entries in the scatterlist array
659 * @len: number of elements to transfer
660 *
661 * This macro fills a scatterlist for DMA input.
662 * It returns the number entries in the scatterlist array.
663 *
664 * Note that with only one concurrent reader and one concurrent
665 * writer, you don't need extra locking to use these macros.
666 */
667#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \
668({ \
669 typeof(fifo + 1) __tmp = (fifo); \
670 struct scatterlist *__sgl = (sgl); \
671 int __nents = (nents); \
672 unsigned int __len = (len); \
673 const size_t __recsize = sizeof(*__tmp->rectype); \
674 struct __kfifo *__kfifo = &__tmp->kfifo; \
675 (__recsize) ? \
676 __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
677 __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \
678})
380 679
381extern unsigned int __kfifo_out_generic(struct kfifo *fifo, 680/**
382 void *to, unsigned int n, 681 * kfifo_dma_in_finish - finish a DMA IN operation
383 unsigned int recsize, unsigned int *total); 682 * @fifo: address of the fifo to be used
683 * @len: number of bytes to received
684 *
685 * This macro finish a DMA IN operation. The in counter will be updated by
686 * the len parameter. No error checking will be done.
687 *
688 * Note that with only one concurrent reader and one concurrent
689 * writer, you don't need extra locking to use these macros.
690 */
691#define kfifo_dma_in_finish(fifo, len) \
692(void)({ \
693 typeof(fifo + 1) __tmp = (fifo); \
694 unsigned int __len = (len); \
695 const size_t __recsize = sizeof(*__tmp->rectype); \
696 struct __kfifo *__kfifo = &__tmp->kfifo; \
697 if (__recsize) \
698 __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \
699 else \
700 __kfifo->in += __len / sizeof(*__tmp->type); \
701})
384 702
385static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, 703/**
386 void *to, unsigned int n, unsigned int recsize, 704 * kfifo_dma_out_prepare - setup a scatterlist for DMA output
387 unsigned int *total) 705 * @fifo: address of the fifo to be used
388{ 706 * @sgl: pointer to the scatterlist array
389 unsigned int l; 707 * @nents: number of entries in the scatterlist array
390 708 * @len: number of elements to transfer
391 if (!recsize) { 709 *
392 l = n; 710 * This macro fills a scatterlist for DMA output which at most @len bytes
393 if (total) 711 * to transfer.
394 *total = l; 712 * It returns the number entries in the scatterlist array.
395 } else { 713 * A zero means there is no space available and the scatterlist is not filled.
396 l = __kfifo_peek_n(fifo, recsize); 714 *
397 if (total) 715 * Note that with only one concurrent reader and one concurrent
398 *total = l; 716 * writer, you don't need extra locking to use these macros.
399 if (n < l) 717 */
400 return l; 718#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \
401 } 719({ \
720 typeof(fifo + 1) __tmp = (fifo); \
721 struct scatterlist *__sgl = (sgl); \
722 int __nents = (nents); \
723 unsigned int __len = (len); \
724 const size_t __recsize = sizeof(*__tmp->rectype); \
725 struct __kfifo *__kfifo = &__tmp->kfifo; \
726 (__recsize) ? \
727 __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
728 __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \
729})
402 730
403 return __kfifo_out_n(fifo, to, l, recsize); 731/**
404} 732 * kfifo_dma_out_finish - finish a DMA OUT operation
733 * @fifo: address of the fifo to be used
734 * @len: number of bytes transferd
735 *
736 * This macro finish a DMA OUT operation. The out counter will be updated by
737 * the len parameter. No error checking will be done.
738 *
739 * Note that with only one concurrent reader and one concurrent
740 * writer, you don't need extra locking to use these macros.
741 */
742#define kfifo_dma_out_finish(fifo, len) \
743(void)({ \
744 typeof(fifo + 1) __tmp = (fifo); \
745 unsigned int __len = (len); \
746 const size_t __recsize = sizeof(*__tmp->rectype); \
747 struct __kfifo *__kfifo = &__tmp->kfifo; \
748 if (__recsize) \
749 __kfifo_dma_out_finish_r(__kfifo, __recsize); \
750 else \
751 __kfifo->out += __len / sizeof(*__tmp->type); \
752})
405 753
406/** 754/**
407 * kfifo_out_rec - gets some record data from the FIFO 755 * kfifo_out_peek - gets some data from the fifo
408 * @fifo: the fifo to be used. 756 * @fifo: address of the fifo to be used
409 * @to: where the data must be copied. 757 * @buf: pointer to the storage buffer
410 * @n: the size of the destination buffer. 758 * @n: max. number of elements to get
411 * @recsize: size of record field
412 * @total: pointer where the total number of to copied bytes should stored
413 * 759 *
414 * This function copies at most @n bytes from the FIFO to @to and returns the 760 * This macro get the data from the fifo and return the numbers of elements
415 * number of bytes which cannot be copied. 761 * copied. The data is not removed from the fifo.
416 * A returned value greater than the @n value means that the record doesn't
417 * fit into the @to buffer.
418 * 762 *
419 * Note that with only one concurrent reader and one concurrent 763 * Note that with only one concurrent reader and one concurrent
420 * writer, you don't need extra locking to use these functions. 764 * writer, you don't need extra locking to use these macro.
421 */ 765 */
422static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, 766#define kfifo_out_peek(fifo, buf, n) \
423 void *to, unsigned int n, unsigned int recsize, 767__kfifo_must_check_helper( \
424 unsigned int *total) 768({ \
769 typeof(fifo + 1) __tmp = (fifo); \
770 typeof(buf + 1) __buf = (buf); \
771 unsigned long __n = (n); \
772 const size_t __recsize = sizeof(*__tmp->rectype); \
773 struct __kfifo *__kfifo = &__tmp->kfifo; \
774 if (0) { \
775 typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \
776 __buf = __dummy; \
777 } \
778 (__recsize) ? \
779 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \
780 __kfifo_out_peek(__kfifo, __buf, __n); \
781}) \
782)
425 783
426{ 784extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
427 if (!__builtin_constant_p(recsize)) 785 size_t esize, gfp_t gfp_mask);
428 return __kfifo_out_generic(fifo, to, n, recsize, total);
429 return __kfifo_out_rec(fifo, to, n, recsize, total);
430}
431 786
432/* 787extern void __kfifo_free(struct __kfifo *fifo);
433 * __kfifo_from_user_... internal functions for transfer from user space into
434 * the fifo. do not call it directly, use kfifo_from_user_rec() instead
435 */
436extern unsigned int __kfifo_from_user_n(struct kfifo *fifo,
437 const void __user *from, unsigned int n, unsigned int recsize);
438 788
439extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, 789extern int __kfifo_init(struct __kfifo *fifo, void *buffer,
440 const void __user *from, unsigned int n, unsigned int recsize); 790 unsigned int size, size_t esize);
441 791
442static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, 792extern unsigned int __kfifo_in(struct __kfifo *fifo,
443 const void __user *from, unsigned int n, unsigned int recsize) 793 const void *buf, unsigned int len);
444{
445 unsigned int ret;
446 794
447 ret = __kfifo_from_user_n(fifo, from, n, recsize); 795extern unsigned int __kfifo_out(struct __kfifo *fifo,
796 void *buf, unsigned int len);
448 797
449 if (likely(ret == 0)) { 798extern int __kfifo_from_user(struct __kfifo *fifo,
450 if (recsize) 799 const void __user *from, unsigned long len, unsigned int *copied);
451 __kfifo_poke_n(fifo, recsize, n);
452 __kfifo_add_in(fifo, n + recsize);
453 }
454 return ret;
455}
456 800
457/** 801extern int __kfifo_to_user(struct __kfifo *fifo,
458 * kfifo_from_user_rec - puts some data from user space into the FIFO 802 void __user *to, unsigned long len, unsigned int *copied);
459 * @fifo: the fifo to be used.
460 * @from: pointer to the data to be added.
461 * @n: the length of the data to be added.
462 * @recsize: size of record field
463 *
464 * This function copies @n bytes from the @from into the
465 * FIFO and returns the number of bytes which cannot be copied.
466 *
467 * If the returned value is equal or less the @n value, the copy_from_user()
468 * functions has failed. Otherwise the record doesn't fit into the buffer.
469 *
470 * Note that with only one concurrent reader and one concurrent
471 * writer, you don't need extra locking to use these functions.
472 */
473static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo,
474 const void __user *from, unsigned int n, unsigned int recsize)
475{
476 if (!__builtin_constant_p(recsize))
477 return __kfifo_from_user_generic(fifo, from, n, recsize);
478 return __kfifo_from_user_rec(fifo, from, n, recsize);
479}
480 803
481/* 804extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo,
482 * __kfifo_to_user_... internal functions for transfer fifo data into user space 805 struct scatterlist *sgl, int nents, unsigned int len);
483 * do not call it directly, use kfifo_to_user_rec() instead
484 */
485extern unsigned int __kfifo_to_user_n(struct kfifo *fifo,
486 void __user *to, unsigned int n, unsigned int reclen,
487 unsigned int recsize);
488 806
489extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, 807extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo,
490 void __user *to, unsigned int n, unsigned int recsize, 808 struct scatterlist *sgl, int nents, unsigned int len);
491 unsigned int *total);
492 809
493static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, 810extern unsigned int __kfifo_out_peek(struct __kfifo *fifo,
494 void __user *to, unsigned int n, 811 void *buf, unsigned int len);
495 unsigned int recsize, unsigned int *total)
496{
497 unsigned int l;
498
499 if (!recsize) {
500 l = n;
501 if (total)
502 *total = l;
503 } else {
504 l = __kfifo_peek_n(fifo, recsize);
505 if (total)
506 *total = l;
507 if (n < l)
508 return l;
509 }
510 812
511 return __kfifo_to_user_n(fifo, to, n, l, recsize); 813extern unsigned int __kfifo_in_r(struct __kfifo *fifo,
512} 814 const void *buf, unsigned int len, size_t recsize);
513 815
514/** 816extern unsigned int __kfifo_out_r(struct __kfifo *fifo,
515 * kfifo_to_user_rec - gets data from the FIFO and write it to user space 817 void *buf, unsigned int len, size_t recsize);
516 * @fifo: the fifo to be used.
517 * @to: where the data must be copied.
518 * @n: the size of the destination buffer.
519 * @recsize: size of record field
520 * @total: pointer where the total number of to copied bytes should stored
521 *
522 * This function copies at most @n bytes from the FIFO to the @to.
523 * In case of an error, the function returns the number of bytes which cannot
524 * be copied.
525 * If the returned value is equal or less the @n value, the copy_to_user()
526 * functions has failed. Otherwise the record doesn't fit into the @to buffer.
527 *
528 * Note that with only one concurrent reader and one concurrent
529 * writer, you don't need extra locking to use these functions.
530 */
531static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo,
532 void __user *to, unsigned int n, unsigned int recsize,
533 unsigned int *total)
534{
535 if (!__builtin_constant_p(recsize))
536 return __kfifo_to_user_generic(fifo, to, n, recsize, total);
537 return __kfifo_to_user_rec(fifo, to, n, recsize, total);
538}
539 818
540/* 819extern int __kfifo_from_user_r(struct __kfifo *fifo,
541 * __kfifo_peek_... internal functions for peek into the next fifo record 820 const void __user *from, unsigned long len, unsigned int *copied,
542 * do not call it directly, use kfifo_peek_rec() instead 821 size_t recsize);
543 */
544extern unsigned int __kfifo_peek_generic(struct kfifo *fifo,
545 unsigned int recsize);
546 822
547/** 823extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to,
548 * kfifo_peek_rec - gets the size of the next FIFO record data 824 unsigned long len, unsigned int *copied, size_t recsize);
549 * @fifo: the fifo to be used.
550 * @recsize: size of record field
551 *
552 * This function returns the size of the next FIFO record in number of bytes
553 */
554static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo,
555 unsigned int recsize)
556{
557 if (!__builtin_constant_p(recsize))
558 return __kfifo_peek_generic(fifo, recsize);
559 if (!recsize)
560 return kfifo_len(fifo);
561 return __kfifo_peek_n(fifo, recsize);
562}
563 825
564/* 826extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
565 * __kfifo_skip_... internal functions for skip the next fifo record 827 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
566 * do not call it directly, use kfifo_skip_rec() instead
567 */
568extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize);
569 828
570static inline void __kfifo_skip_rec(struct kfifo *fifo, 829extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo,
571 unsigned int recsize) 830 unsigned int len, size_t recsize);
572{
573 unsigned int l;
574 831
575 if (recsize) { 832extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
576 l = __kfifo_peek_n(fifo, recsize); 833 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
577 834
578 if (l + recsize <= kfifo_len(fifo)) { 835extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize);
579 __kfifo_add_out(fifo, l + recsize);
580 return;
581 }
582 }
583 kfifo_reset_out(fifo);
584}
585 836
586/** 837extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize);
587 * kfifo_skip_rec - skip the next fifo out record
588 * @fifo: the fifo to be used.
589 * @recsize: size of record field
590 *
591 * This function skips the next FIFO record
592 */
593static inline void kfifo_skip_rec(struct kfifo *fifo,
594 unsigned int recsize)
595{
596 if (!__builtin_constant_p(recsize))
597 __kfifo_skip_generic(fifo, recsize);
598 else
599 __kfifo_skip_rec(fifo, recsize);
600}
601 838
602/** 839extern void __kfifo_skip_r(struct __kfifo *fifo, size_t recsize);
603 * kfifo_avail_rec - returns the number of bytes available in a record FIFO
604 * @fifo: the fifo to be used.
605 * @recsize: size of record field
606 */
607static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo,
608 unsigned int recsize)
609{
610 unsigned int l = kfifo_size(fifo) - kfifo_len(fifo);
611 840
612 return (l > recsize) ? l - recsize : 0; 841extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo,
613} 842 void *buf, unsigned int len, size_t recsize);
843
844extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize);
614 845
615#endif 846#endif
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 43bdab769fc3..74d691ee9121 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -78,7 +78,7 @@ static inline struct page *ksm_might_need_to_copy(struct page *page,
78 struct anon_vma *anon_vma = page_anon_vma(page); 78 struct anon_vma *anon_vma = page_anon_vma(page);
79 79
80 if (!anon_vma || 80 if (!anon_vma ||
81 (anon_vma == vma->anon_vma && 81 (anon_vma->root == vma->anon_vma->root &&
82 page->index == linear_page_index(vma, address))) 82 page->index == linear_page_index(vma, address)))
83 return page; 83 return page;
84 84
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
new file mode 100644
index 000000000000..b288cb713b90
--- /dev/null
+++ b/include/linux/lglock.h
@@ -0,0 +1,172 @@
1/*
2 * Specialised local-global spinlock. Can only be declared as global variables
3 * to avoid overhead and keep things simple (and we don't want to start using
4 * these inside dynamically allocated structures).
5 *
6 * "local/global locks" (lglocks) can be used to:
7 *
8 * - Provide fast exclusive access to per-CPU data, with exclusive access to
9 * another CPU's data allowed but possibly subject to contention, and to
10 * provide very slow exclusive access to all per-CPU data.
11 * - Or to provide very fast and scalable read serialisation, and to provide
12 * very slow exclusive serialisation of data (not necessarily per-CPU data).
13 *
14 * Brlocks are also implemented as a short-hand notation for the latter use
15 * case.
16 *
17 * Copyright 2009, 2010, Nick Piggin, Novell Inc.
18 */
19#ifndef __LINUX_LGLOCK_H
20#define __LINUX_LGLOCK_H
21
22#include <linux/spinlock.h>
23#include <linux/lockdep.h>
24#include <linux/percpu.h>
25
26/* can make br locks by using local lock for read side, global lock for write */
27#define br_lock_init(name) name##_lock_init()
28#define br_read_lock(name) name##_local_lock()
29#define br_read_unlock(name) name##_local_unlock()
30#define br_write_lock(name) name##_global_lock_online()
31#define br_write_unlock(name) name##_global_unlock_online()
32
33#define DECLARE_BRLOCK(name) DECLARE_LGLOCK(name)
34#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
35
36
37#define lg_lock_init(name) name##_lock_init()
38#define lg_local_lock(name) name##_local_lock()
39#define lg_local_unlock(name) name##_local_unlock()
40#define lg_local_lock_cpu(name, cpu) name##_local_lock_cpu(cpu)
41#define lg_local_unlock_cpu(name, cpu) name##_local_unlock_cpu(cpu)
42#define lg_global_lock(name) name##_global_lock()
43#define lg_global_unlock(name) name##_global_unlock()
44#define lg_global_lock_online(name) name##_global_lock_online()
45#define lg_global_unlock_online(name) name##_global_unlock_online()
46
47#ifdef CONFIG_DEBUG_LOCK_ALLOC
48#define LOCKDEP_INIT_MAP lockdep_init_map
49
50#define DEFINE_LGLOCK_LOCKDEP(name) \
51 struct lock_class_key name##_lock_key; \
52 struct lockdep_map name##_lock_dep_map; \
53 EXPORT_SYMBOL(name##_lock_dep_map)
54
55#else
56#define LOCKDEP_INIT_MAP(a, b, c, d)
57
58#define DEFINE_LGLOCK_LOCKDEP(name)
59#endif
60
61
62#define DECLARE_LGLOCK(name) \
63 extern void name##_lock_init(void); \
64 extern void name##_local_lock(void); \
65 extern void name##_local_unlock(void); \
66 extern void name##_local_lock_cpu(int cpu); \
67 extern void name##_local_unlock_cpu(int cpu); \
68 extern void name##_global_lock(void); \
69 extern void name##_global_unlock(void); \
70 extern void name##_global_lock_online(void); \
71 extern void name##_global_unlock_online(void); \
72
73#define DEFINE_LGLOCK(name) \
74 \
75 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
76 DEFINE_LGLOCK_LOCKDEP(name); \
77 \
78 void name##_lock_init(void) { \
79 int i; \
80 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
81 for_each_possible_cpu(i) { \
82 arch_spinlock_t *lock; \
83 lock = &per_cpu(name##_lock, i); \
84 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
85 } \
86 } \
87 EXPORT_SYMBOL(name##_lock_init); \
88 \
89 void name##_local_lock(void) { \
90 arch_spinlock_t *lock; \
91 preempt_disable(); \
92 rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \
93 lock = &__get_cpu_var(name##_lock); \
94 arch_spin_lock(lock); \
95 } \
96 EXPORT_SYMBOL(name##_local_lock); \
97 \
98 void name##_local_unlock(void) { \
99 arch_spinlock_t *lock; \
100 rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \
101 lock = &__get_cpu_var(name##_lock); \
102 arch_spin_unlock(lock); \
103 preempt_enable(); \
104 } \
105 EXPORT_SYMBOL(name##_local_unlock); \
106 \
107 void name##_local_lock_cpu(int cpu) { \
108 arch_spinlock_t *lock; \
109 preempt_disable(); \
110 rwlock_acquire_read(&name##_lock_dep_map, 0, 0, _THIS_IP_); \
111 lock = &per_cpu(name##_lock, cpu); \
112 arch_spin_lock(lock); \
113 } \
114 EXPORT_SYMBOL(name##_local_lock_cpu); \
115 \
116 void name##_local_unlock_cpu(int cpu) { \
117 arch_spinlock_t *lock; \
118 rwlock_release(&name##_lock_dep_map, 1, _THIS_IP_); \
119 lock = &per_cpu(name##_lock, cpu); \
120 arch_spin_unlock(lock); \
121 preempt_enable(); \
122 } \
123 EXPORT_SYMBOL(name##_local_unlock_cpu); \
124 \
125 void name##_global_lock_online(void) { \
126 int i; \
127 preempt_disable(); \
128 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
129 for_each_online_cpu(i) { \
130 arch_spinlock_t *lock; \
131 lock = &per_cpu(name##_lock, i); \
132 arch_spin_lock(lock); \
133 } \
134 } \
135 EXPORT_SYMBOL(name##_global_lock_online); \
136 \
137 void name##_global_unlock_online(void) { \
138 int i; \
139 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
140 for_each_online_cpu(i) { \
141 arch_spinlock_t *lock; \
142 lock = &per_cpu(name##_lock, i); \
143 arch_spin_unlock(lock); \
144 } \
145 preempt_enable(); \
146 } \
147 EXPORT_SYMBOL(name##_global_unlock_online); \
148 \
149 void name##_global_lock(void) { \
150 int i; \
151 preempt_disable(); \
152 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
153 for_each_online_cpu(i) { \
154 arch_spinlock_t *lock; \
155 lock = &per_cpu(name##_lock, i); \
156 arch_spin_lock(lock); \
157 } \
158 } \
159 EXPORT_SYMBOL(name##_global_lock); \
160 \
161 void name##_global_unlock(void) { \
162 int i; \
163 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
164 for_each_online_cpu(i) { \
165 arch_spinlock_t *lock; \
166 lock = &per_cpu(name##_lock, i); \
167 arch_spin_unlock(lock); \
168 } \
169 preempt_enable(); \
170 } \
171 EXPORT_SYMBOL(name##_global_unlock);
172#endif
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index a09b84e4fdb4..54cbbac1e71d 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -4,9 +4,6 @@
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6 6
7/* Hardwire the number of additional indexes */
8#define MB_CACHE_INDEXES_COUNT 1
9
10struct mb_cache_entry { 7struct mb_cache_entry {
11 struct list_head e_lru_list; 8 struct list_head e_lru_list;
12 struct mb_cache *e_cache; 9 struct mb_cache *e_cache;
@@ -18,17 +15,12 @@ struct mb_cache_entry {
18 struct { 15 struct {
19 struct list_head o_list; 16 struct list_head o_list;
20 unsigned int o_key; 17 unsigned int o_key;
21 } e_indexes[0]; 18 } e_index;
22};
23
24struct mb_cache_op {
25 int (*free)(struct mb_cache_entry *, gfp_t);
26}; 19};
27 20
28/* Functions on caches */ 21/* Functions on caches */
29 22
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 23struct mb_cache *mb_cache_create(const char *, int);
31 int, int);
32void mb_cache_shrink(struct block_device *); 24void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 25void mb_cache_destroy(struct mb_cache *);
34 26
@@ -36,17 +28,15 @@ void mb_cache_destroy(struct mb_cache *);
36 28
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t); 29struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 30int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 31 sector_t, unsigned int);
40void mb_cache_entry_release(struct mb_cache_entry *); 32void mb_cache_entry_release(struct mb_cache_entry *);
41void mb_cache_entry_free(struct mb_cache_entry *); 33void mb_cache_entry_free(struct mb_cache_entry *);
42struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *, 34struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
43 struct block_device *, 35 struct block_device *,
44 sector_t); 36 sector_t);
45#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0) 37struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
46struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
47 struct block_device *, 38 struct block_device *,
48 unsigned int); 39 unsigned int);
49struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int, 40struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *,
50 struct block_device *, 41 struct block_device *,
51 unsigned int); 42 unsigned int);
52#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 9411d32840b0..159a0762aeaf 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -98,11 +98,6 @@ extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
98/* 98/*
99 * For memory reclaim. 99 * For memory reclaim.
100 */ 100 */
101extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
102extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
103 int priority);
104extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
105 int priority);
106int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 101int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
107int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); 102int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
108unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 103unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
@@ -128,8 +123,9 @@ static inline bool mem_cgroup_disabled(void)
128 123
129void mem_cgroup_update_file_mapped(struct page *page, int val); 124void mem_cgroup_update_file_mapped(struct page *page, int val);
130unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 125unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
131 gfp_t gfp_mask, int nid, 126 gfp_t gfp_mask);
132 int zid); 127u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
128
133#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 129#else /* CONFIG_CGROUP_MEM_RES_CTLR */
134struct mem_cgroup; 130struct mem_cgroup;
135 131
@@ -304,7 +300,13 @@ static inline void mem_cgroup_update_file_mapped(struct page *page,
304 300
305static inline 301static inline
306unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 302unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
307 gfp_t gfp_mask, int nid, int zid) 303 gfp_t gfp_mask)
304{
305 return 0;
306}
307
308static inline
309u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
308{ 310{
309 return 0; 311 return 0;
310} 312}
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7b9ef6bf45aa..31ac26ca4acf 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -210,6 +210,8 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
210 unsigned long addr, gfp_t gfp_flags, 210 unsigned long addr, gfp_t gfp_flags,
211 struct mempolicy **mpol, nodemask_t **nodemask); 211 struct mempolicy **mpol, nodemask_t **nodemask);
212extern bool init_nodemask_of_mempolicy(nodemask_t *mask); 212extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
213extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
214 const nodemask_t *mask);
213extern unsigned slab_node(struct mempolicy *policy); 215extern unsigned slab_node(struct mempolicy *policy);
214 216
215extern enum zone_type policy_zone; 217extern enum zone_type policy_zone;
@@ -338,7 +340,16 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
338 return node_zonelist(0, gfp_flags); 340 return node_zonelist(0, gfp_flags);
339} 341}
340 342
341static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; } 343static inline bool init_nodemask_of_mempolicy(nodemask_t *m)
344{
345 return false;
346}
347
348static inline bool mempolicy_nodemask_intersects(struct task_struct *tsk,
349 const nodemask_t *mask)
350{
351 return false;
352}
342 353
343static inline int do_migrate_pages(struct mm_struct *mm, 354static inline int do_migrate_pages(struct mm_struct *mm,
344 const nodemask_t *from_nodes, 355 const nodemask_t *from_nodes,
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index b63ff3ba3351..f5cec4500f38 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -76,6 +76,8 @@
76#define AB8500_NR_IRQS 104 76#define AB8500_NR_IRQS 104
77#define AB8500_NUM_IRQ_REGS 13 77#define AB8500_NUM_IRQ_REGS 13
78 78
79#define AB8500_NUM_REGULATORS 15
80
79/** 81/**
80 * struct ab8500 - ab8500 internal structure 82 * struct ab8500 - ab8500 internal structure
81 * @dev: parent device 83 * @dev: parent device
@@ -108,14 +110,18 @@ struct ab8500 {
108 u8 oldmask[AB8500_NUM_IRQ_REGS]; 110 u8 oldmask[AB8500_NUM_IRQ_REGS];
109}; 111};
110 112
113struct regulator_init_data;
114
111/** 115/**
112 * struct ab8500_platform_data - AB8500 platform data 116 * struct ab8500_platform_data - AB8500 platform data
113 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 117 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
114 * @init: board-specific initialization after detection of ab8500 118 * @init: board-specific initialization after detection of ab8500
119 * @regulator: machine-specific constraints for regulators
115 */ 120 */
116struct ab8500_platform_data { 121struct ab8500_platform_data {
117 int irq_base; 122 int irq_base;
118 void (*init) (struct ab8500 *); 123 void (*init) (struct ab8500 *);
124 struct regulator_init_data *regulator[AB8500_NUM_REGULATORS];
119}; 125};
120 126
121extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data); 127extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data);
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
new file mode 100644
index 000000000000..6dc75b3e2d33
--- /dev/null
+++ b/include/linux/mfd/max8998-private.h
@@ -0,0 +1,112 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_MAX8998_PRIV_H
24#define __LINUX_MFD_MAX8998_PRIV_H
25
26/* MAX 8998 registers */
27enum {
28 MAX8998_REG_IRQ1,
29 MAX8998_REG_IRQ2,
30 MAX8998_REG_IRQ3,
31 MAX8998_REG_IRQ4,
32 MAX8998_REG_IRQM1,
33 MAX8998_REG_IRQM2,
34 MAX8998_REG_IRQM3,
35 MAX8998_REG_IRQM4,
36 MAX8998_REG_STATUS1,
37 MAX8998_REG_STATUS2,
38 MAX8998_REG_STATUSM1,
39 MAX8998_REG_STATUSM2,
40 MAX8998_REG_CHGR1,
41 MAX8998_REG_CHGR2,
42 MAX8998_REG_LDO_ACTIVE_DISCHARGE1,
43 MAX8998_REG_LDO_ACTIVE_DISCHARGE2,
44 MAX8998_REG_BUCK_ACTIVE_DISCHARGE3,
45 MAX8998_REG_ONOFF1,
46 MAX8998_REG_ONOFF2,
47 MAX8998_REG_ONOFF3,
48 MAX8998_REG_ONOFF4,
49 MAX8998_REG_BUCK1_DVSARM1,
50 MAX8998_REG_BUCK1_DVSARM2,
51 MAX8998_REG_BUCK1_DVSARM3,
52 MAX8998_REG_BUCK1_DVSARM4,
53 MAX8998_REG_BUCK2_DVSINT1,
54 MAX8998_REG_BUCK2_DVSINT2,
55 MAX8998_REG_BUCK3,
56 MAX8998_REG_BUCK4,
57 MAX8998_REG_LDO2_LDO3,
58 MAX8998_REG_LDO4,
59 MAX8998_REG_LDO5,
60 MAX8998_REG_LDO6,
61 MAX8998_REG_LDO7,
62 MAX8998_REG_LDO8_LDO9,
63 MAX8998_REG_LDO10_LDO11,
64 MAX8998_REG_LDO12,
65 MAX8998_REG_LDO13,
66 MAX8998_REG_LDO14,
67 MAX8998_REG_LDO15,
68 MAX8998_REG_LDO16,
69 MAX8998_REG_LDO17,
70 MAX8998_REG_BKCHR,
71 MAX8998_REG_LBCNFG1,
72 MAX8998_REG_LBCNFG2,
73};
74
75/**
76 * struct max8998_dev - max8998 master device for sub-drivers
77 * @dev: master device of the chip (can be used to access platform data)
78 * @i2c_client: i2c client private data
79 * @dev_read(): chip register read function
80 * @dev_write(): chip register write function
81 * @dev_update(): chip register update function
82 * @iolock: mutex for serializing io access
83 */
84
85struct max8998_dev {
86 struct device *dev;
87 struct i2c_client *i2c_client;
88 int (*dev_read)(struct max8998_dev *max8998, u8 reg, u8 *dest);
89 int (*dev_write)(struct max8998_dev *max8998, u8 reg, u8 val);
90 int (*dev_update)(struct max8998_dev *max8998, u8 reg, u8 val, u8 mask);
91 struct mutex iolock;
92};
93
94static inline int max8998_read_reg(struct max8998_dev *max8998, u8 reg,
95 u8 *value)
96{
97 return max8998->dev_read(max8998, reg, value);
98}
99
100static inline int max8998_write_reg(struct max8998_dev *max8998, u8 reg,
101 u8 value)
102{
103 return max8998->dev_write(max8998, reg, value);
104}
105
106static inline int max8998_update_reg(struct max8998_dev *max8998, u8 reg,
107 u8 value, u8 mask)
108{
109 return max8998->dev_update(max8998, reg, value, mask);
110}
111
112#endif /* __LINUX_MFD_MAX8998_PRIV_H */
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
new file mode 100644
index 000000000000..1d3601a2d853
--- /dev/null
+++ b/include/linux/mfd/max8998.h
@@ -0,0 +1,78 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8998
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_MAX8998_H
24#define __LINUX_MFD_MAX8998_H
25
26#include <linux/regulator/machine.h>
27
28/* MAX 8998 regulator ids */
29enum {
30 MAX8998_LDO2 = 2,
31 MAX8998_LDO3,
32 MAX8998_LDO4,
33 MAX8998_LDO5,
34 MAX8998_LDO6,
35 MAX8998_LDO7,
36 MAX8998_LDO8,
37 MAX8998_LDO9,
38 MAX8998_LDO10,
39 MAX8998_LDO11,
40 MAX8998_LDO12,
41 MAX8998_LDO13,
42 MAX8998_LDO14,
43 MAX8998_LDO15,
44 MAX8998_LDO16,
45 MAX8998_LDO17,
46 MAX8998_BUCK1,
47 MAX8998_BUCK2,
48 MAX8998_BUCK3,
49 MAX8998_BUCK4,
50 MAX8998_EN32KHZ_AP,
51 MAX8998_EN32KHZ_CP,
52 MAX8998_ENVICHG,
53 MAX8998_ESAFEOUT1,
54 MAX8998_ESAFEOUT2,
55};
56
57/**
58 * max8998_regulator_data - regulator data
59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...)
61 */
62struct max8998_regulator_data {
63 int id;
64 struct regulator_init_data *initdata;
65};
66
67/**
68 * struct max8998_board - packages regulator init data
69 * @num_regulators: number of regultors used
70 * @regulators: array of defined regulators
71 */
72
73struct max8998_platform_data {
74 int num_regulators;
75 struct max8998_regulator_data *regulators;
76};
77
78#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13783-private.h b/include/linux/mfd/mc13783-private.h
deleted file mode 100644
index 95cf9360553f..000000000000
--- a/include/linux/mfd/mc13783-private.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef __LINUX_MFD_MC13783_PRIV_H
23#define __LINUX_MFD_MC13783_PRIV_H
24
25#include <linux/platform_device.h>
26#include <linux/mfd/mc13783.h>
27#include <linux/mutex.h>
28#include <linux/interrupt.h>
29
30struct mc13783 {
31 struct spi_device *spidev;
32 struct mutex lock;
33 int irq;
34 int flags;
35
36 irq_handler_t irqhandler[MC13783_NUM_IRQ];
37 void *irqdata[MC13783_NUM_IRQ];
38
39 /* XXX these should go as platformdata to the regulator subdevice */
40 struct mc13783_regulator_init_data *regulators;
41 int num_regulators;
42};
43
44#define MC13783_REG_INTERRUPT_STATUS_0 0
45#define MC13783_REG_INTERRUPT_MASK_0 1
46#define MC13783_REG_INTERRUPT_SENSE_0 2
47#define MC13783_REG_INTERRUPT_STATUS_1 3
48#define MC13783_REG_INTERRUPT_MASK_1 4
49#define MC13783_REG_INTERRUPT_SENSE_1 5
50#define MC13783_REG_POWER_UP_MODE_SENSE 6
51#define MC13783_REG_REVISION 7
52#define MC13783_REG_SEMAPHORE 8
53#define MC13783_REG_ARBITRATION_PERIPHERAL_AUDIO 9
54#define MC13783_REG_ARBITRATION_SWITCHERS 10
55#define MC13783_REG_ARBITRATION_REGULATORS_0 11
56#define MC13783_REG_ARBITRATION_REGULATORS_1 12
57#define MC13783_REG_POWER_CONTROL_0 13
58#define MC13783_REG_POWER_CONTROL_1 14
59#define MC13783_REG_POWER_CONTROL_2 15
60#define MC13783_REG_REGEN_ASSIGNMENT 16
61#define MC13783_REG_CONTROL_SPARE 17
62#define MC13783_REG_MEMORY_A 18
63#define MC13783_REG_MEMORY_B 19
64#define MC13783_REG_RTC_TIME 20
65#define MC13783_REG_RTC_ALARM 21
66#define MC13783_REG_RTC_DAY 22
67#define MC13783_REG_RTC_DAY_ALARM 23
68#define MC13783_REG_SWITCHERS_0 24
69#define MC13783_REG_SWITCHERS_1 25
70#define MC13783_REG_SWITCHERS_2 26
71#define MC13783_REG_SWITCHERS_3 27
72#define MC13783_REG_SWITCHERS_4 28
73#define MC13783_REG_SWITCHERS_5 29
74#define MC13783_REG_REGULATOR_SETTING_0 30
75#define MC13783_REG_REGULATOR_SETTING_1 31
76#define MC13783_REG_REGULATOR_MODE_0 32
77#define MC13783_REG_REGULATOR_MODE_1 33
78#define MC13783_REG_POWER_MISCELLANEOUS 34
79#define MC13783_REG_POWER_SPARE 35
80#define MC13783_REG_AUDIO_RX_0 36
81#define MC13783_REG_AUDIO_RX_1 37
82#define MC13783_REG_AUDIO_TX 38
83#define MC13783_REG_AUDIO_SSI_NETWORK 39
84#define MC13783_REG_AUDIO_CODEC 40
85#define MC13783_REG_AUDIO_STEREO_DAC 41
86#define MC13783_REG_AUDIO_SPARE 42
87#define MC13783_REG_ADC_0 43
88#define MC13783_REG_ADC_1 44
89#define MC13783_REG_ADC_2 45
90#define MC13783_REG_ADC_3 46
91#define MC13783_REG_ADC_4 47
92#define MC13783_REG_CHARGER 48
93#define MC13783_REG_USB 49
94#define MC13783_REG_CHARGE_USB_SPARE 50
95#define MC13783_REG_LED_CONTROL_0 51
96#define MC13783_REG_LED_CONTROL_1 52
97#define MC13783_REG_LED_CONTROL_2 53
98#define MC13783_REG_LED_CONTROL_3 54
99#define MC13783_REG_LED_CONTROL_4 55
100#define MC13783_REG_LED_CONTROL_5 56
101#define MC13783_REG_SPARE 57
102#define MC13783_REG_TRIM_0 58
103#define MC13783_REG_TRIM_1 59
104#define MC13783_REG_TEST_0 60
105#define MC13783_REG_TEST_1 61
106#define MC13783_REG_TEST_2 62
107#define MC13783_REG_TEST_3 63
108#define MC13783_REG_NB 64
109
110/*
111 * Reg Regulator Mode 0
112 */
113#define MC13783_REGCTRL_VAUDIO_EN (1 << 0)
114#define MC13783_REGCTRL_VAUDIO_STBY (1 << 1)
115#define MC13783_REGCTRL_VAUDIO_MODE (1 << 2)
116#define MC13783_REGCTRL_VIOHI_EN (1 << 3)
117#define MC13783_REGCTRL_VIOHI_STBY (1 << 4)
118#define MC13783_REGCTRL_VIOHI_MODE (1 << 5)
119#define MC13783_REGCTRL_VIOLO_EN (1 << 6)
120#define MC13783_REGCTRL_VIOLO_STBY (1 << 7)
121#define MC13783_REGCTRL_VIOLO_MODE (1 << 8)
122#define MC13783_REGCTRL_VDIG_EN (1 << 9)
123#define MC13783_REGCTRL_VDIG_STBY (1 << 10)
124#define MC13783_REGCTRL_VDIG_MODE (1 << 11)
125#define MC13783_REGCTRL_VGEN_EN (1 << 12)
126#define MC13783_REGCTRL_VGEN_STBY (1 << 13)
127#define MC13783_REGCTRL_VGEN_MODE (1 << 14)
128#define MC13783_REGCTRL_VRFDIG_EN (1 << 15)
129#define MC13783_REGCTRL_VRFDIG_STBY (1 << 16)
130#define MC13783_REGCTRL_VRFDIG_MODE (1 << 17)
131#define MC13783_REGCTRL_VRFREF_EN (1 << 18)
132#define MC13783_REGCTRL_VRFREF_STBY (1 << 19)
133#define MC13783_REGCTRL_VRFREF_MODE (1 << 20)
134#define MC13783_REGCTRL_VRFCP_EN (1 << 21)
135#define MC13783_REGCTRL_VRFCP_STBY (1 << 22)
136#define MC13783_REGCTRL_VRFCP_MODE (1 << 23)
137
138/*
139 * Reg Regulator Mode 1
140 */
141#define MC13783_REGCTRL_VSIM_EN (1 << 0)
142#define MC13783_REGCTRL_VSIM_STBY (1 << 1)
143#define MC13783_REGCTRL_VSIM_MODE (1 << 2)
144#define MC13783_REGCTRL_VESIM_EN (1 << 3)
145#define MC13783_REGCTRL_VESIM_STBY (1 << 4)
146#define MC13783_REGCTRL_VESIM_MODE (1 << 5)
147#define MC13783_REGCTRL_VCAM_EN (1 << 6)
148#define MC13783_REGCTRL_VCAM_STBY (1 << 7)
149#define MC13783_REGCTRL_VCAM_MODE (1 << 8)
150#define MC13783_REGCTRL_VRFBG_EN (1 << 9)
151#define MC13783_REGCTRL_VRFBG_STBY (1 << 10)
152#define MC13783_REGCTRL_VVIB_EN (1 << 11)
153#define MC13783_REGCTRL_VRF1_EN (1 << 12)
154#define MC13783_REGCTRL_VRF1_STBY (1 << 13)
155#define MC13783_REGCTRL_VRF1_MODE (1 << 14)
156#define MC13783_REGCTRL_VRF2_EN (1 << 15)
157#define MC13783_REGCTRL_VRF2_STBY (1 << 16)
158#define MC13783_REGCTRL_VRF2_MODE (1 << 17)
159#define MC13783_REGCTRL_VMMC1_EN (1 << 18)
160#define MC13783_REGCTRL_VMMC1_STBY (1 << 19)
161#define MC13783_REGCTRL_VMMC1_MODE (1 << 20)
162#define MC13783_REGCTRL_VMMC2_EN (1 << 21)
163#define MC13783_REGCTRL_VMMC2_STBY (1 << 22)
164#define MC13783_REGCTRL_VMMC2_MODE (1 << 23)
165
166/*
167 * Reg Regulator Misc.
168 */
169#define MC13783_REGCTRL_GPO1_EN (1 << 6)
170#define MC13783_REGCTRL_GPO2_EN (1 << 8)
171#define MC13783_REGCTRL_GPO3_EN (1 << 10)
172#define MC13783_REGCTRL_GPO4_EN (1 << 12)
173#define MC13783_REGCTRL_VIBPINCTRL (1 << 14)
174
175/*
176 * Reg Switcher 4
177 */
178#define MC13783_SWCTRL_SW1A_MODE (1 << 0)
179#define MC13783_SWCTRL_SW1A_STBY_MODE (1 << 2)
180#define MC13783_SWCTRL_SW1A_DVS_SPEED (1 << 6)
181#define MC13783_SWCTRL_SW1A_PANIC_MODE (1 << 8)
182#define MC13783_SWCTRL_SW1A_SOFTSTART (1 << 9)
183#define MC13783_SWCTRL_SW1B_MODE (1 << 10)
184#define MC13783_SWCTRL_SW1B_STBY_MODE (1 << 12)
185#define MC13783_SWCTRL_SW1B_DVS_SPEED (1 << 14)
186#define MC13783_SWCTRL_SW1B_PANIC_MODE (1 << 16)
187#define MC13783_SWCTRL_SW1B_SOFTSTART (1 << 17)
188#define MC13783_SWCTRL_PLL_EN (1 << 18)
189#define MC13783_SWCTRL_PLL_FACTOR (1 << 19)
190
191/*
192 * Reg Switcher 5
193 */
194#define MC13783_SWCTRL_SW2A_MODE (1 << 0)
195#define MC13783_SWCTRL_SW2A_STBY_MODE (1 << 2)
196#define MC13783_SWCTRL_SW2A_DVS_SPEED (1 << 6)
197#define MC13783_SWCTRL_SW2A_PANIC_MODE (1 << 8)
198#define MC13783_SWCTRL_SW2A_SOFTSTART (1 << 9)
199#define MC13783_SWCTRL_SW2B_MODE (1 << 10)
200#define MC13783_SWCTRL_SW2B_STBY_MODE (1 << 12)
201#define MC13783_SWCTRL_SW2B_DVS_SPEED (1 << 14)
202#define MC13783_SWCTRL_SW2B_PANIC_MODE (1 << 16)
203#define MC13783_SWCTRL_SW2B_SOFTSTART (1 << 17)
204#define MC13783_SWSET_SW3 (1 << 18)
205#define MC13783_SWCTRL_SW3_EN (1 << 20)
206#define MC13783_SWCTRL_SW3_STBY (1 << 21)
207#define MC13783_SWCTRL_SW3_MODE (1 << 22)
208
209static inline int mc13783_set_bits(struct mc13783 *mc13783, unsigned int offset,
210 u32 mask, u32 val)
211{
212 int ret;
213 mc13783_lock(mc13783);
214 ret = mc13783_reg_rmw(mc13783, offset, mask, val);
215 mc13783_unlock(mc13783);
216
217 return ret;
218}
219
220#endif /* __LINUX_MFD_MC13783_PRIV_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 4a894f688549..0fa44fb8dd26 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -21,6 +21,8 @@ int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val);
21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, 21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset,
22 u32 mask, u32 val); 22 u32 mask, u32 val);
23 23
24int mc13783_get_flags(struct mc13783 *mc13783);
25
24int mc13783_irq_request(struct mc13783 *mc13783, int irq, 26int mc13783_irq_request(struct mc13783 *mc13783, int irq,
25 irq_handler_t handler, const char *name, void *dev); 27 irq_handler_t handler, const char *name, void *dev);
26int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 28int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
new file mode 100644
index 000000000000..39ca7588659b
--- /dev/null
+++ b/include/linux/mfd/stmpe.h
@@ -0,0 +1,201 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 */
7
8#ifndef __LINUX_MFD_STMPE_H
9#define __LINUX_MFD_STMPE_H
10
11#include <linux/device.h>
12
13enum stmpe_block {
14 STMPE_BLOCK_GPIO = 1 << 0,
15 STMPE_BLOCK_KEYPAD = 1 << 1,
16 STMPE_BLOCK_TOUCHSCREEN = 1 << 2,
17 STMPE_BLOCK_ADC = 1 << 3,
18 STMPE_BLOCK_PWM = 1 << 4,
19 STMPE_BLOCK_ROTATOR = 1 << 5,
20};
21
22enum stmpe_partnum {
23 STMPE811,
24 STMPE1601,
25 STMPE2401,
26 STMPE2403,
27};
28
29/*
30 * For registers whose locations differ on variants, the correct address is
31 * obtained by indexing stmpe->regs with one of the following.
32 */
33enum {
34 STMPE_IDX_CHIP_ID,
35 STMPE_IDX_ICR_LSB,
36 STMPE_IDX_IER_LSB,
37 STMPE_IDX_ISR_MSB,
38 STMPE_IDX_GPMR_LSB,
39 STMPE_IDX_GPSR_LSB,
40 STMPE_IDX_GPCR_LSB,
41 STMPE_IDX_GPDR_LSB,
42 STMPE_IDX_GPEDR_MSB,
43 STMPE_IDX_GPRER_LSB,
44 STMPE_IDX_GPFER_LSB,
45 STMPE_IDX_GPAFR_U_MSB,
46 STMPE_IDX_IEGPIOR_LSB,
47 STMPE_IDX_ISGPIOR_MSB,
48 STMPE_IDX_MAX,
49};
50
51
52struct stmpe_variant_info;
53
54/**
55 * struct stmpe - STMPE MFD structure
56 * @lock: lock protecting I/O operations
57 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client
60 * @variant: the detected STMPE model number
61 * @regs: list of addresses of registers which are at different addresses on
62 * different variants. Indexed by one of STMPE_IDX_*.
63 * @irq_base: starting IRQ number for internal IRQs
64 * @num_gpios: number of gpios, differs for variants
65 * @ier: cache of IER registers for bus_lock
66 * @oldier: cache of IER registers for bus_lock
67 * @pdata: platform data
68 */
69struct stmpe {
70 struct mutex lock;
71 struct mutex irq_lock;
72 struct device *dev;
73 struct i2c_client *i2c;
74 enum stmpe_partnum partnum;
75 struct stmpe_variant_info *variant;
76 const u8 *regs;
77
78 int irq_base;
79 int num_gpios;
80 u8 ier[2];
81 u8 oldier[2];
82 struct stmpe_platform_data *pdata;
83};
84
85extern int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 data);
86extern int stmpe_reg_read(struct stmpe *stmpe, u8 reg);
87extern int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
88 u8 *values);
89extern int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
90 const u8 *values);
91extern int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val);
92extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins,
93 enum stmpe_block block);
94extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks);
95extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
96
97struct matrix_keymap_data;
98
99/**
100 * struct stmpe_keypad_platform_data - STMPE keypad platform data
101 * @keymap_data: key map table and size
102 * @debounce_ms: debounce interval, in ms. Maximum is
103 * %STMPE_KEYPAD_MAX_DEBOUNCE.
104 * @scan_count: number of key scanning cycles to confirm key data.
105 * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT.
106 * @no_autorepeat: disable key autorepeat
107 */
108struct stmpe_keypad_platform_data {
109 struct matrix_keymap_data *keymap_data;
110 unsigned int debounce_ms;
111 unsigned int scan_count;
112 bool no_autorepeat;
113};
114
115/**
116 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
117 * @gpio_base: first gpio number assigned. A maximum of
118 * %STMPE_NR_GPIOS GPIOs will be allocated.
119 */
120struct stmpe_gpio_platform_data {
121 int gpio_base;
122 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
123 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
124};
125
126/**
127 * struct stmpe_ts_platform_data - stmpe811 touch screen controller platform
128 * data
129 * @sample_time: ADC converstion time in number of clock.
130 * (0 -> 36 clocks, 1 -> 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks,
131 * 4 -> 80 clocks, 5 -> 96 clocks, 6 -> 144 clocks),
132 * recommended is 4.
133 * @mod_12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC)
134 * @ref_sel: ADC reference source
135 * (0 -> internal reference, 1 -> external reference)
136 * @adc_freq: ADC Clock speed
137 * (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz)
138 * @ave_ctrl: Sample average control
139 * (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 samples, 3 -> 8 samples)
140 * @touch_det_delay: Touch detect interrupt delay
141 * (0 -> 10 us, 1 -> 50 us, 2 -> 100 us, 3 -> 500 us,
142 * 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms)
143 * recommended is 3
144 * @settling: Panel driver settling time
145 * (0 -> 10 us, 1 -> 100 us, 2 -> 500 us, 3 -> 1 ms,
146 * 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms)
147 * recommended is 2
148 * @fraction_z: Length of the fractional part in z
149 * (fraction_z ([0..7]) = Count of the fractional part)
150 * recommended is 7
151 * @i_drive: current limit value of the touchscreen drivers
152 * (0 -> 20 mA typical 35 mA max, 1 -> 50 mA typical 80 mA max)
153 *
154 * */
155struct stmpe_ts_platform_data {
156 u8 sample_time;
157 u8 mod_12b;
158 u8 ref_sel;
159 u8 adc_freq;
160 u8 ave_ctrl;
161 u8 touch_det_delay;
162 u8 settling;
163 u8 fraction_z;
164 u8 i_drive;
165};
166
167/**
168 * struct stmpe_platform_data - STMPE platform data
169 * @id: device id to distinguish between multiple STMPEs on the same board
170 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
171 * @irq_trigger: IRQ trigger to use for the interrupt to the host
172 * @irq_invert_polarity: IRQ line is connected with reversed polarity
173 * @autosleep: bool to enable/disable stmpe autosleep
174 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
175 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
176 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
177 * @gpio: GPIO-specific platform data
178 * @keypad: keypad-specific platform data
179 * @ts: touchscreen-specific platform data
180 */
181struct stmpe_platform_data {
182 int id;
183 unsigned int blocks;
184 int irq_base;
185 unsigned int irq_trigger;
186 bool irq_invert_polarity;
187 bool autosleep;
188 int autosleep_timeout;
189
190 struct stmpe_gpio_platform_data *gpio;
191 struct stmpe_keypad_platform_data *keypad;
192 struct stmpe_ts_platform_data *ts;
193};
194
195#define STMPE_NR_INTERNAL_IRQS 9
196#define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x))
197
198#define STMPE_NR_GPIOS 24
199#define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS)
200
201#endif
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
new file mode 100644
index 000000000000..772b3ae640af
--- /dev/null
+++ b/include/linux/mfd/tps6586x.h
@@ -0,0 +1,47 @@
1#ifndef __LINUX_MFD_TPS6586X_H
2#define __LINUX_MFD_TPS6586X_H
3
4enum {
5 TPS6586X_ID_SM_0,
6 TPS6586X_ID_SM_1,
7 TPS6586X_ID_SM_2,
8 TPS6586X_ID_LDO_0,
9 TPS6586X_ID_LDO_1,
10 TPS6586X_ID_LDO_2,
11 TPS6586X_ID_LDO_3,
12 TPS6586X_ID_LDO_4,
13 TPS6586X_ID_LDO_5,
14 TPS6586X_ID_LDO_6,
15 TPS6586X_ID_LDO_7,
16 TPS6586X_ID_LDO_8,
17 TPS6586X_ID_LDO_9,
18 TPS6586X_ID_LDO_RTC,
19};
20
21struct tps6586x_subdev_info {
22 int id;
23 const char *name;
24 void *platform_data;
25};
26
27struct tps6586x_platform_data {
28 int num_subdevs;
29 struct tps6586x_subdev_info *subdevs;
30
31 int gpio_base;
32};
33
34/*
35 * NOTE: the functions below are not intended for use outside
36 * of the TPS6586X sub-device drivers
37 */
38extern int tps6586x_write(struct device *dev, int reg, uint8_t val);
39extern int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val);
40extern int tps6586x_read(struct device *dev, int reg, uint8_t *val);
41extern int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val);
42extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
43extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
44extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
45 uint8_t mask);
46
47#endif /*__LINUX_MFD_TPS6586X_H */
diff --git a/include/linux/mfd/wm8994/gpio.h b/include/linux/mfd/wm8994/gpio.h
index b4d4c22991e8..0c79b5ff4b5a 100644
--- a/include/linux/mfd/wm8994/gpio.h
+++ b/include/linux/mfd/wm8994/gpio.h
@@ -36,6 +36,10 @@
36#define WM8994_GP_FN_WSEQ_STATUS 16 36#define WM8994_GP_FN_WSEQ_STATUS 16
37#define WM8994_GP_FN_FIFO_ERROR 17 37#define WM8994_GP_FN_FIFO_ERROR 17
38#define WM8994_GP_FN_OPCLK 18 38#define WM8994_GP_FN_OPCLK 18
39#define WM8994_GP_FN_THW 19
40#define WM8994_GP_FN_DCS_DONE 20
41#define WM8994_GP_FN_FLL1_OUT 21
42#define WM8994_GP_FN_FLL2_OUT 22
39 43
40#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */ 44#define WM8994_GPN_DIR 0x8000 /* GPN_DIR */
41#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 45#define WM8994_GPN_DIR_MASK 0x8000 /* GPN_DIR */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index f6c9b7dcb9fd..bafffc737903 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -38,6 +38,7 @@
38#define KVM_MINOR 232 38#define KVM_MINOR 232
39#define BTRFS_MINOR 234 39#define BTRFS_MINOR 234
40#define AUTOFS_MINOR 235 40#define AUTOFS_MINOR 235
41#define MAPPER_CTRL_MINOR 236
41#define MISC_DYNAMIC_MINOR 255 42#define MISC_DYNAMIC_MINOR 255
42 43
43struct device; 44struct device;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7a9ab7db1975..709f6728fc90 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -815,6 +815,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
815} 815}
816 816
817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
818extern void truncate_setsize(struct inode *inode, loff_t newsize);
818extern int vmtruncate(struct inode *inode, loff_t offset); 819extern int vmtruncate(struct inode *inode, loff_t offset);
819extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); 820extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
820 821
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index b8bb9a6a1f37..ee7e258627f9 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -134,7 +134,7 @@ struct vm_area_struct {
134 within vm_mm. */ 134 within vm_mm. */
135 135
136 /* linked list of VM areas per task, sorted by address */ 136 /* linked list of VM areas per task, sorted by address */
137 struct vm_area_struct *vm_next; 137 struct vm_area_struct *vm_next, *vm_prev;
138 138
139 pgprot_t vm_page_prot; /* Access permissions of this VMA. */ 139 pgprot_t vm_page_prot; /* Access permissions of this VMA. */
140 unsigned long vm_flags; /* Flags, see mm.h. */ 140 unsigned long vm_flags; /* Flags, see mm.h. */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d02d2c6e0cfe..6b7525099e56 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -24,12 +24,14 @@ struct mmc_cid {
24}; 24};
25 25
26struct mmc_csd { 26struct mmc_csd {
27 unsigned char structure;
27 unsigned char mmca_vsn; 28 unsigned char mmca_vsn;
28 unsigned short cmdclass; 29 unsigned short cmdclass;
29 unsigned short tacc_clks; 30 unsigned short tacc_clks;
30 unsigned int tacc_ns; 31 unsigned int tacc_ns;
31 unsigned int r2w_factor; 32 unsigned int r2w_factor;
32 unsigned int max_dtr; 33 unsigned int max_dtr;
34 unsigned int erase_size; /* In sectors */
33 unsigned int read_blkbits; 35 unsigned int read_blkbits;
34 unsigned int write_blkbits; 36 unsigned int write_blkbits;
35 unsigned int capacity; 37 unsigned int capacity;
@@ -41,9 +43,16 @@ struct mmc_csd {
41 43
42struct mmc_ext_csd { 44struct mmc_ext_csd {
43 u8 rev; 45 u8 rev;
46 u8 erase_group_def;
47 u8 sec_feature_support;
44 unsigned int sa_timeout; /* Units: 100ns */ 48 unsigned int sa_timeout; /* Units: 100ns */
45 unsigned int hs_max_dtr; 49 unsigned int hs_max_dtr;
46 unsigned int sectors; 50 unsigned int sectors;
51 unsigned int hc_erase_size; /* In sectors */
52 unsigned int hc_erase_timeout; /* In milliseconds */
53 unsigned int sec_trim_mult; /* Secure trim multiplier */
54 unsigned int sec_erase_mult; /* Secure erase multiplier */
55 unsigned int trim_timeout; /* In milliseconds */
47}; 56};
48 57
49struct sd_scr { 58struct sd_scr {
@@ -53,6 +62,12 @@ struct sd_scr {
53#define SD_SCR_BUS_WIDTH_4 (1<<2) 62#define SD_SCR_BUS_WIDTH_4 (1<<2)
54}; 63};
55 64
65struct sd_ssr {
66 unsigned int au; /* In sectors */
67 unsigned int erase_timeout; /* In milliseconds */
68 unsigned int erase_offset; /* In milliseconds */
69};
70
56struct sd_switch_caps { 71struct sd_switch_caps {
57 unsigned int hs_max_dtr; 72 unsigned int hs_max_dtr;
58}; 73};
@@ -92,6 +107,7 @@ struct mmc_card {
92#define MMC_TYPE_MMC 0 /* MMC card */ 107#define MMC_TYPE_MMC 0 /* MMC card */
93#define MMC_TYPE_SD 1 /* SD card */ 108#define MMC_TYPE_SD 1 /* SD card */
94#define MMC_TYPE_SDIO 2 /* SDIO card */ 109#define MMC_TYPE_SDIO 2 /* SDIO card */
110#define MMC_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */
95 unsigned int state; /* (our) card state */ 111 unsigned int state; /* (our) card state */
96#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 112#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
97#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 113#define MMC_STATE_READONLY (1<<1) /* card is read-only */
@@ -101,6 +117,13 @@ struct mmc_card {
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 117#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
102#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 118#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
103 /* for byte mode */ 119 /* for byte mode */
120#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
121 /* (missing CIA registers) */
122
123 unsigned int erase_size; /* erase size in sectors */
124 unsigned int erase_shift; /* if erase unit is power 2 */
125 unsigned int pref_erase; /* in sectors */
126 u8 erased_byte; /* value of erased bytes */
104 127
105 u32 raw_cid[4]; /* raw card CID */ 128 u32 raw_cid[4]; /* raw card CID */
106 u32 raw_csd[4]; /* raw card CSD */ 129 u32 raw_csd[4]; /* raw card CSD */
@@ -109,6 +132,7 @@ struct mmc_card {
109 struct mmc_csd csd; /* card specific */ 132 struct mmc_csd csd; /* card specific */
110 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ 133 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
111 struct sd_scr scr; /* extra SD information */ 134 struct sd_scr scr; /* extra SD information */
135 struct sd_ssr ssr; /* yet more SD information */
112 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ 136 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
113 137
114 unsigned int sdio_funcs; /* number of SDIO functions */ 138 unsigned int sdio_funcs; /* number of SDIO functions */
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index e4898e9eeb59..7429033acb66 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -92,6 +92,8 @@ struct mmc_command {
92 * actively failing requests 92 * actively failing requests
93 */ 93 */
94 94
95 unsigned int erase_timeout; /* in milliseconds */
96
95 struct mmc_data *data; /* data segment associated with cmd */ 97 struct mmc_data *data; /* data segment associated with cmd */
96 struct mmc_request *mrq; /* associated request */ 98 struct mmc_request *mrq; /* associated request */
97}; 99};
@@ -134,6 +136,23 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
134extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 136extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
135 struct mmc_command *, int); 137 struct mmc_command *, int);
136 138
139#define MMC_ERASE_ARG 0x00000000
140#define MMC_SECURE_ERASE_ARG 0x80000000
141#define MMC_TRIM_ARG 0x00000001
142#define MMC_SECURE_TRIM1_ARG 0x80000001
143#define MMC_SECURE_TRIM2_ARG 0x80008000
144
145#define MMC_SECURE_ARGS 0x80000000
146#define MMC_TRIM_ARGS 0x00008001
147
148extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
149 unsigned int arg);
150extern int mmc_can_erase(struct mmc_card *card);
151extern int mmc_can_trim(struct mmc_card *card);
152extern int mmc_can_secure_erase_trim(struct mmc_card *card);
153extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
154 unsigned int nr);
155
137extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); 156extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
138extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); 157extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
139 158
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f65913c9f5a4..1575b52c3bfa 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -124,6 +124,7 @@ struct mmc_host {
124 unsigned int f_min; 124 unsigned int f_min;
125 unsigned int f_max; 125 unsigned int f_max;
126 u32 ocr_avail; 126 u32 ocr_avail;
127 struct notifier_block pm_notify;
127 128
128#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
129#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ 130#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
@@ -155,6 +156,7 @@ struct mmc_host {
155#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ 156#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
156#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 157#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
157#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 158#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
159#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
158 160
159 mmc_pm_flag_t pm_caps; /* supported pm features */ 161 mmc_pm_flag_t pm_caps; /* supported pm features */
160 162
@@ -183,6 +185,7 @@ struct mmc_host {
183 185
184 /* Only used with MMC_CAP_DISABLE */ 186 /* Only used with MMC_CAP_DISABLE */
185 int enabled; /* host is enabled */ 187 int enabled; /* host is enabled */
188 int rescan_disable; /* disable card detection */
186 int nesting_cnt; /* "enable" nesting count */ 189 int nesting_cnt; /* "enable" nesting count */
187 int en_dis_recurs; /* detect recursion */ 190 int en_dis_recurs; /* detect recursion */
188 unsigned int disable_delay; /* disable delay in msecs */ 191 unsigned int disable_delay; /* disable delay in msecs */
@@ -257,6 +260,7 @@ int mmc_card_can_sleep(struct mmc_host *host);
257int mmc_host_enable(struct mmc_host *host); 260int mmc_host_enable(struct mmc_host *host);
258int mmc_host_disable(struct mmc_host *host); 261int mmc_host_disable(struct mmc_host *host);
259int mmc_host_lazy_disable(struct mmc_host *host); 262int mmc_host_lazy_disable(struct mmc_host *host);
263int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
260 264
261static inline void mmc_set_disable_delay(struct mmc_host *host, 265static inline void mmc_set_disable_delay(struct mmc_host *host,
262 unsigned int disable_delay) 266 unsigned int disable_delay)
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 8a49cbf0376d..dd11ae51fb68 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -251,12 +251,21 @@ struct _mmc_csd {
251 * EXT_CSD fields 251 * EXT_CSD fields
252 */ 252 */
253 253
254#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 254#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
255#define EXT_CSD_HS_TIMING 185 /* R/W */ 255#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
256#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_BUS_WIDTH 183 /* R/W */
257#define EXT_CSD_REV 192 /* RO */ 257#define EXT_CSD_HS_TIMING 185 /* R/W */
258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 258#define EXT_CSD_REV 192 /* RO */
259#define EXT_CSD_S_A_TIMEOUT 217 259#define EXT_CSD_STRUCTURE 194 /* RO */
260#define EXT_CSD_CARD_TYPE 196 /* RO */
261#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
262#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
263#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
264#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
265#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
266#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
267#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
268#define EXT_CSD_TRIM_MULT 232 /* RO */
260 269
261/* 270/*
262 * EXT_CSD field definitions 271 * EXT_CSD field definitions
@@ -274,6 +283,10 @@ struct _mmc_csd {
274#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 283#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
275#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ 284#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
276 285
286#define EXT_CSD_SEC_ER_EN BIT(0)
287#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
288#define EXT_CSD_SEC_GB_CL_EN BIT(4)
289
277/* 290/*
278 * MMC_SWITCH access modes 291 * MMC_SWITCH access modes
279 */ 292 */
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
index f310062cffb4..3fd85e088cc3 100644
--- a/include/linux/mmc/sd.h
+++ b/include/linux/mmc/sd.h
@@ -21,8 +21,13 @@
21 /* class 10 */ 21 /* class 10 */
22#define SD_SWITCH 6 /* adtc [31:0] See below R1 */ 22#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
23 23
24 /* class 5 */
25#define SD_ERASE_WR_BLK_START 32 /* ac [31:0] data addr R1 */
26#define SD_ERASE_WR_BLK_END 33 /* ac [31:0] data addr R1 */
27
24 /* Application commands */ 28 /* Application commands */
25#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 29#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
30#define SD_APP_SD_STATUS 13 /* adtc R1 */
26#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */ 31#define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */
27#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */ 32#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
28#define SD_APP_SEND_SCR 51 /* adtc R1 */ 33#define SD_APP_SEND_SCR 51 /* adtc R1 */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index ee24ef8ab616..c04ecfe03f7f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,7 +4,7 @@
4#ifdef CONFIG_DEBUG_VM 4#ifdef CONFIG_DEBUG_VM
5#define VM_BUG_ON(cond) BUG_ON(cond) 5#define VM_BUG_ON(cond) BUG_ON(cond)
6#else 6#else
7#define VM_BUG_ON(cond) do { } while (0) 7#define VM_BUG_ON(cond) do { (void)(cond); } while (0)
8#endif 8#endif
9 9
10#ifdef CONFIG_DEBUG_VIRTUAL 10#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index b4d109e389b8..6e6e62648a4d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -348,21 +348,6 @@ struct zone {
348 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; 348 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
349 349
350 /* 350 /*
351 * prev_priority holds the scanning priority for this zone. It is
352 * defined as the scanning priority at which we achieved our reclaim
353 * target at the previous try_to_free_pages() or balance_pgdat()
354 * invocation.
355 *
356 * We use prev_priority as a measure of how much stress page reclaim is
357 * under - it drives the swappiness decision: whether to unmap mapped
358 * pages.
359 *
360 * Access to both this field is quite racy even on uniprocessor. But
361 * it is expected to average out OK.
362 */
363 int prev_priority;
364
365 /*
366 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on 351 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
367 * this zone's LRU. Maintained by the pageout code. 352 * this zone's LRU. Maintained by the pageout code.
368 */ 353 */
@@ -651,8 +636,6 @@ typedef struct pglist_data {
651#include <linux/memory_hotplug.h> 636#include <linux/memory_hotplug.h>
652 637
653extern struct mutex zonelists_mutex; 638extern struct mutex zonelists_mutex;
654void get_zone_counts(unsigned long *active, unsigned long *inactive,
655 unsigned long *free);
656void build_all_zonelists(void *data); 639void build_all_zonelists(void *data);
657void wakeup_kswapd(struct zone *zone, int order); 640void wakeup_kswapd(struct zone *zone, int order);
658int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 641int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 82a9124f7d75..9d2f1837b3d8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -31,20 +31,23 @@ static const char __module_cat(name,__LINE__)[] \
31 31
32struct kernel_param; 32struct kernel_param;
33 33
34/* Returns 0, or -errno. arg is in kp->arg. */ 34struct kernel_param_ops {
35typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); 35 /* Returns 0, or -errno. arg is in kp->arg. */
36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 36 int (*set)(const char *val, const struct kernel_param *kp);
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
38 int (*get)(char *buffer, const struct kernel_param *kp);
39 /* Optional function to free kp->arg when module unloaded. */
40 void (*free)(void *arg);
41};
38 42
39/* Flag bits for kernel_param.flags */ 43/* Flag bits for kernel_param.flags */
40#define KPARAM_ISBOOL 2 44#define KPARAM_ISBOOL 2
41 45
42struct kernel_param { 46struct kernel_param {
43 const char *name; 47 const char *name;
48 const struct kernel_param_ops *ops;
44 u16 perm; 49 u16 perm;
45 u16 flags; 50 u16 flags;
46 param_set_fn set;
47 param_get_fn get;
48 union { 51 union {
49 void *arg; 52 void *arg;
50 const struct kparam_string *str; 53 const struct kparam_string *str;
@@ -63,12 +66,67 @@ struct kparam_array
63{ 66{
64 unsigned int max; 67 unsigned int max;
65 unsigned int *num; 68 unsigned int *num;
66 param_set_fn set; 69 const struct kernel_param_ops *ops;
67 param_get_fn get;
68 unsigned int elemsize; 70 unsigned int elemsize;
69 void *elem; 71 void *elem;
70}; 72};
71 73
74/**
75 * module_param - typesafe helper for a module/cmdline parameter
76 * @value: the variable to alter, and exposed parameter name.
77 * @type: the type of the parameter
78 * @perm: visibility in sysfs.
79 *
80 * @value becomes the module parameter, or (prefixed by KBUILD_MODNAME and a
81 * ".") the kernel commandline parameter. Note that - is changed to _, so
82 * the user can use "foo-bar=1" even for variable "foo_bar".
83 *
84 * @perm is 0 if the the variable is not to appear in sysfs, or 0444
85 * for world-readable, 0644 for root-writable, etc. Note that if it
86 * is writable, you may need to use kparam_block_sysfs_write() around
87 * accesses (esp. charp, which can be kfreed when it changes).
88 *
89 * The @type is simply pasted to refer to a param_ops_##type and a
90 * param_check_##type: for convenience many standard types are provided but
91 * you can create your own by defining those variables.
92 *
93 * Standard types are:
94 * byte, short, ushort, int, uint, long, ulong
95 * charp: a character pointer
96 * bool: a bool, values 0/1, y/n, Y/N.
97 * invbool: the above, only sense-reversed (N = true).
98 */
99#define module_param(name, type, perm) \
100 module_param_named(name, name, type, perm)
101
102/**
103 * module_param_named - typesafe helper for a renamed module/cmdline parameter
104 * @name: a valid C identifier which is the parameter name.
105 * @value: the actual lvalue to alter.
106 * @type: the type of the parameter
107 * @perm: visibility in sysfs.
108 *
109 * Usually it's a good idea to have variable names and user-exposed names the
110 * same, but that's harder if the variable must be non-static or is inside a
111 * structure. This allows exposure under a different name.
112 */
113#define module_param_named(name, value, type, perm) \
114 param_check_##type(name, &(value)); \
115 module_param_cb(name, &param_ops_##type, &value, perm); \
116 __MODULE_PARM_TYPE(name, #type)
117
118/**
119 * module_param_cb - general callback for a module/cmdline parameter
120 * @name: a valid C identifier which is the parameter name.
121 * @ops: the set & get operations for this parameter.
122 * @perm: visibility in sysfs.
123 *
124 * The ops can have NULL set or get functions.
125 */
126#define module_param_cb(name, ops, arg, perm) \
127 __module_param_call(MODULE_PARAM_PREFIX, \
128 name, ops, arg, __same_type((arg), bool *), perm)
129
72/* On alpha, ia64 and ppc64 relocations to global data cannot go into 130/* On alpha, ia64 and ppc64 relocations to global data cannot go into
73 read-only sections (which is part of respective UNIX ABI on these 131 read-only sections (which is part of respective UNIX ABI on these
74 platforms). So 'const' makes no sense and even causes compile failures 132 platforms). So 'const' makes no sense and even causes compile failures
@@ -80,10 +138,8 @@ struct kparam_array
80#endif 138#endif
81 139
82/* This is the fundamental function for registering boot/module 140/* This is the fundamental function for registering boot/module
83 parameters. perm sets the visibility in sysfs: 000 means it's 141 parameters. */
84 not there, read bits mean it's readable, write bits mean it's 142#define __module_param_call(prefix, name, ops, arg, isbool, perm) \
85 writable. */
86#define __module_param_call(prefix, name, set, get, arg, isbool, perm) \
87 /* Default value instead of permissions? */ \ 143 /* Default value instead of permissions? */ \
88 static int __param_perm_check_##name __attribute__((unused)) = \ 144 static int __param_perm_check_##name __attribute__((unused)) = \
89 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 145 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -92,31 +148,87 @@ struct kparam_array
92 static struct kernel_param __moduleparam_const __param_##name \ 148 static struct kernel_param __moduleparam_const __param_##name \
93 __used \ 149 __used \
94 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 150 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
95 = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \ 151 = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \
96 set, get, { arg } } 152 { arg } }
153
154/* Obsolete - use module_param_cb() */
155#define module_param_call(name, set, get, arg, perm) \
156 static struct kernel_param_ops __param_ops_##name = \
157 { (void *)set, (void *)get }; \
158 __module_param_call(MODULE_PARAM_PREFIX, \
159 name, &__param_ops_##name, arg, \
160 __same_type(arg, bool *), \
161 (perm) + sizeof(__check_old_set_param(set))*0)
162
163/* We don't get oldget: it's often a new-style param_get_uint, etc. */
164static inline int
165__check_old_set_param(int (*oldset)(const char *, struct kernel_param *))
166{
167 return 0;
168}
97 169
98#define module_param_call(name, set, get, arg, perm) \ 170/**
99 __module_param_call(MODULE_PARAM_PREFIX, \ 171 * kparam_block_sysfs_write - make sure a parameter isn't written via sysfs.
100 name, set, get, arg, \ 172 * @name: the name of the parameter
101 __same_type(*(arg), bool), perm) 173 *
174 * There's no point blocking write on a paramter that isn't writable via sysfs!
175 */
176#define kparam_block_sysfs_write(name) \
177 do { \
178 BUG_ON(!(__param_##name.perm & 0222)); \
179 __kernel_param_lock(); \
180 } while (0)
102 181
103/* Helper functions: type is byte, short, ushort, int, uint, long, 182/**
104 ulong, charp, bool or invbool, or XXX if you define param_get_XXX, 183 * kparam_unblock_sysfs_write - allows sysfs to write to a parameter again.
105 param_set_XXX and param_check_XXX. */ 184 * @name: the name of the parameter
106#define module_param_named(name, value, type, perm) \ 185 */
107 param_check_##type(name, &(value)); \ 186#define kparam_unblock_sysfs_write(name) \
108 module_param_call(name, param_set_##type, param_get_##type, &value, perm); \ 187 do { \
109 __MODULE_PARM_TYPE(name, #type) 188 BUG_ON(!(__param_##name.perm & 0222)); \
189 __kernel_param_unlock(); \
190 } while (0)
110 191
111#define module_param(name, type, perm) \ 192/**
112 module_param_named(name, name, type, perm) 193 * kparam_block_sysfs_read - make sure a parameter isn't read via sysfs.
194 * @name: the name of the parameter
195 *
196 * This also blocks sysfs writes.
197 */
198#define kparam_block_sysfs_read(name) \
199 do { \
200 BUG_ON(!(__param_##name.perm & 0444)); \
201 __kernel_param_lock(); \
202 } while (0)
203
204/**
205 * kparam_unblock_sysfs_read - allows sysfs to read a parameter again.
206 * @name: the name of the parameter
207 */
208#define kparam_unblock_sysfs_read(name) \
209 do { \
210 BUG_ON(!(__param_##name.perm & 0444)); \
211 __kernel_param_unlock(); \
212 } while (0)
213
214#ifdef CONFIG_SYSFS
215extern void __kernel_param_lock(void);
216extern void __kernel_param_unlock(void);
217#else
218static inline void __kernel_param_lock(void)
219{
220}
221static inline void __kernel_param_unlock(void)
222{
223}
224#endif
113 225
114#ifndef MODULE 226#ifndef MODULE
115/** 227/**
116 * core_param - define a historical core kernel parameter. 228 * core_param - define a historical core kernel parameter.
117 * @name: the name of the cmdline and sysfs parameter (often the same as var) 229 * @name: the name of the cmdline and sysfs parameter (often the same as var)
118 * @var: the variable 230 * @var: the variable
119 * @type: the type (for param_set_##type and param_get_##type) 231 * @type: the type of the parameter
120 * @perm: visibility in sysfs 232 * @perm: visibility in sysfs
121 * 233 *
122 * core_param is just like module_param(), but cannot be modular and 234 * core_param is just like module_param(), but cannot be modular and
@@ -126,23 +238,32 @@ struct kparam_array
126 */ 238 */
127#define core_param(name, var, type, perm) \ 239#define core_param(name, var, type, perm) \
128 param_check_##type(name, &(var)); \ 240 param_check_##type(name, &(var)); \
129 __module_param_call("", name, param_set_##type, param_get_##type, \ 241 __module_param_call("", name, &param_ops_##type, \
130 &var, __same_type(var, bool), perm) 242 &var, __same_type(var, bool), perm)
131#endif /* !MODULE */ 243#endif /* !MODULE */
132 244
133/* Actually copy string: maxlen param is usually sizeof(string). */ 245/**
246 * module_param_string - a char array parameter
247 * @name: the name of the parameter
248 * @string: the string variable
249 * @len: the maximum length of the string, incl. terminator
250 * @perm: visibility in sysfs.
251 *
252 * This actually copies the string when it's set (unlike type charp).
253 * @len is usually just sizeof(string).
254 */
134#define module_param_string(name, string, len, perm) \ 255#define module_param_string(name, string, len, perm) \
135 static const struct kparam_string __param_string_##name \ 256 static const struct kparam_string __param_string_##name \
136 = { len, string }; \ 257 = { len, string }; \
137 __module_param_call(MODULE_PARAM_PREFIX, name, \ 258 __module_param_call(MODULE_PARAM_PREFIX, name, \
138 param_set_copystring, param_get_string, \ 259 &param_ops_string, \
139 .str = &__param_string_##name, 0, perm); \ 260 .str = &__param_string_##name, 0, perm); \
140 __MODULE_PARM_TYPE(name, "string") 261 __MODULE_PARM_TYPE(name, "string")
141 262
142/* Called on module insert or kernel boot */ 263/* Called on module insert or kernel boot */
143extern int parse_args(const char *name, 264extern int parse_args(const char *name,
144 char *args, 265 char *args,
145 struct kernel_param *params, 266 const struct kernel_param *params,
146 unsigned num, 267 unsigned num,
147 int (*unknown)(char *param, char *val)); 268 int (*unknown)(char *param, char *val));
148 269
@@ -162,72 +283,105 @@ static inline void destroy_params(const struct kernel_param *params,
162#define __param_check(name, p, type) \ 283#define __param_check(name, p, type) \
163 static inline type *__check_##name(void) { return(p); } 284 static inline type *__check_##name(void) { return(p); }
164 285
165extern int param_set_byte(const char *val, struct kernel_param *kp); 286extern struct kernel_param_ops param_ops_byte;
166extern int param_get_byte(char *buffer, struct kernel_param *kp); 287extern int param_set_byte(const char *val, const struct kernel_param *kp);
288extern int param_get_byte(char *buffer, const struct kernel_param *kp);
167#define param_check_byte(name, p) __param_check(name, p, unsigned char) 289#define param_check_byte(name, p) __param_check(name, p, unsigned char)
168 290
169extern int param_set_short(const char *val, struct kernel_param *kp); 291extern struct kernel_param_ops param_ops_short;
170extern int param_get_short(char *buffer, struct kernel_param *kp); 292extern int param_set_short(const char *val, const struct kernel_param *kp);
293extern int param_get_short(char *buffer, const struct kernel_param *kp);
171#define param_check_short(name, p) __param_check(name, p, short) 294#define param_check_short(name, p) __param_check(name, p, short)
172 295
173extern int param_set_ushort(const char *val, struct kernel_param *kp); 296extern struct kernel_param_ops param_ops_ushort;
174extern int param_get_ushort(char *buffer, struct kernel_param *kp); 297extern int param_set_ushort(const char *val, const struct kernel_param *kp);
298extern int param_get_ushort(char *buffer, const struct kernel_param *kp);
175#define param_check_ushort(name, p) __param_check(name, p, unsigned short) 299#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
176 300
177extern int param_set_int(const char *val, struct kernel_param *kp); 301extern struct kernel_param_ops param_ops_int;
178extern int param_get_int(char *buffer, struct kernel_param *kp); 302extern int param_set_int(const char *val, const struct kernel_param *kp);
303extern int param_get_int(char *buffer, const struct kernel_param *kp);
179#define param_check_int(name, p) __param_check(name, p, int) 304#define param_check_int(name, p) __param_check(name, p, int)
180 305
181extern int param_set_uint(const char *val, struct kernel_param *kp); 306extern struct kernel_param_ops param_ops_uint;
182extern int param_get_uint(char *buffer, struct kernel_param *kp); 307extern int param_set_uint(const char *val, const struct kernel_param *kp);
308extern int param_get_uint(char *buffer, const struct kernel_param *kp);
183#define param_check_uint(name, p) __param_check(name, p, unsigned int) 309#define param_check_uint(name, p) __param_check(name, p, unsigned int)
184 310
185extern int param_set_long(const char *val, struct kernel_param *kp); 311extern struct kernel_param_ops param_ops_long;
186extern int param_get_long(char *buffer, struct kernel_param *kp); 312extern int param_set_long(const char *val, const struct kernel_param *kp);
313extern int param_get_long(char *buffer, const struct kernel_param *kp);
187#define param_check_long(name, p) __param_check(name, p, long) 314#define param_check_long(name, p) __param_check(name, p, long)
188 315
189extern int param_set_ulong(const char *val, struct kernel_param *kp); 316extern struct kernel_param_ops param_ops_ulong;
190extern int param_get_ulong(char *buffer, struct kernel_param *kp); 317extern int param_set_ulong(const char *val, const struct kernel_param *kp);
318extern int param_get_ulong(char *buffer, const struct kernel_param *kp);
191#define param_check_ulong(name, p) __param_check(name, p, unsigned long) 319#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
192 320
193extern int param_set_charp(const char *val, struct kernel_param *kp); 321extern struct kernel_param_ops param_ops_charp;
194extern int param_get_charp(char *buffer, struct kernel_param *kp); 322extern int param_set_charp(const char *val, const struct kernel_param *kp);
323extern int param_get_charp(char *buffer, const struct kernel_param *kp);
195#define param_check_charp(name, p) __param_check(name, p, char *) 324#define param_check_charp(name, p) __param_check(name, p, char *)
196 325
197/* For historical reasons "bool" parameters can be (unsigned) "int". */ 326/* For historical reasons "bool" parameters can be (unsigned) "int". */
198extern int param_set_bool(const char *val, struct kernel_param *kp); 327extern struct kernel_param_ops param_ops_bool;
199extern int param_get_bool(char *buffer, struct kernel_param *kp); 328extern int param_set_bool(const char *val, const struct kernel_param *kp);
329extern int param_get_bool(char *buffer, const struct kernel_param *kp);
200#define param_check_bool(name, p) \ 330#define param_check_bool(name, p) \
201 static inline void __check_##name(void) \ 331 static inline void __check_##name(void) \
202 { \ 332 { \
203 BUILD_BUG_ON(!__same_type(*(p), bool) && \ 333 BUILD_BUG_ON(!__same_type((p), bool *) && \
204 !__same_type(*(p), unsigned int) && \ 334 !__same_type((p), unsigned int *) && \
205 !__same_type(*(p), int)); \ 335 !__same_type((p), int *)); \
206 } 336 }
207 337
208extern int param_set_invbool(const char *val, struct kernel_param *kp); 338extern struct kernel_param_ops param_ops_invbool;
209extern int param_get_invbool(char *buffer, struct kernel_param *kp); 339extern int param_set_invbool(const char *val, const struct kernel_param *kp);
340extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
210#define param_check_invbool(name, p) __param_check(name, p, bool) 341#define param_check_invbool(name, p) __param_check(name, p, bool)
211 342
212/* Comma-separated array: *nump is set to number they actually specified. */ 343/**
344 * module_param_array - a parameter which is an array of some type
345 * @name: the name of the array variable
346 * @type: the type, as per module_param()
347 * @nump: optional pointer filled in with the number written
348 * @perm: visibility in sysfs
349 *
350 * Input and output are as comma-separated values. Commas inside values
351 * don't work properly (eg. an array of charp).
352 *
353 * ARRAY_SIZE(@name) is used to determine the number of elements in the
354 * array, so the definition must be visible.
355 */
356#define module_param_array(name, type, nump, perm) \
357 module_param_array_named(name, name, type, nump, perm)
358
359/**
360 * module_param_array_named - renamed parameter which is an array of some type
361 * @name: a valid C identifier which is the parameter name
362 * @array: the name of the array variable
363 * @type: the type, as per module_param()
364 * @nump: optional pointer filled in with the number written
365 * @perm: visibility in sysfs
366 *
367 * This exposes a different name than the actual variable name. See
368 * module_param_named() for why this might be necessary.
369 */
213#define module_param_array_named(name, array, type, nump, perm) \ 370#define module_param_array_named(name, array, type, nump, perm) \
214 static const struct kparam_array __param_arr_##name \ 371 static const struct kparam_array __param_arr_##name \
215 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ 372 = { ARRAY_SIZE(array), nump, &param_ops_##type, \
216 sizeof(array[0]), array }; \ 373 sizeof(array[0]), array }; \
217 __module_param_call(MODULE_PARAM_PREFIX, name, \ 374 __module_param_call(MODULE_PARAM_PREFIX, name, \
218 param_array_set, param_array_get, \ 375 &param_array_ops, \
219 .arr = &__param_arr_##name, \ 376 .arr = &__param_arr_##name, \
220 __same_type(array[0], bool), perm); \ 377 __same_type(array[0], bool), perm); \
221 __MODULE_PARM_TYPE(name, "array of " #type) 378 __MODULE_PARM_TYPE(name, "array of " #type)
222 379
223#define module_param_array(name, type, nump, perm) \ 380extern struct kernel_param_ops param_array_ops;
224 module_param_array_named(name, name, type, nump, perm)
225
226extern int param_array_set(const char *val, struct kernel_param *kp);
227extern int param_array_get(char *buffer, struct kernel_param *kp);
228 381
229extern int param_set_copystring(const char *val, struct kernel_param *kp); 382extern struct kernel_param_ops param_ops_string;
230extern int param_get_string(char *buffer, struct kernel_param *kp); 383extern int param_set_copystring(const char *val, const struct kernel_param *);
384extern int param_get_string(char *buffer, const struct kernel_param *kp);
231 385
232/* for exporting parameters in /sys/parameters */ 386/* for exporting parameters in /sys/parameters */
233 387
@@ -235,13 +389,13 @@ struct module;
235 389
236#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES) 390#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
237extern int module_param_sysfs_setup(struct module *mod, 391extern int module_param_sysfs_setup(struct module *mod,
238 struct kernel_param *kparam, 392 const struct kernel_param *kparam,
239 unsigned int num_params); 393 unsigned int num_params);
240 394
241extern void module_param_sysfs_remove(struct module *mod); 395extern void module_param_sysfs_remove(struct module *mod);
242#else 396#else
243static inline int module_param_sysfs_setup(struct module *mod, 397static inline int module_param_sysfs_setup(struct module *mod,
244 struct kernel_param *kparam, 398 const struct kernel_param *kparam,
245 unsigned int num_params) 399 unsigned int num_params)
246{ 400{
247 return 0; 401 return 0;
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4bd05474d11d..5e7a59408dd4 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -27,7 +27,6 @@ struct mnt_namespace;
27#define MNT_NODIRATIME 0x10 27#define MNT_NODIRATIME 0x10
28#define MNT_RELATIME 0x20 28#define MNT_RELATIME 0x20
29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ 29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
30#define MNT_STRICTATIME 0x80
31 30
32#define MNT_SHRINKABLE 0x100 31#define MNT_SHRINKABLE 0x100
33#define MNT_WRITE_HOLD 0x200 32#define MNT_WRITE_HOLD 0x200
@@ -56,7 +55,11 @@ struct vfsmount {
56 struct list_head mnt_mounts; /* list of children, anchored here */ 55 struct list_head mnt_mounts; /* list of children, anchored here */
57 struct list_head mnt_child; /* and going through their mnt_child */ 56 struct list_head mnt_child; /* and going through their mnt_child */
58 int mnt_flags; 57 int mnt_flags;
59 /* 4 bytes hole on 64bits arches */ 58 /* 4 bytes hole on 64bits arches without fsnotify */
59#ifdef CONFIG_FSNOTIFY
60 __u32 mnt_fsnotify_mask;
61 struct hlist_head mnt_fsnotify_marks;
62#endif
60 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 63 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
61 struct list_head mnt_list; 64 struct list_head mnt_list;
62 struct list_head mnt_expire; /* link in fs-specific expiry list */ 65 struct list_head mnt_expire; /* link in fs-specific expiry list */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c5759d..7fa20beb2ab9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -4,12 +4,26 @@
4 * NAND family Bad Block Management (BBM) header file 4 * NAND family Bad Block Management (BBM) header file
5 * - Bad Block Table (BBT) implementation 5 * - Bad Block Table (BBT) implementation
6 * 6 *
7 * Copyright (c) 2005 Samsung Electronics 7 * Copyright © 2005 Samsung Electronics
8 * Kyungmin Park <kyungmin.park@samsung.com> 8 * Kyungmin Park <kyungmin.park@samsung.com>
9 * 9 *
10 * Copyright (c) 2000-2005 10 * Copyright © 2000-2005
11 * Thomas Gleixner <tglx@linuxtronix.de> 11 * Thomas Gleixner <tglx@linuxtronix.de>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 *
13 */ 27 */
14#ifndef __LINUX_MTD_BBM_H 28#ifndef __LINUX_MTD_BBM_H
15#define __LINUX_MTD_BBM_H 29#define __LINUX_MTD_BBM_H
@@ -82,6 +96,12 @@ struct nand_bbt_descr {
82#define NAND_BBT_SAVECONTENT 0x00002000 96#define NAND_BBT_SAVECONTENT 0x00002000
83/* Search good / bad pattern on the first and the second page */ 97/* Search good / bad pattern on the first and the second page */
84#define NAND_BBT_SCAN2NDPAGE 0x00004000 98#define NAND_BBT_SCAN2NDPAGE 0x00004000
99/* Search good / bad pattern on the last page of the eraseblock */
100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
85 105
86/* The maximum number of blocks to scan for a bbt */ 106/* The maximum number of blocks to scan for a bbt */
87#define NAND_BBT_SCAN_MAXBLOCKS 4 107#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index b481ccd7ff3c..26529ebd59cc 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,7 +1,19 @@
1/* 1/*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
3 * 3 *
4 * Interface to Linux block layer for MTD 'translation layers'. 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 17 *
6 */ 18 */
7 19
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 574d9ee066f1..d2118b0eac9a 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,6 +1,20 @@
1 1/*
2/* Common Flash Interface structures 2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 * See http://support.intel.com/design/flash/technote/index.htm 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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
4 */ 18 */
5 19
6#ifndef __MTD_CFI_H__ 20#ifndef __MTD_CFI_H__
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index d802f7736be3..51cc3f5917a8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,3 +1,22 @@
1/*
2 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
1#include <asm/byteorder.h> 20#include <asm/byteorder.h>
2 21
3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
deleted file mode 100644
index 7d1300d9bd51..000000000000
--- a/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifndef __LINUX_MTD_COMPATMAC_H__
3#define __LINUX_MTD_COMPATMAC_H__
4
5/* Nothing to see here. We write 2.5-compatible code and this
6 file makes it all OK in older kernels, but it's empty in _current_
7 kernels. Include guard just to make GCC ignore it in future inclusions
8 anyway... */
9
10#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index e80c674daeb3..ccdbe93a909c 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -1,9 +1,22 @@
1/* 1/*
2 * MTD device concatenation layer definitions 2 * MTD device concatenation layer definitions
3 * 3 *
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 19 *
6 * This code is GPL
7 */ 20 */
8 21
9#ifndef MTD_CONCAT_H 22#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0a6d516ab71d..0f6fea73a1f6 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -1,12 +1,25 @@
1/* 1/*
2 * Linux driver for Disk-On-Chip devices 2 * Linux driver for Disk-On-Chip devices
3 * 3 *
4 * Copyright (C) 1999 Machine Vision Holdings, Inc. 4 * Copyright © 1999 Machine Vision Holdings, Inc.
5 * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> 5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright © 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright © 2002-2003 SnapGear Inc
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8 * 22 *
9 * Released under GPL
10 */ 23 */
11 24
12#ifndef __MTD_DOC2000_H__ 25#ifndef __MTD_DOC2000_H__
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index f43e9b49b751..b63fa457febd 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -1,10 +1,21 @@
1
2/* 1/*
3 * struct flchip definition 2 * Copyright © 2000 Red Hat UK Limited
3 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
4 * 14 *
5 * Contains information about the location and state of a given flash device 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 * 18 *
7 * (C) 2000 Red Hat. GPLd.
8 */ 19 */
9 20
10#ifndef __MTD_FLASHCHIP_H__ 21#ifndef __MTD_FLASHCHIP_H__
@@ -92,7 +103,7 @@ struct flchip {
92/* This is used to handle contention on write/erase operations 103/* This is used to handle contention on write/erase operations
93 between partitions of the same physical chip. */ 104 between partitions of the same physical chip. */
94struct flchip_shared { 105struct flchip_shared {
95 spinlock_t lock; 106 struct mutex lock;
96 struct flchip *writing; 107 struct flchip *writing;
97 struct flchip *erasing; 108 struct flchip *erasing;
98}; 109};
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index df362ddf2949..2c456054fded 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,6 +1,21 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * Copyright © 2001 Red Hat UK Limited
3 * GPL'd 3 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
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; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
4 */ 19 */
5 20
6#ifndef __LINUX_MTD_GEN_PROBE_H__ 21#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index de89eca864ce..a9e6ba46865e 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,3 +1,21 @@
1/*
2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
1 19
2/* Overhauled routines for dealing with different mmap regions of flash */ 20/* Overhauled routines for dealing with different mmap regions of flash */
3 21
@@ -9,7 +27,6 @@
9#include <linux/string.h> 27#include <linux/string.h>
10#include <linux/bug.h> 28#include <linux/bug.h>
11 29
12#include <linux/mtd/compatmac.h>
13 30
14#include <asm/unaligned.h> 31#include <asm/unaligned.h>
15#include <asm/system.h> 32#include <asm/system.h>
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 5326435a7571..8485e42a9b09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,7 +1,20 @@
1/* 1/*
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 * Released under GPL
5 */ 18 */
6 19
7#ifndef __MTD_MTD_H__ 20#ifndef __MTD_MTD_H__
@@ -13,7 +26,6 @@
13#include <linux/notifier.h> 26#include <linux/notifier.h>
14#include <linux/device.h> 27#include <linux/device.h>
15 28
16#include <linux/mtd/compatmac.h>
17#include <mtd/mtd-abi.h> 29#include <mtd/mtd-abi.h>
18 30
19#include <asm/div64.h> 31#include <asm/div64.h>
@@ -216,6 +228,7 @@ struct mtd_info {
216 /* Chip-supported device locking */ 228 /* Chip-supported device locking */
217 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 229 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
218 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 230 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
231 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
219 232
220 /* Power Management functions */ 233 /* Power Management functions */
221 int (*suspend) (struct mtd_info *mtd); 234 int (*suspend) (struct mtd_info *mtd);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81b185e23a7..102e12c58cb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> 4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -181,8 +181,6 @@ typedef enum {
181#define NAND_NO_READRDY 0x00000100 181#define NAND_NO_READRDY 0x00000100
182/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
183#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
184/* Chip stores bad block marker on the last page of the eraseblock */
185#define NAND_BB_LAST_PAGE 0x00000400
186 184
187/* Device is one of 'new' xD cards that expose fake nand command set */ 185/* Device is one of 'new' xD cards that expose fake nand command set */
188#define NAND_BROKEN_XD 0x00000400 186#define NAND_BROKEN_XD 0x00000400
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 41bc013571d0..4d8406c81652 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * drivers/mtd/nand_ecc.h 2 * drivers/mtd/nand_ecc.h
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 * Thomas Gleixner <tglx@linutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index dcaf611ed748..b059629e22bc 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_NFTL_H__ 20#ifndef __MTD_NFTL_H__
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index c26ff86ad08a..0c8815bfae1c 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -68,6 +68,7 @@ struct onenand_bufferram {
68 * @write_word: [REPLACEABLE] hardware specific function for write 68 * @write_word: [REPLACEABLE] hardware specific function for write
69 * register of OneNAND 69 * register of OneNAND
70 * @mmcontrol: sync burst read function 70 * @mmcontrol: sync burst read function
71 * @chip_probe: [REPLACEABLE] hardware specific function for chip probe
71 * @block_markbad: function to mark a block as bad 72 * @block_markbad: function to mark a block as bad
72 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 73 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
73 * Bad block Table 74 * Bad block Table
@@ -114,6 +115,7 @@ struct onenand_chip {
114 unsigned short (*read_word)(void __iomem *addr); 115 unsigned short (*read_word)(void __iomem *addr);
115 void (*write_word)(unsigned short value, void __iomem *addr); 116 void (*write_word)(unsigned short value, void __iomem *addr);
116 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 117 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
118 int (*chip_probe)(struct mtd_info *mtd);
117 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
118 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
119 121
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cabf07d3..bcfd9f777454 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base; 27 unsigned int pfow_base;
28 char *probe_type;
28 struct mtd_partition *parts; 29 struct mtd_partition *parts;
29}; 30};
30 31
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index edeeabdc1500..9d40effe7ca7 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -1,8 +1,14 @@
1header-y += nf_conntrack_common.h
2header-y += nf_conntrack_ftp.h
1header-y += nf_conntrack_sctp.h 3header-y += nf_conntrack_sctp.h
4header-y += nf_conntrack_tcp.h
2header-y += nf_conntrack_tuple_common.h 5header-y += nf_conntrack_tuple_common.h
6header-y += nfnetlink.h
7header-y += nfnetlink_compat.h
3header-y += nfnetlink_conntrack.h 8header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h 9header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h 10header-y += nfnetlink_queue.h
11header-y += x_tables.h
6header-y += xt_CHECKSUM.h 12header-y += xt_CHECKSUM.h
7header-y += xt_CLASSIFY.h 13header-y += xt_CLASSIFY.h
8header-y += xt_CONNMARK.h 14header-y += xt_CONNMARK.h
@@ -31,9 +37,9 @@ header-y += xt_dccp.h
31header-y += xt_dscp.h 37header-y += xt_dscp.h
32header-y += xt_esp.h 38header-y += xt_esp.h
33header-y += xt_hashlimit.h 39header-y += xt_hashlimit.h
40header-y += xt_helper.h
34header-y += xt_iprange.h 41header-y += xt_iprange.h
35header-y += xt_ipvs.h 42header-y += xt_ipvs.h
36header-y += xt_helper.h
37header-y += xt_length.h 43header-y += xt_length.h
38header-y += xt_limit.h 44header-y += xt_limit.h
39header-y += xt_mac.h 45header-y += xt_mac.h
@@ -41,7 +47,9 @@ header-y += xt_mark.h
41header-y += xt_multiport.h 47header-y += xt_multiport.h
42header-y += xt_osf.h 48header-y += xt_osf.h
43header-y += xt_owner.h 49header-y += xt_owner.h
50header-y += xt_physdev.h
44header-y += xt_pkttype.h 51header-y += xt_pkttype.h
52header-y += xt_policy.h
45header-y += xt_quota.h 53header-y += xt_quota.h
46header-y += xt_rateest.h 54header-y += xt_rateest.h
47header-y += xt_realm.h 55header-y += xt_realm.h
@@ -54,12 +62,3 @@ header-y += xt_tcpmss.h
54header-y += xt_tcpudp.h 62header-y += xt_tcpudp.h
55header-y += xt_time.h 63header-y += xt_time.h
56header-y += xt_u32.h 64header-y += xt_u32.h
57
58unifdef-y += nf_conntrack_common.h
59unifdef-y += nf_conntrack_ftp.h
60unifdef-y += nf_conntrack_tcp.h
61unifdef-y += nfnetlink.h
62unifdef-y += nfnetlink_compat.h
63unifdef-y += x_tables.h
64unifdef-y += xt_physdev.h
65unifdef-y += xt_policy.h
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
index 4f13dfcb92ea..b27439c71037 100644
--- a/include/linux/netfilter_arp/Kbuild
+++ b/include/linux/netfilter_arp/Kbuild
@@ -1,3 +1,2 @@
1header-y += arp_tables.h
1header-y += arpt_mangle.h 2header-y += arpt_mangle.h
2
3unifdef-y += arp_tables.h
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
index 76ff4c47d8c4..d4d78672873e 100644
--- a/include/linux/netfilter_bridge/Kbuild
+++ b/include/linux/netfilter_bridge/Kbuild
@@ -1,3 +1,4 @@
1header-y += ebt_802_3.h
1header-y += ebt_among.h 2header-y += ebt_among.h
2header-y += ebt_arp.h 3header-y += ebt_arp.h
3header-y += ebt_arpreply.h 4header-y += ebt_arpreply.h
@@ -12,6 +13,4 @@ header-y += ebt_redirect.h
12header-y += ebt_stp.h 13header-y += ebt_stp.h
13header-y += ebt_ulog.h 14header-y += ebt_ulog.h
14header-y += ebt_vlan.h 15header-y += ebt_vlan.h
15 16header-y += ebtables.h
16unifdef-y += ebtables.h
17unifdef-y += ebt_802_3.h
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 431b40761920..f9930c87fff3 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,3 +1,5 @@
1header-y += ip_queue.h
2header-y += ip_tables.h
1header-y += ipt_CLUSTERIP.h 3header-y += ipt_CLUSTERIP.h
2header-y += ipt_ECN.h 4header-y += ipt_ECN.h
3header-y += ipt_LOG.h 5header-y += ipt_LOG.h
@@ -10,6 +12,3 @@ header-y += ipt_ah.h
10header-y += ipt_ecn.h 12header-y += ipt_ecn.h
11header-y += ipt_realm.h 13header-y += ipt_realm.h
12header-y += ipt_ttl.h 14header-y += ipt_ttl.h
13
14unifdef-y += ip_queue.h
15unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index e864eaee9e5e..bd095bc075e9 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,12 +1,11 @@
1header-y += ip6_tables.h
1header-y += ip6t_HL.h 2header-y += ip6t_HL.h
2header-y += ip6t_LOG.h 3header-y += ip6t_LOG.h
3header-y += ip6t_REJECT.h 4header-y += ip6t_REJECT.h
4header-y += ip6t_ah.h 5header-y += ip6t_ah.h
5header-y += ip6t_frag.h 6header-y += ip6t_frag.h
6header-y += ip6t_ipv6header.h
7header-y += ip6t_hl.h 7header-y += ip6t_hl.h
8header-y += ip6t_ipv6header.h
8header-y += ip6t_mh.h 9header-y += ip6t_mh.h
9header-y += ip6t_opts.h 10header-y += ip6t_opts.h
10header-y += ip6t_rt.h 11header-y += ip6t_rt.h
11
12unifdef-y += ip6_tables.h
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 413742c92d14..791d5109f34c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -122,7 +122,7 @@ static inline int netpoll_tx_running(struct net_device *dev)
122} 122}
123 123
124#else 124#else
125static inline int netpoll_rx(struct sk_buff *skb) 125static inline bool netpoll_rx(struct sk_buff *skb)
126{ 126{
127 return 0; 127 return 0;
128} 128}
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index fc972048e572..55d1467de3c1 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,6 +1,6 @@
1unifdef-y += const.h 1header-y += const.h
2unifdef-y += debug.h 2header-y += debug.h
3unifdef-y += export.h 3header-y += export.h
4unifdef-y += nfsfh.h 4header-y += nfsfh.h
5unifdef-y += stats.h 5header-y += stats.h
6unifdef-y += syscall.h 6header-y += syscall.h
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 35aa44ad9f2c..835f85ecd2de 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,20 +1,6 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4/*
5 * The of_device *was* a kind of "base class" that was a superset of
6 * struct device for use by devices attached to an OF node and probed
7 * using OF properties. However, the important bit of OF-style
8 * probing, namely the device node pointer, has been moved into the
9 * common struct device when CONFIG_OF is set to make OF-style probing
10 * available to all bus types. So now, just make of_device and
11 * platform_device equivalent so that current of_platform bus users
12 * can be transparently migrated over to using the platform bus.
13 *
14 * This line will go away once all references to of_device are removed
15 * from the kernel.
16 */
17#define of_device platform_device
18#include <linux/platform_device.h> 4#include <linux/platform_device.h>
19#include <linux/of_platform.h> /* temporary until merge */ 5#include <linux/of_platform.h> /* temporary until merge */
20 6
@@ -23,8 +9,6 @@
23#include <linux/of.h> 9#include <linux/of.h>
24#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
25 11
26#define to_of_device(d) container_of(d, struct of_device, dev)
27
28extern const struct of_device_id *of_match_device( 12extern const struct of_device_id *of_match_device(
29 const struct of_device_id *matches, const struct device *dev); 13 const struct of_device_id *matches, const struct device *dev);
30extern void of_device_make_bus_id(struct device *dev); 14extern void of_device_make_bus_id(struct device *dev);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 4e6d989c06df..a68716ad38ce 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -19,9 +19,17 @@
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22/* 22/**
23 * An of_platform_driver driver is attached to a basic of_device on 23 * of_platform_driver - Legacy of-aware driver for platform devices.
24 * the "platform bus" (platform_bus_type). 24 *
25 * An of_platform_driver driver is attached to a basic platform_device on
26 * ether the "platform bus" (platform_bus_type), or the ibm ebus
27 * (ibmebus_bus_type).
28 *
29 * of_platform_driver is being phased out when used with the platform_bus_type,
30 * and regular platform_drivers should be used instead. When the transition
31 * is complete, only ibmebus will be using this structure, and the
32 * platform_driver member of this structure will be removed.
25 */ 33 */
26struct of_platform_driver 34struct of_platform_driver
27{ 35{
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 537662315627..5e3aa8311c5e 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -1,19 +1,34 @@
1#ifndef __INCLUDE_LINUX_OOM_H 1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H 2#define __INCLUDE_LINUX_OOM_H
3 3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 4/*
5 * /proc/<pid>/oom_adj is deprecated, see
6 * Documentation/feature-removal-schedule.txt.
7 *
8 * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
9 */
5#define OOM_DISABLE (-17) 10#define OOM_DISABLE (-17)
6/* inclusive */ 11/* inclusive */
7#define OOM_ADJUST_MIN (-16) 12#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15 13#define OOM_ADJUST_MAX 15
9 14
15/*
16 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
17 * pid.
18 */
19#define OOM_SCORE_ADJ_MIN (-1000)
20#define OOM_SCORE_ADJ_MAX 1000
21
10#ifdef __KERNEL__ 22#ifdef __KERNEL__
11 23
24#include <linux/sched.h>
12#include <linux/types.h> 25#include <linux/types.h>
13#include <linux/nodemask.h> 26#include <linux/nodemask.h>
14 27
15struct zonelist; 28struct zonelist;
16struct notifier_block; 29struct notifier_block;
30struct mem_cgroup;
31struct task_struct;
17 32
18/* 33/*
19 * Types of limitations to the nodes from which allocations may occur 34 * Types of limitations to the nodes from which allocations may occur
@@ -22,9 +37,12 @@ enum oom_constraint {
22 CONSTRAINT_NONE, 37 CONSTRAINT_NONE,
23 CONSTRAINT_CPUSET, 38 CONSTRAINT_CPUSET,
24 CONSTRAINT_MEMORY_POLICY, 39 CONSTRAINT_MEMORY_POLICY,
40 CONSTRAINT_MEMCG,
25}; 41};
26 42
27extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); 43extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
44 const nodemask_t *nodemask, unsigned long totalpages);
45extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 46extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
29 47
30extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 48extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
@@ -43,5 +61,16 @@ static inline void oom_killer_enable(void)
43{ 61{
44 oom_killer_disabled = false; 62 oom_killer_disabled = false;
45} 63}
64
65/* The badness from the OOM killer */
66extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem,
67 const nodemask_t *nodemask, unsigned long uptime);
68
69extern struct task_struct *find_lock_task_mm(struct task_struct *p);
70
71/* sysctls */
72extern int sysctl_oom_dump_tasks;
73extern int sysctl_oom_kill_allocating_task;
74extern int sysctl_panic_on_oom;
46#endif /* __KERNEL__*/ 75#endif /* __KERNEL__*/
47#endif /* _INCLUDE_LINUX_OOM_H */ 76#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 3c62ed408492..e12cdc6d79ee 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -13,6 +13,7 @@
13#include <linux/gfp.h> 13#include <linux/gfp.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/hardirq.h> /* for in_interrupt() */ 15#include <linux/hardirq.h> /* for in_interrupt() */
16#include <linux/hugetlb_inline.h>
16 17
17/* 18/*
18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 19 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
@@ -281,10 +282,16 @@ static inline loff_t page_offset(struct page *page)
281 return ((loff_t)page->index) << PAGE_CACHE_SHIFT; 282 return ((loff_t)page->index) << PAGE_CACHE_SHIFT;
282} 283}
283 284
285extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma,
286 unsigned long address);
287
284static inline pgoff_t linear_page_index(struct vm_area_struct *vma, 288static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
285 unsigned long address) 289 unsigned long address)
286{ 290{
287 pgoff_t pgoff = (address - vma->vm_start) >> PAGE_SHIFT; 291 pgoff_t pgoff;
292 if (unlikely(is_vm_hugetlb_page(vma)))
293 return linear_hugepage_index(vma, address);
294 pgoff = (address - vma->vm_start) >> PAGE_SHIFT;
288 pgoff += vma->vm_pgoff; 295 pgoff += vma->vm_pgoff;
289 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT); 296 return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
290} 297}
@@ -423,8 +430,10 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
423 const char __user *end = uaddr + size - 1; 430 const char __user *end = uaddr + size - 1;
424 431
425 if (((unsigned long)uaddr & PAGE_MASK) != 432 if (((unsigned long)uaddr & PAGE_MASK) !=
426 ((unsigned long)end & PAGE_MASK)) 433 ((unsigned long)end & PAGE_MASK)) {
427 ret = __get_user(c, end); 434 ret = __get_user(c, end);
435 (void)c;
436 }
428 } 437 }
429 return ret; 438 return ret;
430} 439}
diff --git a/include/linux/path.h b/include/linux/path.h
index 915e0c382a51..edc98dec6266 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -12,4 +12,9 @@ struct path {
12extern void path_get(struct path *); 12extern void path_get(struct path *);
13extern void path_put(struct path *); 13extern void path_put(struct path *);
14 14
15static inline int path_equal(const struct path *path1, const struct path *path2)
16{
17 return path1->mnt == path2->mnt && path1->dentry == path2->dentry;
18}
19
15#endif /* _LINUX_PATH_H */ 20#endif /* _LINUX_PATH_H */
diff --git a/include/linux/pch_dma.h b/include/linux/pch_dma.h
new file mode 100644
index 000000000000..fdafe529ef8a
--- /dev/null
+++ b/include/linux/pch_dma.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) 2010 Intel Corporation
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 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#ifndef PCH_DMA_H
19#define PCH_DMA_H
20
21#include <linux/dmaengine.h>
22
23enum pch_dma_width {
24 PCH_DMA_WIDTH_1_BYTE,
25 PCH_DMA_WIDTH_2_BYTES,
26 PCH_DMA_WIDTH_4_BYTES,
27};
28
29struct pch_dma_slave {
30 struct device *dma_dev;
31 unsigned int chan_id;
32 dma_addr_t tx_reg;
33 dma_addr_t rx_reg;
34 enum pch_dma_width width;
35};
36
37#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c81eec4d3c35..f6a3b2d36cad 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2372,6 +2372,9 @@
2372#define PCI_VENDOR_ID_AKS 0x416c 2372#define PCI_VENDOR_ID_AKS 0x416c
2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2374 2374
2375#define PCI_VENDOR_ID_ACCESSIO 0x494f
2376#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0
2377
2375#define PCI_VENDOR_ID_S3 0x5333 2378#define PCI_VENDOR_ID_S3 0x5333
2376#define PCI_DEVICE_ID_S3_TRIO 0x8811 2379#define PCI_DEVICE_ID_S3_TRIO 0x8811
2377#define PCI_DEVICE_ID_S3_868 0x8880 2380#define PCI_DEVICE_ID_S3_868 0x8880
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index c88d67b59394..8a7d510ffa9c 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -40,6 +40,7 @@ void percpu_counter_destroy(struct percpu_counter *fbc);
40void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
42s64 __percpu_counter_sum(struct percpu_counter *fbc); 42s64 __percpu_counter_sum(struct percpu_counter *fbc);
43int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs);
43 44
44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 45static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
45{ 46{
@@ -98,6 +99,16 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
98 fbc->count = amount; 99 fbc->count = amount;
99} 100}
100 101
102static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
103{
104 if (fbc->count > rhs)
105 return 1;
106 else if (fbc->count < rhs)
107 return -1;
108 else
109 return 0;
110}
111
101static inline void 112static inline void
102percpu_counter_add(struct percpu_counter *fbc, s64 amount) 113percpu_counter_add(struct percpu_counter *fbc, s64 amount)
103{ 114{
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 34066ffd893d..2110a81c5e2a 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -48,15 +48,6 @@
48#define POISON_FREE 0x6b /* for use-after-free poisoning */ 48#define POISON_FREE 0x6b /* for use-after-free poisoning */
49#define POISON_END 0xa5 /* end-byte of poisoning */ 49#define POISON_END 0xa5 /* end-byte of poisoning */
50 50
51/********** mm/hugetlb.c **********/
52/*
53 * Private mappings of hugetlb pages use this poisoned value for
54 * page->mapping. The core VM should not be doing anything with this mapping
55 * but futex requires the existence of some page->mapping value even though it
56 * is unused if PAGE_MAPPING_ANON is set.
57 */
58#define HUGETLB_POISON ((void *)(0x00300300 + POISON_POINTER_DELTA + PAGE_MAPPING_ANON))
59
60/********** arch/$ARCH/mm/init.c **********/ 51/********** arch/$ARCH/mm/init.c **********/
61#define POISON_FREE_INITMEM 0xcc 52#define POISON_FREE_INITMEM 0xcc
62 53
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 4f71bf4e628c..3e23844a6990 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -117,6 +117,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
117 117
118long clock_nanosleep_restart(struct restart_block *restart_block); 118long clock_nanosleep_restart(struct restart_block *restart_block);
119 119
120void update_rlimit_cpu(unsigned long rlim_new); 120void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
121 121
122#endif 122#endif
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index bff98ec1bfed..5d87f810a3b7 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -36,7 +36,7 @@ struct ppp_channel_ops {
36 36
37struct ppp_channel { 37struct ppp_channel {
38 void *private; /* channel private data */ 38 void *private; /* channel private data */
39 struct ppp_channel_ops *ops; /* operations for this channel */ 39 const struct ppp_channel_ops *ops; /* operations for this channel */
40 int mtu; /* max transmit packet size */ 40 int mtu; /* max transmit packet size */
41 int hdrlen; /* amount of headroom channel needs */ 41 int hdrlen; /* amount of headroom channel needs */
42 void *ppp; /* opaque to channel */ 42 void *ppp; /* opaque to channel */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 55ca73cf25e5..634b8e674ac5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -55,7 +55,7 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
55 55
56/*** radix-tree API starts here ***/ 56/*** radix-tree API starts here ***/
57 57
58#define RADIX_TREE_MAX_TAGS 2 58#define RADIX_TREE_MAX_TAGS 3
59 59
60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */ 60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
61struct radix_tree_root { 61struct radix_tree_root {
@@ -192,6 +192,10 @@ unsigned int
192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, 192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
193 unsigned long first_index, unsigned int max_items, 193 unsigned long first_index, unsigned int max_items,
194 unsigned int tag); 194 unsigned int tag);
195unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
196 unsigned long *first_indexp, unsigned long last_index,
197 unsigned long nr_to_tag,
198 unsigned int fromtag, unsigned int totag);
195int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 199int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
196 200
197static inline void radix_tree_preload_end(void) 201static inline void radix_tree_preload_end(void)
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 1cbbd2c11aa9..2b59cc824395 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -62,7 +62,9 @@ extern const char raid6_empty_zero_page[PAGE_SIZE];
62#define disable_kernel_altivec() 62#define disable_kernel_altivec()
63 63
64#define EXPORT_SYMBOL(sym) 64#define EXPORT_SYMBOL(sym)
65#define EXPORT_SYMBOL_GPL(sym)
65#define MODULE_LICENSE(licence) 66#define MODULE_LICENSE(licence)
67#define MODULE_DESCRIPTION(desc)
66#define subsys_initcall(x) 68#define subsys_initcall(x)
67#define module_exit(x) 69#define module_exit(x)
68#endif /* __KERNEL__ */ 70#endif /* __KERNEL__ */
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
new file mode 100644
index 000000000000..f509877c2ed4
--- /dev/null
+++ b/include/linux/regulator/ab8500.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * Author: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 *
8 */
9
10#ifndef __LINUX_MFD_AB8500_REGULATOR_H
11#define __LINUX_MFD_AB8500_REGULATOR_H
12
13/* AB8500 regulators */
14#define AB8500_LDO_AUX1 0
15#define AB8500_LDO_AUX2 1
16#define AB8500_LDO_AUX3 2
17#define AB8500_LDO_INTCORE 3
18#define AB8500_LDO_TVOUT 4
19#define AB8500_LDO_AUDIO 5
20#define AB8500_LDO_ANAMIC1 6
21#define AB8500_LDO_ANAMIC2 7
22#define AB8500_LDO_DMIC 8
23#define AB8500_LDO_ANA 9
24
25#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index ba394163dea1..91a4177e60ce 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2033,7 +2033,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
2033 struct reiserfs_iget_args *args); 2033 struct reiserfs_iget_args *args);
2034int reiserfs_find_actor(struct inode *inode, void *p); 2034int reiserfs_find_actor(struct inode *inode, void *p);
2035int reiserfs_init_locked_inode(struct inode *inode, void *p); 2035int reiserfs_init_locked_inode(struct inode *inode, void *p);
2036void reiserfs_delete_inode(struct inode *inode); 2036void reiserfs_evict_inode(struct inode *inode);
2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); 2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2038int reiserfs_get_block(struct inode *inode, sector_t block, 2038int reiserfs_get_block(struct inode *inode, sector_t block,
2039 struct buffer_head *bh_result, int create); 2039 struct buffer_head *bh_result, int create);
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 89f4d3abbf5a..97959bdfe214 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -25,7 +25,6 @@ typedef enum {
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28 i_ever_mapped = 0x0100
29} reiserfs_inode_flags; 28} reiserfs_inode_flags;
30 29
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
@@ -53,7 +52,8 @@ struct reiserfs_inode_info {
53 ** flushed */ 52 ** flushed */
54 unsigned int i_trans_id; 53 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 55 atomic_t openers;
56 struct mutex tailpack;
57#ifdef CONFIG_REISERFS_FS_XATTR 57#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore i_xattr_sem; 58 struct rw_semaphore i_xattr_sem;
59#endif 59#endif
diff --git a/include/linux/resource.h b/include/linux/resource.h
index f1e914eefeab..88d36f9145ba 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -43,6 +43,13 @@ struct rlimit {
43 unsigned long rlim_max; 43 unsigned long rlim_max;
44}; 44};
45 45
46#define RLIM64_INFINITY (~0ULL)
47
48struct rlimit64 {
49 __u64 rlim_cur;
50 __u64 rlim_max;
51};
52
46#define PRIO_MIN (-20) 53#define PRIO_MIN (-20)
47#define PRIO_MAX 20 54#define PRIO_MAX 20
48 55
@@ -73,6 +80,8 @@ struct rlimit {
73struct task_struct; 80struct task_struct;
74 81
75int getrusage(struct task_struct *p, int who, struct rusage __user *ru); 82int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
83int do_prlimit(struct task_struct *tsk, unsigned int resource,
84 struct rlimit *new_rlim, struct rlimit *old_rlim);
76 85
77#endif /* __KERNEL__ */ 86#endif /* __KERNEL__ */
78 87
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 77216742c178..31b2fd75dcba 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,7 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29 struct anon_vma *root; /* Root of this anon_vma tree */
29#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION) 30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
30 31
31 /* 32 /*
@@ -80,6 +81,13 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
80{ 81{
81 return atomic_read(&anon_vma->external_refcount); 82 return atomic_read(&anon_vma->external_refcount);
82} 83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma)
86{
87 atomic_inc(&anon_vma->external_refcount);
88}
89
90void drop_anon_vma(struct anon_vma *);
83#else 91#else
84static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma) 92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
85{ 93{
@@ -89,6 +97,14 @@ static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
89{ 97{
90 return 0; 98 return 0;
91} 99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{
103}
104
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
92#endif /* CONFIG_KSM */ 108#endif /* CONFIG_KSM */
93 109
94static inline struct anon_vma *page_anon_vma(struct page *page) 110static inline struct anon_vma *page_anon_vma(struct page *page)
@@ -99,18 +115,28 @@ static inline struct anon_vma *page_anon_vma(struct page *page)
99 return page_rmapping(page); 115 return page_rmapping(page);
100} 116}
101 117
102static inline void anon_vma_lock(struct vm_area_struct *vma) 118static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
103{ 119{
104 struct anon_vma *anon_vma = vma->anon_vma; 120 struct anon_vma *anon_vma = vma->anon_vma;
105 if (anon_vma) 121 if (anon_vma)
106 spin_lock(&anon_vma->lock); 122 spin_lock(&anon_vma->root->lock);
107} 123}
108 124
109static inline void anon_vma_unlock(struct vm_area_struct *vma) 125static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
110{ 126{
111 struct anon_vma *anon_vma = vma->anon_vma; 127 struct anon_vma *anon_vma = vma->anon_vma;
112 if (anon_vma) 128 if (anon_vma)
113 spin_unlock(&anon_vma->lock); 129 spin_unlock(&anon_vma->root->lock);
130}
131
132static inline void anon_vma_lock(struct anon_vma *anon_vma)
133{
134 spin_lock(&anon_vma->root->lock);
135}
136
137static inline void anon_vma_unlock(struct anon_vma *anon_vma)
138{
139 spin_unlock(&anon_vma->root->lock);
114} 140}
115 141
116/* 142/*
@@ -136,10 +162,17 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
136 */ 162 */
137void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 163void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
138void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 164void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
165void do_page_add_anon_rmap(struct page *, struct vm_area_struct *,
166 unsigned long, int);
139void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 167void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
140void page_add_file_rmap(struct page *); 168void page_add_file_rmap(struct page *);
141void page_remove_rmap(struct page *); 169void page_remove_rmap(struct page *);
142 170
171void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *,
172 unsigned long);
173void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *,
174 unsigned long);
175
143static inline void page_dup_rmap(struct page *page) 176static inline void page_dup_rmap(struct page *page)
144{ 177{
145 atomic_inc(&page->_mapcount); 178 atomic_inc(&page->_mapcount);
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
new file mode 100644
index 000000000000..dbce22faa660
--- /dev/null
+++ b/include/linux/s3c_adc_battery.h
@@ -0,0 +1,36 @@
1#ifndef _S3C_ADC_BATTERY_H
2#define _S3C_ADC_BATTERY_H
3
4struct s3c_adc_bat_thresh {
5 int volt; /* mV */
6 int cur; /* mA */
7 int level; /* percent */
8};
9
10struct s3c_adc_bat_pdata {
11 int (*init)(void);
12 void (*exit)(void);
13 void (*enable_charger)(void);
14 void (*disable_charger)(void);
15
16 int gpio_charge_finished;
17
18 const struct s3c_adc_bat_thresh *lut_noac;
19 unsigned int lut_noac_cnt;
20 const struct s3c_adc_bat_thresh *lut_acin;
21 unsigned int lut_acin_cnt;
22
23 const unsigned int volt_channel;
24 const unsigned int current_channel;
25 const unsigned int backup_volt_channel;
26
27 const unsigned int volt_mult;
28 const unsigned int current_mult;
29 const unsigned int backup_volt_mult;
30 const unsigned int internal_impedance;
31
32 const unsigned int backup_volt_max;
33 const unsigned int backup_volt_min;
34};
35
36#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9591907c4f79..1e2a6db2d7dd 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -621,7 +621,8 @@ struct signal_struct {
621 struct tty_audit_buf *tty_audit_buf; 621 struct tty_audit_buf *tty_audit_buf;
622#endif 622#endif
623 623
624 int oom_adj; /* OOM kill score adjustment (bit shift) */ 624 int oom_adj; /* OOM kill score adjustment (bit shift) */
625 int oom_score_adj; /* OOM kill score adjustment */
625}; 626};
626 627
627/* Context switch must be unlocked if interrupts are to be enabled */ 628/* Context switch must be unlocked if interrupts are to be enabled */
@@ -2108,7 +2109,9 @@ extern void daemonize(const char *, ...);
2108extern int allow_signal(int); 2109extern int allow_signal(int);
2109extern int disallow_signal(int); 2110extern int disallow_signal(int);
2110 2111
2111extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *); 2112extern int do_execve(const char *,
2113 const char __user * const __user *,
2114 const char __user * const __user *, struct pt_regs *);
2112extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2115extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
2113struct task_struct *fork_idle(int); 2116struct task_struct *fork_idle(int);
2114 2117
diff --git a/include/linux/security.h b/include/linux/security.h
index 723a93df756a..a22219afff09 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -23,6 +23,7 @@
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h>
26#include <linux/binfmts.h> 27#include <linux/binfmts.h>
27#include <linux/signal.h> 28#include <linux/signal.h>
28#include <linux/resource.h> 29#include <linux/resource.h>
@@ -1498,7 +1499,8 @@ struct security_operations {
1498 int (*task_setnice) (struct task_struct *p, int nice); 1499 int (*task_setnice) (struct task_struct *p, int nice);
1499 int (*task_setioprio) (struct task_struct *p, int ioprio); 1500 int (*task_setioprio) (struct task_struct *p, int ioprio);
1500 int (*task_getioprio) (struct task_struct *p); 1501 int (*task_getioprio) (struct task_struct *p);
1501 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); 1502 int (*task_setrlimit) (struct task_struct *p, unsigned int resource,
1503 struct rlimit *new_rlim);
1502 int (*task_setscheduler) (struct task_struct *p, int policy, 1504 int (*task_setscheduler) (struct task_struct *p, int policy,
1503 struct sched_param *lp); 1505 struct sched_param *lp);
1504 int (*task_getscheduler) (struct task_struct *p); 1506 int (*task_getscheduler) (struct task_struct *p);
@@ -1748,7 +1750,8 @@ void security_task_getsecid(struct task_struct *p, u32 *secid);
1748int security_task_setnice(struct task_struct *p, int nice); 1750int security_task_setnice(struct task_struct *p, int nice);
1749int security_task_setioprio(struct task_struct *p, int ioprio); 1751int security_task_setioprio(struct task_struct *p, int ioprio);
1750int security_task_getioprio(struct task_struct *p); 1752int security_task_getioprio(struct task_struct *p);
1751int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); 1753int security_task_setrlimit(struct task_struct *p, unsigned int resource,
1754 struct rlimit *new_rlim);
1752int security_task_setscheduler(struct task_struct *p, 1755int security_task_setscheduler(struct task_struct *p,
1753 int policy, struct sched_param *lp); 1756 int policy, struct sched_param *lp);
1754int security_task_getscheduler(struct task_struct *p); 1757int security_task_getscheduler(struct task_struct *p);
@@ -2310,7 +2313,8 @@ static inline int security_task_getioprio(struct task_struct *p)
2310 return 0; 2313 return 0;
2311} 2314}
2312 2315
2313static inline int security_task_setrlimit(unsigned int resource, 2316static inline int security_task_setrlimit(struct task_struct *p,
2317 unsigned int resource,
2314 struct rlimit *new_rlim) 2318 struct rlimit *new_rlim)
2315{ 2319{
2316 return 0; 2320 return 0;
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c8613c3ff9d3..1ebc694a6d52 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -77,7 +77,8 @@ struct serial_struct {
77#define PORT_16654 11 77#define PORT_16654 11
78#define PORT_16850 12 78#define PORT_16850 12
79#define PORT_RSA 13 /* RSA-DV II/S card */ 79#define PORT_RSA 13 /* RSA-DV II/S card */
80#define PORT_MAX 13 80#define PORT_U6_16550A 14
81#define PORT_MAX 14
81 82
82#define SERIAL_IO_PORT 0 83#define SERIAL_IO_PORT 0
83#define SERIAL_IO_HUB6 1 84#define SERIAL_IO_HUB6 1
@@ -151,7 +152,7 @@ struct serial_uart_config {
151#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) 152#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 153#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 154
154#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1) 155#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 156#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 157 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 158#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
@@ -210,8 +211,10 @@ struct serial_rs485 {
210#define SER_RS485_ENABLED (1 << 0) 211#define SER_RS485_ENABLED (1 << 0)
211#define SER_RS485_RTS_ON_SEND (1 << 1) 212#define SER_RS485_RTS_ON_SEND (1 << 1)
212#define SER_RS485_RTS_AFTER_SEND (1 << 2) 213#define SER_RS485_RTS_AFTER_SEND (1 << 2)
214#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
213 __u32 delay_rts_before_send; /* Milliseconds */ 215 __u32 delay_rts_before_send; /* Milliseconds */
214 __u32 padding[6]; /* Memory is cheap, new structs 216 __u32 delay_rts_after_send; /* Milliseconds */
217 __u32 padding[5]; /* Memory is cheap, new structs
215 are a royal PITA .. */ 218 are a royal PITA .. */
216}; 219};
217 220
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index fb46aba11fb5..7638deaaba65 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -32,6 +32,9 @@ struct plat_serial8250_port {
32 unsigned int type; /* If UPF_FIXED_TYPE */ 32 unsigned int type; /* If UPF_FIXED_TYPE */
33 unsigned int (*serial_in)(struct uart_port *, int); 33 unsigned int (*serial_in)(struct uart_port *, int);
34 void (*serial_out)(struct uart_port *, int, int); 34 void (*serial_out)(struct uart_port *, int, int);
35 void (*set_termios)(struct uart_port *,
36 struct ktermios *new,
37 struct ktermios *old);
35}; 38};
36 39
37/* 40/*
@@ -71,5 +74,7 @@ extern int early_serial_setup(struct uart_port *port);
71extern int serial8250_find_port(struct uart_port *p); 74extern int serial8250_find_port(struct uart_port *p);
72extern int serial8250_find_port_for_earlycon(void); 75extern int serial8250_find_port_for_earlycon(void);
73extern int setup_early_serial8250_console(char *cmdline); 76extern int setup_early_serial8250_console(char *cmdline);
77extern void serial8250_do_set_termios(struct uart_port *port,
78 struct ktermios *termios, struct ktermios *old);
74 79
75#endif 80#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f10db6e5f3b5..3c2ad99fed34 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -186,6 +186,15 @@
186#define PORT_ALTERA_JTAGUART 91 186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92 187#define PORT_ALTERA_UART 92
188 188
189/* SH-SCI */
190#define PORT_SCIFB 93
191
192/* MAX3107 */
193#define PORT_MAX3107 94
194
195/* High Speed UART for Medfield */
196#define PORT_MFD 95
197
189#ifdef __KERNEL__ 198#ifdef __KERNEL__
190 199
191#include <linux/compiler.h> 200#include <linux/compiler.h>
@@ -220,7 +229,7 @@ struct uart_ops {
220 void (*flush_buffer)(struct uart_port *); 229 void (*flush_buffer)(struct uart_port *);
221 void (*set_termios)(struct uart_port *, struct ktermios *new, 230 void (*set_termios)(struct uart_port *, struct ktermios *new,
222 struct ktermios *old); 231 struct ktermios *old);
223 void (*set_ldisc)(struct uart_port *); 232 void (*set_ldisc)(struct uart_port *, int new);
224 void (*pm)(struct uart_port *, unsigned int state, 233 void (*pm)(struct uart_port *, unsigned int state,
225 unsigned int oldstate); 234 unsigned int oldstate);
226 int (*set_wake)(struct uart_port *, unsigned int state); 235 int (*set_wake)(struct uart_port *, unsigned int state);
@@ -276,6 +285,9 @@ struct uart_port {
276 unsigned char __iomem *membase; /* read/write[bwl] */ 285 unsigned char __iomem *membase; /* read/write[bwl] */
277 unsigned int (*serial_in)(struct uart_port *, int); 286 unsigned int (*serial_in)(struct uart_port *, int);
278 void (*serial_out)(struct uart_port *, int, int); 287 void (*serial_out)(struct uart_port *, int, int);
288 void (*set_termios)(struct uart_port *,
289 struct ktermios *new,
290 struct ktermios *old);
279 unsigned int irq; /* irq number */ 291 unsigned int irq; /* irq number */
280 unsigned long irqflags; /* irq flags */ 292 unsigned long irqflags; /* irq flags */
281 unsigned int uartclk; /* base uart clock */ 293 unsigned int uartclk; /* base uart clock */
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h
new file mode 100644
index 000000000000..2b071e0b034d
--- /dev/null
+++ b/include/linux/serial_mfd.h
@@ -0,0 +1,47 @@
1#ifndef _SERIAL_MFD_H_
2#define _SERIAL_MFD_H_
3
4/* HW register offset definition */
5#define UART_FOR 0x08
6#define UART_PS 0x0C
7#define UART_MUL 0x0D
8#define UART_DIV 0x0E
9
10#define HSU_GBL_IEN 0x0
11#define HSU_GBL_IST 0x4
12
13#define HSU_GBL_INT_BIT_PORT0 0x0
14#define HSU_GBL_INT_BIT_PORT1 0x1
15#define HSU_GBL_INT_BIT_PORT2 0x2
16#define HSU_GBL_INT_BIT_IRI 0x3
17#define HSU_GBL_INT_BIT_HDLC 0x4
18#define HSU_GBL_INT_BIT_DMA 0x5
19
20#define HSU_GBL_ISR 0x8
21#define HSU_GBL_DMASR 0x400
22#define HSU_GBL_DMAISR 0x404
23
24#define HSU_PORT_REG_OFFSET 0x80
25#define HSU_PORT0_REG_OFFSET 0x80
26#define HSU_PORT1_REG_OFFSET 0x100
27#define HSU_PORT2_REG_OFFSET 0x180
28#define HSU_PORT_REG_LENGTH 0x80
29
30#define HSU_DMA_CHANS_REG_OFFSET 0x500
31#define HSU_DMA_CHANS_REG_LENGTH 0x40
32
33#define HSU_CH_SR 0x0 /* channel status reg */
34#define HSU_CH_CR 0x4 /* control reg */
35#define HSU_CH_DCR 0x8 /* descriptor control reg */
36#define HSU_CH_BSR 0x10 /* max fifo buffer size reg */
37#define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */
38#define HSU_CH_D0SAR 0x20 /* desc 0 start addr */
39#define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */
40#define HSU_CH_D1SAR 0x28
41#define HSU_CH_D1TSR 0x2C
42#define HSU_CH_D2SAR 0x30
43#define HSU_CH_D2TSR 0x34
44#define HSU_CH_D3SAR 0x38
45#define HSU_CH_D3TSR 0x3C
46
47#endif
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index cf9327c051ad..c7a0ce11cd47 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -221,8 +221,24 @@
221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ 221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */
222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ 222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
223 223
224/*
225 * Intel MID on-chip HSU (High Speed UART) defined bits
226 */
227#define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */
228#define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */
229#define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */
230#define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */
231
232#define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */
233#define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */
234#define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */
235#define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */
224 236
237#define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */
238#define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */
225 239
240#define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */
241#define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */
226 242
227/* 243/*
228 * These register definitions are for the 16C950 244 * These register definitions are for the 16C950
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 1636d1e2a5f1..875ce50719a9 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -25,6 +25,10 @@ struct clk {
25 int id; 25 int id;
26 26
27 struct clk *parent; 27 struct clk *parent;
28 struct clk **parent_table; /* list of parents to */
29 unsigned short parent_num; /* choose between */
30 unsigned char src_shift; /* source clock field in the */
31 unsigned char src_width; /* configuration register */
28 struct clk_ops *ops; 32 struct clk_ops *ops;
29 33
30 struct list_head children; 34 struct list_head children;
@@ -138,13 +142,22 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
138int sh_clk_div4_reparent_register(struct clk *clks, int nr, 142int sh_clk_div4_reparent_register(struct clk *clks, int nr,
139 struct clk_div4_table *table); 143 struct clk_div4_table *table);
140 144
141#define SH_CLK_DIV6(_parent, _reg, _flags) \ 145#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \
142{ \ 146 _num_parents, _src_shift, _src_width) \
143 .parent = _parent, \ 147{ \
144 .enable_reg = (void __iomem *)_reg, \ 148 .parent = _parent, \
145 .flags = _flags, \ 149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151 .parent_table = _parents, \
152 .parent_num = _num_parents, \
153 .src_shift = _src_shift, \
154 .src_width = _src_width, \
146} 155}
147 156
157#define SH_CLK_DIV6(_parent, _reg, _flags) \
158 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
159
148int sh_clk_div6_register(struct clk *clks, int nr); 160int sh_clk_div6_register(struct clk *clks, int nr);
161int sh_clk_div6_reparent_register(struct clk *clks, int nr);
149 162
150#endif /* __SH_CLOCK_H */ 163#endif /* __SH_CLOCK_H */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index e164291fb3e7..399be5ad2f99 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/swap.h> 4#include <linux/swap.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/percpu_counter.h>
6 7
7/* inode in-kernel data */ 8/* inode in-kernel data */
8 9
@@ -23,7 +24,7 @@ struct shmem_inode_info {
23 24
24struct shmem_sb_info { 25struct shmem_sb_info {
25 unsigned long max_blocks; /* How many blocks are allowed */ 26 unsigned long max_blocks; /* How many blocks are allowed */
26 unsigned long free_blocks; /* How many are left for allocation */ 27 struct percpu_counter used_blocks; /* How many are allocated */
27 unsigned long max_inodes; /* How many inodes are allowed */ 28 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 29 unsigned long free_inodes; /* How many are left for allocation */
29 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d20d9e7a9bbd..77eb60d2b496 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1379,6 +1379,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1379 return skb_network_header(skb) - skb->data; 1379 return skb_network_header(skb) - skb->data;
1380} 1380}
1381 1381
1382static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1383{
1384 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1385}
1386
1382/* 1387/*
1383 * CPUs often take a performance hit when accessing unaligned memory 1388 * CPUs often take a performance hit when accessing unaligned memory
1384 * locations. The actual performance hit varies, it can be small if the 1389 * locations. The actual performance hit varies, it can be small if the
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 1acfa73ce2ac..791a502f6906 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -17,7 +17,6 @@
17 17
18#include <trace/events/kmem.h> 18#include <trace/events/kmem.h>
19 19
20#ifndef ARCH_KMALLOC_MINALIGN
21/* 20/*
22 * Enforce a minimum alignment for the kmalloc caches. 21 * Enforce a minimum alignment for the kmalloc caches.
23 * Usually, the kmalloc caches are cache_line_size() aligned, except when 22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
@@ -27,6 +26,9 @@
27 * ARCH_KMALLOC_MINALIGN allows that. 26 * ARCH_KMALLOC_MINALIGN allows that.
28 * Note that increasing this value may disable some debug features. 27 * Note that increasing this value may disable some debug features.
29 */ 28 */
29#ifdef ARCH_DMA_MINALIGN
30#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
31#else
30#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 32#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
31#endif 33#endif
32 34
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 62667f72c2ef..4382db09df4f 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,7 +1,9 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifndef ARCH_KMALLOC_MINALIGN 4#ifdef ARCH_DMA_MINALIGN
5#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
6#else
5#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) 7#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
6#endif 8#endif
7 9
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5ec4bc0e45aa..9f63538928c0 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -106,15 +106,17 @@ struct kmem_cache {
106/* 106/*
107 * Kmalloc subsystem. 107 * Kmalloc subsystem.
108 */ 108 */
109#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 109#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
110#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN 110#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
111#else 111#else
112#define KMALLOC_MIN_SIZE 8 112#define KMALLOC_MIN_SIZE 8
113#endif 113#endif
114 114
115#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 115#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
116 116
117#ifndef ARCH_KMALLOC_MINALIGN 117#ifdef ARCH_DMA_MINALIGN
118#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
119#else
118#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 120#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
119#endif 121#endif
120 122
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
index 34af0a3477bf..bcaa2f762cc1 100644
--- a/include/linux/spi/max7301.h
+++ b/include/linux/spi/max7301.h
@@ -11,6 +11,7 @@ struct max7301 {
11 struct mutex lock; 11 struct mutex lock;
12 u8 port_config[8]; /* field 0 is unused */ 12 u8 port_config[8]; /* field 0 is unused */
13 u32 out_level; /* cached output levels */ 13 u32 out_level; /* cached output levels */
14 u32 input_pullup_active;
14 struct gpio_chip chip; 15 struct gpio_chip chip;
15 struct device *dev; 16 struct device *dev;
16 int (*write)(struct device *dev, unsigned int reg, unsigned int val); 17 int (*write)(struct device *dev, unsigned int reg, unsigned int val);
@@ -20,6 +21,13 @@ struct max7301 {
20struct max7301_platform_data { 21struct max7301_platform_data {
21 /* number assigned to the first GPIO */ 22 /* number assigned to the first GPIO */
22 unsigned base; 23 unsigned base;
24 /*
25 * bitmask controlling the pullup configuration,
26 *
27 * _note_ the 4 lowest bits are unused, because the first 4
28 * ports of the controller are not used, too.
29 */
30 u32 input_pullup_active;
23}; 31};
24 32
25extern int __max730x_remove(struct device *dev); 33extern int __max730x_remove(struct device *dev);
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index af56071b06f9..92e52a1e6af3 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -213,6 +213,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
213 * @dma_alignment: SPI controller constraint on DMA buffers alignment. 213 * @dma_alignment: SPI controller constraint on DMA buffers alignment.
214 * @mode_bits: flags understood by this controller driver 214 * @mode_bits: flags understood by this controller driver
215 * @flags: other constraints relevant to this driver 215 * @flags: other constraints relevant to this driver
216 * @bus_lock_spinlock: spinlock for SPI bus locking
217 * @bus_lock_mutex: mutex for SPI bus locking
218 * @bus_lock_flag: indicates that the SPI bus is locked for exclusive use
216 * @setup: updates the device mode and clocking records used by a 219 * @setup: updates the device mode and clocking records used by a
217 * device's SPI controller; protocol code may call this. This 220 * device's SPI controller; protocol code may call this. This
218 * must fail if an unrecognized or unsupported mode is requested. 221 * must fail if an unrecognized or unsupported mode is requested.
@@ -262,6 +265,13 @@ struct spi_master {
262#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ 265#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
263#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ 266#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
264 267
268 /* lock and mutex for SPI bus locking */
269 spinlock_t bus_lock_spinlock;
270 struct mutex bus_lock_mutex;
271
272 /* flag indicating that the SPI bus is locked for exclusive use */
273 bool bus_lock_flag;
274
265 /* Setup mode and clock, etc (spi driver may call many times). 275 /* Setup mode and clock, etc (spi driver may call many times).
266 * 276 *
267 * IMPORTANT: this may be called when transfers to another 277 * IMPORTANT: this may be called when transfers to another
@@ -542,6 +552,8 @@ static inline void spi_message_free(struct spi_message *m)
542 552
543extern int spi_setup(struct spi_device *spi); 553extern int spi_setup(struct spi_device *spi);
544extern int spi_async(struct spi_device *spi, struct spi_message *message); 554extern int spi_async(struct spi_device *spi, struct spi_message *message);
555extern int spi_async_locked(struct spi_device *spi,
556 struct spi_message *message);
545 557
546/*---------------------------------------------------------------------------*/ 558/*---------------------------------------------------------------------------*/
547 559
@@ -551,6 +563,9 @@ extern int spi_async(struct spi_device *spi, struct spi_message *message);
551 */ 563 */
552 564
553extern int spi_sync(struct spi_device *spi, struct spi_message *message); 565extern int spi_sync(struct spi_device *spi, struct spi_message *message);
566extern int spi_sync_locked(struct spi_device *spi, struct spi_message *message);
567extern int spi_bus_lock(struct spi_master *master);
568extern int spi_bus_unlock(struct spi_master *master);
554 569
555/** 570/**
556 * spi_write - SPI synchronous write 571 * spi_write - SPI synchronous write
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
index ca6782ee4b9f..369b3d7d5b95 100644
--- a/include/linux/spi/spi_gpio.h
+++ b/include/linux/spi/spi_gpio.h
@@ -29,11 +29,16 @@
29 * SPI_GPIO_NO_CHIPSELECT to the controller_data: 29 * SPI_GPIO_NO_CHIPSELECT to the controller_data:
30 * .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT; 30 * .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT;
31 * 31 *
32 * If the MISO or MOSI pin is not available then it should be set to
33 * SPI_GPIO_NO_MISO or SPI_GPIO_NO_MOSI.
34 *
32 * If the bitbanged bus is later switched to a "native" controller, 35 * If the bitbanged bus is later switched to a "native" controller,
33 * that platform_device and controller_data should be removed. 36 * that platform_device and controller_data should be removed.
34 */ 37 */
35 38
36#define SPI_GPIO_NO_CHIPSELECT ((unsigned long)-1l) 39#define SPI_GPIO_NO_CHIPSELECT ((unsigned long)-1l)
40#define SPI_GPIO_NO_MISO ((unsigned long)-1l)
41#define SPI_GPIO_NO_MOSI ((unsigned long)-1l)
37 42
38/** 43/**
39 * struct spi_gpio_platform_data - parameter for bitbanged SPI master 44 * struct spi_gpio_platform_data - parameter for bitbanged SPI master
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index b34cc829f98d..0166d320a75d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -2,7 +2,6 @@
2#define _LINUX_STATFS_H 2#define _LINUX_STATFS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5
6#include <asm/statfs.h> 5#include <asm/statfs.h>
7 6
8struct kstatfs { 7struct kstatfs {
@@ -16,7 +15,29 @@ struct kstatfs {
16 __kernel_fsid_t f_fsid; 15 __kernel_fsid_t f_fsid;
17 long f_namelen; 16 long f_namelen;
18 long f_frsize; 17 long f_frsize;
19 long f_spare[5]; 18 long f_flags;
19 long f_spare[4];
20}; 20};
21 21
22/*
23 * Definitions for the flag in f_flag.
24 *
25 * Generally these flags are equivalent to the MS_ flags used in the mount
26 * ABI. The exception is ST_VALID which has the same value as MS_REMOUNT
27 * which doesn't make any sense for statfs.
28 */
29#define ST_RDONLY 0x0001 /* mount read-only */
30#define ST_NOSUID 0x0002 /* ignore suid and sgid bits */
31#define ST_NODEV 0x0004 /* disallow access to device special files */
32#define ST_NOEXEC 0x0008 /* disallow program execution */
33#define ST_SYNCHRONOUS 0x0010 /* writes are synced at once */
34#define ST_VALID 0x0020 /* f_flags support is implemented */
35#define ST_MANDLOCK 0x0040 /* allow mandatory locks on an FS */
36/* 0x0080 used for ST_WRITE in glibc */
37/* 0x0100 used for ST_APPEND in glibc */
38/* 0x0200 used for ST_IMMUTABLE in glibc */
39#define ST_NOATIME 0x0400 /* do not update access times */
40#define ST_NODIRATIME 0x0800 /* do not update directory access times */
41#define ST_RELATIME 0x1000 /* update atime relative to mtime/ctime */
42
22#endif 43#endif
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
index fb438f158eee..98df21164a86 100644
--- a/include/linux/sunrpc/Kbuild
+++ b/include/linux/sunrpc/Kbuild
@@ -1 +1 @@
unifdef-y += debug.h header-y += debug.h
diff --git a/include/linux/swap.h b/include/linux/swap.h
index ff4acea9bbdb..2fee51a11b73 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -244,8 +244,7 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
244extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 244extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
245 gfp_t gfp_mask, bool noswap, 245 gfp_t gfp_mask, bool noswap,
246 unsigned int swappiness, 246 unsigned int swappiness,
247 struct zone *zone, 247 struct zone *zone);
248 int nid);
249extern int __isolate_lru_page(struct page *page, int mode, int file); 248extern int __isolate_lru_page(struct page *page, int mode, int file);
250extern unsigned long shrink_all_memory(unsigned long nr_pages); 249extern unsigned long shrink_all_memory(unsigned long nr_pages);
251extern int vm_swappiness; 250extern int vm_swappiness;
@@ -316,7 +315,6 @@ extern long nr_swap_pages;
316extern long total_swap_pages; 315extern long total_swap_pages;
317extern void si_swapinfo(struct sysinfo *); 316extern void si_swapinfo(struct sysinfo *);
318extern swp_entry_t get_swap_page(void); 317extern swp_entry_t get_swap_page(void);
319extern swp_entry_t get_swap_page_of_type(int);
320extern int valid_swaphandles(swp_entry_t, unsigned long *); 318extern int valid_swaphandles(swp_entry_t, unsigned long *);
321extern int add_swap_count_continuation(swp_entry_t, gfp_t); 319extern int add_swap_count_continuation(swp_entry_t, gfp_t);
322extern void swap_shmem_alloc(swp_entry_t); 320extern void swap_shmem_alloc(swp_entry_t);
@@ -333,6 +331,13 @@ extern int reuse_swap_page(struct page *);
333extern int try_to_free_swap(struct page *); 331extern int try_to_free_swap(struct page *);
334struct backing_dev_info; 332struct backing_dev_info;
335 333
334#ifdef CONFIG_HIBERNATION
335void hibernation_freeze_swap(void);
336void hibernation_thaw_swap(void);
337swp_entry_t get_swap_for_hibernation(int type);
338void swap_free_for_hibernation(swp_entry_t val);
339#endif
340
336/* linux/mm/thrash.c */ 341/* linux/mm/thrash.c */
337extern struct mm_struct *swap_token_mm; 342extern struct mm_struct *swap_token_mm;
338extern void grab_swap_token(struct mm_struct *); 343extern void grab_swap_token(struct mm_struct *);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a6bfd1367d2a..e6319d18a55d 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -35,6 +35,7 @@ struct oldold_utsname;
35struct old_utsname; 35struct old_utsname;
36struct pollfd; 36struct pollfd;
37struct rlimit; 37struct rlimit;
38struct rlimit64;
38struct rusage; 39struct rusage;
39struct sched_param; 40struct sched_param;
40struct sel_arg_struct; 41struct sel_arg_struct;
@@ -393,7 +394,7 @@ asmlinkage long sys_umount(char __user *name, int flags);
393asmlinkage long sys_oldumount(char __user *name); 394asmlinkage long sys_oldumount(char __user *name);
394asmlinkage long sys_truncate(const char __user *path, long length); 395asmlinkage long sys_truncate(const char __user *path, long length);
395asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 396asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
396asmlinkage long sys_stat(char __user *filename, 397asmlinkage long sys_stat(const char __user *filename,
397 struct __old_kernel_stat __user *statbuf); 398 struct __old_kernel_stat __user *statbuf);
398asmlinkage long sys_statfs(const char __user * path, 399asmlinkage long sys_statfs(const char __user * path,
399 struct statfs __user *buf); 400 struct statfs __user *buf);
@@ -402,21 +403,21 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz,
402asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf); 403asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user *buf);
403asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, 404asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz,
404 struct statfs64 __user *buf); 405 struct statfs64 __user *buf);
405asmlinkage long sys_lstat(char __user *filename, 406asmlinkage long sys_lstat(const char __user *filename,
406 struct __old_kernel_stat __user *statbuf); 407 struct __old_kernel_stat __user *statbuf);
407asmlinkage long sys_fstat(unsigned int fd, 408asmlinkage long sys_fstat(unsigned int fd,
408 struct __old_kernel_stat __user *statbuf); 409 struct __old_kernel_stat __user *statbuf);
409asmlinkage long sys_newstat(char __user *filename, 410asmlinkage long sys_newstat(const char __user *filename,
410 struct stat __user *statbuf); 411 struct stat __user *statbuf);
411asmlinkage long sys_newlstat(char __user *filename, 412asmlinkage long sys_newlstat(const char __user *filename,
412 struct stat __user *statbuf); 413 struct stat __user *statbuf);
413asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf); 414asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf);
414asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf); 415asmlinkage long sys_ustat(unsigned dev, struct ustat __user *ubuf);
415#if BITS_PER_LONG == 32 416#if BITS_PER_LONG == 32
416asmlinkage long sys_stat64(char __user *filename, 417asmlinkage long sys_stat64(const char __user *filename,
417 struct stat64 __user *statbuf); 418 struct stat64 __user *statbuf);
418asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf); 419asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user *statbuf);
419asmlinkage long sys_lstat64(char __user *filename, 420asmlinkage long sys_lstat64(const char __user *filename,
420 struct stat64 __user *statbuf); 421 struct stat64 __user *statbuf);
421asmlinkage long sys_truncate64(const char __user *path, loff_t length); 422asmlinkage long sys_truncate64(const char __user *path, loff_t length);
422asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); 423asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
@@ -644,6 +645,9 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
644#endif 645#endif
645asmlinkage long sys_setrlimit(unsigned int resource, 646asmlinkage long sys_setrlimit(unsigned int resource,
646 struct rlimit __user *rlim); 647 struct rlimit __user *rlim);
648asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
649 const struct rlimit64 __user *new_rlim,
650 struct rlimit64 __user *old_rlim);
647asmlinkage long sys_getrusage(int who, struct rusage __user *ru); 651asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
648asmlinkage long sys_umask(int mask); 652asmlinkage long sys_umask(int mask);
649 653
@@ -756,7 +760,7 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
756 int newdfd, const char __user *newname, int flags); 760 int newdfd, const char __user *newname, int flags);
757asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 761asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
758 int newdfd, const char __user * newname); 762 int newdfd, const char __user * newname);
759asmlinkage long sys_futimesat(int dfd, char __user *filename, 763asmlinkage long sys_futimesat(int dfd, const char __user *filename,
760 struct timeval __user *utimes); 764 struct timeval __user *utimes);
761asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 765asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
762asmlinkage long sys_fchmodat(int dfd, const char __user * filename, 766asmlinkage long sys_fchmodat(int dfd, const char __user * filename,
@@ -765,13 +769,13 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
765 gid_t group, int flag); 769 gid_t group, int flag);
766asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 770asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
767 int mode); 771 int mode);
768asmlinkage long sys_newfstatat(int dfd, char __user *filename, 772asmlinkage long sys_newfstatat(int dfd, const char __user *filename,
769 struct stat __user *statbuf, int flag); 773 struct stat __user *statbuf, int flag);
770asmlinkage long sys_fstatat64(int dfd, char __user *filename, 774asmlinkage long sys_fstatat64(int dfd, const char __user *filename,
771 struct stat64 __user *statbuf, int flag); 775 struct stat64 __user *statbuf, int flag);
772asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf, 776asmlinkage long sys_readlinkat(int dfd, const char __user *path, char __user *buf,
773 int bufsiz); 777 int bufsiz);
774asmlinkage long sys_utimensat(int dfd, char __user *filename, 778asmlinkage long sys_utimensat(int dfd, const char __user *filename,
775 struct timespec __user *utimes, int flags); 779 struct timespec __user *utimes, int flags);
776asmlinkage long sys_unshare(unsigned long unshare_flags); 780asmlinkage long sys_unshare(unsigned long unshare_flags);
777 781
@@ -811,8 +815,12 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
811asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 815asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
812 struct timespec __user *, const sigset_t __user *, 816 struct timespec __user *, const sigset_t __user *,
813 size_t); 817 size_t);
818asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
819asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd,
821 const char __user *pathname);
814 822
815int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
816 824
817 825
818asmlinkage long sys_perf_event_open( 826asmlinkage long sys_perf_event_open(
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h
index 96411306eec6..e47d6d90023d 100644
--- a/include/linux/sysv_fs.h
+++ b/include/linux/sysv_fs.h
@@ -148,6 +148,17 @@ struct v7_super_block {
148 char s_fname[6]; /* file system name */ 148 char s_fname[6]; /* file system name */
149 char s_fpack[6]; /* file system pack name */ 149 char s_fpack[6]; /* file system pack name */
150}; 150};
151/* Constants to aid sanity checking */
152/* This is not a hard limit, nor enforced by v7 kernel. It's actually just
153 * the limit used by Seventh Edition's ls, though is high enough to assume
154 * that no reasonable file system would have that much entries in root
155 * directory. Thus, if we see anything higher, we just probably got the
156 * endiannes wrong. */
157#define V7_NFILES 1024
158/* The disk addresses are three-byte (despite direct block addresses being
159 * aligned word-wise in inode). If the most significant byte is non-zero,
160 * something is most likely wrong (not a filesystem, bad bytesex). */
161#define V7_MAXSIZE 0x00ffffff
151 162
152/* Coherent super-block data on disk */ 163/* Coherent super-block data on disk */
153#define COH_NICINOD 100 /* number of inode cache entries */ 164#define COH_NICINOD 100 /* number of inode cache entries */
diff --git a/include/linux/time.h b/include/linux/time.h
index cb34e35fabac..9f15ac7ab92a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -38,7 +38,7 @@ extern struct timezone sys_tz;
38#define NSEC_PER_MSEC 1000000L 38#define NSEC_PER_MSEC 1000000L
39#define USEC_PER_SEC 1000000L 39#define USEC_PER_SEC 1000000L
40#define NSEC_PER_SEC 1000000000L 40#define NSEC_PER_SEC 1000000000L
41#define FSEC_PER_SEC 1000000000000000L 41#define FSEC_PER_SEC 1000000000000000LL
42 42
43#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 43#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
44 44
@@ -150,7 +150,7 @@ extern void do_gettimeofday(struct timeval *tv);
150extern int do_settimeofday(struct timespec *tv); 150extern int do_settimeofday(struct timespec *tv);
151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
153extern long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags); 153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
154struct itimerval; 154struct itimerval;
155extern int do_setitimer(int which, struct itimerval *value, 155extern int do_setitimer(int which, struct itimerval *value,
156 struct itimerval *ovalue); 156 struct itimerval *ovalue);
diff --git a/include/linux/topology.h b/include/linux/topology.h
index b572e432d2f3..64e084ff5e5c 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -292,10 +292,6 @@ static inline void set_cpu_numa_mem(int cpu, int node)
292 292
293#else /* !CONFIG_HAVE_MEMORYLESS_NODES */ 293#else /* !CONFIG_HAVE_MEMORYLESS_NODES */
294 294
295static inline void set_numa_mem(int node) {}
296
297static inline void set_cpu_numa_mem(int cpu, int node) {}
298
299#ifndef numa_mem_id 295#ifndef numa_mem_id
300/* Returns the number of the nearest Node with memory */ 296/* Returns the number of the nearest Node with memory */
301static inline int numa_mem_id(void) 297static inline int numa_mem_id(void)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 7802a243ee13..67d64e6efe7a 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,6 +13,7 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/system.h> 18#include <asm/system.h>
18 19
@@ -179,6 +180,7 @@ struct tty_bufhead {
179#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) 180#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
180#define L_PENDIN(tty) _L_FLAG((tty), PENDIN) 181#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
181#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) 182#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
183#define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
182 184
183struct device; 185struct device;
184struct signal_struct; 186struct signal_struct;
@@ -327,6 +329,13 @@ struct tty_struct {
327 struct tty_port *port; 329 struct tty_port *port;
328}; 330};
329 331
332/* Each of a tty's open files has private_data pointing to tty_file_private */
333struct tty_file_private {
334 struct tty_struct *tty;
335 struct file *file;
336 struct list_head list;
337};
338
330/* tty magic number */ 339/* tty magic number */
331#define TTY_MAGIC 0x5401 340#define TTY_MAGIC 0x5401
332 341
@@ -415,6 +424,7 @@ extern int is_ignored(int sig);
415extern int tty_signal(int sig, struct tty_struct *tty); 424extern int tty_signal(int sig, struct tty_struct *tty);
416extern void tty_hangup(struct tty_struct *tty); 425extern void tty_hangup(struct tty_struct *tty);
417extern void tty_vhangup(struct tty_struct *tty); 426extern void tty_vhangup(struct tty_struct *tty);
427extern void tty_vhangup_locked(struct tty_struct *tty);
418extern void tty_vhangup_self(void); 428extern void tty_vhangup_self(void);
419extern void tty_unhangup(struct file *filp); 429extern void tty_unhangup(struct file *filp);
420extern int tty_hung_up_p(struct file *filp); 430extern int tty_hung_up_p(struct file *filp);
@@ -455,6 +465,7 @@ extern void proc_clear_tty(struct task_struct *p);
455extern struct tty_struct *get_current_tty(void); 465extern struct tty_struct *get_current_tty(void);
456extern void tty_default_fops(struct file_operations *fops); 466extern void tty_default_fops(struct file_operations *fops);
457extern struct tty_struct *alloc_tty_struct(void); 467extern struct tty_struct *alloc_tty_struct(void);
468extern void tty_add_file(struct tty_struct *tty, struct file *file);
458extern void free_tty_struct(struct tty_struct *tty); 469extern void free_tty_struct(struct tty_struct *tty);
459extern void initialize_tty_struct(struct tty_struct *tty, 470extern void initialize_tty_struct(struct tty_struct *tty,
460 struct tty_driver *driver, int idx); 471 struct tty_driver *driver, int idx);
@@ -467,6 +478,7 @@ extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
467extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); 478extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
468 479
469extern struct mutex tty_mutex; 480extern struct mutex tty_mutex;
481extern spinlock_t tty_files_lock;
470 482
471extern void tty_write_unlock(struct tty_struct *tty); 483extern void tty_write_unlock(struct tty_struct *tty);
472extern int tty_write_lock(struct tty_struct *tty, int ndelay); 484extern int tty_write_lock(struct tty_struct *tty, int ndelay);
@@ -575,5 +587,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file,
575extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 587extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
576 unsigned int cmd, unsigned long arg); 588 unsigned int cmd, unsigned long arg);
577 589
590/* tty_mutex.c */
591/* functions for preparation of BKL removal */
592extern void __lockfunc tty_lock(void) __acquires(tty_lock);
593extern void __lockfunc tty_unlock(void) __releases(tty_lock);
594extern struct task_struct *__big_tty_mutex_owner;
595#define tty_locked() (current == __big_tty_mutex_owner)
596
597/*
598 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
599 *
600 * The condition we are waiting for might take a long time to
601 * become true, or might depend on another thread taking the
602 * BTM. In either case, we need to drop the BTM to guarantee
603 * forward progress. This is a leftover from the conversion
604 * from the BKL and should eventually get removed as the BTM
605 * falls out of use.
606 *
607 * Do not use in new code.
608 */
609#define wait_event_interruptible_tty(wq, condition) \
610({ \
611 int __ret = 0; \
612 if (!(condition)) { \
613 __wait_event_interruptible_tty(wq, condition, __ret); \
614 } \
615 __ret; \
616})
617
618#define __wait_event_interruptible_tty(wq, condition, ret) \
619do { \
620 DEFINE_WAIT(__wait); \
621 \
622 for (;;) { \
623 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
624 if (condition) \
625 break; \
626 if (!signal_pending(current)) { \
627 tty_unlock(); \
628 schedule(); \
629 tty_lock(); \
630 continue; \
631 } \
632 ret = -ERESTARTSYS; \
633 break; \
634 } \
635 finish_wait(&wq, &__wait); \
636} while (0)
637
638
578#endif /* __KERNEL__ */ 639#endif /* __KERNEL__ */
579#endif 640#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d5922a877994..35fe6ab222bb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -127,6 +127,8 @@ enum usb_interface_condition {
127 * queued reset so that usb_cancel_queued_reset() doesn't try to 127 * queued reset so that usb_cancel_queued_reset() doesn't try to
128 * remove from the workqueue when running inside the worker 128 * remove from the workqueue when running inside the worker
129 * thread. See __usb_queue_reset_device(). 129 * thread. See __usb_queue_reset_device().
130 * @resetting_device: USB core reset the device, so use alt setting 0 as
131 * current; needs bandwidth alloc after reset.
130 * 132 *
131 * USB device drivers attach to interfaces on a physical device. Each 133 * USB device drivers attach to interfaces on a physical device. Each
132 * interface encapsulates a single high level function, such as feeding 134 * interface encapsulates a single high level function, such as feeding
@@ -843,7 +845,7 @@ struct usb_driver {
843 845
844 void (*disconnect) (struct usb_interface *intf); 846 void (*disconnect) (struct usb_interface *intf);
845 847
846 int (*ioctl) (struct usb_interface *intf, unsigned int code, 848 int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
847 void *buf); 849 void *buf);
848 850
849 int (*suspend) (struct usb_interface *intf, pm_message_t message); 851 int (*suspend) (struct usb_interface *intf, pm_message_t message);
@@ -1015,6 +1017,7 @@ typedef void (*usb_complete_t)(struct urb *);
1015 * is a different endpoint (and pipe) from "out" endpoint two. 1017 * is a different endpoint (and pipe) from "out" endpoint two.
1016 * The current configuration controls the existence, type, and 1018 * The current configuration controls the existence, type, and
1017 * maximum packet size of any given endpoint. 1019 * maximum packet size of any given endpoint.
1020 * @stream_id: the endpoint's stream ID for bulk streams
1018 * @dev: Identifies the USB device to perform the request. 1021 * @dev: Identifies the USB device to perform the request.
1019 * @status: This is read in non-iso completion functions to get the 1022 * @status: This is read in non-iso completion functions to get the
1020 * status of the particular request. ISO requests only use it 1023 * status of the particular request. ISO requests only use it
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 139353efad34..890bc1472190 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -276,6 +276,8 @@ struct usb_composite_driver {
276 int (*bind)(struct usb_composite_dev *); 276 int (*bind)(struct usb_composite_dev *);
277 int (*unbind)(struct usb_composite_dev *); 277 int (*unbind)(struct usb_composite_dev *);
278 278
279 void (*disconnect)(struct usb_composite_dev *);
280
279 /* global suspend hooks */ 281 /* global suspend hooks */
280 void (*suspend)(struct usb_composite_dev *); 282 void (*suspend)(struct usb_composite_dev *);
281 void (*resume)(struct usb_composite_dev *); 283 void (*resume)(struct usb_composite_dev *);
@@ -342,6 +344,10 @@ struct usb_composite_dev {
342}; 344};
343 345
344extern int usb_string_id(struct usb_composite_dev *c); 346extern int usb_string_id(struct usb_composite_dev *c);
347extern int usb_string_ids_tab(struct usb_composite_dev *c,
348 struct usb_string *str);
349extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
350
345 351
346/* messaging utils */ 352/* messaging utils */
347#define DBG(d, fmt, args...) \ 353#define DBG(d, fmt, args...) \
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 80287af2a738..2e262cb15425 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -39,6 +39,12 @@ struct ehci_caps {
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ 39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40 40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */ 41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42/* EHCI 1.1 addendum */
43#define HCC_32FRAME_PERIODIC_LIST(p) ((p)&(1 << 19))
44#define HCC_PER_PORT_CHANGE_EVENT(p) ((p)&(1 << 18))
45#define HCC_LPM(p) ((p)&(1 << 17))
46#define HCC_HW_PREFETCH(p) ((p)&(1 << 16))
47
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ 48#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ 49#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ 50#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
@@ -54,6 +60,13 @@ struct ehci_regs {
54 60
55 /* USBCMD: offset 0x00 */ 61 /* USBCMD: offset 0x00 */
56 u32 command; 62 u32 command;
63
64/* EHCI 1.1 addendum */
65#define CMD_HIRD (0xf<<24) /* host initiated resume duration */
66#define CMD_PPCEE (1<<15) /* per port change event enable */
67#define CMD_FSP (1<<14) /* fully synchronized prefetch */
68#define CMD_ASPE (1<<13) /* async schedule prefetch enable */
69#define CMD_PSPE (1<<12) /* periodic schedule prefetch enable */
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ 70/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */ 71#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ 72#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
@@ -67,6 +80,7 @@ struct ehci_regs {
67 80
68 /* USBSTS: offset 0x04 */ 81 /* USBSTS: offset 0x04 */
69 u32 status; 82 u32 status;
83#define STS_PPCE_MASK (0xff<<16) /* Per-Port change event 1-16 */
70#define STS_ASS (1<<15) /* Async Schedule Status */ 84#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */ 85#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */ 86#define STS_RECL (1<<13) /* Reclamation */
@@ -100,6 +114,14 @@ struct ehci_regs {
100 114
101 /* PORTSC: offset 0x44 */ 115 /* PORTSC: offset 0x44 */
102 u32 port_status[0]; /* up to N_PORTS */ 116 u32 port_status[0]; /* up to N_PORTS */
117/* EHCI 1.1 addendum */
118#define PORTSC_SUSPEND_STS_ACK 0
119#define PORTSC_SUSPEND_STS_NYET 1
120#define PORTSC_SUSPEND_STS_STALL 2
121#define PORTSC_SUSPEND_STS_ERR 3
122
123#define PORT_DEV_ADDR (0x7f<<25) /* device address */
124#define PORT_SSTS (0x3<<23) /* suspend status */
103/* 31:23 reserved */ 125/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 126#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
@@ -115,6 +137,7 @@ struct ehci_regs {
115#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ 137#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
116/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ 138/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
117/* 9 reserved */ 139/* 9 reserved */
140#define PORT_LPM (1<<9) /* LPM transaction */
118#define PORT_RESET (1<<8) /* reset port */ 141#define PORT_RESET (1<<8) /* reset port */
119#define PORT_SUSPEND (1<<7) /* suspend port */ 142#define PORT_SUSPEND (1<<7) /* suspend port */
120#define PORT_RESUME (1<<6) /* resume it */ 143#define PORT_RESUME (1<<6) /* resume it */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index a34a2a043b21..6f649c13193b 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -180,9 +180,9 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
180static void functionfs_unbind(struct ffs_data *ffs) 180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull)); 181 __attribute__((nonnull));
182 182
183static int functionfs_add(struct usb_composite_dev *cdev, 183static int functionfs_bind_config(struct usb_composite_dev *cdev,
184 struct usb_configuration *c, 184 struct usb_configuration *c,
185 struct ffs_data *ffs) 185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull)); 186 __attribute__((warn_unused_result, nonnull));
187 187
188 188
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 2e3a4ea1a3da..3b571f1ffbb3 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -89,18 +89,33 @@ struct usb_hcd {
89 */ 89 */
90 const struct hc_driver *driver; /* hw-specific hooks */ 90 const struct hc_driver *driver; /* hw-specific hooks */
91 91
92 /* Flags that need to be manipulated atomically */ 92 /* Flags that need to be manipulated atomically because they can
93 * change while the host controller is running. Always use
94 * set_bit() or clear_bit() to change their values.
95 */
93 unsigned long flags; 96 unsigned long flags;
94#define HCD_FLAG_HW_ACCESSIBLE 0x00000001 97#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
95#define HCD_FLAG_SAW_IRQ 0x00000002 98#define HCD_FLAG_SAW_IRQ 1
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
102
103 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit().
105 */
106#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
107#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
96 111
112 /* Flags that get set only during HCD registration or removal. */
97 unsigned rh_registered:1;/* is root hub registered? */ 113 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */
98 115
99 /* The next flag is a stopgap, to be removed when all the HCDs 116 /* The next flag is a stopgap, to be removed when all the HCDs
100 * support the new root-hub polling mechanism. */ 117 * support the new root-hub polling mechanism. */
101 unsigned uses_new_polling:1; 118 unsigned uses_new_polling:1;
102 unsigned poll_rh:1; /* poll for rh status? */
103 unsigned poll_pending:1; /* status has changed? */
104 unsigned wireless:1; /* Wireless USB HCD */ 119 unsigned wireless:1; /* Wireless USB HCD */
105 unsigned authorized_default:1; 120 unsigned authorized_default:1;
106 unsigned has_tt:1; /* Integrated TT in root hub */ 121 unsigned has_tt:1; /* Integrated TT in root hub */
@@ -198,7 +213,7 @@ struct hc_driver {
198 * a whole, not just the root hub; they're for PCI bus glue. 213 * a whole, not just the root hub; they're for PCI bus glue.
199 */ 214 */
200 /* called after suspending the hub, before entering D3 etc */ 215 /* called after suspending the hub, before entering D3 etc */
201 int (*pci_suspend)(struct usb_hcd *hcd); 216 int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
202 217
203 /* called after entering D0 (etc), before resuming the hub */ 218 /* called after entering D0 (etc), before resuming the hub */
204 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); 219 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
@@ -299,6 +314,10 @@ struct hc_driver {
299 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, 314 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
300 struct usb_tt *tt, gfp_t mem_flags); 315 struct usb_tt *tt, gfp_t mem_flags);
301 int (*reset_device)(struct usb_hcd *, struct usb_device *); 316 int (*reset_device)(struct usb_hcd *, struct usb_device *);
317 /* Notifies the HCD after a device is connected and its
318 * address is set
319 */
320 int (*update_device)(struct usb_hcd *, struct usb_device *);
302}; 321};
303 322
304extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 323extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f8302d036a76..545cba73ccaf 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,13 +43,6 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46#define USB_OTG_PULLUP_ID (1 << 0)
47#define USB_OTG_PULLDOWN_DP (1 << 1)
48#define USB_OTG_PULLDOWN_DM (1 << 2)
49#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
50#define USB_OTG_DRV_VBUS (1 << 4)
51#define USB_OTG_DRV_VBUS_EXT (1 << 5)
52
53struct otg_transceiver; 46struct otg_transceiver;
54 47
55/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
@@ -146,10 +139,10 @@ static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
146 return -EINVAL; 139 return -EINVAL;
147} 140}
148 141
149static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) 142static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg)
150{ 143{
151 if (otg->io_ops && otg->io_ops->write) 144 if (otg->io_ops && otg->io_ops->write)
152 return otg->io_ops->write(otg, reg, val); 145 return otg->io_ops->write(otg, val, reg);
153 146
154 return -EINVAL; 147 return -EINVAL;
155} 148}
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 16b7f3347545..3e93de7ecbc3 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -26,4 +26,8 @@
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28 28
29/* device needs a pause during initialization, after we read the device
30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040
32
29#endif /* __LINUX_USB_QUIRKS_H */ 33#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 2369d07c3c87..82b1507f4735 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -11,6 +11,42 @@
11#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
12#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
13 13
14#include <linux/usb/otg.h>
15/*-------------------------------------------------------------------------*/
16
17/*
18 * ULPI Flags
19 */
20#define ULPI_OTG_ID_PULLUP (1 << 0)
21#define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1)
22#define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2)
23#define ULPI_OTG_DISCHRGVBUS (1 << 3)
24#define ULPI_OTG_CHRGVBUS (1 << 4)
25#define ULPI_OTG_DRVVBUS (1 << 5)
26#define ULPI_OTG_DRVVBUS_EXT (1 << 6)
27#define ULPI_OTG_EXTVBUSIND (1 << 7)
28
29#define ULPI_IC_6PIN_SERIAL (1 << 8)
30#define ULPI_IC_3PIN_SERIAL (1 << 9)
31#define ULPI_IC_CARKIT (1 << 10)
32#define ULPI_IC_CLKSUSPM (1 << 11)
33#define ULPI_IC_AUTORESUME (1 << 12)
34#define ULPI_IC_EXTVBUS_INDINV (1 << 13)
35#define ULPI_IC_IND_PASSTHRU (1 << 14)
36#define ULPI_IC_PROTECT_DIS (1 << 15)
37
38#define ULPI_FC_HS (1 << 16)
39#define ULPI_FC_FS (1 << 17)
40#define ULPI_FC_LS (1 << 18)
41#define ULPI_FC_FS4LS (1 << 19)
42#define ULPI_FC_TERMSEL (1 << 20)
43#define ULPI_FC_OP_NORM (1 << 21)
44#define ULPI_FC_OP_NODRV (1 << 22)
45#define ULPI_FC_OP_DIS_NRZI (1 << 23)
46#define ULPI_FC_OP_NSYNC_NEOP (1 << 24)
47#define ULPI_FC_RST (1 << 25)
48#define ULPI_FC_SUSPM (1 << 26)
49
14/*-------------------------------------------------------------------------*/ 50/*-------------------------------------------------------------------------*/
15 51
16/* 52/*
@@ -58,6 +94,10 @@
58 94
59/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
60 96
97/*
98 * Register Bits
99 */
100
61/* Function Control */ 101/* Function Control */
62#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) 102#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
63#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) 103#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 814f294d4cd0..6228b5b77d35 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,7 +31,6 @@
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H 32#define LINUX_VGA_H
33 33
34#include <asm/vga.h>
35 34
36/* Legacy VGA regions */ 35/* Legacy VGA regions */
37#define VGA_RSRC_NONE 0x00 36#define VGA_RSRC_NONE 0x00
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 047f7e6edb86..61490c6dcdbd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -277,6 +277,7 @@ struct v4l2_pix_format {
277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
280#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
280#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
281#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
282#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 395c38a47adb..1faa80d92f05 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,6 +2,7 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h>
5#include <linux/virtio_ids.h> 6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
7#include <linux/types.h> 8#include <linux/types.h>
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index de05e96e0a70..01c2145118dc 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -7,6 +7,8 @@
7 7
8struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 8struct vm_area_struct; /* vma defining user mapping in mm_types.h */
9 9
10extern bool vmap_lazy_unmap;
11
10/* bits in flags of vmalloc's vm_struct below */ 12/* bits in flags of vmalloc's vm_struct below */
11#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
12#define VM_ALLOC 0x00000002 /* vmalloc() */ 14#define VM_ALLOC 0x00000002 /* vmalloc() */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 7f56db4a79f0..6625cc1ab758 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -76,17 +76,52 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 ((vc)->vc_toggle_meta ? 0x80 : 0)]) 77 ((vc)->vc_toggle_meta ? 0x80 : 0)])
78#else 78#else
79#define con_set_trans_old(arg) (0) 79static inline int con_set_trans_old(unsigned char __user *table)
80#define con_get_trans_old(arg) (-EINVAL) 80{
81#define con_set_trans_new(arg) (0) 81 return 0;
82#define con_get_trans_new(arg) (-EINVAL) 82}
83#define con_clear_unimap(vc, ui) (0) 83static inline int con_get_trans_old(unsigned char __user *table)
84#define con_set_unimap(vc, ct, list) (0) 84{
85#define con_set_default_unimap(vc) (0) 85 return -EINVAL;
86#define con_copy_unimap(d, s) (0) 86}
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL) 87static inline int con_set_trans_new(unsigned short __user *table)
88#define con_free_unimap(vc) do { ; } while (0) 88{
89#define con_protect_unimap(vc, rdonly) do { ; } while (0) 89 return 0;
90}
91static inline int con_get_trans_new(unsigned short __user *table)
92{
93 return -EINVAL;
94}
95static inline int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
96{
97 return 0;
98}
99static inline
100int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
101{
102 return 0;
103}
104static inline
105int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
106 struct unipair __user *list)
107{
108 return -EINVAL;
109}
110static inline int con_set_default_unimap(struct vc_data *vc)
111{
112 return 0;
113}
114static inline void con_free_unimap(struct vc_data *vc)
115{
116}
117static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
118{
119}
120static inline
121int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
122{
123 return 0;
124}
90 125
91#define vc_translate(vc, c) (c) 126#define vc_translate(vc, c) (c)
92#endif 127#endif
@@ -100,6 +135,13 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
100 int deflt); 135 int deflt);
101int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
102 137
138static inline bool vt_force_oops_output(struct vc_data *vc)
139{
140 if (oops_in_progress && vc->vc_panic_force_write)
141 return true;
142 return false;
143}
144
103/* 145/*
104 * vc_screen.c shares this temporary buffer with the console write code so that 146 * vc_screen.c shares this temporary buffer with the console write code so that
105 * we can easily avoid touching user space while holding the console spinlock. 147 * we can easily avoid touching user space while holding the console spinlock.
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
deleted file mode 100644
index a1d6419c2ff8..000000000000
--- a/include/linux/wm97xx_batt.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _LINUX_WM97XX_BAT_H
2#define _LINUX_WM97XX_BAT_H
3
4#include <linux/wm97xx.h>
5
6#warning This file will be removed soon, use wm97xx.h instead!
7
8#define wm97xx_batt_info wm97xx_batt_pdata
9
10#ifdef CONFIG_BATTERY_WM97XX
11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
12#else
13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
14#endif
15
16#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c24eca71e80c..72a5d647a5f2 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -124,8 +124,9 @@ struct ctl_table;
124int dirty_writeback_centisecs_handler(struct ctl_table *, int, 124int dirty_writeback_centisecs_handler(struct ctl_table *, int,
125 void __user *, size_t *, loff_t *); 125 void __user *, size_t *, loff_t *);
126 126
127void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, 127void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
128 unsigned long *pbdi_dirty, struct backing_dev_info *bdi); 128unsigned long bdi_dirty_limit(struct backing_dev_info *bdi,
129 unsigned long dirty);
129 130
130void page_writeback_init(void); 131void page_writeback_init(void);
131void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 132void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ebe8558b9b6..8d08ebfe20b7 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -19,6 +19,8 @@
19#ifndef CX2341X_H 19#ifndef CX2341X_H
20#define CX2341X_H 20#define CX2341X_H
21 21
22#include <media/v4l2-ctrls.h>
23
22enum cx2341x_port { 24enum cx2341x_port {
23 CX2341X_PORT_MEMORY = 0, 25 CX2341X_PORT_MEMORY = 0,
24 CX2341X_PORT_STREAMING = 1, 26 CX2341X_PORT_STREAMING = 1,
@@ -99,6 +101,101 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
99void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); 101void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
100void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); 102void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix);
101 103
104struct cx2341x_handler;
105
106struct cx2341x_handler_ops {
107 /* needed for the video clock freq */
108 int (*s_audio_sampling_freq)(struct cx2341x_handler *hdl, u32 val);
109 /* needed for dualwatch */
110 int (*s_audio_mode)(struct cx2341x_handler *hdl, u32 val);
111 /* needed for setting up the video resolution */
112 int (*s_video_encoding)(struct cx2341x_handler *hdl, u32 val);
113 /* needed for setting up the sliced vbi insertion data structures */
114 int (*s_stream_vbi_fmt)(struct cx2341x_handler *hdl, u32 val);
115};
116
117struct cx2341x_handler {
118 u32 capabilities;
119 enum cx2341x_port port;
120 u16 width;
121 u16 height;
122 u16 is_50hz;
123 u32 audio_properties;
124
125 struct v4l2_ctrl_handler hdl;
126 void *priv;
127 cx2341x_mbox_func func;
128 const struct cx2341x_handler_ops *ops;
129
130 struct v4l2_ctrl *stream_vbi_fmt;
131
132 struct {
133 /* audio cluster */
134 struct v4l2_ctrl *audio_sampling_freq;
135 struct v4l2_ctrl *audio_encoding;
136 struct v4l2_ctrl *audio_l2_bitrate;
137 struct v4l2_ctrl *audio_mode;
138 struct v4l2_ctrl *audio_mode_extension;
139 struct v4l2_ctrl *audio_emphasis;
140 struct v4l2_ctrl *audio_crc;
141 struct v4l2_ctrl *audio_ac3_bitrate;
142 };
143
144 struct {
145 /* video gop cluster */
146 struct v4l2_ctrl *video_b_frames;
147 struct v4l2_ctrl *video_gop_size;
148 };
149
150 struct {
151 /* stream type cluster */
152 struct v4l2_ctrl *stream_type;
153 struct v4l2_ctrl *video_encoding;
154 struct v4l2_ctrl *video_bitrate_mode;
155 struct v4l2_ctrl *video_bitrate;
156 struct v4l2_ctrl *video_bitrate_peak;
157 };
158
159 struct {
160 /* video mute cluster */
161 struct v4l2_ctrl *video_mute;
162 struct v4l2_ctrl *video_mute_yuv;
163 };
164
165 struct {
166 /* video filter mode cluster */
167 struct v4l2_ctrl *video_spatial_filter_mode;
168 struct v4l2_ctrl *video_temporal_filter_mode;
169 struct v4l2_ctrl *video_median_filter_type;
170 };
171
172 struct {
173 /* video filter type cluster */
174 struct v4l2_ctrl *video_luma_spatial_filter_type;
175 struct v4l2_ctrl *video_chroma_spatial_filter_type;
176 };
177
178 struct {
179 /* video filter cluster */
180 struct v4l2_ctrl *video_spatial_filter;
181 struct v4l2_ctrl *video_temporal_filter;
182 };
183
184 struct {
185 /* video median cluster */
186 struct v4l2_ctrl *video_luma_median_filter_top;
187 struct v4l2_ctrl *video_luma_median_filter_bottom;
188 struct v4l2_ctrl *video_chroma_median_filter_top;
189 struct v4l2_ctrl *video_chroma_median_filter_bottom;
190 };
191};
192
193int cx2341x_handler_init(struct cx2341x_handler *cxhdl,
194 unsigned nr_of_controls_hint);
195void cx2341x_handler_set_50hz(struct cx2341x_handler *cxhdl, int is_50hz);
196int cx2341x_handler_setup(struct cx2341x_handler *cxhdl);
197void cx2341x_handler_set_busy(struct cx2341x_handler *cxhdl, int busy);
198
102/* Firmware names */ 199/* Firmware names */
103#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" 200#define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"
104/* Decoder firmware for the cx23415 only */ 201/* Decoder firmware for the cx23415 only */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 0b0cb1776796..46d1a141208e 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -97,4 +97,91 @@ enum cx25840_audio_input {
97 CX25840_AUDIO8, 97 CX25840_AUDIO8,
98}; 98};
99 99
100enum cx25840_io_pin {
101 CX25840_PIN_DVALID_PRGM0 = 0,
102 CX25840_PIN_FIELD_PRGM1,
103 CX25840_PIN_HRESET_PRGM2,
104 CX25840_PIN_VRESET_HCTL_PRGM3,
105 CX25840_PIN_IRQ_N_PRGM4,
106 CX25840_PIN_IR_TX_PRGM6,
107 CX25840_PIN_IR_RX_PRGM5,
108 CX25840_PIN_GPIO0_PRGM8,
109 CX25840_PIN_GPIO1_PRGM9,
110 CX25840_PIN_SA_SDIN, /* Alternate GP Input only */
111 CX25840_PIN_SA_SDOUT, /* Alternate GP Input only */
112 CX25840_PIN_PLL_CLK_PRGM7,
113 CX25840_PIN_CHIP_SEL_VIPCLK, /* Output only */
114};
115
116enum cx25840_io_pad {
117 /* Output pads */
118 CX25840_PAD_DEFAULT = 0,
119 CX25840_PAD_ACTIVE,
120 CX25840_PAD_VACTIVE,
121 CX25840_PAD_CBFLAG,
122 CX25840_PAD_VID_DATA_EXT0,
123 CX25840_PAD_VID_DATA_EXT1,
124 CX25840_PAD_GPO0,
125 CX25840_PAD_GPO1,
126 CX25840_PAD_GPO2,
127 CX25840_PAD_GPO3,
128 CX25840_PAD_IRQ_N,
129 CX25840_PAD_AC_SYNC,
130 CX25840_PAD_AC_SDOUT,
131 CX25840_PAD_PLL_CLK,
132 CX25840_PAD_VRESET,
133 CX25840_PAD_RESERVED,
134 /* Pads for PLL_CLK output only */
135 CX25840_PAD_XTI_X5_DLL,
136 CX25840_PAD_AUX_PLL,
137 CX25840_PAD_VID_PLL,
138 CX25840_PAD_XTI,
139 /* Input Pads */
140 CX25840_PAD_GPI0,
141 CX25840_PAD_GPI1,
142 CX25840_PAD_GPI2,
143 CX25840_PAD_GPI3,
144};
145
146enum cx25840_io_pin_strength {
147 CX25840_PIN_DRIVE_MEDIUM = 0,
148 CX25840_PIN_DRIVE_SLOW,
149 CX25840_PIN_DRIVE_FAST,
150};
151
152enum cx23885_io_pin {
153 CX23885_PIN_IR_RX_GPIO19,
154 CX23885_PIN_IR_TX_GPIO20,
155 CX23885_PIN_I2S_SDAT_GPIO21,
156 CX23885_PIN_I2S_WCLK_GPIO22,
157 CX23885_PIN_I2S_BCLK_GPIO23,
158 CX23885_PIN_IRQ_N_GPIO16,
159};
160
161enum cx23885_io_pad {
162 CX23885_PAD_IR_RX,
163 CX23885_PAD_GPIO19,
164 CX23885_PAD_IR_TX,
165 CX23885_PAD_GPIO20,
166 CX23885_PAD_I2S_SDAT,
167 CX23885_PAD_GPIO21,
168 CX23885_PAD_I2S_WCLK,
169 CX23885_PAD_GPIO22,
170 CX23885_PAD_I2S_BCLK,
171 CX23885_PAD_GPIO23,
172 CX23885_PAD_IRQ_N,
173 CX23885_PAD_GPIO16,
174};
175
176/* pvr150_workaround activates a workaround for a hardware bug that is
177 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
178 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
179 audio autodetect fails on some channels for these models and the workaround
180 is to select the audio standard explicitly. Many thanks to Hauppauge for
181 providing this information.
182 This platform data only needs to be supplied by the ivtv driver. */
183struct cx25840_platform_data {
184 int pvr150_workaround;
185};
186
100#endif 187#endif
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index 513e60dd1010..eb7fddf8f607 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -41,6 +41,11 @@ enum rc_driver_type {
41 * anything with it. Yet, as the same keycode table can be used with other 41 * anything with it. Yet, as the same keycode table can be used with other
42 * devices, a mask is provided to allow its usage. Drivers should generally 42 * devices, a mask is provided to allow its usage. Drivers should generally
43 * leave this field in blank 43 * leave this field in blank
44 * @timeout: optional time after which device stops sending data
45 * @min_timeout: minimum timeout supported by device
46 * @max_timeout: maximum timeout supported by device
47 * @rx_resolution : resolution (in ns) of input sampler
48 * @tx_resolution: resolution (in ns) of output sampler
44 * @priv: driver-specific data, to be used on the callbacks 49 * @priv: driver-specific data, to be used on the callbacks
45 * @change_protocol: allow changing the protocol used on hardware decoders 50 * @change_protocol: allow changing the protocol used on hardware decoders
46 * @open: callback to allow drivers to enable polling/irq when IR input device 51 * @open: callback to allow drivers to enable polling/irq when IR input device
@@ -49,19 +54,36 @@ enum rc_driver_type {
49 * is opened. 54 * is opened.
50 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) 55 * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs)
51 * @s_tx_carrier: set transmit carrier frequency 56 * @s_tx_carrier: set transmit carrier frequency
57 * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%)
58 * @s_rx_carrier: inform driver about carrier it is expected to handle
52 * @tx_ir: transmit IR 59 * @tx_ir: transmit IR
60 * @s_idle: optional: enable/disable hardware idle mode, upon which,
61 device doesn't interrupt host until it sees IR pulses
62 * @s_learning_mode: enable wide band receiver used for learning
53 */ 63 */
54struct ir_dev_props { 64struct ir_dev_props {
55 enum rc_driver_type driver_type; 65 enum rc_driver_type driver_type;
56 unsigned long allowed_protos; 66 unsigned long allowed_protos;
57 u32 scanmask; 67 u32 scanmask;
68
69 u32 timeout;
70 u32 min_timeout;
71 u32 max_timeout;
72
73 u32 rx_resolution;
74 u32 tx_resolution;
75
58 void *priv; 76 void *priv;
59 int (*change_protocol)(void *priv, u64 ir_type); 77 int (*change_protocol)(void *priv, u64 ir_type);
60 int (*open)(void *priv); 78 int (*open)(void *priv);
61 void (*close)(void *priv); 79 void (*close)(void *priv);
62 int (*s_tx_mask)(void *priv, u32 mask); 80 int (*s_tx_mask)(void *priv, u32 mask);
63 int (*s_tx_carrier)(void *priv, u32 carrier); 81 int (*s_tx_carrier)(void *priv, u32 carrier);
82 int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle);
83 int (*s_rx_carrier_range)(void *priv, u32 min, u32 max);
64 int (*tx_ir)(void *priv, int *txbuf, u32 n); 84 int (*tx_ir)(void *priv, int *txbuf, u32 n);
85 void (*s_idle)(void *priv, int enable);
86 int (*s_learning_mode)(void *priv, int enable);
65}; 87};
66 88
67struct ir_input_dev { 89struct ir_input_dev {
@@ -69,9 +91,10 @@ struct ir_input_dev {
69 char *driver_name; /* Name of the driver module */ 91 char *driver_name; /* Name of the driver module */
70 struct ir_scancode_table rc_tab; /* scan/key table */ 92 struct ir_scancode_table rc_tab; /* scan/key table */
71 unsigned long devno; /* device number */ 93 unsigned long devno; /* device number */
72 const struct ir_dev_props *props; /* Device properties */ 94 struct ir_dev_props *props; /* Device properties */
73 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ 95 struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */
74 struct input_dev *input_dev; /* the input device associated with this device */ 96 struct input_dev *input_dev; /* the input device associated with this device */
97 bool idle;
75 98
76 /* key info - needed by IR keycode handlers */ 99 /* key info - needed by IR keycode handlers */
77 spinlock_t keylock; /* protects the below members */ 100 spinlock_t keylock; /* protects the below members */
@@ -95,12 +118,12 @@ enum raw_event_type {
95/* From ir-keytable.c */ 118/* From ir-keytable.c */
96int __ir_input_register(struct input_dev *dev, 119int __ir_input_register(struct input_dev *dev,
97 const struct ir_scancode_table *ir_codes, 120 const struct ir_scancode_table *ir_codes,
98 const struct ir_dev_props *props, 121 struct ir_dev_props *props,
99 const char *driver_name); 122 const char *driver_name);
100 123
101static inline int ir_input_register(struct input_dev *dev, 124static inline int ir_input_register(struct input_dev *dev,
102 const char *map_name, 125 const char *map_name,
103 const struct ir_dev_props *props, 126 struct ir_dev_props *props,
104 const char *driver_name) { 127 const char *driver_name) {
105 struct ir_scancode_table *ir_codes; 128 struct ir_scancode_table *ir_codes;
106 struct ir_input_dev *ir_dev; 129 struct ir_input_dev *ir_dev;
@@ -110,8 +133,12 @@ static inline int ir_input_register(struct input_dev *dev,
110 return -EINVAL; 133 return -EINVAL;
111 134
112 ir_codes = get_rc_map(map_name); 135 ir_codes = get_rc_map(map_name);
113 if (!ir_codes) 136 if (!ir_codes) {
114 return -EINVAL; 137 ir_codes = get_rc_map(RC_MAP_EMPTY);
138
139 if (!ir_codes)
140 return -EINVAL;
141 }
115 142
116 rc = __ir_input_register(dev, ir_codes, props, driver_name); 143 rc = __ir_input_register(dev, ir_codes, props, driver_name);
117 if (rc < 0) 144 if (rc < 0)
@@ -144,6 +171,10 @@ struct ir_raw_event {
144void ir_raw_event_handle(struct input_dev *input_dev); 171void ir_raw_event_handle(struct input_dev *input_dev);
145int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); 172int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev);
146int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); 173int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type);
174int ir_raw_event_store_with_filter(struct input_dev *input_dev,
175 struct ir_raw_event *ev);
176void ir_raw_event_set_idle(struct input_dev *input_dev, int idle);
177
147static inline void ir_raw_event_reset(struct input_dev *input_dev) 178static inline void ir_raw_event_reset(struct input_dev *input_dev)
148{ 179{
149 struct ir_raw_event ev = { .pulse = false, .duration = 0 }; 180 struct ir_raw_event ev = { .pulse = false, .duration = 0 };
diff --git a/include/media/lirc.h b/include/media/lirc.h
index 42c467c50519..6678a169fd9e 100644
--- a/include/media/lirc.h
+++ b/include/media/lirc.h
@@ -77,6 +77,7 @@
77#define LIRC_CAN_SET_REC_FILTER 0x08000000 77#define LIRC_CAN_SET_REC_FILTER 0x08000000
78 78
79#define LIRC_CAN_MEASURE_CARRIER 0x02000000 79#define LIRC_CAN_MEASURE_CARRIER 0x02000000
80#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
80 81
81#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) 82#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
82#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) 83#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
@@ -145,7 +146,7 @@
145 * if enabled from the next key press on the driver will send 146 * if enabled from the next key press on the driver will send
146 * LIRC_MODE2_FREQUENCY packets 147 * LIRC_MODE2_FREQUENCY packets
147 */ 148 */
148#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) 149#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
149 150
150/* 151/*
151 * to set a range use 152 * to set a range use
@@ -162,4 +163,6 @@
162#define LIRC_SETUP_START _IO('i', 0x00000021) 163#define LIRC_SETUP_START _IO('i', 0x00000021)
163#define LIRC_SETUP_END _IO('i', 0x00000022) 164#define LIRC_SETUP_END _IO('i', 0x00000022)
164 165
166#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
167
165#endif 168#endif
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 9569d0863f8b..a9c041d49662 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -114,6 +114,7 @@ void rc_map_init(void);
114#define RC_MAP_PURPLETV "rc-purpletv" 114#define RC_MAP_PURPLETV "rc-purpletv"
115#define RC_MAP_PV951 "rc-pv951" 115#define RC_MAP_PV951 "rc-pv951"
116#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" 116#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new"
117#define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap"
117#define RC_MAP_RC5_TV "rc-rc5-tv" 118#define RC_MAP_RC5_TV "rc-rc5-tv"
118#define RC_MAP_RC6_MCE "rc-rc6-mce" 119#define RC_MAP_RC6_MCE "rc-rc6-mce"
119#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 120#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
new file mode 100644
index 000000000000..9b7bea928a88
--- /dev/null
+++ b/include/media/v4l2-ctrls.h
@@ -0,0 +1,460 @@
1/*
2 V4L2 controls support header.
3
4 Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _V4L2_CTRLS_H
22#define _V4L2_CTRLS_H
23
24#include <linux/list.h>
25#include <linux/device.h>
26
27/* forward references */
28struct v4l2_ctrl_handler;
29struct v4l2_ctrl;
30struct video_device;
31struct v4l2_subdev;
32
33/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
34 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
35 * for volatile (and usually read-only) controls such as a control
36 * that returns the current signal strength which changes
37 * continuously.
38 * If not set, then the currently cached value will be returned.
39 * @try_ctrl: Test whether the control's value is valid. Only relevant when
40 * the usual min/max/step checks are not sufficient.
41 * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The
42 * ctrl->handler->lock is held when these ops are called, so no
43 * one else can access controls owned by that handler.
44 */
45struct v4l2_ctrl_ops {
46 int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
47 int (*try_ctrl)(struct v4l2_ctrl *ctrl);
48 int (*s_ctrl)(struct v4l2_ctrl *ctrl);
49};
50
51/** struct v4l2_ctrl - The control structure.
52 * @node: The list node.
53 * @handler: The handler that owns the control.
54 * @cluster: Point to start of cluster array.
55 * @ncontrols: Number of controls in cluster array.
56 * @has_new: Internal flag: set when there is a valid new value.
57 * @done: Internal flag: set for each processed control.
58 * @is_private: If set, then this control is private to its handler and it
59 * will not be added to any other handlers. Drivers can set
60 * this flag.
61 * @is_volatile: If set, then this control is volatile. This means that the
62 * control's current value cannot be cached and needs to be
63 * retrieved through the g_volatile_ctrl op. Drivers can set
64 * this flag.
65 * @ops: The control ops.
66 * @id: The control ID.
67 * @name: The control name.
68 * @type: The control type.
69 * @minimum: The control's minimum value.
70 * @maximum: The control's maximum value.
71 * @default_value: The control's default value.
72 * @step: The control's step value for non-menu controls.
73 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
74 * easy to skip menu items that are not valid. If bit X is set,
75 * then menu item X is skipped. Of course, this only works for
76 * menus with <= 32 menu items. There are no menus that come
77 * close to that number, so this is OK. Should we ever need more,
78 * then this will have to be extended to a u64 or a bit array.
79 * @qmenu: A const char * array for all menu items. Array entries that are
80 * empty strings ("") correspond to non-existing menu items (this
81 * is in addition to the menu_skip_mask above). The last entry
82 * must be NULL.
83 * @flags: The control's flags.
84 * @cur: The control's current value.
85 * @val: The control's new s32 value.
86 * @val64: The control's new s64 value.
87 * @string: The control's new string value.
88 * @priv: The control's private pointer. For use by the driver. It is
89 * untouched by the control framework. Note that this pointer is
90 * not freed when the control is deleted. Should this be needed
91 * then a new internal bitfield can be added to tell the framework
92 * to free this pointer.
93 */
94struct v4l2_ctrl {
95 /* Administrative fields */
96 struct list_head node;
97 struct v4l2_ctrl_handler *handler;
98 struct v4l2_ctrl **cluster;
99 unsigned ncontrols;
100 unsigned int has_new:1;
101 unsigned int done:1;
102
103 unsigned int is_private:1;
104 unsigned int is_volatile:1;
105
106 const struct v4l2_ctrl_ops *ops;
107 u32 id;
108 const char *name;
109 enum v4l2_ctrl_type type;
110 s32 minimum, maximum, default_value;
111 union {
112 u32 step;
113 u32 menu_skip_mask;
114 };
115 const char **qmenu;
116 unsigned long flags;
117 union {
118 s32 val;
119 s64 val64;
120 char *string;
121 } cur;
122 union {
123 s32 val;
124 s64 val64;
125 char *string;
126 };
127 void *priv;
128};
129
130/** struct v4l2_ctrl_ref - The control reference.
131 * @node: List node for the sorted list.
132 * @next: Single-link list node for the hash.
133 * @ctrl: The actual control information.
134 *
135 * Each control handler has a list of these refs. The list_head is used to
136 * keep a sorted-by-control-ID list of all controls, while the next pointer
137 * is used to link the control in the hash's bucket.
138 */
139struct v4l2_ctrl_ref {
140 struct list_head node;
141 struct v4l2_ctrl_ref *next;
142 struct v4l2_ctrl *ctrl;
143};
144
145/** struct v4l2_ctrl_handler - The control handler keeps track of all the
146 * controls: both the controls owned by the handler and those inherited
147 * from other handlers.
148 * @lock: Lock to control access to this handler and its controls.
149 * @ctrls: The list of controls owned by this handler.
150 * @ctrl_refs: The list of control references.
151 * @cached: The last found control reference. It is common that the same
152 * control is needed multiple times, so this is a simple
153 * optimization.
154 * @buckets: Buckets for the hashing. Allows for quick control lookup.
155 * @nr_of_buckets: Total number of buckets in the array.
156 * @error: The error code of the first failed control addition.
157 */
158struct v4l2_ctrl_handler {
159 struct mutex lock;
160 struct list_head ctrls;
161 struct list_head ctrl_refs;
162 struct v4l2_ctrl_ref *cached;
163 struct v4l2_ctrl_ref **buckets;
164 u16 nr_of_buckets;
165 int error;
166};
167
168/** struct v4l2_ctrl_config - Control configuration structure.
169 * @ops: The control ops.
170 * @id: The control ID.
171 * @name: The control name.
172 * @type: The control type.
173 * @min: The control's minimum value.
174 * @max: The control's maximum value.
175 * @step: The control's step value for non-menu controls.
176 * @def: The control's default value.
177 * @flags: The control's flags.
178 * @menu_skip_mask: The control's skip mask for menu controls. This makes it
179 * easy to skip menu items that are not valid. If bit X is set,
180 * then menu item X is skipped. Of course, this only works for
181 * menus with <= 32 menu items. There are no menus that come
182 * close to that number, so this is OK. Should we ever need more,
183 * then this will have to be extended to a u64 or a bit array.
184 * @qmenu: A const char * array for all menu items. Array entries that are
185 * empty strings ("") correspond to non-existing menu items (this
186 * is in addition to the menu_skip_mask above). The last entry
187 * must be NULL.
188 * @is_private: If set, then this control is private to its handler and it
189 * will not be added to any other handlers.
190 * @is_volatile: If set, then this control is volatile. This means that the
191 * control's current value cannot be cached and needs to be
192 * retrieved through the g_volatile_ctrl op.
193 */
194struct v4l2_ctrl_config {
195 const struct v4l2_ctrl_ops *ops;
196 u32 id;
197 const char *name;
198 enum v4l2_ctrl_type type;
199 s32 min;
200 s32 max;
201 u32 step;
202 s32 def;
203 u32 flags;
204 u32 menu_skip_mask;
205 const char **qmenu;
206 unsigned int is_private:1;
207 unsigned int is_volatile:1;
208};
209
210/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
211 *
212 * This works for all standard V4L2 controls.
213 * For non-standard controls it will only fill in the given arguments
214 * and @name will be NULL.
215 *
216 * This function will overwrite the contents of @name, @type and @flags.
217 * The contents of @min, @max, @step and @def may be modified depending on
218 * the type.
219 *
220 * Do not use in drivers! It is used internally for backwards compatibility
221 * control handling only. Once all drivers are converted to use the new
222 * control framework this function will no longer be exported.
223 */
224void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
225 s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
226
227
228/** v4l2_ctrl_handler_init() - Initialize the control handler.
229 * @hdl: The control handler.
230 * @nr_of_controls_hint: A hint of how many controls this handler is
231 * expected to refer to. This is the total number, so including
232 * any inherited controls. It doesn't have to be precise, but if
233 * it is way off, then you either waste memory (too many buckets
234 * are allocated) or the control lookup becomes slower (not enough
235 * buckets are allocated, so there are more slow list lookups).
236 * It will always work, though.
237 *
238 * Returns an error if the buckets could not be allocated. This error will
239 * also be stored in @hdl->error.
240 */
241int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
242 unsigned nr_of_controls_hint);
243
244/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
245 * the control list.
246 * @hdl: The control handler.
247 *
248 * Does nothing if @hdl == NULL.
249 */
250void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
251
252/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
253 * to the handler to initialize the hardware to the current control values.
254 * @hdl: The control handler.
255 *
256 * Button controls will be skipped, as are read-only controls.
257 *
258 * If @hdl == NULL, then this just returns 0.
259 */
260int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
261
262/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
263 * @hdl: The control handler.
264 * @prefix: The prefix to use when logging the control values. If the
265 * prefix does not end with a space, then ": " will be added
266 * after the prefix. If @prefix == NULL, then no prefix will be
267 * used.
268 *
269 * For use with VIDIOC_LOG_STATUS.
270 *
271 * Does nothing if @hdl == NULL.
272 */
273void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
274 const char *prefix);
275
276/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
277 * control.
278 * @hdl: The control handler.
279 * @cfg: The control's configuration data.
280 * @priv: The control's driver-specific private data.
281 *
282 * If the &v4l2_ctrl struct could not be allocated then NULL is returned
283 * and @hdl->error is set to the error code (if it wasn't set already).
284 */
285struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
286 const struct v4l2_ctrl_config *cfg, void *priv);
287
288/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
289 * @hdl: The control handler.
290 * @ops: The control ops.
291 * @id: The control ID.
292 * @min: The control's minimum value.
293 * @max: The control's maximum value.
294 * @step: The control's step value
295 * @def: The control's default value.
296 *
297 * If the &v4l2_ctrl struct could not be allocated, or the control
298 * ID is not known, then NULL is returned and @hdl->error is set to the
299 * appropriate error code (if it wasn't set already).
300 *
301 * If @id refers to a menu control, then this function will return NULL.
302 *
303 * Use v4l2_ctrl_new_std_menu() when adding menu controls.
304 */
305struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
306 const struct v4l2_ctrl_ops *ops,
307 u32 id, s32 min, s32 max, u32 step, s32 def);
308
309/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
310 * @hdl: The control handler.
311 * @ops: The control ops.
312 * @id: The control ID.
313 * @max: The control's maximum value.
314 * @mask: The control's skip mask for menu controls. This makes it
315 * easy to skip menu items that are not valid. If bit X is set,
316 * then menu item X is skipped. Of course, this only works for
317 * menus with <= 32 menu items. There are no menus that come
318 * close to that number, so this is OK. Should we ever need more,
319 * then this will have to be extended to a u64 or a bit array.
320 * @def: The control's default value.
321 *
322 * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
323 * determines which menu items are to be skipped.
324 *
325 * If @id refers to a non-menu control, then this function will return NULL.
326 */
327struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
328 const struct v4l2_ctrl_ops *ops,
329 u32 id, s32 max, s32 mask, s32 def);
330
331/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
332 * @hdl: The control handler.
333 * @ctrl: The control to add.
334 *
335 * It will return NULL if it was unable to add the control reference.
336 * If the control already belonged to the handler, then it will do
337 * nothing and just return @ctrl.
338 */
339struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
340 struct v4l2_ctrl *ctrl);
341
342/** v4l2_ctrl_add_handler() - Add all controls from handler @add to
343 * handler @hdl.
344 * @hdl: The control handler.
345 * @add: The control handler whose controls you want to add to
346 * the @hdl control handler.
347 *
348 * Does nothing if either of the two is a NULL pointer.
349 * In case of an error @hdl->error will be set to the error code (if it
350 * wasn't set already).
351 */
352int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
353 struct v4l2_ctrl_handler *add);
354
355
356/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
357 * @ncontrols: The number of controls in this cluster.
358 * @controls: The cluster control array of size @ncontrols.
359 */
360void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
361
362
363/** v4l2_ctrl_find() - Find a control with the given ID.
364 * @hdl: The control handler.
365 * @id: The control ID to find.
366 *
367 * If @hdl == NULL this will return NULL as well. Will lock the handler so
368 * do not use from inside &v4l2_ctrl_ops.
369 */
370struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
371
372/** v4l2_ctrl_activate() - Make the control active or inactive.
373 * @ctrl: The control to (de)activate.
374 * @active: True if the control should become active.
375 *
376 * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
377 * Does nothing if @ctrl == NULL.
378 * This will usually be called from within the s_ctrl op.
379 *
380 * This function can be called regardless of whether the control handler
381 * is locked or not.
382 */
383void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
384
385/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
386 * @ctrl: The control to (de)activate.
387 * @grabbed: True if the control should become grabbed.
388 *
389 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
390 * Does nothing if @ctrl == NULL.
391 * This will usually be called when starting or stopping streaming in the
392 * driver.
393 *
394 * This function can be called regardless of whether the control handler
395 * is locked or not.
396 */
397void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
398
399/** v4l2_ctrl_lock() - Helper function to lock the handler
400 * associated with the control.
401 * @ctrl: The control to lock.
402 */
403static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
404{
405 mutex_lock(&ctrl->handler->lock);
406}
407
408/** v4l2_ctrl_lock() - Helper function to unlock the handler
409 * associated with the control.
410 * @ctrl: The control to unlock.
411 */
412static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
413{
414 mutex_unlock(&ctrl->handler->lock);
415}
416
417/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
418 * @ctrl: The control.
419 *
420 * This returns the control's value safely by going through the control
421 * framework. This function will lock the control's handler, so it cannot be
422 * used from within the &v4l2_ctrl_ops functions.
423 *
424 * This function is for integer type controls only.
425 */
426s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
427
428/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
429 * @ctrl: The control.
430 * @val: The new value.
431 *
432 * This set the control's new value safely by going through the control
433 * framework. This function will lock the control's handler, so it cannot be
434 * used from within the &v4l2_ctrl_ops functions.
435 *
436 * This function is for integer type controls only.
437 */
438int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
439
440
441/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
442int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
443int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
444int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
445int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
446int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
447int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
448int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
449
450/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
451 will all return -EINVAL. */
452int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
453int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
454int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
455int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
456int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
457int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
458int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
459
460#endif
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index bebe44b03e0f..1efcacbed01a 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -27,6 +27,7 @@
27struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
28struct video_device; 28struct video_device;
29struct v4l2_device; 29struct v4l2_device;
30struct v4l2_ctrl_handler;
30 31
31/* Flag to mark the video_device struct as registered. 32/* Flag to mark the video_device struct as registered.
32 Drivers can clear this flag if they want to block all future 33 Drivers can clear this flag if they want to block all future
@@ -67,6 +68,9 @@ struct video_device
67 struct device *parent; /* device parent */ 68 struct device *parent; /* device parent */
68 struct v4l2_device *v4l2_dev; /* v4l2_device parent */ 69 struct v4l2_device *v4l2_dev; /* v4l2_device parent */
69 70
71 /* Control handler associated with this device node. May be NULL. */
72 struct v4l2_ctrl_handler *ctrl_handler;
73
70 /* device info */ 74 /* device info */
71 char name[32]; 75 char name[32];
72 int vfl_type; 76 int vfl_type;
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 5d5d550e63ad..8bcbd7a0271c 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -32,6 +32,8 @@
32 32
33#define V4L2_DEVICE_NAME_SIZE (20 + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 16)
34 34
35struct v4l2_ctrl_handler;
36
35struct v4l2_device { 37struct v4l2_device {
36 /* dev->driver_data points to this struct. 38 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device 39 Note: dev might be NULL if there is no parent device
@@ -47,6 +49,8 @@ struct v4l2_device {
47 /* notify callback called by some sub-devices. */ 49 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd, 50 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg); 51 unsigned int notification, void *arg);
52 /* The control handler. May be NULL. */
53 struct v4l2_ctrl_handler *ctrl_handler;
50}; 54};
51 55
52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. 56/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 02c6f4d11ed3..4a97d7341a94 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -35,6 +35,7 @@
35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 35#define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001
36 36
37struct v4l2_device; 37struct v4l2_device;
38struct v4l2_ctrl_handler;
38struct v4l2_subdev; 39struct v4l2_subdev;
39struct tuner_setup; 40struct tuner_setup;
40 41
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line {
90 not yet implemented) since ops provide proper type-checking. 91 not yet implemented) since ops provide proper type-checking.
91 */ 92 */
92 93
94/* Subdevice external IO pin configuration */
95#define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */
96#define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1)
97#define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2)
98#define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */
99#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */
100
101struct v4l2_subdev_io_pin_config {
102 u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */
103 u8 pin; /* Chip external IO pin to configure */
104 u8 function; /* Internal signal pad/function to route to IO pin */
105 u8 value; /* Initial value for pin - e.g. GPIO output value */
106 u8 strength; /* Pin drive strength */
107};
108
93/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* 109/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev*
94 functions after the v4l2_subdev was registered. It is used to pass 110 functions after the v4l2_subdev was registered. It is used to pass
95 platform data to the subdev which can be used during initialization. 111 platform data to the subdev which can be used during initialization.
96 112
113 s_io_pin_config: configure one or more chip I/O pins for chips that
114 multiplex different internal signal pads out to IO pins. This function
115 takes a pointer to an array of 'n' pin configuration entries, one for
116 each pin being configured. This function could be called at times
117 other than just subdevice initialization.
118
97 init: initialize the sensor registors to some sort of reasonable default 119 init: initialize the sensor registors to some sort of reasonable default
98 values. Do not use for new drivers and should be removed in existing 120 values. Do not use for new drivers and should be removed in existing
99 drivers. 121 drivers.
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line {
110 132
111 s_power: puts subdevice in power saving mode (on == 0) or normal operation 133 s_power: puts subdevice in power saving mode (on == 0) or normal operation
112 mode (on == 1). 134 mode (on == 1).
135
136 interrupt_service_routine: Called by the bridge chip's interrupt service
137 handler, when an interrupt status has be raised due to this subdev,
138 so that this subdev can handle the details. It may schedule work to be
139 performed later. It must not sleep. *Called from an IRQ context*.
113 */ 140 */
114struct v4l2_subdev_core_ops { 141struct v4l2_subdev_core_ops {
115 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 142 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
116 int (*log_status)(struct v4l2_subdev *sd); 143 int (*log_status)(struct v4l2_subdev *sd);
117 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); 144 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
145 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
146 struct v4l2_subdev_io_pin_config *pincfg);
118 int (*init)(struct v4l2_subdev *sd, u32 val); 147 int (*init)(struct v4l2_subdev *sd, u32 val);
119 int (*load_fw)(struct v4l2_subdev *sd); 148 int (*load_fw)(struct v4l2_subdev *sd);
120 int (*reset)(struct v4l2_subdev *sd, u32 val); 149 int (*reset)(struct v4l2_subdev *sd, u32 val);
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops {
133 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 162 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
134#endif 163#endif
135 int (*s_power)(struct v4l2_subdev *sd, int on); 164 int (*s_power)(struct v4l2_subdev *sd, int on);
165 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
166 u32 status, bool *handled);
136}; 167};
137 168
138/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 169/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops {
307}; 338};
308 339
309/* 340/*
310 interrupt_service_routine: Called by the bridge chip's interrupt service
311 handler, when an IR interrupt status has be raised due to this subdev,
312 so that this subdev can handle the details. It may schedule work to be
313 performed later. It must not sleep. *Called from an IRQ context*.
314
315 [rt]x_g_parameters: Get the current operating parameters and state of the 341 [rt]x_g_parameters: Get the current operating parameters and state of the
316 the IR receiver or transmitter. 342 the IR receiver or transmitter.
317 343
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops {
335 */ 361 */
336 362
337enum v4l2_subdev_ir_mode { 363enum v4l2_subdev_ir_mode {
338 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ 364 V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */
339}; 365};
340 366
341/* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */
342#define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff
343#define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000
344#define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff
345
346struct v4l2_subdev_ir_parameters { 367struct v4l2_subdev_ir_parameters {
347 /* Either Rx or Tx */ 368 /* Either Rx or Tx */
348 unsigned int bytes_per_data_element; /* of data in read or write call */ 369 unsigned int bytes_per_data_element; /* of data in read or write call */
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters {
356 u32 max_pulse_width; /* ns, valid only for baseband signal */ 377 u32 max_pulse_width; /* ns, valid only for baseband signal */
357 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ 378 unsigned int carrier_freq; /* Hz, valid only for modulated signal*/
358 unsigned int duty_cycle; /* percent, valid only for modulated signal*/ 379 unsigned int duty_cycle; /* percent, valid only for modulated signal*/
359 bool invert; /* logically invert sense of mark/space */ 380 bool invert_level; /* invert signal level */
381
382 /* Tx only */
383 bool invert_carrier_sense; /* Send 0/space as a carrier burst */
360 384
361 /* Rx only */ 385 /* Rx only */
362 u32 noise_filter_min_width; /* ns, min time of a valid pulse */ 386 u32 noise_filter_min_width; /* ns, min time of a valid pulse */
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters {
366}; 390};
367 391
368struct v4l2_subdev_ir_ops { 392struct v4l2_subdev_ir_ops {
369 /* Common to receiver and transmitter */
370 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
371 u32 status, bool *handled);
372
373 /* Receiver */ 393 /* Receiver */
374 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, 394 int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
375 ssize_t *num); 395 ssize_t *num);
@@ -415,6 +435,8 @@ struct v4l2_subdev {
415 u32 flags; 435 u32 flags;
416 struct v4l2_device *v4l2_dev; 436 struct v4l2_device *v4l2_dev;
417 const struct v4l2_subdev_ops *ops; 437 const struct v4l2_subdev_ops *ops;
438 /* The control handler of this subdev. May be NULL. */
439 struct v4l2_ctrl_handler *ctrl_handler;
418 /* name must be unique */ 440 /* name must be unique */
419 char name[V4L2_SUBDEV_NAME_SIZE]; 441 char name[V4L2_SUBDEV_NAME_SIZE];
420 /* can be used to group similar subdevs, value is driver-specific */ 442 /* can be used to group similar subdevs, value is driver-specific */
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index be51ae2bd0ff..4debb4514634 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * Portions of MTD ABI definition which are shared by kernel and user space 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_ABI_H__ 20#ifndef __MTD_ABI_H__
@@ -110,6 +125,7 @@ struct otp_info {
110#define MEMERASE64 _IOW('M', 20, struct erase_info_user64) 125#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
111#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) 126#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
112#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) 127#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
128#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
113 129
114/* 130/*
115 * Obsolete legacy interface. Keep it in order not to break userspace 131 * Obsolete legacy interface. Keep it in order not to break userspace
diff --git a/include/mtd/mtd-user.h b/include/mtd/mtd-user.h
index 170ceca3b2d0..aa3c2f86a913 100644
--- a/include/mtd/mtd-user.h
+++ b/include/mtd/mtd-user.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * MTD ABI header for use by user space only. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_USER_H__ 20#ifndef __MTD_USER_H__
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h
index 98e9e57f22de..bdeabd86ad99 100644
--- a/include/mtd/nftl-user.h
+++ b/include/mtd/nftl-user.h
@@ -1,5 +1,19 @@
1/* 1/*
2 * Parts of NFTL headers shared with userspace 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 */ 18 */
5 19
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 466a8320f1e6..c0d47ad4b103 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) International Business Machines Corp., 2006 2 * Copyright © International Business Machines Corp., 2006
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 8b28962e737e..4568b938ca35 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -132,7 +132,7 @@ struct hci_dev {
132 132
133 struct inquiry_cache inq_cache; 133 struct inquiry_cache inq_cache;
134 struct hci_conn_hash conn_hash; 134 struct hci_conn_hash conn_hash;
135 struct bdaddr_list blacklist; 135 struct list_head blacklist;
136 136
137 struct hci_dev_stats stat; 137 struct hci_dev_stats stat;
138 138
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 636724b203ee..6c241444f902 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -33,9 +33,9 @@
33#define L2CAP_DEFAULT_FLUSH_TO 0xffff 33#define L2CAP_DEFAULT_FLUSH_TO 0xffff
34#define L2CAP_DEFAULT_TX_WINDOW 63 34#define L2CAP_DEFAULT_TX_WINDOW 63
35#define L2CAP_DEFAULT_MAX_TX 3 35#define L2CAP_DEFAULT_MAX_TX 3
36#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */ 36#define L2CAP_DEFAULT_RETRANS_TO 2000 /* 2 seconds */
37#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */ 37#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 672 38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 39#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LOCAL_BUSY_TRIES 12 40#define L2CAP_LOCAL_BUSY_TRIES 12
41 41
diff --git a/include/net/sock.h b/include/net/sock.h
index a441c9cdd625..ac53bfbdfe16 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -195,7 +195,8 @@ struct sock_common {
195 * @sk_priority: %SO_PRIORITY setting 195 * @sk_priority: %SO_PRIORITY setting
196 * @sk_type: socket type (%SOCK_STREAM, etc) 196 * @sk_type: socket type (%SOCK_STREAM, etc)
197 * @sk_protocol: which protocol this socket belongs in this network family 197 * @sk_protocol: which protocol this socket belongs in this network family
198 * @sk_peercred: %SO_PEERCRED setting 198 * @sk_peer_pid: &struct pid for this socket's peer
199 * @sk_peer_cred: %SO_PEERCRED setting
199 * @sk_rcvlowat: %SO_RCVLOWAT setting 200 * @sk_rcvlowat: %SO_RCVLOWAT setting
200 * @sk_rcvtimeo: %SO_RCVTIMEO setting 201 * @sk_rcvtimeo: %SO_RCVTIMEO setting
201 * @sk_sndtimeo: %SO_SNDTIMEO setting 202 * @sk_sndtimeo: %SO_SNDTIMEO setting
@@ -211,6 +212,7 @@ struct sock_common {
211 * @sk_send_head: front of stuff to transmit 212 * @sk_send_head: front of stuff to transmit
212 * @sk_security: used by security modules 213 * @sk_security: used by security modules
213 * @sk_mark: generic packet mark 214 * @sk_mark: generic packet mark
215 * @sk_classid: this socket's cgroup classid
214 * @sk_write_pending: a write to stream socket waits to start 216 * @sk_write_pending: a write to stream socket waits to start
215 * @sk_state_change: callback to indicate change in the state of the sock 217 * @sk_state_change: callback to indicate change in the state of the sock
216 * @sk_data_ready: callback to indicate there is data to be processed 218 * @sk_data_ready: callback to indicate there is data to be processed
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 9ae5c613131b..8fcb6e0e9e72 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -151,10 +151,10 @@ struct scsi_cmnd;
151 151
152/* defined in T10 SCSI Primary Commands-2 (SPC2) */ 152/* defined in T10 SCSI Primary Commands-2 (SPC2) */
153struct scsi_varlen_cdb_hdr { 153struct scsi_varlen_cdb_hdr {
154 u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ 154 __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */
155 u8 control; 155 __u8 control;
156 u8 misc[5]; 156 __u8 misc[5];
157 u8 additional_cdb_length; /* total cdb length - 8 */ 157 __u8 additional_cdb_length; /* total cdb length - 8 */
158 __be16 service_action; 158 __be16 service_action;
159 /* service specific data follows */ 159 /* service specific data follows */
160}; 160};
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 536752c40d41..58ce8fe44783 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -105,8 +105,8 @@ struct scsi_nl_host_vendor_msg {
105 * PCI : ID data is the 16 bit PCI Registered Vendor ID 105 * PCI : ID data is the 16 bit PCI Registered Vendor ID
106 */ 106 */
107#define SCSI_NL_VID_TYPE_SHIFT 56 107#define SCSI_NL_VID_TYPE_SHIFT 56
108#define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) 108#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
109#define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) 109#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
110#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) 110#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
111 111
112 112
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
index e9dd9369ecb9..802947f60915 100644
--- a/include/sound/Kbuild
+++ b/include/sound/Kbuild
@@ -1,9 +1,8 @@
1header-y += asequencer.h
2header-y += asound.h
1header-y += asound_fm.h 3header-y += asound_fm.h
4header-y += emu10k1.h
2header-y += hdsp.h 5header-y += hdsp.h
3header-y += hdspm.h 6header-y += hdspm.h
7header-y += sb16_csp.h
4header-y += sfnt_info.h 8header-y += sfnt_info.h
5
6unifdef-y += asequencer.h
7unifdef-y += asound.h
8unifdef-y += emu10k1.h
9unifdef-y += sb16_csp.h
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 6a664c3f7c1e..7dc97d12253c 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1707,6 +1707,7 @@ struct snd_emu10k1 {
1707 unsigned int card_type; /* EMU10K1_CARD_* */ 1707 unsigned int card_type; /* EMU10K1_CARD_* */
1708 unsigned int ecard_ctrl; /* ecard control bits */ 1708 unsigned int ecard_ctrl; /* ecard control bits */
1709 unsigned long dma_mask; /* PCI DMA mask */ 1709 unsigned long dma_mask; /* PCI DMA mask */
1710 unsigned int delay_pcm_irq; /* in samples */
1710 int max_cache_pages; /* max memory size / PAGE_SIZE */ 1711 int max_cache_pages; /* max memory size / PAGE_SIZE */
1711 struct snd_dma_buffer silent_page; /* silent page */ 1712 struct snd_dma_buffer silent_page; /* silent page */
1712 struct snd_dma_buffer ptb_pages; /* page table pages */ 1713 struct snd_dma_buffer ptb_pages; /* page table pages */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d870a918559c..d8ce278515c3 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -25,8 +25,10 @@ DECLARE_EVENT_CLASS(block_rq_with_error,
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 28 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
29 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 29 0 : blk_rq_pos(rq);
30 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
31 0 : blk_rq_sectors(rq);
30 __entry->errors = rq->errors; 32 __entry->errors = rq->errors;
31 33
32 blk_fill_rwbs_rq(__entry->rwbs, rq); 34 blk_fill_rwbs_rq(__entry->rwbs, rq);
@@ -109,9 +111,12 @@ DECLARE_EVENT_CLASS(block_rq,
109 111
110 TP_fast_assign( 112 TP_fast_assign(
111 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 113 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
112 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); 114 __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
113 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); 115 0 : blk_rq_pos(rq);
114 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; 116 __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
117 0 : blk_rq_sectors(rq);
118 __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ?
119 blk_rq_bytes(rq) : 0;
115 120
116 blk_fill_rwbs_rq(__entry->rwbs, rq); 121 blk_fill_rwbs_rq(__entry->rwbs, rq);
117 blk_dump_cmd(__get_str(cmd), rq); 122 blk_dump_cmd(__get_str(cmd), rq);
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
new file mode 100644
index 000000000000..e3615c093741
--- /dev/null
+++ b/include/trace/events/gfpflags.h
@@ -0,0 +1,37 @@
1/*
2 * The order of these masks is important. Matching masks will be seen
3 * first and the left over flags will end up showing by themselves.
4 *
5 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
6 *
7 * GFP_KERNEL|GFP_HARDWALL
8 *
9 * Thus most bits set go first.
10 */
11#define show_gfp_flags(flags) \
12 (flags) ? __print_flags(flags, "|", \
13 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \
14 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
15 {(unsigned long)GFP_USER, "GFP_USER"}, \
16 {(unsigned long)GFP_TEMPORARY, "GFP_TEMPORARY"}, \
17 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
18 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
19 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
20 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
21 {(unsigned long)__GFP_HIGH, "GFP_HIGH"}, \
22 {(unsigned long)__GFP_WAIT, "GFP_WAIT"}, \
23 {(unsigned long)__GFP_IO, "GFP_IO"}, \
24 {(unsigned long)__GFP_COLD, "GFP_COLD"}, \
25 {(unsigned long)__GFP_NOWARN, "GFP_NOWARN"}, \
26 {(unsigned long)__GFP_REPEAT, "GFP_REPEAT"}, \
27 {(unsigned long)__GFP_NOFAIL, "GFP_NOFAIL"}, \
28 {(unsigned long)__GFP_NORETRY, "GFP_NORETRY"}, \
29 {(unsigned long)__GFP_COMP, "GFP_COMP"}, \
30 {(unsigned long)__GFP_ZERO, "GFP_ZERO"}, \
31 {(unsigned long)__GFP_NOMEMALLOC, "GFP_NOMEMALLOC"}, \
32 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
33 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
34 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
35 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
36 ) : "GFP_NOWAIT"
37
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 3adca0ca9dbe..a9c87ad8331c 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -6,43 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9#include "gfpflags.h"
10/*
11 * The order of these masks is important. Matching masks will be seen
12 * first and the left over flags will end up showing by themselves.
13 *
14 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
15 *
16 * GFP_KERNEL|GFP_HARDWALL
17 *
18 * Thus most bits set go first.
19 */
20#define show_gfp_flags(flags) \
21 (flags) ? __print_flags(flags, "|", \
22 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \
23 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
24 {(unsigned long)GFP_USER, "GFP_USER"}, \
25 {(unsigned long)GFP_TEMPORARY, "GFP_TEMPORARY"}, \
26 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
27 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
28 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
29 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
30 {(unsigned long)__GFP_HIGH, "GFP_HIGH"}, \
31 {(unsigned long)__GFP_WAIT, "GFP_WAIT"}, \
32 {(unsigned long)__GFP_IO, "GFP_IO"}, \
33 {(unsigned long)__GFP_COLD, "GFP_COLD"}, \
34 {(unsigned long)__GFP_NOWARN, "GFP_NOWARN"}, \
35 {(unsigned long)__GFP_REPEAT, "GFP_REPEAT"}, \
36 {(unsigned long)__GFP_NOFAIL, "GFP_NOFAIL"}, \
37 {(unsigned long)__GFP_NORETRY, "GFP_NORETRY"}, \
38 {(unsigned long)__GFP_COMP, "GFP_COMP"}, \
39 {(unsigned long)__GFP_ZERO, "GFP_ZERO"}, \
40 {(unsigned long)__GFP_NOMEMALLOC, "GFP_NOMEMALLOC"}, \
41 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
42 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
43 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
44 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
45 ) : "GFP_NOWAIT"
46 10
47DECLARE_EVENT_CLASS(kmem_alloc, 11DECLARE_EVENT_CLASS(kmem_alloc,
48 12
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
new file mode 100644
index 000000000000..370aa5a87322
--- /dev/null
+++ b/include/trace/events/vmscan.h
@@ -0,0 +1,275 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM vmscan
3
4#if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_VMSCAN_H
6
7#include <linux/types.h>
8#include <linux/tracepoint.h>
9#include "gfpflags.h"
10
11#define RECLAIM_WB_ANON 0x0001u
12#define RECLAIM_WB_FILE 0x0002u
13#define RECLAIM_WB_SYNC 0x0004u
14#define RECLAIM_WB_ASYNC 0x0008u
15
16#define show_reclaim_flags(flags) \
17 (flags) ? __print_flags(flags, "|", \
18 {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
19 {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
20 {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
21 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
22 ) : "RECLAIM_WB_NONE"
23
24#define trace_reclaim_flags(page, sync) ( \
25 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
26 (sync == PAGEOUT_IO_SYNC ? RECLAIM_WB_SYNC : RECLAIM_WB_ASYNC) \
27 )
28
29TRACE_EVENT(mm_vmscan_kswapd_sleep,
30
31 TP_PROTO(int nid),
32
33 TP_ARGS(nid),
34
35 TP_STRUCT__entry(
36 __field( int, nid )
37 ),
38
39 TP_fast_assign(
40 __entry->nid = nid;
41 ),
42
43 TP_printk("nid=%d", __entry->nid)
44);
45
46TRACE_EVENT(mm_vmscan_kswapd_wake,
47
48 TP_PROTO(int nid, int order),
49
50 TP_ARGS(nid, order),
51
52 TP_STRUCT__entry(
53 __field( int, nid )
54 __field( int, order )
55 ),
56
57 TP_fast_assign(
58 __entry->nid = nid;
59 __entry->order = order;
60 ),
61
62 TP_printk("nid=%d order=%d", __entry->nid, __entry->order)
63);
64
65TRACE_EVENT(mm_vmscan_wakeup_kswapd,
66
67 TP_PROTO(int nid, int zid, int order),
68
69 TP_ARGS(nid, zid, order),
70
71 TP_STRUCT__entry(
72 __field( int, nid )
73 __field( int, zid )
74 __field( int, order )
75 ),
76
77 TP_fast_assign(
78 __entry->nid = nid;
79 __entry->zid = zid;
80 __entry->order = order;
81 ),
82
83 TP_printk("nid=%d zid=%d order=%d",
84 __entry->nid,
85 __entry->zid,
86 __entry->order)
87);
88
89DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
90
91 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
92
93 TP_ARGS(order, may_writepage, gfp_flags),
94
95 TP_STRUCT__entry(
96 __field( int, order )
97 __field( int, may_writepage )
98 __field( gfp_t, gfp_flags )
99 ),
100
101 TP_fast_assign(
102 __entry->order = order;
103 __entry->may_writepage = may_writepage;
104 __entry->gfp_flags = gfp_flags;
105 ),
106
107 TP_printk("order=%d may_writepage=%d gfp_flags=%s",
108 __entry->order,
109 __entry->may_writepage,
110 show_gfp_flags(__entry->gfp_flags))
111);
112
113DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
114
115 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
116
117 TP_ARGS(order, may_writepage, gfp_flags)
118);
119
120DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
121
122 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
123
124 TP_ARGS(order, may_writepage, gfp_flags)
125);
126
127DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
128
129 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
130
131 TP_ARGS(order, may_writepage, gfp_flags)
132);
133
134DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
135
136 TP_PROTO(unsigned long nr_reclaimed),
137
138 TP_ARGS(nr_reclaimed),
139
140 TP_STRUCT__entry(
141 __field( unsigned long, nr_reclaimed )
142 ),
143
144 TP_fast_assign(
145 __entry->nr_reclaimed = nr_reclaimed;
146 ),
147
148 TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
149);
150
151DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
152
153 TP_PROTO(unsigned long nr_reclaimed),
154
155 TP_ARGS(nr_reclaimed)
156);
157
158DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
159
160 TP_PROTO(unsigned long nr_reclaimed),
161
162 TP_ARGS(nr_reclaimed)
163);
164
165DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
166
167 TP_PROTO(unsigned long nr_reclaimed),
168
169 TP_ARGS(nr_reclaimed)
170);
171
172
173DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
174
175 TP_PROTO(int order,
176 unsigned long nr_requested,
177 unsigned long nr_scanned,
178 unsigned long nr_taken,
179 unsigned long nr_lumpy_taken,
180 unsigned long nr_lumpy_dirty,
181 unsigned long nr_lumpy_failed,
182 int isolate_mode),
183
184 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode),
185
186 TP_STRUCT__entry(
187 __field(int, order)
188 __field(unsigned long, nr_requested)
189 __field(unsigned long, nr_scanned)
190 __field(unsigned long, nr_taken)
191 __field(unsigned long, nr_lumpy_taken)
192 __field(unsigned long, nr_lumpy_dirty)
193 __field(unsigned long, nr_lumpy_failed)
194 __field(int, isolate_mode)
195 ),
196
197 TP_fast_assign(
198 __entry->order = order;
199 __entry->nr_requested = nr_requested;
200 __entry->nr_scanned = nr_scanned;
201 __entry->nr_taken = nr_taken;
202 __entry->nr_lumpy_taken = nr_lumpy_taken;
203 __entry->nr_lumpy_dirty = nr_lumpy_dirty;
204 __entry->nr_lumpy_failed = nr_lumpy_failed;
205 __entry->isolate_mode = isolate_mode;
206 ),
207
208 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu",
209 __entry->isolate_mode,
210 __entry->order,
211 __entry->nr_requested,
212 __entry->nr_scanned,
213 __entry->nr_taken,
214 __entry->nr_lumpy_taken,
215 __entry->nr_lumpy_dirty,
216 __entry->nr_lumpy_failed)
217);
218
219DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
220
221 TP_PROTO(int order,
222 unsigned long nr_requested,
223 unsigned long nr_scanned,
224 unsigned long nr_taken,
225 unsigned long nr_lumpy_taken,
226 unsigned long nr_lumpy_dirty,
227 unsigned long nr_lumpy_failed,
228 int isolate_mode),
229
230 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
231
232);
233
234DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
235
236 TP_PROTO(int order,
237 unsigned long nr_requested,
238 unsigned long nr_scanned,
239 unsigned long nr_taken,
240 unsigned long nr_lumpy_taken,
241 unsigned long nr_lumpy_dirty,
242 unsigned long nr_lumpy_failed,
243 int isolate_mode),
244
245 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode)
246
247);
248
249TRACE_EVENT(mm_vmscan_writepage,
250
251 TP_PROTO(struct page *page,
252 int reclaim_flags),
253
254 TP_ARGS(page, reclaim_flags),
255
256 TP_STRUCT__entry(
257 __field(struct page *, page)
258 __field(int, reclaim_flags)
259 ),
260
261 TP_fast_assign(
262 __entry->page = page;
263 __entry->reclaim_flags = reclaim_flags;
264 ),
265
266 TP_printk("page=%p pfn=%lu flags=%s",
267 __entry->page,
268 page_to_pfn(__entry->page),
269 show_reclaim_flags(__entry->reclaim_flags))
270);
271
272#endif /* _TRACE_VMSCAN_H */
273
274/* This part must be outside protection */
275#include <trace/define_trace.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
new file mode 100644
index 000000000000..49682d7e9d60
--- /dev/null
+++ b/include/trace/events/workqueue.h
@@ -0,0 +1,62 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM workqueue
3
4#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WORKQUEUE_H
6
7#include <linux/tracepoint.h>
8#include <linux/workqueue.h>
9
10/**
11 * workqueue_execute_start - called immediately before the workqueue callback
12 * @work: pointer to struct work_struct
13 *
14 * Allows to track workqueue execution.
15 */
16TRACE_EVENT(workqueue_execute_start,
17
18 TP_PROTO(struct work_struct *work),
19
20 TP_ARGS(work),
21
22 TP_STRUCT__entry(
23 __field( void *, work )
24 __field( void *, function)
25 ),
26
27 TP_fast_assign(
28 __entry->work = work;
29 __entry->function = work->func;
30 ),
31
32 TP_printk("work struct %p: function %pf", __entry->work, __entry->function)
33);
34
35/**
36 * workqueue_execute_end - called immediately before the workqueue callback
37 * @work: pointer to struct work_struct
38 *
39 * Allows to track workqueue execution.
40 */
41TRACE_EVENT(workqueue_execute_end,
42
43 TP_PROTO(struct work_struct *work),
44
45 TP_ARGS(work),
46
47 TP_STRUCT__entry(
48 __field( void *, work )
49 ),
50
51 TP_fast_assign(
52 __entry->work = work;
53 ),
54
55 TP_printk("work struct %p", __entry->work)
56);
57
58
59#endif /* _TRACE_WORKQUEUE_H */
60
61/* This part must be outside protection */
62#include <trace/define_trace.h>
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
new file mode 100644
index 000000000000..f345f66ae9d1
--- /dev/null
+++ b/include/trace/events/writeback.h
@@ -0,0 +1,159 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WRITEBACK_H
6
7#include <linux/backing-dev.h>
8#include <linux/device.h>
9#include <linux/writeback.h>
10
11struct wb_writeback_work;
12
13DECLARE_EVENT_CLASS(writeback_work_class,
14 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
15 TP_ARGS(bdi, work),
16 TP_STRUCT__entry(
17 __array(char, name, 32)
18 __field(long, nr_pages)
19 __field(dev_t, sb_dev)
20 __field(int, sync_mode)
21 __field(int, for_kupdate)
22 __field(int, range_cyclic)
23 __field(int, for_background)
24 ),
25 TP_fast_assign(
26 strncpy(__entry->name, dev_name(bdi->dev), 32);
27 __entry->nr_pages = work->nr_pages;
28 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
29 __entry->sync_mode = work->sync_mode;
30 __entry->for_kupdate = work->for_kupdate;
31 __entry->range_cyclic = work->range_cyclic;
32 __entry->for_background = work->for_background;
33 ),
34 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
35 "kupdate=%d range_cyclic=%d background=%d",
36 __entry->name,
37 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
38 __entry->nr_pages,
39 __entry->sync_mode,
40 __entry->for_kupdate,
41 __entry->range_cyclic,
42 __entry->for_background
43 )
44);
45#define DEFINE_WRITEBACK_WORK_EVENT(name) \
46DEFINE_EVENT(writeback_work_class, name, \
47 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
48 TP_ARGS(bdi, work))
49DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
50DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
51DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
52
53TRACE_EVENT(writeback_pages_written,
54 TP_PROTO(long pages_written),
55 TP_ARGS(pages_written),
56 TP_STRUCT__entry(
57 __field(long, pages)
58 ),
59 TP_fast_assign(
60 __entry->pages = pages_written;
61 ),
62 TP_printk("%ld", __entry->pages)
63);
64
65DECLARE_EVENT_CLASS(writeback_class,
66 TP_PROTO(struct backing_dev_info *bdi),
67 TP_ARGS(bdi),
68 TP_STRUCT__entry(
69 __array(char, name, 32)
70 ),
71 TP_fast_assign(
72 strncpy(__entry->name, dev_name(bdi->dev), 32);
73 ),
74 TP_printk("bdi %s",
75 __entry->name
76 )
77);
78#define DEFINE_WRITEBACK_EVENT(name) \
79DEFINE_EVENT(writeback_class, name, \
80 TP_PROTO(struct backing_dev_info *bdi), \
81 TP_ARGS(bdi))
82
83DEFINE_WRITEBACK_EVENT(writeback_nowork);
84DEFINE_WRITEBACK_EVENT(writeback_wake_thread);
85DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread);
86DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
87DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
88DEFINE_WRITEBACK_EVENT(writeback_thread_start);
89DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
90
91DECLARE_EVENT_CLASS(wbc_class,
92 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
93 TP_ARGS(wbc, bdi),
94 TP_STRUCT__entry(
95 __array(char, name, 32)
96 __field(long, nr_to_write)
97 __field(long, pages_skipped)
98 __field(int, sync_mode)
99 __field(int, nonblocking)
100 __field(int, encountered_congestion)
101 __field(int, for_kupdate)
102 __field(int, for_background)
103 __field(int, for_reclaim)
104 __field(int, range_cyclic)
105 __field(int, more_io)
106 __field(unsigned long, older_than_this)
107 __field(long, range_start)
108 __field(long, range_end)
109 ),
110
111 TP_fast_assign(
112 strncpy(__entry->name, dev_name(bdi->dev), 32);
113 __entry->nr_to_write = wbc->nr_to_write;
114 __entry->pages_skipped = wbc->pages_skipped;
115 __entry->sync_mode = wbc->sync_mode;
116 __entry->for_kupdate = wbc->for_kupdate;
117 __entry->for_background = wbc->for_background;
118 __entry->for_reclaim = wbc->for_reclaim;
119 __entry->range_cyclic = wbc->range_cyclic;
120 __entry->more_io = wbc->more_io;
121 __entry->older_than_this = wbc->older_than_this ?
122 *wbc->older_than_this : 0;
123 __entry->range_start = (long)wbc->range_start;
124 __entry->range_end = (long)wbc->range_end;
125 ),
126
127 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
128 "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx "
129 "start=0x%lx end=0x%lx",
130 __entry->name,
131 __entry->nr_to_write,
132 __entry->pages_skipped,
133 __entry->sync_mode,
134 __entry->for_kupdate,
135 __entry->for_background,
136 __entry->for_reclaim,
137 __entry->range_cyclic,
138 __entry->more_io,
139 __entry->older_than_this,
140 __entry->range_start,
141 __entry->range_end)
142)
143
144#define DEFINE_WBC_EVENT(name) \
145DEFINE_EVENT(wbc_class, name, \
146 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
147 TP_ARGS(wbc, bdi))
148DEFINE_WBC_EVENT(wbc_writeback_start);
149DEFINE_WBC_EVENT(wbc_writeback_written);
150DEFINE_WBC_EVENT(wbc_writeback_wait);
151DEFINE_WBC_EVENT(wbc_balance_dirty_start);
152DEFINE_WBC_EVENT(wbc_balance_dirty_written);
153DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
154DEFINE_WBC_EVENT(wbc_writepage);
155
156#endif /* _TRACE_WRITEBACK_H */
157
158/* This part must be outside protection */
159#include <trace/define_trace.h>
diff --git a/include/video/Kbuild b/include/video/Kbuild
index 0e406f730c2f..ad3e622c5339 100644
--- a/include/video/Kbuild
+++ b/include/video/Kbuild
@@ -1,2 +1,3 @@
1unifdef-y += sisfb.h uvesafb.h 1header-y += edid.h
2unifdef-y += edid.h 2header-y += sisfb.h
3header-y += uvesafb.h
diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h
new file mode 100644
index 000000000000..ddcc8ca7316b
--- /dev/null
+++ b/include/video/mipi_display.h
@@ -0,0 +1,130 @@
1/*
2 * Defines for Mobile Industry Processor Interface (MIPI(R))
3 * Display Working Group standards: DSI, DCS, DBI, DPI
4 *
5 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#ifndef MIPI_DISPLAY_H
14#define MIPI_DISPLAY_H
15
16/* MIPI DSI Processor-to-Peripheral transaction types */
17enum {
18 MIPI_DSI_V_SYNC_START = 0x01,
19 MIPI_DSI_V_SYNC_END = 0x11,
20 MIPI_DSI_H_SYNC_START = 0x21,
21 MIPI_DSI_H_SYNC_END = 0x31,
22
23 MIPI_DSI_COLOR_MODE_OFF = 0x02,
24 MIPI_DSI_COLOR_MODE_ON = 0x12,
25 MIPI_DSI_SHUTDOWN_PERIPHERAL = 0x22,
26 MIPI_DSI_TURN_ON_PERIPHERAL = 0x32,
27
28 MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM = 0x03,
29 MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM = 0x13,
30 MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM = 0x23,
31
32 MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM = 0x04,
33 MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM = 0x14,
34 MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM = 0x24,
35
36 MIPI_DSI_DCS_SHORT_WRITE = 0x05,
37 MIPI_DSI_DCS_SHORT_WRITE_PARAM = 0x15,
38
39 MIPI_DSI_DCS_READ = 0x06,
40
41 MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE = 0x37,
42
43 MIPI_DSI_END_OF_TRANSMISSION = 0x08,
44
45 MIPI_DSI_NULL_PACKET = 0x09,
46 MIPI_DSI_BLANKING_PACKET = 0x19,
47 MIPI_DSI_GENERIC_LONG_WRITE = 0x29,
48 MIPI_DSI_DCS_LONG_WRITE = 0x39,
49
50 MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 = 0x0c,
51 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 = 0x1c,
52 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 = 0x2c,
53
54 MIPI_DSI_PACKED_PIXEL_STREAM_30 = 0x0d,
55 MIPI_DSI_PACKED_PIXEL_STREAM_36 = 0x1d,
56 MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 = 0x3d,
57
58 MIPI_DSI_PACKED_PIXEL_STREAM_16 = 0x0e,
59 MIPI_DSI_PACKED_PIXEL_STREAM_18 = 0x1e,
60 MIPI_DSI_PIXEL_STREAM_3BYTE_18 = 0x2e,
61 MIPI_DSI_PACKED_PIXEL_STREAM_24 = 0x3e,
62};
63
64/* MIPI DSI Peripheral-to-Processor transaction types */
65enum {
66 MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT = 0x02,
67 MIPI_DSI_RX_END_OF_TRANSMISSION = 0x08,
68 MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE = 0x11,
69 MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE = 0x12,
70 MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE = 0x1a,
71 MIPI_DSI_RX_DCS_LONG_READ_RESPONSE = 0x1c,
72 MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE = 0x21,
73 MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE = 0x22,
74};
75
76/* MIPI DCS commands */
77enum {
78 MIPI_DCS_NOP = 0x00,
79 MIPI_DCS_SOFT_RESET = 0x01,
80 MIPI_DCS_GET_DISPLAY_ID = 0x04,
81 MIPI_DCS_GET_RED_CHANNEL = 0x06,
82 MIPI_DCS_GET_GREEN_CHANNEL = 0x07,
83 MIPI_DCS_GET_BLUE_CHANNEL = 0x08,
84 MIPI_DCS_GET_DISPLAY_STATUS = 0x09,
85 MIPI_DCS_GET_POWER_MODE = 0x0A,
86 MIPI_DCS_GET_ADDRESS_MODE = 0x0B,
87 MIPI_DCS_GET_PIXEL_FORMAT = 0x0C,
88 MIPI_DCS_GET_DISPLAY_MODE = 0x0D,
89 MIPI_DCS_GET_SIGNAL_MODE = 0x0E,
90 MIPI_DCS_GET_DIAGNOSTIC_RESULT = 0x0F,
91 MIPI_DCS_ENTER_SLEEP_MODE = 0x10,
92 MIPI_DCS_EXIT_SLEEP_MODE = 0x11,
93 MIPI_DCS_ENTER_PARTIAL_MODE = 0x12,
94 MIPI_DCS_ENTER_NORMAL_MODE = 0x13,
95 MIPI_DCS_EXIT_INVERT_MODE = 0x20,
96 MIPI_DCS_ENTER_INVERT_MODE = 0x21,
97 MIPI_DCS_SET_GAMMA_CURVE = 0x26,
98 MIPI_DCS_SET_DISPLAY_OFF = 0x28,
99 MIPI_DCS_SET_DISPLAY_ON = 0x29,
100 MIPI_DCS_SET_COLUMN_ADDRESS = 0x2A,
101 MIPI_DCS_SET_PAGE_ADDRESS = 0x2B,
102 MIPI_DCS_WRITE_MEMORY_START = 0x2C,
103 MIPI_DCS_WRITE_LUT = 0x2D,
104 MIPI_DCS_READ_MEMORY_START = 0x2E,
105 MIPI_DCS_SET_PARTIAL_AREA = 0x30,
106 MIPI_DCS_SET_SCROLL_AREA = 0x33,
107 MIPI_DCS_SET_TEAR_OFF = 0x34,
108 MIPI_DCS_SET_TEAR_ON = 0x35,
109 MIPI_DCS_SET_ADDRESS_MODE = 0x36,
110 MIPI_DCS_SET_SCROLL_START = 0x37,
111 MIPI_DCS_EXIT_IDLE_MODE = 0x38,
112 MIPI_DCS_ENTER_IDLE_MODE = 0x39,
113 MIPI_DCS_SET_PIXEL_FORMAT = 0x3A,
114 MIPI_DCS_WRITE_MEMORY_CONTINUE = 0x3C,
115 MIPI_DCS_READ_MEMORY_CONTINUE = 0x3E,
116 MIPI_DCS_SET_TEAR_SCANLINE = 0x44,
117 MIPI_DCS_GET_SCANLINE = 0x45,
118 MIPI_DCS_READ_DDB_START = 0xA1,
119 MIPI_DCS_READ_DDB_CONTINUE = 0xA8,
120};
121
122/* MIPI DCS pixel formats */
123#define MIPI_DCS_PIXEL_FMT_24BIT 7
124#define MIPI_DCS_PIXEL_FMT_18BIT 6
125#define MIPI_DCS_PIXEL_FMT_16BIT 5
126#define MIPI_DCS_PIXEL_FMT_12BIT 3
127#define MIPI_DCS_PIXEL_FMT_8BIT 2
128#define MIPI_DCS_PIXEL_FMT_3BIT 1
129
130#endif
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
new file mode 100644
index 000000000000..18bca08f9f59
--- /dev/null
+++ b/include/video/sh_mipi_dsi.h
@@ -0,0 +1,35 @@
1/*
2 * Public SH-mobile MIPI DSI header
3 *
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef VIDEO_SH_MIPI_DSI_H
11#define VIDEO_SH_MIPI_DSI_H
12
13enum sh_mipi_dsi_data_fmt {
14 MIPI_RGB888,
15 MIPI_RGB565,
16 MIPI_RGB666_LP,
17 MIPI_RGB666,
18 MIPI_BGR888,
19 MIPI_BGR565,
20 MIPI_BGR666_LP,
21 MIPI_BGR666,
22 MIPI_YUYV,
23 MIPI_UYVY,
24 MIPI_YUV420_L,
25 MIPI_YUV420,
26};
27
28struct sh_mobile_lcdc_chan_cfg;
29
30struct sh_mipi_dsi_info {
31 enum sh_mipi_dsi_data_fmt data_format;
32 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
33};
34
35#endif
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
new file mode 100644
index 000000000000..577cf18cce89
--- /dev/null
+++ b/include/video/sh_mobile_hdmi.h
@@ -0,0 +1,22 @@
1/*
2 * SH-Mobile High-Definition Multimedia Interface (HDMI)
3 *
4 * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef SH_MOBILE_HDMI_H
12#define SH_MOBILE_HDMI_H
13
14struct sh_mobile_lcdc_chan_cfg;
15struct device;
16
17struct sh_mobile_hdmi_info {
18 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
19 struct device *lcd_dev;
20};
21
22#endif
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 288205457713..55d700e8566e 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -3,24 +3,27 @@
3 3
4#include <linux/fb.h> 4#include <linux/fb.h>
5 5
6enum { RGB8, /* 24bpp, 8:8:8 */ 6enum {
7 RGB9, /* 18bpp, 9:9 */ 7 RGB8, /* 24bpp, 8:8:8 */
8 RGB12A, /* 24bpp, 12:12 */ 8 RGB9, /* 18bpp, 9:9 */
9 RGB12B, /* 12bpp */ 9 RGB12A, /* 24bpp, 12:12 */
10 RGB16, /* 16bpp */ 10 RGB12B, /* 12bpp */
11 RGB18, /* 18bpp */ 11 RGB16, /* 16bpp */
12 RGB24, /* 24bpp */ 12 RGB18, /* 18bpp */
13 SYS8A, /* 24bpp, 8:8:8 */ 13 RGB24, /* 24bpp */
14 SYS8B, /* 18bpp, 8:8:2 */ 14 YUV422, /* 16bpp */
15 SYS8C, /* 18bpp, 2:8:8 */ 15 SYS8A, /* 24bpp, 8:8:8 */
16 SYS8D, /* 16bpp, 8:8 */ 16 SYS8B, /* 18bpp, 8:8:2 */
17 SYS9, /* 18bpp, 9:9 */ 17 SYS8C, /* 18bpp, 2:8:8 */
18 SYS12, /* 24bpp, 12:12 */ 18 SYS8D, /* 16bpp, 8:8 */
19 SYS16A, /* 16bpp */ 19 SYS9, /* 18bpp, 9:9 */
20 SYS16B, /* 18bpp, 16:2 */ 20 SYS12, /* 24bpp, 12:12 */
21 SYS16C, /* 18bpp, 2:16 */ 21 SYS16A, /* 16bpp */
22 SYS18, /* 18bpp */ 22 SYS16B, /* 18bpp, 16:2 */
23 SYS24 };/* 24bpp */ 23 SYS16C, /* 18bpp, 2:16 */
24 SYS18, /* 18bpp */
25 SYS24, /* 24bpp */
26};
24 27
25enum { LCDC_CHAN_DISABLED = 0, 28enum { LCDC_CHAN_DISABLED = 0,
26 LCDC_CHAN_MAINLCD, 29 LCDC_CHAN_MAINLCD,
@@ -52,7 +55,7 @@ struct sh_mobile_lcdc_board_cfg {
52 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 55 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
53 void (*start_transfer)(void *board_data, void *sys_ops_handle, 56 void (*start_transfer)(void *board_data, void *sys_ops_handle,
54 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 57 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
55 void (*display_on)(void *board_data); 58 void (*display_on)(void *board_data, struct fb_info *info);
56 void (*display_off)(void *board_data); 59 void (*display_off)(void *board_data);
57}; 60};
58 61
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index af36ead16817..d3938d3e71f8 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -9,6 +9,8 @@
9#ifndef __XEN_PUBLIC_MEMORY_H__ 9#ifndef __XEN_PUBLIC_MEMORY_H__
10#define __XEN_PUBLIC_MEMORY_H__ 10#define __XEN_PUBLIC_MEMORY_H__
11 11
12#include <linux/spinlock.h>
13
12/* 14/*
13 * Increase or decrease the specified domain's memory reservation. Returns a 15 * Increase or decrease the specified domain's memory reservation. Returns a
14 * -ve errcode on failure, or the # extents successfully allocated or freed. 16 * -ve errcode on failure, or the # extents successfully allocated or freed.
@@ -53,6 +55,48 @@ struct xen_memory_reservation {
53DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); 55DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation);
54 56
55/* 57/*
58 * An atomic exchange of memory pages. If return code is zero then
59 * @out.extent_list provides GMFNs of the newly-allocated memory.
60 * Returns zero on complete success, otherwise a negative error code.
61 * On complete success then always @nr_exchanged == @in.nr_extents.
62 * On partial success @nr_exchanged indicates how much work was done.
63 */
64#define XENMEM_exchange 11
65struct xen_memory_exchange {
66 /*
67 * [IN] Details of memory extents to be exchanged (GMFN bases).
68 * Note that @in.address_bits is ignored and unused.
69 */
70 struct xen_memory_reservation in;
71
72 /*
73 * [IN/OUT] Details of new memory extents.
74 * We require that:
75 * 1. @in.domid == @out.domid
76 * 2. @in.nr_extents << @in.extent_order ==
77 * @out.nr_extents << @out.extent_order
78 * 3. @in.extent_start and @out.extent_start lists must not overlap
79 * 4. @out.extent_start lists GPFN bases to be populated
80 * 5. @out.extent_start is overwritten with allocated GMFN bases
81 */
82 struct xen_memory_reservation out;
83
84 /*
85 * [OUT] Number of input extents that were successfully exchanged:
86 * 1. The first @nr_exchanged input extents were successfully
87 * deallocated.
88 * 2. The corresponding first entries in the output extent list correctly
89 * indicate the GMFNs that were successfully exchanged.
90 * 3. All other input and output extents are untouched.
91 * 4. If not all input exents are exchanged then the return code of this
92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
94 */
95 unsigned long nr_exchanged;
96};
97
98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
99/*
56 * Returns the maximum machine frame number of mapped RAM in this system. 100 * Returns the maximum machine frame number of mapped RAM in this system.
57 * This command always succeeds (it never returns an error code). 101 * This command always succeeds (it never returns an error code).
58 * arg == NULL. 102 * arg == NULL.
@@ -142,4 +186,10 @@ struct xen_translate_gpfn_list {
142}; 186};
143DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); 187DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
144 188
189
190/*
191 * Prevent the balloon driver from changing the memory reservation
192 * during a driver critical region.
193 */
194extern spinlock_t xen_reservation_lock;
145#endif /* __XEN_PUBLIC_MEMORY_H__ */ 195#endif /* __XEN_PUBLIC_MEMORY_H__ */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
new file mode 100644
index 000000000000..2ea2fdc79c16
--- /dev/null
+++ b/include/xen/swiotlb-xen.h
@@ -0,0 +1,65 @@
1#ifndef __LINUX_SWIOTLB_XEN_H
2#define __LINUX_SWIOTLB_XEN_H
3
4#include <linux/swiotlb.h>
5
6extern void xen_swiotlb_init(int verbose);
7
8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flags);
11
12extern void
13xen_swiotlb_free_coherent(struct device *hwdev, size_t size,
14 void *vaddr, dma_addr_t dma_handle);
15
16extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
17 unsigned long offset, size_t size,
18 enum dma_data_direction dir,
19 struct dma_attrs *attrs);
20
21extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
22 size_t size, enum dma_data_direction dir,
23 struct dma_attrs *attrs);
24/*
25extern int
26xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
27 enum dma_data_direction dir);
28
29extern void
30xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
31 enum dma_data_direction dir);
32*/
33extern int
34xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
35 int nelems, enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37
38extern void
39xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
40 int nelems, enum dma_data_direction dir,
41 struct dma_attrs *attrs);
42
43extern void
44xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
45 size_t size, enum dma_data_direction dir);
46
47extern void
48xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
49 int nelems, enum dma_data_direction dir);
50
51extern void
52xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
53 size_t size, enum dma_data_direction dir);
54
55extern void
56xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
57 int nelems, enum dma_data_direction dir);
58
59extern int
60xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
61
62extern int
63xen_swiotlb_dma_supported(struct device *hwdev, u64 mask);
64
65#endif /* __LINUX_SWIOTLB_XEN_H */
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 46bc81ef74c6..351f4051f6d8 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -17,4 +17,10 @@ void xen_arch_resume(void);
17 17
18int xen_setup_shutdown_event(void); 18int xen_setup_shutdown_event(void);
19 19
20extern unsigned long *xen_contiguous_bitmap;
21int xen_create_contiguous_region(unsigned long vstart, unsigned int order,
22 unsigned int address_bits);
23
24void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
25
20#endif /* INCLUDE_XEN_OPS_H */ 26#endif /* INCLUDE_XEN_OPS_H */