aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acoutput.h12
-rw-r--r--include/acpi/acpi_bus.h1
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/actbl.h16
-rw-r--r--include/acpi/actbl2.h64
-rw-r--r--include/acpi/apei.h5
-rw-r--r--include/asm-generic/bitops.h3
-rw-r--r--include/asm-generic/bitops/ext2-atomic.h4
-rw-r--r--include/asm-generic/bitops/ext2-non-atomic.h20
-rw-r--r--include/asm-generic/bitops/le.h89
-rw-r--r--include/asm-generic/bitops/minix-le.h17
-rw-r--r--include/asm-generic/bitops/minix.h15
-rw-r--r--include/asm-generic/bug.h28
-rw-r--r--include/asm-generic/types.h27
-rw-r--r--include/asm-generic/unistd.h6
-rw-r--r--include/drm/drm.h4
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi_io.h3
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/amba/clcd.h90
-rw-r--r--include/linux/atmdev.h1
-rw-r--r--include/linux/backing-dev.h16
-rw-r--r--include/linux/backlight.h9
-rw-r--r--include/linux/bch.h79
-rw-r--r--include/linux/bio.h1
-rw-r--r--include/linux/blk_types.h6
-rw-r--r--include/linux/blkdev.h101
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/buffer_head.h1
-rw-r--r--include/linux/can/core.h9
-rw-r--r--include/linux/capability.h52
-rw-r--r--include/linux/ceph/ceph_fs.h19
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/osd_client.h57
-rw-r--r--include/linux/ceph/rados.h39
-rw-r--r--include/linux/compaction.h9
-rw-r--r--include/linux/compiler-gcc.h8
-rw-r--r--include/linux/compiler-gcc3.h8
-rw-r--r--include/linux/compiler-gcc4.h8
-rw-r--r--include/linux/connector.h16
-rw-r--r--include/linux/cper.h2
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/cred.h4
-rw-r--r--include/linux/davinci_emac.h1
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/device-mapper.h5
-rw-r--r--include/linux/device.h4
-rw-r--r--include/linux/dm-ioctl.h12
-rw-r--r--include/linux/drbd.h23
-rw-r--r--include/linux/drbd_limits.h12
-rw-r--r--include/linux/drbd_nl.h13
-rw-r--r--include/linux/drbd_tag_magic.h1
-rw-r--r--include/linux/dw_dmac.h44
-rw-r--r--include/linux/elevator.h10
-rw-r--r--include/linux/err.h8
-rw-r--r--include/linux/ethtool.h4
-rw-r--r--include/linux/ext3_fs.h10
-rw-r--r--include/linux/firewire.h2
-rw-r--r--include/linux/fs.h44
-rw-r--r--include/linux/genhd.h12
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/i2c-id.h37
-rw-r--r--include/linux/i2c.h18
-rw-r--r--include/linux/i2c/ads1015.h36
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h (renamed from include/linux/i2c/qt602240_ts.h)34
-rw-r--r--include/linux/i2c/mcs.h1
-rw-r--r--include/linux/i2c/pxa-i2c.h82
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/i2c/twl4030-madc.h141
-rw-r--r--include/linux/input-polldev.h4
-rw-r--r--include/linux/input.h19
-rw-r--r--include/linux/ipc_namespace.h10
-rw-r--r--include/linux/irq.h184
-rw-r--r--include/linux/irqdesc.h89
-rw-r--r--include/linux/jbd2.h28
-rw-r--r--include/linux/journal-head.h7
-rw-r--r--include/linux/kallsyms.h7
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kernel.h70
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kthread.h14
-rw-r--r--include/linux/led-lm3530.h107
-rw-r--r--include/linux/leds.h7
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/media.h132
-rw-r--r--include/linux/memcontrol.h27
-rw-r--r--include/linux/mfd/88pm860x.h20
-rw-r--r--include/linux/mfd/ab8500.h51
-rw-r--r--include/linux/mfd/ab8500/gpadc.h32
-rw-r--r--include/linux/mfd/ab8500/gpio.h21
-rw-r--r--include/linux/mfd/ab8500/sysctrl.h254
-rw-r--r--include/linux/mfd/abx500.h1
-rw-r--r--include/linux/mfd/core.h63
-rw-r--r--include/linux/mfd/max8997-private.h368
-rw-r--r--include/linux/mfd/max8997.h117
-rw-r--r--include/linux/mfd/mc13xxx.h3
-rw-r--r--include/linux/mfd/tps6105x.h101
-rw-r--r--include/linux/mfd/wl1273-core.h2
-rw-r--r--include/linux/mfd/wm831x/pdata.h9
-rw-r--r--include/linux/mfd/wm8994/core.h4
-rw-r--r--include/linux/mlx4/device.h51
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/linux/mm.h27
-rw-r--r--include/linux/mm_types.h8
-rw-r--r--include/linux/mmc/boot.h7
-rw-r--r--include/linux/mmc/card.h6
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/dw_mmc.h15
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sh_mmcif.h3
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h (renamed from include/linux/mfd/sh_mobile_sdhi.h)0
-rw-r--r--include/linux/mmc/tmio.h63
-rw-r--r--include/linux/mtd/blktrans.h3
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/latch-addr-flash.h29
-rw-r--r--include/linux/mtd/nand.h3
-rw-r--r--include/linux/mtd/nand_bch.h72
-rw-r--r--include/linux/mtd/onenand.h1
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h10
-rw-r--r--include/linux/nfs_page.h8
-rw-r--r--include/linux/nfs_xdr.h70
-rw-r--r--include/linux/nilfs2_fs.h32
-rw-r--r--include/linux/of_platform.h3
-rw-r--r--include/linux/omap3isp.h646
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/page_cgroup.h90
-rw-r--r--include/linux/pagemap.h17
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h7
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--include/linux/pid.h11
-rw-r--r--include/linux/pm.h10
-rw-r--r--include/linux/power/bq20z75.h39
-rw-r--r--include/linux/power/bq27x00_battery.h19
-rw-r--r--include/linux/power_supply.h47
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/pwm_backlight.h3
-rw-r--r--include/linux/quotaops.h2
-rw-r--r--include/linux/regulator/ab8500.h51
-rw-r--r--include/linux/regulator/consumer.h2
-rw-r--r--include/linux/regulator/driver.h11
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/reiserfs_fs.h27
-rw-r--r--include/linux/res_counter.h72
-rw-r--r--include/linux/rio.h25
-rw-r--r--include/linux/rio_drv.h7
-rw-r--r--include/linux/rmap.h45
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/security.h28
-rw-r--r--include/linux/sigma.h60
-rw-r--r--include/linux/skbuff.h8
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/slub_def.h9
-rw-r--r--include/linux/sm501.h8
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/linux/sonypi.h1
-rw-r--r--include/linux/spi/tsc2005.h41
-rw-r--r--include/linux/sunrpc/gss_api.h3
-rw-r--r--include/linux/svga.h34
-rw-r--r--include/linux/swap.h12
-rw-r--r--include/linux/syscalls.h1
-rw-r--r--include/linux/sysdev.h7
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/types.h6
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/utsname.h10
-rw-r--r--include/linux/v4l2-mediabus.h108
-rw-r--r--include/linux/v4l2-subdev.h141
-rw-r--r--include/linux/videodev2.h146
-rw-r--r--include/linux/vmalloc.h32
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/zlib.h11
-rw-r--r--include/media/media-device.h95
-rw-r--r--include/media/media-devnode.h97
-rw-r--r--include/media/media-entity.h151
-rw-r--r--include/media/noon010pc30.h28
-rw-r--r--include/media/rc-map.h6
-rw-r--r--include/media/s5p_fimc.h (renamed from include/media/s3c_fimc.h)27
-rw-r--r--include/media/soc_camera.h24
-rw-r--r--include/media/soc_mediabus.h4
-rw-r--r--include/media/tuner.h16
-rw-r--r--include/media/v4l2-chip-ident.h4
-rw-r--r--include/media/v4l2-common.h15
-rw-r--r--include/media/v4l2-dev.h46
-rw-r--r--include/media/v4l2-device.h24
-rw-r--r--include/media/v4l2-fh.h29
-rw-r--r--include/media/v4l2-ioctl.h18
-rw-r--r--include/media/v4l2-mediabus.h61
-rw-r--r--include/media/v4l2-mem2mem.h58
-rw-r--r--include/media/v4l2-subdev.h113
-rw-r--r--include/media/videobuf2-core.h380
-rw-r--r--include/media/videobuf2-dma-contig.h32
-rw-r--r--include/media/videobuf2-dma-sg.h32
-rw-r--r--include/media/videobuf2-memops.h45
-rw-r--r--include/media/videobuf2-vmalloc.h20
-rw-r--r--include/media/wm8775.h9
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/if_inet6.h16
-rw-r--r--include/net/ip.h8
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h18
-rw-r--r--include/net/ip_vs.h2
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--include/net/rose.h8
-rw-r--r--include/net/route.h5
-rw-r--r--include/net/sch_generic.h8
-rw-r--r--include/net/snmp.h4
-rw-r--r--include/net/xfrm.h23
-rw-r--r--include/scsi/libiscsi_tcp.h1
-rw-r--r--include/scsi/scsi_device.h2
-rw-r--r--include/sound/pcm.h4
-rw-r--r--include/staging/altera.h49
-rw-r--r--include/target/target_core_base.h73
-rw-r--r--include/target/target_core_configfs.h4
-rw-r--r--include/target/target_core_fabric_ops.h2
-rw-r--r--include/target/target_core_tmr.h52
-rw-r--r--include/target/target_core_transport.h4
-rw-r--r--include/trace/events/btrfs.h667
-rw-r--r--include/trace/events/ext4.h775
-rw-r--r--include/trace/events/jbd2.h78
-rw-r--r--include/video/atmel_lcdc.h1
224 files changed, 7192 insertions, 1407 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index ef1cef77d32b..d7bd661bfae7 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -183,13 +183,19 @@
183 183
184#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 184#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
185/* 185/*
186 * Module name is included in both debug and non-debug versions primarily for 186 * The module name is used primarily for error and debug messages.
187 * error messages. The __FILE__ macro is not very useful for this, because it 187 * The __FILE__ macro is not very useful for this, because it
188 * often includes the entire pathname to the module 188 * usually includes the entire pathname to the module making the
189 * debug output difficult to read.
189 */ 190 */
190#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; 191#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
191#else 192#else
193/*
194 * For the no-debug and no-error-msg cases, we must at least define
195 * a null module name.
196 */
192#define ACPI_MODULE_NAME(name) 197#define ACPI_MODULE_NAME(name)
198#define _acpi_module_name ""
193#endif 199#endif
194 200
195/* 201/*
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index ff103ba96b78..3a10ef5914eb 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -250,7 +250,6 @@ struct acpi_device_wakeup {
250 struct acpi_handle_list resources; 250 struct acpi_handle_list resources;
251 struct acpi_device_wakeup_flags flags; 251 struct acpi_device_wakeup_flags flags;
252 int prepare_count; 252 int prepare_count;
253 int run_wake_count;
254}; 253};
255 254
256/* Device */ 255/* Device */
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e46ec95a8ada..f6ad63d25b73 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20110112 50#define ACPI_CA_VERSION 0x20110316
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 7e42bfee0e29..d41c94885211 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -343,4 +343,20 @@ struct acpi_table_desc {
343#include <acpi/actbl1.h> 343#include <acpi/actbl1.h>
344#include <acpi/actbl2.h> 344#include <acpi/actbl2.h>
345 345
346/*
347 * Sizes of the various flavors of FADT. We need to look closely
348 * at the FADT length because the version number essentially tells
349 * us nothing because of many BIOS bugs where the version does not
350 * match the expected length. In other words, the length of the
351 * FADT is the bottom line as to what the version really is.
352 *
353 * For reference, the values below are as follows:
354 * FADT V1 size: 0x74
355 * FADT V2 size: 0x84
356 * FADT V3+ size: 0xF4
357 */
358#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
359#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3)
360#define ACPI_FADT_V3_SIZE (u32) (sizeof (struct acpi_table_fadt))
361
346#endif /* __ACTBL_H__ */ 362#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 0fc15dfb2e22..58bdd0545c5a 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl2.h - ACPI Specification Revision 2.0 Tables 3 * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -716,6 +716,68 @@ struct acpi_table_mchi {
716 716
717/******************************************************************************* 717/*******************************************************************************
718 * 718 *
719 * SLIC - Software Licensing Description Table
720 * Version 1
721 *
722 * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems",
723 * Copyright 2006
724 *
725 ******************************************************************************/
726
727/* Basic SLIC table is only the common ACPI header */
728
729struct acpi_table_slic {
730 struct acpi_table_header header; /* Common ACPI table header */
731};
732
733/* Common SLIC subtable header */
734
735struct acpi_slic_header {
736 u32 type;
737 u32 length;
738};
739
740/* Values for Type field above */
741
742enum acpi_slic_type {
743 ACPI_SLIC_TYPE_PUBLIC_KEY = 0,
744 ACPI_SLIC_TYPE_WINDOWS_MARKER = 1,
745 ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */
746};
747
748/*
749 * SLIC Sub-tables, correspond to Type in struct acpi_slic_header
750 */
751
752/* 0: Public Key Structure */
753
754struct acpi_slic_key {
755 struct acpi_slic_header header;
756 u8 key_type;
757 u8 version;
758 u16 reserved;
759 u32 algorithm;
760 char magic[4];
761 u32 bit_length;
762 u32 exponent;
763 u8 modulus[128];
764};
765
766/* 1: Windows Marker Structure */
767
768struct acpi_slic_marker {
769 struct acpi_slic_header header;
770 u32 version;
771 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
772 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
773 char windows_flag[8];
774 u32 slic_version;
775 u8 reserved[16];
776 u8 signature[128];
777};
778
779/*******************************************************************************
780 *
719 * SPCR - Serial Port Console Redirection table 781 * SPCR - Serial Port Console Redirection table
720 * Version 1 782 * Version 1
721 * 783 *
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index c4dbb132d902..e67b523a50e1 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -30,10 +30,11 @@ int apei_hest_parse(apei_hest_func_t func, void *data);
30 30
31int erst_write(const struct cper_record_header *record); 31int erst_write(const struct cper_record_header *record);
32ssize_t erst_get_record_count(void); 32ssize_t erst_get_record_count(void);
33int erst_get_next_record_id(u64 *record_id); 33int erst_get_record_id_begin(int *pos);
34int erst_get_record_id_next(int *pos, u64 *record_id);
35void erst_get_record_id_end(void);
34ssize_t erst_read(u64 record_id, struct cper_record_header *record, 36ssize_t erst_read(u64 record_id, struct cper_record_header *record,
35 size_t buflen); 37 size_t buflen);
36ssize_t erst_read_next(struct cper_record_header *record, size_t buflen);
37int erst_clear(u64 record_id); 38int erst_clear(u64 record_id);
38 39
39#endif 40#endif
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index a54f4421a24d..280ca7a96f75 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -38,8 +38,7 @@
38 38
39#include <asm-generic/bitops/atomic.h> 39#include <asm-generic/bitops/atomic.h>
40#include <asm-generic/bitops/non-atomic.h> 40#include <asm-generic/bitops/non-atomic.h>
41#include <asm-generic/bitops/ext2-non-atomic.h> 41#include <asm-generic/bitops/le.h>
42#include <asm-generic/bitops/ext2-atomic.h> 42#include <asm-generic/bitops/ext2-atomic.h>
43#include <asm-generic/bitops/minix.h>
44 43
45#endif /* __ASM_GENERIC_BITOPS_H */ 44#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h
index ab1c875efb74..ecf1c9d8a7cc 100644
--- a/include/asm-generic/bitops/ext2-atomic.h
+++ b/include/asm-generic/bitops/ext2-atomic.h
@@ -5,7 +5,7 @@
5 ({ \ 5 ({ \
6 int ret; \ 6 int ret; \
7 spin_lock(lock); \ 7 spin_lock(lock); \
8 ret = ext2_set_bit((nr), (unsigned long *)(addr)); \ 8 ret = __test_and_set_bit_le(nr, addr); \
9 spin_unlock(lock); \ 9 spin_unlock(lock); \
10 ret; \ 10 ret; \
11 }) 11 })
@@ -14,7 +14,7 @@
14 ({ \ 14 ({ \
15 int ret; \ 15 int ret; \
16 spin_lock(lock); \ 16 spin_lock(lock); \
17 ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \ 17 ret = __test_and_clear_bit_le(nr, addr); \
18 spin_unlock(lock); \ 18 spin_unlock(lock); \
19 ret; \ 19 ret; \
20 }) 20 })
diff --git a/include/asm-generic/bitops/ext2-non-atomic.h b/include/asm-generic/bitops/ext2-non-atomic.h
deleted file mode 100644
index 63cf822431a2..000000000000
--- a/include/asm-generic/bitops/ext2-non-atomic.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define ext2_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define ext2_clear_bit(nr,addr) \
9 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
10
11#define ext2_test_bit(nr,addr) \
12 generic_test_le_bit((nr),(unsigned long *)(addr))
13#define ext2_find_first_zero_bit(addr, size) \
14 generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
15#define ext2_find_next_zero_bit(addr, size, off) \
16 generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
17#define ext2_find_next_bit(addr, size, off) \
18 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
19
20#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 80e3bf13b2b9..946a21b1b5dc 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -4,54 +4,77 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/byteorder.h> 5#include <asm/byteorder.h>
6 6
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
9
10#if defined(__LITTLE_ENDIAN) 7#if defined(__LITTLE_ENDIAN)
11 8
12#define generic_test_le_bit(nr, addr) test_bit(nr, addr) 9#define BITOP_LE_SWIZZLE 0
13#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
14#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
15 10
16#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr) 11static inline unsigned long find_next_zero_bit_le(const void *addr,
17#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr) 12 unsigned long size, unsigned long offset)
13{
14 return find_next_zero_bit(addr, size, offset);
15}
18 16
19#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr) 17static inline unsigned long find_next_bit_le(const void *addr,
20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr) 18 unsigned long size, unsigned long offset)
19{
20 return find_next_bit(addr, size, offset);
21}
21 22
22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset) 23static inline unsigned long find_first_zero_bit_le(const void *addr,
23#define generic_find_next_le_bit(addr, size, offset) \ 24 unsigned long size)
24 find_next_bit(addr, size, offset) 25{
26 return find_first_zero_bit(addr, size);
27}
25 28
26#elif defined(__BIG_ENDIAN) 29#elif defined(__BIG_ENDIAN)
27 30
28#define generic_test_le_bit(nr, addr) \ 31#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
29 test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
30#define generic___set_le_bit(nr, addr) \
31 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
32#define generic___clear_le_bit(nr, addr) \
33 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
34
35#define generic_test_and_set_le_bit(nr, addr) \
36 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
37#define generic_test_and_clear_le_bit(nr, addr) \
38 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
39
40#define generic___test_and_set_le_bit(nr, addr) \
41 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
42#define generic___test_and_clear_le_bit(nr, addr) \
43 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
44 32
45extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, 33extern unsigned long find_next_zero_bit_le(const void *addr,
46 unsigned long size, unsigned long offset); 34 unsigned long size, unsigned long offset);
47extern unsigned long generic_find_next_le_bit(const unsigned long *addr, 35extern unsigned long find_next_bit_le(const void *addr,
48 unsigned long size, unsigned long offset); 36 unsigned long size, unsigned long offset);
49 37
38#define find_first_zero_bit_le(addr, size) \
39 find_next_zero_bit_le((addr), (size), 0)
40
50#else 41#else
51#error "Please fix <asm/byteorder.h>" 42#error "Please fix <asm/byteorder.h>"
52#endif 43#endif
53 44
54#define generic_find_first_zero_le_bit(addr, size) \ 45static inline int test_bit_le(int nr, const void *addr)
55 generic_find_next_zero_le_bit((addr), (size), 0) 46{
47 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
48}
49
50static inline void __set_bit_le(int nr, void *addr)
51{
52 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
53}
54
55static inline void __clear_bit_le(int nr, void *addr)
56{
57 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
58}
59
60static inline int test_and_set_bit_le(int nr, void *addr)
61{
62 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
63}
64
65static inline int test_and_clear_bit_le(int nr, void *addr)
66{
67 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
68}
69
70static inline int __test_and_set_bit_le(int nr, void *addr)
71{
72 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
73}
74
75static inline int __test_and_clear_bit_le(int nr, void *addr)
76{
77 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
78}
56 79
57#endif /* _ASM_GENERIC_BITOPS_LE_H_ */ 80#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
diff --git a/include/asm-generic/bitops/minix-le.h b/include/asm-generic/bitops/minix-le.h
deleted file mode 100644
index 4a981c1bb1ae..000000000000
--- a/include/asm-generic/bitops/minix-le.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
2#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define minix_test_and_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define minix_set_bit(nr,addr) \
9 generic___set_le_bit((nr),(unsigned long *)(addr))
10#define minix_test_and_clear_bit(nr,addr) \
11 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
12#define minix_test_bit(nr,addr) \
13 generic_test_le_bit((nr),(unsigned long *)(addr))
14#define minix_find_first_zero_bit(addr,size) \
15 generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
16
17#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
diff --git a/include/asm-generic/bitops/minix.h b/include/asm-generic/bitops/minix.h
deleted file mode 100644
index 91f42e87aa51..000000000000
--- a/include/asm-generic/bitops/minix.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
2#define _ASM_GENERIC_BITOPS_MINIX_H_
3
4#define minix_test_and_set_bit(nr,addr) \
5 __test_and_set_bit((nr),(unsigned long *)(addr))
6#define minix_set_bit(nr,addr) \
7 __set_bit((nr),(unsigned long *)(addr))
8#define minix_test_and_clear_bit(nr,addr) \
9 __test_and_clear_bit((nr),(unsigned long *)(addr))
10#define minix_test_bit(nr,addr) \
11 test_bit((nr),(unsigned long *)(addr))
12#define minix_find_first_zero_bit(addr,size) \
13 find_first_zero_bit((unsigned long *)(addr),(size))
14
15#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c2c9ba032d46..f2d2faf4d9ae 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -165,10 +165,36 @@ extern void warn_slowpath_null(const char *file, const int line);
165#define WARN_ON_RATELIMIT(condition, state) \ 165#define WARN_ON_RATELIMIT(condition, state) \
166 WARN_ON((condition) && __ratelimit(state)) 166 WARN_ON((condition) && __ratelimit(state))
167 167
168/*
169 * WARN_ON_SMP() is for cases that the warning is either
170 * meaningless for !SMP or may even cause failures.
171 * This is usually used for cases that we have
172 * WARN_ON(!spin_is_locked(&lock)) checks, as spin_is_locked()
173 * returns 0 for uniprocessor settings.
174 * It can also be used with values that are only defined
175 * on SMP:
176 *
177 * struct foo {
178 * [...]
179 * #ifdef CONFIG_SMP
180 * int bar;
181 * #endif
182 * };
183 *
184 * void func(struct foo *zoot)
185 * {
186 * WARN_ON_SMP(!zoot->bar);
187 *
188 * For CONFIG_SMP, WARN_ON_SMP() should act the same as WARN_ON(),
189 * and should be a nop and return false for uniprocessor.
190 *
191 * if (WARN_ON_SMP(x)) returns true only when CONFIG_SMP is set
192 * and x is true.
193 */
168#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
169# define WARN_ON_SMP(x) WARN_ON(x) 195# define WARN_ON_SMP(x) WARN_ON(x)
170#else 196#else
171# define WARN_ON_SMP(x) do { } while (0) 197# define WARN_ON_SMP(x) ({0;})
172#endif 198#endif
173 199
174#endif 200#endif
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
index fba7d33ca3f2..7a0f69e6c618 100644
--- a/include/asm-generic/types.h
+++ b/include/asm-generic/types.h
@@ -12,31 +12,4 @@ typedef unsigned short umode_t;
12 12
13#endif /* __ASSEMBLY__ */ 13#endif /* __ASSEMBLY__ */
14 14
15/*
16 * These aren't exported outside the kernel to avoid name space clashes
17 */
18#ifdef __KERNEL__
19#ifndef __ASSEMBLY__
20/*
21 * DMA addresses may be very different from physical addresses
22 * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit
23 * systems, while sparc64 uses 32 bit DMA addresses for 64 bit
24 * physical addresses.
25 * This default defines dma_addr_t to have the same size as
26 * phys_addr_t, which is the most common way.
27 * Do not define the dma64_addr_t type, which never really
28 * worked.
29 */
30#ifndef dma_addr_t
31#ifdef CONFIG_PHYS_ADDR_T_64BIT
32typedef u64 dma_addr_t;
33#else
34typedef u32 dma_addr_t;
35#endif /* CONFIG_PHYS_ADDR_T_64BIT */
36#endif /* dma_addr_t */
37
38#endif /* __ASSEMBLY__ */
39
40#endif /* __KERNEL__ */
41
42#endif /* _ASM_GENERIC_TYPES_H */ 15#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 57af0338d270..07c40d5149de 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -650,9 +650,13 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
650__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) 650__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
651#define __NR_open_by_handle_at 265 651#define __NR_open_by_handle_at 265
652__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 652__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
653#define __NR_clock_adjtime 266
654__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
655#define __NR_syncfs 267
656__SYSCALL(__NR_syncfs, sys_syncfs)
653 657
654#undef __NR_syscalls 658#undef __NR_syscalls
655#define __NR_syscalls 266 659#define __NR_syscalls 268
656 660
657/* 661/*
658 * All syscalls below here should go away really, 662 * All syscalls below here should go away really,
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 9ac431396176..4be33b4ca2f8 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -463,12 +463,15 @@ struct drm_irq_busid {
463enum drm_vblank_seq_type { 463enum drm_vblank_seq_type {
464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
466 /* bits 1-6 are reserved for high crtcs */
467 _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
466 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 468 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
467 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 469 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
468 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 470 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
469 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 471 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
470 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 472 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */
471}; 473};
474#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
472 475
473#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 476#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
474#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 477#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
@@ -753,6 +756,7 @@ struct drm_event_vblank {
753}; 756};
754 757
755#define DRM_CAP_DUMB_BUFFER 0x1 758#define DRM_CAP_DUMB_BUFFER 0x1
759#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
756 760
757/* typedef area */ 761/* typedef area */
758#ifndef __KERNEL__ 762#ifndef __KERNEL__
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b0ada6f37dd6..75cf611641e6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -233,6 +233,7 @@ header-y += magic.h
233header-y += major.h 233header-y += major.h
234header-y += map_to_7segment.h 234header-y += map_to_7segment.h
235header-y += matroxfb.h 235header-y += matroxfb.h
236header-y += media.h
236header-y += mempolicy.h 237header-y += mempolicy.h
237header-y += meye.h 238header-y += meye.h
238header-y += mii.h 239header-y += mii.h
@@ -276,6 +277,7 @@ header-y += nfsacl.h
276header-y += nl80211.h 277header-y += nl80211.h
277header-y += nubus.h 278header-y += nubus.h
278header-y += nvram.h 279header-y += nvram.h
280header-y += omap3isp.h
279header-y += omapfb.h 281header-y += omapfb.h
280header-y += oom.h 282header-y += oom.h
281header-y += param.h 283header-y += param.h
@@ -370,6 +372,8 @@ header-y += unistd.h
370header-y += usbdevice_fs.h 372header-y += usbdevice_fs.h
371header-y += utime.h 373header-y += utime.h
372header-y += utsname.h 374header-y += utsname.h
375header-y += v4l2-mediabus.h
376header-y += v4l2-subdev.h
373header-y += veth.h 377header-y += veth.h
374header-y += vhost.h 378header-y += vhost.h
375header-y += videodev2.h 379header-y += videodev2.h
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
index 7180013a4a3a..4afd7102459d 100644
--- a/include/linux/acpi_io.h
+++ b/include/linux/acpi_io.h
@@ -10,7 +10,6 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
10 return ioremap_cache(phys, size); 10 return ioremap_cache(phys, size);
11} 11}
12 12
13int acpi_os_map_generic_address(struct acpi_generic_address *addr); 13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
15 14
16#endif 15#endif
diff --git a/include/linux/aer.h b/include/linux/aer.h
index f7df1eefc107..8414de22a779 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,28 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10struct aer_header_log_regs {
11 unsigned int dw0;
12 unsigned int dw1;
13 unsigned int dw2;
14 unsigned int dw3;
15};
16
17struct aer_capability_regs {
18 u32 header;
19 u32 uncor_status;
20 u32 uncor_mask;
21 u32 uncor_severity;
22 u32 cor_status;
23 u32 cor_mask;
24 u32 cap_control;
25 struct aer_header_log_regs header_log;
26 u32 root_command;
27 u32 root_status;
28 u16 cor_err_source;
29 u16 uncor_err_source;
30};
31
10#if defined(CONFIG_PCIEAER) 32#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */ 33/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 34extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
@@ -27,5 +49,7 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
27} 49}
28#endif 50#endif
29 51
52extern void cper_print_aer(const char *prefix, int cper_severity,
53 struct aer_capability_regs *aer);
30#endif //_AER_H_ 54#endif //_AER_H_
31 55
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index be33b3affc8a..24d26efd1432 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -53,6 +53,7 @@
53#define CNTL_LCDBPP8 (3 << 1) 53#define CNTL_LCDBPP8 (3 << 1)
54#define CNTL_LCDBPP16 (4 << 1) 54#define CNTL_LCDBPP16 (4 << 1)
55#define CNTL_LCDBPP16_565 (6 << 1) 55#define CNTL_LCDBPP16_565 (6 << 1)
56#define CNTL_LCDBPP16_444 (7 << 1)
56#define CNTL_LCDBPP24 (5 << 1) 57#define CNTL_LCDBPP24 (5 << 1)
57#define CNTL_LCDBW (1 << 4) 58#define CNTL_LCDBW (1 << 4)
58#define CNTL_LCDTFT (1 << 5) 59#define CNTL_LCDTFT (1 << 5)
@@ -66,6 +67,32 @@
66#define CNTL_LDMAFIFOTIME (1 << 15) 67#define CNTL_LDMAFIFOTIME (1 << 15)
67#define CNTL_WATERMARK (1 << 16) 68#define CNTL_WATERMARK (1 << 16)
68 69
70enum {
71 /* individual formats */
72 CLCD_CAP_RGB444 = (1 << 0),
73 CLCD_CAP_RGB5551 = (1 << 1),
74 CLCD_CAP_RGB565 = (1 << 2),
75 CLCD_CAP_RGB888 = (1 << 3),
76 CLCD_CAP_BGR444 = (1 << 4),
77 CLCD_CAP_BGR5551 = (1 << 5),
78 CLCD_CAP_BGR565 = (1 << 6),
79 CLCD_CAP_BGR888 = (1 << 7),
80
81 /* connection layouts */
82 CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444,
83 CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551,
84 CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565,
85 CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888,
86
87 /* red/blue ordering */
88 CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 |
89 CLCD_CAP_RGB565 | CLCD_CAP_RGB888,
90 CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 |
91 CLCD_CAP_BGR565 | CLCD_CAP_BGR888,
92
93 CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB,
94};
95
69struct clcd_panel { 96struct clcd_panel {
70 struct fb_videomode mode; 97 struct fb_videomode mode;
71 signed short width; /* width in mm */ 98 signed short width; /* width in mm */
@@ -73,6 +100,7 @@ struct clcd_panel {
73 u32 tim2; 100 u32 tim2;
74 u32 tim3; 101 u32 tim3;
75 u32 cntl; 102 u32 cntl;
103 u32 caps;
76 unsigned int bpp:8, 104 unsigned int bpp:8,
77 fixedtimings:1, 105 fixedtimings:1,
78 grayscale:1; 106 grayscale:1;
@@ -97,6 +125,11 @@ struct clcd_board {
97 const char *name; 125 const char *name;
98 126
99 /* 127 /*
128 * Optional. Hardware capability flags.
129 */
130 u32 caps;
131
132 /*
100 * Optional. Check whether the var structure is acceptable 133 * Optional. Check whether the var structure is acceptable
101 * for this display. 134 * for this display.
102 */ 135 */
@@ -155,34 +188,35 @@ struct clcd_fb {
155 188
156static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 189static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
157{ 190{
191 struct fb_var_screeninfo *var = &fb->fb.var;
158 u32 val, cpl; 192 u32 val, cpl;
159 193
160 /* 194 /*
161 * Program the CLCD controller registers and start the CLCD 195 * Program the CLCD controller registers and start the CLCD
162 */ 196 */
163 val = ((fb->fb.var.xres / 16) - 1) << 2; 197 val = ((var->xres / 16) - 1) << 2;
164 val |= (fb->fb.var.hsync_len - 1) << 8; 198 val |= (var->hsync_len - 1) << 8;
165 val |= (fb->fb.var.right_margin - 1) << 16; 199 val |= (var->right_margin - 1) << 16;
166 val |= (fb->fb.var.left_margin - 1) << 24; 200 val |= (var->left_margin - 1) << 24;
167 regs->tim0 = val; 201 regs->tim0 = val;
168 202
169 val = fb->fb.var.yres; 203 val = var->yres;
170 if (fb->panel->cntl & CNTL_LCDDUAL) 204 if (fb->panel->cntl & CNTL_LCDDUAL)
171 val /= 2; 205 val /= 2;
172 val -= 1; 206 val -= 1;
173 val |= (fb->fb.var.vsync_len - 1) << 10; 207 val |= (var->vsync_len - 1) << 10;
174 val |= fb->fb.var.lower_margin << 16; 208 val |= var->lower_margin << 16;
175 val |= fb->fb.var.upper_margin << 24; 209 val |= var->upper_margin << 24;
176 regs->tim1 = val; 210 regs->tim1 = val;
177 211
178 val = fb->panel->tim2; 212 val = fb->panel->tim2;
179 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS; 213 val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
180 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS; 214 val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
181 215
182 cpl = fb->fb.var.xres_virtual; 216 cpl = var->xres_virtual;
183 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */ 217 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
184 /* / 1 */; 218 /* / 1 */;
185 else if (!fb->fb.var.grayscale) /* STN color */ 219 else if (!var->grayscale) /* STN color */
186 cpl = cpl * 8 / 3; 220 cpl = cpl * 8 / 3;
187 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */ 221 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
188 cpl /= 8; 222 cpl /= 8;
@@ -194,10 +228,22 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
194 regs->tim3 = fb->panel->tim3; 228 regs->tim3 = fb->panel->tim3;
195 229
196 val = fb->panel->cntl; 230 val = fb->panel->cntl;
197 if (fb->fb.var.grayscale) 231 if (var->grayscale)
198 val |= CNTL_LCDBW; 232 val |= CNTL_LCDBW;
199 233
200 switch (fb->fb.var.bits_per_pixel) { 234 if (fb->panel->caps && fb->board->caps &&
235 var->bits_per_pixel >= 16) {
236 /*
237 * if board and panel supply capabilities, we can support
238 * changing BGR/RGB depending on supplied parameters
239 */
240 if (var->red.offset == 0)
241 val &= ~CNTL_BGR;
242 else
243 val |= CNTL_BGR;
244 }
245
246 switch (var->bits_per_pixel) {
201 case 1: 247 case 1:
202 val |= CNTL_LCDBPP1; 248 val |= CNTL_LCDBPP1;
203 break; 249 break;
@@ -212,15 +258,17 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
212 break; 258 break;
213 case 16: 259 case 16:
214 /* 260 /*
215 * PL110 cannot choose between 5551 and 565 modes in 261 * PL110 cannot choose between 5551 and 565 modes in its
216 * its control register 262 * control register. It is possible to use 565 with
263 * custom external wiring.
217 */ 264 */
218 if ((fb->dev->periphid & 0x000fffff) == 0x00041110) 265 if (amba_part(fb->dev) == 0x110 ||
266 var->green.length == 5)
219 val |= CNTL_LCDBPP16; 267 val |= CNTL_LCDBPP16;
220 else if (fb->fb.var.green.length == 5) 268 else if (var->green.length == 6)
221 val |= CNTL_LCDBPP16;
222 else
223 val |= CNTL_LCDBPP16_565; 269 val |= CNTL_LCDBPP16_565;
270 else
271 val |= CNTL_LCDBPP16_444;
224 break; 272 break;
225 case 32: 273 case 32:
226 val |= CNTL_LCDBPP24; 274 val |= CNTL_LCDBPP24;
@@ -228,7 +276,7 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
228 } 276 }
229 277
230 regs->cntl = val; 278 regs->cntl = val;
231 regs->pixclock = fb->fb.var.pixclock; 279 regs->pixclock = var->pixclock;
232} 280}
233 281
234static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) 282static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 475f8c42c0e9..381f4cec8260 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -443,6 +443,7 @@ void atm_dev_signal_change(struct atm_dev *dev, char signal);
443 443
444void vcc_insert_socket(struct sock *sk); 444void vcc_insert_socket(struct sock *sk);
445 445
446void atm_dev_release_vccs(struct atm_dev *dev);
446 447
447/* 448/*
448 * This is approximately the algorithm used by alloc_skb. 449 * This is approximately the algorithm used by alloc_skb.
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 4ce34fa937d4..96f4094b706d 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -66,8 +66,6 @@ struct backing_dev_info {
66 unsigned int capabilities; /* Device capabilities */ 66 unsigned int capabilities; /* Device capabilities */
67 congested_fn *congested_fn; /* Function pointer if device is md/dm */ 67 congested_fn *congested_fn; /* Function pointer if device is md/dm */
68 void *congested_data; /* Pointer to aux data for congested func */ 68 void *congested_data; /* Pointer to aux data for congested func */
69 void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
70 void *unplug_io_data;
71 69
72 char *name; 70 char *name;
73 71
@@ -251,7 +249,6 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
251 249
252extern struct backing_dev_info default_backing_dev_info; 250extern struct backing_dev_info default_backing_dev_info;
253extern struct backing_dev_info noop_backing_dev_info; 251extern struct backing_dev_info noop_backing_dev_info;
254void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
255 252
256int writeback_in_progress(struct backing_dev_info *bdi); 253int writeback_in_progress(struct backing_dev_info *bdi);
257 254
@@ -336,17 +333,4 @@ static inline int bdi_sched_wait(void *word)
336 return 0; 333 return 0;
337} 334}
338 335
339static inline void blk_run_backing_dev(struct backing_dev_info *bdi,
340 struct page *page)
341{
342 if (bdi && bdi->unplug_io_fn)
343 bdi->unplug_io_fn(bdi, page);
344}
345
346static inline void blk_run_address_space(struct address_space *mapping)
347{
348 if (mapping)
349 blk_run_backing_dev(mapping->backing_dev_info, NULL);
350}
351
352#endif /* _LINUX_BACKING_DEV_H */ 336#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 4a3d52e545e1..5ffc6dda4675 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -32,6 +32,13 @@ enum backlight_update_reason {
32 BACKLIGHT_UPDATE_SYSFS, 32 BACKLIGHT_UPDATE_SYSFS,
33}; 33};
34 34
35enum backlight_type {
36 BACKLIGHT_RAW = 1,
37 BACKLIGHT_PLATFORM,
38 BACKLIGHT_FIRMWARE,
39 BACKLIGHT_TYPE_MAX,
40};
41
35struct backlight_device; 42struct backlight_device;
36struct fb_info; 43struct fb_info;
37 44
@@ -62,6 +69,8 @@ struct backlight_properties {
62 /* FB Blanking active? (values as for power) */ 69 /* FB Blanking active? (values as for power) */
63 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ 70 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
64 int fb_blank; 71 int fb_blank;
72 /* Backlight type */
73 enum backlight_type type;
65 /* Flags used to signal drivers of state changes */ 74 /* Flags used to signal drivers of state changes */
66 /* Upper 4 bits are reserved for driver internal use */ 75 /* Upper 4 bits are reserved for driver internal use */
67 unsigned int state; 76 unsigned int state;
diff --git a/include/linux/bch.h b/include/linux/bch.h
new file mode 100644
index 000000000000..295b4ef153bb
--- /dev/null
+++ b/include/linux/bch.h
@@ -0,0 +1,79 @@
1/*
2 * Generic binary BCH encoding/decoding library
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Copyright © 2011 Parrot S.A.
18 *
19 * Author: Ivan Djelic <ivan.djelic@parrot.com>
20 *
21 * Description:
22 *
23 * This library provides runtime configurable encoding/decoding of binary
24 * Bose-Chaudhuri-Hocquenghem (BCH) codes.
25*/
26#ifndef _BCH_H
27#define _BCH_H
28
29#include <linux/types.h>
30
31/**
32 * struct bch_control - BCH control structure
33 * @m: Galois field order
34 * @n: maximum codeword size in bits (= 2^m-1)
35 * @t: error correction capability in bits
36 * @ecc_bits: ecc exact size in bits, i.e. generator polynomial degree (<=m*t)
37 * @ecc_bytes: ecc max size (m*t bits) in bytes
38 * @a_pow_tab: Galois field GF(2^m) exponentiation lookup table
39 * @a_log_tab: Galois field GF(2^m) log lookup table
40 * @mod8_tab: remainder generator polynomial lookup tables
41 * @ecc_buf: ecc parity words buffer
42 * @ecc_buf2: ecc parity words buffer
43 * @xi_tab: GF(2^m) base for solving degree 2 polynomial roots
44 * @syn: syndrome buffer
45 * @cache: log-based polynomial representation buffer
46 * @elp: error locator polynomial
47 * @poly_2t: temporary polynomials of degree 2t
48 */
49struct bch_control {
50 unsigned int m;
51 unsigned int n;
52 unsigned int t;
53 unsigned int ecc_bits;
54 unsigned int ecc_bytes;
55/* private: */
56 uint16_t *a_pow_tab;
57 uint16_t *a_log_tab;
58 uint32_t *mod8_tab;
59 uint32_t *ecc_buf;
60 uint32_t *ecc_buf2;
61 unsigned int *xi_tab;
62 unsigned int *syn;
63 int *cache;
64 struct gf_poly *elp;
65 struct gf_poly *poly_2t[4];
66};
67
68struct bch_control *init_bch(int m, int t, unsigned int prim_poly);
69
70void free_bch(struct bch_control *bch);
71
72void encode_bch(struct bch_control *bch, const uint8_t *data,
73 unsigned int len, uint8_t *ecc);
74
75int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
76 const uint8_t *recv_ecc, const uint8_t *calc_ecc,
77 const unsigned int *syn, unsigned int *errloc);
78
79#endif /* _BCH_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 35dcdb3589bc..ce33e6868a2f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -304,7 +304,6 @@ struct biovec_slab {
304}; 304};
305 305
306extern struct bio_set *fs_bio_set; 306extern struct bio_set *fs_bio_set;
307extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
308 307
309/* 308/*
310 * a small number of entries is fine, not going to be performance critical. 309 * a small number of entries is fine, not going to be performance critical.
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 46ad5197537a..be50d9e70a7d 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -128,7 +128,6 @@ enum rq_flag_bits {
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
129 129
130 /* bio only flags */ 130 /* bio only flags */
131 __REQ_UNPLUG, /* unplug the immediately after submission */
132 __REQ_RAHEAD, /* read ahead, can fail anytime */ 131 __REQ_RAHEAD, /* read ahead, can fail anytime */
133 __REQ_THROTTLED, /* This bio has already been subjected to 132 __REQ_THROTTLED, /* This bio has already been subjected to
134 * throttling rules. Don't do it again. */ 133 * throttling rules. Don't do it again. */
@@ -148,9 +147,11 @@ enum rq_flag_bits {
148 __REQ_ALLOCED, /* request came from our alloc pool */ 147 __REQ_ALLOCED, /* request came from our alloc pool */
149 __REQ_COPY_USER, /* contains copies of user pages */ 148 __REQ_COPY_USER, /* contains copies of user pages */
150 __REQ_FLUSH, /* request for cache flush */ 149 __REQ_FLUSH, /* request for cache flush */
150 __REQ_FLUSH_SEQ, /* request for flush sequence */
151 __REQ_IO_STAT, /* account I/O stat */ 151 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ 153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
154 __REQ_ON_PLUG, /* on plug list */
154 __REQ_NR_BITS, /* stops here */ 155 __REQ_NR_BITS, /* stops here */
155}; 156};
156 157
@@ -170,7 +171,6 @@ enum rq_flag_bits {
170 REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 171 REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
171#define REQ_CLONE_MASK REQ_COMMON_MASK 172#define REQ_CLONE_MASK REQ_COMMON_MASK
172 173
173#define REQ_UNPLUG (1 << __REQ_UNPLUG)
174#define REQ_RAHEAD (1 << __REQ_RAHEAD) 174#define REQ_RAHEAD (1 << __REQ_RAHEAD)
175#define REQ_THROTTLED (1 << __REQ_THROTTLED) 175#define REQ_THROTTLED (1 << __REQ_THROTTLED)
176 176
@@ -188,8 +188,10 @@ enum rq_flag_bits {
188#define REQ_ALLOCED (1 << __REQ_ALLOCED) 188#define REQ_ALLOCED (1 << __REQ_ALLOCED)
189#define REQ_COPY_USER (1 << __REQ_COPY_USER) 189#define REQ_COPY_USER (1 << __REQ_COPY_USER)
190#define REQ_FLUSH (1 << __REQ_FLUSH) 190#define REQ_FLUSH (1 << __REQ_FLUSH)
191#define REQ_FLUSH_SEQ (1 << __REQ_FLUSH_SEQ)
191#define REQ_IO_STAT (1 << __REQ_IO_STAT) 192#define REQ_IO_STAT (1 << __REQ_IO_STAT)
192#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) 193#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
193#define REQ_SECURE (1 << __REQ_SECURE) 194#define REQ_SECURE (1 << __REQ_SECURE)
195#define REQ_ON_PLUG (1 << __REQ_ON_PLUG)
194 196
195#endif /* __LINUX_BLK_TYPES_H */ 197#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d5063e1b5555..16a902f099ac 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -108,11 +108,17 @@ struct request {
108 108
109 /* 109 /*
110 * Three pointers are available for the IO schedulers, if they need 110 * Three pointers are available for the IO schedulers, if they need
111 * more they have to dynamically allocate it. 111 * more they have to dynamically allocate it. Flush requests are
112 * never put on the IO scheduler. So let the flush fields share
113 * space with the three elevator_private pointers.
112 */ 114 */
113 void *elevator_private; 115 union {
114 void *elevator_private2; 116 void *elevator_private[3];
115 void *elevator_private3; 117 struct {
118 unsigned int seq;
119 struct list_head list;
120 } flush;
121 };
116 122
117 struct gendisk *rq_disk; 123 struct gendisk *rq_disk;
118 struct hd_struct *part; 124 struct hd_struct *part;
@@ -190,7 +196,6 @@ typedef void (request_fn_proc) (struct request_queue *q);
190typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 196typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
191typedef int (prep_rq_fn) (struct request_queue *, struct request *); 197typedef int (prep_rq_fn) (struct request_queue *, struct request *);
192typedef void (unprep_rq_fn) (struct request_queue *, struct request *); 198typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
193typedef void (unplug_fn) (struct request_queue *);
194 199
195struct bio_vec; 200struct bio_vec;
196struct bvec_merge_data { 201struct bvec_merge_data {
@@ -273,7 +278,6 @@ struct request_queue
273 make_request_fn *make_request_fn; 278 make_request_fn *make_request_fn;
274 prep_rq_fn *prep_rq_fn; 279 prep_rq_fn *prep_rq_fn;
275 unprep_rq_fn *unprep_rq_fn; 280 unprep_rq_fn *unprep_rq_fn;
276 unplug_fn *unplug_fn;
277 merge_bvec_fn *merge_bvec_fn; 281 merge_bvec_fn *merge_bvec_fn;
278 softirq_done_fn *softirq_done_fn; 282 softirq_done_fn *softirq_done_fn;
279 rq_timed_out_fn *rq_timed_out_fn; 283 rq_timed_out_fn *rq_timed_out_fn;
@@ -287,12 +291,9 @@ struct request_queue
287 struct request *boundary_rq; 291 struct request *boundary_rq;
288 292
289 /* 293 /*
290 * Auto-unplugging state 294 * Delayed queue handling
291 */ 295 */
292 struct timer_list unplug_timer; 296 struct delayed_work delay_work;
293 int unplug_thresh; /* After this many requests */
294 unsigned long unplug_delay; /* After this many jiffies */
295 struct work_struct unplug_work;
296 297
297 struct backing_dev_info backing_dev_info; 298 struct backing_dev_info backing_dev_info;
298 299
@@ -363,11 +364,12 @@ struct request_queue
363 * for flush operations 364 * for flush operations
364 */ 365 */
365 unsigned int flush_flags; 366 unsigned int flush_flags;
366 unsigned int flush_seq; 367 unsigned int flush_pending_idx:1;
367 int flush_err; 368 unsigned int flush_running_idx:1;
369 unsigned long flush_pending_since;
370 struct list_head flush_queue[2];
371 struct list_head flush_data_in_flight;
368 struct request flush_rq; 372 struct request flush_rq;
369 struct request *orig_flush_rq;
370 struct list_head pending_flushes;
371 373
372 struct mutex sysfs_lock; 374 struct mutex sysfs_lock;
373 375
@@ -387,14 +389,13 @@ struct request_queue
387#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ 389#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
388#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 390#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
389#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 391#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
390#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 392#define QUEUE_FLAG_ELVSWITCH 7 /* don't use elevator, just do FIFO */
391#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 393#define QUEUE_FLAG_BIDI 8 /* queue supports bidi requests */
392#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 394#define QUEUE_FLAG_NOMERGES 9 /* disable merge attempts */
393#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ 395#define QUEUE_FLAG_SAME_COMP 10 /* force complete on same CPU */
394#define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */ 396#define QUEUE_FLAG_FAIL_IO 11 /* fake timeout */
395#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ 397#define QUEUE_FLAG_STACKABLE 12 /* supports request stacking */
396#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ 398#define QUEUE_FLAG_NONROT 13 /* non-rotational device (SSD) */
397#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
398#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ 399#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
399#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 400#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
400#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 401#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
@@ -472,7 +473,6 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
472 __clear_bit(flag, &q->queue_flags); 473 __clear_bit(flag, &q->queue_flags);
473} 474}
474 475
475#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
476#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 476#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
477#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 477#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
478#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 478#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
@@ -667,9 +667,7 @@ extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
667extern void blk_rq_unprep_clone(struct request *rq); 667extern void blk_rq_unprep_clone(struct request *rq);
668extern int blk_insert_cloned_request(struct request_queue *q, 668extern int blk_insert_cloned_request(struct request_queue *q,
669 struct request *rq); 669 struct request *rq);
670extern void blk_plug_device(struct request_queue *); 670extern void blk_delay_queue(struct request_queue *, unsigned long);
671extern void blk_plug_device_unlocked(struct request_queue *);
672extern int blk_remove_plug(struct request_queue *);
673extern void blk_recount_segments(struct request_queue *, struct bio *); 671extern void blk_recount_segments(struct request_queue *, struct bio *);
674extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, 672extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
675 unsigned int, void __user *); 673 unsigned int, void __user *);
@@ -713,7 +711,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
713 struct request *, int); 711 struct request *, int);
714extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 712extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
715 struct request *, int, rq_end_io_fn *); 713 struct request *, int, rq_end_io_fn *);
716extern void blk_unplug(struct request_queue *q);
717 714
718static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 715static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
719{ 716{
@@ -850,7 +847,6 @@ extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bd
850 847
851extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 848extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
852extern void blk_dump_rq_flags(struct request *, char *); 849extern void blk_dump_rq_flags(struct request *, char *);
853extern void generic_unplug_device(struct request_queue *);
854extern long nr_blockdev_pages(void); 850extern long nr_blockdev_pages(void);
855 851
856int blk_get_queue(struct request_queue *); 852int blk_get_queue(struct request_queue *);
@@ -858,6 +854,31 @@ struct request_queue *blk_alloc_queue(gfp_t);
858struct request_queue *blk_alloc_queue_node(gfp_t, int); 854struct request_queue *blk_alloc_queue_node(gfp_t, int);
859extern void blk_put_queue(struct request_queue *); 855extern void blk_put_queue(struct request_queue *);
860 856
857struct blk_plug {
858 unsigned long magic;
859 struct list_head list;
860 unsigned int should_sort;
861};
862
863extern void blk_start_plug(struct blk_plug *);
864extern void blk_finish_plug(struct blk_plug *);
865extern void __blk_flush_plug(struct task_struct *, struct blk_plug *);
866
867static inline void blk_flush_plug(struct task_struct *tsk)
868{
869 struct blk_plug *plug = tsk->plug;
870
871 if (unlikely(plug))
872 __blk_flush_plug(tsk, plug);
873}
874
875static inline bool blk_needs_flush_plug(struct task_struct *tsk)
876{
877 struct blk_plug *plug = tsk->plug;
878
879 return plug && !list_empty(&plug->list);
880}
881
861/* 882/*
862 * tag stuff 883 * tag stuff
863 */ 884 */
@@ -1135,7 +1156,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1135extern int blk_throtl_init(struct request_queue *q); 1156extern int blk_throtl_init(struct request_queue *q);
1136extern void blk_throtl_exit(struct request_queue *q); 1157extern void blk_throtl_exit(struct request_queue *q);
1137extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); 1158extern int blk_throtl_bio(struct request_queue *q, struct bio **bio);
1138extern void throtl_shutdown_timer_wq(struct request_queue *q);
1139#else /* CONFIG_BLK_DEV_THROTTLING */ 1159#else /* CONFIG_BLK_DEV_THROTTLING */
1140static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) 1160static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1141{ 1161{
@@ -1144,7 +1164,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1144 1164
1145static inline int blk_throtl_init(struct request_queue *q) { return 0; } 1165static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1146static inline int blk_throtl_exit(struct request_queue *q) { return 0; } 1166static inline int blk_throtl_exit(struct request_queue *q) { return 0; }
1147static inline void throtl_shutdown_timer_wq(struct request_queue *q) {}
1148#endif /* CONFIG_BLK_DEV_THROTTLING */ 1167#endif /* CONFIG_BLK_DEV_THROTTLING */
1149 1168
1150#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1169#define MODULE_ALIAS_BLOCKDEV(major,minor) \
@@ -1278,6 +1297,26 @@ static inline long nr_blockdev_pages(void)
1278 return 0; 1297 return 0;
1279} 1298}
1280 1299
1300struct blk_plug {
1301};
1302
1303static inline void blk_start_plug(struct blk_plug *plug)
1304{
1305}
1306
1307static inline void blk_finish_plug(struct blk_plug *plug)
1308{
1309}
1310
1311static inline void blk_flush_plug(struct task_struct *task)
1312{
1313}
1314
1315static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1316{
1317 return false;
1318}
1319
1281#endif /* CONFIG_BLOCK */ 1320#endif /* CONFIG_BLOCK */
1282 1321
1283#endif 1322#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 499dfe982a0e..b8613e806aa9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -19,10 +19,6 @@ extern unsigned long min_low_pfn;
19 */ 19 */
20extern unsigned long max_pfn; 20extern unsigned long max_pfn;
21 21
22#ifdef CONFIG_CRASH_DUMP
23extern unsigned long saved_max_pfn;
24#endif
25
26#ifndef CONFIG_NO_BOOTMEM 22#ifndef CONFIG_NO_BOOTMEM
27/* 23/*
28 * node_bootmem_map is a map pointer - the bits represent all physical 24 * node_bootmem_map is a map pointer - the bits represent all physical
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 68d1fe7b877c..f5df23561b96 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -219,7 +219,6 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size);
219int block_commit_write(struct page *page, unsigned from, unsigned to); 219int block_commit_write(struct page *page, unsigned from, unsigned to);
220int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, 220int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
221 get_block_t get_block); 221 get_block_t get_block);
222void block_sync_page(struct page *);
223sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 222sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
224int block_truncate_page(struct address_space *, loff_t, get_block_t *); 223int block_truncate_page(struct address_space *, loff_t, get_block_t *);
225int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned, 224int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 6c507bea275f..6f70a6d3a16e 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -36,10 +36,10 @@
36 * @prot: pointer to struct proto structure. 36 * @prot: pointer to struct proto structure.
37 */ 37 */
38struct can_proto { 38struct can_proto {
39 int type; 39 int type;
40 int protocol; 40 int protocol;
41 struct proto_ops *ops; 41 const struct proto_ops *ops;
42 struct proto *prot; 42 struct proto *prot;
43}; 43};
44 44
45/* function prototypes for the CAN networklayer core (af_can.c) */ 45/* function prototypes for the CAN networklayer core (af_can.c) */
@@ -58,5 +58,6 @@ extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58 void *data); 58 void *data);
59 59
60extern int can_send(struct sk_buff *skb, int loop); 60extern int can_send(struct sk_buff *skb, int loop);
61extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
61 62
62#endif /* CAN_CORE_H */ 63#endif /* CAN_CORE_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index fb16a3699b99..16ee8b49a200 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -368,6 +368,15 @@ struct cpu_vfs_cap_data {
368 368
369#ifdef __KERNEL__ 369#ifdef __KERNEL__
370 370
371struct dentry;
372struct user_namespace;
373
374struct user_namespace *current_user_ns(void);
375
376extern const kernel_cap_t __cap_empty_set;
377extern const kernel_cap_t __cap_full_set;
378extern const kernel_cap_t __cap_init_eff_set;
379
371/* 380/*
372 * Internal kernel functions only 381 * Internal kernel functions only
373 */ 382 */
@@ -530,40 +539,27 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
530 cap_intersect(permitted, __cap_nfsd_set)); 539 cap_intersect(permitted, __cap_nfsd_set));
531} 540}
532 541
533extern const kernel_cap_t __cap_empty_set; 542extern bool has_capability(struct task_struct *t, int cap);
534extern const kernel_cap_t __cap_full_set; 543extern bool has_ns_capability(struct task_struct *t,
535extern const kernel_cap_t __cap_init_eff_set; 544 struct user_namespace *ns, int cap);
536 545extern bool has_capability_noaudit(struct task_struct *t, int cap);
537/** 546extern bool capable(int cap);
538 * has_capability - Determine if a task has a superior capability available 547extern bool ns_capable(struct user_namespace *ns, int cap);
539 * @t: The task in question 548extern bool task_ns_capable(struct task_struct *t, int cap);
540 * @cap: The capability to be tested for
541 *
542 * Return true if the specified task has the given superior capability
543 * currently in effect, false if not.
544 *
545 * Note that this does not set PF_SUPERPRIV on the task.
546 */
547#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
548 549
549/** 550/**
550 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited) 551 * nsown_capable - Check superior capability to one's own user_ns
551 * @t: The task in question 552 * @cap: The capability in question
552 * @cap: The capability to be tested for
553 * 553 *
554 * Return true if the specified task has the given superior capability 554 * Return true if the current task has the given superior capability
555 * currently in effect, false if not, but don't write an audit message for the 555 * targeted at its own user namespace.
556 * check.
557 *
558 * Note that this does not set PF_SUPERPRIV on the task.
559 */ 556 */
560#define has_capability_noaudit(t, cap) \ 557static inline bool nsown_capable(int cap)
561 (security_real_capable_noaudit((t), (cap)) == 0) 558{
562 559 return ns_capable(current_user_ns(), cap);
563extern int capable(int cap); 560}
564 561
565/* audit system wants to get cap info from files as well */ 562/* audit system wants to get cap info from files as well */
566struct dentry;
567extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 563extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
568 564
569#endif /* __KERNEL__ */ 565#endif /* __KERNEL__ */
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 09dcc0c2ffd5..b8e995fbd867 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -136,9 +136,18 @@ struct ceph_dir_layout {
136 136
137 137
138/* osd */ 138/* osd */
139#define CEPH_MSG_OSD_MAP 41 139#define CEPH_MSG_OSD_MAP 41
140#define CEPH_MSG_OSD_OP 42 140#define CEPH_MSG_OSD_OP 42
141#define CEPH_MSG_OSD_OPREPLY 43 141#define CEPH_MSG_OSD_OPREPLY 43
142#define CEPH_MSG_WATCH_NOTIFY 44
143
144
145/* watch-notify operations */
146enum {
147 WATCH_NOTIFY = 1, /* notifying watcher */
148 WATCH_NOTIFY_COMPLETE = 2, /* notifier notified when done */
149};
150
142 151
143/* pool operations */ 152/* pool operations */
144enum { 153enum {
@@ -213,8 +222,10 @@ struct ceph_client_mount {
213 struct ceph_mon_request_header monhdr; 222 struct ceph_mon_request_header monhdr;
214} __attribute__ ((packed)); 223} __attribute__ ((packed));
215 224
225#define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */
226
216struct ceph_mon_subscribe_item { 227struct ceph_mon_subscribe_item {
217 __le64 have_version; __le64 have; 228 __le64 have_version; __le64 have;
218 __u8 onetime; 229 __u8 onetime;
219} __attribute__ ((packed)); 230} __attribute__ ((packed));
220 231
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 72c72bfccb88..0d2e0fffb470 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -71,7 +71,6 @@ struct ceph_options {
71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ 71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
72#define CEPH_OSD_KEEPALIVE_DEFAULT 5 72#define CEPH_OSD_KEEPALIVE_DEFAULT 5
73#define CEPH_OSD_IDLE_TTL_DEFAULT 60 73#define CEPH_OSD_IDLE_TTL_DEFAULT 60
74#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
75 74
76#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 75#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
77#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 76#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index a1af29648fb5..f88eacb111d4 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -32,6 +32,7 @@ struct ceph_osd {
32 struct rb_node o_node; 32 struct rb_node o_node;
33 struct ceph_connection o_con; 33 struct ceph_connection o_con;
34 struct list_head o_requests; 34 struct list_head o_requests;
35 struct list_head o_linger_requests;
35 struct list_head o_osd_lru; 36 struct list_head o_osd_lru;
36 struct ceph_authorizer *o_authorizer; 37 struct ceph_authorizer *o_authorizer;
37 void *o_authorizer_buf, *o_authorizer_reply_buf; 38 void *o_authorizer_buf, *o_authorizer_reply_buf;
@@ -47,6 +48,8 @@ struct ceph_osd_request {
47 struct rb_node r_node; 48 struct rb_node r_node;
48 struct list_head r_req_lru_item; 49 struct list_head r_req_lru_item;
49 struct list_head r_osd_item; 50 struct list_head r_osd_item;
51 struct list_head r_linger_item;
52 struct list_head r_linger_osd;
50 struct ceph_osd *r_osd; 53 struct ceph_osd *r_osd;
51 struct ceph_pg r_pgid; 54 struct ceph_pg r_pgid;
52 int r_pg_osds[CEPH_PG_MAX_SIZE]; 55 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -59,6 +62,7 @@ struct ceph_osd_request {
59 int r_flags; /* any additional flags for the osd */ 62 int r_flags; /* any additional flags for the osd */
60 u32 r_sent; /* >0 if r_request is sending/sent */ 63 u32 r_sent; /* >0 if r_request is sending/sent */
61 int r_got_reply; 64 int r_got_reply;
65 int r_linger;
62 66
63 struct ceph_osd_client *r_osdc; 67 struct ceph_osd_client *r_osdc;
64 struct kref r_kref; 68 struct kref r_kref;
@@ -74,7 +78,6 @@ struct ceph_osd_request {
74 char r_oid[40]; /* object name */ 78 char r_oid[40]; /* object name */
75 int r_oid_len; 79 int r_oid_len;
76 unsigned long r_stamp; /* send OR check time */ 80 unsigned long r_stamp; /* send OR check time */
77 bool r_resend; /* msg send failed, needs retry */
78 81
79 struct ceph_file_layout r_file_layout; 82 struct ceph_file_layout r_file_layout;
80 struct ceph_snap_context *r_snapc; /* snap context for writes */ 83 struct ceph_snap_context *r_snapc; /* snap context for writes */
@@ -90,6 +93,26 @@ struct ceph_osd_request {
90 struct ceph_pagelist *r_trail; /* trailing part of the data */ 93 struct ceph_pagelist *r_trail; /* trailing part of the data */
91}; 94};
92 95
96struct ceph_osd_event {
97 u64 cookie;
98 int one_shot;
99 struct ceph_osd_client *osdc;
100 void (*cb)(u64, u64, u8, void *);
101 void *data;
102 struct rb_node node;
103 struct list_head osd_node;
104 struct kref kref;
105 struct completion completion;
106};
107
108struct ceph_osd_event_work {
109 struct work_struct work;
110 struct ceph_osd_event *event;
111 u64 ver;
112 u64 notify_id;
113 u8 opcode;
114};
115
93struct ceph_osd_client { 116struct ceph_osd_client {
94 struct ceph_client *client; 117 struct ceph_client *client;
95 118
@@ -104,7 +127,10 @@ struct ceph_osd_client {
104 u64 timeout_tid; /* tid of timeout triggering rq */ 127 u64 timeout_tid; /* tid of timeout triggering rq */
105 u64 last_tid; /* tid of last request */ 128 u64 last_tid; /* tid of last request */
106 struct rb_root requests; /* pending requests */ 129 struct rb_root requests; /* pending requests */
107 struct list_head req_lru; /* pending requests lru */ 130 struct list_head req_lru; /* in-flight lru */
131 struct list_head req_unsent; /* unsent/need-resend queue */
132 struct list_head req_notarget; /* map to no osd */
133 struct list_head req_linger; /* lingering requests */
108 int num_requests; 134 int num_requests;
109 struct delayed_work timeout_work; 135 struct delayed_work timeout_work;
110 struct delayed_work osds_timeout_work; 136 struct delayed_work osds_timeout_work;
@@ -116,6 +142,12 @@ struct ceph_osd_client {
116 142
117 struct ceph_msgpool msgpool_op; 143 struct ceph_msgpool msgpool_op;
118 struct ceph_msgpool msgpool_op_reply; 144 struct ceph_msgpool msgpool_op_reply;
145
146 spinlock_t event_lock;
147 struct rb_root event_tree;
148 u64 event_count;
149
150 struct workqueue_struct *notify_wq;
119}; 151};
120 152
121struct ceph_osd_req_op { 153struct ceph_osd_req_op {
@@ -150,6 +182,13 @@ struct ceph_osd_req_op {
150 struct { 182 struct {
151 u64 snapid; 183 u64 snapid;
152 } snap; 184 } snap;
185 struct {
186 u64 cookie;
187 u64 ver;
188 __u8 flag;
189 u32 prot_ver;
190 u32 timeout;
191 } watch;
153 }; 192 };
154 u32 payload_len; 193 u32 payload_len;
155}; 194};
@@ -198,6 +237,11 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
198 bool use_mempool, int num_reply, 237 bool use_mempool, int num_reply,
199 int page_align); 238 int page_align);
200 239
240extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
241 struct ceph_osd_request *req);
242extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc,
243 struct ceph_osd_request *req);
244
201static inline void ceph_osdc_get_request(struct ceph_osd_request *req) 245static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
202{ 246{
203 kref_get(&req->r_kref); 247 kref_get(&req->r_kref);
@@ -233,5 +277,14 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
233 struct page **pages, int nr_pages, 277 struct page **pages, int nr_pages,
234 int flags, int do_sync, bool nofail); 278 int flags, int do_sync, bool nofail);
235 279
280/* watch/notify events */
281extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
282 void (*event_cb)(u64, u64, u8, void *),
283 int one_shot, void *data,
284 struct ceph_osd_event **pevent);
285extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
286extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
287 unsigned long timeout);
288extern void ceph_osdc_put_event(struct ceph_osd_event *event);
236#endif 289#endif
237 290
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 6d5247f2e81b..0a99099801a4 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -12,9 +12,9 @@
12 * osdmap encoding versions 12 * osdmap encoding versions
13 */ 13 */
14#define CEPH_OSDMAP_INC_VERSION 5 14#define CEPH_OSDMAP_INC_VERSION 5
15#define CEPH_OSDMAP_INC_VERSION_EXT 5 15#define CEPH_OSDMAP_INC_VERSION_EXT 6
16#define CEPH_OSDMAP_VERSION 5 16#define CEPH_OSDMAP_VERSION 5
17#define CEPH_OSDMAP_VERSION_EXT 5 17#define CEPH_OSDMAP_VERSION_EXT 6
18 18
19/* 19/*
20 * fs id 20 * fs id
@@ -181,9 +181,17 @@ enum {
181 /* read */ 181 /* read */
182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, 183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
184 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
184 185
185 /* fancy read */ 186 /* fancy read */
186 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, 187 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
188 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
189
190 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
191 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
192
193 /* versioning */
194 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
187 195
188 /* write */ 196 /* write */
189 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, 197 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
@@ -205,6 +213,8 @@ enum {
205 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, 213 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
206 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, 214 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
207 215
216 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
217
208 /** attrs **/ 218 /** attrs **/
209 /* read */ 219 /* read */
210 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 220 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -218,11 +228,14 @@ enum {
218 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, 228 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
219 229
220 /** subop **/ 230 /** subop **/
221 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, 231 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
222 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, 232 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
223 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, 233 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
224 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, 234 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
225 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, 235 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
236 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
237 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
238 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
226 239
227 /** lock **/ 240 /** lock **/
228 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, 241 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
@@ -328,6 +341,8 @@ enum {
328 CEPH_OSD_CMPXATTR_MODE_U64 = 2 341 CEPH_OSD_CMPXATTR_MODE_U64 = 2
329}; 342};
330 343
344#define RADOS_NOTIFY_VER 1
345
331/* 346/*
332 * an individual object operation. each may be accompanied by some data 347 * an individual object operation. each may be accompanied by some data
333 * payload 348 * payload
@@ -359,7 +374,12 @@ struct ceph_osd_op {
359 struct { 374 struct {
360 __le64 snapid; 375 __le64 snapid;
361 } __attribute__ ((packed)) snap; 376 } __attribute__ ((packed)) snap;
362 }; 377 struct {
378 __le64 cookie;
379 __le64 ver;
380 __u8 flag; /* 0 = unwatch, 1 = watch */
381 } __attribute__ ((packed)) watch;
382};
363 __le32 payload_len; 383 __le32 payload_len;
364} __attribute__ ((packed)); 384} __attribute__ ((packed));
365 385
@@ -402,4 +422,5 @@ struct ceph_osd_reply_head {
402} __attribute__ ((packed)); 422} __attribute__ ((packed));
403 423
404 424
425
405#endif 426#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index dfa2ed4c0d26..cc9f7a428649 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -11,9 +11,6 @@
11/* The full zone was compacted */ 11/* The full zone was compacted */
12#define COMPACT_COMPLETE 3 12#define COMPACT_COMPLETE 3
13 13
14#define COMPACT_MODE_DIRECT_RECLAIM 0
15#define COMPACT_MODE_KSWAPD 1
16
17#ifdef CONFIG_COMPACTION 14#ifdef CONFIG_COMPACTION
18extern int sysctl_compact_memory; 15extern int sysctl_compact_memory;
19extern int sysctl_compaction_handler(struct ctl_table *table, int write, 16extern int sysctl_compaction_handler(struct ctl_table *table, int write,
@@ -28,8 +25,7 @@ extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
28 bool sync); 25 bool sync);
29extern unsigned long compaction_suitable(struct zone *zone, int order); 26extern unsigned long compaction_suitable(struct zone *zone, int order);
30extern unsigned long compact_zone_order(struct zone *zone, int order, 27extern unsigned long compact_zone_order(struct zone *zone, int order,
31 gfp_t gfp_mask, bool sync, 28 gfp_t gfp_mask, bool sync);
32 int compact_mode);
33 29
34/* Do not skip compaction more than 64 times */ 30/* Do not skip compaction more than 64 times */
35#define COMPACT_MAX_DEFER_SHIFT 6 31#define COMPACT_MAX_DEFER_SHIFT 6
@@ -74,8 +70,7 @@ static inline unsigned long compaction_suitable(struct zone *zone, int order)
74} 70}
75 71
76static inline unsigned long compact_zone_order(struct zone *zone, int order, 72static inline unsigned long compact_zone_order(struct zone *zone, int order,
77 gfp_t gfp_mask, bool sync, 73 gfp_t gfp_mask, bool sync)
78 int compact_mode)
79{ 74{
80 return COMPACT_CONTINUE; 75 return COMPACT_CONTINUE;
81} 76}
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 16508bcddacc..cb4c1eb7778e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -92,3 +92,11 @@
92#if !defined(__noclone) 92#if !defined(__noclone)
93#define __noclone /* not needed */ 93#define __noclone /* not needed */
94#endif 94#endif
95
96/*
97 * A trick to suppress uninitialized variable warning without generating any
98 * code
99 */
100#define uninitialized_var(x) x = x
101
102#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index b721129e0469..37d412436d0f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -21,11 +21,3 @@
21# error "GCOV profiling support for gcc versions below 3.4 not included" 21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */ 22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */ 23#endif /* CONFIG_GCOV_KERNEL */
24
25/*
26 * A trick to suppress uninitialized variable warning without generating any
27 * code
28 */
29#define uninitialized_var(x) x = x
30
31#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index fcfa5b9a4317..64b7c003fd7a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -12,13 +12,6 @@
12#define __used __attribute__((__used__)) 12#define __used __attribute__((__used__))
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15#define __always_inline inline __attribute__((always_inline))
16
17/*
18 * A trick to suppress uninitialized variable warning without generating any
19 * code
20 */
21#define uninitialized_var(x) x = x
22 15
23#if __GNUC_MINOR__ >= 3 16#if __GNUC_MINOR__ >= 3
24/* Mark functions as cold. gcc will assume any path leading to a call 17/* Mark functions as cold. gcc will assume any path leading to a call
@@ -53,7 +46,6 @@
53#define __noclone __attribute__((__noclone__)) 46#define __noclone __attribute__((__noclone__))
54 47
55#endif 48#endif
56
57#endif 49#endif
58 50
59#if __GNUC_MINOR__ > 0 51#if __GNUC_MINOR__ > 0
diff --git a/include/linux/connector.h b/include/linux/connector.h
index bcafc942e5e4..7c60d0942adb 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -88,8 +88,6 @@ struct cn_queue_dev {
88 atomic_t refcnt; 88 atomic_t refcnt;
89 unsigned char name[CN_CBQ_NAMELEN]; 89 unsigned char name[CN_CBQ_NAMELEN];
90 90
91 struct workqueue_struct *cn_queue;
92
93 struct list_head queue_list; 91 struct list_head queue_list;
94 spinlock_t queue_lock; 92 spinlock_t queue_lock;
95 93
@@ -101,20 +99,13 @@ struct cn_callback_id {
101 struct cb_id id; 99 struct cb_id id;
102}; 100};
103 101
104struct cn_callback_data {
105 struct sk_buff *skb;
106 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
107
108 void *free;
109};
110
111struct cn_callback_entry { 102struct cn_callback_entry {
112 struct list_head callback_entry; 103 struct list_head callback_entry;
113 struct work_struct work; 104 atomic_t refcnt;
114 struct cn_queue_dev *pdev; 105 struct cn_queue_dev *pdev;
115 106
116 struct cn_callback_id id; 107 struct cn_callback_id id;
117 struct cn_callback_data data; 108 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
118 109
119 u32 seq, group; 110 u32 seq, group;
120}; 111};
@@ -138,13 +129,12 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
138 struct cb_id *id, 129 struct cb_id *id,
139 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 130 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
140void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 131void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
132void cn_queue_release_callback(struct cn_callback_entry *);
141 133
142struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); 134struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *);
143void cn_queue_free_dev(struct cn_queue_dev *dev); 135void cn_queue_free_dev(struct cn_queue_dev *dev);
144 136
145int cn_cb_equal(struct cb_id *, struct cb_id *); 137int cn_cb_equal(struct cb_id *, struct cb_id *);
146 138
147void cn_queue_wrapper(struct work_struct *work);
148
149#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
150#endif /* __CONNECTOR_H */ 140#endif /* __CONNECTOR_H */
diff --git a/include/linux/cper.h b/include/linux/cper.h
index 3104aaff5dd0..372a25839fd1 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -388,5 +388,7 @@ struct cper_sec_pcie {
388#pragma pack() 388#pragma pack()
389 389
390u64 cper_next_record_id(void); 390u64 cper_next_record_id(void);
391void cper_print_bits(const char *prefix, unsigned int bits,
392 const char *strs[], unsigned int strs_size);
391 393
392#endif 394#endif
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index e20dd1f9b40a..391a259b2cc9 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,7 +11,7 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)data, length) 14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 15
16/* 16/*
17 * Helpers for hash table generation of ethernet nics: 17 * Helpers for hash table generation of ethernet nics:
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4aaeab376446..9aeeb0ba2003 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -354,9 +354,11 @@ static inline void put_cred(const struct cred *_cred)
354#define current_fsgid() (current_cred_xxx(fsgid)) 354#define current_fsgid() (current_cred_xxx(fsgid))
355#define current_cap() (current_cred_xxx(cap_effective)) 355#define current_cap() (current_cred_xxx(cap_effective))
356#define current_user() (current_cred_xxx(user)) 356#define current_user() (current_cred_xxx(user))
357#define current_user_ns() (current_cred_xxx(user)->user_ns) 357#define _current_user_ns() (current_cred_xxx(user)->user_ns)
358#define current_security() (current_cred_xxx(security)) 358#define current_security() (current_cred_xxx(security))
359 359
360extern struct user_namespace *current_user_ns(void);
361
360#define current_uid_gid(_uid, _gid) \ 362#define current_uid_gid(_uid, _gid) \
361do { \ 363do { \
362 const struct cred *__cred; \ 364 const struct cred *__cred; \
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index 5dd428532f79..542888504994 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -36,6 +36,7 @@ struct emac_platform_data {
36 36
37 u8 rmii_en; 37 u8 rmii_en;
38 u8 version; 38 u8 version;
39 bool no_bd_ram;
39 void (*interrupt_enable) (void); 40 void (*interrupt_enable) (void);
40 void (*interrupt_disable) (void); 41 void (*interrupt_disable) (void);
41}; 42};
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 1a87760d6532..f2afed4fa945 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
416 return dentry->d_flags & DCACHE_MOUNTED; 416 return dentry->d_flags & DCACHE_MOUNTED;
417} 417}
418 418
419extern struct vfsmount *lookup_mnt(struct path *);
420extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 419extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
421 420
422extern int sysctl_vfs_cache_pressure; 421extern int sysctl_vfs_cache_pressure;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 272496d1fae4..e2768834f397 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -286,11 +286,6 @@ void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callback
286int dm_table_complete(struct dm_table *t); 286int dm_table_complete(struct dm_table *t);
287 287
288/* 288/*
289 * Unplug all devices in a table.
290 */
291void dm_table_unplug_all(struct dm_table *t);
292
293/*
294 * Table reference counting. 289 * Table reference counting.
295 */ 290 */
296struct dm_table *dm_get_live_table(struct mapped_device *md); 291struct dm_table *dm_get_live_table(struct mapped_device *md);
diff --git a/include/linux/device.h b/include/linux/device.h
index 144ec135875f..ab8dfc095709 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -633,8 +633,12 @@ static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
633/* drivers/base/power/shutdown.c */ 633/* drivers/base/power/shutdown.c */
634extern void device_shutdown(void); 634extern void device_shutdown(void);
635 635
636#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
636/* drivers/base/sys.c */ 637/* drivers/base/sys.c */
637extern void sysdev_shutdown(void); 638extern void sysdev_shutdown(void);
639#else
640static inline void sysdev_shutdown(void) { }
641#endif
638 642
639/* debugging and troubleshooting/diagnostic helpers. */ 643/* debugging and troubleshooting/diagnostic helpers. */
640extern const char *dev_driver_string(const struct device *dev); 644extern const char *dev_driver_string(const struct device *dev);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 78bbf47bbb96..3708455ee6c3 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#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)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 19 270#define DM_VERSION_MINOR 20
271#define DM_VERSION_PATCHLEVEL 1 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2011-01-07)" 272#define DM_VERSION_EXTRA "-ioctl (2011-02-02)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -328,4 +328,10 @@ enum {
328 */ 328 */
329#define DM_UUID_FLAG (1 << 14) /* In */ 329#define DM_UUID_FLAG (1 << 14) /* In */
330 330
331/*
332 * If set, all buffers are wiped after use. Use when sending
333 * or requesting sensitive data such as an encryption key.
334 */
335#define DM_SECURE_DATA_FLAG (1 << 15) /* In */
336
331#endif /* _LINUX_DM_IOCTL_H */ 337#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index ef44c7a0638c..d18d673ebc78 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,10 +53,10 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.9" 56#define REL_VERSION "8.3.10"
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 95 59#define PRO_VERSION_MAX 96
60 60
61 61
62enum drbd_io_error_p { 62enum drbd_io_error_p {
@@ -96,8 +96,14 @@ enum drbd_on_no_data {
96 OND_SUSPEND_IO 96 OND_SUSPEND_IO
97}; 97};
98 98
99enum drbd_on_congestion {
100 OC_BLOCK,
101 OC_PULL_AHEAD,
102 OC_DISCONNECT,
103};
104
99/* KEEP the order, do not delete or insert. Only append. */ 105/* KEEP the order, do not delete or insert. Only append. */
100enum drbd_ret_codes { 106enum drbd_ret_code {
101 ERR_CODE_BASE = 100, 107 ERR_CODE_BASE = 100,
102 NO_ERROR = 101, 108 NO_ERROR = 101,
103 ERR_LOCAL_ADDR = 102, 109 ERR_LOCAL_ADDR = 102,
@@ -146,6 +152,9 @@ enum drbd_ret_codes {
146 ERR_PERM = 152, 152 ERR_PERM = 152,
147 ERR_NEED_APV_93 = 153, 153 ERR_NEED_APV_93 = 153,
148 ERR_STONITH_AND_PROT_A = 154, 154 ERR_STONITH_AND_PROT_A = 154,
155 ERR_CONG_NOT_PROTO_A = 155,
156 ERR_PIC_AFTER_DEP = 156,
157 ERR_PIC_PEER_DEP = 157,
149 158
150 /* insert new ones above this line */ 159 /* insert new ones above this line */
151 AFTER_LAST_ERR_CODE 160 AFTER_LAST_ERR_CODE
@@ -199,6 +208,10 @@ enum drbd_conns {
199 C_VERIFY_T, 208 C_VERIFY_T,
200 C_PAUSED_SYNC_S, 209 C_PAUSED_SYNC_S,
201 C_PAUSED_SYNC_T, 210 C_PAUSED_SYNC_T,
211
212 C_AHEAD,
213 C_BEHIND,
214
202 C_MASK = 31 215 C_MASK = 31
203}; 216};
204 217
@@ -259,7 +272,7 @@ union drbd_state {
259 unsigned int i; 272 unsigned int i;
260}; 273};
261 274
262enum drbd_state_ret_codes { 275enum drbd_state_rv {
263 SS_CW_NO_NEED = 4, 276 SS_CW_NO_NEED = 4,
264 SS_CW_SUCCESS = 3, 277 SS_CW_SUCCESS = 3,
265 SS_NOTHING_TO_DO = 2, 278 SS_NOTHING_TO_DO = 2,
@@ -290,7 +303,7 @@ enum drbd_state_ret_codes {
290extern const char *drbd_conn_str(enum drbd_conns); 303extern const char *drbd_conn_str(enum drbd_conns);
291extern const char *drbd_role_str(enum drbd_role); 304extern const char *drbd_role_str(enum drbd_role);
292extern const char *drbd_disk_str(enum drbd_disk_state); 305extern const char *drbd_disk_str(enum drbd_disk_state);
293extern const char *drbd_set_st_err_str(enum drbd_state_ret_codes); 306extern const char *drbd_set_st_err_str(enum drbd_state_rv);
294 307
295#define SHARED_SECRET_MAX 64 308#define SHARED_SECRET_MAX 64
296 309
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 4ac33f34b77e..bb264a5732de 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -16,7 +16,8 @@
16#define DEBUG_RANGE_CHECK 0 16#define DEBUG_RANGE_CHECK 0
17 17
18#define DRBD_MINOR_COUNT_MIN 1 18#define DRBD_MINOR_COUNT_MIN 1
19#define DRBD_MINOR_COUNT_MAX 255 19#define DRBD_MINOR_COUNT_MAX 256
20#define DRBD_MINOR_COUNT_DEF 32
20 21
21#define DRBD_DIALOG_REFRESH_MIN 0 22#define DRBD_DIALOG_REFRESH_MIN 0
22#define DRBD_DIALOG_REFRESH_MAX 600 23#define DRBD_DIALOG_REFRESH_MAX 600
@@ -129,6 +130,7 @@
129#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT 130#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT
130#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT 131#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
131#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR 132#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
133#define DRBD_ON_CONGESTION_DEF OC_BLOCK
132 134
133#define DRBD_MAX_BIO_BVECS_MIN 0 135#define DRBD_MAX_BIO_BVECS_MIN 0
134#define DRBD_MAX_BIO_BVECS_MAX 128 136#define DRBD_MAX_BIO_BVECS_MAX 128
@@ -154,5 +156,13 @@
154#define DRBD_C_MIN_RATE_MAX (4 << 20) 156#define DRBD_C_MIN_RATE_MAX (4 << 20)
155#define DRBD_C_MIN_RATE_DEF 4096 157#define DRBD_C_MIN_RATE_DEF 4096
156 158
159#define DRBD_CONG_FILL_MIN 0
160#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
161#define DRBD_CONG_FILL_DEF 0
162
163#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN
164#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX
165#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF
166
157#undef RANGE 167#undef RANGE
158#endif 168#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index ade91107c9a5..ab6159e4fcf0 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -56,6 +56,9 @@ NL_PACKET(net_conf, 5,
56 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict) 56 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict)
57 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo) 57 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo)
58 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size) 58 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size)
59 NL_INTEGER( 81, T_MAY_IGNORE, on_congestion)
60 NL_INTEGER( 82, T_MAY_IGNORE, cong_fill)
61 NL_INTEGER( 83, T_MAY_IGNORE, cong_extents)
59 /* 59 addr_family was available in GIT, never released */ 62 /* 59 addr_family was available in GIT, never released */
60 NL_BIT( 60, T_MANDATORY, mind_af) 63 NL_BIT( 60, T_MANDATORY, mind_af)
61 NL_BIT( 27, T_MAY_IGNORE, want_lose) 64 NL_BIT( 27, T_MAY_IGNORE, want_lose)
@@ -66,7 +69,9 @@ NL_PACKET(net_conf, 5,
66 NL_BIT( 70, T_MANDATORY, dry_run) 69 NL_BIT( 70, T_MANDATORY, dry_run)
67) 70)
68 71
69NL_PACKET(disconnect, 6, ) 72NL_PACKET(disconnect, 6,
73 NL_BIT( 84, T_MAY_IGNORE, force)
74)
70 75
71NL_PACKET(resize, 7, 76NL_PACKET(resize, 7,
72 NL_INT64( 29, T_MAY_IGNORE, resize_size) 77 NL_INT64( 29, T_MAY_IGNORE, resize_size)
@@ -143,9 +148,13 @@ NL_PACKET(new_c_uuid, 26,
143 NL_BIT( 63, T_MANDATORY, clear_bm) 148 NL_BIT( 63, T_MANDATORY, clear_bm)
144) 149)
145 150
151#ifdef NL_RESPONSE
152NL_RESPONSE(return_code_only, 27)
153#endif
154
146#undef NL_PACKET 155#undef NL_PACKET
147#undef NL_INTEGER 156#undef NL_INTEGER
148#undef NL_INT64 157#undef NL_INT64
149#undef NL_BIT 158#undef NL_BIT
150#undef NL_STRING 159#undef NL_STRING
151 160#undef NL_RESPONSE
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
index fcdff8410e99..f14a165e82dc 100644
--- a/include/linux/drbd_tag_magic.h
+++ b/include/linux/drbd_tag_magic.h
@@ -7,6 +7,7 @@
7/* declare packet_type enums */ 7/* declare packet_type enums */
8enum packet_types { 8enum packet_types {
9#define NL_PACKET(name, number, fields) P_ ## name = number, 9#define NL_PACKET(name, number, fields) P_ ## name = number,
10#define NL_RESPONSE(name, number) P_ ## name = number,
10#define NL_INTEGER(pn, pr, member) 11#define NL_INTEGER(pn, pr, member)
11#define NL_INT64(pn, pr, member) 12#define NL_INT64(pn, pr, member)
12#define NL_BIT(pn, pr, member) 13#define NL_BIT(pn, pr, member)
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index c8aad713a046..6998d9376ef9 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -16,9 +16,18 @@
16/** 16/**
17 * struct dw_dma_platform_data - Controller configuration parameters 17 * struct dw_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8) 18 * @nr_channels: Number of channels supported by hardware (max 8)
19 * @is_private: The device channels should be marked as private and not for
20 * by the general purpose DMA channel allocator.
19 */ 21 */
20struct dw_dma_platform_data { 22struct dw_dma_platform_data {
21 unsigned int nr_channels; 23 unsigned int nr_channels;
24 bool is_private;
25#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
26#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
27 unsigned char chan_allocation_order;
28#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
29#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
30 unsigned char chan_priority;
22}; 31};
23 32
24/** 33/**
@@ -33,6 +42,30 @@ enum dw_dma_slave_width {
33 DW_DMA_SLAVE_WIDTH_32BIT, 42 DW_DMA_SLAVE_WIDTH_32BIT,
34}; 43};
35 44
45/* bursts size */
46enum dw_dma_msize {
47 DW_DMA_MSIZE_1,
48 DW_DMA_MSIZE_4,
49 DW_DMA_MSIZE_8,
50 DW_DMA_MSIZE_16,
51 DW_DMA_MSIZE_32,
52 DW_DMA_MSIZE_64,
53 DW_DMA_MSIZE_128,
54 DW_DMA_MSIZE_256,
55};
56
57/* flow controller */
58enum dw_dma_fc {
59 DW_DMA_FC_D_M2M,
60 DW_DMA_FC_D_M2P,
61 DW_DMA_FC_D_P2M,
62 DW_DMA_FC_D_P2P,
63 DW_DMA_FC_P_P2M,
64 DW_DMA_FC_SP_P2P,
65 DW_DMA_FC_P_M2P,
66 DW_DMA_FC_DP_P2P,
67};
68
36/** 69/**
37 * struct dw_dma_slave - Controller-specific information about a slave 70 * struct dw_dma_slave - Controller-specific information about a slave
38 * 71 *
@@ -44,6 +77,11 @@ enum dw_dma_slave_width {
44 * @reg_width: peripheral register width 77 * @reg_width: peripheral register width
45 * @cfg_hi: Platform-specific initializer for the CFG_HI register 78 * @cfg_hi: Platform-specific initializer for the CFG_HI register
46 * @cfg_lo: Platform-specific initializer for the CFG_LO register 79 * @cfg_lo: Platform-specific initializer for the CFG_LO register
80 * @src_master: src master for transfers on allocated channel.
81 * @dst_master: dest master for transfers on allocated channel.
82 * @src_msize: src burst size.
83 * @dst_msize: dest burst size.
84 * @fc: flow controller for DMA transfer
47 */ 85 */
48struct dw_dma_slave { 86struct dw_dma_slave {
49 struct device *dma_dev; 87 struct device *dma_dev;
@@ -52,6 +90,11 @@ struct dw_dma_slave {
52 enum dw_dma_slave_width reg_width; 90 enum dw_dma_slave_width reg_width;
53 u32 cfg_hi; 91 u32 cfg_hi;
54 u32 cfg_lo; 92 u32 cfg_lo;
93 u8 src_master;
94 u8 dst_master;
95 u8 src_msize;
96 u8 dst_msize;
97 u8 fc;
55}; 98};
56 99
57/* Platform-configurable bits in CFG_HI */ 100/* Platform-configurable bits in CFG_HI */
@@ -62,7 +105,6 @@ struct dw_dma_slave {
62#define DWC_CFGH_DST_PER(x) ((x) << 11) 105#define DWC_CFGH_DST_PER(x) ((x) << 11)
63 106
64/* Platform-configurable bits in CFG_LO */ 107/* Platform-configurable bits in CFG_LO */
65#define DWC_CFGL_PRIO(x) ((x) << 5) /* priority */
66#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */ 108#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
67#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12) 109#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
68#define DWC_CFGL_LOCK_CH_XACT (2 << 12) 110#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 4d857973d2c9..d93efcc44570 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -20,7 +20,6 @@ typedef void (elevator_bio_merged_fn) (struct request_queue *,
20typedef int (elevator_dispatch_fn) (struct request_queue *, int); 20typedef int (elevator_dispatch_fn) (struct request_queue *, int);
21 21
22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); 22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
23typedef int (elevator_queue_empty_fn) (struct request_queue *);
24typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *); 23typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
25typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *); 24typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
26typedef int (elevator_may_queue_fn) (struct request_queue *, int); 25typedef int (elevator_may_queue_fn) (struct request_queue *, int);
@@ -46,7 +45,6 @@ struct elevator_ops
46 elevator_activate_req_fn *elevator_activate_req_fn; 45 elevator_activate_req_fn *elevator_activate_req_fn;
47 elevator_deactivate_req_fn *elevator_deactivate_req_fn; 46 elevator_deactivate_req_fn *elevator_deactivate_req_fn;
48 47
49 elevator_queue_empty_fn *elevator_queue_empty_fn;
50 elevator_completed_req_fn *elevator_completed_req_fn; 48 elevator_completed_req_fn *elevator_completed_req_fn;
51 49
52 elevator_request_list_fn *elevator_former_req_fn; 50 elevator_request_list_fn *elevator_former_req_fn;
@@ -101,17 +99,17 @@ struct elevator_queue
101 */ 99 */
102extern void elv_dispatch_sort(struct request_queue *, struct request *); 100extern void elv_dispatch_sort(struct request_queue *, struct request *);
103extern void elv_dispatch_add_tail(struct request_queue *, struct request *); 101extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
104extern void elv_add_request(struct request_queue *, struct request *, int, int); 102extern void elv_add_request(struct request_queue *, struct request *, int);
105extern void __elv_add_request(struct request_queue *, struct request *, int, int); 103extern void __elv_add_request(struct request_queue *, struct request *, int);
106extern void elv_insert(struct request_queue *, struct request *, int); 104extern void elv_insert(struct request_queue *, struct request *, int);
107extern int elv_merge(struct request_queue *, struct request **, struct bio *); 105extern int elv_merge(struct request_queue *, struct request **, struct bio *);
106extern int elv_try_merge(struct request *, struct bio *);
108extern void elv_merge_requests(struct request_queue *, struct request *, 107extern void elv_merge_requests(struct request_queue *, struct request *,
109 struct request *); 108 struct request *);
110extern void elv_merged_request(struct request_queue *, struct request *, int); 109extern void elv_merged_request(struct request_queue *, struct request *, int);
111extern void elv_bio_merged(struct request_queue *q, struct request *, 110extern void elv_bio_merged(struct request_queue *q, struct request *,
112 struct bio *); 111 struct bio *);
113extern void elv_requeue_request(struct request_queue *, struct request *); 112extern void elv_requeue_request(struct request_queue *, struct request *);
114extern int elv_queue_empty(struct request_queue *);
115extern struct request *elv_former_request(struct request_queue *, struct request *); 113extern struct request *elv_former_request(struct request_queue *, struct request *);
116extern struct request *elv_latter_request(struct request_queue *, struct request *); 114extern struct request *elv_latter_request(struct request_queue *, struct request *);
117extern int elv_register_queue(struct request_queue *q); 115extern int elv_register_queue(struct request_queue *q);
@@ -167,6 +165,8 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t);
167#define ELEVATOR_INSERT_BACK 2 165#define ELEVATOR_INSERT_BACK 2
168#define ELEVATOR_INSERT_SORT 3 166#define ELEVATOR_INSERT_SORT 3
169#define ELEVATOR_INSERT_REQUEUE 4 167#define ELEVATOR_INSERT_REQUEUE 4
168#define ELEVATOR_INSERT_FLUSH 5
169#define ELEVATOR_INSERT_SORT_MERGE 6
170 170
171/* 171/*
172 * return values from elevator_may_queue_fn 172 * return values from elevator_may_queue_fn
diff --git a/include/linux/err.h b/include/linux/err.h
index 448afc12c78a..f2edce25a76b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,6 +52,14 @@ static inline void * __must_check ERR_CAST(const void *ptr)
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(const void *ptr)
56{
57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr);
59 else
60 return 0;
61}
62
55#endif 63#endif
56 64
57#endif /* _LINUX_ERR_H */ 65#endif /* _LINUX_ERR_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b297f288f6eb..c8fcbdd2b0e7 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -648,6 +648,9 @@ enum ethtool_sfeatures_retval_bits {
648 648
649#include <linux/rculist.h> 649#include <linux/rculist.h>
650 650
651/* needed by dev_disable_lro() */
652extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
653
651struct ethtool_rx_ntuple_flow_spec_container { 654struct ethtool_rx_ntuple_flow_spec_container {
652 struct ethtool_rx_ntuple_flow_spec fs; 655 struct ethtool_rx_ntuple_flow_spec fs;
653 struct list_head list; 656 struct list_head list;
@@ -677,6 +680,7 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
677u32 ethtool_op_get_flags(struct net_device *dev); 680u32 ethtool_op_get_flags(struct net_device *dev);
678int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 681int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
679void ethtool_ntuple_flush(struct net_device *dev); 682void ethtool_ntuple_flush(struct net_device *dev);
683bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
680 684
681/** 685/**
682 * &ethtool_ops - Alter and report network device settings 686 * &ethtool_ops - Alter and report network device settings
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 6043c64c207a..85c1d302c12e 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -418,13 +418,13 @@ struct ext3_inode {
418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
419#endif 419#endif
420 420
421#define ext3_set_bit ext2_set_bit 421#define ext3_set_bit __test_and_set_bit_le
422#define ext3_set_bit_atomic ext2_set_bit_atomic 422#define ext3_set_bit_atomic ext2_set_bit_atomic
423#define ext3_clear_bit ext2_clear_bit 423#define ext3_clear_bit __test_and_clear_bit_le
424#define ext3_clear_bit_atomic ext2_clear_bit_atomic 424#define ext3_clear_bit_atomic ext2_clear_bit_atomic
425#define ext3_test_bit ext2_test_bit 425#define ext3_test_bit test_bit_le
426#define ext3_find_first_zero_bit ext2_find_first_zero_bit 426#define ext3_find_first_zero_bit find_first_zero_bit_le
427#define ext3_find_next_zero_bit ext2_find_next_zero_bit 427#define ext3_find_next_zero_bit find_next_zero_bit_le
428 428
429/* 429/*
430 * Maximal mount counts between two filesystem checks 430 * Maximal mount counts between two filesystem checks
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index fc023d67676f..c64f3680d4f1 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -93,7 +93,7 @@ struct fw_card {
93 int current_tlabel; 93 int current_tlabel;
94 u64 tlabel_mask; 94 u64 tlabel_mask;
95 struct list_head transaction_list; 95 struct list_head transaction_list;
96 unsigned long reset_jiffies; 96 u64 reset_jiffies;
97 97
98 u32 split_timeout_hi; 98 u32 split_timeout_hi;
99 u32 split_timeout_lo; 99 u32 split_timeout_lo;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7061a8587ee3..52f283c1edb2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -138,16 +138,10 @@ struct inodes_stat_t {
138 * block layer could (in theory) choose to ignore this 138 * block layer could (in theory) choose to ignore this
139 * request if it runs into resource problems. 139 * request if it runs into resource problems.
140 * WRITE A normal async write. Device will be plugged. 140 * WRITE A normal async write. Device will be plugged.
141 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down 141 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down
142 * the hint that someone will be waiting on this IO 142 * the hint that someone will be waiting on this IO
143 * shortly. The device must still be unplugged explicitly, 143 * shortly. The write equivalent of READ_SYNC.
144 * WRITE_SYNC_PLUG does not do this as we could be 144 * WRITE_ODIRECT Special case write for O_DIRECT only.
145 * submitting more writes before we actually wait on any
146 * of them.
147 * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device
148 * immediately after submission. The write equivalent
149 * of READ_SYNC.
150 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
151 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. 145 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush.
152 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on 146 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on
153 * non-volatile media on completion. 147 * non-volatile media on completion.
@@ -163,18 +157,14 @@ struct inodes_stat_t {
163#define WRITE RW_MASK 157#define WRITE RW_MASK
164#define READA RWA_MASK 158#define READA RWA_MASK
165 159
166#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) 160#define READ_SYNC (READ | REQ_SYNC)
167#define READ_META (READ | REQ_META) 161#define READ_META (READ | REQ_META)
168#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) 162#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
169#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) 163#define WRITE_ODIRECT (WRITE | REQ_SYNC)
170#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
171#define WRITE_META (WRITE | REQ_META) 164#define WRITE_META (WRITE | REQ_META)
172#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 165#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
173 REQ_FLUSH) 166#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
174#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ 167#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
175 REQ_FUA)
176#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
177 REQ_FLUSH | REQ_FUA)
178 168
179#define SEL_IN 1 169#define SEL_IN 1
180#define SEL_OUT 2 170#define SEL_OUT 2
@@ -367,6 +357,8 @@ struct inodes_stat_t {
367#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 357#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
368#define FS_EXTENT_FL 0x00080000 /* Extents */ 358#define FS_EXTENT_FL 0x00080000 /* Extents */
369#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ 359#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
360#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
361#define FS_COW_FL 0x02000000 /* Cow file */
370#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 362#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
371 363
372#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 364#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
@@ -586,7 +578,6 @@ typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
586struct address_space_operations { 578struct address_space_operations {
587 int (*writepage)(struct page *page, struct writeback_control *wbc); 579 int (*writepage)(struct page *page, struct writeback_control *wbc);
588 int (*readpage)(struct file *, struct page *); 580 int (*readpage)(struct file *, struct page *);
589 void (*sync_page)(struct page *);
590 581
591 /* Write back some dirty pages from this mapping. */ 582 /* Write back some dirty pages from this mapping. */
592 int (*writepages)(struct address_space *, struct writeback_control *); 583 int (*writepages)(struct address_space *, struct writeback_control *);
@@ -662,9 +653,9 @@ struct address_space {
662 653
663struct block_device { 654struct block_device {
664 dev_t bd_dev; /* not a kdev_t - it's a search key */ 655 dev_t bd_dev; /* not a kdev_t - it's a search key */
656 int bd_openers;
665 struct inode * bd_inode; /* will die */ 657 struct inode * bd_inode; /* will die */
666 struct super_block * bd_super; 658 struct super_block * bd_super;
667 int bd_openers;
668 struct mutex bd_mutex; /* open/close mutex */ 659 struct mutex bd_mutex; /* open/close mutex */
669 struct list_head bd_inodes; 660 struct list_head bd_inodes;
670 void * bd_claiming; 661 void * bd_claiming;
@@ -1457,8 +1448,13 @@ enum {
1457#define put_fs_excl() atomic_dec(&current->fs_excl) 1448#define put_fs_excl() atomic_dec(&current->fs_excl)
1458#define has_fs_excl() atomic_read(&current->fs_excl) 1449#define has_fs_excl() atomic_read(&current->fs_excl)
1459 1450
1460#define is_owner_or_cap(inode) \ 1451/*
1461 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER)) 1452 * until VFS tracks user namespaces for inodes, just make all files
1453 * belong to init_user_ns
1454 */
1455extern struct user_namespace init_user_ns;
1456#define inode_userns(inode) (&init_user_ns)
1457extern bool inode_owner_or_capable(const struct inode *inode);
1462 1458
1463/* not quite ready to be deprecated, but... */ 1459/* not quite ready to be deprecated, but... */
1464extern void lock_super(struct super_block *); 1460extern void lock_super(struct super_block *);
@@ -1642,7 +1638,7 @@ struct super_operations {
1642}; 1638};
1643 1639
1644/* 1640/*
1645 * Inode state bits. Protected by inode_lock. 1641 * Inode state bits. Protected by inode->i_lock
1646 * 1642 *
1647 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1643 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1648 * I_DIRTY_DATASYNC and I_DIRTY_PAGES. 1644 * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index c0d5f6945c1e..d764a426e9fd 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -109,7 +109,7 @@ struct hd_struct {
109 int make_it_fail; 109 int make_it_fail;
110#endif 110#endif
111 unsigned long stamp; 111 unsigned long stamp;
112 int in_flight[2]; 112 atomic_t in_flight[2];
113#ifdef CONFIG_SMP 113#ifdef CONFIG_SMP
114 struct disk_stats __percpu *dkstats; 114 struct disk_stats __percpu *dkstats;
115#else 115#else
@@ -370,21 +370,21 @@ static inline void free_part_stats(struct hd_struct *part)
370 370
371static inline void part_inc_in_flight(struct hd_struct *part, int rw) 371static inline void part_inc_in_flight(struct hd_struct *part, int rw)
372{ 372{
373 part->in_flight[rw]++; 373 atomic_inc(&part->in_flight[rw]);
374 if (part->partno) 374 if (part->partno)
375 part_to_disk(part)->part0.in_flight[rw]++; 375 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
376} 376}
377 377
378static inline void part_dec_in_flight(struct hd_struct *part, int rw) 378static inline void part_dec_in_flight(struct hd_struct *part, int rw)
379{ 379{
380 part->in_flight[rw]--; 380 atomic_dec(&part->in_flight[rw]);
381 if (part->partno) 381 if (part->partno)
382 part_to_disk(part)->part0.in_flight[rw]--; 382 atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
383} 383}
384 384
385static inline int part_in_flight(struct hd_struct *part) 385static inline int part_in_flight(struct hd_struct *part)
386{ 386{
387 return part->in_flight[0] + part->in_flight[1]; 387 return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
388} 388}
389 389
390static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) 390static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index dca31761b311..bfb8f934521e 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -35,6 +35,7 @@ struct vm_area_struct;
35#define ___GFP_NOTRACK 0 35#define ___GFP_NOTRACK 0
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u 37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u
38 39
39/* 40/*
40 * GFP bitmasks.. 41 * GFP bitmasks..
@@ -83,6 +84,7 @@ struct vm_area_struct;
83#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 84#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
84 85
85#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
86 88
87/* 89/*
88 * This may seem redundant, but it's a way of annotating false positives vs. 90 * This may seem redundant, but it's a way of annotating false positives vs.
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
deleted file mode 100644
index 4bef5c557160..000000000000
--- a/include/linux/i2c-id.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/* ------------------------------------------------------------------------- */
2/* */
3/* i2c-id.h - identifier values for i2c drivers and adapters */
4/* */
5/* ------------------------------------------------------------------------- */
6/* Copyright (C) 1995-1999 Simon G. Vogl
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
21/* ------------------------------------------------------------------------- */
22
23#ifndef LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H
25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
30/*
31 * ---- Adapter types ----------------------------------------------------
32 */
33
34/* --- Bit algorithm adapters */
35#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
36
37#endif /* LINUX_I2C_ID_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 06a8d9c7de98..f1e3ff5880a9 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/i2c-id.h>
33#include <linux/mod_devicetable.h> 32#include <linux/mod_devicetable.h>
34#include <linux/device.h> /* for struct device */ 33#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 34#include <linux/sched.h> /* for completion */
@@ -105,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
105/** 104/**
106 * struct i2c_driver - represent an I2C device driver 105 * struct i2c_driver - represent an I2C device driver
107 * @class: What kind of i2c device we instantiate (for detect) 106 * @class: What kind of i2c device we instantiate (for detect)
108 * @attach_adapter: Callback for bus addition (for legacy drivers) 107 * @attach_adapter: Callback for bus addition (deprecated)
109 * @detach_adapter: Callback for bus removal (for legacy drivers) 108 * @detach_adapter: Callback for bus removal (deprecated)
110 * @probe: Callback for device binding 109 * @probe: Callback for device binding
111 * @remove: Callback for device unbinding 110 * @remove: Callback for device unbinding
112 * @shutdown: Callback for device shutdown 111 * @shutdown: Callback for device shutdown
@@ -144,11 +143,11 @@ struct i2c_driver {
144 unsigned int class; 143 unsigned int class;
145 144
146 /* Notifies the driver that a new bus has appeared or is about to be 145 /* Notifies the driver that a new bus has appeared or is about to be
147 * removed. You should avoid using this if you can, it will probably 146 * removed. You should avoid using this, it will be removed in a
148 * be removed in a near future. 147 * near future.
149 */ 148 */
150 int (*attach_adapter)(struct i2c_adapter *); 149 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
151 int (*detach_adapter)(struct i2c_adapter *); 150 int (*detach_adapter)(struct i2c_adapter *) __deprecated;
152 151
153 /* Standard driver model interfaces */ 152 /* Standard driver model interfaces */
154 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 153 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
@@ -354,7 +353,6 @@ struct i2c_algorithm {
354 */ 353 */
355struct i2c_adapter { 354struct i2c_adapter {
356 struct module *owner; 355 struct module *owner;
357 unsigned int id __deprecated;
358 unsigned int class; /* classes to allow probing for */ 356 unsigned int class; /* classes to allow probing for */
359 const struct i2c_algorithm *algo; /* the algorithm to access the bus */ 357 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
360 void *algo_data; 358 void *algo_data;
@@ -396,6 +394,8 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
396 return NULL; 394 return NULL;
397} 395}
398 396
397int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *));
398
399/* Adapter locking functions, exported for shared pin cases */ 399/* Adapter locking functions, exported for shared pin cases */
400void i2c_lock_adapter(struct i2c_adapter *); 400void i2c_lock_adapter(struct i2c_adapter *);
401void i2c_unlock_adapter(struct i2c_adapter *); 401void i2c_unlock_adapter(struct i2c_adapter *);
@@ -447,7 +447,7 @@ extern void i2c_release_client(struct i2c_client *client);
447extern void i2c_clients_command(struct i2c_adapter *adap, 447extern void i2c_clients_command(struct i2c_adapter *adap,
448 unsigned int cmd, void *arg); 448 unsigned int cmd, void *arg);
449 449
450extern struct i2c_adapter *i2c_get_adapter(int id); 450extern struct i2c_adapter *i2c_get_adapter(int nr);
451extern void i2c_put_adapter(struct i2c_adapter *adap); 451extern void i2c_put_adapter(struct i2c_adapter *adap);
452 452
453 453
diff --git a/include/linux/i2c/ads1015.h b/include/linux/i2c/ads1015.h
new file mode 100644
index 000000000000..d5aa2a045669
--- /dev/null
+++ b/include/linux/i2c/ads1015.h
@@ -0,0 +1,36 @@
1/*
2 * Platform Data for ADS1015 12-bit 4-input ADC
3 * (C) Copyright 2010
4 * Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef LINUX_ADS1015_H
22#define LINUX_ADS1015_H
23
24#define ADS1015_CHANNELS 8
25
26struct ads1015_channel_data {
27 bool enabled;
28 unsigned int pga;
29 unsigned int data_rate;
30};
31
32struct ads1015_platform_data {
33 struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
34};
35
36#endif /* LINUX_ADS1015_H */
diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index c5033e101094..f027f7a63511 100644
--- a/include/linux/i2c/qt602240_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * AT42QT602240/ATMXT224 Touchscreen driver 2 * Atmel maXTouch Touchscreen driver
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd 4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com> 5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
@@ -10,21 +10,26 @@
10 * option) any later version. 10 * option) any later version.
11 */ 11 */
12 12
13#ifndef __LINUX_QT602240_TS_H 13#ifndef __LINUX_ATMEL_MXT_TS_H
14#define __LINUX_QT602240_TS_H 14#define __LINUX_ATMEL_MXT_TS_H
15
16#include <linux/types.h>
15 17
16/* Orient */ 18/* Orient */
17#define QT602240_NORMAL 0x0 19#define MXT_NORMAL 0x0
18#define QT602240_DIAGONAL 0x1 20#define MXT_DIAGONAL 0x1
19#define QT602240_HORIZONTAL_FLIP 0x2 21#define MXT_HORIZONTAL_FLIP 0x2
20#define QT602240_ROTATED_90_COUNTER 0x3 22#define MXT_ROTATED_90_COUNTER 0x3
21#define QT602240_VERTICAL_FLIP 0x4 23#define MXT_VERTICAL_FLIP 0x4
22#define QT602240_ROTATED_90 0x5 24#define MXT_ROTATED_90 0x5
23#define QT602240_ROTATED_180 0x6 25#define MXT_ROTATED_180 0x6
24#define QT602240_DIAGONAL_COUNTER 0x7 26#define MXT_DIAGONAL_COUNTER 0x7
27
28/* The platform data for the Atmel maXTouch touchscreen driver */
29struct mxt_platform_data {
30 const u8 *config;
31 size_t config_length;
25 32
26/* The platform data for the AT42QT602240/ATMXT224 touchscreen driver */
27struct qt602240_platform_data {
28 unsigned int x_line; 33 unsigned int x_line;
29 unsigned int y_line; 34 unsigned int y_line;
30 unsigned int x_size; 35 unsigned int x_size;
@@ -33,6 +38,7 @@ struct qt602240_platform_data {
33 unsigned int threshold; 38 unsigned int threshold;
34 unsigned int voltage; 39 unsigned int voltage;
35 unsigned char orient; 40 unsigned char orient;
41 unsigned long irqflags;
36}; 42};
37 43
38#endif /* __LINUX_QT602240_TS_H */ 44#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/mcs.h b/include/linux/i2c/mcs.h
index 725ae7c313ff..61bb18a4fd3c 100644
--- a/include/linux/i2c/mcs.h
+++ b/include/linux/i2c/mcs.h
@@ -18,6 +18,7 @@
18#define MCS_KEY_CODE(v) ((v) & 0xffff) 18#define MCS_KEY_CODE(v) ((v) & 0xffff)
19 19
20struct mcs_platform_data { 20struct mcs_platform_data {
21 void (*poweron)(bool);
21 void (*cfg_pin)(void); 22 void (*cfg_pin)(void);
22 23
23 /* touchscreen */ 24 /* touchscreen */
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
new file mode 100644
index 000000000000..1a9f65e6ec0f
--- /dev/null
+++ b/include/linux/i2c/pxa-i2c.h
@@ -0,0 +1,82 @@
1/*
2 * i2c_pxa.h
3 *
4 * Copyright (C) 2002 Intrinsyc Software Inc.
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 _I2C_PXA_H_
12#define _I2C_PXA_H_
13
14#if 0
15#define DEF_TIMEOUT 3
16#else
17/* need a longer timeout if we're dealing with the fact we may well be
18 * looking at a multi-master environment
19*/
20#define DEF_TIMEOUT 32
21#endif
22
23#define BUS_ERROR (-EREMOTEIO)
24#define XFER_NAKED (-ECONNREFUSED)
25#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
26
27/* ICR initialize bit values
28*
29* 15. FM 0 (100 Khz operation)
30* 14. UR 0 (No unit reset)
31* 13. SADIE 0 (Disables the unit from interrupting on slave addresses
32* matching its slave address)
33* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration
34* in master mode)
35* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode)
36* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent)
37* 9. IRFIE 1 (Enable interrupts from full buffer received)
38* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty)
39* 7. GCD 1 (Disables i2c unit response to general call messages as a slave)
40* 6. IUE 0 (Disable unit until we change settings)
41* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL)
42* 4. MA 0 (Only send stop with the ICR stop bit)
43* 3. TB 0 (We are not transmitting a byte initially)
44* 2. ACKNAK 0 (Send an ACK after the unit receives a byte)
45* 1. STOP 0 (Do not send a STOP)
46* 0. START 0 (Do not send a START)
47*
48*/
49#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
50
51/* I2C status register init values
52 *
53 * 10. BED 1 (Clear bus error detected)
54 * 9. SAD 1 (Clear slave address detected)
55 * 7. IRF 1 (Clear IDBR Receive Full)
56 * 6. ITE 1 (Clear IDBR Transmit Empty)
57 * 5. ALD 1 (Clear Arbitration Loss Detected)
58 * 4. SSD 1 (Clear Slave Stop Detected)
59 */
60#define I2C_ISR_INIT 0x7FF /* status register init */
61
62struct i2c_slave_client;
63
64struct i2c_pxa_platform_data {
65 unsigned int slave_addr;
66 struct i2c_slave_client *slave;
67 unsigned int class;
68 unsigned int use_pio :1;
69 unsigned int fast_mode :1;
70};
71
72extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
73
74#ifdef CONFIG_PXA27x
75extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info);
76#endif
77
78#ifdef CONFIG_PXA3xx
79extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info);
80#endif
81
82#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 58afd9d2c438..0c0d1ae79981 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -698,6 +698,7 @@ struct twl4030_platform_data {
698 struct regulator_init_data *vana; 698 struct regulator_init_data *vana;
699 struct regulator_init_data *vcxio; 699 struct regulator_init_data *vcxio;
700 struct regulator_init_data *vusb; 700 struct regulator_init_data *vusb;
701 struct regulator_init_data *clk32kg;
701}; 702};
702 703
703/*----------------------------------------------------------------------*/ 704/*----------------------------------------------------------------------*/
@@ -777,5 +778,6 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
777 778
778/* INTERNAL LDOs */ 779/* INTERNAL LDOs */
779#define TWL6030_REG_VRTC 47 780#define TWL6030_REG_VRTC 47
781#define TWL6030_REG_CLK32KG 48
780 782
781#endif /* End of __TWL4030_H */ 783#endif /* End of __TWL4030_H */
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
new file mode 100644
index 000000000000..6427d298fbfc
--- /dev/null
+++ b/include/linux/i2c/twl4030-madc.h
@@ -0,0 +1,141 @@
1/*
2 * twl4030_madc.h - Header for TWL4030 MADC
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 * J Keerthy <j-keerthy@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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
19 * 02110-1301 USA
20 *
21 */
22
23#ifndef _TWL4030_MADC_H
24#define _TWL4030_MADC_H
25
26struct twl4030_madc_conversion_method {
27 u8 sel;
28 u8 avg;
29 u8 rbase;
30 u8 ctrl;
31};
32
33#define TWL4030_MADC_MAX_CHANNELS 16
34
35
36/*
37 * twl4030_madc_request- madc request packet for channel conversion
38 * @channels: 16 bit bitmap for individual channels
39 * @do_avgP: sample the input channel for 4 consecutive cycles
40 * @method: RT, SW1, SW2
41 * @type: Polling or interrupt based method
42 */
43
44struct twl4030_madc_request {
45 unsigned long channels;
46 u16 do_avg;
47 u16 method;
48 u16 type;
49 bool active;
50 bool result_pending;
51 int rbuf[TWL4030_MADC_MAX_CHANNELS];
52 void (*func_cb)(int len, int channels, int *buf);
53};
54
55enum conversion_methods {
56 TWL4030_MADC_RT,
57 TWL4030_MADC_SW1,
58 TWL4030_MADC_SW2,
59 TWL4030_MADC_NUM_METHODS
60};
61
62enum sample_type {
63 TWL4030_MADC_WAIT,
64 TWL4030_MADC_IRQ_ONESHOT,
65 TWL4030_MADC_IRQ_REARM
66};
67
68#define TWL4030_MADC_CTRL1 0x00
69#define TWL4030_MADC_CTRL2 0x01
70
71#define TWL4030_MADC_RTSELECT_LSB 0x02
72#define TWL4030_MADC_SW1SELECT_LSB 0x06
73#define TWL4030_MADC_SW2SELECT_LSB 0x0A
74
75#define TWL4030_MADC_RTAVERAGE_LSB 0x04
76#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
77#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
78
79#define TWL4030_MADC_CTRL_SW1 0x12
80#define TWL4030_MADC_CTRL_SW2 0x13
81
82#define TWL4030_MADC_RTCH0_LSB 0x17
83#define TWL4030_MADC_GPCH0_LSB 0x37
84
85#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
86#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
87/* MADC conversion completion */
88#define TWL4030_MADC_EOC_SW (1 << 1)
89/* MADC SWx start conversion */
90#define TWL4030_MADC_SW_START (1 << 5)
91#define TWL4030_MADC_ADCIN0 (1 << 0)
92#define TWL4030_MADC_ADCIN1 (1 << 1)
93#define TWL4030_MADC_ADCIN2 (1 << 2)
94#define TWL4030_MADC_ADCIN3 (1 << 3)
95#define TWL4030_MADC_ADCIN4 (1 << 4)
96#define TWL4030_MADC_ADCIN5 (1 << 5)
97#define TWL4030_MADC_ADCIN6 (1 << 6)
98#define TWL4030_MADC_ADCIN7 (1 << 7)
99#define TWL4030_MADC_ADCIN8 (1 << 8)
100#define TWL4030_MADC_ADCIN9 (1 << 9)
101#define TWL4030_MADC_ADCIN10 (1 << 10)
102#define TWL4030_MADC_ADCIN11 (1 << 11)
103#define TWL4030_MADC_ADCIN12 (1 << 12)
104#define TWL4030_MADC_ADCIN13 (1 << 13)
105#define TWL4030_MADC_ADCIN14 (1 << 14)
106#define TWL4030_MADC_ADCIN15 (1 << 15)
107
108/* Fixed channels */
109#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
110#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
111#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
112#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
113#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
114#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
115
116/* Step size and prescaler ratio */
117#define TEMP_STEP_SIZE 147
118#define TEMP_PSR_R 100
119#define CURR_STEP_SIZE 147
120#define CURR_PSR_R1 44
121#define CURR_PSR_R2 88
122
123#define TWL4030_BCI_BCICTL1 0x23
124#define TWL4030_BCI_CGAIN 0x020
125#define TWL4030_BCI_MESBAT (1 << 1)
126#define TWL4030_BCI_TYPEN (1 << 4)
127#define TWL4030_BCI_ITHEN (1 << 3)
128
129#define REG_BCICTL2 0x024
130#define TWL4030_BCI_ITHSENS 0x007
131
132struct twl4030_madc_user_parms {
133 int channel;
134 int average;
135 int status;
136 u16 result;
137};
138
139int twl4030_madc_conversion(struct twl4030_madc_request *conv);
140int twl4030_get_madc_conversion(int channel_no);
141#endif
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 5e3dddf8f562..ce0b72464eb8 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -22,12 +22,12 @@
22 * @poll: driver-supplied method that polls the device and posts 22 * @poll: driver-supplied method that polls the device and posts
23 * input events (mandatory). 23 * input events (mandatory).
24 * @poll_interval: specifies how often the poll() method should be called. 24 * @poll_interval: specifies how often the poll() method should be called.
25 * Defaults to 500 msec unless overriden when registering the device. 25 * Defaults to 500 msec unless overridden when registering the device.
26 * @poll_interval_max: specifies upper bound for the poll interval. 26 * @poll_interval_max: specifies upper bound for the poll interval.
27 * Defaults to the initial value of @poll_interval. 27 * Defaults to the initial value of @poll_interval.
28 * @poll_interval_min: specifies lower bound for the poll interval. 28 * @poll_interval_min: specifies lower bound for the poll interval.
29 * Defaults to 0. 29 * Defaults to 0.
30 * @input: input device structire associated with the polled device. 30 * @input: input device structure associated with the polled device.
31 * Must be properly initialized by the driver (id, name, phys, bits). 31 * Must be properly initialized by the driver (id, name, phys, bits).
32 * 32 *
33 * Polled input device provides a skeleton for supporting simple input 33 * Polled input device provides a skeleton for supporting simple input
diff --git a/include/linux/input.h b/include/linux/input.h
index e428382ca28a..f3a7794a18c4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -664,6 +664,13 @@ struct input_keymap_entry {
664#define KEY_TOUCHPAD_ON 0x213 664#define KEY_TOUCHPAD_ON 0x213
665#define KEY_TOUCHPAD_OFF 0x214 665#define KEY_TOUCHPAD_OFF 0x214
666 666
667#define KEY_CAMERA_ZOOMIN 0x215
668#define KEY_CAMERA_ZOOMOUT 0x216
669#define KEY_CAMERA_UP 0x217
670#define KEY_CAMERA_DOWN 0x218
671#define KEY_CAMERA_LEFT 0x219
672#define KEY_CAMERA_RIGHT 0x21a
673
667#define BTN_TRIGGER_HAPPY 0x2c0 674#define BTN_TRIGGER_HAPPY 0x2c0
668#define BTN_TRIGGER_HAPPY1 0x2c0 675#define BTN_TRIGGER_HAPPY1 0x2c0
669#define BTN_TRIGGER_HAPPY2 0x2c1 676#define BTN_TRIGGER_HAPPY2 0x2c1
@@ -1154,8 +1161,6 @@ struct ff_effect {
1154 * sparse keymaps. If not supplied default mechanism will be used. 1161 * sparse keymaps. If not supplied default mechanism will be used.
1155 * The method is being called while holding event_lock and thus must 1162 * The method is being called while holding event_lock and thus must
1156 * not sleep 1163 * not sleep
1157 * @getkeycode_new: transition method
1158 * @setkeycode_new: transition method
1159 * @ff: force feedback structure associated with the device if device 1164 * @ff: force feedback structure associated with the device if device
1160 * supports force feedback effects 1165 * supports force feedback effects
1161 * @repeat_key: stores key code of the last key pressed; used to implement 1166 * @repeat_key: stores key code of the last key pressed; used to implement
@@ -1234,14 +1239,10 @@ struct input_dev {
1234 void *keycode; 1239 void *keycode;
1235 1240
1236 int (*setkeycode)(struct input_dev *dev, 1241 int (*setkeycode)(struct input_dev *dev,
1237 unsigned int scancode, unsigned int keycode); 1242 const struct input_keymap_entry *ke,
1243 unsigned int *old_keycode);
1238 int (*getkeycode)(struct input_dev *dev, 1244 int (*getkeycode)(struct input_dev *dev,
1239 unsigned int scancode, unsigned int *keycode); 1245 struct input_keymap_entry *ke);
1240 int (*setkeycode_new)(struct input_dev *dev,
1241 const struct input_keymap_entry *ke,
1242 unsigned int *old_keycode);
1243 int (*getkeycode_new)(struct input_dev *dev,
1244 struct input_keymap_entry *ke);
1245 1246
1246 struct ff_device *ff; 1247 struct ff_device *ff;
1247 1248
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 51952989ad42..a6d1655f9607 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -5,6 +5,7 @@
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#include <linux/notifier.h> 7#include <linux/notifier.h>
8#include <linux/nsproxy.h>
8 9
9/* 10/*
10 * ipc namespace events 11 * ipc namespace events
@@ -15,6 +16,7 @@
15 16
16#define IPCNS_CALLBACK_PRI 0 17#define IPCNS_CALLBACK_PRI 0
17 18
19struct user_namespace;
18 20
19struct ipc_ids { 21struct ipc_ids {
20 int in_use; 22 int in_use;
@@ -56,6 +58,8 @@ struct ipc_namespace {
56 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ 58 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
57 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ 59 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
58 60
61 /* user_ns which owns the ipc ns */
62 struct user_namespace *user_ns;
59}; 63};
60 64
61extern struct ipc_namespace init_ipc_ns; 65extern struct ipc_namespace init_ipc_ns;
@@ -90,7 +94,7 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
90 94
91#if defined(CONFIG_IPC_NS) 95#if defined(CONFIG_IPC_NS)
92extern struct ipc_namespace *copy_ipcs(unsigned long flags, 96extern struct ipc_namespace *copy_ipcs(unsigned long flags,
93 struct ipc_namespace *ns); 97 struct task_struct *tsk);
94static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 98static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
95{ 99{
96 if (ns) 100 if (ns)
@@ -101,12 +105,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
101extern void put_ipc_ns(struct ipc_namespace *ns); 105extern void put_ipc_ns(struct ipc_namespace *ns);
102#else 106#else
103static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 107static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
104 struct ipc_namespace *ns) 108 struct task_struct *tsk)
105{ 109{
106 if (flags & CLONE_NEWIPC) 110 if (flags & CLONE_NEWIPC)
107 return ERR_PTR(-EINVAL); 111 return ERR_PTR(-EINVAL);
108 112
109 return ns; 113 return tsk->nsproxy->ipc_ns;
110} 114}
111 115
112static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 116static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 1d3577f30d45..2a375a72ce3c 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -28,6 +28,7 @@
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
29#include <asm/irq_regs.h> 29#include <asm/irq_regs.h>
30 30
31struct seq_file;
31struct irq_desc; 32struct irq_desc;
32struct irq_data; 33struct irq_data;
33typedef void (*irq_flow_handler_t)(unsigned int irq, 34typedef void (*irq_flow_handler_t)(unsigned int irq,
@@ -91,18 +92,6 @@ enum {
91 IRQ_NO_BALANCING = (1 << 13), 92 IRQ_NO_BALANCING = (1 << 13),
92 IRQ_MOVE_PCNTXT = (1 << 14), 93 IRQ_MOVE_PCNTXT = (1 << 14),
93 IRQ_NESTED_THREAD = (1 << 15), 94 IRQ_NESTED_THREAD = (1 << 15),
94
95#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
96 IRQ_INPROGRESS = (1 << 16),
97 IRQ_REPLAY = (1 << 17),
98 IRQ_WAITING = (1 << 18),
99 IRQ_DISABLED = (1 << 19),
100 IRQ_PENDING = (1 << 20),
101 IRQ_MASKED = (1 << 21),
102 IRQ_MOVE_PENDING = (1 << 22),
103 IRQ_AFFINITY_SET = (1 << 23),
104 IRQ_WAKEUP = (1 << 24),
105#endif
106}; 95};
107 96
108#define IRQF_MODIFY_MASK \ 97#define IRQF_MODIFY_MASK \
@@ -134,7 +123,7 @@ struct msi_desc;
134 * struct irq_data - per irq and irq chip data passed down to chip functions 123 * struct irq_data - per irq and irq chip data passed down to chip functions
135 * @irq: interrupt number 124 * @irq: interrupt number
136 * @node: node index useful for balancing 125 * @node: node index useful for balancing
137 * @state_use_accessor: status information for irq chip functions. 126 * @state_use_accessors: status information for irq chip functions.
138 * Use accessor functions to deal with it 127 * Use accessor functions to deal with it
139 * @chip: low level interrupt hardware access 128 * @chip: low level interrupt hardware access
140 * @handler_data: per-IRQ data for the irq_chip methods 129 * @handler_data: per-IRQ data for the irq_chip methods
@@ -173,6 +162,9 @@ struct irq_data {
173 * from suspend 162 * from suspend
174 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process 163 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
175 * context 164 * context
165 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
166 * IRQD_IRQ_MASKED - Masked state of the interrupt
167 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
176 */ 168 */
177enum { 169enum {
178 IRQD_TRIGGER_MASK = 0xf, 170 IRQD_TRIGGER_MASK = 0xf,
@@ -183,6 +175,9 @@ enum {
183 IRQD_LEVEL = (1 << 13), 175 IRQD_LEVEL = (1 << 13),
184 IRQD_WAKEUP_STATE = (1 << 14), 176 IRQD_WAKEUP_STATE = (1 << 14),
185 IRQD_MOVE_PCNTXT = (1 << 15), 177 IRQD_MOVE_PCNTXT = (1 << 15),
178 IRQD_IRQ_DISABLED = (1 << 16),
179 IRQD_IRQ_MASKED = (1 << 17),
180 IRQD_IRQ_INPROGRESS = (1 << 18),
186}; 181};
187 182
188static inline bool irqd_is_setaffinity_pending(struct irq_data *d) 183static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -205,6 +200,11 @@ static inline bool irqd_affinity_was_set(struct irq_data *d)
205 return d->state_use_accessors & IRQD_AFFINITY_SET; 200 return d->state_use_accessors & IRQD_AFFINITY_SET;
206} 201}
207 202
203static inline void irqd_mark_affinity_was_set(struct irq_data *d)
204{
205 d->state_use_accessors |= IRQD_AFFINITY_SET;
206}
207
208static inline u32 irqd_get_trigger_type(struct irq_data *d) 208static inline u32 irqd_get_trigger_type(struct irq_data *d)
209{ 209{
210 return d->state_use_accessors & IRQD_TRIGGER_MASK; 210 return d->state_use_accessors & IRQD_TRIGGER_MASK;
@@ -234,6 +234,36 @@ static inline bool irqd_can_move_in_process_context(struct irq_data *d)
234 return d->state_use_accessors & IRQD_MOVE_PCNTXT; 234 return d->state_use_accessors & IRQD_MOVE_PCNTXT;
235} 235}
236 236
237static inline bool irqd_irq_disabled(struct irq_data *d)
238{
239 return d->state_use_accessors & IRQD_IRQ_DISABLED;
240}
241
242static inline bool irqd_irq_masked(struct irq_data *d)
243{
244 return d->state_use_accessors & IRQD_IRQ_MASKED;
245}
246
247static inline bool irqd_irq_inprogress(struct irq_data *d)
248{
249 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
250}
251
252/*
253 * Functions for chained handlers which can be enabled/disabled by the
254 * standard disable_irq/enable_irq calls. Must be called with
255 * irq_desc->lock held.
256 */
257static inline void irqd_set_chained_irq_inprogress(struct irq_data *d)
258{
259 d->state_use_accessors |= IRQD_IRQ_INPROGRESS;
260}
261
262static inline void irqd_clr_chained_irq_inprogress(struct irq_data *d)
263{
264 d->state_use_accessors &= ~IRQD_IRQ_INPROGRESS;
265}
266
237/** 267/**
238 * struct irq_chip - hardware interrupt chip descriptor 268 * struct irq_chip - hardware interrupt chip descriptor
239 * 269 *
@@ -270,34 +300,15 @@ static inline bool irqd_can_move_in_process_context(struct irq_data *d)
270 * @irq_set_wake: enable/disable power-management wake-on of an IRQ 300 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
271 * @irq_bus_lock: function to lock access to slow bus (i2c) chips 301 * @irq_bus_lock: function to lock access to slow bus (i2c) chips
272 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips 302 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
303 * @irq_cpu_online: configure an interrupt source for a secondary CPU
304 * @irq_cpu_offline: un-configure an interrupt source for a secondary CPU
305 * @irq_print_chip: optional to print special chip info in show_interrupts
273 * @flags: chip specific flags 306 * @flags: chip specific flags
274 * 307 *
275 * @release: release function solely used by UML 308 * @release: release function solely used by UML
276 */ 309 */
277struct irq_chip { 310struct irq_chip {
278 const char *name; 311 const char *name;
279#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
280 unsigned int (*startup)(unsigned int irq);
281 void (*shutdown)(unsigned int irq);
282 void (*enable)(unsigned int irq);
283 void (*disable)(unsigned int irq);
284
285 void (*ack)(unsigned int irq);
286 void (*mask)(unsigned int irq);
287 void (*mask_ack)(unsigned int irq);
288 void (*unmask)(unsigned int irq);
289 void (*eoi)(unsigned int irq);
290
291 void (*end)(unsigned int irq);
292 int (*set_affinity)(unsigned int irq,
293 const struct cpumask *dest);
294 int (*retrigger)(unsigned int irq);
295 int (*set_type)(unsigned int irq, unsigned int flow_type);
296 int (*set_wake)(unsigned int irq, unsigned int on);
297
298 void (*bus_lock)(unsigned int irq);
299 void (*bus_sync_unlock)(unsigned int irq);
300#endif
301 unsigned int (*irq_startup)(struct irq_data *data); 312 unsigned int (*irq_startup)(struct irq_data *data);
302 void (*irq_shutdown)(struct irq_data *data); 313 void (*irq_shutdown)(struct irq_data *data);
303 void (*irq_enable)(struct irq_data *data); 314 void (*irq_enable)(struct irq_data *data);
@@ -317,6 +328,11 @@ struct irq_chip {
317 void (*irq_bus_lock)(struct irq_data *data); 328 void (*irq_bus_lock)(struct irq_data *data);
318 void (*irq_bus_sync_unlock)(struct irq_data *data); 329 void (*irq_bus_sync_unlock)(struct irq_data *data);
319 330
331 void (*irq_cpu_online)(struct irq_data *data);
332 void (*irq_cpu_offline)(struct irq_data *data);
333
334 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
335
320 unsigned long flags; 336 unsigned long flags;
321 337
322 /* Currently used only by UML, might disappear one day.*/ 338 /* Currently used only by UML, might disappear one day.*/
@@ -331,11 +347,14 @@ struct irq_chip {
331 * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type() 347 * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
332 * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled 348 * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
333 * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path 349 * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
350 * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
351 * when irq enabled
334 */ 352 */
335enum { 353enum {
336 IRQCHIP_SET_TYPE_MASKED = (1 << 0), 354 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
337 IRQCHIP_EOI_IF_HANDLED = (1 << 1), 355 IRQCHIP_EOI_IF_HANDLED = (1 << 1),
338 IRQCHIP_MASK_ON_SUSPEND = (1 << 2), 356 IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
357 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
339}; 358};
340 359
341/* This include will go away once we isolated irq_desc usage to core code */ 360/* This include will go away once we isolated irq_desc usage to core code */
@@ -360,25 +379,22 @@ struct irqaction;
360extern int setup_irq(unsigned int irq, struct irqaction *new); 379extern int setup_irq(unsigned int irq, struct irqaction *new);
361extern void remove_irq(unsigned int irq, struct irqaction *act); 380extern void remove_irq(unsigned int irq, struct irqaction *act);
362 381
382extern void irq_cpu_online(void);
383extern void irq_cpu_offline(void);
384extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask);
385
363#ifdef CONFIG_GENERIC_HARDIRQS 386#ifdef CONFIG_GENERIC_HARDIRQS
364 387
365#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 388#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
366void move_native_irq(int irq);
367void move_masked_irq(int irq);
368void irq_move_irq(struct irq_data *data); 389void irq_move_irq(struct irq_data *data);
369void irq_move_masked_irq(struct irq_data *data); 390void irq_move_masked_irq(struct irq_data *data);
370#else 391#else
371static inline void move_native_irq(int irq) { }
372static inline void move_masked_irq(int irq) { }
373static inline void irq_move_irq(struct irq_data *data) { } 392static inline void irq_move_irq(struct irq_data *data) { }
374static inline void irq_move_masked_irq(struct irq_data *data) { } 393static inline void irq_move_masked_irq(struct irq_data *data) { }
375#endif 394#endif
376 395
377extern int no_irq_affinity; 396extern int no_irq_affinity;
378 397
379/* Handle irq action chains: */
380extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
381
382/* 398/*
383 * Built-in IRQ handlers for various IRQ types, 399 * Built-in IRQ handlers for various IRQ types,
384 * callable via desc->handle_irq() 400 * callable via desc->handle_irq()
@@ -386,6 +402,7 @@ extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
386extern void handle_level_irq(unsigned int irq, struct irq_desc *desc); 402extern void handle_level_irq(unsigned int irq, struct irq_desc *desc);
387extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc); 403extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);
388extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc); 404extern void handle_edge_irq(unsigned int irq, struct irq_desc *desc);
405extern void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc);
389extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc); 406extern void handle_simple_irq(unsigned int irq, struct irq_desc *desc);
390extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc); 407extern void handle_percpu_irq(unsigned int irq, struct irq_desc *desc);
391extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc); 408extern void handle_bad_irq(unsigned int irq, struct irq_desc *desc);
@@ -534,89 +551,6 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
534 return d->msi_desc; 551 return d->msi_desc;
535} 552}
536 553
537#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
538/* Please do not use: Use the replacement functions instead */
539static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip)
540{
541 return irq_set_chip(irq, chip);
542}
543static inline int set_irq_data(unsigned int irq, void *data)
544{
545 return irq_set_handler_data(irq, data);
546}
547static inline int set_irq_chip_data(unsigned int irq, void *data)
548{
549 return irq_set_chip_data(irq, data);
550}
551static inline int set_irq_type(unsigned int irq, unsigned int type)
552{
553 return irq_set_irq_type(irq, type);
554}
555static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry)
556{
557 return irq_set_msi_desc(irq, entry);
558}
559static inline struct irq_chip *get_irq_chip(unsigned int irq)
560{
561 return irq_get_chip(irq);
562}
563static inline void *get_irq_chip_data(unsigned int irq)
564{
565 return irq_get_chip_data(irq);
566}
567static inline void *get_irq_data(unsigned int irq)
568{
569 return irq_get_handler_data(irq);
570}
571static inline void *irq_data_get_irq_data(struct irq_data *d)
572{
573 return irq_data_get_irq_handler_data(d);
574}
575static inline struct msi_desc *get_irq_msi(unsigned int irq)
576{
577 return irq_get_msi_desc(irq);
578}
579static inline void set_irq_noprobe(unsigned int irq)
580{
581 irq_set_noprobe(irq);
582}
583static inline void set_irq_probe(unsigned int irq)
584{
585 irq_set_probe(irq);
586}
587static inline void set_irq_nested_thread(unsigned int irq, int nest)
588{
589 irq_set_nested_thread(irq, nest);
590}
591static inline void
592set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
593 irq_flow_handler_t handle, const char *name)
594{
595 irq_set_chip_and_handler_name(irq, chip, handle, name);
596}
597static inline void
598set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
599 irq_flow_handler_t handle)
600{
601 irq_set_chip_and_handler(irq, chip, handle);
602}
603static inline void
604__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
605 const char *name)
606{
607 __irq_set_handler(irq, handle, is_chained, name);
608}
609static inline void set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
610{
611 irq_set_handler(irq, handle);
612}
613static inline void
614set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle)
615{
616 irq_set_chained_handler(irq, handle);
617}
618#endif
619
620int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); 554int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);
621void irq_free_descs(unsigned int irq, unsigned int cnt); 555void irq_free_descs(unsigned int irq, unsigned int cnt);
622int irq_reserve_irqs(unsigned int from, unsigned int cnt); 556int irq_reserve_irqs(unsigned int from, unsigned int cnt);
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 00218371518b..a082905b5ebe 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -35,32 +35,7 @@ struct timer_rand_state;
35 * @name: flow handler name for /proc/interrupts output 35 * @name: flow handler name for /proc/interrupts output
36 */ 36 */
37struct irq_desc { 37struct irq_desc {
38
39#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
40 struct irq_data irq_data; 38 struct irq_data irq_data;
41#else
42 /*
43 * This union will go away, once we fixed the direct access to
44 * irq_desc all over the place. The direct fields are a 1:1
45 * overlay of irq_data.
46 */
47 union {
48 struct irq_data irq_data;
49 struct {
50 unsigned int irq;
51 unsigned int node;
52 unsigned int pad_do_not_even_think_about_it;
53 struct irq_chip *chip;
54 void *handler_data;
55 void *chip_data;
56 struct msi_desc *msi_desc;
57#ifdef CONFIG_SMP
58 cpumask_var_t affinity;
59#endif
60 };
61 };
62#endif
63
64 struct timer_rand_state *timer_rand_state; 39 struct timer_rand_state *timer_rand_state;
65 unsigned int __percpu *kstat_irqs; 40 unsigned int __percpu *kstat_irqs;
66 irq_flow_handler_t handle_irq; 41 irq_flow_handler_t handle_irq;
@@ -68,11 +43,7 @@ struct irq_desc {
68 irq_preflow_handler_t preflow_handler; 43 irq_preflow_handler_t preflow_handler;
69#endif 44#endif
70 struct irqaction *action; /* IRQ action list */ 45 struct irqaction *action; /* IRQ action list */
71#ifdef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
72 unsigned int status_use_accessors; 46 unsigned int status_use_accessors;
73#else
74 unsigned int status; /* IRQ status */
75#endif
76 unsigned int core_internal_state__do_not_mess_with_it; 47 unsigned int core_internal_state__do_not_mess_with_it;
77 unsigned int depth; /* nested irq disables */ 48 unsigned int depth; /* nested irq disables */
78 unsigned int wake_depth; /* nested wake enables */ 49 unsigned int wake_depth; /* nested wake enables */
@@ -100,13 +71,6 @@ struct irq_desc {
100extern struct irq_desc irq_desc[NR_IRQS]; 71extern struct irq_desc irq_desc[NR_IRQS];
101#endif 72#endif
102 73
103/* Will be removed once the last users in power and sh are gone */
104extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
105static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
106{
107 return desc;
108}
109
110#ifdef CONFIG_GENERIC_HARDIRQS 74#ifdef CONFIG_GENERIC_HARDIRQS
111 75
112static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) 76static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
@@ -134,27 +98,6 @@ static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
134 return desc->irq_data.msi_desc; 98 return desc->irq_data.msi_desc;
135} 99}
136 100
137#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
138static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc)
139{
140 return irq_desc_get_chip(desc);
141}
142static inline void *get_irq_desc_data(struct irq_desc *desc)
143{
144 return irq_desc_get_handler_data(desc);
145}
146
147static inline void *get_irq_desc_chip_data(struct irq_desc *desc)
148{
149 return irq_desc_get_chip_data(desc);
150}
151
152static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc)
153{
154 return irq_desc_get_msi_desc(desc);
155}
156#endif
157
158/* 101/*
159 * Architectures call this to let the generic IRQ layer 102 * Architectures call this to let the generic IRQ layer
160 * handle an interrupt. If the descriptor is attached to an 103 * handle an interrupt. If the descriptor is attached to an
@@ -178,24 +121,44 @@ static inline int irq_has_action(unsigned int irq)
178 return desc->action != NULL; 121 return desc->action != NULL;
179} 122}
180 123
181#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT 124/* caller has locked the irq_desc and both params are valid */
182static inline int irq_balancing_disabled(unsigned int irq) 125static inline void __irq_set_handler_locked(unsigned int irq,
126 irq_flow_handler_t handler)
183{ 127{
184 struct irq_desc *desc; 128 struct irq_desc *desc;
185 129
186 desc = irq_to_desc(irq); 130 desc = irq_to_desc(irq);
187 return desc->status & IRQ_NO_BALANCING_MASK; 131 desc->handle_irq = handler;
188} 132}
189#endif
190 133
191/* caller has locked the irq_desc and both params are valid */ 134/* caller has locked the irq_desc and both params are valid */
192static inline void __set_irq_handler_unlocked(int irq, 135static inline void
193 irq_flow_handler_t handler) 136__irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip,
137 irq_flow_handler_t handler, const char *name)
194{ 138{
195 struct irq_desc *desc; 139 struct irq_desc *desc;
196 140
197 desc = irq_to_desc(irq); 141 desc = irq_to_desc(irq);
142 irq_desc_get_irq_data(desc)->chip = chip;
198 desc->handle_irq = handler; 143 desc->handle_irq = handler;
144 desc->name = name;
145}
146
147static inline int irq_balancing_disabled(unsigned int irq)
148{
149 struct irq_desc *desc;
150
151 desc = irq_to_desc(irq);
152 return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;
153}
154
155static inline void
156irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
157{
158 struct irq_desc *desc = irq_to_desc(irq);
159
160 if (desc)
161 lockdep_set_class(&desc->lock, class);
199} 162}
200 163
201#ifdef CONFIG_IRQ_PREFLOW_FASTEOI 164#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 27e79c27ba08..a32dcaec04e1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -432,13 +432,35 @@ struct jbd2_journal_handle
432 int h_err; 432 int h_err;
433 433
434 /* Flags [no locking] */ 434 /* Flags [no locking] */
435 unsigned int h_sync: 1; /* sync-on-close */ 435 unsigned int h_sync:1; /* sync-on-close */
436 unsigned int h_jdata: 1; /* force data journaling */ 436 unsigned int h_jdata:1; /* force data journaling */
437 unsigned int h_aborted: 1; /* fatal error on handle */ 437 unsigned int h_aborted:1; /* fatal error on handle */
438 unsigned int h_cowing:1; /* COWing block to snapshot */
439
440 /* Number of buffers requested by user:
441 * (before adding the COW credits factor) */
442 unsigned int h_base_credits:14;
443
444 /* Number of buffers the user is allowed to dirty:
445 * (counts only buffers dirtied when !h_cowing) */
446 unsigned int h_user_credits:14;
447
438 448
439#ifdef CONFIG_DEBUG_LOCK_ALLOC 449#ifdef CONFIG_DEBUG_LOCK_ALLOC
440 struct lockdep_map h_lockdep_map; 450 struct lockdep_map h_lockdep_map;
441#endif 451#endif
452
453#ifdef CONFIG_JBD2_DEBUG
454 /* COW debugging counters: */
455 unsigned int h_cow_moved; /* blocks moved to snapshot */
456 unsigned int h_cow_copied; /* blocks copied to snapshot */
457 unsigned int h_cow_ok_jh; /* blocks already COWed during current
458 transaction */
459 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
460 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
461 unsigned int h_cow_bitmaps; /* COW bitmaps created */
462 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
463#endif
442}; 464};
443 465
444 466
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 525aac3c97df..44e95d0a721f 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -41,6 +41,13 @@ struct journal_head {
41 unsigned b_modified; 41 unsigned b_modified;
42 42
43 /* 43 /*
44 * This feild tracks the last transaction id in which this buffer
45 * has been cowed
46 * [jbd_lock_bh_state()]
47 */
48 unsigned b_cow_tid;
49
50 /*
44 * Copy of the buffer data frozen for writing to the log. 51 * Copy of the buffer data frozen for writing to the log.
45 * [jbd_lock_bh_state()] 52 * [jbd_lock_bh_state()]
46 */ 53 */
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index d8e9b3d1c23c..0df513b7a9f8 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -36,6 +36,7 @@ const char *kallsyms_lookup(unsigned long addr,
36 36
37/* Look up a kernel symbol and return it in a text buffer. */ 37/* Look up a kernel symbol and return it in a text buffer. */
38extern int sprint_symbol(char *buffer, unsigned long address); 38extern int sprint_symbol(char *buffer, unsigned long address);
39extern int sprint_backtrace(char *buffer, unsigned long address);
39 40
40/* Look up a kernel symbol and print it to the kernel messages. */ 41/* Look up a kernel symbol and print it to the kernel messages. */
41extern void __print_symbol(const char *fmt, unsigned long address); 42extern void __print_symbol(const char *fmt, unsigned long address);
@@ -79,6 +80,12 @@ static inline int sprint_symbol(char *buffer, unsigned long addr)
79 return 0; 80 return 0;
80} 81}
81 82
83static inline int sprint_backtrace(char *buffer, unsigned long addr)
84{
85 *buffer = '\0';
86 return 0;
87}
88
82static inline int lookup_symbol_name(unsigned long addr, char *symname) 89static inline int lookup_symbol_name(unsigned long addr, char *symname)
83{ 90{
84 return -ERANGE; 91 return -ERANGE;
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 4b0761cc7dd9..ec2d17bc1f1e 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -159,7 +159,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
159 if (t->buf.tail != NULL) 159 if (t->buf.tail != NULL)
160 t->buf.tail->commit = t->buf.tail->used; 160 t->buf.tail->commit = t->buf.tail->used;
161 spin_unlock_irqrestore(&t->buf.lock, flags); 161 spin_unlock_irqrestore(&t->buf.lock, flags);
162 schedule_delayed_work(&t->buf.work, 0); 162 schedule_work(&t->buf.work);
163} 163}
164 164
165#endif 165#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2fe6e84894a4..00cec4dc0ae2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -187,14 +187,76 @@ NORET_TYPE void do_exit(long error_code)
187 ATTRIB_NORET; 187 ATTRIB_NORET;
188NORET_TYPE void complete_and_exit(struct completion *, long) 188NORET_TYPE void complete_and_exit(struct completion *, long)
189 ATTRIB_NORET; 189 ATTRIB_NORET;
190
191/* Internal, do not use. */
192int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
193int __must_check _kstrtol(const char *s, unsigned int base, long *res);
194
195int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
196int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
197static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
198{
199 /*
200 * We want to shortcut function call, but
201 * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
202 */
203 if (sizeof(unsigned long) == sizeof(unsigned long long) &&
204 __alignof__(unsigned long) == __alignof__(unsigned long long))
205 return kstrtoull(s, base, (unsigned long long *)res);
206 else
207 return _kstrtoul(s, base, res);
208}
209
210static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
211{
212 /*
213 * We want to shortcut function call, but
214 * __builtin_types_compatible_p(long, long long) = 0.
215 */
216 if (sizeof(long) == sizeof(long long) &&
217 __alignof__(long) == __alignof__(long long))
218 return kstrtoll(s, base, (long long *)res);
219 else
220 return _kstrtol(s, base, res);
221}
222
223int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
224int __must_check kstrtoint(const char *s, unsigned int base, int *res);
225
226static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
227{
228 return kstrtoull(s, base, res);
229}
230
231static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
232{
233 return kstrtoll(s, base, res);
234}
235
236static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
237{
238 return kstrtouint(s, base, res);
239}
240
241static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
242{
243 return kstrtoint(s, base, res);
244}
245
246int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
247int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
248int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
249int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
250
190extern unsigned long simple_strtoul(const char *,char **,unsigned int); 251extern unsigned long simple_strtoul(const char *,char **,unsigned int);
191extern long simple_strtol(const char *,char **,unsigned int); 252extern long simple_strtol(const char *,char **,unsigned int);
192extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 253extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
193extern long long simple_strtoll(const char *,char **,unsigned int); 254extern long long simple_strtoll(const char *,char **,unsigned int);
194extern int __must_check strict_strtoul(const char *, unsigned int, unsigned long *); 255#define strict_strtoul kstrtoul
195extern int __must_check strict_strtol(const char *, unsigned int, long *); 256#define strict_strtol kstrtol
196extern int __must_check strict_strtoull(const char *, unsigned int, unsigned long long *); 257#define strict_strtoull kstrtoull
197extern int __must_check strict_strtoll(const char *, unsigned int, long long *); 258#define strict_strtoll kstrtoll
259
198extern int sprintf(char * buf, const char * fmt, ...) 260extern int sprintf(char * buf, const char * fmt, ...)
199 __attribute__ ((format (printf, 2, 3))); 261 __attribute__ ((format (printf, 2, 3)));
200extern int vsprintf(char *buf, const char *, va_list) 262extern int vsprintf(char *buf, const char *, va_list)
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 092e4250a458..10ca03d0a250 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -297,6 +297,7 @@ extern int
297kgdb_handle_exception(int ex_vector, int signo, int err_code, 297kgdb_handle_exception(int ex_vector, int signo, int err_code,
298 struct pt_regs *regs); 298 struct pt_regs *regs);
299extern int kgdb_nmicallback(int cpu, void *regs); 299extern int kgdb_nmicallback(int cpu, void *regs);
300extern void gdbstub_exit(int status);
300 301
301extern int kgdb_single_step; 302extern int kgdb_single_step;
302extern atomic_t kgdb_active; 303extern atomic_t kgdb_active;
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 7ff16f7d3ed4..1e923e5e88e8 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,10 +4,15 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
8 void *data, 8 void *data,
9 const char namefmt[], ...) 9 int node,
10 __attribute__((format(printf, 3, 4))); 10 const char namefmt[], ...)
11 __attribute__((format(printf, 4, 5)));
12
13#define kthread_create(threadfn, data, namefmt, arg...) \
14 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg)
15
11 16
12/** 17/**
13 * kthread_run - create and wake a thread. 18 * kthread_run - create and wake a thread.
@@ -34,6 +39,7 @@ void *kthread_data(struct task_struct *k);
34 39
35int kthreadd(void *unused); 40int kthreadd(void *unused);
36extern struct task_struct *kthreadd_task; 41extern struct task_struct *kthreadd_task;
42extern int tsk_fork_get_node(struct task_struct *tsk);
37 43
38/* 44/*
39 * Simple work processor based on kthread. 45 * Simple work processor based on kthread.
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
new file mode 100644
index 000000000000..bb69d20da0dc
--- /dev/null
+++ b/include/linux/led-lm3530.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA.
3 * Copyright (C) 2009 Motorola, Inc.
4 *
5 * License Terms: GNU General Public License v2
6 *
7 * Simple driver for National Semiconductor LM35330 Backlight driver chip
8 *
9 * Author: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
10 * based on leds-lm3530.c by Dan Murphy <D.Murphy@motorola.com>
11 */
12
13#ifndef _LINUX_LED_LM3530_H__
14#define _LINUX_LED_LM3530_H__
15
16#define LM3530_FS_CURR_5mA (0) /* Full Scale Current */
17#define LM3530_FS_CURR_8mA (1)
18#define LM3530_FS_CURR_12mA (2)
19#define LM3530_FS_CURR_15mA (3)
20#define LM3530_FS_CURR_19mA (4)
21#define LM3530_FS_CURR_22mA (5)
22#define LM3530_FS_CURR_26mA (6)
23#define LM3530_FS_CURR_29mA (7)
24
25#define LM3530_ALS_AVRG_TIME_32ms (0) /* ALS Averaging Time */
26#define LM3530_ALS_AVRG_TIME_64ms (1)
27#define LM3530_ALS_AVRG_TIME_128ms (2)
28#define LM3530_ALS_AVRG_TIME_256ms (3)
29#define LM3530_ALS_AVRG_TIME_512ms (4)
30#define LM3530_ALS_AVRG_TIME_1024ms (5)
31#define LM3530_ALS_AVRG_TIME_2048ms (6)
32#define LM3530_ALS_AVRG_TIME_4096ms (7)
33
34#define LM3530_RAMP_TIME_1ms (0) /* Brigtness Ramp Time */
35#define LM3530_RAMP_TIME_130ms (1) /* Max to 0 and vice versa */
36#define LM3530_RAMP_TIME_260ms (2)
37#define LM3530_RAMP_TIME_520ms (3)
38#define LM3530_RAMP_TIME_1s (4)
39#define LM3530_RAMP_TIME_2s (5)
40#define LM3530_RAMP_TIME_4s (6)
41#define LM3530_RAMP_TIME_8s (7)
42
43/* ALS Resistor Select */
44#define LM3530_ALS_IMPD_Z (0x00) /* ALS Impedence */
45#define LM3530_ALS_IMPD_13_53kOhm (0x01)
46#define LM3530_ALS_IMPD_9_01kOhm (0x02)
47#define LM3530_ALS_IMPD_5_41kOhm (0x03)
48#define LM3530_ALS_IMPD_2_27kOhm (0x04)
49#define LM3530_ALS_IMPD_1_94kOhm (0x05)
50#define LM3530_ALS_IMPD_1_81kOhm (0x06)
51#define LM3530_ALS_IMPD_1_6kOhm (0x07)
52#define LM3530_ALS_IMPD_1_138kOhm (0x08)
53#define LM3530_ALS_IMPD_1_05kOhm (0x09)
54#define LM3530_ALS_IMPD_1_011kOhm (0x0A)
55#define LM3530_ALS_IMPD_941Ohm (0x0B)
56#define LM3530_ALS_IMPD_759Ohm (0x0C)
57#define LM3530_ALS_IMPD_719Ohm (0x0D)
58#define LM3530_ALS_IMPD_700Ohm (0x0E)
59#define LM3530_ALS_IMPD_667Ohm (0x0F)
60
61enum lm3530_mode {
62 LM3530_BL_MODE_MANUAL = 0, /* "man" */
63 LM3530_BL_MODE_ALS, /* "als" */
64 LM3530_BL_MODE_PWM, /* "pwm" */
65};
66
67/* ALS input select */
68enum lm3530_als_mode {
69 LM3530_INPUT_AVRG = 0, /* ALS1 and ALS2 input average */
70 LM3530_INPUT_ALS1, /* ALS1 Input */
71 LM3530_INPUT_ALS2, /* ALS2 Input */
72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */
73};
74
75/**
76 * struct lm3530_platform_data
77 * @mode: mode of operation i.e. Manual, ALS or PWM
78 * @als_input_mode: select source of ALS input - ALS1/2 or average
79 * @max_current: full scale LED current
80 * @pwm_pol_hi: PWM input polarity - active high/active low
81 * @als_avrg_time: ALS input averaging time
82 * @brt_ramp_law: brightness mapping mode - exponential/linear
83 * @brt_ramp_fall: rate of fall of led current
84 * @brt_ramp_rise: rate of rise of led current
85 * @als1_resistor_sel: internal resistance from ALS1 input to ground
86 * @als2_resistor_sel: internal resistance from ALS2 input to ground
87 * @brt_val: brightness value (0-255)
88 */
89struct lm3530_platform_data {
90 enum lm3530_mode mode;
91 enum lm3530_als_mode als_input_mode;
92
93 u8 max_current;
94 bool pwm_pol_hi;
95 u8 als_avrg_time;
96
97 bool brt_ramp_law;
98 u8 brt_ramp_fall;
99 u8 brt_ramp_rise;
100
101 u8 als1_resistor_sel;
102 u8 als2_resistor_sel;
103
104 u8 brt_val;
105};
106
107#endif /* _LINUX_LED_LM3530_H__ */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0f19df9e37b0..61e0340a4b77 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -145,6 +145,9 @@ extern void led_trigger_register_simple(const char *name,
145extern void led_trigger_unregister_simple(struct led_trigger *trigger); 145extern void led_trigger_unregister_simple(struct led_trigger *trigger);
146extern void led_trigger_event(struct led_trigger *trigger, 146extern void led_trigger_event(struct led_trigger *trigger,
147 enum led_brightness event); 147 enum led_brightness event);
148extern void led_trigger_blink(struct led_trigger *trigger,
149 unsigned long *delay_on,
150 unsigned long *delay_off);
148 151
149#else 152#else
150 153
@@ -194,11 +197,11 @@ struct gpio_led {
194 197
195struct gpio_led_platform_data { 198struct gpio_led_platform_data {
196 int num_leds; 199 int num_leds;
197 struct gpio_led *leds; 200 const struct gpio_led *leds;
198 201
199#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ 202#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
200#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ 203#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
201#define GPIO_LED_BLINK 2 /* Plase, blink */ 204#define GPIO_LED_BLINK 2 /* Please, blink */
202 int (*gpio_blink_set)(unsigned gpio, int state, 205 int (*gpio_blink_set)(unsigned gpio, int state,
203 unsigned long *delay_on, 206 unsigned long *delay_on,
204 unsigned long *delay_off); 207 unsigned long *delay_off);
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 6cfe344f9559..1e5df2af8d84 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -23,6 +23,7 @@
23#define XENFS_SUPER_MAGIC 0xabba1974 23#define XENFS_SUPER_MAGIC 0xabba1974
24#define EXT4_SUPER_MAGIC 0xEF53 24#define EXT4_SUPER_MAGIC 0xEF53
25#define BTRFS_SUPER_MAGIC 0x9123683E 25#define BTRFS_SUPER_MAGIC 0x9123683E
26#define NILFS_SUPER_MAGIC 0x3434
26#define HPFS_SUPER_MAGIC 0xf995e849 27#define HPFS_SUPER_MAGIC 0xf995e849
27#define ISOFS_SUPER_MAGIC 0x9660 28#define ISOFS_SUPER_MAGIC 0x9660
28#define JFFS2_SUPER_MAGIC 0x72b6 29#define JFFS2_SUPER_MAGIC 0x72b6
diff --git a/include/linux/media.h b/include/linux/media.h
new file mode 100644
index 000000000000..0ef883327de2
--- /dev/null
+++ b/include/linux/media.h
@@ -0,0 +1,132 @@
1/*
2 * Multimedia device API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 * 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_MEDIA_H
24#define __LINUX_MEDIA_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/version.h>
29
30#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
31
32struct media_device_info {
33 char driver[16];
34 char model[32];
35 char serial[40];
36 char bus_info[32];
37 __u32 media_version;
38 __u32 hw_revision;
39 __u32 driver_version;
40 __u32 reserved[31];
41};
42
43#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
44
45#define MEDIA_ENT_TYPE_SHIFT 16
46#define MEDIA_ENT_TYPE_MASK 0x00ff0000
47#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
48
49#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
53#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
54
55#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
59
60#define MEDIA_ENT_FL_DEFAULT (1 << 0)
61
62struct media_entity_desc {
63 __u32 id;
64 char name[32];
65 __u32 type;
66 __u32 revision;
67 __u32 flags;
68 __u32 group_id;
69 __u16 pads;
70 __u16 links;
71
72 __u32 reserved[4];
73
74 union {
75 /* Node specifications */
76 struct {
77 __u32 major;
78 __u32 minor;
79 } v4l;
80 struct {
81 __u32 major;
82 __u32 minor;
83 } fb;
84 struct {
85 __u32 card;
86 __u32 device;
87 __u32 subdevice;
88 } alsa;
89 int dvb;
90
91 /* Sub-device specifications */
92 /* Nothing needed yet */
93 __u8 raw[184];
94 };
95};
96
97#define MEDIA_PAD_FL_SINK (1 << 0)
98#define MEDIA_PAD_FL_SOURCE (1 << 1)
99
100struct media_pad_desc {
101 __u32 entity; /* entity ID */
102 __u16 index; /* pad index */
103 __u32 flags; /* pad flags */
104 __u32 reserved[2];
105};
106
107#define MEDIA_LNK_FL_ENABLED (1 << 0)
108#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
109#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
110
111struct media_link_desc {
112 struct media_pad_desc source;
113 struct media_pad_desc sink;
114 __u32 flags;
115 __u32 reserved[2];
116};
117
118struct media_links_enum {
119 __u32 entity;
120 /* Should have enough room for pads elements */
121 struct media_pad_desc __user *pads;
122 /* Should have enough room for links elements */
123 struct media_link_desc __user *links;
124 __u32 reserved[4];
125};
126
127#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
128#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
129#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
130#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
131
132#endif /* __LINUX_MEDIA_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index f512e189be5a..5a5ce7055839 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -62,6 +62,7 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
62 gfp_t gfp_mask); 62 gfp_t gfp_mask);
63extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 63extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
64extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 64extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
65extern void mem_cgroup_rotate_reclaimable_page(struct page *page);
65extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 66extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
66extern void mem_cgroup_del_lru(struct page *page); 67extern void mem_cgroup_del_lru(struct page *page);
67extern void mem_cgroup_move_lists(struct page *page, 68extern void mem_cgroup_move_lists(struct page *page,
@@ -96,7 +97,7 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
96 97
97extern int 98extern int
98mem_cgroup_prepare_migration(struct page *page, 99mem_cgroup_prepare_migration(struct page *page,
99 struct page *newpage, struct mem_cgroup **ptr); 100 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask);
100extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 101extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
101 struct page *oldpage, struct page *newpage, bool migration_ok); 102 struct page *oldpage, struct page *newpage, bool migration_ok);
102 103
@@ -150,6 +151,10 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
150void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); 151void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail);
151#endif 152#endif
152 153
154#ifdef CONFIG_DEBUG_VM
155bool mem_cgroup_bad_page_check(struct page *page);
156void mem_cgroup_print_bad_page(struct page *page);
157#endif
153#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
154struct mem_cgroup; 159struct mem_cgroup;
155 160
@@ -211,6 +216,11 @@ static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
211 return ; 216 return ;
212} 217}
213 218
219static inline inline void mem_cgroup_rotate_reclaimable_page(struct page *page)
220{
221 return ;
222}
223
214static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 224static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
215{ 225{
216 return ; 226 return ;
@@ -249,7 +259,7 @@ static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
249 259
250static inline int 260static inline int
251mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 261mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
252 struct mem_cgroup **ptr) 262 struct mem_cgroup **ptr, gfp_t gfp_mask)
253{ 263{
254 return 0; 264 return 0;
255} 265}
@@ -346,5 +356,18 @@ static inline void mem_cgroup_split_huge_fixup(struct page *head,
346 356
347#endif /* CONFIG_CGROUP_MEM_CONT */ 357#endif /* CONFIG_CGROUP_MEM_CONT */
348 358
359#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
360static inline bool
361mem_cgroup_bad_page_check(struct page *page)
362{
363 return false;
364}
365
366static inline void
367mem_cgroup_print_bad_page(struct page *page)
368{
369}
370#endif
371
349#endif /* _LINUX_MEMCONTROL_H */ 372#endif /* _LINUX_MEMCONTROL_H */
350 373
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 4db1fbd8969e..8fba7972ff5f 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -131,9 +131,11 @@ enum {
131 PM8607_ID_LDO8, 131 PM8607_ID_LDO8,
132 PM8607_ID_LDO9, 132 PM8607_ID_LDO9,
133 PM8607_ID_LDO10, 133 PM8607_ID_LDO10,
134 PM8607_ID_LDO11,
134 PM8607_ID_LDO12, 135 PM8607_ID_LDO12,
135 PM8607_ID_LDO13, 136 PM8607_ID_LDO13,
136 PM8607_ID_LDO14, 137 PM8607_ID_LDO14,
138 PM8607_ID_LDO15,
137 139
138 PM8607_ID_RG_MAX, 140 PM8607_ID_RG_MAX,
139}; 141};
@@ -310,8 +312,6 @@ struct pm860x_chip {
310 312
311}; 313};
312 314
313#define PM8607_MAX_REGULATOR PM8607_ID_RG_MAX /* 3 Bucks, 13 LDOs */
314
315enum { 315enum {
316 GI2C_PORT = 0, 316 GI2C_PORT = 0,
317 PI2C_PORT, 317 PI2C_PORT,
@@ -351,23 +351,31 @@ struct pm860x_platform_data {
351 struct pm860x_led_pdata *led; 351 struct pm860x_led_pdata *led;
352 struct pm860x_touch_pdata *touch; 352 struct pm860x_touch_pdata *touch;
353 struct pm860x_power_pdata *power; 353 struct pm860x_power_pdata *power;
354 struct regulator_init_data *regulator;
354 355
355 unsigned short companion_addr; /* I2C address of companion chip */ 356 unsigned short companion_addr; /* I2C address of companion chip */
356 int i2c_port; /* Controlled by GI2C or PI2C */ 357 int i2c_port; /* Controlled by GI2C or PI2C */
357 int irq_mode; /* Clear interrupt by read/write(0/1) */ 358 int irq_mode; /* Clear interrupt by read/write(0/1) */
358 int irq_base; /* IRQ base number of 88pm860x */ 359 int irq_base; /* IRQ base number of 88pm860x */
359 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; 360 int num_leds;
361 int num_backlights;
362 int num_regulators;
360}; 363};
361 364
362extern char pm860x_backlight_name[][MFD_NAME_SIZE];
363extern char pm860x_led_name[][MFD_NAME_SIZE];
364
365extern int pm860x_reg_read(struct i2c_client *, int); 365extern int pm860x_reg_read(struct i2c_client *, int);
366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *); 368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, 369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
370 unsigned char); 370 unsigned char);
371extern int pm860x_page_reg_read(struct i2c_client *, int);
372extern int pm860x_page_reg_write(struct i2c_client *, int, unsigned char);
373extern int pm860x_page_bulk_read(struct i2c_client *, int, int,
374 unsigned char *);
375extern int pm860x_page_bulk_write(struct i2c_client *, int, int,
376 unsigned char *);
377extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char,
378 unsigned char);
371 379
372extern int pm860x_device_init(struct pm860x_chip *chip, 380extern int pm860x_device_init(struct pm860x_chip *chip,
373 struct pm860x_platform_data *pdata) __devinit ; 381 struct pm860x_platform_data *pdata) __devinit ;
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index 37f56b7c4c15..b31843075198 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -74,6 +74,45 @@
74#define AB8500_INT_ACC_DETECT_21DB_F 37 74#define AB8500_INT_ACC_DETECT_21DB_F 37
75#define AB8500_INT_ACC_DETECT_21DB_R 38 75#define AB8500_INT_ACC_DETECT_21DB_R 38
76#define AB8500_INT_GP_SW_ADC_CONV_END 39 76#define AB8500_INT_GP_SW_ADC_CONV_END 39
77#define AB8500_INT_ACC_DETECT_1DB_F 33
78#define AB8500_INT_ACC_DETECT_1DB_R 34
79#define AB8500_INT_ACC_DETECT_22DB_F 35
80#define AB8500_INT_ACC_DETECT_22DB_R 36
81#define AB8500_INT_ACC_DETECT_21DB_F 37
82#define AB8500_INT_ACC_DETECT_21DB_R 38
83#define AB8500_INT_GP_SW_ADC_CONV_END 39
84#define AB8500_INT_GPIO6R 40
85#define AB8500_INT_GPIO7R 41
86#define AB8500_INT_GPIO8R 42
87#define AB8500_INT_GPIO9R 43
88#define AB8500_INT_GPIO10R 44
89#define AB8500_INT_GPIO11R 45
90#define AB8500_INT_GPIO12R 46
91#define AB8500_INT_GPIO13R 47
92#define AB8500_INT_GPIO24R 48
93#define AB8500_INT_GPIO25R 49
94#define AB8500_INT_GPIO36R 50
95#define AB8500_INT_GPIO37R 51
96#define AB8500_INT_GPIO38R 52
97#define AB8500_INT_GPIO39R 53
98#define AB8500_INT_GPIO40R 54
99#define AB8500_INT_GPIO41R 55
100#define AB8500_INT_GPIO6F 56
101#define AB8500_INT_GPIO7F 57
102#define AB8500_INT_GPIO8F 58
103#define AB8500_INT_GPIO9F 59
104#define AB8500_INT_GPIO10F 60
105#define AB8500_INT_GPIO11F 61
106#define AB8500_INT_GPIO12F 62
107#define AB8500_INT_GPIO13F 63
108#define AB8500_INT_GPIO24F 64
109#define AB8500_INT_GPIO25F 65
110#define AB8500_INT_GPIO36F 66
111#define AB8500_INT_GPIO37F 67
112#define AB8500_INT_GPIO38F 68
113#define AB8500_INT_GPIO39F 69
114#define AB8500_INT_GPIO40F 70
115#define AB8500_INT_GPIO41F 71
77#define AB8500_INT_ADP_SOURCE_ERROR 72 116#define AB8500_INT_ADP_SOURCE_ERROR 72
78#define AB8500_INT_ADP_SINK_ERROR 73 117#define AB8500_INT_ADP_SINK_ERROR 73
79#define AB8500_INT_ADP_PROBE_PLUG 74 118#define AB8500_INT_ADP_PROBE_PLUG 74
@@ -111,8 +150,8 @@
111 * @dev: parent device 150 * @dev: parent device
112 * @lock: read/write operations lock 151 * @lock: read/write operations lock
113 * @irq_lock: genirq bus lock 152 * @irq_lock: genirq bus lock
114 * @revision: chip revision
115 * @irq: irq line 153 * @irq: irq line
154 * @chip_id: chip revision id
116 * @write: register write 155 * @write: register write
117 * @read: register read 156 * @read: register read
118 * @rx_buf: rx buf for SPI 157 * @rx_buf: rx buf for SPI
@@ -124,7 +163,7 @@ struct ab8500 {
124 struct device *dev; 163 struct device *dev;
125 struct mutex lock; 164 struct mutex lock;
126 struct mutex irq_lock; 165 struct mutex irq_lock;
127 int revision; 166
128 int irq_base; 167 int irq_base;
129 int irq; 168 int irq;
130 u8 chip_id; 169 u8 chip_id;
@@ -139,19 +178,27 @@ struct ab8500 {
139 u8 oldmask[AB8500_NUM_IRQ_REGS]; 178 u8 oldmask[AB8500_NUM_IRQ_REGS];
140}; 179};
141 180
181struct regulator_reg_init;
142struct regulator_init_data; 182struct regulator_init_data;
183struct ab8500_gpio_platform_data;
143 184
144/** 185/**
145 * struct ab8500_platform_data - AB8500 platform data 186 * struct ab8500_platform_data - AB8500 platform data
146 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 187 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
147 * @init: board-specific initialization after detection of ab8500 188 * @init: board-specific initialization after detection of ab8500
189 * @num_regulator_reg_init: number of regulator init registers
190 * @regulator_reg_init: regulator init registers
191 * @num_regulator: number of regulators
148 * @regulator: machine-specific constraints for regulators 192 * @regulator: machine-specific constraints for regulators
149 */ 193 */
150struct ab8500_platform_data { 194struct ab8500_platform_data {
151 int irq_base; 195 int irq_base;
152 void (*init) (struct ab8500 *); 196 void (*init) (struct ab8500 *);
197 int num_regulator_reg_init;
198 struct ab8500_regulator_reg_init *regulator_reg_init;
153 int num_regulator; 199 int num_regulator;
154 struct regulator_init_data *regulator; 200 struct regulator_init_data *regulator;
201 struct ab8500_gpio_platform_data *gpio;
155}; 202};
156 203
157extern int __devinit ab8500_init(struct ab8500 *ab8500); 204extern int __devinit ab8500_init(struct ab8500 *ab8500);
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/ab8500/gpadc.h
new file mode 100644
index 000000000000..46b954011f16
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpadc.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2010 ST-Ericsson SA
3 * Licensed under GPLv2.
4 *
5 * Author: Arun R Murthy <arun.murthy@stericsson.com>
6 * Author: Daniel Willerud <daniel.willerud@stericsson.com>
7 */
8
9#ifndef _AB8500_GPADC_H
10#define _AB8500_GPADC_H
11
12/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
13#define BAT_CTRL 0x01
14#define BTEMP_BALL 0x02
15#define MAIN_CHARGER_V 0x03
16#define ACC_DETECT1 0x04
17#define ACC_DETECT2 0x05
18#define ADC_AUX1 0x06
19#define ADC_AUX2 0x07
20#define MAIN_BAT_V 0x08
21#define VBUS_V 0x09
22#define MAIN_CHARGER_C 0x0A
23#define USB_CHARGER_C 0x0B
24#define BK_BAT_V 0x0C
25#define DIE_TEMP 0x0D
26
27struct ab8500_gpadc;
28
29struct ab8500_gpadc *ab8500_gpadc_get(char *name);
30int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input);
31
32#endif /* _AB8500_GPADC_H */
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/ab8500/gpio.h
new file mode 100644
index 000000000000..488a8c920a29
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpio.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright ST-Ericsson 2010.
3 *
4 * Author: Bibek Basu <bibek.basu@stericsson.com>
5 * Licensed under GPLv2.
6 */
7
8#ifndef _AB8500_GPIO_H
9#define _AB8500_GPIO_H
10
11/*
12 * Platform data to register a block: only the initial gpio/irq number.
13 */
14
15struct ab8500_gpio_platform_data {
16 int gpio_base;
17 u32 irq_base;
18 u8 config_reg[7];
19};
20
21#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/ab8500/sysctrl.h
new file mode 100644
index 000000000000..10da0291f8f8
--- /dev/null
+++ b/include/linux/mfd/ab8500/sysctrl.h
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
4 * License terms: GNU General Public License (GPL) version 2
5 */
6#ifndef __AB8500_SYSCTRL_H
7#define __AB8500_SYSCTRL_H
8
9#include <linux/bitops.h>
10
11#ifdef CONFIG_AB8500_CORE
12
13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15
16#else
17
18static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
19{
20 return 0;
21}
22
23static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
24{
25 return 0;
26}
27
28#endif /* CONFIG_AB8500_CORE */
29
30static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
31{
32 return ab8500_sysctrl_write(reg, bits, bits);
33}
34
35static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
36{
37 return ab8500_sysctrl_write(reg, bits, 0);
38}
39
40/* Registers */
41#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101
43#define AB8500_PONKEY1PRESSSTATUS 0x102
44#define AB8500_SYSCLKREQSTATUS 0x142
45#define AB8500_STW4500CTRL1 0x180
46#define AB8500_STW4500CTRL2 0x181
47#define AB8500_STW4500CTRL3 0x200
48#define AB8500_MAINWDOGCTRL 0x201
49#define AB8500_MAINWDOGTIMER 0x202
50#define AB8500_LOWBAT 0x203
51#define AB8500_BATTOK 0x204
52#define AB8500_SYSCLKTIMER 0x205
53#define AB8500_SMPSCLKCTRL 0x206
54#define AB8500_SMPSCLKSEL1 0x207
55#define AB8500_SMPSCLKSEL2 0x208
56#define AB8500_SMPSCLKSEL3 0x209
57#define AB8500_SYSULPCLKCONF 0x20A
58#define AB8500_SYSULPCLKCTRL1 0x20B
59#define AB8500_SYSCLKCTRL 0x20C
60#define AB8500_SYSCLKREQ1VALID 0x20D
61#define AB8500_SYSTEMCTRLSUP 0x20F
62#define AB8500_SYSCLKREQ1RFCLKBUF 0x210
63#define AB8500_SYSCLKREQ2RFCLKBUF 0x211
64#define AB8500_SYSCLKREQ3RFCLKBUF 0x212
65#define AB8500_SYSCLKREQ4RFCLKBUF 0x213
66#define AB8500_SYSCLKREQ5RFCLKBUF 0x214
67#define AB8500_SYSCLKREQ6RFCLKBUF 0x215
68#define AB8500_SYSCLKREQ7RFCLKBUF 0x216
69#define AB8500_SYSCLKREQ8RFCLKBUF 0x217
70#define AB8500_DITHERCLKCTRL 0x220
71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233
74
75/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
77#define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
78#define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
79#define AB8500_TURNONSTATUS_RTCALARM BIT(3)
80#define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
81#define AB8500_TURNONSTATUS_VBUSDET BIT(5)
82#define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
83
84#define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
85#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
86
87#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
88#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
89
90#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
91#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
92#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
93#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
94#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
95#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
96#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
97#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
98
99#define AB8500_STW4500CTRL1_SWOFF BIT(0)
100#define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
101#define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
102
103#define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
104#define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
105#define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
106#define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
107#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
108#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
109#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
110#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
111
112#define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
113#define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
114#define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
115#define AB8500_STW4500CTRL3_THSDENA BIT(3)
116
117#define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
118#define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
119#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
120
121#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
122#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
123
124#define AB8500_LOWBAT_LOWBATENA BIT(0)
125#define AB8500_LOWBAT_LOWBAT_MASK 0x7E
126#define AB8500_LOWBAT_LOWBAT_SHIFT 1
127
128#define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
129#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
130#define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
131#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
132
133#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
134#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
135#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
136#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
137
138#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
139#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
140#define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
141
142#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
143#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
144#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
145#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
146
147#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
148#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
149#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
150#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
151
152#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
153#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
154#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
155#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
156
157#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
158#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
159#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
160#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
161#define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
162#define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
163#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
164#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
165
166#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
167#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
168#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
169#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
170#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
171#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
172#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
173#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
174
175#define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
176#define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
177#define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
178
179#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
180#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
181#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
182
183#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
184#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
185#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
186#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
187#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
188
189#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
190#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
191#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
192
193#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
194#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
195#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
196
197#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
198#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
199#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
200
201#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
202#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
203#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
204
205#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
206#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
207#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
208
209#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
210#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
211#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
212
213#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
214#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
215#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
216
217#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
218#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
219#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
220
221#define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
222#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
223#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
224#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
225#define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
226#define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
227#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
228#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
229
230#define AB8500_SWATCTRL_UPDATERF BIT(0)
231#define AB8500_SWATCTRL_SWATENABLE BIT(1)
232#define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
233#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
234#define AB8500_SWATCTRL_SWATBIT5 BIT(6)
235
236#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
237#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
238#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
239#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
240#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
241#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
242#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
243#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
244
245#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
246#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
247#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
248#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
249#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
250#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253
254#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 67bd6f7ecf32..7d9b6ae1c203 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -186,7 +186,6 @@ struct abx500_init_settings {
186struct ab3550_platform_data { 186struct ab3550_platform_data {
187 struct {unsigned int base; unsigned int count; } irq; 187 struct {unsigned int base; unsigned int count; } irq;
188 void *dev_data[AB3550_NUM_DEVICES]; 188 void *dev_data[AB3550_NUM_DEVICES];
189 size_t dev_data_sz[AB3550_NUM_DEVICES];
190 struct abx500_init_settings *init_settings; 189 struct abx500_init_settings *init_settings;
191 unsigned int init_settings_sz; 190 unsigned int init_settings_sz;
192}; 191};
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 835996e167e1..ad1b19aa6508 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -25,22 +25,20 @@ struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id; 26 int id;
27 27
28 /* refcounting for multiple drivers to use a single cell */
29 atomic_t *usage_count;
28 int (*enable)(struct platform_device *dev); 30 int (*enable)(struct platform_device *dev);
29 int (*disable)(struct platform_device *dev); 31 int (*disable)(struct platform_device *dev);
32
30 int (*suspend)(struct platform_device *dev); 33 int (*suspend)(struct platform_device *dev);
31 int (*resume)(struct platform_device *dev); 34 int (*resume)(struct platform_device *dev);
32 35
33 /* driver-specific data for MFD-aware "cell" drivers */ 36 /* mfd_data can be used to pass data to client drivers */
34 void *driver_data; 37 void *mfd_data;
35
36 /* platform_data can be used to either pass data to "generic"
37 driver or as a hook to mfd_cell for the "cell" drivers */
38 void *platform_data;
39 size_t data_size;
40 38
41 /* 39 /*
42 * This resources can be specified relatively to the parent device. 40 * These resources can be specified relative to the parent device.
43 * For accessing device you should use resources from device 41 * For accessing hardware you should use resources from the platform dev
44 */ 42 */
45 int num_resources; 43 int num_resources;
46 const struct resource *resources; 44 const struct resource *resources;
@@ -55,8 +53,53 @@ struct mfd_cell {
55 bool pm_runtime_no_callbacks; 53 bool pm_runtime_no_callbacks;
56}; 54};
57 55
56/*
57 * Convenience functions for clients using shared cells. Refcounting
58 * happens automatically, with the cell's enable/disable callbacks
59 * being called only when a device is first being enabled or no other
60 * clients are making use of it.
61 */
62extern int mfd_cell_enable(struct platform_device *pdev);
63extern int mfd_cell_disable(struct platform_device *pdev);
64
65/*
66 * "Clone" multiple platform devices for a single cell. This is to be used
67 * for devices that have multiple users of a cell. For example, if an mfd
68 * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver,
69 * and a platform driver, the following bit of code would be use after first
70 * calling mfd_add_devices():
71 *
72 * const char *fclones[] = { "foo-gpio", "foo-mtd" };
73 * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones));
74 *
75 * Each driver (MTD, GPIO, and platform driver) would then register
76 * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively.
77 * The cell's .enable/.disable hooks should be used to deal with hardware
78 * resource contention.
79 */
80extern int mfd_clone_cell(const char *cell, const char **clones,
81 size_t n_clones);
82
83/*
84 * Given a platform device that's been created by mfd_add_devices(), fetch
85 * the mfd_cell that created it.
86 */
87static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
88{
89 return pdev->dev.platform_data;
90}
91
92/*
93 * Given a platform device that's been created by mfd_add_devices(), fetch
94 * the .mfd_data entry from the mfd_cell that created it.
95 */
96static inline void *mfd_get_data(struct platform_device *pdev)
97{
98 return mfd_get_cell(pdev)->mfd_data;
99}
100
58extern int mfd_add_devices(struct device *parent, int id, 101extern int mfd_add_devices(struct device *parent, int id,
59 const struct mfd_cell *cells, int n_devs, 102 struct mfd_cell *cells, int n_devs,
60 struct resource *mem_base, 103 struct resource *mem_base,
61 int irq_base); 104 int irq_base);
62 105
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
new file mode 100644
index 000000000000..69d1010e2e51
--- /dev/null
+++ b/include/linux/mfd/max8997-private.h
@@ -0,0 +1,368 @@
1/*
2 * max8997.h - Voltage regulator driver for the Maxim 8997
3 *
4 * Copyright (C) 2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_MAX8997_PRIV_H
23#define __LINUX_MFD_MAX8997_PRIV_H
24
25#include <linux/i2c.h>
26
27#define MAX8997_REG_INVALID (0xff)
28
29enum max8997_pmic_reg {
30 MAX8997_REG_PMIC_ID0 = 0x00,
31 MAX8997_REG_PMIC_ID1 = 0x01,
32 MAX8997_REG_INTSRC = 0x02,
33 MAX8997_REG_INT1 = 0x03,
34 MAX8997_REG_INT2 = 0x04,
35 MAX8997_REG_INT3 = 0x05,
36 MAX8997_REG_INT4 = 0x06,
37
38 MAX8997_REG_INT1MSK = 0x08,
39 MAX8997_REG_INT2MSK = 0x09,
40 MAX8997_REG_INT3MSK = 0x0a,
41 MAX8997_REG_INT4MSK = 0x0b,
42
43 MAX8997_REG_STATUS1 = 0x0d,
44 MAX8997_REG_STATUS2 = 0x0e,
45 MAX8997_REG_STATUS3 = 0x0f,
46 MAX8997_REG_STATUS4 = 0x10,
47
48 MAX8997_REG_MAINCON1 = 0x13,
49 MAX8997_REG_MAINCON2 = 0x14,
50 MAX8997_REG_BUCKRAMP = 0x15,
51
52 MAX8997_REG_BUCK1CTRL = 0x18,
53 MAX8997_REG_BUCK1DVS1 = 0x19,
54 MAX8997_REG_BUCK1DVS2 = 0x1a,
55 MAX8997_REG_BUCK1DVS3 = 0x1b,
56 MAX8997_REG_BUCK1DVS4 = 0x1c,
57 MAX8997_REG_BUCK1DVS5 = 0x1d,
58 MAX8997_REG_BUCK1DVS6 = 0x1e,
59 MAX8997_REG_BUCK1DVS7 = 0x1f,
60 MAX8997_REG_BUCK1DVS8 = 0x20,
61 MAX8997_REG_BUCK2CTRL = 0x21,
62 MAX8997_REG_BUCK2DVS1 = 0x22,
63 MAX8997_REG_BUCK2DVS2 = 0x23,
64 MAX8997_REG_BUCK2DVS3 = 0x24,
65 MAX8997_REG_BUCK2DVS4 = 0x25,
66 MAX8997_REG_BUCK2DVS5 = 0x26,
67 MAX8997_REG_BUCK2DVS6 = 0x27,
68 MAX8997_REG_BUCK2DVS7 = 0x28,
69 MAX8997_REG_BUCK2DVS8 = 0x29,
70 MAX8997_REG_BUCK3CTRL = 0x2a,
71 MAX8997_REG_BUCK3DVS = 0x2b,
72 MAX8997_REG_BUCK4CTRL = 0x2c,
73 MAX8997_REG_BUCK4DVS = 0x2d,
74 MAX8997_REG_BUCK5CTRL = 0x2e,
75 MAX8997_REG_BUCK5DVS1 = 0x2f,
76 MAX8997_REG_BUCK5DVS2 = 0x30,
77 MAX8997_REG_BUCK5DVS3 = 0x31,
78 MAX8997_REG_BUCK5DVS4 = 0x32,
79 MAX8997_REG_BUCK5DVS5 = 0x33,
80 MAX8997_REG_BUCK5DVS6 = 0x34,
81 MAX8997_REG_BUCK5DVS7 = 0x35,
82 MAX8997_REG_BUCK5DVS8 = 0x36,
83 MAX8997_REG_BUCK6CTRL = 0x37,
84 MAX8997_REG_BUCK6BPSKIPCTRL = 0x38,
85 MAX8997_REG_BUCK7CTRL = 0x39,
86 MAX8997_REG_BUCK7DVS = 0x3a,
87 MAX8997_REG_LDO1CTRL = 0x3b,
88 MAX8997_REG_LDO2CTRL = 0x3c,
89 MAX8997_REG_LDO3CTRL = 0x3d,
90 MAX8997_REG_LDO4CTRL = 0x3e,
91 MAX8997_REG_LDO5CTRL = 0x3f,
92 MAX8997_REG_LDO6CTRL = 0x40,
93 MAX8997_REG_LDO7CTRL = 0x41,
94 MAX8997_REG_LDO8CTRL = 0x42,
95 MAX8997_REG_LDO9CTRL = 0x43,
96 MAX8997_REG_LDO10CTRL = 0x44,
97 MAX8997_REG_LDO11CTRL = 0x45,
98 MAX8997_REG_LDO12CTRL = 0x46,
99 MAX8997_REG_LDO13CTRL = 0x47,
100 MAX8997_REG_LDO14CTRL = 0x48,
101 MAX8997_REG_LDO15CTRL = 0x49,
102 MAX8997_REG_LDO16CTRL = 0x4a,
103 MAX8997_REG_LDO17CTRL = 0x4b,
104 MAX8997_REG_LDO18CTRL = 0x4c,
105 MAX8997_REG_LDO21CTRL = 0x4d,
106
107 MAX8997_REG_MBCCTRL1 = 0x50,
108 MAX8997_REG_MBCCTRL2 = 0x51,
109 MAX8997_REG_MBCCTRL3 = 0x52,
110 MAX8997_REG_MBCCTRL4 = 0x53,
111 MAX8997_REG_MBCCTRL5 = 0x54,
112 MAX8997_REG_MBCCTRL6 = 0x55,
113 MAX8997_REG_OTPCGHCVS = 0x56,
114
115 MAX8997_REG_SAFEOUTCTRL = 0x5a,
116
117 MAX8997_REG_LBCNFG1 = 0x5e,
118 MAX8997_REG_LBCNFG2 = 0x5f,
119 MAX8997_REG_BBCCTRL = 0x60,
120
121 MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */
122 MAX8997_REG_FLASH2_CUR = 0x64,
123 MAX8997_REG_MOVIE_CUR = 0x65,
124 MAX8997_REG_GSMB_CUR = 0x66,
125 MAX8997_REG_BOOST_CNTL = 0x67,
126 MAX8997_REG_LEN_CNTL = 0x68,
127 MAX8997_REG_FLASH_CNTL = 0x69,
128 MAX8997_REG_WDT_CNTL = 0x6a,
129 MAX8997_REG_MAXFLASH1 = 0x6b,
130 MAX8997_REG_MAXFLASH2 = 0x6c,
131 MAX8997_REG_FLASHSTATUS = 0x6d,
132 MAX8997_REG_FLASHSTATUSMASK = 0x6e,
133
134 MAX8997_REG_GPIOCNTL1 = 0x70,
135 MAX8997_REG_GPIOCNTL2 = 0x71,
136 MAX8997_REG_GPIOCNTL3 = 0x72,
137 MAX8997_REG_GPIOCNTL4 = 0x73,
138 MAX8997_REG_GPIOCNTL5 = 0x74,
139 MAX8997_REG_GPIOCNTL6 = 0x75,
140 MAX8997_REG_GPIOCNTL7 = 0x76,
141 MAX8997_REG_GPIOCNTL8 = 0x77,
142 MAX8997_REG_GPIOCNTL9 = 0x78,
143 MAX8997_REG_GPIOCNTL10 = 0x79,
144 MAX8997_REG_GPIOCNTL11 = 0x7a,
145 MAX8997_REG_GPIOCNTL12 = 0x7b,
146
147 MAX8997_REG_LDO1CONFIG = 0x80,
148 MAX8997_REG_LDO2CONFIG = 0x81,
149 MAX8997_REG_LDO3CONFIG = 0x82,
150 MAX8997_REG_LDO4CONFIG = 0x83,
151 MAX8997_REG_LDO5CONFIG = 0x84,
152 MAX8997_REG_LDO6CONFIG = 0x85,
153 MAX8997_REG_LDO7CONFIG = 0x86,
154 MAX8997_REG_LDO8CONFIG = 0x87,
155 MAX8997_REG_LDO9CONFIG = 0x88,
156 MAX8997_REG_LDO10CONFIG = 0x89,
157 MAX8997_REG_LDO11CONFIG = 0x8a,
158 MAX8997_REG_LDO12CONFIG = 0x8b,
159 MAX8997_REG_LDO13CONFIG = 0x8c,
160 MAX8997_REG_LDO14CONFIG = 0x8d,
161 MAX8997_REG_LDO15CONFIG = 0x8e,
162 MAX8997_REG_LDO16CONFIG = 0x8f,
163 MAX8997_REG_LDO17CONFIG = 0x90,
164 MAX8997_REG_LDO18CONFIG = 0x91,
165 MAX8997_REG_LDO21CONFIG = 0x92,
166
167 MAX8997_REG_DVSOKTIMER1 = 0x97,
168 MAX8997_REG_DVSOKTIMER2 = 0x98,
169 MAX8997_REG_DVSOKTIMER4 = 0x99,
170 MAX8997_REG_DVSOKTIMER5 = 0x9a,
171
172 MAX8997_REG_PMIC_END = 0x9b,
173};
174
175enum max8997_muic_reg {
176 MAX8997_MUIC_REG_ID = 0x0,
177 MAX8997_MUIC_REG_INT1 = 0x1,
178 MAX8997_MUIC_REG_INT2 = 0x2,
179 MAX8997_MUIC_REG_INT3 = 0x3,
180 MAX8997_MUIC_REG_STATUS1 = 0x4,
181 MAX8997_MUIC_REG_STATUS2 = 0x5,
182 MAX8997_MUIC_REG_STATUS3 = 0x6,
183 MAX8997_MUIC_REG_INTMASK1 = 0x7,
184 MAX8997_MUIC_REG_INTMASK2 = 0x8,
185 MAX8997_MUIC_REG_INTMASK3 = 0x9,
186 MAX8997_MUIC_REG_CDETCTRL = 0xa,
187
188 MAX8997_MUIC_REG_CONTROL1 = 0xc,
189 MAX8997_MUIC_REG_CONTROL2 = 0xd,
190 MAX8997_MUIC_REG_CONTROL3 = 0xe,
191
192 MAX8997_MUIC_REG_END = 0xf,
193};
194
195enum max8997_haptic_reg {
196 MAX8997_HAPTIC_REG_GENERAL = 0x00,
197 MAX8997_HAPTIC_REG_CONF1 = 0x01,
198 MAX8997_HAPTIC_REG_CONF2 = 0x02,
199 MAX8997_HAPTIC_REG_DRVCONF = 0x03,
200 MAX8997_HAPTIC_REG_CYCLECONF1 = 0x04,
201 MAX8997_HAPTIC_REG_CYCLECONF2 = 0x05,
202 MAX8997_HAPTIC_REG_SIGCONF1 = 0x06,
203 MAX8997_HAPTIC_REG_SIGCONF2 = 0x07,
204 MAX8997_HAPTIC_REG_SIGCONF3 = 0x08,
205 MAX8997_HAPTIC_REG_SIGCONF4 = 0x09,
206 MAX8997_HAPTIC_REG_SIGDC1 = 0x0a,
207 MAX8997_HAPTIC_REG_SIGDC2 = 0x0b,
208 MAX8997_HAPTIC_REG_SIGPWMDC1 = 0x0c,
209 MAX8997_HAPTIC_REG_SIGPWMDC2 = 0x0d,
210 MAX8997_HAPTIC_REG_SIGPWMDC3 = 0x0e,
211 MAX8997_HAPTIC_REG_SIGPWMDC4 = 0x0f,
212 MAX8997_HAPTIC_REG_MTR_REV = 0x10,
213
214 MAX8997_HAPTIC_REG_END = 0x11,
215};
216
217/* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
218enum max8997_rtc_reg {
219 MAX8997_RTC_CTRLMASK = 0x02,
220 MAX8997_RTC_CTRL = 0x03,
221 MAX8997_RTC_UPDATE1 = 0x04,
222 MAX8997_RTC_UPDATE2 = 0x05,
223 MAX8997_RTC_WTSR_SMPL = 0x06,
224
225 MAX8997_RTC_SEC = 0x10,
226 MAX8997_RTC_MIN = 0x11,
227 MAX8997_RTC_HOUR = 0x12,
228 MAX8997_RTC_DAY_OF_WEEK = 0x13,
229 MAX8997_RTC_MONTH = 0x14,
230 MAX8997_RTC_YEAR = 0x15,
231 MAX8997_RTC_DAY_OF_MONTH = 0x16,
232 MAX8997_RTC_ALARM1_SEC = 0x17,
233 MAX8997_RTC_ALARM1_MIN = 0x18,
234 MAX8997_RTC_ALARM1_HOUR = 0x19,
235 MAX8997_RTC_ALARM1_DAY_OF_WEEK = 0x1a,
236 MAX8997_RTC_ALARM1_MONTH = 0x1b,
237 MAX8997_RTC_ALARM1_YEAR = 0x1c,
238 MAX8997_RTC_ALARM1_DAY_OF_MONTH = 0x1d,
239 MAX8997_RTC_ALARM2_SEC = 0x1e,
240 MAX8997_RTC_ALARM2_MIN = 0x1f,
241 MAX8997_RTC_ALARM2_HOUR = 0x20,
242 MAX8997_RTC_ALARM2_DAY_OF_WEEK = 0x21,
243 MAX8997_RTC_ALARM2_MONTH = 0x22,
244 MAX8997_RTC_ALARM2_YEAR = 0x23,
245 MAX8997_RTC_ALARM2_DAY_OF_MONTH = 0x24,
246};
247
248enum max8997_irq_source {
249 PMIC_INT1 = 0,
250 PMIC_INT2,
251 PMIC_INT3,
252 PMIC_INT4,
253
254 FUEL_GAUGE, /* Ignored (MAX17042 driver handles) */
255
256 MUIC_INT1,
257 MUIC_INT2,
258 MUIC_INT3,
259
260 GPIO_LOW, /* Not implemented */
261 GPIO_HI, /* Not implemented */
262
263 FLASH_STATUS, /* Not implemented */
264
265 MAX8997_IRQ_GROUP_NR,
266};
267
268enum max8997_irq {
269 MAX8997_PMICIRQ_PWRONR,
270 MAX8997_PMICIRQ_PWRONF,
271 MAX8997_PMICIRQ_PWRON1SEC,
272 MAX8997_PMICIRQ_JIGONR,
273 MAX8997_PMICIRQ_JIGONF,
274 MAX8997_PMICIRQ_LOWBAT2,
275 MAX8997_PMICIRQ_LOWBAT1,
276
277 MAX8997_PMICIRQ_JIGR,
278 MAX8997_PMICIRQ_JIGF,
279 MAX8997_PMICIRQ_MR,
280 MAX8997_PMICIRQ_DVS1OK,
281 MAX8997_PMICIRQ_DVS2OK,
282 MAX8997_PMICIRQ_DVS3OK,
283 MAX8997_PMICIRQ_DVS4OK,
284
285 MAX8997_PMICIRQ_CHGINS,
286 MAX8997_PMICIRQ_CHGRM,
287 MAX8997_PMICIRQ_DCINOVP,
288 MAX8997_PMICIRQ_TOPOFFR,
289 MAX8997_PMICIRQ_CHGRSTF,
290 MAX8997_PMICIRQ_MBCHGTMEXPD,
291
292 MAX8997_PMICIRQ_RTC60S,
293 MAX8997_PMICIRQ_RTCA1,
294 MAX8997_PMICIRQ_RTCA2,
295 MAX8997_PMICIRQ_SMPL_INT,
296 MAX8997_PMICIRQ_RTC1S,
297 MAX8997_PMICIRQ_WTSR,
298
299 MAX8997_MUICIRQ_ADCError,
300 MAX8997_MUICIRQ_ADCLow,
301 MAX8997_MUICIRQ_ADC,
302
303 MAX8997_MUICIRQ_VBVolt,
304 MAX8997_MUICIRQ_DBChg,
305 MAX8997_MUICIRQ_DCDTmr,
306 MAX8997_MUICIRQ_ChgDetRun,
307 MAX8997_MUICIRQ_ChgTyp,
308
309 MAX8997_MUICIRQ_OVP,
310
311 MAX8997_IRQ_NR,
312};
313
314#define MAX8997_REG_BUCK1DVS(x) (MAX8997_REG_BUCK1DVS1 + (x) - 1)
315#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1)
316#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1)
317
318#define MAX8997_NUM_GPIO 12
319struct max8997_dev {
320 struct device *dev;
321 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
322 struct i2c_client *rtc; /* slave addr 0x0c */
323 struct i2c_client *haptic; /* slave addr 0x90 */
324 struct i2c_client *muic; /* slave addr 0x4a */
325 struct mutex iolock;
326
327 int type;
328 struct platform_device *battery; /* battery control (not fuel gauge) */
329
330 int irq;
331 int ono;
332 int irq_base;
333 bool wakeup;
334 struct mutex irqlock;
335 int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
336 int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
337
338 /* For hibernation */
339 u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END +
340 MAX8997_HAPTIC_REG_END];
341
342 bool gpio_status[MAX8997_NUM_GPIO];
343};
344
345enum max8997_types {
346 TYPE_MAX8997,
347 TYPE_MAX8966,
348};
349
350extern int max8997_irq_init(struct max8997_dev *max8997);
351extern void max8997_irq_exit(struct max8997_dev *max8997);
352extern int max8997_irq_resume(struct max8997_dev *max8997);
353
354extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
355extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
356 u8 *buf);
357extern int max8997_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
358extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
359 u8 *buf);
360extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
361
362#define MAX8997_GPIO_INT_BOTH (0x3 << 4)
363#define MAX8997_GPIO_INT_RISE (0x2 << 4)
364#define MAX8997_GPIO_INT_FALL (0x1 << 4)
365
366#define MAX8997_GPIO_INT_MASK (0x3 << 4)
367#define MAX8997_GPIO_DATA_MASK (0x1 << 2)
368#endif /* __LINUX_MFD_MAX8997_PRIV_H */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
new file mode 100644
index 000000000000..60931d089422
--- /dev/null
+++ b/include/linux/mfd/max8997.h
@@ -0,0 +1,117 @@
1/*
2 * max8997.h - Driver for the Maxim 8997/8966
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * This driver is based on max8998.h
22 *
23 * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
24 * Except Fuel Gauge, every device shares the same I2C bus and included in
25 * this mfd driver. Although the fuel gauge is included in the chip, it is
26 * excluded from the driver because a) it has a different I2C bus from
27 * others and b) it can be enabled simply by using MAX17042 driver.
28 */
29
30#ifndef __LINUX_MFD_MAX8998_H
31#define __LINUX_MFD_MAX8998_H
32
33#include <linux/regulator/consumer.h>
34
35/* MAX8997/8966 regulator IDs */
36enum max8998_regulators {
37 MAX8997_LDO1 = 0,
38 MAX8997_LDO2,
39 MAX8997_LDO3,
40 MAX8997_LDO4,
41 MAX8997_LDO5,
42 MAX8997_LDO6,
43 MAX8997_LDO7,
44 MAX8997_LDO8,
45 MAX8997_LDO9,
46 MAX8997_LDO10,
47 MAX8997_LDO11,
48 MAX8997_LDO12,
49 MAX8997_LDO13,
50 MAX8997_LDO14,
51 MAX8997_LDO15,
52 MAX8997_LDO16,
53 MAX8997_LDO17,
54 MAX8997_LDO18,
55 MAX8997_LDO21,
56 MAX8997_BUCK1,
57 MAX8997_BUCK2,
58 MAX8997_BUCK3,
59 MAX8997_BUCK4,
60 MAX8997_BUCK5,
61 MAX8997_BUCK6,
62 MAX8997_BUCK7,
63 MAX8997_EN32KHZ_AP,
64 MAX8997_EN32KHZ_CP,
65 MAX8997_ENVICHG,
66 MAX8997_ESAFEOUT1,
67 MAX8997_ESAFEOUT2,
68 MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
69 MAX8997_CHARGER, /* charger current, MBCCTRL4 */
70 MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
71
72 MAX8997_REG_MAX,
73};
74
75struct max8997_regulator_data {
76 int id;
77 struct regulator_init_data *initdata;
78};
79
80struct max8997_platform_data {
81 /* IRQ */
82 int irq_base;
83 int ono;
84 int wakeup;
85
86 /* ---- PMIC ---- */
87 struct max8997_regulator_data *regulators;
88 int num_regulators;
89
90 /*
91 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
92 * With buckx_gpiodvs enabled, the buckx cannot be controlled
93 * independently. To control buckx (of 1, 2, and 5) independently,
94 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
95 *
96 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
97 * on buckx will change the voltage of bucky at the same time.
98 *
99 */
100 bool ignore_gpiodvs_side_effect;
101 int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
102 int buck125_default_idx; /* Default value of SET1, 2, 3 */
103 unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
104 bool buck1_gpiodvs;
105 unsigned int buck2_voltage[8];
106 bool buck2_gpiodvs;
107 unsigned int buck5_voltage[8];
108 bool buck5_gpiodvs;
109
110 /* MUIC: Not implemented */
111 /* HAPTIC: Not implemented */
112 /* RTC: Not implemented */
113 /* Flash: Not implemented */
114 /* Charger control: Not implemented */
115};
116
117#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index a1d391b40e68..c064beaaccb7 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -146,8 +146,7 @@ struct mc13xxx_platform_data {
146#define MC13XXX_USE_LED (1 << 5) 146#define MC13XXX_USE_LED (1 << 5)
147 unsigned int flags; 147 unsigned int flags;
148 148
149 int num_regulators; 149 struct mc13xxx_regulator_platform_data regulators;
150 struct mc13xxx_regulator_init_data *regulators;
151 struct mc13xxx_leds_platform_data *leds; 150 struct mc13xxx_leds_platform_data *leds;
152}; 151};
153 152
diff --git a/include/linux/mfd/tps6105x.h b/include/linux/mfd/tps6105x.h
new file mode 100644
index 000000000000..386743dd931c
--- /dev/null
+++ b/include/linux/mfd/tps6105x.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA
3 * Written on behalf of Linaro for ST-Ericsson
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9#ifndef MFD_TPS6105X_H
10#define MFD_TPS6105X_H
11
12#include <linux/i2c.h>
13#include <linux/regulator/machine.h>
14
15/*
16 * Register definitions to all subdrivers
17 */
18#define TPS6105X_REG_0 0x00
19#define TPS6105X_REG0_MODE_SHIFT 6
20#define TPS6105X_REG0_MODE_MASK (0x03<<6)
21/* These defines for both reg0 and reg1 */
22#define TPS6105X_REG0_MODE_SHUTDOWN 0x00
23#define TPS6105X_REG0_MODE_TORCH 0x01
24#define TPS6105X_REG0_MODE_TORCH_FLASH 0x02
25#define TPS6105X_REG0_MODE_VOLTAGE 0x03
26#define TPS6105X_REG0_VOLTAGE_SHIFT 4
27#define TPS6105X_REG0_VOLTAGE_MASK (3<<4)
28#define TPS6105X_REG0_VOLTAGE_450 0
29#define TPS6105X_REG0_VOLTAGE_500 1
30#define TPS6105X_REG0_VOLTAGE_525 2
31#define TPS6105X_REG0_VOLTAGE_500_2 3
32#define TPS6105X_REG0_DIMMING_SHIFT 3
33#define TPS6105X_REG0_TORCHC_SHIFT 0
34#define TPS6105X_REG0_TORCHC_MASK (7<<0)
35#define TPS6105X_REG0_TORCHC_0 0x00
36#define TPS6105X_REG0_TORCHC_50 0x01
37#define TPS6105X_REG0_TORCHC_75 0x02
38#define TPS6105X_REG0_TORCHC_100 0x03
39#define TPS6105X_REG0_TORCHC_150 0x04
40#define TPS6105X_REG0_TORCHC_200 0x05
41#define TPS6105X_REG0_TORCHC_250_400 0x06
42#define TPS6105X_REG0_TORCHC_250_500 0x07
43#define TPS6105X_REG_1 0x01
44#define TPS6105X_REG1_MODE_SHIFT 6
45#define TPS6105X_REG1_MODE_MASK (0x03<<6)
46#define TPS6105X_REG1_MODE_SHUTDOWN 0x00
47#define TPS6105X_REG1_MODE_TORCH 0x01
48#define TPS6105X_REG1_MODE_TORCH_FLASH 0x02
49#define TPS6105X_REG1_MODE_VOLTAGE 0x03
50#define TPS6105X_REG_2 0x02
51#define TPS6105X_REG_3 0x03
52
53/**
54 * enum tps6105x_mode - desired mode for the TPS6105x
55 * @TPS6105X_MODE_SHUTDOWN: this instance is inactive, not used for anything
56 * @TPS61905X_MODE_TORCH: this instance is used as a LED, usually a while
57 * LED, for example as backlight or flashlight. If this is set, the
58 * TPS6105X will register to the LED framework
59 * @TPS6105X_MODE_TORCH_FLASH: this instance is used as a flashgun, usually
60 * in a camera
61 * @TPS6105X_MODE_VOLTAGE: this instance is used as a voltage regulator and
62 * will register to the regulator framework
63 */
64enum tps6105x_mode {
65 TPS6105X_MODE_SHUTDOWN,
66 TPS6105X_MODE_TORCH,
67 TPS6105X_MODE_TORCH_FLASH,
68 TPS6105X_MODE_VOLTAGE,
69};
70
71/**
72 * struct tps6105x_platform_data - TPS61905x platform data
73 * @mode: what mode this instance shall be operated in,
74 * this is not selectable at runtime
75 * @regulator_data: initialization data for the voltage
76 * regulator if used as a voltage source
77 */
78struct tps6105x_platform_data {
79 enum tps6105x_mode mode;
80 struct regulator_init_data *regulator_data;
81};
82
83/**
84 * struct tps6105x - state holder for the TPS6105x drivers
85 * @mutex: mutex to serialize I2C accesses
86 * @i2c_client: corresponding I2C client
87 * @regulator: regulator device if used in voltage mode
88 */
89struct tps6105x {
90 struct tps6105x_platform_data *pdata;
91 struct mutex lock;
92 struct i2c_client *client;
93 struct regulator_dev *regulator;
94};
95
96extern int tps6105x_set(struct tps6105x *tps6105x, u8 reg, u8 value);
97extern int tps6105x_get(struct tps6105x *tps6105x, u8 reg, u8 *buf);
98extern int tps6105x_mask_and_set(struct tps6105x *tps6105x, u8 reg,
99 u8 bitmask, u8 bitvalues);
100
101#endif
diff --git a/include/linux/mfd/wl1273-core.h b/include/linux/mfd/wl1273-core.h
index 9787293eae5f..db2f3f454a1b 100644
--- a/include/linux/mfd/wl1273-core.h
+++ b/include/linux/mfd/wl1273-core.h
@@ -280,7 +280,9 @@ struct wl1273_core {
280 280
281 struct i2c_client *client; 281 struct i2c_client *client;
282 282
283 int (*read)(struct wl1273_core *core, u8, u16 *);
283 int (*write)(struct wl1273_core *core, u8, u16); 284 int (*write)(struct wl1273_core *core, u8, u16);
285 int (*write_data)(struct wl1273_core *core, u8 *, u16);
284 int (*set_audio)(struct wl1273_core *core, unsigned int); 286 int (*set_audio)(struct wl1273_core *core, unsigned int);
285 int (*set_volume)(struct wl1273_core *core, unsigned int); 287 int (*set_volume)(struct wl1273_core *core, unsigned int);
286}; 288};
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index fd322aca33ba..afe4db49402d 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -80,7 +80,8 @@ struct wm831x_touch_pdata {
80 int isel; /** Current for pen down (uA) */ 80 int isel; /** Current for pen down (uA) */
81 int rpu; /** Pen down sensitivity resistor divider */ 81 int rpu; /** Pen down sensitivity resistor divider */
82 int pressure; /** Report pressure (boolean) */ 82 int pressure; /** Report pressure (boolean) */
83 int data_irq; /** Touch data ready IRQ */ 83 unsigned int data_irq; /** Touch data ready IRQ */
84 unsigned int pd_irq; /** Touch pendown detect IRQ */
84}; 85};
85 86
86enum wm831x_watchdog_action { 87enum wm831x_watchdog_action {
@@ -103,11 +104,17 @@ struct wm831x_watchdog_pdata {
103#define WM831X_MAX_ISINK 2 104#define WM831X_MAX_ISINK 2
104 105
105struct wm831x_pdata { 106struct wm831x_pdata {
107 /** Used to distinguish multiple WM831x chips */
108 int wm831x_num;
109
106 /** Called before subdevices are set up */ 110 /** Called before subdevices are set up */
107 int (*pre_init)(struct wm831x *wm831x); 111 int (*pre_init)(struct wm831x *wm831x);
108 /** Called after subdevices are set up */ 112 /** Called after subdevices are set up */
109 int (*post_init)(struct wm831x *wm831x); 113 int (*post_init)(struct wm831x *wm831x);
110 114
115 /** Put the /IRQ line into CMOS mode */
116 bool irq_cmos;
117
111 int irq_base; 118 int irq_base;
112 int gpio_base; 119 int gpio_base;
113 struct wm831x_backlight_pdata *backlight; 120 struct wm831x_backlight_pdata *backlight;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index ef4f0b6083a3..f0b69cdae41c 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -59,7 +59,7 @@ struct wm8994 {
59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
60 int bytes, void *dest); 60 int bytes, void *dest);
61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg, 61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
62 int bytes, void *src); 62 int bytes, const void *src);
63 63
64 void *control_data; 64 void *control_data;
65 65
@@ -88,6 +88,8 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
88 unsigned short mask, unsigned short val); 88 unsigned short mask, unsigned short val);
89int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 89int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
90 int count, u16 *buf); 90 int count, u16 *buf);
91int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
92 int count, const u16 *buf);
91 93
92 94
93/* Helper to save on boilerplate */ 95/* Helper to save on boilerplate */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 049214642036..8985768e2c0d 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -39,6 +39,11 @@
39 39
40#include <asm/atomic.h> 40#include <asm/atomic.h>
41 41
42#define MAX_MSIX_P_PORT 17
43#define MAX_MSIX 64
44#define MSIX_LEGACY_SZ 4
45#define MIN_MSIX_P_PORT 5
46
42enum { 47enum {
43 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
44 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -145,8 +150,10 @@ enum {
145}; 150};
146 151
147enum mlx4_protocol { 152enum mlx4_protocol {
148 MLX4_PROTOCOL_IB, 153 MLX4_PROT_IB_IPV6 = 0,
149 MLX4_PROTOCOL_EN, 154 MLX4_PROT_ETH,
155 MLX4_PROT_IB_IPV4,
156 MLX4_PROT_FCOE
150}; 157};
151 158
152enum { 159enum {
@@ -173,6 +180,12 @@ enum mlx4_special_vlan_idx {
173 MLX4_VLAN_REGULAR 180 MLX4_VLAN_REGULAR
174}; 181};
175 182
183enum mlx4_steer_type {
184 MLX4_MC_STEER = 0,
185 MLX4_UC_STEER,
186 MLX4_NUM_STEERS
187};
188
176enum { 189enum {
177 MLX4_NUM_FEXCH = 64 * 1024, 190 MLX4_NUM_FEXCH = 64 * 1024,
178}; 191};
@@ -223,6 +236,7 @@ struct mlx4_caps {
223 int num_eqs; 236 int num_eqs;
224 int reserved_eqs; 237 int reserved_eqs;
225 int num_comp_vectors; 238 int num_comp_vectors;
239 int comp_pool;
226 int num_mpts; 240 int num_mpts;
227 int num_mtt_segs; 241 int num_mtt_segs;
228 int mtts_per_seg; 242 int mtts_per_seg;
@@ -245,6 +259,9 @@ struct mlx4_caps {
245 u16 stat_rate_support; 259 u16 stat_rate_support;
246 int udp_rss; 260 int udp_rss;
247 int loopback_support; 261 int loopback_support;
262 int vep_uc_steering;
263 int vep_mc_steering;
264 int wol;
248 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 265 u8 port_width_cap[MLX4_MAX_PORTS + 1];
249 int max_gso_sz; 266 int max_gso_sz;
250 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 267 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
@@ -334,6 +351,17 @@ struct mlx4_fmr {
334struct mlx4_uar { 351struct mlx4_uar {
335 unsigned long pfn; 352 unsigned long pfn;
336 int index; 353 int index;
354 struct list_head bf_list;
355 unsigned free_bf_bmap;
356 void __iomem *map;
357 void __iomem *bf_map;
358};
359
360struct mlx4_bf {
361 unsigned long offset;
362 int buf_size;
363 struct mlx4_uar *uar;
364 void __iomem *reg;
337}; 365};
338 366
339struct mlx4_cq { 367struct mlx4_cq {
@@ -415,7 +443,7 @@ struct mlx4_dev {
415 unsigned long flags; 443 unsigned long flags;
416 struct mlx4_caps caps; 444 struct mlx4_caps caps;
417 struct radix_tree_root qp_table_tree; 445 struct radix_tree_root qp_table_tree;
418 u32 rev_id; 446 u8 rev_id;
419 char board_id[MLX4_BOARD_ID_LEN]; 447 char board_id[MLX4_BOARD_ID_LEN];
420}; 448};
421 449
@@ -461,6 +489,8 @@ void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn);
461 489
462int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 490int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar);
463void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 491void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar);
492int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf);
493void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf);
464 494
465int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 495int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
466 struct mlx4_mtt *mtt); 496 struct mlx4_mtt *mtt);
@@ -508,9 +538,15 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
508 int block_mcast_loopback, enum mlx4_protocol protocol); 538 int block_mcast_loopback, enum mlx4_protocol protocol);
509int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 539int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
510 enum mlx4_protocol protocol); 540 enum mlx4_protocol protocol);
541int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
542int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
543int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
544int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
545int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
511 546
512int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index); 547int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap);
513void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index); 548void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn);
549int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap);
514 550
515int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 551int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
516int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 552int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -526,5 +562,10 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
526int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); 562int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
527int mlx4_SYNC_TPT(struct mlx4_dev *dev); 563int mlx4_SYNC_TPT(struct mlx4_dev *dev);
528int mlx4_test_interrupts(struct mlx4_dev *dev); 564int mlx4_test_interrupts(struct mlx4_dev *dev);
565int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector);
566void mlx4_release_eq(struct mlx4_dev *dev, int vec);
567
568int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);
569int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
529 570
530#endif /* MLX4_DEVICE_H */ 571#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 0eeb2a1a867c..9e9eb21056ca 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -303,6 +303,7 @@ struct mlx4_wqe_data_seg {
303 303
304enum { 304enum {
305 MLX4_INLINE_ALIGN = 64, 305 MLX4_INLINE_ALIGN = 64,
306 MLX4_INLINE_SEG = 1 << 31,
306}; 307};
307 308
308struct mlx4_wqe_inline_seg { 309struct mlx4_wqe_inline_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 581703d86fbd..7606d7db96c9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -151,6 +151,7 @@ extern pgprot_t protection_map[16];
151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ 152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ 153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
154#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
154 155
155/* 156/*
156 * This interface is used by x86 PAT code to identify a pfn mapping that is 157 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -859,7 +860,14 @@ extern void pagefault_out_of_memory(void);
859 860
860#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 861#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
861 862
863/*
864 * Flags passed to show_mem() and __show_free_areas() to suppress output in
865 * various contexts.
866 */
867#define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */
868
862extern void show_free_areas(void); 869extern void show_free_areas(void);
870extern void __show_free_areas(unsigned int flags);
863 871
864int shmem_lock(struct file *file, int lock, struct user_struct *user); 872int shmem_lock(struct file *file, int lock, struct user_struct *user);
865struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 873struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
@@ -906,6 +914,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
906 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry 914 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry
907 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry 915 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
908 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry 916 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
917 * this handler is required to be able to handle
918 * pmd_trans_huge() pmds. They may simply choose to
919 * split_huge_page() instead of handling it explicitly.
909 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry 920 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
910 * @pte_hole: if set, called for each hole at all levels 921 * @pte_hole: if set, called for each hole at all levels
911 * @hugetlb_entry: if set, called for each hugetlb entry 922 * @hugetlb_entry: if set, called for each hugetlb entry
@@ -971,6 +982,8 @@ static inline int handle_mm_fault(struct mm_struct *mm,
971 982
972extern int make_pages_present(unsigned long addr, unsigned long end); 983extern int make_pages_present(unsigned long addr, unsigned long end);
973extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 984extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
985extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
986 void *buf, int len, int write);
974 987
975int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 988int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
976 unsigned long start, int len, unsigned int foll_flags, 989 unsigned long start, int len, unsigned int foll_flags,
@@ -1347,7 +1360,7 @@ extern void setup_per_zone_wmarks(void);
1347extern void calculate_zone_inactive_ratio(struct zone *zone); 1360extern void calculate_zone_inactive_ratio(struct zone *zone);
1348extern void mem_init(void); 1361extern void mem_init(void);
1349extern void __init mmap_init(void); 1362extern void __init mmap_init(void);
1350extern void show_mem(void); 1363extern void show_mem(unsigned int flags);
1351extern void si_meminfo(struct sysinfo * val); 1364extern void si_meminfo(struct sysinfo * val);
1352extern void si_meminfo_node(struct sysinfo *val, int nid); 1365extern void si_meminfo_node(struct sysinfo *val, int nid);
1353extern int after_bootmem; 1366extern int after_bootmem;
@@ -1537,6 +1550,8 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1537#define FOLL_GET 0x04 /* do get_page on page */ 1550#define FOLL_GET 0x04 /* do get_page on page */
1538#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ 1551#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1539#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 1552#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1553#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
1554 * and return without waiting upon it */
1540#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 1555#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1541#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1556#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1542#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1557#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
@@ -1578,13 +1593,13 @@ static inline bool kernel_page_present(struct page *page) { return true; }
1578#endif /* CONFIG_HIBERNATION */ 1593#endif /* CONFIG_HIBERNATION */
1579#endif 1594#endif
1580 1595
1581extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1596extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
1582#ifdef __HAVE_ARCH_GATE_AREA 1597#ifdef __HAVE_ARCH_GATE_AREA
1583int in_gate_area_no_task(unsigned long addr); 1598int in_gate_area_no_mm(unsigned long addr);
1584int in_gate_area(struct task_struct *task, unsigned long addr); 1599int in_gate_area(struct mm_struct *mm, unsigned long addr);
1585#else 1600#else
1586int in_gate_area_no_task(unsigned long addr); 1601int in_gate_area_no_mm(unsigned long addr);
1587#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1602#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})
1588#endif /* __HAVE_ARCH_GATE_AREA */ 1603#endif /* __HAVE_ARCH_GATE_AREA */
1589 1604
1590int drop_caches_sysctl_handler(struct ctl_table *, int, 1605int drop_caches_sysctl_handler(struct ctl_table *, int,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 26bc4e2cd275..02aa5619709b 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -237,8 +237,9 @@ struct mm_struct {
237 atomic_t mm_users; /* How many users with user space? */ 237 atomic_t mm_users; /* How many users with user space? */
238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
239 int map_count; /* number of VMAs */ 239 int map_count; /* number of VMAs */
240 struct rw_semaphore mmap_sem; 240
241 spinlock_t page_table_lock; /* Protects page tables and some counters */ 241 spinlock_t page_table_lock; /* Protects page tables and some counters */
242 struct rw_semaphore mmap_sem;
242 243
243 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung 244 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung
244 * together off init_mm.mmlist, and are protected 245 * together off init_mm.mmlist, and are protected
@@ -281,6 +282,9 @@ struct mm_struct {
281 unsigned int token_priority; 282 unsigned int token_priority;
282 unsigned int last_interval; 283 unsigned int last_interval;
283 284
285 /* How many tasks sharing this mm are OOM_DISABLE */
286 atomic_t oom_disable_count;
287
284 unsigned long flags; /* Must use atomic bitops to access the bits */ 288 unsigned long flags; /* Must use atomic bitops to access the bits */
285 289
286 struct core_state *core_state; /* coredumping support */ 290 struct core_state *core_state; /* coredumping support */
@@ -313,8 +317,6 @@ struct mm_struct {
313#ifdef CONFIG_TRANSPARENT_HUGEPAGE 317#ifdef CONFIG_TRANSPARENT_HUGEPAGE
314 pgtable_t pmd_huge_pte; /* protected by page_table_lock */ 318 pgtable_t pmd_huge_pte; /* protected by page_table_lock */
315#endif 319#endif
316 /* How many tasks sharing this mm are OOM_DISABLE */
317 atomic_t oom_disable_count;
318}; 320};
319 321
320/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 322/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
new file mode 100644
index 000000000000..39d787c229cb
--- /dev/null
+++ b/include/linux/mmc/boot.h
@@ -0,0 +1,7 @@
1#ifndef MMC_BOOT_H
2#define MMC_BOOT_H
3
4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
6
7#endif
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 8ce082781ccb..adb4888248be 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -54,6 +54,9 @@ struct mmc_ext_csd {
54 unsigned int sec_trim_mult; /* Secure trim multiplier */ 54 unsigned int sec_trim_mult; /* Secure trim multiplier */
55 unsigned int sec_erase_mult; /* Secure erase multiplier */ 55 unsigned int sec_erase_mult; /* Secure erase multiplier */
56 unsigned int trim_timeout; /* In milliseconds */ 56 unsigned int trim_timeout; /* In milliseconds */
57 bool enhanced_area_en; /* enable bit */
58 unsigned long long enhanced_area_offset; /* Units: Byte */
59 unsigned int enhanced_area_size; /* Units: KB */
57}; 60};
58 61
59struct sd_scr { 62struct sd_scr {
@@ -121,6 +124,7 @@ struct mmc_card {
121 /* for byte mode */ 124 /* for byte mode */
122#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ 125#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
123 /* (missing CIA registers) */ 126 /* (missing CIA registers) */
127#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
124 128
125 unsigned int erase_size; /* erase size in sectors */ 129 unsigned int erase_size; /* erase size in sectors */
126 unsigned int erase_shift; /* if erase unit is power 2 */ 130 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -148,6 +152,8 @@ struct mmc_card {
148 struct dentry *debugfs_root; 152 struct dentry *debugfs_root;
149}; 153};
150 154
155void mmc_fixup_device(struct mmc_card *dev);
156
151#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 157#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
152#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) 158#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
153#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) 159#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 64e013f1cfb8..07f27af4dba5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -160,6 +160,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
160 160
161extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 161extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
162extern void mmc_release_host(struct mmc_host *host); 162extern void mmc_release_host(struct mmc_host *host);
163extern void mmc_do_release_host(struct mmc_host *host);
163extern int mmc_try_claim_host(struct mmc_host *host); 164extern int mmc_try_claim_host(struct mmc_host *host);
164 165
165/** 166/**
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 16b0261763ed..c0207a770476 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -140,6 +140,7 @@ struct dw_mci {
140 u32 bus_hz; 140 u32 bus_hz;
141 u32 current_speed; 141 u32 current_speed;
142 u32 num_slots; 142 u32 num_slots;
143 u32 fifoth_val;
143 struct platform_device *pdev; 144 struct platform_device *pdev;
144 struct dw_mci_board *pdata; 145 struct dw_mci_board *pdata;
145 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 146 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
@@ -151,6 +152,8 @@ struct dw_mci {
151 152
152 /* Workaround flags */ 153 /* Workaround flags */
153 u32 quirks; 154 u32 quirks;
155
156 struct regulator *vmmc; /* Power regulator */
154}; 157};
155 158
156/* DMA ops for Internal/External DMAC interface */ 159/* DMA ops for Internal/External DMAC interface */
@@ -165,14 +168,14 @@ struct dw_mci_dma_ops {
165}; 168};
166 169
167/* IP Quirks/flags. */ 170/* IP Quirks/flags. */
168/* No special quirks or flags to cater for */
169#define DW_MCI_QUIRK_NONE 0
170/* DTO fix for command transmission with IDMAC configured */ 171/* DTO fix for command transmission with IDMAC configured */
171#define DW_MCI_QUIRK_IDMAC_DTO 1 172#define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
172/* delay needed between retries on some 2.11a implementations */ 173/* delay needed between retries on some 2.11a implementations */
173#define DW_MCI_QUIRK_RETRY_DELAY 2 174#define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
174/* High Speed Capable - Supports HS cards (upto 50MHz) */ 175/* High Speed Capable - Supports HS cards (upto 50MHz) */
175#define DW_MCI_QUIRK_HIGHSPEED 4 176#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
177/* Unreliable card detection */
178#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
176 179
177 180
178struct dma_pdata; 181struct dma_pdata;
@@ -192,6 +195,8 @@ struct dw_mci_board {
192 u32 quirks; /* Workaround / Quirk flags */ 195 u32 quirks; /* Workaround / Quirk flags */
193 unsigned int bus_hz; /* Bus speed */ 196 unsigned int bus_hz; /* Bus speed */
194 197
198 unsigned int caps; /* Capabilities */
199
195 /* delay in mS before detecting cards after interrupt */ 200 /* delay in mS before detecting cards after interrupt */
196 u32 detect_delay_ms; 201 u32 detect_delay_ms;
197 202
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 612301f85d14..264ba5451e3b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -253,6 +253,8 @@ struct _mmc_csd {
253 * EXT_CSD fields 253 * EXT_CSD fields
254 */ 254 */
255 255
256#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
257#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
256#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 258#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
257#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 259#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
258#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 260#define EXT_CSD_BUS_WIDTH 183 /* R/W */
@@ -262,6 +264,7 @@ struct _mmc_csd {
262#define EXT_CSD_CARD_TYPE 196 /* RO */ 264#define EXT_CSD_CARD_TYPE 196 /* RO */
263#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 265#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
264#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 266#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
267#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */
265#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ 268#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
266#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ 269#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
267#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ 270#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 38d393092812..9eb9b4b96f55 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -104,9 +104,6 @@ static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
104 104
105#define SH_MMCIF_BBS 512 /* boot block size */ 105#define SH_MMCIF_BBS 512 /* boot block size */
106 106
107enum { MMCIF_PROGRESS_ENTER, MMCIF_PROGRESS_INIT,
108 MMCIF_PROGRESS_LOAD, MMCIF_PROGRESS_DONE };
109
110static inline void sh_mmcif_boot_cmd_send(void __iomem *base, 107static inline void sh_mmcif_boot_cmd_send(void __iomem *base,
111 unsigned long cmd, unsigned long arg) 108 unsigned long cmd, unsigned long arg)
112{ 109{
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index c981b959760f..c981b959760f 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
new file mode 100644
index 000000000000..19490b942db0
--- /dev/null
+++ b/include/linux/mmc/tmio.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/mmc/tmio.h
3 *
4 * Copyright (C) 2007 Ian Molton
5 * Copyright (C) 2004 Ian Molton
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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Driver for the MMC / SD / SDIO cell found in:
12 *
13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
14 */
15#ifndef _LINUX_MMC_TMIO_H_
16#define _LINUX_MMC_TMIO_H_
17
18#define CTL_SD_CMD 0x00
19#define CTL_ARG_REG 0x04
20#define CTL_STOP_INTERNAL_ACTION 0x08
21#define CTL_XFER_BLK_COUNT 0xa
22#define CTL_RESPONSE 0x0c
23#define CTL_STATUS 0x1c
24#define CTL_IRQ_MASK 0x20
25#define CTL_SD_CARD_CLK_CTL 0x24
26#define CTL_SD_XFER_LEN 0x26
27#define CTL_SD_MEM_CARD_OPT 0x28
28#define CTL_SD_ERROR_DETAIL_STATUS 0x2c
29#define CTL_SD_DATA_PORT 0x30
30#define CTL_TRANSACTION_CTL 0x34
31#define CTL_SDIO_STATUS 0x36
32#define CTL_SDIO_IRQ_MASK 0x38
33#define CTL_RESET_SD 0xe0
34#define CTL_SDIO_REGS 0x100
35#define CTL_CLK_AND_WAIT_CTL 0x138
36#define CTL_RESET_SDIO 0x1e0
37
38/* Definitions for values the CTRL_STATUS register can take. */
39#define TMIO_STAT_CMDRESPEND 0x00000001
40#define TMIO_STAT_DATAEND 0x00000004
41#define TMIO_STAT_CARD_REMOVE 0x00000008
42#define TMIO_STAT_CARD_INSERT 0x00000010
43#define TMIO_STAT_SIGSTATE 0x00000020
44#define TMIO_STAT_WRPROTECT 0x00000080
45#define TMIO_STAT_CARD_REMOVE_A 0x00000100
46#define TMIO_STAT_CARD_INSERT_A 0x00000200
47#define TMIO_STAT_SIGSTATE_A 0x00000400
48#define TMIO_STAT_CMD_IDX_ERR 0x00010000
49#define TMIO_STAT_CRCFAIL 0x00020000
50#define TMIO_STAT_STOPBIT_ERR 0x00040000
51#define TMIO_STAT_DATATIMEOUT 0x00080000
52#define TMIO_STAT_RXOVERFLOW 0x00100000
53#define TMIO_STAT_TXUNDERRUN 0x00200000
54#define TMIO_STAT_CMDTIMEOUT 0x00400000
55#define TMIO_STAT_RXRDY 0x01000000
56#define TMIO_STAT_TXRQ 0x02000000
57#define TMIO_STAT_ILL_FUNC 0x20000000
58#define TMIO_STAT_CMD_BUSY 0x40000000
59#define TMIO_STAT_ILL_ACCESS 0x80000000
60
61#define TMIO_BBS 512 /* Boot block size */
62
63#endif /* _LINUX_MMC_TMIO_H_ */
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 26529ebd59cc..1bbd9f289245 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -36,6 +36,7 @@ struct mtd_blktrans_dev {
36 struct mtd_info *mtd; 36 struct mtd_info *mtd;
37 struct mutex lock; 37 struct mutex lock;
38 int devnum; 38 int devnum;
39 bool bg_stop;
39 unsigned long size; 40 unsigned long size;
40 int readonly; 41 int readonly;
41 int open; 42 int open;
@@ -62,6 +63,7 @@ struct mtd_blktrans_ops {
62 unsigned long block, char *buffer); 63 unsigned long block, char *buffer);
63 int (*discard)(struct mtd_blktrans_dev *dev, 64 int (*discard)(struct mtd_blktrans_dev *dev,
64 unsigned long block, unsigned nr_blocks); 65 unsigned long block, unsigned nr_blocks);
66 void (*background)(struct mtd_blktrans_dev *dev);
65 67
66 /* Block layer ioctls */ 68 /* Block layer ioctls */
67 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); 69 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
@@ -85,6 +87,7 @@ extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
85extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); 87extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
86extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 88extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
87extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 89extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
90extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
88 91
89 92
90#endif /* __MTD_TRANS_H__ */ 93#endif /* __MTD_TRANS_H__ */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index a9baee6864af..0d823f2dd667 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -535,6 +535,7 @@ struct cfi_fixup {
535#define CFI_MFR_CONTINUATION 0x007F 535#define CFI_MFR_CONTINUATION 0x007F
536 536
537#define CFI_MFR_AMD 0x0001 537#define CFI_MFR_AMD 0x0001
538#define CFI_MFR_AMIC 0x0037
538#define CFI_MFR_ATMEL 0x001F 539#define CFI_MFR_ATMEL 0x001F
539#define CFI_MFR_EON 0x001C 540#define CFI_MFR_EON 0x001C
540#define CFI_MFR_FUJITSU 0x0004 541#define CFI_MFR_FUJITSU 0x0004
diff --git a/include/linux/mtd/latch-addr-flash.h b/include/linux/mtd/latch-addr-flash.h
new file mode 100644
index 000000000000..e94b8e128074
--- /dev/null
+++ b/include/linux/mtd/latch-addr-flash.h
@@ -0,0 +1,29 @@
1/*
2 * Interface for NOR flash driver whose high address lines are latched
3 *
4 * Copyright © 2008 MontaVista Software, Inc. <source@mvista.com>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10#ifndef __LATCH_ADDR_FLASH__
11#define __LATCH_ADDR_FLASH__
12
13struct map_info;
14struct mtd_partition;
15
16struct latch_addr_flash_data {
17 unsigned int width;
18 unsigned int size;
19
20 int (*init)(void *data, int cs);
21 void (*done)(void *data);
22 void (*set_window)(unsigned long offset, void *data);
23 void *data;
24
25 unsigned int nr_parts;
26 struct mtd_partition *parts;
27};
28
29#endif
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 1f489b247a29..ae67ef56a8f5 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -140,6 +140,7 @@ typedef enum {
140 NAND_ECC_HW, 140 NAND_ECC_HW,
141 NAND_ECC_HW_SYNDROME, 141 NAND_ECC_HW_SYNDROME,
142 NAND_ECC_HW_OOB_FIRST, 142 NAND_ECC_HW_OOB_FIRST,
143 NAND_ECC_SOFT_BCH,
143} nand_ecc_modes_t; 144} nand_ecc_modes_t;
144 145
145/* 146/*
@@ -339,6 +340,7 @@ struct nand_hw_control {
339 * @prepad: padding information for syndrome based ecc generators 340 * @prepad: padding information for syndrome based ecc generators
340 * @postpad: padding information for syndrome based ecc generators 341 * @postpad: padding information for syndrome based ecc generators
341 * @layout: ECC layout control struct pointer 342 * @layout: ECC layout control struct pointer
343 * @priv: pointer to private ecc control data
342 * @hwctl: function to control hardware ecc generator. Must only 344 * @hwctl: function to control hardware ecc generator. Must only
343 * be provided if an hardware ECC is available 345 * be provided if an hardware ECC is available
344 * @calculate: function for ecc calculation or readback from ecc hardware 346 * @calculate: function for ecc calculation or readback from ecc hardware
@@ -362,6 +364,7 @@ struct nand_ecc_ctrl {
362 int prepad; 364 int prepad;
363 int postpad; 365 int postpad;
364 struct nand_ecclayout *layout; 366 struct nand_ecclayout *layout;
367 void *priv;
365 void (*hwctl)(struct mtd_info *mtd, int mode); 368 void (*hwctl)(struct mtd_info *mtd, int mode);
366 int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, 369 int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
367 uint8_t *ecc_code); 370 uint8_t *ecc_code);
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
new file mode 100644
index 000000000000..74acf5367556
--- /dev/null
+++ b/include/linux/mtd/nand_bch.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
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 file is the header for the NAND BCH ECC implementation.
9 */
10
11#ifndef __MTD_NAND_BCH_H__
12#define __MTD_NAND_BCH_H__
13
14struct mtd_info;
15struct nand_bch_control;
16
17#if defined(CONFIG_MTD_NAND_ECC_BCH)
18
19static inline int mtd_nand_has_bch(void) { return 1; }
20
21/*
22 * Calculate BCH ecc code
23 */
24int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
25 u_char *ecc_code);
26
27/*
28 * Detect and correct bit errors
29 */
30int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
31 u_char *calc_ecc);
32/*
33 * Initialize BCH encoder/decoder
34 */
35struct nand_bch_control *
36nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
37 unsigned int eccbytes, struct nand_ecclayout **ecclayout);
38/*
39 * Release BCH encoder/decoder resources
40 */
41void nand_bch_free(struct nand_bch_control *nbc);
42
43#else /* !CONFIG_MTD_NAND_ECC_BCH */
44
45static inline int mtd_nand_has_bch(void) { return 0; }
46
47static inline int
48nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
49 u_char *ecc_code)
50{
51 return -1;
52}
53
54static inline int
55nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
56 unsigned char *read_ecc, unsigned char *calc_ecc)
57{
58 return -1;
59}
60
61static inline struct nand_bch_control *
62nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
63 unsigned int eccbytes, struct nand_ecclayout **ecclayout)
64{
65 return NULL;
66}
67
68static inline void nand_bch_free(struct nand_bch_control *nbc) {}
69
70#endif /* CONFIG_MTD_NAND_ECC_BCH */
71
72#endif /* __MTD_NAND_BCH_H__ */
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index ae418e41d8f5..52b6f187bf49 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -198,6 +198,7 @@ struct onenand_chip {
198#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 198#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
199#define ONENAND_PAGEBUF_ALLOC (0x1000) 199#define ONENAND_PAGEBUF_ALLOC (0x1000)
200#define ONENAND_OOBBUF_ALLOC (0x2000) 200#define ONENAND_OOBBUF_ALLOC (0x2000)
201#define ONENAND_SKIP_INITIAL_UNLOCKING (0x4000)
201 202
202#define ONENAND_IS_4KB_PAGE(this) \ 203#define ONENAND_IS_4KB_PAGE(this) \
203 (this->options & ONENAND_HAS_4KB_PAGE) 204 (this->options & ONENAND_HAS_4KB_PAGE)
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 134716e5e350..b528f6d4b860 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -550,6 +550,7 @@ enum {
550 NFSPROC4_CLNT_SETACL, 550 NFSPROC4_CLNT_SETACL,
551 NFSPROC4_CLNT_FS_LOCATIONS, 551 NFSPROC4_CLNT_FS_LOCATIONS,
552 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 552 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
553 NFSPROC4_CLNT_SECINFO,
553 554
554 /* nfs41 */ 555 /* nfs41 */
555 NFSPROC4_CLNT_EXCHANGE_ID, 556 NFSPROC4_CLNT_EXCHANGE_ID,
@@ -560,6 +561,7 @@ enum {
560 NFSPROC4_CLNT_RECLAIM_COMPLETE, 561 NFSPROC4_CLNT_RECLAIM_COMPLETE,
561 NFSPROC4_CLNT_LAYOUTGET, 562 NFSPROC4_CLNT_LAYOUTGET,
562 NFSPROC4_CLNT_GETDEVICEINFO, 563 NFSPROC4_CLNT_GETDEVICEINFO,
564 NFSPROC4_CLNT_LAYOUTCOMMIT,
563}; 565};
564 566
565/* nfs41 types */ 567/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index f88522b10a38..1b93b9c60e55 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -33,6 +33,8 @@
33#define FLUSH_STABLE 4 /* commit to stable storage */ 33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */ 34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
36 38
37#ifdef __KERNEL__ 39#ifdef __KERNEL__
38 40
@@ -93,8 +95,13 @@ struct nfs_open_context {
93 int error; 95 int error;
94 96
95 struct list_head list; 97 struct list_head list;
98};
96 99
100struct nfs_open_dir_context {
101 struct rpc_cred *cred;
97 __u64 dir_cookie; 102 __u64 dir_cookie;
103 __u64 dup_cookie;
104 int duped;
98}; 105};
99 106
100/* 107/*
@@ -191,6 +198,7 @@ struct nfs_inode {
191 198
192 /* pNFS layout information */ 199 /* pNFS layout information */
193 struct pnfs_layout_hdr *layout; 200 struct pnfs_layout_hdr *layout;
201 atomic_t commits_outstanding;
194#endif /* CONFIG_NFS_V4*/ 202#endif /* CONFIG_NFS_V4*/
195#ifdef CONFIG_NFS_FSCACHE 203#ifdef CONFIG_NFS_FSCACHE
196 struct fscache_cookie *fscache; 204 struct fscache_cookie *fscache;
@@ -219,6 +227,8 @@ struct nfs_inode {
219#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 227#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
220#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 228#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
221#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 229#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
230#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */
231#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
222 232
223static inline struct nfs_inode *NFS_I(const struct inode *inode) 233static inline struct nfs_inode *NFS_I(const struct inode *inode)
224{ 234{
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 90907ada6d52..91af2e49fa3a 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -33,11 +33,15 @@ enum {
33 PG_CLEAN, 33 PG_CLEAN,
34 PG_NEED_COMMIT, 34 PG_NEED_COMMIT,
35 PG_NEED_RESCHED, 35 PG_NEED_RESCHED,
36 PG_PNFS_COMMIT,
36}; 37};
37 38
38struct nfs_inode; 39struct nfs_inode;
39struct nfs_page { 40struct nfs_page {
40 struct list_head wb_list; /* Defines state of page: */ 41 union {
42 struct list_head wb_list; /* Defines state of page: */
43 struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */
44 };
41 struct page *wb_page; /* page to read in/write out */ 45 struct page *wb_page; /* page to read in/write out */
42 struct nfs_open_context *wb_context; /* File state context info */ 46 struct nfs_open_context *wb_context; /* File state context info */
43 struct nfs_lock_context *wb_lock_context; /* lock context info */ 47 struct nfs_lock_context *wb_lock_context; /* lock context info */
@@ -57,6 +61,7 @@ struct nfs_pageio_descriptor {
57 size_t pg_count; 61 size_t pg_count;
58 size_t pg_bsize; 62 size_t pg_bsize;
59 unsigned int pg_base; 63 unsigned int pg_base;
64 char pg_moreio;
60 65
61 struct inode *pg_inode; 66 struct inode *pg_inode;
62 int (*pg_doio)(struct nfs_pageio_descriptor *); 67 int (*pg_doio)(struct nfs_pageio_descriptor *);
@@ -73,7 +78,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
73 struct page *page, 78 struct page *page,
74 unsigned int offset, 79 unsigned int offset,
75 unsigned int count); 80 unsigned int count);
76extern void nfs_clear_request(struct nfs_page *req);
77extern void nfs_release_request(struct nfs_page *req); 81extern void nfs_release_request(struct nfs_page *req);
78 82
79 83
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2c2c67d2eb42..78b101e487ea 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h> 5#include <linux/nfs3.h>
6#include <linux/sunrpc/gss_api.h>
6 7
7/* 8/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust 9 * To change the maximum rsize and wsize supported by the NFS client, adjust
@@ -14,6 +15,9 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 15#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 16#define NFS_MIN_FILE_IO_SIZE (1024U)
16 17
18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors;
20
17struct nfs_fsid { 21struct nfs_fsid {
18 uint64_t major; 22 uint64_t major;
19 uint64_t minor; 23 uint64_t minor;
@@ -78,6 +82,7 @@ struct nfs_fattr {
78#define NFS_ATTR_FATTR_CHANGE (1U << 17) 82#define NFS_ATTR_FATTR_CHANGE (1U << 17)
79#define NFS_ATTR_FATTR_PRECHANGE (1U << 18) 83#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 84#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
85#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
81 86
82#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 87#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \ 88 | NFS_ATTR_FATTR_MODE \
@@ -190,8 +195,9 @@ struct nfs4_get_lease_time_res {
190#define PNFS_LAYOUT_MAXSIZE 4096 195#define PNFS_LAYOUT_MAXSIZE 4096
191 196
192struct nfs4_layoutdriver_data { 197struct nfs4_layoutdriver_data {
198 struct page **pages;
199 __u32 pglen;
193 __u32 len; 200 __u32 len;
194 void *buf;
195}; 201};
196 202
197struct pnfs_layout_range { 203struct pnfs_layout_range {
@@ -209,6 +215,7 @@ struct nfs4_layoutget_args {
209 struct nfs_open_context *ctx; 215 struct nfs_open_context *ctx;
210 struct nfs4_sequence_args seq_args; 216 struct nfs4_sequence_args seq_args;
211 nfs4_stateid stateid; 217 nfs4_stateid stateid;
218 struct nfs4_layoutdriver_data layout;
212}; 219};
213 220
214struct nfs4_layoutget_res { 221struct nfs4_layoutget_res {
@@ -216,8 +223,8 @@ struct nfs4_layoutget_res {
216 struct pnfs_layout_range range; 223 struct pnfs_layout_range range;
217 __u32 type; 224 __u32 type;
218 nfs4_stateid stateid; 225 nfs4_stateid stateid;
219 struct nfs4_layoutdriver_data layout;
220 struct nfs4_sequence_res seq_res; 226 struct nfs4_sequence_res seq_res;
227 struct nfs4_layoutdriver_data *layoutp;
221}; 228};
222 229
223struct nfs4_layoutget { 230struct nfs4_layoutget {
@@ -236,6 +243,29 @@ struct nfs4_getdeviceinfo_res {
236 struct nfs4_sequence_res seq_res; 243 struct nfs4_sequence_res seq_res;
237}; 244};
238 245
246struct nfs4_layoutcommit_args {
247 nfs4_stateid stateid;
248 __u64 lastbytewritten;
249 struct inode *inode;
250 const u32 *bitmask;
251 struct nfs4_sequence_args seq_args;
252};
253
254struct nfs4_layoutcommit_res {
255 struct nfs_fattr *fattr;
256 const struct nfs_server *server;
257 struct nfs4_sequence_res seq_res;
258};
259
260struct nfs4_layoutcommit_data {
261 struct rpc_task task;
262 struct nfs_fattr fattr;
263 struct pnfs_layout_segment *lseg;
264 struct rpc_cred *cred;
265 struct nfs4_layoutcommit_args args;
266 struct nfs4_layoutcommit_res res;
267};
268
239/* 269/*
240 * Arguments to the open call. 270 * Arguments to the open call.
241 */ 271 */
@@ -936,6 +966,38 @@ struct nfs4_fs_locations_res {
936 struct nfs4_sequence_res seq_res; 966 struct nfs4_sequence_res seq_res;
937}; 967};
938 968
969struct nfs4_secinfo_oid {
970 unsigned int len;
971 char data[GSS_OID_MAX_LEN];
972};
973
974struct nfs4_secinfo_gss {
975 struct nfs4_secinfo_oid sec_oid4;
976 unsigned int qop4;
977 unsigned int service;
978};
979
980struct nfs4_secinfo_flavor {
981 unsigned int flavor;
982 struct nfs4_secinfo_gss gss;
983};
984
985struct nfs4_secinfo_flavors {
986 unsigned int num_flavors;
987 struct nfs4_secinfo_flavor flavors[0];
988};
989
990struct nfs4_secinfo_arg {
991 const struct nfs_fh *dir_fh;
992 const struct qstr *name;
993 struct nfs4_sequence_args seq_args;
994};
995
996struct nfs4_secinfo_res {
997 struct nfs4_secinfo_flavors *flavors;
998 struct nfs4_sequence_res seq_res;
999};
1000
939#endif /* CONFIG_NFS_V4 */ 1001#endif /* CONFIG_NFS_V4 */
940 1002
941struct nfstime4 { 1003struct nfstime4 {
@@ -1040,6 +1102,7 @@ struct nfs_write_data {
1040 struct nfs_writeres res; /* result struct */ 1102 struct nfs_writeres res; /* result struct */
1041 struct pnfs_layout_segment *lseg; 1103 struct pnfs_layout_segment *lseg;
1042 struct nfs_client *ds_clp; /* pNFS data server */ 1104 struct nfs_client *ds_clp; /* pNFS data server */
1105 int ds_commit_index;
1043 const struct rpc_call_ops *mds_ops; 1106 const struct rpc_call_ops *mds_ops;
1044 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); 1107 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1045#ifdef CONFIG_NFS_V4 1108#ifdef CONFIG_NFS_V4
@@ -1071,7 +1134,7 @@ struct nfs_rpc_ops {
1071 struct nfs_fattr *); 1134 struct nfs_fattr *);
1072 int (*setattr) (struct dentry *, struct nfs_fattr *, 1135 int (*setattr) (struct dentry *, struct nfs_fattr *,
1073 struct iattr *); 1136 struct iattr *);
1074 int (*lookup) (struct inode *, struct qstr *, 1137 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
1075 struct nfs_fh *, struct nfs_fattr *); 1138 struct nfs_fh *, struct nfs_fattr *);
1076 int (*access) (struct inode *, struct nfs_access_entry *); 1139 int (*access) (struct inode *, struct nfs_access_entry *);
1077 int (*readlink)(struct inode *, struct page *, unsigned int, 1140 int (*readlink)(struct inode *, struct page *, unsigned int,
@@ -1118,6 +1181,7 @@ struct nfs_rpc_ops {
1118 struct iattr *iattr); 1181 struct iattr *iattr);
1119 int (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1182 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1120 const char *, rpc_authflavor_t, int); 1183 const char *, rpc_authflavor_t, int);
1184 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
1121}; 1185};
1122 1186
1123/* 1187/*
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 227e49dd5720..8768c469e93e 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -40,26 +40,7 @@
40 40
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43 43#include <linux/magic.h>
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63 44
64 45
65#define NILFS_INODE_BMAP_SIZE 7 46#define NILFS_INODE_BMAP_SIZE 7
@@ -236,8 +217,10 @@ struct nilfs_super_block {
236 * If there is a bit set in the incompatible feature set that the kernel 217 * If there is a bit set in the incompatible feature set that the kernel
237 * doesn't know about, it should refuse to mount the filesystem. 218 * doesn't know about, it should refuse to mount the filesystem.
238 */ 219 */
220#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
221
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL 222#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL 223#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL 224#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242 225
243/* 226/*
@@ -260,7 +243,6 @@ struct nilfs_super_block {
260#define NILFS_USER_INO 11 /* Fisrt user's file inode number */ 243#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
261 244
262#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ 245#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
263#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
264 246
265#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in 247#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
266 a full segment */ 248 a full segment */
@@ -346,17 +328,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
346{ 328{
347 unsigned len = le16_to_cpu(dlen); 329 unsigned len = le16_to_cpu(dlen);
348 330
331#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
349 if (len == NILFS_MAX_REC_LEN) 332 if (len == NILFS_MAX_REC_LEN)
350 return 1 << 16; 333 return 1 << 16;
334#endif
351 return len; 335 return len;
352} 336}
353 337
354static inline __le16 nilfs_rec_len_to_disk(unsigned len) 338static inline __le16 nilfs_rec_len_to_disk(unsigned len)
355{ 339{
340#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
356 if (len == (1 << 16)) 341 if (len == (1 << 16))
357 return cpu_to_le16(NILFS_MAX_REC_LEN); 342 return cpu_to_le16(NILFS_MAX_REC_LEN);
358 else if (len > (1 << 16)) 343 else if (len > (1 << 16))
359 BUG(); 344 BUG();
345#endif
360 return cpu_to_le16(len); 346 return cpu_to_le16(len);
361} 347}
362 348
@@ -525,7 +511,7 @@ struct nilfs_checkpoint {
525 __le64 cp_create; 511 __le64 cp_create;
526 __le64 cp_nblk_inc; 512 __le64 cp_nblk_inc;
527 __le64 cp_inodes_count; 513 __le64 cp_inodes_count;
528 __le64 cp_blocks_count; /* Reserved (might be deleted) */ 514 __le64 cp_blocks_count;
529 515
530 /* Do not change the byte offset of ifile inode. 516 /* Do not change the byte offset of ifile inode.
531 To keep the compatibility of the disk format, 517 To keep the compatibility of the disk format,
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 17c7e21c0bd7..fb51ae38cea7 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -52,9 +52,6 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
52 const char *bus_id, 52 const char *bus_id,
53 struct device *parent); 53 struct device *parent);
54 54
55/* pseudo "matches" value to not do deep probe */
56#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
57
58extern int of_platform_bus_probe(struct device_node *root, 55extern int of_platform_bus_probe(struct device_node *root,
59 const struct of_device_id *matches, 56 const struct of_device_id *matches,
60 struct device *parent); 57 struct device *parent);
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h
new file mode 100644
index 000000000000..150822b4dbff
--- /dev/null
+++ b/include/linux/omap3isp.h
@@ -0,0 +1,646 @@
1/*
2 * omap3isp.h
3 *
4 * TI OMAP3 ISP - User-space API
5 *
6 * Copyright (C) 2010 Nokia Corporation
7 * Copyright (C) 2009 Texas Instruments, Inc.
8 *
9 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 * Sakari Ailus <sakari.ailus@iki.fi>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 * 02110-1301 USA
25 */
26
27#ifndef OMAP3_ISP_USER_H
28#define OMAP3_ISP_USER_H
29
30#include <linux/types.h>
31
32/*
33 * Private IOCTLs
34 *
35 * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
36 * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
37 * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
38 * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
39 * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
40 * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
41 * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
42 */
43
44#define VIDIOC_OMAP3ISP_CCDC_CFG \
45 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
46#define VIDIOC_OMAP3ISP_PRV_CFG \
47 _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
48#define VIDIOC_OMAP3ISP_AEWB_CFG \
49 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
50#define VIDIOC_OMAP3ISP_HIST_CFG \
51 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
52#define VIDIOC_OMAP3ISP_AF_CFG \
53 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
54#define VIDIOC_OMAP3ISP_STAT_REQ \
55 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
56#define VIDIOC_OMAP3ISP_STAT_EN \
57 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
58
59/*
60 * Events
61 *
62 * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
63 * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
64 * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
65 * V4L2_EVENT_OMAP3ISP_HS_VS: Horizontal/vertical synchronization detected
66 */
67
68#define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100)
69#define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
70#define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
71#define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
72#define V4L2_EVENT_OMAP3ISP_HS_VS (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
73
74struct omap3isp_stat_event_status {
75 __u32 frame_number;
76 __u16 config_counter;
77 __u8 buf_err;
78};
79
80/* AE/AWB related structures and flags*/
81
82/* H3A Range Constants */
83#define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023
84#define OMAP3ISP_AEWB_MIN_WIN_H 2
85#define OMAP3ISP_AEWB_MAX_WIN_H 256
86#define OMAP3ISP_AEWB_MIN_WIN_W 6
87#define OMAP3ISP_AEWB_MAX_WIN_W 256
88#define OMAP3ISP_AEWB_MIN_WINVC 1
89#define OMAP3ISP_AEWB_MIN_WINHC 1
90#define OMAP3ISP_AEWB_MAX_WINVC 128
91#define OMAP3ISP_AEWB_MAX_WINHC 36
92#define OMAP3ISP_AEWB_MAX_WINSTART 4095
93#define OMAP3ISP_AEWB_MIN_SUB_INC 2
94#define OMAP3ISP_AEWB_MAX_SUB_INC 32
95#define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600
96
97#define OMAP3ISP_AF_IIRSH_MIN 0
98#define OMAP3ISP_AF_IIRSH_MAX 4095
99#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1
100#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36
101#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1
102#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128
103#define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2
104#define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32
105#define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2
106#define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256
107#define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16
108#define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256
109#define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1
110#define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095
111#define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0
112#define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095
113#define OMAP3ISP_AF_THRESHOLD_MAX 255
114#define OMAP3ISP_AF_COEF_MAX 4095
115#define OMAP3ISP_AF_PAXEL_SIZE 48
116#define OMAP3ISP_AF_MAX_BUF_SIZE 221184
117
118/**
119 * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
120 * saturation_limit: Saturation limit.
121 * @win_height: Window Height. Range 2 - 256, even values only.
122 * @win_width: Window Width. Range 6 - 256, even values only.
123 * @ver_win_count: Vertical Window Count. Range 1 - 128.
124 * @hor_win_count: Horizontal Window Count. Range 1 - 36.
125 * @ver_win_start: Vertical Window Start. Range 0 - 4095.
126 * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
127 * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
128 * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
129 * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
130 * values only.
131 * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
132 * values only.
133 * @alaw_enable: AEW ALAW EN flag.
134 */
135struct omap3isp_h3a_aewb_config {
136 /*
137 * Common fields.
138 * They should be the first ones and must be in the same order as in
139 * ispstat_generic_config struct.
140 */
141 __u32 buf_size;
142 __u16 config_counter;
143
144 /* Private fields */
145 __u16 saturation_limit;
146 __u16 win_height;
147 __u16 win_width;
148 __u16 ver_win_count;
149 __u16 hor_win_count;
150 __u16 ver_win_start;
151 __u16 hor_win_start;
152 __u16 blk_ver_win_start;
153 __u16 blk_win_height;
154 __u16 subsample_ver_inc;
155 __u16 subsample_hor_inc;
156 __u8 alaw_enable;
157};
158
159/**
160 * struct omap3isp_stat_data - Statistic data sent to or received from user
161 * @ts: Timestamp of returned framestats.
162 * @buf: Pointer to pass to user.
163 * @frame_number: Frame number of requested stats.
164 * @cur_frame: Current frame number being processed.
165 * @config_counter: Number of the configuration associated with the data.
166 */
167struct omap3isp_stat_data {
168 struct timeval ts;
169 void __user *buf;
170 __u32 buf_size;
171 __u16 frame_number;
172 __u16 cur_frame;
173 __u16 config_counter;
174};
175
176
177/* Histogram related structs */
178
179/* Flags for number of bins */
180#define OMAP3ISP_HIST_BINS_32 0
181#define OMAP3ISP_HIST_BINS_64 1
182#define OMAP3ISP_HIST_BINS_128 2
183#define OMAP3ISP_HIST_BINS_256 3
184
185/* Number of bins * 4 colors * 4-bytes word */
186#define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4)
187
188#define OMAP3ISP_HIST_MEM_SIZE 1024
189#define OMAP3ISP_HIST_MIN_REGIONS 1
190#define OMAP3ISP_HIST_MAX_REGIONS 4
191#define OMAP3ISP_HIST_MAX_WB_GAIN 255
192#define OMAP3ISP_HIST_MIN_WB_GAIN 0
193#define OMAP3ISP_HIST_MAX_BIT_WIDTH 14
194#define OMAP3ISP_HIST_MIN_BIT_WIDTH 8
195#define OMAP3ISP_HIST_MAX_WG 4
196#define OMAP3ISP_HIST_MAX_BUF_SIZE 4096
197
198/* Source */
199#define OMAP3ISP_HIST_SOURCE_CCDC 0
200#define OMAP3ISP_HIST_SOURCE_MEM 1
201
202/* CFA pattern */
203#define OMAP3ISP_HIST_CFA_BAYER 0
204#define OMAP3ISP_HIST_CFA_FOVEONX3 1
205
206struct omap3isp_hist_region {
207 __u16 h_start;
208 __u16 h_end;
209 __u16 v_start;
210 __u16 v_end;
211};
212
213struct omap3isp_hist_config {
214 /*
215 * Common fields.
216 * They should be the first ones and must be in the same order as in
217 * ispstat_generic_config struct.
218 */
219 __u32 buf_size;
220 __u16 config_counter;
221
222 __u8 num_acc_frames; /* Num of image frames to be processed and
223 accumulated for each histogram frame */
224 __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */
225 __u8 cfa; /* BAYER or FOVEON X3 */
226 __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */
227 __u8 num_regions; /* number of regions to be configured */
228 struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
229};
230
231/* Auto Focus related structs */
232
233#define OMAP3ISP_AF_NUM_COEF 11
234
235enum omap3isp_h3a_af_fvmode {
236 OMAP3ISP_AF_MODE_SUMMED = 0,
237 OMAP3ISP_AF_MODE_PEAK = 1
238};
239
240/* Red, Green, and blue pixel location in the AF windows */
241enum omap3isp_h3a_af_rgbpos {
242 OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */
243 OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */
244 OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */
245 OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */
246 OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */
247 OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */
248};
249
250/* Contains the information regarding the Horizontal Median Filter */
251struct omap3isp_h3a_af_hmf {
252 __u8 enable; /* Status of Horizontal Median Filter */
253 __u8 threshold; /* Threshhold Value for Horizontal Median Filter */
254};
255
256/* Contains the information regarding the IIR Filters */
257struct omap3isp_h3a_af_iir {
258 __u16 h_start; /* IIR horizontal start */
259 __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */
260 __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */
261};
262
263/* Contains the information regarding the Paxels Structure in AF Engine */
264struct omap3isp_h3a_af_paxel {
265 __u16 h_start; /* Horizontal Start Position */
266 __u16 v_start; /* Vertical Start Position */
267 __u8 width; /* Width of the Paxel */
268 __u8 height; /* Height of the Paxel */
269 __u8 h_cnt; /* Horizontal Count */
270 __u8 v_cnt; /* vertical Count */
271 __u8 line_inc; /* Line Increment */
272};
273
274/* Contains the parameters required for hardware set up of AF Engine */
275struct omap3isp_h3a_af_config {
276 /*
277 * Common fields.
278 * They should be the first ones and must be in the same order as in
279 * ispstat_generic_config struct.
280 */
281 __u32 buf_size;
282 __u16 config_counter;
283
284 struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */
285 struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */
286 struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */
287 enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */
288 enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */
289 __u8 alaw_enable; /* AF ALAW status */
290};
291
292/* ISP CCDC structs */
293
294/* Abstraction layer CCDC configurations */
295#define OMAP3ISP_CCDC_ALAW (1 << 0)
296#define OMAP3ISP_CCDC_LPF (1 << 1)
297#define OMAP3ISP_CCDC_BLCLAMP (1 << 2)
298#define OMAP3ISP_CCDC_BCOMP (1 << 3)
299#define OMAP3ISP_CCDC_FPC (1 << 4)
300#define OMAP3ISP_CCDC_CULL (1 << 5)
301#define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7)
302#define OMAP3ISP_CCDC_TBL_LSC (1 << 8)
303
304#define OMAP3ISP_RGB_MAX 3
305
306/* Enumeration constants for Alaw input width */
307enum omap3isp_alaw_ipwidth {
308 OMAP3ISP_ALAW_BIT12_3 = 0x3,
309 OMAP3ISP_ALAW_BIT11_2 = 0x4,
310 OMAP3ISP_ALAW_BIT10_1 = 0x5,
311 OMAP3ISP_ALAW_BIT9_0 = 0x6
312};
313
314/**
315 * struct omap3isp_ccdc_lsc_config - LSC configuration
316 * @offset: Table Offset of the gain table.
317 * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
318 * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
319 * @gain_format: Gain table format.
320 * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
321 * @fmtlnh: Number of pixels in horizontal direction to use for the data
322 * reformatter.
323 * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
324 * @fmtlnv: Number of lines in vertical direction for the data reformatter.
325 * @initial_x: X position, in pixels, of the first active pixel in reference
326 * to the first active paxel. Must be an even number.
327 * @initial_y: Y position, in pixels, of the first active pixel in reference
328 * to the first active paxel. Must be an even number.
329 * @size: Size of LSC gain table. Filled when loaded from userspace.
330 */
331struct omap3isp_ccdc_lsc_config {
332 __u16 offset;
333 __u8 gain_mode_n;
334 __u8 gain_mode_m;
335 __u8 gain_format;
336 __u16 fmtsph;
337 __u16 fmtlnh;
338 __u16 fmtslv;
339 __u16 fmtlnv;
340 __u8 initial_x;
341 __u8 initial_y;
342 __u32 size;
343};
344
345/**
346 * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
347 * @obgain: Optical black average gain.
348 * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
349 * @oblines: Optical Black Sample lines.
350 * @oblen: Optical Black Sample Length.
351 * @dcsubval: Digital Black Clamp subtract value.
352 */
353struct omap3isp_ccdc_bclamp {
354 __u8 obgain;
355 __u8 obstpixel;
356 __u8 oblines;
357 __u8 oblen;
358 __u16 dcsubval;
359};
360
361/**
362 * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
363 * @fpnum: Number of faulty pixels to be corrected in the frame.
364 * @fpcaddr: Memory address of the FPC Table
365 */
366struct omap3isp_ccdc_fpc {
367 __u16 fpnum;
368 __u32 fpcaddr;
369};
370
371/**
372 * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
373 * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
374 * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
375 * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
376 * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
377 */
378struct omap3isp_ccdc_blcomp {
379 __u8 b_mg;
380 __u8 gb_g;
381 __u8 gr_cy;
382 __u8 r_ye;
383};
384
385/**
386 * omap3isp_ccdc_culling - Culling parameters
387 * @v_pattern: Vertical culling pattern.
388 * @h_odd: Horizontal Culling pattern for odd lines.
389 * @h_even: Horizontal Culling pattern for even lines.
390 */
391struct omap3isp_ccdc_culling {
392 __u8 v_pattern;
393 __u16 h_odd;
394 __u16 h_even;
395};
396
397/**
398 * omap3isp_ccdc_update_config - CCDC configuration
399 * @update: Specifies which CCDC registers should be updated.
400 * @flag: Specifies which CCDC functions should be enabled.
401 * @alawip: Enable/Disable A-Law compression.
402 * @bclamp: Black clamp control register.
403 * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
404 * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
405 * @cull: Cull control register.
406 * @lsc: Pointer to LSC gain table.
407 */
408struct omap3isp_ccdc_update_config {
409 __u16 update;
410 __u16 flag;
411 enum omap3isp_alaw_ipwidth alawip;
412 struct omap3isp_ccdc_bclamp __user *bclamp;
413 struct omap3isp_ccdc_blcomp __user *blcomp;
414 struct omap3isp_ccdc_fpc __user *fpc;
415 struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
416 struct omap3isp_ccdc_culling __user *cull;
417 __u8 __user *lsc;
418};
419
420/* Preview configurations */
421#define OMAP3ISP_PREV_LUMAENH (1 << 0)
422#define OMAP3ISP_PREV_INVALAW (1 << 1)
423#define OMAP3ISP_PREV_HRZ_MED (1 << 2)
424#define OMAP3ISP_PREV_CFA (1 << 3)
425#define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4)
426#define OMAP3ISP_PREV_WB (1 << 5)
427#define OMAP3ISP_PREV_BLKADJ (1 << 6)
428#define OMAP3ISP_PREV_RGB2RGB (1 << 7)
429#define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
430#define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
431#define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
432#define OMAP3ISP_PREV_GAMMABYPASS (1 << 11)
433#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
434#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
435#define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
436#define OMAP3ISP_PREV_NF (1 << 15)
437#define OMAP3ISP_PREV_GAMMA (1 << 16)
438
439#define OMAP3ISP_PREV_NF_TBL_SIZE 64
440#define OMAP3ISP_PREV_CFA_TBL_SIZE 576
441#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
442#define OMAP3ISP_PREV_YENH_TBL_SIZE 128
443
444#define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4
445
446/**
447 * struct omap3isp_prev_hmed - Horizontal Median Filter
448 * @odddist: Distance between consecutive pixels of same color in the odd line.
449 * @evendist: Distance between consecutive pixels of same color in the even
450 * line.
451 * @thres: Horizontal median filter threshold.
452 */
453struct omap3isp_prev_hmed {
454 __u8 odddist;
455 __u8 evendist;
456 __u8 thres;
457};
458
459/*
460 * Enumeration for CFA Formats supported by preview
461 */
462enum omap3isp_cfa_fmt {
463 OMAP3ISP_CFAFMT_BAYER,
464 OMAP3ISP_CFAFMT_SONYVGA,
465 OMAP3ISP_CFAFMT_RGBFOVEON,
466 OMAP3ISP_CFAFMT_DNSPL,
467 OMAP3ISP_CFAFMT_HONEYCOMB,
468 OMAP3ISP_CFAFMT_RRGGBBFOVEON
469};
470
471/**
472 * struct omap3isp_prev_cfa - CFA Interpolation
473 * @format: CFA Format Enum value supported by preview.
474 * @gradthrs_vert: CFA Gradient Threshold - Vertical.
475 * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
476 * @table: Pointer to the CFA table.
477 */
478struct omap3isp_prev_cfa {
479 enum omap3isp_cfa_fmt format;
480 __u8 gradthrs_vert;
481 __u8 gradthrs_horz;
482 __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE];
483};
484
485/**
486 * struct omap3isp_prev_csup - Chrominance Suppression
487 * @gain: Gain.
488 * @thres: Threshold.
489 * @hypf_en: Flag to enable/disable the High Pass Filter.
490 */
491struct omap3isp_prev_csup {
492 __u8 gain;
493 __u8 thres;
494 __u8 hypf_en;
495};
496
497/**
498 * struct omap3isp_prev_wbal - White Balance
499 * @dgain: Digital gain (U10Q8).
500 * @coef3: White balance gain - COEF 3 (U8Q5).
501 * @coef2: White balance gain - COEF 2 (U8Q5).
502 * @coef1: White balance gain - COEF 1 (U8Q5).
503 * @coef0: White balance gain - COEF 0 (U8Q5).
504 */
505struct omap3isp_prev_wbal {
506 __u16 dgain;
507 __u8 coef3;
508 __u8 coef2;
509 __u8 coef1;
510 __u8 coef0;
511};
512
513/**
514 * struct omap3isp_prev_blkadj - Black Level Adjustment
515 * @red: Black level offset adjustment for Red in 2's complement format
516 * @green: Black level offset adjustment for Green in 2's complement format
517 * @blue: Black level offset adjustment for Blue in 2's complement format
518 */
519struct omap3isp_prev_blkadj {
520 /*Black level offset adjustment for Red in 2's complement format */
521 __u8 red;
522 /*Black level offset adjustment for Green in 2's complement format */
523 __u8 green;
524 /* Black level offset adjustment for Blue in 2's complement format */
525 __u8 blue;
526};
527
528/**
529 * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
530 * @matrix: Blending values(S12Q8 format)
531 * [RR] [GR] [BR]
532 * [RG] [GG] [BG]
533 * [RB] [GB] [BB]
534 * @offset: Blending offset value for R,G,B in 2's complement integer format.
535 */
536struct omap3isp_prev_rgbtorgb {
537 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
538 __u16 offset[OMAP3ISP_RGB_MAX];
539};
540
541/**
542 * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
543 * @matrix: Color space conversion coefficients(S10Q8)
544 * [CSCRY] [CSCGY] [CSCBY]
545 * [CSCRCB] [CSCGCB] [CSCBCB]
546 * [CSCRCR] [CSCGCR] [CSCBCR]
547 * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
548 */
549struct omap3isp_prev_csc {
550 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
551 __s16 offset[OMAP3ISP_RGB_MAX];
552};
553
554/**
555 * struct omap3isp_prev_yclimit - Y, C Value Limit
556 * @minC: Minimum C value
557 * @maxC: Maximum C value
558 * @minY: Minimum Y value
559 * @maxY: Maximum Y value
560 */
561struct omap3isp_prev_yclimit {
562 __u8 minC;
563 __u8 maxC;
564 __u8 minY;
565 __u8 maxY;
566};
567
568/**
569 * struct omap3isp_prev_dcor - Defect correction
570 * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
571 * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
572 */
573struct omap3isp_prev_dcor {
574 __u8 couplet_mode_en;
575 __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
576};
577
578/**
579 * struct omap3isp_prev_nf - Noise Filter
580 * @spread: Spread value to be used in Noise Filter
581 * @table: Pointer to the Noise Filter table
582 */
583struct omap3isp_prev_nf {
584 __u8 spread;
585 __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
586};
587
588/**
589 * struct omap3isp_prev_gtables - Gamma correction tables
590 * @red: Array for red gamma table.
591 * @green: Array for green gamma table.
592 * @blue: Array for blue gamma table.
593 */
594struct omap3isp_prev_gtables {
595 __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
596 __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
597 __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
598};
599
600/**
601 * struct omap3isp_prev_luma - Luma enhancement
602 * @table: Array for luma enhancement table.
603 */
604struct omap3isp_prev_luma {
605 __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
606};
607
608/**
609 * struct omap3isp_prev_update_config - Preview engine configuration (user)
610 * @update: Specifies which ISP Preview registers should be updated.
611 * @flag: Specifies which ISP Preview functions should be enabled.
612 * @shading_shift: 3bit value of shift used in shading compensation.
613 * @luma: Pointer to luma enhancement structure.
614 * @hmed: Pointer to structure containing the odd and even distance.
615 * between the pixels in the image along with the filter threshold.
616 * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
617 * format in the image, vertical and horizontal gradient threshold.
618 * @csup: Pointer to Structure for Chrominance Suppression coefficients.
619 * @wbal: Pointer to structure for White Balance.
620 * @blkadj: Pointer to structure for Black Adjustment.
621 * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
622 * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
623 * @yclimit: Pointer to structure for Y, C Value Limit.
624 * @dcor: Pointer to structure for defect correction.
625 * @nf: Pointer to structure for Noise Filter
626 * @gamma: Pointer to gamma structure.
627 */
628struct omap3isp_prev_update_config {
629 __u32 update;
630 __u32 flag;
631 __u32 shading_shift;
632 struct omap3isp_prev_luma __user *luma;
633 struct omap3isp_prev_hmed __user *hmed;
634 struct omap3isp_prev_cfa __user *cfa;
635 struct omap3isp_prev_csup __user *csup;
636 struct omap3isp_prev_wbal __user *wbal;
637 struct omap3isp_prev_blkadj __user *blkadj;
638 struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
639 struct omap3isp_prev_csc __user *csc;
640 struct omap3isp_prev_yclimit __user *yclimit;
641 struct omap3isp_prev_dcor __user *dcor;
642 struct omap3isp_prev_nf __user *nf;
643 struct omap3isp_prev_gtables __user *gamma;
644};
645
646#endif /* OMAP3_ISP_USER_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0db8037e2725..811183de1ef5 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -196,7 +196,7 @@ static inline int __TestClearPage##uname(struct page *page) { return 0; }
196 196
197struct page; /* forward declaration */ 197struct page; /* forward declaration */
198 198
199TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 199TESTPAGEFLAG(Locked, locked)
200PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error) 200PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
201PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 201PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 6d6cb7a57bb3..f5de21de31dd 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -1,8 +1,26 @@
1#ifndef __LINUX_PAGE_CGROUP_H 1#ifndef __LINUX_PAGE_CGROUP_H
2#define __LINUX_PAGE_CGROUP_H 2#define __LINUX_PAGE_CGROUP_H
3 3
4enum {
5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
7 PCG_CACHE, /* charged as cache */
8 PCG_USED, /* this object is in use. */
9 PCG_MIGRATION, /* under page migration */
10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS,
16};
17
18#ifndef __GENERATING_BOUNDS_H
19#include <generated/bounds.h>
20
4#ifdef CONFIG_CGROUP_MEM_RES_CTLR 21#ifdef CONFIG_CGROUP_MEM_RES_CTLR
5#include <linux/bit_spinlock.h> 22#include <linux/bit_spinlock.h>
23
6/* 24/*
7 * Page Cgroup can be considered as an extended mem_map. 25 * Page Cgroup can be considered as an extended mem_map.
8 * A page_cgroup page is associated with every page descriptor. The 26 * A page_cgroup page is associated with every page descriptor. The
@@ -13,7 +31,6 @@
13struct page_cgroup { 31struct page_cgroup {
14 unsigned long flags; 32 unsigned long flags;
15 struct mem_cgroup *mem_cgroup; 33 struct mem_cgroup *mem_cgroup;
16 struct page *page;
17 struct list_head lru; /* per cgroup LRU list */ 34 struct list_head lru; /* per cgroup LRU list */
18}; 35};
19 36
@@ -32,19 +49,7 @@ static inline void __init page_cgroup_init(void)
32#endif 49#endif
33 50
34struct page_cgroup *lookup_page_cgroup(struct page *page); 51struct page_cgroup *lookup_page_cgroup(struct page *page);
35 52struct page *lookup_cgroup_page(struct page_cgroup *pc);
36enum {
37 /* flags for mem_cgroup */
38 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */
41 PCG_MIGRATION, /* under page migration */
42 /* flags for mem_cgroup and file and I/O status */
43 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
44 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
45 /* No lock in page_cgroup */
46 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
47};
48 53
49#define TESTPCGFLAG(uname, lname) \ 54#define TESTPCGFLAG(uname, lname) \
50static inline int PageCgroup##uname(struct page_cgroup *pc) \ 55static inline int PageCgroup##uname(struct page_cgroup *pc) \
@@ -85,16 +90,6 @@ SETPCGFLAG(Migration, MIGRATION)
85CLEARPCGFLAG(Migration, MIGRATION) 90CLEARPCGFLAG(Migration, MIGRATION)
86TESTPCGFLAG(Migration, MIGRATION) 91TESTPCGFLAG(Migration, MIGRATION)
87 92
88static inline int page_cgroup_nid(struct page_cgroup *pc)
89{
90 return page_to_nid(pc->page);
91}
92
93static inline enum zone_type page_cgroup_zid(struct page_cgroup *pc)
94{
95 return page_zonenum(pc->page);
96}
97
98static inline void lock_page_cgroup(struct page_cgroup *pc) 93static inline void lock_page_cgroup(struct page_cgroup *pc)
99{ 94{
100 /* 95 /*
@@ -109,11 +104,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc)
109 bit_spin_unlock(PCG_LOCK, &pc->flags); 104 bit_spin_unlock(PCG_LOCK, &pc->flags);
110} 105}
111 106
112static inline int page_is_cgroup_locked(struct page_cgroup *pc)
113{
114 return bit_spin_is_locked(PCG_LOCK, &pc->flags);
115}
116
117static inline void move_lock_page_cgroup(struct page_cgroup *pc, 107static inline void move_lock_page_cgroup(struct page_cgroup *pc,
118 unsigned long *flags) 108 unsigned long *flags)
119{ 109{
@@ -132,6 +122,39 @@ static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
132 local_irq_restore(*flags); 122 local_irq_restore(*flags);
133} 123}
134 124
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existant fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
156}
157
135#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
136struct page_cgroup; 159struct page_cgroup;
137 160
@@ -152,7 +175,7 @@ static inline void __init page_cgroup_init_flatmem(void)
152{ 175{
153} 176}
154 177
155#endif 178#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
156 179
157#include <linux/swap.h> 180#include <linux/swap.h>
158 181
@@ -188,5 +211,8 @@ static inline void swap_cgroup_swapoff(int type)
188 return; 211 return;
189} 212}
190 213
191#endif 214#endif /* CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
192#endif 215
216#endif /* !__GENERATING_BOUNDS_H */
217
218#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 9c66e994540f..c11950652646 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -298,7 +298,6 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
298 298
299extern void __lock_page(struct page *page); 299extern void __lock_page(struct page *page);
300extern int __lock_page_killable(struct page *page); 300extern int __lock_page_killable(struct page *page);
301extern void __lock_page_nosync(struct page *page);
302extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm, 301extern int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
303 unsigned int flags); 302 unsigned int flags);
304extern void unlock_page(struct page *page); 303extern void unlock_page(struct page *page);
@@ -342,17 +341,6 @@ static inline int lock_page_killable(struct page *page)
342} 341}
343 342
344/* 343/*
345 * lock_page_nosync should only be used if we can't pin the page's inode.
346 * Doesn't play quite so well with block device plugging.
347 */
348static inline void lock_page_nosync(struct page *page)
349{
350 might_sleep();
351 if (!trylock_page(page))
352 __lock_page_nosync(page);
353}
354
355/*
356 * lock_page_or_retry - Lock the page, unless this would block and the 344 * lock_page_or_retry - Lock the page, unless this would block and the
357 * caller indicated that it can handle a retry. 345 * caller indicated that it can handle a retry.
358 */ 346 */
@@ -455,8 +443,9 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
455 pgoff_t index, gfp_t gfp_mask); 443 pgoff_t index, gfp_t gfp_mask);
456int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 444int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
457 pgoff_t index, gfp_t gfp_mask); 445 pgoff_t index, gfp_t gfp_mask);
458extern void remove_from_page_cache(struct page *page); 446extern void delete_from_page_cache(struct page *page);
459extern void __remove_from_page_cache(struct page *page); 447extern void __delete_from_page_cache(struct page *page);
448int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
460 449
461/* 450/*
462 * Like add_to_page_cache_locked, but used to add newly allocated pages: 451 * Like add_to_page_cache_locked, but used to add newly allocated pages:
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index ce6810512c66..67cb3ae38016 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -26,6 +26,7 @@
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev); 26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30extern void pcie_clear_aspm(void); 31extern void pcie_clear_aspm(void);
31extern void pcie_no_aspm(void); 32extern void pcie_no_aspm(void);
@@ -39,6 +40,9 @@ static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev)
39static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) 40static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
40{ 41{
41} 42}
43static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
44{
45}
42static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 46static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
43{ 47{
44} 48}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 16c9f2e61977..96f70d7e058d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1002,12 +1002,11 @@ extern bool pcie_ports_auto;
1002#endif 1002#endif
1003 1003
1004#ifndef CONFIG_PCIEASPM 1004#ifndef CONFIG_PCIEASPM
1005static inline int pcie_aspm_enabled(void) 1005static inline int pcie_aspm_enabled(void) { return 0; }
1006{ 1006static inline bool pcie_aspm_support_enabled(void) { return false; }
1007 return 0;
1008}
1009#else 1007#else
1010extern int pcie_aspm_enabled(void); 1008extern int pcie_aspm_enabled(void);
1009extern bool pcie_aspm_support_enabled(void);
1011#endif 1010#endif
1012 1011
1013#ifdef CONFIG_PCIEAER 1012#ifdef CONFIG_PCIEAER
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index bda221dfaf0a..11fd38151cc9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2737,6 +2737,7 @@
2737#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2737#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2738#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2738#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2739#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2739#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2740#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2740#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2741#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2741#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2742#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
2742#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca 2743#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f495c0147240..311b4dc785a1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -938,9 +938,7 @@ struct perf_cpu_context {
938 struct list_head rotation_list; 938 struct list_head rotation_list;
939 int jiffies_interval; 939 int jiffies_interval;
940 struct pmu *active_pmu; 940 struct pmu *active_pmu;
941#ifdef CONFIG_CGROUP_PERF
942 struct perf_cgroup *cgrp; 941 struct perf_cgroup *cgrp;
943#endif
944}; 942};
945 943
946struct perf_output_handle { 944struct perf_output_handle {
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 49f1c2f66e95..efceda0a51b1 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -141,6 +141,17 @@ static inline struct pid_namespace *ns_of_pid(struct pid *pid)
141} 141}
142 142
143/* 143/*
144 * is_child_reaper returns true if the pid is the init process
145 * of the current namespace. As this one could be checked before
146 * pid_ns->child_reaper is assigned in copy_process, we check
147 * with the pid number.
148 */
149static inline bool is_child_reaper(struct pid *pid)
150{
151 return pid->numbers[pid->level].nr == 1;
152}
153
154/*
144 * the helpers to get the pid's id seen from different namespaces 155 * the helpers to get the pid's id seen from different namespaces
145 * 156 *
146 * pid_nr() : global id, i.e. the id seen from the init namespace; 157 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 6618216bb973..512e09177e57 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -529,13 +529,19 @@ struct dev_power_domain {
529 */ 529 */
530 530
531#ifdef CONFIG_PM_SLEEP 531#ifdef CONFIG_PM_SLEEP
532extern void device_pm_lock(void); 532#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
533extern int sysdev_suspend(pm_message_t state);
533extern int sysdev_resume(void); 534extern int sysdev_resume(void);
535#else
536static inline int sysdev_suspend(pm_message_t state) { return 0; }
537static inline int sysdev_resume(void) { return 0; }
538#endif
539
540extern void device_pm_lock(void);
534extern void dpm_resume_noirq(pm_message_t state); 541extern void dpm_resume_noirq(pm_message_t state);
535extern void dpm_resume_end(pm_message_t state); 542extern void dpm_resume_end(pm_message_t state);
536 543
537extern void device_pm_unlock(void); 544extern void device_pm_unlock(void);
538extern int sysdev_suspend(pm_message_t state);
539extern int dpm_suspend_noirq(pm_message_t state); 545extern int dpm_suspend_noirq(pm_message_t state);
540extern int dpm_suspend_start(pm_message_t state); 546extern int dpm_suspend_start(pm_message_t state);
541 547
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h
new file mode 100644
index 000000000000..b0843b68af92
--- /dev/null
+++ b/include/linux/power/bq20z75.h
@@ -0,0 +1,39 @@
1/*
2 * Gas Gauge driver for TI's BQ20Z75
3 *
4 * Copyright (c) 2010, NVIDIA Corporation.
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, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __LINUX_POWER_BQ20Z75_H_
22#define __LINUX_POWER_BQ20Z75_H_
23
24#include <linux/power_supply.h>
25#include <linux/types.h>
26
27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices
29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 */
33struct bq20z75_platform_data {
34 int battery_detect;
35 int battery_detect_present;
36 int i2c_retry_count;
37};
38
39#endif
diff --git a/include/linux/power/bq27x00_battery.h b/include/linux/power/bq27x00_battery.h
new file mode 100644
index 000000000000..a857f719bf40
--- /dev/null
+++ b/include/linux/power/bq27x00_battery.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_BQ27X00_BATTERY_H__
2#define __LINUX_BQ27X00_BATTERY_H__
3
4/**
5 * struct bq27000_plaform_data - Platform data for bq27000 devices
6 * @name: Name of the battery. If NULL the driver will fallback to "bq27000".
7 * @read: HDQ read callback.
8 * This function should provide access to the HDQ bus the battery is
9 * connected to.
10 * The first parameter is a pointer to the battery device, the second the
11 * register to be read. The return value should either be the content of
12 * the passed register or an error value.
13 */
14struct bq27000_platform_data {
15 const char *name;
16 int (*read)(struct device *dev, unsigned int);
17};
18
19#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7d7325685c42..204c18dfdc9e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -173,6 +173,8 @@ struct power_supply {
173 char *full_trig_name; 173 char *full_trig_name;
174 struct led_trigger *online_trig; 174 struct led_trigger *online_trig;
175 char *online_trig_name; 175 char *online_trig_name;
176 struct led_trigger *charging_blink_full_solid_trig;
177 char *charging_blink_full_solid_trig_name;
176#endif 178#endif
177}; 179};
178 180
@@ -213,4 +215,49 @@ extern void power_supply_unregister(struct power_supply *psy);
213/* For APM emulation, think legacy userspace. */ 215/* For APM emulation, think legacy userspace. */
214extern struct class *power_supply_class; 216extern struct class *power_supply_class;
215 217
218static inline bool power_supply_is_amp_property(enum power_supply_property psp)
219{
220 switch (psp) {
221 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
222 case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
223 case POWER_SUPPLY_PROP_CHARGE_FULL:
224 case POWER_SUPPLY_PROP_CHARGE_EMPTY:
225 case POWER_SUPPLY_PROP_CHARGE_NOW:
226 case POWER_SUPPLY_PROP_CHARGE_AVG:
227 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
228 case POWER_SUPPLY_PROP_CURRENT_MAX:
229 case POWER_SUPPLY_PROP_CURRENT_NOW:
230 case POWER_SUPPLY_PROP_CURRENT_AVG:
231 return 1;
232 default:
233 break;
234 }
235
236 return 0;
237}
238
239static inline bool power_supply_is_watt_property(enum power_supply_property psp)
240{
241 switch (psp) {
242 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
243 case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
244 case POWER_SUPPLY_PROP_ENERGY_FULL:
245 case POWER_SUPPLY_PROP_ENERGY_EMPTY:
246 case POWER_SUPPLY_PROP_ENERGY_NOW:
247 case POWER_SUPPLY_PROP_ENERGY_AVG:
248 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
249 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
250 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
251 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
252 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
253 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
254 case POWER_SUPPLY_PROP_POWER_NOW:
255 return 1;
256 default:
257 break;
258 }
259
260 return 0;
261}
262
216#endif /* __LINUX_POWER_SUPPLY_H__ */ 263#endif /* __LINUX_POWER_SUPPLY_H__ */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 379eaed72d4b..838c1149251a 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 unsigned short namelen; 53 unsigned int namelen;
54 const char *name; 54 const char *name;
55 mode_t mode; 55 mode_t mode;
56 nlink_t nlink; 56 nlink_t nlink;
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index e031e1a486d9..5e3e25a3c9c3 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -4,6 +4,8 @@
4#ifndef __LINUX_PWM_BACKLIGHT_H 4#ifndef __LINUX_PWM_BACKLIGHT_H
5#define __LINUX_PWM_BACKLIGHT_H 5#define __LINUX_PWM_BACKLIGHT_H
6 6
7#include <linux/backlight.h>
8
7struct platform_pwm_backlight_data { 9struct platform_pwm_backlight_data {
8 int pwm_id; 10 int pwm_id;
9 unsigned int max_brightness; 11 unsigned int max_brightness;
@@ -13,6 +15,7 @@ struct platform_pwm_backlight_data {
13 int (*init)(struct device *dev); 15 int (*init)(struct device *dev);
14 int (*notify)(struct device *dev, int brightness); 16 int (*notify)(struct device *dev, int brightness);
15 void (*exit)(struct device *dev); 17 void (*exit)(struct device *dev);
18 int (*check_fb)(struct device *dev, struct fb_info *info);
16}; 19};
17 20
18#endif 21#endif
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index eb354f6f26b3..26f9e3612e0f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -277,7 +277,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
277 /* 277 /*
278 * Mark inode fully dirty. Since we are allocating blocks, inode 278 * Mark inode fully dirty. Since we are allocating blocks, inode
279 * would become fully dirty soon anyway and it reportedly 279 * would become fully dirty soon anyway and it reportedly
280 * reduces inode_lock contention. 280 * reduces lock contention.
281 */ 281 */
282 mark_inode_dirty(inode); 282 mark_inode_dirty(inode);
283 } 283 }
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 6a210f1511fc..76579f964a29 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -3,8 +3,8 @@
3 * 3 *
4 * License Terms: GNU General Public License v2 4 * License Terms: GNU General Public License v2
5 * 5 *
6 * Author: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson 6 * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
7 * 7 * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
8 */ 8 */
9 9
10#ifndef __LINUX_MFD_AB8500_REGULATOR_H 10#ifndef __LINUX_MFD_AB8500_REGULATOR_H
@@ -17,6 +17,7 @@ enum ab8500_regulator_id {
17 AB8500_LDO_AUX3, 17 AB8500_LDO_AUX3,
18 AB8500_LDO_INTCORE, 18 AB8500_LDO_INTCORE,
19 AB8500_LDO_TVOUT, 19 AB8500_LDO_TVOUT,
20 AB8500_LDO_USB,
20 AB8500_LDO_AUDIO, 21 AB8500_LDO_AUDIO,
21 AB8500_LDO_ANAMIC1, 22 AB8500_LDO_ANAMIC1,
22 AB8500_LDO_ANAMIC2, 23 AB8500_LDO_ANAMIC2,
@@ -24,4 +25,50 @@ enum ab8500_regulator_id {
24 AB8500_LDO_ANA, 25 AB8500_LDO_ANA,
25 AB8500_NUM_REGULATORS, 26 AB8500_NUM_REGULATORS,
26}; 27};
28
29/* AB8500 register initialization */
30struct ab8500_regulator_reg_init {
31 int id;
32 u8 value;
33};
34
35#define INIT_REGULATOR_REGISTER(_id, _value) \
36 { \
37 .id = _id, \
38 .value = _value, \
39 }
40
41/* AB8500 registers */
42enum ab8500_regulator_reg {
43 AB8500_REGUREQUESTCTRL2,
44 AB8500_REGUREQUESTCTRL3,
45 AB8500_REGUREQUESTCTRL4,
46 AB8500_REGUSYSCLKREQ1HPVALID1,
47 AB8500_REGUSYSCLKREQ1HPVALID2,
48 AB8500_REGUHWHPREQ1VALID1,
49 AB8500_REGUHWHPREQ1VALID2,
50 AB8500_REGUHWHPREQ2VALID1,
51 AB8500_REGUHWHPREQ2VALID2,
52 AB8500_REGUSWHPREQVALID1,
53 AB8500_REGUSWHPREQVALID2,
54 AB8500_REGUSYSCLKREQVALID1,
55 AB8500_REGUSYSCLKREQVALID2,
56 AB8500_REGUMISC1,
57 AB8500_VAUDIOSUPPLY,
58 AB8500_REGUCTRL1VAMIC,
59 AB8500_VPLLVANAREGU,
60 AB8500_VREFDDR,
61 AB8500_EXTSUPPLYREGU,
62 AB8500_VAUX12REGU,
63 AB8500_VRF1VAUX3REGU,
64 AB8500_VAUX1SEL,
65 AB8500_VAUX2SEL,
66 AB8500_VRF1VAUX3SEL,
67 AB8500_REGUCTRL2SPARE,
68 AB8500_REGUCTRLDISCH,
69 AB8500_REGUCTRLDISCH2,
70 AB8500_VSMPS1SEL1,
71 AB8500_NUM_REGULATOR_REGISTERS,
72};
73
27#endif 74#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 7954f6bd7edb..9e87c1cb7270 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -153,6 +153,8 @@ int regulator_list_voltage(struct regulator *regulator, unsigned selector);
153int regulator_is_supported_voltage(struct regulator *regulator, 153int regulator_is_supported_voltage(struct regulator *regulator,
154 int min_uV, int max_uV); 154 int min_uV, int max_uV);
155int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 155int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
156int regulator_set_voltage_time(struct regulator *regulator,
157 int old_uV, int new_uV);
156int regulator_get_voltage(struct regulator *regulator); 158int regulator_get_voltage(struct regulator *regulator);
157int regulator_sync_voltage(struct regulator *regulator); 159int regulator_sync_voltage(struct regulator *regulator);
158int regulator_set_current_limit(struct regulator *regulator, 160int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index b8ed16a33c47..6c433b89c80d 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -63,7 +63,11 @@ enum regulator_status {
63 * when running with the specified parameters. 63 * when running with the specified parameters.
64 * 64 *
65 * @enable_time: Time taken for the regulator voltage output voltage to 65 * @enable_time: Time taken for the regulator voltage output voltage to
66 * stabalise after being enabled, in microseconds. 66 * stabilise after being enabled, in microseconds.
67 * @set_voltage_time_sel: Time taken for the regulator voltage output voltage
68 * to stabilise after being set to a new value, in microseconds.
69 * The function provides the from and to voltage selector, the
70 * function should return the worst case.
67 * 71 *
68 * @set_suspend_voltage: Set the voltage for the regulator when the system 72 * @set_suspend_voltage: Set the voltage for the regulator when the system
69 * is suspended. 73 * is suspended.
@@ -103,8 +107,11 @@ struct regulator_ops {
103 int (*set_mode) (struct regulator_dev *, unsigned int mode); 107 int (*set_mode) (struct regulator_dev *, unsigned int mode);
104 unsigned int (*get_mode) (struct regulator_dev *); 108 unsigned int (*get_mode) (struct regulator_dev *);
105 109
106 /* Time taken to enable the regulator */ 110 /* Time taken to enable or set voltage on the regulator */
107 int (*enable_time) (struct regulator_dev *); 111 int (*enable_time) (struct regulator_dev *);
112 int (*set_voltage_time_sel) (struct regulator_dev *,
113 unsigned int old_selector,
114 unsigned int new_selector);
108 115
109 /* report regulator status ... most other accessors report 116 /* report regulator status ... most other accessors report
110 * control inputs, this reports results of combining inputs 117 * control inputs, this reports results of combining inputs
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 761c745b9c24..c4c4fc45f856 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -186,6 +186,7 @@ struct regulator_init_data {
186}; 186};
187 187
188int regulator_suspend_prepare(suspend_state_t state); 188int regulator_suspend_prepare(suspend_state_t state);
189int regulator_suspend_finish(void);
189 190
190#ifdef CONFIG_REGULATOR 191#ifdef CONFIG_REGULATOR
191void regulator_has_full_constraints(void); 192void regulator_has_full_constraints(void);
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index c21072adbfad..0a3842aacba9 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1124,15 +1124,18 @@ struct reiserfs_de_head {
1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) 1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) 1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
1126 1126
1127# define set_bit_unaligned(nr, addr) ext2_set_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1127# define set_bit_unaligned(nr, addr) \
1128# define clear_bit_unaligned(nr, addr) ext2_clear_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1128 __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1129# define test_bit_unaligned(nr, addr) ext2_test_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1129# define clear_bit_unaligned(nr, addr) \
1130 __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1131# define test_bit_unaligned(nr, addr) \
1132 test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1130 1133
1131#else 1134#else
1132 1135
1133# define set_bit_unaligned(nr, addr) ext2_set_bit(nr, addr) 1136# define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr)
1134# define clear_bit_unaligned(nr, addr) ext2_clear_bit(nr, addr) 1137# define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr)
1135# define test_bit_unaligned(nr, addr) ext2_test_bit(nr, addr) 1138# define test_bit_unaligned(nr, addr) test_bit_le(nr, addr)
1136 1139
1137#endif 1140#endif
1138 1141
@@ -2329,14 +2332,10 @@ __u32 keyed_hash(const signed char *msg, int len);
2329__u32 yura_hash(const signed char *msg, int len); 2332__u32 yura_hash(const signed char *msg, int len);
2330__u32 r5_hash(const signed char *msg, int len); 2333__u32 r5_hash(const signed char *msg, int len);
2331 2334
2332/* the ext2 bit routines adjust for big or little endian as 2335#define reiserfs_test_and_set_le_bit __test_and_set_bit_le
2333** appropriate for the arch, so in our laziness we use them rather 2336#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le
2334** than using the bit routines they call more directly. These 2337#define reiserfs_test_le_bit test_bit_le
2335** routines must be used when changing on disk bitmaps. */ 2338#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le
2336#define reiserfs_test_and_set_le_bit ext2_set_bit
2337#define reiserfs_test_and_clear_le_bit ext2_clear_bit
2338#define reiserfs_test_le_bit ext2_test_bit
2339#define reiserfs_find_next_zero_le_bit ext2_find_next_zero_bit
2340 2339
2341/* sometimes reiserfs_truncate may require to allocate few new blocks 2340/* sometimes reiserfs_truncate may require to allocate few new blocks
2342 to perform indirect2direct conversion. People probably used to 2341 to perform indirect2direct conversion. People probably used to
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index a5930cb66145..c9d625ca659e 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -129,20 +129,22 @@ int __must_check res_counter_charge(struct res_counter *counter,
129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
130void res_counter_uncharge(struct res_counter *counter, unsigned long val); 130void res_counter_uncharge(struct res_counter *counter, unsigned long val);
131 131
132static inline bool res_counter_limit_check_locked(struct res_counter *cnt) 132/**
133{ 133 * res_counter_margin - calculate chargeable space of a counter
134 if (cnt->usage < cnt->limit) 134 * @cnt: the counter
135 return true; 135 *
136 136 * Returns the difference between the hard limit and the current usage
137 return false; 137 * of resource counter @cnt.
138} 138 */
139 139static inline unsigned long long res_counter_margin(struct res_counter *cnt)
140static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
141{ 140{
142 if (cnt->usage < cnt->soft_limit) 141 unsigned long long margin;
143 return true; 142 unsigned long flags;
144 143
145 return false; 144 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage;
146 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin;
146} 148}
147 149
148/** 150/**
@@ -167,52 +169,6 @@ res_counter_soft_limit_excess(struct res_counter *cnt)
167 return excess; 169 return excess;
168} 170}
169 171
170/*
171 * Helper function to detect if the cgroup is within it's limit or
172 * not. It's currently called from cgroup_rss_prepare()
173 */
174static inline bool res_counter_check_under_limit(struct res_counter *cnt)
175{
176 bool ret;
177 unsigned long flags;
178
179 spin_lock_irqsave(&cnt->lock, flags);
180 ret = res_counter_limit_check_locked(cnt);
181 spin_unlock_irqrestore(&cnt->lock, flags);
182 return ret;
183}
184
185/**
186 * res_counter_check_margin - check if the counter allows charging
187 * @cnt: the resource counter to check
188 * @bytes: the number of bytes to check the remaining space against
189 *
190 * Returns a boolean value on whether the counter can be charged
191 * @bytes or whether this would exceed the limit.
192 */
193static inline bool res_counter_check_margin(struct res_counter *cnt,
194 unsigned long bytes)
195{
196 bool ret;
197 unsigned long flags;
198
199 spin_lock_irqsave(&cnt->lock, flags);
200 ret = cnt->limit - cnt->usage >= bytes;
201 spin_unlock_irqrestore(&cnt->lock, flags);
202 return ret;
203}
204
205static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
206{
207 bool ret;
208 unsigned long flags;
209
210 spin_lock_irqsave(&cnt->lock, flags);
211 ret = res_counter_soft_limit_check_locked(cnt);
212 spin_unlock_irqrestore(&cnt->lock, flags);
213 return ret;
214}
215
216static inline void res_counter_reset_max(struct res_counter *cnt) 172static inline void res_counter_reset_max(struct res_counter *cnt)
217{ 173{
218 unsigned long flags; 174 unsigned long flags;
diff --git a/include/linux/rio.h b/include/linux/rio.h
index ff681ebba585..4e37a7cfa726 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -24,6 +24,7 @@
24#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
25#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
26 26
27#define RIO_MAX_MPORTS 8
27#define RIO_MAX_MPORT_RESOURCES 16 28#define RIO_MAX_MPORT_RESOURCES 16
28#define RIO_MAX_DEV_RESOURCES 16 29#define RIO_MAX_DEV_RESOURCES 16
29 30
@@ -241,7 +242,7 @@ struct rio_mport {
241 struct rio_msg inb_msg[RIO_MAX_MBOX]; 242 struct rio_msg inb_msg[RIO_MAX_MBOX];
242 struct rio_msg outb_msg[RIO_MAX_MBOX]; 243 struct rio_msg outb_msg[RIO_MAX_MBOX];
243 int host_deviceid; /* Host device ID */ 244 int host_deviceid; /* Host device ID */
244 struct rio_ops *ops; /* maintenance transaction functions */ 245 struct rio_ops *ops; /* low-level architecture-dependent routines */
245 unsigned char id; /* port ID, unique among all ports */ 246 unsigned char id; /* port ID, unique among all ports */
246 unsigned char index; /* port index, unique among all port 247 unsigned char index; /* port index, unique among all port
247 interfaces of the same type */ 248 interfaces of the same type */
@@ -285,6 +286,13 @@ struct rio_net {
285 * @cwrite: Callback to perform network write of config space. 286 * @cwrite: Callback to perform network write of config space.
286 * @dsend: Callback to send a doorbell message. 287 * @dsend: Callback to send a doorbell message.
287 * @pwenable: Callback to enable/disable port-write message handling. 288 * @pwenable: Callback to enable/disable port-write message handling.
289 * @open_outb_mbox: Callback to initialize outbound mailbox.
290 * @close_outb_mbox: Callback to shut down outbound mailbox.
291 * @open_inb_mbox: Callback to initialize inbound mailbox.
292 * @close_inb_mbox: Callback to shut down inbound mailbox.
293 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
294 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
295 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
288 */ 296 */
289struct rio_ops { 297struct rio_ops {
290 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 298 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -297,6 +305,16 @@ struct rio_ops {
297 u8 hopcount, u32 offset, int len, u32 data); 305 u8 hopcount, u32 offset, int len, u32 data);
298 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 306 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
299 int (*pwenable) (struct rio_mport *mport, int enable); 307 int (*pwenable) (struct rio_mport *mport, int enable);
308 int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
309 int mbox, int entries);
310 void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
311 int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
312 int mbox, int entries);
313 void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
314 int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
315 int mbox, void *buffer, size_t len);
316 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
317 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
300}; 318};
301 319
302#define RIO_RESOURCE_MEM 0x00000100 320#define RIO_RESOURCE_MEM 0x00000100
@@ -378,12 +396,7 @@ union rio_pw_msg {
378}; 396};
379 397
380/* Architecture and hardware-specific functions */ 398/* Architecture and hardware-specific functions */
381extern int rio_init_mports(void);
382extern void rio_register_mport(struct rio_mport *); 399extern void rio_register_mport(struct rio_mport *);
383extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int,
384 void *, size_t);
385extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *);
386extern void *rio_hw_get_inb_message(struct rio_mport *, int);
387extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 400extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
388extern void rio_close_inb_mbox(struct rio_mport *, int); 401extern void rio_close_inb_mbox(struct rio_mport *, int);
389extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 402extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index e09e565c4bce..229b3ca23134 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -317,7 +317,8 @@ static inline int rio_add_outb_message(struct rio_mport *mport,
317 struct rio_dev *rdev, int mbox, 317 struct rio_dev *rdev, int mbox,
318 void *buffer, size_t len) 318 void *buffer, size_t len)
319{ 319{
320 return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len); 320 return mport->ops->add_outb_message(mport, rdev, mbox,
321 buffer, len);
321} 322}
322 323
323extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int, 324extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int,
@@ -336,7 +337,7 @@ extern int rio_release_inb_mbox(struct rio_mport *, int);
336static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox, 337static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
337 void *buffer) 338 void *buffer)
338{ 339{
339 return rio_hw_add_inb_buffer(mport, mbox, buffer); 340 return mport->ops->add_inb_buffer(mport, mbox, buffer);
340} 341}
341 342
342/** 343/**
@@ -348,7 +349,7 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
348 */ 349 */
349static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox) 350static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox)
350{ 351{
351 return rio_hw_get_inb_message(mport, mbox); 352 return mport->ops->get_inb_message(mport, mbox);
352} 353}
353 354
354/* Doorbell management */ 355/* Doorbell management */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index e9fd04ca1e51..830e65dc01ee 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -27,18 +27,15 @@
27struct anon_vma { 27struct anon_vma {
28 struct anon_vma *root; /* Root of this anon_vma tree */ 28 struct anon_vma *root; /* Root of this anon_vma tree */
29 spinlock_t lock; /* Serialize access to vma list */ 29 spinlock_t lock; /* Serialize access to vma list */
30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
31
32 /* 30 /*
33 * The external_refcount is taken by either KSM or page migration 31 * The refcount is taken on an anon_vma when there is no
34 * to take a reference to an anon_vma when there is no
35 * guarantee that the vma of page tables will exist for 32 * guarantee that the vma of page tables will exist for
36 * the duration of the operation. A caller that takes 33 * the duration of the operation. A caller that takes
37 * the reference is responsible for clearing up the 34 * the reference is responsible for clearing up the
38 * anon_vma if they are the last user on release 35 * anon_vma if they are the last user on release
39 */ 36 */
40 atomic_t external_refcount; 37 atomic_t refcount;
41#endif 38
42 /* 39 /*
43 * NOTE: the LSB of the head.next is set by 40 * NOTE: the LSB of the head.next is set by
44 * mm_take_all_locks() _after_ taking the above lock. So the 41 * mm_take_all_locks() _after_ taking the above lock. So the
@@ -71,42 +68,19 @@ struct anon_vma_chain {
71}; 68};
72 69
73#ifdef CONFIG_MMU 70#ifdef CONFIG_MMU
74#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
75static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
76{
77 atomic_set(&anon_vma->external_refcount, 0);
78}
79
80static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
81{
82 return atomic_read(&anon_vma->external_refcount);
83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma) 71static inline void get_anon_vma(struct anon_vma *anon_vma)
86{ 72{
87 atomic_inc(&anon_vma->external_refcount); 73 atomic_inc(&anon_vma->refcount);
88} 74}
89 75
90void drop_anon_vma(struct anon_vma *); 76void __put_anon_vma(struct anon_vma *anon_vma);
91#else
92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
93{
94}
95 77
96static inline int anonvma_external_refcount(struct anon_vma *anon_vma) 78static inline void put_anon_vma(struct anon_vma *anon_vma)
97{
98 return 0;
99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{ 79{
80 if (atomic_dec_and_test(&anon_vma->refcount))
81 __put_anon_vma(anon_vma);
103} 82}
104 83
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
108#endif /* CONFIG_KSM */
109
110static inline struct anon_vma *page_anon_vma(struct page *page) 84static inline struct anon_vma *page_anon_vma(struct page *page)
111{ 85{
112 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != 86 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
@@ -148,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *);
148int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
149int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150void __anon_vma_link(struct vm_area_struct *); 124void __anon_vma_link(struct vm_area_struct *);
151void anon_vma_free(struct anon_vma *);
152 125
153static inline void anon_vma_merge(struct vm_area_struct *vma, 126static inline void anon_vma_merge(struct vm_area_struct *vma,
154 struct vm_area_struct *next) 127 struct vm_area_struct *next)
@@ -157,6 +130,8 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
157 unlink_anon_vmas(next); 130 unlink_anon_vmas(next);
158} 131}
159 132
133struct anon_vma *page_get_anon_vma(struct page *page);
134
160/* 135/*
161 * rmap interfaces called when adding or removing pte of page 136 * rmap interfaces called when adding or removing pte of page
162 */ 137 */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c15936fe998b..83bd2e2982fc 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -99,6 +99,7 @@ struct robust_list_head;
99struct bio_list; 99struct bio_list;
100struct fs_struct; 100struct fs_struct;
101struct perf_event_context; 101struct perf_event_context;
102struct blk_plug;
102 103
103/* 104/*
104 * List of flags we want to share for kernel threads, 105 * List of flags we want to share for kernel threads,
@@ -516,7 +517,7 @@ struct thread_group_cputimer {
516struct autogroup; 517struct autogroup;
517 518
518/* 519/*
519 * NOTE! "signal_struct" does not have it's own 520 * NOTE! "signal_struct" does not have its own
520 * locking, because a shared signal_struct always 521 * locking, because a shared signal_struct always
521 * implies a shared sighand_struct, so locking 522 * implies a shared sighand_struct, so locking
522 * sighand_struct is always a proper superset of 523 * sighand_struct is always a proper superset of
@@ -1428,6 +1429,11 @@ struct task_struct {
1428/* stacked block device info */ 1429/* stacked block device info */
1429 struct bio_list *bio_list; 1430 struct bio_list *bio_list;
1430 1431
1432#ifdef CONFIG_BLOCK
1433/* stack plugging */
1434 struct blk_plug *plug;
1435#endif
1436
1431/* VM state */ 1437/* VM state */
1432 struct reclaim_state *reclaim_state; 1438 struct reclaim_state *reclaim_state;
1433 1439
@@ -1471,6 +1477,7 @@ struct task_struct {
1471#ifdef CONFIG_NUMA 1477#ifdef CONFIG_NUMA
1472 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1478 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1473 short il_next; 1479 short il_next;
1480 short pref_node_fork;
1474#endif 1481#endif
1475 atomic_t fs_excl; /* holding fs exclusive resources */ 1482 atomic_t fs_excl; /* holding fs exclusive resources */
1476 struct rcu_head rcu; 1483 struct rcu_head rcu;
@@ -1523,8 +1530,8 @@ struct task_struct {
1523 struct memcg_batch_info { 1530 struct memcg_batch_info {
1524 int do_batch; /* incremented when batch uncharge started */ 1531 int do_batch; /* incremented when batch uncharge started */
1525 struct mem_cgroup *memcg; /* target memcg of uncharge */ 1532 struct mem_cgroup *memcg; /* target memcg of uncharge */
1526 unsigned long bytes; /* uncharged usage */ 1533 unsigned long nr_pages; /* uncharged usage */
1527 unsigned long memsw_bytes; /* uncharged mem+swap usage */ 1534 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1528 } memcg_batch; 1535 } memcg_batch;
1529#endif 1536#endif
1530}; 1537};
diff --git a/include/linux/security.h b/include/linux/security.h
index 56cac520d014..ca02f1716736 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -47,13 +47,14 @@
47 47
48struct ctl_table; 48struct ctl_table;
49struct audit_krule; 49struct audit_krule;
50struct user_namespace;
50 51
51/* 52/*
52 * These functions are in security/capability.c and are used 53 * These functions are in security/capability.c and are used
53 * as the default capabilities functions 54 * as the default capabilities functions
54 */ 55 */
55extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 56extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
56 int cap, int audit); 57 struct user_namespace *ns, int cap, int audit);
57extern int cap_settime(const struct timespec *ts, const struct timezone *tz); 58extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
58extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 59extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
59extern int cap_ptrace_traceme(struct task_struct *parent); 60extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -1262,6 +1263,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1262 * credentials. 1263 * credentials.
1263 * @tsk contains the task_struct for the process. 1264 * @tsk contains the task_struct for the process.
1264 * @cred contains the credentials to use. 1265 * @cred contains the credentials to use.
1266 * @ns contains the user namespace we want the capability in
1265 * @cap contains the capability <include/linux/capability.h>. 1267 * @cap contains the capability <include/linux/capability.h>.
1266 * @audit: Whether to write an audit message or not 1268 * @audit: Whether to write an audit message or not
1267 * Return 0 if the capability is granted for @tsk. 1269 * Return 0 if the capability is granted for @tsk.
@@ -1384,7 +1386,7 @@ struct security_operations {
1384 const kernel_cap_t *inheritable, 1386 const kernel_cap_t *inheritable,
1385 const kernel_cap_t *permitted); 1387 const kernel_cap_t *permitted);
1386 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1388 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1387 int cap, int audit); 1389 struct user_namespace *ns, int cap, int audit);
1388 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1390 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1389 int (*quota_on) (struct dentry *dentry); 1391 int (*quota_on) (struct dentry *dentry);
1390 int (*syslog) (int type); 1392 int (*syslog) (int type);
@@ -1665,9 +1667,12 @@ int security_capset(struct cred *new, const struct cred *old,
1665 const kernel_cap_t *effective, 1667 const kernel_cap_t *effective,
1666 const kernel_cap_t *inheritable, 1668 const kernel_cap_t *inheritable,
1667 const kernel_cap_t *permitted); 1669 const kernel_cap_t *permitted);
1668int security_capable(const struct cred *cred, int cap); 1670int security_capable(struct user_namespace *ns, const struct cred *cred,
1669int security_real_capable(struct task_struct *tsk, int cap); 1671 int cap);
1670int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1672int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1673 int cap);
1674int security_real_capable_noaudit(struct task_struct *tsk,
1675 struct user_namespace *ns, int cap);
1671int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1676int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1672int security_quota_on(struct dentry *dentry); 1677int security_quota_on(struct dentry *dentry);
1673int security_syslog(int type); 1678int security_syslog(int type);
@@ -1860,28 +1865,29 @@ static inline int security_capset(struct cred *new,
1860 return cap_capset(new, old, effective, inheritable, permitted); 1865 return cap_capset(new, old, effective, inheritable, permitted);
1861} 1866}
1862 1867
1863static inline int security_capable(const struct cred *cred, int cap) 1868static inline int security_capable(struct user_namespace *ns,
1869 const struct cred *cred, int cap)
1864{ 1870{
1865 return cap_capable(current, cred, cap, SECURITY_CAP_AUDIT); 1871 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1866} 1872}
1867 1873
1868static inline int security_real_capable(struct task_struct *tsk, int cap) 1874static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1869{ 1875{
1870 int ret; 1876 int ret;
1871 1877
1872 rcu_read_lock(); 1878 rcu_read_lock();
1873 ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT); 1879 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1874 rcu_read_unlock(); 1880 rcu_read_unlock();
1875 return ret; 1881 return ret;
1876} 1882}
1877 1883
1878static inline 1884static inline
1879int security_real_capable_noaudit(struct task_struct *tsk, int cap) 1885int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap)
1880{ 1886{
1881 int ret; 1887 int ret;
1882 1888
1883 rcu_read_lock(); 1889 rcu_read_lock();
1884 ret = cap_capable(tsk, __task_cred(tsk), cap, 1890 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1885 SECURITY_CAP_NOAUDIT); 1891 SECURITY_CAP_NOAUDIT);
1886 rcu_read_unlock(); 1892 rcu_read_unlock();
1887 return ret; 1893 return ret;
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
new file mode 100644
index 000000000000..e2accb3164d8
--- /dev/null
+++ b/include/linux/sigma.h
@@ -0,0 +1,60 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 u32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 u16 len;
44 u16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | sa->len;
51}
52
53static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
54{
55 return sizeof(*sa) + payload_len + (payload_len % 2);
56}
57
58extern int process_sigma_firmware(struct i2c_client *client, const char *name);
59
60#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 24cfa626931e..d9e52fa2416d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -122,8 +122,14 @@ struct sk_buff_head {
122 122
123struct sk_buff; 123struct sk_buff;
124 124
125/* To allow 64K frame to be packed as single skb without frag_list */ 125/* To allow 64K frame to be packed as single skb without frag_list. Since
126 * GRO uses frags we allocate at least 16 regardless of page size.
127 */
128#if (65536/PAGE_SIZE + 2) < 16
129#define MAX_SKB_FRAGS 16UL
130#else
126#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 131#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
132#endif
127 133
128typedef struct skb_frag_struct skb_frag_t; 134typedef struct skb_frag_struct skb_frag_t;
129 135
diff --git a/include/linux/slab.h b/include/linux/slab.h
index fa9086647eb7..ad4dd1c8d30a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -105,7 +105,6 @@ void kmem_cache_destroy(struct kmem_cache *);
105int kmem_cache_shrink(struct kmem_cache *); 105int kmem_cache_shrink(struct kmem_cache *);
106void kmem_cache_free(struct kmem_cache *, void *); 106void kmem_cache_free(struct kmem_cache *, void *);
107unsigned int kmem_cache_size(struct kmem_cache *); 107unsigned int kmem_cache_size(struct kmem_cache *);
108const char *kmem_cache_name(struct kmem_cache *);
109 108
110/* 109/*
111 * Please use this macro to create slab caches. Simply specify the 110 * Please use this macro to create slab caches. Simply specify the
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 8b6e8ae5d5ca..45ca123e8002 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -32,10 +32,14 @@ enum stat_item {
32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ 32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ 33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
34 ORDER_FALLBACK, /* Number of times fallback was necessary */ 34 ORDER_FALLBACK, /* Number of times fallback was necessary */
35 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
35 NR_SLUB_STAT_ITEMS }; 36 NR_SLUB_STAT_ITEMS };
36 37
37struct kmem_cache_cpu { 38struct kmem_cache_cpu {
38 void **freelist; /* Pointer to first free per cpu object */ 39 void **freelist; /* Pointer to next available object */
40#ifdef CONFIG_CMPXCHG_LOCAL
41 unsigned long tid; /* Globally unique transaction id */
42#endif
39 struct page *page; /* The slab from which we are allocating */ 43 struct page *page; /* The slab from which we are allocating */
40 int node; /* The node of the page (or -1 for debug) */ 44 int node; /* The node of the page (or -1 for debug) */
41#ifdef CONFIG_SLUB_STATS 45#ifdef CONFIG_SLUB_STATS
@@ -70,6 +74,7 @@ struct kmem_cache {
70 struct kmem_cache_cpu __percpu *cpu_slab; 74 struct kmem_cache_cpu __percpu *cpu_slab;
71 /* Used for retriving partial slabs etc */ 75 /* Used for retriving partial slabs etc */
72 unsigned long flags; 76 unsigned long flags;
77 unsigned long min_partial;
73 int size; /* The size of an object including meta data */ 78 int size; /* The size of an object including meta data */
74 int objsize; /* The size of an object without meta data */ 79 int objsize; /* The size of an object without meta data */
75 int offset; /* Free pointer offset. */ 80 int offset; /* Free pointer offset. */
@@ -83,7 +88,7 @@ struct kmem_cache {
83 void (*ctor)(void *); 88 void (*ctor)(void *);
84 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
85 int align; /* Alignment */ 90 int align; /* Alignment */
86 unsigned long min_partial; 91 int reserved; /* Reserved bytes at the end of slabs */
87 const char *name; /* Name (only for display!) */ 92 const char *name; /* Name (only for display!) */
88 struct list_head list; /* List of slab caches */ 93 struct list_head list; /* List of slab caches */
89#ifdef CONFIG_SYSFS 94#ifdef CONFIG_SYSFS
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index 214f93209b8c..02fde50a79a5 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -172,3 +172,11 @@ struct sm501_platdata {
172 struct sm501_platdata_gpio_i2c *gpio_i2c; 172 struct sm501_platdata_gpio_i2c *gpio_i2c;
173 unsigned int gpio_i2c_nr; 173 unsigned int gpio_i2c_nr;
174}; 174};
175
176#if defined(CONFIG_PPC32)
177#define smc501_readl(addr) ioread32be((addr))
178#define smc501_writel(val, addr) iowrite32be((val), (addr))
179#else
180#define smc501_readl(addr) readl(addr)
181#define smc501_writel(val, addr) writel(val, addr)
182#endif
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6dc95cac6b3d..74243c86ba39 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -10,6 +10,7 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/init.h>
13 14
14extern void cpu_idle(void); 15extern void cpu_idle(void);
15 16
@@ -114,6 +115,8 @@ int on_each_cpu(smp_call_func_t func, void *info, int wait);
114void smp_prepare_boot_cpu(void); 115void smp_prepare_boot_cpu(void);
115 116
116extern unsigned int setup_max_cpus; 117extern unsigned int setup_max_cpus;
118extern void __init setup_nr_cpu_ids(void);
119extern void __init smp_init(void);
117 120
118#else /* !SMP */ 121#else /* !SMP */
119 122
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index 0e6dc3891942..c0f87da78f8a 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -40,6 +40,7 @@
40 40
41/* events the user application reading /dev/sonypi can use */ 41/* events the user application reading /dev/sonypi can use */
42 42
43#define SONYPI_EVENT_IGNORE 0
43#define SONYPI_EVENT_JOGDIAL_DOWN 1 44#define SONYPI_EVENT_JOGDIAL_DOWN 1
44#define SONYPI_EVENT_JOGDIAL_UP 2 45#define SONYPI_EVENT_JOGDIAL_UP 2
45#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3 46#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
diff --git a/include/linux/spi/tsc2005.h b/include/linux/spi/tsc2005.h
new file mode 100644
index 000000000000..d9b0c84220c7
--- /dev/null
+++ b/include/linux/spi/tsc2005.h
@@ -0,0 +1,41 @@
1/*
2 * This file is part of TSC2005 touchscreen driver
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation
5 *
6 * Contact: Aaro Koskinen <aaro.koskinen@nokia.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
24#ifndef _LINUX_SPI_TSC2005_H
25#define _LINUX_SPI_TSC2005_H
26
27#include <linux/types.h>
28
29struct tsc2005_platform_data {
30 int ts_pressure_max;
31 int ts_pressure_fudge;
32 int ts_x_max;
33 int ts_x_fudge;
34 int ts_y_max;
35 int ts_y_fudge;
36 int ts_x_plate_ohm;
37 unsigned int esd_timeout_ms;
38 void (*set_reset)(bool enable);
39};
40
41#endif
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 5d8048beb051..332da61cf8b7 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -126,6 +126,9 @@ struct gss_api_mech *gss_mech_get_by_name(const char *);
126/* Similar, but get by pseudoflavor. */ 126/* Similar, but get by pseudoflavor. */
127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); 127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
128 128
129/* Fill in an array with a list of supported pseudoflavors */
130int gss_mech_list_pseudoflavors(u32 *);
131
129/* Just increments the mechanism's reference count and returns its input: */ 132/* Just increments the mechanism's reference count and returns its input: */
130struct gss_api_mech * gss_mech_get(struct gss_api_mech *); 133struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
131 134
diff --git a/include/linux/svga.h b/include/linux/svga.h
index c59a51a2b0e7..bfa68e837d6a 100644
--- a/include/linux/svga.h
+++ b/include/linux/svga.h
@@ -67,25 +67,25 @@ struct svga_pll {
67 67
68/* Write a value to the attribute register */ 68/* Write a value to the attribute register */
69 69
70static inline void svga_wattr(u8 index, u8 data) 70static inline void svga_wattr(void __iomem *regbase, u8 index, u8 data)
71{ 71{
72 inb(0x3DA); 72 vga_r(regbase, VGA_IS1_RC);
73 outb(index, 0x3C0); 73 vga_w(regbase, VGA_ATT_IW, index);
74 outb(data, 0x3C0); 74 vga_w(regbase, VGA_ATT_W, data);
75} 75}
76 76
77/* Write a value to a sequence register with a mask */ 77/* Write a value to a sequence register with a mask */
78 78
79static inline void svga_wseq_mask(u8 index, u8 data, u8 mask) 79static inline void svga_wseq_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
80{ 80{
81 vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask)); 81 vga_wseq(regbase, index, (data & mask) | (vga_rseq(regbase, index) & ~mask));
82} 82}
83 83
84/* Write a value to a CRT register with a mask */ 84/* Write a value to a CRT register with a mask */
85 85
86static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask) 86static inline void svga_wcrt_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
87{ 87{
88 vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask)); 88 vga_wcrt(regbase, index, (data & mask) | (vga_rcrt(regbase, index) & ~mask));
89} 89}
90 90
91static inline int svga_primary_device(struct pci_dev *dev) 91static inline int svga_primary_device(struct pci_dev *dev)
@@ -96,27 +96,27 @@ static inline int svga_primary_device(struct pci_dev *dev)
96} 96}
97 97
98 98
99void svga_wcrt_multi(const struct vga_regset *regset, u32 value); 99void svga_wcrt_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
100void svga_wseq_multi(const struct vga_regset *regset, u32 value); 100void svga_wseq_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
101 101
102void svga_set_default_gfx_regs(void); 102void svga_set_default_gfx_regs(void __iomem *regbase);
103void svga_set_default_atc_regs(void); 103void svga_set_default_atc_regs(void __iomem *regbase);
104void svga_set_default_seq_regs(void); 104void svga_set_default_seq_regs(void __iomem *regbase);
105void svga_set_default_crt_regs(void); 105void svga_set_default_crt_regs(void __iomem *regbase);
106void svga_set_textmode_vga_regs(void); 106void svga_set_textmode_vga_regs(void __iomem *regbase);
107 107
108void svga_settile(struct fb_info *info, struct fb_tilemap *map); 108void svga_settile(struct fb_info *info, struct fb_tilemap *map);
109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area); 109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect); 110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit); 111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
112void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor); 112void svga_tilecursor(void __iomem *regbase, struct fb_info *info, struct fb_tilecursor *cursor);
113int svga_get_tilemax(struct fb_info *info); 113int svga_get_tilemax(struct fb_info *info);
114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps, 114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
115 struct fb_var_screeninfo *var); 115 struct fb_var_screeninfo *var);
116 116
117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node); 117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node); 118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
119void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node); 119void svga_set_timings(void __iomem *regbase, const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
120 120
121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
122 122
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 4d559325d919..a5c6da5d8df8 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -155,6 +155,15 @@ enum {
155#define SWAP_CLUSTER_MAX 32 155#define SWAP_CLUSTER_MAX 32
156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
157 157
158/*
159 * Ratio between the present memory in the zone and the "gap" that
160 * we're allowing kswapd to shrink in addition to the per-zone high
161 * wmark, even for zones that already have the high wmark satisfied,
162 * in order to provide better per-zone lru behavior. We are ok to
163 * spend not more than 1% of the memory for this zone balancing "gap".
164 */
165#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
166
158#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 167#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
159#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 168#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
160#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ 169#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */
@@ -215,6 +224,7 @@ extern void mark_page_accessed(struct page *);
215extern void lru_add_drain(void); 224extern void lru_add_drain(void);
216extern int lru_add_drain_all(void); 225extern int lru_add_drain_all(void);
217extern void rotate_reclaimable_page(struct page *page); 226extern void rotate_reclaimable_page(struct page *page);
227extern void deactivate_page(struct page *page);
218extern void swap_setup(void); 228extern void swap_setup(void);
219 229
220extern void add_page_to_unevictable_list(struct page *page); 230extern void add_page_to_unevictable_list(struct page *page);
@@ -299,8 +309,6 @@ extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
299 struct page **pagep, swp_entry_t *ent); 309 struct page **pagep, swp_entry_t *ent);
300#endif 310#endif
301 311
302extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
303
304#ifdef CONFIG_SWAP 312#ifdef CONFIG_SWAP
305/* linux/mm/page_io.c */ 313/* linux/mm/page_io.c */
306extern int swap_readpage(struct page *); 314extern int swap_readpage(struct page *);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 1f5c18e6f4f1..83ecc1749ef6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -825,6 +825,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags
825asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 825asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
826 u64 mask, int fd, 826 u64 mask, int fd,
827 const char __user *pathname); 827 const char __user *pathname);
828asmlinkage long sys_syncfs(int fd);
828 829
829int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 830int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
830 831
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 1154c29f4101..8a75da551e4e 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -33,12 +33,13 @@ struct sysdev_class {
33 const char *name; 33 const char *name;
34 struct list_head drivers; 34 struct list_head drivers;
35 struct sysdev_class_attribute **attrs; 35 struct sysdev_class_attribute **attrs;
36 36 struct kset kset;
37#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
37 /* Default operations for these types of devices */ 38 /* Default operations for these types of devices */
38 int (*shutdown)(struct sys_device *); 39 int (*shutdown)(struct sys_device *);
39 int (*suspend)(struct sys_device *, pm_message_t state); 40 int (*suspend)(struct sys_device *, pm_message_t state);
40 int (*resume)(struct sys_device *); 41 int (*resume)(struct sys_device *);
41 struct kset kset; 42#endif
42}; 43};
43 44
44struct sysdev_class_attribute { 45struct sysdev_class_attribute {
@@ -76,9 +77,11 @@ struct sysdev_driver {
76 struct list_head entry; 77 struct list_head entry;
77 int (*add)(struct sys_device *); 78 int (*add)(struct sys_device *);
78 int (*remove)(struct sys_device *); 79 int (*remove)(struct sys_device *);
80#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
79 int (*shutdown)(struct sys_device *); 81 int (*shutdown)(struct sys_device *);
80 int (*suspend)(struct sys_device *, pm_message_t state); 82 int (*suspend)(struct sys_device *, pm_message_t state);
81 int (*resume)(struct sys_device *); 83 int (*resume)(struct sys_device *);
84#endif
82}; 85};
83 86
84 87
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4e53d4641b38..9f469c700550 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -82,7 +82,7 @@ struct tty_buffer {
82 82
83 83
84struct tty_bufhead { 84struct tty_bufhead {
85 struct delayed_work work; 85 struct work_struct work;
86 spinlock_t lock; 86 spinlock_t lock;
87 struct tty_buffer *head; /* Queue head */ 87 struct tty_buffer *head; /* Queue head */
88 struct tty_buffer *tail; /* Active buffer */ 88 struct tty_buffer *tail; /* Active buffer */
diff --git a/include/linux/types.h b/include/linux/types.h
index c2a9eb44f2fa..176da8c1fbb1 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -150,6 +150,12 @@ typedef unsigned long blkcnt_t;
150#define pgoff_t unsigned long 150#define pgoff_t unsigned long
151#endif 151#endif
152 152
153#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
154typedef u64 dma_addr_t;
155#else
156typedef u32 dma_addr_t;
157#endif /* dma_addr_t */
158
153#endif /* __KERNEL__ */ 159#endif /* __KERNEL__ */
154 160
155/* 161/*
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 44842c8d38c0..201f2228f731 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -102,6 +102,7 @@ struct driver_info {
102 * Affects statistic (counters) and short packet handling. 102 * Affects statistic (counters) and short packet handling.
103 */ 103 */
104#define FLAG_MULTI_PACKET 0x1000 104#define FLAG_MULTI_PACKET 0x1000
105#define FLAG_RX_ASSEMBLE 0x2000 /* rx packets may span >1 frames */
105 106
106 /* init device ... can sleep, or cause probe() failure */ 107 /* init device ... can sleep, or cause probe() failure */
107 int (*bind)(struct usbnet *, struct usb_interface *); 108 int (*bind)(struct usbnet *, struct usb_interface *);
@@ -172,7 +173,9 @@ struct cdc_state {
172}; 173};
173 174
174extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); 175extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
176extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
175extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); 177extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
178extern void usbnet_cdc_status(struct usbnet *, struct urb *);
176 179
177/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 180/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
178#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 181#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 69f39974c041..4e5b0213fdc1 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -37,9 +37,13 @@ struct new_utsname {
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39 39
40struct user_namespace;
41extern struct user_namespace init_user_ns;
42
40struct uts_namespace { 43struct uts_namespace {
41 struct kref kref; 44 struct kref kref;
42 struct new_utsname name; 45 struct new_utsname name;
46 struct user_namespace *user_ns;
43}; 47};
44extern struct uts_namespace init_uts_ns; 48extern struct uts_namespace init_uts_ns;
45 49
@@ -50,7 +54,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
50} 54}
51 55
52extern struct uts_namespace *copy_utsname(unsigned long flags, 56extern struct uts_namespace *copy_utsname(unsigned long flags,
53 struct uts_namespace *ns); 57 struct task_struct *tsk);
54extern void free_uts_ns(struct kref *kref); 58extern void free_uts_ns(struct kref *kref);
55 59
56static inline void put_uts_ns(struct uts_namespace *ns) 60static inline void put_uts_ns(struct uts_namespace *ns)
@@ -67,12 +71,12 @@ static inline void put_uts_ns(struct uts_namespace *ns)
67} 71}
68 72
69static inline struct uts_namespace *copy_utsname(unsigned long flags, 73static inline struct uts_namespace *copy_utsname(unsigned long flags,
70 struct uts_namespace *ns) 74 struct task_struct *tsk)
71{ 75{
72 if (flags & CLONE_NEWUTS) 76 if (flags & CLONE_NEWUTS)
73 return ERR_PTR(-EINVAL); 77 return ERR_PTR(-EINVAL);
74 78
75 return ns; 79 return tsk->nsproxy->uts_ns;
76} 80}
77#endif 81#endif
78 82
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
new file mode 100644
index 000000000000..7054a7a8065e
--- /dev/null
+++ b/include/linux/v4l2-mediabus.h
@@ -0,0 +1,108 @@
1/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, 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 __LINUX_V4L2_MEDIABUS_H
12#define __LINUX_V4L2_MEDIABUS_H
13
14#include <linux/types.h>
15#include <linux/videodev2.h>
16
17/*
18 * These pixel codes uniquely identify data formats on the media bus. Mostly
19 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
20 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
21 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
22 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
23 * transferred over the bus: "LE" means that the least significant bits are
24 * transferred first, "BE" means that the most significant bits are transferred
25 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
26 * incomplete high byte, are filled with padding bits.
27 *
28 * The pixel codes are grouped by type, bus_width, bits per component, samples
29 * per pixel and order of subsamples. Numerical values are sorted using generic
30 * numerical sort order (8 thus comes before 10).
31 *
32 * As their value can't change when a new pixel code is inserted in the
33 * enumeration, the pixel codes are explicitly given a numerical value. The next
34 * free values for each category are listed below, update them when inserting
35 * new pixel codes.
36 */
37enum v4l2_mbus_pixelcode {
38 V4L2_MBUS_FMT_FIXED = 0x0001,
39
40 /* RGB - next is 0x1009 */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
45 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49
50 /* YUV (including grey) - next is 0x2013 */
51 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
52 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
53 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
54 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
55 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
56 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
57 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
58 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
59 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
60 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
61 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
62 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
63 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
64 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
65 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
66 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
67 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
68 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
69
70 /* Bayer - next is 0x3013 */
71 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
72 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
73 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
74 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
75 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
76 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
77 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
78 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
79 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
80 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
81 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
82 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
83 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
84 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
85 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
86 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
87 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
88 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
89};
90
91/**
92 * struct v4l2_mbus_framefmt - frame format on the media bus
93 * @width: frame width
94 * @height: frame height
95 * @code: data format code (from enum v4l2_mbus_pixelcode)
96 * @field: used interlacing type (from enum v4l2_field)
97 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
98 */
99struct v4l2_mbus_framefmt {
100 __u32 width;
101 __u32 height;
102 __u32 code;
103 __u32 field;
104 __u32 colorspace;
105 __u32 reserved[7];
106};
107
108#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
new file mode 100644
index 000000000000..ed29cbbebfef
--- /dev/null
+++ b/include/linux/v4l2-subdev.h
@@ -0,0 +1,141 @@
1/*
2 * V4L2 subdev userspace API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 * 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_V4L2_SUBDEV_H
24#define __LINUX_V4L2_SUBDEV_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/v4l2-mediabus.h>
29
30/**
31 * enum v4l2_subdev_format_whence - Media bus format type
32 * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
33 * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
34 */
35enum v4l2_subdev_format_whence {
36 V4L2_SUBDEV_FORMAT_TRY = 0,
37 V4L2_SUBDEV_FORMAT_ACTIVE = 1,
38};
39
40/**
41 * struct v4l2_subdev_format - Pad-level media bus format
42 * @which: format type (from enum v4l2_subdev_format_whence)
43 * @pad: pad number, as reported by the media API
44 * @format: media bus format (format code and frame size)
45 */
46struct v4l2_subdev_format {
47 __u32 which;
48 __u32 pad;
49 struct v4l2_mbus_framefmt format;
50 __u32 reserved[8];
51};
52
53/**
54 * struct v4l2_subdev_crop - Pad-level crop settings
55 * @which: format type (from enum v4l2_subdev_format_whence)
56 * @pad: pad number, as reported by the media API
57 * @rect: pad crop rectangle boundaries
58 */
59struct v4l2_subdev_crop {
60 __u32 which;
61 __u32 pad;
62 struct v4l2_rect rect;
63 __u32 reserved[8];
64};
65
66/**
67 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
68 * @pad: pad number, as reported by the media API
69 * @index: format index during enumeration
70 * @code: format code (from enum v4l2_mbus_pixelcode)
71 */
72struct v4l2_subdev_mbus_code_enum {
73 __u32 pad;
74 __u32 index;
75 __u32 code;
76 __u32 reserved[9];
77};
78
79/**
80 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
81 * @pad: pad number, as reported by the media API
82 * @index: format index during enumeration
83 * @code: format code (from enum v4l2_mbus_pixelcode)
84 */
85struct v4l2_subdev_frame_size_enum {
86 __u32 index;
87 __u32 pad;
88 __u32 code;
89 __u32 min_width;
90 __u32 max_width;
91 __u32 min_height;
92 __u32 max_height;
93 __u32 reserved[9];
94};
95
96/**
97 * struct v4l2_subdev_frame_interval - Pad-level frame rate
98 * @pad: pad number, as reported by the media API
99 * @interval: frame interval in seconds
100 */
101struct v4l2_subdev_frame_interval {
102 __u32 pad;
103 struct v4l2_fract interval;
104 __u32 reserved[9];
105};
106
107/**
108 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
109 * @pad: pad number, as reported by the media API
110 * @index: frame interval index during enumeration
111 * @code: format code (from enum v4l2_mbus_pixelcode)
112 * @width: frame width in pixels
113 * @height: frame height in pixels
114 * @interval: frame interval in seconds
115 */
116struct v4l2_subdev_frame_interval_enum {
117 __u32 index;
118 __u32 pad;
119 __u32 code;
120 __u32 width;
121 __u32 height;
122 struct v4l2_fract interval;
123 __u32 reserved[9];
124};
125
126#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
127#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
129 _IOWR('V', 21, struct v4l2_subdev_frame_interval)
130#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
131 _IOWR('V', 22, struct v4l2_subdev_frame_interval)
132#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
133 _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
134#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
135 _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
136#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
137 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
138#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
139#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
140
141#endif
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5f6f47044abf..aa6c393b7ae9 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -70,6 +70,7 @@
70 * Moved from videodev.h 70 * Moved from videodev.h
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73#define VIDEO_MAX_PLANES 8
73 74
74#ifndef __KERNEL__ 75#ifndef __KERNEL__
75 76
@@ -157,9 +158,23 @@ enum v4l2_buf_type {
157 /* Experimental */ 158 /* Experimental */
158 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, 159 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
159#endif 160#endif
161 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
162 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 163 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 164};
162 165
166#define V4L2_TYPE_IS_MULTIPLANAR(type) \
167 ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
168 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
169
170#define V4L2_TYPE_IS_OUTPUT(type) \
171 ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
172 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
173 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
174 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
175 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
176 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
177
163enum v4l2_tuner_type { 178enum v4l2_tuner_type {
164 V4L2_TUNER_RADIO = 1, 179 V4L2_TUNER_RADIO = 1,
165 V4L2_TUNER_ANALOG_TV = 2, 180 V4L2_TUNER_ANALOG_TV = 2,
@@ -245,6 +260,11 @@ struct v4l2_capability {
245#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ 260#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
246#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ 261#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
247 262
263/* Is a video capture device that supports multiplanar formats */
264#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
265/* Is a video output device that supports multiplanar formats */
266#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
267
248#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 268#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
249#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 269#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
250#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 270#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
@@ -319,6 +339,13 @@ struct v4l2_pix_format {
319#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 339#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
320#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 340#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
321 341
342/* two non contiguous planes - one Y, one Cr + Cb interleaved */
343#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
344#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
345
346/* three non contiguous planes - Y, Cb, Cr */
347#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
348
322/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 349/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
323#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 350#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
324#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 351#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
@@ -328,6 +355,10 @@ struct v4l2_pix_format {
328#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ 355#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
329#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ 356#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
330#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ 357#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
358#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
359#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
360#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
361#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
331 /* 10bit raw bayer DPCM compressed to 8 bits */ 362 /* 10bit raw bayer DPCM compressed to 8 bits */
332#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 363#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
333 /* 364 /*
@@ -365,6 +396,7 @@ struct v4l2_pix_format {
365#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ 396#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
366#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ 397#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
367#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ 398#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
399#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
368 400
369/* 401/*
370 * F O R M A T E N U M E R A T I O N 402 * F O R M A T E N U M E R A T I O N
@@ -517,6 +549,62 @@ struct v4l2_requestbuffers {
517 __u32 reserved[2]; 549 __u32 reserved[2];
518}; 550};
519 551
552/**
553 * struct v4l2_plane - plane info for multi-planar buffers
554 * @bytesused: number of bytes occupied by data in the plane (payload)
555 * @length: size of this plane (NOT the payload) in bytes
556 * @mem_offset: when memory in the associated struct v4l2_buffer is
557 * V4L2_MEMORY_MMAP, equals the offset from the start of
558 * the device memory for this plane (or is a "cookie" that
559 * should be passed to mmap() called on the video node)
560 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
561 * pointing to this plane
562 * @data_offset: offset in the plane to the start of data; usually 0,
563 * unless there is a header in front of the data
564 *
565 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
566 * with two planes can have one plane for Y, and another for interleaved CbCr
567 * components. Each plane can reside in a separate memory buffer, or even in
568 * a completely separate memory node (e.g. in embedded devices).
569 */
570struct v4l2_plane {
571 __u32 bytesused;
572 __u32 length;
573 union {
574 __u32 mem_offset;
575 unsigned long userptr;
576 } m;
577 __u32 data_offset;
578 __u32 reserved[11];
579};
580
581/**
582 * struct v4l2_buffer - video buffer info
583 * @index: id number of the buffer
584 * @type: buffer type (type == *_MPLANE for multiplanar buffers)
585 * @bytesused: number of bytes occupied by data in the buffer (payload);
586 * unused (set to 0) for multiplanar buffers
587 * @flags: buffer informational flags
588 * @field: field order of the image in the buffer
589 * @timestamp: frame timestamp
590 * @timecode: frame timecode
591 * @sequence: sequence count of this frame
592 * @memory: the method, in which the actual video data is passed
593 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
594 * offset from the start of the device memory for this plane,
595 * (or a "cookie" that should be passed to mmap() as offset)
596 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
597 * a userspace pointer pointing to this buffer
598 * @planes: for multiplanar buffers; userspace pointer to the array of plane
599 * info structs for this buffer
600 * @length: size in bytes of the buffer (NOT its payload) for single-plane
601 * buffers (when type != *_MPLANE); number of elements in the
602 * planes array for multi-plane buffers
603 * @input: input number from which the video data has has been captured
604 *
605 * Contains data exchanged by application and driver using one of the Streaming
606 * I/O methods.
607 */
520struct v4l2_buffer { 608struct v4l2_buffer {
521 __u32 index; 609 __u32 index;
522 enum v4l2_buf_type type; 610 enum v4l2_buf_type type;
@@ -532,6 +620,7 @@ struct v4l2_buffer {
532 union { 620 union {
533 __u32 offset; 621 __u32 offset;
534 unsigned long userptr; 622 unsigned long userptr;
623 struct v4l2_plane *planes;
535 } m; 624 } m;
536 __u32 length; 625 __u32 length;
537 __u32 input; 626 __u32 input;
@@ -1622,12 +1711,56 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
1622 * A G G R E G A T E S T R U C T U R E S 1711 * A G G R E G A T E S T R U C T U R E S
1623 */ 1712 */
1624 1713
1625/* Stream data format 1714/**
1715 * struct v4l2_plane_pix_format - additional, per-plane format definition
1716 * @sizeimage: maximum size in bytes required for data, for which
1717 * this plane will be used
1718 * @bytesperline: distance in bytes between the leftmost pixels in two
1719 * adjacent lines
1720 */
1721struct v4l2_plane_pix_format {
1722 __u32 sizeimage;
1723 __u16 bytesperline;
1724 __u16 reserved[7];
1725} __attribute__ ((packed));
1726
1727/**
1728 * struct v4l2_pix_format_mplane - multiplanar format definition
1729 * @width: image width in pixels
1730 * @height: image height in pixels
1731 * @pixelformat: little endian four character code (fourcc)
1732 * @field: field order (for interlaced video)
1733 * @colorspace: supplemental to pixelformat
1734 * @plane_fmt: per-plane information
1735 * @num_planes: number of planes for this format
1736 */
1737struct v4l2_pix_format_mplane {
1738 __u32 width;
1739 __u32 height;
1740 __u32 pixelformat;
1741 enum v4l2_field field;
1742 enum v4l2_colorspace colorspace;
1743
1744 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1745 __u8 num_planes;
1746 __u8 reserved[11];
1747} __attribute__ ((packed));
1748
1749/**
1750 * struct v4l2_format - stream data format
1751 * @type: type of the data stream
1752 * @pix: definition of an image format
1753 * @pix_mp: definition of a multiplanar image format
1754 * @win: definition of an overlaid image
1755 * @vbi: raw VBI capture or output parameters
1756 * @sliced: sliced VBI capture or output parameters
1757 * @raw_data: placeholder for future extensions and custom formats
1626 */ 1758 */
1627struct v4l2_format { 1759struct v4l2_format {
1628 enum v4l2_buf_type type; 1760 enum v4l2_buf_type type;
1629 union { 1761 union {
1630 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 1762 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1763 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
1631 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ 1764 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1632 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ 1765 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1633 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ 1766 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
@@ -1635,7 +1768,6 @@ struct v4l2_format {
1635 } fmt; 1768 } fmt;
1636}; 1769};
1637 1770
1638
1639/* Stream type-dependent parameters 1771/* Stream type-dependent parameters
1640 */ 1772 */
1641struct v4l2_streamparm { 1773struct v4l2_streamparm {
@@ -1808,16 +1940,6 @@ struct v4l2_dbg_chip_ident {
1808/* Reminder: when adding new ioctls please add support for them to 1940/* Reminder: when adding new ioctls please add support for them to
1809 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1941 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1810 1942
1811#ifdef __OLD_VIDIOC_
1812/* for compatibility, will go away some day */
1813#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1814#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1815#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1816#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1817#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1818#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1819#endif
1820
1821#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1943#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1822 1944
1823#endif /* __LINUX_VIDEODEV2_H */ 1945#endif /* __LINUX_VIDEODEV2_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 4ed6fcd6b726..9332e52ea8c2 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -95,10 +95,27 @@ extern struct vm_struct *remove_vm_area(const void *addr);
95 95
96extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 96extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
97 struct page ***pages); 97 struct page ***pages);
98#ifdef CONFIG_MMU
98extern int map_kernel_range_noflush(unsigned long start, unsigned long size, 99extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
99 pgprot_t prot, struct page **pages); 100 pgprot_t prot, struct page **pages);
100extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size); 101extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);
101extern void unmap_kernel_range(unsigned long addr, unsigned long size); 102extern void unmap_kernel_range(unsigned long addr, unsigned long size);
103#else
104static inline int
105map_kernel_range_noflush(unsigned long start, unsigned long size,
106 pgprot_t prot, struct page **pages)
107{
108 return size >> PAGE_SHIFT;
109}
110static inline void
111unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
112{
113}
114static inline void
115unmap_kernel_range(unsigned long addr, unsigned long size)
116{
117}
118#endif
102 119
103/* Allocate/destroy a 'vmalloc' VM area. */ 120/* Allocate/destroy a 'vmalloc' VM area. */
104extern struct vm_struct *alloc_vm_area(size_t size); 121extern struct vm_struct *alloc_vm_area(size_t size);
@@ -116,11 +133,26 @@ extern struct vm_struct *vmlist;
116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); 133extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
117 134
118#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
136# ifdef CONFIG_MMU
119struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, 137struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
120 const size_t *sizes, int nr_vms, 138 const size_t *sizes, int nr_vms,
121 size_t align); 139 size_t align);
122 140
123void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms); 141void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
142# else
143static inline struct vm_struct **
144pcpu_get_vm_areas(const unsigned long *offsets,
145 const size_t *sizes, int nr_vms,
146 size_t align)
147{
148 return NULL;
149}
150
151static inline void
152pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
153{
154}
155# endif
124#endif 156#endif
125 157
126#endif /* _LINUX_VMALLOC_H */ 158#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 833e676d6d92..461c0119664f 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -220,12 +220,12 @@ static inline unsigned long node_page_state(int node,
220 zone_page_state(&zones[ZONE_MOVABLE], item); 220 zone_page_state(&zones[ZONE_MOVABLE], item);
221} 221}
222 222
223extern void zone_statistics(struct zone *, struct zone *); 223extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
224 224
225#else 225#else
226 226
227#define node_page_state(node, item) global_page_state(item) 227#define node_page_state(node, item) global_page_state(item)
228#define zone_statistics(_zl,_z) do { } while (0) 228#define zone_statistics(_zl, _z, gfp) do { } while (0)
229 229
230#endif /* CONFIG_NUMA */ 230#endif /* CONFIG_NUMA */
231 231
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 0ead399e08b5..17e7ccc322a5 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -9,7 +9,7 @@
9 9
10struct backing_dev_info; 10struct backing_dev_info;
11 11
12extern spinlock_t inode_lock; 12extern spinlock_t inode_wb_list_lock;
13 13
14/* 14/*
15 * fs/fs-writeback.c 15 * fs/fs-writeback.c
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 40c49cb3eb51..9c5a6b4de0a3 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -179,11 +179,16 @@ typedef z_stream *z_streamp;
179 179
180 /* basic functions */ 180 /* basic functions */
181 181
182extern int zlib_deflate_workspacesize (void); 182extern int zlib_deflate_workspacesize (int windowBits, int memLevel);
183/* 183/*
184 Returns the number of bytes that needs to be allocated for a per- 184 Returns the number of bytes that needs to be allocated for a per-
185 stream workspace. A pointer to this number of bytes should be 185 stream workspace with the specified parameters. A pointer to this
186 returned in stream->workspace before calling zlib_deflateInit(). 186 number of bytes should be returned in stream->workspace before
187 you call zlib_deflateInit() or zlib_deflateInit2(). If you call
188 zlib_deflateInit(), specify windowBits = MAX_WBITS and memLevel =
189 MAX_MEM_LEVEL here. If you call zlib_deflateInit2(), the windowBits
190 and memLevel parameters passed to zlib_deflateInit2() must not
191 exceed those passed here.
187*/ 192*/
188 193
189/* 194/*
diff --git a/include/media/media-device.h b/include/media/media-device.h
new file mode 100644
index 000000000000..6a27d916c250
--- /dev/null
+++ b/include/media/media-device.h
@@ -0,0 +1,95 @@
1/*
2 * Media device
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 * 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 _MEDIA_DEVICE_H
24#define _MEDIA_DEVICE_H
25
26#include <linux/device.h>
27#include <linux/list.h>
28#include <linux/mutex.h>
29#include <linux/spinlock.h>
30
31#include <media/media-devnode.h>
32#include <media/media-entity.h>
33
34/**
35 * struct media_device - Media device
36 * @dev: Parent device
37 * @devnode: Media device node
38 * @model: Device model name
39 * @serial: Device serial number (optional)
40 * @bus_info: Unique and stable device location identifier
41 * @hw_revision: Hardware device revision
42 * @driver_version: Device driver version
43 * @entity_id: ID of the next entity to be registered
44 * @entities: List of registered entities
45 * @lock: Entities list lock
46 * @graph_mutex: Entities graph operation lock
47 *
48 * This structure represents an abstract high-level media device. It allows easy
49 * access to entities and provides basic media device-level support. The
50 * structure can be allocated directly or embedded in a larger structure.
51 *
52 * The parent @dev is a physical device. It must be set before registering the
53 * media device.
54 *
55 * @model is a descriptive model name exported through sysfs. It doesn't have to
56 * be unique.
57 */
58struct media_device {
59 /* dev->driver_data points to this struct. */
60 struct device *dev;
61 struct media_devnode devnode;
62
63 char model[32];
64 char serial[40];
65 char bus_info[32];
66 u32 hw_revision;
67 u32 driver_version;
68
69 u32 entity_id;
70 struct list_head entities;
71
72 /* Protects the entities list */
73 spinlock_t lock;
74 /* Serializes graph operations. */
75 struct mutex graph_mutex;
76
77 int (*link_notify)(struct media_pad *source,
78 struct media_pad *sink, u32 flags);
79};
80
81/* media_devnode to media_device */
82#define to_media_device(node) container_of(node, struct media_device, devnode)
83
84int __must_check media_device_register(struct media_device *mdev);
85void media_device_unregister(struct media_device *mdev);
86
87int __must_check media_device_register_entity(struct media_device *mdev,
88 struct media_entity *entity);
89void media_device_unregister_entity(struct media_entity *entity);
90
91/* Iterate over all entities. */
92#define media_device_for_each_entity(entity, mdev) \
93 list_for_each_entry(entity, &(mdev)->entities, list)
94
95#endif
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
new file mode 100644
index 000000000000..f6caafc874cb
--- /dev/null
+++ b/include/media/media-devnode.h
@@ -0,0 +1,97 @@
1/*
2 * Media device node
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 * 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 *
24 * Common functions for media-related drivers to register and unregister media
25 * device nodes.
26 */
27
28#ifndef _MEDIA_DEVNODE_H
29#define _MEDIA_DEVNODE_H
30
31#include <linux/poll.h>
32#include <linux/fs.h>
33#include <linux/device.h>
34#include <linux/cdev.h>
35
36/*
37 * Flag to mark the media_devnode struct as registered. Drivers must not touch
38 * this flag directly, it will be set and cleared by media_devnode_register and
39 * media_devnode_unregister.
40 */
41#define MEDIA_FLAG_REGISTERED 0
42
43struct media_file_operations {
44 struct module *owner;
45 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
46 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
47 unsigned int (*poll) (struct file *, struct poll_table_struct *);
48 long (*ioctl) (struct file *, unsigned int, unsigned long);
49 int (*open) (struct file *);
50 int (*release) (struct file *);
51};
52
53/**
54 * struct media_devnode - Media device node
55 * @parent: parent device
56 * @minor: device node minor number
57 * @flags: flags, combination of the MEDIA_FLAG_* constants
58 *
59 * This structure represents a media-related device node.
60 *
61 * The @parent is a physical device. It must be set by core or device drivers
62 * before registering the node.
63 */
64struct media_devnode {
65 /* device ops */
66 const struct media_file_operations *fops;
67
68 /* sysfs */
69 struct device dev; /* media device */
70 struct cdev cdev; /* character device */
71 struct device *parent; /* device parent */
72
73 /* device info */
74 int minor;
75 unsigned long flags; /* Use bitops to access flags */
76
77 /* callbacks */
78 void (*release)(struct media_devnode *mdev);
79};
80
81/* dev to media_devnode */
82#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
83
84int __must_check media_devnode_register(struct media_devnode *mdev);
85void media_devnode_unregister(struct media_devnode *mdev);
86
87static inline struct media_devnode *media_devnode_data(struct file *filp)
88{
89 return filp->private_data;
90}
91
92static inline int media_devnode_is_registered(struct media_devnode *mdev)
93{
94 return test_bit(MEDIA_FLAG_REGISTERED, &mdev->flags);
95}
96
97#endif /* _MEDIA_DEVNODE_H */
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
new file mode 100644
index 000000000000..cd8bca63a502
--- /dev/null
+++ b/include/media/media-entity.h
@@ -0,0 +1,151 @@
1/*
2 * Media entity
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 * 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 _MEDIA_ENTITY_H
24#define _MEDIA_ENTITY_H
25
26#include <linux/list.h>
27#include <linux/media.h>
28
29struct media_pipeline {
30};
31
32struct media_link {
33 struct media_pad *source; /* Source pad */
34 struct media_pad *sink; /* Sink pad */
35 struct media_link *reverse; /* Link in the reverse direction */
36 unsigned long flags; /* Link flags (MEDIA_LNK_FL_*) */
37};
38
39struct media_pad {
40 struct media_entity *entity; /* Entity this pad belongs to */
41 u16 index; /* Pad index in the entity pads array */
42 unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */
43};
44
45struct media_entity_operations {
46 int (*link_setup)(struct media_entity *entity,
47 const struct media_pad *local,
48 const struct media_pad *remote, u32 flags);
49};
50
51struct media_entity {
52 struct list_head list;
53 struct media_device *parent; /* Media device this entity belongs to*/
54 u32 id; /* Entity ID, unique in the parent media
55 * device context */
56 const char *name; /* Entity name */
57 u32 type; /* Entity type (MEDIA_ENT_T_*) */
58 u32 revision; /* Entity revision, driver specific */
59 unsigned long flags; /* Entity flags (MEDIA_ENT_FL_*) */
60 u32 group_id; /* Entity group ID */
61
62 u16 num_pads; /* Number of sink and source pads */
63 u16 num_links; /* Number of existing links, both
64 * enabled and disabled */
65 u16 num_backlinks; /* Number of backlinks */
66 u16 max_links; /* Maximum number of links */
67
68 struct media_pad *pads; /* Pads array (num_pads elements) */
69 struct media_link *links; /* Links array (max_links elements)*/
70
71 const struct media_entity_operations *ops; /* Entity operations */
72
73 /* Reference counts must never be negative, but are signed integers on
74 * purpose: a simple WARN_ON(<0) check can be used to detect reference
75 * count bugs that would make them negative.
76 */
77 int stream_count; /* Stream count for the entity. */
78 int use_count; /* Use count for the entity. */
79
80 struct media_pipeline *pipe; /* Pipeline this entity belongs to. */
81
82 union {
83 /* Node specifications */
84 struct {
85 u32 major;
86 u32 minor;
87 } v4l;
88 struct {
89 u32 major;
90 u32 minor;
91 } fb;
92 struct {
93 u32 card;
94 u32 device;
95 u32 subdevice;
96 } alsa;
97 int dvb;
98
99 /* Sub-device specifications */
100 /* Nothing needed yet */
101 };
102};
103
104static inline u32 media_entity_type(struct media_entity *entity)
105{
106 return entity->type & MEDIA_ENT_TYPE_MASK;
107}
108
109static inline u32 media_entity_subtype(struct media_entity *entity)
110{
111 return entity->type & MEDIA_ENT_SUBTYPE_MASK;
112}
113
114#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
115
116struct media_entity_graph {
117 struct {
118 struct media_entity *entity;
119 int link;
120 } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH];
121 int top;
122};
123
124int media_entity_init(struct media_entity *entity, u16 num_pads,
125 struct media_pad *pads, u16 extra_links);
126void media_entity_cleanup(struct media_entity *entity);
127
128int media_entity_create_link(struct media_entity *source, u16 source_pad,
129 struct media_entity *sink, u16 sink_pad, u32 flags);
130int __media_entity_setup_link(struct media_link *link, u32 flags);
131int media_entity_setup_link(struct media_link *link, u32 flags);
132struct media_link *media_entity_find_link(struct media_pad *source,
133 struct media_pad *sink);
134struct media_pad *media_entity_remote_source(struct media_pad *pad);
135
136struct media_entity *media_entity_get(struct media_entity *entity);
137void media_entity_put(struct media_entity *entity);
138
139void media_entity_graph_walk_start(struct media_entity_graph *graph,
140 struct media_entity *entity);
141struct media_entity *
142media_entity_graph_walk_next(struct media_entity_graph *graph);
143void media_entity_pipeline_start(struct media_entity *entity,
144 struct media_pipeline *pipe);
145void media_entity_pipeline_stop(struct media_entity *entity);
146
147#define media_entity_call(entity, operation, args...) \
148 (((entity)->ops && (entity)->ops->operation) ? \
149 (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)
150
151#endif
diff --git a/include/media/noon010pc30.h b/include/media/noon010pc30.h
new file mode 100644
index 000000000000..58eafee36b30
--- /dev/null
+++ b/include/media/noon010pc30.h
@@ -0,0 +1,28 @@
1/*
2 * Driver header for NOON010PC30L camera sensor chip.
3 *
4 * Copyright (c) 2010 Samsung Electronics, Co. Ltd
5 * Contact: Sylwester Nawrocki <s.nawrocki@samsung.com>
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
13#ifndef NOON010PC30_H
14#define NOON010PC30_H
15
16/**
17 * @clk_rate: the clock frequency in Hz
18 * @gpio_nreset: GPIO driving nRESET pin
19 * @gpio_nstby: GPIO driving nSTBY pin
20 */
21
22struct noon010pc30_platform_data {
23 unsigned long clk_rate;
24 int gpio_nreset;
25 int gpio_nstby;
26};
27
28#endif /* NOON010PC30_H */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index ee9e2f747c76..9184751f19c0 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -94,7 +94,7 @@ void rc_map_init(void);
94#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z" 94#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z"
95#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce" 95#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"
96#define RC_MAP_GOTVIEW7135 "rc-gotview7135" 96#define RC_MAP_GOTVIEW7135 "rc-gotview7135"
97#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new" 97#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge"
98#define RC_MAP_IMON_MCE "rc-imon-mce" 98#define RC_MAP_IMON_MCE "rc-imon-mce"
99#define RC_MAP_IMON_PAD "rc-imon-pad" 99#define RC_MAP_IMON_PAD "rc-imon-pad"
100#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" 100#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
@@ -125,14 +125,16 @@ void rc_map_init(void);
125#define RC_MAP_PROTEUS_2309 "rc-proteus-2309" 125#define RC_MAP_PROTEUS_2309 "rc-proteus-2309"
126#define RC_MAP_PURPLETV "rc-purpletv" 126#define RC_MAP_PURPLETV "rc-purpletv"
127#define RC_MAP_PV951 "rc-pv951" 127#define RC_MAP_PV951 "rc-pv951"
128#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" 128#define RC_MAP_HAUPPAUGE "rc-hauppauge"
129#define RC_MAP_RC5_TV "rc-rc5-tv" 129#define RC_MAP_RC5_TV "rc-rc5-tv"
130#define RC_MAP_RC6_MCE "rc-rc6-mce" 130#define RC_MAP_RC6_MCE "rc-rc6-mce"
131#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 131#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
132#define RC_MAP_STREAMZAP "rc-streamzap" 132#define RC_MAP_STREAMZAP "rc-streamzap"
133#define RC_MAP_TBS_NEC "rc-tbs-nec" 133#define RC_MAP_TBS_NEC "rc-tbs-nec"
134#define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2"
134#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" 135#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
135#define RC_MAP_TERRATEC_SLIM "rc-terratec-slim" 136#define RC_MAP_TERRATEC_SLIM "rc-terratec-slim"
137#define RC_MAP_TERRATEC_SLIM_2 "rc-terratec-slim-2"
136#define RC_MAP_TEVII_NEC "rc-tevii-nec" 138#define RC_MAP_TEVII_NEC "rc-tevii-nec"
137#define RC_MAP_TOTAL_MEDIA_IN_HAND "rc-total-media-in-hand" 139#define RC_MAP_TOTAL_MEDIA_IN_HAND "rc-total-media-in-hand"
138#define RC_MAP_TREKSTOR "rc-trekstor" 140#define RC_MAP_TREKSTOR "rc-trekstor"
diff --git a/include/media/s3c_fimc.h b/include/media/s5p_fimc.h
index ca1b6738e4a4..9fdff8a4ed26 100644
--- a/include/media/s3c_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -9,8 +9,8 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#ifndef S3C_FIMC_H_ 12#ifndef S5P_FIMC_H_
13#define S3C_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15enum cam_bus_type { 15enum cam_bus_type {
16 FIMC_ITU_601 = 1, 16 FIMC_ITU_601 = 1,
@@ -27,34 +27,35 @@ enum cam_bus_type {
27struct i2c_board_info; 27struct i2c_board_info;
28 28
29/** 29/**
30 * struct s3c_fimc_isp_info - image sensor information required for host 30 * struct s5p_fimc_isp_info - image sensor information required for host
31 * interace configuration. 31 * interace configuration.
32 * 32 *
33 * @board_info: pointer to I2C subdevice's board info 33 * @board_info: pointer to I2C subdevice's board info
34 * @clk_frequency: frequency of the clock the host interface provides to sensor
34 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. 35 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
36 * @csi_data_align: MIPI-CSI interface data alignment in bits
35 * @i2c_bus_num: i2c control bus id the sensor is attached to 37 * @i2c_bus_num: i2c control bus id the sensor is attached to
36 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) 38 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
37 * @bus_width: camera data bus width in bits
38 * @flags: flags defining bus signals polarity inversion (High by default) 39 * @flags: flags defining bus signals polarity inversion (High by default)
39 */ 40 */
40struct s3c_fimc_isp_info { 41struct s5p_fimc_isp_info {
41 struct i2c_board_info *board_info; 42 struct i2c_board_info *board_info;
43 unsigned long clk_frequency;
42 enum cam_bus_type bus_type; 44 enum cam_bus_type bus_type;
45 u16 csi_data_align;
43 u16 i2c_bus_num; 46 u16 i2c_bus_num;
44 u16 mux_id; 47 u16 mux_id;
45 u16 bus_width;
46 u16 flags; 48 u16 flags;
47}; 49};
48 50
49
50#define FIMC_MAX_CAMIF_CLIENTS 2
51
52/** 51/**
53 * struct s3c_platform_fimc - camera host interface platform data 52 * struct s5p_platform_fimc - camera host interface platform data
54 * 53 *
55 * @isp_info: properties of camera sensor required for host interface setup 54 * @isp_info: properties of camera sensor required for host interface setup
55 * @num_clients: the number of attached image sensors
56 */ 56 */
57struct s3c_platform_fimc { 57struct s5p_platform_fimc {
58 struct s3c_fimc_isp_info *isp_info[FIMC_MAX_CAMIF_CLIENTS]; 58 struct s5p_fimc_isp_info *isp_info;
59 int num_clients;
59}; 60};
60#endif /* S3C_FIMC_H_ */ 61#endif /* S5P_FIMC_H_ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 9386db829fb7..f80b5372baf3 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -17,6 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <media/videobuf-core.h> 19#include <media/videobuf-core.h>
20#include <media/videobuf2-core.h>
20#include <media/v4l2-device.h> 21#include <media/v4l2-device.h>
21 22
22extern struct bus_type soc_camera_bus_type; 23extern struct bus_type soc_camera_bus_type;
@@ -29,6 +30,8 @@ struct soc_camera_device {
29 struct device *pdev; /* Platform device */ 30 struct device *pdev; /* Platform device */
30 s32 user_width; 31 s32 user_width;
31 s32 user_height; 32 s32 user_height;
33 u32 bytesperline; /* for padding, zero if unused */
34 u32 sizeimage;
32 enum v4l2_colorspace colorspace; 35 enum v4l2_colorspace colorspace;
33 unsigned char iface; /* Host number */ 36 unsigned char iface; /* Host number */
34 unsigned char devnum; /* Device number per host */ 37 unsigned char devnum; /* Device number per host */
@@ -44,7 +47,10 @@ struct soc_camera_device {
44 int use_count; 47 int use_count;
45 struct mutex video_lock; /* Protects device data */ 48 struct mutex video_lock; /* Protects device data */
46 struct file *streamer; /* stream owner */ 49 struct file *streamer; /* stream owner */
47 struct videobuf_queue vb_vidq; 50 union {
51 struct videobuf_queue vb_vidq;
52 struct vb2_queue vb2_vidq;
53 };
48}; 54};
49 55
50struct soc_camera_host { 56struct soc_camera_host {
@@ -78,6 +84,8 @@ struct soc_camera_host_ops {
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 84 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 85 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 86 struct soc_camera_device *);
87 int (*init_videobuf2)(struct vb2_queue *,
88 struct soc_camera_device *);
81 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *); 89 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
82 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 90 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
83 int (*set_bus_param)(struct soc_camera_device *, __u32); 91 int (*set_bus_param)(struct soc_camera_device *, __u32);
@@ -85,6 +93,7 @@ struct soc_camera_host_ops {
85 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); 93 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
86 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 94 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
87 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 95 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
96 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
88 unsigned int (*poll)(struct file *, poll_table *); 97 unsigned int (*poll)(struct file *, poll_table *);
89 const struct v4l2_queryctrl *controls; 98 const struct v4l2_queryctrl *controls;
90 int num_controls; 99 int num_controls;
@@ -299,4 +308,17 @@ static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *cli
299 return icd->vdev; 308 return icd->vdev;
300} 309}
301 310
311static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq)
312{
313 return container_of(vq, struct soc_camera_device, vb2_vidq);
314}
315
316static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq)
317{
318 return container_of(vq, struct soc_camera_device, vb_vidq);
319}
320
321void soc_camera_lock(struct vb2_queue *vq);
322void soc_camera_unlock(struct vb2_queue *vq);
323
302#endif 324#endif
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 037cd7be001e..b338108ec305 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -12,8 +12,7 @@
12#define SOC_MEDIABUS_H 12#define SOC_MEDIABUS_H
13 13
14#include <linux/videodev2.h> 14#include <linux/videodev2.h>
15 15#include <linux/v4l2-mediabus.h>
16#include <media/v4l2-mediabus.h>
17 16
18/** 17/**
19 * enum soc_mbus_packing - data packing types on the media-bus 18 * enum soc_mbus_packing - data packing types on the media-bus
@@ -61,5 +60,6 @@ struct soc_mbus_pixelfmt {
61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 60const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
62 enum v4l2_mbus_pixelcode code); 61 enum v4l2_mbus_pixelcode code);
63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 62s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
63int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf);
64 64
65#endif 65#endif
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 51811eac46f1..963e33471835 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _TUNER_H 22#ifndef _TUNER_H
23#define _TUNER_H 23#define _TUNER_H
24#ifdef __KERNEL__
24 25
25#include <linux/videodev2.h> 26#include <linux/videodev2.h>
26 27
@@ -131,6 +132,7 @@
131#define TUNER_NXP_TDA18271 83 132#define TUNER_NXP_TDA18271 83
132#define TUNER_SONY_BTF_PXN01Z 84 133#define TUNER_SONY_BTF_PXN01Z 84
133#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */ 134#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */
135#define TUNER_TENA_TNF_5337 86
134 136
135/* tv card specific */ 137/* tv card specific */
136#define TDA9887_PRESENT (1<<0) 138#define TDA9887_PRESENT (1<<0)
@@ -156,14 +158,10 @@
156#define TDA9887_GAIN_NORMAL (1<<20) 158#define TDA9887_GAIN_NORMAL (1<<20)
157#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */ 159#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */
158 160
159#ifdef __KERNEL__
160
161enum tuner_mode { 161enum tuner_mode {
162 T_UNINITIALIZED = 0,
163 T_RADIO = 1 << V4L2_TUNER_RADIO, 162 T_RADIO = 1 << V4L2_TUNER_RADIO,
164 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV, 163 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV,
165 T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV, 164 /* Don't need to map V4L2_TUNER_DIGITAL_TV, as tuner-core won't use it */
166 T_STANDBY = 1 << 31
167}; 165};
168 166
169/* Older boards only had a single tuner device. Nowadays multiple tuner 167/* Older boards only had a single tuner device. Nowadays multiple tuner
@@ -193,11 +191,3 @@ struct tuner_setup {
193#endif /* __KERNEL__ */ 191#endif /* __KERNEL__ */
194 192
195#endif /* _TUNER_H */ 193#endif /* _TUNER_H */
196
197/*
198 * Overrides for Emacs so that we follow Linus's tabbing style.
199 * ---------------------------------------------------------------------------
200 * Local variables:
201 * c-basic-offset: 8
202 * End:
203 */
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 44fe44ec9ea7..b3edb67a8311 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -75,6 +75,7 @@ enum {
75 V4L2_IDENT_OV9640 = 257, 75 V4L2_IDENT_OV9640 = 257,
76 V4L2_IDENT_OV6650 = 258, 76 V4L2_IDENT_OV6650 = 258,
77 V4L2_IDENT_OV2640 = 259, 77 V4L2_IDENT_OV2640 = 259,
78 V4L2_IDENT_OV9740 = 260,
78 79
79 /* module saa7146: reserved range 300-309 */ 80 /* module saa7146: reserved range 300-309 */
80 V4L2_IDENT_SAA7146 = 300, 81 V4L2_IDENT_SAA7146 = 300,
@@ -209,6 +210,9 @@ enum {
209 /* module sn9c20x: just ident 10000 */ 210 /* module sn9c20x: just ident 10000 */
210 V4L2_IDENT_SN9C20X = 10000, 211 V4L2_IDENT_SN9C20X = 10000,
211 212
213 /* Siliconfile sensors: reserved range 10100 - 10199 */
214 V4L2_IDENT_NOON010PC30 = 10100,
215
212 /* module cx231xx and cx25840 */ 216 /* module cx231xx and cx25840 */
213 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */ 217 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
214 V4L2_IDENT_CX23100 = 23100, 218 V4L2_IDENT_CX23100 = 23100,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a659319e8582..a298ec49ddc4 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -80,21 +80,6 @@
80 80
81/* ------------------------------------------------------------------------- */ 81/* ------------------------------------------------------------------------- */
82 82
83/* Priority helper functions */
84
85struct v4l2_prio_state {
86 atomic_t prios[4];
87};
88void v4l2_prio_init(struct v4l2_prio_state *global);
89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
90 enum v4l2_priority new);
91void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
92void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
95
96/* ------------------------------------------------------------------------- */
97
98/* Control helper functions */ 83/* Control helper functions */
99 84
100int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 85int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 15802a067a12..8266d5ade2ff 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -16,12 +16,15 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18 18
19#include <media/media-entity.h>
20
19#define VIDEO_MAJOR 81 21#define VIDEO_MAJOR 81
20 22
21#define VFL_TYPE_GRABBER 0 23#define VFL_TYPE_GRABBER 0
22#define VFL_TYPE_VBI 1 24#define VFL_TYPE_VBI 1
23#define VFL_TYPE_RADIO 2 25#define VFL_TYPE_RADIO 2
24#define VFL_TYPE_MAX 3 26#define VFL_TYPE_SUBDEV 3
27#define VFL_TYPE_MAX 4
25 28
26struct v4l2_ioctl_callbacks; 29struct v4l2_ioctl_callbacks;
27struct video_device; 30struct video_device;
@@ -32,7 +35,25 @@ struct v4l2_ctrl_handler;
32 Drivers can clear this flag if they want to block all future 35 Drivers can clear this flag if they want to block all future
33 device access. It is cleared by video_unregister_device. */ 36 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_REGISTERED (0) 37#define V4L2_FL_REGISTERED (0)
38/* file->private_data points to struct v4l2_fh */
35#define V4L2_FL_USES_V4L2_FH (1) 39#define V4L2_FL_USES_V4L2_FH (1)
40/* Use the prio field of v4l2_fh for core priority checking */
41#define V4L2_FL_USE_FH_PRIO (2)
42
43/* Priority helper functions */
44
45struct v4l2_prio_state {
46 atomic_t prios[4];
47};
48
49void v4l2_prio_init(struct v4l2_prio_state *global);
50int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
51 enum v4l2_priority new);
52void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
53void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
54enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
55int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
56
36 57
37struct v4l2_file_operations { 58struct v4l2_file_operations {
38 struct module *owner; 59 struct module *owner;
@@ -54,6 +75,9 @@ struct v4l2_file_operations {
54 75
55struct video_device 76struct video_device
56{ 77{
78#if defined(CONFIG_MEDIA_CONTROLLER)
79 struct media_entity entity;
80#endif
57 /* device ops */ 81 /* device ops */
58 const struct v4l2_file_operations *fops; 82 const struct v4l2_file_operations *fops;
59 83
@@ -68,6 +92,9 @@ struct video_device
68 /* Control handler associated with this device node. May be NULL. */ 92 /* Control handler associated with this device node. May be NULL. */
69 struct v4l2_ctrl_handler *ctrl_handler; 93 struct v4l2_ctrl_handler *ctrl_handler;
70 94
95 /* Priority state. If NULL, then v4l2_dev->prio will be used. */
96 struct v4l2_prio_state *prio;
97
71 /* device info */ 98 /* device info */
72 char name[32]; 99 char name[32];
73 int vfl_type; 100 int vfl_type;
@@ -99,18 +126,31 @@ struct video_device
99 struct mutex *lock; 126 struct mutex *lock;
100}; 127};
101 128
129#define media_entity_to_video_device(entity) \
130 container_of(entity, struct video_device, entity)
102/* dev to video-device */ 131/* dev to video-device */
103#define to_video_device(cd) container_of(cd, struct video_device, dev) 132#define to_video_device(cd) container_of(cd, struct video_device, dev)
104 133
134int __must_check __video_register_device(struct video_device *vdev, int type,
135 int nr, int warn_if_nr_in_use, struct module *owner);
136
105/* Register video devices. Note that if video_register_device fails, 137/* Register video devices. Note that if video_register_device fails,
106 the release() callback of the video_device structure is *not* called, so 138 the release() callback of the video_device structure is *not* called, so
107 the caller is responsible for freeing any data. Usually that means that 139 the caller is responsible for freeing any data. Usually that means that
108 you call video_device_release() on failure. */ 140 you call video_device_release() on failure. */
109int __must_check video_register_device(struct video_device *vdev, int type, int nr); 141static inline int __must_check video_register_device(struct video_device *vdev,
142 int type, int nr)
143{
144 return __video_register_device(vdev, type, nr, 1, vdev->fops->owner);
145}
110 146
111/* Same as video_register_device, but no warning is issued if the desired 147/* Same as video_register_device, but no warning is issued if the desired
112 device node number was already in use. */ 148 device node number was already in use. */
113int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); 149static inline int __must_check video_register_device_no_warn(
150 struct video_device *vdev, int type, int nr)
151{
152 return __video_register_device(vdev, type, nr, 0, vdev->fops->owner);
153}
114 154
115/* Unregister video devices. Will do nothing if vdev == NULL or 155/* Unregister video devices. Will do nothing if vdev == NULL or
116 video_is_registered() returns false. */ 156 video_is_registered() returns false. */
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index b16f307d471a..bd102cf509ac 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -21,7 +21,9 @@
21#ifndef _V4L2_DEVICE_H 21#ifndef _V4L2_DEVICE_H
22#define _V4L2_DEVICE_H 22#define _V4L2_DEVICE_H
23 23
24#include <media/media-device.h>
24#include <media/v4l2-subdev.h> 25#include <media/v4l2-subdev.h>
26#include <media/v4l2-dev.h>
25 27
26/* Each instance of a V4L2 device should create the v4l2_device struct, 28/* Each instance of a V4L2 device should create the v4l2_device struct,
27 either stand-alone or embedded in a larger struct. 29 either stand-alone or embedded in a larger struct.
@@ -39,6 +41,9 @@ struct v4l2_device {
39 Note: dev might be NULL if there is no parent device 41 Note: dev might be NULL if there is no parent device
40 as is the case with e.g. ISA devices. */ 42 as is the case with e.g. ISA devices. */
41 struct device *dev; 43 struct device *dev;
44#if defined(CONFIG_MEDIA_CONTROLLER)
45 struct media_device *mdev;
46#endif
42 /* used to keep track of the registered subdevs */ 47 /* used to keep track of the registered subdevs */
43 struct list_head subdevs; 48 struct list_head subdevs;
44 /* lock this struct; can be used by the driver as well if this 49 /* lock this struct; can be used by the driver as well if this
@@ -51,10 +56,23 @@ struct v4l2_device {
51 unsigned int notification, void *arg); 56 unsigned int notification, void *arg);
52 /* The control handler. May be NULL. */ 57 /* The control handler. May be NULL. */
53 struct v4l2_ctrl_handler *ctrl_handler; 58 struct v4l2_ctrl_handler *ctrl_handler;
59 /* Device's priority state */
60 struct v4l2_prio_state prio;
54 /* BKL replacement mutex. Temporary solution only. */ 61 /* BKL replacement mutex. Temporary solution only. */
55 struct mutex ioctl_lock; 62 struct mutex ioctl_lock;
63 /* Keep track of the references to this struct. */
64 struct kref ref;
65 /* Release function that is called when the ref count goes to 0. */
66 void (*release)(struct v4l2_device *v4l2_dev);
56}; 67};
57 68
69static inline void v4l2_device_get(struct v4l2_device *v4l2_dev)
70{
71 kref_get(&v4l2_dev->ref);
72}
73
74int v4l2_device_put(struct v4l2_device *v4l2_dev);
75
58/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. 76/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
59 dev may be NULL in rare cases (ISA devices). In that case you 77 dev may be NULL in rare cases (ISA devices). In that case you
60 must fill in the v4l2_dev->name field before calling this function. */ 78 must fill in the v4l2_dev->name field before calling this function. */
@@ -96,6 +114,12 @@ int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
96 wasn't registered. In that case it will do nothing. */ 114 wasn't registered. In that case it will do nothing. */
97void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); 115void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
98 116
117/* Register device nodes for all subdev of the v4l2 device that are marked with
118 * the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
119 */
120int __must_check
121v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
122
99/* Iterate over all subdevs. */ 123/* Iterate over all subdevs. */
100#define v4l2_device_for_each_subdev(sd, v4l2_dev) \ 124#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
101 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) 125 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 1d72dde320bf..0206aa55be24 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -35,6 +35,7 @@ struct v4l2_fh {
35 struct list_head list; 35 struct list_head list;
36 struct video_device *vdev; 36 struct video_device *vdev;
37 struct v4l2_events *events; /* events, pending and subscribed */ 37 struct v4l2_events *events; /* events, pending and subscribed */
38 enum v4l2_priority prio;
38}; 39};
39 40
40/* 41/*
@@ -50,8 +51,16 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
50 */ 51 */
51void v4l2_fh_add(struct v4l2_fh *fh); 52void v4l2_fh_add(struct v4l2_fh *fh);
52/* 53/*
54 * Can be used as the open() op of v4l2_file_operations.
55 * It allocates a v4l2_fh and inits and adds it to the video_device associated
56 * with the file pointer.
57 */
58int v4l2_fh_open(struct file *filp);
59/*
53 * Remove file handle from the list of file handles. Must be called in 60 * Remove file handle from the list of file handles. Must be called in
54 * v4l2_file_operations->release() handler if the driver uses v4l2_fh. 61 * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
62 * On error filp->private_data will be NULL, otherwise it will point to
63 * the v4l2_fh struct.
55 */ 64 */
56void v4l2_fh_del(struct v4l2_fh *fh); 65void v4l2_fh_del(struct v4l2_fh *fh);
57/* 66/*
@@ -61,5 +70,25 @@ void v4l2_fh_del(struct v4l2_fh *fh);
61 * driver uses v4l2_fh. 70 * driver uses v4l2_fh.
62 */ 71 */
63void v4l2_fh_exit(struct v4l2_fh *fh); 72void v4l2_fh_exit(struct v4l2_fh *fh);
73/*
74 * Can be used as the release() op of v4l2_file_operations.
75 * It deletes and exits the v4l2_fh associated with the file pointer and
76 * frees it. It will do nothing if filp->private_data (the pointer to the
77 * v4l2_fh struct) is NULL. This function always returns 0.
78 */
79int v4l2_fh_release(struct file *filp);
80/*
81 * Returns 1 if this filehandle is the only filehandle opened for the
82 * associated video_device. If fh is NULL, then it returns 0.
83 */
84int v4l2_fh_is_singular(struct v4l2_fh *fh);
85/*
86 * Helper function with struct file as argument. If filp->private_data is
87 * NULL, then it will return 0.
88 */
89static inline int v4l2_fh_is_singular_file(struct file *filp)
90{
91 return v4l2_fh_is_singular(filp->private_data);
92}
64 93
65#endif /* V4L2_EVENT_H */ 94#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 67df37542c68..dd9f1e7b8ff7 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -37,6 +37,10 @@ struct v4l2_ioctl_ops {
37 struct v4l2_fmtdesc *f); 37 struct v4l2_fmtdesc *f);
38 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, 38 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
39 struct v4l2_fmtdesc *f); 39 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh,
41 struct v4l2_fmtdesc *f);
42 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
43 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 44 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
41 struct v4l2_fmtdesc *f); 45 struct v4l2_fmtdesc *f);
42 46
@@ -57,6 +61,10 @@ struct v4l2_ioctl_ops {
57 struct v4l2_format *f); 61 struct v4l2_format *f);
58 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, 62 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
59 struct v4l2_format *f); 63 struct v4l2_format *f);
64 int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
65 struct v4l2_format *f);
66 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
67 struct v4l2_format *f);
60 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, 68 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
61 struct v4l2_format *f); 69 struct v4l2_format *f);
62 70
@@ -77,6 +85,10 @@ struct v4l2_ioctl_ops {
77 struct v4l2_format *f); 85 struct v4l2_format *f);
78 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, 86 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
79 struct v4l2_format *f); 87 struct v4l2_format *f);
88 int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
89 struct v4l2_format *f);
90 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
91 struct v4l2_format *f);
80 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, 92 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
81 struct v4l2_format *f); 93 struct v4l2_format *f);
82 94
@@ -97,6 +109,10 @@ struct v4l2_ioctl_ops {
97 struct v4l2_format *f); 109 struct v4l2_format *f);
98 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, 110 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
99 struct v4l2_format *f); 111 struct v4l2_format *f);
112 int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
113 struct v4l2_format *f);
114 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
115 struct v4l2_format *f);
100 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, 116 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
101 struct v4l2_format *f); 117 struct v4l2_format *f);
102 118
@@ -254,7 +270,7 @@ struct v4l2_ioctl_ops {
254 270
255 /* For other private ioctls */ 271 /* For other private ioctls */
256 long (*vidioc_default) (struct file *file, void *fh, 272 long (*vidioc_default) (struct file *file, void *fh,
257 int cmd, void *arg); 273 bool valid_prio, int cmd, void *arg);
258}; 274};
259 275
260 276
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 8e6559838ae3..971c7fa29614 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -11,66 +11,7 @@
11#ifndef V4L2_MEDIABUS_H 11#ifndef V4L2_MEDIABUS_H
12#define V4L2_MEDIABUS_H 12#define V4L2_MEDIABUS_H
13 13
14/* 14#include <linux/v4l2-mediabus.h>
15 * These pixel codes uniquely identify data formats on the media bus. Mostly
16 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
17 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
18 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
19 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
20 * transferred over the bus: "LE" means that the least significant bits are
21 * transferred first, "BE" means that the most significant bits are transferred
22 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
23 * incomplete high byte, are filled with padding bits.
24 */
25enum v4l2_mbus_pixelcode {
26 V4L2_MBUS_FMT_FIXED = 1,
27 V4L2_MBUS_FMT_YUYV8_2X8,
28 V4L2_MBUS_FMT_YVYU8_2X8,
29 V4L2_MBUS_FMT_UYVY8_2X8,
30 V4L2_MBUS_FMT_VYUY8_2X8,
31 V4L2_MBUS_FMT_YVYU10_2X10,
32 V4L2_MBUS_FMT_YUYV10_2X10,
33 V4L2_MBUS_FMT_YVYU10_1X20,
34 V4L2_MBUS_FMT_YUYV10_1X20,
35 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
36 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE,
37 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
38 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
39 V4L2_MBUS_FMT_RGB565_2X8_LE,
40 V4L2_MBUS_FMT_RGB565_2X8_BE,
41 V4L2_MBUS_FMT_BGR565_2X8_LE,
42 V4L2_MBUS_FMT_BGR565_2X8_BE,
43 V4L2_MBUS_FMT_SBGGR8_1X8,
44 V4L2_MBUS_FMT_SBGGR10_1X10,
45 V4L2_MBUS_FMT_GREY8_1X8,
46 V4L2_MBUS_FMT_Y10_1X10,
47 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
48 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
49 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
50 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
51 V4L2_MBUS_FMT_SGRBG8_1X8,
52 V4L2_MBUS_FMT_SBGGR12_1X12,
53 V4L2_MBUS_FMT_YUYV8_1_5X8,
54 V4L2_MBUS_FMT_YVYU8_1_5X8,
55 V4L2_MBUS_FMT_UYVY8_1_5X8,
56 V4L2_MBUS_FMT_VYUY8_1_5X8,
57};
58
59/**
60 * struct v4l2_mbus_framefmt - frame format on the media bus
61 * @width: frame width
62 * @height: frame height
63 * @code: data format code
64 * @field: used interlacing type
65 * @colorspace: colorspace of the data
66 */
67struct v4l2_mbus_framefmt {
68 __u32 width;
69 __u32 height;
70 enum v4l2_mbus_pixelcode code;
71 enum v4l2_field field;
72 enum v4l2_colorspace colorspace;
73};
74 15
75static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, 16static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
76 const struct v4l2_mbus_framefmt *mbus_fmt) 17 const struct v4l2_mbus_framefmt *mbus_fmt)
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 8d149f1c58d0..16ac4733e80d 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -5,7 +5,7 @@
5 * and destination. 5 * and destination.
6 * 6 *
7 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
8 * Pawel Osciak, <p.osciak@samsung.com> 8 * Pawel Osciak, <pawel@osciak.com>
9 * Marek Szyprowski, <m.szyprowski@samsung.com> 9 * Marek Szyprowski, <m.szyprowski@samsung.com>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
17#ifndef _MEDIA_V4L2_MEM2MEM_H 17#ifndef _MEDIA_V4L2_MEM2MEM_H
18#define _MEDIA_V4L2_MEM2MEM_H 18#define _MEDIA_V4L2_MEM2MEM_H
19 19
20#include <media/videobuf-core.h> 20#include <media/videobuf2-core.h>
21 21
22/** 22/**
23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks 23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks
@@ -45,17 +45,20 @@ struct v4l2_m2m_ops {
45 void (*device_run)(void *priv); 45 void (*device_run)(void *priv);
46 int (*job_ready)(void *priv); 46 int (*job_ready)(void *priv);
47 void (*job_abort)(void *priv); 47 void (*job_abort)(void *priv);
48 void (*lock)(void *priv);
49 void (*unlock)(void *priv);
48}; 50};
49 51
50struct v4l2_m2m_dev; 52struct v4l2_m2m_dev;
51 53
52struct v4l2_m2m_queue_ctx { 54struct v4l2_m2m_queue_ctx {
53/* private: internal use only */ 55/* private: internal use only */
54 struct videobuf_queue q; 56 struct vb2_queue q;
55 57
56 /* Queue for buffers ready to be processed as soon as this 58 /* Queue for buffers ready to be processed as soon as this
57 * instance receives access to the device */ 59 * instance receives access to the device */
58 struct list_head rdy_queue; 60 struct list_head rdy_queue;
61 spinlock_t rdy_spinlock;
59 u8 num_rdy; 62 u8 num_rdy;
60}; 63};
61 64
@@ -72,19 +75,31 @@ struct v4l2_m2m_ctx {
72 /* For device job queue */ 75 /* For device job queue */
73 struct list_head queue; 76 struct list_head queue;
74 unsigned long job_flags; 77 unsigned long job_flags;
78 wait_queue_head_t finished;
75 79
76 /* Instance private data */ 80 /* Instance private data */
77 void *priv; 81 void *priv;
78}; 82};
79 83
84struct v4l2_m2m_buffer {
85 struct vb2_buffer vb;
86 struct list_head list;
87};
88
80void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); 89void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
81 90
82struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, 91struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
83 enum v4l2_buf_type type); 92 enum v4l2_buf_type type);
84 93
85void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, 94void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
86 struct v4l2_m2m_ctx *m2m_ctx); 95 struct v4l2_m2m_ctx *m2m_ctx);
87 96
97static inline void
98v4l2_m2m_buf_done(struct vb2_buffer *buf, enum vb2_buffer_state state)
99{
100 vb2_buffer_done(buf, state);
101}
102
88int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 103int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
89 struct v4l2_requestbuffers *reqbufs); 104 struct v4l2_requestbuffers *reqbufs);
90 105
@@ -110,13 +125,13 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
110struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops); 125struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops);
111void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); 126void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
112 127
113struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev, 128struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
114 void (*vq_init)(void *priv, struct videobuf_queue *, 129 void *drv_priv,
115 enum v4l2_buf_type)); 130 int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq));
131
116void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); 132void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
117 133
118void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq, 134void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);
119 struct videobuf_buffer *vb);
120 135
121/** 136/**
122 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for 137 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
@@ -138,7 +153,7 @@ unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
138 return m2m_ctx->out_q_ctx.num_rdy; 153 return m2m_ctx->out_q_ctx.num_rdy;
139} 154}
140 155
141void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); 156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx);
142 157
143/** 158/**
144 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready 159 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
@@ -146,7 +161,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type);
146 */ 161 */
147static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) 162static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
148{ 163{
149 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 164 return v4l2_m2m_next_buf(&m2m_ctx->out_q_ctx);
150} 165}
151 166
152/** 167/**
@@ -155,29 +170,28 @@ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
155 */ 170 */
156static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) 171static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
157{ 172{
158 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 173 return v4l2_m2m_next_buf(&m2m_ctx->cap_q_ctx);
159} 174}
160 175
161/** 176/**
162 * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers 177 * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers
163 */ 178 */
164static inline 179static inline
165struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) 180struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
166{ 181{
167 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 182 return &m2m_ctx->out_q_ctx.q;
168} 183}
169 184
170/** 185/**
171 * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers 186 * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers
172 */ 187 */
173static inline 188static inline
174struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) 189struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
175{ 190{
176 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 191 return &m2m_ctx->cap_q_ctx.q;
177} 192}
178 193
179void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx, 194void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx);
180 enum v4l2_buf_type type);
181 195
182/** 196/**
183 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready 197 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
@@ -185,7 +199,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx,
185 */ 199 */
186static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 200static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
187{ 201{
188 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 202 return v4l2_m2m_buf_remove(&m2m_ctx->out_q_ctx);
189} 203}
190 204
191/** 205/**
@@ -194,7 +208,7 @@ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
194 */ 208 */
195static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 209static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
196{ 210{
197 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 211 return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx);
198} 212}
199 213
200#endif /* _MEDIA_V4L2_MEM2MEM_H */ 214#endif /* _MEDIA_V4L2_MEM2MEM_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index daf1e57d9b26..1562c4ff3a65 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -21,7 +21,11 @@
21#ifndef _V4L2_SUBDEV_H 21#ifndef _V4L2_SUBDEV_H
22#define _V4L2_SUBDEV_H 22#define _V4L2_SUBDEV_H
23 23
24#include <linux/v4l2-subdev.h>
25#include <media/media-entity.h>
24#include <media/v4l2-common.h> 26#include <media/v4l2-common.h>
27#include <media/v4l2-dev.h>
28#include <media/v4l2-fh.h>
25#include <media/v4l2-mediabus.h> 29#include <media/v4l2-mediabus.h>
26 30
27/* generic v4l2_device notify callback notification values */ 31/* generic v4l2_device notify callback notification values */
@@ -36,7 +40,10 @@
36 40
37struct v4l2_device; 41struct v4l2_device;
38struct v4l2_ctrl_handler; 42struct v4l2_ctrl_handler;
43struct v4l2_event_subscription;
44struct v4l2_fh;
39struct v4l2_subdev; 45struct v4l2_subdev;
46struct v4l2_subdev_fh;
40struct tuner_setup; 47struct tuner_setup;
41 48
42/* decode_vbi_line */ 49/* decode_vbi_line */
@@ -160,6 +167,10 @@ struct v4l2_subdev_core_ops {
160 int (*s_power)(struct v4l2_subdev *sd, int on); 167 int (*s_power)(struct v4l2_subdev *sd, int on);
161 int (*interrupt_service_routine)(struct v4l2_subdev *sd, 168 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
162 u32 status, bool *handled); 169 u32 status, bool *handled);
170 int (*subscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
171 struct v4l2_event_subscription *sub);
172 int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
173 struct v4l2_event_subscription *sub);
163}; 174};
164 175
165/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 176/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -257,6 +268,10 @@ struct v4l2_subdev_video_ops {
257 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 268 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
258 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 269 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
259 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 270 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
271 int (*g_frame_interval)(struct v4l2_subdev *sd,
272 struct v4l2_subdev_frame_interval *interval);
273 int (*s_frame_interval)(struct v4l2_subdev *sd,
274 struct v4l2_subdev_frame_interval *interval);
260 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 275 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
261 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 276 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
262 int (*enum_dv_presets) (struct v4l2_subdev *sd, 277 int (*enum_dv_presets) (struct v4l2_subdev *sd,
@@ -271,6 +286,8 @@ struct v4l2_subdev_video_ops {
271 struct v4l2_dv_timings *timings); 286 struct v4l2_dv_timings *timings);
272 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 287 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
273 enum v4l2_mbus_pixelcode *code); 288 enum v4l2_mbus_pixelcode *code);
289 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
290 struct v4l2_frmsizeenum *fsize);
274 int (*g_mbus_fmt)(struct v4l2_subdev *sd, 291 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
275 struct v4l2_mbus_framefmt *fmt); 292 struct v4l2_mbus_framefmt *fmt);
276 int (*try_mbus_fmt)(struct v4l2_subdev *sd, 293 int (*try_mbus_fmt)(struct v4l2_subdev *sd,
@@ -324,9 +341,13 @@ struct v4l2_subdev_vbi_ops {
324 * This is needed for some sensors, which always corrupt 341 * This is needed for some sensors, which always corrupt
325 * several top lines of the output image, or which send their 342 * several top lines of the output image, or which send their
326 * metadata in them. 343 * metadata in them.
344 * @g_skip_frames: number of frames to skip at stream start. This is needed for
345 * buggy sensors that generate faulty frames when they are
346 * turned on.
327 */ 347 */
328struct v4l2_subdev_sensor_ops { 348struct v4l2_subdev_sensor_ops {
329 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines); 349 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
350 int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
330}; 351};
331 352
332/* 353/*
@@ -401,6 +422,25 @@ struct v4l2_subdev_ir_ops {
401 struct v4l2_subdev_ir_parameters *params); 422 struct v4l2_subdev_ir_parameters *params);
402}; 423};
403 424
425struct v4l2_subdev_pad_ops {
426 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
427 struct v4l2_subdev_mbus_code_enum *code);
428 int (*enum_frame_size)(struct v4l2_subdev *sd,
429 struct v4l2_subdev_fh *fh,
430 struct v4l2_subdev_frame_size_enum *fse);
431 int (*enum_frame_interval)(struct v4l2_subdev *sd,
432 struct v4l2_subdev_fh *fh,
433 struct v4l2_subdev_frame_interval_enum *fie);
434 int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
435 struct v4l2_subdev_format *format);
436 int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
437 struct v4l2_subdev_format *format);
438 int (*set_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
439 struct v4l2_subdev_crop *crop);
440 int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
441 struct v4l2_subdev_crop *crop);
442};
443
404struct v4l2_subdev_ops { 444struct v4l2_subdev_ops {
405 const struct v4l2_subdev_core_ops *core; 445 const struct v4l2_subdev_core_ops *core;
406 const struct v4l2_subdev_tuner_ops *tuner; 446 const struct v4l2_subdev_tuner_ops *tuner;
@@ -409,6 +449,7 @@ struct v4l2_subdev_ops {
409 const struct v4l2_subdev_vbi_ops *vbi; 449 const struct v4l2_subdev_vbi_ops *vbi;
410 const struct v4l2_subdev_ir_ops *ir; 450 const struct v4l2_subdev_ir_ops *ir;
411 const struct v4l2_subdev_sensor_ops *sensor; 451 const struct v4l2_subdev_sensor_ops *sensor;
452 const struct v4l2_subdev_pad_ops *pad;
412}; 453};
413 454
414/* 455/*
@@ -420,23 +461,36 @@ struct v4l2_subdev_ops {
420 * 461 *
421 * unregistered: called when this subdev is unregistered. When called the 462 * unregistered: called when this subdev is unregistered. When called the
422 * v4l2_dev field is still set to the correct v4l2_device. 463 * v4l2_dev field is still set to the correct v4l2_device.
464 *
465 * open: called when the subdev device node is opened by an application.
466 *
467 * close: called when the subdev device node is closed.
423 */ 468 */
424struct v4l2_subdev_internal_ops { 469struct v4l2_subdev_internal_ops {
425 int (*registered)(struct v4l2_subdev *sd); 470 int (*registered)(struct v4l2_subdev *sd);
426 void (*unregistered)(struct v4l2_subdev *sd); 471 void (*unregistered)(struct v4l2_subdev *sd);
472 int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
473 int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
427}; 474};
428 475
429#define V4L2_SUBDEV_NAME_SIZE 32 476#define V4L2_SUBDEV_NAME_SIZE 32
430 477
431/* Set this flag if this subdev is a i2c device. */ 478/* Set this flag if this subdev is a i2c device. */
432#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) 479#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
433/* Set this flag if this subdev is a spi device. */ 480/* Set this flag if this subdev is a spi device. */
434#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) 481#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
482/* Set this flag if this subdev needs a device node. */
483#define V4L2_SUBDEV_FL_HAS_DEVNODE (1U << 2)
484/* Set this flag if this subdev generates events. */
485#define V4L2_SUBDEV_FL_HAS_EVENTS (1U << 3)
435 486
436/* Each instance of a subdev driver should create this struct, either 487/* Each instance of a subdev driver should create this struct, either
437 stand-alone or embedded in a larger struct. 488 stand-alone or embedded in a larger struct.
438 */ 489 */
439struct v4l2_subdev { 490struct v4l2_subdev {
491#if defined(CONFIG_MEDIA_CONTROLLER)
492 struct media_entity entity;
493#endif
440 struct list_head list; 494 struct list_head list;
441 struct module *owner; 495 struct module *owner;
442 u32 flags; 496 u32 flags;
@@ -453,8 +507,47 @@ struct v4l2_subdev {
453 /* pointer to private data */ 507 /* pointer to private data */
454 void *dev_priv; 508 void *dev_priv;
455 void *host_priv; 509 void *host_priv;
510 /* subdev device node */
511 struct video_device devnode;
512 /* number of events to be allocated on open */
513 unsigned int nevents;
514};
515
516#define media_entity_to_v4l2_subdev(ent) \
517 container_of(ent, struct v4l2_subdev, entity)
518#define vdev_to_v4l2_subdev(vdev) \
519 container_of(vdev, struct v4l2_subdev, devnode)
520
521/*
522 * Used for storing subdev information per file handle
523 */
524struct v4l2_subdev_fh {
525 struct v4l2_fh vfh;
526#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
527 struct v4l2_mbus_framefmt *try_fmt;
528 struct v4l2_rect *try_crop;
529#endif
456}; 530};
457 531
532#define to_v4l2_subdev_fh(fh) \
533 container_of(fh, struct v4l2_subdev_fh, vfh)
534
535#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
536static inline struct v4l2_mbus_framefmt *
537v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad)
538{
539 return &fh->try_fmt[pad];
540}
541
542static inline struct v4l2_rect *
543v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad)
544{
545 return &fh->try_crop[pad];
546}
547#endif
548
549extern const struct v4l2_file_operations v4l2_subdev_fops;
550
458static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) 551static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p)
459{ 552{
460 sd->dev_priv = p; 553 sd->dev_priv = p;
@@ -475,20 +568,8 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd)
475 return sd->host_priv; 568 return sd->host_priv;
476} 569}
477 570
478static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 571void v4l2_subdev_init(struct v4l2_subdev *sd,
479 const struct v4l2_subdev_ops *ops) 572 const struct v4l2_subdev_ops *ops);
480{
481 INIT_LIST_HEAD(&sd->list);
482 /* ops->core MUST be set */
483 BUG_ON(!ops || !ops->core);
484 sd->ops = ops;
485 sd->v4l2_dev = NULL;
486 sd->flags = 0;
487 sd->name[0] = '\0';
488 sd->grp_id = 0;
489 sd->dev_priv = NULL;
490 sd->host_priv = NULL;
491}
492 573
493/* Call an ops of a v4l2_subdev, doing the right checks against 574/* Call an ops of a v4l2_subdev, doing the right checks against
494 NULL pointers. 575 NULL pointers.
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
new file mode 100644
index 000000000000..f87472acbc51
--- /dev/null
+++ b/include/media/videobuf2-core.h
@@ -0,0 +1,380 @@
1/*
2 * videobuf2-core.h - V4L2 driver helper framework
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12#ifndef _MEDIA_VIDEOBUF2_CORE_H
13#define _MEDIA_VIDEOBUF2_CORE_H
14
15#include <linux/mm_types.h>
16#include <linux/mutex.h>
17#include <linux/poll.h>
18#include <linux/videodev2.h>
19
20struct vb2_alloc_ctx;
21struct vb2_fileio_data;
22
23/**
24 * struct vb2_mem_ops - memory handling/memory allocator operations
25 * @alloc: allocate video memory and, optionally, allocator private data,
26 * return NULL on failure or a pointer to allocator private,
27 * per-buffer data on success; the returned private structure
28 * will then be passed as buf_priv argument to other ops in this
29 * structure
30 * @put: inform the allocator that the buffer will no longer be used;
31 * usually will result in the allocator freeing the buffer (if
32 * no other users of this buffer are present); the buf_priv
33 * argument is the allocator private per-buffer structure
34 * previously returned from the alloc callback
35 * @get_userptr: acquire userspace memory for a hardware operation; used for
36 * USERPTR memory types; vaddr is the address passed to the
37 * videobuf layer when queuing a video buffer of USERPTR type;
38 * should return an allocator private per-buffer structure
39 * associated with the buffer on success, NULL on failure;
40 * the returned private structure will then be passed as buf_priv
41 * argument to other ops in this structure
42 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
43 * be used
44 * @vaddr: return a kernel virtual address to a given memory buffer
45 * associated with the passed private structure or NULL if no
46 * such mapping exists
47 * @cookie: return allocator specific cookie for a given memory buffer
48 * associated with the passed private structure or NULL if not
49 * available
50 * @num_users: return the current number of users of a memory buffer;
51 * return 1 if the videobuf layer (or actually the driver using
52 * it) is the only user
53 * @mmap: setup a userspace mapping for a given memory buffer under
54 * the provided virtual memory region
55 *
56 * Required ops for USERPTR types: get_userptr, put_userptr.
57 * Required ops for MMAP types: alloc, put, num_users, mmap.
58 * Required ops for read/write access types: alloc, put, num_users, vaddr
59 */
60struct vb2_mem_ops {
61 void *(*alloc)(void *alloc_ctx, unsigned long size);
62 void (*put)(void *buf_priv);
63
64 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
65 unsigned long size, int write);
66 void (*put_userptr)(void *buf_priv);
67
68 void *(*vaddr)(void *buf_priv);
69 void *(*cookie)(void *buf_priv);
70
71 unsigned int (*num_users)(void *buf_priv);
72
73 int (*mmap)(void *buf_priv, struct vm_area_struct *vma);
74};
75
76struct vb2_plane {
77 void *mem_priv;
78 int mapped:1;
79};
80
81/**
82 * enum vb2_io_modes - queue access methods
83 * @VB2_MMAP: driver supports MMAP with streaming API
84 * @VB2_USERPTR: driver supports USERPTR with streaming API
85 * @VB2_READ: driver supports read() style access
86 * @VB2_WRITE: driver supports write() style access
87 */
88enum vb2_io_modes {
89 VB2_MMAP = (1 << 0),
90 VB2_USERPTR = (1 << 1),
91 VB2_READ = (1 << 2),
92 VB2_WRITE = (1 << 3),
93};
94
95/**
96 * enum vb2_fileio_flags - flags for selecting a mode of the file io emulator,
97 * by default the 'streaming' style is used by the file io emulator
98 * @VB2_FILEIO_READ_ONCE: report EOF after reading the first buffer
99 * @VB2_FILEIO_WRITE_IMMEDIATELY: queue buffer after each write() call
100 */
101enum vb2_fileio_flags {
102 VB2_FILEIO_READ_ONCE = (1 << 0),
103 VB2_FILEIO_WRITE_IMMEDIATELY = (1 << 1),
104};
105
106/**
107 * enum vb2_buffer_state - current video buffer state
108 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control
109 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver
110 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used
111 * in a hardware operation
112 * @VB2_BUF_STATE_DONE: buffer returned from driver to videobuf, but
113 * not yet dequeued to userspace
114 * @VB2_BUF_STATE_ERROR: same as above, but the operation on the buffer
115 * has ended with an error, which will be reported
116 * to the userspace when it is dequeued
117 */
118enum vb2_buffer_state {
119 VB2_BUF_STATE_DEQUEUED,
120 VB2_BUF_STATE_QUEUED,
121 VB2_BUF_STATE_ACTIVE,
122 VB2_BUF_STATE_DONE,
123 VB2_BUF_STATE_ERROR,
124};
125
126struct vb2_queue;
127
128/**
129 * struct vb2_buffer - represents a video buffer
130 * @v4l2_buf: struct v4l2_buffer associated with this buffer; can
131 * be read by the driver and relevant entries can be
132 * changed by the driver in case of CAPTURE types
133 * (such as timestamp)
134 * @v4l2_planes: struct v4l2_planes associated with this buffer; can
135 * be read by the driver and relevant entries can be
136 * changed by the driver in case of CAPTURE types
137 * (such as bytesused); NOTE that even for single-planar
138 * types, the v4l2_planes[0] struct should be used
139 * instead of v4l2_buf for filling bytesused - drivers
140 * should use the vb2_set_plane_payload() function for that
141 * @vb2_queue: the queue to which this driver belongs
142 * @num_planes: number of planes in the buffer
143 * on an internal driver queue
144 * @state: current buffer state; do not change
145 * @queued_entry: entry on the queued buffers list, which holds all
146 * buffers queued from userspace
147 * @done_entry: entry on the list that stores all buffers ready to
148 * be dequeued to userspace
149 * @planes: private per-plane information; do not change
150 * @num_planes_mapped: number of mapped planes; do not change
151 */
152struct vb2_buffer {
153 struct v4l2_buffer v4l2_buf;
154 struct v4l2_plane v4l2_planes[VIDEO_MAX_PLANES];
155
156 struct vb2_queue *vb2_queue;
157
158 unsigned int num_planes;
159
160/* Private: internal use only */
161 enum vb2_buffer_state state;
162
163 struct list_head queued_entry;
164 struct list_head done_entry;
165
166 struct vb2_plane planes[VIDEO_MAX_PLANES];
167 unsigned int num_planes_mapped;
168};
169
170/**
171 * struct vb2_ops - driver-specific callbacks
172 *
173 * @queue_setup: called from a VIDIOC_REQBUFS handler, before
174 * memory allocation; driver should return the required
175 * number of buffers in num_buffers, the required number
176 * of planes per buffer in num_planes; the size of each
177 * plane should be set in the sizes[] array and optional
178 * per-plane allocator specific context in alloc_ctxs[]
179 * array
180 * @wait_prepare: release any locks taken while calling vb2 functions;
181 * it is called before an ioctl needs to wait for a new
182 * buffer to arrive; required to avoid a deadlock in
183 * blocking access type
184 * @wait_finish: reacquire all locks released in the previous callback;
185 * required to continue operation after sleeping while
186 * waiting for a new buffer to arrive
187 * @buf_init: called once after allocating a buffer (in MMAP case)
188 * or after acquiring a new USERPTR buffer; drivers may
189 * perform additional buffer-related initialization;
190 * initialization failure (return != 0) will prevent
191 * queue setup from completing successfully; optional
192 * @buf_prepare: called every time the buffer is queued from userspace;
193 * drivers may perform any initialization required before
194 * each hardware operation in this callback;
195 * if an error is returned, the buffer will not be queued
196 * in driver; optional
197 * @buf_finish: called before every dequeue of the buffer back to
198 * userspace; drivers may perform any operations required
199 * before userspace accesses the buffer; optional
200 * @buf_cleanup: called once before the buffer is freed; drivers may
201 * perform any additional cleanup; optional
202 * @start_streaming: called once before entering 'streaming' state; enables
203 * driver to receive buffers over buf_queue() callback
204 * @stop_streaming: called when 'streaming' state must be disabled; driver
205 * should stop any DMA transactions or wait until they
206 * finish and give back all buffers it got from buf_queue()
207 * callback; may use vb2_wait_for_all_buffers() function
208 * @buf_queue: passes buffer vb to the driver; driver may start
209 * hardware operation on this buffer; driver should give
210 * the buffer back by calling vb2_buffer_done() function
211 */
212struct vb2_ops {
213 int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers,
214 unsigned int *num_planes, unsigned long sizes[],
215 void *alloc_ctxs[]);
216
217 void (*wait_prepare)(struct vb2_queue *q);
218 void (*wait_finish)(struct vb2_queue *q);
219
220 int (*buf_init)(struct vb2_buffer *vb);
221 int (*buf_prepare)(struct vb2_buffer *vb);
222 int (*buf_finish)(struct vb2_buffer *vb);
223 void (*buf_cleanup)(struct vb2_buffer *vb);
224
225 int (*start_streaming)(struct vb2_queue *q);
226 int (*stop_streaming)(struct vb2_queue *q);
227
228 void (*buf_queue)(struct vb2_buffer *vb);
229};
230
231/**
232 * struct vb2_queue - a videobuf queue
233 *
234 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
235 * @io_modes: supported io methods (see vb2_io_modes enum)
236 * @io_flags: additional io flags (see vb2_fileio_flags enum)
237 * @ops: driver-specific callbacks
238 * @mem_ops: memory allocator specific callbacks
239 * @drv_priv: driver private data
240 * @buf_struct_size: size of the driver-specific buffer structure;
241 * "0" indicates the driver doesn't want to use a custom buffer
242 * structure type, so sizeof(struct vb2_buffer) will is used
243 *
244 * @memory: current memory type used
245 * @bufs: videobuf buffer structures
246 * @num_buffers: number of allocated/used buffers
247 * @queued_list: list of buffers currently queued from userspace
248 * @queued_count: number of buffers owned by the driver
249 * @done_list: list of buffers ready to be dequeued to userspace
250 * @done_lock: lock to protect done_list list
251 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
252 * @alloc_ctx: memory type/allocator-specific contexts for each plane
253 * @streaming: current streaming state
254 * @fileio: file io emulator internal data, used only if emulator is active
255 */
256struct vb2_queue {
257 enum v4l2_buf_type type;
258 unsigned int io_modes;
259 unsigned int io_flags;
260
261 const struct vb2_ops *ops;
262 const struct vb2_mem_ops *mem_ops;
263 void *drv_priv;
264 unsigned int buf_struct_size;
265
266/* private: internal use only */
267 enum v4l2_memory memory;
268 struct vb2_buffer *bufs[VIDEO_MAX_FRAME];
269 unsigned int num_buffers;
270
271 struct list_head queued_list;
272
273 atomic_t queued_count;
274 struct list_head done_list;
275 spinlock_t done_lock;
276 wait_queue_head_t done_wq;
277
278 void *alloc_ctx[VIDEO_MAX_PLANES];
279
280 unsigned int streaming:1;
281
282 struct vb2_fileio_data *fileio;
283};
284
285void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no);
286void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
287
288void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
289int vb2_wait_for_all_buffers(struct vb2_queue *q);
290
291int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
292int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
293
294int vb2_queue_init(struct vb2_queue *q);
295
296void vb2_queue_release(struct vb2_queue *q);
297
298int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
299int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
300
301int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
302int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type);
303
304int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma);
305unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait);
306size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
307 loff_t *ppos, int nonblock);
308size_t vb2_write(struct vb2_queue *q, char __user *data, size_t count,
309 loff_t *ppos, int nonblock);
310
311/**
312 * vb2_is_streaming() - return streaming status of the queue
313 * @q: videobuf queue
314 */
315static inline bool vb2_is_streaming(struct vb2_queue *q)
316{
317 return q->streaming;
318}
319
320/**
321 * vb2_is_busy() - return busy status of the queue
322 * @q: videobuf queue
323 *
324 * This function checks if queue has any buffers allocated.
325 */
326static inline bool vb2_is_busy(struct vb2_queue *q)
327{
328 return (q->num_buffers > 0);
329}
330
331/**
332 * vb2_get_drv_priv() - return driver private data associated with the queue
333 * @q: videobuf queue
334 */
335static inline void *vb2_get_drv_priv(struct vb2_queue *q)
336{
337 return q->drv_priv;
338}
339
340/**
341 * vb2_set_plane_payload() - set bytesused for the plane plane_no
342 * @vb: buffer for which plane payload should be set
343 * @plane_no: plane number for which payload should be set
344 * @size: payload in bytes
345 */
346static inline void vb2_set_plane_payload(struct vb2_buffer *vb,
347 unsigned int plane_no, unsigned long size)
348{
349 if (plane_no < vb->num_planes)
350 vb->v4l2_planes[plane_no].bytesused = size;
351}
352
353/**
354 * vb2_get_plane_payload() - get bytesused for the plane plane_no
355 * @vb: buffer for which plane payload should be set
356 * @plane_no: plane number for which payload should be set
357 * @size: payload in bytes
358 */
359static inline unsigned long vb2_get_plane_payload(struct vb2_buffer *vb,
360 unsigned int plane_no)
361{
362 if (plane_no < vb->num_planes)
363 return vb->v4l2_planes[plane_no].bytesused;
364 return 0;
365}
366
367/**
368 * vb2_plane_size() - return plane size in bytes
369 * @vb: buffer for which plane size should be returned
370 * @plane_no: plane number for which size should be returned
371 */
372static inline unsigned long
373vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
374{
375 if (plane_no < vb->num_planes)
376 return vb->v4l2_planes[plane_no].length;
377 return 0;
378}
379
380#endif /* _MEDIA_VIDEOBUF2_CORE_H */
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
new file mode 100644
index 000000000000..7e6c68b23773
--- /dev/null
+++ b/include/media/videobuf2-dma-contig.h
@@ -0,0 +1,32 @@
1/*
2 * videobuf2-dma-coherent.h - DMA coherent memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_DMA_COHERENT_H
14#define _MEDIA_VIDEOBUF2_DMA_COHERENT_H
15
16#include <media/videobuf2-core.h>
17#include <linux/dma-mapping.h>
18
19static inline dma_addr_t
20vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no)
21{
22 dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no);
23
24 return *paddr;
25}
26
27void *vb2_dma_contig_init_ctx(struct device *dev);
28void vb2_dma_contig_cleanup_ctx(void *alloc_ctx);
29
30extern const struct vb2_mem_ops vb2_dma_contig_memops;
31
32#endif
diff --git a/include/media/videobuf2-dma-sg.h b/include/media/videobuf2-dma-sg.h
new file mode 100644
index 000000000000..0038526b8ef7
--- /dev/null
+++ b/include/media/videobuf2-dma-sg.h
@@ -0,0 +1,32 @@
1/*
2 * videobuf2-dma-sg.h - DMA scatter/gather memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Andrzej Pietrasiewicz <andrzej.p@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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_DMA_SG_H
14#define _MEDIA_VIDEOBUF2_DMA_SG_H
15
16#include <media/videobuf2-core.h>
17
18struct vb2_dma_sg_desc {
19 unsigned long size;
20 unsigned int num_pages;
21 struct scatterlist *sglist;
22};
23
24static inline struct vb2_dma_sg_desc *vb2_dma_sg_plane_desc(
25 struct vb2_buffer *vb, unsigned int plane_no)
26{
27 return (struct vb2_dma_sg_desc *)vb2_plane_cookie(vb, plane_no);
28}
29
30extern const struct vb2_mem_ops vb2_dma_sg_memops;
31
32#endif
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
new file mode 100644
index 000000000000..84e1f6c031c5
--- /dev/null
+++ b/include/media/videobuf2-memops.h
@@ -0,0 +1,45 @@
1/*
2 * videobuf2-memops.h - generic memory handling routines for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.com>
7 * Marek Szyprowski <m.szyprowski@samsung.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.
12 */
13
14#ifndef _MEDIA_VIDEOBUF2_MEMOPS_H
15#define _MEDIA_VIDEOBUF2_MEMOPS_H
16
17#include <media/videobuf2-core.h>
18
19/**
20 * vb2_vmarea_handler - common vma refcount tracking handler
21 * @refcount: pointer to refcount entry in the buffer
22 * @put: callback to function that decreases buffer refcount
23 * @arg: argument for @put callback
24 */
25struct vb2_vmarea_handler {
26 atomic_t *refcount;
27 void (*put)(void *arg);
28 void *arg;
29};
30
31extern const struct vm_operations_struct vb2_common_vm_ops;
32
33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
34 struct vm_area_struct **res_vma, dma_addr_t *res_pa);
35
36int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
37 unsigned long size,
38 const struct vm_operations_struct *vm_ops,
39 void *priv);
40
41struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
42void vb2_put_vma(struct vm_area_struct *vma);
43
44
45#endif
diff --git a/include/media/videobuf2-vmalloc.h b/include/media/videobuf2-vmalloc.h
new file mode 100644
index 000000000000..93a76b43038d
--- /dev/null
+++ b/include/media/videobuf2-vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * videobuf2-vmalloc.h - vmalloc memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_VMALLOC_H
14#define _MEDIA_VIDEOBUF2_VMALLOC_H
15
16#include <media/videobuf2-core.h>
17
18extern const struct vb2_mem_ops vb2_vmalloc_memops;
19
20#endif
diff --git a/include/media/wm8775.h b/include/media/wm8775.h
index 60739c5a23ae..d0e801a9935c 100644
--- a/include/media/wm8775.h
+++ b/include/media/wm8775.h
@@ -32,4 +32,13 @@
32#define WM8775_AIN3 4 32#define WM8775_AIN3 4
33#define WM8775_AIN4 8 33#define WM8775_AIN4 8
34 34
35
36struct wm8775_platform_data {
37 /*
38 * FIXME: Instead, we should parametrize the params
39 * that need different settings between ivtv, pvrusb2, and Nova-S
40 */
41 bool is_nova_s;
42};
43
35#endif 44#endif
diff --git a/include/net/dst.h b/include/net/dst.h
index 2a46cbaef92d..75b95df4afe7 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -345,7 +345,7 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
345 345
346static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) 346static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
347{ 347{
348 struct dst_entry *child = skb_dst(skb)->child; 348 struct dst_entry *child = dst_clone(skb_dst(skb)->child);
349 349
350 skb_dst_drop(skb); 350 skb_dst_drop(skb);
351 return child; 351 return child;
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 04977eefb0ee..fccc2180c61b 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -286,5 +286,21 @@ static inline void ipv6_ib_mc_map(const struct in6_addr *addr,
286 buf[9] = broadcast[9]; 286 buf[9] = broadcast[9];
287 memcpy(buf + 10, addr->s6_addr + 6, 10); 287 memcpy(buf + 10, addr->s6_addr + 6, 10);
288} 288}
289
290static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr,
291 const unsigned char *broadcast, char *buf)
292{
293 if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) {
294 memcpy(buf, broadcast, 4);
295 } else {
296 /* v4mapped? */
297 if ((addr->s6_addr32[0] | addr->s6_addr32[1] |
298 (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0)
299 return -EINVAL;
300 memcpy(buf, &addr->s6_addr32[3], 4);
301 }
302 return 0;
303}
304
289#endif 305#endif
290#endif 306#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index a4f631108c54..7c416583b710 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -339,6 +339,14 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch
339 buf[16] = addr & 0x0f; 339 buf[16] = addr & 0x0f;
340} 340}
341 341
342static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf)
343{
344 if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0)
345 memcpy(buf, broadcast, 4);
346 else
347 memcpy(buf, &naddr, sizeof(naddr));
348}
349
342#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 350#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
343#include <linux/ipv6.h> 351#include <linux/ipv6.h>
344#endif 352#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 642a80bb42cf..c850e5fb967c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -70,7 +70,7 @@ static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
70extern void ip6_route_input(struct sk_buff *skb); 70extern void ip6_route_input(struct sk_buff *skb);
71 71
72extern struct dst_entry * ip6_route_output(struct net *net, 72extern struct dst_entry * ip6_route_output(struct net *net,
73 struct sock *sk, 73 const struct sock *sk,
74 struct flowi6 *fl6); 74 struct flowi6 *fl6);
75 75
76extern int ip6_route_init(void); 76extern int ip6_route_init(void);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index a1a858035913..e5d66ec88cf6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -51,7 +51,6 @@ struct fib_nh {
51 struct fib_info *nh_parent; 51 struct fib_info *nh_parent;
52 unsigned nh_flags; 52 unsigned nh_flags;
53 unsigned char nh_scope; 53 unsigned char nh_scope;
54 unsigned char nh_cfg_scope;
55#ifdef CONFIG_IP_ROUTE_MULTIPATH 54#ifdef CONFIG_IP_ROUTE_MULTIPATH
56 int nh_weight; 55 int nh_weight;
57 int nh_power; 56 int nh_power;
@@ -62,6 +61,7 @@ struct fib_nh {
62 int nh_oif; 61 int nh_oif;
63 __be32 nh_gw; 62 __be32 nh_gw;
64 __be32 nh_saddr; 63 __be32 nh_saddr;
64 int nh_saddr_genid;
65}; 65};
66 66
67/* 67/*
@@ -74,9 +74,10 @@ struct fib_info {
74 struct net *fib_net; 74 struct net *fib_net;
75 int fib_treeref; 75 int fib_treeref;
76 atomic_t fib_clntref; 76 atomic_t fib_clntref;
77 int fib_dead;
78 unsigned fib_flags; 77 unsigned fib_flags;
79 int fib_protocol; 78 unsigned char fib_dead;
79 unsigned char fib_protocol;
80 unsigned char fib_scope;
80 __be32 fib_prefsrc; 81 __be32 fib_prefsrc;
81 u32 fib_priority; 82 u32 fib_priority;
82 u32 *fib_metrics; 83 u32 *fib_metrics;
@@ -141,12 +142,19 @@ struct fib_result_nl {
141 142
142#endif /* CONFIG_IP_ROUTE_MULTIPATH */ 143#endif /* CONFIG_IP_ROUTE_MULTIPATH */
143 144
144#define FIB_RES_SADDR(res) (FIB_RES_NH(res).nh_saddr) 145extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
146
147#define FIB_RES_SADDR(net, res) \
148 ((FIB_RES_NH(res).nh_saddr_genid == \
149 atomic_read(&(net)->ipv4.dev_addr_genid)) ? \
150 FIB_RES_NH(res).nh_saddr : \
151 fib_info_update_nh_saddr((net), &FIB_RES_NH(res)))
145#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) 152#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw)
146#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) 153#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev)
147#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) 154#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif)
148 155
149#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : FIB_RES_SADDR(res)) 156#define FIB_RES_PREFSRC(net, res) ((res).fi->fib_prefsrc ? : \
157 FIB_RES_SADDR(net, res))
150 158
151struct fib_table { 159struct fib_table {
152 struct hlist_node tb_hlist; 160 struct hlist_node tb_hlist;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 272f59336b73..30b49ed72f0d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -801,8 +801,6 @@ struct netns_ipvs {
801 struct list_head rs_table[IP_VS_RTAB_SIZE]; 801 struct list_head rs_table[IP_VS_RTAB_SIZE];
802 /* ip_vs_app */ 802 /* ip_vs_app */
803 struct list_head app_list; 803 struct list_head app_list;
804 struct mutex app_mutex;
805 struct lock_class_key app_key; /* mutex debuging */
806 804
807 /* ip_vs_proto */ 805 /* ip_vs_proto */
808 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ 806 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index e2e2ef57eca2..542195d9469e 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -55,6 +55,7 @@ struct netns_ipv4 {
55 int current_rt_cache_rebuild_count; 55 int current_rt_cache_rebuild_count;
56 56
57 atomic_t rt_genid; 57 atomic_t rt_genid;
58 atomic_t dev_addr_genid;
58 59
59#ifdef CONFIG_IP_MROUTE 60#ifdef CONFIG_IP_MROUTE
60#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES 61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
diff --git a/include/net/rose.h b/include/net/rose.h
index 5ba9f02731eb..555dd198aab7 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -14,6 +14,12 @@
14 14
15#define ROSE_MIN_LEN 3 15#define ROSE_MIN_LEN 3
16 16
17#define ROSE_CALL_REQ_ADDR_LEN_OFF 3
18#define ROSE_CALL_REQ_ADDR_LEN_VAL 0xAA /* each address is 10 digits */
19#define ROSE_CALL_REQ_DEST_ADDR_OFF 4
20#define ROSE_CALL_REQ_SRC_ADDR_OFF 9
21#define ROSE_CALL_REQ_FACILITIES_OFF 14
22
17#define ROSE_GFI 0x10 23#define ROSE_GFI 0x10
18#define ROSE_Q_BIT 0x80 24#define ROSE_Q_BIT 0x80
19#define ROSE_D_BIT 0x40 25#define ROSE_D_BIT 0x40
@@ -214,7 +220,7 @@ extern void rose_requeue_frames(struct sock *);
214extern int rose_validate_nr(struct sock *, unsigned short); 220extern int rose_validate_nr(struct sock *, unsigned short);
215extern void rose_write_internal(struct sock *, int); 221extern void rose_write_internal(struct sock *, int);
216extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *); 222extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
217extern int rose_parse_facilities(unsigned char *, struct rose_facilities_struct *); 223extern int rose_parse_facilities(unsigned char *, unsigned int, struct rose_facilities_struct *);
218extern void rose_disconnect(struct sock *, int, int, int); 224extern void rose_disconnect(struct sock *, int, int, int);
219 225
220/* rose_timer.c */ 226/* rose_timer.c */
diff --git a/include/net/route.h b/include/net/route.h
index 30d6cae3841a..f88429cad52a 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -207,6 +207,7 @@ extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
207 207
208struct in_ifaddr; 208struct in_ifaddr;
209extern void fib_add_ifaddr(struct in_ifaddr *); 209extern void fib_add_ifaddr(struct in_ifaddr *);
210extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
210 211
211static inline void ip_rt_put(struct rtable * rt) 212static inline void ip_rt_put(struct rtable * rt)
212{ 213{
@@ -269,8 +270,8 @@ static inline struct rtable *ip_route_newports(struct rtable *rt,
269 struct flowi4 fl4 = { 270 struct flowi4 fl4 = {
270 .flowi4_oif = rt->rt_oif, 271 .flowi4_oif = rt->rt_oif,
271 .flowi4_mark = rt->rt_mark, 272 .flowi4_mark = rt->rt_mark,
272 .daddr = rt->rt_key_dst, 273 .daddr = rt->rt_dst,
273 .saddr = rt->rt_key_src, 274 .saddr = rt->rt_src,
274 .flowi4_tos = rt->rt_tos, 275 .flowi4_tos = rt->rt_tos,
275 .flowi4_proto = protocol, 276 .flowi4_proto = protocol,
276 .fl4_sport = sport, 277 .fl4_sport = sport,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a9505b6a18e3..b931f021d7ab 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -25,6 +25,7 @@ struct qdisc_rate_table {
25enum qdisc_state_t { 25enum qdisc_state_t {
26 __QDISC_STATE_SCHED, 26 __QDISC_STATE_SCHED,
27 __QDISC_STATE_DEACTIVATED, 27 __QDISC_STATE_DEACTIVATED,
28 __QDISC_STATE_THROTTLED,
28}; 29};
29 30
30/* 31/*
@@ -32,7 +33,6 @@ enum qdisc_state_t {
32 */ 33 */
33enum qdisc___state_t { 34enum qdisc___state_t {
34 __QDISC___STATE_RUNNING = 1, 35 __QDISC___STATE_RUNNING = 1,
35 __QDISC___STATE_THROTTLED = 2,
36}; 36};
37 37
38struct qdisc_size_table { 38struct qdisc_size_table {
@@ -106,17 +106,17 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
106 106
107static inline bool qdisc_is_throttled(const struct Qdisc *qdisc) 107static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
108{ 108{
109 return (qdisc->__state & __QDISC___STATE_THROTTLED) ? true : false; 109 return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false;
110} 110}
111 111
112static inline void qdisc_throttled(struct Qdisc *qdisc) 112static inline void qdisc_throttled(struct Qdisc *qdisc)
113{ 113{
114 qdisc->__state |= __QDISC___STATE_THROTTLED; 114 set_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
115} 115}
116 116
117static inline void qdisc_unthrottled(struct Qdisc *qdisc) 117static inline void qdisc_unthrottled(struct Qdisc *qdisc)
118{ 118{
119 qdisc->__state &= ~__QDISC___STATE_THROTTLED; 119 clear_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
120} 120}
121 121
122struct Qdisc_class_ops { 122struct Qdisc_class_ops {
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 762e2abce889..27461d6dd46f 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -150,7 +150,7 @@ struct linux_xfrm_mib {
150#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 150#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
151 do { \ 151 do { \
152 __typeof__(*mib[0]) *ptr = \ 152 __typeof__(*mib[0]) *ptr = \
153 __this_cpu_ptr((mib)[!in_softirq()]); \ 153 __this_cpu_ptr((mib)[0]); \
154 ptr->mibs[basefield##PKTS]++; \ 154 ptr->mibs[basefield##PKTS]++; \
155 ptr->mibs[basefield##OCTETS] += addend;\ 155 ptr->mibs[basefield##OCTETS] += addend;\
156 } while (0) 156 } while (0)
@@ -202,7 +202,7 @@ struct linux_xfrm_mib {
202#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 202#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
203 do { \ 203 do { \
204 __typeof__(*mib[0]) *ptr; \ 204 __typeof__(*mib[0]) *ptr; \
205 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ 205 ptr = __this_cpu_ptr((mib)[0]); \
206 u64_stats_update_begin(&ptr->syncp); \ 206 u64_stats_update_begin(&ptr->syncp); \
207 ptr->mibs[basefield##PKTS]++; \ 207 ptr->mibs[basefield##PKTS]++; \
208 ptr->mibs[basefield##OCTETS] += addend; \ 208 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 42a8c32a10e2..6ae4bc5ce8a7 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1430,6 +1430,7 @@ extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1430extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); 1430extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
1431extern int xfrm_init_replay(struct xfrm_state *x); 1431extern int xfrm_init_replay(struct xfrm_state *x);
1432extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1432extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1433extern int __xfrm_init_state(struct xfrm_state *x, bool init_replay);
1433extern int xfrm_init_state(struct xfrm_state *x); 1434extern int xfrm_init_state(struct xfrm_state *x);
1434extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); 1435extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
1435extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, 1436extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi,
@@ -1600,6 +1601,28 @@ static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay
1600} 1601}
1601 1602
1602#ifdef CONFIG_XFRM_MIGRATE 1603#ifdef CONFIG_XFRM_MIGRATE
1604static inline int xfrm_replay_clone(struct xfrm_state *x,
1605 struct xfrm_state *orig)
1606{
1607 x->replay_esn = kzalloc(xfrm_replay_state_esn_len(orig->replay_esn),
1608 GFP_KERNEL);
1609 if (!x->replay_esn)
1610 return -ENOMEM;
1611
1612 x->replay_esn->bmp_len = orig->replay_esn->bmp_len;
1613 x->replay_esn->replay_window = orig->replay_esn->replay_window;
1614
1615 x->preplay_esn = kmemdup(x->replay_esn,
1616 xfrm_replay_state_esn_len(x->replay_esn),
1617 GFP_KERNEL);
1618 if (!x->preplay_esn) {
1619 kfree(x->replay_esn);
1620 return -ENOMEM;
1621 }
1622
1623 return 0;
1624}
1625
1603static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1626static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1604{ 1627{
1605 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL); 1628 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 741ae7ed4394..e6b9fd2eea34 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -47,6 +47,7 @@ struct iscsi_segment {
47 struct scatterlist *sg; 47 struct scatterlist *sg;
48 void *sg_mapped; 48 void *sg_mapped;
49 unsigned int sg_offset; 49 unsigned int sg_offset;
50 bool atomic_mapped;
50 51
51 iscsi_segment_done_fn_t *done; 52 iscsi_segment_done_fn_t *done;
52}; 53};
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index f171c65dc5a8..2d3ec5094685 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -462,7 +462,7 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
462} 462}
463static inline int scsi_device_enclosure(struct scsi_device *sdev) 463static inline int scsi_device_enclosure(struct scsi_device *sdev)
464{ 464{
465 return sdev->inquiry[6] & (1<<6); 465 return sdev->inquiry ? (sdev->inquiry[6] & (1<<6)) : 1;
466} 466}
467 467
468static inline int scsi_device_protection(struct scsi_device *sdev) 468static inline int scsi_device_protection(struct scsi_device *sdev)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 430a9cc045e2..e1bad1130616 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1031,9 +1031,7 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
1031#define snd_pcm_lib_mmap_iomem NULL 1031#define snd_pcm_lib_mmap_iomem NULL
1032#endif 1032#endif
1033 1033
1034int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream, 1034#define snd_pcm_lib_mmap_vmalloc NULL
1035 struct vm_area_struct *area);
1036#define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached
1037 1035
1038static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) 1036static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
1039{ 1037{
diff --git a/include/staging/altera.h b/include/staging/altera.h
new file mode 100644
index 000000000000..94c0c6181daf
--- /dev/null
+++ b/include/staging/altera.h
@@ -0,0 +1,49 @@
1/*
2 * altera.h
3 *
4 * altera FPGA driver
5 *
6 * Copyright (C) Altera Corporation 1998-2001
7 * Copyright (C) 2010 NetUP Inc.
8 * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 *
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#ifndef _ALTERA_H_
27#define _ALTERA_H_
28
29struct altera_config {
30 void *dev;
31 u8 *action;
32 int (*jtag_io) (void *dev, int tms, int tdi, int tdo);
33};
34
35#if defined(CONFIG_ALTERA_STAPL) || \
36 (defined(CONFIG_ALTERA_STAPL_MODULE) && defined(MODULE))
37
38extern int altera_init(struct altera_config *config, const struct firmware *fw);
39#else
40
41static inline int altera_init(struct altera_config *config,
42 const struct firmware *fw)
43{
44 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
45 return 0;
46}
47#endif /* CONFIG_ALTERA_STAPL */
48
49#endif /* _ALTERA_H_ */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 0828b6c8610a..c15ed5026fb5 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -9,7 +9,7 @@
9#include <net/sock.h> 9#include <net/sock.h>
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.0.0-rc6" 12#define TARGET_CORE_MOD_VERSION "v4.0.0-rc7-ml"
13#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) 13#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
14 14
15/* Used by transport_generic_allocate_iovecs() */ 15/* Used by transport_generic_allocate_iovecs() */
@@ -239,7 +239,7 @@ struct t10_alua_lu_gp {
239} ____cacheline_aligned; 239} ____cacheline_aligned;
240 240
241struct t10_alua_lu_gp_member { 241struct t10_alua_lu_gp_member {
242 int lu_gp_assoc:1; 242 bool lu_gp_assoc;
243 atomic_t lu_gp_mem_ref_cnt; 243 atomic_t lu_gp_mem_ref_cnt;
244 spinlock_t lu_gp_mem_lock; 244 spinlock_t lu_gp_mem_lock;
245 struct t10_alua_lu_gp *lu_gp; 245 struct t10_alua_lu_gp *lu_gp;
@@ -271,7 +271,7 @@ struct t10_alua_tg_pt_gp {
271} ____cacheline_aligned; 271} ____cacheline_aligned;
272 272
273struct t10_alua_tg_pt_gp_member { 273struct t10_alua_tg_pt_gp_member {
274 int tg_pt_gp_assoc:1; 274 bool tg_pt_gp_assoc;
275 atomic_t tg_pt_gp_mem_ref_cnt; 275 atomic_t tg_pt_gp_mem_ref_cnt;
276 spinlock_t tg_pt_gp_mem_lock; 276 spinlock_t tg_pt_gp_mem_lock;
277 struct t10_alua_tg_pt_gp *tg_pt_gp; 277 struct t10_alua_tg_pt_gp *tg_pt_gp;
@@ -336,7 +336,7 @@ struct t10_pr_registration {
336 int pr_res_type; 336 int pr_res_type;
337 int pr_res_scope; 337 int pr_res_scope;
338 /* Used for fabric initiator WWPNs using a ISID */ 338 /* Used for fabric initiator WWPNs using a ISID */
339 int isid_present_at_reg:1; 339 bool isid_present_at_reg;
340 u32 pr_res_mapped_lun; 340 u32 pr_res_mapped_lun;
341 u32 pr_aptpl_target_lun; 341 u32 pr_aptpl_target_lun;
342 u32 pr_res_generation; 342 u32 pr_res_generation;
@@ -418,7 +418,7 @@ struct se_transport_task {
418 unsigned long long t_task_lba; 418 unsigned long long t_task_lba;
419 int t_tasks_failed; 419 int t_tasks_failed;
420 int t_tasks_fua; 420 int t_tasks_fua;
421 int t_tasks_bidi:1; 421 bool t_tasks_bidi;
422 u32 t_task_cdbs; 422 u32 t_task_cdbs;
423 u32 t_tasks_check; 423 u32 t_tasks_check;
424 u32 t_tasks_no; 424 u32 t_tasks_no;
@@ -470,7 +470,7 @@ struct se_task {
470 u8 task_flags; 470 u8 task_flags;
471 int task_error_status; 471 int task_error_status;
472 int task_state_flags; 472 int task_state_flags;
473 int task_padded_sg:1; 473 bool task_padded_sg;
474 unsigned long long task_lba; 474 unsigned long long task_lba;
475 u32 task_no; 475 u32 task_no;
476 u32 task_sectors; 476 u32 task_sectors;
@@ -494,8 +494,8 @@ struct se_task {
494 struct list_head t_state_list; 494 struct list_head t_state_list;
495} ____cacheline_aligned; 495} ____cacheline_aligned;
496 496
497#define TASK_CMD(task) ((struct se_cmd *)task->task_se_cmd) 497#define TASK_CMD(task) ((task)->task_se_cmd)
498#define TASK_DEV(task) ((struct se_device *)task->se_dev) 498#define TASK_DEV(task) ((task)->se_dev)
499 499
500struct se_cmd { 500struct se_cmd {
501 /* SAM response code being sent to initiator */ 501 /* SAM response code being sent to initiator */
@@ -551,8 +551,8 @@ struct se_cmd {
551 void (*transport_complete_callback)(struct se_cmd *); 551 void (*transport_complete_callback)(struct se_cmd *);
552} ____cacheline_aligned; 552} ____cacheline_aligned;
553 553
554#define T_TASK(cmd) ((struct se_transport_task *)(cmd->t_task)) 554#define T_TASK(cmd) ((cmd)->t_task)
555#define CMD_TFO(cmd) ((struct target_core_fabric_ops *)cmd->se_tfo) 555#define CMD_TFO(cmd) ((cmd)->se_tfo)
556 556
557struct se_tmr_req { 557struct se_tmr_req {
558 /* Task Management function to be preformed */ 558 /* Task Management function to be preformed */
@@ -583,7 +583,7 @@ struct se_ua {
583struct se_node_acl { 583struct se_node_acl {
584 char initiatorname[TRANSPORT_IQN_LEN]; 584 char initiatorname[TRANSPORT_IQN_LEN];
585 /* Used to signal demo mode created ACL, disabled by default */ 585 /* Used to signal demo mode created ACL, disabled by default */
586 int dynamic_node_acl:1; 586 bool dynamic_node_acl;
587 u32 queue_depth; 587 u32 queue_depth;
588 u32 acl_index; 588 u32 acl_index;
589 u64 num_cmds; 589 u64 num_cmds;
@@ -601,7 +601,8 @@ struct se_node_acl {
601 struct config_group acl_attrib_group; 601 struct config_group acl_attrib_group;
602 struct config_group acl_auth_group; 602 struct config_group acl_auth_group;
603 struct config_group acl_param_group; 603 struct config_group acl_param_group;
604 struct config_group *acl_default_groups[4]; 604 struct config_group acl_fabric_stat_group;
605 struct config_group *acl_default_groups[5];
605 struct list_head acl_list; 606 struct list_head acl_list;
606 struct list_head acl_sess_list; 607 struct list_head acl_sess_list;
607} ____cacheline_aligned; 608} ____cacheline_aligned;
@@ -615,13 +616,19 @@ struct se_session {
615 struct list_head sess_acl_list; 616 struct list_head sess_acl_list;
616} ____cacheline_aligned; 617} ____cacheline_aligned;
617 618
618#define SE_SESS(cmd) ((struct se_session *)(cmd)->se_sess) 619#define SE_SESS(cmd) ((cmd)->se_sess)
619#define SE_NODE_ACL(sess) ((struct se_node_acl *)(sess)->se_node_acl) 620#define SE_NODE_ACL(sess) ((sess)->se_node_acl)
620 621
621struct se_device; 622struct se_device;
622struct se_transform_info; 623struct se_transform_info;
623struct scatterlist; 624struct scatterlist;
624 625
626struct se_ml_stat_grps {
627 struct config_group stat_group;
628 struct config_group scsi_auth_intr_group;
629 struct config_group scsi_att_intr_port_group;
630};
631
625struct se_lun_acl { 632struct se_lun_acl {
626 char initiatorname[TRANSPORT_IQN_LEN]; 633 char initiatorname[TRANSPORT_IQN_LEN];
627 u32 mapped_lun; 634 u32 mapped_lun;
@@ -629,10 +636,13 @@ struct se_lun_acl {
629 struct se_lun *se_lun; 636 struct se_lun *se_lun;
630 struct list_head lacl_list; 637 struct list_head lacl_list;
631 struct config_group se_lun_group; 638 struct config_group se_lun_group;
639 struct se_ml_stat_grps ml_stat_grps;
632} ____cacheline_aligned; 640} ____cacheline_aligned;
633 641
642#define ML_STAT_GRPS(lacl) (&(lacl)->ml_stat_grps)
643
634struct se_dev_entry { 644struct se_dev_entry {
635 int def_pr_registered:1; 645 bool def_pr_registered;
636 /* See transport_lunflags_table */ 646 /* See transport_lunflags_table */
637 u32 lun_flags; 647 u32 lun_flags;
638 u32 deve_cmds; 648 u32 deve_cmds;
@@ -693,6 +703,13 @@ struct se_dev_attrib {
693 struct config_group da_group; 703 struct config_group da_group;
694} ____cacheline_aligned; 704} ____cacheline_aligned;
695 705
706struct se_dev_stat_grps {
707 struct config_group stat_group;
708 struct config_group scsi_dev_group;
709 struct config_group scsi_tgt_dev_group;
710 struct config_group scsi_lu_group;
711};
712
696struct se_subsystem_dev { 713struct se_subsystem_dev {
697/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */ 714/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */
698#define SE_DEV_ALIAS_LEN 512 715#define SE_DEV_ALIAS_LEN 512
@@ -716,11 +733,14 @@ struct se_subsystem_dev {
716 struct config_group se_dev_group; 733 struct config_group se_dev_group;
717 /* For T10 Reservations */ 734 /* For T10 Reservations */
718 struct config_group se_dev_pr_group; 735 struct config_group se_dev_pr_group;
736 /* For target_core_stat.c groups */
737 struct se_dev_stat_grps dev_stat_grps;
719} ____cacheline_aligned; 738} ____cacheline_aligned;
720 739
721#define T10_ALUA(su_dev) (&(su_dev)->t10_alua) 740#define T10_ALUA(su_dev) (&(su_dev)->t10_alua)
722#define T10_RES(su_dev) (&(su_dev)->t10_reservation) 741#define T10_RES(su_dev) (&(su_dev)->t10_reservation)
723#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops) 742#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops)
743#define DEV_STAT_GRP(dev) (&(dev)->dev_stat_grps)
724 744
725struct se_device { 745struct se_device {
726 /* Set to 1 if thread is NOT sleeping on thread_sem */ 746 /* Set to 1 if thread is NOT sleeping on thread_sem */
@@ -803,8 +823,8 @@ struct se_device {
803 struct list_head g_se_dev_list; 823 struct list_head g_se_dev_list;
804} ____cacheline_aligned; 824} ____cacheline_aligned;
805 825
806#define SE_DEV(cmd) ((struct se_device *)(cmd)->se_lun->lun_se_dev) 826#define SE_DEV(cmd) ((cmd)->se_lun->lun_se_dev)
807#define SU_DEV(dev) ((struct se_subsystem_dev *)(dev)->se_sub_dev) 827#define SU_DEV(dev) ((dev)->se_sub_dev)
808#define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib) 828#define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib)
809#define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn) 829#define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn)
810 830
@@ -832,7 +852,14 @@ struct se_hba {
832 struct se_subsystem_api *transport; 852 struct se_subsystem_api *transport;
833} ____cacheline_aligned; 853} ____cacheline_aligned;
834 854
835#define SE_HBA(d) ((struct se_hba *)(d)->se_hba) 855#define SE_HBA(dev) ((dev)->se_hba)
856
857struct se_port_stat_grps {
858 struct config_group stat_group;
859 struct config_group scsi_port_group;
860 struct config_group scsi_tgt_port_group;
861 struct config_group scsi_transport_group;
862};
836 863
837struct se_lun { 864struct se_lun {
838 /* See transport_lun_status_table */ 865 /* See transport_lun_status_table */
@@ -848,11 +875,13 @@ struct se_lun {
848 struct list_head lun_cmd_list; 875 struct list_head lun_cmd_list;
849 struct list_head lun_acl_list; 876 struct list_head lun_acl_list;
850 struct se_device *lun_se_dev; 877 struct se_device *lun_se_dev;
878 struct se_port *lun_sep;
851 struct config_group lun_group; 879 struct config_group lun_group;
852 struct se_port *lun_sep; 880 struct se_port_stat_grps port_stat_grps;
853} ____cacheline_aligned; 881} ____cacheline_aligned;
854 882
855#define SE_LUN(c) ((struct se_lun *)(c)->se_lun) 883#define SE_LUN(cmd) ((cmd)->se_lun)
884#define PORT_STAT_GRP(lun) (&(lun)->port_stat_grps)
856 885
857struct scsi_port_stats { 886struct scsi_port_stats {
858 u64 cmd_pdus; 887 u64 cmd_pdus;
@@ -919,11 +948,13 @@ struct se_portal_group {
919 struct config_group tpg_param_group; 948 struct config_group tpg_param_group;
920} ____cacheline_aligned; 949} ____cacheline_aligned;
921 950
922#define TPG_TFO(se_tpg) ((struct target_core_fabric_ops *)(se_tpg)->se_tpg_tfo) 951#define TPG_TFO(se_tpg) ((se_tpg)->se_tpg_tfo)
923 952
924struct se_wwn { 953struct se_wwn {
925 struct target_fabric_configfs *wwn_tf; 954 struct target_fabric_configfs *wwn_tf;
926 struct config_group wwn_group; 955 struct config_group wwn_group;
956 struct config_group *wwn_default_groups[2];
957 struct config_group fabric_stat_group;
927} ____cacheline_aligned; 958} ____cacheline_aligned;
928 959
929struct se_global { 960struct se_global {
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 40e6e740527c..612509592ffd 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -14,10 +14,12 @@ extern void target_fabric_configfs_deregister(struct target_fabric_configfs *);
14struct target_fabric_configfs_template { 14struct target_fabric_configfs_template {
15 struct config_item_type tfc_discovery_cit; 15 struct config_item_type tfc_discovery_cit;
16 struct config_item_type tfc_wwn_cit; 16 struct config_item_type tfc_wwn_cit;
17 struct config_item_type tfc_wwn_fabric_stats_cit;
17 struct config_item_type tfc_tpg_cit; 18 struct config_item_type tfc_tpg_cit;
18 struct config_item_type tfc_tpg_base_cit; 19 struct config_item_type tfc_tpg_base_cit;
19 struct config_item_type tfc_tpg_lun_cit; 20 struct config_item_type tfc_tpg_lun_cit;
20 struct config_item_type tfc_tpg_port_cit; 21 struct config_item_type tfc_tpg_port_cit;
22 struct config_item_type tfc_tpg_port_stat_cit;
21 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
22 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
23 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
@@ -27,7 +29,9 @@ struct target_fabric_configfs_template {
27 struct config_item_type tfc_tpg_nacl_attrib_cit; 29 struct config_item_type tfc_tpg_nacl_attrib_cit;
28 struct config_item_type tfc_tpg_nacl_auth_cit; 30 struct config_item_type tfc_tpg_nacl_auth_cit;
29 struct config_item_type tfc_tpg_nacl_param_cit; 31 struct config_item_type tfc_tpg_nacl_param_cit;
32 struct config_item_type tfc_tpg_nacl_stat_cit;
30 struct config_item_type tfc_tpg_mappedlun_cit; 33 struct config_item_type tfc_tpg_mappedlun_cit;
34 struct config_item_type tfc_tpg_mappedlun_stat_cit;
31}; 35};
32 36
33struct target_fabric_configfs { 37struct target_fabric_configfs {
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
index f3ac12b019c2..5eb8b1ae59d1 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -8,7 +8,7 @@ struct target_core_fabric_ops {
8 * for scatterlist chaining using transport_do_task_sg_link(), 8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default 9 * disabled by default
10 */ 10 */
11 int task_sg_chaining:1; 11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 12 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 13 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 14 char *(*tpg_get_wwn)(struct se_portal_group *);
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
index 6c8248bc2c66..bd5596807478 100644
--- a/include/target/target_core_tmr.h
+++ b/include/target/target_core_tmr.h
@@ -1,37 +1,29 @@
1#ifndef TARGET_CORE_TMR_H 1#ifndef TARGET_CORE_TMR_H
2#define TARGET_CORE_TMR_H 2#define TARGET_CORE_TMR_H
3 3
4/* task management function values */ 4/* fabric independent task management function values */
5#ifdef ABORT_TASK 5enum tcm_tmreq_table {
6#undef ABORT_TASK 6 TMR_ABORT_TASK = 1,
7#endif /* ABORT_TASK */ 7 TMR_ABORT_TASK_SET = 2,
8#define ABORT_TASK 1 8 TMR_CLEAR_ACA = 3,
9#ifdef ABORT_TASK_SET 9 TMR_CLEAR_TASK_SET = 4,
10#undef ABORT_TASK_SET 10 TMR_LUN_RESET = 5,
11#endif /* ABORT_TASK_SET */ 11 TMR_TARGET_WARM_RESET = 6,
12#define ABORT_TASK_SET 2 12 TMR_TARGET_COLD_RESET = 7,
13#ifdef CLEAR_ACA 13 TMR_FABRIC_TMR = 255,
14#undef CLEAR_ACA 14};
15#endif /* CLEAR_ACA */
16#define CLEAR_ACA 3
17#ifdef CLEAR_TASK_SET
18#undef CLEAR_TASK_SET
19#endif /* CLEAR_TASK_SET */
20#define CLEAR_TASK_SET 4
21#define LUN_RESET 5
22#define TARGET_WARM_RESET 6
23#define TARGET_COLD_RESET 7
24#define TASK_REASSIGN 8
25 15
26/* task management response values */ 16/* fabric independent task management response values */
27#define TMR_FUNCTION_COMPLETE 0 17enum tcm_tmrsp_table {
28#define TMR_TASK_DOES_NOT_EXIST 1 18 TMR_FUNCTION_COMPLETE = 0,
29#define TMR_LUN_DOES_NOT_EXIST 2 19 TMR_TASK_DOES_NOT_EXIST = 1,
30#define TMR_TASK_STILL_ALLEGIANT 3 20 TMR_LUN_DOES_NOT_EXIST = 2,
31#define TMR_TASK_FAILOVER_NOT_SUPPORTED 4 21 TMR_TASK_STILL_ALLEGIANT = 3,
32#define TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED 5 22 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
33#define TMR_FUNCTION_AUTHORIZATION_FAILED 6 23 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
34#define TMR_FUNCTION_REJECTED 255 24 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
25 TMR_FUNCTION_REJECTED = 255,
26};
35 27
36extern struct kmem_cache *se_tmr_req_cache; 28extern struct kmem_cache *se_tmr_req_cache;
37 29
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index 2e8ec51f0615..59aa464f6ee2 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -109,6 +109,8 @@
109struct se_mem; 109struct se_mem;
110struct se_subsystem_api; 110struct se_subsystem_api;
111 111
112extern struct kmem_cache *se_mem_cache;
113
112extern int init_se_global(void); 114extern int init_se_global(void);
113extern void release_se_global(void); 115extern void release_se_global(void);
114extern void init_scsi_index_table(void); 116extern void init_scsi_index_table(void);
@@ -190,6 +192,8 @@ extern void transport_generic_process_write(struct se_cmd *);
190extern int transport_generic_do_tmr(struct se_cmd *); 192extern int transport_generic_do_tmr(struct se_cmd *);
191/* From target_core_alua.c */ 193/* From target_core_alua.c */
192extern int core_alua_check_nonop_delay(struct se_cmd *); 194extern int core_alua_check_nonop_delay(struct se_cmd *);
195/* From target_core_cdb.c */
196extern int transport_emulate_control_cdb(struct se_task *);
193 197
194/* 198/*
195 * Each se_transport_task_t can have N number of possible struct se_task's 199 * Each se_transport_task_t can have N number of possible struct se_task's
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
new file mode 100644
index 000000000000..f445cff66ab7
--- /dev/null
+++ b/include/trace/events/btrfs.h
@@ -0,0 +1,667 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM btrfs
3
4#if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_BTRFS_H
6
7#include <linux/writeback.h>
8#include <linux/tracepoint.h>
9
10struct btrfs_root;
11struct btrfs_fs_info;
12struct btrfs_inode;
13struct extent_map;
14struct btrfs_ordered_extent;
15struct btrfs_delayed_ref_node;
16struct btrfs_delayed_tree_ref;
17struct btrfs_delayed_data_ref;
18struct btrfs_delayed_ref_head;
19struct map_lookup;
20struct extent_buffer;
21
22#define show_ref_type(type) \
23 __print_symbolic(type, \
24 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \
25 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \
26 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \
27 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \
28 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" })
29
30#define __show_root_type(obj) \
31 __print_symbolic(obj, \
32 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \
33 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \
34 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \
35 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \
36 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \
37 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \
38 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \
39 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \
40 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \
41 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" })
42
43#define show_root_type(obj) \
44 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
45 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
46
47TRACE_EVENT(btrfs_transaction_commit,
48
49 TP_PROTO(struct btrfs_root *root),
50
51 TP_ARGS(root),
52
53 TP_STRUCT__entry(
54 __field( u64, generation )
55 __field( u64, root_objectid )
56 ),
57
58 TP_fast_assign(
59 __entry->generation = root->fs_info->generation;
60 __entry->root_objectid = root->root_key.objectid;
61 ),
62
63 TP_printk("root = %llu(%s), gen = %llu",
64 show_root_type(__entry->root_objectid),
65 (unsigned long long)__entry->generation)
66);
67
68DECLARE_EVENT_CLASS(btrfs__inode,
69
70 TP_PROTO(struct inode *inode),
71
72 TP_ARGS(inode),
73
74 TP_STRUCT__entry(
75 __field( ino_t, ino )
76 __field( blkcnt_t, blocks )
77 __field( u64, disk_i_size )
78 __field( u64, generation )
79 __field( u64, last_trans )
80 __field( u64, logged_trans )
81 __field( u64, root_objectid )
82 ),
83
84 TP_fast_assign(
85 __entry->ino = inode->i_ino;
86 __entry->blocks = inode->i_blocks;
87 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size;
88 __entry->generation = BTRFS_I(inode)->generation;
89 __entry->last_trans = BTRFS_I(inode)->last_trans;
90 __entry->logged_trans = BTRFS_I(inode)->logged_trans;
91 __entry->root_objectid =
92 BTRFS_I(inode)->root->root_key.objectid;
93 ),
94
95 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, "
96 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu",
97 show_root_type(__entry->root_objectid),
98 (unsigned long long)__entry->generation,
99 (unsigned long)__entry->ino,
100 (unsigned long long)__entry->blocks,
101 (unsigned long long)__entry->disk_i_size,
102 (unsigned long long)__entry->last_trans,
103 (unsigned long long)__entry->logged_trans)
104);
105
106DEFINE_EVENT(btrfs__inode, btrfs_inode_new,
107
108 TP_PROTO(struct inode *inode),
109
110 TP_ARGS(inode)
111);
112
113DEFINE_EVENT(btrfs__inode, btrfs_inode_request,
114
115 TP_PROTO(struct inode *inode),
116
117 TP_ARGS(inode)
118);
119
120DEFINE_EVENT(btrfs__inode, btrfs_inode_evict,
121
122 TP_PROTO(struct inode *inode),
123
124 TP_ARGS(inode)
125);
126
127#define __show_map_type(type) \
128 __print_symbolic(type, \
129 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \
130 { EXTENT_MAP_HOLE, "HOLE" }, \
131 { EXTENT_MAP_INLINE, "INLINE" }, \
132 { EXTENT_MAP_DELALLOC, "DELALLOC" })
133
134#define show_map_type(type) \
135 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type)
136
137#define show_map_flags(flag) \
138 __print_flags(flag, "|", \
139 { EXTENT_FLAG_PINNED, "PINNED" }, \
140 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \
141 { EXTENT_FLAG_VACANCY, "VACANCY" }, \
142 { EXTENT_FLAG_PREALLOC, "PREALLOC" })
143
144TRACE_EVENT(btrfs_get_extent,
145
146 TP_PROTO(struct btrfs_root *root, struct extent_map *map),
147
148 TP_ARGS(root, map),
149
150 TP_STRUCT__entry(
151 __field( u64, root_objectid )
152 __field( u64, start )
153 __field( u64, len )
154 __field( u64, orig_start )
155 __field( u64, block_start )
156 __field( u64, block_len )
157 __field( unsigned long, flags )
158 __field( int, refs )
159 __field( unsigned int, compress_type )
160 ),
161
162 TP_fast_assign(
163 __entry->root_objectid = root->root_key.objectid;
164 __entry->start = map->start;
165 __entry->len = map->len;
166 __entry->orig_start = map->orig_start;
167 __entry->block_start = map->block_start;
168 __entry->block_len = map->block_len;
169 __entry->flags = map->flags;
170 __entry->refs = atomic_read(&map->refs);
171 __entry->compress_type = map->compress_type;
172 ),
173
174 TP_printk("root = %llu(%s), start = %llu, len = %llu, "
175 "orig_start = %llu, block_start = %llu(%s), "
176 "block_len = %llu, flags = %s, refs = %u, "
177 "compress_type = %u",
178 show_root_type(__entry->root_objectid),
179 (unsigned long long)__entry->start,
180 (unsigned long long)__entry->len,
181 (unsigned long long)__entry->orig_start,
182 show_map_type(__entry->block_start),
183 (unsigned long long)__entry->block_len,
184 show_map_flags(__entry->flags),
185 __entry->refs, __entry->compress_type)
186);
187
188#define show_ordered_flags(flags) \
189 __print_symbolic(flags, \
190 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \
191 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \
192 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \
193 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \
194 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \
195 { BTRFS_ORDERED_DIRECT, "DIRECT" })
196
197DECLARE_EVENT_CLASS(btrfs__ordered_extent,
198
199 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
200
201 TP_ARGS(inode, ordered),
202
203 TP_STRUCT__entry(
204 __field( ino_t, ino )
205 __field( u64, file_offset )
206 __field( u64, start )
207 __field( u64, len )
208 __field( u64, disk_len )
209 __field( u64, bytes_left )
210 __field( unsigned long, flags )
211 __field( int, compress_type )
212 __field( int, refs )
213 __field( u64, root_objectid )
214 ),
215
216 TP_fast_assign(
217 __entry->ino = inode->i_ino;
218 __entry->file_offset = ordered->file_offset;
219 __entry->start = ordered->start;
220 __entry->len = ordered->len;
221 __entry->disk_len = ordered->disk_len;
222 __entry->bytes_left = ordered->bytes_left;
223 __entry->flags = ordered->flags;
224 __entry->compress_type = ordered->compress_type;
225 __entry->refs = atomic_read(&ordered->refs);
226 __entry->root_objectid =
227 BTRFS_I(inode)->root->root_key.objectid;
228 ),
229
230 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, "
231 "start = %llu, len = %llu, disk_len = %llu, "
232 "bytes_left = %llu, flags = %s, compress_type = %d, "
233 "refs = %d",
234 show_root_type(__entry->root_objectid),
235 (unsigned long long)__entry->ino,
236 (unsigned long long)__entry->file_offset,
237 (unsigned long long)__entry->start,
238 (unsigned long long)__entry->len,
239 (unsigned long long)__entry->disk_len,
240 (unsigned long long)__entry->bytes_left,
241 show_ordered_flags(__entry->flags),
242 __entry->compress_type, __entry->refs)
243);
244
245DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add,
246
247 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
248
249 TP_ARGS(inode, ordered)
250);
251
252DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove,
253
254 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
255
256 TP_ARGS(inode, ordered)
257);
258
259DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start,
260
261 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
262
263 TP_ARGS(inode, ordered)
264);
265
266DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put,
267
268 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
269
270 TP_ARGS(inode, ordered)
271);
272
273DECLARE_EVENT_CLASS(btrfs__writepage,
274
275 TP_PROTO(struct page *page, struct inode *inode,
276 struct writeback_control *wbc),
277
278 TP_ARGS(page, inode, wbc),
279
280 TP_STRUCT__entry(
281 __field( ino_t, ino )
282 __field( pgoff_t, index )
283 __field( long, nr_to_write )
284 __field( long, pages_skipped )
285 __field( loff_t, range_start )
286 __field( loff_t, range_end )
287 __field( char, nonblocking )
288 __field( char, for_kupdate )
289 __field( char, for_reclaim )
290 __field( char, range_cyclic )
291 __field( pgoff_t, writeback_index )
292 __field( u64, root_objectid )
293 ),
294
295 TP_fast_assign(
296 __entry->ino = inode->i_ino;
297 __entry->index = page->index;
298 __entry->nr_to_write = wbc->nr_to_write;
299 __entry->pages_skipped = wbc->pages_skipped;
300 __entry->range_start = wbc->range_start;
301 __entry->range_end = wbc->range_end;
302 __entry->nonblocking = wbc->nonblocking;
303 __entry->for_kupdate = wbc->for_kupdate;
304 __entry->for_reclaim = wbc->for_reclaim;
305 __entry->range_cyclic = wbc->range_cyclic;
306 __entry->writeback_index = inode->i_mapping->writeback_index;
307 __entry->root_objectid =
308 BTRFS_I(inode)->root->root_key.objectid;
309 ),
310
311 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, "
312 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, "
313 "range_end = %llu, nonblocking = %d, for_kupdate = %d, "
314 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu",
315 show_root_type(__entry->root_objectid),
316 (unsigned long)__entry->ino, __entry->index,
317 __entry->nr_to_write, __entry->pages_skipped,
318 __entry->range_start, __entry->range_end,
319 __entry->nonblocking, __entry->for_kupdate,
320 __entry->for_reclaim, __entry->range_cyclic,
321 (unsigned long)__entry->writeback_index)
322);
323
324DEFINE_EVENT(btrfs__writepage, __extent_writepage,
325
326 TP_PROTO(struct page *page, struct inode *inode,
327 struct writeback_control *wbc),
328
329 TP_ARGS(page, inode, wbc)
330);
331
332TRACE_EVENT(btrfs_writepage_end_io_hook,
333
334 TP_PROTO(struct page *page, u64 start, u64 end, int uptodate),
335
336 TP_ARGS(page, start, end, uptodate),
337
338 TP_STRUCT__entry(
339 __field( ino_t, ino )
340 __field( pgoff_t, index )
341 __field( u64, start )
342 __field( u64, end )
343 __field( int, uptodate )
344 __field( u64, root_objectid )
345 ),
346
347 TP_fast_assign(
348 __entry->ino = page->mapping->host->i_ino;
349 __entry->index = page->index;
350 __entry->start = start;
351 __entry->end = end;
352 __entry->uptodate = uptodate;
353 __entry->root_objectid =
354 BTRFS_I(page->mapping->host)->root->root_key.objectid;
355 ),
356
357 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, "
358 "end = %llu, uptodate = %d",
359 show_root_type(__entry->root_objectid),
360 (unsigned long)__entry->ino, (unsigned long)__entry->index,
361 (unsigned long long)__entry->start,
362 (unsigned long long)__entry->end, __entry->uptodate)
363);
364
365TRACE_EVENT(btrfs_sync_file,
366
367 TP_PROTO(struct file *file, int datasync),
368
369 TP_ARGS(file, datasync),
370
371 TP_STRUCT__entry(
372 __field( ino_t, ino )
373 __field( ino_t, parent )
374 __field( int, datasync )
375 __field( u64, root_objectid )
376 ),
377
378 TP_fast_assign(
379 struct dentry *dentry = file->f_path.dentry;
380 struct inode *inode = dentry->d_inode;
381
382 __entry->ino = inode->i_ino;
383 __entry->parent = dentry->d_parent->d_inode->i_ino;
384 __entry->datasync = datasync;
385 __entry->root_objectid =
386 BTRFS_I(inode)->root->root_key.objectid;
387 ),
388
389 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d",
390 show_root_type(__entry->root_objectid),
391 (unsigned long)__entry->ino, (unsigned long)__entry->parent,
392 __entry->datasync)
393);
394
395TRACE_EVENT(btrfs_sync_fs,
396
397 TP_PROTO(int wait),
398
399 TP_ARGS(wait),
400
401 TP_STRUCT__entry(
402 __field( int, wait )
403 ),
404
405 TP_fast_assign(
406 __entry->wait = wait;
407 ),
408
409 TP_printk("wait = %d", __entry->wait)
410);
411
412#define show_ref_action(action) \
413 __print_symbolic(action, \
414 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \
415 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \
416 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \
417 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" })
418
419
420TRACE_EVENT(btrfs_delayed_tree_ref,
421
422 TP_PROTO(struct btrfs_delayed_ref_node *ref,
423 struct btrfs_delayed_tree_ref *full_ref,
424 int action),
425
426 TP_ARGS(ref, full_ref, action),
427
428 TP_STRUCT__entry(
429 __field( u64, bytenr )
430 __field( u64, num_bytes )
431 __field( int, action )
432 __field( u64, parent )
433 __field( u64, ref_root )
434 __field( int, level )
435 __field( int, type )
436 ),
437
438 TP_fast_assign(
439 __entry->bytenr = ref->bytenr;
440 __entry->num_bytes = ref->num_bytes;
441 __entry->action = action;
442 __entry->parent = full_ref->parent;
443 __entry->ref_root = full_ref->root;
444 __entry->level = full_ref->level;
445 __entry->type = ref->type;
446 ),
447
448 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
449 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
450 "type = %s",
451 (unsigned long long)__entry->bytenr,
452 (unsigned long long)__entry->num_bytes,
453 show_ref_action(__entry->action),
454 show_root_type(__entry->parent),
455 show_root_type(__entry->ref_root),
456 __entry->level, show_ref_type(__entry->type))
457);
458
459TRACE_EVENT(btrfs_delayed_data_ref,
460
461 TP_PROTO(struct btrfs_delayed_ref_node *ref,
462 struct btrfs_delayed_data_ref *full_ref,
463 int action),
464
465 TP_ARGS(ref, full_ref, action),
466
467 TP_STRUCT__entry(
468 __field( u64, bytenr )
469 __field( u64, num_bytes )
470 __field( int, action )
471 __field( u64, parent )
472 __field( u64, ref_root )
473 __field( u64, owner )
474 __field( u64, offset )
475 __field( int, type )
476 ),
477
478 TP_fast_assign(
479 __entry->bytenr = ref->bytenr;
480 __entry->num_bytes = ref->num_bytes;
481 __entry->action = action;
482 __entry->parent = full_ref->parent;
483 __entry->ref_root = full_ref->root;
484 __entry->owner = full_ref->objectid;
485 __entry->offset = full_ref->offset;
486 __entry->type = ref->type;
487 ),
488
489 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
490 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
491 "offset = %llu, type = %s",
492 (unsigned long long)__entry->bytenr,
493 (unsigned long long)__entry->num_bytes,
494 show_ref_action(__entry->action),
495 show_root_type(__entry->parent),
496 show_root_type(__entry->ref_root),
497 (unsigned long long)__entry->owner,
498 (unsigned long long)__entry->offset,
499 show_ref_type(__entry->type))
500);
501
502TRACE_EVENT(btrfs_delayed_ref_head,
503
504 TP_PROTO(struct btrfs_delayed_ref_node *ref,
505 struct btrfs_delayed_ref_head *head_ref,
506 int action),
507
508 TP_ARGS(ref, head_ref, action),
509
510 TP_STRUCT__entry(
511 __field( u64, bytenr )
512 __field( u64, num_bytes )
513 __field( int, action )
514 __field( int, is_data )
515 ),
516
517 TP_fast_assign(
518 __entry->bytenr = ref->bytenr;
519 __entry->num_bytes = ref->num_bytes;
520 __entry->action = action;
521 __entry->is_data = head_ref->is_data;
522 ),
523
524 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d",
525 (unsigned long long)__entry->bytenr,
526 (unsigned long long)__entry->num_bytes,
527 show_ref_action(__entry->action),
528 __entry->is_data)
529);
530
531#define show_chunk_type(type) \
532 __print_flags(type, "|", \
533 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \
534 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
535 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
536 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \
537 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \
538 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \
539 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"})
540
541DECLARE_EVENT_CLASS(btrfs__chunk,
542
543 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
544 u64 offset, u64 size),
545
546 TP_ARGS(root, map, offset, size),
547
548 TP_STRUCT__entry(
549 __field( int, num_stripes )
550 __field( u64, type )
551 __field( int, sub_stripes )
552 __field( u64, offset )
553 __field( u64, size )
554 __field( u64, root_objectid )
555 ),
556
557 TP_fast_assign(
558 __entry->num_stripes = map->num_stripes;
559 __entry->type = map->type;
560 __entry->sub_stripes = map->sub_stripes;
561 __entry->offset = offset;
562 __entry->size = size;
563 __entry->root_objectid = root->root_key.objectid;
564 ),
565
566 TP_printk("root = %llu(%s), offset = %llu, size = %llu, "
567 "num_stripes = %d, sub_stripes = %d, type = %s",
568 show_root_type(__entry->root_objectid),
569 (unsigned long long)__entry->offset,
570 (unsigned long long)__entry->size,
571 __entry->num_stripes, __entry->sub_stripes,
572 show_chunk_type(__entry->type))
573);
574
575DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc,
576
577 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
578 u64 offset, u64 size),
579
580 TP_ARGS(root, map, offset, size)
581);
582
583DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free,
584
585 TP_PROTO(struct btrfs_root *root, struct map_lookup *map,
586 u64 offset, u64 size),
587
588 TP_ARGS(root, map, offset, size)
589);
590
591TRACE_EVENT(btrfs_cow_block,
592
593 TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf,
594 struct extent_buffer *cow),
595
596 TP_ARGS(root, buf, cow),
597
598 TP_STRUCT__entry(
599 __field( u64, root_objectid )
600 __field( u64, buf_start )
601 __field( int, refs )
602 __field( u64, cow_start )
603 __field( int, buf_level )
604 __field( int, cow_level )
605 ),
606
607 TP_fast_assign(
608 __entry->root_objectid = root->root_key.objectid;
609 __entry->buf_start = buf->start;
610 __entry->refs = atomic_read(&buf->refs);
611 __entry->cow_start = cow->start;
612 __entry->buf_level = btrfs_header_level(buf);
613 __entry->cow_level = btrfs_header_level(cow);
614 ),
615
616 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu "
617 "(orig_level = %d), cow_buf = %llu (cow_level = %d)",
618 show_root_type(__entry->root_objectid),
619 __entry->refs,
620 (unsigned long long)__entry->buf_start,
621 __entry->buf_level,
622 (unsigned long long)__entry->cow_start,
623 __entry->cow_level)
624);
625
626DECLARE_EVENT_CLASS(btrfs__reserved_extent,
627
628 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
629
630 TP_ARGS(root, start, len),
631
632 TP_STRUCT__entry(
633 __field( u64, root_objectid )
634 __field( u64, start )
635 __field( u64, len )
636 ),
637
638 TP_fast_assign(
639 __entry->root_objectid = root->root_key.objectid;
640 __entry->start = start;
641 __entry->len = len;
642 ),
643
644 TP_printk("root = %llu(%s), start = %llu, len = %llu",
645 show_root_type(__entry->root_objectid),
646 (unsigned long long)__entry->start,
647 (unsigned long long)__entry->len)
648);
649
650DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc,
651
652 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
653
654 TP_ARGS(root, start, len)
655);
656
657DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
658
659 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
660
661 TP_ARGS(root, start, len)
662);
663
664#endif /* _TRACE_BTRFS_H */
665
666/* This part must be outside protection */
667#include <trace/define_trace.h>
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index e5e345fb2a5c..e09592d2f916 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -21,8 +21,7 @@ TRACE_EVENT(ext4_free_inode,
21 TP_ARGS(inode), 21 TP_ARGS(inode),
22 22
23 TP_STRUCT__entry( 23 TP_STRUCT__entry(
24 __field( int, dev_major ) 24 __field( dev_t, dev )
25 __field( int, dev_minor )
26 __field( ino_t, ino ) 25 __field( ino_t, ino )
27 __field( umode_t, mode ) 26 __field( umode_t, mode )
28 __field( uid_t, uid ) 27 __field( uid_t, uid )
@@ -31,8 +30,7 @@ TRACE_EVENT(ext4_free_inode,
31 ), 30 ),
32 31
33 TP_fast_assign( 32 TP_fast_assign(
34 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 33 __entry->dev = inode->i_sb->s_dev;
35 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
36 __entry->ino = inode->i_ino; 34 __entry->ino = inode->i_ino;
37 __entry->mode = inode->i_mode; 35 __entry->mode = inode->i_mode;
38 __entry->uid = inode->i_uid; 36 __entry->uid = inode->i_uid;
@@ -41,9 +39,9 @@ TRACE_EVENT(ext4_free_inode,
41 ), 39 ),
42 40
43 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", 41 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
44 __entry->dev_major, __entry->dev_minor, 42 MAJOR(__entry->dev), MINOR(__entry->dev),
45 (unsigned long) __entry->ino, __entry->mode, 43 (unsigned long) __entry->ino,
46 __entry->uid, __entry->gid, 44 __entry->mode, __entry->uid, __entry->gid,
47 (unsigned long long) __entry->blocks) 45 (unsigned long long) __entry->blocks)
48); 46);
49 47
@@ -53,21 +51,19 @@ TRACE_EVENT(ext4_request_inode,
53 TP_ARGS(dir, mode), 51 TP_ARGS(dir, mode),
54 52
55 TP_STRUCT__entry( 53 TP_STRUCT__entry(
56 __field( int, dev_major ) 54 __field( dev_t, dev )
57 __field( int, dev_minor )
58 __field( ino_t, dir ) 55 __field( ino_t, dir )
59 __field( umode_t, mode ) 56 __field( umode_t, mode )
60 ), 57 ),
61 58
62 TP_fast_assign( 59 TP_fast_assign(
63 __entry->dev_major = MAJOR(dir->i_sb->s_dev); 60 __entry->dev = dir->i_sb->s_dev;
64 __entry->dev_minor = MINOR(dir->i_sb->s_dev);
65 __entry->dir = dir->i_ino; 61 __entry->dir = dir->i_ino;
66 __entry->mode = mode; 62 __entry->mode = mode;
67 ), 63 ),
68 64
69 TP_printk("dev %d,%d dir %lu mode 0%o", 65 TP_printk("dev %d,%d dir %lu mode 0%o",
70 __entry->dev_major, __entry->dev_minor, 66 MAJOR(__entry->dev), MINOR(__entry->dev),
71 (unsigned long) __entry->dir, __entry->mode) 67 (unsigned long) __entry->dir, __entry->mode)
72); 68);
73 69
@@ -77,23 +73,21 @@ TRACE_EVENT(ext4_allocate_inode,
77 TP_ARGS(inode, dir, mode), 73 TP_ARGS(inode, dir, mode),
78 74
79 TP_STRUCT__entry( 75 TP_STRUCT__entry(
80 __field( int, dev_major ) 76 __field( dev_t, dev )
81 __field( int, dev_minor )
82 __field( ino_t, ino ) 77 __field( ino_t, ino )
83 __field( ino_t, dir ) 78 __field( ino_t, dir )
84 __field( umode_t, mode ) 79 __field( umode_t, mode )
85 ), 80 ),
86 81
87 TP_fast_assign( 82 TP_fast_assign(
88 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 83 __entry->dev = inode->i_sb->s_dev;
89 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
90 __entry->ino = inode->i_ino; 84 __entry->ino = inode->i_ino;
91 __entry->dir = dir->i_ino; 85 __entry->dir = dir->i_ino;
92 __entry->mode = mode; 86 __entry->mode = mode;
93 ), 87 ),
94 88
95 TP_printk("dev %d,%d ino %lu dir %lu mode 0%o", 89 TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
96 __entry->dev_major, __entry->dev_minor, 90 MAJOR(__entry->dev), MINOR(__entry->dev),
97 (unsigned long) __entry->ino, 91 (unsigned long) __entry->ino,
98 (unsigned long) __entry->dir, __entry->mode) 92 (unsigned long) __entry->dir, __entry->mode)
99); 93);
@@ -104,21 +98,19 @@ TRACE_EVENT(ext4_evict_inode,
104 TP_ARGS(inode), 98 TP_ARGS(inode),
105 99
106 TP_STRUCT__entry( 100 TP_STRUCT__entry(
107 __field( int, dev_major ) 101 __field( dev_t, dev )
108 __field( int, dev_minor )
109 __field( ino_t, ino ) 102 __field( ino_t, ino )
110 __field( int, nlink ) 103 __field( int, nlink )
111 ), 104 ),
112 105
113 TP_fast_assign( 106 TP_fast_assign(
114 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 107 __entry->dev = inode->i_sb->s_dev;
115 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
116 __entry->ino = inode->i_ino; 108 __entry->ino = inode->i_ino;
117 __entry->nlink = inode->i_nlink; 109 __entry->nlink = inode->i_nlink;
118 ), 110 ),
119 111
120 TP_printk("dev %d,%d ino %lu nlink %d", 112 TP_printk("dev %d,%d ino %lu nlink %d",
121 __entry->dev_major, __entry->dev_minor, 113 MAJOR(__entry->dev), MINOR(__entry->dev),
122 (unsigned long) __entry->ino, __entry->nlink) 114 (unsigned long) __entry->ino, __entry->nlink)
123); 115);
124 116
@@ -128,21 +120,19 @@ TRACE_EVENT(ext4_drop_inode,
128 TP_ARGS(inode, drop), 120 TP_ARGS(inode, drop),
129 121
130 TP_STRUCT__entry( 122 TP_STRUCT__entry(
131 __field( int, dev_major ) 123 __field( dev_t, dev )
132 __field( int, dev_minor )
133 __field( ino_t, ino ) 124 __field( ino_t, ino )
134 __field( int, drop ) 125 __field( int, drop )
135 ), 126 ),
136 127
137 TP_fast_assign( 128 TP_fast_assign(
138 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 129 __entry->dev = inode->i_sb->s_dev;
139 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
140 __entry->ino = inode->i_ino; 130 __entry->ino = inode->i_ino;
141 __entry->drop = drop; 131 __entry->drop = drop;
142 ), 132 ),
143 133
144 TP_printk("dev %d,%d ino %lu drop %d", 134 TP_printk("dev %d,%d ino %lu drop %d",
145 __entry->dev_major, __entry->dev_minor, 135 MAJOR(__entry->dev), MINOR(__entry->dev),
146 (unsigned long) __entry->ino, __entry->drop) 136 (unsigned long) __entry->ino, __entry->drop)
147); 137);
148 138
@@ -152,21 +142,19 @@ TRACE_EVENT(ext4_mark_inode_dirty,
152 TP_ARGS(inode, IP), 142 TP_ARGS(inode, IP),
153 143
154 TP_STRUCT__entry( 144 TP_STRUCT__entry(
155 __field( int, dev_major ) 145 __field( dev_t, dev )
156 __field( int, dev_minor )
157 __field( ino_t, ino ) 146 __field( ino_t, ino )
158 __field(unsigned long, ip ) 147 __field(unsigned long, ip )
159 ), 148 ),
160 149
161 TP_fast_assign( 150 TP_fast_assign(
162 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 151 __entry->dev = inode->i_sb->s_dev;
163 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
164 __entry->ino = inode->i_ino; 152 __entry->ino = inode->i_ino;
165 __entry->ip = IP; 153 __entry->ip = IP;
166 ), 154 ),
167 155
168 TP_printk("dev %d,%d ino %lu caller %pF", 156 TP_printk("dev %d,%d ino %lu caller %pF",
169 __entry->dev_major, __entry->dev_minor, 157 MAJOR(__entry->dev), MINOR(__entry->dev),
170 (unsigned long) __entry->ino, (void *)__entry->ip) 158 (unsigned long) __entry->ino, (void *)__entry->ip)
171); 159);
172 160
@@ -176,21 +164,19 @@ TRACE_EVENT(ext4_begin_ordered_truncate,
176 TP_ARGS(inode, new_size), 164 TP_ARGS(inode, new_size),
177 165
178 TP_STRUCT__entry( 166 TP_STRUCT__entry(
179 __field( int, dev_major ) 167 __field( dev_t, dev )
180 __field( int, dev_minor )
181 __field( ino_t, ino ) 168 __field( ino_t, ino )
182 __field( loff_t, new_size ) 169 __field( loff_t, new_size )
183 ), 170 ),
184 171
185 TP_fast_assign( 172 TP_fast_assign(
186 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 173 __entry->dev = inode->i_sb->s_dev;
187 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
188 __entry->ino = inode->i_ino; 174 __entry->ino = inode->i_ino;
189 __entry->new_size = new_size; 175 __entry->new_size = new_size;
190 ), 176 ),
191 177
192 TP_printk("dev %d,%d ino %lu new_size %lld", 178 TP_printk("dev %d,%d ino %lu new_size %lld",
193 __entry->dev_major, __entry->dev_minor, 179 MAJOR(__entry->dev), MINOR(__entry->dev),
194 (unsigned long) __entry->ino, 180 (unsigned long) __entry->ino,
195 (long long) __entry->new_size) 181 (long long) __entry->new_size)
196); 182);
@@ -203,8 +189,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
203 TP_ARGS(inode, pos, len, flags), 189 TP_ARGS(inode, pos, len, flags),
204 190
205 TP_STRUCT__entry( 191 TP_STRUCT__entry(
206 __field( int, dev_major ) 192 __field( dev_t, dev )
207 __field( int, dev_minor )
208 __field( ino_t, ino ) 193 __field( ino_t, ino )
209 __field( loff_t, pos ) 194 __field( loff_t, pos )
210 __field( unsigned int, len ) 195 __field( unsigned int, len )
@@ -212,8 +197,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
212 ), 197 ),
213 198
214 TP_fast_assign( 199 TP_fast_assign(
215 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 200 __entry->dev = inode->i_sb->s_dev;
216 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
217 __entry->ino = inode->i_ino; 201 __entry->ino = inode->i_ino;
218 __entry->pos = pos; 202 __entry->pos = pos;
219 __entry->len = len; 203 __entry->len = len;
@@ -221,7 +205,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
221 ), 205 ),
222 206
223 TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u", 207 TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u",
224 __entry->dev_major, __entry->dev_minor, 208 MAJOR(__entry->dev), MINOR(__entry->dev),
225 (unsigned long) __entry->ino, 209 (unsigned long) __entry->ino,
226 __entry->pos, __entry->len, __entry->flags) 210 __entry->pos, __entry->len, __entry->flags)
227); 211);
@@ -249,8 +233,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
249 TP_ARGS(inode, pos, len, copied), 233 TP_ARGS(inode, pos, len, copied),
250 234
251 TP_STRUCT__entry( 235 TP_STRUCT__entry(
252 __field( int, dev_major ) 236 __field( dev_t, dev )
253 __field( int, dev_minor )
254 __field( ino_t, ino ) 237 __field( ino_t, ino )
255 __field( loff_t, pos ) 238 __field( loff_t, pos )
256 __field( unsigned int, len ) 239 __field( unsigned int, len )
@@ -258,8 +241,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
258 ), 241 ),
259 242
260 TP_fast_assign( 243 TP_fast_assign(
261 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 244 __entry->dev = inode->i_sb->s_dev;
262 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
263 __entry->ino = inode->i_ino; 245 __entry->ino = inode->i_ino;
264 __entry->pos = pos; 246 __entry->pos = pos;
265 __entry->len = len; 247 __entry->len = len;
@@ -267,9 +249,9 @@ DECLARE_EVENT_CLASS(ext4__write_end,
267 ), 249 ),
268 250
269 TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u", 251 TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u",
270 __entry->dev_major, __entry->dev_minor, 252 MAJOR(__entry->dev), MINOR(__entry->dev),
271 (unsigned long) __entry->ino, __entry->pos, 253 (unsigned long) __entry->ino,
272 __entry->len, __entry->copied) 254 __entry->pos, __entry->len, __entry->copied)
273); 255);
274 256
275DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end, 257DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
@@ -310,22 +292,20 @@ TRACE_EVENT(ext4_writepage,
310 TP_ARGS(inode, page), 292 TP_ARGS(inode, page),
311 293
312 TP_STRUCT__entry( 294 TP_STRUCT__entry(
313 __field( int, dev_major ) 295 __field( dev_t, dev )
314 __field( int, dev_minor )
315 __field( ino_t, ino ) 296 __field( ino_t, ino )
316 __field( pgoff_t, index ) 297 __field( pgoff_t, index )
317 298
318 ), 299 ),
319 300
320 TP_fast_assign( 301 TP_fast_assign(
321 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 302 __entry->dev = inode->i_sb->s_dev;
322 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
323 __entry->ino = inode->i_ino; 303 __entry->ino = inode->i_ino;
324 __entry->index = page->index; 304 __entry->index = page->index;
325 ), 305 ),
326 306
327 TP_printk("dev %d,%d ino %lu page_index %lu", 307 TP_printk("dev %d,%d ino %lu page_index %lu",
328 __entry->dev_major, __entry->dev_minor, 308 MAJOR(__entry->dev), MINOR(__entry->dev),
329 (unsigned long) __entry->ino, __entry->index) 309 (unsigned long) __entry->ino, __entry->index)
330); 310);
331 311
@@ -335,43 +315,39 @@ TRACE_EVENT(ext4_da_writepages,
335 TP_ARGS(inode, wbc), 315 TP_ARGS(inode, wbc),
336 316
337 TP_STRUCT__entry( 317 TP_STRUCT__entry(
338 __field( int, dev_major ) 318 __field( dev_t, dev )
339 __field( int, dev_minor )
340 __field( ino_t, ino ) 319 __field( ino_t, ino )
341 __field( long, nr_to_write ) 320 __field( long, nr_to_write )
342 __field( long, pages_skipped ) 321 __field( long, pages_skipped )
343 __field( loff_t, range_start ) 322 __field( loff_t, range_start )
344 __field( loff_t, range_end ) 323 __field( loff_t, range_end )
324 __field( int, sync_mode )
345 __field( char, for_kupdate ) 325 __field( char, for_kupdate )
346 __field( char, for_reclaim )
347 __field( char, range_cyclic ) 326 __field( char, range_cyclic )
348 __field( pgoff_t, writeback_index ) 327 __field( pgoff_t, writeback_index )
349 ), 328 ),
350 329
351 TP_fast_assign( 330 TP_fast_assign(
352 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 331 __entry->dev = inode->i_sb->s_dev;
353 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
354 __entry->ino = inode->i_ino; 332 __entry->ino = inode->i_ino;
355 __entry->nr_to_write = wbc->nr_to_write; 333 __entry->nr_to_write = wbc->nr_to_write;
356 __entry->pages_skipped = wbc->pages_skipped; 334 __entry->pages_skipped = wbc->pages_skipped;
357 __entry->range_start = wbc->range_start; 335 __entry->range_start = wbc->range_start;
358 __entry->range_end = wbc->range_end; 336 __entry->range_end = wbc->range_end;
337 __entry->sync_mode = wbc->sync_mode;
359 __entry->for_kupdate = wbc->for_kupdate; 338 __entry->for_kupdate = wbc->for_kupdate;
360 __entry->for_reclaim = wbc->for_reclaim;
361 __entry->range_cyclic = wbc->range_cyclic; 339 __entry->range_cyclic = wbc->range_cyclic;
362 __entry->writeback_index = inode->i_mapping->writeback_index; 340 __entry->writeback_index = inode->i_mapping->writeback_index;
363 ), 341 ),
364 342
365 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " 343 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
366 "range_start %llu range_end %llu " 344 "range_start %llu range_end %llu sync_mode %d"
367 "for_kupdate %d for_reclaim %d " 345 "for_kupdate %d range_cyclic %d writeback_index %lu",
368 "range_cyclic %d writeback_index %lu", 346 MAJOR(__entry->dev), MINOR(__entry->dev),
369 __entry->dev_major, __entry->dev_minor,
370 (unsigned long) __entry->ino, __entry->nr_to_write, 347 (unsigned long) __entry->ino, __entry->nr_to_write,
371 __entry->pages_skipped, __entry->range_start, 348 __entry->pages_skipped, __entry->range_start,
372 __entry->range_end, 349 __entry->range_end, __entry->sync_mode,
373 __entry->for_kupdate, __entry->for_reclaim, 350 __entry->for_kupdate, __entry->range_cyclic,
374 __entry->range_cyclic,
375 (unsigned long) __entry->writeback_index) 351 (unsigned long) __entry->writeback_index)
376); 352);
377 353
@@ -381,8 +357,7 @@ TRACE_EVENT(ext4_da_write_pages,
381 TP_ARGS(inode, mpd), 357 TP_ARGS(inode, mpd),
382 358
383 TP_STRUCT__entry( 359 TP_STRUCT__entry(
384 __field( int, dev_major ) 360 __field( dev_t, dev )
385 __field( int, dev_minor )
386 __field( ino_t, ino ) 361 __field( ino_t, ino )
387 __field( __u64, b_blocknr ) 362 __field( __u64, b_blocknr )
388 __field( __u32, b_size ) 363 __field( __u32, b_size )
@@ -390,11 +365,11 @@ TRACE_EVENT(ext4_da_write_pages,
390 __field( unsigned long, first_page ) 365 __field( unsigned long, first_page )
391 __field( int, io_done ) 366 __field( int, io_done )
392 __field( int, pages_written ) 367 __field( int, pages_written )
368 __field( int, sync_mode )
393 ), 369 ),
394 370
395 TP_fast_assign( 371 TP_fast_assign(
396 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 372 __entry->dev = inode->i_sb->s_dev;
397 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
398 __entry->ino = inode->i_ino; 373 __entry->ino = inode->i_ino;
399 __entry->b_blocknr = mpd->b_blocknr; 374 __entry->b_blocknr = mpd->b_blocknr;
400 __entry->b_size = mpd->b_size; 375 __entry->b_size = mpd->b_size;
@@ -402,14 +377,18 @@ TRACE_EVENT(ext4_da_write_pages,
402 __entry->first_page = mpd->first_page; 377 __entry->first_page = mpd->first_page;
403 __entry->io_done = mpd->io_done; 378 __entry->io_done = mpd->io_done;
404 __entry->pages_written = mpd->pages_written; 379 __entry->pages_written = mpd->pages_written;
380 __entry->sync_mode = mpd->wbc->sync_mode;
405 ), 381 ),
406 382
407 TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d", 383 TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x "
408 __entry->dev_major, __entry->dev_minor, 384 "first_page %lu io_done %d pages_written %d sync_mode %d",
385 MAJOR(__entry->dev), MINOR(__entry->dev),
409 (unsigned long) __entry->ino, 386 (unsigned long) __entry->ino,
410 __entry->b_blocknr, __entry->b_size, 387 __entry->b_blocknr, __entry->b_size,
411 __entry->b_state, __entry->first_page, 388 __entry->b_state, __entry->first_page,
412 __entry->io_done, __entry->pages_written) 389 __entry->io_done, __entry->pages_written,
390 __entry->sync_mode
391 )
413); 392);
414 393
415TRACE_EVENT(ext4_da_writepages_result, 394TRACE_EVENT(ext4_da_writepages_result,
@@ -419,35 +398,100 @@ TRACE_EVENT(ext4_da_writepages_result,
419 TP_ARGS(inode, wbc, ret, pages_written), 398 TP_ARGS(inode, wbc, ret, pages_written),
420 399
421 TP_STRUCT__entry( 400 TP_STRUCT__entry(
422 __field( int, dev_major ) 401 __field( dev_t, dev )
423 __field( int, dev_minor )
424 __field( ino_t, ino ) 402 __field( ino_t, ino )
425 __field( int, ret ) 403 __field( int, ret )
426 __field( int, pages_written ) 404 __field( int, pages_written )
427 __field( long, pages_skipped ) 405 __field( long, pages_skipped )
406 __field( int, sync_mode )
428 __field( char, more_io ) 407 __field( char, more_io )
429 __field( pgoff_t, writeback_index ) 408 __field( pgoff_t, writeback_index )
430 ), 409 ),
431 410
432 TP_fast_assign( 411 TP_fast_assign(
433 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 412 __entry->dev = inode->i_sb->s_dev;
434 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
435 __entry->ino = inode->i_ino; 413 __entry->ino = inode->i_ino;
436 __entry->ret = ret; 414 __entry->ret = ret;
437 __entry->pages_written = pages_written; 415 __entry->pages_written = pages_written;
438 __entry->pages_skipped = wbc->pages_skipped; 416 __entry->pages_skipped = wbc->pages_skipped;
417 __entry->sync_mode = wbc->sync_mode;
439 __entry->more_io = wbc->more_io; 418 __entry->more_io = wbc->more_io;
440 __entry->writeback_index = inode->i_mapping->writeback_index; 419 __entry->writeback_index = inode->i_mapping->writeback_index;
441 ), 420 ),
442 421
443 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld more_io %d writeback_index %lu", 422 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
444 __entry->dev_major, __entry->dev_minor, 423 " more_io %d sync_mode %d writeback_index %lu",
424 MAJOR(__entry->dev), MINOR(__entry->dev),
445 (unsigned long) __entry->ino, __entry->ret, 425 (unsigned long) __entry->ino, __entry->ret,
446 __entry->pages_written, __entry->pages_skipped, 426 __entry->pages_written, __entry->pages_skipped,
447 __entry->more_io, 427 __entry->more_io, __entry->sync_mode,
448 (unsigned long) __entry->writeback_index) 428 (unsigned long) __entry->writeback_index)
449); 429);
450 430
431DECLARE_EVENT_CLASS(ext4__page_op,
432 TP_PROTO(struct page *page),
433
434 TP_ARGS(page),
435
436 TP_STRUCT__entry(
437 __field( pgoff_t, index )
438 __field( ino_t, ino )
439 __field( dev_t, dev )
440
441 ),
442
443 TP_fast_assign(
444 __entry->index = page->index;
445 __entry->ino = page->mapping->host->i_ino;
446 __entry->dev = page->mapping->host->i_sb->s_dev;
447 ),
448
449 TP_printk("dev %d,%d ino %lu page_index %lu",
450 MAJOR(__entry->dev), MINOR(__entry->dev),
451 (unsigned long) __entry->ino,
452 __entry->index)
453);
454
455DEFINE_EVENT(ext4__page_op, ext4_readpage,
456
457 TP_PROTO(struct page *page),
458
459 TP_ARGS(page)
460);
461
462DEFINE_EVENT(ext4__page_op, ext4_releasepage,
463
464 TP_PROTO(struct page *page),
465
466 TP_ARGS(page)
467);
468
469TRACE_EVENT(ext4_invalidatepage,
470 TP_PROTO(struct page *page, unsigned long offset),
471
472 TP_ARGS(page, offset),
473
474 TP_STRUCT__entry(
475 __field( pgoff_t, index )
476 __field( unsigned long, offset )
477 __field( ino_t, ino )
478 __field( dev_t, dev )
479
480 ),
481
482 TP_fast_assign(
483 __entry->index = page->index;
484 __entry->offset = offset;
485 __entry->ino = page->mapping->host->i_ino;
486 __entry->dev = page->mapping->host->i_sb->s_dev;
487 ),
488
489 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
490 MAJOR(__entry->dev), MINOR(__entry->dev),
491 (unsigned long) __entry->ino,
492 __entry->index, __entry->offset)
493);
494
451TRACE_EVENT(ext4_discard_blocks, 495TRACE_EVENT(ext4_discard_blocks,
452 TP_PROTO(struct super_block *sb, unsigned long long blk, 496 TP_PROTO(struct super_block *sb, unsigned long long blk,
453 unsigned long long count), 497 unsigned long long count),
@@ -455,22 +499,20 @@ TRACE_EVENT(ext4_discard_blocks,
455 TP_ARGS(sb, blk, count), 499 TP_ARGS(sb, blk, count),
456 500
457 TP_STRUCT__entry( 501 TP_STRUCT__entry(
458 __field( int, dev_major ) 502 __field( dev_t, dev )
459 __field( int, dev_minor )
460 __field( __u64, blk ) 503 __field( __u64, blk )
461 __field( __u64, count ) 504 __field( __u64, count )
462 505
463 ), 506 ),
464 507
465 TP_fast_assign( 508 TP_fast_assign(
466 __entry->dev_major = MAJOR(sb->s_dev); 509 __entry->dev = sb->s_dev;
467 __entry->dev_minor = MINOR(sb->s_dev);
468 __entry->blk = blk; 510 __entry->blk = blk;
469 __entry->count = count; 511 __entry->count = count;
470 ), 512 ),
471 513
472 TP_printk("dev %d,%d blk %llu count %llu", 514 TP_printk("dev %d,%d blk %llu count %llu",
473 __entry->dev_major, __entry->dev_minor, 515 MAJOR(__entry->dev), MINOR(__entry->dev),
474 __entry->blk, __entry->count) 516 __entry->blk, __entry->count)
475); 517);
476 518
@@ -481,8 +523,7 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
481 TP_ARGS(ac, pa), 523 TP_ARGS(ac, pa),
482 524
483 TP_STRUCT__entry( 525 TP_STRUCT__entry(
484 __field( int, dev_major ) 526 __field( dev_t, dev )
485 __field( int, dev_minor )
486 __field( ino_t, ino ) 527 __field( ino_t, ino )
487 __field( __u64, pa_pstart ) 528 __field( __u64, pa_pstart )
488 __field( __u32, pa_len ) 529 __field( __u32, pa_len )
@@ -491,8 +532,7 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
491 ), 532 ),
492 533
493 TP_fast_assign( 534 TP_fast_assign(
494 __entry->dev_major = MAJOR(ac->ac_sb->s_dev); 535 __entry->dev = ac->ac_sb->s_dev;
495 __entry->dev_minor = MINOR(ac->ac_sb->s_dev);
496 __entry->ino = ac->ac_inode->i_ino; 536 __entry->ino = ac->ac_inode->i_ino;
497 __entry->pa_pstart = pa->pa_pstart; 537 __entry->pa_pstart = pa->pa_pstart;
498 __entry->pa_len = pa->pa_len; 538 __entry->pa_len = pa->pa_len;
@@ -500,9 +540,9 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
500 ), 540 ),
501 541
502 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu", 542 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
503 __entry->dev_major, __entry->dev_minor, 543 MAJOR(__entry->dev), MINOR(__entry->dev),
504 (unsigned long) __entry->ino, __entry->pa_pstart, 544 (unsigned long) __entry->ino,
505 __entry->pa_len, __entry->pa_lstart) 545 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
506); 546);
507 547
508DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa, 548DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
@@ -530,8 +570,7 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
530 TP_ARGS(sb, inode, pa, block, count), 570 TP_ARGS(sb, inode, pa, block, count),
531 571
532 TP_STRUCT__entry( 572 TP_STRUCT__entry(
533 __field( int, dev_major ) 573 __field( dev_t, dev )
534 __field( int, dev_minor )
535 __field( ino_t, ino ) 574 __field( ino_t, ino )
536 __field( __u64, block ) 575 __field( __u64, block )
537 __field( __u32, count ) 576 __field( __u32, count )
@@ -539,16 +578,16 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
539 ), 578 ),
540 579
541 TP_fast_assign( 580 TP_fast_assign(
542 __entry->dev_major = MAJOR(sb->s_dev); 581 __entry->dev = sb->s_dev;
543 __entry->dev_minor = MINOR(sb->s_dev);
544 __entry->ino = inode->i_ino; 582 __entry->ino = inode->i_ino;
545 __entry->block = block; 583 __entry->block = block;
546 __entry->count = count; 584 __entry->count = count;
547 ), 585 ),
548 586
549 TP_printk("dev %d,%d ino %lu block %llu count %u", 587 TP_printk("dev %d,%d ino %lu block %llu count %u",
550 __entry->dev_major, __entry->dev_minor, 588 MAJOR(__entry->dev), MINOR(__entry->dev),
551 (unsigned long) __entry->ino, __entry->block, __entry->count) 589 (unsigned long) __entry->ino,
590 __entry->block, __entry->count)
552); 591);
553 592
554TRACE_EVENT(ext4_mb_release_group_pa, 593TRACE_EVENT(ext4_mb_release_group_pa,
@@ -558,22 +597,20 @@ TRACE_EVENT(ext4_mb_release_group_pa,
558 TP_ARGS(sb, pa), 597 TP_ARGS(sb, pa),
559 598
560 TP_STRUCT__entry( 599 TP_STRUCT__entry(
561 __field( int, dev_major ) 600 __field( dev_t, dev )
562 __field( int, dev_minor )
563 __field( __u64, pa_pstart ) 601 __field( __u64, pa_pstart )
564 __field( __u32, pa_len ) 602 __field( __u32, pa_len )
565 603
566 ), 604 ),
567 605
568 TP_fast_assign( 606 TP_fast_assign(
569 __entry->dev_major = MAJOR(sb->s_dev); 607 __entry->dev = sb->s_dev;
570 __entry->dev_minor = MINOR(sb->s_dev);
571 __entry->pa_pstart = pa->pa_pstart; 608 __entry->pa_pstart = pa->pa_pstart;
572 __entry->pa_len = pa->pa_len; 609 __entry->pa_len = pa->pa_len;
573 ), 610 ),
574 611
575 TP_printk("dev %d,%d pstart %llu len %u", 612 TP_printk("dev %d,%d pstart %llu len %u",
576 __entry->dev_major, __entry->dev_minor, 613 MAJOR(__entry->dev), MINOR(__entry->dev),
577 __entry->pa_pstart, __entry->pa_len) 614 __entry->pa_pstart, __entry->pa_len)
578); 615);
579 616
@@ -583,20 +620,18 @@ TRACE_EVENT(ext4_discard_preallocations,
583 TP_ARGS(inode), 620 TP_ARGS(inode),
584 621
585 TP_STRUCT__entry( 622 TP_STRUCT__entry(
586 __field( int, dev_major ) 623 __field( dev_t, dev )
587 __field( int, dev_minor )
588 __field( ino_t, ino ) 624 __field( ino_t, ino )
589 625
590 ), 626 ),
591 627
592 TP_fast_assign( 628 TP_fast_assign(
593 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 629 __entry->dev = inode->i_sb->s_dev;
594 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
595 __entry->ino = inode->i_ino; 630 __entry->ino = inode->i_ino;
596 ), 631 ),
597 632
598 TP_printk("dev %d,%d ino %lu", 633 TP_printk("dev %d,%d ino %lu",
599 __entry->dev_major, __entry->dev_minor, 634 MAJOR(__entry->dev), MINOR(__entry->dev),
600 (unsigned long) __entry->ino) 635 (unsigned long) __entry->ino)
601); 636);
602 637
@@ -606,20 +641,19 @@ TRACE_EVENT(ext4_mb_discard_preallocations,
606 TP_ARGS(sb, needed), 641 TP_ARGS(sb, needed),
607 642
608 TP_STRUCT__entry( 643 TP_STRUCT__entry(
609 __field( int, dev_major ) 644 __field( dev_t, dev )
610 __field( int, dev_minor )
611 __field( int, needed ) 645 __field( int, needed )
612 646
613 ), 647 ),
614 648
615 TP_fast_assign( 649 TP_fast_assign(
616 __entry->dev_major = MAJOR(sb->s_dev); 650 __entry->dev = sb->s_dev;
617 __entry->dev_minor = MINOR(sb->s_dev);
618 __entry->needed = needed; 651 __entry->needed = needed;
619 ), 652 ),
620 653
621 TP_printk("dev %d,%d needed %d", 654 TP_printk("dev %d,%d needed %d",
622 __entry->dev_major, __entry->dev_minor, __entry->needed) 655 MAJOR(__entry->dev), MINOR(__entry->dev),
656 __entry->needed)
623); 657);
624 658
625TRACE_EVENT(ext4_request_blocks, 659TRACE_EVENT(ext4_request_blocks,
@@ -628,8 +662,7 @@ TRACE_EVENT(ext4_request_blocks,
628 TP_ARGS(ar), 662 TP_ARGS(ar),
629 663
630 TP_STRUCT__entry( 664 TP_STRUCT__entry(
631 __field( int, dev_major ) 665 __field( dev_t, dev )
632 __field( int, dev_minor )
633 __field( ino_t, ino ) 666 __field( ino_t, ino )
634 __field( unsigned int, flags ) 667 __field( unsigned int, flags )
635 __field( unsigned int, len ) 668 __field( unsigned int, len )
@@ -642,8 +675,7 @@ TRACE_EVENT(ext4_request_blocks,
642 ), 675 ),
643 676
644 TP_fast_assign( 677 TP_fast_assign(
645 __entry->dev_major = MAJOR(ar->inode->i_sb->s_dev); 678 __entry->dev = ar->inode->i_sb->s_dev;
646 __entry->dev_minor = MINOR(ar->inode->i_sb->s_dev);
647 __entry->ino = ar->inode->i_ino; 679 __entry->ino = ar->inode->i_ino;
648 __entry->flags = ar->flags; 680 __entry->flags = ar->flags;
649 __entry->len = ar->len; 681 __entry->len = ar->len;
@@ -655,8 +687,9 @@ TRACE_EVENT(ext4_request_blocks,
655 __entry->pright = ar->pright; 687 __entry->pright = ar->pright;
656 ), 688 ),
657 689
658 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 690 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %llu goal %llu "
659 __entry->dev_major, __entry->dev_minor, 691 "lleft %llu lright %llu pleft %llu pright %llu ",
692 MAJOR(__entry->dev), MINOR(__entry->dev),
660 (unsigned long) __entry->ino, 693 (unsigned long) __entry->ino,
661 __entry->flags, __entry->len, 694 __entry->flags, __entry->len,
662 (unsigned long long) __entry->logical, 695 (unsigned long long) __entry->logical,
@@ -673,8 +706,7 @@ TRACE_EVENT(ext4_allocate_blocks,
673 TP_ARGS(ar, block), 706 TP_ARGS(ar, block),
674 707
675 TP_STRUCT__entry( 708 TP_STRUCT__entry(
676 __field( int, dev_major ) 709 __field( dev_t, dev )
677 __field( int, dev_minor )
678 __field( ino_t, ino ) 710 __field( ino_t, ino )
679 __field( __u64, block ) 711 __field( __u64, block )
680 __field( unsigned int, flags ) 712 __field( unsigned int, flags )
@@ -688,8 +720,7 @@ TRACE_EVENT(ext4_allocate_blocks,
688 ), 720 ),
689 721
690 TP_fast_assign( 722 TP_fast_assign(
691 __entry->dev_major = MAJOR(ar->inode->i_sb->s_dev); 723 __entry->dev = ar->inode->i_sb->s_dev;
692 __entry->dev_minor = MINOR(ar->inode->i_sb->s_dev);
693 __entry->ino = ar->inode->i_ino; 724 __entry->ino = ar->inode->i_ino;
694 __entry->block = block; 725 __entry->block = block;
695 __entry->flags = ar->flags; 726 __entry->flags = ar->flags;
@@ -702,10 +733,11 @@ TRACE_EVENT(ext4_allocate_blocks,
702 __entry->pright = ar->pright; 733 __entry->pright = ar->pright;
703 ), 734 ),
704 735
705 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 736 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %llu "
706 __entry->dev_major, __entry->dev_minor, 737 "goal %llu lleft %llu lright %llu pleft %llu pright %llu",
707 (unsigned long) __entry->ino, __entry->flags, 738 MAJOR(__entry->dev), MINOR(__entry->dev),
708 __entry->len, __entry->block, 739 (unsigned long) __entry->ino,
740 __entry->flags, __entry->len, __entry->block,
709 (unsigned long long) __entry->logical, 741 (unsigned long long) __entry->logical,
710 (unsigned long long) __entry->goal, 742 (unsigned long long) __entry->goal,
711 (unsigned long long) __entry->lleft, 743 (unsigned long long) __entry->lleft,
@@ -721,8 +753,7 @@ TRACE_EVENT(ext4_free_blocks,
721 TP_ARGS(inode, block, count, flags), 753 TP_ARGS(inode, block, count, flags),
722 754
723 TP_STRUCT__entry( 755 TP_STRUCT__entry(
724 __field( int, dev_major ) 756 __field( dev_t, dev )
725 __field( int, dev_minor )
726 __field( ino_t, ino ) 757 __field( ino_t, ino )
727 __field( umode_t, mode ) 758 __field( umode_t, mode )
728 __field( __u64, block ) 759 __field( __u64, block )
@@ -731,8 +762,7 @@ TRACE_EVENT(ext4_free_blocks,
731 ), 762 ),
732 763
733 TP_fast_assign( 764 TP_fast_assign(
734 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 765 __entry->dev = inode->i_sb->s_dev;
735 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
736 __entry->ino = inode->i_ino; 766 __entry->ino = inode->i_ino;
737 __entry->mode = inode->i_mode; 767 __entry->mode = inode->i_mode;
738 __entry->block = block; 768 __entry->block = block;
@@ -741,20 +771,19 @@ TRACE_EVENT(ext4_free_blocks,
741 ), 771 ),
742 772
743 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", 773 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
744 __entry->dev_major, __entry->dev_minor, 774 MAJOR(__entry->dev), MINOR(__entry->dev),
745 (unsigned long) __entry->ino, 775 (unsigned long) __entry->ino,
746 __entry->mode, __entry->block, __entry->count, 776 __entry->mode, __entry->block, __entry->count,
747 __entry->flags) 777 __entry->flags)
748); 778);
749 779
750TRACE_EVENT(ext4_sync_file, 780TRACE_EVENT(ext4_sync_file_enter,
751 TP_PROTO(struct file *file, int datasync), 781 TP_PROTO(struct file *file, int datasync),
752 782
753 TP_ARGS(file, datasync), 783 TP_ARGS(file, datasync),
754 784
755 TP_STRUCT__entry( 785 TP_STRUCT__entry(
756 __field( int, dev_major ) 786 __field( dev_t, dev )
757 __field( int, dev_minor )
758 __field( ino_t, ino ) 787 __field( ino_t, ino )
759 __field( ino_t, parent ) 788 __field( ino_t, parent )
760 __field( int, datasync ) 789 __field( int, datasync )
@@ -763,39 +792,60 @@ TRACE_EVENT(ext4_sync_file,
763 TP_fast_assign( 792 TP_fast_assign(
764 struct dentry *dentry = file->f_path.dentry; 793 struct dentry *dentry = file->f_path.dentry;
765 794
766 __entry->dev_major = MAJOR(dentry->d_inode->i_sb->s_dev); 795 __entry->dev = dentry->d_inode->i_sb->s_dev;
767 __entry->dev_minor = MINOR(dentry->d_inode->i_sb->s_dev);
768 __entry->ino = dentry->d_inode->i_ino; 796 __entry->ino = dentry->d_inode->i_ino;
769 __entry->datasync = datasync; 797 __entry->datasync = datasync;
770 __entry->parent = dentry->d_parent->d_inode->i_ino; 798 __entry->parent = dentry->d_parent->d_inode->i_ino;
771 ), 799 ),
772 800
773 TP_printk("dev %d,%d ino %ld parent %ld datasync %d ", 801 TP_printk("dev %d,%d ino %ld parent %ld datasync %d ",
774 __entry->dev_major, __entry->dev_minor, 802 MAJOR(__entry->dev), MINOR(__entry->dev),
775 (unsigned long) __entry->ino, 803 (unsigned long) __entry->ino,
776 (unsigned long) __entry->parent, __entry->datasync) 804 (unsigned long) __entry->parent, __entry->datasync)
777); 805);
778 806
807TRACE_EVENT(ext4_sync_file_exit,
808 TP_PROTO(struct inode *inode, int ret),
809
810 TP_ARGS(inode, ret),
811
812 TP_STRUCT__entry(
813 __field( int, ret )
814 __field( ino_t, ino )
815 __field( dev_t, dev )
816 ),
817
818 TP_fast_assign(
819 __entry->ret = ret;
820 __entry->ino = inode->i_ino;
821 __entry->dev = inode->i_sb->s_dev;
822 ),
823
824 TP_printk("dev %d,%d ino %ld ret %d",
825 MAJOR(__entry->dev), MINOR(__entry->dev),
826 (unsigned long) __entry->ino,
827 __entry->ret)
828);
829
779TRACE_EVENT(ext4_sync_fs, 830TRACE_EVENT(ext4_sync_fs,
780 TP_PROTO(struct super_block *sb, int wait), 831 TP_PROTO(struct super_block *sb, int wait),
781 832
782 TP_ARGS(sb, wait), 833 TP_ARGS(sb, wait),
783 834
784 TP_STRUCT__entry( 835 TP_STRUCT__entry(
785 __field( int, dev_major ) 836 __field( dev_t, dev )
786 __field( int, dev_minor )
787 __field( int, wait ) 837 __field( int, wait )
788 838
789 ), 839 ),
790 840
791 TP_fast_assign( 841 TP_fast_assign(
792 __entry->dev_major = MAJOR(sb->s_dev); 842 __entry->dev = sb->s_dev;
793 __entry->dev_minor = MINOR(sb->s_dev);
794 __entry->wait = wait; 843 __entry->wait = wait;
795 ), 844 ),
796 845
797 TP_printk("dev %d,%d wait %d", __entry->dev_major, 846 TP_printk("dev %d,%d wait %d",
798 __entry->dev_minor, __entry->wait) 847 MAJOR(__entry->dev), MINOR(__entry->dev),
848 __entry->wait)
799); 849);
800 850
801TRACE_EVENT(ext4_alloc_da_blocks, 851TRACE_EVENT(ext4_alloc_da_blocks,
@@ -804,23 +854,21 @@ TRACE_EVENT(ext4_alloc_da_blocks,
804 TP_ARGS(inode), 854 TP_ARGS(inode),
805 855
806 TP_STRUCT__entry( 856 TP_STRUCT__entry(
807 __field( int, dev_major ) 857 __field( dev_t, dev )
808 __field( int, dev_minor )
809 __field( ino_t, ino ) 858 __field( ino_t, ino )
810 __field( unsigned int, data_blocks ) 859 __field( unsigned int, data_blocks )
811 __field( unsigned int, meta_blocks ) 860 __field( unsigned int, meta_blocks )
812 ), 861 ),
813 862
814 TP_fast_assign( 863 TP_fast_assign(
815 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 864 __entry->dev = inode->i_sb->s_dev;
816 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
817 __entry->ino = inode->i_ino; 865 __entry->ino = inode->i_ino;
818 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 866 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
819 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 867 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
820 ), 868 ),
821 869
822 TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u", 870 TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
823 __entry->dev_major, __entry->dev_minor, 871 MAJOR(__entry->dev), MINOR(__entry->dev),
824 (unsigned long) __entry->ino, 872 (unsigned long) __entry->ino,
825 __entry->data_blocks, __entry->meta_blocks) 873 __entry->data_blocks, __entry->meta_blocks)
826); 874);
@@ -831,8 +879,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
831 TP_ARGS(ac), 879 TP_ARGS(ac),
832 880
833 TP_STRUCT__entry( 881 TP_STRUCT__entry(
834 __field( int, dev_major ) 882 __field( dev_t, dev )
835 __field( int, dev_minor )
836 __field( ino_t, ino ) 883 __field( ino_t, ino )
837 __field( __u16, found ) 884 __field( __u16, found )
838 __field( __u16, groups ) 885 __field( __u16, groups )
@@ -855,8 +902,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
855 ), 902 ),
856 903
857 TP_fast_assign( 904 TP_fast_assign(
858 __entry->dev_major = MAJOR(ac->ac_inode->i_sb->s_dev); 905 __entry->dev = ac->ac_inode->i_sb->s_dev;
859 __entry->dev_minor = MINOR(ac->ac_inode->i_sb->s_dev);
860 __entry->ino = ac->ac_inode->i_ino; 906 __entry->ino = ac->ac_inode->i_ino;
861 __entry->found = ac->ac_found; 907 __entry->found = ac->ac_found;
862 __entry->flags = ac->ac_flags; 908 __entry->flags = ac->ac_flags;
@@ -881,7 +927,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
881 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " 927 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
882 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x " 928 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
883 "tail %u broken %u", 929 "tail %u broken %u",
884 __entry->dev_major, __entry->dev_minor, 930 MAJOR(__entry->dev), MINOR(__entry->dev),
885 (unsigned long) __entry->ino, 931 (unsigned long) __entry->ino,
886 __entry->orig_group, __entry->orig_start, 932 __entry->orig_group, __entry->orig_start,
887 __entry->orig_len, __entry->orig_logical, 933 __entry->orig_len, __entry->orig_logical,
@@ -900,8 +946,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
900 TP_ARGS(ac), 946 TP_ARGS(ac),
901 947
902 TP_STRUCT__entry( 948 TP_STRUCT__entry(
903 __field( int, dev_major ) 949 __field( dev_t, dev )
904 __field( int, dev_minor )
905 __field( ino_t, ino ) 950 __field( ino_t, ino )
906 __field( __u32, orig_logical ) 951 __field( __u32, orig_logical )
907 __field( int, orig_start ) 952 __field( int, orig_start )
@@ -914,8 +959,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
914 ), 959 ),
915 960
916 TP_fast_assign( 961 TP_fast_assign(
917 __entry->dev_major = MAJOR(ac->ac_inode->i_sb->s_dev); 962 __entry->dev = ac->ac_inode->i_sb->s_dev;
918 __entry->dev_minor = MINOR(ac->ac_inode->i_sb->s_dev);
919 __entry->ino = ac->ac_inode->i_ino; 963 __entry->ino = ac->ac_inode->i_ino;
920 __entry->orig_logical = ac->ac_o_ex.fe_logical; 964 __entry->orig_logical = ac->ac_o_ex.fe_logical;
921 __entry->orig_start = ac->ac_o_ex.fe_start; 965 __entry->orig_start = ac->ac_o_ex.fe_start;
@@ -928,7 +972,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
928 ), 972 ),
929 973
930 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u", 974 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
931 __entry->dev_major, __entry->dev_minor, 975 MAJOR(__entry->dev), MINOR(__entry->dev),
932 (unsigned long) __entry->ino, 976 (unsigned long) __entry->ino,
933 __entry->orig_group, __entry->orig_start, 977 __entry->orig_group, __entry->orig_start,
934 __entry->orig_len, __entry->orig_logical, 978 __entry->orig_len, __entry->orig_logical,
@@ -946,8 +990,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
946 TP_ARGS(sb, inode, group, start, len), 990 TP_ARGS(sb, inode, group, start, len),
947 991
948 TP_STRUCT__entry( 992 TP_STRUCT__entry(
949 __field( int, dev_major ) 993 __field( dev_t, dev )
950 __field( int, dev_minor )
951 __field( ino_t, ino ) 994 __field( ino_t, ino )
952 __field( int, result_start ) 995 __field( int, result_start )
953 __field( __u32, result_group ) 996 __field( __u32, result_group )
@@ -955,8 +998,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
955 ), 998 ),
956 999
957 TP_fast_assign( 1000 TP_fast_assign(
958 __entry->dev_major = MAJOR(sb->s_dev); 1001 __entry->dev = sb->s_dev;
959 __entry->dev_minor = MINOR(sb->s_dev);
960 __entry->ino = inode ? inode->i_ino : 0; 1002 __entry->ino = inode ? inode->i_ino : 0;
961 __entry->result_start = start; 1003 __entry->result_start = start;
962 __entry->result_group = group; 1004 __entry->result_group = group;
@@ -964,7 +1006,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
964 ), 1006 ),
965 1007
966 TP_printk("dev %d,%d inode %lu extent %u/%d/%u ", 1008 TP_printk("dev %d,%d inode %lu extent %u/%d/%u ",
967 __entry->dev_major, __entry->dev_minor, 1009 MAJOR(__entry->dev), MINOR(__entry->dev),
968 (unsigned long) __entry->ino, 1010 (unsigned long) __entry->ino,
969 __entry->result_group, __entry->result_start, 1011 __entry->result_group, __entry->result_start,
970 __entry->result_len) 1012 __entry->result_len)
@@ -998,8 +1040,7 @@ TRACE_EVENT(ext4_forget,
998 TP_ARGS(inode, is_metadata, block), 1040 TP_ARGS(inode, is_metadata, block),
999 1041
1000 TP_STRUCT__entry( 1042 TP_STRUCT__entry(
1001 __field( int, dev_major ) 1043 __field( dev_t, dev )
1002 __field( int, dev_minor )
1003 __field( ino_t, ino ) 1044 __field( ino_t, ino )
1004 __field( umode_t, mode ) 1045 __field( umode_t, mode )
1005 __field( int, is_metadata ) 1046 __field( int, is_metadata )
@@ -1007,8 +1048,7 @@ TRACE_EVENT(ext4_forget,
1007 ), 1048 ),
1008 1049
1009 TP_fast_assign( 1050 TP_fast_assign(
1010 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1051 __entry->dev = inode->i_sb->s_dev;
1011 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1012 __entry->ino = inode->i_ino; 1052 __entry->ino = inode->i_ino;
1013 __entry->mode = inode->i_mode; 1053 __entry->mode = inode->i_mode;
1014 __entry->is_metadata = is_metadata; 1054 __entry->is_metadata = is_metadata;
@@ -1016,9 +1056,9 @@ TRACE_EVENT(ext4_forget,
1016 ), 1056 ),
1017 1057
1018 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu", 1058 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1019 __entry->dev_major, __entry->dev_minor, 1059 MAJOR(__entry->dev), MINOR(__entry->dev),
1020 (unsigned long) __entry->ino, __entry->mode, 1060 (unsigned long) __entry->ino,
1021 __entry->is_metadata, __entry->block) 1061 __entry->mode, __entry->is_metadata, __entry->block)
1022); 1062);
1023 1063
1024TRACE_EVENT(ext4_da_update_reserve_space, 1064TRACE_EVENT(ext4_da_update_reserve_space,
@@ -1027,8 +1067,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1027 TP_ARGS(inode, used_blocks), 1067 TP_ARGS(inode, used_blocks),
1028 1068
1029 TP_STRUCT__entry( 1069 TP_STRUCT__entry(
1030 __field( int, dev_major ) 1070 __field( dev_t, dev )
1031 __field( int, dev_minor )
1032 __field( ino_t, ino ) 1071 __field( ino_t, ino )
1033 __field( umode_t, mode ) 1072 __field( umode_t, mode )
1034 __field( __u64, i_blocks ) 1073 __field( __u64, i_blocks )
@@ -1039,8 +1078,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1039 ), 1078 ),
1040 1079
1041 TP_fast_assign( 1080 TP_fast_assign(
1042 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1081 __entry->dev = inode->i_sb->s_dev;
1043 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1044 __entry->ino = inode->i_ino; 1082 __entry->ino = inode->i_ino;
1045 __entry->mode = inode->i_mode; 1083 __entry->mode = inode->i_mode;
1046 __entry->i_blocks = inode->i_blocks; 1084 __entry->i_blocks = inode->i_blocks;
@@ -1050,10 +1088,12 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1050 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1088 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1051 ), 1089 ),
1052 1090
1053 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", 1091 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1054 __entry->dev_major, __entry->dev_minor, 1092 "reserved_data_blocks %d reserved_meta_blocks %d "
1055 (unsigned long) __entry->ino, __entry->mode, 1093 "allocated_meta_blocks %d",
1056 (unsigned long long) __entry->i_blocks, 1094 MAJOR(__entry->dev), MINOR(__entry->dev),
1095 (unsigned long) __entry->ino,
1096 __entry->mode, (unsigned long long) __entry->i_blocks,
1057 __entry->used_blocks, __entry->reserved_data_blocks, 1097 __entry->used_blocks, __entry->reserved_data_blocks,
1058 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) 1098 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1059); 1099);
@@ -1064,8 +1104,7 @@ TRACE_EVENT(ext4_da_reserve_space,
1064 TP_ARGS(inode, md_needed), 1104 TP_ARGS(inode, md_needed),
1065 1105
1066 TP_STRUCT__entry( 1106 TP_STRUCT__entry(
1067 __field( int, dev_major ) 1107 __field( dev_t, dev )
1068 __field( int, dev_minor )
1069 __field( ino_t, ino ) 1108 __field( ino_t, ino )
1070 __field( umode_t, mode ) 1109 __field( umode_t, mode )
1071 __field( __u64, i_blocks ) 1110 __field( __u64, i_blocks )
@@ -1075,8 +1114,7 @@ TRACE_EVENT(ext4_da_reserve_space,
1075 ), 1114 ),
1076 1115
1077 TP_fast_assign( 1116 TP_fast_assign(
1078 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1117 __entry->dev = inode->i_sb->s_dev;
1079 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1080 __entry->ino = inode->i_ino; 1118 __entry->ino = inode->i_ino;
1081 __entry->mode = inode->i_mode; 1119 __entry->mode = inode->i_mode;
1082 __entry->i_blocks = inode->i_blocks; 1120 __entry->i_blocks = inode->i_blocks;
@@ -1085,8 +1123,9 @@ TRACE_EVENT(ext4_da_reserve_space,
1085 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1123 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1086 ), 1124 ),
1087 1125
1088 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d", 1126 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
1089 __entry->dev_major, __entry->dev_minor, 1127 "reserved_data_blocks %d reserved_meta_blocks %d",
1128 MAJOR(__entry->dev), MINOR(__entry->dev),
1090 (unsigned long) __entry->ino, 1129 (unsigned long) __entry->ino,
1091 __entry->mode, (unsigned long long) __entry->i_blocks, 1130 __entry->mode, (unsigned long long) __entry->i_blocks,
1092 __entry->md_needed, __entry->reserved_data_blocks, 1131 __entry->md_needed, __entry->reserved_data_blocks,
@@ -1099,8 +1138,7 @@ TRACE_EVENT(ext4_da_release_space,
1099 TP_ARGS(inode, freed_blocks), 1138 TP_ARGS(inode, freed_blocks),
1100 1139
1101 TP_STRUCT__entry( 1140 TP_STRUCT__entry(
1102 __field( int, dev_major ) 1141 __field( dev_t, dev )
1103 __field( int, dev_minor )
1104 __field( ino_t, ino ) 1142 __field( ino_t, ino )
1105 __field( umode_t, mode ) 1143 __field( umode_t, mode )
1106 __field( __u64, i_blocks ) 1144 __field( __u64, i_blocks )
@@ -1111,8 +1149,7 @@ TRACE_EVENT(ext4_da_release_space,
1111 ), 1149 ),
1112 1150
1113 TP_fast_assign( 1151 TP_fast_assign(
1114 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1152 __entry->dev = inode->i_sb->s_dev;
1115 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1116 __entry->ino = inode->i_ino; 1153 __entry->ino = inode->i_ino;
1117 __entry->mode = inode->i_mode; 1154 __entry->mode = inode->i_mode;
1118 __entry->i_blocks = inode->i_blocks; 1155 __entry->i_blocks = inode->i_blocks;
@@ -1122,8 +1159,10 @@ TRACE_EVENT(ext4_da_release_space,
1122 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1159 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1123 ), 1160 ),
1124 1161
1125 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", 1162 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1126 __entry->dev_major, __entry->dev_minor, 1163 "reserved_data_blocks %d reserved_meta_blocks %d "
1164 "allocated_meta_blocks %d",
1165 MAJOR(__entry->dev), MINOR(__entry->dev),
1127 (unsigned long) __entry->ino, 1166 (unsigned long) __entry->ino,
1128 __entry->mode, (unsigned long long) __entry->i_blocks, 1167 __entry->mode, (unsigned long long) __entry->i_blocks,
1129 __entry->freed_blocks, __entry->reserved_data_blocks, 1168 __entry->freed_blocks, __entry->reserved_data_blocks,
@@ -1136,20 +1175,19 @@ DECLARE_EVENT_CLASS(ext4__bitmap_load,
1136 TP_ARGS(sb, group), 1175 TP_ARGS(sb, group),
1137 1176
1138 TP_STRUCT__entry( 1177 TP_STRUCT__entry(
1139 __field( int, dev_major ) 1178 __field( dev_t, dev )
1140 __field( int, dev_minor )
1141 __field( __u32, group ) 1179 __field( __u32, group )
1142 1180
1143 ), 1181 ),
1144 1182
1145 TP_fast_assign( 1183 TP_fast_assign(
1146 __entry->dev_major = MAJOR(sb->s_dev); 1184 __entry->dev = sb->s_dev;
1147 __entry->dev_minor = MINOR(sb->s_dev);
1148 __entry->group = group; 1185 __entry->group = group;
1149 ), 1186 ),
1150 1187
1151 TP_printk("dev %d,%d group %u", 1188 TP_printk("dev %d,%d group %u",
1152 __entry->dev_major, __entry->dev_minor, __entry->group) 1189 MAJOR(__entry->dev), MINOR(__entry->dev),
1190 __entry->group)
1153); 1191);
1154 1192
1155DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load, 1193DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
@@ -1166,6 +1204,349 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1166 TP_ARGS(sb, group) 1204 TP_ARGS(sb, group)
1167); 1205);
1168 1206
1207DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1208
1209 TP_PROTO(struct super_block *sb, unsigned long group),
1210
1211 TP_ARGS(sb, group)
1212);
1213
1214DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1215
1216 TP_PROTO(struct super_block *sb, unsigned long group),
1217
1218 TP_ARGS(sb, group)
1219);
1220
1221TRACE_EVENT(ext4_direct_IO_enter,
1222 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1223
1224 TP_ARGS(inode, offset, len, rw),
1225
1226 TP_STRUCT__entry(
1227 __field( ino_t, ino )
1228 __field( dev_t, dev )
1229 __field( loff_t, pos )
1230 __field( unsigned long, len )
1231 __field( int, rw )
1232 ),
1233
1234 TP_fast_assign(
1235 __entry->ino = inode->i_ino;
1236 __entry->dev = inode->i_sb->s_dev;
1237 __entry->pos = offset;
1238 __entry->len = len;
1239 __entry->rw = rw;
1240 ),
1241
1242 TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d",
1243 MAJOR(__entry->dev), MINOR(__entry->dev),
1244 (unsigned long) __entry->ino,
1245 (unsigned long long) __entry->pos, __entry->len, __entry->rw)
1246);
1247
1248TRACE_EVENT(ext4_direct_IO_exit,
1249 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw, int ret),
1250
1251 TP_ARGS(inode, offset, len, rw, ret),
1252
1253 TP_STRUCT__entry(
1254 __field( ino_t, ino )
1255 __field( dev_t, dev )
1256 __field( loff_t, pos )
1257 __field( unsigned long, len )
1258 __field( int, rw )
1259 __field( int, ret )
1260 ),
1261
1262 TP_fast_assign(
1263 __entry->ino = inode->i_ino;
1264 __entry->dev = inode->i_sb->s_dev;
1265 __entry->pos = offset;
1266 __entry->len = len;
1267 __entry->rw = rw;
1268 __entry->ret = ret;
1269 ),
1270
1271 TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d ret %d",
1272 MAJOR(__entry->dev), MINOR(__entry->dev),
1273 (unsigned long) __entry->ino,
1274 (unsigned long long) __entry->pos, __entry->len,
1275 __entry->rw, __entry->ret)
1276);
1277
1278TRACE_EVENT(ext4_fallocate_enter,
1279 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1280
1281 TP_ARGS(inode, offset, len, mode),
1282
1283 TP_STRUCT__entry(
1284 __field( ino_t, ino )
1285 __field( dev_t, dev )
1286 __field( loff_t, pos )
1287 __field( loff_t, len )
1288 __field( int, mode )
1289 ),
1290
1291 TP_fast_assign(
1292 __entry->ino = inode->i_ino;
1293 __entry->dev = inode->i_sb->s_dev;
1294 __entry->pos = offset;
1295 __entry->len = len;
1296 __entry->mode = mode;
1297 ),
1298
1299 TP_printk("dev %d,%d ino %ld pos %llu len %llu mode %d",
1300 MAJOR(__entry->dev), MINOR(__entry->dev),
1301 (unsigned long) __entry->ino,
1302 (unsigned long long) __entry->pos,
1303 (unsigned long long) __entry->len, __entry->mode)
1304);
1305
1306TRACE_EVENT(ext4_fallocate_exit,
1307 TP_PROTO(struct inode *inode, loff_t offset, unsigned int max_blocks, int ret),
1308
1309 TP_ARGS(inode, offset, max_blocks, ret),
1310
1311 TP_STRUCT__entry(
1312 __field( ino_t, ino )
1313 __field( dev_t, dev )
1314 __field( loff_t, pos )
1315 __field( unsigned, blocks )
1316 __field( int, ret )
1317 ),
1318
1319 TP_fast_assign(
1320 __entry->ino = inode->i_ino;
1321 __entry->dev = inode->i_sb->s_dev;
1322 __entry->pos = offset;
1323 __entry->blocks = max_blocks;
1324 __entry->ret = ret;
1325 ),
1326
1327 TP_printk("dev %d,%d ino %ld pos %llu blocks %d ret %d",
1328 MAJOR(__entry->dev), MINOR(__entry->dev),
1329 (unsigned long) __entry->ino,
1330 (unsigned long long) __entry->pos, __entry->blocks,
1331 __entry->ret)
1332);
1333
1334TRACE_EVENT(ext4_unlink_enter,
1335 TP_PROTO(struct inode *parent, struct dentry *dentry),
1336
1337 TP_ARGS(parent, dentry),
1338
1339 TP_STRUCT__entry(
1340 __field( ino_t, parent )
1341 __field( ino_t, ino )
1342 __field( loff_t, size )
1343 __field( dev_t, dev )
1344 ),
1345
1346 TP_fast_assign(
1347 __entry->parent = parent->i_ino;
1348 __entry->ino = dentry->d_inode->i_ino;
1349 __entry->size = dentry->d_inode->i_size;
1350 __entry->dev = dentry->d_inode->i_sb->s_dev;
1351 ),
1352
1353 TP_printk("dev %d,%d ino %ld size %lld parent %ld",
1354 MAJOR(__entry->dev), MINOR(__entry->dev),
1355 (unsigned long) __entry->ino, __entry->size,
1356 (unsigned long) __entry->parent)
1357);
1358
1359TRACE_EVENT(ext4_unlink_exit,
1360 TP_PROTO(struct dentry *dentry, int ret),
1361
1362 TP_ARGS(dentry, ret),
1363
1364 TP_STRUCT__entry(
1365 __field( ino_t, ino )
1366 __field( dev_t, dev )
1367 __field( int, ret )
1368 ),
1369
1370 TP_fast_assign(
1371 __entry->ino = dentry->d_inode->i_ino;
1372 __entry->dev = dentry->d_inode->i_sb->s_dev;
1373 __entry->ret = ret;
1374 ),
1375
1376 TP_printk("dev %d,%d ino %ld ret %d",
1377 MAJOR(__entry->dev), MINOR(__entry->dev),
1378 (unsigned long) __entry->ino,
1379 __entry->ret)
1380);
1381
1382DECLARE_EVENT_CLASS(ext4__truncate,
1383 TP_PROTO(struct inode *inode),
1384
1385 TP_ARGS(inode),
1386
1387 TP_STRUCT__entry(
1388 __field( ino_t, ino )
1389 __field( dev_t, dev )
1390 __field( blkcnt_t, blocks )
1391 ),
1392
1393 TP_fast_assign(
1394 __entry->ino = inode->i_ino;
1395 __entry->dev = inode->i_sb->s_dev;
1396 __entry->blocks = inode->i_blocks;
1397 ),
1398
1399 TP_printk("dev %d,%d ino %lu blocks %lu",
1400 MAJOR(__entry->dev), MINOR(__entry->dev),
1401 (unsigned long) __entry->ino, (unsigned long) __entry->blocks)
1402);
1403
1404DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1405
1406 TP_PROTO(struct inode *inode),
1407
1408 TP_ARGS(inode)
1409);
1410
1411DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1412
1413 TP_PROTO(struct inode *inode),
1414
1415 TP_ARGS(inode)
1416);
1417
1418DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1419 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1420 unsigned len, unsigned flags),
1421
1422 TP_ARGS(inode, lblk, len, flags),
1423
1424 TP_STRUCT__entry(
1425 __field( ino_t, ino )
1426 __field( dev_t, dev )
1427 __field( ext4_lblk_t, lblk )
1428 __field( unsigned, len )
1429 __field( unsigned, flags )
1430 ),
1431
1432 TP_fast_assign(
1433 __entry->ino = inode->i_ino;
1434 __entry->dev = inode->i_sb->s_dev;
1435 __entry->lblk = lblk;
1436 __entry->len = len;
1437 __entry->flags = flags;
1438 ),
1439
1440 TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u",
1441 MAJOR(__entry->dev), MINOR(__entry->dev),
1442 (unsigned long) __entry->ino,
1443 (unsigned) __entry->lblk, __entry->len, __entry->flags)
1444);
1445
1446DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1447 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1448 unsigned len, unsigned flags),
1449
1450 TP_ARGS(inode, lblk, len, flags)
1451);
1452
1453DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1454 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1455 unsigned len, unsigned flags),
1456
1457 TP_ARGS(inode, lblk, len, flags)
1458);
1459
1460DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1461 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1462 ext4_fsblk_t pblk, unsigned len, int ret),
1463
1464 TP_ARGS(inode, lblk, pblk, len, ret),
1465
1466 TP_STRUCT__entry(
1467 __field( ino_t, ino )
1468 __field( dev_t, dev )
1469 __field( ext4_lblk_t, lblk )
1470 __field( ext4_fsblk_t, pblk )
1471 __field( unsigned, len )
1472 __field( int, ret )
1473 ),
1474
1475 TP_fast_assign(
1476 __entry->ino = inode->i_ino;
1477 __entry->dev = inode->i_sb->s_dev;
1478 __entry->lblk = lblk;
1479 __entry->pblk = pblk;
1480 __entry->len = len;
1481 __entry->ret = ret;
1482 ),
1483
1484 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
1485 MAJOR(__entry->dev), MINOR(__entry->dev),
1486 (unsigned long) __entry->ino,
1487 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1488 __entry->len, __entry->ret)
1489);
1490
1491DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1492 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1493 ext4_fsblk_t pblk, unsigned len, int ret),
1494
1495 TP_ARGS(inode, lblk, pblk, len, ret)
1496);
1497
1498DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1499 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1500 ext4_fsblk_t pblk, unsigned len, int ret),
1501
1502 TP_ARGS(inode, lblk, pblk, len, ret)
1503);
1504
1505TRACE_EVENT(ext4_ext_load_extent,
1506 TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1507
1508 TP_ARGS(inode, lblk, pblk),
1509
1510 TP_STRUCT__entry(
1511 __field( ino_t, ino )
1512 __field( dev_t, dev )
1513 __field( ext4_lblk_t, lblk )
1514 __field( ext4_fsblk_t, pblk )
1515 ),
1516
1517 TP_fast_assign(
1518 __entry->ino = inode->i_ino;
1519 __entry->dev = inode->i_sb->s_dev;
1520 __entry->lblk = lblk;
1521 __entry->pblk = pblk;
1522 ),
1523
1524 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1525 MAJOR(__entry->dev), MINOR(__entry->dev),
1526 (unsigned long) __entry->ino,
1527 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk)
1528);
1529
1530TRACE_EVENT(ext4_load_inode,
1531 TP_PROTO(struct inode *inode),
1532
1533 TP_ARGS(inode),
1534
1535 TP_STRUCT__entry(
1536 __field( ino_t, ino )
1537 __field( dev_t, dev )
1538 ),
1539
1540 TP_fast_assign(
1541 __entry->ino = inode->i_ino;
1542 __entry->dev = inode->i_sb->s_dev;
1543 ),
1544
1545 TP_printk("dev %d,%d ino %ld",
1546 MAJOR(__entry->dev), MINOR(__entry->dev),
1547 (unsigned long) __entry->ino)
1548);
1549
1169#endif /* _TRACE_EXT4_H */ 1550#endif /* _TRACE_EXT4_H */
1170 1551
1171/* This part must be outside protection */ 1552/* This part must be outside protection */
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 7447ea9305b5..bf16545cc977 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -17,19 +17,17 @@ TRACE_EVENT(jbd2_checkpoint,
17 TP_ARGS(journal, result), 17 TP_ARGS(journal, result),
18 18
19 TP_STRUCT__entry( 19 TP_STRUCT__entry(
20 __field( int, dev_major ) 20 __field( dev_t, dev )
21 __field( int, dev_minor )
22 __field( int, result ) 21 __field( int, result )
23 ), 22 ),
24 23
25 TP_fast_assign( 24 TP_fast_assign(
26 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 25 __entry->dev = journal->j_fs_dev->bd_dev;
27 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
28 __entry->result = result; 26 __entry->result = result;
29 ), 27 ),
30 28
31 TP_printk("dev %d,%d result %d", 29 TP_printk("dev %s result %d",
32 __entry->dev_major, __entry->dev_minor, __entry->result) 30 jbd2_dev_to_name(__entry->dev), __entry->result)
33); 31);
34 32
35DECLARE_EVENT_CLASS(jbd2_commit, 33DECLARE_EVENT_CLASS(jbd2_commit,
@@ -39,22 +37,20 @@ DECLARE_EVENT_CLASS(jbd2_commit,
39 TP_ARGS(journal, commit_transaction), 37 TP_ARGS(journal, commit_transaction),
40 38
41 TP_STRUCT__entry( 39 TP_STRUCT__entry(
42 __field( int, dev_major ) 40 __field( dev_t, dev )
43 __field( int, dev_minor )
44 __field( char, sync_commit ) 41 __field( char, sync_commit )
45 __field( int, transaction ) 42 __field( int, transaction )
46 ), 43 ),
47 44
48 TP_fast_assign( 45 TP_fast_assign(
49 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 46 __entry->dev = journal->j_fs_dev->bd_dev;
50 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
51 __entry->sync_commit = commit_transaction->t_synchronous_commit; 47 __entry->sync_commit = commit_transaction->t_synchronous_commit;
52 __entry->transaction = commit_transaction->t_tid; 48 __entry->transaction = commit_transaction->t_tid;
53 ), 49 ),
54 50
55 TP_printk("dev %d,%d transaction %d sync %d", 51 TP_printk("dev %s transaction %d sync %d",
56 __entry->dev_major, __entry->dev_minor, 52 jbd2_dev_to_name(__entry->dev), __entry->transaction,
57 __entry->transaction, __entry->sync_commit) 53 __entry->sync_commit)
58); 54);
59 55
60DEFINE_EVENT(jbd2_commit, jbd2_start_commit, 56DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
@@ -91,24 +87,22 @@ TRACE_EVENT(jbd2_end_commit,
91 TP_ARGS(journal, commit_transaction), 87 TP_ARGS(journal, commit_transaction),
92 88
93 TP_STRUCT__entry( 89 TP_STRUCT__entry(
94 __field( int, dev_major ) 90 __field( dev_t, dev )
95 __field( int, dev_minor )
96 __field( char, sync_commit ) 91 __field( char, sync_commit )
97 __field( int, transaction ) 92 __field( int, transaction )
98 __field( int, head ) 93 __field( int, head )
99 ), 94 ),
100 95
101 TP_fast_assign( 96 TP_fast_assign(
102 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 97 __entry->dev = journal->j_fs_dev->bd_dev;
103 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
104 __entry->sync_commit = commit_transaction->t_synchronous_commit; 98 __entry->sync_commit = commit_transaction->t_synchronous_commit;
105 __entry->transaction = commit_transaction->t_tid; 99 __entry->transaction = commit_transaction->t_tid;
106 __entry->head = journal->j_tail_sequence; 100 __entry->head = journal->j_tail_sequence;
107 ), 101 ),
108 102
109 TP_printk("dev %d,%d transaction %d sync %d head %d", 103 TP_printk("dev %s transaction %d sync %d head %d",
110 __entry->dev_major, __entry->dev_minor, 104 jbd2_dev_to_name(__entry->dev), __entry->transaction,
111 __entry->transaction, __entry->sync_commit, __entry->head) 105 __entry->sync_commit, __entry->head)
112); 106);
113 107
114TRACE_EVENT(jbd2_submit_inode_data, 108TRACE_EVENT(jbd2_submit_inode_data,
@@ -117,20 +111,17 @@ TRACE_EVENT(jbd2_submit_inode_data,
117 TP_ARGS(inode), 111 TP_ARGS(inode),
118 112
119 TP_STRUCT__entry( 113 TP_STRUCT__entry(
120 __field( int, dev_major ) 114 __field( dev_t, dev )
121 __field( int, dev_minor )
122 __field( ino_t, ino ) 115 __field( ino_t, ino )
123 ), 116 ),
124 117
125 TP_fast_assign( 118 TP_fast_assign(
126 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 119 __entry->dev = inode->i_sb->s_dev;
127 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
128 __entry->ino = inode->i_ino; 120 __entry->ino = inode->i_ino;
129 ), 121 ),
130 122
131 TP_printk("dev %d,%d ino %lu", 123 TP_printk("dev %s ino %lu",
132 __entry->dev_major, __entry->dev_minor, 124 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
133 (unsigned long) __entry->ino)
134); 125);
135 126
136TRACE_EVENT(jbd2_run_stats, 127TRACE_EVENT(jbd2_run_stats,
@@ -140,8 +131,7 @@ TRACE_EVENT(jbd2_run_stats,
140 TP_ARGS(dev, tid, stats), 131 TP_ARGS(dev, tid, stats),
141 132
142 TP_STRUCT__entry( 133 TP_STRUCT__entry(
143 __field( int, dev_major ) 134 __field( dev_t, dev )
144 __field( int, dev_minor )
145 __field( unsigned long, tid ) 135 __field( unsigned long, tid )
146 __field( unsigned long, wait ) 136 __field( unsigned long, wait )
147 __field( unsigned long, running ) 137 __field( unsigned long, running )
@@ -154,8 +144,7 @@ TRACE_EVENT(jbd2_run_stats,
154 ), 144 ),
155 145
156 TP_fast_assign( 146 TP_fast_assign(
157 __entry->dev_major = MAJOR(dev); 147 __entry->dev = dev;
158 __entry->dev_minor = MINOR(dev);
159 __entry->tid = tid; 148 __entry->tid = tid;
160 __entry->wait = stats->rs_wait; 149 __entry->wait = stats->rs_wait;
161 __entry->running = stats->rs_running; 150 __entry->running = stats->rs_running;
@@ -167,9 +156,9 @@ TRACE_EVENT(jbd2_run_stats,
167 __entry->blocks_logged = stats->rs_blocks_logged; 156 __entry->blocks_logged = stats->rs_blocks_logged;
168 ), 157 ),
169 158
170 TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u " 159 TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
171 "logging %u handle_count %u blocks %u blocks_logged %u", 160 "logging %u handle_count %u blocks %u blocks_logged %u",
172 __entry->dev_major, __entry->dev_minor, __entry->tid, 161 jbd2_dev_to_name(__entry->dev), __entry->tid,
173 jiffies_to_msecs(__entry->wait), 162 jiffies_to_msecs(__entry->wait),
174 jiffies_to_msecs(__entry->running), 163 jiffies_to_msecs(__entry->running),
175 jiffies_to_msecs(__entry->locked), 164 jiffies_to_msecs(__entry->locked),
@@ -186,8 +175,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
186 TP_ARGS(dev, tid, stats), 175 TP_ARGS(dev, tid, stats),
187 176
188 TP_STRUCT__entry( 177 TP_STRUCT__entry(
189 __field( int, dev_major ) 178 __field( dev_t, dev )
190 __field( int, dev_minor )
191 __field( unsigned long, tid ) 179 __field( unsigned long, tid )
192 __field( unsigned long, chp_time ) 180 __field( unsigned long, chp_time )
193 __field( __u32, forced_to_close ) 181 __field( __u32, forced_to_close )
@@ -196,8 +184,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
196 ), 184 ),
197 185
198 TP_fast_assign( 186 TP_fast_assign(
199 __entry->dev_major = MAJOR(dev); 187 __entry->dev = dev;
200 __entry->dev_minor = MINOR(dev);
201 __entry->tid = tid; 188 __entry->tid = tid;
202 __entry->chp_time = stats->cs_chp_time; 189 __entry->chp_time = stats->cs_chp_time;
203 __entry->forced_to_close= stats->cs_forced_to_close; 190 __entry->forced_to_close= stats->cs_forced_to_close;
@@ -205,9 +192,9 @@ TRACE_EVENT(jbd2_checkpoint_stats,
205 __entry->dropped = stats->cs_dropped; 192 __entry->dropped = stats->cs_dropped;
206 ), 193 ),
207 194
208 TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u " 195 TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
209 "written %u dropped %u", 196 "written %u dropped %u",
210 __entry->dev_major, __entry->dev_minor, __entry->tid, 197 jbd2_dev_to_name(__entry->dev), __entry->tid,
211 jiffies_to_msecs(__entry->chp_time), 198 jiffies_to_msecs(__entry->chp_time),
212 __entry->forced_to_close, __entry->written, __entry->dropped) 199 __entry->forced_to_close, __entry->written, __entry->dropped)
213); 200);
@@ -220,8 +207,7 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
220 TP_ARGS(journal, first_tid, block_nr, freed), 207 TP_ARGS(journal, first_tid, block_nr, freed),
221 208
222 TP_STRUCT__entry( 209 TP_STRUCT__entry(
223 __field( int, dev_major ) 210 __field( dev_t, dev )
224 __field( int, dev_minor )
225 __field( tid_t, tail_sequence ) 211 __field( tid_t, tail_sequence )
226 __field( tid_t, first_tid ) 212 __field( tid_t, first_tid )
227 __field(unsigned long, block_nr ) 213 __field(unsigned long, block_nr )
@@ -229,18 +215,16 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
229 ), 215 ),
230 216
231 TP_fast_assign( 217 TP_fast_assign(
232 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 218 __entry->dev = journal->j_fs_dev->bd_dev;
233 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
234 __entry->tail_sequence = journal->j_tail_sequence; 219 __entry->tail_sequence = journal->j_tail_sequence;
235 __entry->first_tid = first_tid; 220 __entry->first_tid = first_tid;
236 __entry->block_nr = block_nr; 221 __entry->block_nr = block_nr;
237 __entry->freed = freed; 222 __entry->freed = freed;
238 ), 223 ),
239 224
240 TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", 225 TP_printk("dev %s from %u to %u offset %lu freed %lu",
241 __entry->dev_major, __entry->dev_minor, 226 jbd2_dev_to_name(__entry->dev), __entry->tail_sequence,
242 __entry->tail_sequence, __entry->first_tid, 227 __entry->first_tid, __entry->block_nr, __entry->freed)
243 __entry->block_nr, __entry->freed)
244); 228);
245 229
246#endif /* _TRACE_JBD2_H */ 230#endif /* _TRACE_JBD2_H */
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 0c864db1a466..28447f1594fa 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -52,6 +52,7 @@ struct atmel_lcdfb_info {
52 u8 bl_power; 52 u8 bl_power;
53#endif 53#endif
54 bool lcdcon_is_backlight; 54 bool lcdcon_is_backlight;
55 bool lcdcon_pol_negative;
55 u8 saved_lcdcon; 56 u8 saved_lcdcon;
56 57
57 u8 default_bpp; 58 u8 default_bpp;