aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h7
-rw-r--r--include/linux/aio.h21
-rw-r--r--include/linux/amba/pl080.h1
-rw-r--r--include/linux/anon_inodes.h3
-rw-r--r--include/linux/ata.h123
-rw-r--r--include/linux/atmel-ssc.h2
-rw-r--r--include/linux/atmel_serial.h2
-rw-r--r--include/linux/backing-dev.h3
-rw-r--r--include/linux/balloon_compaction.h25
-rw-r--r--include/linux/bcma/bcma.h17
-rw-r--r--include/linux/bcma/bcma_driver_pci.h25
-rw-r--r--include/linux/binfmts.h2
-rw-r--r--include/linux/blkdev.h11
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/can/platform/mcp251x.h15
-rw-r--r--include/linux/capability.h1
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--include/linux/cgroup.h303
-rw-r--r--include/linux/clk-private.h3
-rw-r--r--include/linux/clk-provider.h31
-rw-r--r--include/linux/cmdline-parser.h43
-rw-r--r--include/linux/coda.h1
-rw-r--r--include/linux/compat.h8
-rw-r--r--include/linux/compiler-gcc4.h15
-rw-r--r--include/linux/context_tracking.h128
-rw-r--r--include/linux/context_tracking_state.h39
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpu_rmap.h3
-rw-r--r--include/linux/cpufreq.h389
-rw-r--r--include/linux/cpuidle.h9
-rw-r--r--include/linux/crash_dump.h9
-rw-r--r--include/linux/crc-t10dif.h4
-rw-r--r--include/linux/dcache.h50
-rw-r--r--include/linux/debugfs.h7
-rw-r--r--include/linux/debugobjects.h6
-rw-r--r--include/linux/device-mapper.h12
-rw-r--r--include/linux/device.h35
-rw-r--r--include/linux/dm9000.h4
-rw-r--r--include/linux/dma-contiguous.h64
-rw-r--r--include/linux/dma-mapping.h5
-rw-r--r--include/linux/dma/mmp-pdma.h15
-rw-r--r--include/linux/dmaengine.h54
-rw-r--r--include/linux/err.h5
-rw-r--r--include/linux/etherdevice.h15
-rw-r--r--include/linux/eventfd.h3
-rw-r--r--include/linux/extcon/of_extcon.h31
-rw-r--r--include/linux/f2fs_fs.h20
-rw-r--r--include/linux/filter.h15
-rw-r--r--include/linux/fs.h43
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/fs_struct.h11
-rw-r--r--include/linux/fscache-cache.h4
-rw-r--r--include/linux/fscache.h42
-rw-r--r--include/linux/fsl/mxs-dma.h20
-rw-r--r--include/linux/ftrace_event.h34
-rw-r--r--include/linux/genalloc.h4
-rw-r--r--include/linux/hardirq.h121
-rw-r--r--include/linux/hdmi.h53
-rw-r--r--include/linux/hid-sensor-hub.h2
-rw-r--r--include/linux/hid-sensor-ids.h2
-rw-r--r--include/linux/hid.h20
-rw-r--r--include/linux/hidraw.h1
-rw-r--r--include/linux/huge_mm.h3
-rw-r--r--include/linux/hugetlb.h25
-rw-r--r--include/linux/hyperv.h34
-rw-r--r--include/linux/i2c.h24
-rw-r--r--include/linux/i2c/i2c-hid.h3
-rw-r--r--include/linux/i2c/pxa-i2c.h3
-rw-r--r--include/linux/i8042.h24
-rw-r--r--include/linux/ieee80211.h72
-rw-r--r--include/linux/if_team.h14
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/common/st_sensors.h14
-rw-r--r--include/linux/iio/iio.h54
-rw-r--r--include/linux/iio/sysfs.h5
-rw-r--r--include/linux/init.h1
-rw-r--r--include/linux/intel-iommu.h2
-rw-r--r--include/linux/interrupt.h75
-rw-r--r--include/linux/iommu.h16
-rw-r--r--include/linux/ipc_namespace.h8
-rw-r--r--include/linux/ipv6.h3
-rw-r--r--include/linux/irq.h9
-rw-r--r--include/linux/irqchip/arm-gic.h1
-rw-r--r--include/linux/irqchip/mmp.h6
-rw-r--r--include/linux/irqdesc.h3
-rw-r--r--include/linux/irqnr.h19
-rw-r--r--include/linux/jbd.h17
-rw-r--r--include/linux/jiffies.h8
-rw-r--r--include/linux/jump_label.h28
-rw-r--r--include/linux/jump_label_ratelimit.h34
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/kernel.h11
-rw-r--r--include/linux/kernel_stat.h34
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/kobject_ns.h2
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/ktime.h28
-rw-r--r--include/linux/kvm_host.h14
-rw-r--r--include/linux/libata.h120
-rw-r--r--include/linux/list_lru.h131
-rw-r--r--include/linux/llist.h23
-rw-r--r--include/linux/lockdep.h92
-rw-r--r--include/linux/lockref.h62
-rw-r--r--include/linux/lz4.h8
-rw-r--r--include/linux/math64.h13
-rw-r--r--include/linux/mbus.h16
-rw-r--r--include/linux/memblock.h2
-rw-r--r--include/linux/memcontrol.h67
-rw-r--r--include/linux/memory.h14
-rw-r--r--include/linux/mempolicy.h11
-rw-r--r--include/linux/mfd/arizona/gpio.h96
-rw-r--r--include/linux/mfd/da9063/core.h93
-rw-r--r--include/linux/mfd/da9063/pdata.h111
-rw-r--r--include/linux/mfd/da9063/registers.h1028
-rw-r--r--include/linux/mfd/davinci_voicecodec.h3
-rw-r--r--include/linux/mfd/mcp.h2
-rw-r--r--include/linux/mfd/palmas.h102
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h66
-rw-r--r--include/linux/mfd/samsung/s2mps11.h17
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h1
-rw-r--r--include/linux/mfd/tmio.h1
-rw-r--r--include/linux/mfd/tps65217.h19
-rw-r--r--include/linux/mfd/twl6040.h2
-rw-r--r--include/linux/mfd/ucb1x00.h1
-rw-r--r--include/linux/micrel_phy.h6
-rw-r--r--include/linux/migrate.h8
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h1
-rw-r--r--include/linux/mlx4/device.h17
-rw-r--r--include/linux/mlx4/qp.h5
-rw-r--r--include/linux/mlx5/device.h4
-rw-r--r--include/linux/mlx5/driver.h6
-rw-r--r--include/linux/mm.h39
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mm_types.h5
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/sdhci.h1
-rw-r--r--include/linux/mmc/sh_mmcif.h6
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h2
-rw-r--r--include/linux/mmc/slot-gpio.h3
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/module.h6
-rw-r--r--include/linux/moduleparam.h13
-rw-r--r--include/linux/mount.h1
-rw-r--r--include/linux/msi.h21
-rw-r--r--include/linux/mtd/bbm.h2
-rw-r--r--include/linux/mtd/fsmc.h1
-rw-r--r--include/linux/mtd/mtd.h3
-rw-r--r--include/linux/mtd/nand.h83
-rw-r--r--include/linux/mutex.h6
-rw-r--r--include/linux/mv643xx_eth.h3
-rw-r--r--include/linux/namei.h3
-rw-r--r--include/linux/netdevice.h85
-rw-r--r--include/linux/netfilter.h15
-rw-r--r--include/linux/netfilter/ipset/ip_set.h6
-rw-r--r--include/linux/netfilter/xt_HMARK.h50
-rw-r--r--include/linux/netfilter/xt_rpfilter.h23
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nfs_fs_sb.h13
-rw-r--r--include/linux/nfs_xdr.h28
-rw-r--r--include/linux/nodemask.h11
-rw-r--r--include/linux/nvme.h466
-rw-r--r--include/linux/of.h63
-rw-r--r--include/linux/of_device.h15
-rw-r--r--include/linux/of_fdt.h6
-rw-r--r--include/linux/of_i2c.h46
-rw-r--r--include/linux/of_irq.h20
-rw-r--r--include/linux/of_net.h4
-rw-r--r--include/linux/of_pci.h12
-rw-r--r--include/linux/olpc-ec.h1
-rw-r--r--include/linux/oprofile.h16
-rw-r--r--include/linux/pci-acpi.h10
-rw-r--r--include/linux/pci.h30
-rw-r--r--include/linux/pci_hotplug.h17
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/percpu-defs.h5
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/percpu_ida.h60
-rw-r--r--include/linux/perf_event.h49
-rw-r--r--include/linux/pinctrl/pinconf-generic.h33
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/platform_data/asoc-s3c.h1
-rw-r--r--include/linux/platform_data/at91_adc.h4
-rw-r--r--include/linux/platform_data/atmel.h4
-rw-r--r--include/linux/platform_data/bd6107.h19
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h6
-rw-r--r--include/linux/platform_data/camera-mx3.h4
-rw-r--r--include/linux/platform_data/camera-rcar.h25
-rw-r--r--include/linux/platform_data/cpsw.h44
-rw-r--r--include/linux/platform_data/dma-rcar-hpbdma.h103
-rw-r--r--include/linux/platform_data/edma.h2
-rw-r--r--include/linux/platform_data/efm32-spi.h14
-rw-r--r--include/linux/platform_data/exynos_thermal.h119
-rw-r--r--include/linux/platform_data/gpio-em.h1
-rw-r--r--include/linux/platform_data/gpio_backlight.h21
-rw-r--r--include/linux/platform_data/leds-lp55xx.h10
-rw-r--r--include/linux/platform_data/leds-pca963x.h (renamed from include/linux/platform_data/leds-pca9633.h)25
-rw-r--r--include/linux/platform_data/leds-renesas-tpu.h14
-rw-r--r--include/linux/platform_data/lv5207lp.h19
-rw-r--r--include/linux/platform_data/max310x.h9
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h13
-rw-r--r--include/linux/platform_data/omap-abe-twl6040.h49
-rw-r--r--include/linux/platform_data/pca953x.h (renamed from include/linux/i2c/pca953x.h)0
-rw-r--r--include/linux/platform_data/pinctrl-nomadik.h24
-rw-r--r--include/linux/platform_data/rcar-du.h34
-rw-r--r--include/linux/platform_data/serial-sccnxp.h3
-rw-r--r--include/linux/platform_data/simplefb.h64
-rw-r--r--include/linux/platform_data/st_sensors_pdata.h24
-rw-r--r--include/linux/platform_data/tegra_usb.h32
-rw-r--r--include/linux/platform_data/vsp1.h25
-rw-r--r--include/linux/power/bq24190_charger.h16
-rw-r--r--include/linux/power/twl4030_madc_battery.h39
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/pps_kernel.h2
-rw-r--r--include/linux/preempt_mask.h122
-rw-r--r--include/linux/printk.h2
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/pxa2xx_ssp.h11
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/quotaops.h15
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/pq.h6
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/random.h1
-rw-r--r--include/linux/rbtree.h22
-rw-r--r--include/linux/rculist.h5
-rw-r--r--include/linux/rcupdate.h26
-rw-r--r--include/linux/regmap.h10
-rw-r--r--include/linux/regulator/consumer.h32
-rw-r--r--include/linux/regulator/driver.h27
-rw-r--r--include/linux/regulator/fan53555.h1
-rw-r--r--include/linux/regulator/machine.h1
-rw-r--r--include/linux/regulator/max8660.h2
-rw-r--r--include/linux/regulator/pfuze100.h44
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/sched.h25
-rw-r--r--include/linux/security.h8
-rw-r--r--include/linux/seqlock.h68
-rw-r--r--include/linux/sh_dma.h55
-rw-r--r--include/linux/sh_eth.h10
-rw-r--r--include/linux/shdma-base.h3
-rw-r--r--include/linux/shrinker.h54
-rw-r--r--include/linux/signal.h8
-rw-r--r--include/linux/skbuff.h21
-rw-r--r--include/linux/slab.h156
-rw-r--r--include/linux/slab_def.h106
-rw-r--r--include/linux/slob_def.h31
-rw-r--r--include/linux/slub_def.h110
-rw-r--r--include/linux/smp.h85
-rw-r--r--include/linux/smsc911x.h3
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spi/mmc_spi.h19
-rw-r--r--include/linux/spi/spi.h36
-rw-r--r--include/linux/spi/spi_bitbang.h5
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/sunrpc/auth.h28
-rw-r--r--include/linux/sunrpc/cache.h22
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h39
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/swap.h54
-rw-r--r--include/linux/syscalls.h1
-rw-r--r--include/linux/sysfs.h36
-rw-r--r--include/linux/tc_act/tc_defact.h19
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/tegra-cpuidle.h25
-rw-r--r--include/linux/thermal.h18
-rw-r--r--include/linux/tick.h45
-rw-r--r--include/linux/time-armada-370-xp.h18
-rw-r--r--include/linux/timex.h15
-rw-r--r--include/linux/tty.h66
-rw-r--r--include/linux/tty_flip.h8
-rw-r--r--include/linux/tty_ldisc.h16
-rw-r--r--include/linux/usb.h32
-rw-r--r--include/linux/usb/chipidea.h7
-rw-r--r--include/linux/usb/dwc3-omap.h30
-rw-r--r--include/linux/usb/gadget.h4
-rw-r--r--include/linux/usb/hcd.h19
-rw-r--r--include/linux/usb/of.h10
-rw-r--r--include/linux/usb/phy.h18
-rw-r--r--include/linux/usb/tegra_usb_phy.h40
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h (renamed from include/linux/usb/nop-usb-xceiv.h)2
-rw-r--r--include/linux/usb/usbnet.h5
-rw-r--r--include/linux/usb/wusb-wa.h1
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/user_namespace.h4
-rw-r--r--include/linux/uwb/spec.h5
-rw-r--r--include/linux/vfio.h7
-rw-r--r--include/linux/vga_switcheroo.h13
-rw-r--r--include/linux/vm_event_item.h6
-rw-r--r--include/linux/vmpressure.h6
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/vtime.h74
-rw-r--r--include/linux/workqueue.h7
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/yam.h2
299 files changed, 5695 insertions, 3000 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba256f368..a5db4aeefa36 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
481 481
482acpi_status acpi_os_prepare_sleep(u8 sleep_state, 482acpi_status acpi_os_prepare_sleep(u8 sleep_state,
483 u32 pm1a_control, u32 pm1b_control); 483 u32 pm1a_control, u32 pm1b_control);
484
485void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
486 u32 val_a, u32 val_b));
487
488acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
489 u32 val_a, u32 val_b);
490
484#ifdef CONFIG_X86 491#ifdef CONFIG_X86
485void arch_reserve_mem_area(acpi_physical_address addr, size_t size); 492void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
486#else 493#else
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 1bdf965339f9..d9c92daa3944 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -27,15 +27,13 @@ struct kiocb;
27 */ 27 */
28#define KIOCB_CANCELLED ((void *) (~0ULL)) 28#define KIOCB_CANCELLED ((void *) (~0ULL))
29 29
30typedef int (kiocb_cancel_fn)(struct kiocb *, struct io_event *); 30typedef int (kiocb_cancel_fn)(struct kiocb *);
31 31
32struct kiocb { 32struct kiocb {
33 atomic_t ki_users;
34
35 struct file *ki_filp; 33 struct file *ki_filp;
36 struct kioctx *ki_ctx; /* NULL for sync ops */ 34 struct kioctx *ki_ctx; /* NULL for sync ops */
37 kiocb_cancel_fn *ki_cancel; 35 kiocb_cancel_fn *ki_cancel;
38 void (*ki_dtor)(struct kiocb *); 36 void *private;
39 37
40 union { 38 union {
41 void __user *user; 39 void __user *user;
@@ -44,17 +42,7 @@ struct kiocb {
44 42
45 __u64 ki_user_data; /* user's data for completion */ 43 __u64 ki_user_data; /* user's data for completion */
46 loff_t ki_pos; 44 loff_t ki_pos;
47 45 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
48 void *private;
49 /* State that we remember to be able to restart/retry */
50 unsigned short ki_opcode;
51 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
52 char __user *ki_buf; /* remaining iocb->aio_buf */
53 size_t ki_left; /* remaining bytes */
54 struct iovec ki_inline_vec; /* inline vector */
55 struct iovec *ki_iovec;
56 unsigned long ki_nr_segs;
57 unsigned long ki_cur_seg;
58 46
59 struct list_head ki_list; /* the aio core uses this 47 struct list_head ki_list; /* the aio core uses this
60 * for cancellation */ 48 * for cancellation */
@@ -74,7 +62,6 @@ static inline bool is_sync_kiocb(struct kiocb *kiocb)
74static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) 62static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
75{ 63{
76 *kiocb = (struct kiocb) { 64 *kiocb = (struct kiocb) {
77 .ki_users = ATOMIC_INIT(1),
78 .ki_ctx = NULL, 65 .ki_ctx = NULL,
79 .ki_filp = filp, 66 .ki_filp = filp,
80 .ki_obj.tsk = current, 67 .ki_obj.tsk = current,
@@ -84,7 +71,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp)
84/* prototypes */ 71/* prototypes */
85#ifdef CONFIG_AIO 72#ifdef CONFIG_AIO
86extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 73extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
87extern void aio_put_req(struct kiocb *iocb);
88extern void aio_complete(struct kiocb *iocb, long res, long res2); 74extern void aio_complete(struct kiocb *iocb, long res, long res2);
89struct mm_struct; 75struct mm_struct;
90extern void exit_aio(struct mm_struct *mm); 76extern void exit_aio(struct mm_struct *mm);
@@ -93,7 +79,6 @@ extern long do_io_submit(aio_context_t ctx_id, long nr,
93void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel); 79void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel);
94#else 80#else
95static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 81static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
96static inline void aio_put_req(struct kiocb *iocb) { }
97static inline void aio_complete(struct kiocb *iocb, long res, long res2) { } 82static inline void aio_complete(struct kiocb *iocb, long res, long res2) { }
98struct mm_struct; 83struct mm_struct;
99static inline void exit_aio(struct mm_struct *mm) { } 84static inline void exit_aio(struct mm_struct *mm) { }
diff --git a/include/linux/amba/pl080.h b/include/linux/amba/pl080.h
index 3e7b62fbefbd..91b84a7f0539 100644
--- a/include/linux/amba/pl080.h
+++ b/include/linux/amba/pl080.h
@@ -87,6 +87,7 @@
87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12) 87#define PL080_CONTROL_SB_SIZE_MASK (0x7 << 12)
88#define PL080_CONTROL_SB_SIZE_SHIFT (12) 88#define PL080_CONTROL_SB_SIZE_SHIFT (12)
89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0) 89#define PL080_CONTROL_TRANSFER_SIZE_MASK (0xfff << 0)
90#define PL080S_CONTROL_TRANSFER_SIZE_MASK (0x1ffffff << 0)
90#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0) 91#define PL080_CONTROL_TRANSFER_SIZE_SHIFT (0)
91 92
92#define PL080_BSIZE_1 (0x0) 93#define PL080_BSIZE_1 (0x0)
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index 8013a45242fe..cf573c22b81e 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -13,6 +13,9 @@ struct file_operations;
13struct file *anon_inode_getfile(const char *name, 13struct file *anon_inode_getfile(const char *name,
14 const struct file_operations *fops, 14 const struct file_operations *fops,
15 void *priv, int flags); 15 void *priv, int flags);
16struct file *anon_inode_getfile_private(const char *name,
17 const struct file_operations *fops,
18 void *priv, int flags);
16int anon_inode_getfd(const char *name, const struct file_operations *fops, 19int anon_inode_getfd(const char *name, const struct file_operations *fops,
17 void *priv, int flags); 20 void *priv, int flags);
18 21
diff --git a/include/linux/ata.h b/include/linux/ata.h
index ee0bd9524055..bf4c69ca76df 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -239,6 +239,8 @@ enum {
239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E, 239 ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
240 ATA_CMD_FPDMA_READ = 0x60, 240 ATA_CMD_FPDMA_READ = 0x60,
241 ATA_CMD_FPDMA_WRITE = 0x61, 241 ATA_CMD_FPDMA_WRITE = 0x61,
242 ATA_CMD_FPDMA_SEND = 0x64,
243 ATA_CMD_FPDMA_RECV = 0x65,
242 ATA_CMD_PIO_READ = 0x20, 244 ATA_CMD_PIO_READ = 0x20,
243 ATA_CMD_PIO_READ_EXT = 0x24, 245 ATA_CMD_PIO_READ_EXT = 0x24,
244 ATA_CMD_PIO_WRITE = 0x30, 246 ATA_CMD_PIO_WRITE = 0x30,
@@ -293,8 +295,13 @@ enum {
293 /* marked obsolete in the ATA/ATAPI-7 spec */ 295 /* marked obsolete in the ATA/ATAPI-7 spec */
294 ATA_CMD_RESTORE = 0x10, 296 ATA_CMD_RESTORE = 0x10,
295 297
298 /* Subcmds for ATA_CMD_FPDMA_SEND */
299 ATA_SUBCMD_FPDMA_SEND_DSM = 0x00,
300 ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT = 0x02,
301
296 /* READ_LOG_EXT pages */ 302 /* READ_LOG_EXT pages */
297 ATA_LOG_SATA_NCQ = 0x10, 303 ATA_LOG_SATA_NCQ = 0x10,
304 ATA_LOG_NCQ_SEND_RECV = 0x13,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30, 305 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08, 306 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_OFFSET = 0x30, 307 ATA_LOG_DEVSLP_OFFSET = 0x30,
@@ -305,6 +312,15 @@ enum {
305 ATA_LOG_DEVSLP_VALID = 0x07, 312 ATA_LOG_DEVSLP_VALID = 0x07,
306 ATA_LOG_DEVSLP_VALID_MASK = 0x80, 313 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
307 314
315 /* NCQ send and receive log */
316 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00,
317 ATA_LOG_NCQ_SEND_RECV_SUBCMDS_DSM = (1 << 0),
318 ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET = 0x04,
319 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM = (1 << 0),
320 ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET = 0x08,
321 ATA_LOG_NCQ_SEND_RECV_WR_LOG_OFFSET = 0x0C,
322 ATA_LOG_NCQ_SEND_RECV_SIZE = 0x10,
323
308 /* READ/WRITE LONG (obsolete) */ 324 /* READ/WRITE LONG (obsolete) */
309 ATA_CMD_READ_LONG = 0x22, 325 ATA_CMD_READ_LONG = 0x22,
310 ATA_CMD_READ_LONG_ONCE = 0x23, 326 ATA_CMD_READ_LONG_ONCE = 0x23,
@@ -446,22 +462,6 @@ enum {
446 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */ 462 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */
447 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */ 463 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */
448 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 464 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
449
450 /* struct ata_taskfile flags */
451 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
452 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
453 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
454 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
455 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
456 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
457 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
458
459 /* protocol flags */
460 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
461 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
462 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
463 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
464 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
465}; 465};
466 466
467enum ata_tf_protocols { 467enum ata_tf_protocols {
@@ -488,83 +488,6 @@ struct ata_bmdma_prd {
488 __le32 flags_len; 488 __le32 flags_len;
489}; 489};
490 490
491struct ata_taskfile {
492 unsigned long flags; /* ATA_TFLAG_xxx */
493 u8 protocol; /* ATA_PROT_xxx */
494
495 u8 ctl; /* control reg */
496
497 u8 hob_feature; /* additional data */
498 u8 hob_nsect; /* to support LBA48 */
499 u8 hob_lbal;
500 u8 hob_lbam;
501 u8 hob_lbah;
502
503 u8 feature;
504 u8 nsect;
505 u8 lbal;
506 u8 lbam;
507 u8 lbah;
508
509 u8 device;
510
511 u8 command; /* IO operation */
512};
513
514/*
515 * protocol tests
516 */
517static inline unsigned int ata_prot_flags(u8 prot)
518{
519 switch (prot) {
520 case ATA_PROT_NODATA:
521 return 0;
522 case ATA_PROT_PIO:
523 return ATA_PROT_FLAG_PIO;
524 case ATA_PROT_DMA:
525 return ATA_PROT_FLAG_DMA;
526 case ATA_PROT_NCQ:
527 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
528 case ATAPI_PROT_NODATA:
529 return ATA_PROT_FLAG_ATAPI;
530 case ATAPI_PROT_PIO:
531 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
532 case ATAPI_PROT_DMA:
533 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
534 }
535 return 0;
536}
537
538static inline int ata_is_atapi(u8 prot)
539{
540 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
541}
542
543static inline int ata_is_nodata(u8 prot)
544{
545 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
546}
547
548static inline int ata_is_pio(u8 prot)
549{
550 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
551}
552
553static inline int ata_is_dma(u8 prot)
554{
555 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
556}
557
558static inline int ata_is_ncq(u8 prot)
559{
560 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
561}
562
563static inline int ata_is_data(u8 prot)
564{
565 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
566}
567
568/* 491/*
569 * id tests 492 * id tests
570 */ 493 */
@@ -865,6 +788,11 @@ static inline int ata_id_rotation_rate(const u16 *id)
865 return val; 788 return val;
866} 789}
867 790
791static inline bool ata_id_has_ncq_send_and_recv(const u16 *id)
792{
793 return id[ATA_ID_SATA_CAPABILITY_2] & BIT(6);
794}
795
868static inline bool ata_id_has_trim(const u16 *id) 796static inline bool ata_id_has_trim(const u16 *id)
869{ 797{
870 if (ata_id_major_version(id) >= 7 && 798 if (ata_id_major_version(id) >= 7 &&
@@ -1060,15 +988,6 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer,
1060 return used_bytes; 988 return used_bytes;
1061} 989}
1062 990
1063static inline int is_multi_taskfile(struct ata_taskfile *tf)
1064{
1065 return (tf->command == ATA_CMD_READ_MULTI) ||
1066 (tf->command == ATA_CMD_WRITE_MULTI) ||
1067 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1068 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1070}
1071
1072static inline bool ata_ok(u8 status) 991static inline bool ata_ok(u8 status)
1073{ 992{
1074 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 993 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index deb0ae58b99b..66a0e5384edd 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -11,7 +11,7 @@ struct atmel_ssc_platform_data {
11 11
12struct ssc_device { 12struct ssc_device {
13 struct list_head list; 13 struct list_head list;
14 resource_size_t phybase; 14 dma_addr_t phybase;
15 void __iomem *regs; 15 void __iomem *regs;
16 struct platform_device *pdev; 16 struct platform_device *pdev;
17 struct atmel_ssc_platform_data *pdata; 17 struct atmel_ssc_platform_data *pdata;
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index fd6833764d72..be201ca2990c 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -124,4 +124,6 @@
124#define ATMEL_US_NER 0x44 /* Number of Errors Register */ 124#define ATMEL_US_NER 0x44 /* Number of Errors Register */
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128
127#endif 129#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index c3881553f7d1..5f66d519a726 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -243,6 +243,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
243 * BDI_CAP_EXEC_MAP: Can be mapped for execution 243 * BDI_CAP_EXEC_MAP: Can be mapped for execution
244 * 244 *
245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed. 245 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed.
246 *
247 * BDI_CAP_STRICTLIMIT: Keep number of dirty pages below bdi threshold.
246 */ 248 */
247#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 249#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
248#define BDI_CAP_NO_WRITEBACK 0x00000002 250#define BDI_CAP_NO_WRITEBACK 0x00000002
@@ -254,6 +256,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
254#define BDI_CAP_NO_ACCT_WB 0x00000080 256#define BDI_CAP_NO_ACCT_WB 0x00000080
255#define BDI_CAP_SWAP_BACKED 0x00000100 257#define BDI_CAP_SWAP_BACKED 0x00000100
256#define BDI_CAP_STABLE_WRITES 0x00000200 258#define BDI_CAP_STABLE_WRITES 0x00000200
259#define BDI_CAP_STRICTLIMIT 0x00000400
257 260
258#define BDI_CAP_VMFLAGS \ 261#define BDI_CAP_VMFLAGS \
259 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 262 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index f7f1d7169b11..089743ade734 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -159,6 +159,26 @@ static inline bool balloon_page_movable(struct page *page)
159} 159}
160 160
161/* 161/*
162 * isolated_balloon_page - identify an isolated balloon page on private
163 * compaction/migration page lists.
164 *
165 * After a compaction thread isolates a balloon page for migration, it raises
166 * the page refcount to prevent concurrent compaction threads from re-isolating
167 * the same page. For that reason putback_movable_pages(), or other routines
168 * that need to identify isolated balloon pages on private pagelists, cannot
169 * rely on balloon_page_movable() to accomplish the task.
170 */
171static inline bool isolated_balloon_page(struct page *page)
172{
173 /* Already isolated balloon pages, by default, have a raised refcount */
174 if (page_flags_cleared(page) && !page_mapped(page) &&
175 page_count(page) >= 2)
176 return __is_movable_balloon_page(page);
177
178 return false;
179}
180
181/*
162 * balloon_page_insert - insert a page into the balloon's page list and make 182 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly. 183 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page' 184 * @page : page to be assigned as a 'balloon page'
@@ -243,6 +263,11 @@ static inline bool balloon_page_movable(struct page *page)
243 return false; 263 return false;
244} 264}
245 265
266static inline bool isolated_balloon_page(struct page *page)
267{
268 return false;
269}
270
246static inline bool balloon_page_isolate(struct page *page) 271static inline bool balloon_page_isolate(struct page *page)
247{ 272{
248 return false; 273 return false;
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 622fc505d3e1..4d043c30216f 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -72,7 +72,19 @@ struct bcma_host_ops {
72/* Core-ID values. */ 72/* Core-ID values. */
73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ 73#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */
74#define BCMA_CORE_4706_CHIPCOMMON 0x500 74#define BCMA_CORE_4706_CHIPCOMMON 0x500
75#define BCMA_CORE_PCIEG2 0x501
76#define BCMA_CORE_DMA 0x502
77#define BCMA_CORE_SDIO3 0x503
78#define BCMA_CORE_USB20 0x504
79#define BCMA_CORE_USB30 0x505
80#define BCMA_CORE_A9JTAG 0x506
81#define BCMA_CORE_DDR23 0x507
82#define BCMA_CORE_ROM 0x508
83#define BCMA_CORE_NAND 0x509
84#define BCMA_CORE_QSPI 0x50A
85#define BCMA_CORE_CHIPCOMMON_B 0x50B
75#define BCMA_CORE_4706_SOC_RAM 0x50E 86#define BCMA_CORE_4706_SOC_RAM 0x50E
87#define BCMA_CORE_ARMCA9 0x510
76#define BCMA_CORE_4706_MAC_GBIT 0x52D 88#define BCMA_CORE_4706_MAC_GBIT 0x52D
77#define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */ 89#define BCMA_CORE_AMEMC 0x52E /* DDR1/2 memory controller core */
78#define BCMA_CORE_ALTA 0x534 /* I2S core */ 90#define BCMA_CORE_ALTA 0x534 /* I2S core */
@@ -177,6 +189,11 @@ struct bcma_host_ops {
177#define BCMA_PKG_ID_BCM5357 11 189#define BCMA_PKG_ID_BCM5357 11
178#define BCMA_CHIP_ID_BCM53572 53572 190#define BCMA_CHIP_ID_BCM53572 53572
179#define BCMA_PKG_ID_BCM47188 9 191#define BCMA_PKG_ID_BCM47188 9
192#define BCMA_CHIP_ID_BCM4707 53010
193#define BCMA_PKG_ID_BCM4707 1
194#define BCMA_PKG_ID_BCM4708 2
195#define BCMA_PKG_ID_BCM4709 0
196#define BCMA_CHIP_ID_BCM53018 53018
180 197
181/* Board types (on PCI usually equals to the subsystem dev id) */ 198/* Board types (on PCI usually equals to the subsystem dev id) */
182/* BCM4313 */ 199/* BCM4313 */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 424760f01b9d..0333e605ea0d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -181,10 +181,31 @@ struct pci_dev;
181 181
182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8 182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8
183 183
184#define BCMA_CORE_PCI_
185
186/* MDIO devices (SERDES modules) */
187#define BCMA_CORE_PCI_MDIO_IEEE0 0x000
188#define BCMA_CORE_PCI_MDIO_IEEE1 0x001
189#define BCMA_CORE_PCI_MDIO_BLK0 0x800
190#define BCMA_CORE_PCI_MDIO_BLK1 0x801
191#define BCMA_CORE_PCI_MDIO_BLK1_MGMT0 0x16
192#define BCMA_CORE_PCI_MDIO_BLK1_MGMT1 0x17
193#define BCMA_CORE_PCI_MDIO_BLK1_MGMT2 0x18
194#define BCMA_CORE_PCI_MDIO_BLK1_MGMT3 0x19
195#define BCMA_CORE_PCI_MDIO_BLK1_MGMT4 0x1A
196#define BCMA_CORE_PCI_MDIO_BLK2 0x802
197#define BCMA_CORE_PCI_MDIO_BLK3 0x803
198#define BCMA_CORE_PCI_MDIO_BLK4 0x804
199#define BCMA_CORE_PCI_MDIO_TXPLL 0x808 /* TXPLL register block idx */
200#define BCMA_CORE_PCI_MDIO_TXCTRL0 0x820
201#define BCMA_CORE_PCI_MDIO_SERDESID 0x831
202#define BCMA_CORE_PCI_MDIO_RXCTRL0 0x840
203
184/* PCIE Root Capability Register bits (Host mode only) */ 204/* PCIE Root Capability Register bits (Host mode only) */
185#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 205#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
186 206
187struct bcma_drv_pci; 207struct bcma_drv_pci;
208struct bcma_bus;
188 209
189#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 210#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
190struct bcma_drv_pci_host { 211struct bcma_drv_pci_host {
@@ -219,7 +240,9 @@ struct bcma_drv_pci {
219extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 240extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
220extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 241extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
221 struct bcma_device *core, bool enable); 242 struct bcma_device *core, bool enable);
222extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); 243extern void bcma_core_pci_up(struct bcma_bus *bus);
244extern void bcma_core_pci_down(struct bcma_bus *bus);
245extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
223 246
224extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 247extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
225extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 248extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 70cf138690e9..e8112ae50531 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -31,7 +31,7 @@ struct linux_binprm {
31#ifdef __alpha__ 31#ifdef __alpha__
32 unsigned int taso:1; 32 unsigned int taso:1;
33#endif 33#endif
34 unsigned int recursion_depth; 34 unsigned int recursion_depth; /* only for search_binary_handler() */
35 struct file * file; 35 struct file * file;
36 struct cred *cred; /* new credentials */ 36 struct cred *cred; /* new credentials */
37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */ 37 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2fdb4a451b49..0e6f765aa1f5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -862,6 +862,17 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
862 return blk_queue_get_max_sectors(q, rq->cmd_flags); 862 return blk_queue_get_max_sectors(q, rq->cmd_flags);
863} 863}
864 864
865static inline unsigned int blk_rq_count_bios(struct request *rq)
866{
867 unsigned int nr_bios = 0;
868 struct bio *bio;
869
870 __rq_for_each_bio(bio, rq)
871 nr_bios++;
872
873 return nr_bios;
874}
875
865/* 876/*
866 * Request issue related functions. 877 * Request issue related functions.
867 */ 878 */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 91fa9a94ae92..d77797a52b7b 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -36,6 +36,7 @@ enum bh_state_bits {
36 BH_Quiet, /* Buffer Error Prinks to be quiet */ 36 BH_Quiet, /* Buffer Error Prinks to be quiet */
37 BH_Meta, /* Buffer contains metadata */ 37 BH_Meta, /* Buffer contains metadata */
38 BH_Prio, /* Buffer should be submitted with REQ_PRIO */ 38 BH_Prio, /* Buffer should be submitted with REQ_PRIO */
39 BH_Defer_Completion, /* Defer AIO completion to workqueue */
39 40
40 BH_PrivateStart,/* not a state bit, but the first bit available 41 BH_PrivateStart,/* not a state bit, but the first bit available
41 * for private allocation by other entities 42 * for private allocation by other entities
@@ -128,6 +129,7 @@ BUFFER_FNS(Write_EIO, write_io_error)
128BUFFER_FNS(Unwritten, unwritten) 129BUFFER_FNS(Unwritten, unwritten)
129BUFFER_FNS(Meta, meta) 130BUFFER_FNS(Meta, meta)
130BUFFER_FNS(Prio, prio) 131BUFFER_FNS(Prio, prio)
132BUFFER_FNS(Defer_Completion, defer_completion)
131 133
132#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 134#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
133 135
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 089fe43211a4..dc029dba7a03 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -9,26 +9,13 @@
9 9
10#include <linux/spi/spi.h> 10#include <linux/spi/spi.h>
11 11
12/** 12/*
13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data 13 * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data
14 * @oscillator_frequency: - oscillator frequency in Hz 14 * @oscillator_frequency: - oscillator frequency in Hz
15 * @irq_flags: - IRQF configuration flags
16 * @board_specific_setup: - called before probing the chip (power,reset)
17 * @transceiver_enable: - called to power on/off the transceiver
18 * @power_enable: - called to power on/off the mcp *and* the
19 * transceiver
20 *
21 * Please note that you should define power_enable or transceiver_enable or
22 * none of them. Defining both of them is no use.
23 *
24 */ 15 */
25 16
26struct mcp251x_platform_data { 17struct mcp251x_platform_data {
27 unsigned long oscillator_frequency; 18 unsigned long oscillator_frequency;
28 unsigned long irq_flags;
29 int (*board_specific_setup)(struct spi_device *spi);
30 int (*transceiver_enable)(int enable);
31 int (*power_enable) (int enable);
32}; 19};
33 20
34#endif /* __CAN_PLATFORM_MCP251X_H__ */ 21#endif /* __CAN_PLATFORM_MCP251X_H__ */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index d9a4f7f40f32..a6ee1f9a5018 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -210,7 +210,6 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
210 struct user_namespace *ns, int cap); 210 struct user_namespace *ns, int cap);
211extern bool capable(int cap); 211extern bool capable(int cap);
212extern bool ns_capable(struct user_namespace *ns, int cap); 212extern bool ns_capable(struct user_namespace *ns, int cap);
213extern bool nsown_capable(int cap);
214extern bool inode_capable(const struct inode *inode, int cap); 213extern bool inode_capable(const struct inode *inode, int cap);
215extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
216 215
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index ce6df39f60ff..8f47625a0661 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -335,6 +335,8 @@ extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
335 struct ceph_osd_request *req); 335 struct ceph_osd_request *req);
336extern void ceph_osdc_sync(struct ceph_osd_client *osdc); 336extern void ceph_osdc_sync(struct ceph_osd_client *osdc);
337 337
338extern void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc);
339
338extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, 340extern int ceph_osdc_readpages(struct ceph_osd_client *osdc,
339 struct ceph_vino vino, 341 struct ceph_vino vino,
340 struct ceph_file_layout *layout, 342 struct ceph_file_layout *layout,
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e9ac882868c0..3561d305b1e0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -66,22 +66,25 @@ enum cgroup_subsys_id {
66 66
67/* Per-subsystem/per-cgroup state maintained by the system. */ 67/* Per-subsystem/per-cgroup state maintained by the system. */
68struct cgroup_subsys_state { 68struct cgroup_subsys_state {
69 /* 69 /* the cgroup that this css is attached to */
70 * The cgroup that this subsystem is attached to. Useful
71 * for subsystems that want to know about the cgroup
72 * hierarchy structure
73 */
74 struct cgroup *cgroup; 70 struct cgroup *cgroup;
75 71
72 /* the cgroup subsystem that this css is attached to */
73 struct cgroup_subsys *ss;
74
76 /* reference count - access via css_[try]get() and css_put() */ 75 /* reference count - access via css_[try]get() and css_put() */
77 struct percpu_ref refcnt; 76 struct percpu_ref refcnt;
78 77
78 /* the parent css */
79 struct cgroup_subsys_state *parent;
80
79 unsigned long flags; 81 unsigned long flags;
80 /* ID for this css, if possible */ 82 /* ID for this css, if possible */
81 struct css_id __rcu *id; 83 struct css_id __rcu *id;
82 84
83 /* Used to put @cgroup->dentry on the last css_put() */ 85 /* percpu_ref killing and RCU release */
84 struct work_struct dput_work; 86 struct rcu_head rcu_head;
87 struct work_struct destroy_work;
85}; 88};
86 89
87/* bits in struct cgroup_subsys_state flags field */ 90/* bits in struct cgroup_subsys_state flags field */
@@ -161,7 +164,16 @@ struct cgroup_name {
161struct cgroup { 164struct cgroup {
162 unsigned long flags; /* "unsigned long" so bitops work */ 165 unsigned long flags; /* "unsigned long" so bitops work */
163 166
164 int id; /* ida allocated in-hierarchy ID */ 167 /*
168 * idr allocated in-hierarchy ID.
169 *
170 * The ID of the root cgroup is always 0, and a new cgroup
171 * will be assigned with a smallest available ID.
172 */
173 int id;
174
175 /* the number of attached css's */
176 int nr_css;
165 177
166 /* 178 /*
167 * We link our 'sibling' struct into our parent's 'children'. 179 * We link our 'sibling' struct into our parent's 'children'.
@@ -196,7 +208,7 @@ struct cgroup {
196 struct cgroup_name __rcu *name; 208 struct cgroup_name __rcu *name;
197 209
198 /* Private pointers for each registered subsystem */ 210 /* Private pointers for each registered subsystem */
199 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 211 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
200 212
201 struct cgroupfs_root *root; 213 struct cgroupfs_root *root;
202 214
@@ -220,10 +232,12 @@ struct cgroup {
220 struct list_head pidlists; 232 struct list_head pidlists;
221 struct mutex pidlist_mutex; 233 struct mutex pidlist_mutex;
222 234
235 /* dummy css with NULL ->ss, points back to this cgroup */
236 struct cgroup_subsys_state dummy_css;
237
223 /* For css percpu_ref killing and RCU-protected deletion */ 238 /* For css percpu_ref killing and RCU-protected deletion */
224 struct rcu_head rcu_head; 239 struct rcu_head rcu_head;
225 struct work_struct destroy_work; 240 struct work_struct destroy_work;
226 atomic_t css_kill_cnt;
227 241
228 /* List of events which userspace want to receive */ 242 /* List of events which userspace want to receive */
229 struct list_head event_list; 243 struct list_head event_list;
@@ -322,7 +336,7 @@ struct cgroupfs_root {
322 unsigned long flags; 336 unsigned long flags;
323 337
324 /* IDs for cgroups in this hierarchy */ 338 /* IDs for cgroups in this hierarchy */
325 struct ida cgroup_ida; 339 struct idr cgroup_idr;
326 340
327 /* The path to use for release notifications. */ 341 /* The path to use for release notifications. */
328 char release_agent_path[PATH_MAX]; 342 char release_agent_path[PATH_MAX];
@@ -394,9 +408,10 @@ struct cgroup_map_cb {
394 408
395/* cftype->flags */ 409/* cftype->flags */
396enum { 410enum {
397 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cg */ 411 CFTYPE_ONLY_ON_ROOT = (1 << 0), /* only create on root cgrp */
398 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cg */ 412 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
399 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ 413 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
414 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
400}; 415};
401 416
402#define MAX_CFTYPE_NAME 64 417#define MAX_CFTYPE_NAME 64
@@ -424,35 +439,41 @@ struct cftype {
424 /* CFTYPE_* flags */ 439 /* CFTYPE_* flags */
425 unsigned int flags; 440 unsigned int flags;
426 441
442 /*
443 * The subsys this file belongs to. Initialized automatically
444 * during registration. NULL for cgroup core files.
445 */
446 struct cgroup_subsys *ss;
447
427 int (*open)(struct inode *inode, struct file *file); 448 int (*open)(struct inode *inode, struct file *file);
428 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 449 ssize_t (*read)(struct cgroup_subsys_state *css, struct cftype *cft,
429 struct file *file, 450 struct file *file,
430 char __user *buf, size_t nbytes, loff_t *ppos); 451 char __user *buf, size_t nbytes, loff_t *ppos);
431 /* 452 /*
432 * read_u64() is a shortcut for the common case of returning a 453 * read_u64() is a shortcut for the common case of returning a
433 * single integer. Use it in place of read() 454 * single integer. Use it in place of read()
434 */ 455 */
435 u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); 456 u64 (*read_u64)(struct cgroup_subsys_state *css, struct cftype *cft);
436 /* 457 /*
437 * read_s64() is a signed version of read_u64() 458 * read_s64() is a signed version of read_u64()
438 */ 459 */
439 s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); 460 s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft);
440 /* 461 /*
441 * read_map() is used for defining a map of key/value 462 * read_map() is used for defining a map of key/value
442 * pairs. It should call cb->fill(cb, key, value) for each 463 * pairs. It should call cb->fill(cb, key, value) for each
443 * entry. The key/value pairs (and their ordering) should not 464 * entry. The key/value pairs (and their ordering) should not
444 * change between reboots. 465 * change between reboots.
445 */ 466 */
446 int (*read_map)(struct cgroup *cgrp, struct cftype *cft, 467 int (*read_map)(struct cgroup_subsys_state *css, struct cftype *cft,
447 struct cgroup_map_cb *cb); 468 struct cgroup_map_cb *cb);
448 /* 469 /*
449 * read_seq_string() is used for outputting a simple sequence 470 * read_seq_string() is used for outputting a simple sequence
450 * using seqfile. 471 * using seqfile.
451 */ 472 */
452 int (*read_seq_string)(struct cgroup *cgrp, struct cftype *cft, 473 int (*read_seq_string)(struct cgroup_subsys_state *css,
453 struct seq_file *m); 474 struct cftype *cft, struct seq_file *m);
454 475
455 ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, 476 ssize_t (*write)(struct cgroup_subsys_state *css, struct cftype *cft,
456 struct file *file, 477 struct file *file,
457 const char __user *buf, size_t nbytes, loff_t *ppos); 478 const char __user *buf, size_t nbytes, loff_t *ppos);
458 479
@@ -461,18 +482,20 @@ struct cftype {
461 * a single integer (as parsed by simple_strtoull) from 482 * a single integer (as parsed by simple_strtoull) from
462 * userspace. Use in place of write(); return 0 or error. 483 * userspace. Use in place of write(); return 0 or error.
463 */ 484 */
464 int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); 485 int (*write_u64)(struct cgroup_subsys_state *css, struct cftype *cft,
486 u64 val);
465 /* 487 /*
466 * write_s64() is a signed version of write_u64() 488 * write_s64() is a signed version of write_u64()
467 */ 489 */
468 int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); 490 int (*write_s64)(struct cgroup_subsys_state *css, struct cftype *cft,
491 s64 val);
469 492
470 /* 493 /*
471 * write_string() is passed a nul-terminated kernelspace 494 * write_string() is passed a nul-terminated kernelspace
472 * buffer of maximum length determined by max_write_len. 495 * buffer of maximum length determined by max_write_len.
473 * Returns 0 or -ve error code. 496 * Returns 0 or -ve error code.
474 */ 497 */
475 int (*write_string)(struct cgroup *cgrp, struct cftype *cft, 498 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
476 const char *buffer); 499 const char *buffer);
477 /* 500 /*
478 * trigger() callback can be used to get some kick from the 501 * trigger() callback can be used to get some kick from the
@@ -480,7 +503,7 @@ struct cftype {
480 * at all. The private field can be used to determine the 503 * at all. The private field can be used to determine the
481 * kick type for multiplexing. 504 * kick type for multiplexing.
482 */ 505 */
483 int (*trigger)(struct cgroup *cgrp, unsigned int event); 506 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
484 507
485 int (*release)(struct inode *inode, struct file *file); 508 int (*release)(struct inode *inode, struct file *file);
486 509
@@ -490,16 +513,18 @@ struct cftype {
490 * you want to provide this functionality. Use eventfd_signal() 513 * you want to provide this functionality. Use eventfd_signal()
491 * on eventfd to send notification to userspace. 514 * on eventfd to send notification to userspace.
492 */ 515 */
493 int (*register_event)(struct cgroup *cgrp, struct cftype *cft, 516 int (*register_event)(struct cgroup_subsys_state *css,
494 struct eventfd_ctx *eventfd, const char *args); 517 struct cftype *cft, struct eventfd_ctx *eventfd,
518 const char *args);
495 /* 519 /*
496 * unregister_event() callback will be called when userspace 520 * unregister_event() callback will be called when userspace
497 * closes the eventfd or on cgroup removing. 521 * closes the eventfd or on cgroup removing.
498 * This callback must be implemented, if you want provide 522 * This callback must be implemented, if you want provide
499 * notification functionality. 523 * notification functionality.
500 */ 524 */
501 void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, 525 void (*unregister_event)(struct cgroup_subsys_state *css,
502 struct eventfd_ctx *eventfd); 526 struct cftype *cft,
527 struct eventfd_ctx *eventfd);
503}; 528};
504 529
505/* 530/*
@@ -512,15 +537,6 @@ struct cftype_set {
512 struct cftype *cfts; 537 struct cftype *cfts;
513}; 538};
514 539
515struct cgroup_scanner {
516 struct cgroup *cg;
517 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
518 void (*process_task)(struct task_struct *p,
519 struct cgroup_scanner *scan);
520 struct ptr_heap *heap;
521 void *data;
522};
523
524/* 540/*
525 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This 541 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
526 * function can be called as long as @cgrp is accessible. 542 * function can be called as long as @cgrp is accessible.
@@ -537,7 +553,7 @@ static inline const char *cgroup_name(const struct cgroup *cgrp)
537} 553}
538 554
539int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 555int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
540int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 556int cgroup_rm_cftypes(struct cftype *cfts);
541 557
542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 558bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
543 559
@@ -553,20 +569,22 @@ int cgroup_task_count(const struct cgroup *cgrp);
553struct cgroup_taskset; 569struct cgroup_taskset;
554struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); 570struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
555struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); 571struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
556struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset); 572struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset,
573 int subsys_id);
557int cgroup_taskset_size(struct cgroup_taskset *tset); 574int cgroup_taskset_size(struct cgroup_taskset *tset);
558 575
559/** 576/**
560 * cgroup_taskset_for_each - iterate cgroup_taskset 577 * cgroup_taskset_for_each - iterate cgroup_taskset
561 * @task: the loop cursor 578 * @task: the loop cursor
562 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all 579 * @skip_css: skip if task's css matches this, %NULL to iterate through all
563 * @tset: taskset to iterate 580 * @tset: taskset to iterate
564 */ 581 */
565#define cgroup_taskset_for_each(task, skip_cgrp, tset) \ 582#define cgroup_taskset_for_each(task, skip_css, tset) \
566 for ((task) = cgroup_taskset_first((tset)); (task); \ 583 for ((task) = cgroup_taskset_first((tset)); (task); \
567 (task) = cgroup_taskset_next((tset))) \ 584 (task) = cgroup_taskset_next((tset))) \
568 if (!(skip_cgrp) || \ 585 if (!(skip_css) || \
569 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp)) 586 cgroup_taskset_cur_css((tset), \
587 (skip_css)->ss->subsys_id) != (skip_css))
570 588
571/* 589/*
572 * Control Group subsystem type. 590 * Control Group subsystem type.
@@ -574,18 +592,22 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
574 */ 592 */
575 593
576struct cgroup_subsys { 594struct cgroup_subsys {
577 struct cgroup_subsys_state *(*css_alloc)(struct cgroup *cgrp); 595 struct cgroup_subsys_state *(*css_alloc)(struct cgroup_subsys_state *parent_css);
578 int (*css_online)(struct cgroup *cgrp); 596 int (*css_online)(struct cgroup_subsys_state *css);
579 void (*css_offline)(struct cgroup *cgrp); 597 void (*css_offline)(struct cgroup_subsys_state *css);
580 void (*css_free)(struct cgroup *cgrp); 598 void (*css_free)(struct cgroup_subsys_state *css);
581 599
582 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 600 int (*can_attach)(struct cgroup_subsys_state *css,
583 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 601 struct cgroup_taskset *tset);
584 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 602 void (*cancel_attach)(struct cgroup_subsys_state *css,
603 struct cgroup_taskset *tset);
604 void (*attach)(struct cgroup_subsys_state *css,
605 struct cgroup_taskset *tset);
585 void (*fork)(struct task_struct *task); 606 void (*fork)(struct task_struct *task);
586 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 607 void (*exit)(struct cgroup_subsys_state *css,
608 struct cgroup_subsys_state *old_css,
587 struct task_struct *task); 609 struct task_struct *task);
588 void (*bind)(struct cgroup *root); 610 void (*bind)(struct cgroup_subsys_state *root_css);
589 611
590 int subsys_id; 612 int subsys_id;
591 int disabled; 613 int disabled;
@@ -641,10 +663,17 @@ struct cgroup_subsys {
641#undef IS_SUBSYS_ENABLED 663#undef IS_SUBSYS_ENABLED
642#undef SUBSYS 664#undef SUBSYS
643 665
644static inline struct cgroup_subsys_state *cgroup_subsys_state( 666/**
645 struct cgroup *cgrp, int subsys_id) 667 * css_parent - find the parent css
668 * @css: the target cgroup_subsys_state
669 *
670 * Return the parent css of @css. This function is guaranteed to return
671 * non-NULL parent as long as @css isn't the root.
672 */
673static inline
674struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
646{ 675{
647 return cgrp->subsys[subsys_id]; 676 return css->parent;
648} 677}
649 678
650/** 679/**
@@ -672,7 +701,7 @@ extern struct mutex cgroup_mutex;
672#endif 701#endif
673 702
674/** 703/**
675 * task_subsys_state_check - obtain css for (task, subsys) w/ extra access conds 704 * task_css_check - obtain css for (task, subsys) w/ extra access conds
676 * @task: the target task 705 * @task: the target task
677 * @subsys_id: the target subsystem ID 706 * @subsys_id: the target subsystem ID
678 * @__c: extra condition expression to be passed to rcu_dereference_check() 707 * @__c: extra condition expression to be passed to rcu_dereference_check()
@@ -680,7 +709,7 @@ extern struct mutex cgroup_mutex;
680 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The 709 * Return the cgroup_subsys_state for the (@task, @subsys_id) pair. The
681 * synchronization rules are the same as task_css_set_check(). 710 * synchronization rules are the same as task_css_set_check().
682 */ 711 */
683#define task_subsys_state_check(task, subsys_id, __c) \ 712#define task_css_check(task, subsys_id, __c) \
684 task_css_set_check((task), (__c))->subsys[(subsys_id)] 713 task_css_set_check((task), (__c))->subsys[(subsys_id)]
685 714
686/** 715/**
@@ -695,87 +724,92 @@ static inline struct css_set *task_css_set(struct task_struct *task)
695} 724}
696 725
697/** 726/**
698 * task_subsys_state - obtain css for (task, subsys) 727 * task_css - obtain css for (task, subsys)
699 * @task: the target task 728 * @task: the target task
700 * @subsys_id: the target subsystem ID 729 * @subsys_id: the target subsystem ID
701 * 730 *
702 * See task_subsys_state_check(). 731 * See task_css_check().
703 */ 732 */
704static inline struct cgroup_subsys_state * 733static inline struct cgroup_subsys_state *task_css(struct task_struct *task,
705task_subsys_state(struct task_struct *task, int subsys_id) 734 int subsys_id)
706{ 735{
707 return task_subsys_state_check(task, subsys_id, false); 736 return task_css_check(task, subsys_id, false);
708} 737}
709 738
710static inline struct cgroup* task_cgroup(struct task_struct *task, 739static inline struct cgroup *task_cgroup(struct task_struct *task,
711 int subsys_id) 740 int subsys_id)
712{ 741{
713 return task_subsys_state(task, subsys_id)->cgroup; 742 return task_css(task, subsys_id)->cgroup;
714} 743}
715 744
716struct cgroup *cgroup_next_sibling(struct cgroup *pos); 745struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos,
746 struct cgroup_subsys_state *parent);
747
748struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
717 749
718/** 750/**
719 * cgroup_for_each_child - iterate through children of a cgroup 751 * css_for_each_child - iterate through children of a css
720 * @pos: the cgroup * to use as the loop cursor 752 * @pos: the css * to use as the loop cursor
721 * @cgrp: cgroup whose children to walk 753 * @parent: css whose children to walk
722 * 754 *
723 * Walk @cgrp's children. Must be called under rcu_read_lock(). A child 755 * Walk @parent's children. Must be called under rcu_read_lock(). A child
724 * cgroup which hasn't finished ->css_online() or already has finished 756 * css which hasn't finished ->css_online() or already has finished
725 * ->css_offline() may show up during traversal and it's each subsystem's 757 * ->css_offline() may show up during traversal and it's each subsystem's
726 * responsibility to verify that each @pos is alive. 758 * responsibility to verify that each @pos is alive.
727 * 759 *
728 * If a subsystem synchronizes against the parent in its ->css_online() and 760 * If a subsystem synchronizes against the parent in its ->css_online() and
729 * before starting iterating, a cgroup which finished ->css_online() is 761 * before starting iterating, a css which finished ->css_online() is
730 * guaranteed to be visible in the future iterations. 762 * guaranteed to be visible in the future iterations.
731 * 763 *
732 * It is allowed to temporarily drop RCU read lock during iteration. The 764 * It is allowed to temporarily drop RCU read lock during iteration. The
733 * caller is responsible for ensuring that @pos remains accessible until 765 * caller is responsible for ensuring that @pos remains accessible until
734 * the start of the next iteration by, for example, bumping the css refcnt. 766 * the start of the next iteration by, for example, bumping the css refcnt.
735 */ 767 */
736#define cgroup_for_each_child(pos, cgrp) \ 768#define css_for_each_child(pos, parent) \
737 for ((pos) = list_first_or_null_rcu(&(cgrp)->children, \ 769 for ((pos) = css_next_child(NULL, (parent)); (pos); \
738 struct cgroup, sibling); \ 770 (pos) = css_next_child((pos), (parent)))
739 (pos); (pos) = cgroup_next_sibling((pos))) 771
772struct cgroup_subsys_state *
773css_next_descendant_pre(struct cgroup_subsys_state *pos,
774 struct cgroup_subsys_state *css);
740 775
741struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 776struct cgroup_subsys_state *
742 struct cgroup *cgroup); 777css_rightmost_descendant(struct cgroup_subsys_state *pos);
743struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
744 778
745/** 779/**
746 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants 780 * css_for_each_descendant_pre - pre-order walk of a css's descendants
747 * @pos: the cgroup * to use as the loop cursor 781 * @pos: the css * to use as the loop cursor
748 * @cgroup: cgroup whose descendants to walk 782 * @root: css whose descendants to walk
749 * 783 *
750 * Walk @cgroup's descendants. Must be called under rcu_read_lock(). A 784 * Walk @root's descendants. @root is included in the iteration and the
751 * descendant cgroup which hasn't finished ->css_online() or already has 785 * first node to be visited. Must be called under rcu_read_lock(). A
786 * descendant css which hasn't finished ->css_online() or already has
752 * finished ->css_offline() may show up during traversal and it's each 787 * finished ->css_offline() may show up during traversal and it's each
753 * subsystem's responsibility to verify that each @pos is alive. 788 * subsystem's responsibility to verify that each @pos is alive.
754 * 789 *
755 * If a subsystem synchronizes against the parent in its ->css_online() and 790 * If a subsystem synchronizes against the parent in its ->css_online() and
756 * before starting iterating, and synchronizes against @pos on each 791 * before starting iterating, and synchronizes against @pos on each
757 * iteration, any descendant cgroup which finished ->css_online() is 792 * iteration, any descendant css which finished ->css_online() is
758 * guaranteed to be visible in the future iterations. 793 * guaranteed to be visible in the future iterations.
759 * 794 *
760 * In other words, the following guarantees that a descendant can't escape 795 * In other words, the following guarantees that a descendant can't escape
761 * state updates of its ancestors. 796 * state updates of its ancestors.
762 * 797 *
763 * my_online(@cgrp) 798 * my_online(@css)
764 * { 799 * {
765 * Lock @cgrp->parent and @cgrp; 800 * Lock @css's parent and @css;
766 * Inherit state from @cgrp->parent; 801 * Inherit state from the parent;
767 * Unlock both. 802 * Unlock both.
768 * } 803 * }
769 * 804 *
770 * my_update_state(@cgrp) 805 * my_update_state(@css)
771 * { 806 * {
772 * Lock @cgrp; 807 * css_for_each_descendant_pre(@pos, @css) {
773 * Update @cgrp's state;
774 * Unlock @cgrp;
775 *
776 * cgroup_for_each_descendant_pre(@pos, @cgrp) {
777 * Lock @pos; 808 * Lock @pos;
778 * Verify @pos is alive and inherit state from @pos->parent; 809 * if (@pos == @css)
810 * Update @css's state;
811 * else
812 * Verify @pos is alive and inherit state from its parent;
779 * Unlock @pos; 813 * Unlock @pos;
780 * } 814 * }
781 * } 815 * }
@@ -786,8 +820,7 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
786 * visible by walking order and, as long as inheriting operations to the 820 * visible by walking order and, as long as inheriting operations to the
787 * same @pos are atomic to each other, multiple updates racing each other 821 * same @pos are atomic to each other, multiple updates racing each other
788 * still result in the correct state. It's guaranateed that at least one 822 * still result in the correct state. It's guaranateed that at least one
789 * inheritance happens for any cgroup after the latest update to its 823 * inheritance happens for any css after the latest update to its parent.
790 * parent.
791 * 824 *
792 * If checking parent's state requires locking the parent, each inheriting 825 * If checking parent's state requires locking the parent, each inheriting
793 * iteration should lock and unlock both @pos->parent and @pos. 826 * iteration should lock and unlock both @pos->parent and @pos.
@@ -800,52 +833,45 @@ struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
800 * caller is responsible for ensuring that @pos remains accessible until 833 * caller is responsible for ensuring that @pos remains accessible until
801 * the start of the next iteration by, for example, bumping the css refcnt. 834 * the start of the next iteration by, for example, bumping the css refcnt.
802 */ 835 */
803#define cgroup_for_each_descendant_pre(pos, cgroup) \ 836#define css_for_each_descendant_pre(pos, css) \
804 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \ 837 for ((pos) = css_next_descendant_pre(NULL, (css)); (pos); \
805 pos = cgroup_next_descendant_pre((pos), (cgroup))) 838 (pos) = css_next_descendant_pre((pos), (css)))
806 839
807struct cgroup *cgroup_next_descendant_post(struct cgroup *pos, 840struct cgroup_subsys_state *
808 struct cgroup *cgroup); 841css_next_descendant_post(struct cgroup_subsys_state *pos,
842 struct cgroup_subsys_state *css);
809 843
810/** 844/**
811 * cgroup_for_each_descendant_post - post-order walk of a cgroup's descendants 845 * css_for_each_descendant_post - post-order walk of a css's descendants
812 * @pos: the cgroup * to use as the loop cursor 846 * @pos: the css * to use as the loop cursor
813 * @cgroup: cgroup whose descendants to walk 847 * @css: css whose descendants to walk
814 * 848 *
815 * Similar to cgroup_for_each_descendant_pre() but performs post-order 849 * Similar to css_for_each_descendant_pre() but performs post-order
816 * traversal instead. Note that the walk visibility guarantee described in 850 * traversal instead. @root is included in the iteration and the last
817 * pre-order walk doesn't apply the same to post-order walks. 851 * node to be visited. Note that the walk visibility guarantee described
852 * in pre-order walk doesn't apply the same to post-order walks.
818 */ 853 */
819#define cgroup_for_each_descendant_post(pos, cgroup) \ 854#define css_for_each_descendant_post(pos, css) \
820 for (pos = cgroup_next_descendant_post(NULL, (cgroup)); (pos); \ 855 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
821 pos = cgroup_next_descendant_post((pos), (cgroup))) 856 (pos) = css_next_descendant_post((pos), (css)))
822 857
823/* A cgroup_iter should be treated as an opaque object */ 858/* A css_task_iter should be treated as an opaque object */
824struct cgroup_iter { 859struct css_task_iter {
825 struct list_head *cset_link; 860 struct cgroup_subsys_state *origin_css;
826 struct list_head *task; 861 struct list_head *cset_link;
862 struct list_head *task;
827}; 863};
828 864
829/* 865void css_task_iter_start(struct cgroup_subsys_state *css,
830 * To iterate across the tasks in a cgroup: 866 struct css_task_iter *it);
831 * 867struct task_struct *css_task_iter_next(struct css_task_iter *it);
832 * 1) call cgroup_iter_start to initialize an iterator 868void css_task_iter_end(struct css_task_iter *it);
833 * 869
834 * 2) call cgroup_iter_next() to retrieve member tasks until it 870int css_scan_tasks(struct cgroup_subsys_state *css,
835 * returns NULL or until you want to end the iteration 871 bool (*test)(struct task_struct *, void *),
836 * 872 void (*process)(struct task_struct *, void *),
837 * 3) call cgroup_iter_end() to destroy the iterator. 873 void *data, struct ptr_heap *heap);
838 * 874
839 * Or, call cgroup_scan_tasks() to iterate through every task in a
840 * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
841 * the test_task() callback, but not while calling the process_task()
842 * callback.
843 */
844void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
845struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
846 struct cgroup_iter *it);
847void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
848int cgroup_scan_tasks(struct cgroup_scanner *scan);
849int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 875int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
850int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 876int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
851 877
@@ -878,7 +904,8 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
878 904
879/* Get id and depth of css */ 905/* Get id and depth of css */
880unsigned short css_id(struct cgroup_subsys_state *css); 906unsigned short css_id(struct cgroup_subsys_state *css);
881struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id); 907struct cgroup_subsys_state *css_from_dir(struct dentry *dentry,
908 struct cgroup_subsys *ss);
882 909
883#else /* !CONFIG_CGROUPS */ 910#else /* !CONFIG_CGROUPS */
884 911
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index dd7adff76e81..8138c94409f3 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -33,8 +33,11 @@ struct clk {
33 const char **parent_names; 33 const char **parent_names;
34 struct clk **parents; 34 struct clk **parents;
35 u8 num_parents; 35 u8 num_parents;
36 u8 new_parent_index;
36 unsigned long rate; 37 unsigned long rate;
37 unsigned long new_rate; 38 unsigned long new_rate;
39 struct clk *new_parent;
40 struct clk *new_child;
38 unsigned long flags; 41 unsigned long flags;
39 unsigned int enable_count; 42 unsigned int enable_count;
40 unsigned int prepare_count; 43 unsigned int prepare_count;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 1ec14a732176..73bdb69f0c08 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -12,6 +12,7 @@
12#define __LINUX_CLK_PROVIDER_H 12#define __LINUX_CLK_PROVIDER_H
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h>
15 16
16#ifdef CONFIG_COMMON_CLK 17#ifdef CONFIG_COMMON_CLK
17 18
@@ -27,6 +28,7 @@
27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ 28#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
28#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ 29#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
29#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ 30#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
31#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
30 32
31struct clk_hw; 33struct clk_hw;
32 34
@@ -79,6 +81,10 @@ struct clk_hw;
79 * @round_rate: Given a target rate as input, returns the closest rate actually 81 * @round_rate: Given a target rate as input, returns the closest rate actually
80 * supported by the clock. 82 * supported by the clock.
81 * 83 *
84 * @determine_rate: Given a target rate as input, returns the closest rate
85 * actually supported by the clock, and optionally the parent clock
86 * that should be used to provide the clock rate.
87 *
82 * @get_parent: Queries the hardware to determine the parent of a clock. The 88 * @get_parent: Queries the hardware to determine the parent of a clock. The
83 * return value is a u8 which specifies the index corresponding to 89 * return value is a u8 which specifies the index corresponding to
84 * the parent clock. This index can be applied to either the 90 * the parent clock. This index can be applied to either the
@@ -126,6 +132,9 @@ struct clk_ops {
126 unsigned long parent_rate); 132 unsigned long parent_rate);
127 long (*round_rate)(struct clk_hw *hw, unsigned long, 133 long (*round_rate)(struct clk_hw *hw, unsigned long,
128 unsigned long *); 134 unsigned long *);
135 long (*determine_rate)(struct clk_hw *hw, unsigned long rate,
136 unsigned long *best_parent_rate,
137 struct clk **best_parent_clk);
129 int (*set_parent)(struct clk_hw *hw, u8 index); 138 int (*set_parent)(struct clk_hw *hw, u8 index);
130 u8 (*get_parent)(struct clk_hw *hw); 139 u8 (*get_parent)(struct clk_hw *hw);
131 int (*set_rate)(struct clk_hw *hw, unsigned long, 140 int (*set_rate)(struct clk_hw *hw, unsigned long,
@@ -327,8 +336,10 @@ struct clk_mux {
327#define CLK_MUX_INDEX_ONE BIT(0) 336#define CLK_MUX_INDEX_ONE BIT(0)
328#define CLK_MUX_INDEX_BIT BIT(1) 337#define CLK_MUX_INDEX_BIT BIT(1)
329#define CLK_MUX_HIWORD_MASK BIT(2) 338#define CLK_MUX_HIWORD_MASK BIT(2)
339#define CLK_MUX_READ_ONLY BIT(3) /* mux setting cannot be changed */
330 340
331extern const struct clk_ops clk_mux_ops; 341extern const struct clk_ops clk_mux_ops;
342extern const struct clk_ops clk_mux_ro_ops;
332 343
333struct clk *clk_register_mux(struct device *dev, const char *name, 344struct clk *clk_register_mux(struct device *dev, const char *name,
334 const char **parent_names, u8 num_parents, unsigned long flags, 345 const char **parent_names, u8 num_parents, unsigned long flags,
@@ -418,6 +429,7 @@ const char *__clk_get_name(struct clk *clk);
418struct clk_hw *__clk_get_hw(struct clk *clk); 429struct clk_hw *__clk_get_hw(struct clk *clk);
419u8 __clk_get_num_parents(struct clk *clk); 430u8 __clk_get_num_parents(struct clk *clk);
420struct clk *__clk_get_parent(struct clk *clk); 431struct clk *__clk_get_parent(struct clk *clk);
432struct clk *clk_get_parent_by_index(struct clk *clk, u8 index);
421unsigned int __clk_get_enable_count(struct clk *clk); 433unsigned int __clk_get_enable_count(struct clk *clk);
422unsigned int __clk_get_prepare_count(struct clk *clk); 434unsigned int __clk_get_prepare_count(struct clk *clk);
423unsigned long __clk_get_rate(struct clk *clk); 435unsigned long __clk_get_rate(struct clk *clk);
@@ -425,6 +437,9 @@ unsigned long __clk_get_flags(struct clk *clk);
425bool __clk_is_prepared(struct clk *clk); 437bool __clk_is_prepared(struct clk *clk);
426bool __clk_is_enabled(struct clk *clk); 438bool __clk_is_enabled(struct clk *clk);
427struct clk *__clk_lookup(const char *name); 439struct clk *__clk_lookup(const char *name);
440long __clk_mux_determine_rate(struct clk_hw *hw, unsigned long rate,
441 unsigned long *best_parent_rate,
442 struct clk **best_parent_p);
428 443
429/* 444/*
430 * FIXME clock api without lock protection 445 * FIXME clock api without lock protection
@@ -490,5 +505,21 @@ static inline const char *of_clk_get_parent_name(struct device_node *np,
490#define of_clk_init(matches) \ 505#define of_clk_init(matches) \
491 { while (0); } 506 { while (0); }
492#endif /* CONFIG_OF */ 507#endif /* CONFIG_OF */
508
509/*
510 * wrap access to peripherals in accessor routines
511 * for improved portability across platforms
512 */
513
514static inline u32 clk_readl(u32 __iomem *reg)
515{
516 return readl(reg);
517}
518
519static inline void clk_writel(u32 val, u32 __iomem *reg)
520{
521 writel(val, reg);
522}
523
493#endif /* CONFIG_COMMON_CLK */ 524#endif /* CONFIG_COMMON_CLK */
494#endif /* CLK_PROVIDER_H */ 525#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/cmdline-parser.h b/include/linux/cmdline-parser.h
new file mode 100644
index 000000000000..98e892ef6d5a
--- /dev/null
+++ b/include/linux/cmdline-parser.h
@@ -0,0 +1,43 @@
1/*
2 * Parsing command line, get the partitions information.
3 *
4 * Written by Cai Zhiyong <caizhiyong@huawei.com>
5 *
6 */
7#ifndef CMDLINEPARSEH
8#define CMDLINEPARSEH
9
10#include <linux/blkdev.h>
11
12/* partition flags */
13#define PF_RDONLY 0x01 /* Device is read only */
14#define PF_POWERUP_LOCK 0x02 /* Always locked after reset */
15
16struct cmdline_subpart {
17 char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
18 sector_t from;
19 sector_t size;
20 int flags;
21 struct cmdline_subpart *next_subpart;
22};
23
24struct cmdline_parts {
25 char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */
26 unsigned int nr_subparts;
27 struct cmdline_subpart *subpart;
28 struct cmdline_parts *next_parts;
29};
30
31void cmdline_parts_free(struct cmdline_parts **parts);
32
33int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
34
35struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
36 const char *bdev);
37
38void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
39 int slot,
40 int (*add_part)(int, struct cmdline_subpart *, void *),
41 void *param);
42
43#endif /* CMDLINEPARSEH */
diff --git a/include/linux/coda.h b/include/linux/coda.h
index cff544f81105..d30209b9cef8 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
60 60
61#if defined(__linux__) 61#if defined(__linux__)
62typedef unsigned long long u_quad_t; 62typedef unsigned long long u_quad_t;
63#else
64#endif 63#endif
65#include <uapi/linux/coda.h> 64#include <uapi/linux/coda.h>
66#endif 65#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 7f0c1dd09079..345da00a86e0 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -43,6 +43,7 @@
43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 43#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 44 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ 45 static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
46 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\ 47 asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
47 { \ 48 { \
48 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \ 49 return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__)); \
@@ -669,6 +670,13 @@ asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
669 670
670int compat_restore_altstack(const compat_stack_t __user *uss); 671int compat_restore_altstack(const compat_stack_t __user *uss);
671int __compat_save_altstack(compat_stack_t __user *, unsigned long); 672int __compat_save_altstack(compat_stack_t __user *, unsigned long);
673#define compat_save_altstack_ex(uss, sp) do { \
674 compat_stack_t __user *__uss = uss; \
675 struct task_struct *t = current; \
676 put_user_ex(ptr_to_compat((void __user *)t->sas_ss_sp), &__uss->ss_sp); \
677 put_user_ex(sas_ss_flags(sp), &__uss->ss_flags); \
678 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
679} while (0);
672 680
673asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 681asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
674 struct compat_timespec __user *interval); 682 struct compat_timespec __user *interval);
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 842de225055f..ded429966c1f 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -65,6 +65,21 @@
65#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
66#endif 66#endif
67 67
68/*
69 * GCC 'asm goto' miscompiles certain code sequences:
70 *
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 *
76 * (asm goto is automatically volatile - the naming reflects this.)
77 */
78#if GCC_VERSION <= 40801
79# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
80#else
81# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
82#endif
68 83
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 84#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if GCC_VERSION >= 40400 85#if GCC_VERSION >= 40400
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index fc09d7b0dacf..158158704c30 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -2,100 +2,110 @@
2#define _LINUX_CONTEXT_TRACKING_H 2#define _LINUX_CONTEXT_TRACKING_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/percpu.h>
6#include <linux/vtime.h> 5#include <linux/vtime.h>
6#include <linux/context_tracking_state.h>
7#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8 8
9struct context_tracking {
10 /*
11 * When active is false, probes are unset in order
12 * to minimize overhead: TIF flags are cleared
13 * and calls to user_enter/exit are ignored. This
14 * may be further optimized using static keys.
15 */
16 bool active;
17 enum ctx_state {
18 IN_KERNEL = 0,
19 IN_USER,
20 } state;
21};
22
23static inline void __guest_enter(void)
24{
25 /*
26 * This is running in ioctl context so we can avoid
27 * the call to vtime_account() with its unnecessary idle check.
28 */
29 vtime_account_system(current);
30 current->flags |= PF_VCPU;
31}
32
33static inline void __guest_exit(void)
34{
35 /*
36 * This is running in ioctl context so we can avoid
37 * the call to vtime_account() with its unnecessary idle check.
38 */
39 vtime_account_system(current);
40 current->flags &= ~PF_VCPU;
41}
42 9
43#ifdef CONFIG_CONTEXT_TRACKING 10#ifdef CONFIG_CONTEXT_TRACKING
44DECLARE_PER_CPU(struct context_tracking, context_tracking); 11extern void context_tracking_cpu_set(int cpu);
45 12
46static inline bool context_tracking_in_user(void) 13extern void context_tracking_user_enter(void);
14extern void context_tracking_user_exit(void);
15extern void __context_tracking_task_switch(struct task_struct *prev,
16 struct task_struct *next);
17
18static inline void user_enter(void)
47{ 19{
48 return __this_cpu_read(context_tracking.state) == IN_USER; 20 if (static_key_false(&context_tracking_enabled))
49} 21 context_tracking_user_enter();
50 22
51static inline bool context_tracking_active(void) 23}
24static inline void user_exit(void)
52{ 25{
53 return __this_cpu_read(context_tracking.active); 26 if (static_key_false(&context_tracking_enabled))
27 context_tracking_user_exit();
54} 28}
55 29
56extern void user_enter(void);
57extern void user_exit(void);
58
59extern void guest_enter(void);
60extern void guest_exit(void);
61
62static inline enum ctx_state exception_enter(void) 30static inline enum ctx_state exception_enter(void)
63{ 31{
64 enum ctx_state prev_ctx; 32 enum ctx_state prev_ctx;
65 33
34 if (!static_key_false(&context_tracking_enabled))
35 return 0;
36
66 prev_ctx = this_cpu_read(context_tracking.state); 37 prev_ctx = this_cpu_read(context_tracking.state);
67 user_exit(); 38 context_tracking_user_exit();
68 39
69 return prev_ctx; 40 return prev_ctx;
70} 41}
71 42
72static inline void exception_exit(enum ctx_state prev_ctx) 43static inline void exception_exit(enum ctx_state prev_ctx)
73{ 44{
74 if (prev_ctx == IN_USER) 45 if (static_key_false(&context_tracking_enabled)) {
75 user_enter(); 46 if (prev_ctx == IN_USER)
47 context_tracking_user_enter();
48 }
76} 49}
77 50
78extern void context_tracking_task_switch(struct task_struct *prev, 51static inline void context_tracking_task_switch(struct task_struct *prev,
79 struct task_struct *next); 52 struct task_struct *next)
53{
54 if (static_key_false(&context_tracking_enabled))
55 __context_tracking_task_switch(prev, next);
56}
80#else 57#else
81static inline bool context_tracking_in_user(void) { return false; }
82static inline void user_enter(void) { } 58static inline void user_enter(void) { }
83static inline void user_exit(void) { } 59static inline void user_exit(void) { }
60static inline enum ctx_state exception_enter(void) { return 0; }
61static inline void exception_exit(enum ctx_state prev_ctx) { }
62static inline void context_tracking_task_switch(struct task_struct *prev,
63 struct task_struct *next) { }
64#endif /* !CONFIG_CONTEXT_TRACKING */
65
66
67#ifdef CONFIG_CONTEXT_TRACKING_FORCE
68extern void context_tracking_init(void);
69#else
70static inline void context_tracking_init(void) { }
71#endif /* CONFIG_CONTEXT_TRACKING_FORCE */
72
84 73
74#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
85static inline void guest_enter(void) 75static inline void guest_enter(void)
86{ 76{
87 __guest_enter(); 77 if (vtime_accounting_enabled())
78 vtime_guest_enter(current);
79 else
80 current->flags |= PF_VCPU;
88} 81}
89 82
90static inline void guest_exit(void) 83static inline void guest_exit(void)
91{ 84{
92 __guest_exit(); 85 if (vtime_accounting_enabled())
86 vtime_guest_exit(current);
87 else
88 current->flags &= ~PF_VCPU;
93} 89}
94 90
95static inline enum ctx_state exception_enter(void) { return 0; } 91#else
96static inline void exception_exit(enum ctx_state prev_ctx) { } 92static inline void guest_enter(void)
97static inline void context_tracking_task_switch(struct task_struct *prev, 93{
98 struct task_struct *next) { } 94 /*
99#endif /* !CONFIG_CONTEXT_TRACKING */ 95 * This is running in ioctl context so its safe
96 * to assume that it's the stime pending cputime
97 * to flush.
98 */
99 vtime_account_system(current);
100 current->flags |= PF_VCPU;
101}
102
103static inline void guest_exit(void)
104{
105 /* Flush the guest cputime we spent on the guest */
106 vtime_account_system(current);
107 current->flags &= ~PF_VCPU;
108}
109#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
100 110
101#endif 111#endif
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
new file mode 100644
index 000000000000..0f1979d0674f
--- /dev/null
+++ b/include/linux/context_tracking_state.h
@@ -0,0 +1,39 @@
1#ifndef _LINUX_CONTEXT_TRACKING_STATE_H
2#define _LINUX_CONTEXT_TRACKING_STATE_H
3
4#include <linux/percpu.h>
5#include <linux/static_key.h>
6
7struct context_tracking {
8 /*
9 * When active is false, probes are unset in order
10 * to minimize overhead: TIF flags are cleared
11 * and calls to user_enter/exit are ignored. This
12 * may be further optimized using static keys.
13 */
14 bool active;
15 enum ctx_state {
16 IN_KERNEL = 0,
17 IN_USER,
18 } state;
19};
20
21#ifdef CONFIG_CONTEXT_TRACKING
22extern struct static_key context_tracking_enabled;
23DECLARE_PER_CPU(struct context_tracking, context_tracking);
24
25static inline bool context_tracking_in_user(void)
26{
27 return __this_cpu_read(context_tracking.state) == IN_USER;
28}
29
30static inline bool context_tracking_active(void)
31{
32 return __this_cpu_read(context_tracking.active);
33}
34#else
35static inline bool context_tracking_in_user(void) { return false; }
36static inline bool context_tracking_active(void) { return false; }
37#endif /* CONFIG_CONTEXT_TRACKING */
38
39#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ab0eade73039..801ff9e73679 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -28,6 +28,7 @@ struct cpu {
28extern int register_cpu(struct cpu *cpu, int num); 28extern int register_cpu(struct cpu *cpu, int num);
29extern struct device *get_cpu_device(unsigned cpu); 29extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu); 30extern bool cpu_is_hotpluggable(unsigned cpu);
31extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
31 32
32extern int cpu_add_dev_attr(struct device_attribute *attr); 33extern int cpu_add_dev_attr(struct device_attribute *attr);
33extern void cpu_remove_dev_attr(struct device_attribute *attr); 34extern void cpu_remove_dev_attr(struct device_attribute *attr);
@@ -172,6 +173,8 @@ extern struct bus_type cpu_subsys;
172#ifdef CONFIG_HOTPLUG_CPU 173#ifdef CONFIG_HOTPLUG_CPU
173/* Stop CPUs going up and down. */ 174/* Stop CPUs going up and down. */
174 175
176extern void cpu_hotplug_begin(void);
177extern void cpu_hotplug_done(void);
175extern void get_online_cpus(void); 178extern void get_online_cpus(void);
176extern void put_online_cpus(void); 179extern void put_online_cpus(void);
177extern void cpu_hotplug_disable(void); 180extern void cpu_hotplug_disable(void);
@@ -197,6 +200,8 @@ static inline void cpu_hotplug_driver_unlock(void)
197 200
198#else /* CONFIG_HOTPLUG_CPU */ 201#else /* CONFIG_HOTPLUG_CPU */
199 202
203static inline void cpu_hotplug_begin(void) {}
204static inline void cpu_hotplug_done(void) {}
200#define get_online_cpus() do { } while (0) 205#define get_online_cpus() do { } while (0)
201#define put_online_cpus() do { } while (0) 206#define put_online_cpus() do { } while (0)
202#define cpu_hotplug_disable() do { } while (0) 207#define cpu_hotplug_disable() do { } while (0)
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index 1739510d8994..bdd18caa6c94 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -52,8 +52,6 @@ static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
52 return rmap->obj[rmap->near[cpu].index]; 52 return rmap->obj[rmap->near[cpu].index];
53} 53}
54 54
55#ifdef CONFIG_GENERIC_HARDIRQS
56
57/** 55/**
58 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs 56 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
59 * @size: Number of objects to be mapped 57 * @size: Number of objects to be mapped
@@ -68,5 +66,4 @@ extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
68 66
69extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq); 67extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
70 68
71#endif
72#endif /* __LINUX_CPU_RMAP_H */ 69#endif /* __LINUX_CPU_RMAP_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 90d5a15120d5..fcabc42d66ab 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -11,71 +11,36 @@
11#ifndef _LINUX_CPUFREQ_H 11#ifndef _LINUX_CPUFREQ_H
12#define _LINUX_CPUFREQ_H 12#define _LINUX_CPUFREQ_H
13 13
14#include <asm/cputime.h> 14#include <linux/cpumask.h>
15#include <linux/mutex.h> 15#include <linux/completion.h>
16#include <linux/notifier.h>
17#include <linux/threads.h>
18#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/notifier.h>
19#include <linux/sysfs.h> 18#include <linux/sysfs.h>
20#include <linux/completion.h>
21#include <linux/workqueue.h>
22#include <linux/cpumask.h>
23#include <asm/div64.h>
24
25#define CPUFREQ_NAME_LEN 16
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28 19
29/********************************************************************* 20/*********************************************************************
30 * CPUFREQ NOTIFIER INTERFACE * 21 * CPUFREQ INTERFACE *
31 *********************************************************************/ 22 *********************************************************************/
32 23/*
33#define CPUFREQ_TRANSITION_NOTIFIER (0) 24 * Frequency values here are CPU kHz
34#define CPUFREQ_POLICY_NOTIFIER (1) 25 *
35
36#ifdef CONFIG_CPU_FREQ
37int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
38int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
39extern void disable_cpufreq(void);
40#else /* CONFIG_CPU_FREQ */
41static inline int cpufreq_register_notifier(struct notifier_block *nb,
42 unsigned int list)
43{
44 return 0;
45}
46static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
47 unsigned int list)
48{
49 return 0;
50}
51static inline void disable_cpufreq(void) { }
52#endif /* CONFIG_CPU_FREQ */
53
54/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
55 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
56 * two generic policies are available:
57 */
58
59#define CPUFREQ_POLICY_POWERSAVE (1)
60#define CPUFREQ_POLICY_PERFORMANCE (2)
61
62/* Frequency values here are CPU kHz so that hardware which doesn't run
63 * with some frequencies can complain without having to guess what per
64 * cent / per mille means.
65 * Maximum transition latency is in nanoseconds - if it's unknown, 26 * Maximum transition latency is in nanoseconds - if it's unknown,
66 * CPUFREQ_ETERNAL shall be used. 27 * CPUFREQ_ETERNAL shall be used.
67 */ 28 */
68 29
30#define CPUFREQ_ETERNAL (-1)
31#define CPUFREQ_NAME_LEN 16
32/* Print length for names. Extra 1 space for accomodating '\n' in prints */
33#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
34
69struct cpufreq_governor; 35struct cpufreq_governor;
70 36
71/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ 37struct cpufreq_freqs {
72extern struct kobject *cpufreq_global_kobject; 38 unsigned int cpu; /* cpu nr */
73int cpufreq_get_global_kobject(void); 39 unsigned int old;
74void cpufreq_put_global_kobject(void); 40 unsigned int new;
75int cpufreq_sysfs_create_file(const struct attribute *attr); 41 u8 flags; /* flags of cpufreq_driver, see below. */
76void cpufreq_sysfs_remove_file(const struct attribute *attr); 42};
77 43
78#define CPUFREQ_ETERNAL (-1)
79struct cpufreq_cpuinfo { 44struct cpufreq_cpuinfo {
80 unsigned int max_freq; 45 unsigned int max_freq;
81 unsigned int min_freq; 46 unsigned int min_freq;
@@ -117,123 +82,102 @@ struct cpufreq_policy {
117 82
118 struct cpufreq_real_policy user_policy; 83 struct cpufreq_real_policy user_policy;
119 84
85 struct list_head policy_list;
120 struct kobject kobj; 86 struct kobject kobj;
121 struct completion kobj_unregister; 87 struct completion kobj_unregister;
122 int transition_ongoing; /* Tracks transition status */
123}; 88};
124 89
125#define CPUFREQ_ADJUST (0)
126#define CPUFREQ_INCOMPATIBLE (1)
127#define CPUFREQ_NOTIFY (2)
128#define CPUFREQ_START (3)
129#define CPUFREQ_UPDATE_POLICY_CPU (4)
130
131/* Only for ACPI */ 90/* Only for ACPI */
132#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 91#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
133#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 92#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
134#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 93#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
135#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 94#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
136 95
96struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
97void cpufreq_cpu_put(struct cpufreq_policy *policy);
98
137static inline bool policy_is_shared(struct cpufreq_policy *policy) 99static inline bool policy_is_shared(struct cpufreq_policy *policy)
138{ 100{
139 return cpumask_weight(policy->cpus) > 1; 101 return cpumask_weight(policy->cpus) > 1;
140} 102}
141 103
142/******************** cpufreq transition notifiers *******************/ 104/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
143 105extern struct kobject *cpufreq_global_kobject;
144#define CPUFREQ_PRECHANGE (0) 106int cpufreq_get_global_kobject(void);
145#define CPUFREQ_POSTCHANGE (1) 107void cpufreq_put_global_kobject(void);
146#define CPUFREQ_RESUMECHANGE (8) 108int cpufreq_sysfs_create_file(const struct attribute *attr);
147#define CPUFREQ_SUSPENDCHANGE (9) 109void cpufreq_sysfs_remove_file(const struct attribute *attr);
148 110
149struct cpufreq_freqs { 111#ifdef CONFIG_CPU_FREQ
150 unsigned int cpu; /* cpu nr */ 112unsigned int cpufreq_get(unsigned int cpu);
151 unsigned int old; 113unsigned int cpufreq_quick_get(unsigned int cpu);
152 unsigned int new; 114unsigned int cpufreq_quick_get_max(unsigned int cpu);
153 u8 flags; /* flags of cpufreq_driver, see below. */ 115void disable_cpufreq(void);
154};
155 116
156/** 117u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
157 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch 118int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
158 * safe) 119int cpufreq_update_policy(unsigned int cpu);
159 * @old: old value 120bool have_governor_per_policy(void);
160 * @div: divisor 121struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
161 * @mult: multiplier 122#else
162 * 123static inline unsigned int cpufreq_get(unsigned int cpu)
163 *
164 * new = old * mult / div
165 */
166static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
167 u_int mult)
168{ 124{
169#if BITS_PER_LONG == 32 125 return 0;
170 126}
171 u64 result = ((u64) old) * ((u64) mult); 127static inline unsigned int cpufreq_quick_get(unsigned int cpu)
172 do_div(result, div); 128{
173 return (unsigned long) result; 129 return 0;
174 130}
175#elif BITS_PER_LONG == 64 131static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
176 132{
177 unsigned long result = old * ((u64) mult); 133 return 0;
178 result /= div; 134}
179 return result; 135static inline void disable_cpufreq(void) { }
180
181#endif 136#endif
182};
183 137
184/********************************************************************* 138/*********************************************************************
185 * CPUFREQ GOVERNORS * 139 * CPUFREQ DRIVER INTERFACE *
186 *********************************************************************/ 140 *********************************************************************/
187 141
188#define CPUFREQ_GOV_START 1 142#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */
189#define CPUFREQ_GOV_STOP 2 143#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */
190#define CPUFREQ_GOV_LIMITS 3
191#define CPUFREQ_GOV_POLICY_INIT 4
192#define CPUFREQ_GOV_POLICY_EXIT 5
193 144
194struct cpufreq_governor { 145struct freq_attr {
195 char name[CPUFREQ_NAME_LEN]; 146 struct attribute attr;
196 int initialized; 147 ssize_t (*show)(struct cpufreq_policy *, char *);
197 int (*governor) (struct cpufreq_policy *policy, 148 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
198 unsigned int event);
199 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
200 char *buf);
201 int (*store_setspeed) (struct cpufreq_policy *policy,
202 unsigned int freq);
203 unsigned int max_transition_latency; /* HW must be able to switch to
204 next freq faster than this value in nano secs or we
205 will fallback to performance governor */
206 struct list_head governor_list;
207 struct module *owner;
208}; 149};
209 150
210/* 151#define cpufreq_freq_attr_ro(_name) \
211 * Pass a target to the cpufreq driver. 152static struct freq_attr _name = \
212 */ 153__ATTR(_name, 0444, show_##_name, NULL)
213extern int cpufreq_driver_target(struct cpufreq_policy *policy,
214 unsigned int target_freq,
215 unsigned int relation);
216extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
217 unsigned int target_freq,
218 unsigned int relation);
219 154
220extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 155#define cpufreq_freq_attr_ro_perm(_name, _perm) \
221 unsigned int cpu); 156static struct freq_attr _name = \
157__ATTR(_name, _perm, show_##_name, NULL)
222 158
223int cpufreq_register_governor(struct cpufreq_governor *governor); 159#define cpufreq_freq_attr_rw(_name) \
224void cpufreq_unregister_governor(struct cpufreq_governor *governor); 160static struct freq_attr _name = \
161__ATTR(_name, 0644, show_##_name, store_##_name)
225 162
226/********************************************************************* 163struct global_attr {
227 * CPUFREQ DRIVER INTERFACE * 164 struct attribute attr;
228 *********************************************************************/ 165 ssize_t (*show)(struct kobject *kobj,
166 struct attribute *attr, char *buf);
167 ssize_t (*store)(struct kobject *a, struct attribute *b,
168 const char *c, size_t count);
169};
229 170
230#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ 171#define define_one_global_ro(_name) \
231#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ 172static struct global_attr _name = \
173__ATTR(_name, 0444, show_##_name, NULL)
174
175#define define_one_global_rw(_name) \
176static struct global_attr _name = \
177__ATTR(_name, 0644, show_##_name, store_##_name)
232 178
233struct freq_attr;
234 179
235struct cpufreq_driver { 180struct cpufreq_driver {
236 struct module *owner;
237 char name[CPUFREQ_NAME_LEN]; 181 char name[CPUFREQ_NAME_LEN];
238 u8 flags; 182 u8 flags;
239 /* 183 /*
@@ -258,8 +202,6 @@ struct cpufreq_driver {
258 unsigned int (*get) (unsigned int cpu); 202 unsigned int (*get) (unsigned int cpu);
259 203
260 /* optional */ 204 /* optional */
261 unsigned int (*getavg) (struct cpufreq_policy *policy,
262 unsigned int cpu);
263 int (*bios_limit) (int cpu, unsigned int *limit); 205 int (*bios_limit) (int cpu, unsigned int *limit);
264 206
265 int (*exit) (struct cpufreq_policy *policy); 207 int (*exit) (struct cpufreq_policy *policy);
@@ -269,7 +211,6 @@ struct cpufreq_driver {
269}; 211};
270 212
271/* flags */ 213/* flags */
272
273#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if 214#define CPUFREQ_STICKY 0x01 /* the driver isn't removed even if
274 * all ->init() calls failed */ 215 * all ->init() calls failed */
275#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel 216#define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel
@@ -281,8 +222,7 @@ struct cpufreq_driver {
281int cpufreq_register_driver(struct cpufreq_driver *driver_data); 222int cpufreq_register_driver(struct cpufreq_driver *driver_data);
282int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 223int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
283 224
284void cpufreq_notify_transition(struct cpufreq_policy *policy, 225const char *cpufreq_get_current_driver(void);
285 struct cpufreq_freqs *freqs, unsigned int state);
286 226
287static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, 227static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
288 unsigned int min, unsigned int max) 228 unsigned int min, unsigned int max)
@@ -300,87 +240,118 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
300 return; 240 return;
301} 241}
302 242
303struct freq_attr { 243/*********************************************************************
304 struct attribute attr; 244 * CPUFREQ NOTIFIER INTERFACE *
305 ssize_t (*show)(struct cpufreq_policy *, char *); 245 *********************************************************************/
306 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
307};
308
309#define cpufreq_freq_attr_ro(_name) \
310static struct freq_attr _name = \
311__ATTR(_name, 0444, show_##_name, NULL)
312
313#define cpufreq_freq_attr_ro_perm(_name, _perm) \
314static struct freq_attr _name = \
315__ATTR(_name, _perm, show_##_name, NULL)
316
317#define cpufreq_freq_attr_rw(_name) \
318static struct freq_attr _name = \
319__ATTR(_name, 0644, show_##_name, store_##_name)
320 246
321struct global_attr { 247#define CPUFREQ_TRANSITION_NOTIFIER (0)
322 struct attribute attr; 248#define CPUFREQ_POLICY_NOTIFIER (1)
323 ssize_t (*show)(struct kobject *kobj,
324 struct attribute *attr, char *buf);
325 ssize_t (*store)(struct kobject *a, struct attribute *b,
326 const char *c, size_t count);
327};
328 249
329#define define_one_global_ro(_name) \ 250/* Transition notifiers */
330static struct global_attr _name = \ 251#define CPUFREQ_PRECHANGE (0)
331__ATTR(_name, 0444, show_##_name, NULL) 252#define CPUFREQ_POSTCHANGE (1)
253#define CPUFREQ_RESUMECHANGE (8)
254#define CPUFREQ_SUSPENDCHANGE (9)
332 255
333#define define_one_global_rw(_name) \ 256/* Policy Notifiers */
334static struct global_attr _name = \ 257#define CPUFREQ_ADJUST (0)
335__ATTR(_name, 0644, show_##_name, store_##_name) 258#define CPUFREQ_INCOMPATIBLE (1)
259#define CPUFREQ_NOTIFY (2)
260#define CPUFREQ_START (3)
261#define CPUFREQ_UPDATE_POLICY_CPU (4)
336 262
337struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 263#ifdef CONFIG_CPU_FREQ
338void cpufreq_cpu_put(struct cpufreq_policy *data); 264int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
339const char *cpufreq_get_current_driver(void); 265int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
340 266
341/********************************************************************* 267void cpufreq_notify_transition(struct cpufreq_policy *policy,
342 * CPUFREQ 2.6. INTERFACE * 268 struct cpufreq_freqs *freqs, unsigned int state);
343 *********************************************************************/
344u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
345int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
346int cpufreq_update_policy(unsigned int cpu);
347bool have_governor_per_policy(void);
348struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
349 269
350#ifdef CONFIG_CPU_FREQ 270#else /* CONFIG_CPU_FREQ */
351/* 271static inline int cpufreq_register_notifier(struct notifier_block *nb,
352 * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it 272 unsigned int list)
353 */
354unsigned int cpufreq_get(unsigned int cpu);
355#else
356static inline unsigned int cpufreq_get(unsigned int cpu)
357{ 273{
358 return 0; 274 return 0;
359} 275}
360#endif 276static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
361 277 unsigned int list)
362/*
363 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
364 */
365#ifdef CONFIG_CPU_FREQ
366unsigned int cpufreq_quick_get(unsigned int cpu);
367unsigned int cpufreq_quick_get_max(unsigned int cpu);
368#else
369static inline unsigned int cpufreq_quick_get(unsigned int cpu)
370{ 278{
371 return 0; 279 return 0;
372} 280}
373static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) 281#endif /* !CONFIG_CPU_FREQ */
282
283/**
284 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
285 * safe)
286 * @old: old value
287 * @div: divisor
288 * @mult: multiplier
289 *
290 *
291 * new = old * mult / div
292 */
293static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
294 u_int mult)
374{ 295{
375 return 0; 296#if BITS_PER_LONG == 32
376} 297 u64 result = ((u64) old) * ((u64) mult);
298 do_div(result, div);
299 return (unsigned long) result;
300
301#elif BITS_PER_LONG == 64
302 unsigned long result = old * ((u64) mult);
303 result /= div;
304 return result;
377#endif 305#endif
306}
378 307
379/********************************************************************* 308/*********************************************************************
380 * CPUFREQ DEFAULT GOVERNOR * 309 * CPUFREQ GOVERNORS *
381 *********************************************************************/ 310 *********************************************************************/
382 311
383/* 312/*
313 * If (cpufreq_driver->target) exists, the ->governor decides what frequency
314 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
315 * two generic policies are available:
316 */
317#define CPUFREQ_POLICY_POWERSAVE (1)
318#define CPUFREQ_POLICY_PERFORMANCE (2)
319
320/* Governor Events */
321#define CPUFREQ_GOV_START 1
322#define CPUFREQ_GOV_STOP 2
323#define CPUFREQ_GOV_LIMITS 3
324#define CPUFREQ_GOV_POLICY_INIT 4
325#define CPUFREQ_GOV_POLICY_EXIT 5
326
327struct cpufreq_governor {
328 char name[CPUFREQ_NAME_LEN];
329 int initialized;
330 int (*governor) (struct cpufreq_policy *policy,
331 unsigned int event);
332 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
333 char *buf);
334 int (*store_setspeed) (struct cpufreq_policy *policy,
335 unsigned int freq);
336 unsigned int max_transition_latency; /* HW must be able to switch to
337 next freq faster than this value in nano secs or we
338 will fallback to performance governor */
339 struct list_head governor_list;
340 struct module *owner;
341};
342
343/* Pass a target to the cpufreq driver */
344int cpufreq_driver_target(struct cpufreq_policy *policy,
345 unsigned int target_freq,
346 unsigned int relation);
347int __cpufreq_driver_target(struct cpufreq_policy *policy,
348 unsigned int target_freq,
349 unsigned int relation);
350int cpufreq_register_governor(struct cpufreq_governor *governor);
351void cpufreq_unregister_governor(struct cpufreq_governor *governor);
352
353/* CPUFREQ DEFAULT GOVERNOR */
354/*
384 * Performance governor is fallback governor if any other gov failed to auto 355 * Performance governor is fallback governor if any other gov failed to auto
385 * load due latency restrictions 356 * load due latency restrictions
386 */ 357 */
@@ -428,18 +399,16 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
428 unsigned int relation, 399 unsigned int relation,
429 unsigned int *index); 400 unsigned int *index);
430 401
431/* the following 3 funtions are for cpufreq core use only */ 402void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
403ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
404
405/* the following funtion is for cpufreq core use only */
432struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 406struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
433 407
434/* the following are really really optional */ 408/* the following are really really optional */
435extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 409extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
436
437void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 410void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
438 unsigned int cpu); 411 unsigned int cpu);
439void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
440
441void cpufreq_frequency_table_put_attr(unsigned int cpu); 412void cpufreq_frequency_table_put_attr(unsigned int cpu);
442 413
443ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
444
445#endif /* _LINUX_CPUFREQ_H */ 414#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 0bc4b74668e9..781addc66f03 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/kobject.h>
17#include <linux/completion.h>
18#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
19 17
20#define CPUIDLE_STATE_MAX 10 18#define CPUIDLE_STATE_MAX 10
@@ -61,6 +59,10 @@ struct cpuidle_state {
61 59
62#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 60#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
63 61
62struct cpuidle_device_kobj;
63struct cpuidle_state_kobj;
64struct cpuidle_driver_kobj;
65
64struct cpuidle_device { 66struct cpuidle_device {
65 unsigned int registered:1; 67 unsigned int registered:1;
66 unsigned int enabled:1; 68 unsigned int enabled:1;
@@ -71,9 +73,8 @@ struct cpuidle_device {
71 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 73 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
72 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 74 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
73 struct cpuidle_driver_kobj *kobj_driver; 75 struct cpuidle_driver_kobj *kobj_driver;
76 struct cpuidle_device_kobj *kobj_dev;
74 struct list_head device_list; 77 struct list_head device_list;
75 struct kobject kobj;
76 struct completion kobj_unregister;
77 78
78#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 79#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
79 int safe_state_index; 80 int safe_state_index;
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 37e4f8da7cdf..fe68a5a98583 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -12,6 +12,15 @@
12extern unsigned long long elfcorehdr_addr; 12extern unsigned long long elfcorehdr_addr;
13extern unsigned long long elfcorehdr_size; 13extern unsigned long long elfcorehdr_size;
14 14
15extern int __weak elfcorehdr_alloc(unsigned long long *addr,
16 unsigned long long *size);
17extern void __weak elfcorehdr_free(unsigned long long addr);
18extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos);
19extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
20extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
21 unsigned long from, unsigned long pfn,
22 unsigned long size, pgprot_t prot);
23
15extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 24extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
16 unsigned long, int); 25 unsigned long, int);
17 26
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index a9c96d865ee7..b3cb71f0d3b0 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define CRC_T10DIF_DIGEST_SIZE 2
7#define CRC_T10DIF_BLOCK_SIZE 1
8
9__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
6__u16 crc_t10dif(unsigned char const *, size_t); 10__u16 crc_t10dif(unsigned char const *, size_t);
7 11
8#endif 12#endif
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index efdc94434c30..59066e0b4ff1 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -55,11 +55,11 @@ struct qstr {
55#define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) 55#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
56 56
57struct dentry_stat_t { 57struct dentry_stat_t {
58 int nr_dentry; 58 long nr_dentry;
59 int nr_unused; 59 long nr_unused;
60 int age_limit; /* age in seconds */ 60 long age_limit; /* age in seconds */
61 int want_pages; /* pages requested by system */ 61 long want_pages; /* pages requested by system */
62 int dummy[2]; 62 long dummy[2];
63}; 63};
64extern struct dentry_stat_t dentry_stat; 64extern struct dentry_stat_t dentry_stat;
65 65
@@ -208,11 +208,12 @@ struct dentry_operations {
208#define DCACHE_MANAGED_DENTRY \ 208#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 210
211#define DCACHE_LRU_LIST 0x80000
211#define DCACHE_DENTRY_KILLED 0x100000 212#define DCACHE_DENTRY_KILLED 0x100000
212 213
213extern seqlock_t rename_lock; 214extern seqlock_t rename_lock;
214 215
215static inline int dname_external(struct dentry *dentry) 216static inline int dname_external(const struct dentry *dentry)
216{ 217{
217 return dentry->d_name.name != dentry->d_iname; 218 return dentry->d_name.name != dentry->d_iname;
218} 219}
@@ -253,6 +254,7 @@ extern void d_prune_aliases(struct inode *);
253 254
254/* test whether we have any submounts in a subdir tree */ 255/* test whether we have any submounts in a subdir tree */
255extern int have_submounts(struct dentry *); 256extern int have_submounts(struct dentry *);
257extern int check_submounts_and_drop(struct dentry *);
256 258
257/* 259/*
258 * This adds the entry to the hash queues. 260 * This adds the entry to the hash queues.
@@ -304,28 +306,6 @@ extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
304extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 306extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
305 const struct qstr *name, unsigned *seq); 307 const struct qstr *name, unsigned *seq);
306 308
307/**
308 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
309 * @dentry: dentry to take a ref on
310 * @seq: seqcount to verify against
311 * Returns: 0 on failure, else 1.
312 *
313 * __d_rcu_to_refcount operates on a dentry,seq pair that was returned
314 * by __d_lookup_rcu, to get a reference on an rcu-walk dentry.
315 */
316static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
317{
318 int ret = 0;
319
320 assert_spin_locked(&dentry->d_lock);
321 if (!read_seqcount_retry(&dentry->d_seq, seq)) {
322 ret = 1;
323 dentry->d_lockref.count++;
324 }
325
326 return ret;
327}
328
329static inline unsigned d_count(const struct dentry *dentry) 309static inline unsigned d_count(const struct dentry *dentry)
330{ 310{
331 return dentry->d_lockref.count; 311 return dentry->d_lockref.count;
@@ -379,17 +359,17 @@ extern struct dentry *dget_parent(struct dentry *dentry);
379 * Returns true if the dentry passed is not currently hashed. 359 * Returns true if the dentry passed is not currently hashed.
380 */ 360 */
381 361
382static inline int d_unhashed(struct dentry *dentry) 362static inline int d_unhashed(const struct dentry *dentry)
383{ 363{
384 return hlist_bl_unhashed(&dentry->d_hash); 364 return hlist_bl_unhashed(&dentry->d_hash);
385} 365}
386 366
387static inline int d_unlinked(struct dentry *dentry) 367static inline int d_unlinked(const struct dentry *dentry)
388{ 368{
389 return d_unhashed(dentry) && !IS_ROOT(dentry); 369 return d_unhashed(dentry) && !IS_ROOT(dentry);
390} 370}
391 371
392static inline int cant_mount(struct dentry *dentry) 372static inline int cant_mount(const struct dentry *dentry)
393{ 373{
394 return (dentry->d_flags & DCACHE_CANT_MOUNT); 374 return (dentry->d_flags & DCACHE_CANT_MOUNT);
395} 375}
@@ -403,16 +383,20 @@ static inline void dont_mount(struct dentry *dentry)
403 383
404extern void dput(struct dentry *); 384extern void dput(struct dentry *);
405 385
406static inline bool d_managed(struct dentry *dentry) 386static inline bool d_managed(const struct dentry *dentry)
407{ 387{
408 return dentry->d_flags & DCACHE_MANAGED_DENTRY; 388 return dentry->d_flags & DCACHE_MANAGED_DENTRY;
409} 389}
410 390
411static inline bool d_mountpoint(struct dentry *dentry) 391static inline bool d_mountpoint(const struct dentry *dentry)
412{ 392{
413 return dentry->d_flags & DCACHE_MOUNTED; 393 return dentry->d_flags & DCACHE_MOUNTED;
414} 394}
415 395
416extern int sysctl_vfs_cache_pressure; 396extern int sysctl_vfs_cache_pressure;
417 397
398static inline unsigned long vfs_pressure_ratio(unsigned long val)
399{
400 return mult_frac(val, sysctl_vfs_cache_pressure, 100);
401}
418#endif /* __LINUX_DCACHE_H */ 402#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index d68b4ea7343c..263489d0788d 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -192,6 +192,13 @@ static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode,
192 return ERR_PTR(-ENODEV); 192 return ERR_PTR(-ENODEV);
193} 193}
194 194
195static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode,
196 struct dentry *parent,
197 u64 *value)
198{
199 return ERR_PTR(-ENODEV);
200}
201
195static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, 202static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode,
196 struct dentry *parent, 203 struct dentry *parent,
197 size_t *value) 204 size_t *value)
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 0e5f5785d9f2..98ffcbd4888e 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -63,7 +63,7 @@ struct debug_obj_descr {
63extern void debug_object_init (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_init (void *addr, struct debug_obj_descr *descr);
64extern void 64extern void
65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr); 65debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
66extern void debug_object_activate (void *addr, struct debug_obj_descr *descr); 66extern int debug_object_activate (void *addr, struct debug_obj_descr *descr);
67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr); 67extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 68extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
69extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 69extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
@@ -85,8 +85,8 @@ static inline void
85debug_object_init (void *addr, struct debug_obj_descr *descr) { } 85debug_object_init (void *addr, struct debug_obj_descr *descr) { }
86static inline void 86static inline void
87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { } 87debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr) { }
88static inline void 88static inline int
89debug_object_activate (void *addr, struct debug_obj_descr *descr) { } 89debug_object_activate (void *addr, struct debug_obj_descr *descr) { return 0; }
90static inline void 90static inline void
91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { } 91debug_object_deactivate(void *addr, struct debug_obj_descr *descr) { }
92static inline void 92static inline void
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index e151d4c9298d..ed419c62dde1 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/bio.h> 11#include <linux/bio.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/math64.h>
13#include <linux/ratelimit.h> 14#include <linux/ratelimit.h>
14 15
15struct dm_dev; 16struct dm_dev;
@@ -405,13 +406,14 @@ int dm_noflush_suspending(struct dm_target *ti);
405union map_info *dm_get_mapinfo(struct bio *bio); 406union map_info *dm_get_mapinfo(struct bio *bio);
406union map_info *dm_get_rq_mapinfo(struct request *rq); 407union map_info *dm_get_rq_mapinfo(struct request *rq);
407 408
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
410
408/* 411/*
409 * Geometry functions. 412 * Geometry functions.
410 */ 413 */
411int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo); 414int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo);
412int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); 415int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
413 416
414
415/*----------------------------------------------------------------- 417/*-----------------------------------------------------------------
416 * Functions for manipulating device-mapper tables. 418 * Functions for manipulating device-mapper tables.
417 *---------------------------------------------------------------*/ 419 *---------------------------------------------------------------*/
@@ -550,6 +552,14 @@ extern struct ratelimit_state dm_ratelimit_state;
550#define DM_MAPIO_REMAPPED 1 552#define DM_MAPIO_REMAPPED 1
551#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE 553#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
552 554
555#define dm_sector_div64(x, y)( \
556{ \
557 u64 _res; \
558 (x) = div64_u64_rem(x, y, &_res); \
559 _res; \
560} \
561)
562
553/* 563/*
554 * Ceiling(n / sz) 564 * Ceiling(n / sz)
555 */ 565 */
diff --git a/include/linux/device.h b/include/linux/device.h
index 22b546a58591..2a9d6ed59579 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -66,6 +66,9 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
66 * @bus_attrs: Default attributes of the bus. 66 * @bus_attrs: Default attributes of the bus.
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus. 68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus.
69 * @match: Called, perhaps multiple times, whenever a new device or driver 72 * @match: Called, perhaps multiple times, whenever a new device or driver
70 * is added for this bus. It should return a nonzero value if the 73 * is added for this bus. It should return a nonzero value if the
71 * given device can be handled by the given driver. 74 * given device can be handled by the given driver.
@@ -103,9 +106,12 @@ struct bus_type {
103 const char *name; 106 const char *name;
104 const char *dev_name; 107 const char *dev_name;
105 struct device *dev_root; 108 struct device *dev_root;
106 struct bus_attribute *bus_attrs; 109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
107 struct device_attribute *dev_attrs; 110 struct device_attribute *dev_attrs; /* use dev_groups instead */
108 struct driver_attribute *drv_attrs; 111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups;
109 115
110 int (*match)(struct device *dev, struct device_driver *drv); 116 int (*match)(struct device *dev, struct device_driver *drv);
111 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 117 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -271,6 +277,8 @@ struct driver_attribute {
271 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) 277 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
272#define DRIVER_ATTR_RO(_name) \ 278#define DRIVER_ATTR_RO(_name) \
273 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) 279 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
280#define DRIVER_ATTR_WO(_name) \
281 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
274 282
275extern int __must_check driver_create_file(struct device_driver *driver, 283extern int __must_check driver_create_file(struct device_driver *driver,
276 const struct driver_attribute *attr); 284 const struct driver_attribute *attr);
@@ -528,6 +536,8 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
528 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 536 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
529#define DEVICE_ATTR_RO(_name) \ 537#define DEVICE_ATTR_RO(_name) \
530 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 538 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
539#define DEVICE_ATTR_WO(_name) \
540 struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
531#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 541#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
532 struct dev_ext_attribute dev_attr_##_name = \ 542 struct dev_ext_attribute dev_attr_##_name = \
533 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 543 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -727,7 +737,7 @@ struct device {
727 737
728 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 738 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
729 override */ 739 override */
730#ifdef CONFIG_CMA 740#ifdef CONFIG_DMA_CMA
731 struct cma *cma_area; /* contiguous memory area for dma 741 struct cma *cma_area; /* contiguous memory area for dma
732 allocations */ 742 allocations */
733#endif 743#endif
@@ -895,6 +905,7 @@ static inline bool device_supports_offline(struct device *dev)
895 905
896extern void lock_device_hotplug(void); 906extern void lock_device_hotplug(void);
897extern void unlock_device_hotplug(void); 907extern void unlock_device_hotplug(void);
908extern int lock_device_hotplug_sysfs(void);
898extern int device_offline(struct device *dev); 909extern int device_offline(struct device *dev);
899extern int device_online(struct device *dev); 910extern int device_online(struct device *dev);
900/* 911/*
@@ -1099,7 +1110,8 @@ do { \
1099 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1110 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
1100#define dev_info_ratelimited(dev, fmt, ...) \ 1111#define dev_info_ratelimited(dev, fmt, ...) \
1101 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1112 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1102#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG) 1113#if defined(CONFIG_DYNAMIC_DEBUG)
1114/* descriptor check is first to prevent flooding with "callbacks suppressed" */
1103#define dev_dbg_ratelimited(dev, fmt, ...) \ 1115#define dev_dbg_ratelimited(dev, fmt, ...) \
1104do { \ 1116do { \
1105 static DEFINE_RATELIMIT_STATE(_rs, \ 1117 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -1108,8 +1120,17 @@ do { \
1108 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1120 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1109 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1121 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1110 __ratelimit(&_rs)) \ 1122 __ratelimit(&_rs)) \
1111 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 1123 __dynamic_dev_dbg(&descriptor, dev, fmt, \
1112 ##__VA_ARGS__); \ 1124 ##__VA_ARGS__); \
1125} while (0)
1126#elif defined(DEBUG)
1127#define dev_dbg_ratelimited(dev, fmt, ...) \
1128do { \
1129 static DEFINE_RATELIMIT_STATE(_rs, \
1130 DEFAULT_RATELIMIT_INTERVAL, \
1131 DEFAULT_RATELIMIT_BURST); \
1132 if (__ratelimit(&_rs)) \
1133 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1113} while (0) 1134} while (0)
1114#else 1135#else
1115#define dev_dbg_ratelimited(dev, fmt, ...) \ 1136#define dev_dbg_ratelimited(dev, fmt, ...) \
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index 96e87693d933..841925fbfe8a 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -14,6 +14,8 @@
14#ifndef __DM9000_PLATFORM_DATA 14#ifndef __DM9000_PLATFORM_DATA
15#define __DM9000_PLATFORM_DATA __FILE__ 15#define __DM9000_PLATFORM_DATA __FILE__
16 16
17#include <linux/if_ether.h>
18
17/* IO control flags */ 19/* IO control flags */
18 20
19#define DM9000_PLATF_8BITONLY (0x0001) 21#define DM9000_PLATF_8BITONLY (0x0001)
@@ -27,7 +29,7 @@
27 29
28struct dm9000_plat_data { 30struct dm9000_plat_data {
29 unsigned int flags; 31 unsigned int flags;
30 unsigned char dev_addr[6]; 32 unsigned char dev_addr[ETH_ALEN];
31 33
32 /* allow replacement IO routines */ 34 /* allow replacement IO routines */
33 35
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 01b5c84be828..3b28f937d959 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -57,7 +57,7 @@ struct cma;
57struct page; 57struct page;
58struct device; 58struct device;
59 59
60#ifdef CONFIG_CMA 60#ifdef CONFIG_DMA_CMA
61 61
62/* 62/*
63 * There is always at least global CMA area and a few optional device 63 * There is always at least global CMA area and a few optional device
@@ -67,9 +67,53 @@ struct device;
67 67
68extern struct cma *dma_contiguous_default_area; 68extern struct cma *dma_contiguous_default_area;
69 69
70static inline struct cma *dev_get_cma_area(struct device *dev)
71{
72 if (dev && dev->cma_area)
73 return dev->cma_area;
74 return dma_contiguous_default_area;
75}
76
77static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
78{
79 if (dev)
80 dev->cma_area = cma;
81}
82
83static inline void dma_contiguous_set_default(struct cma *cma)
84{
85 dma_contiguous_default_area = cma;
86}
87
70void dma_contiguous_reserve(phys_addr_t addr_limit); 88void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, phys_addr_t size, 89
72 phys_addr_t base, phys_addr_t limit); 90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
91 phys_addr_t limit, struct cma **res_cma);
92
93/**
94 * dma_declare_contiguous() - reserve area for contiguous memory handling
95 * for particular device
96 * @dev: Pointer to device structure.
97 * @size: Size of the reserved memory.
98 * @base: Start address of the reserved memory (optional, 0 for any).
99 * @limit: End address of the reserved memory (optional, 0 for any).
100 *
101 * This function reserves memory for specified device. It should be
102 * called by board specific code when early allocator (memblock or bootmem)
103 * is still activate.
104 */
105
106static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
107 phys_addr_t base, phys_addr_t limit)
108{
109 struct cma *cma;
110 int ret;
111 ret = dma_contiguous_reserve_area(size, base, limit, &cma);
112 if (ret == 0)
113 dev_set_cma_area(dev, cma);
114
115 return ret;
116}
73 117
74struct page *dma_alloc_from_contiguous(struct device *dev, int count, 118struct page *dma_alloc_from_contiguous(struct device *dev, int count,
75 unsigned int order); 119 unsigned int order);
@@ -80,8 +124,22 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
80 124
81#define MAX_CMA_AREAS (0) 125#define MAX_CMA_AREAS (0)
82 126
127static inline struct cma *dev_get_cma_area(struct device *dev)
128{
129 return NULL;
130}
131
132static inline void dev_set_cma_area(struct device *dev, struct cma *cma) { }
133
134static inline void dma_contiguous_set_default(struct cma *cma) { }
135
83static inline void dma_contiguous_reserve(phys_addr_t limit) { } 136static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84 137
138static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
139 phys_addr_t limit, struct cma **res_cma) {
140 return -ENOSYS;
141}
142
85static inline 143static inline
86int dma_declare_contiguous(struct device *dev, phys_addr_t size, 144int dma_declare_contiguous(struct device *dev, phys_addr_t size,
87 phys_addr_t base, phys_addr_t limit) 145 phys_addr_t base, phys_addr_t limit)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 94af41858513..3a8d0a2af607 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -132,9 +132,8 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
132static inline void *dma_zalloc_coherent(struct device *dev, size_t size, 132static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
133 dma_addr_t *dma_handle, gfp_t flag) 133 dma_addr_t *dma_handle, gfp_t flag)
134{ 134{
135 void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); 135 void *ret = dma_alloc_coherent(dev, size, dma_handle,
136 if (ret) 136 flag | __GFP_ZERO);
137 memset(ret, 0, size);
138 return ret; 137 return ret;
139} 138}
140 139
diff --git a/include/linux/dma/mmp-pdma.h b/include/linux/dma/mmp-pdma.h
new file mode 100644
index 000000000000..2dc9b2bc18fc
--- /dev/null
+++ b/include/linux/dma/mmp-pdma.h
@@ -0,0 +1,15 @@
1#ifndef _MMP_PDMA_H_
2#define _MMP_PDMA_H_
3
4struct dma_chan;
5
6#ifdef CONFIG_MMP_PDMA
7bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param);
8#else
9static inline bool mmp_pdma_filter_fn(struct dma_chan *chan, void *param)
10{
11 return false;
12}
13#endif
14
15#endif /* _MMP_PDMA_H_ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index cb286b1acdb6..0bc727534108 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -38,7 +38,10 @@ typedef s32 dma_cookie_t;
38#define DMA_MIN_COOKIE 1 38#define DMA_MIN_COOKIE 1
39#define DMA_MAX_COOKIE INT_MAX 39#define DMA_MAX_COOKIE INT_MAX
40 40
41#define dma_submit_error(cookie) ((cookie) < 0 ? 1 : 0) 41static inline int dma_submit_error(dma_cookie_t cookie)
42{
43 return cookie < 0 ? cookie : 0;
44}
42 45
43/** 46/**
44 * enum dma_status - DMA transaction status 47 * enum dma_status - DMA transaction status
@@ -370,6 +373,25 @@ struct dma_slave_config {
370 unsigned int slave_id; 373 unsigned int slave_id;
371}; 374};
372 375
376/* struct dma_slave_caps - expose capabilities of a slave channel only
377 *
378 * @src_addr_widths: bit mask of src addr widths the channel supports
379 * @dstn_addr_widths: bit mask of dstn addr widths the channel supports
380 * @directions: bit mask of slave direction the channel supported
381 * since the enum dma_transfer_direction is not defined as bits for each
382 * type of direction, the dma controller should fill (1 << <TYPE>) and same
383 * should be checked by controller as well
384 * @cmd_pause: true, if pause and thereby resume is supported
385 * @cmd_terminate: true, if terminate cmd is supported
386 */
387struct dma_slave_caps {
388 u32 src_addr_widths;
389 u32 dstn_addr_widths;
390 u32 directions;
391 bool cmd_pause;
392 bool cmd_terminate;
393};
394
373static inline const char *dma_chan_name(struct dma_chan *chan) 395static inline const char *dma_chan_name(struct dma_chan *chan)
374{ 396{
375 return dev_name(&chan->dev->device); 397 return dev_name(&chan->dev->device);
@@ -532,6 +554,7 @@ struct dma_tx_state {
532 * struct with auxiliary transfer status information, otherwise the call 554 * struct with auxiliary transfer status information, otherwise the call
533 * will just return a simple status code 555 * will just return a simple status code
534 * @device_issue_pending: push pending transactions to hardware 556 * @device_issue_pending: push pending transactions to hardware
557 * @device_slave_caps: return the slave channel capabilities
535 */ 558 */
536struct dma_device { 559struct dma_device {
537 560
@@ -597,6 +620,7 @@ struct dma_device {
597 dma_cookie_t cookie, 620 dma_cookie_t cookie,
598 struct dma_tx_state *txstate); 621 struct dma_tx_state *txstate);
599 void (*device_issue_pending)(struct dma_chan *chan); 622 void (*device_issue_pending)(struct dma_chan *chan);
623 int (*device_slave_caps)(struct dma_chan *chan, struct dma_slave_caps *caps);
600}; 624};
601 625
602static inline int dmaengine_device_control(struct dma_chan *chan, 626static inline int dmaengine_device_control(struct dma_chan *chan,
@@ -670,6 +694,21 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma(
670 return chan->device->device_prep_interleaved_dma(chan, xt, flags); 694 return chan->device->device_prep_interleaved_dma(chan, xt, flags);
671} 695}
672 696
697static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps)
698{
699 if (!chan || !caps)
700 return -EINVAL;
701
702 /* check if the channel supports slave transactions */
703 if (!test_bit(DMA_SLAVE, chan->device->cap_mask.bits))
704 return -ENXIO;
705
706 if (chan->device->device_slave_caps)
707 return chan->device->device_slave_caps(chan, caps);
708
709 return -ENXIO;
710}
711
673static inline int dmaengine_terminate_all(struct dma_chan *chan) 712static inline int dmaengine_terminate_all(struct dma_chan *chan)
674{ 713{
675 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); 714 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
@@ -958,8 +997,9 @@ dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used,
958 } 997 }
959} 998}
960 999
961enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
962#ifdef CONFIG_DMA_ENGINE 1000#ifdef CONFIG_DMA_ENGINE
1001struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
1002enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
963enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 1003enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
964void dma_issue_pending_all(void); 1004void dma_issue_pending_all(void);
965struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask, 1005struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
@@ -967,6 +1007,14 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
967struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name); 1007struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name);
968void dma_release_channel(struct dma_chan *chan); 1008void dma_release_channel(struct dma_chan *chan);
969#else 1009#else
1010static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
1011{
1012 return NULL;
1013}
1014static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
1015{
1016 return DMA_SUCCESS;
1017}
970static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 1018static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
971{ 1019{
972 return DMA_SUCCESS; 1020 return DMA_SUCCESS;
@@ -994,7 +1042,7 @@ static inline void dma_release_channel(struct dma_chan *chan)
994int dma_async_device_register(struct dma_device *device); 1042int dma_async_device_register(struct dma_device *device);
995void dma_async_device_unregister(struct dma_device *device); 1043void dma_async_device_unregister(struct dma_device *device);
996void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 1044void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
997struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 1045struct dma_chan *dma_get_slave_channel(struct dma_chan *chan);
998struct dma_chan *net_dma_find_channel(void); 1046struct dma_chan *net_dma_find_channel(void);
999#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 1047#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
1000#define dma_request_slave_channel_compat(mask, x, y, dev, name) \ 1048#define dma_request_slave_channel_compat(mask, x, y, dev, name) \
diff --git a/include/linux/err.h b/include/linux/err.h
index 221fcfb676c4..15f92e072450 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,7 +52,7 @@ static inline void * __must_check ERR_CAST(__force const void *ptr)
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(__force const void *ptr) 55static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
56{ 56{
57 if (IS_ERR(ptr)) 57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr); 58 return PTR_ERR(ptr);
@@ -60,6 +60,9 @@ static inline int __must_check PTR_RET(__force const void *ptr)
60 return 0; 60 return 0;
61} 61}
62 62
63/* Deprecated */
64#define PTR_RET(p) PTR_ERR_OR_ZERO(p)
65
63#endif 66#endif
64 67
65#endif /* _LINUX_ERR_H */ 68#endif /* _LINUX_ERR_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index c623861964e4..d8b512496e50 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -199,6 +199,21 @@ static inline void eth_hw_addr_random(struct net_device *dev)
199} 199}
200 200
201/** 201/**
202 * eth_hw_addr_inherit - Copy dev_addr from another net_device
203 * @dst: pointer to net_device to copy dev_addr to
204 * @src: pointer to net_device to copy dev_addr from
205 *
206 * Copy the Ethernet address from one net_device to another along with
207 * the address attributes (addr_assign_type).
208 */
209static inline void eth_hw_addr_inherit(struct net_device *dst,
210 struct net_device *src)
211{
212 dst->addr_assign_type = src->addr_assign_type;
213 memcpy(dst->dev_addr, src->dev_addr, ETH_ALEN);
214}
215
216/**
202 * compare_ether_addr - Compare two Ethernet addresses 217 * compare_ether_addr - Compare two Ethernet addresses
203 * @addr1: Pointer to a six-byte array containing the Ethernet address 218 * @addr1: Pointer to a six-byte array containing the Ethernet address
204 * @addr2: Pointer other six-byte array containing the Ethernet address 219 * @addr2: Pointer other six-byte array containing the Ethernet address
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index cf5d2af61b81..ff0b981f078e 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -9,7 +9,6 @@
9#define _LINUX_EVENTFD_H 9#define _LINUX_EVENTFD_H
10 10
11#include <linux/fcntl.h> 11#include <linux/fcntl.h>
12#include <linux/file.h>
13#include <linux/wait.h> 12#include <linux/wait.h>
14 13
15/* 14/*
@@ -26,6 +25,8 @@
26#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK) 25#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
27#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE) 26#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
28 27
28struct file;
29
29#ifdef CONFIG_EVENTFD 30#ifdef CONFIG_EVENTFD
30 31
31struct file *eventfd_file_create(unsigned int count, int flags); 32struct file *eventfd_file_create(unsigned int count, int flags);
diff --git a/include/linux/extcon/of_extcon.h b/include/linux/extcon/of_extcon.h
new file mode 100644
index 000000000000..0ebfeff1b55d
--- /dev/null
+++ b/include/linux/extcon/of_extcon.h
@@ -0,0 +1,31 @@
1/*
2 * OF helpers for External connector (extcon) framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Kishon Vijay Abraham I <kishon@ti.com>
6 *
7 * Copyright (C) 2013 Samsung Electronics
8 * Chanwoo Choi <cw00.choi@samsung.com>
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
16#ifndef __LINUX_OF_EXTCON_H
17#define __LINUX_OF_EXTCON_H
18
19#include <linux/err.h>
20
21#if IS_ENABLED(CONFIG_OF_EXTCON)
22extern struct extcon_dev
23 *of_extcon_get_extcon_dev(struct device *dev, int index);
24#else
25static inline struct extcon_dev
26 *of_extcon_get_extcon_dev(struct device *dev, int index)
27{
28 return ERR_PTR(-ENOSYS);
29}
30#endif /* CONFIG_OF_EXTCON */
31#endif /* __LINUX_OF_EXTCON_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 383d5e39b280..bb942f6d5702 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -140,14 +140,24 @@ struct f2fs_extent {
140} __packed; 140} __packed;
141 141
142#define F2FS_NAME_LEN 255 142#define F2FS_NAME_LEN 255
143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 143#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 144#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 145#define ADDRS_PER_INODE(fi) addrs_per_inode(fi)
146#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
147#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
148
149#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1)
150#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2)
151#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3)
152#define NODE_IND2_BLOCK (DEF_ADDRS_PER_INODE + 4)
153#define NODE_DIND_BLOCK (DEF_ADDRS_PER_INODE + 5)
154
155#define F2FS_INLINE_XATTR 0x01 /* file inline xattr flag */
146 156
147struct f2fs_inode { 157struct f2fs_inode {
148 __le16 i_mode; /* file mode */ 158 __le16 i_mode; /* file mode */
149 __u8 i_advise; /* file hints */ 159 __u8 i_advise; /* file hints */
150 __u8 i_reserved; /* reserved */ 160 __u8 i_inline; /* file inline flags */
151 __le32 i_uid; /* user ID */ 161 __le32 i_uid; /* user ID */
152 __le32 i_gid; /* group ID */ 162 __le32 i_gid; /* group ID */
153 __le32 i_links; /* links count */ 163 __le32 i_links; /* links count */
@@ -170,7 +180,7 @@ struct f2fs_inode {
170 180
171 struct f2fs_extent i_ext; /* caching a largest extent */ 181 struct f2fs_extent i_ext; /* caching a largest extent */
172 182
173 __le32 i_addr[ADDRS_PER_INODE]; /* Pointers to data blocks */ 183 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
174 184
175 __le32 i_nid[5]; /* direct(2), indirect(2), 185 __le32 i_nid[5]; /* direct(2), indirect(2),
176 double_indirect(1) node id */ 186 double_indirect(1) node id */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index a6ac84871d6d..ff4e40cd45b1 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <linux/compat.h> 8#include <linux/compat.h>
9#include <linux/workqueue.h>
9#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
10 11
11#ifdef CONFIG_COMPAT 12#ifdef CONFIG_COMPAT
@@ -25,15 +26,19 @@ struct sk_filter
25{ 26{
26 atomic_t refcnt; 27 atomic_t refcnt;
27 unsigned int len; /* Number of filter blocks */ 28 unsigned int len; /* Number of filter blocks */
29 struct rcu_head rcu;
28 unsigned int (*bpf_func)(const struct sk_buff *skb, 30 unsigned int (*bpf_func)(const struct sk_buff *skb,
29 const struct sock_filter *filter); 31 const struct sock_filter *filter);
30 struct rcu_head rcu; 32 union {
31 struct sock_filter insns[0]; 33 struct sock_filter insns[0];
34 struct work_struct work;
35 };
32}; 36};
33 37
34static inline unsigned int sk_filter_len(const struct sk_filter *fp) 38static inline unsigned int sk_filter_size(unsigned int proglen)
35{ 39{
36 return fp->len * sizeof(struct sock_filter) + sizeof(*fp); 40 return max(sizeof(struct sk_filter),
41 offsetof(struct sk_filter, insns[proglen]));
37} 42}
38 43
39extern int sk_filter(struct sock *sk, struct sk_buff *skb); 44extern int sk_filter(struct sock *sk, struct sk_buff *skb);
@@ -67,11 +72,13 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
67} 72}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
69#else 74#else
75#include <linux/slab.h>
70static inline void bpf_jit_compile(struct sk_filter *fp) 76static inline void bpf_jit_compile(struct sk_filter *fp)
71{ 77{
72} 78}
73static inline void bpf_jit_free(struct sk_filter *fp) 79static inline void bpf_jit_free(struct sk_filter *fp)
74{ 80{
81 kfree(fp);
75} 82}
76#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns) 83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
77#endif 84#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 981874773e85..3f40547ba191 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,7 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/list_lru.h>
13#include <linux/llist.h> 14#include <linux/llist.h>
14#include <linux/radix-tree.h> 15#include <linux/radix-tree.h>
15#include <linux/rbtree.h> 16#include <linux/rbtree.h>
@@ -46,6 +47,7 @@ struct vfsmount;
46struct cred; 47struct cred;
47struct swap_info_struct; 48struct swap_info_struct;
48struct seq_file; 49struct seq_file;
50struct workqueue_struct;
49 51
50extern void __init inode_init(void); 52extern void __init inode_init(void);
51extern void __init inode_init_early(void); 53extern void __init inode_init_early(void);
@@ -63,8 +65,7 @@ struct buffer_head;
63typedef int (get_block_t)(struct inode *inode, sector_t iblock, 65typedef int (get_block_t)(struct inode *inode, sector_t iblock,
64 struct buffer_head *bh_result, int create); 66 struct buffer_head *bh_result, int create);
65typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 67typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
66 ssize_t bytes, void *private, int ret, 68 ssize_t bytes, void *private);
67 bool is_async);
68 69
69#define MAY_EXEC 0x00000001 70#define MAY_EXEC 0x00000001
70#define MAY_WRITE 0x00000002 71#define MAY_WRITE 0x00000002
@@ -1269,15 +1270,6 @@ struct super_block {
1269 struct list_head s_files; 1270 struct list_head s_files;
1270#endif 1271#endif
1271 struct list_head s_mounts; /* list of mounts; _not_ for fs use */ 1272 struct list_head s_mounts; /* list of mounts; _not_ for fs use */
1272 /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
1273 struct list_head s_dentry_lru; /* unused dentry lru */
1274 int s_nr_dentry_unused; /* # of dentry on lru */
1275
1276 /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */
1277 spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp;
1278 struct list_head s_inode_lru; /* unused inode lru */
1279 int s_nr_inodes_unused; /* # of inodes on lru */
1280
1281 struct block_device *s_bdev; 1273 struct block_device *s_bdev;
1282 struct backing_dev_info *s_bdi; 1274 struct backing_dev_info *s_bdi;
1283 struct mtd_info *s_mtd; 1275 struct mtd_info *s_mtd;
@@ -1328,11 +1320,17 @@ struct super_block {
1328 1320
1329 /* Being remounted read-only */ 1321 /* Being remounted read-only */
1330 int s_readonly_remount; 1322 int s_readonly_remount;
1331};
1332 1323
1333/* superblock cache pruning functions */ 1324 /* AIO completions deferred from interrupt context */
1334extern void prune_icache_sb(struct super_block *sb, int nr_to_scan); 1325 struct workqueue_struct *s_dio_done_wq;
1335extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan); 1326
1327 /*
1328 * Keep the lru lists last in the structure so they always sit on their
1329 * own individual cachelines.
1330 */
1331 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1332 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1333};
1336 1334
1337extern struct timespec current_fs_time(struct super_block *sb); 1335extern struct timespec current_fs_time(struct super_block *sb);
1338 1336
@@ -1626,8 +1624,8 @@ struct super_operations {
1626 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1624 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1627#endif 1625#endif
1628 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1626 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1629 int (*nr_cached_objects)(struct super_block *); 1627 long (*nr_cached_objects)(struct super_block *, int);
1630 void (*free_cached_objects)(struct super_block *, int); 1628 long (*free_cached_objects)(struct super_block *, long, int);
1631}; 1629};
1632 1630
1633/* 1631/*
@@ -1804,7 +1802,7 @@ enum file_time_flags {
1804 S_VERSION = 8, 1802 S_VERSION = 8,
1805}; 1803};
1806 1804
1807extern void touch_atime(struct path *); 1805extern void touch_atime(const struct path *);
1808static inline void file_accessed(struct file *file) 1806static inline void file_accessed(struct file *file)
1809{ 1807{
1810 if (!(file->f_flags & O_NOATIME)) 1808 if (!(file->f_flags & O_NOATIME))
@@ -1897,6 +1895,7 @@ extern int vfs_ustat(dev_t, struct kstatfs *);
1897extern int freeze_super(struct super_block *super); 1895extern int freeze_super(struct super_block *super);
1898extern int thaw_super(struct super_block *super); 1896extern int thaw_super(struct super_block *super);
1899extern bool our_mnt(struct vfsmount *mnt); 1897extern bool our_mnt(struct vfsmount *mnt);
1898extern bool fs_fully_visible(struct file_system_type *);
1900 1899
1901extern int current_umask(void); 1900extern int current_umask(void);
1902 1901
@@ -2070,6 +2069,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
2070extern void emergency_thaw_all(void); 2069extern void emergency_thaw_all(void);
2071extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2070extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
2072extern int fsync_bdev(struct block_device *); 2071extern int fsync_bdev(struct block_device *);
2072extern int sb_is_blkdev_sb(struct super_block *sb);
2073#else 2073#else
2074static inline void bd_forget(struct inode *inode) {} 2074static inline void bd_forget(struct inode *inode) {}
2075static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2075static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -2089,6 +2089,11 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2089static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg) 2089static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
2090{ 2090{
2091} 2091}
2092
2093static inline int sb_is_blkdev_sb(struct super_block *sb)
2094{
2095 return 0;
2096}
2092#endif 2097#endif
2093extern int sync_filesystem(struct super_block *); 2098extern int sync_filesystem(struct super_block *);
2094extern const struct file_operations def_blk_fops; 2099extern const struct file_operations def_blk_fops;
@@ -2490,7 +2495,6 @@ extern const struct file_operations generic_ro_fops;
2490#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 2495#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2491 2496
2492extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 2497extern int vfs_readlink(struct dentry *, char __user *, int, const char *);
2493extern int vfs_follow_link(struct nameidata *, const char *);
2494extern int page_readlink(struct dentry *, char __user *, int); 2498extern int page_readlink(struct dentry *, char __user *, int);
2495extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2499extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2496extern void page_put_link(struct dentry *, struct nameidata *, void *); 2500extern void page_put_link(struct dentry *, struct nameidata *, void *);
@@ -2503,6 +2507,7 @@ extern void generic_fillattr(struct inode *, struct kstat *);
2503extern int vfs_getattr(struct path *, struct kstat *); 2507extern int vfs_getattr(struct path *, struct kstat *);
2504void __inode_add_bytes(struct inode *inode, loff_t bytes); 2508void __inode_add_bytes(struct inode *inode, loff_t bytes);
2505void inode_add_bytes(struct inode *inode, loff_t bytes); 2509void inode_add_bytes(struct inode *inode, loff_t bytes);
2510void __inode_sub_bytes(struct inode *inode, loff_t bytes);
2506void inode_sub_bytes(struct inode *inode, loff_t bytes); 2511void inode_sub_bytes(struct inode *inode, loff_t bytes);
2507loff_t inode_get_bytes(struct inode *inode); 2512loff_t inode_get_bytes(struct inode *inode);
2508void inode_set_bytes(struct inode *inode, loff_t bytes); 2513void inode_set_bytes(struct inode *inode, loff_t bytes);
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 51b793466ff3..efb05961bdd8 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -16,8 +16,10 @@
16#ifndef FS_ENET_PD_H 16#ifndef FS_ENET_PD_H
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/clk.h>
19#include <linux/string.h> 20#include <linux/string.h>
20#include <linux/of_mdio.h> 21#include <linux/of_mdio.h>
22#include <linux/if_ether.h>
21#include <asm/types.h> 23#include <asm/types.h>
22 24
23#define FS_ENET_NAME "fs_enet" 25#define FS_ENET_NAME "fs_enet"
@@ -135,13 +137,15 @@ struct fs_platform_info {
135 const struct fs_mii_bus_info *bus_info; 137 const struct fs_mii_bus_info *bus_info;
136 138
137 int rx_ring, tx_ring; /* number of buffers on rx */ 139 int rx_ring, tx_ring; /* number of buffers on rx */
138 __u8 macaddr[6]; /* mac address */ 140 __u8 macaddr[ETH_ALEN]; /* mac address */
139 int rx_copybreak; /* limit we copy small frames */ 141 int rx_copybreak; /* limit we copy small frames */
140 int use_napi; /* use NAPI */ 142 int use_napi; /* use NAPI */
141 int napi_weight; /* NAPI weight */ 143 int napi_weight; /* NAPI weight */
142 144
143 int use_rmii; /* use RMII mode */ 145 int use_rmii; /* use RMII mode */
144 int has_phy; /* if the network is phy container as well...*/ 146 int has_phy; /* if the network is phy container as well...*/
147
148 struct clk *clk_per; /* 'per' clock for register access */
145}; 149};
146struct fs_mii_fec_platform_info { 150struct fs_mii_fec_platform_info {
147 u32 irq[32]; 151 u32 irq[32];
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 2b93a9a5a1e6..0efc3e62843a 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -39,17 +39,6 @@ static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
39 spin_unlock(&fs->lock); 39 spin_unlock(&fs->lock);
40} 40}
41 41
42static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
43 struct path *pwd)
44{
45 spin_lock(&fs->lock);
46 *root = fs->root;
47 path_get(root);
48 *pwd = fs->pwd;
49 path_get(pwd);
50 spin_unlock(&fs->lock);
51}
52
53extern bool current_chrooted(void); 42extern bool current_chrooted(void);
54 43
55#endif /* _LINUX_FS_STRUCT_H */ 44#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index a9ff9a36b86d..7823e9ef995e 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -251,6 +251,10 @@ struct fscache_cache_ops {
251 /* unpin an object in the cache */ 251 /* unpin an object in the cache */
252 void (*unpin_object)(struct fscache_object *object); 252 void (*unpin_object)(struct fscache_object *object);
253 253
254 /* check the consistency between the backing cache and the FS-Cache
255 * cookie */
256 bool (*check_consistency)(struct fscache_operation *op);
257
254 /* store the updated auxiliary data on an object */ 258 /* store the updated auxiliary data on an object */
255 void (*update_object)(struct fscache_object *object); 259 void (*update_object)(struct fscache_object *object);
256 260
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 7a086235da4b..19b46458e4e8 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -183,6 +183,7 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
183 const struct fscache_cookie_def *, 183 const struct fscache_cookie_def *,
184 void *); 184 void *);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern int __fscache_check_consistency(struct fscache_cookie *);
186extern void __fscache_update_cookie(struct fscache_cookie *); 187extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *); 188extern int __fscache_attr_changed(struct fscache_cookie *);
188extern void __fscache_invalidate(struct fscache_cookie *); 189extern void __fscache_invalidate(struct fscache_cookie *);
@@ -208,6 +209,8 @@ extern bool __fscache_maybe_release_page(struct fscache_cookie *, struct page *,
208 gfp_t); 209 gfp_t);
209extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *, 210extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
210 struct inode *); 211 struct inode *);
212extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
213 struct list_head *pages);
211 214
212/** 215/**
213 * fscache_register_netfs - Register a filesystem as desiring caching services 216 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -326,6 +329,25 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
326} 329}
327 330
328/** 331/**
332 * fscache_check_consistency - Request that if the cache is updated
333 * @cookie: The cookie representing the cache object
334 *
335 * Request an consistency check from fscache, which passes the request
336 * to the backing cache.
337 *
338 * Returns 0 if consistent and -ESTALE if inconsistent. May also
339 * return -ENOMEM and -ERESTARTSYS.
340 */
341static inline
342int fscache_check_consistency(struct fscache_cookie *cookie)
343{
344 if (fscache_cookie_valid(cookie))
345 return __fscache_check_consistency(cookie);
346 else
347 return 0;
348}
349
350/**
329 * fscache_update_cookie - Request that a cache object be updated 351 * fscache_update_cookie - Request that a cache object be updated
330 * @cookie: The cookie representing the cache object 352 * @cookie: The cookie representing the cache object
331 * 353 *
@@ -570,6 +592,26 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
570} 592}
571 593
572/** 594/**
595 * fscache_readpages_cancel - Cancel read/alloc on pages
596 * @cookie: The cookie representing the inode's cache object.
597 * @pages: The netfs pages that we canceled write on in readpages()
598 *
599 * Uncache/unreserve the pages reserved earlier in readpages() via
600 * fscache_readpages_or_alloc() and similar. In most successful caches in
601 * readpages() this doesn't do anything. In cases when the underlying netfs's
602 * readahead failed we need to clean up the pagelist (unmark and uncache).
603 *
604 * This function may sleep as it may have to clean up disk state.
605 */
606static inline
607void fscache_readpages_cancel(struct fscache_cookie *cookie,
608 struct list_head *pages)
609{
610 if (fscache_cookie_valid(cookie))
611 __fscache_readpages_cancel(cookie, pages);
612}
613
614/**
573 * fscache_write_page - Request storage of a page in the cache 615 * fscache_write_page - Request storage of a page in the cache
574 * @cookie: The cookie representing the cache object 616 * @cookie: The cookie representing the cache object
575 * @page: The netfs page to store 617 * @page: The netfs page to store
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
deleted file mode 100644
index 55d870238399..000000000000
--- a/include/linux/fsl/mxs-dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_MXS_DMA_H__
10#define __MACH_MXS_DMA_H__
11
12#include <linux/dmaengine.h>
13
14struct mxs_dma_data {
15 int chan_irq;
16};
17
18extern int mxs_dma_is_apbh(struct dma_chan *chan);
19extern int mxs_dma_is_apbx(struct dma_chan *chan);
20#endif /* __MACH_MXS_DMA_H__ */
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 120d57a1c3a5..5eaa746735ff 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -359,6 +359,40 @@ do { \
359 __trace_printk(ip, fmt, ##args); \ 359 __trace_printk(ip, fmt, ##args); \
360} while (0) 360} while (0)
361 361
362/**
363 * tracepoint_string - register constant persistent string to trace system
364 * @str - a constant persistent string that will be referenced in tracepoints
365 *
366 * If constant strings are being used in tracepoints, it is faster and
367 * more efficient to just save the pointer to the string and reference
368 * that with a printf "%s" instead of saving the string in the ring buffer
369 * and wasting space and time.
370 *
371 * The problem with the above approach is that userspace tools that read
372 * the binary output of the trace buffers do not have access to the string.
373 * Instead they just show the address of the string which is not very
374 * useful to users.
375 *
376 * With tracepoint_string(), the string will be registered to the tracing
377 * system and exported to userspace via the debugfs/tracing/printk_formats
378 * file that maps the string address to the string text. This way userspace
379 * tools that read the binary buffers have a way to map the pointers to
380 * the ASCII strings they represent.
381 *
382 * The @str used must be a constant string and persistent as it would not
383 * make sense to show a string that no longer exists. But it is still fine
384 * to be used with modules, because when modules are unloaded, if they
385 * had tracepoints, the ring buffers are cleared too. As long as the string
386 * does not change during the life of the module, it is fine to use
387 * tracepoint_string() within a module.
388 */
389#define tracepoint_string(str) \
390 ({ \
391 static const char *___tp_str __tracepoint_string = str; \
392 ___tp_str; \
393 })
394#define __tracepoint_string __attribute__((section("__tracepoint_str")))
395
362#ifdef CONFIG_PERF_EVENTS 396#ifdef CONFIG_PERF_EVENTS
363struct perf_event; 397struct perf_event;
364 398
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 661d374aeb2d..f8d41cb1cbe0 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -66,8 +66,8 @@ struct gen_pool_chunk {
66 struct list_head next_chunk; /* next chunk in pool */ 66 struct list_head next_chunk; /* next chunk in pool */
67 atomic_t avail; 67 atomic_t avail;
68 phys_addr_t phys_addr; /* physical starting address of memory chunk */ 68 phys_addr_t phys_addr; /* physical starting address of memory chunk */
69 unsigned long start_addr; /* starting address of memory chunk */ 69 unsigned long start_addr; /* start address of memory chunk */
70 unsigned long end_addr; /* ending address of memory chunk */ 70 unsigned long end_addr; /* end address of memory chunk (inclusive) */
71 unsigned long bits[0]; /* bitmap for allocating memory chunk */ 71 unsigned long bits[0]; /* bitmap for allocating memory chunk */
72}; 72};
73 73
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 05bcc0903766..1e041063b226 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -1,132 +1,13 @@
1#ifndef LINUX_HARDIRQ_H 1#ifndef LINUX_HARDIRQ_H
2#define LINUX_HARDIRQ_H 2#define LINUX_HARDIRQ_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt_mask.h>
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
7#include <linux/vtime.h> 7#include <linux/vtime.h>
8#include <asm/hardirq.h>
9 8
10/*
11 * We put the hardirq and softirq counter into the preemption
12 * counter. The bitmask has the following meaning:
13 *
14 * - bits 0-7 are the preemption count (max preemption depth: 256)
15 * - bits 8-15 are the softirq count (max # of softirqs: 256)
16 *
17 * The hardirq count can in theory reach the same as NR_IRQS.
18 * In reality, the number of nested IRQS is limited to the stack
19 * size as well. For archs with over 1000 IRQS it is not practical
20 * to expect that they will all nest. We give a max of 10 bits for
21 * hardirq nesting. An arch may choose to give less than 10 bits.
22 * m68k expects it to be 8.
23 *
24 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
25 * - bit 26 is the NMI_MASK
26 * - bit 27 is the PREEMPT_ACTIVE flag
27 *
28 * PREEMPT_MASK: 0x000000ff
29 * SOFTIRQ_MASK: 0x0000ff00
30 * HARDIRQ_MASK: 0x03ff0000
31 * NMI_MASK: 0x04000000
32 */
33#define PREEMPT_BITS 8
34#define SOFTIRQ_BITS 8
35#define NMI_BITS 1
36
37#define MAX_HARDIRQ_BITS 10
38
39#ifndef HARDIRQ_BITS
40# define HARDIRQ_BITS MAX_HARDIRQ_BITS
41#endif
42
43#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
44#error HARDIRQ_BITS too high!
45#endif
46
47#define PREEMPT_SHIFT 0
48#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
49#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
50#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
51
52#define __IRQ_MASK(x) ((1UL << (x))-1)
53
54#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
55#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
56#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
57#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
58 9
59#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
60#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
61#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
62#define NMI_OFFSET (1UL << NMI_SHIFT)
63
64#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
65
66#ifndef PREEMPT_ACTIVE
67#define PREEMPT_ACTIVE_BITS 1
68#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
69#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
70#endif
71
72#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
73#error PREEMPT_ACTIVE is too low!
74#endif
75
76#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
77#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
78#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
79 | NMI_MASK))
80
81/*
82 * Are we doing bottom half or hardware interrupt processing?
83 * Are we in a softirq context? Interrupt context?
84 * in_softirq - Are we currently processing softirq or have bh disabled?
85 * in_serving_softirq - Are we currently processing softirq?
86 */
87#define in_irq() (hardirq_count())
88#define in_softirq() (softirq_count())
89#define in_interrupt() (irq_count())
90#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
91
92/*
93 * Are we in NMI context?
94 */
95#define in_nmi() (preempt_count() & NMI_MASK)
96
97#if defined(CONFIG_PREEMPT_COUNT)
98# define PREEMPT_CHECK_OFFSET 1
99#else
100# define PREEMPT_CHECK_OFFSET 0
101#endif
102
103/*
104 * Are we running in atomic context? WARNING: this macro cannot
105 * always detect atomic context; in particular, it cannot know about
106 * held spinlocks in non-preemptible kernels. Thus it should not be
107 * used in the general case to determine whether sleeping is possible.
108 * Do not use in_atomic() in driver code.
109 */
110#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
111
112/*
113 * Check whether we were atomic before we did preempt_disable():
114 * (used by the scheduler, *after* releasing the kernel lock)
115 */
116#define in_atomic_preempt_off() \
117 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
118
119#ifdef CONFIG_PREEMPT_COUNT
120# define preemptible() (preempt_count() == 0 && !irqs_disabled())
121#else
122# define preemptible() 0
123#endif
124
125#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
126extern void synchronize_irq(unsigned int irq); 10extern void synchronize_irq(unsigned int irq);
127#else
128# define synchronize_irq(irq) barrier()
129#endif
130 11
131#if defined(CONFIG_TINY_RCU) 12#if defined(CONFIG_TINY_RCU)
132 13
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 3b589440ecfe..9231be9e90a2 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -18,11 +18,21 @@ enum hdmi_infoframe_type {
18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84, 18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
19}; 19};
20 20
21#define HDMI_IEEE_OUI 0x000c03
21#define HDMI_INFOFRAME_HEADER_SIZE 4 22#define HDMI_INFOFRAME_HEADER_SIZE 4
22#define HDMI_AVI_INFOFRAME_SIZE 13 23#define HDMI_AVI_INFOFRAME_SIZE 13
23#define HDMI_SPD_INFOFRAME_SIZE 25 24#define HDMI_SPD_INFOFRAME_SIZE 25
24#define HDMI_AUDIO_INFOFRAME_SIZE 10 25#define HDMI_AUDIO_INFOFRAME_SIZE 10
25 26
27#define HDMI_INFOFRAME_SIZE(type) \
28 (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
29
30struct hdmi_any_infoframe {
31 enum hdmi_infoframe_type type;
32 unsigned char version;
33 unsigned char length;
34};
35
26enum hdmi_colorspace { 36enum hdmi_colorspace {
27 HDMI_COLORSPACE_RGB, 37 HDMI_COLORSPACE_RGB,
28 HDMI_COLORSPACE_YUV422, 38 HDMI_COLORSPACE_YUV422,
@@ -100,9 +110,6 @@ struct hdmi_avi_infoframe {
100 unsigned char version; 110 unsigned char version;
101 unsigned char length; 111 unsigned char length;
102 enum hdmi_colorspace colorspace; 112 enum hdmi_colorspace colorspace;
103 bool active_info_valid;
104 bool horizontal_bar_valid;
105 bool vertical_bar_valid;
106 enum hdmi_scan_mode scan_mode; 113 enum hdmi_scan_mode scan_mode;
107 enum hdmi_colorimetry colorimetry; 114 enum hdmi_colorimetry colorimetry;
108 enum hdmi_picture_aspect picture_aspect; 115 enum hdmi_picture_aspect picture_aspect;
@@ -218,14 +225,52 @@ int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame);
218ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame, 225ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
219 void *buffer, size_t size); 226 void *buffer, size_t size);
220 227
228enum hdmi_3d_structure {
229 HDMI_3D_STRUCTURE_INVALID = -1,
230 HDMI_3D_STRUCTURE_FRAME_PACKING = 0,
231 HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE,
232 HDMI_3D_STRUCTURE_LINE_ALTERNATIVE,
233 HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL,
234 HDMI_3D_STRUCTURE_L_DEPTH,
235 HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH,
236 HDMI_3D_STRUCTURE_TOP_AND_BOTTOM,
237 HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF = 8,
238};
239
240
221struct hdmi_vendor_infoframe { 241struct hdmi_vendor_infoframe {
222 enum hdmi_infoframe_type type; 242 enum hdmi_infoframe_type type;
223 unsigned char version; 243 unsigned char version;
224 unsigned char length; 244 unsigned char length;
225 u8 data[27]; 245 unsigned int oui;
246 u8 vic;
247 enum hdmi_3d_structure s3d_struct;
248 unsigned int s3d_ext_data;
226}; 249};
227 250
251int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame);
228ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, 252ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
229 void *buffer, size_t size); 253 void *buffer, size_t size);
230 254
255union hdmi_vendor_any_infoframe {
256 struct {
257 enum hdmi_infoframe_type type;
258 unsigned char version;
259 unsigned char length;
260 unsigned int oui;
261 } any;
262 struct hdmi_vendor_infoframe hdmi;
263};
264
265union hdmi_infoframe {
266 struct hdmi_any_infoframe any;
267 struct hdmi_avi_infoframe avi;
268 struct hdmi_spd_infoframe spd;
269 union hdmi_vendor_any_infoframe vendor;
270 struct hdmi_audio_infoframe audio;
271};
272
273ssize_t
274hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size);
275
231#endif /* _DRM_HDMI_H */ 276#endif /* _DRM_HDMI_H */
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index ecefb7311dd6..32ba45158d39 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -172,7 +172,7 @@ struct hid_sensor_common {
172 struct hid_sensor_hub_attribute_info sensitivity; 172 struct hid_sensor_hub_attribute_info sensitivity;
173}; 173};
174 174
175/*Convert from hid unit expo to regular exponent*/ 175/* Convert from hid unit expo to regular exponent */
176static inline int hid_sensor_convert_exponent(int unit_expo) 176static inline int hid_sensor_convert_exponent(int unit_expo)
177{ 177{
178 if (unit_expo < 0x08) 178 if (unit_expo < 0x08)
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 6f24446e7669..4f945d3ed49f 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -37,7 +37,7 @@
37#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 37#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458
38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459
39 39
40/*ORIENTATION: Compass 3D: (200083) */ 40/* ORIENTATION: Compass 3D: (200083) */
41#define HID_USAGE_SENSOR_COMPASS_3D 0x200083 41#define HID_USAGE_SENSOR_COMPASS_3D 0x200083
42#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 42#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471
43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 0c48991b0402..31b9d299ef6c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -252,6 +252,8 @@ struct hid_item {
252#define HID_OUTPUT_REPORT 1 252#define HID_OUTPUT_REPORT 1
253#define HID_FEATURE_REPORT 2 253#define HID_FEATURE_REPORT 2
254 254
255#define HID_REPORT_TYPES 3
256
255/* 257/*
256 * HID connect requests 258 * HID connect requests
257 */ 259 */
@@ -283,6 +285,7 @@ struct hid_item {
283#define HID_QUIRK_MULTI_INPUT 0x00000040 285#define HID_QUIRK_MULTI_INPUT 0x00000040
284#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 286#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
285#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
286#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
287#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 290#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
288#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 291#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
@@ -295,6 +298,7 @@ struct hid_item {
295#define HID_GROUP_GENERIC 0x0001 298#define HID_GROUP_GENERIC 0x0001
296#define HID_GROUP_MULTITOUCH 0x0002 299#define HID_GROUP_MULTITOUCH 0x0002
297#define HID_GROUP_SENSOR_HUB 0x0003 300#define HID_GROUP_SENSOR_HUB 0x0003
301#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
298 302
299/* 303/*
300 * This is the global environment of the parser. This information is 304 * This is the global environment of the parser. This information is
@@ -393,14 +397,14 @@ struct hid_report {
393 struct hid_device *device; /* associated device */ 397 struct hid_device *device; /* associated device */
394}; 398};
395 399
400#define HID_MAX_IDS 256
401
396struct hid_report_enum { 402struct hid_report_enum {
397 unsigned numbered; 403 unsigned numbered;
398 struct list_head report_list; 404 struct list_head report_list;
399 struct hid_report *report_id_hash[256]; 405 struct hid_report *report_id_hash[HID_MAX_IDS];
400}; 406};
401 407
402#define HID_REPORT_TYPES 3
403
404#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */ 408#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */
405#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */ 409#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */
406#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */ 410#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */
@@ -456,6 +460,7 @@ struct hid_device { /* device report descriptor */
456 enum hid_type type; /* device type (mouse, kbd, ...) */ 460 enum hid_type type; /* device type (mouse, kbd, ...) */
457 unsigned country; /* HID country */ 461 unsigned country; /* HID country */
458 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 462 struct hid_report_enum report_enum[HID_REPORT_TYPES];
463 struct work_struct led_work; /* delayed LED worker */
459 464
460 struct semaphore driver_lock; /* protects the current driver, except during input */ 465 struct semaphore driver_lock; /* protects the current driver, except during input */
461 struct semaphore driver_input_lock; /* protects the current driver */ 466 struct semaphore driver_input_lock; /* protects the current driver */
@@ -532,6 +537,8 @@ static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
532#define HID_GLOBAL_STACK_SIZE 4 537#define HID_GLOBAL_STACK_SIZE 4
533#define HID_COLLECTION_STACK_SIZE 4 538#define HID_COLLECTION_STACK_SIZE 4
534 539
540#define HID_SCAN_FLAG_MT_WIN_8 0x00000001
541
535struct hid_parser { 542struct hid_parser {
536 struct hid_global global; 543 struct hid_global global;
537 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE]; 544 struct hid_global global_stack[HID_GLOBAL_STACK_SIZE];
@@ -540,6 +547,7 @@ struct hid_parser {
540 unsigned collection_stack[HID_COLLECTION_STACK_SIZE]; 547 unsigned collection_stack[HID_COLLECTION_STACK_SIZE];
541 unsigned collection_stack_ptr; 548 unsigned collection_stack_ptr;
542 struct hid_device *device; 549 struct hid_device *device;
550 unsigned scan_flags;
543}; 551};
544 552
545struct hid_class_descriptor { 553struct hid_class_descriptor {
@@ -744,9 +752,14 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
744unsigned int hidinput_count_leds(struct hid_device *hid); 752unsigned int hidinput_count_leds(struct hid_device *hid);
745__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 753__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
746void hid_output_report(struct hid_report *report, __u8 *data); 754void hid_output_report(struct hid_report *report, __u8 *data);
755u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
747struct hid_device *hid_allocate_device(void); 756struct hid_device *hid_allocate_device(void);
748struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
749int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 758int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
759struct hid_report *hid_validate_values(struct hid_device *hid,
760 unsigned int type, unsigned int id,
761 unsigned int field_index,
762 unsigned int report_counts);
750int hid_open_report(struct hid_device *device); 763int hid_open_report(struct hid_device *device);
751int hid_check_keys_pressed(struct hid_device *hid); 764int hid_check_keys_pressed(struct hid_device *hid);
752int hid_connect(struct hid_device *hid, unsigned int connect_mask); 765int hid_connect(struct hid_device *hid, unsigned int connect_mask);
@@ -989,7 +1002,6 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
989u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 1002u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
990int usbhid_quirks_init(char **quirks_param); 1003int usbhid_quirks_init(char **quirks_param);
991void usbhid_quirks_exit(void); 1004void usbhid_quirks_exit(void);
992void usbhid_set_leds(struct hid_device *hid);
993 1005
994#ifdef CONFIG_HID_PID 1006#ifdef CONFIG_HID_PID
995int hid_pidff_init(struct hid_device *hid); 1007int hid_pidff_init(struct hid_device *hid);
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 2451662c728a..ddf52612eed8 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -23,6 +23,7 @@ struct hidraw {
23 wait_queue_head_t wait; 23 wait_queue_head_t wait;
24 struct hid_device *hid; 24 struct hid_device *hid;
25 struct device *dev; 25 struct device *dev;
26 spinlock_t list_lock;
26 struct list_head list; 27 struct list_head list;
27}; 28};
28 29
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b60de92e2edc..3935428c57cf 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -96,9 +96,6 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
96 pmd_t *dst_pmd, pmd_t *src_pmd, 96 pmd_t *dst_pmd, pmd_t *src_pmd,
97 struct vm_area_struct *vma, 97 struct vm_area_struct *vma,
98 unsigned long addr, unsigned long end); 98 unsigned long addr, unsigned long end);
99extern int handle_pte_fault(struct mm_struct *mm,
100 struct vm_area_struct *vma, unsigned long address,
101 pte_t *pte, pmd_t *pmd, unsigned int flags);
102extern int split_huge_page_to_list(struct page *page, struct list_head *list); 99extern int split_huge_page_to_list(struct page *page, struct list_head *list);
103static inline int split_huge_page(struct page *page) 100static inline int split_huge_page(struct page *page)
104{ 101{
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c2b1801a160b..0393270466c3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -66,6 +66,9 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
66 vm_flags_t vm_flags); 66 vm_flags_t vm_flags);
67void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed); 67void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
68int dequeue_hwpoisoned_huge_page(struct page *page); 68int dequeue_hwpoisoned_huge_page(struct page *page);
69bool isolate_huge_page(struct page *page, struct list_head *list);
70void putback_active_hugepage(struct page *page);
71bool is_hugepage_active(struct page *page);
69void copy_huge_page(struct page *dst, struct page *src); 72void copy_huge_page(struct page *dst, struct page *src);
70 73
71#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE 74#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
@@ -134,6 +137,9 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
134 return 0; 137 return 0;
135} 138}
136 139
140#define isolate_huge_page(p, l) false
141#define putback_active_hugepage(p) do {} while (0)
142#define is_hugepage_active(x) false
137static inline void copy_huge_page(struct page *dst, struct page *src) 143static inline void copy_huge_page(struct page *dst, struct page *src)
138{ 144{
139} 145}
@@ -261,6 +267,8 @@ struct huge_bootmem_page {
261}; 267};
262 268
263struct page *alloc_huge_page_node(struct hstate *h, int nid); 269struct page *alloc_huge_page_node(struct hstate *h, int nid);
270struct page *alloc_huge_page_noerr(struct vm_area_struct *vma,
271 unsigned long addr, int avoid_reserve);
264 272
265/* arch callback */ 273/* arch callback */
266int __init alloc_bootmem_huge_page(struct hstate *h); 274int __init alloc_bootmem_huge_page(struct hstate *h);
@@ -371,9 +379,23 @@ static inline pgoff_t basepage_index(struct page *page)
371 return __basepage_index(page); 379 return __basepage_index(page);
372} 380}
373 381
382extern void dissolve_free_huge_pages(unsigned long start_pfn,
383 unsigned long end_pfn);
384int pmd_huge_support(void);
385/*
386 * Currently hugepage migration is enabled only for pmd-based hugepage.
387 * This function will be updated when hugepage migration is more widely
388 * supported.
389 */
390static inline int hugepage_migration_support(struct hstate *h)
391{
392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
393}
394
374#else /* CONFIG_HUGETLB_PAGE */ 395#else /* CONFIG_HUGETLB_PAGE */
375struct hstate {}; 396struct hstate {};
376#define alloc_huge_page_node(h, nid) NULL 397#define alloc_huge_page_node(h, nid) NULL
398#define alloc_huge_page_noerr(v, a, r) NULL
377#define alloc_bootmem_huge_page(h) NULL 399#define alloc_bootmem_huge_page(h) NULL
378#define hstate_file(f) NULL 400#define hstate_file(f) NULL
379#define hstate_sizelog(s) NULL 401#define hstate_sizelog(s) NULL
@@ -396,6 +418,9 @@ static inline pgoff_t basepage_index(struct page *page)
396{ 418{
397 return page->index; 419 return page->index;
398} 420}
421#define dissolve_free_huge_pages(s, e) do {} while (0)
422#define pmd_huge_support() 0
423#define hugepage_migration_support(h) 0
399#endif /* CONFIG_HUGETLB_PAGE */ 424#endif /* CONFIG_HUGETLB_PAGE */
400 425
401#endif /* _LINUX_HUGETLB_H */ 426#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index fae8bac907ef..d98503bde7e9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -27,6 +27,17 @@
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29 29
30/*
31 * Framework version for util services.
32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
38#define UTIL_FW_MAJOR 3
39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
40
30 41
31/* 42/*
32 * Implementation of host controlled snapshot of the guest. 43 * Implementation of host controlled snapshot of the guest.
@@ -455,27 +466,6 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
455 *read = dsize - *write; 466 *read = dsize - *write;
456} 467}
457 468
458
459/*
460 * We use the same version numbering for all Hyper-V modules.
461 *
462 * Definition of versioning is as follows;
463 *
464 * Major Number Changes for these scenarios;
465 * 1. When a new version of Windows Hyper-V
466 * is released.
467 * 2. A Major change has occurred in the
468 * Linux IC's.
469 * (For example the merge for the first time
470 * into the kernel) Every time the Major Number
471 * changes, the Revision number is reset to 0.
472 * Minor Number Changes when new functionality is added
473 * to the Linux IC's that is not a bug fix.
474 *
475 * 3.1 - Added completed hv_utils driver. Shutdown/Heartbeat/Timesync
476 */
477#define HV_DRV_VERSION "3.1"
478
479/* 469/*
480 * VMBUS version is 32 bit entity broken up into 470 * VMBUS version is 32 bit entity broken up into
481 * two 16 bit quantities: major_number. minor_number. 471 * two 16 bit quantities: major_number. minor_number.
@@ -1494,7 +1484,7 @@ struct hyperv_service_callback {
1494}; 1484};
1495 1485
1496#define MAX_SRV_VER 0x7ffffff 1486#define MAX_SRV_VER 0x7ffffff
1497extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1487extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1498 struct icmsg_negotiate *, u8 *, int, 1488 struct icmsg_negotiate *, u8 *, int,
1499 int); 1489 int);
1500 1490
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e988fa935b3c..2ab11dc38077 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -447,11 +447,13 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
447static inline struct i2c_adapter * 447static inline struct i2c_adapter *
448i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) 448i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
449{ 449{
450#if IS_ENABLED(I2C_MUX)
450 struct device *parent = adapter->dev.parent; 451 struct device *parent = adapter->dev.parent;
451 452
452 if (parent != NULL && parent->type == &i2c_adapter_type) 453 if (parent != NULL && parent->type == &i2c_adapter_type)
453 return to_i2c_adapter(parent); 454 return to_i2c_adapter(parent);
454 else 455 else
456#endif
455 return NULL; 457 return NULL;
456} 458}
457 459
@@ -542,10 +544,24 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
542 544
543#endif /* I2C */ 545#endif /* I2C */
544 546
545#if IS_ENABLED(CONFIG_ACPI_I2C) 547#if IS_ENABLED(CONFIG_OF)
546extern void acpi_i2c_register_devices(struct i2c_adapter *adap); 548/* must call put_device() when done with returned i2c_client device */
549extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
550
551/* must call put_device() when done with returned i2c_adapter device */
552extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
553
547#else 554#else
548static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {} 555
549#endif 556static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
557{
558 return NULL;
559}
560
561static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
562{
563 return NULL;
564}
565#endif /* CONFIG_OF */
550 566
551#endif /* _LINUX_I2C_H */ 567#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
index 60e411d764d4..7aa901d92058 100644
--- a/include/linux/i2c/i2c-hid.h
+++ b/include/linux/i2c/i2c-hid.h
@@ -19,7 +19,8 @@
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored. 19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 * 20 *
21 * Note that it is the responsibility of the platform driver (or the acpi 5.0 21 * Note that it is the responsibility of the platform driver (or the acpi 5.0
22 * driver) to setup the irq related to the gpio in the struct i2c_board_info. 22 * driver, or the flattened device tree) to setup the irq related to the gpio in
23 * the struct i2c_board_info.
23 * The platform driver should also setup the gpio according to the device: 24 * The platform driver should also setup the gpio according to the device:
24 * 25 *
25 * A typical example is the following: 26 * A typical example is the following:
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
index 1a9f65e6ec0f..53aab243cbd8 100644
--- a/include/linux/i2c/pxa-i2c.h
+++ b/include/linux/i2c/pxa-i2c.h
@@ -67,6 +67,9 @@ struct i2c_pxa_platform_data {
67 unsigned int class; 67 unsigned int class;
68 unsigned int use_pio :1; 68 unsigned int use_pio :1;
69 unsigned int fast_mode :1; 69 unsigned int fast_mode :1;
70 unsigned int high_mode:1;
71 unsigned char master_code;
72 unsigned long rate;
70}; 73};
71 74
72extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info); 75extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index a986ff588944..0f9bafa17a02 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -31,6 +31,30 @@
31#define I8042_CMD_MUX_PFX 0x0090 31#define I8042_CMD_MUX_PFX 0x0090
32#define I8042_CMD_MUX_SEND 0x1090 32#define I8042_CMD_MUX_SEND 0x1090
33 33
34/*
35 * Status register bits.
36 */
37
38#define I8042_STR_PARITY 0x80
39#define I8042_STR_TIMEOUT 0x40
40#define I8042_STR_AUXDATA 0x20
41#define I8042_STR_KEYLOCK 0x10
42#define I8042_STR_CMDDAT 0x08
43#define I8042_STR_MUXERR 0x04
44#define I8042_STR_IBF 0x02
45#define I8042_STR_OBF 0x01
46
47/*
48 * Control register bits.
49 */
50
51#define I8042_CTR_KBDINT 0x01
52#define I8042_CTR_AUXINT 0x02
53#define I8042_CTR_IGNKEYLOCK 0x08
54#define I8042_CTR_KBDDIS 0x10
55#define I8042_CTR_AUXDIS 0x20
56#define I8042_CTR_XLATE 0x40
57
34struct serio; 58struct serio;
35 59
36#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE) 60#if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index b0dc87a2a376..a5b598a79bec 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -16,6 +16,7 @@
16#define LINUX_IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/if_ether.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21/* 22/*
@@ -209,28 +210,28 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
209struct ieee80211_hdr { 210struct ieee80211_hdr {
210 __le16 frame_control; 211 __le16 frame_control;
211 __le16 duration_id; 212 __le16 duration_id;
212 u8 addr1[6]; 213 u8 addr1[ETH_ALEN];
213 u8 addr2[6]; 214 u8 addr2[ETH_ALEN];
214 u8 addr3[6]; 215 u8 addr3[ETH_ALEN];
215 __le16 seq_ctrl; 216 __le16 seq_ctrl;
216 u8 addr4[6]; 217 u8 addr4[ETH_ALEN];
217} __packed __aligned(2); 218} __packed __aligned(2);
218 219
219struct ieee80211_hdr_3addr { 220struct ieee80211_hdr_3addr {
220 __le16 frame_control; 221 __le16 frame_control;
221 __le16 duration_id; 222 __le16 duration_id;
222 u8 addr1[6]; 223 u8 addr1[ETH_ALEN];
223 u8 addr2[6]; 224 u8 addr2[ETH_ALEN];
224 u8 addr3[6]; 225 u8 addr3[ETH_ALEN];
225 __le16 seq_ctrl; 226 __le16 seq_ctrl;
226} __packed __aligned(2); 227} __packed __aligned(2);
227 228
228struct ieee80211_qos_hdr { 229struct ieee80211_qos_hdr {
229 __le16 frame_control; 230 __le16 frame_control;
230 __le16 duration_id; 231 __le16 duration_id;
231 u8 addr1[6]; 232 u8 addr1[ETH_ALEN];
232 u8 addr2[6]; 233 u8 addr2[ETH_ALEN];
233 u8 addr3[6]; 234 u8 addr3[ETH_ALEN];
234 __le16 seq_ctrl; 235 __le16 seq_ctrl;
235 __le16 qos_ctrl; 236 __le16 qos_ctrl;
236} __packed __aligned(2); 237} __packed __aligned(2);
@@ -608,8 +609,8 @@ struct ieee80211s_hdr {
608 u8 flags; 609 u8 flags;
609 u8 ttl; 610 u8 ttl;
610 __le32 seqnum; 611 __le32 seqnum;
611 u8 eaddr1[6]; 612 u8 eaddr1[ETH_ALEN];
612 u8 eaddr2[6]; 613 u8 eaddr2[ETH_ALEN];
613} __packed __aligned(2); 614} __packed __aligned(2);
614 615
615/* Mesh flags */ 616/* Mesh flags */
@@ -758,7 +759,7 @@ struct ieee80211_rann_ie {
758 u8 rann_flags; 759 u8 rann_flags;
759 u8 rann_hopcount; 760 u8 rann_hopcount;
760 u8 rann_ttl; 761 u8 rann_ttl;
761 u8 rann_addr[6]; 762 u8 rann_addr[ETH_ALEN];
762 __le32 rann_seq; 763 __le32 rann_seq;
763 __le32 rann_interval; 764 __le32 rann_interval;
764 __le32 rann_metric; 765 __le32 rann_metric;
@@ -802,9 +803,9 @@ enum ieee80211_vht_opmode_bits {
802struct ieee80211_mgmt { 803struct ieee80211_mgmt {
803 __le16 frame_control; 804 __le16 frame_control;
804 __le16 duration; 805 __le16 duration;
805 u8 da[6]; 806 u8 da[ETH_ALEN];
806 u8 sa[6]; 807 u8 sa[ETH_ALEN];
807 u8 bssid[6]; 808 u8 bssid[ETH_ALEN];
808 __le16 seq_ctrl; 809 __le16 seq_ctrl;
809 union { 810 union {
810 struct { 811 struct {
@@ -833,7 +834,7 @@ struct ieee80211_mgmt {
833 struct { 834 struct {
834 __le16 capab_info; 835 __le16 capab_info;
835 __le16 listen_interval; 836 __le16 listen_interval;
836 u8 current_ap[6]; 837 u8 current_ap[ETH_ALEN];
837 /* followed by SSID and Supported rates */ 838 /* followed by SSID and Supported rates */
838 u8 variable[0]; 839 u8 variable[0];
839 } __packed reassoc_req; 840 } __packed reassoc_req;
@@ -966,21 +967,21 @@ struct ieee80211_vendor_ie {
966struct ieee80211_rts { 967struct ieee80211_rts {
967 __le16 frame_control; 968 __le16 frame_control;
968 __le16 duration; 969 __le16 duration;
969 u8 ra[6]; 970 u8 ra[ETH_ALEN];
970 u8 ta[6]; 971 u8 ta[ETH_ALEN];
971} __packed __aligned(2); 972} __packed __aligned(2);
972 973
973struct ieee80211_cts { 974struct ieee80211_cts {
974 __le16 frame_control; 975 __le16 frame_control;
975 __le16 duration; 976 __le16 duration;
976 u8 ra[6]; 977 u8 ra[ETH_ALEN];
977} __packed __aligned(2); 978} __packed __aligned(2);
978 979
979struct ieee80211_pspoll { 980struct ieee80211_pspoll {
980 __le16 frame_control; 981 __le16 frame_control;
981 __le16 aid; 982 __le16 aid;
982 u8 bssid[6]; 983 u8 bssid[ETH_ALEN];
983 u8 ta[6]; 984 u8 ta[ETH_ALEN];
984} __packed __aligned(2); 985} __packed __aligned(2);
985 986
986/* TDLS */ 987/* TDLS */
@@ -989,14 +990,14 @@ struct ieee80211_pspoll {
989struct ieee80211_tdls_lnkie { 990struct ieee80211_tdls_lnkie {
990 u8 ie_type; /* Link Identifier IE */ 991 u8 ie_type; /* Link Identifier IE */
991 u8 ie_len; 992 u8 ie_len;
992 u8 bssid[6]; 993 u8 bssid[ETH_ALEN];
993 u8 init_sta[6]; 994 u8 init_sta[ETH_ALEN];
994 u8 resp_sta[6]; 995 u8 resp_sta[ETH_ALEN];
995} __packed; 996} __packed;
996 997
997struct ieee80211_tdls_data { 998struct ieee80211_tdls_data {
998 u8 da[6]; 999 u8 da[ETH_ALEN];
999 u8 sa[6]; 1000 u8 sa[ETH_ALEN];
1000 __be16 ether_type; 1001 __be16 ether_type;
1001 u8 payload_type; 1002 u8 payload_type;
1002 u8 category; 1003 u8 category;
@@ -1090,8 +1091,8 @@ struct ieee80211_p2p_noa_attr {
1090struct ieee80211_bar { 1091struct ieee80211_bar {
1091 __le16 frame_control; 1092 __le16 frame_control;
1092 __le16 duration; 1093 __le16 duration;
1093 __u8 ra[6]; 1094 __u8 ra[ETH_ALEN];
1094 __u8 ta[6]; 1095 __u8 ta[ETH_ALEN];
1095 __le16 control; 1096 __le16 control;
1096 __le16 start_seq_num; 1097 __le16 start_seq_num;
1097} __packed; 1098} __packed;
@@ -1709,6 +1710,10 @@ enum ieee80211_eid {
1709 WLAN_EID_OPMODE_NOTIF = 199, 1710 WLAN_EID_OPMODE_NOTIF = 199,
1710 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, 1711 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1711 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196, 1712 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1713 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1714 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1715 WLAN_EID_AID = 197,
1716 WLAN_EID_QUIET_CHANNEL = 198,
1712 1717
1713 /* 802.11ad */ 1718 /* 802.11ad */
1714 WLAN_EID_NON_TX_BSSID_CAP = 83, 1719 WLAN_EID_NON_TX_BSSID_CAP = 83,
@@ -1860,6 +1865,11 @@ enum ieee80211_tdls_actioncode {
1860 WLAN_TDLS_DISCOVERY_REQUEST = 10, 1865 WLAN_TDLS_DISCOVERY_REQUEST = 10,
1861}; 1866};
1862 1867
1868/* Interworking capabilities are set in 7th bit of 4th byte of the
1869 * @WLAN_EID_EXT_CAPABILITY information element
1870 */
1871#define WLAN_EXT_CAPA4_INTERWORKING_ENABLED BIT(7)
1872
1863/* 1873/*
1864 * TDLS capabililites to be enabled in the 5th byte of the 1874 * TDLS capabililites to be enabled in the 5th byte of the
1865 * @WLAN_EID_EXT_CAPABILITY information element 1875 * @WLAN_EID_EXT_CAPABILITY information element
@@ -2279,4 +2289,8 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2279 return !!(tim->virtual_map[index] & mask); 2289 return !!(tim->virtual_map[index] & mask);
2280} 2290}
2281 2291
2292/* convert time units */
2293#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2294#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
2295
2282#endif /* LINUX_IEEE80211_H */ 2296#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index f6156f91eb1c..a899dc24be15 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -10,9 +10,9 @@
10#ifndef _LINUX_IF_TEAM_H_ 10#ifndef _LINUX_IF_TEAM_H_
11#define _LINUX_IF_TEAM_H_ 11#define _LINUX_IF_TEAM_H_
12 12
13
14#include <linux/netpoll.h> 13#include <linux/netpoll.h>
15#include <net/sch_generic.h> 14#include <net/sch_generic.h>
15#include <linux/types.h>
16#include <uapi/linux/if_team.h> 16#include <uapi/linux/if_team.h>
17 17
18struct team_pcpu_stats { 18struct team_pcpu_stats {
@@ -194,6 +194,18 @@ struct team {
194 bool user_carrier_enabled; 194 bool user_carrier_enabled;
195 bool queue_override_enabled; 195 bool queue_override_enabled;
196 struct list_head *qom_lists; /* array of queue override mapping lists */ 196 struct list_head *qom_lists; /* array of queue override mapping lists */
197 struct {
198 unsigned int count;
199 unsigned int interval; /* in ms */
200 atomic_t count_pending;
201 struct delayed_work dw;
202 } notify_peers;
203 struct {
204 unsigned int count;
205 unsigned int interval; /* in ms */
206 atomic_t count_pending;
207 struct delayed_work dw;
208 } mcast_rejoin;
197 long mode_priv[TEAM_MODE_PRIV_LONGS]; 209 long mode_priv[TEAM_MODE_PRIV_LONGS];
198}; 210};
199 211
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index e3362b5f13e8..f47550d75f85 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -129,6 +129,5 @@ extern void ip_mc_unmap(struct in_device *);
129extern void ip_mc_remap(struct in_device *); 129extern void ip_mc_remap(struct in_device *);
130extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 130extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
131extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 131extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
132extern void ip_mc_rejoin_groups(struct in_device *in_dev);
133 132
134#endif 133#endif
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 72b26940730d..e51f65480ea5 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -17,6 +17,8 @@
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <linux/platform_data/st_sensors_pdata.h>
21
20#define ST_SENSORS_TX_MAX_LENGTH 2 22#define ST_SENSORS_TX_MAX_LENGTH 2
21#define ST_SENSORS_RX_MAX_LENGTH 6 23#define ST_SENSORS_RX_MAX_LENGTH 6
22 24
@@ -118,14 +120,16 @@ struct st_sensor_bdu {
118/** 120/**
119 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt 121 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
120 * @addr: address of the register. 122 * @addr: address of the register.
121 * @mask: mask to write the on/off value. 123 * @mask_int1: mask to enable/disable IRQ on INT1 pin.
124 * @mask_int2: mask to enable/disable IRQ on INT2 pin.
122 * struct ig1 - represents the Interrupt Generator 1 of sensors. 125 * struct ig1 - represents the Interrupt Generator 1 of sensors.
123 * @en_addr: address of the enable ig1 register. 126 * @en_addr: address of the enable ig1 register.
124 * @en_mask: mask to write the on/off value for enable. 127 * @en_mask: mask to write the on/off value for enable.
125 */ 128 */
126struct st_sensor_data_ready_irq { 129struct st_sensor_data_ready_irq {
127 u8 addr; 130 u8 addr;
128 u8 mask; 131 u8 mask_int1;
132 u8 mask_int2;
129 struct { 133 struct {
130 u8 en_addr; 134 u8 en_addr;
131 u8 en_mask; 135 u8 en_mask;
@@ -201,6 +205,7 @@ struct st_sensors {
201 * @buffer_data: Data used by buffer part. 205 * @buffer_data: Data used by buffer part.
202 * @odr: Output data rate of the sensor [Hz]. 206 * @odr: Output data rate of the sensor [Hz].
203 * num_data_channels: Number of data channels used in buffer. 207 * num_data_channels: Number of data channels used in buffer.
208 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
204 * @get_irq_data_ready: Function to get the IRQ used for data ready signal. 209 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
205 * @tf: Transfer function structure used by I/O operations. 210 * @tf: Transfer function structure used by I/O operations.
206 * @tb: Transfer buffers and mutex used by I/O operations. 211 * @tb: Transfer buffers and mutex used by I/O operations.
@@ -219,6 +224,8 @@ struct st_sensor_data {
219 unsigned int odr; 224 unsigned int odr;
220 unsigned int num_data_channels; 225 unsigned int num_data_channels;
221 226
227 u8 drdy_int_pin;
228
222 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); 229 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
223 230
224 const struct st_sensor_transfer_function *tf; 231 const struct st_sensor_transfer_function *tf;
@@ -249,7 +256,8 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev)
249} 256}
250#endif 257#endif
251 258
252int st_sensors_init_sensor(struct iio_dev *indio_dev); 259int st_sensors_init_sensor(struct iio_dev *indio_dev,
260 struct st_sensors_platform_data *pdata);
253 261
254int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); 262int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
255 263
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3d35b7023591..2103cc32a5fb 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -532,6 +532,60 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
532void iio_device_free(struct iio_dev *indio_dev); 532void iio_device_free(struct iio_dev *indio_dev);
533 533
534/** 534/**
535 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
536 * @dev: Device to allocate iio_dev for
537 * @sizeof_priv: Space to allocate for private structure.
538 *
539 * Managed iio_device_alloc. iio_dev allocated with this function is
540 * automatically freed on driver detach.
541 *
542 * If an iio_dev allocated with this function needs to be freed separately,
543 * devm_iio_device_free() must be used.
544 *
545 * RETURNS:
546 * Pointer to allocated iio_dev on success, NULL on failure.
547 */
548struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
549
550/**
551 * devm_iio_device_free - Resource-managed iio_device_free()
552 * @dev: Device this iio_dev belongs to
553 * @indio_dev: the iio_dev associated with the device
554 *
555 * Free iio_dev allocated with devm_iio_device_alloc().
556 */
557void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
558
559/**
560 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
561 * @dev: Device to allocate iio_trigger for
562 * @fmt: trigger name format. If it includes format
563 * specifiers, the additional arguments following
564 * format are formatted and inserted in the resulting
565 * string replacing their respective specifiers.
566 *
567 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
568 * automatically freed on driver detach.
569 *
570 * If an iio_trigger allocated with this function needs to be freed separately,
571 * devm_iio_trigger_free() must be used.
572 *
573 * RETURNS:
574 * Pointer to allocated iio_trigger on success, NULL on failure.
575 */
576struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
577 const char *fmt, ...);
578
579/**
580 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
581 * @dev: Device this iio_dev belongs to
582 * @iio_trig: the iio_trigger associated with the device
583 *
584 * Free iio_trigger allocated with devm_iio_trigger_alloc().
585 */
586void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
587
588/**
535 * iio_buffer_enabled() - helper function to test if the buffer is enabled 589 * iio_buffer_enabled() - helper function to test if the buffer is enabled
536 * @indio_dev: IIO device structure for device 590 * @indio_dev: IIO device structure for device
537 **/ 591 **/
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index b7a934b9431b..2958c960003a 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -73,11 +73,6 @@ struct iio_const_attr {
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} 73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74 74
75/* Generic attributes of onetype or another */ 75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81 76
82/** 77/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency 78 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
diff --git a/include/linux/init.h b/include/linux/init.h
index e73f2b708525..f1c27a71d03c 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -153,6 +153,7 @@ extern unsigned int reset_devices;
153void setup_arch(char **); 153void setup_arch(char **);
154void prepare_namespace(void); 154void prepare_namespace(void);
155void __init load_default_modules(void); 155void __init load_default_modules(void);
156int __init init_rootfs(void);
156 157
157extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
158 159
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 78e2ada50cd5..d380c5e68008 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -55,7 +55,7 @@
55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ 55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */ 56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */
57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ 57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ 58#define DMAR_ICS_REG 0x9c /* Invalidation complete status register */
59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ 59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
60 60
61#define OFFSET_STRIDE (9) 61#define OFFSET_STRIDE (9)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5fa5afeeb759..5e865b554940 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -120,7 +120,6 @@ struct irqaction {
120 120
121extern irqreturn_t no_action(int cpl, void *dev_id); 121extern irqreturn_t no_action(int cpl, void *dev_id);
122 122
123#ifdef CONFIG_GENERIC_HARDIRQS
124extern int __must_check 123extern int __must_check
125request_threaded_irq(unsigned int irq, irq_handler_t handler, 124request_threaded_irq(unsigned int irq, irq_handler_t handler,
126 irq_handler_t thread_fn, 125 irq_handler_t thread_fn,
@@ -140,40 +139,6 @@ request_any_context_irq(unsigned int irq, irq_handler_t handler,
140extern int __must_check 139extern int __must_check
141request_percpu_irq(unsigned int irq, irq_handler_t handler, 140request_percpu_irq(unsigned int irq, irq_handler_t handler,
142 const char *devname, void __percpu *percpu_dev_id); 141 const char *devname, void __percpu *percpu_dev_id);
143#else
144
145extern int __must_check
146request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
147 const char *name, void *dev);
148
149/*
150 * Special function to avoid ifdeffery in kernel/irq/devres.c which
151 * gets magically built by GENERIC_HARDIRQS=n architectures (sparc,
152 * m68k). I really love these $@%#!* obvious Makefile references:
153 * ../../../kernel/irq/devres.o
154 */
155static inline int __must_check
156request_threaded_irq(unsigned int irq, irq_handler_t handler,
157 irq_handler_t thread_fn,
158 unsigned long flags, const char *name, void *dev)
159{
160 return request_irq(irq, handler, flags, name, dev);
161}
162
163static inline int __must_check
164request_any_context_irq(unsigned int irq, irq_handler_t handler,
165 unsigned long flags, const char *name, void *dev_id)
166{
167 return request_irq(irq, handler, flags, name, dev_id);
168}
169
170static inline int __must_check
171request_percpu_irq(unsigned int irq, irq_handler_t handler,
172 const char *devname, void __percpu *percpu_dev_id)
173{
174 return request_irq(irq, handler, 0, devname, percpu_dev_id);
175}
176#endif
177 142
178extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
179extern void free_percpu_irq(unsigned int, void __percpu *); 144extern void free_percpu_irq(unsigned int, void __percpu *);
@@ -221,7 +186,6 @@ extern void enable_irq(unsigned int irq);
221extern void enable_percpu_irq(unsigned int irq, unsigned int type); 186extern void enable_percpu_irq(unsigned int irq, unsigned int type);
222 187
223/* The following three functions are for the core kernel use only. */ 188/* The following three functions are for the core kernel use only. */
224#ifdef CONFIG_GENERIC_HARDIRQS
225extern void suspend_device_irqs(void); 189extern void suspend_device_irqs(void);
226extern void resume_device_irqs(void); 190extern void resume_device_irqs(void);
227#ifdef CONFIG_PM_SLEEP 191#ifdef CONFIG_PM_SLEEP
@@ -229,13 +193,8 @@ extern int check_wakeup_irqs(void);
229#else 193#else
230static inline int check_wakeup_irqs(void) { return 0; } 194static inline int check_wakeup_irqs(void) { return 0; }
231#endif 195#endif
232#else
233static inline void suspend_device_irqs(void) { };
234static inline void resume_device_irqs(void) { };
235static inline int check_wakeup_irqs(void) { return 0; }
236#endif
237 196
238#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 197#if defined(CONFIG_SMP)
239 198
240extern cpumask_var_t irq_default_affinity; 199extern cpumask_var_t irq_default_affinity;
241 200
@@ -287,9 +246,8 @@ static inline int irq_set_affinity_hint(unsigned int irq,
287{ 246{
288 return -EINVAL; 247 return -EINVAL;
289} 248}
290#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 249#endif /* CONFIG_SMP */
291 250
292#ifdef CONFIG_GENERIC_HARDIRQS
293/* 251/*
294 * Special lockdep variants of irq disabling/enabling. 252 * Special lockdep variants of irq disabling/enabling.
295 * These should be used for locking constructs that 253 * These should be used for locking constructs that
@@ -354,33 +312,6 @@ static inline int disable_irq_wake(unsigned int irq)
354 return irq_set_irq_wake(irq, 0); 312 return irq_set_irq_wake(irq, 0);
355} 313}
356 314
357#else /* !CONFIG_GENERIC_HARDIRQS */
358/*
359 * NOTE: non-genirq architectures, if they want to support the lock
360 * validator need to define the methods below in their asm/irq.h
361 * files, under an #ifdef CONFIG_LOCKDEP section.
362 */
363#ifndef CONFIG_LOCKDEP
364# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
365# define disable_irq_nosync_lockdep_irqsave(irq, flags) \
366 disable_irq_nosync(irq)
367# define disable_irq_lockdep(irq) disable_irq(irq)
368# define enable_irq_lockdep(irq) enable_irq(irq)
369# define enable_irq_lockdep_irqrestore(irq, flags) \
370 enable_irq(irq)
371# endif
372
373static inline int enable_irq_wake(unsigned int irq)
374{
375 return 0;
376}
377
378static inline int disable_irq_wake(unsigned int irq)
379{
380 return 0;
381}
382#endif /* CONFIG_GENERIC_HARDIRQS */
383
384 315
385#ifdef CONFIG_IRQ_FORCED_THREADING 316#ifdef CONFIG_IRQ_FORCED_THREADING
386extern bool force_irqthreads; 317extern bool force_irqthreads;
@@ -655,7 +586,7 @@ void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
655 * if more than one irq occurred. 586 * if more than one irq occurred.
656 */ 587 */
657 588
658#if defined(CONFIG_GENERIC_HARDIRQS) && !defined(CONFIG_GENERIC_IRQ_PROBE) 589#if !defined(CONFIG_GENERIC_IRQ_PROBE)
659static inline unsigned long probe_irq_on(void) 590static inline unsigned long probe_irq_on(void)
660{ 591{
661 return 0; 592 return 0;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3aeb7305e2f5..7ea319e95b47 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -58,10 +58,26 @@ struct iommu_domain {
58#define IOMMU_CAP_CACHE_COHERENCY 0x1 58#define IOMMU_CAP_CACHE_COHERENCY 0x1
59#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 59#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
60 60
61/*
62 * Following constraints are specifc to FSL_PAMUV1:
63 * -aperture must be power of 2, and naturally aligned
64 * -number of windows must be power of 2, and address space size
65 * of each window is determined by aperture size / # of windows
66 * -the actual size of the mapped region of a window must be power
67 * of 2 starting with 4KB and physical address must be naturally
68 * aligned.
69 * DOMAIN_ATTR_FSL_PAMUV1 corresponds to the above mentioned contraints.
70 * The caller can invoke iommu_domain_get_attr to check if the underlying
71 * iommu implementation supports these constraints.
72 */
73
61enum iommu_attr { 74enum iommu_attr {
62 DOMAIN_ATTR_GEOMETRY, 75 DOMAIN_ATTR_GEOMETRY,
63 DOMAIN_ATTR_PAGING, 76 DOMAIN_ATTR_PAGING,
64 DOMAIN_ATTR_WINDOWS, 77 DOMAIN_ATTR_WINDOWS,
78 DOMAIN_ATTR_FSL_PAMU_STASH,
79 DOMAIN_ATTR_FSL_PAMU_ENABLE,
80 DOMAIN_ATTR_FSL_PAMUV1,
65 DOMAIN_ATTR_MAX, 81 DOMAIN_ATTR_MAX,
66}; 82};
67 83
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index c4d870b0d5e6..f6c82de12541 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -22,7 +22,7 @@ struct ipc_ids {
22 int in_use; 22 int in_use;
23 unsigned short seq; 23 unsigned short seq;
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rwsem;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id; 27 int next_id;
28}; 28};
@@ -34,9 +34,9 @@ struct ipc_namespace {
34 int sem_ctls[4]; 34 int sem_ctls[4];
35 int used_sems; 35 int used_sems;
36 36
37 int msg_ctlmax; 37 unsigned int msg_ctlmax;
38 int msg_ctlmnb; 38 unsigned int msg_ctlmnb;
39 int msg_ctlmni; 39 unsigned int msg_ctlmni;
40 atomic_t msg_bytes; 40 atomic_t msg_bytes;
41 atomic_t msg_hdrs; 41 atomic_t msg_hdrs;
42 int auto_msgmni; 42 int auto_msgmni;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index b8b7dc755752..28ea38439313 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -19,6 +19,8 @@ struct ipv6_devconf {
19 __s32 rtr_solicit_interval; 19 __s32 rtr_solicit_interval;
20 __s32 rtr_solicit_delay; 20 __s32 rtr_solicit_delay;
21 __s32 force_mld_version; 21 __s32 force_mld_version;
22 __s32 mldv1_unsolicited_report_interval;
23 __s32 mldv2_unsolicited_report_interval;
22#ifdef CONFIG_IPV6_PRIVACY 24#ifdef CONFIG_IPV6_PRIVACY
23 __s32 use_tempaddr; 25 __s32 use_tempaddr;
24 __s32 temp_valid_lft; 26 __s32 temp_valid_lft;
@@ -48,6 +50,7 @@ struct ipv6_devconf {
48 __s32 accept_dad; 50 __s32 accept_dad;
49 __s32 force_tllao; 51 __s32 force_tllao;
50 __s32 ndisc_notify; 52 __s32 ndisc_notify;
53 __s32 suppress_frag_ndisc;
51 void *sysctl; 54 void *sysctl;
52}; 55};
53 56
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f04d3ba335cb..56bb0dc8b7d4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -382,8 +382,6 @@ extern void irq_cpu_online(void);
382extern void irq_cpu_offline(void); 382extern void irq_cpu_offline(void);
383extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask); 383extern int __irq_set_affinity_locked(struct irq_data *data, const struct cpumask *cpumask);
384 384
385#ifdef CONFIG_GENERIC_HARDIRQS
386
387#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 385#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
388void irq_move_irq(struct irq_data *data); 386void irq_move_irq(struct irq_data *data);
389void irq_move_masked_irq(struct irq_data *data); 387void irq_move_masked_irq(struct irq_data *data);
@@ -802,11 +800,4 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
802static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 800static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
803#endif 801#endif
804 802
805#else /* !CONFIG_GENERIC_HARDIRQS */
806
807extern struct msi_desc *irq_get_msi_desc(unsigned int irq);
808extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
809
810#endif /* CONFIG_GENERIC_HARDIRQS */
811
812#endif /* _LINUX_IRQ_H */ 803#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 3e203eb23cc7..0e5d9ecdb2b6 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -66,6 +66,7 @@ extern struct irq_chip gic_arch_extn;
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, 66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *); 67 u32 offset, struct device_node *);
68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); 68void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
69void gic_cpu_if_down(void);
69 70
70static inline void gic_init(unsigned int nr, int start, 71static inline void gic_init(unsigned int nr, int start,
71 void __iomem *dist , void __iomem *cpu) 72 void __iomem *dist , void __iomem *cpu)
diff --git a/include/linux/irqchip/mmp.h b/include/linux/irqchip/mmp.h
new file mode 100644
index 000000000000..c78a8921185d
--- /dev/null
+++ b/include/linux/irqchip/mmp.h
@@ -0,0 +1,6 @@
1#ifndef __IRQCHIP_MMP_H
2#define __IRQCHIP_MMP_H
3
4extern struct irq_chip icu_irq_chip;
5
6#endif /* __IRQCHIP_MMP_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 623325e2ff97..56fb646909dc 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -76,8 +76,6 @@ struct irq_desc {
76extern struct irq_desc irq_desc[NR_IRQS]; 76extern struct irq_desc irq_desc[NR_IRQS];
77#endif 77#endif
78 78
79#ifdef CONFIG_GENERIC_HARDIRQS
80
81static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) 79static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
82{ 80{
83 return &desc->irq_data; 81 return &desc->irq_data;
@@ -173,6 +171,5 @@ __irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
173 desc->preflow_handler = handler; 171 desc->preflow_handler = handler;
174} 172}
175#endif 173#endif
176#endif
177 174
178#endif 175#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 0a2dc46cdaf6..fdd5cc16c9c4 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -4,23 +4,6 @@
4#include <uapi/linux/irqnr.h> 4#include <uapi/linux/irqnr.h>
5 5
6 6
7#ifndef CONFIG_GENERIC_HARDIRQS
8#include <asm/irq.h>
9
10/*
11 * Wrappers for non-genirq architectures:
12 */
13#define nr_irqs NR_IRQS
14#define irq_to_desc(irq) (&irq_desc[irq])
15
16# define for_each_irq_desc(irq, desc) \
17 for (irq = 0; irq < nr_irqs; irq++)
18
19# define for_each_irq_desc_reverse(irq, desc) \
20 for (irq = nr_irqs - 1; irq >= 0; irq--)
21
22#else /* CONFIG_GENERIC_HARDIRQS */
23
24extern int nr_irqs; 7extern int nr_irqs;
25extern struct irq_desc *irq_to_desc(unsigned int irq); 8extern struct irq_desc *irq_to_desc(unsigned int irq);
26unsigned int irq_get_next_irq(unsigned int offset); 9unsigned int irq_get_next_irq(unsigned int offset);
@@ -50,8 +33,6 @@ unsigned int irq_get_next_irq(unsigned int offset);
50 for (irq = irq_get_next_irq(0); irq < nr_irqs; \ 33 for (irq = irq_get_next_irq(0); irq < nr_irqs; \
51 irq = irq_get_next_irq(irq + 1)) 34 irq = irq_get_next_irq(irq + 1))
52 35
53#endif /* CONFIG_GENERIC_HARDIRQS */
54
55#define for_each_irq_nr(irq) \ 36#define for_each_irq_nr(irq) \
56 for (irq = 0; irq < nr_irqs; irq++) 37 for (irq = 0; irq < nr_irqs; irq++)
57 38
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 8685d1be12c7..31229e0be90b 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -57,16 +57,13 @@
57#define JBD_EXPENSIVE_CHECKING 57#define JBD_EXPENSIVE_CHECKING
58extern u8 journal_enable_debug; 58extern u8 journal_enable_debug;
59 59
60#define jbd_debug(n, f, a...) \ 60void __jbd_debug(int level, const char *file, const char *func,
61 do { \ 61 unsigned int line, const char *fmt, ...);
62 if ((n) <= journal_enable_debug) { \ 62
63 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63#define jbd_debug(n, fmt, a...) \
64 __FILE__, __LINE__, __func__); \ 64 __jbd_debug((n), __FILE__, __func__, __LINE__, (fmt), ##a)
65 printk (f, ## a); \
66 } \
67 } while (0)
68#else 65#else
69#define jbd_debug(f, a...) /**/ 66#define jbd_debug(n, fmt, a...) /**/
70#endif 67#endif
71 68
72static inline void *jbd_alloc(size_t size, gfp_t flags) 69static inline void *jbd_alloc(size_t size, gfp_t flags)
@@ -77,7 +74,7 @@ static inline void *jbd_alloc(size_t size, gfp_t flags)
77static inline void jbd_free(void *ptr, size_t size) 74static inline void jbd_free(void *ptr, size_t size)
78{ 75{
79 free_pages((unsigned long)ptr, get_order(size)); 76 free_pages((unsigned long)ptr, get_order(size));
80}; 77}
81 78
82#define JFS_MIN_JOURNAL_BLOCKS 1024 79#define JFS_MIN_JOURNAL_BLOCKS 1024
83 80
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 97ba4e78a37e..d235e88cfd7c 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -101,13 +101,13 @@ static inline u64 get_jiffies_64(void)
101#define time_after(a,b) \ 101#define time_after(a,b) \
102 (typecheck(unsigned long, a) && \ 102 (typecheck(unsigned long, a) && \
103 typecheck(unsigned long, b) && \ 103 typecheck(unsigned long, b) && \
104 ((long)(b) - (long)(a) < 0)) 104 ((long)((b) - (a)) < 0))
105#define time_before(a,b) time_after(b,a) 105#define time_before(a,b) time_after(b,a)
106 106
107#define time_after_eq(a,b) \ 107#define time_after_eq(a,b) \
108 (typecheck(unsigned long, a) && \ 108 (typecheck(unsigned long, a) && \
109 typecheck(unsigned long, b) && \ 109 typecheck(unsigned long, b) && \
110 ((long)(a) - (long)(b) >= 0)) 110 ((long)((a) - (b)) >= 0))
111#define time_before_eq(a,b) time_after_eq(b,a) 111#define time_before_eq(a,b) time_after_eq(b,a)
112 112
113/* 113/*
@@ -130,13 +130,13 @@ static inline u64 get_jiffies_64(void)
130#define time_after64(a,b) \ 130#define time_after64(a,b) \
131 (typecheck(__u64, a) && \ 131 (typecheck(__u64, a) && \
132 typecheck(__u64, b) && \ 132 typecheck(__u64, b) && \
133 ((__s64)(b) - (__s64)(a) < 0)) 133 ((__s64)((b) - (a)) < 0))
134#define time_before64(a,b) time_after64(b,a) 134#define time_before64(a,b) time_after64(b,a)
135 135
136#define time_after_eq64(a,b) \ 136#define time_after_eq64(a,b) \
137 (typecheck(__u64, a) && \ 137 (typecheck(__u64, a) && \
138 typecheck(__u64, b) && \ 138 typecheck(__u64, b) && \
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)((a) - (b)) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \ 142#define time_in_range64(a, b, c) \
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 0976fc46d1e0..a5079072da66 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -48,7 +48,6 @@
48 48
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/compiler.h> 50#include <linux/compiler.h>
51#include <linux/workqueue.h>
52 51
53#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 52#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
54 53
@@ -61,12 +60,6 @@ struct static_key {
61#endif 60#endif
62}; 61};
63 62
64struct static_key_deferred {
65 struct static_key key;
66 unsigned long timeout;
67 struct delayed_work work;
68};
69
70# include <asm/jump_label.h> 63# include <asm/jump_label.h>
71# define HAVE_JUMP_LABEL 64# define HAVE_JUMP_LABEL
72#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 65#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
@@ -78,6 +71,7 @@ enum jump_label_type {
78 71
79struct module; 72struct module;
80 73
74#include <linux/atomic.h>
81#ifdef HAVE_JUMP_LABEL 75#ifdef HAVE_JUMP_LABEL
82 76
83#define JUMP_LABEL_TRUE_BRANCH 1UL 77#define JUMP_LABEL_TRUE_BRANCH 1UL
@@ -119,10 +113,7 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
119extern int jump_label_text_reserved(void *start, void *end); 113extern int jump_label_text_reserved(void *start, void *end);
120extern void static_key_slow_inc(struct static_key *key); 114extern void static_key_slow_inc(struct static_key *key);
121extern void static_key_slow_dec(struct static_key *key); 115extern void static_key_slow_dec(struct static_key *key);
122extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
123extern void jump_label_apply_nops(struct module *mod); 116extern void jump_label_apply_nops(struct module *mod);
124extern void
125jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
126 117
127#define STATIC_KEY_INIT_TRUE ((struct static_key) \ 118#define STATIC_KEY_INIT_TRUE ((struct static_key) \
128 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 }) 119 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
@@ -131,8 +122,6 @@ jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
131 122
132#else /* !HAVE_JUMP_LABEL */ 123#else /* !HAVE_JUMP_LABEL */
133 124
134#include <linux/atomic.h>
135
136struct static_key { 125struct static_key {
137 atomic_t enabled; 126 atomic_t enabled;
138}; 127};
@@ -141,10 +130,6 @@ static __always_inline void jump_label_init(void)
141{ 130{
142} 131}
143 132
144struct static_key_deferred {
145 struct static_key key;
146};
147
148static __always_inline bool static_key_false(struct static_key *key) 133static __always_inline bool static_key_false(struct static_key *key)
149{ 134{
150 if (unlikely(atomic_read(&key->enabled)) > 0) 135 if (unlikely(atomic_read(&key->enabled)) > 0)
@@ -169,11 +154,6 @@ static inline void static_key_slow_dec(struct static_key *key)
169 atomic_dec(&key->enabled); 154 atomic_dec(&key->enabled);
170} 155}
171 156
172static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
173{
174 static_key_slow_dec(&key->key);
175}
176
177static inline int jump_label_text_reserved(void *start, void *end) 157static inline int jump_label_text_reserved(void *start, void *end)
178{ 158{
179 return 0; 159 return 0;
@@ -187,12 +167,6 @@ static inline int jump_label_apply_nops(struct module *mod)
187 return 0; 167 return 0;
188} 168}
189 169
190static inline void
191jump_label_rate_limit(struct static_key_deferred *key,
192 unsigned long rl)
193{
194}
195
196#define STATIC_KEY_INIT_TRUE ((struct static_key) \ 170#define STATIC_KEY_INIT_TRUE ((struct static_key) \
197 { .enabled = ATOMIC_INIT(1) }) 171 { .enabled = ATOMIC_INIT(1) })
198#define STATIC_KEY_INIT_FALSE ((struct static_key) \ 172#define STATIC_KEY_INIT_FALSE ((struct static_key) \
diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h
new file mode 100644
index 000000000000..113788389b3d
--- /dev/null
+++ b/include/linux/jump_label_ratelimit.h
@@ -0,0 +1,34 @@
1#ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
2#define _LINUX_JUMP_LABEL_RATELIMIT_H
3
4#include <linux/jump_label.h>
5#include <linux/workqueue.h>
6
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8struct static_key_deferred {
9 struct static_key key;
10 unsigned long timeout;
11 struct delayed_work work;
12};
13#endif
14
15#ifdef HAVE_JUMP_LABEL
16extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
17extern void
18jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
19
20#else /* !HAVE_JUMP_LABEL */
21struct static_key_deferred {
22 struct static_key key;
23};
24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
25{
26 static_key_slow_dec(&key->key);
27}
28static inline void
29jump_label_rate_limit(struct static_key_deferred *key,
30 unsigned long rl)
31{
32}
33#endif /* HAVE_JUMP_LABEL */
34#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index b7c8cdc1d422..cbfb171bbcba 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -36,10 +36,9 @@ struct kbd_struct {
36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ 36#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */
37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */ 37 unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */
38 38
39 unsigned char ledmode:2; /* one 2-bit value */ 39 unsigned char ledmode:1;
40#define LED_SHOW_FLAGS 0 /* traditional state */ 40#define LED_SHOW_FLAGS 0 /* traditional state */
41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ 41#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */
42#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */
43 42
44 unsigned char ledflagstate:4; /* flags, not lights */ 43 unsigned char ledflagstate:4; /* flags, not lights */
45 unsigned char default_ledflagstate:4; 44 unsigned char default_ledflagstate:4;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 482ad2d84a32..672ddc4de4af 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -439,6 +439,17 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
439 return buf; 439 return buf;
440} 440}
441 441
442extern const char hex_asc_upper[];
443#define hex_asc_upper_lo(x) hex_asc_upper[((x) & 0x0f)]
444#define hex_asc_upper_hi(x) hex_asc_upper[((x) & 0xf0) >> 4]
445
446static inline char *hex_byte_pack_upper(char *buf, u8 byte)
447{
448 *buf++ = hex_asc_upper_hi(byte);
449 *buf++ = hex_asc_upper_lo(byte);
450 return buf;
451}
452
442static inline char * __deprecated pack_hex_byte(char *buf, u8 byte) 453static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
443{ 454{
444 return hex_byte_pack(buf, byte); 455 return hex_byte_pack(buf, byte);
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ed5f6ed6eb77..51c72be4a7c3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -36,9 +36,6 @@ struct kernel_cpustat {
36}; 36};
37 37
38struct kernel_stat { 38struct kernel_stat {
39#ifndef CONFIG_GENERIC_HARDIRQS
40 unsigned int irqs[NR_IRQS];
41#endif
42 unsigned long irqs_sum; 39 unsigned long irqs_sum;
43 unsigned int softirqs[NR_SOFTIRQS]; 40 unsigned int softirqs[NR_SOFTIRQS];
44}; 41};
@@ -54,22 +51,6 @@ DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
54 51
55extern unsigned long long nr_context_switches(void); 52extern unsigned long long nr_context_switches(void);
56 53
57#ifndef CONFIG_GENERIC_HARDIRQS
58
59struct irq_desc;
60
61static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
62 struct irq_desc *desc)
63{
64 __this_cpu_inc(kstat.irqs[irq]);
65 __this_cpu_inc(kstat.irqs_sum);
66}
67
68static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
69{
70 return kstat_cpu(cpu).irqs[irq];
71}
72#else
73#include <linux/irq.h> 54#include <linux/irq.h>
74extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 55extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
75 56
@@ -79,8 +60,6 @@ do { \
79 __this_cpu_inc(kstat.irqs_sum); \ 60 __this_cpu_inc(kstat.irqs_sum); \
80} while (0) 61} while (0)
81 62
82#endif
83
84static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) 63static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
85{ 64{
86 __this_cpu_inc(kstat.softirqs[irq]); 65 __this_cpu_inc(kstat.softirqs[irq]);
@@ -94,20 +73,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
94/* 73/*
95 * Number of interrupts per specific IRQ source, since bootup 74 * Number of interrupts per specific IRQ source, since bootup
96 */ 75 */
97#ifndef CONFIG_GENERIC_HARDIRQS
98static inline unsigned int kstat_irqs(unsigned int irq)
99{
100 unsigned int sum = 0;
101 int cpu;
102
103 for_each_possible_cpu(cpu)
104 sum += kstat_irqs_cpu(irq, cpu);
105
106 return sum;
107}
108#else
109extern unsigned int kstat_irqs(unsigned int irq); 76extern unsigned int kstat_irqs(unsigned int irq);
110#endif
111 77
112/* 78/*
113 * Number of interrupts per cpu, since bootup 79 * Number of interrupts per cpu, since bootup
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 939b11268c86..de6dcbcc6ef7 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/atomic.h> 28#include <linux/atomic.h>
29#include <linux/workqueue.h>
29 30
30#define UEVENT_HELPER_PATH_LEN 256 31#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
@@ -65,6 +66,9 @@ struct kobject {
65 struct kobj_type *ktype; 66 struct kobj_type *ktype;
66 struct sysfs_dirent *sd; 67 struct sysfs_dirent *sd;
67 struct kref kref; 68 struct kref kref;
69#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
70 struct delayed_work release;
71#endif
68 unsigned int state_initialized:1; 72 unsigned int state_initialized:1;
69 unsigned int state_in_sysfs:1; 73 unsigned int state_in_sysfs:1;
70 unsigned int state_add_uevent_sent:1; 74 unsigned int state_add_uevent_sent:1;
diff --git a/include/linux/kobject_ns.h b/include/linux/kobject_ns.h
index f66b065a8b5f..df32d2508290 100644
--- a/include/linux/kobject_ns.h
+++ b/include/linux/kobject_ns.h
@@ -39,6 +39,7 @@ enum kobj_ns_type {
39 */ 39 */
40struct kobj_ns_type_operations { 40struct kobj_ns_type_operations {
41 enum kobj_ns_type type; 41 enum kobj_ns_type type;
42 bool (*current_may_mount)(void);
42 void *(*grab_current_ns)(void); 43 void *(*grab_current_ns)(void);
43 const void *(*netlink_ns)(struct sock *sk); 44 const void *(*netlink_ns)(struct sock *sk);
44 const void *(*initial_ns)(void); 45 const void *(*initial_ns)(void);
@@ -50,6 +51,7 @@ int kobj_ns_type_registered(enum kobj_ns_type type);
50const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent); 51const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
51const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj); 52const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
52 53
54bool kobj_ns_current_may_mount(enum kobj_ns_type type);
53void *kobj_ns_grab_current(enum kobj_ns_type type); 55void *kobj_ns_grab_current(enum kobj_ns_type type);
54const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk); 56const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
55const void *kobj_ns_initial(enum kobj_ns_type type); 57const void *kobj_ns_initial(enum kobj_ns_type type);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ca1d27a0d6a6..925eaf28fca9 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -264,10 +264,36 @@ extern void arch_arm_kprobe(struct kprobe *p);
264extern void arch_disarm_kprobe(struct kprobe *p); 264extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern kprobe_opcode_t *get_insn_slot(void);
268extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
269extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
270 268
269struct kprobe_insn_cache {
270 struct mutex mutex;
271 void *(*alloc)(void); /* allocate insn page */
272 void (*free)(void *); /* free insn page */
273 struct list_head pages; /* list of kprobe_insn_page */
274 size_t insn_size; /* size of instruction slot */
275 int nr_garbage;
276};
277
278extern kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c);
279extern void __free_insn_slot(struct kprobe_insn_cache *c,
280 kprobe_opcode_t *slot, int dirty);
281
282#define DEFINE_INSN_CACHE_OPS(__name) \
283extern struct kprobe_insn_cache kprobe_##__name##_slots; \
284 \
285static inline kprobe_opcode_t *get_##__name##_slot(void) \
286{ \
287 return __get_insn_slot(&kprobe_##__name##_slots); \
288} \
289 \
290static inline void free_##__name##_slot(kprobe_opcode_t *slot, int dirty)\
291{ \
292 __free_insn_slot(&kprobe_##__name##_slots, slot, dirty); \
293} \
294
295DEFINE_INSN_CACHE_OPS(insn);
296
271#ifdef CONFIG_OPTPROBES 297#ifdef CONFIG_OPTPROBES
272/* 298/*
273 * Internal structure for direct jump optimized probe 299 * Internal structure for direct jump optimized probe
@@ -287,13 +313,13 @@ extern void arch_optimize_kprobes(struct list_head *oplist);
287extern void arch_unoptimize_kprobes(struct list_head *oplist, 313extern void arch_unoptimize_kprobes(struct list_head *oplist,
288 struct list_head *done_list); 314 struct list_head *done_list);
289extern void arch_unoptimize_kprobe(struct optimized_kprobe *op); 315extern void arch_unoptimize_kprobe(struct optimized_kprobe *op);
290extern kprobe_opcode_t *get_optinsn_slot(void);
291extern void free_optinsn_slot(kprobe_opcode_t *slot, int dirty);
292extern int arch_within_optimized_kprobe(struct optimized_kprobe *op, 316extern int arch_within_optimized_kprobe(struct optimized_kprobe *op,
293 unsigned long addr); 317 unsigned long addr);
294 318
295extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs); 319extern void opt_pre_handler(struct kprobe *p, struct pt_regs *regs);
296 320
321DEFINE_INSN_CACHE_OPS(optinsn);
322
297#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
298extern int sysctl_kprobes_optimization; 324extern int sysctl_kprobes_optimization;
299extern int proc_kprobes_optimization_handler(struct ctl_table *table, 325extern int proc_kprobes_optimization_handler(struct ctl_table *table,
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index debf208b7611..31c0cd1c941a 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -69,7 +69,7 @@ typedef union ktime ktime_t; /* Kill this */
69 * @secs: seconds to set 69 * @secs: seconds to set
70 * @nsecs: nanoseconds to set 70 * @nsecs: nanoseconds to set
71 * 71 *
72 * Return the ktime_t representation of the value 72 * Return: The ktime_t representation of the value.
73 */ 73 */
74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 74static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
75{ 75{
@@ -151,7 +151,7 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
151 * @lhs: minuend 151 * @lhs: minuend
152 * @rhs: subtrahend 152 * @rhs: subtrahend
153 * 153 *
154 * Returns the remainder of the subtraction 154 * Return: The remainder of the subtraction.
155 */ 155 */
156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) 156static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
157{ 157{
@@ -169,7 +169,7 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
169 * @add1: addend1 169 * @add1: addend1
170 * @add2: addend2 170 * @add2: addend2
171 * 171 *
172 * Returns the sum of @add1 and @add2. 172 * Return: The sum of @add1 and @add2.
173 */ 173 */
174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) 174static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
175{ 175{
@@ -195,7 +195,7 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
195 * @kt: addend 195 * @kt: addend
196 * @nsec: the scalar nsec value to add 196 * @nsec: the scalar nsec value to add
197 * 197 *
198 * Returns the sum of @kt and @nsec in ktime_t format 198 * Return: The sum of @kt and @nsec in ktime_t format.
199 */ 199 */
200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); 200extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
201 201
@@ -204,7 +204,7 @@ extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
204 * @kt: minuend 204 * @kt: minuend
205 * @nsec: the scalar nsec value to subtract 205 * @nsec: the scalar nsec value to subtract
206 * 206 *
207 * Returns the subtraction of @nsec from @kt in ktime_t format 207 * Return: The subtraction of @nsec from @kt in ktime_t format.
208 */ 208 */
209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec); 209extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
210 210
@@ -212,7 +212,7 @@ extern ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec);
212 * timespec_to_ktime - convert a timespec to ktime_t format 212 * timespec_to_ktime - convert a timespec to ktime_t format
213 * @ts: the timespec variable to convert 213 * @ts: the timespec variable to convert
214 * 214 *
215 * Returns a ktime_t variable with the converted timespec value 215 * Return: A ktime_t variable with the converted timespec value.
216 */ 216 */
217static inline ktime_t timespec_to_ktime(const struct timespec ts) 217static inline ktime_t timespec_to_ktime(const struct timespec ts)
218{ 218{
@@ -224,7 +224,7 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
224 * timeval_to_ktime - convert a timeval to ktime_t format 224 * timeval_to_ktime - convert a timeval to ktime_t format
225 * @tv: the timeval variable to convert 225 * @tv: the timeval variable to convert
226 * 226 *
227 * Returns a ktime_t variable with the converted timeval value 227 * Return: A ktime_t variable with the converted timeval value.
228 */ 228 */
229static inline ktime_t timeval_to_ktime(const struct timeval tv) 229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{ 230{
@@ -237,7 +237,7 @@ static inline ktime_t timeval_to_ktime(const struct timeval tv)
237 * ktime_to_timespec - convert a ktime_t variable to timespec format 237 * ktime_to_timespec - convert a ktime_t variable to timespec format
238 * @kt: the ktime_t variable to convert 238 * @kt: the ktime_t variable to convert
239 * 239 *
240 * Returns the timespec representation of the ktime value 240 * Return: The timespec representation of the ktime value.
241 */ 241 */
242static inline struct timespec ktime_to_timespec(const ktime_t kt) 242static inline struct timespec ktime_to_timespec(const ktime_t kt)
243{ 243{
@@ -249,7 +249,7 @@ static inline struct timespec ktime_to_timespec(const ktime_t kt)
249 * ktime_to_timeval - convert a ktime_t variable to timeval format 249 * ktime_to_timeval - convert a ktime_t variable to timeval format
250 * @kt: the ktime_t variable to convert 250 * @kt: the ktime_t variable to convert
251 * 251 *
252 * Returns the timeval representation of the ktime value 252 * Return: The timeval representation of the ktime value.
253 */ 253 */
254static inline struct timeval ktime_to_timeval(const ktime_t kt) 254static inline struct timeval ktime_to_timeval(const ktime_t kt)
255{ 255{
@@ -262,7 +262,7 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
262 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds 262 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
263 * @kt: the ktime_t variable to convert 263 * @kt: the ktime_t variable to convert
264 * 264 *
265 * Returns the scalar nanoseconds representation of @kt 265 * Return: The scalar nanoseconds representation of @kt.
266 */ 266 */
267static inline s64 ktime_to_ns(const ktime_t kt) 267static inline s64 ktime_to_ns(const ktime_t kt)
268{ 268{
@@ -276,7 +276,9 @@ static inline s64 ktime_to_ns(const ktime_t kt)
276 * @cmp1: comparable1 276 * @cmp1: comparable1
277 * @cmp2: comparable2 277 * @cmp2: comparable2
278 * 278 *
279 * Compare two ktime_t variables, returns 1 if equal 279 * Compare two ktime_t variables.
280 *
281 * Return: 1 if equal.
280 */ 282 */
281static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2) 283static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
282{ 284{
@@ -288,7 +290,7 @@ static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
288 * @cmp1: comparable1 290 * @cmp1: comparable1
289 * @cmp2: comparable2 291 * @cmp2: comparable2
290 * 292 *
291 * Returns ... 293 * Return: ...
292 * cmp1 < cmp2: return <0 294 * cmp1 < cmp2: return <0
293 * cmp1 == cmp2: return 0 295 * cmp1 == cmp2: return 0
294 * cmp1 > cmp2: return >0 296 * cmp1 > cmp2: return >0
@@ -342,7 +344,7 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
342 * @kt: the ktime_t variable to convert 344 * @kt: the ktime_t variable to convert
343 * @ts: the timespec variable to store the result in 345 * @ts: the timespec variable to store the result in
344 * 346 *
345 * Returns true if there was a successful conversion, false if kt was 0. 347 * Return: %true if there was a successful conversion, %false if kt was 0.
346 */ 348 */
347static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt, 349static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
348 struct timespec *ts) 350 struct timespec *ts)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a63d83ebd151..0fbbc7aa02cb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -85,6 +85,12 @@ static inline bool is_noslot_pfn(pfn_t pfn)
85 return pfn == KVM_PFN_NOSLOT; 85 return pfn == KVM_PFN_NOSLOT;
86} 86}
87 87
88/*
89 * architectures with KVM_HVA_ERR_BAD other than PAGE_OFFSET (e.g. s390)
90 * provide own defines and kvm_is_error_hva
91 */
92#ifndef KVM_HVA_ERR_BAD
93
88#define KVM_HVA_ERR_BAD (PAGE_OFFSET) 94#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
89#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE) 95#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE)
90 96
@@ -93,6 +99,8 @@ static inline bool kvm_is_error_hva(unsigned long addr)
93 return addr >= PAGE_OFFSET; 99 return addr >= PAGE_OFFSET;
94} 100}
95 101
102#endif
103
96#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT)) 104#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT))
97 105
98static inline bool is_error_page(struct page *page) 106static inline bool is_error_page(struct page *page)
@@ -160,8 +168,12 @@ enum kvm_bus {
160 168
161int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 169int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
162 int len, const void *val); 170 int len, const void *val);
171int kvm_io_bus_write_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
172 int len, const void *val, long cookie);
163int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len, 173int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
164 void *val); 174 void *val);
175int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
176 int len, void *val, long cookie);
165int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, 177int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
166 int len, struct kvm_io_device *dev); 178 int len, struct kvm_io_device *dev);
167int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 179int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
@@ -499,6 +511,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
499void kvm_arch_free_memslot(struct kvm_memory_slot *free, 511void kvm_arch_free_memslot(struct kvm_memory_slot *free,
500 struct kvm_memory_slot *dont); 512 struct kvm_memory_slot *dont);
501int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 513int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
514void kvm_arch_memslots_updated(struct kvm *kvm);
502int kvm_arch_prepare_memory_region(struct kvm *kvm, 515int kvm_arch_prepare_memory_region(struct kvm *kvm,
503 struct kvm_memory_slot *memslot, 516 struct kvm_memory_slot *memslot,
504 struct kvm_userspace_memory_region *mem, 517 struct kvm_userspace_memory_region *mem,
@@ -520,6 +533,7 @@ int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages,
520 533
521struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 534struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
522unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 535unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
536unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable);
523unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn); 537unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
524void kvm_release_page_clean(struct page *page); 538void kvm_release_page_clean(struct page *page);
525void kvm_release_page_dirty(struct page *page); 539void kvm_release_page_dirty(struct page *page);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 4ea55bb45deb..0e23c26485f4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -138,6 +138,22 @@ enum {
138 ATA_SHT_THIS_ID = -1, 138 ATA_SHT_THIS_ID = -1,
139 ATA_SHT_USE_CLUSTERING = 1, 139 ATA_SHT_USE_CLUSTERING = 1,
140 140
141 /* struct ata_taskfile flags */
142 ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
143 ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
144 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
145 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
146 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
147 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
148 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
149
150 /* protocol flags */
151 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
152 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
153 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
154 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
155 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
156
141 /* struct ata_device stuff */ 157 /* struct ata_device stuff */
142 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ 158 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
143 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 159 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
@@ -156,6 +172,7 @@ enum {
156 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 172 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
157 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ 173 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
158 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ 174 ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */
175 ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */
159 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 176 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
160 177
161 ATA_DFLAG_DETACH = (1 << 24), 178 ATA_DFLAG_DETACH = (1 << 24),
@@ -207,6 +224,7 @@ enum {
207 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 224 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
208 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 225 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
209 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 226 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
227 ATA_FLAG_FPDMA_AUX = (1 << 20), /* controller supports H2DFIS aux field */
210 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure 228 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
211 * management */ 229 * management */
212 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 230 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
@@ -518,6 +536,33 @@ enum sw_activity {
518 BLINK_OFF, 536 BLINK_OFF,
519}; 537};
520 538
539struct ata_taskfile {
540 unsigned long flags; /* ATA_TFLAG_xxx */
541 u8 protocol; /* ATA_PROT_xxx */
542
543 u8 ctl; /* control reg */
544
545 u8 hob_feature; /* additional data */
546 u8 hob_nsect; /* to support LBA48 */
547 u8 hob_lbal;
548 u8 hob_lbam;
549 u8 hob_lbah;
550
551 u8 feature;
552 u8 nsect;
553 u8 lbal;
554 u8 lbam;
555 u8 lbah;
556
557 u8 device;
558
559 u8 command; /* IO operation */
560
561 u32 auxiliary; /* auxiliary field */
562 /* from SATA 3.1 and */
563 /* ATA-8 ACS-3 */
564};
565
521#ifdef CONFIG_ATA_SFF 566#ifdef CONFIG_ATA_SFF
522struct ata_ioports { 567struct ata_ioports {
523 void __iomem *cmd_addr; 568 void __iomem *cmd_addr;
@@ -660,6 +705,9 @@ struct ata_device {
660 /* DEVSLP Timing Variables from Identify Device Data Log */ 705 /* DEVSLP Timing Variables from Identify Device Data Log */
661 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; 706 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
662 707
708 /* NCQ send and receive log subcommand support */
709 u8 ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_SIZE];
710
663 /* error history */ 711 /* error history */
664 int spdn_cnt; 712 int spdn_cnt;
665 /* ering is CLEAR_END, read comment above CLEAR_END */ 713 /* ering is CLEAR_END, read comment above CLEAR_END */
@@ -959,6 +1007,69 @@ extern const unsigned long sata_deb_timing_long[];
959extern struct ata_port_operations ata_dummy_port_ops; 1007extern struct ata_port_operations ata_dummy_port_ops;
960extern const struct ata_port_info ata_dummy_port_info; 1008extern const struct ata_port_info ata_dummy_port_info;
961 1009
1010/*
1011 * protocol tests
1012 */
1013static inline unsigned int ata_prot_flags(u8 prot)
1014{
1015 switch (prot) {
1016 case ATA_PROT_NODATA:
1017 return 0;
1018 case ATA_PROT_PIO:
1019 return ATA_PROT_FLAG_PIO;
1020 case ATA_PROT_DMA:
1021 return ATA_PROT_FLAG_DMA;
1022 case ATA_PROT_NCQ:
1023 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
1024 case ATAPI_PROT_NODATA:
1025 return ATA_PROT_FLAG_ATAPI;
1026 case ATAPI_PROT_PIO:
1027 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
1028 case ATAPI_PROT_DMA:
1029 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
1030 }
1031 return 0;
1032}
1033
1034static inline int ata_is_atapi(u8 prot)
1035{
1036 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
1037}
1038
1039static inline int ata_is_nodata(u8 prot)
1040{
1041 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
1042}
1043
1044static inline int ata_is_pio(u8 prot)
1045{
1046 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
1047}
1048
1049static inline int ata_is_dma(u8 prot)
1050{
1051 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
1052}
1053
1054static inline int ata_is_ncq(u8 prot)
1055{
1056 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
1057}
1058
1059static inline int ata_is_data(u8 prot)
1060{
1061 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
1062}
1063
1064static inline int is_multi_taskfile(struct ata_taskfile *tf)
1065{
1066 return (tf->command == ATA_CMD_READ_MULTI) ||
1067 (tf->command == ATA_CMD_WRITE_MULTI) ||
1068 (tf->command == ATA_CMD_READ_MULTI_EXT) ||
1069 (tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
1070 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1071}
1072
962static inline const unsigned long * 1073static inline const unsigned long *
963sata_ehc_deb_timing(struct ata_eh_context *ehc) 1074sata_ehc_deb_timing(struct ata_eh_context *ehc)
964{ 1075{
@@ -1142,8 +1253,6 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
1142int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 1253int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
1143unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, 1254unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
1144 const struct ata_acpi_gtm *gtm); 1255 const struct ata_acpi_gtm *gtm);
1145acpi_handle ata_ap_acpi_handle(struct ata_port *ap);
1146acpi_handle ata_dev_acpi_handle(struct ata_device *dev);
1147int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); 1256int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
1148#else 1257#else
1149static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap) 1258static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
@@ -1497,6 +1606,13 @@ static inline int ata_ncq_enabled(struct ata_device *dev)
1497 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ; 1606 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1498} 1607}
1499 1608
1609static inline bool ata_fpdma_dsm_supported(struct ata_device *dev)
1610{
1611 return (dev->flags & ATA_DFLAG_NCQ_SEND_RECV) &&
1612 (dev->ncq_send_recv_cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &
1613 ATA_LOG_NCQ_SEND_RECV_DSM_TRIM);
1614}
1615
1500static inline void ata_qc_set_polling(struct ata_queued_cmd *qc) 1616static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
1501{ 1617{
1502 qc->tf.ctl |= ATA_NIEN; 1618 qc->tf.ctl |= ATA_NIEN;
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
new file mode 100644
index 000000000000..3ce541753c88
--- /dev/null
+++ b/include/linux/list_lru.h
@@ -0,0 +1,131 @@
1/*
2 * Copyright (c) 2013 Red Hat, Inc. and Parallels Inc. All rights reserved.
3 * Authors: David Chinner and Glauber Costa
4 *
5 * Generic LRU infrastructure
6 */
7#ifndef _LRU_LIST_H
8#define _LRU_LIST_H
9
10#include <linux/list.h>
11#include <linux/nodemask.h>
12
13/* list_lru_walk_cb has to always return one of those */
14enum lru_status {
15 LRU_REMOVED, /* item removed from list */
16 LRU_ROTATE, /* item referenced, give another pass */
17 LRU_SKIP, /* item cannot be locked, skip */
18 LRU_RETRY, /* item not freeable. May drop the lock
19 internally, but has to return locked. */
20};
21
22struct list_lru_node {
23 spinlock_t lock;
24 struct list_head list;
25 /* kept as signed so we can catch imbalance bugs */
26 long nr_items;
27} ____cacheline_aligned_in_smp;
28
29struct list_lru {
30 struct list_lru_node *node;
31 nodemask_t active_nodes;
32};
33
34void list_lru_destroy(struct list_lru *lru);
35int list_lru_init(struct list_lru *lru);
36
37/**
38 * list_lru_add: add an element to the lru list's tail
39 * @list_lru: the lru pointer
40 * @item: the item to be added.
41 *
42 * If the element is already part of a list, this function returns doing
43 * nothing. Therefore the caller does not need to keep state about whether or
44 * not the element already belongs in the list and is allowed to lazy update
45 * it. Note however that this is valid for *a* list, not *this* list. If
46 * the caller organize itself in a way that elements can be in more than
47 * one type of list, it is up to the caller to fully remove the item from
48 * the previous list (with list_lru_del() for instance) before moving it
49 * to @list_lru
50 *
51 * Return value: true if the list was updated, false otherwise
52 */
53bool list_lru_add(struct list_lru *lru, struct list_head *item);
54
55/**
56 * list_lru_del: delete an element to the lru list
57 * @list_lru: the lru pointer
58 * @item: the item to be deleted.
59 *
60 * This function works analogously as list_lru_add in terms of list
61 * manipulation. The comments about an element already pertaining to
62 * a list are also valid for list_lru_del.
63 *
64 * Return value: true if the list was updated, false otherwise
65 */
66bool list_lru_del(struct list_lru *lru, struct list_head *item);
67
68/**
69 * list_lru_count_node: return the number of objects currently held by @lru
70 * @lru: the lru pointer.
71 * @nid: the node id to count from.
72 *
73 * Always return a non-negative number, 0 for empty lists. There is no
74 * guarantee that the list is not updated while the count is being computed.
75 * Callers that want such a guarantee need to provide an outer lock.
76 */
77unsigned long list_lru_count_node(struct list_lru *lru, int nid);
78static inline unsigned long list_lru_count(struct list_lru *lru)
79{
80 long count = 0;
81 int nid;
82
83 for_each_node_mask(nid, lru->active_nodes)
84 count += list_lru_count_node(lru, nid);
85
86 return count;
87}
88
89typedef enum lru_status
90(*list_lru_walk_cb)(struct list_head *item, spinlock_t *lock, void *cb_arg);
91/**
92 * list_lru_walk_node: walk a list_lru, isolating and disposing freeable items.
93 * @lru: the lru pointer.
94 * @nid: the node id to scan from.
95 * @isolate: callback function that is resposible for deciding what to do with
96 * the item currently being scanned
97 * @cb_arg: opaque type that will be passed to @isolate
98 * @nr_to_walk: how many items to scan.
99 *
100 * This function will scan all elements in a particular list_lru, calling the
101 * @isolate callback for each of those items, along with the current list
102 * spinlock and a caller-provided opaque. The @isolate callback can choose to
103 * drop the lock internally, but *must* return with the lock held. The callback
104 * will return an enum lru_status telling the list_lru infrastructure what to
105 * do with the object being scanned.
106 *
107 * Please note that nr_to_walk does not mean how many objects will be freed,
108 * just how many objects will be scanned.
109 *
110 * Return value: the number of objects effectively removed from the LRU.
111 */
112unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
113 list_lru_walk_cb isolate, void *cb_arg,
114 unsigned long *nr_to_walk);
115
116static inline unsigned long
117list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
118 void *cb_arg, unsigned long nr_to_walk)
119{
120 long isolated = 0;
121 int nid;
122
123 for_each_node_mask(nid, lru->active_nodes) {
124 isolated += list_lru_walk_node(lru, nid, isolate,
125 cb_arg, &nr_to_walk);
126 if (nr_to_walk <= 0)
127 break;
128 }
129 return isolated;
130}
131#endif /* _LRU_LIST_H */
diff --git a/include/linux/llist.h b/include/linux/llist.h
index cdaa7f023899..8828a78dec9a 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -125,6 +125,29 @@ static inline void init_llist_head(struct llist_head *list)
125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 125 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
126 126
127/** 127/**
128 * llist_for_each_entry_safe - iterate over some deleted entries of lock-less list of given type
129 * safe against removal of list entry
130 * @pos: the type * to use as a loop cursor.
131 * @n: another type * to use as temporary storage
132 * @node: the first entry of deleted list entries.
133 * @member: the name of the llist_node with the struct.
134 *
135 * In general, some entries of the lock-less list can be traversed
136 * safely only after being removed from list, so start with an entry
137 * instead of list head.
138 *
139 * If being used on entries deleted from lock-less list directly, the
140 * traverse order is from the newest to the oldest added entry. If
141 * you want to traverse from the oldest to the newest, you must
142 * reverse the order by yourself before traversing.
143 */
144#define llist_for_each_entry_safe(pos, n, node, member) \
145 for (pos = llist_entry((node), typeof(*pos), member); \
146 &pos->member != NULL && \
147 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
148 pos = n)
149
150/**
128 * llist_empty - tests whether a lock-less list is empty 151 * llist_empty - tests whether a lock-less list is empty
129 * @head: the list to test 152 * @head: the list to test
130 * 153 *
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index f1e877b79ed8..cfc2f119779a 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -365,7 +365,7 @@ extern void lockdep_trace_alloc(gfp_t mask);
365 365
366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
367 367
368#else /* !LOCKDEP */ 368#else /* !CONFIG_LOCKDEP */
369 369
370static inline void lockdep_off(void) 370static inline void lockdep_off(void)
371{ 371{
@@ -479,82 +479,36 @@ static inline void print_irqtrace_events(struct task_struct *curr)
479 * on the per lock-class debug mode: 479 * on the per lock-class debug mode:
480 */ 480 */
481 481
482#ifdef CONFIG_DEBUG_LOCK_ALLOC 482#ifdef CONFIG_PROVE_LOCKING
483# ifdef CONFIG_PROVE_LOCKING 483 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
484# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 484 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 2, n, i)
485# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 485 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 2, n, i)
486# else
487# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
488# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, NULL, i)
489# endif
490# define spin_release(l, n, i) lock_release(l, n, i)
491#else 486#else
492# define spin_acquire(l, s, t, i) do { } while (0) 487 #define lock_acquire_exclusive(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
493# define spin_release(l, n, i) do { } while (0) 488 #define lock_acquire_shared(l, s, t, n, i) lock_acquire(l, s, t, 1, 1, n, i)
489 #define lock_acquire_shared_recursive(l, s, t, n, i) lock_acquire(l, s, t, 2, 1, n, i)
494#endif 490#endif
495 491
496#ifdef CONFIG_DEBUG_LOCK_ALLOC 492#define spin_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
497# ifdef CONFIG_PROVE_LOCKING 493#define spin_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
498# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 494#define spin_release(l, n, i) lock_release(l, n, i)
499# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, NULL, i)
500# else
501# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
502# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, NULL, i)
503# endif
504# define rwlock_release(l, n, i) lock_release(l, n, i)
505#else
506# define rwlock_acquire(l, s, t, i) do { } while (0)
507# define rwlock_acquire_read(l, s, t, i) do { } while (0)
508# define rwlock_release(l, n, i) do { } while (0)
509#endif
510 495
511#ifdef CONFIG_DEBUG_LOCK_ALLOC 496#define rwlock_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
512# ifdef CONFIG_PROVE_LOCKING 497#define rwlock_acquire_read(l, s, t, i) lock_acquire_shared_recursive(l, s, t, NULL, i)
513# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 498#define rwlock_release(l, n, i) lock_release(l, n, i)
514# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
515# else
516# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
517# define mutex_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
518# endif
519# define mutex_release(l, n, i) lock_release(l, n, i)
520#else
521# define mutex_acquire(l, s, t, i) do { } while (0)
522# define mutex_acquire_nest(l, s, t, n, i) do { } while (0)
523# define mutex_release(l, n, i) do { } while (0)
524#endif
525 499
526#ifdef CONFIG_DEBUG_LOCK_ALLOC 500#define mutex_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
527# ifdef CONFIG_PROVE_LOCKING 501#define mutex_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
528# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 502#define mutex_release(l, n, i) lock_release(l, n, i)
529# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) 503
530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) 504#define rwsem_acquire(l, s, t, i) lock_acquire_exclusive(l, s, t, NULL, i)
531# else 505#define rwsem_acquire_nest(l, s, t, n, i) lock_acquire_exclusive(l, s, t, n, i)
532# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) 506#define rwsem_acquire_read(l, s, t, i) lock_acquire_shared(l, s, t, NULL, i)
533# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
534# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
535# endif
536# define rwsem_release(l, n, i) lock_release(l, n, i) 507# define rwsem_release(l, n, i) lock_release(l, n, i)
537#else
538# define rwsem_acquire(l, s, t, i) do { } while (0)
539# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0)
540# define rwsem_acquire_read(l, s, t, i) do { } while (0)
541# define rwsem_release(l, n, i) do { } while (0)
542#endif
543 508
544#ifdef CONFIG_DEBUG_LOCK_ALLOC 509#define lock_map_acquire(l) lock_acquire_exclusive(l, 0, 0, NULL, _THIS_IP_)
545# ifdef CONFIG_PROVE_LOCKING 510#define lock_map_acquire_read(l) lock_acquire_shared_recursive(l, 0, 0, NULL, _THIS_IP_)
546# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
547# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
548# else
549# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
550# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
551# endif
552# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 511# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
553#else
554# define lock_map_acquire(l) do { } while (0)
555# define lock_map_acquire_read(l) do { } while (0)
556# define lock_map_release(l) do { } while (0)
557#endif
558 512
559#ifdef CONFIG_PROVE_LOCKING 513#ifdef CONFIG_PROVE_LOCKING
560# define might_lock(lock) \ 514# define might_lock(lock) \
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index 01233e01627a..f279ed9a9163 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -17,55 +17,23 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18 18
19struct lockref { 19struct lockref {
20 spinlock_t lock; 20 union {
21 unsigned int count; 21#ifdef CONFIG_CMPXCHG_LOCKREF
22 aligned_u64 lock_count;
23#endif
24 struct {
25 spinlock_t lock;
26 unsigned int count;
27 };
28 };
22}; 29};
23 30
24/** 31extern void lockref_get(struct lockref *);
25 * lockref_get - Increments reference count unconditionally 32extern int lockref_get_not_zero(struct lockref *);
26 * @lockcnt: pointer to lockref structure 33extern int lockref_get_or_lock(struct lockref *);
27 * 34extern int lockref_put_or_lock(struct lockref *);
28 * This operation is only valid if you already hold a reference
29 * to the object, so you know the count cannot be zero.
30 */
31static inline void lockref_get(struct lockref *lockref)
32{
33 spin_lock(&lockref->lock);
34 lockref->count++;
35 spin_unlock(&lockref->lock);
36}
37
38/**
39 * lockref_get_not_zero - Increments count unless the count is 0
40 * @lockcnt: pointer to lockref structure
41 * Return: 1 if count updated successfully or 0 if count is 0
42 */
43static inline int lockref_get_not_zero(struct lockref *lockref)
44{
45 int retval = 0;
46
47 spin_lock(&lockref->lock);
48 if (lockref->count) {
49 lockref->count++;
50 retval = 1;
51 }
52 spin_unlock(&lockref->lock);
53 return retval;
54}
55 35
56/** 36extern void lockref_mark_dead(struct lockref *);
57 * lockref_put_or_lock - decrements count unless count <= 1 before decrement 37extern int lockref_get_not_dead(struct lockref *);
58 * @lockcnt: pointer to lockref structure
59 * Return: 1 if count updated successfully or 0 if count <= 1 and lock taken
60 */
61static inline int lockref_put_or_lock(struct lockref *lockref)
62{
63 spin_lock(&lockref->lock);
64 if (lockref->count <= 1)
65 return 0;
66 lockref->count--;
67 spin_unlock(&lockref->lock);
68 return 1;
69}
70 38
71#endif /* __LINUX_LOCKREF_H */ 39#endif /* __LINUX_LOCKREF_H */
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
index d21c13f10a64..4356686b0a39 100644
--- a/include/linux/lz4.h
+++ b/include/linux/lz4.h
@@ -67,8 +67,8 @@ int lz4hc_compress(const unsigned char *src, size_t src_len,
67 * note : Destination buffer must be already allocated. 67 * note : Destination buffer must be already allocated.
68 * slightly faster than lz4_decompress_unknownoutputsize() 68 * slightly faster than lz4_decompress_unknownoutputsize()
69 */ 69 */
70int lz4_decompress(const char *src, size_t *src_len, char *dest, 70int lz4_decompress(const unsigned char *src, size_t *src_len,
71 size_t actual_dest_len); 71 unsigned char *dest, size_t actual_dest_len);
72 72
73/* 73/*
74 * lz4_decompress_unknownoutputsize() 74 * lz4_decompress_unknownoutputsize()
@@ -82,6 +82,6 @@ int lz4_decompress(const char *src, size_t *src_len, char *dest,
82 * Error if return (< 0) 82 * Error if return (< 0)
83 * note : Destination buffer must be already allocated. 83 * note : Destination buffer must be already allocated.
84 */ 84 */
85int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, 85int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len,
86 char *dest, size_t *dest_len); 86 unsigned char *dest, size_t *dest_len);
87#endif 87#endif
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 2913b86eb12a..69ed5f5e9f6e 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -31,6 +31,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
31} 31}
32 32
33/** 33/**
34 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
35 */
36static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
37{
38 *remainder = dividend % divisor;
39 return dividend / divisor;
40}
41
42/**
34 * div64_u64 - unsigned 64bit divide with 64bit divisor 43 * div64_u64 - unsigned 64bit divide with 64bit divisor
35 */ 44 */
36static inline u64 div64_u64(u64 dividend, u64 divisor) 45static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -63,6 +72,10 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
63extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); 72extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
64#endif 73#endif
65 74
75#ifndef div64_u64_rem
76extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
77#endif
78
66#ifndef div64_u64 79#ifndef div64_u64
67extern u64 div64_u64(u64 dividend, u64 divisor); 80extern u64 div64_u64(u64 dividend, u64 divisor);
68#endif 81#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index dba482e31a13..345b8c53b897 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -11,6 +11,8 @@
11#ifndef __LINUX_MBUS_H 11#ifndef __LINUX_MBUS_H
12#define __LINUX_MBUS_H 12#define __LINUX_MBUS_H
13 13
14struct resource;
15
14struct mbus_dram_target_info 16struct mbus_dram_target_info
15{ 17{
16 /* 18 /*
@@ -59,14 +61,18 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
59} 61}
60#endif 62#endif
61 63
62int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, 64void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
63 size_t size, phys_addr_t remap, 65void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
64 unsigned int flags); 66int mvebu_mbus_add_window_remap_by_id(unsigned int target,
65int mvebu_mbus_add_window(const char *devname, phys_addr_t base, 67 unsigned int attribute,
66 size_t size); 68 phys_addr_t base, size_t size,
69 phys_addr_t remap);
70int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
71 phys_addr_t base, size_t size);
67int mvebu_mbus_del_window(phys_addr_t base, size_t size); 72int mvebu_mbus_del_window(phys_addr_t base, size_t size);
68int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, 73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
69 size_t mbus_size, phys_addr_t sdram_phys_base, 74 size_t mbus_size, phys_addr_t sdram_phys_base,
70 size_t sdram_size); 75 size_t sdram_size);
76int mvebu_mbus_dt_init(void);
71 77
72#endif /* __LINUX_MBUS_H */ 78#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f388203db7e8..31e95acddb4d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -60,6 +60,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
60void memblock_trim_memory(phys_addr_t align); 60void memblock_trim_memory(phys_addr_t align);
61 61
62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
63int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
64 unsigned long *end_pfn);
63void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 65void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
64 unsigned long *out_end_pfn, int *out_nid); 66 unsigned long *out_end_pfn, int *out_nid);
65 67
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 7b4d9d79570b..b3e7a667e03c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -30,9 +30,21 @@ struct page;
30struct mm_struct; 30struct mm_struct;
31struct kmem_cache; 31struct kmem_cache;
32 32
33/* Stats that can be updated by kernel. */ 33/*
34enum mem_cgroup_page_stat_item { 34 * The corresponding mem_cgroup_stat_names is defined in mm/memcontrol.c,
35 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 35 * These two lists should keep in accord with each other.
36 */
37enum mem_cgroup_stat_index {
38 /*
39 * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss.
40 */
41 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */
42 MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */
43 MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */
44 MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */
45 MEM_CGROUP_STAT_WRITEBACK, /* # of pages under writeback */
46 MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */
47 MEM_CGROUP_STAT_NSTATS,
36}; 48};
37 49
38struct mem_cgroup_reclaim_cookie { 50struct mem_cgroup_reclaim_cookie {
@@ -85,7 +97,7 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
85extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 97extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
86 98
87extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 99extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
88extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); 100extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
89 101
90static inline 102static inline
91bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) 103bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
@@ -125,6 +137,25 @@ extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
125extern void mem_cgroup_replace_page_cache(struct page *oldpage, 137extern void mem_cgroup_replace_page_cache(struct page *oldpage,
126 struct page *newpage); 138 struct page *newpage);
127 139
140static inline void mem_cgroup_oom_enable(void)
141{
142 WARN_ON(current->memcg_oom.may_oom);
143 current->memcg_oom.may_oom = 1;
144}
145
146static inline void mem_cgroup_oom_disable(void)
147{
148 WARN_ON(!current->memcg_oom.may_oom);
149 current->memcg_oom.may_oom = 0;
150}
151
152static inline bool task_in_memcg_oom(struct task_struct *p)
153{
154 return p->memcg_oom.memcg;
155}
156
157bool mem_cgroup_oom_synchronize(bool wait);
158
128#ifdef CONFIG_MEMCG_SWAP 159#ifdef CONFIG_MEMCG_SWAP
129extern int do_swap_account; 160extern int do_swap_account;
130#endif 161#endif
@@ -165,17 +196,17 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
165} 196}
166 197
167void mem_cgroup_update_page_stat(struct page *page, 198void mem_cgroup_update_page_stat(struct page *page,
168 enum mem_cgroup_page_stat_item idx, 199 enum mem_cgroup_stat_index idx,
169 int val); 200 int val);
170 201
171static inline void mem_cgroup_inc_page_stat(struct page *page, 202static inline void mem_cgroup_inc_page_stat(struct page *page,
172 enum mem_cgroup_page_stat_item idx) 203 enum mem_cgroup_stat_index idx)
173{ 204{
174 mem_cgroup_update_page_stat(page, idx, 1); 205 mem_cgroup_update_page_stat(page, idx, 1);
175} 206}
176 207
177static inline void mem_cgroup_dec_page_stat(struct page *page, 208static inline void mem_cgroup_dec_page_stat(struct page *page,
178 enum mem_cgroup_page_stat_item idx) 209 enum mem_cgroup_stat_index idx)
179{ 210{
180 mem_cgroup_update_page_stat(page, idx, -1); 211 mem_cgroup_update_page_stat(page, idx, -1);
181} 212}
@@ -348,13 +379,31 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page,
348{ 379{
349} 380}
350 381
382static inline void mem_cgroup_oom_enable(void)
383{
384}
385
386static inline void mem_cgroup_oom_disable(void)
387{
388}
389
390static inline bool task_in_memcg_oom(struct task_struct *p)
391{
392 return false;
393}
394
395static inline bool mem_cgroup_oom_synchronize(bool wait)
396{
397 return false;
398}
399
351static inline void mem_cgroup_inc_page_stat(struct page *page, 400static inline void mem_cgroup_inc_page_stat(struct page *page,
352 enum mem_cgroup_page_stat_item idx) 401 enum mem_cgroup_stat_index idx)
353{ 402{
354} 403}
355 404
356static inline void mem_cgroup_dec_page_stat(struct page *page, 405static inline void mem_cgroup_dec_page_stat(struct page *page,
357 enum mem_cgroup_page_stat_item idx) 406 enum mem_cgroup_stat_index idx)
358{ 407{
359} 408}
360 409
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 85c31a8e2904..9a6bbf76452d 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -25,16 +25,9 @@
25struct memory_block { 25struct memory_block {
26 unsigned long start_section_nr; 26 unsigned long start_section_nr;
27 unsigned long end_section_nr; 27 unsigned long end_section_nr;
28 unsigned long state; 28 unsigned long state; /* serialized by the dev->lock */
29 int section_count; 29 int section_count; /* serialized by mem_sysfs_mutex */
30 30 int online_type; /* for passing data to online routine */
31 /*
32 * This serializes all state change requests. It isn't
33 * held during creation because the control files are
34 * created long after the critical areas during
35 * initialization.
36 */
37 struct mutex state_mutex;
38 int phys_device; /* to which fru does this belong? */ 31 int phys_device; /* to which fru does this belong? */
39 void *hw; /* optional pointer to fw/hw data */ 32 void *hw; /* optional pointer to fw/hw data */
40 int (*phys_callback)(struct memory_block *); 33 int (*phys_callback)(struct memory_block *);
@@ -125,7 +118,6 @@ extern struct memory_block *find_memory_block_hinted(struct mem_section *,
125 struct memory_block *); 118 struct memory_block *);
126extern struct memory_block *find_memory_block(struct mem_section *); 119extern struct memory_block *find_memory_block(struct mem_section *);
127#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 120#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
128enum mem_add_context { BOOT, HOTPLUG };
129#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 121#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
130 122
131#ifdef CONFIG_MEMORY_HOTPLUG 123#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 0d7df39a5885..da6716b9e3fe 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -91,7 +91,6 @@ static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
91} 91}
92 92
93#define vma_policy(vma) ((vma)->vm_policy) 93#define vma_policy(vma) ((vma)->vm_policy)
94#define vma_set_policy(vma, pol) ((vma)->vm_policy = (pol))
95 94
96static inline void mpol_get(struct mempolicy *pol) 95static inline void mpol_get(struct mempolicy *pol)
97{ 96{
@@ -126,6 +125,7 @@ struct shared_policy {
126 spinlock_t lock; 125 spinlock_t lock;
127}; 126};
128 127
128int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst);
129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
130int mpol_set_shared_policy(struct shared_policy *info, 130int mpol_set_shared_policy(struct shared_policy *info,
131 struct vm_area_struct *vma, 131 struct vm_area_struct *vma,
@@ -173,7 +173,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
173/* Check if a vma is migratable */ 173/* Check if a vma is migratable */
174static inline int vma_migratable(struct vm_area_struct *vma) 174static inline int vma_migratable(struct vm_area_struct *vma)
175{ 175{
176 if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP)) 176 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
177 return 0; 177 return 0;
178 /* 178 /*
179 * Migration allocates pages in the highest zone. If we cannot 179 * Migration allocates pages in the highest zone. If we cannot
@@ -240,7 +240,12 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
240} 240}
241 241
242#define vma_policy(vma) NULL 242#define vma_policy(vma) NULL
243#define vma_set_policy(vma, pol) do {} while(0) 243
244static inline int
245vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
246{
247 return 0;
248}
244 249
245static inline void numa_policy_init(void) 250static inline void numa_policy_init(void)
246{ 251{
diff --git a/include/linux/mfd/arizona/gpio.h b/include/linux/mfd/arizona/gpio.h
new file mode 100644
index 000000000000..d2146bb74f89
--- /dev/null
+++ b/include/linux/mfd/arizona/gpio.h
@@ -0,0 +1,96 @@
1/*
2 * GPIO configuration for Arizona devices
3 *
4 * Copyright 2013 Wolfson Microelectronics. PLC.
5 *
6 * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _ARIZONA_GPIO_H
14#define _ARIZONA_GPIO_H
15
16#define ARIZONA_GP_FN_TXLRCLK 0x00
17#define ARIZONA_GP_FN_GPIO 0x01
18#define ARIZONA_GP_FN_IRQ1 0x02
19#define ARIZONA_GP_FN_IRQ2 0x03
20#define ARIZONA_GP_FN_OPCLK 0x04
21#define ARIZONA_GP_FN_FLL1_OUT 0x05
22#define ARIZONA_GP_FN_FLL2_OUT 0x06
23#define ARIZONA_GP_FN_PWM1 0x08
24#define ARIZONA_GP_FN_PWM2 0x09
25#define ARIZONA_GP_FN_SYSCLK_UNDERCLOCKED 0x0A
26#define ARIZONA_GP_FN_ASYNCCLK_UNDERCLOCKED 0x0B
27#define ARIZONA_GP_FN_FLL1_LOCK 0x0C
28#define ARIZONA_GP_FN_FLL2_LOCK 0x0D
29#define ARIZONA_GP_FN_FLL1_CLOCK_OK 0x0F
30#define ARIZONA_GP_FN_FLL2_CLOCK_OK 0x10
31#define ARIZONA_GP_FN_HEADPHONE_DET 0x12
32#define ARIZONA_GP_FN_MIC_DET 0x13
33#define ARIZONA_GP_FN_WSEQ_STATUS 0x15
34#define ARIZONA_GP_FN_CIF_ADDRESS_ERROR 0x16
35#define ARIZONA_GP_FN_ASRC1_LOCK 0x1A
36#define ARIZONA_GP_FN_ASRC2_LOCK 0x1B
37#define ARIZONA_GP_FN_ASRC_CONFIG_ERROR 0x1C
38#define ARIZONA_GP_FN_DRC1_SIGNAL_DETECT 0x1D
39#define ARIZONA_GP_FN_DRC1_ANTICLIP 0x1E
40#define ARIZONA_GP_FN_DRC1_DECAY 0x1F
41#define ARIZONA_GP_FN_DRC1_NOISE 0x20
42#define ARIZONA_GP_FN_DRC1_QUICK_RELEASE 0x21
43#define ARIZONA_GP_FN_DRC2_SIGNAL_DETECT 0x22
44#define ARIZONA_GP_FN_DRC2_ANTICLIP 0x23
45#define ARIZONA_GP_FN_DRC2_DECAY 0x24
46#define ARIZONA_GP_FN_DRC2_NOISE 0x25
47#define ARIZONA_GP_FN_DRC2_QUICK_RELEASE 0x26
48#define ARIZONA_GP_FN_MIXER_DROPPED_SAMPLE 0x27
49#define ARIZONA_GP_FN_AIF1_CONFIG_ERROR 0x28
50#define ARIZONA_GP_FN_AIF2_CONFIG_ERROR 0x29
51#define ARIZONA_GP_FN_AIF3_CONFIG_ERROR 0x2A
52#define ARIZONA_GP_FN_SPK_TEMP_SHUTDOWN 0x2B
53#define ARIZONA_GP_FN_SPK_TEMP_WARNING 0x2C
54#define ARIZONA_GP_FN_UNDERCLOCKED 0x2D
55#define ARIZONA_GP_FN_OVERCLOCKED 0x2E
56#define ARIZONA_GP_FN_DSP_IRQ1 0x35
57#define ARIZONA_GP_FN_DSP_IRQ2 0x36
58#define ARIZONA_GP_FN_ASYNC_OPCLK 0x3D
59#define ARIZONA_GP_FN_BOOT_DONE 0x44
60#define ARIZONA_GP_FN_DSP1_RAM_READY 0x45
61#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS 0x4B
62#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS 0x4C
63
64#define ARIZONA_GPN_DIR 0x8000 /* GPN_DIR */
65#define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */
66#define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */
67#define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */
68#define ARIZONA_GPN_PU 0x4000 /* GPN_PU */
69#define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */
70#define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */
71#define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */
72#define ARIZONA_GPN_PD 0x2000 /* GPN_PD */
73#define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */
74#define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */
75#define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */
76#define ARIZONA_GPN_LVL 0x0800 /* GPN_LVL */
77#define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */
78#define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */
79#define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */
80#define ARIZONA_GPN_POL 0x0400 /* GPN_POL */
81#define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */
82#define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */
83#define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */
84#define ARIZONA_GPN_OP_CFG 0x0200 /* GPN_OP_CFG */
85#define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */
86#define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */
87#define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */
88#define ARIZONA_GPN_DB 0x0100 /* GPN_DB */
89#define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */
90#define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */
91#define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */
92#define ARIZONA_GPN_FN_MASK 0x007F /* GPN_DB */
93#define ARIZONA_GPN_FN_SHIFT 0 /* GPN_DB */
94#define ARIZONA_GPN_FN_WIDTH 7 /* GPN_DB */
95
96#endif
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
new file mode 100644
index 000000000000..2d2a0af675fd
--- /dev/null
+++ b/include/linux/mfd/da9063/core.h
@@ -0,0 +1,93 @@
1/*
2 * Definitions for DA9063 MFD driver
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_CORE_H__
17#define __MFD_DA9063_CORE_H__
18
19#include <linux/interrupt.h>
20#include <linux/mfd/da9063/registers.h>
21
22/* DA9063 modules */
23#define DA9063_DRVNAME_CORE "da9063-core"
24#define DA9063_DRVNAME_REGULATORS "da9063-regulators"
25#define DA9063_DRVNAME_LEDS "da9063-leds"
26#define DA9063_DRVNAME_WATCHDOG "da9063-watchdog"
27#define DA9063_DRVNAME_HWMON "da9063-hwmon"
28#define DA9063_DRVNAME_ONKEY "da9063-onkey"
29#define DA9063_DRVNAME_RTC "da9063-rtc"
30#define DA9063_DRVNAME_VIBRATION "da9063-vibration"
31
32enum da9063_models {
33 PMIC_DA9063 = 0x61,
34};
35
36/* Interrupts */
37enum da9063_irqs {
38 DA9063_IRQ_ONKEY = 0,
39 DA9063_IRQ_ALARM,
40 DA9063_IRQ_TICK,
41 DA9063_IRQ_ADC_RDY,
42 DA9063_IRQ_SEQ_RDY,
43 DA9063_IRQ_WAKE,
44 DA9063_IRQ_TEMP,
45 DA9063_IRQ_COMP_1V2,
46 DA9063_IRQ_LDO_LIM,
47 DA9063_IRQ_REG_UVOV,
48 DA9063_IRQ_VDD_MON,
49 DA9063_IRQ_WARN,
50 DA9063_IRQ_GPI0,
51 DA9063_IRQ_GPI1,
52 DA9063_IRQ_GPI2,
53 DA9063_IRQ_GPI3,
54 DA9063_IRQ_GPI4,
55 DA9063_IRQ_GPI5,
56 DA9063_IRQ_GPI6,
57 DA9063_IRQ_GPI7,
58 DA9063_IRQ_GPI8,
59 DA9063_IRQ_GPI9,
60 DA9063_IRQ_GPI10,
61 DA9063_IRQ_GPI11,
62 DA9063_IRQ_GPI12,
63 DA9063_IRQ_GPI13,
64 DA9063_IRQ_GPI14,
65 DA9063_IRQ_GPI15,
66};
67
68#define DA9063_IRQ_BASE_OFFSET 0
69#define DA9063_NUM_IRQ (DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
70
71struct da9063 {
72 /* Device */
73 struct device *dev;
74 unsigned short model;
75 unsigned short revision;
76 unsigned int flags;
77
78 /* Control interface */
79 struct regmap *regmap;
80
81 /* Interrupts */
82 int chip_irq;
83 unsigned int irq_base;
84 struct regmap_irq_chip_data *regmap_irq;
85};
86
87int da9063_device_init(struct da9063 *da9063, unsigned int irq);
88int da9063_irq_init(struct da9063 *da9063);
89
90void da9063_device_exit(struct da9063 *da9063);
91void da9063_irq_exit(struct da9063 *da9063);
92
93#endif /* __MFD_DA9063_CORE_H__ */
diff --git a/include/linux/mfd/da9063/pdata.h b/include/linux/mfd/da9063/pdata.h
new file mode 100644
index 000000000000..95c8742215a7
--- /dev/null
+++ b/include/linux/mfd/da9063/pdata.h
@@ -0,0 +1,111 @@
1/*
2 * Platform configuration options for DA9063
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Author: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MFD_DA9063_PDATA_H__
17#define __MFD_DA9063_PDATA_H__
18
19#include <linux/regulator/machine.h>
20
21/*
22 * Regulator configuration
23 */
24/* DA9063 regulator IDs */
25enum {
26 /* BUCKs */
27 DA9063_ID_BCORE1,
28 DA9063_ID_BCORE2,
29 DA9063_ID_BPRO,
30 DA9063_ID_BMEM,
31 DA9063_ID_BIO,
32 DA9063_ID_BPERI,
33
34 /* BCORE1 and BCORE2 in merged mode */
35 DA9063_ID_BCORES_MERGED,
36 /* BMEM and BIO in merged mode */
37 DA9063_ID_BMEM_BIO_MERGED,
38 /* When two BUCKs are merged, they cannot be reused separately */
39
40 /* LDOs */
41 DA9063_ID_LDO1,
42 DA9063_ID_LDO2,
43 DA9063_ID_LDO3,
44 DA9063_ID_LDO4,
45 DA9063_ID_LDO5,
46 DA9063_ID_LDO6,
47 DA9063_ID_LDO7,
48 DA9063_ID_LDO8,
49 DA9063_ID_LDO9,
50 DA9063_ID_LDO10,
51 DA9063_ID_LDO11,
52};
53
54/* Regulators platform data */
55struct da9063_regulator_data {
56 int id;
57 struct regulator_init_data *initdata;
58};
59
60struct da9063_regulators_pdata {
61 unsigned n_regulators;
62 struct da9063_regulator_data *regulator_data;
63};
64
65
66/*
67 * RGB LED configuration
68 */
69/* LED IDs for flags in struct led_info. */
70enum {
71 DA9063_GPIO11_LED,
72 DA9063_GPIO14_LED,
73 DA9063_GPIO15_LED,
74
75 DA9063_LED_NUM
76};
77#define DA9063_LED_ID_MASK 0x3
78
79/* LED polarity for flags in struct led_info. */
80#define DA9063_LED_HIGH_LEVEL_ACTIVE 0x0
81#define DA9063_LED_LOW_LEVEL_ACTIVE 0x4
82
83
84/*
85 * General PMIC configuration
86 */
87/* HWMON ADC channels configuration */
88#define DA9063_FLG_FORCE_IN0_MANUAL_MODE 0x0010
89#define DA9063_FLG_FORCE_IN0_AUTO_MODE 0x0020
90#define DA9063_FLG_FORCE_IN1_MANUAL_MODE 0x0040
91#define DA9063_FLG_FORCE_IN1_AUTO_MODE 0x0080
92#define DA9063_FLG_FORCE_IN2_MANUAL_MODE 0x0100
93#define DA9063_FLG_FORCE_IN2_AUTO_MODE 0x0200
94#define DA9063_FLG_FORCE_IN3_MANUAL_MODE 0x0400
95#define DA9063_FLG_FORCE_IN3_AUTO_MODE 0x0800
96
97/* Disable register caching. */
98#define DA9063_FLG_NO_CACHE 0x0008
99
100struct da9063;
101
102/* DA9063 platform data */
103struct da9063_pdata {
104 int (*init)(struct da9063 *da9063);
105 int irq_base;
106 unsigned flags;
107 struct da9063_regulators_pdata *regulators_pdata;
108 struct led_platform_data *leds_pdata;
109};
110
111#endif /* __MFD_DA9063_PDATA_H__ */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
new file mode 100644
index 000000000000..5834813fb5f3
--- /dev/null
+++ b/include/linux/mfd/da9063/registers.h
@@ -0,0 +1,1028 @@
1/*
2 * Registers definition for DA9063 modules
3 *
4 * Copyright 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: Michal Hajduk <michal.hajduk@diasemi.com>
7 * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef _DA9063_REG_H
17#define _DA9063_REG_H
18
19#define DA9063_I2C_PAGE_SEL_SHIFT 1
20
21#define DA9063_EVENT_REG_NUM 4
22#define DA9210_EVENT_REG_NUM 2
23#define DA9063_EXT_EVENT_REG_NUM (DA9063_EVENT_REG_NUM + \
24 DA9210_EVENT_REG_NUM)
25
26/* Page selection I2C or SPI always in the begining of any page. */
27/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */
28/* Page 1 : SPI access 0x080 - 0x0FF */
29/* Page 2 : I2C access 0x100 - 0x1FF SPI access 0x100 - 0x17F */
30/* Page 3 : SPI access 0x180 - 0x1FF */
31#define DA9063_REG_PAGE_CON 0x00
32
33/* System Control and Event Registers */
34#define DA9063_REG_STATUS_A 0x01
35#define DA9063_REG_STATUS_B 0x02
36#define DA9063_REG_STATUS_C 0x03
37#define DA9063_REG_STATUS_D 0x04
38#define DA9063_REG_FAULT_LOG 0x05
39#define DA9063_REG_EVENT_A 0x06
40#define DA9063_REG_EVENT_B 0x07
41#define DA9063_REG_EVENT_C 0x08
42#define DA9063_REG_EVENT_D 0x09
43#define DA9063_REG_IRQ_MASK_A 0x0A
44#define DA9063_REG_IRQ_MASK_B 0x0B
45#define DA9063_REG_IRQ_MASK_C 0x0C
46#define DA9063_REG_IRQ_MASK_D 0x0D
47#define DA9063_REG_CONTROL_A 0x0E
48#define DA9063_REG_CONTROL_B 0x0F
49#define DA9063_REG_CONTROL_C 0x10
50#define DA9063_REG_CONTROL_D 0x11
51#define DA9063_REG_CONTROL_E 0x12
52#define DA9063_REG_CONTROL_F 0x13
53#define DA9063_REG_PD_DIS 0x14
54
55/* GPIO Control Registers */
56#define DA9063_REG_GPIO_0_1 0x15
57#define DA9063_REG_GPIO_2_3 0x16
58#define DA9063_REG_GPIO_4_5 0x17
59#define DA9063_REG_GPIO_6_7 0x18
60#define DA9063_REG_GPIO_8_9 0x19
61#define DA9063_REG_GPIO_10_11 0x1A
62#define DA9063_REG_GPIO_12_13 0x1B
63#define DA9063_REG_GPIO_14_15 0x1C
64#define DA9063_REG_GPIO_MODE_0_7 0x1D
65#define DA9063_REG_GPIO_MODE_8_15 0x1E
66#define DA9063_REG_GPIO_SWITCH_CONT 0x1F
67
68/* Regulator Control Registers */
69#define DA9063_REG_BCORE2_CONT 0x20
70#define DA9063_REG_BCORE1_CONT 0x21
71#define DA9063_REG_BPRO_CONT 0x22
72#define DA9063_REG_BMEM_CONT 0x23
73#define DA9063_REG_BIO_CONT 0x24
74#define DA9063_REG_BPERI_CONT 0x25
75#define DA9063_REG_LDO1_CONT 0x26
76#define DA9063_REG_LDO2_CONT 0x27
77#define DA9063_REG_LDO3_CONT 0x28
78#define DA9063_REG_LDO4_CONT 0x29
79#define DA9063_REG_LDO5_CONT 0x2A
80#define DA9063_REG_LDO6_CONT 0x2B
81#define DA9063_REG_LDO7_CONT 0x2C
82#define DA9063_REG_LDO8_CONT 0x2D
83#define DA9063_REG_LDO9_CONT 0x2E
84#define DA9063_REG_LDO10_CONT 0x2F
85#define DA9063_REG_LDO11_CONT 0x30
86#define DA9063_REG_VIB 0x31
87#define DA9063_REG_DVC_1 0x32
88#define DA9063_REG_DVC_2 0x33
89
90/* GP-ADC Control Registers */
91#define DA9063_REG_ADC_MAN 0x34
92#define DA9063_REG_ADC_CONT 0x35
93#define DA9063_REG_VSYS_MON 0x36
94#define DA9063_REG_ADC_RES_L 0x37
95#define DA9063_REG_ADC_RES_H 0x38
96#define DA9063_REG_VSYS_RES 0x39
97#define DA9063_REG_ADCIN1_RES 0x3A
98#define DA9063_REG_ADCIN2_RES 0x3B
99#define DA9063_REG_ADCIN3_RES 0x3C
100#define DA9063_REG_MON1_RES 0x3D
101#define DA9063_REG_MON2_RES 0x3E
102#define DA9063_REG_MON3_RES 0x3F
103
104/* RTC Calendar and Alarm Registers */
105#define DA9063_REG_COUNT_S 0x40
106#define DA9063_REG_COUNT_MI 0x41
107#define DA9063_REG_COUNT_H 0x42
108#define DA9063_REG_COUNT_D 0x43
109#define DA9063_REG_COUNT_MO 0x44
110#define DA9063_REG_COUNT_Y 0x45
111#define DA9063_REG_ALARM_MI 0x46
112#define DA9063_REG_ALARM_H 0x47
113#define DA9063_REG_ALARM_D 0x48
114#define DA9063_REG_ALARM_MO 0x49
115#define DA9063_REG_ALARM_Y 0x4A
116#define DA9063_REG_SECOND_A 0x4B
117#define DA9063_REG_SECOND_B 0x4C
118#define DA9063_REG_SECOND_C 0x4D
119#define DA9063_REG_SECOND_D 0x4E
120
121/* Sequencer Control Registers */
122#define DA9063_REG_SEQ 0x81
123#define DA9063_REG_SEQ_TIMER 0x82
124#define DA9063_REG_ID_2_1 0x83
125#define DA9063_REG_ID_4_3 0x84
126#define DA9063_REG_ID_6_5 0x85
127#define DA9063_REG_ID_8_7 0x86
128#define DA9063_REG_ID_10_9 0x87
129#define DA9063_REG_ID_12_11 0x88
130#define DA9063_REG_ID_14_13 0x89
131#define DA9063_REG_ID_16_15 0x8A
132#define DA9063_REG_ID_18_17 0x8B
133#define DA9063_REG_ID_20_19 0x8C
134#define DA9063_REG_ID_22_21 0x8D
135#define DA9063_REG_ID_24_23 0x8E
136#define DA9063_REG_ID_26_25 0x8F
137#define DA9063_REG_ID_28_27 0x90
138#define DA9063_REG_ID_30_29 0x91
139#define DA9063_REG_ID_32_31 0x92
140#define DA9063_REG_SEQ_A 0x95
141#define DA9063_REG_SEQ_B 0x96
142#define DA9063_REG_WAIT 0x97
143#define DA9063_REG_EN_32K 0x98
144#define DA9063_REG_RESET 0x99
145
146/* Regulator Setting Registers */
147#define DA9063_REG_BUCK_ILIM_A 0x9A
148#define DA9063_REG_BUCK_ILIM_B 0x9B
149#define DA9063_REG_BUCK_ILIM_C 0x9C
150#define DA9063_REG_BCORE2_CFG 0x9D
151#define DA9063_REG_BCORE1_CFG 0x9E
152#define DA9063_REG_BPRO_CFG 0x9F
153#define DA9063_REG_BIO_CFG 0xA0
154#define DA9063_REG_BMEM_CFG 0xA1
155#define DA9063_REG_BPERI_CFG 0xA2
156#define DA9063_REG_VBCORE2_A 0xA3
157#define DA9063_REG_VBCORE1_A 0xA4
158#define DA9063_REG_VBPRO_A 0xA5
159#define DA9063_REG_VBMEM_A 0xA6
160#define DA9063_REG_VBIO_A 0xA7
161#define DA9063_REG_VBPERI_A 0xA8
162#define DA9063_REG_VLDO1_A 0xA9
163#define DA9063_REG_VLDO2_A 0xAA
164#define DA9063_REG_VLDO3_A 0xAB
165#define DA9063_REG_VLDO4_A 0xAC
166#define DA9063_REG_VLDO5_A 0xAD
167#define DA9063_REG_VLDO6_A 0xAE
168#define DA9063_REG_VLDO7_A 0xAF
169#define DA9063_REG_VLDO8_A 0xB0
170#define DA9063_REG_VLDO9_A 0xB1
171#define DA9063_REG_VLDO10_A 0xB2
172#define DA9063_REG_VLDO11_A 0xB3
173#define DA9063_REG_VBCORE2_B 0xB4
174#define DA9063_REG_VBCORE1_B 0xB5
175#define DA9063_REG_VBPRO_B 0xB6
176#define DA9063_REG_VBMEM_B 0xB7
177#define DA9063_REG_VBIO_B 0xB8
178#define DA9063_REG_VBPERI_B 0xB9
179#define DA9063_REG_VLDO1_B 0xBA
180#define DA9063_REG_VLDO2_B 0xBB
181#define DA9063_REG_VLDO3_B 0xBC
182#define DA9063_REG_VLDO4_B 0xBD
183#define DA9063_REG_VLDO5_B 0xBE
184#define DA9063_REG_VLDO6_B 0xBF
185#define DA9063_REG_VLDO7_B 0xC0
186#define DA9063_REG_VLDO8_B 0xC1
187#define DA9063_REG_VLDO9_B 0xC2
188#define DA9063_REG_VLDO10_B 0xC3
189#define DA9063_REG_VLDO11_B 0xC4
190
191/* Backup Battery Charger Control Register */
192#define DA9063_REG_BBAT_CONT 0xC5
193
194/* GPIO PWM (LED) */
195#define DA9063_REG_GPO11_LED 0xC6
196#define DA9063_REG_GPO14_LED 0xC7
197#define DA9063_REG_GPO15_LED 0xC8
198
199/* GP-ADC Threshold Registers */
200#define DA9063_REG_ADC_CFG 0xC9
201#define DA9063_REG_AUTO1_HIGH 0xCA
202#define DA9063_REG_AUTO1_LOW 0xCB
203#define DA9063_REG_AUTO2_HIGH 0xCC
204#define DA9063_REG_AUTO2_LOW 0xCD
205#define DA9063_REG_AUTO3_HIGH 0xCE
206#define DA9063_REG_AUTO3_LOW 0xCF
207
208/* DA9063 Configuration registers */
209/* OTP */
210#define DA9063_REG_OPT_COUNT 0x101
211#define DA9063_REG_OPT_ADDR 0x102
212#define DA9063_REG_OPT_DATA 0x103
213
214/* Customer Trim and Configuration */
215#define DA9063_REG_T_OFFSET 0x104
216#define DA9063_REG_INTERFACE 0x105
217#define DA9063_REG_CONFIG_A 0x106
218#define DA9063_REG_CONFIG_B 0x107
219#define DA9063_REG_CONFIG_C 0x108
220#define DA9063_REG_CONFIG_D 0x109
221#define DA9063_REG_CONFIG_E 0x10A
222#define DA9063_REG_CONFIG_F 0x10B
223#define DA9063_REG_CONFIG_G 0x10C
224#define DA9063_REG_CONFIG_H 0x10D
225#define DA9063_REG_CONFIG_I 0x10E
226#define DA9063_REG_CONFIG_J 0x10F
227#define DA9063_REG_CONFIG_K 0x110
228#define DA9063_REG_CONFIG_L 0x111
229#define DA9063_REG_MON_REG_1 0x112
230#define DA9063_REG_MON_REG_2 0x113
231#define DA9063_REG_MON_REG_3 0x114
232#define DA9063_REG_MON_REG_4 0x115
233#define DA9063_REG_MON_REG_5 0x116
234#define DA9063_REG_MON_REG_6 0x117
235#define DA9063_REG_TRIM_CLDR 0x118
236
237/* General Purpose Registers */
238#define DA9063_REG_GP_ID_0 0x119
239#define DA9063_REG_GP_ID_1 0x11A
240#define DA9063_REG_GP_ID_2 0x11B
241#define DA9063_REG_GP_ID_3 0x11C
242#define DA9063_REG_GP_ID_4 0x11D
243#define DA9063_REG_GP_ID_5 0x11E
244#define DA9063_REG_GP_ID_6 0x11F
245#define DA9063_REG_GP_ID_7 0x120
246#define DA9063_REG_GP_ID_8 0x121
247#define DA9063_REG_GP_ID_9 0x122
248#define DA9063_REG_GP_ID_10 0x123
249#define DA9063_REG_GP_ID_11 0x124
250#define DA9063_REG_GP_ID_12 0x125
251#define DA9063_REG_GP_ID_13 0x126
252#define DA9063_REG_GP_ID_14 0x127
253#define DA9063_REG_GP_ID_15 0x128
254#define DA9063_REG_GP_ID_16 0x129
255#define DA9063_REG_GP_ID_17 0x12A
256#define DA9063_REG_GP_ID_18 0x12B
257#define DA9063_REG_GP_ID_19 0x12C
258
259/* Chip ID and variant */
260#define DA9063_REG_CHIP_ID 0x181
261#define DA9063_REG_CHIP_VARIANT 0x182
262
263/*
264 * PMIC registers bits
265 */
266/* DA9063_REG_PAGE_CON (addr=0x00) */
267#define DA9063_PEG_PAGE_SHIFT 0
268#define DA9063_REG_PAGE_MASK 0x07
269#define DA9063_REG_PAGE0 0x00
270#define DA9063_REG_PAGE2 0x02
271#define DA9063_PAGE_WRITE_MODE 0x00
272#define DA9063_REPEAT_WRITE_MODE 0x40
273#define DA9063_PAGE_REVERT 0x80
274
275/* DA9063_REG_STATUS_A (addr=0x01) */
276#define DA9063_NONKEY 0x01
277#define DA9063_WAKE 0x02
278#define DA9063_DVC_BUSY 0x04
279#define DA9063_COMP_1V2 0x08
280
281/* DA9063_REG_STATUS_B (addr=0x02) */
282#define DA9063_GPI0 0x01
283#define DA9063_GPI1 0x02
284#define DA9063_GPI2 0x04
285#define DA9063_GPI3 0x08
286#define DA9063_GPI4 0x10
287#define DA9063_GPI5 0x20
288#define DA9063_GPI6 0x40
289#define DA9063_GPI7 0x80
290
291/* DA9063_REG_STATUS_C (addr=0x03) */
292#define DA9063_GPI8 0x01
293#define DA9063_GPI9 0x02
294#define DA9063_GPI10 0x04
295#define DA9063_GPI11 0x08
296#define DA9063_GPI12 0x10
297#define DA9063_GPI13 0x20
298#define DA9063_GPI14 0x40
299#define DA9063_GPI15 0x80
300
301/* DA9063_REG_STATUS_D (addr=0x04) */
302#define DA9063_LDO3_LIM 0x08
303#define DA9063_LDO4_LIM 0x10
304#define DA9063_LDO7_LIM 0x20
305#define DA9063_LDO8_LIM 0x40
306#define DA9063_LDO11_LIM 0x80
307
308/* DA9063_REG_FAULT_LOG (addr=0x05) */
309#define DA9063_TWD_ERROR 0x01
310#define DA9063_POR 0x02
311#define DA9063_VDD_FAULT 0x04
312#define DA9063_VDD_START 0x08
313#define DA9063_TEMP_CRIT 0x10
314#define DA9063_KEY_RESET 0x20
315#define DA9063_NSHUTDOWN 0x40
316#define DA9063_WAIT_SHUT 0x80
317
318/* DA9063_REG_EVENT_A (addr=0x06) */
319#define DA9063_E_NONKEY 0x01
320#define DA9063_E_ALARM 0x02
321#define DA9063_E_TICK 0x04
322#define DA9063_E_ADC_RDY 0x08
323#define DA9063_E_SEQ_RDY 0x10
324#define DA9063_EVENTS_B 0x20
325#define DA9063_EVENTS_C 0x40
326#define DA9063_EVENTS_D 0x80
327
328/* DA9063_REG_EVENT_B (addr=0x07) */
329#define DA9063_E_WAKE 0x01
330#define DA9063_E_TEMP 0x02
331#define DA9063_E_COMP_1V2 0x04
332#define DA9063_E_LDO_LIM 0x08
333#define DA9063_E_REG_UVOV 0x10
334#define DA9063_E_DVC_RDY 0x20
335#define DA9063_E_VDD_MON 0x40
336#define DA9063_E_VDD_WARN 0x80
337
338/* DA9063_REG_EVENT_C (addr=0x08) */
339#define DA9063_E_GPI0 0x01
340#define DA9063_E_GPI1 0x02
341#define DA9063_E_GPI2 0x04
342#define DA9063_E_GPI3 0x08
343#define DA9063_E_GPI4 0x10
344#define DA9063_E_GPI5 0x20
345#define DA9063_E_GPI6 0x40
346#define DA9063_E_GPI7 0x80
347
348/* DA9063_REG_EVENT_D (addr=0x09) */
349#define DA9063_E_GPI8 0x01
350#define DA9063_E_GPI9 0x02
351#define DA9063_E_GPI10 0x04
352#define DA9063_E_GPI11 0x08
353#define DA9063_E_GPI12 0x10
354#define DA9063_E_GPI13 0x20
355#define DA9063_E_GPI14 0x40
356#define DA9063_E_GPI15 0x80
357
358/* DA9063_REG_IRQ_MASK_A (addr=0x0A) */
359#define DA9063_M_ONKEY 0x01
360#define DA9063_M_ALARM 0x02
361#define DA9063_M_TICK 0x04
362#define DA9063_M_ADC_RDY 0x08
363#define DA9063_M_SEQ_RDY 0x10
364
365/* DA9063_REG_IRQ_MASK_B (addr=0x0B) */
366#define DA9063_M_WAKE 0x01
367#define DA9063_M_TEMP 0x02
368#define DA9063_M_COMP_1V2 0x04
369#define DA9063_M_LDO_LIM 0x08
370#define DA9063_M_UVOV 0x10
371#define DA9063_M_DVC_RDY 0x20
372#define DA9063_M_VDD_MON 0x40
373#define DA9063_M_VDD_WARN 0x80
374
375/* DA9063_REG_IRQ_MASK_C (addr=0x0C) */
376#define DA9063_M_GPI0 0x01
377#define DA9063_M_GPI1 0x02
378#define DA9063_M_GPI2 0x04
379#define DA9063_M_GPI3 0x08
380#define DA9063_M_GPI4 0x10
381#define DA9063_M_GPI5 0x20
382#define DA9063_M_GPI6 0x40
383#define DA9063_M_GPI7 0x80
384
385/* DA9063_REG_IRQ_MASK_D (addr=0x0D) */
386#define DA9063_M_GPI8 0x01
387#define DA9063_M_GPI9 0x02
388#define DA9063_M_GPI10 0x04
389#define DA9063_M_GPI11 0x08
390#define DA9063_M_GPI12 0x10
391#define DA9063_M_GPI13 0x20
392#define DA9063_M_GPI14 0x40
393#define DA9063_M_GPI15 0x80
394
395/* DA9063_REG_CONTROL_A (addr=0x0E) */
396#define DA9063_SYSTEM_EN 0x01
397#define DA9063_POWER_EN 0x02
398#define DA9063_POWER1_EN 0x04
399#define DA9063_STANDBY 0x08
400#define DA9063_M_SYSTEM_EN 0x10
401#define DA9063_M_POWER_EN 0x20
402#define DA9063_M_POWER1_EN 0x40
403#define DA9063_CP_EN 0x80
404
405/* DA9063_REG_CONTROL_B (addr=0x0F) */
406#define DA9063_CHG_SEL 0x01
407#define DA9063_WATCHDOG_PD 0x02
408#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10
410
411/* DA9063_REG_CONTROL_C (addr=0x10) */
412#define DA9063_DEBOUNCING_MASK 0x07
413#define DA9063_DEBOUNCING_OFF 0x0
414#define DA9063_DEBOUNCING_0MS1 0x1
415#define DA9063_DEBOUNCING_1MS 0x2
416#define DA9063_DEBOUNCING_10MS24 0x3
417#define DA9063_DEBOUNCING_51MS2 0x4
418#define DA9063_DEBOUNCING_256MS 0x5
419#define DA9063_DEBOUNCING_512MS 0x6
420#define DA9063_DEBOUNCING_1024MS 0x7
421
422#define DA9063_AUTO_BOOT 0x08
423#define DA9063_OTPREAD_EN 0x10
424#define DA9063_SLEW_RATE_MASK 0x60
425#define DA9063_SLEW_RATE_4US 0x00
426#define DA9063_SLEW_RATE_3US 0x20
427#define DA9063_SLEW_RATE_1US 0x40
428#define DA9063_SLEW_RATE_0US5 0x60
429#define DA9063_DEF_SUPPLY 0x80
430
431/* DA9063_REG_CONTROL_D (addr=0x11) */
432#define DA9063_TWDSCALE_MASK 0x07
433#define DA9063_BLINK_FRQ_MASK 0x38
434#define DA9063_BLINK_FRQ_OFF 0x00
435#define DA9063_BLINK_FRQ_1S0 0x08
436#define DA9063_BLINK_FRQ_2S0 0x10
437#define DA9063_BLINK_FRQ_4S0 0x18
438#define DA9063_BLINK_FRQ_0S18 0x20
439#define DA9063_BLINK_FRQ_2S0_VDD 0x28
440#define DA9063_BLINK_FRQ_4S0_VDD 0x30
441#define DA9063_BLINK_FRQ_0S18_VDD 0x38
442
443#define DA9063_BLINK_DUR_MASK 0xC0
444#define DA9063_BLINK_DUR_10MS 0x00
445#define DA9063_BLINK_DUR_20MS 0x40
446#define DA9063_BLINK_DUR_40MS 0x80
447#define DA9063_BLINK_DUR_20MSDBL 0xC0
448
449/* DA9063_REG_CONTROL_E (addr=0x12) */
450#define DA9063_RTC_MODE_PD 0x01
451#define DA9063_RTC_MODE_SD 0x02
452#define DA9063_RTC_EN 0x04
453#define DA9063_ECO_MODE 0x08
454#define DA9063_PM_FB1_PIN 0x10
455#define DA9063_PM_FB2_PIN 0x20
456#define DA9063_PM_FB3_PIN 0x40
457#define DA9063_V_LOCK 0x80
458
459/* DA9063_REG_CONTROL_F (addr=0x13) */
460#define DA9063_WATCHDOG 0x01
461#define DA9063_SHUTDOWN 0x02
462#define DA9063_WAKE_UP 0x04
463
464/* DA9063_REG_PD_DIS (addr=0x14) */
465#define DA9063_GPI_DIS 0x01
466#define DA9063_GPADC_PAUSE 0x02
467#define DA9063_PMIF_DIS 0x04
468#define DA9063_HS2WIRE_DIS 0x08
469#define DA9063_BBAT_DIS 0x20
470#define DA9063_OUT_32K_PAUSE 0x40
471#define DA9063_PMCONT_DIS 0x80
472
473/* DA9063_REG_GPIO_0_1 (addr=0x15) */
474#define DA9063_GPIO0_PIN_MASK 0x03
475#define DA9063_GPIO0_PIN_ADCIN1 0x00
476#define DA9063_GPIO0_PIN_GPI 0x01
477#define DA9063_GPIO0_PIN_GPO_OD 0x02
478#define DA9063_GPIO0_PIN_GPO 0x03
479#define DA9063_GPIO0_TYPE 0x04
480#define DA9063_GPIO0_TYPE_GPI_ACT_LOW 0x00
481#define DA9063_GPIO0_TYPE_GPO_VDD_IO1 0x00
482#define DA9063_GPIO0_TYPE_GPI_ACT_HIGH 0x04
483#define DA9063_GPIO0_TYPE_GPO_VDD_IO2 0x04
484#define DA9063_GPIO0_NO_WAKEUP 0x08
485#define DA9063_GPIO1_PIN_MASK 0x30
486#define DA9063_GPIO1_PIN_ADCIN2_COMP 0x00
487#define DA9063_GPIO1_PIN_GPI 0x10
488#define DA9063_GPIO1_PIN_GPO_OD 0x20
489#define DA9063_GPIO1_PIN_GPO 0x30
490#define DA9063_GPIO1_TYPE 0x40
491#define DA9063_GPIO1_TYPE_GPI_ACT_LOW 0x00
492#define DA9063_GPIO1_TYPE_GPO_VDD_IO1 0x00
493#define DA9063_GPIO1_TYPE_GPI_ACT_HIGH 0x04
494#define DA9063_GPIO1_TYPE_GPO_VDD_IO2 0x04
495#define DA9063_GPIO1_NO_WAKEUP 0x80
496
497/* DA9063_REG_GPIO_2_3 (addr=0x16) */
498#define DA9063_GPIO2_PIN_MASK 0x03
499#define DA9063_GPIO2_PIN_ADCIN3 0x00
500#define DA9063_GPIO2_PIN_GPI 0x01
501#define DA9063_GPIO2_PIN_GPO_PSS 0x02
502#define DA9063_GPIO2_PIN_GPO 0x03
503#define DA9063_GPIO2_TYPE 0x04
504#define DA9063_GPIO2_TYPE_GPI_ACT_LOW 0x00
505#define DA9063_GPIO2_TYPE_GPO_VDD_IO1 0x00
506#define DA9063_GPIO2_TYPE_GPI_ACT_HIGH 0x04
507#define DA9063_GPIO2_TYPE_GPO_VDD_IO2 0x04
508#define DA9063_GPIO2_NO_WAKEUP 0x08
509#define DA9063_GPIO3_PIN_MASK 0x30
510#define DA9063_GPIO3_PIN_CORE_SW_G 0x00
511#define DA9063_GPIO3_PIN_GPI 0x10
512#define DA9063_GPIO3_PIN_GPO_OD 0x20
513#define DA9063_GPIO3_PIN_GPO 0x30
514#define DA9063_GPIO3_TYPE 0x40
515#define DA9063_GPIO3_TYPE_GPI_ACT_LOW 0x00
516#define DA9063_GPIO3_TYPE_GPO_VDD_IO1 0x00
517#define DA9063_GPIO3_TYPE_GPI_ACT_HIGH 0x04
518#define DA9063_GPIO3_TYPE_GPO_VDD_IO2 0x04
519#define DA9063_GPIO3_NO_WAKEUP 0x80
520
521/* DA9063_REG_GPIO_4_5 (addr=0x17) */
522#define DA9063_GPIO4_PIN_MASK 0x03
523#define DA9063_GPIO4_PIN_CORE_SW_S 0x00
524#define DA9063_GPIO4_PIN_GPI 0x01
525#define DA9063_GPIO4_PIN_GPO_OD 0x02
526#define DA9063_GPIO4_PIN_GPO 0x03
527#define DA9063_GPIO4_TYPE 0x04
528#define DA9063_GPIO4_TYPE_GPI_ACT_LOW 0x00
529#define DA9063_GPIO4_TYPE_GPO_VDD_IO1 0x00
530#define DA9063_GPIO4_TYPE_GPI_ACT_HIGH 0x04
531#define DA9063_GPIO4_TYPE_GPO_VDD_IO2 0x04
532#define DA9063_GPIO4_NO_WAKEUP 0x08
533#define DA9063_GPIO5_PIN_MASK 0x30
534#define DA9063_GPIO5_PIN_PERI_SW_G 0x00
535#define DA9063_GPIO5_PIN_GPI 0x10
536#define DA9063_GPIO5_PIN_GPO_OD 0x20
537#define DA9063_GPIO5_PIN_GPO 0x30
538#define DA9063_GPIO5_TYPE 0x40
539#define DA9063_GPIO5_TYPE_GPI_ACT_LOW 0x00
540#define DA9063_GPIO5_TYPE_GPO_VDD_IO1 0x00
541#define DA9063_GPIO5_TYPE_GPI_ACT_HIGH 0x04
542#define DA9063_GPIO5_TYPE_GPO_VDD_IO2 0x04
543#define DA9063_GPIO5_NO_WAKEUP 0x80
544
545/* DA9063_REG_GPIO_6_7 (addr=0x18) */
546#define DA9063_GPIO6_PIN_MASK 0x03
547#define DA9063_GPIO6_PIN_PERI_SW_S 0x00
548#define DA9063_GPIO6_PIN_GPI 0x01
549#define DA9063_GPIO6_PIN_GPO_OD 0x02
550#define DA9063_GPIO6_PIN_GPO 0x03
551#define DA9063_GPIO6_TYPE 0x04
552#define DA9063_GPIO6_TYPE_GPI_ACT_LOW 0x00
553#define DA9063_GPIO6_TYPE_GPO_VDD_IO1 0x00
554#define DA9063_GPIO6_TYPE_GPI_ACT_HIGH 0x04
555#define DA9063_GPIO6_TYPE_GPO_VDD_IO2 0x04
556#define DA9063_GPIO6_NO_WAKEUP 0x08
557#define DA9063_GPIO7_PIN_MASK 0x30
558#define DA9063_GPIO7_PIN_GPI 0x10
559#define DA9063_GPIO7_PIN_GPO_PSS 0x20
560#define DA9063_GPIO7_PIN_GPO 0x30
561#define DA9063_GPIO7_TYPE 0x40
562#define DA9063_GPIO7_TYPE_GPI_ACT_LOW 0x00
563#define DA9063_GPIO7_TYPE_GPO_VDD_IO1 0x00
564#define DA9063_GPIO7_TYPE_GPI_ACT_HIGH 0x04
565#define DA9063_GPIO7_TYPE_GPO_VDD_IO2 0x04
566#define DA9063_GPIO7_NO_WAKEUP 0x80
567
568/* DA9063_REG_GPIO_8_9 (addr=0x19) */
569#define DA9063_GPIO8_PIN_MASK 0x03
570#define DA9063_GPIO8_PIN_GPI_SYS_EN 0x00
571#define DA9063_GPIO8_PIN_GPI 0x01
572#define DA9063_GPIO8_PIN_GPO_PSS 0x02
573#define DA9063_GPIO8_PIN_GPO 0x03
574#define DA9063_GPIO8_TYPE 0x04
575#define DA9063_GPIO8_TYPE_GPI_ACT_LOW 0x00
576#define DA9063_GPIO8_TYPE_GPO_VDD_IO1 0x00
577#define DA9063_GPIO8_TYPE_GPI_ACT_HIGH 0x04
578#define DA9063_GPIO8_TYPE_GPO_VDD_IO2 0x04
579#define DA9063_GPIO8_NO_WAKEUP 0x08
580#define DA9063_GPIO9_PIN_MASK 0x30
581#define DA9063_GPIO9_PIN_GPI_PWR_EN 0x00
582#define DA9063_GPIO9_PIN_GPI 0x10
583#define DA9063_GPIO9_PIN_GPO_PSS 0x20
584#define DA9063_GPIO9_PIN_GPO 0x30
585#define DA9063_GPIO9_TYPE 0x40
586#define DA9063_GPIO9_TYPE_GPI_ACT_LOW 0x00
587#define DA9063_GPIO9_TYPE_GPO_VDD_IO1 0x00
588#define DA9063_GPIO9_TYPE_GPI_ACT_HIGH 0x04
589#define DA9063_GPIO9_TYPE_GPO_VDD_IO2 0x04
590#define DA9063_GPIO9_NO_WAKEUP 0x80
591
592/* DA9063_REG_GPIO_10_11 (addr=0x1A) */
593#define DA9063_GPIO10_PIN_MASK 0x03
594#define DA9063_GPIO10_PIN_GPI_PWR1_EN 0x00
595#define DA9063_GPIO10_PIN_GPI 0x01
596#define DA9063_GPIO10_PIN_GPO_OD 0x02
597#define DA9063_GPIO10_PIN_GPO 0x03
598#define DA9063_GPIO10_TYPE 0x04
599#define DA9063_GPIO10_TYPE_GPI_ACT_LOW 0x00
600#define DA9063_GPIO10_TYPE_GPO_VDD_IO1 0x00
601#define DA9063_GPIO10_TYPE_GPI_ACT_HIGH 0x04
602#define DA9063_GPIO10_TYPE_GPO_VDD_IO2 0x04
603#define DA9063_GPIO10_NO_WAKEUP 0x08
604#define DA9063_GPIO11_PIN_MASK 0x30
605#define DA9063_GPIO11_PIN_GPO_OD 0x00
606#define DA9063_GPIO11_PIN_GPI 0x10
607#define DA9063_GPIO11_PIN_GPO_PSS 0x20
608#define DA9063_GPIO11_PIN_GPO 0x30
609#define DA9063_GPIO11_TYPE 0x40
610#define DA9063_GPIO11_TYPE_GPI_ACT_LOW 0x00
611#define DA9063_GPIO11_TYPE_GPO_VDD_IO1 0x00
612#define DA9063_GPIO11_TYPE_GPI_ACT_HIGH 0x04
613#define DA9063_GPIO11_TYPE_GPO_VDD_IO2 0x04
614#define DA9063_GPIO11_NO_WAKEUP 0x80
615
616/* DA9063_REG_GPIO_12_13 (addr=0x1B) */
617#define DA9063_GPIO12_PIN_MASK 0x03
618#define DA9063_GPIO12_PIN_NVDDFLT_OUT 0x00
619#define DA9063_GPIO12_PIN_GPI 0x01
620#define DA9063_GPIO12_PIN_VSYSMON_OUT 0x02
621#define DA9063_GPIO12_PIN_GPO 0x03
622#define DA9063_GPIO12_TYPE 0x04
623#define DA9063_GPIO12_TYPE_GPI_ACT_LOW 0x00
624#define DA9063_GPIO12_TYPE_GPO_VDD_IO1 0x00
625#define DA9063_GPIO12_TYPE_GPI_ACT_HIGH 0x04
626#define DA9063_GPIO12_TYPE_GPO_VDD_IO2 0x04
627#define DA9063_GPIO12_NO_WAKEUP 0x08
628#define DA9063_GPIO13_PIN_MASK 0x30
629#define DA9063_GPIO13_PIN_GPFB1_OUT 0x00
630#define DA9063_GPIO13_PIN_GPI 0x10
631#define DA9063_GPIO13_PIN_GPFB1_OUTOD 0x20
632#define DA9063_GPIO13_PIN_GPO 0x30
633#define DA9063_GPIO13_TYPE 0x40
634#define DA9063_GPIO13_TYPE_GPFB1_OUT 0x00
635#define DA9063_GPIO13_TYPE_GPI 0x00
636#define DA9063_GPIO13_TYPE_GPFB1_OUTOD 0x04
637#define DA9063_GPIO13_TYPE_GPO 0x04
638#define DA9063_GPIO13_NO_WAKEUP 0x80
639
640/* DA9063_REG_GPIO_14_15 (addr=0x1C) */
641#define DA9063_GPIO14_PIN_MASK 0x03
642#define DA9063_GPIO14_PIN_GPO_OD 0x00
643#define DA9063_GPIO14_PIN_GPI 0x01
644#define DA9063_GPIO14_PIN_HS2DATA 0x02
645#define DA9063_GPIO14_PIN_GPO 0x03
646#define DA9063_GPIO14_TYPE 0x04
647#define DA9063_GPIO14_TYPE_GPI_ACT_LOW 0x00
648#define DA9063_GPIO14_TYPE_GPO_VDD_IO1 0x00
649#define DA9063_GPIO14_TYPE_GPI_ACT_HIGH 0x04
650#define DA9063_GPIO14_TYPE_GPO_VDD_IO2 0x04
651#define DA9063_GPIO14_NO_WAKEUP 0x08
652#define DA9063_GPIO15_PIN_MASK 0x30
653#define DA9063_GPIO15_PIN_GPO_OD 0x00
654#define DA9063_GPIO15_PIN_GPI 0x10
655#define DA9063_GPIO15_PIN_GPO 0x30
656#define DA9063_GPIO15_TYPE 0x40
657#define DA9063_GPIO15_TYPE_GPFB1_OUT 0x00
658#define DA9063_GPIO15_TYPE_GPI 0x00
659#define DA9063_GPIO15_TYPE_GPFB1_OUTOD 0x04
660#define DA9063_GPIO15_TYPE_GPO 0x04
661#define DA9063_GPIO15_NO_WAKEUP 0x80
662
663/* DA9063_REG_GPIO_MODE_0_7 (addr=0x1D) */
664#define DA9063_GPIO0_MODE 0x01
665#define DA9063_GPIO1_MODE 0x02
666#define DA9063_GPIO2_MODE 0x04
667#define DA9063_GPIO3_MODE 0x08
668#define DA9063_GPIO4_MODE 0x10
669#define DA9063_GPIO5_MODE 0x20
670#define DA9063_GPIO6_MODE 0x40
671#define DA9063_GPIO7_MODE 0x80
672
673/* DA9063_REG_GPIO_MODE_8_15 (addr=0x1E) */
674#define DA9063_GPIO8_MODE 0x01
675#define DA9063_GPIO9_MODE 0x02
676#define DA9063_GPIO10_MODE 0x04
677#define DA9063_GPIO11_MODE 0x08
678#define DA9063_GPIO11_MODE_LED_ACT_HIGH 0x00
679#define DA9063_GPIO11_MODE_LED_ACT_LOW 0x08
680#define DA9063_GPIO12_MODE 0x10
681#define DA9063_GPIO13_MODE 0x20
682#define DA9063_GPIO14_MODE 0x40
683#define DA9063_GPIO14_MODE_LED_ACT_HIGH 0x00
684#define DA9063_GPIO14_MODE_LED_ACT_LOW 0x40
685#define DA9063_GPIO15_MODE 0x80
686#define DA9063_GPIO15_MODE_LED_ACT_HIGH 0x00
687#define DA9063_GPIO15_MODE_LED_ACT_LOW 0x80
688
689/* DA9063_REG_SWITCH_CONT (addr=0x1F) */
690#define DA9063_CORE_SW_GPI_MASK 0x03
691#define DA9063_CORE_SW_GPI_OFF 0x00
692#define DA9063_CORE_SW_GPI_GPIO1 0x01
693#define DA9063_CORE_SW_GPI_GPIO2 0x02
694#define DA9063_CORE_SW_GPI_GPIO13 0x03
695#define DA9063_PERI_SW_GPI_MASK 0x0C
696#define DA9063_PERI_SW_GPI_OFF 0x00
697#define DA9063_PERI_SW_GPI_GPIO1 0x04
698#define DA9063_PERI_SW_GPI_GPIO2 0x08
699#define DA9063_PERI_SW_GPI_GPIO13 0x0C
700#define DA9063_SWITCH_SR_MASK 0x30
701#define DA9063_SWITCH_SR_1MV 0x00
702#define DA9063_SWITCH_SR_5MV 0x10
703#define DA9063_SWITCH_SR_10MV 0x20
704#define DA9063_SWITCH_SR_50MV 0x30
705#define DA9063_SWITCH_SR_DIS 0x40
706#define DA9063_CP_EN_MODE 0x80
707
708/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */
709#define DA9063_BUCK_EN 0x01
710#define DA9063_BUCK_GPI_MASK 0x06
711#define DA9063_BUCK_GPI_OFF 0x00
712#define DA9063_BUCK_GPI_GPIO1 0x02
713#define DA9063_BUCK_GPI_GPIO2 0x04
714#define DA9063_BUCK_GPI_GPIO13 0x06
715#define DA9063_BUCK_CONF 0x08
716#define DA9063_VBUCK_GPI_MASK 0x60
717#define DA9063_VBUCK_GPI_OFF 0x00
718#define DA9063_VBUCK_GPI_GPIO1 0x20
719#define DA9063_VBUCK_GPI_GPIO2 0x40
720#define DA9063_VBUCK_GPI_GPIO13 0x60
721
722/* DA9063_REG_BCORE1_CONT specific bits (addr=0x21) */
723#define DA9063_CORE_SW_EN 0x10
724#define DA9063_CORE_SW_CONF 0x80
725
726/* DA9063_REG_BPERI_CONT specific bits (addr=0x25) */
727#define DA9063_PERI_SW_EN 0x10
728#define DA9063_PERI_SW_CONF 0x80
729
730/* DA9063_REG_LDOx_CONT common bits (addr=0x26-0x30) */
731#define DA9063_LDO_EN 0x01
732#define DA9063_LDO_GPI_MASK 0x06
733#define DA9063_LDO_GPI_OFF 0x00
734#define DA9063_LDO_GPI_GPIO1 0x02
735#define DA9063_LDO_GPI_GPIO2 0x04
736#define DA9063_LDO_GPI_GPIO13 0x06
737#define DA9063_LDO_PD_DIS 0x08
738#define DA9063_VLDO_GPI_MASK 0x60
739#define DA9063_VLDO_GPI_OFF 0x00
740#define DA9063_VLDO_GPI_GPIO1 0x20
741#define DA9063_VLDO_GPI_GPIO2 0x40
742#define DA9063_VLDO_GPI_GPIO13 0x60
743#define DA9063_LDO_CONF 0x80
744
745/* DA9063_REG_LDO5_CONT specific bits (addr=0x2A) */
746#define DA9063_VLDO5_SEL 0x10
747
748/* DA9063_REG_LDO6_CONT specific bits (addr=0x2B) */
749#define DA9063_VLDO6_SEL 0x10
750
751/* DA9063_REG_LDO7_CONT specific bits (addr=0x2C) */
752#define DA9063_VLDO7_SEL 0x10
753
754/* DA9063_REG_LDO8_CONT specific bits (addr=0x2D) */
755#define DA9063_VLDO8_SEL 0x10
756
757/* DA9063_REG_LDO9_CONT specific bits (addr=0x2E) */
758#define DA9063_VLDO9_SEL 0x10
759
760/* DA9063_REG_LDO10_CONT specific bits (addr=0x2F) */
761#define DA9063_VLDO10_SEL 0x10
762
763/* DA9063_REG_LDO11_CONT specific bits (addr=0x30) */
764#define DA9063_VLDO11_SEL 0x10
765
766/* DA9063_REG_VIB (addr=0x31) */
767#define DA9063_VIB_SET_MASK 0x3F
768#define DA9063_VIB_SET_OFF 0
769#define DA9063_VIB_SET_MAX 0x3F
770
771/* DA9063_REG_DVC_1 (addr=0x32) */
772#define DA9063_VBCORE1_SEL 0x01
773#define DA9063_VBCORE2_SEL 0x02
774#define DA9063_VBPRO_SEL 0x04
775#define DA9063_VBMEM_SEL 0x08
776#define DA9063_VBPERI_SEL 0x10
777#define DA9063_VLDO1_SEL 0x20
778#define DA9063_VLDO2_SEL 0x40
779#define DA9063_VLDO3_SEL 0x80
780
781/* DA9063_REG_DVC_2 (addr=0x33) */
782#define DA9063_VBIO_SEL 0x01
783#define DA9063_VLDO4_SEL 0x80
784
785/* DA9063_REG_ADC_MAN (addr=0x34) */
786#define DA9063_ADC_MUX_MASK 0x0F
787#define DA9063_ADC_MUX_VSYS 0x00
788#define DA9063_ADC_MUX_ADCIN1 0x01
789#define DA9063_ADC_MUX_ADCIN2 0x02
790#define DA9063_ADC_MUX_ADCIN3 0x03
791#define DA9063_ADC_MUX_T_SENSE 0x04
792#define DA9063_ADC_MUX_VBBAT 0x05
793#define DA9063_ADC_MUX_LDO_G1 0x08
794#define DA9063_ADC_MUX_LDO_G2 0x09
795#define DA9063_ADC_MUX_LDO_G3 0x0A
796#define DA9063_ADC_MAN 0x10
797#define DA9063_ADC_MODE 0x20
798
799/* DA9063_REG_ADC_CONT (addr=0x35) */
800#define DA9063_ADC_AUTO_VSYS_EN 0x01
801#define DA9063_ADC_AUTO_AD1_EN 0x02
802#define DA9063_ADC_AUTO_AD2_EN 0x04
803#define DA9063_ADC_AUTO_AD3_EN 0x08
804#define DA9063_ADC_AD1_ISRC_EN 0x10
805#define DA9063_ADC_AD2_ISRC_EN 0x20
806#define DA9063_ADC_AD3_ISRC_EN 0x40
807#define DA9063_COMP1V2_EN 0x80
808
809/* DA9063_REG_VSYS_MON (addr=0x36) */
810#define DA9063_VSYS_VAL_MASK 0xFF
811#define DA9063_VSYS_VAL_BASE 0x00
812
813/* DA9063_REG_ADC_RES_L (addr=0x37) */
814#define DA9063_ADC_RES_L_BITS 2
815#define DA9063_ADC_RES_L_MASK 0xC0
816
817/* DA9063_REG_ADC_RES_H (addr=0x38) */
818#define DA9063_ADC_RES_M_BITS 8
819#define DA9063_ADC_RES_M_MASK 0xFF
820
821/* DA9063_REG_(xxx_RES/ADC_RES_H) (addr=0x39-0x3F) */
822#define DA9063_ADC_VAL_MASK 0xFF
823
824/* DA9063_REG_COUNT_S (addr=0x40) */
825#define DA9063_RTC_READ 0x80
826#define DA9063_COUNT_SEC_MASK 0x3F
827
828/* DA9063_REG_COUNT_MI (addr=0x41) */
829#define DA9063_COUNT_MIN_MASK 0x3F
830
831/* DA9063_REG_COUNT_H (addr=0x42) */
832#define DA9063_COUNT_HOUR_MASK 0x1F
833
834/* DA9063_REG_COUNT_D (addr=0x43) */
835#define DA9063_COUNT_DAY_MASK 0x1F
836
837/* DA9063_REG_COUNT_MO (addr=0x44) */
838#define DA9063_COUNT_MONTH_MASK 0x0F
839
840/* DA9063_REG_COUNT_Y (addr=0x45) */
841#define DA9063_COUNT_YEAR_MASK 0x3F
842#define DA9063_MONITOR 0x40
843
844/* DA9063_REG_ALARM_MI (addr=0x46) */
845#define DA9063_ALARM_STATUS_ALARM 0x80
846#define DA9063_ALARM_STATUS_TICK 0x40
847#define DA9063_ALARM_MIN_MASK 0x3F
848
849/* DA9063_REG_ALARM_H (addr=0x47) */
850#define DA9063_ALARM_HOUR_MASK 0x1F
851
852/* DA9063_REG_ALARM_D (addr=0x48) */
853#define DA9063_ALARM_DAY_MASK 0x1F
854
855/* DA9063_REG_ALARM_MO (addr=0x49) */
856#define DA9063_TICK_WAKE 0x20
857#define DA9063_TICK_TYPE 0x10
858#define DA9063_TICK_TYPE_SEC 0x00
859#define DA9063_TICK_TYPE_MIN 0x10
860#define DA9063_ALARM_MONTH_MASK 0x0F
861
862/* DA9063_REG_ALARM_Y (addr=0x4A) */
863#define DA9063_TICK_ON 0x80
864#define DA9063_ALARM_ON 0x40
865#define DA9063_ALARM_YEAR_MASK 0x3F
866
867/* DA9063_REG_WAIT (addr=0x97)*/
868#define DA9063_REG_WAIT_TIME_MASK 0xF
869#define DA9063_WAIT_TIME_0_US 0x0
870#define DA9063_WAIT_TIME_512_US 0x1
871#define DA9063_WAIT_TIME_1_MS 0x2
872#define DA9063_WAIT_TIME_2_MS 0x3
873#define DA9063_WAIT_TIME_4_1_MS 0x4
874#define DA9063_WAIT_TIME_8_2_MS 0x5
875#define DA9063_WAIT_TIME_16_4_MS 0x6
876#define DA9063_WAIT_TIME_32_8_MS 0x7
877#define DA9063_WAIT_TIME_65_5_MS 0x8
878#define DA9063_WAIT_TIME_128_MS 0x9
879#define DA9063_WAIT_TIME_256_MS 0xA
880#define DA9063_WAIT_TIME_512_MS 0xB
881#define DA9063_WAIT_TIME_1_S 0xC
882#define DA9063_WAIT_TIME_2_1_S 0xD
883
884/* DA9063_REG_EN_32K (addr=0x98)*/
885#define DA9063_STABILIZ_TIME_MASK 0x7
886#define DA9063_CRYSTAL 0x08
887#define DA9063_DELAY_MODE 0x10
888#define DA9063_OUT_CLOCK 0x20
889#define DA9063_RTC_CLOCK 0x40
890#define DA9063_OUT_32K_EN 0x80
891
892/* DA9063_REG_CHIP_VARIANT */
893#define DA9063_CHIP_VARIANT_SHIFT 4
894
895/* DA9063_REG_BUCK_ILIM_A (addr=0x9A) */
896#define DA9063_BIO_ILIM_MASK 0x0F
897#define DA9063_BMEM_ILIM_MASK 0xF0
898
899/* DA9063_REG_BUCK_ILIM_B (addr=0x9B) */
900#define DA9063_BPRO_ILIM_MASK 0x0F
901#define DA9063_BPERI_ILIM_MASK 0xF0
902
903/* DA9063_REG_BUCK_ILIM_C (addr=0x9C) */
904#define DA9063_BCORE1_ILIM_MASK 0x0F
905#define DA9063_BCORE2_ILIM_MASK 0xF0
906
907/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */
908#define DA9063_BUCK_FB_MASK 0x07
909#define DA9063_BUCK_PD_DIS_SHIFT 5
910#define DA9063_BUCK_MODE_MASK 0xC0
911#define DA9063_BUCK_MODE_MANUAL 0x00
912#define DA9063_BUCK_MODE_SLEEP 0x40
913#define DA9063_BUCK_MODE_SYNC 0x80
914#define DA9063_BUCK_MODE_AUTO 0xC0
915
916/* DA9063_REG_BPRO_CFG (addr=0x9F) */
917#define DA9063_BPRO_VTTR_EN 0x08
918#define DA9063_BPRO_VTT_EN 0x10
919
920/* DA9063_REG_VBxxxx_A/B (addr=0xA3-0xA8, 0xB4-0xB9) */
921#define DA9063_VBUCK_MASK 0x7F
922#define DA9063_VBUCK_BIAS 0
923#define DA9063_BUCK_SL 0x80
924
925/* DA9063_REG_VLDOx_A/B (addr=0xA9-0x3, 0xBA-0xC4) */
926#define DA9063_LDO_SL 0x80
927
928/* DA9063_REG_VLDO1_A/B (addr=0xA9, 0xBA) */
929#define DA9063_VLDO1_MASK 0x3F
930#define DA9063_VLDO1_BIAS 0
931
932/* DA9063_REG_VLDO2_A/B (addr=0xAA, 0xBB) */
933#define DA9063_VLDO2_MASK 0x3F
934#define DA9063_VLDO2_BIAS 0
935
936/* DA9063_REG_VLDO3_A/B (addr=0xAB, 0xBC) */
937#define DA9063_VLDO3_MASK 0x7F
938#define DA9063_VLDO3_BIAS 0
939
940/* DA9063_REG_VLDO4_A/B (addr=0xAC, 0xBD) */
941#define DA9063_VLDO4_MASK 0x7F
942#define DA9063_VLDO4_BIAS 0
943
944/* DA9063_REG_VLDO5_A/B (addr=0xAD, 0xBE) */
945#define DA9063_VLDO5_MASK 0x3F
946#define DA9063_VLDO5_BIAS 2
947
948/* DA9063_REG_VLDO6_A/B (addr=0xAE, 0xBF) */
949#define DA9063_VLDO6_MASK 0x3F
950#define DA9063_VLDO6_BIAS 2
951
952/* DA9063_REG_VLDO7_A/B (addr=0xAF, 0xC0) */
953#define DA9063_VLDO7_MASK 0x3F
954#define DA9063_VLDO7_BIAS 2
955
956/* DA9063_REG_VLDO8_A/B (addr=0xB0, 0xC1) */
957#define DA9063_VLDO8_MASK 0x3F
958#define DA9063_VLDO8_BIAS 2
959
960/* DA9063_REG_VLDO9_A/B (addr=0xB1, 0xC2) */
961#define DA9063_VLDO9_MASK 0x3F
962#define DA9063_VLDO9_BIAS 3
963
964/* DA9063_REG_VLDO10_A/B (addr=0xB2, 0xC3) */
965#define DA9063_VLDO10_MASK 0x3F
966#define DA9063_VLDO10_BIAS 2
967
968/* DA9063_REG_VLDO11_A/B (addr=0xB3, 0xC4) */
969#define DA9063_VLDO11_MASK 0x3F
970#define DA9063_VLDO11_BIAS 2
971
972/* DA9063_REG_GPO11_LED (addr=0xC6) */
973/* DA9063_REG_GPO14_LED (addr=0xC7) */
974/* DA9063_REG_GPO15_LED (addr=0xC8) */
975#define DA9063_GPIO_DIM 0x80
976#define DA9063_GPIO_PWM_MASK 0x7F
977
978/* DA9063_REG_CONFIG_H (addr=0x10D) */
979#define DA9063_PWM_CLK_MASK 0x01
980#define DA9063_PWM_CLK_PWM2MHZ 0x00
981#define DA9063_PWM_CLK_PWM1MHZ 0x01
982#define DA9063_LDO8_MODE_MASK 0x02
983#define DA9063_LDO8_MODE_LDO 0
984#define DA9063_LDO8_MODE_VIBR 0x02
985#define DA9063_MERGE_SENSE_MASK 0x04
986#define DA9063_MERGE_SENSE_GP_FB2 0x00
987#define DA9063_MERGE_SENSE_GPIO4 0x04
988#define DA9063_BCORE_MERGE 0x08
989#define DA9063_BPRO_OD 0x10
990#define DA9063_BCORE2_OD 0x20
991#define DA9063_BCORE1_OD 0x40
992#define DA9063_BUCK_MERGE 0x80
993
994/* DA9063_REG_CONFIG_I (addr=0x10E) */
995#define DA9063_NONKEY_PIN_MASK 0x03
996#define DA9063_NONKEY_PIN_PORT 0x00
997#define DA9063_NONKEY_PIN_SWDOWN 0x01
998#define DA9063_NONKEY_PIN_AUTODOWN 0x02
999#define DA9063_NONKEY_PIN_AUTOFLPRT 0x03
1000
1001/* DA9063_REG_MON_REG_5 (addr=0x116) */
1002#define DA9063_MON_A8_IDX_MASK 0x07
1003#define DA9063_MON_A8_IDX_NONE 0x00
1004#define DA9063_MON_A8_IDX_BCORE1 0x01
1005#define DA9063_MON_A8_IDX_BCORE2 0x02
1006#define DA9063_MON_A8_IDX_BPRO 0x03
1007#define DA9063_MON_A8_IDX_LDO3 0x04
1008#define DA9063_MON_A8_IDX_LDO4 0x05
1009#define DA9063_MON_A8_IDX_LDO11 0x06
1010#define DA9063_MON_A9_IDX_MASK 0x70
1011#define DA9063_MON_A9_IDX_NONE 0x00
1012#define DA9063_MON_A9_IDX_BIO 0x01
1013#define DA9063_MON_A9_IDX_BMEM 0x02
1014#define DA9063_MON_A9_IDX_BPERI 0x03
1015#define DA9063_MON_A9_IDX_LDO1 0x04
1016#define DA9063_MON_A9_IDX_LDO2 0x05
1017#define DA9063_MON_A9_IDX_LDO5 0x06
1018
1019/* DA9063_REG_MON_REG_6 (addr=0x117) */
1020#define DA9063_MON_A10_IDX_MASK 0x07
1021#define DA9063_MON_A10_IDX_NONE 0x00
1022#define DA9063_MON_A10_IDX_LDO6 0x01
1023#define DA9063_MON_A10_IDX_LDO7 0x02
1024#define DA9063_MON_A10_IDX_LDO8 0x03
1025#define DA9063_MON_A10_IDX_LDO9 0x04
1026#define DA9063_MON_A10_IDX_LDO10 0x05
1027
1028#endif /* _DA9063_REG_H */
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 13a1ee95a233..5166935ce66d 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -30,6 +30,8 @@
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32 32
33struct regmap;
34
33/* 35/*
34 * Register values. 36 * Register values.
35 */ 37 */
@@ -113,6 +115,7 @@ struct davinci_vc {
113 115
114 /* Memory resources */ 116 /* Memory resources */
115 void __iomem *base; 117 void __iomem *base;
118 struct regmap *regmap;
116 119
117 /* MFD cells */ 120 /* MFD cells */
118 struct mfd_cell cells[DAVINCI_VC_CELLS]; 121 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index a9e8bd157673..f682953043ba 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,6 +10,8 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <linux/device.h>
14
13struct mcp_ops; 15struct mcp_ops;
14 16
15struct mcp { 17struct mcp {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 1a8dd7afe084..9974e387e483 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -160,7 +160,8 @@ enum palmas_regulators {
160 PALMAS_REG_SMPS7, 160 PALMAS_REG_SMPS7,
161 PALMAS_REG_SMPS8, 161 PALMAS_REG_SMPS8,
162 PALMAS_REG_SMPS9, 162 PALMAS_REG_SMPS9,
163 PALMAS_REG_SMPS10, 163 PALMAS_REG_SMPS10_OUT2,
164 PALMAS_REG_SMPS10_OUT1,
164 /* LDO regulators */ 165 /* LDO regulators */
165 PALMAS_REG_LDO1, 166 PALMAS_REG_LDO1,
166 PALMAS_REG_LDO2, 167 PALMAS_REG_LDO2,
@@ -183,6 +184,50 @@ enum palmas_regulators {
183 PALMAS_NUM_REGS, 184 PALMAS_NUM_REGS,
184}; 185};
185 186
187/* External controll signal name */
188enum {
189 PALMAS_EXT_CONTROL_ENABLE1 = 0x1,
190 PALMAS_EXT_CONTROL_ENABLE2 = 0x2,
191 PALMAS_EXT_CONTROL_NSLEEP = 0x4,
192};
193
194/*
195 * Palmas device resources can be controlled externally for
196 * enabling/disabling it rather than register write through i2c.
197 * Add the external controlled requestor ID for different resources.
198 */
199enum palmas_external_requestor_id {
200 PALMAS_EXTERNAL_REQSTR_ID_REGEN1,
201 PALMAS_EXTERNAL_REQSTR_ID_REGEN2,
202 PALMAS_EXTERNAL_REQSTR_ID_SYSEN1,
203 PALMAS_EXTERNAL_REQSTR_ID_SYSEN2,
204 PALMAS_EXTERNAL_REQSTR_ID_CLK32KG,
205 PALMAS_EXTERNAL_REQSTR_ID_CLK32KGAUDIO,
206 PALMAS_EXTERNAL_REQSTR_ID_REGEN3,
207 PALMAS_EXTERNAL_REQSTR_ID_SMPS12,
208 PALMAS_EXTERNAL_REQSTR_ID_SMPS3,
209 PALMAS_EXTERNAL_REQSTR_ID_SMPS45,
210 PALMAS_EXTERNAL_REQSTR_ID_SMPS6,
211 PALMAS_EXTERNAL_REQSTR_ID_SMPS7,
212 PALMAS_EXTERNAL_REQSTR_ID_SMPS8,
213 PALMAS_EXTERNAL_REQSTR_ID_SMPS9,
214 PALMAS_EXTERNAL_REQSTR_ID_SMPS10,
215 PALMAS_EXTERNAL_REQSTR_ID_LDO1,
216 PALMAS_EXTERNAL_REQSTR_ID_LDO2,
217 PALMAS_EXTERNAL_REQSTR_ID_LDO3,
218 PALMAS_EXTERNAL_REQSTR_ID_LDO4,
219 PALMAS_EXTERNAL_REQSTR_ID_LDO5,
220 PALMAS_EXTERNAL_REQSTR_ID_LDO6,
221 PALMAS_EXTERNAL_REQSTR_ID_LDO7,
222 PALMAS_EXTERNAL_REQSTR_ID_LDO8,
223 PALMAS_EXTERNAL_REQSTR_ID_LDO9,
224 PALMAS_EXTERNAL_REQSTR_ID_LDOLN,
225 PALMAS_EXTERNAL_REQSTR_ID_LDOUSB,
226
227 /* Last entry */
228 PALMAS_EXTERNAL_REQSTR_ID_MAX,
229};
230
186struct palmas_pmic_platform_data { 231struct palmas_pmic_platform_data {
187 /* An array of pointers to regulator init data indexed by regulator 232 /* An array of pointers to regulator init data indexed by regulator
188 * ID 233 * ID
@@ -258,6 +303,7 @@ struct palmas_platform_data {
258 */ 303 */
259 int mux_from_pdata; 304 int mux_from_pdata;
260 u8 pad1, pad2; 305 u8 pad1, pad2;
306 bool pm_off;
261 307
262 struct palmas_pmic_platform_data *pmic_pdata; 308 struct palmas_pmic_platform_data *pmic_pdata;
263 struct palmas_gpadc_platform_data *gpadc_pdata; 309 struct palmas_gpadc_platform_data *gpadc_pdata;
@@ -355,9 +401,9 @@ struct palmas_pmic {
355 int smps123; 401 int smps123;
356 int smps457; 402 int smps457;
357 403
358 int range[PALMAS_REG_SMPS10]; 404 int range[PALMAS_REG_SMPS10_OUT1];
359 unsigned int ramp_delay[PALMAS_REG_SMPS10]; 405 unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1];
360 unsigned int current_reg_mode[PALMAS_REG_SMPS10]; 406 unsigned int current_reg_mode[PALMAS_REG_SMPS10_OUT1];
361}; 407};
362 408
363struct palmas_resource { 409struct palmas_resource {
@@ -371,17 +417,15 @@ struct palmas_usb {
371 417
372 struct extcon_dev edev; 418 struct extcon_dev edev;
373 419
374 /* used to set vbus, in atomic path */
375 struct work_struct set_vbus_work;
376
377 int id_otg_irq; 420 int id_otg_irq;
378 int id_irq; 421 int id_irq;
379 int vbus_otg_irq; 422 int vbus_otg_irq;
380 int vbus_irq; 423 int vbus_irq;
381 424
382 int vbus_enable;
383
384 enum palmas_usb_state linkstat; 425 enum palmas_usb_state linkstat;
426 int wakeup;
427 bool enable_vbus_detection;
428 bool enable_id_detection;
385}; 429};
386 430
387#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) 431#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
@@ -449,7 +493,7 @@ enum usb_irq_events {
449#define PALMAS_DVFS_BASE 0x180 493#define PALMAS_DVFS_BASE 0x180
450#define PALMAS_PMU_CONTROL_BASE 0x1A0 494#define PALMAS_PMU_CONTROL_BASE 0x1A0
451#define PALMAS_RESOURCE_BASE 0x1D4 495#define PALMAS_RESOURCE_BASE 0x1D4
452#define PALMAS_PU_PD_OD_BASE 0x1F4 496#define PALMAS_PU_PD_OD_BASE 0x1F0
453#define PALMAS_LED_BASE 0x200 497#define PALMAS_LED_BASE 0x200
454#define PALMAS_INTERRUPT_BASE 0x210 498#define PALMAS_INTERRUPT_BASE 0x210
455#define PALMAS_USB_OTG_BASE 0x250 499#define PALMAS_USB_OTG_BASE 0x250
@@ -1734,16 +1778,20 @@ enum usb_irq_events {
1734#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0
1735 1779
1736/* Registers for function PAD_CONTROL */ 1780/* Registers for function PAD_CONTROL */
1737#define PALMAS_PU_PD_INPUT_CTRL1 0x0 1781#define PALMAS_OD_OUTPUT_CTRL2 0x2
1738#define PALMAS_PU_PD_INPUT_CTRL2 0x1 1782#define PALMAS_POLARITY_CTRL2 0x3
1739#define PALMAS_PU_PD_INPUT_CTRL3 0x2 1783#define PALMAS_PU_PD_INPUT_CTRL1 0x4
1740#define PALMAS_OD_OUTPUT_CTRL 0x4 1784#define PALMAS_PU_PD_INPUT_CTRL2 0x5
1741#define PALMAS_POLARITY_CTRL 0x5 1785#define PALMAS_PU_PD_INPUT_CTRL3 0x6
1742#define PALMAS_PRIMARY_SECONDARY_PAD1 0x6 1786#define PALMAS_PU_PD_INPUT_CTRL5 0x7
1743#define PALMAS_PRIMARY_SECONDARY_PAD2 0x7 1787#define PALMAS_OD_OUTPUT_CTRL 0x8
1744#define PALMAS_I2C_SPI 0x8 1788#define PALMAS_POLARITY_CTRL 0x9
1745#define PALMAS_PU_PD_INPUT_CTRL4 0x9 1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0xA
1746#define PALMAS_PRIMARY_SECONDARY_PAD3 0xA 1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0xB
1791#define PALMAS_I2C_SPI 0xC
1792#define PALMAS_PU_PD_INPUT_CTRL4 0xD
1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0xE
1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0xF
1747 1795
1748/* Bit definitions for PU_PD_INPUT_CTRL1 */ 1796/* Bit definitions for PU_PD_INPUT_CTRL1 */
1749#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
@@ -2501,6 +2549,15 @@ enum usb_irq_events {
2501#define PALMAS_PU_PD_GPIO_CTRL1 0x6 2549#define PALMAS_PU_PD_GPIO_CTRL1 0x6
2502#define PALMAS_PU_PD_GPIO_CTRL2 0x7 2550#define PALMAS_PU_PD_GPIO_CTRL2 0x7
2503#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8
2552#define PALMAS_GPIO_DATA_IN2 0x9
2553#define PALMAS_GPIO_DATA_DIR2 0x0A
2554#define PALMAS_GPIO_DATA_OUT2 0x0B
2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C
2556#define PALMAS_GPIO_CLEAR_DATA_OUT2 0x0D
2557#define PALMAS_GPIO_SET_DATA_OUT2 0x0E
2558#define PALMAS_PU_PD_GPIO_CTRL3 0x0F
2559#define PALMAS_PU_PD_GPIO_CTRL4 0x10
2560#define PALMAS_OD_OUTPUT_GPIO_CTRL2 0x11
2504 2561
2505/* Bit definitions for GPIO_DATA_IN */ 2562/* Bit definitions for GPIO_DATA_IN */
2506#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
@@ -2866,4 +2923,9 @@ static inline int palmas_irq_get_virq(struct palmas *palmas, int irq)
2866 return regmap_irq_get_virq(palmas->irq_data, irq); 2923 return regmap_irq_get_virq(palmas->irq_data, irq);
2867} 2924}
2868 2925
2926
2927int palmas_ext_control_req_config(struct palmas *palmas,
2928 enum palmas_external_requestor_id ext_control_req_id,
2929 int ext_ctrl, bool enable);
2930
2869#endif /* __LINUX_MFD_PALMAS_H */ 2931#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index 2b13970596f5..443176ee1ab0 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek driver-based card reader 1/* Driver for Realtek driver-based card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_COMMON_H 22#ifndef __RTSX_COMMON_H
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 7a9f7089435d..d1382dfbeff0 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -1,6 +1,6 @@
1/* Driver for Realtek PCI-Express card reader 1/* Driver for Realtek PCI-Express card reader
2 * 2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. 3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -17,7 +17,6 @@
17 * 17 *
18 * Author: 18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn> 19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */ 20 */
22 21
23#ifndef __RTSX_PCI_H 22#ifndef __RTSX_PCI_H
@@ -25,8 +24,7 @@
25 24
26#include <linux/sched.h> 25#include <linux/sched.h>
27#include <linux/pci.h> 26#include <linux/pci.h>
28 27#include <linux/mfd/rtsx_common.h>
29#include "rtsx_common.h"
30 28
31#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
32 30
@@ -184,11 +182,26 @@
184#define CARD_SHARE_BAROSSA_SD 0x01 182#define CARD_SHARE_BAROSSA_SD 0x01
185#define CARD_SHARE_BAROSSA_MS 0x02 183#define CARD_SHARE_BAROSSA_MS 0x02
186 184
185/* CARD_DRIVE_SEL */
186#define MS_DRIVE_8mA (0x01 << 6)
187#define MMC_DRIVE_8mA (0x01 << 4)
188#define XD_DRIVE_8mA (0x01 << 2)
189#define GPIO_DRIVE_8mA 0x01
190#define RTS5209_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
191 XD_DRIVE_8mA | GPIO_DRIVE_8mA)
192#define RTL8411_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | MMC_DRIVE_8mA |\
193 XD_DRIVE_8mA)
194#define RTSX_CARD_DRIVE_DEFAULT (MS_DRIVE_8mA | GPIO_DRIVE_8mA)
195
187/* SD30_DRIVE_SEL */ 196/* SD30_DRIVE_SEL */
188#define DRIVER_TYPE_A 0x05 197#define DRIVER_TYPE_A 0x05
189#define DRIVER_TYPE_B 0x03 198#define DRIVER_TYPE_B 0x03
190#define DRIVER_TYPE_C 0x02 199#define DRIVER_TYPE_C 0x02
191#define DRIVER_TYPE_D 0x01 200#define DRIVER_TYPE_D 0x01
201#define CFG_DRIVER_TYPE_A 0x02
202#define CFG_DRIVER_TYPE_B 0x03
203#define CFG_DRIVER_TYPE_C 0x01
204#define CFG_DRIVER_TYPE_D 0x00
192 205
193/* FPDCTL */ 206/* FPDCTL */
194#define SSC_POWER_DOWN 0x01 207#define SSC_POWER_DOWN 0x01
@@ -521,6 +534,10 @@
521#define SAMPLE_VAR_CLK0 (0x01 << 4) 534#define SAMPLE_VAR_CLK0 (0x01 << 4)
522#define SAMPLE_VAR_CLK1 (0x02 << 4) 535#define SAMPLE_VAR_CLK1 (0x02 << 4)
523 536
537/* HOST_SLEEP_STATE */
538#define HOST_ENTER_S1 1
539#define HOST_ENTER_S3 2
540
524#define MS_CFG 0xFD40 541#define MS_CFG 0xFD40
525#define MS_TPC 0xFD41 542#define MS_TPC 0xFD41
526#define MS_TRANS_CFG 0xFD42 543#define MS_TRANS_CFG 0xFD42
@@ -669,6 +686,7 @@
669#define PME_FORCE_CTL 0xFE56 686#define PME_FORCE_CTL 0xFE56
670#define ASPM_FORCE_CTL 0xFE57 687#define ASPM_FORCE_CTL 0xFE57
671#define PM_CLK_FORCE_CTL 0xFE58 688#define PM_CLK_FORCE_CTL 0xFE58
689#define FUNC_FORCE_CTL 0xFE59
672#define PERST_GLITCH_WIDTH 0xFE5C 690#define PERST_GLITCH_WIDTH 0xFE5C
673#define CHANGE_LINK_STATE 0xFE5B 691#define CHANGE_LINK_STATE 0xFE5B
674#define RESET_LOAD_REG 0xFE5E 692#define RESET_LOAD_REG 0xFE5E
@@ -684,6 +702,13 @@
684 702
685#define DUMMY_REG_RESET_0 0xFE90 703#define DUMMY_REG_RESET_0 0xFE90
686 704
705#define AUTOLOAD_CFG_BASE 0xFF00
706
707#define PM_CTRL1 0xFF44
708#define PM_CTRL2 0xFF45
709#define PM_CTRL3 0xFF46
710#define PM_CTRL4 0xFF47
711
687/* Memory mapping */ 712/* Memory mapping */
688#define SRAM_BASE 0xE600 713#define SRAM_BASE 0xE600
689#define RBUF_BASE 0xF400 714#define RBUF_BASE 0xF400
@@ -726,6 +751,11 @@
726#define PHY_FLD4 0x1E 751#define PHY_FLD4 0x1E
727#define PHY_DUM_REG 0x1F 752#define PHY_DUM_REG 0x1F
728 753
754#define LCTLR 0x80
755#define PCR_SETTING_REG1 0x724
756#define PCR_SETTING_REG2 0x814
757#define PCR_SETTING_REG3 0x747
758
729#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 759#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
730 760
731struct rtsx_pcr; 761struct rtsx_pcr;
@@ -747,6 +777,8 @@ struct pcr_ops {
747 u8 voltage); 777 u8 voltage);
748 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 778 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
749 int (*conv_clk_and_div_n)(int clk, int dir); 779 int (*conv_clk_and_div_n)(int clk, int dir);
780 void (*fetch_vendor_settings)(struct rtsx_pcr *pcr);
781 void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state);
750}; 782};
751 783
752enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 784enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -788,7 +820,6 @@ struct rtsx_pcr {
788 struct completion *finish_me; 820 struct completion *finish_me;
789 821
790 unsigned int cur_clock; 822 unsigned int cur_clock;
791 bool ms_pmos;
792 bool remove_pci; 823 bool remove_pci;
793 bool msi_en; 824 bool msi_en;
794 825
@@ -806,6 +837,19 @@ struct rtsx_pcr {
806#define IC_VER_D 3 837#define IC_VER_D 3
807 u8 ic_version; 838 u8 ic_version;
808 839
840 u8 sd30_drive_sel_1v8;
841 u8 sd30_drive_sel_3v3;
842 u8 card_drive_sel;
843#define ASPM_L1_EN 0x02
844 u8 aspm_en;
845
846#define PCR_MS_PMOS (1 << 0)
847#define PCR_REVERSE_SOCKET (1 << 1)
848 u32 flags;
849
850 u32 tx_initial_phase;
851 u32 rx_initial_phase;
852
809 const u32 *sd_pull_ctl_enable_tbl; 853 const u32 *sd_pull_ctl_enable_tbl;
810 const u32 *sd_pull_ctl_disable_tbl; 854 const u32 *sd_pull_ctl_disable_tbl;
811 const u32 *ms_pull_ctl_enable_tbl; 855 const u32 *ms_pull_ctl_enable_tbl;
@@ -822,6 +866,18 @@ struct rtsx_pcr {
822#define PCI_VID(pcr) ((pcr)->pci->vendor) 866#define PCI_VID(pcr) ((pcr)->pci->vendor)
823#define PCI_PID(pcr) ((pcr)->pci->device) 867#define PCI_PID(pcr) ((pcr)->pci->device)
824 868
869#define SDR104_PHASE(val) ((val) & 0xFF)
870#define SDR50_PHASE(val) (((val) >> 8) & 0xFF)
871#define DDR50_PHASE(val) (((val) >> 16) & 0xFF)
872#define SDR104_TX_PHASE(pcr) SDR104_PHASE((pcr)->tx_initial_phase)
873#define SDR50_TX_PHASE(pcr) SDR50_PHASE((pcr)->tx_initial_phase)
874#define DDR50_TX_PHASE(pcr) DDR50_PHASE((pcr)->tx_initial_phase)
875#define SDR104_RX_PHASE(pcr) SDR104_PHASE((pcr)->rx_initial_phase)
876#define SDR50_RX_PHASE(pcr) SDR50_PHASE((pcr)->rx_initial_phase)
877#define DDR50_RX_PHASE(pcr) DDR50_PHASE((pcr)->rx_initial_phase)
878#define SET_CLOCK_PHASE(sdr104, sdr50, ddr50) \
879 (((ddr50) << 16) | ((sdr50) << 8) | (sdr104))
880
825void rtsx_pci_start_run(struct rtsx_pcr *pcr); 881void rtsx_pci_start_run(struct rtsx_pcr *pcr);
826int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data); 882int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data);
827int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data); 883int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data);
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index 4e94dc65f987..b3ddf98dec37 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -167,11 +167,8 @@ enum s2mps11_regulators {
167 S2MPS11_BUCK8, 167 S2MPS11_BUCK8,
168 S2MPS11_BUCK9, 168 S2MPS11_BUCK9,
169 S2MPS11_BUCK10, 169 S2MPS11_BUCK10,
170 S2MPS11_AP_EN32KHZ,
171 S2MPS11_CP_EN32KHZ,
172 S2MPS11_BT_EN32KHZ,
173 170
174 S2MPS11_REG_MAX, 171 S2MPS11_REGULATOR_MAX,
175}; 172};
176 173
177#define S2MPS11_BUCK_MIN1 600000 174#define S2MPS11_BUCK_MIN1 600000
@@ -191,7 +188,17 @@ enum s2mps11_regulators {
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 188#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */ 189#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
193 190
191
192#define S2MPS11_BUCK2_RAMP_SHIFT 6
193#define S2MPS11_BUCK34_RAMP_SHIFT 4
194#define S2MPS11_BUCK5_RAMP_SHIFT 6
195#define S2MPS11_BUCK16_RAMP_SHIFT 4
196#define S2MPS11_BUCK7810_RAMP_SHIFT 2
197#define S2MPS11_BUCK9_RAMP_SHIFT 0
198#define S2MPS11_BUCK2_RAMP_EN_SHIFT 3
199#define S2MPS11_BUCK3_RAMP_EN_SHIFT 2
200#define S2MPS11_BUCK4_RAMP_EN_SHIFT 1
201#define S2MPS11_BUCK6_RAMP_EN_SHIFT 0
194#define S2MPS11_PMIC_EN_SHIFT 6 202#define S2MPS11_PMIC_EN_SHIFT 6
195#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
196 203
197#endif /* __LINUX_MFD_S2MPS11_H */ 204#endif /* __LINUX_MFD_S2MPS11_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index db1791bb997a..25f2c611ab01 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -121,7 +121,6 @@
121#define SEQ_STATUS BIT(5) 121#define SEQ_STATUS BIT(5)
122 122
123#define ADC_CLK 3000000 123#define ADC_CLK 3000000
124#define MAX_CLK_DIV 7
125#define TOTAL_STEPS 16 124#define TOTAL_STEPS 16
126#define TOTAL_CHANNELS 8 125#define TOTAL_CHANNELS 8
127 126
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index ce3511326f80..b22883d60500 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -108,7 +108,6 @@ struct tmio_mmc_data {
108 unsigned int cd_gpio; 108 unsigned int cd_gpio;
109 void (*set_pwr)(struct platform_device *host, int state); 109 void (*set_pwr)(struct platform_device *host, int state);
110 void (*set_clk_div)(struct platform_device *host, int state); 110 void (*set_clk_div)(struct platform_device *host, int state);
111 int (*get_cd)(struct platform_device *host);
112 int (*write16_hook)(struct tmio_mmc_host *host, int addr); 111 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
113 /* clock management callbacks */ 112 /* clock management callbacks */
114 int (*clk_enable)(struct platform_device *pdev, unsigned int *f); 113 int (*clk_enable)(struct platform_device *pdev, unsigned int *f);
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 29eab2bd3dfa..a5a7f0130e96 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -244,24 +244,6 @@ struct tps65217_board {
244}; 244};
245 245
246/** 246/**
247 * struct tps_info - packages regulator constraints
248 * @name: Voltage regulator name
249 * @min_uV: minimum micro volts
250 * @max_uV: minimum micro volts
251 * @vsel_to_uv: Function pointer to get voltage from selector
252 * @uv_to_vsel: Function pointer to get selector from voltage
253 *
254 * This data is used to check the regualtor voltage limits while setting.
255 */
256struct tps_info {
257 const char *name;
258 int min_uV;
259 int max_uV;
260 int (*vsel_to_uv)(unsigned int vsel);
261 int (*uv_to_vsel)(int uV, unsigned int *vsel);
262};
263
264/**
265 * struct tps65217 - tps65217 sub-driver chip access routines 247 * struct tps65217 - tps65217 sub-driver chip access routines
266 * 248 *
267 * Device data may be used to access the TPS65217 chip 249 * Device data may be used to access the TPS65217 chip
@@ -273,7 +255,6 @@ struct tps65217 {
273 unsigned int id; 255 unsigned int id;
274 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
275 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; 257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
276 struct tps_info *info[TPS65217_NUM_REGULATOR];
277 struct regmap *regmap; 258 struct regmap *regmap;
278}; 259};
279 260
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 7e7fbce7a308..81f639bc1ae6 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -185,6 +185,7 @@
185 185
186#define TWL6040_GPO_MAX 3 186#define TWL6040_GPO_MAX 3
187 187
188/* TODO: All platform data struct can be removed */
188struct twl6040_codec_data { 189struct twl6040_codec_data {
189 u16 hs_left_step; 190 u16 hs_left_step;
190 u16 hs_right_step; 191 u16 hs_right_step;
@@ -229,7 +230,6 @@ struct twl6040 {
229 int audpwron; 230 int audpwron;
230 int power_count; 231 int power_count;
231 int rev; 232 int rev;
232 u8 vibra_ctrl_cache[2];
233 233
234 /* PLL configuration */ 234 /* PLL configuration */
235 int pll; 235 int pll;
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 28af41756360..88f90cbf8e6a 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -10,6 +10,7 @@
10#ifndef UCB1200_H 10#ifndef UCB1200_H
11#define UCB1200_H 11#define UCB1200_H
12 12
13#include <linux/device.h>
13#include <linux/mfd/mcp.h> 14#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8752dbbc6135..ad05ce60c1c9 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -17,6 +17,7 @@
17 17
18#define PHY_ID_KSZ8873MLL 0x000e7237 18#define PHY_ID_KSZ8873MLL 0x000e7237
19#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
20#define PHY_ID_KSZ9021RLRN 0x00221611
20#define PHY_ID_KS8737 0x00221720 21#define PHY_ID_KS8737 0x00221720
21#define PHY_ID_KSZ8021 0x00221555 22#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8031 0x00221556 23#define PHY_ID_KSZ8031 0x00221556
@@ -35,4 +36,9 @@
35/* struct phy_device dev_flags definitions */ 36/* struct phy_device dev_flags definitions */
36#define MICREL_PHY_50MHZ_CLK 0x00000001 37#define MICREL_PHY_50MHZ_CLK 0x00000001
37 38
39#define MICREL_KSZ9021_EXTREG_CTRL 0xB
40#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
41#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW 0x104
42#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW 0x105
43
38#endif /* _MICREL_PHY_H */ 44#endif /* _MICREL_PHY_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a405d3dc0f61..8d3c57fdf221 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -41,8 +41,6 @@ extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
42extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
43 unsigned long private, enum migrate_mode mode, int reason); 43 unsigned long private, enum migrate_mode mode, int reason);
44extern int migrate_huge_page(struct page *, new_page_t x,
45 unsigned long private, enum migrate_mode mode);
46 44
47extern int fail_migrate_page(struct address_space *, 45extern int fail_migrate_page(struct address_space *,
48 struct page *, struct page *); 46 struct page *, struct page *);
@@ -55,6 +53,9 @@ extern int migrate_vmas(struct mm_struct *mm,
55extern void migrate_page_copy(struct page *newpage, struct page *page); 53extern void migrate_page_copy(struct page *newpage, struct page *page);
56extern int migrate_huge_page_move_mapping(struct address_space *mapping, 54extern int migrate_huge_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page); 55 struct page *newpage, struct page *page);
56extern int migrate_page_move_mapping(struct address_space *mapping,
57 struct page *newpage, struct page *page,
58 struct buffer_head *head, enum migrate_mode mode);
58#else 59#else
59 60
60static inline void putback_lru_pages(struct list_head *l) {} 61static inline void putback_lru_pages(struct list_head *l) {}
@@ -62,9 +63,6 @@ static inline void putback_movable_pages(struct list_head *l) {}
62static inline int migrate_pages(struct list_head *l, new_page_t x, 63static inline int migrate_pages(struct list_head *l, new_page_t x,
63 unsigned long private, enum migrate_mode mode, int reason) 64 unsigned long private, enum migrate_mode mode, int reason)
64 { return -ENOSYS; } 65 { return -ENOSYS; }
65static inline int migrate_huge_page(struct page *page, new_page_t x,
66 unsigned long private, enum migrate_mode mode)
67 { return -ENOSYS; }
68 66
69static inline int migrate_prep(void) { return -ENOSYS; } 67static inline int migrate_prep(void) { return -ENOSYS; }
70static inline int migrate_prep_local(void) { return -ENOSYS; } 68static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 09c2300ddb37..cb358355ef43 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -45,6 +45,7 @@
45#define MAPPER_CTRL_MINOR 236 45#define MAPPER_CTRL_MINOR 236
46#define LOOP_CTRL_MINOR 237 46#define LOOP_CTRL_MINOR 237
47#define VHOST_NET_MINOR 238 47#define VHOST_NET_MINOR 238
48#define UHID_MINOR 239
48#define MISC_DYNAMIC_MINOR 255 49#define MISC_DYNAMIC_MINOR 255
49 50
50struct device; 51struct device;
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index bb1c8096a7eb..cd1fdf75103b 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -69,6 +69,7 @@ enum {
69 MLX4_CMD_SET_ICM_SIZE = 0xffd, 69 MLX4_CMD_SET_ICM_SIZE = 0xffd,
70 /*master notify fw on finish for slave's flr*/ 70 /*master notify fw on finish for slave's flr*/
71 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 71 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
72 MLX4_CMD_GET_OP_REQ = 0x59,
72 73
73 /* TPT commands */ 74 /* TPT commands */
74 MLX4_CMD_SW2HW_MPT = 0xd, 75 MLX4_CMD_SW2HW_MPT = 0xd,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 52c23a892bab..24ce6bdd540e 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -33,6 +33,7 @@
33#ifndef MLX4_DEVICE_H 33#ifndef MLX4_DEVICE_H
34#define MLX4_DEVICE_H 34#define MLX4_DEVICE_H
35 35
36#include <linux/if_ether.h>
36#include <linux/pci.h> 37#include <linux/pci.h>
37#include <linux/completion.h> 38#include <linux/completion.h>
38#include <linux/radix-tree.h> 39#include <linux/radix-tree.h>
@@ -207,6 +208,7 @@ enum mlx4_event {
207 MLX4_EVENT_TYPE_CMD = 0x0a, 208 MLX4_EVENT_TYPE_CMD = 0x0a,
208 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, 209 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
209 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, 210 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
211 MLX4_EVENT_TYPE_OP_REQUIRED = 0x1a,
210 MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, 212 MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b,
211 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, 213 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
212 MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d, 214 MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d,
@@ -619,7 +621,7 @@ struct mlx4_eth_av {
619 u8 dgid[16]; 621 u8 dgid[16];
620 u32 reserved4[2]; 622 u32 reserved4[2];
621 __be16 vlan; 623 __be16 vlan;
622 u8 mac[6]; 624 u8 mac[ETH_ALEN];
623}; 625};
624 626
625union mlx4_ext_av { 627union mlx4_ext_av {
@@ -913,10 +915,10 @@ enum mlx4_net_trans_promisc_mode {
913}; 915};
914 916
915struct mlx4_spec_eth { 917struct mlx4_spec_eth {
916 u8 dst_mac[6]; 918 u8 dst_mac[ETH_ALEN];
917 u8 dst_mac_msk[6]; 919 u8 dst_mac_msk[ETH_ALEN];
918 u8 src_mac[6]; 920 u8 src_mac[ETH_ALEN];
919 u8 src_mac_msk[6]; 921 u8 src_mac_msk[ETH_ALEN];
920 u8 ether_type_enable; 922 u8 ether_type_enable;
921 __be16 ether_type; 923 __be16 ether_type;
922 __be16 vlan_id_msk; 924 __be16 vlan_id_msk;
@@ -1052,11 +1054,6 @@ struct _rule_hw {
1052 }; 1054 };
1053}; 1055};
1054 1056
1055/* translating DMFS verbs sniffer rule to the FW API would need two reg IDs */
1056struct mlx4_flow_handle {
1057 u64 reg_id[2];
1058};
1059
1060int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn, 1057int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, u32 qpn,
1061 enum mlx4_net_trans_promisc_mode mode); 1058 enum mlx4_net_trans_promisc_mode mode);
1062int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port, 1059int mlx4_flow_steer_promisc_remove(struct mlx4_dev *dev, u8 port,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 262deac02c9e..6d351473c292 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -34,6 +34,7 @@
34#define MLX4_QP_H 34#define MLX4_QP_H
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/if_ether.h>
37 38
38#include <linux/mlx4/device.h> 39#include <linux/mlx4/device.h>
39 40
@@ -143,7 +144,7 @@ struct mlx4_qp_path {
143 u8 feup; 144 u8 feup;
144 u8 fvl_rx; 145 u8 fvl_rx;
145 u8 reserved4[2]; 146 u8 reserved4[2];
146 u8 dmac[6]; 147 u8 dmac[ETH_ALEN];
147}; 148};
148 149
149enum { /* fl */ 150enum { /* fl */
@@ -318,7 +319,7 @@ struct mlx4_wqe_datagram_seg {
318 __be32 dqpn; 319 __be32 dqpn;
319 __be32 qkey; 320 __be32 qkey;
320 __be16 vlan; 321 __be16 vlan;
321 u8 mac[6]; 322 u8 mac[ETH_ALEN];
322}; 323};
323 324
324struct mlx4_wqe_lso_seg { 325struct mlx4_wqe_lso_seg {
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 68029b30c3dc..5eb4e31af22b 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -181,7 +181,7 @@ enum {
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39, 181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41, 183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46, 184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
185}; 185};
186 186
187enum { 187enum {
@@ -417,7 +417,7 @@ struct mlx5_init_seg {
417 struct health_buffer health; 417 struct health_buffer health;
418 __be32 rsvd2[884]; 418 __be32 rsvd2[884];
419 __be32 health_counter; 419 __be32 health_counter;
420 __be32 rsvd3[1023]; 420 __be32 rsvd3[1019];
421 __be64 ieee1588_clk; 421 __be64 ieee1588_clk;
422 __be32 ieee1588_clk_type; 422 __be32 ieee1588_clk_type;
423 __be32 clr_intx; 423 __be32 clr_intx;
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 8888381fc150..6b8c496572c8 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -82,7 +82,7 @@ enum {
82}; 82};
83 83
84enum { 84enum {
85 MLX5_MAX_EQ_NAME = 20 85 MLX5_MAX_EQ_NAME = 32
86}; 86};
87 87
88enum { 88enum {
@@ -747,8 +747,7 @@ static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
747 747
748enum { 748enum {
749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0, 749 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
750 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1, 750 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 1,
751 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
752}; 751};
753 752
754enum { 753enum {
@@ -758,7 +757,6 @@ enum {
758struct mlx5_profile { 757struct mlx5_profile {
759 u64 mask; 758 u64 mask;
760 u32 log_max_qp; 759 u32 log_max_qp;
761 int cmdif_csum;
762 struct { 760 struct {
763 int size; 761 int size;
764 int limit; 762 int limit;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f0224608d15e..8b6e55ee8855 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -115,6 +115,12 @@ extern unsigned int kobjsize(const void *objp);
115#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */ 115#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
116#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */ 116#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
117 117
118#ifdef CONFIG_MEM_SOFT_DIRTY
119# define VM_SOFTDIRTY 0x08000000 /* Not soft dirty clean area */
120#else
121# define VM_SOFTDIRTY 0
122#endif
123
118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 124#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
119#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */ 125#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
120#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */ 126#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
@@ -170,6 +176,7 @@ extern pgprot_t protection_map[16];
170#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ 176#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
171#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */ 177#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */
172#define FAULT_FLAG_TRIED 0x40 /* second try */ 178#define FAULT_FLAG_TRIED 0x40 /* second try */
179#define FAULT_FLAG_USER 0x80 /* The fault originated in userspace */
173 180
174/* 181/*
175 * vm_fault is filled by the the pagefault handler and passed to the vma's 182 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -489,20 +496,6 @@ static inline int compound_order(struct page *page)
489 return (unsigned long)page[1].lru.prev; 496 return (unsigned long)page[1].lru.prev;
490} 497}
491 498
492static inline int compound_trans_order(struct page *page)
493{
494 int order;
495 unsigned long flags;
496
497 if (!PageHead(page))
498 return 0;
499
500 flags = compound_lock_irqsave(page);
501 order = compound_order(page);
502 compound_unlock_irqrestore(page, flags);
503 return order;
504}
505
506static inline void set_compound_order(struct page *page, unsigned long order) 499static inline void set_compound_order(struct page *page, unsigned long order)
507{ 500{
508 page[1].lru.prev = (void *)order; 501 page[1].lru.prev = (void *)order;
@@ -637,12 +630,12 @@ static inline enum zone_type page_zonenum(const struct page *page)
637#endif 630#endif
638 631
639/* 632/*
640 * The identification function is only used by the buddy allocator for 633 * The identification function is mainly used by the buddy allocator for
641 * determining if two pages could be buddies. We are not really 634 * determining if two pages could be buddies. We are not really identifying
642 * identifying a zone since we could be using a the section number 635 * the zone since we could be using the section number id if we do not have
643 * id if we have not node id available in page flags. 636 * node id available in page flags.
644 * We guarantee only that it will return the same value for two 637 * We only guarantee that it will return the same value for two combinable
645 * combinable pages in a zone. 638 * pages in a zone.
646 */ 639 */
647static inline int page_zone_id(struct page *page) 640static inline int page_zone_id(struct page *page)
648{ 641{
@@ -884,11 +877,12 @@ static inline int page_mapped(struct page *page)
884#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ 877#define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */
885#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ 878#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
886#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */ 879#define VM_FAULT_RETRY 0x0400 /* ->fault blocked, must retry */
880#define VM_FAULT_FALLBACK 0x0800 /* huge page fault failed, fall back to small */
887 881
888#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ 882#define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */
889 883
890#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \ 884#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \
891 VM_FAULT_HWPOISON_LARGE) 885 VM_FAULT_FALLBACK | VM_FAULT_HWPOISON_LARGE)
892 886
893/* Encode hstate index for a hwpoisoned large page */ 887/* Encode hstate index for a hwpoisoned large page */
894#define VM_FAULT_SET_HINDEX(x) ((x) << 12) 888#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
@@ -992,7 +986,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
992 unmap_mapping_range(mapping, holebegin, holelen, 0); 986 unmap_mapping_range(mapping, holebegin, holelen, 0);
993} 987}
994 988
995extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 989extern void truncate_pagecache(struct inode *inode, loff_t new);
996extern void truncate_setsize(struct inode *inode, loff_t newsize); 990extern void truncate_setsize(struct inode *inode, loff_t newsize);
997void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 991void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
998int truncate_inode_page(struct address_space *mapping, struct page *page); 992int truncate_inode_page(struct address_space *mapping, struct page *page);
@@ -1798,6 +1792,7 @@ enum mf_flags {
1798 MF_COUNT_INCREASED = 1 << 0, 1792 MF_COUNT_INCREASED = 1 << 0,
1799 MF_ACTION_REQUIRED = 1 << 1, 1793 MF_ACTION_REQUIRED = 1 << 1,
1800 MF_MUST_KILL = 1 << 2, 1794 MF_MUST_KILL = 1 << 2,
1795 MF_SOFT_OFFLINE = 1 << 3,
1801}; 1796};
1802extern int memory_failure(unsigned long pfn, int trapno, int flags); 1797extern int memory_failure(unsigned long pfn, int trapno, int flags);
1803extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); 1798extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 1397ccf81e91..cf55945c83fb 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -2,6 +2,7 @@
2#define LINUX_MM_INLINE_H 2#define LINUX_MM_INLINE_H
3 3
4#include <linux/huge_mm.h> 4#include <linux/huge_mm.h>
5#include <linux/swap.h>
5 6
6/** 7/**
7 * page_is_file_cache - should the page be on a file LRU or anon LRU? 8 * page_is_file_cache - should the page be on a file LRU or anon LRU?
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index faf4b7c1ad12..d9851eeb6e1d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -322,6 +322,7 @@ struct mm_rss_stat {
322 atomic_long_t count[NR_MM_COUNTERS]; 322 atomic_long_t count[NR_MM_COUNTERS];
323}; 323};
324 324
325struct kioctx_table;
325struct mm_struct { 326struct mm_struct {
326 struct vm_area_struct * mmap; /* list of VMAs */ 327 struct vm_area_struct * mmap; /* list of VMAs */
327 struct rb_root mm_rb; 328 struct rb_root mm_rb;
@@ -383,8 +384,8 @@ struct mm_struct {
383 384
384 struct core_state *core_state; /* coredumping support */ 385 struct core_state *core_state; /* coredumping support */
385#ifdef CONFIG_AIO 386#ifdef CONFIG_AIO
386 spinlock_t ioctx_lock; 387 spinlock_t ioctx_lock;
387 struct hlist_head ioctx_list; 388 struct kioctx_table __rcu *ioctx_table;
388#endif 389#endif
389#ifdef CONFIG_MM_OWNER 390#ifdef CONFIG_MM_OWNER
390 /* 391 /*
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 443243b241d5..da51bec578c3 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host)
208 __mmc_claim_host(host, NULL); 208 __mmc_claim_host(host, NULL);
209} 209}
210 210
211struct device_node;
211extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); 212extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
213extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
212 214
213#endif /* LINUX_MMC_CORE_H */ 215#endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e3c6a74d980a..3e781b8c0be7 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -171,6 +171,7 @@ struct sdhci_host {
171 unsigned int ocr_avail_sdio; /* OCR bit masks */ 171 unsigned int ocr_avail_sdio; /* OCR bit masks */
172 unsigned int ocr_avail_sd; 172 unsigned int ocr_avail_sd;
173 unsigned int ocr_avail_mmc; 173 unsigned int ocr_avail_mmc;
174 u32 ocr_mask; /* available voltages */
174 175
175 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ 176 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
176 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ 177 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index e7d5dd67bb74..ccd8fb2cad52 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -16,7 +16,6 @@
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sh_dma.h>
20 19
21/* 20/*
22 * MMCIF : CE_CLK_CTRL [19:16] 21 * MMCIF : CE_CLK_CTRL [19:16]
@@ -33,12 +32,12 @@
33 */ 32 */
34 33
35struct sh_mmcif_plat_data { 34struct sh_mmcif_plat_data {
36 void (*set_pwr)(struct platform_device *pdev, int state);
37 void (*down_pwr)(struct platform_device *pdev);
38 int (*get_cd)(struct platform_device *pdef); 35 int (*get_cd)(struct platform_device *pdef);
39 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ 36 unsigned int slave_id_tx; /* embedded slave_id_[tr]x */
40 unsigned int slave_id_rx; 37 unsigned int slave_id_rx;
41 bool use_cd_gpio : 1; 38 bool use_cd_gpio : 1;
39 bool ccs_unsupported : 1;
40 bool clk_ctrl2_present : 1;
42 unsigned int cd_gpio; 41 unsigned int cd_gpio;
43 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 42 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
44 unsigned long caps; 43 unsigned long caps;
@@ -62,6 +61,7 @@ struct sh_mmcif_plat_data {
62#define MMCIF_CE_INT_MASK 0x00000044 61#define MMCIF_CE_INT_MASK 0x00000044
63#define MMCIF_CE_HOST_STS1 0x00000048 62#define MMCIF_CE_HOST_STS1 0x00000048
64#define MMCIF_CE_HOST_STS2 0x0000004C 63#define MMCIF_CE_HOST_STS2 0x0000004C
64#define MMCIF_CE_CLK_CTRL2 0x00000070
65#define MMCIF_CE_VERSION 0x0000007C 65#define MMCIF_CE_VERSION 0x0000007C
66 66
67/* CE_BUF_ACC */ 67/* CE_BUF_ACC */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index b76bcf0621f6..68927ae50845 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -25,8 +25,6 @@ struct sh_mobile_sdhi_info {
25 unsigned long tmio_caps2; 25 unsigned long tmio_caps2;
26 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
27 unsigned int cd_gpio; 27 unsigned int cd_gpio;
28 void (*set_pwr)(struct platform_device *pdev, int state);
29 int (*get_cd)(struct platform_device *pdev);
30 28
31 /* callbacks for board specific setup code */ 29 /* callbacks for board specific setup code */
32 int (*init)(struct platform_device *pdev, 30 int (*init)(struct platform_device *pdev,
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index 7d88d27bfafa..b0c73e4cacea 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -18,7 +18,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio);
18void mmc_gpio_free_ro(struct mmc_host *host); 18void mmc_gpio_free_ro(struct mmc_host *host);
19 19
20int mmc_gpio_get_cd(struct mmc_host *host); 20int mmc_gpio_get_cd(struct mmc_host *host);
21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio); 21int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
22 unsigned int debounce);
22void mmc_gpio_free_cd(struct mmc_host *host); 23void mmc_gpio_free_cd(struct mmc_host *host);
23 24
24#endif 25#endif
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index af4a3b77a8de..bd791e452ad7 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -105,6 +105,7 @@ struct zone_padding {
105enum zone_stat_item { 105enum zone_stat_item {
106 /* First 128 byte cacheline (assuming 64 bit words) */ 106 /* First 128 byte cacheline (assuming 64 bit words) */
107 NR_FREE_PAGES, 107 NR_FREE_PAGES,
108 NR_ALLOC_BATCH,
108 NR_LRU_BASE, 109 NR_LRU_BASE,
109 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */ 110 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */
110 NR_ACTIVE_ANON, /* " " " " " */ 111 NR_ACTIVE_ANON, /* " " " " " */
@@ -352,7 +353,6 @@ struct zone {
352 * free areas of different sizes 353 * free areas of different sizes
353 */ 354 */
354 spinlock_t lock; 355 spinlock_t lock;
355 int all_unreclaimable; /* All pages pinned */
356#if defined CONFIG_COMPACTION || defined CONFIG_CMA 356#if defined CONFIG_COMPACTION || defined CONFIG_CMA
357 /* Set to true when the PG_migrate_skip bits should be cleared */ 357 /* Set to true when the PG_migrate_skip bits should be cleared */
358 bool compact_blockskip_flush; 358 bool compact_blockskip_flush;
diff --git a/include/linux/module.h b/include/linux/module.h
index 46f1ea01e6f6..05f2447f8c15 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -42,6 +42,7 @@ struct module_kobject {
42 struct module *mod; 42 struct module *mod;
43 struct kobject *drivers_dir; 43 struct kobject *drivers_dir;
44 struct module_param_attrs *mp; 44 struct module_param_attrs *mp;
45 struct completion *kobj_completion;
45}; 46};
46 47
47struct module_attribute { 48struct module_attribute {
@@ -97,6 +98,11 @@ extern const struct gtype##_id __mod_##gtype##_table \
97/* For userspace: you can also call me... */ 98/* For userspace: you can also call me... */
98#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) 99#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
99 100
101/* Soft module dependencies. See man modprobe.d for details.
102 * Example: MODULE_SOFTDEP("pre: module-foo module-bar post: module-baz")
103 */
104#define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
105
100/* 106/*
101 * The following license idents are currently accepted as indicating free 107 * The following license idents are currently accepted as indicating free
102 * software modules 108 * software modules
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 27d9da3f86ff..c3eb102a9cc8 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -36,7 +36,18 @@ static const char __UNIQUE_ID(name)[] \
36 36
37struct kernel_param; 37struct kernel_param;
38 38
39/*
40 * Flags available for kernel_param_ops
41 *
42 * NOARG - the parameter allows for no argument (foo instead of foo=1)
43 */
44enum {
45 KERNEL_PARAM_FL_NOARG = (1 << 0)
46};
47
39struct kernel_param_ops { 48struct kernel_param_ops {
49 /* How the ops should behave */
50 unsigned int flags;
40 /* Returns 0, or -errno. arg is in kp->arg. */ 51 /* Returns 0, or -errno. arg is in kp->arg. */
41 int (*set)(const char *val, const struct kernel_param *kp); 52 int (*set)(const char *val, const struct kernel_param *kp);
42 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 53 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
@@ -187,7 +198,7 @@ struct kparam_array
187/* Obsolete - use module_param_cb() */ 198/* Obsolete - use module_param_cb() */
188#define module_param_call(name, set, get, arg, perm) \ 199#define module_param_call(name, set, get, arg, perm) \
189 static struct kernel_param_ops __param_ops_##name = \ 200 static struct kernel_param_ops __param_ops_##name = \
190 { (void *)set, (void *)get }; \ 201 { 0, (void *)set, (void *)get }; \
191 __module_param_call(MODULE_PARAM_PREFIX, \ 202 __module_param_call(MODULE_PARAM_PREFIX, \
192 name, &__param_ops_##name, arg, \ 203 name, &__param_ops_##name, arg, \
193 (perm) + sizeof(__check_old_set_param(set))*0, -1) 204 (perm) + sizeof(__check_old_set_param(set))*0, -1)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 73005f9957ea..38cd98f112a0 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -48,6 +48,7 @@ struct mnt_namespace;
48#define MNT_INTERNAL 0x4000 48#define MNT_INTERNAL 0x4000
49 49
50#define MNT_LOCK_READONLY 0x400000 50#define MNT_LOCK_READONLY 0x400000
51#define MNT_LOCKED 0x800000
51 52
52struct vfsmount { 53struct vfsmount {
53 struct dentry *mnt_root; /* root of the mounted tree */ 54 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ee66f3a12fb6..b17ead818aec 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -51,12 +51,31 @@ struct msi_desc {
51}; 51};
52 52
53/* 53/*
54 * The arch hook for setup up msi irqs 54 * The arch hooks to setup up msi irqs. Those functions are
55 * implemented as weak symbols so that they /can/ be overriden by
56 * architecture specific code if needed.
55 */ 57 */
56int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 58int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
57void arch_teardown_msi_irq(unsigned int irq); 59void arch_teardown_msi_irq(unsigned int irq);
58int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 60int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
59void arch_teardown_msi_irqs(struct pci_dev *dev); 61void arch_teardown_msi_irqs(struct pci_dev *dev);
60int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 62int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
63void arch_restore_msi_irqs(struct pci_dev *dev, int irq);
64
65void default_teardown_msi_irqs(struct pci_dev *dev);
66void default_restore_msi_irqs(struct pci_dev *dev, int irq);
67
68struct msi_chip {
69 struct module *owner;
70 struct device *dev;
71 struct device_node *of_node;
72 struct list_head list;
73
74 int (*setup_irq)(struct msi_chip *chip, struct pci_dev *dev,
75 struct msi_desc *desc);
76 void (*teardown_irq)(struct msi_chip *chip, unsigned int irq);
77 int (*check_device)(struct msi_chip *chip, struct pci_dev *dev,
78 int nvec, int type);
79};
61 80
62#endif /* LINUX_MSI_H */ 81#endif /* LINUX_MSI_H */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 211ff67e8b0d..95fc482cef36 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -93,8 +93,6 @@ struct nand_bbt_descr {
93#define NAND_BBT_CREATE_EMPTY 0x00000400 93#define NAND_BBT_CREATE_EMPTY 0x00000400
94/* Search good / bad pattern through all pages of a block */ 94/* Search good / bad pattern through all pages of a block */
95#define NAND_BBT_SCANALLPAGES 0x00000800 95#define NAND_BBT_SCANALLPAGES 0x00000800
96/* Scan block empty during good / bad block scan */
97#define NAND_BBT_SCANEMPTY 0x00001000
98/* Write bbt if neccecary */ 96/* Write bbt if neccecary */
99#define NAND_BBT_WRITE 0x00002000 97#define NAND_BBT_WRITE 0x00002000
100/* Read and write back block contents when writing bbt */ 98/* Read and write back block contents when writing bbt */
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index d6ed61ef451d..c8be32e9fc49 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -137,6 +137,7 @@ enum access_mode {
137 137
138/** 138/**
139 * fsmc_nand_platform_data - platform specific NAND controller config 139 * fsmc_nand_platform_data - platform specific NAND controller config
140 * @nand_timings: timing setup for the physical NAND interface
140 * @partitions: partition table for the platform, use a default fallback 141 * @partitions: partition table for the platform, use a default fallback
141 * if this is NULL 142 * if this is NULL
142 * @nr_partitions: the number of partitions in the previous entry 143 * @nr_partitions: the number of partitions in the previous entry
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a5cf4e8d6818..f9bfe526d310 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -173,6 +173,9 @@ struct mtd_info {
173 /* ECC layout structure pointer - read only! */ 173 /* ECC layout structure pointer - read only! */
174 struct nand_ecclayout *ecclayout; 174 struct nand_ecclayout *ecclayout;
175 175
176 /* the ecc step size. */
177 unsigned int ecc_step_size;
178
176 /* max number of correctible bit errors per ecc step */ 179 /* max number of correctible bit errors per ecc step */
177 unsigned int ecc_strength; 180 unsigned int ecc_strength;
178 181
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ab6363443ce8..ac8e89d5a792 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
56 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly. 57 * adjust this accordingly.
58 */ 58 */
59#define NAND_MAX_OOBSIZE 640 59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192 60#define NAND_MAX_PAGESIZE 8192
61 61
62/* 62/*
@@ -202,6 +202,10 @@ typedef enum {
202/* Keep gcc happy */ 202/* Keep gcc happy */
203struct nand_chip; 203struct nand_chip;
204 204
205/* ONFI features */
206#define ONFI_FEATURE_16_BIT_BUS (1 << 0)
207#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
208
205/* ONFI timing mode, used in both asynchronous and synchronous mode */ 209/* ONFI timing mode, used in both asynchronous and synchronous mode */
206#define ONFI_TIMING_MODE_0 (1 << 0) 210#define ONFI_TIMING_MODE_0 (1 << 0)
207#define ONFI_TIMING_MODE_1 (1 << 1) 211#define ONFI_TIMING_MODE_1 (1 << 1)
@@ -217,6 +221,9 @@ struct nand_chip;
217/* ONFI subfeature parameters length */ 221/* ONFI subfeature parameters length */
218#define ONFI_SUBFEATURE_PARAM_LEN 4 222#define ONFI_SUBFEATURE_PARAM_LEN 4
219 223
224/* ONFI optional commands SET/GET FEATURES supported? */
225#define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2)
226
220struct nand_onfi_params { 227struct nand_onfi_params {
221 /* rev info and features block */ 228 /* rev info and features block */
222 /* 'O' 'N' 'F' 'I' */ 229 /* 'O' 'N' 'F' 'I' */
@@ -224,7 +231,10 @@ struct nand_onfi_params {
224 __le16 revision; 231 __le16 revision;
225 __le16 features; 232 __le16 features;
226 __le16 opt_cmd; 233 __le16 opt_cmd;
227 u8 reserved[22]; 234 u8 reserved0[2];
235 __le16 ext_param_page_length; /* since ONFI 2.1 */
236 u8 num_of_param_pages; /* since ONFI 2.1 */
237 u8 reserved1[17];
228 238
229 /* manufacturer information block */ 239 /* manufacturer information block */
230 char manufacturer[12]; 240 char manufacturer[12];
@@ -281,6 +291,40 @@ struct nand_onfi_params {
281 291
282#define ONFI_CRC_BASE 0x4F4E 292#define ONFI_CRC_BASE 0x4F4E
283 293
294/* Extended ECC information Block Definition (since ONFI 2.1) */
295struct onfi_ext_ecc_info {
296 u8 ecc_bits;
297 u8 codeword_size;
298 __le16 bb_per_lun;
299 __le16 block_endurance;
300 u8 reserved[2];
301} __packed;
302
303#define ONFI_SECTION_TYPE_0 0 /* Unused section. */
304#define ONFI_SECTION_TYPE_1 1 /* for additional sections. */
305#define ONFI_SECTION_TYPE_2 2 /* for ECC information. */
306struct onfi_ext_section {
307 u8 type;
308 u8 length;
309} __packed;
310
311#define ONFI_EXT_SECTION_MAX 8
312
313/* Extended Parameter Page Definition (since ONFI 2.1) */
314struct onfi_ext_param_page {
315 __le16 crc;
316 u8 sig[4]; /* 'E' 'P' 'P' 'S' */
317 u8 reserved0[10];
318 struct onfi_ext_section sections[ONFI_EXT_SECTION_MAX];
319
320 /*
321 * The actual size of the Extended Parameter Page is in
322 * @ext_param_page_length of nand_onfi_params{}.
323 * The following are the variable length sections.
324 * So we do not add any fields below. Please see the ONFI spec.
325 */
326} __packed;
327
284/** 328/**
285 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 329 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
286 * @lock: protection lock 330 * @lock: protection lock
@@ -390,8 +434,8 @@ struct nand_buffers {
390 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 434 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
391 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 435 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
392 * @select_chip: [REPLACEABLE] select chip nr 436 * @select_chip: [REPLACEABLE] select chip nr
393 * @block_bad: [REPLACEABLE] check, if the block is bad 437 * @block_bad: [REPLACEABLE] check if a block is bad, using OOB markers
394 * @block_markbad: [REPLACEABLE] mark the block bad 438 * @block_markbad: [REPLACEABLE] mark a block bad
395 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling 439 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling
396 * ALE/CLE/nCE. Also used to write command and address 440 * ALE/CLE/nCE. Also used to write command and address
397 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting 441 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting
@@ -434,6 +478,12 @@ struct nand_buffers {
434 * bad block marker position; i.e., BBM == 11110111b is 478 * bad block marker position; i.e., BBM == 11110111b is
435 * not bad when badblockbits == 7 479 * not bad when badblockbits == 7
436 * @cellinfo: [INTERN] MLC/multichip data from chip ident 480 * @cellinfo: [INTERN] MLC/multichip data from chip ident
481 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet.
482 * Minimum amount of bit errors per @ecc_step_ds guaranteed
483 * to be correctable. If unknown, set to zero.
484 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
485 * also from the datasheet. It is the recommended ECC step
486 * size, if known; if unknown, set to zero.
437 * @numchips: [INTERN] number of physical chips 487 * @numchips: [INTERN] number of physical chips
438 * @chipsize: [INTERN] the size of one chip for multichip arrays 488 * @chipsize: [INTERN] the size of one chip for multichip arrays
439 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 489 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -510,6 +560,8 @@ struct nand_chip {
510 unsigned int pagebuf_bitflips; 560 unsigned int pagebuf_bitflips;
511 int subpagesize; 561 int subpagesize;
512 uint8_t cellinfo; 562 uint8_t cellinfo;
563 uint16_t ecc_strength_ds;
564 uint16_t ecc_step_ds;
513 int badblockpos; 565 int badblockpos;
514 int badblockbits; 566 int badblockbits;
515 567
@@ -576,6 +628,11 @@ struct nand_chip {
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ 628 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) } 629 .options = (opts) }
578 630
631#define NAND_ECC_INFO(_strength, _step) \
632 { .strength_ds = (_strength), .step_ds = (_step) }
633#define NAND_ECC_STRENGTH(type) ((type)->ecc.strength_ds)
634#define NAND_ECC_STEP(type) ((type)->ecc.step_ds)
635
579/** 636/**
580 * struct nand_flash_dev - NAND Flash Device ID Structure 637 * struct nand_flash_dev - NAND Flash Device ID Structure
581 * @name: a human-readable name of the NAND chip 638 * @name: a human-readable name of the NAND chip
@@ -593,6 +650,12 @@ struct nand_chip {
593 * @options: stores various chip bit options 650 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id. 651 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size 652 * @oobsize: OOB size
653 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
654 * @ecc_strength_ds in nand_chip{}.
655 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
656 * @ecc_step_ds in nand_chip{}, also from the datasheet.
657 * For example, the "4bit ECC for each 512Byte" can be set with
658 * NAND_ECC_INFO(4, 512).
596 */ 659 */
597struct nand_flash_dev { 660struct nand_flash_dev {
598 char *name; 661 char *name;
@@ -609,6 +672,10 @@ struct nand_flash_dev {
609 unsigned int options; 672 unsigned int options;
610 uint16_t id_len; 673 uint16_t id_len;
611 uint16_t oobsize; 674 uint16_t oobsize;
675 struct {
676 uint16_t strength_ds;
677 uint16_t step_ds;
678 } ecc;
612}; 679};
613 680
614/** 681/**
@@ -625,8 +692,8 @@ extern struct nand_flash_dev nand_flash_ids[];
625extern struct nand_manufacturers nand_manuf_ids[]; 692extern struct nand_manufacturers nand_manuf_ids[];
626 693
627extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 694extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
628extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
629extern int nand_default_bbt(struct mtd_info *mtd); 695extern int nand_default_bbt(struct mtd_info *mtd);
696extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
630extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 697extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
631extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 698extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
632 int allowbbt); 699 int allowbbt);
@@ -708,6 +775,12 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
708 return chip->priv; 775 return chip->priv;
709} 776}
710 777
778/* return the supported features. */
779static inline int onfi_feature(struct nand_chip *chip)
780{
781 return chip->onfi_version ? le16_to_cpu(chip->onfi_params.features) : 0;
782}
783
711/* return the supported asynchronous timing mode. */ 784/* return the supported asynchronous timing mode. */
712static inline int onfi_get_async_timing_mode(struct nand_chip *chip) 785static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
713{ 786{
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index ccd4260834c5..bab49da8a0f0 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -15,8 +15,8 @@
15#include <linux/spinlock_types.h> 15#include <linux/spinlock_types.h>
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <linux/lockdep.h> 17#include <linux/lockdep.h>
18
19#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <asm/processor.h>
20 20
21/* 21/*
22 * Simple, straightforward mutexes with strict semantics: 22 * Simple, straightforward mutexes with strict semantics:
@@ -175,8 +175,8 @@ extern void mutex_unlock(struct mutex *lock);
175 175
176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
177 177
178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef arch_mutex_cpu_relax
179#define arch_mutex_cpu_relax() cpu_relax() 179# define arch_mutex_cpu_relax() cpu_relax()
180#endif 180#endif
181 181
182#endif 182#endif
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 6e8215b15998..61a0da38d0cb 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -6,6 +6,7 @@
6#define __LINUX_MV643XX_ETH_H 6#define __LINUX_MV643XX_ETH_H
7 7
8#include <linux/mbus.h> 8#include <linux/mbus.h>
9#include <linux/if_ether.h>
9 10
10#define MV643XX_ETH_SHARED_NAME "mv643xx_eth" 11#define MV643XX_ETH_SHARED_NAME "mv643xx_eth"
11#define MV643XX_ETH_NAME "mv643xx_eth_port" 12#define MV643XX_ETH_NAME "mv643xx_eth_port"
@@ -48,7 +49,7 @@ struct mv643xx_eth_platform_data {
48 * Use this MAC address if it is valid, overriding the 49 * Use this MAC address if it is valid, overriding the
49 * address that is already in the hardware. 50 * address that is already in the hardware.
50 */ 51 */
51 u8 mac_addr[6]; 52 u8 mac_addr[ETH_ALEN];
52 53
53 /* 54 /*
54 * If speed is 0, autonegotiation is enabled. 55 * If speed is 0, autonegotiation is enabled.
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 5a5ff57ceed4..8e47bc7a1665 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -70,8 +70,7 @@ extern struct dentry *kern_path_create(int, const char *, struct path *, unsigne
70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int); 70extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
71extern void done_path_create(struct path *, struct dentry *); 71extern void done_path_create(struct path *, struct dentry *);
72extern struct dentry *kern_path_locked(const char *, struct path *); 72extern struct dentry *kern_path_locked(const char *, struct path *);
73extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 73extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
74 const char *, unsigned int, struct path *);
75 74
76extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 75extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
77 76
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9a4156845e93..25f5d2d11e7c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -728,6 +728,16 @@ struct netdev_fcoe_hbainfo {
728}; 728};
729#endif 729#endif
730 730
731#define MAX_PHYS_PORT_ID_LEN 32
732
733/* This structure holds a unique identifier to identify the
734 * physical port used by a netdevice.
735 */
736struct netdev_phys_port_id {
737 unsigned char id[MAX_PHYS_PORT_ID_LEN];
738 unsigned char id_len;
739};
740
731/* 741/*
732 * This structure defines the management hooks for network devices. 742 * This structure defines the management hooks for network devices.
733 * The following hooks can be defined; unless noted otherwise, they are 743 * The following hooks can be defined; unless noted otherwise, they are
@@ -932,6 +942,25 @@ struct netdev_fcoe_hbainfo {
932 * that determine carrier state from physical hardware properties (eg 942 * that determine carrier state from physical hardware properties (eg
933 * network cables) or protocol-dependent mechanisms (eg 943 * network cables) or protocol-dependent mechanisms (eg
934 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. 944 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
945 *
946 * int (*ndo_get_phys_port_id)(struct net_device *dev,
947 * struct netdev_phys_port_id *ppid);
948 * Called to get ID of physical port of this device. If driver does
949 * not implement this, it is assumed that the hw is not able to have
950 * multiple net devices on single physical port.
951 *
952 * void (*ndo_add_vxlan_port)(struct net_device *dev,
953 * sa_family_t sa_family, __be16 port);
954 * Called by vxlan to notiy a driver about the UDP port and socket
955 * address family that vxlan is listnening to. It is called only when
956 * a new port starts listening. The operation is protected by the
957 * vxlan_net->sock_lock.
958 *
959 * void (*ndo_del_vxlan_port)(struct net_device *dev,
960 * sa_family_t sa_family, __be16 port);
961 * Called by vxlan to notify the driver about a UDP port and socket
962 * address family that vxlan is not listening to anymore. The operation
963 * is protected by the vxlan_net->sock_lock.
935 */ 964 */
936struct net_device_ops { 965struct net_device_ops {
937 int (*ndo_init)(struct net_device *dev); 966 int (*ndo_init)(struct net_device *dev);
@@ -1060,6 +1089,14 @@ struct net_device_ops {
1060 struct nlmsghdr *nlh); 1089 struct nlmsghdr *nlh);
1061 int (*ndo_change_carrier)(struct net_device *dev, 1090 int (*ndo_change_carrier)(struct net_device *dev,
1062 bool new_carrier); 1091 bool new_carrier);
1092 int (*ndo_get_phys_port_id)(struct net_device *dev,
1093 struct netdev_phys_port_id *ppid);
1094 void (*ndo_add_vxlan_port)(struct net_device *dev,
1095 sa_family_t sa_family,
1096 __be16 port);
1097 void (*ndo_del_vxlan_port)(struct net_device *dev,
1098 sa_family_t sa_family,
1099 __be16 port);
1063}; 1100};
1064 1101
1065/* 1102/*
@@ -1107,6 +1144,7 @@ struct net_device {
1107 struct list_head napi_list; 1144 struct list_head napi_list;
1108 struct list_head unreg_list; 1145 struct list_head unreg_list;
1109 struct list_head upper_dev_list; /* List of upper devices */ 1146 struct list_head upper_dev_list; /* List of upper devices */
1147 struct list_head lower_dev_list;
1110 1148
1111 1149
1112 /* currently active device features */ 1150 /* currently active device features */
@@ -1633,6 +1671,7 @@ struct packet_offload {
1633#define NETDEV_NOTIFY_PEERS 0x0013 1671#define NETDEV_NOTIFY_PEERS 0x0013
1634#define NETDEV_JOIN 0x0014 1672#define NETDEV_JOIN 0x0014
1635#define NETDEV_CHANGEUPPER 0x0015 1673#define NETDEV_CHANGEUPPER 0x0015
1674#define NETDEV_RESEND_IGMP 0x0016
1636 1675
1637extern int register_netdevice_notifier(struct notifier_block *nb); 1676extern int register_netdevice_notifier(struct notifier_block *nb);
1638extern int unregister_netdevice_notifier(struct notifier_block *nb); 1677extern int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -1665,9 +1704,6 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1665 1704
1666extern rwlock_t dev_base_lock; /* Device list lock */ 1705extern rwlock_t dev_base_lock; /* Device list lock */
1667 1706
1668extern seqcount_t devnet_rename_seq; /* Device rename seq */
1669
1670
1671#define for_each_netdev(net, d) \ 1707#define for_each_netdev(net, d) \
1672 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1708 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
1673#define for_each_netdev_reverse(net, d) \ 1709#define for_each_netdev_reverse(net, d) \
@@ -2065,6 +2101,15 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2065#endif 2101#endif
2066} 2102}
2067 2103
2104/**
2105 * netdev_sent_queue - report the number of bytes queued to hardware
2106 * @dev: network device
2107 * @bytes: number of bytes queued to the hardware device queue
2108 *
2109 * Report the number of bytes queued for sending/completion to the network
2110 * device hardware queue. @bytes should be a good approximation and should
2111 * exactly match netdev_completed_queue() @bytes
2112 */
2068static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) 2113static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
2069{ 2114{
2070 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); 2115 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
@@ -2094,6 +2139,16 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
2094#endif 2139#endif
2095} 2140}
2096 2141
2142/**
2143 * netdev_completed_queue - report bytes and packets completed by device
2144 * @dev: network device
2145 * @pkts: actual number of packets sent over the medium
2146 * @bytes: actual number of bytes sent over the medium
2147 *
2148 * Report the number of bytes and packets transmitted by the network device
2149 * hardware queue over the physical medium, @bytes must exactly match the
2150 * @bytes amount passed to netdev_sent_queue()
2151 */
2097static inline void netdev_completed_queue(struct net_device *dev, 2152static inline void netdev_completed_queue(struct net_device *dev,
2098 unsigned int pkts, unsigned int bytes) 2153 unsigned int pkts, unsigned int bytes)
2099{ 2154{
@@ -2108,6 +2163,13 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)
2108#endif 2163#endif
2109} 2164}
2110 2165
2166/**
2167 * netdev_reset_queue - reset the packets and bytes count of a network device
2168 * @dev_queue: network device
2169 *
2170 * Reset the bytes and packet count of a network device and clear the
2171 * software flow control OFF bit for this network device
2172 */
2111static inline void netdev_reset_queue(struct net_device *dev_queue) 2173static inline void netdev_reset_queue(struct net_device *dev_queue)
2112{ 2174{
2113 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0)); 2175 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
@@ -2202,11 +2264,12 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2202} 2264}
2203 2265
2204#ifdef CONFIG_XPS 2266#ifdef CONFIG_XPS
2205extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, 2267extern int netif_set_xps_queue(struct net_device *dev,
2268 const struct cpumask *mask,
2206 u16 index); 2269 u16 index);
2207#else 2270#else
2208static inline int netif_set_xps_queue(struct net_device *dev, 2271static inline int netif_set_xps_queue(struct net_device *dev,
2209 struct cpumask *mask, 2272 const struct cpumask *mask,
2210 u16 index) 2273 u16 index)
2211{ 2274{
2212 return 0; 2275 return 0;
@@ -2317,6 +2380,8 @@ extern int dev_set_mac_address(struct net_device *,
2317 struct sockaddr *); 2380 struct sockaddr *);
2318extern int dev_change_carrier(struct net_device *, 2381extern int dev_change_carrier(struct net_device *,
2319 bool new_carrier); 2382 bool new_carrier);
2383extern int dev_get_phys_port_id(struct net_device *dev,
2384 struct netdev_phys_port_id *ppid);
2320extern int dev_hard_start_xmit(struct sk_buff *skb, 2385extern int dev_hard_start_xmit(struct sk_buff *skb,
2321 struct net_device *dev, 2386 struct net_device *dev,
2322 struct netdev_queue *txq); 2387 struct netdev_queue *txq);
@@ -2749,6 +2814,16 @@ extern int bpf_jit_enable;
2749extern bool netdev_has_upper_dev(struct net_device *dev, 2814extern bool netdev_has_upper_dev(struct net_device *dev,
2750 struct net_device *upper_dev); 2815 struct net_device *upper_dev);
2751extern bool netdev_has_any_upper_dev(struct net_device *dev); 2816extern bool netdev_has_any_upper_dev(struct net_device *dev);
2817extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
2818 struct list_head **iter);
2819
2820/* iterate through upper list, must be called under RCU read lock */
2821#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \
2822 for (iter = &(dev)->upper_dev_list, \
2823 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
2824 upper; \
2825 upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
2826
2752extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 2827extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2753extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); 2828extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2754extern int netdev_upper_dev_link(struct net_device *dev, 2829extern int netdev_upper_dev_link(struct net_device *dev,
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index de70f7b45b68..708fe72ab913 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -314,25 +314,24 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
314#endif /*CONFIG_NETFILTER*/ 314#endif /*CONFIG_NETFILTER*/
315 315
316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 316#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
317extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu; 317extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
318extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); 318extern void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu; 319extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
320 320
321struct nf_conn; 321struct nf_conn;
322enum ip_conntrack_info;
322struct nlattr; 323struct nlattr;
323 324
324struct nfq_ct_hook { 325struct nfq_ct_hook {
325 size_t (*build_size)(const struct nf_conn *ct); 326 size_t (*build_size)(const struct nf_conn *ct);
326 int (*build)(struct sk_buff *skb, struct nf_conn *ct); 327 int (*build)(struct sk_buff *skb, struct nf_conn *ct);
327 int (*parse)(const struct nlattr *attr, struct nf_conn *ct); 328 int (*parse)(const struct nlattr *attr, struct nf_conn *ct);
328}; 329 int (*attach_expect)(const struct nlattr *attr, struct nf_conn *ct,
329extern struct nfq_ct_hook __rcu *nfq_ct_hook; 330 u32 portid, u32 report);
330
331struct nfq_ct_nat_hook {
332 void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, 331 void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct,
333 u32 ctinfo, int off); 332 enum ip_conntrack_info ctinfo, s32 off);
334}; 333};
335extern struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook; 334extern struct nfq_ct_hook __rcu *nfq_ct_hook;
336#else 335#else
337static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 336static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
338#endif 337#endif
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index d80e2753847c..9ac9fbde7b61 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -296,10 +296,12 @@ ip_set_eexist(int ret, u32 flags)
296 296
297/* Match elements marked with nomatch */ 297/* Match elements marked with nomatch */
298static inline bool 298static inline bool
299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) 299ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt, struct ip_set *set)
300{ 300{
301 return adt == IPSET_TEST && 301 return adt == IPSET_TEST &&
302 ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); 302 (set->type->features & IPSET_TYPE_NOMATCH) &&
303 ((flags >> 16) & IPSET_FLAG_NOMATCH) &&
304 (ret > 0 || ret == -ENOTEMPTY);
303} 305}
304 306
305/* Check the NLA_F_NET_BYTEORDER flag */ 307/* Check the NLA_F_NET_BYTEORDER flag */
diff --git a/include/linux/netfilter/xt_HMARK.h b/include/linux/netfilter/xt_HMARK.h
deleted file mode 100644
index 826fc5807577..000000000000
--- a/include/linux/netfilter/xt_HMARK.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef XT_HMARK_H_
2#define XT_HMARK_H_
3
4#include <linux/types.h>
5
6enum {
7 XT_HMARK_SADDR_MASK,
8 XT_HMARK_DADDR_MASK,
9 XT_HMARK_SPI,
10 XT_HMARK_SPI_MASK,
11 XT_HMARK_SPORT,
12 XT_HMARK_DPORT,
13 XT_HMARK_SPORT_MASK,
14 XT_HMARK_DPORT_MASK,
15 XT_HMARK_PROTO_MASK,
16 XT_HMARK_RND,
17 XT_HMARK_MODULUS,
18 XT_HMARK_OFFSET,
19 XT_HMARK_CT,
20 XT_HMARK_METHOD_L3,
21 XT_HMARK_METHOD_L3_4,
22};
23#define XT_HMARK_FLAG(flag) (1 << flag)
24
25union hmark_ports {
26 struct {
27 __u16 src;
28 __u16 dst;
29 } p16;
30 struct {
31 __be16 src;
32 __be16 dst;
33 } b16;
34 __u32 v32;
35 __be32 b32;
36};
37
38struct xt_hmark_info {
39 union nf_inet_addr src_mask;
40 union nf_inet_addr dst_mask;
41 union hmark_ports port_mask;
42 union hmark_ports port_set;
43 __u32 flags;
44 __u16 proto_mask;
45 __u32 hashrnd;
46 __u32 hmodulus;
47 __u32 hoffset; /* Mark offset to start from */
48};
49
50#endif /* XT_HMARK_H_ */
diff --git a/include/linux/netfilter/xt_rpfilter.h b/include/linux/netfilter/xt_rpfilter.h
deleted file mode 100644
index 8358d4f71952..000000000000
--- a/include/linux/netfilter/xt_rpfilter.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _XT_RPATH_H
2#define _XT_RPATH_H
3
4#include <linux/types.h>
5
6enum {
7 XT_RPFILTER_LOOSE = 1 << 0,
8 XT_RPFILTER_VALID_MARK = 1 << 1,
9 XT_RPFILTER_ACCEPT_LOCAL = 1 << 2,
10 XT_RPFILTER_INVERT = 1 << 3,
11#ifdef __KERNEL__
12 XT_RPFILTER_OPTION_MASK = XT_RPFILTER_LOOSE |
13 XT_RPFILTER_VALID_MARK |
14 XT_RPFILTER_ACCEPT_LOCAL |
15 XT_RPFILTER_INVERT,
16#endif
17};
18
19struct xt_rpfilter_info {
20 __u8 flags;
21};
22
23#endif
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7125cef74164..3ea4cde8701c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -524,6 +524,7 @@ static inline void nfs4_label_free(void *label) {}
524 * linux/fs/nfs/unlink.c 524 * linux/fs/nfs/unlink.c
525 */ 525 */
526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
527extern void nfs_wait_on_sillyrename(struct dentry *dentry);
527extern void nfs_block_sillyrename(struct dentry *dentry); 528extern void nfs_block_sillyrename(struct dentry *dentry);
528extern void nfs_unblock_sillyrename(struct dentry *dentry); 529extern void nfs_unblock_sillyrename(struct dentry *dentry);
529extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry); 530extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index d2212432c456..b8cedced50c9 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -56,6 +56,7 @@ struct nfs_client {
56 struct rpc_cred *cl_machine_cred; 56 struct rpc_cred *cl_machine_cred;
57 57
58#if IS_ENABLED(CONFIG_NFS_V4) 58#if IS_ENABLED(CONFIG_NFS_V4)
59 struct list_head cl_ds_clients; /* auth flavor data servers */
59 u64 cl_clientid; /* constant */ 60 u64 cl_clientid; /* constant */
60 nfs4_verifier cl_confirm; /* Clientid verifier */ 61 nfs4_verifier cl_confirm; /* Clientid verifier */
61 unsigned long cl_state; 62 unsigned long cl_state;
@@ -78,6 +79,9 @@ struct nfs_client {
78 u32 cl_cb_ident; /* v4.0 callback identifier */ 79 u32 cl_cb_ident; /* v4.0 callback identifier */
79 const struct nfs4_minor_version_ops *cl_mvops; 80 const struct nfs4_minor_version_ops *cl_mvops;
80 81
82 /* NFSv4.0 transport blocking */
83 struct nfs4_slot_table *cl_slot_tbl;
84
81 /* The sequence id to use for the next CREATE_SESSION */ 85 /* The sequence id to use for the next CREATE_SESSION */
82 u32 cl_seqid; 86 u32 cl_seqid;
83 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 87 /* The flags used for obtaining the clientid during EXCHANGE_ID */
@@ -87,6 +91,15 @@ struct nfs_client {
87 struct nfs41_server_owner *cl_serverowner; 91 struct nfs41_server_owner *cl_serverowner;
88 struct nfs41_server_scope *cl_serverscope; 92 struct nfs41_server_scope *cl_serverscope;
89 struct nfs41_impl_id *cl_implid; 93 struct nfs41_impl_id *cl_implid;
94 /* nfs 4.1+ state protection modes: */
95 unsigned long cl_sp4_flags;
96#define NFS_SP4_MACH_CRED_MINIMAL 1 /* Minimal sp4_mach_cred - state ops
97 * must use machine cred */
98#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */
99#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */
100#define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */
101#define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */
102#define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */
90#endif /* CONFIG_NFS_V4 */ 103#endif /* CONFIG_NFS_V4 */
91 104
92#ifdef CONFIG_NFS_FSCACHE 105#ifdef CONFIG_NFS_FSCACHE
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8651574a305b..49f52c8f4422 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1107,6 +1107,23 @@ struct pnfs_ds_commit_info {
1107 struct pnfs_commit_bucket *buckets; 1107 struct pnfs_commit_bucket *buckets;
1108}; 1108};
1109 1109
1110#define NFS4_OP_MAP_NUM_LONGS \
1111 DIV_ROUND_UP(LAST_NFS4_OP, 8 * sizeof(unsigned long))
1112#define NFS4_OP_MAP_NUM_WORDS \
1113 (NFS4_OP_MAP_NUM_LONGS * sizeof(unsigned long) / sizeof(u32))
1114struct nfs4_op_map {
1115 union {
1116 unsigned long longs[NFS4_OP_MAP_NUM_LONGS];
1117 u32 words[NFS4_OP_MAP_NUM_WORDS];
1118 } u;
1119};
1120
1121struct nfs41_state_protection {
1122 u32 how;
1123 struct nfs4_op_map enforce;
1124 struct nfs4_op_map allow;
1125};
1126
1110#define NFS4_EXCHANGE_ID_LEN (48) 1127#define NFS4_EXCHANGE_ID_LEN (48)
1111struct nfs41_exchange_id_args { 1128struct nfs41_exchange_id_args {
1112 struct nfs_client *client; 1129 struct nfs_client *client;
@@ -1114,6 +1131,7 @@ struct nfs41_exchange_id_args {
1114 unsigned int id_len; 1131 unsigned int id_len;
1115 char id[NFS4_EXCHANGE_ID_LEN]; 1132 char id[NFS4_EXCHANGE_ID_LEN];
1116 u32 flags; 1133 u32 flags;
1134 struct nfs41_state_protection state_protect;
1117}; 1135};
1118 1136
1119struct nfs41_server_owner { 1137struct nfs41_server_owner {
@@ -1146,6 +1164,7 @@ struct nfs41_exchange_id_res {
1146 struct nfs41_server_owner *server_owner; 1164 struct nfs41_server_owner *server_owner;
1147 struct nfs41_server_scope *server_scope; 1165 struct nfs41_server_scope *server_scope;
1148 struct nfs41_impl_id *impl_id; 1166 struct nfs41_impl_id *impl_id;
1167 struct nfs41_state_protection state_protect;
1149}; 1168};
1150 1169
1151struct nfs41_create_session_args { 1170struct nfs41_create_session_args {
@@ -1419,12 +1438,12 @@ struct nfs_rpc_ops {
1419 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1438 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1420 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, 1439 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *,
1421 const struct nfs_pgio_completion_ops *); 1440 const struct nfs_pgio_completion_ops *);
1422 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1441 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1423 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1442 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1424 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1443 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1425 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int, 1444 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1426 const struct nfs_pgio_completion_ops *); 1445 const struct nfs_pgio_completion_ops *);
1427 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); 1446 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1428 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1447 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1429 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1448 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1430 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1449 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
@@ -1436,13 +1455,14 @@ struct nfs_rpc_ops {
1436 struct inode * (*open_context) (struct inode *dir, 1455 struct inode * (*open_context) (struct inode *dir,
1437 struct nfs_open_context *ctx, 1456 struct nfs_open_context *ctx,
1438 int open_flags, 1457 int open_flags,
1439 struct iattr *iattr); 1458 struct iattr *iattr,
1459 int *);
1440 int (*have_delegation)(struct inode *, fmode_t); 1460 int (*have_delegation)(struct inode *, fmode_t);
1441 int (*return_delegation)(struct inode *); 1461 int (*return_delegation)(struct inode *);
1442 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); 1462 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1443 struct nfs_client * 1463 struct nfs_client *
1444 (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1464 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1445 const char *, rpc_authflavor_t); 1465 const char *);
1446 void (*free_client) (struct nfs_client *); 1466 void (*free_client) (struct nfs_client *);
1447 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *); 1467 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1448 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *, 1468 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 4e2cbfa640b7..58b9a02c38d2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -98,8 +98,17 @@
98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 98typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
99extern nodemask_t _unused_nodemask_arg_; 99extern nodemask_t _unused_nodemask_arg_;
100 100
101/*
102 * The inline keyword gives the compiler room to decide to inline, or
103 * not inline a function as it sees best. However, as these functions
104 * are called in both __init and non-__init functions, if they are not
105 * inlined we will end up with a section mis-match error (of the type of
106 * freeable items not being freed). So we must use __always_inline here
107 * to fix the problem. If other functions in the future also end up in
108 * this situation they will also need to be annotated as __always_inline
109 */
101#define node_set(node, dst) __node_set((node), &(dst)) 110#define node_set(node, dst) __node_set((node), &(dst))
102static inline void __node_set(int node, volatile nodemask_t *dstp) 111static __always_inline void __node_set(int node, volatile nodemask_t *dstp)
103{ 112{
104 set_bit(node, dstp->bits); 113 set_bit(node, dstp->bits);
105} 114}
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index f451c8d6e231..26ebcf41c213 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011, Intel Corporation. 3 * Copyright (c) 2011-2013, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -19,7 +19,10 @@
19#ifndef _LINUX_NVME_H 19#ifndef _LINUX_NVME_H
20#define _LINUX_NVME_H 20#define _LINUX_NVME_H
21 21
22#include <linux/types.h> 22#include <uapi/linux/nvme.h>
23#include <linux/pci.h>
24#include <linux/miscdevice.h>
25#include <linux/kref.h>
23 26
24struct nvme_bar { 27struct nvme_bar {
25 __u64 cap; /* Controller Capabilities */ 28 __u64 cap; /* Controller Capabilities */
@@ -50,6 +53,7 @@ enum {
50 NVME_CC_SHN_NONE = 0 << 14, 53 NVME_CC_SHN_NONE = 0 << 14,
51 NVME_CC_SHN_NORMAL = 1 << 14, 54 NVME_CC_SHN_NORMAL = 1 << 14,
52 NVME_CC_SHN_ABRUPT = 2 << 14, 55 NVME_CC_SHN_ABRUPT = 2 << 14,
56 NVME_CC_SHN_MASK = 3 << 14,
53 NVME_CC_IOSQES = 6 << 16, 57 NVME_CC_IOSQES = 6 << 16,
54 NVME_CC_IOCQES = 4 << 20, 58 NVME_CC_IOCQES = 4 << 20,
55 NVME_CSTS_RDY = 1 << 0, 59 NVME_CSTS_RDY = 1 << 0,
@@ -57,462 +61,11 @@ enum {
57 NVME_CSTS_SHST_NORMAL = 0 << 2, 61 NVME_CSTS_SHST_NORMAL = 0 << 2,
58 NVME_CSTS_SHST_OCCUR = 1 << 2, 62 NVME_CSTS_SHST_OCCUR = 1 << 2,
59 NVME_CSTS_SHST_CMPLT = 2 << 2, 63 NVME_CSTS_SHST_CMPLT = 2 << 2,
60}; 64 NVME_CSTS_SHST_MASK = 3 << 2,
61
62struct nvme_id_power_state {
63 __le16 max_power; /* centiwatts */
64 __u16 rsvd2;
65 __le32 entry_lat; /* microseconds */
66 __le32 exit_lat; /* microseconds */
67 __u8 read_tput;
68 __u8 read_lat;
69 __u8 write_tput;
70 __u8 write_lat;
71 __u8 rsvd16[16];
72}; 65};
73 66
74#define NVME_VS(major, minor) (major << 16 | minor) 67#define NVME_VS(major, minor) (major << 16 | minor)
75 68
76struct nvme_id_ctrl {
77 __le16 vid;
78 __le16 ssvid;
79 char sn[20];
80 char mn[40];
81 char fr[8];
82 __u8 rab;
83 __u8 ieee[3];
84 __u8 mic;
85 __u8 mdts;
86 __u8 rsvd78[178];
87 __le16 oacs;
88 __u8 acl;
89 __u8 aerl;
90 __u8 frmw;
91 __u8 lpa;
92 __u8 elpe;
93 __u8 npss;
94 __u8 rsvd264[248];
95 __u8 sqes;
96 __u8 cqes;
97 __u8 rsvd514[2];
98 __le32 nn;
99 __le16 oncs;
100 __le16 fuses;
101 __u8 fna;
102 __u8 vwc;
103 __le16 awun;
104 __le16 awupf;
105 __u8 rsvd530[1518];
106 struct nvme_id_power_state psd[32];
107 __u8 vs[1024];
108};
109
110enum {
111 NVME_CTRL_ONCS_COMPARE = 1 << 0,
112 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
113 NVME_CTRL_ONCS_DSM = 1 << 2,
114};
115
116struct nvme_lbaf {
117 __le16 ms;
118 __u8 ds;
119 __u8 rp;
120};
121
122struct nvme_id_ns {
123 __le64 nsze;
124 __le64 ncap;
125 __le64 nuse;
126 __u8 nsfeat;
127 __u8 nlbaf;
128 __u8 flbas;
129 __u8 mc;
130 __u8 dpc;
131 __u8 dps;
132 __u8 rsvd30[98];
133 struct nvme_lbaf lbaf[16];
134 __u8 rsvd192[192];
135 __u8 vs[3712];
136};
137
138enum {
139 NVME_NS_FEAT_THIN = 1 << 0,
140 NVME_LBAF_RP_BEST = 0,
141 NVME_LBAF_RP_BETTER = 1,
142 NVME_LBAF_RP_GOOD = 2,
143 NVME_LBAF_RP_DEGRADED = 3,
144};
145
146struct nvme_smart_log {
147 __u8 critical_warning;
148 __u8 temperature[2];
149 __u8 avail_spare;
150 __u8 spare_thresh;
151 __u8 percent_used;
152 __u8 rsvd6[26];
153 __u8 data_units_read[16];
154 __u8 data_units_written[16];
155 __u8 host_reads[16];
156 __u8 host_writes[16];
157 __u8 ctrl_busy_time[16];
158 __u8 power_cycles[16];
159 __u8 power_on_hours[16];
160 __u8 unsafe_shutdowns[16];
161 __u8 media_errors[16];
162 __u8 num_err_log_entries[16];
163 __u8 rsvd192[320];
164};
165
166enum {
167 NVME_SMART_CRIT_SPARE = 1 << 0,
168 NVME_SMART_CRIT_TEMPERATURE = 1 << 1,
169 NVME_SMART_CRIT_RELIABILITY = 1 << 2,
170 NVME_SMART_CRIT_MEDIA = 1 << 3,
171 NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4,
172};
173
174struct nvme_lba_range_type {
175 __u8 type;
176 __u8 attributes;
177 __u8 rsvd2[14];
178 __u64 slba;
179 __u64 nlb;
180 __u8 guid[16];
181 __u8 rsvd48[16];
182};
183
184enum {
185 NVME_LBART_TYPE_FS = 0x01,
186 NVME_LBART_TYPE_RAID = 0x02,
187 NVME_LBART_TYPE_CACHE = 0x03,
188 NVME_LBART_TYPE_SWAP = 0x04,
189
190 NVME_LBART_ATTRIB_TEMP = 1 << 0,
191 NVME_LBART_ATTRIB_HIDE = 1 << 1,
192};
193
194/* I/O commands */
195
196enum nvme_opcode {
197 nvme_cmd_flush = 0x00,
198 nvme_cmd_write = 0x01,
199 nvme_cmd_read = 0x02,
200 nvme_cmd_write_uncor = 0x04,
201 nvme_cmd_compare = 0x05,
202 nvme_cmd_dsm = 0x09,
203};
204
205struct nvme_common_command {
206 __u8 opcode;
207 __u8 flags;
208 __u16 command_id;
209 __le32 nsid;
210 __le32 cdw2[2];
211 __le64 metadata;
212 __le64 prp1;
213 __le64 prp2;
214 __le32 cdw10[6];
215};
216
217struct nvme_rw_command {
218 __u8 opcode;
219 __u8 flags;
220 __u16 command_id;
221 __le32 nsid;
222 __u64 rsvd2;
223 __le64 metadata;
224 __le64 prp1;
225 __le64 prp2;
226 __le64 slba;
227 __le16 length;
228 __le16 control;
229 __le32 dsmgmt;
230 __le32 reftag;
231 __le16 apptag;
232 __le16 appmask;
233};
234
235enum {
236 NVME_RW_LR = 1 << 15,
237 NVME_RW_FUA = 1 << 14,
238 NVME_RW_DSM_FREQ_UNSPEC = 0,
239 NVME_RW_DSM_FREQ_TYPICAL = 1,
240 NVME_RW_DSM_FREQ_RARE = 2,
241 NVME_RW_DSM_FREQ_READS = 3,
242 NVME_RW_DSM_FREQ_WRITES = 4,
243 NVME_RW_DSM_FREQ_RW = 5,
244 NVME_RW_DSM_FREQ_ONCE = 6,
245 NVME_RW_DSM_FREQ_PREFETCH = 7,
246 NVME_RW_DSM_FREQ_TEMP = 8,
247 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
248 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
249 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
250 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
251 NVME_RW_DSM_SEQ_REQ = 1 << 6,
252 NVME_RW_DSM_COMPRESSED = 1 << 7,
253};
254
255struct nvme_dsm_cmd {
256 __u8 opcode;
257 __u8 flags;
258 __u16 command_id;
259 __le32 nsid;
260 __u64 rsvd2[2];
261 __le64 prp1;
262 __le64 prp2;
263 __le32 nr;
264 __le32 attributes;
265 __u32 rsvd12[4];
266};
267
268enum {
269 NVME_DSMGMT_IDR = 1 << 0,
270 NVME_DSMGMT_IDW = 1 << 1,
271 NVME_DSMGMT_AD = 1 << 2,
272};
273
274struct nvme_dsm_range {
275 __le32 cattr;
276 __le32 nlb;
277 __le64 slba;
278};
279
280/* Admin commands */
281
282enum nvme_admin_opcode {
283 nvme_admin_delete_sq = 0x00,
284 nvme_admin_create_sq = 0x01,
285 nvme_admin_get_log_page = 0x02,
286 nvme_admin_delete_cq = 0x04,
287 nvme_admin_create_cq = 0x05,
288 nvme_admin_identify = 0x06,
289 nvme_admin_abort_cmd = 0x08,
290 nvme_admin_set_features = 0x09,
291 nvme_admin_get_features = 0x0a,
292 nvme_admin_async_event = 0x0c,
293 nvme_admin_activate_fw = 0x10,
294 nvme_admin_download_fw = 0x11,
295 nvme_admin_format_nvm = 0x80,
296 nvme_admin_security_send = 0x81,
297 nvme_admin_security_recv = 0x82,
298};
299
300enum {
301 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
302 NVME_CQ_IRQ_ENABLED = (1 << 1),
303 NVME_SQ_PRIO_URGENT = (0 << 1),
304 NVME_SQ_PRIO_HIGH = (1 << 1),
305 NVME_SQ_PRIO_MEDIUM = (2 << 1),
306 NVME_SQ_PRIO_LOW = (3 << 1),
307 NVME_FEAT_ARBITRATION = 0x01,
308 NVME_FEAT_POWER_MGMT = 0x02,
309 NVME_FEAT_LBA_RANGE = 0x03,
310 NVME_FEAT_TEMP_THRESH = 0x04,
311 NVME_FEAT_ERR_RECOVERY = 0x05,
312 NVME_FEAT_VOLATILE_WC = 0x06,
313 NVME_FEAT_NUM_QUEUES = 0x07,
314 NVME_FEAT_IRQ_COALESCE = 0x08,
315 NVME_FEAT_IRQ_CONFIG = 0x09,
316 NVME_FEAT_WRITE_ATOMIC = 0x0a,
317 NVME_FEAT_ASYNC_EVENT = 0x0b,
318 NVME_FEAT_SW_PROGRESS = 0x0c,
319 NVME_FWACT_REPL = (0 << 3),
320 NVME_FWACT_REPL_ACTV = (1 << 3),
321 NVME_FWACT_ACTV = (2 << 3),
322};
323
324struct nvme_identify {
325 __u8 opcode;
326 __u8 flags;
327 __u16 command_id;
328 __le32 nsid;
329 __u64 rsvd2[2];
330 __le64 prp1;
331 __le64 prp2;
332 __le32 cns;
333 __u32 rsvd11[5];
334};
335
336struct nvme_features {
337 __u8 opcode;
338 __u8 flags;
339 __u16 command_id;
340 __le32 nsid;
341 __u64 rsvd2[2];
342 __le64 prp1;
343 __le64 prp2;
344 __le32 fid;
345 __le32 dword11;
346 __u32 rsvd12[4];
347};
348
349struct nvme_create_cq {
350 __u8 opcode;
351 __u8 flags;
352 __u16 command_id;
353 __u32 rsvd1[5];
354 __le64 prp1;
355 __u64 rsvd8;
356 __le16 cqid;
357 __le16 qsize;
358 __le16 cq_flags;
359 __le16 irq_vector;
360 __u32 rsvd12[4];
361};
362
363struct nvme_create_sq {
364 __u8 opcode;
365 __u8 flags;
366 __u16 command_id;
367 __u32 rsvd1[5];
368 __le64 prp1;
369 __u64 rsvd8;
370 __le16 sqid;
371 __le16 qsize;
372 __le16 sq_flags;
373 __le16 cqid;
374 __u32 rsvd12[4];
375};
376
377struct nvme_delete_queue {
378 __u8 opcode;
379 __u8 flags;
380 __u16 command_id;
381 __u32 rsvd1[9];
382 __le16 qid;
383 __u16 rsvd10;
384 __u32 rsvd11[5];
385};
386
387struct nvme_download_firmware {
388 __u8 opcode;
389 __u8 flags;
390 __u16 command_id;
391 __u32 rsvd1[5];
392 __le64 prp1;
393 __le64 prp2;
394 __le32 numd;
395 __le32 offset;
396 __u32 rsvd12[4];
397};
398
399struct nvme_format_cmd {
400 __u8 opcode;
401 __u8 flags;
402 __u16 command_id;
403 __le32 nsid;
404 __u64 rsvd2[4];
405 __le32 cdw10;
406 __u32 rsvd11[5];
407};
408
409struct nvme_command {
410 union {
411 struct nvme_common_command common;
412 struct nvme_rw_command rw;
413 struct nvme_identify identify;
414 struct nvme_features features;
415 struct nvme_create_cq create_cq;
416 struct nvme_create_sq create_sq;
417 struct nvme_delete_queue delete_queue;
418 struct nvme_download_firmware dlfw;
419 struct nvme_format_cmd format;
420 struct nvme_dsm_cmd dsm;
421 };
422};
423
424enum {
425 NVME_SC_SUCCESS = 0x0,
426 NVME_SC_INVALID_OPCODE = 0x1,
427 NVME_SC_INVALID_FIELD = 0x2,
428 NVME_SC_CMDID_CONFLICT = 0x3,
429 NVME_SC_DATA_XFER_ERROR = 0x4,
430 NVME_SC_POWER_LOSS = 0x5,
431 NVME_SC_INTERNAL = 0x6,
432 NVME_SC_ABORT_REQ = 0x7,
433 NVME_SC_ABORT_QUEUE = 0x8,
434 NVME_SC_FUSED_FAIL = 0x9,
435 NVME_SC_FUSED_MISSING = 0xa,
436 NVME_SC_INVALID_NS = 0xb,
437 NVME_SC_CMD_SEQ_ERROR = 0xc,
438 NVME_SC_LBA_RANGE = 0x80,
439 NVME_SC_CAP_EXCEEDED = 0x81,
440 NVME_SC_NS_NOT_READY = 0x82,
441 NVME_SC_CQ_INVALID = 0x100,
442 NVME_SC_QID_INVALID = 0x101,
443 NVME_SC_QUEUE_SIZE = 0x102,
444 NVME_SC_ABORT_LIMIT = 0x103,
445 NVME_SC_ABORT_MISSING = 0x104,
446 NVME_SC_ASYNC_LIMIT = 0x105,
447 NVME_SC_FIRMWARE_SLOT = 0x106,
448 NVME_SC_FIRMWARE_IMAGE = 0x107,
449 NVME_SC_INVALID_VECTOR = 0x108,
450 NVME_SC_INVALID_LOG_PAGE = 0x109,
451 NVME_SC_INVALID_FORMAT = 0x10a,
452 NVME_SC_BAD_ATTRIBUTES = 0x180,
453 NVME_SC_WRITE_FAULT = 0x280,
454 NVME_SC_READ_ERROR = 0x281,
455 NVME_SC_GUARD_CHECK = 0x282,
456 NVME_SC_APPTAG_CHECK = 0x283,
457 NVME_SC_REFTAG_CHECK = 0x284,
458 NVME_SC_COMPARE_FAILED = 0x285,
459 NVME_SC_ACCESS_DENIED = 0x286,
460};
461
462struct nvme_completion {
463 __le32 result; /* Used by admin commands to return data */
464 __u32 rsvd;
465 __le16 sq_head; /* how much of this queue may be reclaimed */
466 __le16 sq_id; /* submission queue that generated this entry */
467 __u16 command_id; /* of the command which completed */
468 __le16 status; /* did the command fail, and if so, why? */
469};
470
471struct nvme_user_io {
472 __u8 opcode;
473 __u8 flags;
474 __u16 control;
475 __u16 nblocks;
476 __u16 rsvd;
477 __u64 metadata;
478 __u64 addr;
479 __u64 slba;
480 __u32 dsmgmt;
481 __u32 reftag;
482 __u16 apptag;
483 __u16 appmask;
484};
485
486struct nvme_admin_cmd {
487 __u8 opcode;
488 __u8 flags;
489 __u16 rsvd1;
490 __u32 nsid;
491 __u32 cdw2;
492 __u32 cdw3;
493 __u64 metadata;
494 __u64 addr;
495 __u32 metadata_len;
496 __u32 data_len;
497 __u32 cdw10;
498 __u32 cdw11;
499 __u32 cdw12;
500 __u32 cdw13;
501 __u32 cdw14;
502 __u32 cdw15;
503 __u32 timeout_ms;
504 __u32 result;
505};
506
507#define NVME_IOCTL_ID _IO('N', 0x40)
508#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
509#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
510
511#ifdef __KERNEL__
512#include <linux/pci.h>
513#include <linux/miscdevice.h>
514#include <linux/kref.h>
515
516#define NVME_IO_TIMEOUT (5 * HZ) 69#define NVME_IO_TIMEOUT (5 * HZ)
517 70
518/* 71/*
@@ -553,7 +106,7 @@ struct nvme_ns {
553 struct request_queue *queue; 106 struct request_queue *queue;
554 struct gendisk *disk; 107 struct gendisk *disk;
555 108
556 int ns_id; 109 unsigned ns_id;
557 int lba_shift; 110 int lba_shift;
558 int ms; 111 int ms;
559 u64 mode_select_num_blocks; 112 u64 mode_select_num_blocks;
@@ -572,6 +125,7 @@ struct nvme_iod {
572 int offset; /* Of PRP list */ 125 int offset; /* Of PRP list */
573 int nents; /* Used in scatterlist */ 126 int nents; /* Used in scatterlist */
574 int length; /* Of data, in bytes */ 127 int length; /* Of data, in bytes */
128 unsigned long start_time;
575 dma_addr_t first_dma; 129 dma_addr_t first_dma;
576 struct scatterlist sg[0]; 130 struct scatterlist sg[0];
577}; 131};
@@ -613,6 +167,4 @@ struct sg_io_hdr;
613int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr); 167int nvme_sg_io(struct nvme_ns *ns, struct sg_io_hdr __user *u_hdr);
614int nvme_sg_get_version_num(int __user *ip); 168int nvme_sg_get_version_num(int __user *ip);
615 169
616#endif
617
618#endif /* _LINUX_NVME_H */ 170#endif /* _LINUX_NVME_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 1fd08ca23106..f95aee391e30 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -266,6 +266,7 @@ extern int of_device_is_available(const struct device_node *device);
266extern const void *of_get_property(const struct device_node *node, 266extern const void *of_get_property(const struct device_node *node,
267 const char *name, 267 const char *name,
268 int *lenp); 268 int *lenp);
269extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
269#define for_each_property_of_node(dn, pp) \ 270#define for_each_property_of_node(dn, pp) \
270 for (pp = dn->properties; pp != NULL; pp = pp->next) 271 for (pp = dn->properties; pp != NULL; pp = pp->next)
271 272
@@ -280,6 +281,9 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
280extern int of_parse_phandle_with_args(const struct device_node *np, 281extern int of_parse_phandle_with_args(const struct device_node *np,
281 const char *list_name, const char *cells_name, int index, 282 const char *list_name, const char *cells_name, int index,
282 struct of_phandle_args *out_args); 283 struct of_phandle_args *out_args);
284extern int of_parse_phandle_with_fixed_args(const struct device_node *np,
285 const char *list_name, int cells_count, int index,
286 struct of_phandle_args *out_args);
283extern int of_count_phandle_with_args(const struct device_node *np, 287extern int of_count_phandle_with_args(const struct device_node *np,
284 const char *list_name, const char *cells_name); 288 const char *list_name, const char *cells_name);
285 289
@@ -323,12 +327,6 @@ extern int of_detach_node(struct device_node *);
323 */ 327 */
324const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, 328const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
325 u32 *pu); 329 u32 *pu);
326#define of_property_for_each_u32(np, propname, prop, p, u) \
327 for (prop = of_find_property(np, propname, NULL), \
328 p = of_prop_next_u32(prop, NULL, &u); \
329 p; \
330 p = of_prop_next_u32(prop, p, &u))
331
332/* 330/*
333 * struct property *prop; 331 * struct property *prop;
334 * const char *s; 332 * const char *s;
@@ -337,11 +335,8 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
337 * printk("String value: %s\n", s); 335 * printk("String value: %s\n", s);
338 */ 336 */
339const char *of_prop_next_string(struct property *prop, const char *cur); 337const char *of_prop_next_string(struct property *prop, const char *cur);
340#define of_property_for_each_string(np, propname, prop, s) \ 338
341 for (prop = of_find_property(np, propname, NULL), \ 339int of_device_is_stdout_path(struct device_node *dn);
342 s = of_prop_next_string(prop, NULL); \
343 s; \
344 s = of_prop_next_string(prop, s))
345 340
346#else /* CONFIG_OF */ 341#else /* CONFIG_OF */
347 342
@@ -459,6 +454,12 @@ static inline const void *of_get_property(const struct device_node *node,
459 return NULL; 454 return NULL;
460} 455}
461 456
457static inline struct device_node *of_get_cpu_node(int cpu,
458 unsigned int *thread)
459{
460 return NULL;
461}
462
462static inline int of_property_read_u64(const struct device_node *np, 463static inline int of_property_read_u64(const struct device_node *np,
463 const char *propname, u64 *out_value) 464 const char *propname, u64 *out_value)
464{ 465{
@@ -488,6 +489,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
488 return -ENOSYS; 489 return -ENOSYS;
489} 490}
490 491
492static inline int of_parse_phandle_with_fixed_args(const struct device_node *np,
493 const char *list_name, int cells_count, int index,
494 struct of_phandle_args *out_args)
495{
496 return -ENOSYS;
497}
498
491static inline int of_count_phandle_with_args(struct device_node *np, 499static inline int of_count_phandle_with_args(struct device_node *np,
492 const char *list_name, 500 const char *list_name,
493 const char *cells_name) 501 const char *cells_name)
@@ -505,12 +513,25 @@ static inline int of_machine_is_compatible(const char *compat)
505 return 0; 513 return 0;
506} 514}
507 515
516static inline int of_device_is_stdout_path(struct device_node *dn)
517{
518 return 0;
519}
520
521static inline const __be32 *of_prop_next_u32(struct property *prop,
522 const __be32 *cur, u32 *pu)
523{
524 return NULL;
525}
526
527static inline const char *of_prop_next_string(struct property *prop,
528 const char *cur)
529{
530 return NULL;
531}
532
508#define of_match_ptr(_ptr) NULL 533#define of_match_ptr(_ptr) NULL
509#define of_match_node(_matches, _node) NULL 534#define of_match_node(_matches, _node) NULL
510#define of_property_for_each_u32(np, propname, prop, p, u) \
511 while (0)
512#define of_property_for_each_string(np, propname, prop, s) \
513 while (0)
514#endif /* CONFIG_OF */ 535#endif /* CONFIG_OF */
515 536
516#ifndef of_node_to_nid 537#ifndef of_node_to_nid
@@ -559,6 +580,18 @@ static inline int of_property_read_u32(const struct device_node *np,
559 return of_property_read_u32_array(np, propname, out_value, 1); 580 return of_property_read_u32_array(np, propname, out_value, 1);
560} 581}
561 582
583#define of_property_for_each_u32(np, propname, prop, p, u) \
584 for (prop = of_find_property(np, propname, NULL), \
585 p = of_prop_next_u32(prop, NULL, &u); \
586 p; \
587 p = of_prop_next_u32(prop, p, &u))
588
589#define of_property_for_each_string(np, propname, prop, s) \
590 for (prop = of_find_property(np, propname, NULL), \
591 s = of_prop_next_string(prop, NULL); \
592 s; \
593 s = of_prop_next_string(prop, s))
594
562#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) 595#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
563extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 596extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
564extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 597extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 9d27475feec1..82ce324fdce7 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4#include <linux/cpu.h>
4#include <linux/platform_device.h> 5#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */ 6#include <linux/of_platform.h> /* temporary until merge */
6 7
@@ -43,6 +44,15 @@ static inline void of_device_node_put(struct device *dev)
43 of_node_put(dev->of_node); 44 of_node_put(dev->of_node);
44} 45}
45 46
47static inline struct device_node *of_cpu_device_node_get(int cpu)
48{
49 struct device *cpu_dev;
50 cpu_dev = get_cpu_device(cpu);
51 if (!cpu_dev)
52 return NULL;
53 return of_node_get(cpu_dev->of_node);
54}
55
46#else /* CONFIG_OF */ 56#else /* CONFIG_OF */
47 57
48static inline int of_driver_match_device(struct device *dev, 58static inline int of_driver_match_device(struct device *dev,
@@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device(
67{ 77{
68 return NULL; 78 return NULL;
69} 79}
80
81static inline struct device_node *of_cpu_device_node_get(int cpu)
82{
83 return NULL;
84}
70#endif /* CONFIG_OF */ 85#endif /* CONFIG_OF */
71 86
72#endif /* _LINUX_OF_DEVICE_H */ 87#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ed136ad698ce..a478c62a2aab 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -90,6 +90,9 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 90extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char *const *matches); 91extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 92extern unsigned long of_get_flat_dt_root(void);
93extern int of_scan_flat_dt_by_path(const char *path,
94 int (*it)(unsigned long node, const char *name, int depth, void *data),
95 void *data);
93 96
94extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
95 int depth, void *data); 98 int depth, void *data);
@@ -106,8 +109,7 @@ extern u64 dt_mem_next_cell(int s, __be32 **cellp);
106 * physical addresses. 109 * physical addresses.
107 */ 110 */
108#ifdef CONFIG_BLK_DEV_INITRD 111#ifdef CONFIG_BLK_DEV_INITRD
109extern void early_init_dt_setup_initrd_arch(unsigned long start, 112extern void early_init_dt_setup_initrd_arch(u64 start, u64 end);
110 unsigned long end);
111#endif 113#endif
112 114
113/* Early flat tree scan hooks */ 115/* Early flat tree scan hooks */
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
deleted file mode 100644
index cfb545cd86b5..000000000000
--- a/include/linux/of_i2c.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Generic I2C API implementation for PowerPC.
3 *
4 * Copyright (c) 2008 Jochen Friedrich <jochen@scram.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
12#ifndef __LINUX_OF_I2C_H
13#define __LINUX_OF_I2C_H
14
15#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
16#include <linux/i2c.h>
17
18extern void of_i2c_register_devices(struct i2c_adapter *adap);
19
20/* must call put_device() when done with returned i2c_client device */
21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
23/* must call put_device() when done with returned i2c_adapter device */
24extern struct i2c_adapter *of_find_i2c_adapter_by_node(
25 struct device_node *node);
26
27#else
28static inline void of_i2c_register_devices(struct i2c_adapter *adap)
29{
30 return;
31}
32
33static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
34{
35 return NULL;
36}
37
38/* must call put_device() when done with returned i2c_adapter device */
39static inline struct i2c_adapter *of_find_i2c_adapter_by_node(
40 struct device_node *node)
41{
42 return NULL;
43}
44#endif /* CONFIG_OF_I2C */
45
46#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 535cecf1e02f..fcd63baee5f2 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -1,8 +1,6 @@
1#ifndef __OF_IRQ_H 1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H 2#define __OF_IRQ_H
3 3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h> 4#include <linux/types.h>
7#include <linux/errno.h> 5#include <linux/errno.h>
8#include <linux/irq.h> 6#include <linux/irq.h>
@@ -10,14 +8,6 @@ struct of_irq;
10#include <linux/ioport.h> 8#include <linux/ioport.h>
11#include <linux/of.h> 9#include <linux/of.h>
12 10
13/*
14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */
18extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
19
20#if defined(CONFIG_OF_IRQ)
21/** 11/**
22 * of_irq - container for device_node/irq_specifier pair for an irq controller 12 * of_irq - container for device_node/irq_specifier pair for an irq controller
23 * @controller: pointer to interrupt controller device tree node 13 * @controller: pointer to interrupt controller device tree node
@@ -71,11 +61,17 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
71extern int of_irq_count(struct device_node *dev); 61extern int of_irq_count(struct device_node *dev);
72extern int of_irq_to_resource_table(struct device_node *dev, 62extern int of_irq_to_resource_table(struct device_node *dev,
73 struct resource *res, int nr_irqs); 63 struct resource *res, int nr_irqs);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
75 64
76extern void of_irq_init(const struct of_device_id *matches); 65extern void of_irq_init(const struct of_device_id *matches);
77 66
78#endif /* CONFIG_OF_IRQ */ 67#if defined(CONFIG_OF)
68/*
69 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
70 * implements it differently. However, the prototype is the same for all,
71 * so declare it here regardless of the CONFIG_OF_IRQ setting.
72 */
73extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
74extern struct device_node *of_irq_find_parent(struct device_node *child);
79 75
80#else /* !CONFIG_OF */ 76#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev, 77static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 61bf53b02779..34597c8c1a4c 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,10 +9,10 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np); 12extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
14#else 14#else
15static inline const int of_get_phy_mode(struct device_node *np) 15static inline int of_get_phy_mode(struct device_node *np)
16{ 16{
17 return -ENODEV; 17 return -ENODEV;
18} 18}
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 7a04826018c0..fd9c408631a0 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -2,6 +2,7 @@
2#define __OF_PCI_H 2#define __OF_PCI_H
3 3
4#include <linux/pci.h> 4#include <linux/pci.h>
5#include <linux/msi.h>
5 6
6struct pci_dev; 7struct pci_dev;
7struct of_irq; 8struct of_irq;
@@ -13,4 +14,15 @@ struct device_node *of_pci_find_child_device(struct device_node *parent,
13int of_pci_get_devfn(struct device_node *np); 14int of_pci_get_devfn(struct device_node *np);
14int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 15int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
15 16
17#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
18int of_pci_msi_chip_add(struct msi_chip *chip);
19void of_pci_msi_chip_remove(struct msi_chip *chip);
20struct msi_chip *of_pci_find_msi_chip_by_node(struct device_node *of_node);
21#else
22static inline int of_pci_msi_chip_add(struct msi_chip *chip) { return -EINVAL; }
23static inline void of_pci_msi_chip_remove(struct msi_chip *chip) { }
24static inline struct msi_chip *
25of_pci_find_msi_chip_by_node(struct device_node *of_node) { return NULL; }
26#endif
27
16#endif 28#endif
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h
index 5bb6e760aa61..2925df3ce78a 100644
--- a/include/linux/olpc-ec.h
+++ b/include/linux/olpc-ec.h
@@ -6,6 +6,7 @@
6#define EC_WRITE_SCI_MASK 0x1b 6#define EC_WRITE_SCI_MASK 0x1b
7#define EC_WAKE_UP_WLAN 0x24 7#define EC_WAKE_UP_WLAN 0x24
8#define EC_WLAN_LEAVE_RESET 0x25 8#define EC_WLAN_LEAVE_RESET 0x25
9#define EC_DCON_POWER_MODE 0x26
9#define EC_READ_EB_MODE 0x2a 10#define EC_READ_EB_MODE 0x2a
10#define EC_SET_SCI_INHIBIT 0x32 11#define EC_SET_SCI_INHIBIT 0x32
11#define EC_SET_SCI_INHIBIT_RELEASE 0x34 12#define EC_SET_SCI_INHIBIT_RELEASE 0x34
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index a4c562453f6b..b2a0f15f11fe 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -42,7 +42,6 @@
42#define IBS_FETCH_CODE 13 42#define IBS_FETCH_CODE 13
43#define IBS_OP_CODE 14 43#define IBS_OP_CODE 14
44 44
45struct super_block;
46struct dentry; 45struct dentry;
47struct file_operations; 46struct file_operations;
48struct pt_regs; 47struct pt_regs;
@@ -51,7 +50,7 @@ struct pt_regs;
51struct oprofile_operations { 50struct oprofile_operations {
52 /* create any necessary configuration files in the oprofile fs. 51 /* create any necessary configuration files in the oprofile fs.
53 * Optional. */ 52 * Optional. */
54 int (*create_files)(struct super_block * sb, struct dentry * root); 53 int (*create_files)(struct dentry * root);
55 /* Do any necessary interrupt setup. Optional. */ 54 /* Do any necessary interrupt setup. Optional. */
56 int (*setup)(void); 55 int (*setup)(void);
57 /* Do any necessary interrupt shutdown. Optional. */ 56 /* Do any necessary interrupt shutdown. Optional. */
@@ -125,27 +124,26 @@ void oprofile_add_trace(unsigned long eip);
125 * Create a file of the given name as a child of the given root, with 124 * Create a file of the given name as a child of the given root, with
126 * the specified file operations. 125 * the specified file operations.
127 */ 126 */
128int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 127int oprofilefs_create_file(struct dentry * root,
129 char const * name, const struct file_operations * fops); 128 char const * name, const struct file_operations * fops);
130 129
131int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 130int oprofilefs_create_file_perm(struct dentry * root,
132 char const * name, const struct file_operations * fops, int perm); 131 char const * name, const struct file_operations * fops, int perm);
133 132
134/** Create a file for read/write access to an unsigned long. */ 133/** Create a file for read/write access to an unsigned long. */
135int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 134int oprofilefs_create_ulong(struct dentry * root,
136 char const * name, ulong * val); 135 char const * name, ulong * val);
137 136
138/** Create a file for read-only access to an unsigned long. */ 137/** Create a file for read-only access to an unsigned long. */
139int oprofilefs_create_ro_ulong(struct super_block * sb, struct dentry * root, 138int oprofilefs_create_ro_ulong(struct dentry * root,
140 char const * name, ulong * val); 139 char const * name, ulong * val);
141 140
142/** Create a file for read-only access to an atomic_t. */ 141/** Create a file for read-only access to an atomic_t. */
143int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root, 142int oprofilefs_create_ro_atomic(struct dentry * root,
144 char const * name, atomic_t * val); 143 char const * name, atomic_t * val);
145 144
146/** create a directory */ 145/** create a directory */
147struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, 146struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name);
148 char const * name);
149 147
150/** 148/**
151 * Write the given asciz string to the given user buffer @buf, updating *offset 149 * Write the given asciz string to the given user buffer @buf, updating *offset
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 170447977278..d006f0ca60f4 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -47,24 +47,22 @@ void acpi_pci_remove_bus(struct pci_bus *bus);
47 47
48#ifdef CONFIG_ACPI_PCI_SLOT 48#ifdef CONFIG_ACPI_PCI_SLOT
49void acpi_pci_slot_init(void); 49void acpi_pci_slot_init(void);
50void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); 50void acpi_pci_slot_enumerate(struct pci_bus *bus);
51void acpi_pci_slot_remove(struct pci_bus *bus); 51void acpi_pci_slot_remove(struct pci_bus *bus);
52#else 52#else
53static inline void acpi_pci_slot_init(void) { } 53static inline void acpi_pci_slot_init(void) { }
54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, 54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { }
55 acpi_handle handle) { }
56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } 55static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
57#endif 56#endif
58 57
59#ifdef CONFIG_HOTPLUG_PCI_ACPI 58#ifdef CONFIG_HOTPLUG_PCI_ACPI
60void acpiphp_init(void); 59void acpiphp_init(void);
61void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); 60void acpiphp_enumerate_slots(struct pci_bus *bus);
62void acpiphp_remove_slots(struct pci_bus *bus); 61void acpiphp_remove_slots(struct pci_bus *bus);
63void acpiphp_check_host_bridge(acpi_handle handle); 62void acpiphp_check_host_bridge(acpi_handle handle);
64#else 63#else
65static inline void acpiphp_init(void) { } 64static inline void acpiphp_init(void) { }
66static inline void acpiphp_enumerate_slots(struct pci_bus *bus, 65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
67 acpi_handle handle) { }
68static inline void acpiphp_remove_slots(struct pci_bus *bus) { } 66static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
69static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 67static inline void acpiphp_check_host_bridge(acpi_handle handle) { }
70#endif 68#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0fd1f1582fa1..da172f956ad6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -183,6 +183,19 @@ enum pci_bus_flags {
183 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, 183 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
184}; 184};
185 185
186/* These values come from the PCI Express Spec */
187enum pcie_link_width {
188 PCIE_LNK_WIDTH_RESRV = 0x00,
189 PCIE_LNK_X1 = 0x01,
190 PCIE_LNK_X2 = 0x02,
191 PCIE_LNK_X4 = 0x04,
192 PCIE_LNK_X8 = 0x08,
193 PCIE_LNK_X12 = 0x0C,
194 PCIE_LNK_X16 = 0x10,
195 PCIE_LNK_X32 = 0x20,
196 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
197};
198
186/* Based on the PCI Hotplug Spec, but some values are made up by us */ 199/* Based on the PCI Hotplug Spec, but some values are made up by us */
187enum pci_bus_speed { 200enum pci_bus_speed {
188 PCI_SPEED_33MHz = 0x00, 201 PCI_SPEED_33MHz = 0x00,
@@ -433,6 +446,7 @@ struct pci_bus {
433 struct resource busn_res; /* bus numbers routed to this bus */ 446 struct resource busn_res; /* bus numbers routed to this bus */
434 447
435 struct pci_ops *ops; /* configuration access functions */ 448 struct pci_ops *ops; /* configuration access functions */
449 struct msi_chip *msi; /* MSI controller */
436 void *sysdata; /* hook for sys-specific extension */ 450 void *sysdata; /* hook for sys-specific extension */
437 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */ 451 struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
438 452
@@ -675,7 +689,7 @@ struct pci_driver {
675/* these external functions are only available when PCI support is enabled */ 689/* these external functions are only available when PCI support is enabled */
676#ifdef CONFIG_PCI 690#ifdef CONFIG_PCI
677 691
678void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); 692void pcie_bus_configure_settings(struct pci_bus *bus);
679 693
680enum pcie_bus_config_types { 694enum pcie_bus_config_types {
681 PCIE_BUS_TUNE_OFF, 695 PCIE_BUS_TUNE_OFF,
@@ -914,6 +928,7 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev);
914void pci_msi_off(struct pci_dev *dev); 928void pci_msi_off(struct pci_dev *dev);
915int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 929int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
916int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 930int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
931int pci_wait_for_pending_transaction(struct pci_dev *dev);
917int pcix_get_max_mmrbc(struct pci_dev *dev); 932int pcix_get_max_mmrbc(struct pci_dev *dev);
918int pcix_get_mmrbc(struct pci_dev *dev); 933int pcix_get_mmrbc(struct pci_dev *dev);
919int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 934int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
@@ -921,9 +936,16 @@ int pcie_get_readrq(struct pci_dev *dev);
921int pcie_set_readrq(struct pci_dev *dev, int rq); 936int pcie_set_readrq(struct pci_dev *dev, int rq);
922int pcie_get_mps(struct pci_dev *dev); 937int pcie_get_mps(struct pci_dev *dev);
923int pcie_set_mps(struct pci_dev *dev, int mps); 938int pcie_set_mps(struct pci_dev *dev, int mps);
939int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
940 enum pcie_link_width *width);
924int __pci_reset_function(struct pci_dev *dev); 941int __pci_reset_function(struct pci_dev *dev);
925int __pci_reset_function_locked(struct pci_dev *dev); 942int __pci_reset_function_locked(struct pci_dev *dev);
926int pci_reset_function(struct pci_dev *dev); 943int pci_reset_function(struct pci_dev *dev);
944int pci_probe_reset_slot(struct pci_slot *slot);
945int pci_reset_slot(struct pci_slot *slot);
946int pci_probe_reset_bus(struct pci_bus *bus);
947int pci_reset_bus(struct pci_bus *bus);
948void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
927void pci_update_resource(struct pci_dev *dev, int resno); 949void pci_update_resource(struct pci_dev *dev, int resno);
928int __must_check pci_assign_resource(struct pci_dev *dev, int i); 950int __must_check pci_assign_resource(struct pci_dev *dev, int i);
929int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); 951int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
@@ -1003,6 +1025,7 @@ int pci_claim_resource(struct pci_dev *, int);
1003void pci_assign_unassigned_resources(void); 1025void pci_assign_unassigned_resources(void);
1004void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 1026void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
1005void pci_assign_unassigned_bus_resources(struct pci_bus *bus); 1027void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
1028void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus);
1006void pdev_enable_device(struct pci_dev *); 1029void pdev_enable_device(struct pci_dev *);
1007int pci_enable_resources(struct pci_dev *, int mask); 1030int pci_enable_resources(struct pci_dev *, int mask);
1008void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 1031void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
@@ -1043,7 +1066,6 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1043 resource_size_t, 1066 resource_size_t,
1044 resource_size_t), 1067 resource_size_t),
1045 void *alignf_data); 1068 void *alignf_data);
1046void pci_enable_bridges(struct pci_bus *bus);
1047 1069
1048/* Proper probing supporting hot-pluggable devices */ 1070/* Proper probing supporting hot-pluggable devices */
1049int __must_check __pci_register_driver(struct pci_driver *, struct module *, 1071int __must_check __pci_register_driver(struct pci_driver *, struct module *,
@@ -1648,6 +1670,10 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1648int pcibios_add_device(struct pci_dev *dev); 1670int pcibios_add_device(struct pci_dev *dev);
1649void pcibios_release_device(struct pci_dev *dev); 1671void pcibios_release_device(struct pci_dev *dev);
1650 1672
1673#ifdef CONFIG_HIBERNATE_CALLBACKS
1674extern struct dev_pm_ops pcibios_pm_ops;
1675#endif
1676
1651#ifdef CONFIG_PCI_MMCONFIG 1677#ifdef CONFIG_PCI_MMCONFIG
1652void __init pci_mmcfg_early_init(void); 1678void __init pci_mmcfg_early_init(void);
1653void __init pci_mmcfg_late_init(void); 1679void __init pci_mmcfg_late_init(void);
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 8db71dcd6337..430dd963707b 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,19 +28,6 @@
28#ifndef _PCI_HOTPLUG_H 28#ifndef _PCI_HOTPLUG_H
29#define _PCI_HOTPLUG_H 29#define _PCI_HOTPLUG_H
30 30
31/* These values come from the PCI Express Spec */
32enum pcie_link_width {
33 PCIE_LNK_WIDTH_RESRV = 0x00,
34 PCIE_LNK_X1 = 0x01,
35 PCIE_LNK_X2 = 0x02,
36 PCIE_LNK_X4 = 0x04,
37 PCIE_LNK_X8 = 0x08,
38 PCIE_LNK_X12 = 0x0C,
39 PCIE_LNK_X16 = 0x10,
40 PCIE_LNK_X32 = 0x20,
41 PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
42};
43
44/** 31/**
45 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 32 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
46 * @owner: The module owner of this structure 33 * @owner: The module owner of this structure
@@ -63,6 +50,9 @@ enum pcie_link_width {
63 * @get_adapter_status: Called to get see if an adapter is present in the slot or not. 50 * @get_adapter_status: Called to get see if an adapter is present in the slot or not.
64 * If this field is NULL, the value passed in the struct hotplug_slot_info 51 * If this field is NULL, the value passed in the struct hotplug_slot_info
65 * will be used when this value is requested by a user. 52 * will be used when this value is requested by a user.
53 * @reset_slot: Optional interface to allow override of a bus reset for the
54 * slot for cases where a secondary bus reset can result in spurious
55 * hotplug events or where a slot can be reset independent of the bus.
66 * 56 *
67 * The table of function pointers that is passed to the hotplug pci core by a 57 * The table of function pointers that is passed to the hotplug pci core by a
68 * hotplug pci driver. These functions are called by the hotplug pci core when 58 * hotplug pci driver. These functions are called by the hotplug pci core when
@@ -80,6 +70,7 @@ struct hotplug_slot_ops {
80 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value); 70 int (*get_attention_status) (struct hotplug_slot *slot, u8 *value);
81 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); 71 int (*get_latch_status) (struct hotplug_slot *slot, u8 *value);
82 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); 72 int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value);
73 int (*reset_slot) (struct hotplug_slot *slot, int probe);
83}; 74};
84 75
85/** 76/**
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3bed2e89611b..97fbecdd7a40 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -518,6 +518,8 @@
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403 520#define PCI_DEVICE_ID_AMD_15H_M10H_F3 0x1403
521#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F3 0x141d
522#define PCI_DEVICE_ID_AMD_15H_M30H_NB_F4 0x141e
521#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 523#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600
522#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 524#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601
523#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 525#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602
@@ -756,6 +758,7 @@
756#define PCI_DEVICE_ID_HP_CISSE 0x323a 758#define PCI_DEVICE_ID_HP_CISSE 0x323a
757#define PCI_DEVICE_ID_HP_CISSF 0x323b 759#define PCI_DEVICE_ID_HP_CISSF 0x323b
758#define PCI_DEVICE_ID_HP_CISSH 0x323c 760#define PCI_DEVICE_ID_HP_CISSH 0x323c
761#define PCI_DEVICE_ID_HP_CISSI 0x3239
759#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 762#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
760 763
761#define PCI_VENDOR_ID_PCTECH 0x1042 764#define PCI_VENDOR_ID_PCTECH 0x1042
@@ -1311,6 +1314,8 @@
1311#define PCI_DEVICE_ID_IMS_TT128 0x9128 1314#define PCI_DEVICE_ID_IMS_TT128 0x9128
1312#define PCI_DEVICE_ID_IMS_TT3D 0x9135 1315#define PCI_DEVICE_ID_IMS_TT3D 0x9135
1313 1316
1317#define PCI_VENDOR_ID_AMCC 0x10e8
1318
1314#define PCI_VENDOR_ID_INTERG 0x10ea 1319#define PCI_VENDOR_ID_INTERG 0x10ea
1315#define PCI_DEVICE_ID_INTERG_1682 0x1682 1320#define PCI_DEVICE_ID_INTERG_1682 0x1682
1316#define PCI_DEVICE_ID_INTERG_2000 0x2000 1321#define PCI_DEVICE_ID_INTERG_2000 0x2000
@@ -2256,12 +2261,10 @@
2256/* 2261/*
2257 * ADDI-DATA GmbH communication cards <info@addi-data.com> 2262 * ADDI-DATA GmbH communication cards <info@addi-data.com>
2258 */ 2263 */
2259#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8
2260#define PCI_VENDOR_ID_ADDIDATA 0x15B8 2264#define PCI_VENDOR_ID_ADDIDATA 0x15B8
2261#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000 2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000
2262#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001 2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001
2263#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002 2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002
2264#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E
2265#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009 2268#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009
2266#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A 2269#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A
2267#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B 2270#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 27ef6b190ea6..57e890abe1f0 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -22,9 +22,12 @@
22 * Macro which verifies @ptr is a percpu pointer without evaluating 22 * Macro which verifies @ptr is a percpu pointer without evaluating
23 * @ptr. This is to be used in percpu accessors to verify that the 23 * @ptr. This is to be used in percpu accessors to verify that the
24 * input parameter is a percpu pointer. 24 * input parameter is a percpu pointer.
25 *
26 * + 0 is required in order to convert the pointer type from a
27 * potential array type to a pointer to a single item of the array.
25 */ 28 */
26#define __verify_pcpu_ptr(ptr) do { \ 29#define __verify_pcpu_ptr(ptr) do { \
27 const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ 30 const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
28 (void)__vpp_verify; \ 31 (void)__vpp_verify; \
29} while (0) 32} while (0)
30 33
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index cc88172c7d9a..c74088ab103b 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -332,7 +332,7 @@ do { \
332#endif 332#endif
333 333
334#ifndef this_cpu_sub 334#ifndef this_cpu_sub
335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) 335# define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val))
336#endif 336#endif
337 337
338#ifndef this_cpu_inc 338#ifndef this_cpu_inc
@@ -418,7 +418,7 @@ do { \
418# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) 418# define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val)
419#endif 419#endif
420 420
421#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) 421#define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val))
422#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) 422#define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1)
423#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) 423#define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1)
424 424
@@ -586,7 +586,7 @@ do { \
586#endif 586#endif
587 587
588#ifndef __this_cpu_sub 588#ifndef __this_cpu_sub
589# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) 589# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
590#endif 590#endif
591 591
592#ifndef __this_cpu_inc 592#ifndef __this_cpu_inc
@@ -668,7 +668,7 @@ do { \
668 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) 668 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val)
669#endif 669#endif
670 670
671#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) 671#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
672#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) 672#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
673#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) 673#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
674 674
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h
new file mode 100644
index 000000000000..0b23edbee309
--- /dev/null
+++ b/include/linux/percpu_ida.h
@@ -0,0 +1,60 @@
1#ifndef __PERCPU_IDA_H__
2#define __PERCPU_IDA_H__
3
4#include <linux/types.h>
5#include <linux/bitops.h>
6#include <linux/init.h>
7#include <linux/spinlock_types.h>
8#include <linux/wait.h>
9#include <linux/cpumask.h>
10
11struct percpu_ida_cpu;
12
13struct percpu_ida {
14 /*
15 * number of tags available to be allocated, as passed to
16 * percpu_ida_init()
17 */
18 unsigned nr_tags;
19
20 struct percpu_ida_cpu __percpu *tag_cpu;
21
22 /*
23 * Bitmap of cpus that (may) have tags on their percpu freelists:
24 * steal_tags() uses this to decide when to steal tags, and which cpus
25 * to try stealing from.
26 *
27 * It's ok for a freelist to be empty when its bit is set - steal_tags()
28 * will just keep looking - but the bitmap _must_ be set whenever a
29 * percpu freelist does have tags.
30 */
31 cpumask_t cpus_have_tags;
32
33 struct {
34 spinlock_t lock;
35 /*
36 * When we go to steal tags from another cpu (see steal_tags()),
37 * we want to pick a cpu at random. Cycling through them every
38 * time we steal is a bit easier and more or less equivalent:
39 */
40 unsigned cpu_last_stolen;
41
42 /* For sleeping on allocation failure */
43 wait_queue_head_t wait;
44
45 /*
46 * Global freelist - it's a stack where nr_free points to the
47 * top
48 */
49 unsigned nr_free;
50 unsigned *freelist;
51 } ____cacheline_aligned_in_smp;
52};
53
54int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
55void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
56
57void percpu_ida_destroy(struct percpu_ida *pool);
58int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags);
59
60#endif /* __PERCPU_IDA_H__ */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c43f6eabad5b..c8ba627c1d60 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -48,6 +48,7 @@ struct perf_guest_info_callbacks {
48#include <linux/cpu.h> 48#include <linux/cpu.h>
49#include <linux/irq_work.h> 49#include <linux/irq_work.h>
50#include <linux/static_key.h> 50#include <linux/static_key.h>
51#include <linux/jump_label_ratelimit.h>
51#include <linux/atomic.h> 52#include <linux/atomic.h>
52#include <linux/sysfs.h> 53#include <linux/sysfs.h>
53#include <linux/perf_regs.h> 54#include <linux/perf_regs.h>
@@ -64,30 +65,6 @@ struct perf_raw_record {
64}; 65};
65 66
66/* 67/*
67 * single taken branch record layout:
68 *
69 * from: source instruction (may not always be a branch insn)
70 * to: branch target
71 * mispred: branch target was mispredicted
72 * predicted: branch target was predicted
73 *
74 * support for mispred, predicted is optional. In case it
75 * is not supported mispred = predicted = 0.
76 *
77 * in_tx: running in a hardware transaction
78 * abort: aborting a hardware transaction
79 */
80struct perf_branch_entry {
81 __u64 from;
82 __u64 to;
83 __u64 mispred:1, /* target mispredicted */
84 predicted:1,/* target predicted */
85 in_tx:1, /* in transaction */
86 abort:1, /* transaction abort */
87 reserved:60;
88};
89
90/*
91 * branch stack layout: 68 * branch stack layout:
92 * nr: number of taken branches stored in entries[] 69 * nr: number of taken branches stored in entries[]
93 * 70 *
@@ -317,9 +294,31 @@ struct ring_buffer;
317 */ 294 */
318struct perf_event { 295struct perf_event {
319#ifdef CONFIG_PERF_EVENTS 296#ifdef CONFIG_PERF_EVENTS
320 struct list_head group_entry; 297 /*
298 * entry onto perf_event_context::event_list;
299 * modifications require ctx->lock
300 * RCU safe iterations.
301 */
321 struct list_head event_entry; 302 struct list_head event_entry;
303
304 /*
305 * XXX: group_entry and sibling_list should be mutually exclusive;
306 * either you're a sibling on a group, or you're the group leader.
307 * Rework the code to always use the same list element.
308 *
309 * Locked for modification by both ctx->mutex and ctx->lock; holding
310 * either sufficies for read.
311 */
312 struct list_head group_entry;
322 struct list_head sibling_list; 313 struct list_head sibling_list;
314
315 /*
316 * We need storage to track the entries in perf_pmu_migrate_context; we
317 * cannot use the event_entry because of RCU and we want to keep the
318 * group in tact which avoids us using the other two entries.
319 */
320 struct list_head migrate_entry;
321
323 struct hlist_node hlist_entry; 322 struct hlist_node hlist_entry;
324 int nr_siblings; 323 int nr_siblings;
325 int group_flags; 324 int group_flags;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index bf7e989abcb5..fb90ef5eb038 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -137,6 +137,39 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param
137 return PIN_CONF_PACKED(param, argument); 137 return PIN_CONF_PACKED(param, argument);
138} 138}
139 139
140#ifdef CONFIG_OF
141
142#include <linux/device.h>
143#include <linux/pinctrl/machine.h>
144struct pinctrl_dev;
145struct pinctrl_map;
146
147int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev,
148 struct device_node *np, struct pinctrl_map **map,
149 unsigned *reserved_maps, unsigned *num_maps,
150 enum pinctrl_map_type type);
151int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
152 struct device_node *np_config, struct pinctrl_map **map,
153 unsigned *num_maps, enum pinctrl_map_type type);
154
155static inline int pinconf_generic_dt_node_to_map_group(
156 struct pinctrl_dev *pctldev, struct device_node *np_config,
157 struct pinctrl_map **map, unsigned *num_maps)
158{
159 return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
160 PIN_MAP_TYPE_CONFIGS_GROUP);
161}
162
163static inline int pinconf_generic_dt_node_to_map_pin(
164 struct pinctrl_dev *pctldev, struct device_node *np_config,
165 struct pinctrl_map **map, unsigned *num_maps)
166{
167 return pinconf_generic_dt_node_to_map(pctldev, np_config, map, num_maps,
168 PIN_MAP_TYPE_CONFIGS_PIN);
169}
170
171#endif
172
140#endif /* CONFIG_GENERIC_PINCONF */ 173#endif /* CONFIG_GENERIC_PINCONF */
141 174
142#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ 175#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index f6998692bdc9..09eb80f2574a 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -47,13 +47,15 @@ struct pinconf_ops {
47 unsigned long *config); 47 unsigned long *config);
48 int (*pin_config_set) (struct pinctrl_dev *pctldev, 48 int (*pin_config_set) (struct pinctrl_dev *pctldev,
49 unsigned pin, 49 unsigned pin,
50 unsigned long config); 50 unsigned long *configs,
51 unsigned num_configs);
51 int (*pin_config_group_get) (struct pinctrl_dev *pctldev, 52 int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
52 unsigned selector, 53 unsigned selector,
53 unsigned long *config); 54 unsigned long *config);
54 int (*pin_config_group_set) (struct pinctrl_dev *pctldev, 55 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
55 unsigned selector, 56 unsigned selector,
56 unsigned long config); 57 unsigned long *configs,
58 unsigned num_configs);
57 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev, 59 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
58 const char *arg, 60 const char *arg,
59 unsigned long *config); 61 unsigned long *config);
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 88272591a895..9efc04dd255a 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -36,6 +36,7 @@ struct samsung_i2s {
36 */ 36 */
37#define QUIRK_NO_MUXPSR (1 << 2) 37#define QUIRK_NO_MUXPSR (1 << 2)
38#define QUIRK_NEED_RSTCLR (1 << 3) 38#define QUIRK_NEED_RSTCLR (1 << 3)
39#define QUIRK_SUPPORTS_TDM (1 << 4)
39 /* Quirks of the I2S controller */ 40 /* Quirks of the I2S controller */
40 u32 quirks; 41 u32 quirks;
41 dma_addr_t idma_addr; 42 dma_addr_t idma_addr;
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index e15745b4f3a5..b3ca1e94e0c8 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -14,12 +14,16 @@
14 (Interruptions registers mostly) 14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register 15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register 16 * @trigger_register: Offset of the Trigger setup register
17 * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
18 * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
17 */ 19 */
18struct at91_adc_reg_desc { 20struct at91_adc_reg_desc {
19 u8 channel_base; 21 u8 channel_base;
20 u32 drdy_mask; 22 u32 drdy_mask;
21 u8 status_register; 23 u8 status_register;
22 u8 trigger_register; 24 u8 trigger_register;
25 u32 mr_prescal_mask;
26 u32 mr_startup_mask;
23}; 27};
24 28
25/** 29/**
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index 6a293b7fff3b..cea9f70133c5 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -71,6 +71,10 @@ struct atmel_nand_data {
71 u8 on_flash_bbt; /* bbt on flash */ 71 u8 on_flash_bbt; /* bbt on flash */
72 struct mtd_partition *parts; 72 struct mtd_partition *parts;
73 unsigned int num_parts; 73 unsigned int num_parts;
74 bool has_dma; /* support dma transfer */
75
76 /* default is false, only for at32ap7000 chip is true */
77 bool need_reset_workaround;
74}; 78};
75 79
76 /* Serial */ 80 /* Serial */
diff --git a/include/linux/platform_data/bd6107.h b/include/linux/platform_data/bd6107.h
new file mode 100644
index 000000000000..671d6502d241
--- /dev/null
+++ b/include/linux/platform_data/bd6107.h
@@ -0,0 +1,19 @@
1/*
2 * bd6107.h - Rohm BD6107 LEDs Driver
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#ifndef __BD6107_H__
9#define __BD6107_H__
10
11struct device;
12
13struct bd6107_platform_data {
14 struct device *fbdev;
15 int reset; /* Reset GPIO */
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
index b7174998c24a..e75dcbf2b230 100644
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -94,6 +94,10 @@ void __init brcmfmac_init_pdata(void)
94 * Set this to true if the SDIO host controller has higher align requirement 94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item. 95 * than 32 bytes for each scatterlist item.
96 * 96 *
97 * sd_head_align: alignment requirement for start of data buffer
98 *
99 * sd_sgentry_align: length alignment requirement for each sg entry
100 *
97 * power_on: This function is called by the brcmfmac when the module gets 101 * power_on: This function is called by the brcmfmac when the module gets
98 * loaded. This can be particularly useful for low power devices. The platform 102 * loaded. This can be particularly useful for low power devices. The platform
99 * spcific routine may for example decide to power up the complete device. 103 * spcific routine may for example decide to power up the complete device.
@@ -121,6 +125,8 @@ struct brcmfmac_sdio_platform_data {
121 unsigned int oob_irq_nr; 125 unsigned int oob_irq_nr;
122 unsigned long oob_irq_flags; 126 unsigned long oob_irq_flags;
123 bool broken_sg_support; 127 bool broken_sg_support;
128 unsigned short sd_head_align;
129 unsigned short sd_sgentry_align;
124 void (*power_on)(void); 130 void (*power_on)(void);
125 void (*power_off)(void); 131 void (*power_off)(void);
126 void (*reset)(void); 132 void (*reset)(void);
diff --git a/include/linux/platform_data/camera-mx3.h b/include/linux/platform_data/camera-mx3.h
index f226ee3777e1..a910dadc8258 100644
--- a/include/linux/platform_data/camera-mx3.h
+++ b/include/linux/platform_data/camera-mx3.h
@@ -33,6 +33,8 @@
33#define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \ 33#define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \
34 MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15) 34 MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15)
35 35
36struct v4l2_async_subdev;
37
36/** 38/**
37 * struct mx3_camera_pdata - i.MX3x camera platform data 39 * struct mx3_camera_pdata - i.MX3x camera platform data
38 * @flags: MX3_CAMERA_* flags 40 * @flags: MX3_CAMERA_* flags
@@ -43,6 +45,8 @@ struct mx3_camera_pdata {
43 unsigned long flags; 45 unsigned long flags;
44 unsigned long mclk_10khz; 46 unsigned long mclk_10khz;
45 struct device *dma_dev; 47 struct device *dma_dev;
48 struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */
49 int *asd_sizes; /* 0-terminated array of asd group sizes */
46}; 50};
47 51
48#endif 52#endif
diff --git a/include/linux/platform_data/camera-rcar.h b/include/linux/platform_data/camera-rcar.h
new file mode 100644
index 000000000000..dfc83c581593
--- /dev/null
+++ b/include/linux/platform_data/camera-rcar.h
@@ -0,0 +1,25 @@
1/*
2 * Platform data for Renesas R-Car VIN soc-camera driver
3 *
4 * Copyright (C) 2011-2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Cogent Embedded, Inc., <source@cogentembedded.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __CAMERA_RCAR_H_
14#define __CAMERA_RCAR_H_
15
16#define RCAR_VIN_HSYNC_ACTIVE_LOW (1 << 0)
17#define RCAR_VIN_VSYNC_ACTIVE_LOW (1 << 1)
18#define RCAR_VIN_BT601 (1 << 2)
19#define RCAR_VIN_BT656 (1 << 3)
20
21struct rcar_vin_platform_data {
22 unsigned int flags;
23};
24
25#endif /* __CAMERA_RCAR_H_ */
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
deleted file mode 100644
index bb3cd58d71e3..000000000000
--- a/include/linux/platform_data/cpsw.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Texas Instruments Ethernet Switch Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef __CPSW_H__
16#define __CPSW_H__
17
18#include <linux/if_ether.h>
19
20struct cpsw_slave_data {
21 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if;
23 u8 mac_addr[ETH_ALEN];
24 u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
25
26};
27
28struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 slaves; /* number of slave cpgmac ports */
32 struct cpsw_slave_data *slave_data;
33 u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */
34 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */
35 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
36 u32 ale_entries; /* ale table size */
37 u32 bd_ram_size; /*buffer descriptor ram size */
38 u32 rx_descs; /* Number of Rx Descriptios */
39 u32 mac_control; /* Mac control register */
40 u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
41 bool dual_emac; /* Enable Dual EMAC mode */
42};
43
44#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dma-rcar-hpbdma.h b/include/linux/platform_data/dma-rcar-hpbdma.h
new file mode 100644
index 000000000000..648b8ea61a22
--- /dev/null
+++ b/include/linux/platform_data/dma-rcar-hpbdma.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2011-2013 Renesas Electronics Corporation
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
8 */
9
10#ifndef __DMA_RCAR_HPBDMA_H
11#define __DMA_RCAR_HPBDMA_H
12
13#include <linux/bitops.h>
14#include <linux/types.h>
15
16/* Transmit sizes and respective register values */
17enum {
18 XMIT_SZ_8BIT = 0,
19 XMIT_SZ_16BIT = 1,
20 XMIT_SZ_32BIT = 2,
21 XMIT_SZ_MAX
22};
23
24/* DMA control register (DCR) bits */
25#define HPB_DMAE_DCR_DTAMD (1u << 26)
26#define HPB_DMAE_DCR_DTAC (1u << 25)
27#define HPB_DMAE_DCR_DTAU (1u << 24)
28#define HPB_DMAE_DCR_DTAU1 (1u << 23)
29#define HPB_DMAE_DCR_SWMD (1u << 22)
30#define HPB_DMAE_DCR_BTMD (1u << 21)
31#define HPB_DMAE_DCR_PKMD (1u << 20)
32#define HPB_DMAE_DCR_CT (1u << 18)
33#define HPB_DMAE_DCR_ACMD (1u << 17)
34#define HPB_DMAE_DCR_DIP (1u << 16)
35#define HPB_DMAE_DCR_SMDL (1u << 13)
36#define HPB_DMAE_DCR_SPDAM (1u << 12)
37#define HPB_DMAE_DCR_SDRMD_MASK (3u << 10)
38#define HPB_DMAE_DCR_SDRMD_MOD (0u << 10)
39#define HPB_DMAE_DCR_SDRMD_AUTO (1u << 10)
40#define HPB_DMAE_DCR_SDRMD_TIMER (2u << 10)
41#define HPB_DMAE_DCR_SPDS_MASK (3u << 8)
42#define HPB_DMAE_DCR_SPDS_8BIT (0u << 8)
43#define HPB_DMAE_DCR_SPDS_16BIT (1u << 8)
44#define HPB_DMAE_DCR_SPDS_32BIT (2u << 8)
45#define HPB_DMAE_DCR_DMDL (1u << 5)
46#define HPB_DMAE_DCR_DPDAM (1u << 4)
47#define HPB_DMAE_DCR_DDRMD_MASK (3u << 2)
48#define HPB_DMAE_DCR_DDRMD_MOD (0u << 2)
49#define HPB_DMAE_DCR_DDRMD_AUTO (1u << 2)
50#define HPB_DMAE_DCR_DDRMD_TIMER (2u << 2)
51#define HPB_DMAE_DCR_DPDS_MASK (3u << 0)
52#define HPB_DMAE_DCR_DPDS_8BIT (0u << 0)
53#define HPB_DMAE_DCR_DPDS_16BIT (1u << 0)
54#define HPB_DMAE_DCR_DPDS_32BIT (2u << 0)
55
56/* Asynchronous reset register (ASYNCRSTR) bits */
57#define HPB_DMAE_ASYNCRSTR_ASRST41 BIT(10)
58#define HPB_DMAE_ASYNCRSTR_ASRST40 BIT(9)
59#define HPB_DMAE_ASYNCRSTR_ASRST39 BIT(8)
60#define HPB_DMAE_ASYNCRSTR_ASRST27 BIT(7)
61#define HPB_DMAE_ASYNCRSTR_ASRST26 BIT(6)
62#define HPB_DMAE_ASYNCRSTR_ASRST25 BIT(5)
63#define HPB_DMAE_ASYNCRSTR_ASRST24 BIT(4)
64#define HPB_DMAE_ASYNCRSTR_ASRST23 BIT(3)
65#define HPB_DMAE_ASYNCRSTR_ASRST22 BIT(2)
66#define HPB_DMAE_ASYNCRSTR_ASRST21 BIT(1)
67#define HPB_DMAE_ASYNCRSTR_ASRST20 BIT(0)
68
69struct hpb_dmae_slave_config {
70 unsigned int id;
71 dma_addr_t addr;
72 u32 dcr;
73 u32 port;
74 u32 rstr;
75 u32 mdr;
76 u32 mdm;
77 u32 flags;
78#define HPB_DMAE_SET_ASYNC_RESET BIT(0)
79#define HPB_DMAE_SET_ASYNC_MODE BIT(1)
80 u32 dma_ch;
81};
82
83#define HPB_DMAE_CHANNEL(_irq, _s_id) \
84{ \
85 .ch_irq = _irq, \
86 .s_id = _s_id, \
87}
88
89struct hpb_dmae_channel {
90 unsigned int ch_irq;
91 unsigned int s_id;
92};
93
94struct hpb_dmae_pdata {
95 const struct hpb_dmae_slave_config *slaves;
96 int num_slaves;
97 const struct hpb_dmae_channel *channels;
98 int num_channels;
99 const unsigned int ts_shift[XMIT_SZ_MAX];
100 int num_hw_channels;
101};
102
103#endif
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index 57300fd7cc03..179fb91bb5f2 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -180,4 +180,6 @@ struct edma_soc_info {
180 const s16 (*xbar_chans)[2]; 180 const s16 (*xbar_chans)[2];
181}; 181};
182 182
183int edma_trigger_channel(unsigned);
184
183#endif 185#endif
diff --git a/include/linux/platform_data/efm32-spi.h b/include/linux/platform_data/efm32-spi.h
new file mode 100644
index 000000000000..31b19ca1d73a
--- /dev/null
+++ b/include/linux/platform_data/efm32-spi.h
@@ -0,0 +1,14 @@
1#ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__
2#define __LINUX_PLATFORM_DATA_EFM32_SPI_H__
3
4#include <linux/types.h>
5
6/**
7 * struct efm32_spi_pdata
8 * @location: pinmux location for the I/O pins (to be written to the ROUTE
9 * register)
10 */
11struct efm32_spi_pdata {
12 u8 location;
13};
14#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__ */
diff --git a/include/linux/platform_data/exynos_thermal.h b/include/linux/platform_data/exynos_thermal.h
deleted file mode 100644
index da7e6274b175..000000000000
--- a/include/linux/platform_data/exynos_thermal.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@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_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS_THERMAL_H
24#include <linux/cpu_cooling.h>
25
26enum calibration_type {
27 TYPE_ONE_POINT_TRIMMING,
28 TYPE_TWO_POINT_TRIMMING,
29 TYPE_NONE,
30};
31
32enum soc_type {
33 SOC_ARCH_EXYNOS4210 = 1,
34 SOC_ARCH_EXYNOS,
35};
36/**
37 * struct freq_clip_table
38 * @freq_clip_max: maximum frequency allowed for this cooling state.
39 * @temp_level: Temperature level at which the temperature clipping will
40 * happen.
41 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
42 *
43 * This structure is required to be filled and passed to the
44 * cpufreq_cooling_unregister function.
45 */
46struct freq_clip_table {
47 unsigned int freq_clip_max;
48 unsigned int temp_level;
49 const struct cpumask *mask_val;
50};
51
52/**
53 * struct exynos_tmu_platform_data
54 * @threshold: basic temperature for generating interrupt
55 * 25 <= threshold <= 125 [unit: degree Celsius]
56 * @threshold_falling: differntial value for setting threshold
57 * of temperature falling interrupt.
58 * @trigger_levels: array for each interrupt levels
59 * [unit: degree Celsius]
60 * 0: temperature for trigger_level0 interrupt
61 * condition for trigger_level0 interrupt:
62 * current temperature > threshold + trigger_levels[0]
63 * 1: temperature for trigger_level1 interrupt
64 * condition for trigger_level1 interrupt:
65 * current temperature > threshold + trigger_levels[1]
66 * 2: temperature for trigger_level2 interrupt
67 * condition for trigger_level2 interrupt:
68 * current temperature > threshold + trigger_levels[2]
69 * 3: temperature for trigger_level3 interrupt
70 * condition for trigger_level3 interrupt:
71 * current temperature > threshold + trigger_levels[3]
72 * @trigger_level0_en:
73 * 1 = enable trigger_level0 interrupt,
74 * 0 = disable trigger_level0 interrupt
75 * @trigger_level1_en:
76 * 1 = enable trigger_level1 interrupt,
77 * 0 = disable trigger_level1 interrupt
78 * @trigger_level2_en:
79 * 1 = enable trigger_level2 interrupt,
80 * 0 = disable trigger_level2 interrupt
81 * @trigger_level3_en:
82 * 1 = enable trigger_level3 interrupt,
83 * 0 = disable trigger_level3 interrupt
84 * @gain: gain of amplifier in the positive-TC generator block
85 * 0 <= gain <= 15
86 * @reference_voltage: reference voltage of amplifier
87 * in the positive-TC generator block
88 * 0 <= reference_voltage <= 31
89 * @noise_cancel_mode: noise cancellation mode
90 * 000, 100, 101, 110 and 111 can be different modes
91 * @type: determines the type of SOC
92 * @efuse_value: platform defined fuse value
93 * @cal_type: calibration type for temperature
94 * @freq_clip_table: Table representing frequency reduction percentage.
95 * @freq_tab_count: Count of the above table as frequency reduction may
96 * applicable to only some of the trigger levels.
97 *
98 * This structure is required for configuration of exynos_tmu driver.
99 */
100struct exynos_tmu_platform_data {
101 u8 threshold;
102 u8 threshold_falling;
103 u8 trigger_levels[4];
104 bool trigger_level0_en;
105 bool trigger_level1_en;
106 bool trigger_level2_en;
107 bool trigger_level3_en;
108
109 u8 gain;
110 u8 reference_voltage;
111 u8 noise_cancel_mode;
112 u32 efuse_value;
113
114 enum calibration_type cal_type;
115 enum soc_type type;
116 struct freq_clip_table freq_tab[4];
117 unsigned int freq_tab_count;
118};
119#endif /* _LINUX_EXYNOS_THERMAL_H */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
index 573edfb046c4..7c5a519d2dcd 100644
--- a/include/linux/platform_data/gpio-em.h
+++ b/include/linux/platform_data/gpio-em.h
@@ -5,6 +5,7 @@ struct gpio_em_config {
5 unsigned int gpio_base; 5 unsigned int gpio_base;
6 unsigned int irq_base; 6 unsigned int irq_base;
7 unsigned int number_of_pins; 7 unsigned int number_of_pins;
8 const char *pctl_name;
8}; 9};
9 10
10#endif /* __GPIO_EM_H__ */ 11#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h
new file mode 100644
index 000000000000..5ae0d9c80d4d
--- /dev/null
+++ b/include/linux/platform_data/gpio_backlight.h
@@ -0,0 +1,21 @@
1/*
2 * gpio_backlight.h - Simple GPIO-controlled backlight
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#ifndef __GPIO_BACKLIGHT_H__
9#define __GPIO_BACKLIGHT_H__
10
11struct device;
12
13struct gpio_backlight_platform_data {
14 struct device *fbdev;
15 int gpio;
16 int def_value;
17 bool active_low;
18 const char *name;
19};
20
21#endif
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
index 202e290faea8..51a2ff579d60 100644
--- a/include/linux/platform_data/leds-lp55xx.h
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -36,6 +36,13 @@ struct lp55xx_predef_pattern {
36 u8 size_b; 36 u8 size_b;
37}; 37};
38 38
39enum lp8501_pwr_sel {
40 LP8501_ALL_VDD, /* D1~9 are connected to VDD */
41 LP8501_6VDD_3VOUT, /* D1~6 with VDD, D7~9 with VOUT */
42 LP8501_3VDD_6VOUT, /* D1~6 with VOUT, D7~9 with VDD */
43 LP8501_ALL_VOUT, /* D1~9 are connected to VOUT */
44};
45
39/* 46/*
40 * struct lp55xx_platform_data 47 * struct lp55xx_platform_data
41 * @led_config : Configurable led class device 48 * @led_config : Configurable led class device
@@ -67,6 +74,9 @@ struct lp55xx_platform_data {
67 /* Predefined pattern data */ 74 /* Predefined pattern data */
68 struct lp55xx_predef_pattern *patterns; 75 struct lp55xx_predef_pattern *patterns;
69 unsigned int num_patterns; 76 unsigned int num_patterns;
77
78 /* LP8501 specific */
79 enum lp8501_pwr_sel pwr_sel;
70}; 80};
71 81
72#endif /* _LEDS_LP55XX_H */ 82#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/leds-pca9633.h b/include/linux/platform_data/leds-pca963x.h
index c5bf29b6fa7f..e731f0036329 100644
--- a/include/linux/platform_data/leds-pca9633.h
+++ b/include/linux/platform_data/leds-pca963x.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * PCA9633 LED chip driver. 2 * PCA963X LED chip driver.
3 * 3 *
4 * Copyright 2012 bct electronic GmbH 4 * Copyright 2012 bct electronic GmbH
5 * Copyright 2013 Qtechnology A/S
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -18,18 +19,24 @@
18 * 02110-1301 USA 19 * 02110-1301 USA
19 */ 20 */
20 21
21#ifndef __LINUX_PCA9633_H 22#ifndef __LINUX_PCA963X_H
22#define __LINUX_PCA9633_H 23#define __LINUX_PCA963X_H
23#include <linux/leds.h> 24#include <linux/leds.h>
24 25
25enum pca9633_outdrv { 26enum pca963x_outdrv {
26 PCA9633_OPEN_DRAIN, 27 PCA963X_OPEN_DRAIN,
27 PCA9633_TOTEM_POLE, /* aka push-pull */ 28 PCA963X_TOTEM_POLE, /* aka push-pull */
28}; 29};
29 30
30struct pca9633_platform_data { 31enum pca963x_blink_type {
32 PCA963X_SW_BLINK,
33 PCA963X_HW_BLINK,
34};
35
36struct pca963x_platform_data {
31 struct led_platform_data leds; 37 struct led_platform_data leds;
32 enum pca9633_outdrv outdrv; 38 enum pca963x_outdrv outdrv;
39 enum pca963x_blink_type blink_type;
33}; 40};
34 41
35#endif /* __LINUX_PCA9633_H*/ 42#endif /* __LINUX_PCA963X_H*/
diff --git a/include/linux/platform_data/leds-renesas-tpu.h b/include/linux/platform_data/leds-renesas-tpu.h
deleted file mode 100644
index 055387086fc1..000000000000
--- a/include/linux/platform_data/leds-renesas-tpu.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LEDS_RENESAS_TPU_H__
2#define __LEDS_RENESAS_TPU_H__
3
4struct led_renesas_tpu_config {
5 char *name;
6 unsigned pin_gpio_fn;
7 unsigned pin_gpio;
8 unsigned int channel_offset;
9 unsigned int timer_bit;
10 unsigned int max_brightness;
11 unsigned int refresh_rate;
12};
13
14#endif /* __LEDS_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/lv5207lp.h b/include/linux/platform_data/lv5207lp.h
new file mode 100644
index 000000000000..7dc4d9a219a6
--- /dev/null
+++ b/include/linux/platform_data/lv5207lp.h
@@ -0,0 +1,19 @@
1/*
2 * lv5207lp.h - Sanyo LV5207LP LEDs Driver
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#ifndef __LV5207LP_H__
9#define __LV5207LP_H__
10
11struct device;
12
13struct lv5207lp_platform_data {
14 struct device *fbdev;
15 unsigned int max_value;
16 unsigned int def_value;
17};
18
19#endif
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
index 91648bf5fc5c..dd11dcd1a184 100644
--- a/include/linux/platform_data/max310x.h
+++ b/include/linux/platform_data/max310x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Maxim (Dallas) MAX3107/8 serial driver 2 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver
3 * 3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> 4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 * 5 *
@@ -37,14 +37,13 @@
37 * }; 37 * };
38 */ 38 */
39 39
40#define MAX310X_MAX_UARTS 1 40#define MAX310X_MAX_UARTS 4
41 41
42/* MAX310X platform data structure */ 42/* MAX310X platform data structure */
43struct max310x_pdata { 43struct max310x_pdata {
44 /* Flags global to driver */ 44 /* Flags global to driver */
45 const u8 driver_flags:2; 45 const u8 driver_flags;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */ 46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47#define MAX310X_AUTOSLEEP (0x00000002) /* Enable AutoSleep mode */
48 /* Flags global to UART port */ 47 /* Flags global to UART port */
49 const u8 uart_flags[MAX310X_MAX_UARTS]; 48 const u8 uart_flags[MAX310X_MAX_UARTS];
50#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */ 49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
@@ -60,8 +59,6 @@ struct max310x_pdata {
60 void (*init)(void); 59 void (*init)(void);
61 /* Called before finish */ 60 /* Called before finish */
62 void (*exit)(void); 61 void (*exit)(void);
63 /* Suspend callback */
64 void (*suspend)(int do_suspend);
65}; 62};
66 63
67#endif 64#endif
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index c42f39f20195..ffb801998e5d 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -16,19 +16,6 @@ struct pxa3xx_nand_timing {
16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */ 16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */
17}; 17};
18 18
19struct pxa3xx_nand_cmdset {
20 uint16_t read1;
21 uint16_t read2;
22 uint16_t program;
23 uint16_t read_status;
24 uint16_t read_id;
25 uint16_t erase;
26 uint16_t reset;
27 uint16_t lock;
28 uint16_t unlock;
29 uint16_t lock_status;
30};
31
32struct pxa3xx_nand_flash { 19struct pxa3xx_nand_flash {
33 char *name; 20 char *name;
34 uint32_t chip_id; 21 uint32_t chip_id;
diff --git a/include/linux/platform_data/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h
deleted file mode 100644
index 5d298ac10fc2..000000000000
--- a/include/linux/platform_data/omap-abe-twl6040.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/**
2 * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header.
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
5 * All rights reserved.
6 *
7 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * 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., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef _OMAP_ABE_TWL6040_H_
25#define _OMAP_ABE_TWL6040_H_
26
27/* To select if only one channel is connected in a stereo port */
28#define ABE_TWL6040_LEFT (1 << 0)
29#define ABE_TWL6040_RIGHT (1 << 1)
30
31struct omap_abe_twl6040_data {
32 char *card_name;
33 /* Feature flags for connected audio pins */
34 u8 has_hs;
35 u8 has_hf;
36 bool has_ep;
37 u8 has_aux;
38 u8 has_vibra;
39 bool has_dmic;
40 bool has_hsmic;
41 bool has_mainmic;
42 bool has_submic;
43 u8 has_afm;
44 /* Other features */
45 bool jack_detection; /* board can detect jack events */
46 int mclk_freq; /* MCLK frequency speed for twl6040 */
47};
48
49#endif /* _OMAP_ABE_TWL6040_H_ */
diff --git a/include/linux/i2c/pca953x.h b/include/linux/platform_data/pca953x.h
index 3c98dd4f901f..3c98dd4f901f 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/platform_data/pca953x.h
diff --git a/include/linux/platform_data/pinctrl-nomadik.h b/include/linux/platform_data/pinctrl-nomadik.h
index f73b2f0c55b7..abf5bed84df3 100644
--- a/include/linux/platform_data/pinctrl-nomadik.h
+++ b/include/linux/platform_data/pinctrl-nomadik.h
@@ -226,30 +226,6 @@ enum nmk_gpio_slpm {
226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, 226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
227}; 227};
228 228
229/* Older deprecated pin config API that should go away soon */
230extern int nmk_config_pin(pin_cfg_t cfg, bool sleep);
231extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
232extern int nmk_config_pins_sleep(pin_cfg_t *cfgs, int num);
233extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
234extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
235#ifdef CONFIG_PINCTRL_NOMADIK
236extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
237#else
238static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
239{
240 return -ENODEV;
241}
242#endif
243extern int nmk_gpio_get_mode(int gpio);
244
245extern void nmk_gpio_wakeups_suspend(void);
246extern void nmk_gpio_wakeups_resume(void);
247
248extern void nmk_gpio_clocks_enable(void);
249extern void nmk_gpio_clocks_disable(void);
250
251extern void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up);
252
253/* 229/*
254 * Platform data to register a block: only the initial gpio/irq number. 230 * Platform data to register a block: only the initial gpio/irq number.
255 */ 231 */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
index 80587fdbba3e..1a2e9901a22e 100644
--- a/include/linux/platform_data/rcar-du.h
+++ b/include/linux/platform_data/rcar-du.h
@@ -16,8 +16,18 @@
16 16
17#include <drm/drm_mode.h> 17#include <drm/drm_mode.h>
18 18
19enum rcar_du_output {
20 RCAR_DU_OUTPUT_DPAD0,
21 RCAR_DU_OUTPUT_DPAD1,
22 RCAR_DU_OUTPUT_LVDS0,
23 RCAR_DU_OUTPUT_LVDS1,
24 RCAR_DU_OUTPUT_TCON,
25 RCAR_DU_OUTPUT_MAX,
26};
27
19enum rcar_du_encoder_type { 28enum rcar_du_encoder_type {
20 RCAR_DU_ENCODER_UNUSED = 0, 29 RCAR_DU_ENCODER_UNUSED = 0,
30 RCAR_DU_ENCODER_NONE,
21 RCAR_DU_ENCODER_VGA, 31 RCAR_DU_ENCODER_VGA,
22 RCAR_DU_ENCODER_LVDS, 32 RCAR_DU_ENCODER_LVDS,
23}; 33};
@@ -28,22 +38,32 @@ struct rcar_du_panel_data {
28 struct drm_mode_modeinfo mode; 38 struct drm_mode_modeinfo mode;
29}; 39};
30 40
31struct rcar_du_encoder_lvds_data { 41struct rcar_du_connector_lvds_data {
32 struct rcar_du_panel_data panel; 42 struct rcar_du_panel_data panel;
33}; 43};
34 44
35struct rcar_du_encoder_vga_data { 45struct rcar_du_connector_vga_data {
36 /* TODO: Add DDC information for EDID retrieval */ 46 /* TODO: Add DDC information for EDID retrieval */
37}; 47};
38 48
49/*
50 * struct rcar_du_encoder_data - Encoder platform data
51 * @type: the encoder type (RCAR_DU_ENCODER_*)
52 * @output: the DU output the connector is connected to (RCAR_DU_OUTPUT_*)
53 * @connector.lvds: platform data for LVDS connectors
54 * @connector.vga: platform data for VGA connectors
55 *
56 * Encoder platform data describes an on-board encoder, its associated DU SoC
57 * output, and the connector.
58 */
39struct rcar_du_encoder_data { 59struct rcar_du_encoder_data {
40 enum rcar_du_encoder_type encoder; 60 enum rcar_du_encoder_type type;
41 unsigned int output; 61 enum rcar_du_output output;
42 62
43 union { 63 union {
44 struct rcar_du_encoder_lvds_data lvds; 64 struct rcar_du_connector_lvds_data lvds;
45 struct rcar_du_encoder_vga_data vga; 65 struct rcar_du_connector_vga_data vga;
46 } u; 66 } connector;
47}; 67};
48 68
49struct rcar_du_platform_data { 69struct rcar_du_platform_data {
diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index bdc510d03245..af0c8c3b89ae 100644
--- a/include/linux/platform_data/serial-sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -60,7 +60,6 @@
60 * }; 60 * };
61 * 61 *
62 * static struct sccnxp_pdata sc2892_info = { 62 * static struct sccnxp_pdata sc2892_info = {
63 * .frequency = 3686400,
64 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0), 63 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0),
65 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1), 64 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1),
66 * }; 65 * };
@@ -78,8 +77,6 @@
78 77
79/* SCCNXP platform data structure */ 78/* SCCNXP platform data structure */
80struct sccnxp_pdata { 79struct sccnxp_pdata {
81 /* Frequency (extrenal clock or crystal) */
82 int frequency;
83 /* Shift for A0 line */ 80 /* Shift for A0 line */
84 const u8 reg_shift; 81 const u8 reg_shift;
85 /* Modem control lines configuration */ 82 /* Modem control lines configuration */
diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h
new file mode 100644
index 000000000000..077303cedbf4
--- /dev/null
+++ b/include/linux/platform_data/simplefb.h
@@ -0,0 +1,64 @@
1/*
2 * simplefb.h - Simple Framebuffer Device
3 *
4 * Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __PLATFORM_DATA_SIMPLEFB_H__
13#define __PLATFORM_DATA_SIMPLEFB_H__
14
15#include <drm/drm_fourcc.h>
16#include <linux/fb.h>
17#include <linux/kernel.h>
18
19/* format array, use it to initialize a "struct simplefb_format" array */
20#define SIMPLEFB_FORMATS \
21{ \
22 { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \
23 { "x1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {0, 0}, DRM_FORMAT_XRGB1555 }, \
24 { "a1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {15, 1}, DRM_FORMAT_ARGB1555 }, \
25 { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
26 { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
27 { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
28 { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \
29 { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
30 { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
31}
32
33/*
34 * Data-Format for Simple-Framebuffers
35 * @name: unique 0-terminated name that can be used to identify the mode
36 * @red,green,blue: Offsets and sizes of the single RGB parts
37 * @transp: Offset and size of the alpha bits. length=0 means no alpha
38 * @fourcc: 32bit DRM four-CC code (see drm_fourcc.h)
39 */
40struct simplefb_format {
41 const char *name;
42 u32 bits_per_pixel;
43 struct fb_bitfield red;
44 struct fb_bitfield green;
45 struct fb_bitfield blue;
46 struct fb_bitfield transp;
47 u32 fourcc;
48};
49
50/*
51 * Simple-Framebuffer description
52 * If the arch-boot code creates simple-framebuffers without DT support, it
53 * can pass the width, height, stride and format via this platform-data object.
54 * The framebuffer location must be given as IORESOURCE_MEM resource.
55 * @format must be a format as described in "struct simplefb_format" above.
56 */
57struct simplefb_platform_data {
58 u32 width;
59 u32 height;
60 u32 stride;
61 const char *format;
62};
63
64#endif /* __PLATFORM_DATA_SIMPLEFB_H__ */
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h
new file mode 100644
index 000000000000..753839187ba0
--- /dev/null
+++ b/include/linux/platform_data/st_sensors_pdata.h
@@ -0,0 +1,24 @@
1/*
2 * STMicroelectronics sensors platform-data driver
3 *
4 * Copyright 2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_PDATA_H
12#define ST_SENSORS_PDATA_H
13
14/**
15 * struct st_sensors_platform_data - Platform data for the ST sensors
16 * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2).
17 * Available only for accelerometer and pressure sensors.
18 * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet).
19 */
20struct st_sensors_platform_data {
21 u8 drdy_int_pin;
22};
23
24#endif /* ST_SENSORS_PDATA_H */
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
deleted file mode 100644
index 66c673fef408..000000000000
--- a/include/linux/platform_data/tegra_usb.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _TEGRA_USB_H_
16#define _TEGRA_USB_H_
17
18enum tegra_usb_operating_modes {
19 TEGRA_USB_DEVICE,
20 TEGRA_USB_HOST,
21 TEGRA_USB_OTG,
22};
23
24struct tegra_ehci_platform_data {
25 enum tegra_usb_operating_modes operating_mode;
26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend;
28 void *phy_config;
29 int vbus_gpio;
30};
31
32#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_data/vsp1.h b/include/linux/platform_data/vsp1.h
new file mode 100644
index 000000000000..a73a456d7f11
--- /dev/null
+++ b/include/linux/platform_data/vsp1.h
@@ -0,0 +1,25 @@
1/*
2 * vsp1.h -- R-Car VSP1 Platform Data
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.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#ifndef __PLATFORM_VSP1_H__
14#define __PLATFORM_VSP1_H__
15
16#define VSP1_HAS_LIF (1 << 0)
17
18struct vsp1_platform_data {
19 unsigned int features;
20 unsigned int rpf_count;
21 unsigned int uds_count;
22 unsigned int wpf_count;
23};
24
25#endif /* __PLATFORM_VSP1_H__ */
diff --git a/include/linux/power/bq24190_charger.h b/include/linux/power/bq24190_charger.h
new file mode 100644
index 000000000000..9f0283721cbc
--- /dev/null
+++ b/include/linux/power/bq24190_charger.h
@@ -0,0 +1,16 @@
1/*
2 * Platform data for the TI bq24190 battery charger driver.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _BQ24190_CHARGER_H_
10#define _BQ24190_CHARGER_H_
11
12struct bq24190_platform_data {
13 unsigned int gpio_int; /* GPIO pin that's connected to INT# */
14};
15
16#endif
diff --git a/include/linux/power/twl4030_madc_battery.h b/include/linux/power/twl4030_madc_battery.h
new file mode 100644
index 000000000000..23110dc77726
--- /dev/null
+++ b/include/linux/power/twl4030_madc_battery.h
@@ -0,0 +1,39 @@
1/*
2 * Dumb driver for LiIon batteries using TWL4030 madc.
3 *
4 * Copyright 2013 Golden Delicious Computers
5 * Nikolaus Schaller <hns@goldelico.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * You should have received a copy of the GNU General Public License along
13 * with this program; if not, write to the Free Software Foundation, Inc.,
14 * 675 Mass Ave, Cambridge, MA 02139, USA.
15 *
16 */
17
18#ifndef __TWL4030_MADC_BATTERY_H
19#define __TWL4030_MADC_BATTERY_H
20
21/*
22 * Usually we can assume 100% @ 4.15V and 0% @ 3.3V but curves differ for
23 * charging and discharging!
24 */
25
26struct twl4030_madc_bat_calibration {
27 short voltage; /* in mV - specify -1 for end of list */
28 short level; /* in percent (0 .. 100%) */
29};
30
31struct twl4030_madc_bat_platform_data {
32 unsigned int capacity; /* total capacity in uAh */
33 struct twl4030_madc_bat_calibration *charging;
34 int charging_size;
35 struct twl4030_madc_bat_calibration *discharging;
36 int discharging_size;
37};
38
39#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 804b90643a85..5c2600630dc9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/workqueue.h> 16#include <linux/workqueue.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/spinlock.h>
18 19
19struct device; 20struct device;
20 21
@@ -194,6 +195,8 @@ struct power_supply {
194 /* private */ 195 /* private */
195 struct device *dev; 196 struct device *dev;
196 struct work_struct changed_work; 197 struct work_struct changed_work;
198 spinlock_t changed_lock;
199 bool changed;
197#ifdef CONFIG_THERMAL 200#ifdef CONFIG_THERMAL
198 struct thermal_zone_device *tzd; 201 struct thermal_zone_device *tzd;
199 struct thermal_cooling_device *tcd; 202 struct thermal_cooling_device *tcd;
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 7db3eb93a079..1d2cd21242e8 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -80,7 +80,7 @@ struct pps_device {
80 * Global variables 80 * Global variables
81 */ 81 */
82 82
83extern struct device_attribute pps_attrs[]; 83extern const struct attribute_group *pps_groups[];
84 84
85/* 85/*
86 * Internal functions. 86 * Internal functions.
diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
new file mode 100644
index 000000000000..931bc616219f
--- /dev/null
+++ b/include/linux/preempt_mask.h
@@ -0,0 +1,122 @@
1#ifndef LINUX_PREEMPT_MASK_H
2#define LINUX_PREEMPT_MASK_H
3
4#include <linux/preempt.h>
5#include <asm/hardirq.h>
6
7/*
8 * We put the hardirq and softirq counter into the preemption
9 * counter. The bitmask has the following meaning:
10 *
11 * - bits 0-7 are the preemption count (max preemption depth: 256)
12 * - bits 8-15 are the softirq count (max # of softirqs: 256)
13 *
14 * The hardirq count can in theory reach the same as NR_IRQS.
15 * In reality, the number of nested IRQS is limited to the stack
16 * size as well. For archs with over 1000 IRQS it is not practical
17 * to expect that they will all nest. We give a max of 10 bits for
18 * hardirq nesting. An arch may choose to give less than 10 bits.
19 * m68k expects it to be 8.
20 *
21 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
22 * - bit 26 is the NMI_MASK
23 * - bit 27 is the PREEMPT_ACTIVE flag
24 *
25 * PREEMPT_MASK: 0x000000ff
26 * SOFTIRQ_MASK: 0x0000ff00
27 * HARDIRQ_MASK: 0x03ff0000
28 * NMI_MASK: 0x04000000
29 */
30#define PREEMPT_BITS 8
31#define SOFTIRQ_BITS 8
32#define NMI_BITS 1
33
34#define MAX_HARDIRQ_BITS 10
35
36#ifndef HARDIRQ_BITS
37# define HARDIRQ_BITS MAX_HARDIRQ_BITS
38#endif
39
40#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
41#error HARDIRQ_BITS too high!
42#endif
43
44#define PREEMPT_SHIFT 0
45#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
46#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
47#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
48
49#define __IRQ_MASK(x) ((1UL << (x))-1)
50
51#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
52#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
53#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
54#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
55
56#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
57#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
58#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
59#define NMI_OFFSET (1UL << NMI_SHIFT)
60
61#define SOFTIRQ_DISABLE_OFFSET (2 * SOFTIRQ_OFFSET)
62
63#ifndef PREEMPT_ACTIVE
64#define PREEMPT_ACTIVE_BITS 1
65#define PREEMPT_ACTIVE_SHIFT (NMI_SHIFT + NMI_BITS)
66#define PREEMPT_ACTIVE (__IRQ_MASK(PREEMPT_ACTIVE_BITS) << PREEMPT_ACTIVE_SHIFT)
67#endif
68
69#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
70#error PREEMPT_ACTIVE is too low!
71#endif
72
73#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
74#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
75#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
76 | NMI_MASK))
77
78/*
79 * Are we doing bottom half or hardware interrupt processing?
80 * Are we in a softirq context? Interrupt context?
81 * in_softirq - Are we currently processing softirq or have bh disabled?
82 * in_serving_softirq - Are we currently processing softirq?
83 */
84#define in_irq() (hardirq_count())
85#define in_softirq() (softirq_count())
86#define in_interrupt() (irq_count())
87#define in_serving_softirq() (softirq_count() & SOFTIRQ_OFFSET)
88
89/*
90 * Are we in NMI context?
91 */
92#define in_nmi() (preempt_count() & NMI_MASK)
93
94#if defined(CONFIG_PREEMPT_COUNT)
95# define PREEMPT_CHECK_OFFSET 1
96#else
97# define PREEMPT_CHECK_OFFSET 0
98#endif
99
100/*
101 * Are we running in atomic context? WARNING: this macro cannot
102 * always detect atomic context; in particular, it cannot know about
103 * held spinlocks in non-preemptible kernels. Thus it should not be
104 * used in the general case to determine whether sleeping is possible.
105 * Do not use in_atomic() in driver code.
106 */
107#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
108
109/*
110 * Check whether we were atomic before we did preempt_disable():
111 * (used by the scheduler, *after* releasing the kernel lock)
112 */
113#define in_atomic_preempt_off() \
114 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
115
116#ifdef CONFIG_PREEMPT_COUNT
117# define preemptible() (preempt_count() == 0 && !irqs_disabled())
118#else
119# define preemptible() 0
120#endif
121
122#endif /* LINUX_PREEMPT_MASK_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 22c7052e9372..e6131a782481 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -200,7 +200,7 @@ static inline void show_regs_print_info(const char *log_lvl)
200} 200}
201#endif 201#endif
202 202
203extern void dump_stack(void) __cold; 203extern asmlinkage void dump_stack(void) __cold;
204 204
205#ifndef pr_fmt 205#ifndef pr_fmt
206#define pr_fmt(fmt) fmt 206#define pr_fmt(fmt) fmt
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 4aa80ba830a2..abd437d0a8a7 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -55,14 +55,14 @@ struct pstore_info {
55 int (*close)(struct pstore_info *psi); 55 int (*close)(struct pstore_info *psi);
56 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 56 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
57 int *count, struct timespec *time, char **buf, 57 int *count, struct timespec *time, char **buf,
58 struct pstore_info *psi); 58 bool *compressed, struct pstore_info *psi);
59 int (*write)(enum pstore_type_id type, 59 int (*write)(enum pstore_type_id type,
60 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
61 unsigned int part, int count, size_t hsize, 61 unsigned int part, int count, bool compressed,
62 size_t size, struct pstore_info *psi); 62 size_t size, struct pstore_info *psi);
63 int (*write_buf)(enum pstore_type_id type, 63 int (*write_buf)(enum pstore_type_id type,
64 enum kmsg_dump_reason reason, u64 *id, 64 enum kmsg_dump_reason reason, u64 *id,
65 unsigned int part, const char *buf, size_t hsize, 65 unsigned int part, const char *buf, bool compressed,
66 size_t size, struct pstore_info *psi); 66 size_t size, struct pstore_info *psi);
67 int (*erase)(enum pstore_type_id type, u64 id, 67 int (*erase)(enum pstore_type_id type, u64 id,
68 int count, struct timespec time, 68 int count, struct timespec time,
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 467cc6307b62..49444203328a 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -21,6 +21,8 @@
21 21
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of.h>
25
24 26
25/* 27/*
26 * SSP Serial Port Registers 28 * SSP Serial Port Registers
@@ -190,6 +192,8 @@ struct ssp_device {
190 int irq; 192 int irq;
191 int drcmr_rx; 193 int drcmr_rx;
192 int drcmr_tx; 194 int drcmr_tx;
195
196 struct device_node *of_node;
193}; 197};
194 198
195/** 199/**
@@ -218,11 +222,18 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
218#ifdef CONFIG_ARCH_PXA 222#ifdef CONFIG_ARCH_PXA
219struct ssp_device *pxa_ssp_request(int port, const char *label); 223struct ssp_device *pxa_ssp_request(int port, const char *label);
220void pxa_ssp_free(struct ssp_device *); 224void pxa_ssp_free(struct ssp_device *);
225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
226 const char *label);
221#else 227#else
222static inline struct ssp_device *pxa_ssp_request(int port, const char *label) 228static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
223{ 229{
224 return NULL; 230 return NULL;
225} 231}
232static inline struct ssp_device *pxa_ssp_request_of(const struct device_node *n,
233 const char *name)
234{
235 return NULL;
236}
226static inline void pxa_ssp_free(struct ssp_device *ssp) {} 237static inline void pxa_ssp_free(struct ssp_device *ssp) {}
227#endif 238#endif
228 239
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d13371134c59..cc7494a35429 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -328,6 +328,7 @@ struct quotactl_ops {
328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *); 328 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
330 int (*set_xstate)(struct super_block *, unsigned int, int); 330 int (*set_xstate)(struct super_block *, unsigned int, int);
331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
331}; 332};
332 333
333struct quota_format_type { 334struct quota_format_type {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 1c50093ae656..6965fe394c3b 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -41,6 +41,7 @@ void __quota_error(struct super_block *sb, const char *func,
41void inode_add_rsv_space(struct inode *inode, qsize_t number); 41void inode_add_rsv_space(struct inode *inode, qsize_t number);
42void inode_claim_rsv_space(struct inode *inode, qsize_t number); 42void inode_claim_rsv_space(struct inode *inode, qsize_t number);
43void inode_sub_rsv_space(struct inode *inode, qsize_t number); 43void inode_sub_rsv_space(struct inode *inode, qsize_t number);
44void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
44 45
45void dquot_initialize(struct inode *inode); 46void dquot_initialize(struct inode *inode);
46void dquot_drop(struct inode *inode); 47void dquot_drop(struct inode *inode);
@@ -59,6 +60,7 @@ int dquot_alloc_inode(const struct inode *inode);
59 60
60int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 61int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
61void dquot_free_inode(const struct inode *inode); 62void dquot_free_inode(const struct inode *inode);
63void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number);
62 64
63int dquot_disable(struct super_block *sb, int type, unsigned int flags); 65int dquot_disable(struct super_block *sb, int type, unsigned int flags);
64/* Suspend quotas on remount RO */ 66/* Suspend quotas on remount RO */
@@ -238,6 +240,13 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
238 return 0; 240 return 0;
239} 241}
240 242
243static inline int dquot_reclaim_space_nodirty(struct inode *inode,
244 qsize_t number)
245{
246 inode_sub_bytes(inode, number);
247 return 0;
248}
249
241static inline int dquot_disable(struct super_block *sb, int type, 250static inline int dquot_disable(struct super_block *sb, int type,
242 unsigned int flags) 251 unsigned int flags)
243{ 252{
@@ -336,6 +345,12 @@ static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
336 return ret; 345 return ret;
337} 346}
338 347
348static inline void dquot_reclaim_block(struct inode *inode, qsize_t nr)
349{
350 dquot_reclaim_space_nodirty(inode, nr << inode->i_blkbits);
351 mark_inode_dirty_sync(inode);
352}
353
339static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr) 354static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr)
340{ 355{
341 __dquot_free_space(inode, nr, 0); 356 __dquot_free_space(inode, nr, 0);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index ffc444c38b0a..403940787be1 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -231,6 +231,7 @@ unsigned long radix_tree_next_hole(struct radix_tree_root *root,
231unsigned long radix_tree_prev_hole(struct radix_tree_root *root, 231unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
232 unsigned long index, unsigned long max_scan); 232 unsigned long index, unsigned long max_scan);
233int radix_tree_preload(gfp_t gfp_mask); 233int radix_tree_preload(gfp_t gfp_mask);
234int radix_tree_maybe_preload(gfp_t gfp_mask);
234void radix_tree_init(void); 235void radix_tree_init(void);
235void *radix_tree_tag_set(struct radix_tree_root *root, 236void *radix_tree_tag_set(struct radix_tree_root *root,
236 unsigned long index, unsigned int tag); 237 unsigned long index, unsigned int tag);
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 8dfaa2ce2e95..73069cb6c54a 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -101,6 +101,7 @@ extern const struct raid6_calls raid6_altivec8;
101extern const struct raid6_calls raid6_avx2x1; 101extern const struct raid6_calls raid6_avx2x1;
102extern const struct raid6_calls raid6_avx2x2; 102extern const struct raid6_calls raid6_avx2x2;
103extern const struct raid6_calls raid6_avx2x4; 103extern const struct raid6_calls raid6_avx2x4;
104extern const struct raid6_calls raid6_tilegx8;
104 105
105struct raid6_recov_calls { 106struct raid6_recov_calls {
106 void (*data2)(int, size_t, int, int, void **); 107 void (*data2)(int, size_t, int, int, void **);
@@ -114,6 +115,11 @@ extern const struct raid6_recov_calls raid6_recov_intx1;
114extern const struct raid6_recov_calls raid6_recov_ssse3; 115extern const struct raid6_recov_calls raid6_recov_ssse3;
115extern const struct raid6_recov_calls raid6_recov_avx2; 116extern const struct raid6_recov_calls raid6_recov_avx2;
116 117
118extern const struct raid6_calls raid6_neonx1;
119extern const struct raid6_calls raid6_neonx2;
120extern const struct raid6_calls raid6_neonx4;
121extern const struct raid6_calls raid6_neonx8;
122
117/* Algorithm list */ 123/* Algorithm list */
118extern const struct raid6_calls * const raid6_algos[]; 124extern const struct raid6_calls * const raid6_algos[];
119extern const struct raid6_recov_calls *const raid6_recov_algos[]; 125extern const struct raid6_recov_calls *const raid6_recov_algos[];
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 69e37c2d1ea5..753207c8ce20 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -25,7 +25,7 @@ extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
25 25
26extern const struct file_operations ramfs_file_operations; 26extern const struct file_operations ramfs_file_operations;
27extern const struct vm_operations_struct generic_file_vm_ops; 27extern const struct vm_operations_struct generic_file_vm_ops;
28extern int __init init_rootfs(void); 28extern int __init init_ramfs_fs(void);
29 29
30int ramfs_fill_super(struct super_block *sb, void *data, int silent); 30int ramfs_fill_super(struct super_block *sb, void *data, int silent);
31 31
diff --git a/include/linux/random.h b/include/linux/random.h
index 3b9377d6b7a5..6312dd9ba449 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags);
17extern void get_random_bytes(void *buf, int nbytes); 17extern void get_random_bytes(void *buf, int nbytes);
18extern void get_random_bytes_arch(void *buf, int nbytes); 18extern void get_random_bytes_arch(void *buf, int nbytes);
19void generate_random_uuid(unsigned char uuid_out[16]); 19void generate_random_uuid(unsigned char uuid_out[16]);
20extern int random_int_secret_init(void);
20 21
21#ifndef MODULE 22#ifndef MODULE
22extern const struct file_operations random_fops, urandom_fops; 23extern const struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 0022c1bb1e26..aa870a4ddf54 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -68,6 +68,10 @@ extern struct rb_node *rb_prev(const struct rb_node *);
68extern struct rb_node *rb_first(const struct rb_root *); 68extern struct rb_node *rb_first(const struct rb_root *);
69extern struct rb_node *rb_last(const struct rb_root *); 69extern struct rb_node *rb_last(const struct rb_root *);
70 70
71/* Postorder iteration - always visit the parent after its children */
72extern struct rb_node *rb_first_postorder(const struct rb_root *);
73extern struct rb_node *rb_next_postorder(const struct rb_node *);
74
71/* Fast replacement of a single node without remove/rebalance/add/rebalance */ 75/* Fast replacement of a single node without remove/rebalance/add/rebalance */
72extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 76extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
73 struct rb_root *root); 77 struct rb_root *root);
@@ -81,4 +85,22 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
81 *rb_link = node; 85 *rb_link = node;
82} 86}
83 87
88/**
89 * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
90 * given type safe against removal of rb_node entry
91 *
92 * @pos: the 'type *' to use as a loop cursor.
93 * @n: another 'type *' to use as temporary storage
94 * @root: 'rb_root *' of the rbtree.
95 * @field: the name of the rb_node field within 'type'.
96 */
97#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
98 for (pos = rb_entry(rb_first_postorder(root), typeof(*pos), field),\
99 n = rb_entry(rb_next_postorder(&pos->field), \
100 typeof(*pos), field); \
101 &pos->field; \
102 pos = n, \
103 n = rb_entry(rb_next_postorder(&pos->field), \
104 typeof(*pos), field))
105
84#endif /* _LINUX_RBTREE_H */ 106#endif /* _LINUX_RBTREE_H */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index f4b1001a4676..4106721c4e5e 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -267,8 +267,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
267 */ 267 */
268#define list_first_or_null_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
269 ({struct list_head *__ptr = (ptr); \ 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \ 270 struct list_head *__next = ACCESS_ONCE(__ptr->next); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \ 271 likely(__ptr != __next) ? \
272 list_entry_rcu(__next, type, member) : NULL; \
272 }) 273 })
273 274
274/** 275/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 4b14bdc911d7..f1f1bc39346b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,7 +52,7 @@ extern int rcutorture_runnable; /* for sysctl */
52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
53extern void rcutorture_record_test_transition(void); 53extern void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54extern void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(char *rcutorturename, 55extern void do_trace_rcu_torture_read(const char *rcutorturename,
56 struct rcu_head *rhp, 56 struct rcu_head *rhp,
57 unsigned long secs, 57 unsigned long secs,
58 unsigned long c_old, 58 unsigned long c_old,
@@ -65,7 +65,7 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65{ 65{
66} 66}
67#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
68extern void do_trace_rcu_torture_read(char *rcutorturename, 68extern void do_trace_rcu_torture_read(const char *rcutorturename,
69 struct rcu_head *rhp, 69 struct rcu_head *rhp,
70 unsigned long secs, 70 unsigned long secs,
71 unsigned long c_old, 71 unsigned long c_old,
@@ -229,13 +229,9 @@ extern void rcu_irq_exit(void);
229#ifdef CONFIG_RCU_USER_QS 229#ifdef CONFIG_RCU_USER_QS
230extern void rcu_user_enter(void); 230extern void rcu_user_enter(void);
231extern void rcu_user_exit(void); 231extern void rcu_user_exit(void);
232extern void rcu_user_enter_after_irq(void);
233extern void rcu_user_exit_after_irq(void);
234#else 232#else
235static inline void rcu_user_enter(void) { } 233static inline void rcu_user_enter(void) { }
236static inline void rcu_user_exit(void) { } 234static inline void rcu_user_exit(void) { }
237static inline void rcu_user_enter_after_irq(void) { }
238static inline void rcu_user_exit_after_irq(void) { }
239static inline void rcu_user_hooks_switch(struct task_struct *prev, 235static inline void rcu_user_hooks_switch(struct task_struct *prev,
240 struct task_struct *next) { } 236 struct task_struct *next) { }
241#endif /* CONFIG_RCU_USER_QS */ 237#endif /* CONFIG_RCU_USER_QS */
@@ -1015,4 +1011,22 @@ static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1015#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ 1011#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
1016 1012
1017 1013
1014/* Only for use by adaptive-ticks code. */
1015#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016extern bool rcu_sys_is_idle(void);
1017extern void rcu_sysidle_force_exit(void);
1018#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019
1020static inline bool rcu_sys_is_idle(void)
1021{
1022 return false;
1023}
1024
1025static inline void rcu_sysidle_force_exit(void)
1026{
1027}
1028
1029#endif /* #else #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1030
1031
1018#endif /* __LINUX_RCUPDATE_H */ 1032#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 6d91fcb4c5cb..a10380bfbeac 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -472,6 +472,9 @@ struct regmap_irq {
472 * @ack_base: Base ack address. If zero then the chip is clear on read. 472 * @ack_base: Base ack address. If zero then the chip is clear on read.
473 * @wake_base: Base address for wake enables. If zero unsupported. 473 * @wake_base: Base address for wake enables. If zero unsupported.
474 * @irq_reg_stride: Stride to use for chips where registers are not contiguous. 474 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
475 * @init_ack_masked: Ack all masked interrupts once during initalization.
476 * @mask_invert: Inverted mask register: cleared bits are masked out.
477 * @wake_invert: Inverted wake register: cleared bits are wake enabled.
475 * @runtime_pm: Hold a runtime PM lock on the device when accessing it. 478 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
476 * 479 *
477 * @num_regs: Number of registers in each control bank. 480 * @num_regs: Number of registers in each control bank.
@@ -487,9 +490,10 @@ struct regmap_irq_chip {
487 unsigned int ack_base; 490 unsigned int ack_base;
488 unsigned int wake_base; 491 unsigned int wake_base;
489 unsigned int irq_reg_stride; 492 unsigned int irq_reg_stride;
490 unsigned int mask_invert; 493 bool init_ack_masked:1;
491 unsigned int wake_invert; 494 bool mask_invert:1;
492 bool runtime_pm; 495 bool wake_invert:1;
496 bool runtime_pm:1;
493 497
494 int num_regs; 498 int num_regs;
495 499
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 3a76389c6aaa..27be915caa96 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -137,6 +137,12 @@ struct regulator *__must_check devm_regulator_get(struct device *dev,
137 const char *id); 137 const char *id);
138struct regulator *__must_check regulator_get_exclusive(struct device *dev, 138struct regulator *__must_check regulator_get_exclusive(struct device *dev,
139 const char *id); 139 const char *id);
140struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
141 const char *id);
142struct regulator *__must_check regulator_get_optional(struct device *dev,
143 const char *id);
144struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
145 const char *id);
140void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
141void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
142 148
@@ -217,6 +223,25 @@ devm_regulator_get(struct device *dev, const char *id)
217 return NULL; 223 return NULL;
218} 224}
219 225
226static inline struct regulator *__must_check
227regulator_get_exclusive(struct device *dev, const char *id)
228{
229 return NULL;
230}
231
232static inline struct regulator *__must_check
233regulator_get_optional(struct device *dev, const char *id)
234{
235 return NULL;
236}
237
238
239static inline struct regulator *__must_check
240devm_regulator_get_optional(struct device *dev, const char *id)
241{
242 return NULL;
243}
244
220static inline void regulator_put(struct regulator *regulator) 245static inline void regulator_put(struct regulator *regulator)
221{ 246{
222} 247}
@@ -369,8 +394,11 @@ static inline int regulator_count_voltages(struct regulator *regulator)
369static inline int regulator_set_voltage_tol(struct regulator *regulator, 394static inline int regulator_set_voltage_tol(struct regulator *regulator,
370 int new_uV, int tol_uV) 395 int new_uV, int tol_uV)
371{ 396{
372 return regulator_set_voltage(regulator, 397 if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
373 new_uV - tol_uV, new_uV + tol_uV); 398 return 0;
399 else
400 return regulator_set_voltage(regulator,
401 new_uV - tol_uV, new_uV + tol_uV);
374} 402}
375 403
376static inline int regulator_is_supported_voltage_tol(struct regulator *regulator, 404static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 6700cc94bdd1..9bdad43ad228 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -40,6 +40,26 @@ enum regulator_status {
40}; 40};
41 41
42/** 42/**
43 * struct regulator_linear_range - specify linear voltage ranges
44 *
45 * Specify a range of voltages for regulator_map_linar_range() and
46 * regulator_list_linear_range().
47 *
48 * @min_uV: Lowest voltage in range
49 * @max_uV: Highest voltage in range
50 * @min_sel: Lowest selector for range
51 * @max_sel: Highest selector for range
52 * @uV_step: Step size
53 */
54struct regulator_linear_range {
55 unsigned int min_uV;
56 unsigned int max_uV;
57 unsigned int min_sel;
58 unsigned int max_sel;
59 unsigned int uV_step;
60};
61
62/**
43 * struct regulator_ops - regulator operations. 63 * struct regulator_ops - regulator operations.
44 * 64 *
45 * @enable: Configure the regulator as enabled. 65 * @enable: Configure the regulator as enabled.
@@ -223,6 +243,9 @@ struct regulator_desc {
223 unsigned int linear_min_sel; 243 unsigned int linear_min_sel;
224 unsigned int ramp_delay; 244 unsigned int ramp_delay;
225 245
246 const struct regulator_linear_range *linear_ranges;
247 int n_linear_ranges;
248
226 const unsigned int *volt_table; 249 const unsigned int *volt_table;
227 250
228 unsigned int vsel_reg; 251 unsigned int vsel_reg;
@@ -326,10 +349,14 @@ int regulator_mode_to_status(unsigned int);
326 349
327int regulator_list_voltage_linear(struct regulator_dev *rdev, 350int regulator_list_voltage_linear(struct regulator_dev *rdev,
328 unsigned int selector); 351 unsigned int selector);
352int regulator_list_voltage_linear_range(struct regulator_dev *rdev,
353 unsigned int selector);
329int regulator_list_voltage_table(struct regulator_dev *rdev, 354int regulator_list_voltage_table(struct regulator_dev *rdev,
330 unsigned int selector); 355 unsigned int selector);
331int regulator_map_voltage_linear(struct regulator_dev *rdev, 356int regulator_map_voltage_linear(struct regulator_dev *rdev,
332 int min_uV, int max_uV); 357 int min_uV, int max_uV);
358int regulator_map_voltage_linear_range(struct regulator_dev *rdev,
359 int min_uV, int max_uV);
333int regulator_map_voltage_iterate(struct regulator_dev *rdev, 360int regulator_map_voltage_iterate(struct regulator_dev *rdev,
334 int min_uV, int max_uV); 361 int min_uV, int max_uV);
335int regulator_map_voltage_ascend(struct regulator_dev *rdev, 362int regulator_map_voltage_ascend(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/fan53555.h b/include/linux/regulator/fan53555.h
index 5c45c85d52ca..f13880e84d85 100644
--- a/include/linux/regulator/fan53555.h
+++ b/include/linux/regulator/fan53555.h
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#ifndef __FAN53555_H__ 13#ifndef __FAN53555_H__
14#define __FAN53555_H__
14 15
15/* VSEL ID */ 16/* VSEL ID */
16enum { 17enum {
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 36adbc82de6a..999b20ce06cf 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -134,6 +134,7 @@ struct regulation_constraints {
134 unsigned always_on:1; /* regulator never off when system is on */ 134 unsigned always_on:1; /* regulator never off when system is on */
135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 135 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
136 unsigned apply_uV:1; /* apply uV constraint if min == max */ 136 unsigned apply_uV:1; /* apply uV constraint if min == max */
137 unsigned ramp_disable:1; /* disable ramp delay */
137}; 138};
138 139
139/** 140/**
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h
index 9936763621c7..f8a6a4844864 100644
--- a/include/linux/regulator/max8660.h
+++ b/include/linux/regulator/max8660.h
@@ -39,7 +39,7 @@ enum {
39 */ 39 */
40struct max8660_subdev_data { 40struct max8660_subdev_data {
41 int id; 41 int id;
42 char *name; 42 const char *name;
43 struct regulator_init_data *platform_data; 43 struct regulator_init_data *platform_data;
44}; 44};
45 45
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
new file mode 100644
index 000000000000..65d550bf3954
--- /dev/null
+++ b/include/linux/regulator/pfuze100.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18#ifndef __LINUX_REG_PFUZE100_H
19#define __LINUX_REG_PFUZE100_H
20
21#define PFUZE100_SW1AB 0
22#define PFUZE100_SW1C 1
23#define PFUZE100_SW2 2
24#define PFUZE100_SW3A 3
25#define PFUZE100_SW3B 4
26#define PFUZE100_SW4 5
27#define PFUZE100_SWBST 6
28#define PFUZE100_VSNVS 7
29#define PFUZE100_VREFDDR 8
30#define PFUZE100_VGEN1 9
31#define PFUZE100_VGEN2 10
32#define PFUZE100_VGEN3 11
33#define PFUZE100_VGEN4 12
34#define PFUZE100_VGEN5 13
35#define PFUZE100_VGEN6 14
36#define PFUZE100_MAX_REGULATOR 15
37
38struct regulator_init_data;
39
40struct pfuze_regulator_platform_data {
41 struct regulator_init_data *init_data[PFUZE100_MAX_REGULATOR];
42};
43
44#endif /* __LINUX_REG_PFUZE100_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 96a509b6be04..201a69749659 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -54,7 +54,7 @@ struct res_counter {
54 struct res_counter *parent; 54 struct res_counter *parent;
55}; 55};
56 56
57#define RESOURCE_MAX (unsigned long long)LLONG_MAX 57#define RES_COUNTER_MAX ULLONG_MAX
58 58
59/** 59/**
60 * Helpers to interact with userspace 60 * Helpers to interact with userspace
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 078066daffd4..e27baeeda3f4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -107,14 +107,6 @@ extern unsigned long this_cpu_load(void);
107extern void calc_global_load(unsigned long ticks); 107extern void calc_global_load(unsigned long ticks);
108extern void update_cpu_load_nohz(void); 108extern void update_cpu_load_nohz(void);
109 109
110/* Notifier for when a task gets migrated to a new CPU */
111struct task_migration_notifier {
112 struct task_struct *task;
113 int from_cpu;
114 int to_cpu;
115};
116extern void register_task_migration_notifier(struct notifier_block *n);
117
118extern unsigned long get_parent_ip(unsigned long addr); 110extern unsigned long get_parent_ip(unsigned long addr);
119 111
120extern void dump_cpu_task(int cpu); 112extern void dump_cpu_task(int cpu);
@@ -1034,6 +1026,9 @@ struct task_struct {
1034#ifdef CONFIG_SMP 1026#ifdef CONFIG_SMP
1035 struct llist_node wake_entry; 1027 struct llist_node wake_entry;
1036 int on_cpu; 1028 int on_cpu;
1029 struct task_struct *last_wakee;
1030 unsigned long wakee_flips;
1031 unsigned long wakee_flip_decay_ts;
1037#endif 1032#endif
1038 int on_rq; 1033 int on_rq;
1039 1034
@@ -1398,6 +1393,12 @@ struct task_struct {
1398 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1393 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1399 } memcg_batch; 1394 } memcg_batch;
1400 unsigned int memcg_kmem_skip_account; 1395 unsigned int memcg_kmem_skip_account;
1396 struct memcg_oom_info {
1397 struct mem_cgroup *memcg;
1398 gfp_t gfp_mask;
1399 int order;
1400 unsigned int may_oom:1;
1401 } memcg_oom;
1401#endif 1402#endif
1402#ifdef CONFIG_UPROBES 1403#ifdef CONFIG_UPROBES
1403 struct uprobe_task *utask; 1404 struct uprobe_task *utask;
@@ -2174,15 +2175,15 @@ static inline bool thread_group_leader(struct task_struct *p)
2174 * all we care about is that we have a task with the appropriate 2175 * all we care about is that we have a task with the appropriate
2175 * pid, we don't actually care if we have the right task. 2176 * pid, we don't actually care if we have the right task.
2176 */ 2177 */
2177static inline int has_group_leader_pid(struct task_struct *p) 2178static inline bool has_group_leader_pid(struct task_struct *p)
2178{ 2179{
2179 return p->pid == p->tgid; 2180 return task_pid(p) == p->signal->leader_pid;
2180} 2181}
2181 2182
2182static inline 2183static inline
2183int same_thread_group(struct task_struct *p1, struct task_struct *p2) 2184bool same_thread_group(struct task_struct *p1, struct task_struct *p2)
2184{ 2185{
2185 return p1->tgid == p2->tgid; 2186 return p1->signal == p2->signal;
2186} 2187}
2187 2188
2188static inline struct task_struct *next_thread(const struct task_struct *p) 2189static inline struct task_struct *next_thread(const struct task_struct *p)
diff --git a/include/linux/security.h b/include/linux/security.h
index 7ce53ae1266b..9d37e2b9d3ec 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1492,7 +1492,7 @@ struct security_operations {
1492 int (*inode_alloc_security) (struct inode *inode); 1492 int (*inode_alloc_security) (struct inode *inode);
1493 void (*inode_free_security) (struct inode *inode); 1493 void (*inode_free_security) (struct inode *inode);
1494 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1494 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1495 const struct qstr *qstr, char **name, 1495 const struct qstr *qstr, const char **name,
1496 void **value, size_t *len); 1496 void **value, size_t *len);
1497 int (*inode_create) (struct inode *dir, 1497 int (*inode_create) (struct inode *dir,
1498 struct dentry *dentry, umode_t mode); 1498 struct dentry *dentry, umode_t mode);
@@ -1770,7 +1770,7 @@ int security_inode_init_security(struct inode *inode, struct inode *dir,
1770 const struct qstr *qstr, 1770 const struct qstr *qstr,
1771 initxattrs initxattrs, void *fs_data); 1771 initxattrs initxattrs, void *fs_data);
1772int security_old_inode_init_security(struct inode *inode, struct inode *dir, 1772int security_old_inode_init_security(struct inode *inode, struct inode *dir,
1773 const struct qstr *qstr, char **name, 1773 const struct qstr *qstr, const char **name,
1774 void **value, size_t *len); 1774 void **value, size_t *len);
1775int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode); 1775int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
1776int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1776int security_inode_link(struct dentry *old_dentry, struct inode *dir,
@@ -2094,8 +2094,8 @@ static inline int security_inode_init_security(struct inode *inode,
2094static inline int security_old_inode_init_security(struct inode *inode, 2094static inline int security_old_inode_init_security(struct inode *inode,
2095 struct inode *dir, 2095 struct inode *dir,
2096 const struct qstr *qstr, 2096 const struct qstr *qstr,
2097 char **name, void **value, 2097 const char **name,
2098 size_t *len) 2098 void **value, size_t *len)
2099{ 2099{
2100 return -EOPNOTSUPP; 2100 return -EOPNOTSUPP;
2101} 2101}
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 18299057402f..21a209336e79 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -3,15 +3,21 @@
3/* 3/*
4 * Reader/writer consistent mechanism without starving writers. This type of 4 * Reader/writer consistent mechanism without starving writers. This type of
5 * lock for data where the reader wants a consistent set of information 5 * lock for data where the reader wants a consistent set of information
6 * and is willing to retry if the information changes. Readers never 6 * and is willing to retry if the information changes. There are two types
7 * block but they may have to retry if a writer is in 7 * of readers:
8 * progress. Writers do not wait for readers. 8 * 1. Sequence readers which never block a writer but they may have to retry
9 * if a writer is in progress by detecting change in sequence number.
10 * Writers do not wait for a sequence reader.
11 * 2. Locking readers which will wait if a writer or another locking reader
12 * is in progress. A locking reader in progress will also block a writer
13 * from going forward. Unlike the regular rwlock, the read lock here is
14 * exclusive so that only one locking reader can get it.
9 * 15 *
10 * This is not as cache friendly as brlock. Also, this will not work 16 * This is not as cache friendly as brlock. Also, this may not work well
11 * for data that contains pointers, because any writer could 17 * for data that contains pointers, because any writer could
12 * invalidate a pointer that a reader was following. 18 * invalidate a pointer that a reader was following.
13 * 19 *
14 * Expected reader usage: 20 * Expected non-blocking reader usage:
15 * do { 21 * do {
16 * seq = read_seqbegin(&foo); 22 * seq = read_seqbegin(&foo);
17 * ... 23 * ...
@@ -268,4 +274,56 @@ write_sequnlock_irqrestore(seqlock_t *sl, unsigned long flags)
268 spin_unlock_irqrestore(&sl->lock, flags); 274 spin_unlock_irqrestore(&sl->lock, flags);
269} 275}
270 276
277/*
278 * A locking reader exclusively locks out other writers and locking readers,
279 * but doesn't update the sequence number. Acts like a normal spin_lock/unlock.
280 * Don't need preempt_disable() because that is in the spin_lock already.
281 */
282static inline void read_seqlock_excl(seqlock_t *sl)
283{
284 spin_lock(&sl->lock);
285}
286
287static inline void read_sequnlock_excl(seqlock_t *sl)
288{
289 spin_unlock(&sl->lock);
290}
291
292static inline void read_seqlock_excl_bh(seqlock_t *sl)
293{
294 spin_lock_bh(&sl->lock);
295}
296
297static inline void read_sequnlock_excl_bh(seqlock_t *sl)
298{
299 spin_unlock_bh(&sl->lock);
300}
301
302static inline void read_seqlock_excl_irq(seqlock_t *sl)
303{
304 spin_lock_irq(&sl->lock);
305}
306
307static inline void read_sequnlock_excl_irq(seqlock_t *sl)
308{
309 spin_unlock_irq(&sl->lock);
310}
311
312static inline unsigned long __read_seqlock_excl_irqsave(seqlock_t *sl)
313{
314 unsigned long flags;
315
316 spin_lock_irqsave(&sl->lock, flags);
317 return flags;
318}
319
320#define read_seqlock_excl_irqsave(lock, flags) \
321 do { flags = __read_seqlock_excl_irqsave(lock); } while (0)
322
323static inline void
324read_sequnlock_excl_irqrestore(seqlock_t *sl, unsigned long flags)
325{
326 spin_unlock_irqrestore(&sl->lock, flags);
327}
328
271#endif /* __LINUX_SEQLOCK_H */ 329#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index 4e83f3e034f3..b7b43b82231e 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -33,13 +33,44 @@ struct sh_dmae_slave_config {
33 char mid_rid; 33 char mid_rid;
34}; 34};
35 35
36/**
37 * struct sh_dmae_channel - DMAC channel platform data
38 * @offset: register offset within the main IOMEM resource
39 * @dmars: channel DMARS register offset
40 * @chclr_offset: channel CHCLR register offset
41 * @dmars_bit: channel DMARS field offset within the register
42 * @chclr_bit: bit position, to be set to reset the channel
43 */
36struct sh_dmae_channel { 44struct sh_dmae_channel {
37 unsigned int offset; 45 unsigned int offset;
38 unsigned int dmars; 46 unsigned int dmars;
39 unsigned int dmars_bit;
40 unsigned int chclr_offset; 47 unsigned int chclr_offset;
48 unsigned char dmars_bit;
49 unsigned char chclr_bit;
41}; 50};
42 51
52/**
53 * struct sh_dmae_pdata - DMAC platform data
54 * @slave: array of slaves
55 * @slave_num: number of slaves in the above array
56 * @channel: array of DMA channels
57 * @channel_num: number of channels in the above array
58 * @ts_low_shift: shift of the low part of the TS field
59 * @ts_low_mask: low TS field mask
60 * @ts_high_shift: additional shift of the high part of the TS field
61 * @ts_high_mask: high TS field mask
62 * @ts_shift: array of Transfer Size shifts, indexed by TS value
63 * @ts_shift_num: number of shifts in the above array
64 * @dmaor_init: DMAOR initialisation value
65 * @chcr_offset: CHCR address offset
66 * @chcr_ie_bit: CHCR Interrupt Enable bit
67 * @dmaor_is_32bit: DMAOR is a 32-bit register
68 * @needs_tend_set: the TEND register has to be set
69 * @no_dmars: DMAC has no DMARS registers
70 * @chclr_present: DMAC has one or several CHCLR registers
71 * @chclr_bitwise: channel CHCLR registers are bitwise
72 * @slave_only: DMAC cannot be used for MEMCPY
73 */
43struct sh_dmae_pdata { 74struct sh_dmae_pdata {
44 const struct sh_dmae_slave_config *slave; 75 const struct sh_dmae_slave_config *slave;
45 int slave_num; 76 int slave_num;
@@ -59,42 +90,22 @@ struct sh_dmae_pdata {
59 unsigned int needs_tend_set:1; 90 unsigned int needs_tend_set:1;
60 unsigned int no_dmars:1; 91 unsigned int no_dmars:1;
61 unsigned int chclr_present:1; 92 unsigned int chclr_present:1;
93 unsigned int chclr_bitwise:1;
62 unsigned int slave_only:1; 94 unsigned int slave_only:1;
63}; 95};
64 96
65/* DMA register */
66#define SAR 0x00
67#define DAR 0x04
68#define TCR 0x08
69#define CHCR 0x0C
70#define DMAOR 0x40
71
72#define TEND 0x18 /* USB-DMAC */
73
74/* DMAOR definitions */ 97/* DMAOR definitions */
75#define DMAOR_AE 0x00000004 98#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002 99#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001 100#define DMAOR_DME 0x00000001
78 101
79/* Definitions for the SuperH DMAC */ 102/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000 103#define DM_INC 0x00004000
89#define DM_DEC 0x00008000 104#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000 105#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000 106#define SM_INC 0x00001000
92#define SM_DEC 0x00002000 107#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000 108#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001 109#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002 110#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004 111#define CHCR_IE 0x00000004
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index fc305713fc6d..90b5e30c2f22 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -2,23 +2,17 @@
2#define __ASM_SH_ETH_H__ 2#define __ASM_SH_ETH_H__
3 3
4#include <linux/phy.h> 4#include <linux/phy.h>
5#include <linux/if_ether.h>
5 6
6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN}; 7enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
7enum {
8 SH_ETH_REG_GIGABIT,
9 SH_ETH_REG_FAST_RCAR,
10 SH_ETH_REG_FAST_SH4,
11 SH_ETH_REG_FAST_SH3_SH2
12};
13 8
14struct sh_eth_plat_data { 9struct sh_eth_plat_data {
15 int phy; 10 int phy;
16 int edmac_endian; 11 int edmac_endian;
17 int register_type;
18 phy_interface_t phy_interface; 12 phy_interface_t phy_interface;
19 void (*set_mdio_gate)(void *addr); 13 void (*set_mdio_gate)(void *addr);
20 14
21 unsigned char mac_addr[6]; 15 unsigned char mac_addr[ETH_ALEN];
22 unsigned no_ether_link:1; 16 unsigned no_ether_link:1;
23 unsigned ether_link_active_low:1; 17 unsigned ether_link_active_low:1;
24 unsigned needs_init:1; 18 unsigned needs_init:1;
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index 5b1c9848124c..f92c0a43c54c 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -96,7 +96,7 @@ struct shdma_ops {
96 dma_addr_t (*slave_addr)(struct shdma_chan *); 96 dma_addr_t (*slave_addr)(struct shdma_chan *);
97 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *, 97 int (*desc_setup)(struct shdma_chan *, struct shdma_desc *,
98 dma_addr_t, dma_addr_t, size_t *); 98 dma_addr_t, dma_addr_t, size_t *);
99 int (*set_slave)(struct shdma_chan *, int, bool); 99 int (*set_slave)(struct shdma_chan *, int, dma_addr_t, bool);
100 void (*setup_xfer)(struct shdma_chan *, int); 100 void (*setup_xfer)(struct shdma_chan *, int);
101 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *); 101 void (*start_xfer)(struct shdma_chan *, struct shdma_desc *);
102 struct shdma_desc *(*embedded_desc)(void *, int); 102 struct shdma_desc *(*embedded_desc)(void *, int);
@@ -116,7 +116,6 @@ struct shdma_dev {
116 116
117int shdma_request_irq(struct shdma_chan *, int, 117int shdma_request_irq(struct shdma_chan *, int,
118 unsigned long, const char *); 118 unsigned long, const char *);
119void shdma_free_irq(struct shdma_chan *);
120bool shdma_reset(struct shdma_dev *sdev); 119bool shdma_reset(struct shdma_dev *sdev);
121void shdma_chan_probe(struct shdma_dev *sdev, 120void shdma_chan_probe(struct shdma_dev *sdev,
122 struct shdma_chan *schan, int id); 121 struct shdma_chan *schan, int id);
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
index ac6b8ee07825..68c097077ef0 100644
--- a/include/linux/shrinker.h
+++ b/include/linux/shrinker.h
@@ -4,39 +4,67 @@
4/* 4/*
5 * This struct is used to pass information from page reclaim to the shrinkers. 5 * This struct is used to pass information from page reclaim to the shrinkers.
6 * We consolidate the values for easier extention later. 6 * We consolidate the values for easier extention later.
7 *
8 * The 'gfpmask' refers to the allocation we are currently trying to
9 * fulfil.
7 */ 10 */
8struct shrink_control { 11struct shrink_control {
9 gfp_t gfp_mask; 12 gfp_t gfp_mask;
10 13
11 /* How many slab objects shrinker() should scan and try to reclaim */ 14 /*
15 * How many objects scan_objects should scan and try to reclaim.
16 * This is reset before every call, so it is safe for callees
17 * to modify.
18 */
12 unsigned long nr_to_scan; 19 unsigned long nr_to_scan;
20
21 /* shrink from these nodes */
22 nodemask_t nodes_to_scan;
23 /* current node being shrunk (for NUMA aware shrinkers) */
24 int nid;
13}; 25};
14 26
27#define SHRINK_STOP (~0UL)
15/* 28/*
16 * A callback you can register to apply pressure to ageable caches. 29 * A callback you can register to apply pressure to ageable caches.
17 * 30 *
18 * 'sc' is passed shrink_control which includes a count 'nr_to_scan' 31 * @count_objects should return the number of freeable items in the cache. If
19 * and a 'gfpmask'. It should look through the least-recently-used 32 * there are no objects to free or the number of freeable items cannot be
20 * 'nr_to_scan' entries and attempt to free them up. It should return 33 * determined, it should return 0. No deadlock checks should be done during the
21 * the number of objects which remain in the cache. If it returns -1, it means 34 * count callback - the shrinker relies on aggregating scan counts that couldn't
22 * it cannot do any scanning at this time (eg. there is a risk of deadlock). 35 * be executed due to potential deadlocks to be run at a later call when the
36 * deadlock condition is no longer pending.
23 * 37 *
24 * The 'gfpmask' refers to the allocation we are currently trying to 38 * @scan_objects will only be called if @count_objects returned a non-zero
25 * fulfil. 39 * value for the number of freeable objects. The callout should scan the cache
40 * and attempt to free items from the cache. It should then return the number
41 * of objects freed during the scan, or SHRINK_STOP if progress cannot be made
42 * due to potential deadlocks. If SHRINK_STOP is returned, then no further
43 * attempts to call the @scan_objects will be made from the current reclaim
44 * context.
26 * 45 *
27 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is 46 * @flags determine the shrinker abilities, like numa awareness
28 * querying the cache size, so a fastpath for that case is appropriate.
29 */ 47 */
30struct shrinker { 48struct shrinker {
31 int (*shrink)(struct shrinker *, struct shrink_control *sc); 49 unsigned long (*count_objects)(struct shrinker *,
50 struct shrink_control *sc);
51 unsigned long (*scan_objects)(struct shrinker *,
52 struct shrink_control *sc);
53
32 int seeks; /* seeks to recreate an obj */ 54 int seeks; /* seeks to recreate an obj */
33 long batch; /* reclaim batch size, 0 = default */ 55 long batch; /* reclaim batch size, 0 = default */
56 unsigned long flags;
34 57
35 /* These are for internal use */ 58 /* These are for internal use */
36 struct list_head list; 59 struct list_head list;
37 atomic_long_t nr_in_batch; /* objs pending delete */ 60 /* objs pending delete, per node */
61 atomic_long_t *nr_deferred;
38}; 62};
39#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ 63#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
40extern void register_shrinker(struct shrinker *); 64
65/* Flags */
66#define SHRINKER_NUMA_AWARE (1 << 0)
67
68extern int register_shrinker(struct shrinker *);
41extern void unregister_shrinker(struct shrinker *); 69extern void unregister_shrinker(struct shrinker *);
42#endif 70#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index d897484730c0..2ac423bdb676 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -434,6 +434,14 @@ void signals_init(void);
434int restore_altstack(const stack_t __user *); 434int restore_altstack(const stack_t __user *);
435int __save_altstack(stack_t __user *, unsigned long); 435int __save_altstack(stack_t __user *, unsigned long);
436 436
437#define save_altstack_ex(uss, sp) do { \
438 stack_t __user *__uss = uss; \
439 struct task_struct *t = current; \
440 put_user_ex((void __user *)t->sas_ss_sp, &__uss->ss_sp); \
441 put_user_ex(sas_ss_flags(sp), &__uss->ss_flags); \
442 put_user_ex(t->sas_ss_size, &__uss->ss_size); \
443} while (0);
444
437#ifdef CONFIG_PROC_FS 445#ifdef CONFIG_PROC_FS
438struct seq_file; 446struct seq_file;
439extern void render_sigset_t(struct seq_file *, const char *, sigset_t *); 447extern void render_sigset_t(struct seq_file *, const char *, sigset_t *);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 3b71a4e83642..c2d89335f637 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -498,7 +498,7 @@ struct sk_buff {
498 * headers if needed 498 * headers if needed
499 */ 499 */
500 __u8 encapsulation:1; 500 __u8 encapsulation:1;
501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 501 /* 6/8 bit hole (depending on ndisc_nodetype presence) */
502 kmemcheck_bitfield_end(flags2); 502 kmemcheck_bitfield_end(flags2);
503 503
504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -1805,10 +1805,13 @@ static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len)
1805 */ 1805 */
1806static inline void skb_orphan(struct sk_buff *skb) 1806static inline void skb_orphan(struct sk_buff *skb)
1807{ 1807{
1808 if (skb->destructor) 1808 if (skb->destructor) {
1809 skb->destructor(skb); 1809 skb->destructor(skb);
1810 skb->destructor = NULL; 1810 skb->destructor = NULL;
1811 skb->sk = NULL; 1811 skb->sk = NULL;
1812 } else {
1813 BUG_ON(skb->sk);
1814 }
1812} 1815}
1813 1816
1814/** 1817/**
@@ -1902,8 +1905,8 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1902 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); 1905 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
1903} 1906}
1904 1907
1905/* 1908/**
1906 * __skb_alloc_page - allocate pages for ps-rx on a skb and preserve pfmemalloc data 1909 * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data
1907 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 1910 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX
1908 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used 1911 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
1909 * @order: size of the allocation 1912 * @order: size of the allocation
@@ -2356,6 +2359,10 @@ extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
2356 const struct iovec *from, 2359 const struct iovec *from,
2357 int from_offset, 2360 int from_offset,
2358 int len); 2361 int len);
2362extern int zerocopy_sg_from_iovec(struct sk_buff *skb,
2363 const struct iovec *frm,
2364 int offset,
2365 size_t count);
2359extern int skb_copy_datagram_const_iovec(const struct sk_buff *from, 2366extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
2360 int offset, 2367 int offset,
2361 const struct iovec *to, 2368 const struct iovec *to,
@@ -2385,7 +2392,7 @@ extern void skb_split(struct sk_buff *skb,
2385 struct sk_buff *skb1, const u32 len); 2392 struct sk_buff *skb1, const u32 len);
2386extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2393extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2387 int shiftlen); 2394 int shiftlen);
2388extern void skb_scrub_packet(struct sk_buff *skb); 2395extern void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2389 2396
2390extern struct sk_buff *skb_segment(struct sk_buff *skb, 2397extern struct sk_buff *skb_segment(struct sk_buff *skb,
2391 netdev_features_t features); 2398 netdev_features_t features);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 6c5cc0ea8713..74f105847d13 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -4,6 +4,8 @@
4 * (C) SGI 2006, Christoph Lameter 4 * (C) SGI 2006, Christoph Lameter
5 * Cleaned up and restructured to ease the addition of alternative 5 * Cleaned up and restructured to ease the addition of alternative
6 * implementations of SLAB allocators. 6 * implementations of SLAB allocators.
7 * (C) Linux Foundation 2008-2013
8 * Unified interface for all slab allocators
7 */ 9 */
8 10
9#ifndef _LINUX_SLAB_H 11#ifndef _LINUX_SLAB_H
@@ -94,6 +96,7 @@
94#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 96#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
95 (unsigned long)ZERO_SIZE_PTR) 97 (unsigned long)ZERO_SIZE_PTR)
96 98
99#include <linux/kmemleak.h>
97 100
98struct mem_cgroup; 101struct mem_cgroup;
99/* 102/*
@@ -289,6 +292,57 @@ static __always_inline int kmalloc_index(size_t size)
289} 292}
290#endif /* !CONFIG_SLOB */ 293#endif /* !CONFIG_SLOB */
291 294
295void *__kmalloc(size_t size, gfp_t flags);
296void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags);
297
298#ifdef CONFIG_NUMA
299void *__kmalloc_node(size_t size, gfp_t flags, int node);
300void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
301#else
302static __always_inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
303{
304 return __kmalloc(size, flags);
305}
306
307static __always_inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node)
308{
309 return kmem_cache_alloc(s, flags);
310}
311#endif
312
313#ifdef CONFIG_TRACING
314extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
315
316#ifdef CONFIG_NUMA
317extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
318 gfp_t gfpflags,
319 int node, size_t size);
320#else
321static __always_inline void *
322kmem_cache_alloc_node_trace(struct kmem_cache *s,
323 gfp_t gfpflags,
324 int node, size_t size)
325{
326 return kmem_cache_alloc_trace(s, gfpflags, size);
327}
328#endif /* CONFIG_NUMA */
329
330#else /* CONFIG_TRACING */
331static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s,
332 gfp_t flags, size_t size)
333{
334 return kmem_cache_alloc(s, flags);
335}
336
337static __always_inline void *
338kmem_cache_alloc_node_trace(struct kmem_cache *s,
339 gfp_t gfpflags,
340 int node, size_t size)
341{
342 return kmem_cache_alloc_node(s, gfpflags, node);
343}
344#endif /* CONFIG_TRACING */
345
292#ifdef CONFIG_SLAB 346#ifdef CONFIG_SLAB
293#include <linux/slab_def.h> 347#include <linux/slab_def.h>
294#endif 348#endif
@@ -297,9 +351,60 @@ static __always_inline int kmalloc_index(size_t size)
297#include <linux/slub_def.h> 351#include <linux/slub_def.h>
298#endif 352#endif
299 353
300#ifdef CONFIG_SLOB 354static __always_inline void *
301#include <linux/slob_def.h> 355kmalloc_order(size_t size, gfp_t flags, unsigned int order)
356{
357 void *ret;
358
359 flags |= (__GFP_COMP | __GFP_KMEMCG);
360 ret = (void *) __get_free_pages(flags, order);
361 kmemleak_alloc(ret, size, 1, flags);
362 return ret;
363}
364
365#ifdef CONFIG_TRACING
366extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
367#else
368static __always_inline void *
369kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
370{
371 return kmalloc_order(size, flags, order);
372}
373#endif
374
375static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
376{
377 unsigned int order = get_order(size);
378 return kmalloc_order_trace(size, flags, order);
379}
380
381/**
382 * kmalloc - allocate memory
383 * @size: how many bytes of memory are required.
384 * @flags: the type of memory to allocate (see kcalloc).
385 *
386 * kmalloc is the normal method of allocating memory
387 * for objects smaller than page size in the kernel.
388 */
389static __always_inline void *kmalloc(size_t size, gfp_t flags)
390{
391 if (__builtin_constant_p(size)) {
392 if (size > KMALLOC_MAX_CACHE_SIZE)
393 return kmalloc_large(size, flags);
394#ifndef CONFIG_SLOB
395 if (!(flags & GFP_DMA)) {
396 int index = kmalloc_index(size);
397
398 if (!index)
399 return ZERO_SIZE_PTR;
400
401 return kmem_cache_alloc_trace(kmalloc_caches[index],
402 flags, size);
403 }
302#endif 404#endif
405 }
406 return __kmalloc(size, flags);
407}
303 408
304/* 409/*
305 * Determine size used for the nth kmalloc cache. 410 * Determine size used for the nth kmalloc cache.
@@ -321,6 +426,23 @@ static __always_inline int kmalloc_size(int n)
321 return 0; 426 return 0;
322} 427}
323 428
429static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
430{
431#ifndef CONFIG_SLOB
432 if (__builtin_constant_p(size) &&
433 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
434 int i = kmalloc_index(size);
435
436 if (!i)
437 return ZERO_SIZE_PTR;
438
439 return kmem_cache_alloc_node_trace(kmalloc_caches[i],
440 flags, node, size);
441 }
442#endif
443 return __kmalloc_node(size, flags, node);
444}
445
324/* 446/*
325 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 447 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
326 * Intended for arches that get misalignment faults even for 64 bit integer 448 * Intended for arches that get misalignment faults even for 64 bit integer
@@ -451,36 +573,6 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
451 return kmalloc_array(n, size, flags | __GFP_ZERO); 573 return kmalloc_array(n, size, flags | __GFP_ZERO);
452} 574}
453 575
454#if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
455/**
456 * kmalloc_node - allocate memory from a specific node
457 * @size: how many bytes of memory are required.
458 * @flags: the type of memory to allocate (see kmalloc).
459 * @node: node to allocate from.
460 *
461 * kmalloc() for non-local nodes, used to allocate from a specific node
462 * if available. Equivalent to kmalloc() in the non-NUMA single-node
463 * case.
464 */
465static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
466{
467 return kmalloc(size, flags);
468}
469
470static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
471{
472 return __kmalloc(size, flags);
473}
474
475void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
476
477static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
478 gfp_t flags, int node)
479{
480 return kmem_cache_alloc(cachep, flags);
481}
482#endif /* !CONFIG_NUMA && !CONFIG_SLOB */
483
484/* 576/*
485 * kmalloc_track_caller is a special version of kmalloc that records the 577 * kmalloc_track_caller is a special version of kmalloc that records the
486 * calling function of the routine calling it for slab leak tracking instead 578 * calling function of the routine calling it for slab leak tracking instead
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index cd401580bdd3..e9346b4f1ef4 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -3,20 +3,6 @@
3 3
4/* 4/*
5 * Definitions unique to the original Linux SLAB allocator. 5 * Definitions unique to the original Linux SLAB allocator.
6 *
7 * What we provide here is a way to optimize the frequent kmalloc
8 * calls in the kernel by selecting the appropriate general cache
9 * if kmalloc was called with a size that can be established at
10 * compile time.
11 */
12
13#include <linux/init.h>
14#include <linux/compiler.h>
15
16/*
17 * struct kmem_cache
18 *
19 * manages a cache.
20 */ 6 */
21 7
22struct kmem_cache { 8struct kmem_cache {
@@ -102,96 +88,4 @@ struct kmem_cache {
102 */ 88 */
103}; 89};
104 90
105void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
106void *__kmalloc(size_t size, gfp_t flags);
107
108#ifdef CONFIG_TRACING
109extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
110#else
111static __always_inline void *
112kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
113{
114 return kmem_cache_alloc(cachep, flags);
115}
116#endif
117
118static __always_inline void *kmalloc(size_t size, gfp_t flags)
119{
120 struct kmem_cache *cachep;
121 void *ret;
122
123 if (__builtin_constant_p(size)) {
124 int i;
125
126 if (!size)
127 return ZERO_SIZE_PTR;
128
129 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
130 return NULL;
131
132 i = kmalloc_index(size);
133
134#ifdef CONFIG_ZONE_DMA
135 if (flags & GFP_DMA)
136 cachep = kmalloc_dma_caches[i];
137 else
138#endif
139 cachep = kmalloc_caches[i];
140
141 ret = kmem_cache_alloc_trace(cachep, flags, size);
142
143 return ret;
144 }
145 return __kmalloc(size, flags);
146}
147
148#ifdef CONFIG_NUMA
149extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
150extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
151
152#ifdef CONFIG_TRACING
153extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
154 gfp_t flags,
155 int nodeid,
156 size_t size);
157#else
158static __always_inline void *
159kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
160 gfp_t flags,
161 int nodeid,
162 size_t size)
163{
164 return kmem_cache_alloc_node(cachep, flags, nodeid);
165}
166#endif
167
168static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
169{
170 struct kmem_cache *cachep;
171
172 if (__builtin_constant_p(size)) {
173 int i;
174
175 if (!size)
176 return ZERO_SIZE_PTR;
177
178 if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
179 return NULL;
180
181 i = kmalloc_index(size);
182
183#ifdef CONFIG_ZONE_DMA
184 if (flags & GFP_DMA)
185 cachep = kmalloc_dma_caches[i];
186 else
187#endif
188 cachep = kmalloc_caches[i];
189
190 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
191 }
192 return __kmalloc_node(size, flags, node);
193}
194
195#endif /* CONFIG_NUMA */
196
197#endif /* _LINUX_SLAB_DEF_H */ 91#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
deleted file mode 100644
index 095a5a4a8516..000000000000
--- a/include/linux/slob_def.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H
3
4#include <linux/numa.h>
5
6void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
7
8static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
9 gfp_t flags)
10{
11 return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
12}
13
14void *__kmalloc_node(size_t size, gfp_t flags, int node);
15
16static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
17{
18 return __kmalloc_node(size, flags, node);
19}
20
21static __always_inline void *kmalloc(size_t size, gfp_t flags)
22{
23 return __kmalloc_node(size, flags, NUMA_NO_NODE);
24}
25
26static __always_inline void *__kmalloc(size_t size, gfp_t flags)
27{
28 return kmalloc(size, flags);
29}
30
31#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 027276fa8713..cc0b67eada42 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -6,14 +6,8 @@
6 * 6 *
7 * (C) 2007 SGI, Christoph Lameter 7 * (C) 2007 SGI, Christoph Lameter
8 */ 8 */
9#include <linux/types.h>
10#include <linux/gfp.h>
11#include <linux/bug.h>
12#include <linux/workqueue.h>
13#include <linux/kobject.h> 9#include <linux/kobject.h>
14 10
15#include <linux/kmemleak.h>
16
17enum stat_item { 11enum stat_item {
18 ALLOC_FASTPATH, /* Allocation from cpu slab */ 12 ALLOC_FASTPATH, /* Allocation from cpu slab */
19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 13 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
@@ -104,108 +98,4 @@ struct kmem_cache {
104 struct kmem_cache_node *node[MAX_NUMNODES]; 98 struct kmem_cache_node *node[MAX_NUMNODES];
105}; 99};
106 100
107void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
108void *__kmalloc(size_t size, gfp_t flags);
109
110static __always_inline void *
111kmalloc_order(size_t size, gfp_t flags, unsigned int order)
112{
113 void *ret;
114
115 flags |= (__GFP_COMP | __GFP_KMEMCG);
116 ret = (void *) __get_free_pages(flags, order);
117 kmemleak_alloc(ret, size, 1, flags);
118 return ret;
119}
120
121/**
122 * Calling this on allocated memory will check that the memory
123 * is expected to be in use, and print warnings if not.
124 */
125#ifdef CONFIG_SLUB_DEBUG
126extern bool verify_mem_not_deleted(const void *x);
127#else
128static inline bool verify_mem_not_deleted(const void *x)
129{
130 return true;
131}
132#endif
133
134#ifdef CONFIG_TRACING
135extern void *
136kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size);
137extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
138#else
139static __always_inline void *
140kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size)
141{
142 return kmem_cache_alloc(s, gfpflags);
143}
144
145static __always_inline void *
146kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
147{
148 return kmalloc_order(size, flags, order);
149}
150#endif
151
152static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
153{
154 unsigned int order = get_order(size);
155 return kmalloc_order_trace(size, flags, order);
156}
157
158static __always_inline void *kmalloc(size_t size, gfp_t flags)
159{
160 if (__builtin_constant_p(size)) {
161 if (size > KMALLOC_MAX_CACHE_SIZE)
162 return kmalloc_large(size, flags);
163
164 if (!(flags & GFP_DMA)) {
165 int index = kmalloc_index(size);
166
167 if (!index)
168 return ZERO_SIZE_PTR;
169
170 return kmem_cache_alloc_trace(kmalloc_caches[index],
171 flags, size);
172 }
173 }
174 return __kmalloc(size, flags);
175}
176
177#ifdef CONFIG_NUMA
178void *__kmalloc_node(size_t size, gfp_t flags, int node);
179void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
180
181#ifdef CONFIG_TRACING
182extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s,
183 gfp_t gfpflags,
184 int node, size_t size);
185#else
186static __always_inline void *
187kmem_cache_alloc_node_trace(struct kmem_cache *s,
188 gfp_t gfpflags,
189 int node, size_t size)
190{
191 return kmem_cache_alloc_node(s, gfpflags, node);
192}
193#endif
194
195static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
196{
197 if (__builtin_constant_p(size) &&
198 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) {
199 int index = kmalloc_index(size);
200
201 if (!index)
202 return ZERO_SIZE_PTR;
203
204 return kmem_cache_alloc_node_trace(kmalloc_caches[index],
205 flags, node, size);
206 }
207 return __kmalloc_node(size, flags, node);
208}
209#endif
210
211#endif /* _LINUX_SLUB_DEF_H */ 101#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index c181399f2c20..731f5237d5f4 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -28,6 +28,27 @@ extern unsigned int total_cpus;
28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info, 28int smp_call_function_single(int cpuid, smp_call_func_t func, void *info,
29 int wait); 29 int wait);
30 30
31/*
32 * Call a function on all processors
33 */
34int on_each_cpu(smp_call_func_t func, void *info, int wait);
35
36/*
37 * Call a function on processors specified by mask, which might include
38 * the local one.
39 */
40void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
41 void *info, bool wait);
42
43/*
44 * Call a function on each processor for which the supplied function
45 * cond_func returns a positive value. This may include the local
46 * processor.
47 */
48void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
49 smp_call_func_t func, void *info, bool wait,
50 gfp_t gfp_flags);
51
31#ifdef CONFIG_SMP 52#ifdef CONFIG_SMP
32 53
33#include <linux/preempt.h> 54#include <linux/preempt.h>
@@ -95,27 +116,6 @@ static inline void call_function_init(void) { }
95#endif 116#endif
96 117
97/* 118/*
98 * Call a function on all processors
99 */
100int on_each_cpu(smp_call_func_t func, void *info, int wait);
101
102/*
103 * Call a function on processors specified by mask, which might include
104 * the local one.
105 */
106void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
107 void *info, bool wait);
108
109/*
110 * Call a function on each processor for which the supplied function
111 * cond_func returns a positive value. This may include the local
112 * processor.
113 */
114void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
115 smp_call_func_t func, void *info, bool wait,
116 gfp_t gfp_flags);
117
118/*
119 * Mark the boot cpu "online" so that it can call console drivers in 119 * Mark the boot cpu "online" so that it can call console drivers in
120 * printk() and can access its per-cpu storage. 120 * printk() and can access its per-cpu storage.
121 */ 121 */
@@ -139,43 +139,6 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
139} 139}
140#define smp_call_function(func, info, wait) \ 140#define smp_call_function(func, info, wait) \
141 (up_smp_call_function(func, info)) 141 (up_smp_call_function(func, info))
142#define on_each_cpu(func, info, wait) \
143 ({ \
144 unsigned long __flags; \
145 local_irq_save(__flags); \
146 func(info); \
147 local_irq_restore(__flags); \
148 0; \
149 })
150/*
151 * Note we still need to test the mask even for UP
152 * because we actually can get an empty mask from
153 * code that on SMP might call us without the local
154 * CPU in the mask.
155 */
156#define on_each_cpu_mask(mask, func, info, wait) \
157 do { \
158 if (cpumask_test_cpu(0, (mask))) { \
159 local_irq_disable(); \
160 (func)(info); \
161 local_irq_enable(); \
162 } \
163 } while (0)
164/*
165 * Preemption is disabled here to make sure the cond_func is called under the
166 * same condtions in UP and SMP.
167 */
168#define on_each_cpu_cond(cond_func, func, info, wait, gfp_flags)\
169 do { \
170 void *__info = (info); \
171 preempt_disable(); \
172 if ((cond_func)(0, __info)) { \
173 local_irq_disable(); \
174 (func)(__info); \
175 local_irq_enable(); \
176 } \
177 preempt_enable(); \
178 } while (0)
179 142
180static inline void smp_send_reschedule(int cpu) { } 143static inline void smp_send_reschedule(int cpu) { }
181#define smp_prepare_boot_cpu() do {} while (0) 144#define smp_prepare_boot_cpu() do {} while (0)
@@ -192,6 +155,12 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
192 155
193static inline void kick_all_cpus_sync(void) { } 156static inline void kick_all_cpus_sync(void) { }
194 157
158static inline void __smp_call_function_single(int cpuid,
159 struct call_single_data *data, int wait)
160{
161 on_each_cpu(data->func, data->info, wait);
162}
163
195#endif /* !SMP */ 164#endif /* !SMP */
196 165
197/* 166/*
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 4dde70e74822..eec3efd19beb 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -22,6 +22,7 @@
22#define __LINUX_SMSC911X_H__ 22#define __LINUX_SMSC911X_H__
23 23
24#include <linux/phy.h> 24#include <linux/phy.h>
25#include <linux/if_ether.h>
25 26
26/* platform_device configuration data, should be assigned to 27/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */ 28 * the platform_device's dev.platform_data */
@@ -31,7 +32,7 @@ struct smsc911x_platform_config {
31 unsigned int flags; 32 unsigned int flags;
32 unsigned int shift; 33 unsigned int shift;
33 phy_interface_t phy_interface; 34 phy_interface_t phy_interface;
34 unsigned char mac[6]; 35 unsigned char mac[ETH_ALEN];
35}; 36};
36 37
37/* Constants for platform_device irq polarity configuration */ 38/* Constants for platform_device irq polarity configuration */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 230c04bda3e2..445ef7519dc2 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -313,6 +313,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
313 struct iovec *iov, 313 struct iovec *iov,
314 int offset, 314 int offset,
315 unsigned int len, __wsum *csump); 315 unsigned int len, __wsum *csump);
316extern unsigned long iov_pages(const struct iovec *iov, int offset,
317 unsigned long nr_segs);
316 318
317extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); 319extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
318extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 320extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 32be8dbdf191..274bc0fa00af 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -7,6 +7,11 @@
7struct device; 7struct device;
8struct mmc_host; 8struct mmc_host;
9 9
10#define MMC_SPI_USE_CD_GPIO (1 << 0)
11#define MMC_SPI_USE_RO_GPIO (1 << 1)
12#define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2)
13#define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3)
14
10/* Put this in platform_data of a device being used to manage an MMC/SD 15/* Put this in platform_data of a device being used to manage an MMC/SD
11 * card slot. (Modeled after PXA mmc glue; see that for usage examples.) 16 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
12 * 17 *
@@ -21,17 +26,19 @@ struct mmc_spi_platform_data {
21 void *); 26 void *);
22 void (*exit)(struct device *, void *); 27 void (*exit)(struct device *, void *);
23 28
24 /* sense switch on sd cards */
25 int (*get_ro)(struct device *);
26
27 /* 29 /*
28 * If board does not use CD interrupts, driver can optimize polling 30 * Card Detect and Read Only GPIOs. To enable debouncing on the card
29 * using this function. 31 * detect GPIO, set the cd_debounce to the debounce time in
32 * microseconds.
30 */ 33 */
31 int (*get_cd)(struct device *); 34 unsigned int flags;
35 unsigned int cd_gpio;
36 unsigned int cd_debounce;
37 unsigned int ro_gpio;
32 38
33 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ 39 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
34 unsigned long caps; 40 unsigned long caps;
41 unsigned long caps2;
35 42
36 /* how long to debounce card detect, in msecs */ 43 /* how long to debounce card detect, in msecs */
37 u16 detect_delay; 44 u16 detect_delay;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 28e440be1c07..887116dbce2c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -74,7 +74,7 @@ struct spi_device {
74 struct spi_master *master; 74 struct spi_master *master;
75 u32 max_speed_hz; 75 u32 max_speed_hz;
76 u8 chip_select; 76 u8 chip_select;
77 u8 mode; 77 u16 mode;
78#define SPI_CPHA 0x01 /* clock phase */ 78#define SPI_CPHA 0x01 /* clock phase */
79#define SPI_CPOL 0x02 /* clock polarity */ 79#define SPI_CPOL 0x02 /* clock polarity */
80#define SPI_MODE_0 (0|0) /* (original MicroWire) */ 80#define SPI_MODE_0 (0|0) /* (original MicroWire) */
@@ -87,6 +87,10 @@ struct spi_device {
87#define SPI_LOOP 0x20 /* loopback mode */ 87#define SPI_LOOP 0x20 /* loopback mode */
88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ 88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */
89#define SPI_READY 0x80 /* slave pulls low to pause */ 89#define SPI_READY 0x80 /* slave pulls low to pause */
90#define SPI_TX_DUAL 0x100 /* transmit with 2 wires */
91#define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
92#define SPI_RX_DUAL 0x400 /* receive with 2 wires */
93#define SPI_RX_QUAD 0x800 /* receive with 4 wires */
90 u8 bits_per_word; 94 u8 bits_per_word;
91 int irq; 95 int irq;
92 void *controller_state; 96 void *controller_state;
@@ -233,6 +237,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
233 * suported. If set, the SPI core will reject any transfer with an 237 * suported. If set, the SPI core will reject any transfer with an
234 * unsupported bits_per_word. If not set, this value is simply ignored, 238 * unsupported bits_per_word. If not set, this value is simply ignored,
235 * and it's up to the individual driver to perform any validation. 239 * and it's up to the individual driver to perform any validation.
240 * @min_speed_hz: Lowest supported transfer speed
241 * @max_speed_hz: Highest supported transfer speed
236 * @flags: other constraints relevant to this driver 242 * @flags: other constraints relevant to this driver
237 * @bus_lock_spinlock: spinlock for SPI bus locking 243 * @bus_lock_spinlock: spinlock for SPI bus locking
238 * @bus_lock_mutex: mutex for SPI bus locking 244 * @bus_lock_mutex: mutex for SPI bus locking
@@ -254,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
254 * @busy: message pump is busy 260 * @busy: message pump is busy
255 * @running: message pump is running 261 * @running: message pump is running
256 * @rt: whether this queue is set to run as a realtime task 262 * @rt: whether this queue is set to run as a realtime task
263 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
264 * while the hardware is prepared, using the parent
265 * device for the spidev
257 * @prepare_transfer_hardware: a message will soon arrive from the queue 266 * @prepare_transfer_hardware: a message will soon arrive from the queue
258 * so the subsystem requests the driver to prepare the transfer hardware 267 * so the subsystem requests the driver to prepare the transfer hardware
259 * by issuing this call 268 * by issuing this call
@@ -309,9 +318,13 @@ struct spi_master {
309 /* bitmask of supported bits_per_word for transfers */ 318 /* bitmask of supported bits_per_word for transfers */
310 u32 bits_per_word_mask; 319 u32 bits_per_word_mask;
311#define SPI_BPW_MASK(bits) BIT((bits) - 1) 320#define SPI_BPW_MASK(bits) BIT((bits) - 1)
312#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1)) 321#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
313#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) 322#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
314 323
324 /* limits on transfer speed */
325 u32 min_speed_hz;
326 u32 max_speed_hz;
327
315 /* other constraints relevant to this driver */ 328 /* other constraints relevant to this driver */
316 u16 flags; 329 u16 flags;
317#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 330#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
@@ -374,11 +387,13 @@ struct spi_master {
374 bool busy; 387 bool busy;
375 bool running; 388 bool running;
376 bool rt; 389 bool rt;
390 bool auto_runtime_pm;
377 391
378 int (*prepare_transfer_hardware)(struct spi_master *master); 392 int (*prepare_transfer_hardware)(struct spi_master *master);
379 int (*transfer_one_message)(struct spi_master *master, 393 int (*transfer_one_message)(struct spi_master *master,
380 struct spi_message *mesg); 394 struct spi_message *mesg);
381 int (*unprepare_transfer_hardware)(struct spi_master *master); 395 int (*unprepare_transfer_hardware)(struct spi_master *master);
396
382 /* gpio chip select */ 397 /* gpio chip select */
383 int *cs_gpios; 398 int *cs_gpios;
384}; 399};
@@ -448,6 +463,10 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
448 * @rx_buf: data to be read (dma-safe memory), or NULL 463 * @rx_buf: data to be read (dma-safe memory), or NULL
449 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 464 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
450 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 465 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
466 * @tx_nbits: number of bits used for writting. If 0 the default
467 * (SPI_NBITS_SINGLE) is used.
468 * @rx_nbits: number of bits used for reading. If 0 the default
469 * (SPI_NBITS_SINGLE) is used.
451 * @len: size of rx and tx buffers (in bytes) 470 * @len: size of rx and tx buffers (in bytes)
452 * @speed_hz: Select a speed other than the device default for this 471 * @speed_hz: Select a speed other than the device default for this
453 * transfer. If 0 the default (from @spi_device) is used. 472 * transfer. If 0 the default (from @spi_device) is used.
@@ -502,6 +521,11 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
502 * by the results of previous messages and where the whole transaction 521 * by the results of previous messages and where the whole transaction
503 * ends when the chipselect goes intactive. 522 * ends when the chipselect goes intactive.
504 * 523 *
524 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information
525 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
526 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
527 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
528 *
505 * The code that submits an spi_message (and its spi_transfers) 529 * The code that submits an spi_message (and its spi_transfers)
506 * to the lower layers is responsible for managing its memory. 530 * to the lower layers is responsible for managing its memory.
507 * Zero-initialize every field you don't set up explicitly, to 531 * Zero-initialize every field you don't set up explicitly, to
@@ -522,6 +546,11 @@ struct spi_transfer {
522 dma_addr_t rx_dma; 546 dma_addr_t rx_dma;
523 547
524 unsigned cs_change:1; 548 unsigned cs_change:1;
549 u8 tx_nbits;
550 u8 rx_nbits;
551#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
552#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
553#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
525 u8 bits_per_word; 554 u8 bits_per_word;
526 u16 delay_usecs; 555 u16 delay_usecs;
527 u32 speed_hz; 556 u32 speed_hz;
@@ -578,6 +607,7 @@ struct spi_message {
578 /* completion is reported through a callback */ 607 /* completion is reported through a callback */
579 void (*complete)(void *context); 608 void (*complete)(void *context);
580 void *context; 609 void *context;
610 unsigned frame_length;
581 unsigned actual_length; 611 unsigned actual_length;
582 int status; 612 int status;
583 613
@@ -869,7 +899,7 @@ struct spi_board_info {
869 /* mode becomes spi_device.mode, and is essential for chips 899 /* mode becomes spi_device.mode, and is essential for chips
870 * where the default of SPI_CS_HIGH = 0 is wrong. 900 * where the default of SPI_CS_HIGH = 0 is wrong.
871 */ 901 */
872 u8 mode; 902 u16 mode;
873 903
874 /* ... may need additional spi_device chip config data here. 904 /* ... may need additional spi_device chip config data here.
875 * avoid stuff protocol drivers can set; but include stuff 905 * avoid stuff protocol drivers can set; but include stuff
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index f987a2bee16a..daebaba886aa 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -4,11 +4,7 @@
4#include <linux/workqueue.h> 4#include <linux/workqueue.h>
5 5
6struct spi_bitbang { 6struct spi_bitbang {
7 struct workqueue_struct *workqueue;
8 struct work_struct work;
9
10 spinlock_t lock; 7 spinlock_t lock;
11 struct list_head queue;
12 u8 busy; 8 u8 busy;
13 u8 use_dma; 9 u8 use_dma;
14 u8 flags; /* extra spi->mode support */ 10 u8 flags; /* extra spi->mode support */
@@ -41,7 +37,6 @@ struct spi_bitbang {
41 */ 37 */
42extern int spi_bitbang_setup(struct spi_device *spi); 38extern int spi_bitbang_setup(struct spi_device *spi);
43extern void spi_bitbang_cleanup(struct spi_device *spi); 39extern void spi_bitbang_cleanup(struct spi_device *spi);
44extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
45extern int spi_bitbang_setup_transfer(struct spi_device *spi, 40extern int spi_bitbang_setup_transfer(struct spi_device *spi,
46 struct spi_transfer *t); 41 struct spi_transfer *t);
47 42
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 9e495d31516e..bb5deb0feb6b 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -108,6 +108,7 @@ struct plat_stmmacenet_data {
108 int bugged_jumbo; 108 int bugged_jumbo;
109 int pmt; 109 int pmt;
110 int force_sf_dma_mode; 110 int force_sf_dma_mode;
111 int force_thresh_dma_mode;
111 int riwt_off; 112 int riwt_off;
112 void (*fix_mac_speed)(void *priv, unsigned int speed); 113 void (*fix_mac_speed)(void *priv, unsigned int speed);
113 void (*bus_setup)(void __iomem *ioaddr); 114 void (*bus_setup)(void __iomem *ioaddr);
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 0dd00f4f6810..790be1472792 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -24,12 +24,21 @@
24 24
25struct rpcsec_gss_info; 25struct rpcsec_gss_info;
26 26
27/* auth_cred ac_flags bits */
28enum {
29 RPC_CRED_NO_CRKEY_TIMEOUT = 0, /* underlying cred has no key timeout */
30 RPC_CRED_KEY_EXPIRE_SOON = 1, /* underlying cred key will expire soon */
31 RPC_CRED_NOTIFY_TIMEOUT = 2, /* nofity generic cred when underlying
32 key will expire soon */
33};
34
27/* Work around the lack of a VFS credential */ 35/* Work around the lack of a VFS credential */
28struct auth_cred { 36struct auth_cred {
29 kuid_t uid; 37 kuid_t uid;
30 kgid_t gid; 38 kgid_t gid;
31 struct group_info *group_info; 39 struct group_info *group_info;
32 const char *principal; 40 const char *principal;
41 unsigned long ac_flags;
33 unsigned char machine_cred : 1; 42 unsigned char machine_cred : 1;
34}; 43};
35 44
@@ -87,6 +96,11 @@ struct rpc_auth {
87 /* per-flavor data */ 96 /* per-flavor data */
88}; 97};
89 98
99struct rpc_auth_create_args {
100 rpc_authflavor_t pseudoflavor;
101 const char *target_name;
102};
103
90/* Flags for rpcauth_lookupcred() */ 104/* Flags for rpcauth_lookupcred() */
91#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */ 105#define RPCAUTH_LOOKUP_NEW 0x01 /* Accept an uninitialised cred */
92 106
@@ -97,17 +111,17 @@ struct rpc_authops {
97 struct module *owner; 111 struct module *owner;
98 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */ 112 rpc_authflavor_t au_flavor; /* flavor (RPC_AUTH_*) */
99 char * au_name; 113 char * au_name;
100 struct rpc_auth * (*create)(struct rpc_clnt *, rpc_authflavor_t); 114 struct rpc_auth * (*create)(struct rpc_auth_create_args *, struct rpc_clnt *);
101 void (*destroy)(struct rpc_auth *); 115 void (*destroy)(struct rpc_auth *);
102 116
103 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); 117 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
104 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); 118 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
105 int (*pipes_create)(struct rpc_auth *);
106 void (*pipes_destroy)(struct rpc_auth *);
107 int (*list_pseudoflavors)(rpc_authflavor_t *, int); 119 int (*list_pseudoflavors)(rpc_authflavor_t *, int);
108 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *); 120 rpc_authflavor_t (*info2flavor)(struct rpcsec_gss_info *);
109 int (*flavor2info)(rpc_authflavor_t, 121 int (*flavor2info)(rpc_authflavor_t,
110 struct rpcsec_gss_info *); 122 struct rpcsec_gss_info *);
123 int (*key_timeout)(struct rpc_auth *,
124 struct rpc_cred *);
111}; 125};
112 126
113struct rpc_credops { 127struct rpc_credops {
@@ -124,6 +138,8 @@ struct rpc_credops {
124 void *, __be32 *, void *); 138 void *, __be32 *, void *);
125 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t, 139 int (*crunwrap_resp)(struct rpc_task *, kxdrdproc_t,
126 void *, __be32 *, void *); 140 void *, __be32 *, void *);
141 int (*crkey_timeout)(struct rpc_cred *);
142 bool (*crkey_to_expire)(struct rpc_cred *);
127}; 143};
128 144
129extern const struct rpc_authops authunix_ops; 145extern const struct rpc_authops authunix_ops;
@@ -140,7 +156,8 @@ struct rpc_cred * rpc_lookup_cred(void);
140struct rpc_cred * rpc_lookup_machine_cred(const char *service_name); 156struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
141int rpcauth_register(const struct rpc_authops *); 157int rpcauth_register(const struct rpc_authops *);
142int rpcauth_unregister(const struct rpc_authops *); 158int rpcauth_unregister(const struct rpc_authops *);
143struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 159struct rpc_auth * rpcauth_create(struct rpc_auth_create_args *,
160 struct rpc_clnt *);
144void rpcauth_release(struct rpc_auth *); 161void rpcauth_release(struct rpc_auth *);
145rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t, 162rpc_authflavor_t rpcauth_get_pseudoflavor(rpc_authflavor_t,
146 struct rpcsec_gss_info *); 163 struct rpcsec_gss_info *);
@@ -162,6 +179,9 @@ int rpcauth_uptodatecred(struct rpc_task *);
162int rpcauth_init_credcache(struct rpc_auth *); 179int rpcauth_init_credcache(struct rpc_auth *);
163void rpcauth_destroy_credcache(struct rpc_auth *); 180void rpcauth_destroy_credcache(struct rpc_auth *);
164void rpcauth_clear_credcache(struct rpc_cred_cache *); 181void rpcauth_clear_credcache(struct rpc_cred_cache *);
182int rpcauth_key_timeout_notify(struct rpc_auth *,
183 struct rpc_cred *);
184bool rpcauth_cred_key_to_expire(struct rpc_cred *);
165 185
166static inline 186static inline
167struct rpc_cred * get_rpccred(struct rpc_cred *cred) 187struct rpc_cred * get_rpccred(struct rpc_cred *cred)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6ce690de447f..437ddb6c4aef 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -264,12 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint)
264 return 0; 264 return 0;
265} 265}
266 266
267static inline int get_time(char **bpp, time_t *time)
268{
269 char buf[50];
270 long long ll;
271 int len = qword_get(bpp, buf, sizeof(buf));
272
273 if (len < 0)
274 return -EINVAL;
275 if (len == 0)
276 return -ENOENT;
277
278 if (kstrtoll(buf, 0, &ll))
279 return -EINVAL;
280
281 *time = (time_t)ll;
282 return 0;
283}
284
267static inline time_t get_expiry(char **bpp) 285static inline time_t get_expiry(char **bpp)
268{ 286{
269 int rv; 287 time_t rv;
270 struct timespec boot; 288 struct timespec boot;
271 289
272 if (get_int(bpp, &rv)) 290 if (get_time(bpp, &rv))
273 return 0; 291 return 0;
274 if (rv < 0) 292 if (rv < 0)
275 return 0; 293 return 0;
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index bfe11be81f6f..6740801aa71a 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -21,6 +21,7 @@
21#include <linux/sunrpc/stats.h> 21#include <linux/sunrpc/stats.h>
22#include <linux/sunrpc/xdr.h> 22#include <linux/sunrpc/xdr.h>
23#include <linux/sunrpc/timer.h> 23#include <linux/sunrpc/timer.h>
24#include <linux/sunrpc/rpc_pipe_fs.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25#include <linux/path.h> 26#include <linux/path.h>
26#include <net/ipv6.h> 27#include <net/ipv6.h>
@@ -32,6 +33,7 @@ struct rpc_inode;
32 */ 33 */
33struct rpc_clnt { 34struct rpc_clnt {
34 atomic_t cl_count; /* Number of references */ 35 atomic_t cl_count; /* Number of references */
36 unsigned int cl_clid; /* client id */
35 struct list_head cl_clients; /* Global list of clients */ 37 struct list_head cl_clients; /* Global list of clients */
36 struct list_head cl_tasks; /* List of tasks */ 38 struct list_head cl_tasks; /* List of tasks */
37 spinlock_t cl_lock; /* spinlock */ 39 spinlock_t cl_lock; /* spinlock */
@@ -41,7 +43,6 @@ struct rpc_clnt {
41 cl_vers, /* RPC version number */ 43 cl_vers, /* RPC version number */
42 cl_maxproc; /* max procedure number */ 44 cl_maxproc; /* max procedure number */
43 45
44 const char * cl_protname; /* protocol name */
45 struct rpc_auth * cl_auth; /* authenticator */ 46 struct rpc_auth * cl_auth; /* authenticator */
46 struct rpc_stat * cl_stats; /* per-program statistics */ 47 struct rpc_stat * cl_stats; /* per-program statistics */
47 struct rpc_iostats * cl_metrics; /* per-client statistics */ 48 struct rpc_iostats * cl_metrics; /* per-client statistics */
@@ -56,12 +57,11 @@ struct rpc_clnt {
56 57
57 int cl_nodelen; /* nodename length */ 58 int cl_nodelen; /* nodename length */
58 char cl_nodename[UNX_MAXNODENAME]; 59 char cl_nodename[UNX_MAXNODENAME];
59 struct dentry * cl_dentry; 60 struct rpc_pipe_dir_head cl_pipedir_objects;
60 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 61 struct rpc_clnt * cl_parent; /* Points to parent of clones */
61 struct rpc_rtt cl_rtt_default; 62 struct rpc_rtt cl_rtt_default;
62 struct rpc_timeout cl_timeout_default; 63 struct rpc_timeout cl_timeout_default;
63 const struct rpc_program *cl_program; 64 const struct rpc_program *cl_program;
64 char *cl_principal; /* target to authenticate to */
65}; 65};
66 66
67/* 67/*
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index aa5b582cc471..a353e0300b54 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -5,6 +5,26 @@
5 5
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7 7
8struct rpc_pipe_dir_head {
9 struct list_head pdh_entries;
10 struct dentry *pdh_dentry;
11};
12
13struct rpc_pipe_dir_object_ops;
14struct rpc_pipe_dir_object {
15 struct list_head pdo_head;
16 const struct rpc_pipe_dir_object_ops *pdo_ops;
17
18 void *pdo_data;
19};
20
21struct rpc_pipe_dir_object_ops {
22 int (*create)(struct dentry *dir,
23 struct rpc_pipe_dir_object *pdo);
24 void (*destroy)(struct dentry *dir,
25 struct rpc_pipe_dir_object *pdo);
26};
27
8struct rpc_pipe_msg { 28struct rpc_pipe_msg {
9 struct list_head list; 29 struct list_head list;
10 void *data; 30 void *data;
@@ -74,7 +94,24 @@ extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 94
75struct rpc_clnt; 95struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *); 96extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 97extern int rpc_remove_client_dir(struct rpc_clnt *);
98
99extern void rpc_init_pipe_dir_head(struct rpc_pipe_dir_head *pdh);
100extern void rpc_init_pipe_dir_object(struct rpc_pipe_dir_object *pdo,
101 const struct rpc_pipe_dir_object_ops *pdo_ops,
102 void *pdo_data);
103extern int rpc_add_pipe_dir_object(struct net *net,
104 struct rpc_pipe_dir_head *pdh,
105 struct rpc_pipe_dir_object *pdo);
106extern void rpc_remove_pipe_dir_object(struct net *net,
107 struct rpc_pipe_dir_head *pdh,
108 struct rpc_pipe_dir_object *pdo);
109extern struct rpc_pipe_dir_object *rpc_find_or_alloc_pipe_dir_object(
110 struct net *net,
111 struct rpc_pipe_dir_head *pdh,
112 int (*match)(struct rpc_pipe_dir_object *, void *),
113 struct rpc_pipe_dir_object *(*alloc)(void *),
114 void *data);
78 115
79struct cache_detail; 116struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 117extern struct dentry *rpc_create_cache_dir(struct dentry *,
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 1821445708d6..096ee58be11a 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -79,7 +79,7 @@ struct rpc_task {
79 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */ 80 unsigned short tk_timeouts; /* maj timeouts */
81 81
82#ifdef RPC_DEBUG 82#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
83 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
84#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */ 85 unsigned char tk_priority : 2,/* Task priority */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 1f0216b9a6c9..6eecfc2e4f98 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -243,7 +243,6 @@ struct svc_rqst {
243 struct xdr_buf rq_res; 243 struct xdr_buf rq_res;
244 struct page * rq_pages[RPCSVC_MAXPAGES]; 244 struct page * rq_pages[RPCSVC_MAXPAGES];
245 struct page * *rq_respages; /* points into rq_pages */ 245 struct page * *rq_respages; /* points into rq_pages */
246 int rq_resused; /* number of pages used for result */
247 struct page * *rq_next_page; /* next reply page to use */ 246 struct page * *rq_next_page; /* next reply page to use */
248 247
249 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d95cde5e257d..46ba0c6c219f 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -182,6 +182,33 @@ enum {
182#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ 182#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */
183 183
184/* 184/*
185 * We use this to track usage of a cluster. A cluster is a block of swap disk
186 * space with SWAPFILE_CLUSTER pages long and naturally aligns in disk. All
187 * free clusters are organized into a list. We fetch an entry from the list to
188 * get a free cluster.
189 *
190 * The data field stores next cluster if the cluster is free or cluster usage
191 * counter otherwise. The flags field determines if a cluster is free. This is
192 * protected by swap_info_struct.lock.
193 */
194struct swap_cluster_info {
195 unsigned int data:24;
196 unsigned int flags:8;
197};
198#define CLUSTER_FLAG_FREE 1 /* This cluster is free */
199#define CLUSTER_FLAG_NEXT_NULL 2 /* This cluster has no next cluster */
200
201/*
202 * We assign a cluster to each CPU, so each CPU can allocate swap entry from
203 * its own cluster and swapout sequentially. The purpose is to optimize swapout
204 * throughput.
205 */
206struct percpu_cluster {
207 struct swap_cluster_info index; /* Current cluster index */
208 unsigned int next; /* Likely next allocation offset */
209};
210
211/*
185 * The in-memory structure used to track swap areas. 212 * The in-memory structure used to track swap areas.
186 */ 213 */
187struct swap_info_struct { 214struct swap_info_struct {
@@ -191,14 +218,16 @@ struct swap_info_struct {
191 signed char next; /* next type on the swap list */ 218 signed char next; /* next type on the swap list */
192 unsigned int max; /* extent of the swap_map */ 219 unsigned int max; /* extent of the swap_map */
193 unsigned char *swap_map; /* vmalloc'ed array of usage counts */ 220 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
221 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
222 struct swap_cluster_info free_cluster_head; /* free cluster list head */
223 struct swap_cluster_info free_cluster_tail; /* free cluster list tail */
194 unsigned int lowest_bit; /* index of first free in swap_map */ 224 unsigned int lowest_bit; /* index of first free in swap_map */
195 unsigned int highest_bit; /* index of last free in swap_map */ 225 unsigned int highest_bit; /* index of last free in swap_map */
196 unsigned int pages; /* total of usable pages of swap */ 226 unsigned int pages; /* total of usable pages of swap */
197 unsigned int inuse_pages; /* number of those currently in use */ 227 unsigned int inuse_pages; /* number of those currently in use */
198 unsigned int cluster_next; /* likely index for next allocation */ 228 unsigned int cluster_next; /* likely index for next allocation */
199 unsigned int cluster_nr; /* countdown to next cluster search */ 229 unsigned int cluster_nr; /* countdown to next cluster search */
200 unsigned int lowest_alloc; /* while preparing discard cluster */ 230 struct percpu_cluster __percpu *percpu_cluster; /* per cpu's swap location */
201 unsigned int highest_alloc; /* while preparing discard cluster */
202 struct swap_extent *curr_swap_extent; 231 struct swap_extent *curr_swap_extent;
203 struct swap_extent first_swap_extent; 232 struct swap_extent first_swap_extent;
204 struct block_device *bdev; /* swap device or bdev of swap file */ 233 struct block_device *bdev; /* swap device or bdev of swap file */
@@ -212,14 +241,18 @@ struct swap_info_struct {
212 * protect map scan related fields like 241 * protect map scan related fields like
213 * swap_map, lowest_bit, highest_bit, 242 * swap_map, lowest_bit, highest_bit,
214 * inuse_pages, cluster_next, 243 * inuse_pages, cluster_next,
215 * cluster_nr, lowest_alloc and 244 * cluster_nr, lowest_alloc,
216 * highest_alloc. other fields are only 245 * highest_alloc, free/discard cluster
217 * changed at swapon/swapoff, so are 246 * list. other fields are only changed
218 * protected by swap_lock. changing 247 * at swapon/swapoff, so are protected
219 * flags need hold this lock and 248 * by swap_lock. changing flags need
220 * swap_lock. If both locks need hold, 249 * hold this lock and swap_lock. If
221 * hold swap_lock first. 250 * both locks need hold, hold swap_lock
251 * first.
222 */ 252 */
253 struct work_struct discard_work; /* discard worker */
254 struct swap_cluster_info discard_cluster_head; /* list head of discard clusters */
255 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */
223}; 256};
224 257
225struct swap_list_t { 258struct swap_list_t {
@@ -247,7 +280,7 @@ extern void activate_page(struct page *);
247extern void mark_page_accessed(struct page *); 280extern void mark_page_accessed(struct page *);
248extern void lru_add_drain(void); 281extern void lru_add_drain(void);
249extern void lru_add_drain_cpu(int cpu); 282extern void lru_add_drain_cpu(int cpu);
250extern int lru_add_drain_all(void); 283extern void lru_add_drain_all(void);
251extern void rotate_reclaimable_page(struct page *page); 284extern void rotate_reclaimable_page(struct page *page);
252extern void deactivate_page(struct page *page); 285extern void deactivate_page(struct page *page);
253extern void swap_setup(void); 286extern void swap_setup(void);
@@ -414,6 +447,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
414 447
415#else /* CONFIG_SWAP */ 448#else /* CONFIG_SWAP */
416 449
450#define swap_address_space(entry) (NULL)
417#define get_nr_swap_pages() 0L 451#define get_nr_swap_pages() 0L
418#define total_swap_pages 0L 452#define total_swap_pages 0L
419#define total_swapcache_pages() 0UL 453#define total_swapcache_pages() 0UL
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 84662ecc7b51..7fac04e7ff6e 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -186,6 +186,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
186#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \
187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 187 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 188 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
189 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 190 asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
190 { \ 191 { \
191 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ 192 long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 9e8a9b555ad6..11baec7c9b26 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -51,9 +51,9 @@ do { \
51 static struct lock_class_key __key; \ 51 static struct lock_class_key __key; \
52 \ 52 \
53 (attr)->key = &__key; \ 53 (attr)->key = &__key; \
54} while(0) 54} while (0)
55#else 55#else
56#define sysfs_attr_init(attr) do {} while(0) 56#define sysfs_attr_init(attr) do {} while (0)
57#endif 57#endif
58 58
59struct attribute_group { 59struct attribute_group {
@@ -69,7 +69,7 @@ struct attribute_group {
69 * for examples.. 69 * for examples..
70 */ 70 */
71 71
72#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name, _mode, _show, _store) { \
73 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
74 .show = _show, \ 74 .show = _show, \
75 .store = _store, \ 75 .store = _store, \
@@ -80,6 +80,11 @@ struct attribute_group {
80 .show = _name##_show, \ 80 .show = _name##_show, \
81} 81}
82 82
83#define __ATTR_WO(_name) { \
84 .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \
85 .store = _name##_store, \
86}
87
83#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \ 88#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
84 _name##_show, _name##_store) 89 _name##_show, _name##_store)
85 90
@@ -108,8 +113,6 @@ static const struct attribute_group _name##_group = { \
108}; \ 113}; \
109__ATTRIBUTE_GROUPS(_name) 114__ATTRIBUTE_GROUPS(_name)
110 115
111#define attr_name(_attr) (_attr).attr.name
112
113struct file; 116struct file;
114struct vm_area_struct; 117struct vm_area_struct;
115 118
@@ -119,7 +122,7 @@ struct bin_attribute {
119 void *private; 122 void *private;
120 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 123 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
121 char *, loff_t, size_t); 124 char *, loff_t, size_t);
122 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, 125 ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
123 char *, loff_t, size_t); 126 char *, loff_t, size_t);
124 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, 127 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
125 struct vm_area_struct *vma); 128 struct vm_area_struct *vma);
@@ -153,7 +156,7 @@ struct bin_attribute {
153 156
154#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \ 157#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
155 (S_IWUSR | S_IRUGO), _name##_read, \ 158 (S_IWUSR | S_IRUGO), _name##_read, \
156 _name##_write) 159 _name##_write, _size)
157 160
158#define __BIN_ATTR_NULL __ATTR_NULL 161#define __BIN_ATTR_NULL __ATTR_NULL
159 162
@@ -168,8 +171,8 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size) 171struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
169 172
170struct sysfs_ops { 173struct sysfs_ops {
171 ssize_t (*show)(struct kobject *, struct attribute *,char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
172 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
173 const void *(*namespace)(struct kobject *, const struct attribute *); 176 const void *(*namespace)(struct kobject *, const struct attribute *);
174}; 177};
175 178
@@ -215,10 +218,14 @@ void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
215 218
216int __must_check sysfs_create_group(struct kobject *kobj, 219int __must_check sysfs_create_group(struct kobject *kobj,
217 const struct attribute_group *grp); 220 const struct attribute_group *grp);
221int __must_check sysfs_create_groups(struct kobject *kobj,
222 const struct attribute_group **groups);
218int sysfs_update_group(struct kobject *kobj, 223int sysfs_update_group(struct kobject *kobj,
219 const struct attribute_group *grp); 224 const struct attribute_group *grp);
220void sysfs_remove_group(struct kobject *kobj, 225void sysfs_remove_group(struct kobject *kobj,
221 const struct attribute_group *grp); 226 const struct attribute_group *grp);
227void sysfs_remove_groups(struct kobject *kobj,
228 const struct attribute_group **groups);
222int sysfs_add_file_to_group(struct kobject *kobj, 229int sysfs_add_file_to_group(struct kobject *kobj,
223 const struct attribute *attr, const char *group); 230 const struct attribute *attr, const char *group);
224void sysfs_remove_file_from_group(struct kobject *kobj, 231void sysfs_remove_file_from_group(struct kobject *kobj,
@@ -343,6 +350,12 @@ static inline int sysfs_create_group(struct kobject *kobj,
343 return 0; 350 return 0;
344} 351}
345 352
353static inline int sysfs_create_groups(struct kobject *kobj,
354 const struct attribute_group **groups)
355{
356 return 0;
357}
358
346static inline int sysfs_update_group(struct kobject *kobj, 359static inline int sysfs_update_group(struct kobject *kobj,
347 const struct attribute_group *grp) 360 const struct attribute_group *grp)
348{ 361{
@@ -354,6 +367,11 @@ static inline void sysfs_remove_group(struct kobject *kobj,
354{ 367{
355} 368}
356 369
370static inline void sysfs_remove_groups(struct kobject *kobj,
371 const struct attribute_group **groups)
372{
373}
374
357static inline int sysfs_add_file_to_group(struct kobject *kobj, 375static inline int sysfs_add_file_to_group(struct kobject *kobj,
358 const struct attribute *attr, const char *group) 376 const struct attribute *attr, const char *group)
359{ 377{
diff --git a/include/linux/tc_act/tc_defact.h b/include/linux/tc_act/tc_defact.h
deleted file mode 100644
index 6f65d07c7ce2..000000000000
--- a/include/linux/tc_act/tc_defact.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef __LINUX_TC_DEF_H
2#define __LINUX_TC_DEF_H
3
4#include <linux/pkt_cls.h>
5
6struct tc_defact {
7 tc_gen;
8};
9
10enum {
11 TCA_DEF_UNSPEC,
12 TCA_DEF_TM,
13 TCA_DEF_PARMS,
14 TCA_DEF_DATA,
15 __TCA_DEF_MAX
16};
17#define TCA_DEF_MAX (__TCA_DEF_MAX - 1)
18
19#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 472120b4fac5..d68633452d9b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -107,7 +107,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt)
107 * only four options will fit in a standard TCP header */ 107 * only four options will fit in a standard TCP header */
108#define TCP_NUM_SACKS 4 108#define TCP_NUM_SACKS 4
109 109
110struct tcp_cookie_values;
111struct tcp_request_sock_ops; 110struct tcp_request_sock_ops;
112 111
113struct tcp_request_sock { 112struct tcp_request_sock {
@@ -238,6 +237,7 @@ struct tcp_sock {
238 237
239 u32 rcv_wnd; /* Current receiver window */ 238 u32 rcv_wnd; /* Current receiver window */
240 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 239 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
240 u32 notsent_lowat; /* TCP_NOTSENT_LOWAT */
241 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 241 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
242 u32 lost_out; /* Lost packets */ 242 u32 lost_out; /* Lost packets */
243 u32 sacked_out; /* SACK'd packets */ 243 u32 sacked_out; /* SACK'd packets */
diff --git a/include/linux/tegra-cpuidle.h b/include/linux/tegra-cpuidle.h
new file mode 100644
index 000000000000..9c6286bbf662
--- /dev/null
+++ b/include/linux/tegra-cpuidle.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope 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
14#ifndef __LINUX_TEGRA_CPUIDLE_H__
15#define __LINUX_TEGRA_CPUIDLE_H__
16
17#ifdef CONFIG_CPU_IDLE
18void tegra_cpuidle_pcie_irqs_in_use(void);
19#else
20static inline void tegra_cpuidle_pcie_irqs_in_use(void)
21{
22}
23#endif
24
25#endif
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index a386a1cbb6e1..b268d3cf7ae3 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -207,6 +207,16 @@ struct thermal_bind_params {
207 * See Documentation/thermal/sysfs-api.txt for more information. 207 * See Documentation/thermal/sysfs-api.txt for more information.
208 */ 208 */
209 int trip_mask; 209 int trip_mask;
210
211 /*
212 * This is an array of cooling state limits. Must have exactly
213 * 2 * thermal_zone.number_of_trip_points. It is an array consisting
214 * of tuples <lower-state upper-state> of state limits. Each trip
215 * will be associated with one state limit tuple when binding.
216 * A NULL pointer means <THERMAL_NO_LIMITS THERMAL_NO_LIMITS>
217 * on all trips.
218 */
219 unsigned long *binding_limits;
210 int (*match) (struct thermal_zone_device *tz, 220 int (*match) (struct thermal_zone_device *tz,
211 struct thermal_cooling_device *cdev); 221 struct thermal_cooling_device *cdev);
212}; 222};
@@ -214,6 +224,14 @@ struct thermal_bind_params {
214/* Structure to define Thermal Zone parameters */ 224/* Structure to define Thermal Zone parameters */
215struct thermal_zone_params { 225struct thermal_zone_params {
216 char governor_name[THERMAL_NAME_LENGTH]; 226 char governor_name[THERMAL_NAME_LENGTH];
227
228 /*
229 * a boolean to indicate if the thermal to hwmon sysfs interface
230 * is required. when no_hwmon == false, a hwmon sysfs interface
231 * will be created. when no_hwmon == true, nothing will be done
232 */
233 bool no_hwmon;
234
217 int num_tbps; /* Number of tbp entries */ 235 int num_tbps; /* Number of tbp entries */
218 struct thermal_bind_params *tbp; 236 struct thermal_bind_params *tbp;
219}; 237};
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 62bd8b72873c..5128d33bbb39 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -10,6 +10,8 @@
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h> 11#include <linux/percpu.h>
12#include <linux/hrtimer.h> 12#include <linux/hrtimer.h>
13#include <linux/context_tracking_state.h>
14#include <linux/cpumask.h>
13 15
14#ifdef CONFIG_GENERIC_CLOCKEVENTS 16#ifdef CONFIG_GENERIC_CLOCKEVENTS
15 17
@@ -158,20 +160,51 @@ static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
158# endif /* !CONFIG_NO_HZ_COMMON */ 160# endif /* !CONFIG_NO_HZ_COMMON */
159 161
160#ifdef CONFIG_NO_HZ_FULL 162#ifdef CONFIG_NO_HZ_FULL
163extern bool tick_nohz_full_running;
164extern cpumask_var_t tick_nohz_full_mask;
165
166static inline bool tick_nohz_full_enabled(void)
167{
168 if (!static_key_false(&context_tracking_enabled))
169 return false;
170
171 return tick_nohz_full_running;
172}
173
174static inline bool tick_nohz_full_cpu(int cpu)
175{
176 if (!tick_nohz_full_enabled())
177 return false;
178
179 return cpumask_test_cpu(cpu, tick_nohz_full_mask);
180}
181
161extern void tick_nohz_init(void); 182extern void tick_nohz_init(void);
162extern int tick_nohz_full_cpu(int cpu); 183extern void __tick_nohz_full_check(void);
163extern void tick_nohz_full_check(void);
164extern void tick_nohz_full_kick(void); 184extern void tick_nohz_full_kick(void);
165extern void tick_nohz_full_kick_all(void); 185extern void tick_nohz_full_kick_all(void);
166extern void tick_nohz_task_switch(struct task_struct *tsk); 186extern void __tick_nohz_task_switch(struct task_struct *tsk);
167#else 187#else
168static inline void tick_nohz_init(void) { } 188static inline void tick_nohz_init(void) { }
169static inline int tick_nohz_full_cpu(int cpu) { return 0; } 189static inline bool tick_nohz_full_enabled(void) { return false; }
170static inline void tick_nohz_full_check(void) { } 190static inline bool tick_nohz_full_cpu(int cpu) { return false; }
191static inline void __tick_nohz_full_check(void) { }
171static inline void tick_nohz_full_kick(void) { } 192static inline void tick_nohz_full_kick(void) { }
172static inline void tick_nohz_full_kick_all(void) { } 193static inline void tick_nohz_full_kick_all(void) { }
173static inline void tick_nohz_task_switch(struct task_struct *tsk) { } 194static inline void __tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 195#endif
175 196
197static inline void tick_nohz_full_check(void)
198{
199 if (tick_nohz_full_enabled())
200 __tick_nohz_full_check();
201}
202
203static inline void tick_nohz_task_switch(struct task_struct *tsk)
204{
205 if (tick_nohz_full_enabled())
206 __tick_nohz_task_switch(tsk);
207}
208
176 209
177#endif 210#endif
diff --git a/include/linux/time-armada-370-xp.h b/include/linux/time-armada-370-xp.h
deleted file mode 100644
index dfdfdc03115b..000000000000
--- a/include/linux/time-armada-370-xp.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Marvell Armada 370/XP SoC timer handling.
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Lior Amsalem <alior@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 *
10 */
11#ifndef __TIME_ARMADA_370_XPPRCMU_H
12#define __TIME_ARMADA_370_XPPRCMU_H
13
14#include <linux/init.h>
15
16void __init armada_370_xp_timer_init(void);
17
18#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b3726e61368e..9d3f1a5b6178 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -64,6 +64,20 @@
64 64
65#include <asm/timex.h> 65#include <asm/timex.h>
66 66
67#ifndef random_get_entropy
68/*
69 * The random_get_entropy() function is used by the /dev/random driver
70 * in order to extract entropy via the relative unpredictability of
71 * when an interrupt takes places versus a high speed, fine-grained
72 * timing source or cycle counter. Since it will be occurred on every
73 * single interrupt, it must have a very low cost/overhead.
74 *
75 * By default we use get_cycles() for this purpose, but individual
76 * architectures may override this in their asm/timex.h header file.
77 */
78#define random_get_entropy() get_cycles()
79#endif
80
67/* 81/*
68 * SHIFT_PLL is used as a dampening factor to define how much we 82 * SHIFT_PLL is used as a dampening factor to define how much we
69 * adjust the frequency correction for a given offset in PLL mode. 83 * adjust the frequency correction for a given offset in PLL mode.
@@ -141,6 +155,7 @@ extern int do_adjtimex(struct timex *);
141extern void hardpps(const struct timespec *, const struct timespec *); 155extern void hardpps(const struct timespec *, const struct timespec *);
142 156
143int read_current_timer(unsigned long *timer_val); 157int read_current_timer(unsigned long *timer_val);
158void ntp_notify_cmos_timer(void);
144 159
145/* The clock frequency of the i8253/i8254 PIT */ 160/* The clock frequency of the i8253/i8254 PIT */
146#define PIT_TICK_RATE 1193182ul 161#define PIT_TICK_RATE 1193182ul
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 01ac30efd6a6..64f864651d86 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -10,6 +10,8 @@
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/tty_flags.h> 11#include <linux/tty_flags.h>
12#include <uapi/linux/tty.h> 12#include <uapi/linux/tty.h>
13#include <linux/rwsem.h>
14#include <linux/llist.h>
13 15
14 16
15 17
@@ -29,9 +31,10 @@
29#define __DISABLED_CHAR '\0' 31#define __DISABLED_CHAR '\0'
30 32
31struct tty_buffer { 33struct tty_buffer {
32 struct tty_buffer *next; 34 union {
33 char *char_buf_ptr; 35 struct tty_buffer *next;
34 unsigned char *flag_buf_ptr; 36 struct llist_node free;
37 };
35 int used; 38 int used;
36 int size; 39 int size;
37 int commit; 40 int commit;
@@ -40,25 +43,25 @@ struct tty_buffer {
40 unsigned long data[0]; 43 unsigned long data[0];
41}; 44};
42 45
43/* 46static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
44 * We default to dicing tty buffer allocations to this many characters 47{
45 * in order to avoid multiple page allocations. We know the size of 48 return ((unsigned char *)b->data) + ofs;
46 * tty_buffer itself but it must also be taken into account that the 49}
47 * the buffer is 256 byte aligned. See tty_buffer_find for the allocation
48 * logic this must match
49 */
50
51#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF)
52 50
51static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
52{
53 return (char *)char_buf_ptr(b, ofs) + b->size;
54}
53 55
54struct tty_bufhead { 56struct tty_bufhead {
55 struct work_struct work;
56 spinlock_t lock;
57 struct tty_buffer *head; /* Queue head */ 57 struct tty_buffer *head; /* Queue head */
58 struct work_struct work;
59 struct mutex lock;
60 atomic_t priority;
61 struct tty_buffer sentinel;
62 struct llist_head free; /* Free queue head */
63 atomic_t memory_used; /* In-use buffers excluding free list */
58 struct tty_buffer *tail; /* Active buffer */ 64 struct tty_buffer *tail; /* Active buffer */
59 struct tty_buffer *free; /* Free queue head */
60 int memory_used; /* Buffer space used excluding
61 free queue */
62}; 65};
63/* 66/*
64 * When a break, frame error, or parity error happens, these codes are 67 * When a break, frame error, or parity error happens, these codes are
@@ -199,9 +202,6 @@ struct tty_port {
199 wait_queue_head_t close_wait; /* Close waiters */ 202 wait_queue_head_t close_wait; /* Close waiters */
200 wait_queue_head_t delta_msr_wait; /* Modem status change */ 203 wait_queue_head_t delta_msr_wait; /* Modem status change */
201 unsigned long flags; /* TTY flags ASY_*/ 204 unsigned long flags; /* TTY flags ASY_*/
202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
205 unsigned char console:1, /* port is a console */ 205 unsigned char console:1, /* port is a console */
206 low_latency:1; /* direct buffer flush */ 206 low_latency:1; /* direct buffer flush */
207 struct mutex mutex; /* Locking */ 207 struct mutex mutex; /* Locking */
@@ -238,14 +238,16 @@ struct tty_struct {
238 int index; 238 int index;
239 239
240 /* Protects ldisc changes: Lock tty not pty */ 240 /* Protects ldisc changes: Lock tty not pty */
241 struct mutex ldisc_mutex; 241 struct ld_semaphore ldisc_sem;
242 struct tty_ldisc *ldisc; 242 struct tty_ldisc *ldisc;
243 243
244 struct mutex atomic_write_lock; 244 struct mutex atomic_write_lock;
245 struct mutex legacy_mutex; 245 struct mutex legacy_mutex;
246 struct mutex termios_mutex; 246 struct mutex throttle_mutex;
247 struct rw_semaphore termios_rwsem;
248 struct mutex winsize_mutex;
247 spinlock_t ctrl_lock; 249 spinlock_t ctrl_lock;
248 /* Termios values are protected by the termios mutex */ 250 /* Termios values are protected by the termios rwsem */
249 struct ktermios termios, termios_locked; 251 struct ktermios termios, termios_locked;
250 struct termiox *termiox; /* May be NULL for unsupported */ 252 struct termiox *termiox; /* May be NULL for unsupported */
251 char name[64]; 253 char name[64];
@@ -253,7 +255,7 @@ struct tty_struct {
253 struct pid *session; 255 struct pid *session;
254 unsigned long flags; 256 unsigned long flags;
255 int count; 257 int count;
256 struct winsize winsize; /* termios mutex */ 258 struct winsize winsize; /* winsize_mutex */
257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 259 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 260 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 261 unsigned int receive_room; /* Bytes free for queue */
@@ -303,10 +305,7 @@ struct tty_file_private {
303#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 305#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
304#define TTY_DEBUG 4 /* Debugging */ 306#define TTY_DEBUG 4 /* Debugging */
305#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ 307#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */
306#define TTY_PUSH 6 /* n_tty private */
307#define TTY_CLOSING 7 /* ->close() in progress */ 308#define TTY_CLOSING 7 /* ->close() in progress */
308#define TTY_LDISC 9 /* Line discipline attached */
309#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
310#define TTY_LDISC_OPEN 11 /* Line discipline is open */ 309#define TTY_LDISC_OPEN 11 /* Line discipline is open */
311#define TTY_PTY_LOCK 16 /* pty private */ 310#define TTY_PTY_LOCK 16 /* pty private */
312#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 311#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
@@ -559,6 +558,19 @@ extern void tty_ldisc_init(struct tty_struct *tty);
559extern void tty_ldisc_deinit(struct tty_struct *tty); 558extern void tty_ldisc_deinit(struct tty_struct *tty);
560extern void tty_ldisc_begin(void); 559extern void tty_ldisc_begin(void);
561 560
561static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
562 char *f, int count)
563{
564 if (ld->ops->receive_buf2)
565 count = ld->ops->receive_buf2(ld->tty, p, f, count);
566 else {
567 count = min_t(int, count, ld->tty->receive_room);
568 if (count)
569 ld->ops->receive_buf(ld->tty, p, f, count);
570 }
571 return count;
572}
573
562 574
563/* n_tty.c */ 575/* n_tty.c */
564extern struct tty_ldisc_ops tty_ldisc_N_TTY; 576extern struct tty_ldisc_ops tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index e0f252633b47..21ddd7d9ea1f 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_space_avail(struct tty_port *port);
4extern int tty_buffer_request_room(struct tty_port *port, size_t size); 5extern int tty_buffer_request_room(struct tty_port *port, size_t size);
5extern int tty_insert_flip_string_flags(struct tty_port *port, 6extern int tty_insert_flip_string_flags(struct tty_port *port,
6 const unsigned char *chars, const char *flags, size_t size); 7 const unsigned char *chars, const char *flags, size_t size);
@@ -18,8 +19,8 @@ static inline int tty_insert_flip_char(struct tty_port *port,
18{ 19{
19 struct tty_buffer *tb = port->buf.tail; 20 struct tty_buffer *tb = port->buf.tail;
20 if (tb && tb->used < tb->size) { 21 if (tb && tb->used < tb->size) {
21 tb->flag_buf_ptr[tb->used] = flag; 22 *flag_buf_ptr(tb, tb->used) = flag;
22 tb->char_buf_ptr[tb->used++] = ch; 23 *char_buf_ptr(tb, tb->used++) = ch;
23 return 1; 24 return 1;
24 } 25 }
25 return tty_insert_flip_string_flags(port, &ch, &flag, 1); 26 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
@@ -31,4 +32,7 @@ static inline int tty_insert_flip_string(struct tty_port *port,
31 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size); 32 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
32} 33}
33 34
35extern void tty_buffer_lock_exclusive(struct tty_port *port);
36extern void tty_buffer_unlock_exclusive(struct tty_port *port);
37
34#endif /* _LINUX_TTY_FLIP_H */ 38#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index a1b048999821..f15c898ff462 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -109,6 +109,17 @@
109 * 109 *
110 * Tells the discipline that the DCD pin has changed its status. 110 * Tells the discipline that the DCD pin has changed its status.
111 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline. 111 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline.
112 *
113 * int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
114 * char *fp, int count);
115 *
116 * This function is called by the low-level tty driver to send
117 * characters received by the hardware to the line discpline for
118 * processing. <cp> is a pointer to the buffer of input
119 * character received by the device. <fp> is a pointer to a
120 * pointer of flag bytes which indicate whether a character was
121 * received with a parity error, etc.
122 * If assigned, prefer this function for automatic flow control.
112 */ 123 */
113 124
114#include <linux/fs.h> 125#include <linux/fs.h>
@@ -195,6 +206,8 @@ struct tty_ldisc_ops {
195 void (*write_wakeup)(struct tty_struct *); 206 void (*write_wakeup)(struct tty_struct *);
196 void (*dcd_change)(struct tty_struct *, unsigned int); 207 void (*dcd_change)(struct tty_struct *, unsigned int);
197 void (*fasync)(struct tty_struct *tty, int on); 208 void (*fasync)(struct tty_struct *tty, int on);
209 int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
210 char *fp, int count);
198 211
199 struct module *owner; 212 struct module *owner;
200 213
@@ -203,8 +216,7 @@ struct tty_ldisc_ops {
203 216
204struct tty_ldisc { 217struct tty_ldisc {
205 struct tty_ldisc_ops *ops; 218 struct tty_ldisc_ops *ops;
206 atomic_t users; 219 struct tty_struct *tty;
207 wait_queue_head_t wq_idle;
208}; 220};
209 221
210#define TTY_LDISC_MAGIC 0x5403 222#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0eec2689b955..001629cd1a97 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -337,6 +337,7 @@ struct usb_bus {
337 * the ep queue on a short transfer 337 * the ep queue on a short transfer
338 * with the URB_SHORT_NOT_OK flag set. 338 * with the URB_SHORT_NOT_OK flag set.
339 */ 339 */
340 unsigned no_sg_constraint:1; /* no sg constraint */
340 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 341 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
341 342
342 int devnum_next; /* Next open device number in 343 int devnum_next; /* Next open device number in
@@ -684,6 +685,11 @@ static inline bool usb_device_supports_ltm(struct usb_device *udev)
684 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; 685 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT;
685} 686}
686 687
688static inline bool usb_device_no_sg_constraint(struct usb_device *udev)
689{
690 return udev && udev->bus && udev->bus->no_sg_constraint;
691}
692
687 693
688/*-------------------------------------------------------------------------*/ 694/*-------------------------------------------------------------------------*/
689 695
@@ -708,7 +714,10 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
708 * usb_interface_claimed - returns true iff an interface is claimed 714 * usb_interface_claimed - returns true iff an interface is claimed
709 * @iface: the interface being checked 715 * @iface: the interface being checked
710 * 716 *
711 * Returns true (nonzero) iff the interface is claimed, else false (zero). 717 * Return: %true (nonzero) iff the interface is claimed, else %false
718 * (zero).
719 *
720 * Note:
712 * Callers must own the driver model's usb bus readlock. So driver 721 * Callers must own the driver model's usb bus readlock. So driver
713 * probe() entries don't need extra locking, but other call contexts 722 * probe() entries don't need extra locking, but other call contexts
714 * may need to explicitly claim that lock. 723 * may need to explicitly claim that lock.
@@ -745,8 +754,9 @@ extern struct usb_host_interface *usb_find_alt_setting(
745 * @buf: where to put the string 754 * @buf: where to put the string
746 * @size: how big is "buf"? 755 * @size: how big is "buf"?
747 * 756 *
748 * Returns length of the string (> 0) or negative if size was too small. 757 * Return: Length of the string (> 0) or negative if size was too small.
749 * 758 *
759 * Note:
750 * This identifier is intended to be "stable", reflecting physical paths in 760 * This identifier is intended to be "stable", reflecting physical paths in
751 * hardware such as physical bus addresses for host controllers or ports on 761 * hardware such as physical bus addresses for host controllers or ports on
752 * USB hubs. That makes it stay the same until systems are physically 762 * USB hubs. That makes it stay the same until systems are physically
@@ -1247,7 +1257,9 @@ typedef void (*usb_complete_t)(struct urb *);
1247 * the device driver is saying that it provided this DMA address, 1257 * the device driver is saying that it provided this DMA address,
1248 * which the host controller driver should use in preference to the 1258 * which the host controller driver should use in preference to the
1249 * transfer_buffer. 1259 * transfer_buffer.
1250 * @sg: scatter gather buffer list 1260 * @sg: scatter gather buffer list, the buffer size of each element in
1261 * the list (except the last) must be divisible by the endpoint's
1262 * max packet size if no_sg_constraint isn't set in 'struct usb_bus'
1251 * @num_mapped_sgs: (internal) number of mapped sg entries 1263 * @num_mapped_sgs: (internal) number of mapped sg entries
1252 * @num_sgs: number of entries in the sg list 1264 * @num_sgs: number of entries in the sg list
1253 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1265 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
@@ -1534,10 +1546,16 @@ static inline void usb_fill_int_urb(struct urb *urb,
1534 urb->transfer_buffer_length = buffer_length; 1546 urb->transfer_buffer_length = buffer_length;
1535 urb->complete = complete_fn; 1547 urb->complete = complete_fn;
1536 urb->context = context; 1548 urb->context = context;
1537 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) 1549
1550 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) {
1551 /* make sure interval is within allowed range */
1552 interval = clamp(interval, 1, 16);
1553
1538 urb->interval = 1 << (interval - 1); 1554 urb->interval = 1 << (interval - 1);
1539 else 1555 } else {
1540 urb->interval = interval; 1556 urb->interval = interval;
1557 }
1558
1541 urb->start_frame = -1; 1559 urb->start_frame = -1;
1542} 1560}
1543 1561
@@ -1570,7 +1588,7 @@ extern int usb_anchor_empty(struct usb_anchor *anchor);
1570 * usb_urb_dir_in - check if an URB describes an IN transfer 1588 * usb_urb_dir_in - check if an URB describes an IN transfer
1571 * @urb: URB to be checked 1589 * @urb: URB to be checked
1572 * 1590 *
1573 * Returns 1 if @urb describes an IN transfer (device-to-host), 1591 * Return: 1 if @urb describes an IN transfer (device-to-host),
1574 * otherwise 0. 1592 * otherwise 0.
1575 */ 1593 */
1576static inline int usb_urb_dir_in(struct urb *urb) 1594static inline int usb_urb_dir_in(struct urb *urb)
@@ -1582,7 +1600,7 @@ static inline int usb_urb_dir_in(struct urb *urb)
1582 * usb_urb_dir_out - check if an URB describes an OUT transfer 1600 * usb_urb_dir_out - check if an URB describes an OUT transfer
1583 * @urb: URB to be checked 1601 * @urb: URB to be checked
1584 * 1602 *
1585 * Returns 1 if @urb describes an OUT transfer (host-to-device), 1603 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1586 * otherwise 0. 1604 * otherwise 0.
1587 */ 1605 */
1588static inline int usb_urb_dir_out(struct urb *urb) 1606static inline int usb_urb_dir_out(struct urb *urb)
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 25629948c842..7d399671a566 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -18,12 +18,17 @@ struct ci_hdrc_platform_data {
18 unsigned long flags; 18 unsigned long flags;
19#define CI_HDRC_REGS_SHARED BIT(0) 19#define CI_HDRC_REGS_SHARED BIT(0)
20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1) 20#define CI_HDRC_REQUIRE_TRANSCEIVER BIT(1)
21#define CI_HDRC_PULLUP_ON_VBUS BIT(2)
22#define CI_HDRC_DISABLE_STREAMING BIT(3) 21#define CI_HDRC_DISABLE_STREAMING BIT(3)
22 /*
23 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
24 * but otg is not supported (no register otgsc).
25 */
26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
23 enum usb_dr_mode dr_mode; 27 enum usb_dr_mode dr_mode;
24#define CI_HDRC_CONTROLLER_RESET_EVENT 0 28#define CI_HDRC_CONTROLLER_RESET_EVENT 0
25#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 29#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
26 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 30 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
31 struct regulator *reg_vbus;
27}; 32};
28 33
29/* Default offset of capability registers */ 34/* Default offset of capability registers */
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
deleted file mode 100644
index 5615f4d82724..000000000000
--- a/include/linux/usb/dwc3-omap.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright (C) 2013 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __DWC3_OMAP_H__
11#define __DWC3_OMAP_H__
12
13enum omap_dwc3_vbus_id_status {
14 OMAP_DWC3_UNKNOWN = 0,
15 OMAP_DWC3_ID_GROUND,
16 OMAP_DWC3_ID_FLOAT,
17 OMAP_DWC3_VBUS_VALID,
18 OMAP_DWC3_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else
24static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{
26 return -ENODEV;
27}
28#endif
29
30#endif /* __DWC3_OMAP_H__ */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f1b0dca60f12..942ef5e053bf 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -22,6 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h> 23#include <linux/scatterlist.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/workqueue.h>
25#include <linux/usb/ch9.h> 26#include <linux/usb/ch9.h>
26 27
27struct usb_ep; 28struct usb_ep;
@@ -475,6 +476,7 @@ struct usb_gadget_ops {
475 476
476/** 477/**
477 * struct usb_gadget - represents a usb slave device 478 * struct usb_gadget - represents a usb slave device
479 * @work: (internal use) Workqueue to be used for sysfs_notify()
478 * @ops: Function pointers used to access hardware-specific operations. 480 * @ops: Function pointers used to access hardware-specific operations.
479 * @ep0: Endpoint zero, used when reading or writing responses to 481 * @ep0: Endpoint zero, used when reading or writing responses to
480 * driver setup() requests 482 * driver setup() requests
@@ -520,6 +522,7 @@ struct usb_gadget_ops {
520 * device is acting as a B-Peripheral (so is_a_peripheral is false). 522 * device is acting as a B-Peripheral (so is_a_peripheral is false).
521 */ 523 */
522struct usb_gadget { 524struct usb_gadget {
525 struct work_struct work;
523 /* readonly to gadget driver */ 526 /* readonly to gadget driver */
524 const struct usb_gadget_ops *ops; 527 const struct usb_gadget_ops *ops;
525 struct usb_ep *ep0; 528 struct usb_ep *ep0;
@@ -538,6 +541,7 @@ struct usb_gadget {
538 unsigned out_epnum; 541 unsigned out_epnum;
539 unsigned in_epnum; 542 unsigned in_epnum;
540}; 543};
544#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
541 545
542static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
543 { dev_set_drvdata(&gadget->dev, data); } 547 { dev_set_drvdata(&gadget->dev, data); }
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 1e88377e22f4..75efc45eaa2f 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -22,6 +22,7 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/interrupt.h>
25 26
26#define MAX_TOPO_LEVEL 6 27#define MAX_TOPO_LEVEL 6
27 28
@@ -67,6 +68,13 @@
67 68
68/*-------------------------------------------------------------------------*/ 69/*-------------------------------------------------------------------------*/
69 70
71struct giveback_urb_bh {
72 bool running;
73 spinlock_t lock;
74 struct list_head head;
75 struct tasklet_struct bh;
76};
77
70struct usb_hcd { 78struct usb_hcd {
71 79
72 /* 80 /*
@@ -139,6 +147,9 @@ struct usb_hcd {
139 resource_size_t rsrc_len; /* memory/io resource length */ 147 resource_size_t rsrc_len; /* memory/io resource length */
140 unsigned power_budget; /* in mA, 0 = no limit */ 148 unsigned power_budget; /* in mA, 0 = no limit */
141 149
150 struct giveback_urb_bh high_prio_bh;
151 struct giveback_urb_bh low_prio_bh;
152
142 /* bandwidth_mutex should be taken before adding or removing 153 /* bandwidth_mutex should be taken before adding or removing
143 * any new bus bandwidth constraints: 154 * any new bus bandwidth constraints:
144 * 1. Before adding a configuration for a new device. 155 * 1. Before adding a configuration for a new device.
@@ -221,6 +232,7 @@ struct hc_driver {
221#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/ 232#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
222#define HCD_USB3 0x0040 /* USB 3.0 */ 233#define HCD_USB3 0x0040 /* USB 3.0 */
223#define HCD_MASK 0x0070 234#define HCD_MASK 0x0070
235#define HCD_BH 0x0100 /* URB complete in BH context */
224 236
225 /* called to init HCD and root hub */ 237 /* called to init HCD and root hub */
226 int (*reset) (struct usb_hcd *hcd); 238 int (*reset) (struct usb_hcd *hcd);
@@ -361,6 +373,11 @@ struct hc_driver {
361 int (*find_raw_port_number)(struct usb_hcd *, int); 373 int (*find_raw_port_number)(struct usb_hcd *, int);
362}; 374};
363 375
376static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
377{
378 return hcd->driver->flags & HCD_BH;
379}
380
364extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
365extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
366 int status); 383 int status);
@@ -411,7 +428,7 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
411extern void usb_hcd_pci_remove(struct pci_dev *dev); 428extern void usb_hcd_pci_remove(struct pci_dev *dev);
412extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 429extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
413 430
414#ifdef CONFIG_PM_SLEEP 431#ifdef CONFIG_PM
415extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 432extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
416#endif 433#endif
417#endif /* CONFIG_PCI */ 434#endif /* CONFIG_PCI */
diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index a0ef405368b8..8c38aa26b3bb 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -7,19 +7,27 @@
7#ifndef __LINUX_USB_OF_H 7#ifndef __LINUX_USB_OF_H
8#define __LINUX_USB_OF_H 8#define __LINUX_USB_OF_H
9 9
10#include <linux/usb/ch9.h>
10#include <linux/usb/otg.h> 11#include <linux/usb/otg.h>
11#include <linux/usb/phy.h> 12#include <linux/usb/phy.h>
12 13
13#if IS_ENABLED(CONFIG_OF) 14#if IS_ENABLED(CONFIG_OF)
14enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); 15enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np);
16enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np);
15#else 17#else
16static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) 18static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
17{ 19{
18 return USB_DR_MODE_UNKNOWN; 20 return USB_DR_MODE_UNKNOWN;
19} 21}
22
23static inline enum usb_device_speed
24of_usb_get_maximum_speed(struct device_node *np)
25{
26 return USB_SPEED_UNKNOWN;
27}
20#endif 28#endif
21 29
22#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_PHY) 30#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
23enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); 31enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
24#else 32#else
25static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) 33static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 44036808bf0f..6c0b1c513db7 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -142,7 +142,7 @@ extern void usb_remove_phy(struct usb_phy *);
142/* helpers for direct access thru low-level io interface */ 142/* helpers for direct access thru low-level io interface */
143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) 143static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
144{ 144{
145 if (x->io_ops && x->io_ops->read) 145 if (x && x->io_ops && x->io_ops->read)
146 return x->io_ops->read(x, reg); 146 return x->io_ops->read(x, reg);
147 147
148 return -EINVAL; 148 return -EINVAL;
@@ -150,7 +150,7 @@ static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
150 150
151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) 151static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
152{ 152{
153 if (x->io_ops && x->io_ops->write) 153 if (x && x->io_ops && x->io_ops->write)
154 return x->io_ops->write(x, val, reg); 154 return x->io_ops->write(x, val, reg);
155 155
156 return -EINVAL; 156 return -EINVAL;
@@ -159,7 +159,7 @@ static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
159static inline int 159static inline int
160usb_phy_init(struct usb_phy *x) 160usb_phy_init(struct usb_phy *x)
161{ 161{
162 if (x->init) 162 if (x && x->init)
163 return x->init(x); 163 return x->init(x);
164 164
165 return 0; 165 return 0;
@@ -168,14 +168,14 @@ usb_phy_init(struct usb_phy *x)
168static inline void 168static inline void
169usb_phy_shutdown(struct usb_phy *x) 169usb_phy_shutdown(struct usb_phy *x)
170{ 170{
171 if (x->shutdown) 171 if (x && x->shutdown)
172 x->shutdown(x); 172 x->shutdown(x);
173} 173}
174 174
175static inline int 175static inline int
176usb_phy_vbus_on(struct usb_phy *x) 176usb_phy_vbus_on(struct usb_phy *x)
177{ 177{
178 if (!x->set_vbus) 178 if (!x || !x->set_vbus)
179 return 0; 179 return 0;
180 180
181 return x->set_vbus(x, true); 181 return x->set_vbus(x, true);
@@ -184,7 +184,7 @@ usb_phy_vbus_on(struct usb_phy *x)
184static inline int 184static inline int
185usb_phy_vbus_off(struct usb_phy *x) 185usb_phy_vbus_off(struct usb_phy *x)
186{ 186{
187 if (!x->set_vbus) 187 if (!x || !x->set_vbus)
188 return 0; 188 return 0;
189 189
190 return x->set_vbus(x, false); 190 return x->set_vbus(x, false);
@@ -258,7 +258,7 @@ usb_phy_set_power(struct usb_phy *x, unsigned mA)
258static inline int 258static inline int
259usb_phy_set_suspend(struct usb_phy *x, int suspend) 259usb_phy_set_suspend(struct usb_phy *x, int suspend)
260{ 260{
261 if (x->set_suspend != NULL) 261 if (x && x->set_suspend != NULL)
262 return x->set_suspend(x, suspend); 262 return x->set_suspend(x, suspend);
263 else 263 else
264 return 0; 264 return 0;
@@ -267,7 +267,7 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
267static inline int 267static inline int
268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
269{ 269{
270 if (x->notify_connect) 270 if (x && x->notify_connect)
271 return x->notify_connect(x, speed); 271 return x->notify_connect(x, speed);
272 else 272 else
273 return 0; 273 return 0;
@@ -276,7 +276,7 @@ usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
276static inline int 276static inline int
277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed) 277usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
278{ 278{
279 if (x->notify_disconnect) 279 if (x && x->notify_disconnect)
280 return x->notify_disconnect(x, speed); 280 return x->notify_disconnect(x, speed);
281 else 281 else
282 return 0; 282 return 0;
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index d2ca919a5b73..1de16c324ec8 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -18,19 +18,36 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/usb/otg.h> 19#include <linux/usb/otg.h>
20 20
21/*
22 * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
23 * should be set up by clk-tegra, false if by the PHY code
24 * has_hostpc: true if the USB controller has the HOSTPC extension, which
25 * changes the location of the PHCD and PTS fields
26 * requires_usbmode_setup: true if the USBMODE register needs to be set to
27 * enter host mode
28 * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
29 * and hsdiscon_level should be set for adequate signal quality
30 */
31
32struct tegra_phy_soc_config {
33 bool utmi_pll_config_in_car_module;
34 bool has_hostpc;
35 bool requires_usbmode_setup;
36 bool requires_extra_tuning_parameters;
37};
38
21struct tegra_utmip_config { 39struct tegra_utmip_config {
22 u8 hssync_start_delay; 40 u8 hssync_start_delay;
23 u8 elastic_limit; 41 u8 elastic_limit;
24 u8 idle_wait_delay; 42 u8 idle_wait_delay;
25 u8 term_range_adj; 43 u8 term_range_adj;
44 bool xcvr_setup_use_fuses;
26 u8 xcvr_setup; 45 u8 xcvr_setup;
27 u8 xcvr_lsfslew; 46 u8 xcvr_lsfslew;
28 u8 xcvr_lsrslew; 47 u8 xcvr_lsrslew;
29}; 48 u8 xcvr_hsslew;
30 49 u8 hssquelch_level;
31struct tegra_ulpi_config { 50 u8 hsdiscon_level;
32 int reset_gpio;
33 const char *clk;
34}; 51};
35 52
36enum tegra_usb_phy_port_speed { 53enum tegra_usb_phy_port_speed {
@@ -39,12 +56,6 @@ enum tegra_usb_phy_port_speed {
39 TEGRA_USB_PHY_PORT_SPEED_HIGH, 56 TEGRA_USB_PHY_PORT_SPEED_HIGH,
40}; 57};
41 58
42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST,
45 TEGRA_USB_PHY_MODE_OTG,
46};
47
48struct tegra_xtal_freq; 59struct tegra_xtal_freq;
49 60
50struct tegra_usb_phy { 61struct tegra_usb_phy {
@@ -55,18 +66,17 @@ struct tegra_usb_phy {
55 struct clk *clk; 66 struct clk *clk;
56 struct clk *pll_u; 67 struct clk *pll_u;
57 struct clk *pad_clk; 68 struct clk *pad_clk;
58 enum tegra_usb_phy_mode mode; 69 struct regulator *vbus;
70 enum usb_dr_mode mode;
59 void *config; 71 void *config;
72 const struct tegra_phy_soc_config *soc_config;
60 struct usb_phy *ulpi; 73 struct usb_phy *ulpi;
61 struct usb_phy u_phy; 74 struct usb_phy u_phy;
62 struct device *dev;
63 bool is_legacy_phy; 75 bool is_legacy_phy;
64 bool is_ulpi_phy; 76 bool is_ulpi_phy;
65 int reset_gpio; 77 int reset_gpio;
66}; 78};
67 79
68struct usb_phy *tegra_usb_get_phy(struct device_node *dn);
69
70void tegra_usb_phy_preresume(struct usb_phy *phy); 80void tegra_usb_phy_preresume(struct usb_phy *phy);
71 81
72void tegra_usb_phy_postresume(struct usb_phy *phy); 82void tegra_usb_phy_postresume(struct usb_phy *phy);
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index 148d35171aac..11d85b9c1b08 100644
--- a/include/linux/usb/nop-usb-xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct nop_usb_xceiv_platform_data { 6struct usb_phy_gen_xceiv_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f18d64129f99..e303eef94dd5 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -34,12 +34,15 @@ struct usbnet {
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err; 36 unsigned char pkt_cnt, pkt_err;
37 unsigned short rx_qlen, tx_qlen;
38 unsigned can_dma_sg:1;
37 39
38 /* i/o info: pipes etc */ 40 /* i/o info: pipes etc */
39 unsigned in, out; 41 unsigned in, out;
40 struct usb_host_endpoint *status; 42 struct usb_host_endpoint *status;
41 unsigned maxpacket; 43 unsigned maxpacket;
42 struct timer_list delay; 44 struct timer_list delay;
45 const char *padding_pkt;
43 46
44 /* protocol/interface state */ 47 /* protocol/interface state */
45 struct net_device *net; 48 struct net_device *net;
@@ -253,4 +256,6 @@ extern void usbnet_link_change(struct usbnet *, bool, bool);
253extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags); 256extern int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
254extern void usbnet_status_stop(struct usbnet *dev); 257extern void usbnet_status_stop(struct usbnet *dev);
255 258
259extern void usbnet_update_max_qlen(struct usbnet *dev);
260
256#endif /* __LINUX_USB_USBNET_H */ 261#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index 6be985b2a434..4ff744e2b678 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -66,6 +66,7 @@ enum {
66 WA_ENABLE = 0x01, 66 WA_ENABLE = 0x01,
67 WA_RESET = 0x02, 67 WA_RESET = 0x02,
68 RPIPE_PAUSE = 0x1, 68 RPIPE_PAUSE = 0x1,
69 RPIPE_STALL = 0x2,
69}; 70};
70 71
71/* Responses from Get Status request ([WUSB] section 8.3.1.6) */ 72/* Responses from Get Status request ([WUSB] section 8.3.1.6) */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index bf99cd01be20..630356866030 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -66,7 +66,9 @@
66 US_FLAG(INITIAL_READ10, 0x00100000) \ 66 US_FLAG(INITIAL_READ10, 0x00100000) \
67 /* Initial READ(10) (and others) must be retried */ \ 67 /* Initial READ(10) (and others) must be retried */ \
68 US_FLAG(WRITE_CACHE, 0x00200000) \ 68 US_FLAG(WRITE_CACHE, 0x00200000) \
69 /* Write Cache status is not available */ 69 /* Write Cache status is not available */ \
70 US_FLAG(NEEDS_CAP16, 0x00400000)
71 /* cannot handle READ_CAPACITY_10 */
70 72
71#define US_FLAG(name, value) US_FL_##name = value , 73#define US_FLAG(name, value) US_FL_##name = value ,
72enum { US_DO_ALL_FLAGS }; 74enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 14105c26a836..4db29859464f 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -27,8 +27,6 @@ struct user_namespace {
27 kuid_t owner; 27 kuid_t owner;
28 kgid_t group; 28 kgid_t group;
29 unsigned int proc_inum; 29 unsigned int proc_inum;
30 bool may_mount_sysfs;
31 bool may_mount_proc;
32}; 30};
33 31
34extern struct user_namespace init_user_ns; 32extern struct user_namespace init_user_ns;
@@ -85,6 +83,4 @@ static inline void put_user_ns(struct user_namespace *ns)
85 83
86#endif 84#endif
87 85
88void update_mnt_policy(struct user_namespace *userns);
89
90#endif /* _LINUX_USER_H */ 86#endif /* _LINUX_USER_H */
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
index b52e44f1bd33..0df24bfcdb38 100644
--- a/include/linux/uwb/spec.h
+++ b/include/linux/uwb/spec.h
@@ -32,6 +32,7 @@
32 32
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/bitmap.h> 34#include <linux/bitmap.h>
35#include <linux/if_ether.h>
35 36
36#define i1480_FW 0x00000303 37#define i1480_FW 0x00000303
37/* #define i1480_FW 0x00000302 */ 38/* #define i1480_FW 0x00000302 */
@@ -130,7 +131,7 @@ enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
130 * it is also used to define headers sent down and up the wire/radio). 131 * it is also used to define headers sent down and up the wire/radio).
131 */ 132 */
132struct uwb_mac_addr { 133struct uwb_mac_addr {
133 u8 data[6]; 134 u8 data[ETH_ALEN];
134} __attribute__((packed)); 135} __attribute__((packed));
135 136
136 137
@@ -568,7 +569,7 @@ struct uwb_rc_evt_confirm {
568/* Device Address Management event. [WHCI] section 3.1.3.2. */ 569/* Device Address Management event. [WHCI] section 3.1.3.2. */
569struct uwb_rc_evt_dev_addr_mgmt { 570struct uwb_rc_evt_dev_addr_mgmt {
570 struct uwb_rceb rceb; 571 struct uwb_rceb rceb;
571 u8 baAddr[6]; 572 u8 baAddr[ETH_ALEN];
572 u8 bResultCode; 573 u8 bResultCode;
573} __attribute__((packed)); 574} __attribute__((packed));
574 575
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ac8d488e4372..24579a0312a0 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -90,4 +90,11 @@ extern void vfio_unregister_iommu_driver(
90 TYPE tmp; \ 90 TYPE tmp; \
91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \ 91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
92 92
93/*
94 * External user API
95 */
96extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
97extern void vfio_group_put_external_user(struct vfio_group *group);
98extern int vfio_external_user_iommu_id(struct vfio_group *group);
99
93#endif /* VFIO_H */ 100#endif /* VFIO_H */
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index ddb419cf4530..502073a53dd3 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -45,7 +45,8 @@ struct vga_switcheroo_client_ops {
45#if defined(CONFIG_VGA_SWITCHEROO) 45#if defined(CONFIG_VGA_SWITCHEROO)
46void vga_switcheroo_unregister_client(struct pci_dev *dev); 46void vga_switcheroo_unregister_client(struct pci_dev *dev);
47int vga_switcheroo_register_client(struct pci_dev *dev, 47int vga_switcheroo_register_client(struct pci_dev *dev,
48 const struct vga_switcheroo_client_ops *ops); 48 const struct vga_switcheroo_client_ops *ops,
49 bool driver_power_control);
49int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 50int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
50 const struct vga_switcheroo_client_ops *ops, 51 const struct vga_switcheroo_client_ops *ops,
51 int id, bool active); 52 int id, bool active);
@@ -60,11 +61,15 @@ int vga_switcheroo_process_delayed_switch(void);
60 61
61int vga_switcheroo_get_client_state(struct pci_dev *dev); 62int vga_switcheroo_get_client_state(struct pci_dev *dev);
62 63
64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic);
65
66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
67int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain);
63#else 68#else
64 69
65static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 70static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
66static inline int vga_switcheroo_register_client(struct pci_dev *dev, 71static inline int vga_switcheroo_register_client(struct pci_dev *dev,
67 const struct vga_switcheroo_client_ops *ops) { return 0; } 72 const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { return 0; }
68static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 73static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
69static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 74static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
70static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, 75static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
@@ -74,6 +79,10 @@ static inline void vga_switcheroo_unregister_handler(void) {}
74static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } 79static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
75static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } 80static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
76 81
82static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {}
83
84static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
85static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
77 86
78#endif 87#endif
79#endif /* _LINUX_VGA_SWITCHEROO_H_ */ 88#endif /* _LINUX_VGA_SWITCHEROO_H_ */
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index bd6cf61142be..1855f0a22add 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -70,6 +70,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
70 THP_ZERO_PAGE_ALLOC, 70 THP_ZERO_PAGE_ALLOC,
71 THP_ZERO_PAGE_ALLOC_FAILED, 71 THP_ZERO_PAGE_ALLOC_FAILED,
72#endif 72#endif
73#ifdef CONFIG_SMP
74 NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
75 NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
76#endif
77 NR_TLB_LOCAL_FLUSH_ALL,
78 NR_TLB_LOCAL_FLUSH_ONE,
73 NR_VM_EVENT_ITEMS 79 NR_VM_EVENT_ITEMS
74}; 80};
75 81
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 7dc17e2456de..3f3788d49362 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -34,10 +34,12 @@ extern void vmpressure_cleanup(struct vmpressure *vmpr);
34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); 34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); 35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); 36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
37extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft, 37extern int vmpressure_register_event(struct cgroup_subsys_state *css,
38 struct cftype *cft,
38 struct eventfd_ctx *eventfd, 39 struct eventfd_ctx *eventfd,
39 const char *args); 40 const char *args);
40extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, 41extern void vmpressure_unregister_event(struct cgroup_subsys_state *css,
42 struct cftype *cft,
41 struct eventfd_ctx *eventfd); 43 struct eventfd_ctx *eventfd);
42#else 44#else
43static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, 45static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index c586679b6fef..e4b948080d20 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -143,7 +143,6 @@ static inline unsigned long zone_page_state_snapshot(struct zone *zone,
143} 143}
144 144
145extern unsigned long global_reclaimable_pages(void); 145extern unsigned long global_reclaimable_pages(void);
146extern unsigned long zone_reclaimable_pages(struct zone *zone);
147 146
148#ifdef CONFIG_NUMA 147#ifdef CONFIG_NUMA
149/* 148/*
@@ -198,7 +197,7 @@ extern void __inc_zone_state(struct zone *, enum zone_stat_item);
198extern void dec_zone_state(struct zone *, enum zone_stat_item); 197extern void dec_zone_state(struct zone *, enum zone_stat_item);
199extern void __dec_zone_state(struct zone *, enum zone_stat_item); 198extern void __dec_zone_state(struct zone *, enum zone_stat_item);
200 199
201void refresh_cpu_vm_stats(int); 200void cpu_vm_stats_fold(int cpu);
202void refresh_zone_stat_thresholds(void); 201void refresh_zone_stat_thresholds(void);
203 202
204void drain_zonestat(struct zone *zone, struct per_cpu_pageset *); 203void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
@@ -255,6 +254,7 @@ static inline void __dec_zone_page_state(struct page *page,
255 254
256static inline void refresh_cpu_vm_stats(int cpu) { } 255static inline void refresh_cpu_vm_stats(int cpu) { }
257static inline void refresh_zone_stat_thresholds(void) { } 256static inline void refresh_zone_stat_thresholds(void) { }
257static inline void cpu_vm_stats_fold(int cpu) { }
258 258
259static inline void drain_zonestat(struct zone *zone, 259static inline void drain_zonestat(struct zone *zone,
260 struct per_cpu_pageset *pset) { } 260 struct per_cpu_pageset *pset) { }
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index b1dd2db80076..f5b72b364bda 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -1,18 +1,68 @@
1#ifndef _LINUX_KERNEL_VTIME_H 1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H 2#define _LINUX_KERNEL_VTIME_H
3 3
4#include <linux/context_tracking_state.h>
5#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
6#include <asm/vtime.h>
7#endif
8
9
4struct task_struct; 10struct task_struct;
5 11
12/*
13 * vtime_accounting_enabled() definitions/declarations
14 */
15#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
16static inline bool vtime_accounting_enabled(void) { return true; }
17#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
18
19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
20static inline bool vtime_accounting_enabled(void)
21{
22 if (static_key_false(&context_tracking_enabled)) {
23 if (context_tracking_active())
24 return true;
25 }
26
27 return false;
28}
29#endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
30
31#ifndef CONFIG_VIRT_CPU_ACCOUNTING
32static inline bool vtime_accounting_enabled(void) { return false; }
33#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
34
35
36/*
37 * Common vtime APIs
38 */
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING 39#ifdef CONFIG_VIRT_CPU_ACCOUNTING
40
41#ifdef __ARCH_HAS_VTIME_TASK_SWITCH
7extern void vtime_task_switch(struct task_struct *prev); 42extern void vtime_task_switch(struct task_struct *prev);
43#else
44extern void vtime_common_task_switch(struct task_struct *prev);
45static inline void vtime_task_switch(struct task_struct *prev)
46{
47 if (vtime_accounting_enabled())
48 vtime_common_task_switch(prev);
49}
50#endif /* __ARCH_HAS_VTIME_TASK_SWITCH */
51
8extern void vtime_account_system(struct task_struct *tsk); 52extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_idle(struct task_struct *tsk); 53extern void vtime_account_idle(struct task_struct *tsk);
10extern void vtime_account_user(struct task_struct *tsk); 54extern void vtime_account_user(struct task_struct *tsk);
11extern void vtime_account_irq_enter(struct task_struct *tsk);
12 55
13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE 56#ifdef __ARCH_HAS_VTIME_ACCOUNT
14static inline bool vtime_accounting_enabled(void) { return true; } 57extern void vtime_account_irq_enter(struct task_struct *tsk);
15#endif 58#else
59extern void vtime_common_account_irq_enter(struct task_struct *tsk);
60static inline void vtime_account_irq_enter(struct task_struct *tsk)
61{
62 if (vtime_accounting_enabled())
63 vtime_common_account_irq_enter(tsk);
64}
65#endif /* __ARCH_HAS_VTIME_ACCOUNT */
16 66
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */ 67#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
18 68
@@ -20,14 +70,20 @@ static inline void vtime_task_switch(struct task_struct *prev) { }
20static inline void vtime_account_system(struct task_struct *tsk) { } 70static inline void vtime_account_system(struct task_struct *tsk) { }
21static inline void vtime_account_user(struct task_struct *tsk) { } 71static inline void vtime_account_user(struct task_struct *tsk) { }
22static inline void vtime_account_irq_enter(struct task_struct *tsk) { } 72static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
23static inline bool vtime_accounting_enabled(void) { return false; } 73#endif /* !CONFIG_VIRT_CPU_ACCOUNTING */
24#endif
25 74
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 75#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
27extern void arch_vtime_task_switch(struct task_struct *tsk); 76extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk); 77extern void vtime_gen_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void); 78
79static inline void vtime_account_irq_exit(struct task_struct *tsk)
80{
81 if (vtime_accounting_enabled())
82 vtime_gen_account_irq_exit(tsk);
83}
84
30extern void vtime_user_enter(struct task_struct *tsk); 85extern void vtime_user_enter(struct task_struct *tsk);
86
31static inline void vtime_user_exit(struct task_struct *tsk) 87static inline void vtime_user_exit(struct task_struct *tsk)
32{ 88{
33 vtime_account_user(tsk); 89 vtime_account_user(tsk);
@@ -35,7 +91,7 @@ static inline void vtime_user_exit(struct task_struct *tsk)
35extern void vtime_guest_enter(struct task_struct *tsk); 91extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk); 92extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk, int cpu); 93extern void vtime_init_idle(struct task_struct *tsk, int cpu);
38#else 94#else /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */
39static inline void vtime_account_irq_exit(struct task_struct *tsk) 95static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{ 96{
41 /* On hard|softirq exit we always account to hard|softirq cputime */ 97 /* On hard|softirq exit we always account to hard|softirq cputime */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index a0ed78ab54d7..594521ba0d43 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -295,7 +295,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
295 * Documentation/workqueue.txt. 295 * Documentation/workqueue.txt.
296 */ 296 */
297enum { 297enum {
298 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 298 /*
299 * All wqs are now non-reentrant making the following flag
300 * meaningless. Will be removed.
301 */
302 WQ_NON_REENTRANT = 1 << 0, /* DEPRECATED */
303
299 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 304 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
300 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ 305 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
301 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 306 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 4e198ca1f685..021b8a319b9e 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -98,8 +98,6 @@ int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason);
98int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 98int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
99 enum wb_reason reason); 99 enum wb_reason reason);
100void sync_inodes_sb(struct super_block *); 100void sync_inodes_sb(struct super_block *);
101long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
102 enum wb_reason reason);
103void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 101void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
104void inode_wait_for_writeback(struct inode *inode); 102void inode_wait_for_writeback(struct inode *inode);
105 103
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fdbafc6841cf..91b0a68d38dc 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -31,7 +31,7 @@ struct xattr_handler {
31}; 31};
32 32
33struct xattr { 33struct xattr {
34 char *name; 34 const char *name;
35 void *value; 35 void *value;
36 size_t value_len; 36 size_t value_len;
37}; 37};
diff --git a/include/linux/yam.h b/include/linux/yam.h
index 7fe28228b274..512cdc2fb80f 100644
--- a/include/linux/yam.h
+++ b/include/linux/yam.h
@@ -77,6 +77,6 @@ struct yamdrv_ioctl_cfg {
77 77
78struct yamdrv_ioctl_mcs { 78struct yamdrv_ioctl_mcs {
79 int cmd; 79 int cmd;
80 int bitrate; 80 unsigned int bitrate;
81 unsigned char bits[YAM_FPGA_SIZE]; 81 unsigned char bits[YAM_FPGA_SIZE];
82}; 82};