aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h151
-rw-r--r--include/linux/acpi_gpio.h19
-rw-r--r--include/linux/amba/bus.h10
-rw-r--r--include/linux/asn1.h2
-rw-r--r--include/linux/ata_platform.h2
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/atmel-ssc.h6
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/backlight.h10
-rw-r--r--include/linux/balloon_compaction.h272
-rw-r--r--include/linux/bcm47xx_wdt.h19
-rw-r--r--include/linux/bcma/bcma.h8
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h21
-rw-r--r--include/linux/bcma/bcma_driver_mips.h3
-rw-r--r--include/linux/bcma/bcma_regs.h5
-rw-r--r--include/linux/binfmts.h11
-rw-r--r--include/linux/blkdev.h28
-rw-r--r--include/linux/bootmem.h7
-rw-r--r--include/linux/bsg-lib.h1
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/osdmap.h1
-rw-r--r--include/linux/ceph/rados.h2
-rw-r--r--include/linux/cgroup.h167
-rw-r--r--include/linux/clk-provider.h24
-rw-r--r--include/linux/clk/mvebu.h22
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clk/zynq.h24
-rw-r--r--include/linux/compat.h69
-rw-r--r--include/linux/compiler-gcc4.h12
-rw-r--r--include/linux/compiler-intel.h7
-rw-r--r--include/linux/compiler.h11
-rw-r--r--include/linux/context_tracking.h18
-rw-r--r--include/linux/coredump.h4
-rw-r--r--include/linux/cpu_cooling.h6
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpuidle.h15
-rw-r--r--include/linux/cpuset.h2
-rw-r--r--include/linux/cred.h19
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/devfreq.h136
-rw-r--r--include/linux/device.h25
-rw-r--r--include/linux/devpts_fs.h20
-rw-r--r--include/linux/dlm.h2
-rw-r--r--include/linux/dma-attrs.h1
-rw-r--r--include/linux/dma-buf.h99
-rw-r--r--include/linux/dma-contiguous.h4
-rw-r--r--include/linux/dma-debug.h7
-rw-r--r--include/linux/dma/ipu-dma.h177
-rw-r--r--include/linux/drbd.h81
-rw-r--r--include/linux/drbd_genl.h378
-rw-r--r--include/linux/drbd_genl_api.h55
-rw-r--r--include/linux/drbd_limits.h90
-rw-r--r--include/linux/drbd_nl.h163
-rw-r--r--include/linux/drbd_tag_magic.h84
-rw-r--r--include/linux/dvb/Kbuild0
-rw-r--r--include/linux/dvb/dmx.h29
-rw-r--r--include/linux/dvb/video.h29
-rw-r--r--include/linux/earlycpio.h17
-rw-r--r--include/linux/edac.h3
-rw-r--r--include/linux/efi.h78
-rw-r--r--include/linux/etherdevice.h20
-rw-r--r--include/linux/exportfs.h7
-rw-r--r--include/linux/extcon.h50
-rw-r--r--include/linux/f2fs_fs.h413
-rw-r--r--include/linux/fdtable.h1
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/freezer.h58
-rw-r--r--include/linux/fs.h26
-rw-r--r--include/linux/fs_struct.h1
-rw-r--r--include/linux/fscache-cache.h71
-rw-r--r--include/linux/fscache.h50
-rw-r--r--include/linux/fsl-diu-fb.h9
-rw-r--r--include/linux/fsnotify_backend.h31
-rw-r--r--include/linux/ftrace.h4
-rw-r--r--include/linux/ftrace_event.h20
-rw-r--r--include/linux/genhd.h8
-rw-r--r--include/linux/genl_magic_func.h422
-rw-r--r--include/linux/genl_magic_struct.h277
-rw-r--r--include/linux/gfp.h8
-rw-r--r--include/linux/gpio.h21
-rw-r--r--include/linux/hardirq.h15
-rw-r--r--include/linux/hash.h2
-rw-r--r--include/linux/hdlc/Kbuild1
-rw-r--r--include/linux/hdlc/ioctl.h81
-rw-r--r--include/linux/hid-sensor-ids.h1
-rw-r--r--include/linux/hid.h6
-rw-r--r--include/linux/huge_mm.h38
-rw-r--r--include/linux/hugetlb.h15
-rw-r--r--include/linux/hugetlb_cgroup.h5
-rw-r--r--include/linux/i2c-omap.h2
-rw-r--r--include/linux/i2c.h9
-rw-r--r--include/linux/i2c/i2c-hid.h35
-rw-r--r--include/linux/i2c/i2c-sh_mobile.h1
-rw-r--r--include/linux/i2c/pcf857x.h3
-rw-r--r--include/linux/i2c/twl.h73
-rw-r--r--include/linux/idr.h11
-rw-r--r--include/linux/ieee80211.h188
-rw-r--r--include/linux/if_tunnel.h17
-rw-r--r--include/linux/iio/buffer.h26
-rw-r--r--include/linux/iio/consumer.h50
-rw-r--r--include/linux/iio/iio.h5
-rw-r--r--include/linux/iio/imu/adis.h280
-rw-r--r--include/linux/iio/machine.h2
-rw-r--r--include/linux/iio/types.h2
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/inetdevice.h3
-rw-r--r--include/linux/init.h58
-rw-r--r--include/linux/input.h10
-rw-r--r--include/linux/input/bu21013.h10
-rw-r--r--include/linux/input/mt.h6
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/input/ti_tscadc.h17
-rw-r--r--include/linux/ip.h5
-rw-r--r--include/linux/ipack.h245
-rw-r--r--include/linux/ipc_namespace.h9
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/ipv6.h38
-rw-r--r--include/linux/irq.h19
-rw-r--r--include/linux/irqchip/spear-shirq.h64
-rw-r--r--include/linux/irqchip/sunxi.h27
-rw-r--r--include/linux/irqchip/versatile-fpga.h13
-rw-r--r--include/linux/irqdesc.h3
-rw-r--r--include/linux/jbd2.h9
-rw-r--r--include/linux/jiffies.h3
-rw-r--r--include/linux/kernel.h60
-rw-r--r--include/linux/kernel_stat.h17
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/kobject.h18
-rw-r--r--include/linux/kref.h21
-rw-r--r--include/linux/ktime.h19
-rw-r--r--include/linux/kvm_host.h65
-rw-r--r--include/linux/leds.h17
-rw-r--r--include/linux/libata.h5
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/lru_cache.h71
-rw-r--r--include/linux/memcontrol.h218
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h13
-rw-r--r--include/linux/mempolicy.h8
-rw-r--r--include/linux/mfd/88pm80x.h2
-rw-r--r--include/linux/mfd/abx500.h34
-rw-r--r--include/linux/mfd/abx500/ab8500.h4
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/pdata.h6
-rw-r--r--include/linux/mfd/arizona/registers.h17
-rw-r--r--include/linux/mfd/as3711.h126
-rw-r--r--include/linux/mfd/da9052/da9052.h10
-rw-r--r--include/linux/mfd/da9055/core.h2
-rw-r--r--include/linux/mfd/da9055/pdata.h29
-rw-r--r--include/linux/mfd/da9055/reg.h2
-rw-r--r--include/linux/mfd/db8500-prcmu.h4
-rw-r--r--include/linux/mfd/dbx500-prcmu.h10
-rw-r--r--include/linux/mfd/lp8788.h8
-rw-r--r--include/linux/mfd/max8997-private.h1
-rw-r--r--include/linux/mfd/max8997.h1
-rw-r--r--include/linux/mfd/menelaus.h47
-rw-r--r--include/linux/mfd/pm8xxx/irq.h8
-rw-r--r--include/linux/mfd/rc5t583.h3
-rw-r--r--include/linux/mfd/retu.h22
-rw-r--r--include/linux/mfd/rtsx_common.h48
-rw-r--r--include/linux/mfd/rtsx_pci.h794
-rw-r--r--include/linux/mfd/sta2x11-mfd.h198
-rw-r--r--include/linux/mfd/stmpe.h4
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h152
-rw-r--r--include/linux/mfd/tps65090.h104
-rw-r--r--include/linux/mfd/tps6586x.h4
-rw-r--r--include/linux/mfd/tps65910.h145
-rw-r--r--include/linux/mfd/tps80031.h637
-rw-r--r--include/linux/mfd/twl6040.h10
-rw-r--r--include/linux/mfd/viperboard.h110
-rw-r--r--include/linux/mfd/wm8994/core.h4
-rw-r--r--include/linux/mfd/wm8994/pdata.h5
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/migrate.h65
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/device.h22
-rw-r--r--include/linux/mm.h71
-rw-r--r--include/linux/mm_types.h57
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/dw_mmc.h5
-rw-r--r--include/linux/mmc/host.h17
-rw-r--r--include/linux/mmc/mmc.h2
-rw-r--r--include/linux/mmc/mxs-mmc.h19
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/mmzone.h63
-rw-r--r--include/linux/mnt_namespace.h3
-rw-r--r--include/linux/moduleparam.h6
-rw-r--r--include/linux/mtd/blktrans.h4
-rw-r--r--include/linux/mtd/doc2000.h22
-rw-r--r--include/linux/mtd/fsmc.h3
-rw-r--r--include/linux/mtd/gpmi-nand.h68
-rw-r--r--include/linux/mtd/map.h4
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/mtd/nand.h11
-rw-r--r--include/linux/mtd/sh_flctl.h14
-rw-r--r--include/linux/namei.h20
-rw-r--r--include/linux/netdevice.h46
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h9
-rw-r--r--include/linux/nfc/pn544.h104
-rw-r--r--include/linux/nfs_fs_sb.h47
-rw-r--r--include/linux/nfs_xdr.h155
-rw-r--r--include/linux/node.h3
-rw-r--r--include/linux/nodemask.h5
-rw-r--r--include/linux/nsproxy.h2
-rw-r--r--include/linux/of.h88
-rw-r--r--include/linux/of_i2c.h12
-rw-r--r--include/linux/of_platform.h1
-rw-r--r--include/linux/omap-dma.h366
-rw-r--r--include/linux/omap-iommu.h52
-rw-r--r--include/linux/oom.h21
-rw-r--r--include/linux/openvswitch.h1
-rw-r--r--include/linux/page-isolation.h10
-rw-r--r--include/linux/pagemap.h16
-rw-r--r--include/linux/pci.h44
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/percpu-rwsem.h91
-rw-r--r--include/linux/pid_namespace.h11
-rw-r--r--include/linux/pinctrl/pinconf-generic.h5
-rw-r--r--include/linux/pinctrl/pinctrl.h19
-rw-r--r--include/linux/platform_data/ad5449.h40
-rw-r--r--include/linux/platform_data/ad7298.h20
-rw-r--r--include/linux/platform_data/ad7793.h112
-rw-r--r--include/linux/platform_data/ad7887.h26
-rw-r--r--include/linux/platform_data/ads7828.h29
-rw-r--r--include/linux/platform_data/asoc-imx-ssi.h2
-rw-r--r--include/linux/platform_data/asoc-s3c.h6
-rw-r--r--include/linux/platform_data/atmel.h73
-rw-r--r--include/linux/platform_data/clk-integrator.h2
-rw-r--r--include/linux/platform_data/clocksource-nomadik-mtu.h9
-rw-r--r--include/linux/platform_data/cpsw.h23
-rw-r--r--include/linux/platform_data/crypto-ux500.h2
-rw-r--r--include/linux/platform_data/davinci_asp.h4
-rw-r--r--include/linux/platform_data/db8500_thermal.h38
-rw-r--r--include/linux/platform_data/dma-imx.h4
-rw-r--r--include/linux/platform_data/dma-mv_xor.h11
-rw-r--r--include/linux/platform_data/dma-ste-dma40.h223
-rw-r--r--include/linux/platform_data/dmtimer-omap.h31
-rw-r--r--include/linux/platform_data/gpio-omap.h1
-rw-r--r--include/linux/platform_data/gpio-ts5500.h27
-rw-r--r--include/linux/platform_data/i2c-cbus-gpio.h27
-rw-r--r--include/linux/platform_data/iommu-omap.h54
-rw-r--r--include/linux/platform_data/leds-omap.h22
-rw-r--r--include/linux/platform_data/lp855x.h9
-rw-r--r--include/linux/platform_data/macb.h1
-rw-r--r--include/linux/platform_data/mmc-omap.h151
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h46
-rw-r--r--include/linux/platform_data/mtd-nomadik-nand.h16
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h28
-rw-r--r--include/linux/platform_data/omap-twl4030.h26
-rw-r--r--include/linux/platform_data/omap-wd-timer.h38
-rw-r--r--include/linux/platform_data/omap_drm.h1
-rw-r--r--include/linux/platform_data/pinctrl-coh901.h4
-rw-r--r--include/linux/platform_data/pinctrl-nomadik.h266
-rw-r--r--include/linux/platform_data/pn544.h44
-rw-r--r--include/linux/platform_data/pxa2xx_udc.h27
-rw-r--r--include/linux/platform_data/pxa_sdhci.h6
-rw-r--r--include/linux/platform_data/sa11x0-serial.h33
-rw-r--r--include/linux/platform_data/serial-omap.h51
-rw-r--r--include/linux/platform_data/spi-clps711x.h21
-rw-r--r--include/linux/platform_data/spi-omap2-mcspi.h4
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/platform_data/uio_dmem_genirq.h26
-rw-r--r--include/linux/platform_data/uio_pruss.h3
-rw-r--r--include/linux/platform_data/usb-omap.h83
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h3
-rw-r--r--include/linux/pm_qos.h77
-rw-r--r--include/linux/power/bq2415x_charger.h95
-rw-r--r--include/linux/power/smartreflex.h14
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/proc_fs.h29
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/ptrace.h19
-rw-r--r--include/linux/pvclock_gtod.h9
-rw-r--r--include/linux/pwm.h3
-rw-r--r--include/linux/raid/pq.h4
-rw-r--r--include/linux/random.h19
-rw-r--r--include/linux/rculist.h17
-rw-r--r--include/linux/rcupdate.h29
-rw-r--r--include/linux/regmap.h95
-rw-r--r--include/linux/regulator/consumer.h13
-rw-r--r--include/linux/regulator/driver.h5
-rw-r--r--include/linux/regulator/max8973-regulator.h72
-rw-r--r--include/linux/regulator/tps51632-regulator.h47
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/res_counter.h17
-rw-r--r--include/linux/ring_buffer.h3
-rw-r--r--include/linux/rmap.h33
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/sched.h117
-rw-r--r--include/linux/security.h13
-rw-r--r--include/linux/serial_8250.h2
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/sh_clk.h9
-rw-r--r--include/linux/shm.h15
-rw-r--r--include/linux/signal.h3
-rw-r--r--include/linux/skbuff.h102
-rw-r--r--include/linux/slab.h57
-rw-r--r--include/linux/slab_def.h9
-rw-r--r--include/linux/slub_def.h9
-rw-r--r--include/linux/smscphy.h5
-rw-r--r--include/linux/spi/spi-tegra.h40
-rw-r--r--include/linux/spi/spi.h3
-rw-r--r--include/linux/srcu.h34
-rw-r--r--include/linux/ssb/ssb.h6
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h8
-rw-r--r--include/linux/ssb/ssb_driver_extif.h53
-rw-r--r--include/linux/ssb/ssb_driver_mips.h10
-rw-r--r--include/linux/ssb/ssb_regs.h2
-rw-r--r--include/linux/stmmac.h3
-rw-r--r--include/linux/string.h11
-rw-r--r--include/linux/sunrpc/cache.h6
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h6
-rw-r--r--include/linux/sunrpc/svcsock.h21
-rw-r--r--include/linux/sunxi_timer.h24
-rw-r--r--include/linux/swiotlb.h20
-rw-r--r--include/linux/syscalls.h28
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/tegra-ahb.h19
-rw-r--r--include/linux/thermal.h134
-rw-r--r--include/linux/thread_info.h2
-rw-r--r--include/linux/tick.h6
-rw-r--r--include/linux/timecompare.h125
-rw-r--r--include/linux/trace_clock.h2
-rw-r--r--include/linux/tty.h45
-rw-r--r--include/linux/tty_flip.h2
-rw-r--r--include/linux/types.h1
-rw-r--r--include/linux/udp.h5
-rw-r--r--include/linux/uprobes.h10
-rw-r--r--include/linux/usb.h50
-rw-r--r--include/linux/usb/cdc_ncm.h134
-rw-r--r--include/linux/usb/composite.h4
-rw-r--r--include/linux/usb/ehci_pdriver.h5
-rw-r--r--include/linux/usb/ezusb.h8
-rw-r--r--include/linux/usb/gadget.h7
-rw-r--r--include/linux/usb/ohci_pdriver.h2
-rw-r--r--include/linux/usb/phy.h15
-rw-r--r--include/linux/usb/usbnet.h13
-rw-r--r--include/linux/user_namespace.h10
-rw-r--r--include/linux/utsname.h7
-rw-r--r--include/linux/vexpress.h121
-rw-r--r--include/linux/vgaarb.h4
-rw-r--r--include/linux/virtio.h25
-rw-r--r--include/linux/virtio_scsi.h28
-rw-r--r--include/linux/vm_event_item.h14
-rw-r--r--include/linux/vmstat.h8
-rw-r--r--include/linux/vtime.h48
-rw-r--r--include/linux/wait.h164
-rw-r--r--include/linux/watchdog.h2
-rw-r--r--include/linux/writeback.h9
355 files changed, 11854 insertions, 2295 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90be9898110..3994d7790b2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -25,7 +25,9 @@
25#ifndef _LINUX_ACPI_H 25#ifndef _LINUX_ACPI_H
26#define _LINUX_ACPI_H 26#define _LINUX_ACPI_H
27 27
28#include <linux/errno.h>
28#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h>
29 31
30#ifdef CONFIG_ACPI 32#ifdef CONFIG_ACPI
31 33
@@ -76,6 +78,14 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
76 78
77typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
78 80
81#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
82void acpi_initrd_override(void *data, size_t size);
83#else
84static inline void acpi_initrd_override(void *data, size_t size)
85{
86}
87#endif
88
79char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 89char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
80void __acpi_unmap_table(char *map, unsigned long size); 90void __acpi_unmap_table(char *map, unsigned long size);
81int early_acpi_boot_init(void); 91int early_acpi_boot_init(void);
@@ -250,6 +260,26 @@ extern int pnpacpi_disabled;
250 260
251#define PXM_INVAL (-1) 261#define PXM_INVAL (-1)
252 262
263bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
264bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
265bool acpi_dev_resource_address_space(struct acpi_resource *ares,
266 struct resource *res);
267bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
268 struct resource *res);
269unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
270bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
271 struct resource *res);
272
273struct resource_list_entry {
274 struct list_head node;
275 struct resource res;
276};
277
278void acpi_dev_free_resource_list(struct list_head *list);
279int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
280 int (*preproc)(struct acpi_resource *, void *),
281 void *preproc_data);
282
253int acpi_check_resource_conflict(const struct resource *res); 283int acpi_check_resource_conflict(const struct resource *res);
254 284
255int acpi_check_region(resource_size_t start, resource_size_t n, 285int acpi_check_region(resource_size_t start, resource_size_t n,
@@ -257,10 +287,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
257 287
258int acpi_resources_are_enforced(void); 288int acpi_resources_are_enforced(void);
259 289
260#ifdef CONFIG_PM_SLEEP 290#ifdef CONFIG_HIBERNATION
261void __init acpi_no_s4_hw_signature(void); 291void __init acpi_no_s4_hw_signature(void);
292#endif
293
294#ifdef CONFIG_PM_SLEEP
262void __init acpi_old_suspend_ordering(void); 295void __init acpi_old_suspend_ordering(void);
263void __init acpi_nvs_nosave(void); 296void __init acpi_nvs_nosave(void);
297void __init acpi_nvs_nosave_s3(void);
264#endif /* CONFIG_PM_SLEEP */ 298#endif /* CONFIG_PM_SLEEP */
265 299
266struct acpi_osc_context { 300struct acpi_osc_context {
@@ -364,6 +398,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
364extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), 398extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
365 void *data); 399 void *data);
366 400
401const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
402 const struct device *dev);
403
404static inline bool acpi_driver_match_device(struct device *dev,
405 const struct device_driver *drv)
406{
407 return !!acpi_match_device(drv->acpi_match_table, dev);
408}
409
410#define ACPI_PTR(_ptr) (_ptr)
411
367#else /* !CONFIG_ACPI */ 412#else /* !CONFIG_ACPI */
368 413
369#define acpi_disabled 1 414#define acpi_disabled 1
@@ -418,6 +463,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
418 return 0; 463 return 0;
419} 464}
420 465
466struct acpi_device_id;
467
468static inline const struct acpi_device_id *acpi_match_device(
469 const struct acpi_device_id *ids, const struct device *dev)
470{
471 return NULL;
472}
473
474static inline bool acpi_driver_match_device(struct device *dev,
475 const struct device_driver *drv)
476{
477 return false;
478}
479
480#define ACPI_PTR(_ptr) (NULL)
481
421#endif /* !CONFIG_ACPI */ 482#endif /* !CONFIG_ACPI */
422 483
423#ifdef CONFIG_ACPI 484#ifdef CONFIG_ACPI
@@ -426,8 +487,96 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
426 487
427acpi_status acpi_os_prepare_sleep(u8 sleep_state, 488acpi_status acpi_os_prepare_sleep(u8 sleep_state,
428 u32 pm1a_control, u32 pm1b_control); 489 u32 pm1a_control, u32 pm1b_control);
490#ifdef CONFIG_X86
491void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
492#else
493static inline void arch_reserve_mem_area(acpi_physical_address addr,
494 size_t size)
495{
496}
497#endif /* CONFIG_X86 */
429#else 498#else
430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 499#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
431#endif 500#endif
432 501
502#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
503int acpi_dev_runtime_suspend(struct device *dev);
504int acpi_dev_runtime_resume(struct device *dev);
505int acpi_subsys_runtime_suspend(struct device *dev);
506int acpi_subsys_runtime_resume(struct device *dev);
507#else
508static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
509static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
510static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
511static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
512#endif
513
514#ifdef CONFIG_ACPI_SLEEP
515int acpi_dev_suspend_late(struct device *dev);
516int acpi_dev_resume_early(struct device *dev);
517int acpi_subsys_prepare(struct device *dev);
518int acpi_subsys_suspend_late(struct device *dev);
519int acpi_subsys_resume_early(struct device *dev);
520#else
521static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
522static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
523static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
524static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
525static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
526#endif
527
528#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
529int acpi_dev_pm_attach(struct device *dev, bool power_on);
530void acpi_dev_pm_detach(struct device *dev, bool power_off);
531#else
532static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
533{
534 return -ENODEV;
535}
536static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
537#endif
538
539#ifdef CONFIG_ACPI
540__printf(3, 4)
541void acpi_handle_printk(const char *level, acpi_handle handle,
542 const char *fmt, ...);
543#else /* !CONFIG_ACPI */
544static inline __printf(3, 4) void
545acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
546#endif /* !CONFIG_ACPI */
547
548/*
549 * acpi_handle_<level>: Print message with ACPI prefix and object path
550 *
551 * These interfaces acquire the global namespace mutex to obtain an object
552 * path. In interrupt context, it shows the object path as <n/a>.
553 */
554#define acpi_handle_emerg(handle, fmt, ...) \
555 acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
556#define acpi_handle_alert(handle, fmt, ...) \
557 acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
558#define acpi_handle_crit(handle, fmt, ...) \
559 acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
560#define acpi_handle_err(handle, fmt, ...) \
561 acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
562#define acpi_handle_warn(handle, fmt, ...) \
563 acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
564#define acpi_handle_notice(handle, fmt, ...) \
565 acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
566#define acpi_handle_info(handle, fmt, ...) \
567 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
568
569/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */
570#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
571#define acpi_handle_debug(handle, fmt, ...) \
572 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
573#else
574#define acpi_handle_debug(handle, fmt, ...) \
575({ \
576 if (0) \
577 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
578 0; \
579})
580#endif
581
433#endif /*_LINUX_ACPI_H*/ 582#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
new file mode 100644
index 00000000000..91615a389b6
--- /dev/null
+++ b/include/linux/acpi_gpio.h
@@ -0,0 +1,19 @@
1#ifndef _LINUX_ACPI_GPIO_H_
2#define _LINUX_ACPI_GPIO_H_
3
4#include <linux/errno.h>
5
6#ifdef CONFIG_GPIO_ACPI
7
8int acpi_get_gpio(char *path, int pin);
9
10#else /* CONFIG_GPIO_ACPI */
11
12static inline int acpi_get_gpio(char *path, int pin)
13{
14 return -ENODEV;
15}
16
17#endif /* CONFIG_GPIO_ACPI */
18
19#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index d36417158d8..43ec7e247a8 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -71,6 +71,16 @@ struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size, 71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata, 72 int irq1, int irq2, void *pdata,
73 unsigned int periphid); 73 unsigned int periphid);
74struct amba_device *
75amba_apb_device_add_res(struct device *parent, const char *name,
76 resource_size_t base, size_t size, int irq1,
77 int irq2, void *pdata, unsigned int periphid,
78 struct resource *resbase);
79struct amba_device *
80amba_ahb_device_add_res(struct device *parent, const char *name,
81 resource_size_t base, size_t size, int irq1,
82 int irq2, void *pdata, unsigned int periphid,
83 struct resource *resbase);
74void amba_device_unregister(struct amba_device *); 84void amba_device_unregister(struct amba_device *);
75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 85struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
76int amba_request_regions(struct amba_device *, const char *); 86int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/asn1.h b/include/linux/asn1.h
index 5c3f4e4b9a2..eed6982860b 100644
--- a/include/linux/asn1.h
+++ b/include/linux/asn1.h
@@ -64,4 +64,6 @@ enum asn1_tag {
64 ASN1_LONG_TAG = 31 /* Long form tag */ 64 ASN1_LONG_TAG = 31 /* Long form tag */
65}; 65};
66 66
67#define ASN1_INDEFINITE_LENGTH 0x80
68
67#endif /* _LINUX_ASN1_H */ 69#endif /* _LINUX_ASN1_H */
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index b856a2a590d..fe9989636b6 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -22,8 +22,6 @@ extern int __devinit __pata_platform_probe(struct device *dev,
22 unsigned int ioport_shift, 22 unsigned int ioport_shift,
23 int __pio_mask); 23 int __pio_mask);
24 24
25extern int __devexit __pata_platform_remove(struct device *dev);
26
27/* 25/*
28 * Marvell SATA private data 26 * Marvell SATA private data
29 */ 27 */
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 6e3f54f3784..fcdd81bd531 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -22,6 +22,8 @@
22#define ATH9K_PLAT_EEP_MAX_WORDS 2048 22#define ATH9K_PLAT_EEP_MAX_WORDS 2048
23 23
24struct ath9k_platform_data { 24struct ath9k_platform_data {
25 const char *eeprom_name;
26
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; 27 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26 u8 *macaddr; 28 u8 *macaddr;
27 29
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 22ef21c33d0..c1da539f5e2 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -99,6 +99,7 @@ struct atm_vcc {
99 struct atm_dev *dev; /* device back pointer */ 99 struct atm_dev *dev; /* device back pointer */
100 struct atm_qos qos; /* QOS */ 100 struct atm_qos qos; /* QOS */
101 struct atm_sap sap; /* SAP */ 101 struct atm_sap sap; /* SAP */
102 void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
102 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb); 103 void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
103 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */ 104 void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
104 int (*push_oam)(struct atm_vcc *vcc,void *cell); 105 int (*push_oam)(struct atm_vcc *vcc,void *cell);
@@ -106,6 +107,7 @@ struct atm_vcc {
106 void *dev_data; /* per-device data */ 107 void *dev_data; /* per-device data */
107 void *proto_data; /* per-protocol data */ 108 void *proto_data; /* per-protocol data */
108 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */ 109 struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
110 struct module *owner; /* owner of ->push function */
109 /* SVC part --- may move later ------------------------------------- */ 111 /* SVC part --- may move later ------------------------------------- */
110 short itf; /* interface number */ 112 short itf; /* interface number */
111 struct sockaddr_atmsvc local; 113 struct sockaddr_atmsvc local;
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 4eb31752e2b..deb0ae58b99 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -5,10 +5,16 @@
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/io.h> 6#include <linux/io.h>
7 7
8struct atmel_ssc_platform_data {
9 int use_dma;
10};
11
8struct ssc_device { 12struct ssc_device {
9 struct list_head list; 13 struct list_head list;
14 resource_size_t phybase;
10 void __iomem *regs; 15 void __iomem *regs;
11 struct platform_device *pdev; 16 struct platform_device *pdev;
17 struct atmel_ssc_platform_data *pdata;
12 struct clk *clk; 18 struct clk *clk;
13 int user; 19 int user;
14 int irq; 20 int irq;
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 2a9a9abc912..12731a19ef0 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -114,6 +114,7 @@ struct backing_dev_info {
114int bdi_init(struct backing_dev_info *bdi); 114int bdi_init(struct backing_dev_info *bdi);
115void bdi_destroy(struct backing_dev_info *bdi); 115void bdi_destroy(struct backing_dev_info *bdi);
116 116
117__printf(3, 4)
117int bdi_register(struct backing_dev_info *bdi, struct device *parent, 118int bdi_register(struct backing_dev_info *bdi, struct device *parent,
118 const char *fmt, ...); 119 const char *fmt, ...);
119int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 120int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5ffc6dda467..da9a0825e00 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -134,4 +134,14 @@ struct generic_bl_info {
134 void (*kick_battery)(void); 134 void (*kick_battery)(void);
135}; 135};
136 136
137#ifdef CONFIG_OF
138struct backlight_device *of_find_backlight_by_node(struct device_node *node);
139#else
140static inline struct backlight_device *
141of_find_backlight_by_node(struct device_node *node)
142{
143 return NULL;
144}
145#endif
146
137#endif 147#endif
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
new file mode 100644
index 00000000000..f7f1d7169b1
--- /dev/null
+++ b/include/linux/balloon_compaction.h
@@ -0,0 +1,272 @@
1/*
2 * include/linux/balloon_compaction.h
3 *
4 * Common interface definitions for making balloon pages movable by compaction.
5 *
6 * Despite being perfectly possible to perform ballooned pages migration, they
7 * make a special corner case to compaction scans because balloon pages are not
8 * enlisted at any LRU list like the other pages we do compact / migrate.
9 *
10 * As the page isolation scanning step a compaction thread does is a lockless
11 * procedure (from a page standpoint), it might bring some racy situations while
12 * performing balloon page compaction. In order to sort out these racy scenarios
13 * and safely perform balloon's page compaction and migration we must, always,
14 * ensure following these three simple rules:
15 *
16 * i. when updating a balloon's page ->mapping element, strictly do it under
17 * the following lock order, independently of the far superior
18 * locking scheme (lru_lock, balloon_lock):
19 * +-page_lock(page);
20 * +--spin_lock_irq(&b_dev_info->pages_lock);
21 * ... page->mapping updates here ...
22 *
23 * ii. before isolating or dequeueing a balloon page from the balloon device
24 * pages list, the page reference counter must be raised by one and the
25 * extra refcount must be dropped when the page is enqueued back into
26 * the balloon device page list, thus a balloon page keeps its reference
27 * counter raised only while it is under our special handling;
28 *
29 * iii. after the lockless scan step have selected a potential balloon page for
30 * isolation, re-test the page->mapping flags and the page ref counter
31 * under the proper page lock, to ensure isolating a valid balloon page
32 * (not yet isolated, nor under release procedure)
33 *
34 * The functions provided by this interface are placed to help on coping with
35 * the aforementioned balloon page corner case, as well as to ensure the simple
36 * set of exposed rules are satisfied while we are dealing with balloon pages
37 * compaction / migration.
38 *
39 * Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
40 */
41#ifndef _LINUX_BALLOON_COMPACTION_H
42#define _LINUX_BALLOON_COMPACTION_H
43#include <linux/pagemap.h>
44#include <linux/page-flags.h>
45#include <linux/migrate.h>
46#include <linux/gfp.h>
47#include <linux/err.h>
48
49/*
50 * Balloon device information descriptor.
51 * This struct is used to allow the common balloon compaction interface
52 * procedures to find the proper balloon device holding memory pages they'll
53 * have to cope for page compaction / migration, as well as it serves the
54 * balloon driver as a page book-keeper for its registered balloon devices.
55 */
56struct balloon_dev_info {
57 void *balloon_device; /* balloon device descriptor */
58 struct address_space *mapping; /* balloon special page->mapping */
59 unsigned long isolated_pages; /* # of isolated pages for migration */
60 spinlock_t pages_lock; /* Protection to pages list */
61 struct list_head pages; /* Pages enqueued & handled to Host */
62};
63
64extern struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info);
65extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
66extern struct balloon_dev_info *balloon_devinfo_alloc(
67 void *balloon_dev_descriptor);
68
69static inline void balloon_devinfo_free(struct balloon_dev_info *b_dev_info)
70{
71 kfree(b_dev_info);
72}
73
74/*
75 * balloon_page_free - release a balloon page back to the page free lists
76 * @page: ballooned page to be set free
77 *
78 * This function must be used to properly set free an isolated/dequeued balloon
79 * page at the end of a sucessful page migration, or at the balloon driver's
80 * page release procedure.
81 */
82static inline void balloon_page_free(struct page *page)
83{
84 /*
85 * Balloon pages always get an extra refcount before being isolated
86 * and before being dequeued to help on sorting out fortuite colisions
87 * between a thread attempting to isolate and another thread attempting
88 * to release the very same balloon page.
89 *
90 * Before we handle the page back to Buddy, lets drop its extra refcnt.
91 */
92 put_page(page);
93 __free_page(page);
94}
95
96#ifdef CONFIG_BALLOON_COMPACTION
97extern bool balloon_page_isolate(struct page *page);
98extern void balloon_page_putback(struct page *page);
99extern int balloon_page_migrate(struct page *newpage,
100 struct page *page, enum migrate_mode mode);
101extern struct address_space
102*balloon_mapping_alloc(struct balloon_dev_info *b_dev_info,
103 const struct address_space_operations *a_ops);
104
105static inline void balloon_mapping_free(struct address_space *balloon_mapping)
106{
107 kfree(balloon_mapping);
108}
109
110/*
111 * page_flags_cleared - helper to perform balloon @page ->flags tests.
112 *
113 * As balloon pages are obtained from buddy and we do not play with page->flags
114 * at driver level (exception made when we get the page lock for compaction),
115 * we can safely identify a ballooned page by checking if the
116 * PAGE_FLAGS_CHECK_AT_PREP page->flags are all cleared. This approach also
117 * helps us skip ballooned pages that are locked for compaction or release, thus
118 * mitigating their racy check at balloon_page_movable()
119 */
120static inline bool page_flags_cleared(struct page *page)
121{
122 return !(page->flags & PAGE_FLAGS_CHECK_AT_PREP);
123}
124
125/*
126 * __is_movable_balloon_page - helper to perform @page mapping->flags tests
127 */
128static inline bool __is_movable_balloon_page(struct page *page)
129{
130 struct address_space *mapping = page->mapping;
131 return mapping_balloon(mapping);
132}
133
134/*
135 * balloon_page_movable - test page->mapping->flags to identify balloon pages
136 * that can be moved by compaction/migration.
137 *
138 * This function is used at core compaction's page isolation scheme, therefore
139 * most pages exposed to it are not enlisted as balloon pages and so, to avoid
140 * undesired side effects like racing against __free_pages(), we cannot afford
141 * holding the page locked while testing page->mapping->flags here.
142 *
143 * As we might return false positives in the case of a balloon page being just
144 * released under us, the page->mapping->flags need to be re-tested later,
145 * under the proper page lock, at the functions that will be coping with the
146 * balloon page case.
147 */
148static inline bool balloon_page_movable(struct page *page)
149{
150 /*
151 * Before dereferencing and testing mapping->flags, let's make sure
152 * this is not a page that uses ->mapping in a different way
153 */
154 if (page_flags_cleared(page) && !page_mapped(page) &&
155 page_count(page) == 1)
156 return __is_movable_balloon_page(page);
157
158 return false;
159}
160
161/*
162 * balloon_page_insert - insert a page into the balloon's page list and make
163 * the page->mapping assignment accordingly.
164 * @page : page to be assigned as a 'balloon page'
165 * @mapping : allocated special 'balloon_mapping'
166 * @head : balloon's device page list head
167 *
168 * Caller must ensure the page is locked and the spin_lock protecting balloon
169 * pages list is held before inserting a page into the balloon device.
170 */
171static inline void balloon_page_insert(struct page *page,
172 struct address_space *mapping,
173 struct list_head *head)
174{
175 page->mapping = mapping;
176 list_add(&page->lru, head);
177}
178
179/*
180 * balloon_page_delete - delete a page from balloon's page list and clear
181 * the page->mapping assignement accordingly.
182 * @page : page to be released from balloon's page list
183 *
184 * Caller must ensure the page is locked and the spin_lock protecting balloon
185 * pages list is held before deleting a page from the balloon device.
186 */
187static inline void balloon_page_delete(struct page *page)
188{
189 page->mapping = NULL;
190 list_del(&page->lru);
191}
192
193/*
194 * balloon_page_device - get the b_dev_info descriptor for the balloon device
195 * that enqueues the given page.
196 */
197static inline struct balloon_dev_info *balloon_page_device(struct page *page)
198{
199 struct address_space *mapping = page->mapping;
200 if (likely(mapping))
201 return mapping->private_data;
202
203 return NULL;
204}
205
206static inline gfp_t balloon_mapping_gfp_mask(void)
207{
208 return GFP_HIGHUSER_MOVABLE;
209}
210
211static inline bool balloon_compaction_check(void)
212{
213 return true;
214}
215
216#else /* !CONFIG_BALLOON_COMPACTION */
217
218static inline void *balloon_mapping_alloc(void *balloon_device,
219 const struct address_space_operations *a_ops)
220{
221 return ERR_PTR(-EOPNOTSUPP);
222}
223
224static inline void balloon_mapping_free(struct address_space *balloon_mapping)
225{
226 return;
227}
228
229static inline void balloon_page_insert(struct page *page,
230 struct address_space *mapping,
231 struct list_head *head)
232{
233 list_add(&page->lru, head);
234}
235
236static inline void balloon_page_delete(struct page *page)
237{
238 list_del(&page->lru);
239}
240
241static inline bool balloon_page_movable(struct page *page)
242{
243 return false;
244}
245
246static inline bool balloon_page_isolate(struct page *page)
247{
248 return false;
249}
250
251static inline void balloon_page_putback(struct page *page)
252{
253 return;
254}
255
256static inline int balloon_page_migrate(struct page *newpage,
257 struct page *page, enum migrate_mode mode)
258{
259 return 0;
260}
261
262static inline gfp_t balloon_mapping_gfp_mask(void)
263{
264 return GFP_HIGHUSER;
265}
266
267static inline bool balloon_compaction_check(void)
268{
269 return false;
270}
271#endif /* CONFIG_BALLOON_COMPACTION */
272#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
new file mode 100644
index 00000000000..e5dfc256485
--- /dev/null
+++ b/include/linux/bcm47xx_wdt.h
@@ -0,0 +1,19 @@
1#ifndef LINUX_BCM47XX_WDT_H_
2#define LINUX_BCM47XX_WDT_H_
3
4#include <linux/types.h>
5
6
7struct bcm47xx_wdt {
8 u32 (*timer_set)(struct bcm47xx_wdt *, u32);
9 u32 (*timer_set_ms)(struct bcm47xx_wdt *, u32);
10 u32 max_timer_ms;
11
12 void *driver_data;
13};
14
15static inline void *bcm47xx_wdt_get_drvdata(struct bcm47xx_wdt *wdt)
16{
17 return wdt->driver_data;
18}
19#endif /* LINUX_BCM47XX_WDT_H_ */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 4180eb78d57..e0ce311011c 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -157,6 +157,7 @@ struct bcma_host_ops {
157 157
158/* Chip IDs of SoCs */ 158/* Chip IDs of SoCs */
159#define BCMA_CHIP_ID_BCM4706 0x5300 159#define BCMA_CHIP_ID_BCM4706 0x5300
160#define BCMA_PKG_ID_BCM4706L 1
160#define BCMA_CHIP_ID_BCM4716 0x4716 161#define BCMA_CHIP_ID_BCM4716 0x4716
161#define BCMA_PKG_ID_BCM4716 8 162#define BCMA_PKG_ID_BCM4716 8
162#define BCMA_PKG_ID_BCM4717 9 163#define BCMA_PKG_ID_BCM4717 9
@@ -166,7 +167,11 @@ struct bcma_host_ops {
166#define BCMA_CHIP_ID_BCM4749 0x4749 167#define BCMA_CHIP_ID_BCM4749 0x4749
167#define BCMA_CHIP_ID_BCM5356 0x5356 168#define BCMA_CHIP_ID_BCM5356 0x5356
168#define BCMA_CHIP_ID_BCM5357 0x5357 169#define BCMA_CHIP_ID_BCM5357 0x5357
170#define BCMA_PKG_ID_BCM5358 9
171#define BCMA_PKG_ID_BCM47186 10
172#define BCMA_PKG_ID_BCM5357 11
169#define BCMA_CHIP_ID_BCM53572 53572 173#define BCMA_CHIP_ID_BCM53572 53572
174#define BCMA_PKG_ID_BCM47188 9
170 175
171struct bcma_device { 176struct bcma_device {
172 struct bcma_bus *bus; 177 struct bcma_bus *bus;
@@ -251,7 +256,7 @@ struct bcma_bus {
251 u8 num; 256 u8 num;
252 257
253 struct bcma_drv_cc drv_cc; 258 struct bcma_drv_cc drv_cc;
254 struct bcma_drv_pci drv_pci; 259 struct bcma_drv_pci drv_pci[2];
255 struct bcma_drv_mips drv_mips; 260 struct bcma_drv_mips drv_mips;
256 struct bcma_drv_gmac_cmn drv_gmac_cmn; 261 struct bcma_drv_gmac_cmn drv_gmac_cmn;
257 262
@@ -345,6 +350,7 @@ extern void bcma_core_set_clockmode(struct bcma_device *core,
345 enum bcma_clkmode clkmode); 350 enum bcma_clkmode clkmode);
346extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, 351extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
347 bool on); 352 bool on);
353extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
348#define BCMA_DMA_TRANSLATION_MASK 0xC0000000 354#define BCMA_DMA_TRANSLATION_MASK 0xC0000000
349#define BCMA_DMA_TRANSLATION_NONE 0x00000000 355#define BCMA_DMA_TRANSLATION_NONE 0x00000000
350#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */ 356#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1cf1749440a..9a0e3fa3ca9 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -1,6 +1,9 @@
1#ifndef LINUX_BCMA_DRIVER_CC_H_ 1#ifndef LINUX_BCMA_DRIVER_CC_H_
2#define LINUX_BCMA_DRIVER_CC_H_ 2#define LINUX_BCMA_DRIVER_CC_H_
3 3
4#include <linux/platform_device.h>
5#include <linux/gpio.h>
6
4/** ChipCommon core registers. **/ 7/** ChipCommon core registers. **/
5#define BCMA_CC_ID 0x0000 8#define BCMA_CC_ID 0x0000
6#define BCMA_CC_ID_ID 0x0000FFFF 9#define BCMA_CC_ID_ID 0x0000FFFF
@@ -510,6 +513,7 @@ struct bcma_chipcommon_pmu {
510 513
511#ifdef CONFIG_BCMA_DRIVER_MIPS 514#ifdef CONFIG_BCMA_DRIVER_MIPS
512struct bcma_pflash { 515struct bcma_pflash {
516 bool present;
513 u8 buswidth; 517 u8 buswidth;
514 u32 window; 518 u32 window;
515 u32 window_size; 519 u32 window_size;
@@ -532,6 +536,7 @@ struct mtd_info;
532 536
533struct bcma_nflash { 537struct bcma_nflash {
534 bool present; 538 bool present;
539 bool boot; /* This is the flash the SoC boots from */
535 540
536 struct mtd_info *mtd; 541 struct mtd_info *mtd;
537}; 542};
@@ -552,6 +557,7 @@ struct bcma_drv_cc {
552 u32 capabilities; 557 u32 capabilities;
553 u32 capabilities_ext; 558 u32 capabilities_ext;
554 u8 setup_done:1; 559 u8 setup_done:1;
560 u8 early_setup_done:1;
555 /* Fast Powerup Delay constant */ 561 /* Fast Powerup Delay constant */
556 u16 fast_pwrup_delay; 562 u16 fast_pwrup_delay;
557 struct bcma_chipcommon_pmu pmu; 563 struct bcma_chipcommon_pmu pmu;
@@ -567,6 +573,14 @@ struct bcma_drv_cc {
567 int nr_serial_ports; 573 int nr_serial_ports;
568 struct bcma_serial_port serial_ports[4]; 574 struct bcma_serial_port serial_ports[4];
569#endif /* CONFIG_BCMA_DRIVER_MIPS */ 575#endif /* CONFIG_BCMA_DRIVER_MIPS */
576 u32 ticks_per_ms;
577 struct platform_device *watchdog;
578
579 /* Lock for GPIO register access. */
580 spinlock_t gpio_lock;
581#ifdef CONFIG_BCMA_DRIVER_GPIO
582 struct gpio_chip gpio;
583#endif
570}; 584};
571 585
572/* Register access */ 586/* Register access */
@@ -583,14 +597,14 @@ struct bcma_drv_cc {
583 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 597 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
584 598
585extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); 599extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
600extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
586 601
587extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); 602extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
588extern void bcma_chipco_resume(struct bcma_drv_cc *cc); 603extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
589 604
590void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); 605void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
591 606
592extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, 607extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
593 u32 ticks);
594 608
595void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); 609void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
596 610
@@ -603,9 +617,12 @@ u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value);
603u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value); 617u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
604u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value); 618u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
605u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value); 619u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
620u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
621u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
606 622
607/* PMU support */ 623/* PMU support */
608extern void bcma_pmu_init(struct bcma_drv_cc *cc); 624extern void bcma_pmu_init(struct bcma_drv_cc *cc);
625extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
609 626
610extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 627extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
611 u32 value); 628 u32 value);
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index c0043645cdc..0baf8a56b79 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -35,13 +35,16 @@ struct bcma_device;
35struct bcma_drv_mips { 35struct bcma_drv_mips {
36 struct bcma_device *core; 36 struct bcma_device *core;
37 u8 setup_done:1; 37 u8 setup_done:1;
38 u8 early_setup_done:1;
38 unsigned int assigned_irqs; 39 unsigned int assigned_irqs;
39}; 40};
40 41
41#ifdef CONFIG_BCMA_DRIVER_MIPS 42#ifdef CONFIG_BCMA_DRIVER_MIPS
42extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
43#else 45#else
44static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 46static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
47static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
45#endif 48#endif
46 49
47extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 50extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 6c9cb93ae3d..7e8104bb7a7 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -85,6 +85,9 @@
85 * (2 ZettaBytes), high 32 bits 85 * (2 ZettaBytes), high 32 bits
86 */ 86 */
87 87
88#define BCMA_SFLASH 0x1c000000 88#define BCMA_SOC_FLASH1 0x1fc00000 /* MIPS Flash Region 1 */
89#define BCMA_SOC_FLASH1_SZ 0x00400000 /* MIPS Size of Flash Region 1 */
90#define BCMA_SOC_FLASH2 0x1c000000 /* Flash Region 2 (region 1 shadowed here) */
91#define BCMA_SOC_FLASH2_SZ 0x02000000 /* Size of Flash Region 2 */
89 92
90#endif /* LINUX_BCMA_REGS_H_ */ 93#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index cfcc6bfcaec..0530b986035 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -54,8 +54,6 @@ struct linux_binprm {
54#define BINPRM_FLAGS_EXECFD_BIT 1 54#define BINPRM_FLAGS_EXECFD_BIT 1
55#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 55#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
56 56
57#define BINPRM_MAX_RECURSION 4
58
59/* Function parameter for binfmt->coredump */ 57/* Function parameter for binfmt->coredump */
60struct coredump_params { 58struct coredump_params {
61 siginfo_t *siginfo; 59 siginfo_t *siginfo;
@@ -72,7 +70,7 @@ struct coredump_params {
72struct linux_binfmt { 70struct linux_binfmt {
73 struct list_head lh; 71 struct list_head lh;
74 struct module *module; 72 struct module *module;
75 int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); 73 int (*load_binary)(struct linux_binprm *);
76 int (*load_shlib)(struct file *); 74 int (*load_shlib)(struct file *);
77 int (*core_dump)(struct coredump_params *cprm); 75 int (*core_dump)(struct coredump_params *cprm);
78 unsigned long min_coredump; /* minimal dump size */ 76 unsigned long min_coredump; /* minimal dump size */
@@ -95,7 +93,7 @@ extern void unregister_binfmt(struct linux_binfmt *);
95 93
96extern int prepare_binprm(struct linux_binprm *); 94extern int prepare_binprm(struct linux_binprm *);
97extern int __must_check remove_arg_zero(struct linux_binprm *); 95extern int __must_check remove_arg_zero(struct linux_binprm *);
98extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); 96extern int search_binary_handler(struct linux_binprm *);
99extern int flush_old_exec(struct linux_binprm * bprm); 97extern int flush_old_exec(struct linux_binprm * bprm);
100extern void setup_new_exec(struct linux_binprm * bprm); 98extern void setup_new_exec(struct linux_binprm * bprm);
101extern void would_dump(struct linux_binprm *, struct file *); 99extern void would_dump(struct linux_binprm *, struct file *);
@@ -114,6 +112,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
114 unsigned long stack_top, 112 unsigned long stack_top,
115 int executable_stack); 113 int executable_stack);
116extern int bprm_mm_init(struct linux_binprm *bprm); 114extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
117extern int copy_strings_kernel(int argc, const char *const *argv, 116extern int copy_strings_kernel(int argc, const char *const *argv,
118 struct linux_binprm *bprm); 117 struct linux_binprm *bprm);
119extern int prepare_bprm_creds(struct linux_binprm *bprm); 118extern int prepare_bprm_creds(struct linux_binprm *bprm);
@@ -121,8 +120,4 @@ extern void install_exec_creds(struct linux_binprm *bprm);
121extern void set_binfmt(struct linux_binfmt *new); 120extern void set_binfmt(struct linux_binfmt *new);
122extern void free_bprm(struct linux_binprm *); 121extern void free_bprm(struct linux_binprm *);
123 122
124#ifdef __ARCH_WANT_KERNEL_EXECVE
125extern void ret_from_kernel_execve(struct pt_regs *normal) __noreturn;
126#endif
127
128#endif /* _LINUX_BINFMTS_H */ 123#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1756001210d..f94bc83011e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -378,6 +378,12 @@ struct request_queue {
378 378
379 unsigned int nr_sorted; 379 unsigned int nr_sorted;
380 unsigned int in_flight[2]; 380 unsigned int in_flight[2];
381 /*
382 * Number of active block driver functions for which blk_drain_queue()
383 * must wait. Must be incremented around functions that unlock the
384 * queue_lock internally, e.g. scsi_request_fn().
385 */
386 unsigned int request_fn_active;
381 387
382 unsigned int rq_timeout; 388 unsigned int rq_timeout;
383 struct timer_list timeout; 389 struct timer_list timeout;
@@ -437,7 +443,7 @@ struct request_queue {
437#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 443#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
438#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ 444#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
439#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ 445#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
440#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 446#define QUEUE_FLAG_DYING 5 /* queue being torn down */
441#define QUEUE_FLAG_BYPASS 6 /* act as dumb FIFO queue */ 447#define QUEUE_FLAG_BYPASS 6 /* act as dumb FIFO queue */
442#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ 448#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */
443#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ 449#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */
@@ -452,6 +458,7 @@ struct request_queue {
452#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ 458#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */
453#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ 459#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
454#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 460#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
461#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
455 462
456#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 463#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
457 (1 << QUEUE_FLAG_STACKABLE) | \ 464 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -521,6 +528,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
521 528
522#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 529#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
523#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 530#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
531#define blk_queue_dying(q) test_bit(QUEUE_FLAG_DYING, &(q)->queue_flags)
524#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags) 532#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
525#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags) 533#define blk_queue_bypass(q) test_bit(QUEUE_FLAG_BYPASS, &(q)->queue_flags)
526#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 534#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
@@ -1180,13 +1188,25 @@ static inline int queue_discard_alignment(struct request_queue *q)
1180 1188
1181static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector) 1189static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
1182{ 1190{
1183 unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); 1191 unsigned int alignment, granularity, offset;
1184 1192
1185 if (!lim->max_discard_sectors) 1193 if (!lim->max_discard_sectors)
1186 return 0; 1194 return 0;
1187 1195
1188 return (lim->discard_granularity + lim->discard_alignment - alignment) 1196 /* Why are these in bytes, not sectors? */
1189 & (lim->discard_granularity - 1); 1197 alignment = lim->discard_alignment >> 9;
1198 granularity = lim->discard_granularity >> 9;
1199 if (!granularity)
1200 return 0;
1201
1202 /* Offset of the partition start in 'granularity' sectors */
1203 offset = sector_div(sector, granularity);
1204
1205 /* And why do we do this modulus *again* in blkdev_issue_discard()? */
1206 offset = (granularity + alignment - offset) % granularity;
1207
1208 /* Turn it back into bytes, gaah */
1209 return offset << 9;
1190} 1210}
1191 1211
1192static inline int bdev_discard_alignment(struct block_device *bdev) 1212static inline int bdev_discard_alignment(struct block_device *bdev)
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 6d6795d46a7..3f778c27f82 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -51,8 +51,8 @@ extern unsigned long free_all_bootmem(void);
51extern void free_bootmem_node(pg_data_t *pgdat, 51extern void free_bootmem_node(pg_data_t *pgdat,
52 unsigned long addr, 52 unsigned long addr,
53 unsigned long size); 53 unsigned long size);
54extern void free_bootmem(unsigned long addr, unsigned long size); 54extern void free_bootmem(unsigned long physaddr, unsigned long size);
55extern void free_bootmem_late(unsigned long addr, unsigned long size); 55extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
56 56
57/* 57/*
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
@@ -137,9 +137,6 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
137#define alloc_bootmem_low_pages_node(pgdat, x) \ 137#define alloc_bootmem_low_pages_node(pgdat, x) \
138 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) 138 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
139 139
140extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
141 int flags);
142
143#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 140#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
144extern void *alloc_remap(int nid, unsigned long size); 141extern void *alloc_remap(int nid, unsigned long size);
145#else 142#else
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index 4d0fb3df2f4..a226652a5a6 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -67,6 +67,5 @@ void bsg_job_done(struct bsg_job *job, int result,
67int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name, 67int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
68 bsg_job_fn *job_fn, int dd_job_size); 68 bsg_job_fn *job_fn, int dd_job_size);
69void bsg_request_fn(struct request_queue *q); 69void bsg_request_fn(struct request_queue *q);
70void bsg_goose_queue(struct request_queue *q);
71 70
72#endif 71#endif
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 6470792b13d..084d3c622b1 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -43,7 +43,6 @@ struct ceph_options {
43 struct ceph_entity_addr my_addr; 43 struct ceph_entity_addr my_addr;
44 int mount_timeout; 44 int mount_timeout;
45 int osd_idle_ttl; 45 int osd_idle_ttl;
46 int osd_timeout;
47 int osd_keepalive_timeout; 46 int osd_keepalive_timeout;
48 47
49 /* 48 /*
@@ -63,7 +62,6 @@ struct ceph_options {
63 * defaults 62 * defaults
64 */ 63 */
65#define CEPH_MOUNT_TIMEOUT_DEFAULT 60 64#define CEPH_MOUNT_TIMEOUT_DEFAULT 60
66#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
67#define CEPH_OSD_KEEPALIVE_DEFAULT 5 65#define CEPH_OSD_KEEPALIVE_DEFAULT 5
68#define CEPH_OSD_IDLE_TTL_DEFAULT 60 66#define CEPH_OSD_IDLE_TTL_DEFAULT 60
69 67
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index e37acbe989a..10a417f9f76 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -123,6 +123,7 @@ extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
124 struct ceph_pg pgid); 124 struct ceph_pg pgid);
125 125
126extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id);
126extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); 127extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name);
127 128
128#endif 129#endif
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index de91fbdf127..2c04afeead1 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -87,6 +87,8 @@ struct ceph_pg {
87 * 87 *
88 * lpgp_num -- as above. 88 * lpgp_num -- as above.
89 */ 89 */
90#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
91
90#define CEPH_PG_TYPE_REP 1 92#define CEPH_PG_TYPE_REP 1
91#define CEPH_PG_TYPE_RAID4 2 93#define CEPH_PG_TYPE_RAID4 2
92#define CEPH_PG_POOL_VERSION 2 94#define CEPH_PG_POOL_VERSION 2
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index f8a030ced0c..7d73905dcba 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/rculist.h>
15#include <linux/cgroupstats.h> 16#include <linux/cgroupstats.h>
16#include <linux/prio_heap.h> 17#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 18#include <linux/rwsem.h>
@@ -34,7 +35,6 @@ extern int cgroup_lock_is_held(void);
34extern bool cgroup_lock_live_group(struct cgroup *cgrp); 35extern bool cgroup_lock_live_group(struct cgroup *cgrp);
35extern void cgroup_unlock(void); 36extern void cgroup_unlock(void);
36extern void cgroup_fork(struct task_struct *p); 37extern void cgroup_fork(struct task_struct *p);
37extern void cgroup_fork_callbacks(struct task_struct *p);
38extern void cgroup_post_fork(struct task_struct *p); 38extern void cgroup_post_fork(struct task_struct *p);
39extern void cgroup_exit(struct task_struct *p, int run_callbacks); 39extern void cgroup_exit(struct task_struct *p, int run_callbacks);
40extern int cgroupstats_build(struct cgroupstats *stats, 40extern int cgroupstats_build(struct cgroupstats *stats,
@@ -66,7 +66,7 @@ struct cgroup_subsys_state {
66 /* 66 /*
67 * State maintained by the cgroup system to allow subsystems 67 * State maintained by the cgroup system to allow subsystems
68 * to be "busy". Should be accessed via css_get(), 68 * to be "busy". Should be accessed via css_get(),
69 * css_tryget() and and css_put(). 69 * css_tryget() and css_put().
70 */ 70 */
71 71
72 atomic_t refcnt; 72 atomic_t refcnt;
@@ -81,9 +81,8 @@ struct cgroup_subsys_state {
81 81
82/* bits in struct cgroup_subsys_state flags field */ 82/* bits in struct cgroup_subsys_state flags field */
83enum { 83enum {
84 CSS_ROOT, /* This CSS is the root of the subsystem */ 84 CSS_ROOT = (1 << 0), /* this CSS is the root of the subsystem */
85 CSS_REMOVED, /* This CSS is dead */ 85 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
86 CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
87}; 86};
88 87
89/* Caller must verify that the css is not for root cgroup */ 88/* Caller must verify that the css is not for root cgroup */
@@ -102,15 +101,10 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
102static inline void css_get(struct cgroup_subsys_state *css) 101static inline void css_get(struct cgroup_subsys_state *css)
103{ 102{
104 /* We don't need to reference count the root state */ 103 /* We don't need to reference count the root state */
105 if (!test_bit(CSS_ROOT, &css->flags)) 104 if (!(css->flags & CSS_ROOT))
106 __css_get(css, 1); 105 __css_get(css, 1);
107} 106}
108 107
109static inline bool css_is_removed(struct cgroup_subsys_state *css)
110{
111 return test_bit(CSS_REMOVED, &css->flags);
112}
113
114/* 108/*
115 * Call css_tryget() to take a reference on a css if your existing 109 * Call css_tryget() to take a reference on a css if your existing
116 * (known-valid) reference isn't already ref-counted. Returns false if 110 * (known-valid) reference isn't already ref-counted. Returns false if
@@ -120,7 +114,7 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css)
120extern bool __css_tryget(struct cgroup_subsys_state *css); 114extern bool __css_tryget(struct cgroup_subsys_state *css);
121static inline bool css_tryget(struct cgroup_subsys_state *css) 115static inline bool css_tryget(struct cgroup_subsys_state *css)
122{ 116{
123 if (test_bit(CSS_ROOT, &css->flags)) 117 if (css->flags & CSS_ROOT)
124 return true; 118 return true;
125 return __css_tryget(css); 119 return __css_tryget(css);
126} 120}
@@ -133,7 +127,7 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
133extern void __css_put(struct cgroup_subsys_state *css); 127extern void __css_put(struct cgroup_subsys_state *css);
134static inline void css_put(struct cgroup_subsys_state *css) 128static inline void css_put(struct cgroup_subsys_state *css)
135{ 129{
136 if (!test_bit(CSS_ROOT, &css->flags)) 130 if (!(css->flags & CSS_ROOT))
137 __css_put(css); 131 __css_put(css);
138} 132}
139 133
@@ -149,13 +143,11 @@ enum {
149 /* Control Group requires release notifications to userspace */ 143 /* Control Group requires release notifications to userspace */
150 CGRP_NOTIFY_ON_RELEASE, 144 CGRP_NOTIFY_ON_RELEASE,
151 /* 145 /*
152 * A thread in rmdir() is wating for this cgroup. 146 * Clone the parent's configuration when creating a new child
153 */ 147 * cpuset cgroup. For historical reasons, this option can be
154 CGRP_WAIT_ON_RMDIR, 148 * specified at mount time and thus is implemented here.
155 /*
156 * Clone cgroup values when creating a new child cgroup
157 */ 149 */
158 CGRP_CLONE_CHILDREN, 150 CGRP_CPUSET_CLONE_CHILDREN,
159}; 151};
160 152
161struct cgroup { 153struct cgroup {
@@ -167,6 +159,8 @@ struct cgroup {
167 */ 159 */
168 atomic_t count; 160 atomic_t count;
169 161
162 int id; /* ida allocated in-hierarchy ID */
163
170 /* 164 /*
171 * We link our 'sibling' struct into our parent's 'children'. 165 * We link our 'sibling' struct into our parent's 'children'.
172 * Our children link their 'sibling' into our 'children'. 166 * Our children link their 'sibling' into our 'children'.
@@ -176,7 +170,7 @@ struct cgroup {
176 struct list_head files; /* my files */ 170 struct list_head files; /* my files */
177 171
178 struct cgroup *parent; /* my parent */ 172 struct cgroup *parent; /* my parent */
179 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */ 173 struct dentry *dentry; /* cgroup fs entry, RCU protected */
180 174
181 /* Private pointers for each registered subsystem */ 175 /* Private pointers for each registered subsystem */
182 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 176 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
@@ -282,7 +276,7 @@ struct cgroup_map_cb {
282 276
283/* cftype->flags */ 277/* cftype->flags */
284#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */ 278#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
285#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */ 279#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create on root cg */
286 280
287#define MAX_CFTYPE_NAME 64 281#define MAX_CFTYPE_NAME 64
288 282
@@ -422,23 +416,6 @@ int cgroup_task_count(const struct cgroup *cgrp);
422int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); 416int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
423 417
424/* 418/*
425 * When the subsys has to access css and may add permanent refcnt to css,
426 * it should take care of racy conditions with rmdir(). Following set of
427 * functions, is for stop/restart rmdir if necessary.
428 * Because these will call css_get/put, "css" should be alive css.
429 *
430 * cgroup_exclude_rmdir();
431 * ...do some jobs which may access arbitrary empty cgroup
432 * cgroup_release_and_wakeup_rmdir();
433 *
434 * When someone removes a cgroup while cgroup_exclude_rmdir() holds it,
435 * it sleeps and cgroup_release_and_wakeup_rmdir() will wake him up.
436 */
437
438void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
439void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
440
441/*
442 * Control Group taskset, used to pass around set of tasks to cgroup_subsys 419 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
443 * methods. 420 * methods.
444 */ 421 */
@@ -466,16 +443,17 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
466 */ 443 */
467 444
468struct cgroup_subsys { 445struct cgroup_subsys {
469 struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); 446 struct cgroup_subsys_state *(*css_alloc)(struct cgroup *cgrp);
470 int (*pre_destroy)(struct cgroup *cgrp); 447 int (*css_online)(struct cgroup *cgrp);
471 void (*destroy)(struct cgroup *cgrp); 448 void (*css_offline)(struct cgroup *cgrp);
449 void (*css_free)(struct cgroup *cgrp);
450
472 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 451 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
473 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 452 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
474 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); 453 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
475 void (*fork)(struct task_struct *task); 454 void (*fork)(struct task_struct *task);
476 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 455 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
477 struct task_struct *task); 456 struct task_struct *task);
478 void (*post_clone)(struct cgroup *cgrp);
479 void (*bind)(struct cgroup *root); 457 void (*bind)(struct cgroup *root);
480 458
481 int subsys_id; 459 int subsys_id;
@@ -489,17 +467,6 @@ struct cgroup_subsys {
489 bool use_id; 467 bool use_id;
490 468
491 /* 469 /*
492 * If %true, cgroup removal will try to clear css refs by retrying
493 * ss->pre_destroy() until there's no css ref left. This behavior
494 * is strictly for backward compatibility and will be removed as
495 * soon as the current user (memcg) is updated.
496 *
497 * If %false, ss->pre_destroy() can't fail and cgroup removal won't
498 * wait for css refs to drop to zero before proceeding.
499 */
500 bool __DEPRECATED_clear_css_refs;
501
502 /*
503 * If %false, this subsystem is properly hierarchical - 470 * If %false, this subsystem is properly hierarchical -
504 * configuration, resource accounting and restriction on a parent 471 * configuration, resource accounting and restriction on a parent
505 * cgroup cover those of its children. If %true, hierarchy support 472 * cgroup cover those of its children. If %true, hierarchy support
@@ -572,6 +539,100 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
572 return task_subsys_state(task, subsys_id)->cgroup; 539 return task_subsys_state(task, subsys_id)->cgroup;
573} 540}
574 541
542/**
543 * cgroup_for_each_child - iterate through children of a cgroup
544 * @pos: the cgroup * to use as the loop cursor
545 * @cgroup: cgroup whose children to walk
546 *
547 * Walk @cgroup's children. Must be called under rcu_read_lock(). A child
548 * cgroup which hasn't finished ->css_online() or already has finished
549 * ->css_offline() may show up during traversal and it's each subsystem's
550 * responsibility to verify that each @pos is alive.
551 *
552 * If a subsystem synchronizes against the parent in its ->css_online() and
553 * before starting iterating, a cgroup which finished ->css_online() is
554 * guaranteed to be visible in the future iterations.
555 */
556#define cgroup_for_each_child(pos, cgroup) \
557 list_for_each_entry_rcu(pos, &(cgroup)->children, sibling)
558
559struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
560 struct cgroup *cgroup);
561
562/**
563 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants
564 * @pos: the cgroup * to use as the loop cursor
565 * @cgroup: cgroup whose descendants to walk
566 *
567 * Walk @cgroup's descendants. Must be called under rcu_read_lock(). A
568 * descendant cgroup which hasn't finished ->css_online() or already has
569 * finished ->css_offline() may show up during traversal and it's each
570 * subsystem's responsibility to verify that each @pos is alive.
571 *
572 * If a subsystem synchronizes against the parent in its ->css_online() and
573 * before starting iterating, and synchronizes against @pos on each
574 * iteration, any descendant cgroup which finished ->css_offline() is
575 * guaranteed to be visible in the future iterations.
576 *
577 * In other words, the following guarantees that a descendant can't escape
578 * state updates of its ancestors.
579 *
580 * my_online(@cgrp)
581 * {
582 * Lock @cgrp->parent and @cgrp;
583 * Inherit state from @cgrp->parent;
584 * Unlock both.
585 * }
586 *
587 * my_update_state(@cgrp)
588 * {
589 * Lock @cgrp;
590 * Update @cgrp's state;
591 * Unlock @cgrp;
592 *
593 * cgroup_for_each_descendant_pre(@pos, @cgrp) {
594 * Lock @pos;
595 * Verify @pos is alive and inherit state from @pos->parent;
596 * Unlock @pos;
597 * }
598 * }
599 *
600 * As long as the inheriting step, including checking the parent state, is
601 * enclosed inside @pos locking, double-locking the parent isn't necessary
602 * while inheriting. The state update to the parent is guaranteed to be
603 * visible by walking order and, as long as inheriting operations to the
604 * same @pos are atomic to each other, multiple updates racing each other
605 * still result in the correct state. It's guaranateed that at least one
606 * inheritance happens for any cgroup after the latest update to its
607 * parent.
608 *
609 * If checking parent's state requires locking the parent, each inheriting
610 * iteration should lock and unlock both @pos->parent and @pos.
611 *
612 * Alternatively, a subsystem may choose to use a single global lock to
613 * synchronize ->css_online() and ->css_offline() against tree-walking
614 * operations.
615 */
616#define cgroup_for_each_descendant_pre(pos, cgroup) \
617 for (pos = cgroup_next_descendant_pre(NULL, (cgroup)); (pos); \
618 pos = cgroup_next_descendant_pre((pos), (cgroup)))
619
620struct cgroup *cgroup_next_descendant_post(struct cgroup *pos,
621 struct cgroup *cgroup);
622
623/**
624 * cgroup_for_each_descendant_post - post-order walk of a cgroup's descendants
625 * @pos: the cgroup * to use as the loop cursor
626 * @cgroup: cgroup whose descendants to walk
627 *
628 * Similar to cgroup_for_each_descendant_pre() but performs post-order
629 * traversal instead. Note that the walk visibility guarantee described in
630 * pre-order walk doesn't apply the same to post-order walks.
631 */
632#define cgroup_for_each_descendant_post(pos, cgroup) \
633 for (pos = cgroup_next_descendant_post(NULL, (cgroup)); (pos); \
634 pos = cgroup_next_descendant_post((pos), (cgroup)))
635
575/* A cgroup_iter should be treated as an opaque object */ 636/* A cgroup_iter should be treated as an opaque object */
576struct cgroup_iter { 637struct cgroup_iter {
577 struct list_head *cg_link; 638 struct list_head *cg_link;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index f9f5e9eeb9d..4989b8a7bed 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -53,9 +53,18 @@ struct clk_hw;
53 * @disable: Disable the clock atomically. Called with enable_lock held. 53 * @disable: Disable the clock atomically. Called with enable_lock held.
54 * This function must not sleep. 54 * This function must not sleep.
55 * 55 *
56 * @recalc_rate Recalculate the rate of this clock, by quering hardware. The 56 * @is_enabled: Queries the hardware to determine if the clock is enabled.
57 * This function must not sleep. Optional, if this op is not
58 * set then the enable count will be used.
59 *
60 * @disable_unused: Disable the clock atomically. Only called from
61 * clk_disable_unused for gate clocks with special needs.
62 * Called with enable_lock held. This function must not
63 * sleep.
64 *
65 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The
57 * parent rate is an input parameter. It is up to the caller to 66 * parent rate is an input parameter. It is up to the caller to
58 * insure that the prepare_mutex is held across this call. 67 * ensure that the prepare_mutex is held across this call.
59 * Returns the calculated rate. Optional, but recommended - if 68 * Returns the calculated rate. Optional, but recommended - if
60 * this op is not set then clock rate will be initialized to 0. 69 * this op is not set then clock rate will be initialized to 0.
61 * 70 *
@@ -89,7 +98,7 @@ struct clk_hw;
89 * implementations to split any work between atomic (enable) and sleepable 98 * implementations to split any work between atomic (enable) and sleepable
90 * (prepare) contexts. If enabling a clock requires code that might sleep, 99 * (prepare) contexts. If enabling a clock requires code that might sleep,
91 * this must be done in clk_prepare. Clock enable code that will never be 100 * this must be done in clk_prepare. Clock enable code that will never be
92 * called in a sleepable context may be implement in clk_enable. 101 * called in a sleepable context may be implemented in clk_enable.
93 * 102 *
94 * Typically, drivers will call clk_prepare when a clock may be needed later 103 * Typically, drivers will call clk_prepare when a clock may be needed later
95 * (eg. when a device is opened), and clk_enable when the clock is actually 104 * (eg. when a device is opened), and clk_enable when the clock is actually
@@ -102,6 +111,7 @@ struct clk_ops {
102 int (*enable)(struct clk_hw *hw); 111 int (*enable)(struct clk_hw *hw);
103 void (*disable)(struct clk_hw *hw); 112 void (*disable)(struct clk_hw *hw);
104 int (*is_enabled)(struct clk_hw *hw); 113 int (*is_enabled)(struct clk_hw *hw);
114 void (*disable_unused)(struct clk_hw *hw);
105 unsigned long (*recalc_rate)(struct clk_hw *hw, 115 unsigned long (*recalc_rate)(struct clk_hw *hw,
106 unsigned long parent_rate); 116 unsigned long parent_rate);
107 long (*round_rate)(struct clk_hw *hw, unsigned long, 117 long (*round_rate)(struct clk_hw *hw, unsigned long,
@@ -327,19 +337,21 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
327 * error code; drivers must test for an error code after calling clk_register. 337 * error code; drivers must test for an error code after calling clk_register.
328 */ 338 */
329struct clk *clk_register(struct device *dev, struct clk_hw *hw); 339struct clk *clk_register(struct device *dev, struct clk_hw *hw);
340struct clk *devm_clk_register(struct device *dev, struct clk_hw *hw);
330 341
331void clk_unregister(struct clk *clk); 342void clk_unregister(struct clk *clk);
343void devm_clk_unregister(struct device *dev, struct clk *clk);
332 344
333/* helper functions */ 345/* helper functions */
334const char *__clk_get_name(struct clk *clk); 346const char *__clk_get_name(struct clk *clk);
335struct clk_hw *__clk_get_hw(struct clk *clk); 347struct clk_hw *__clk_get_hw(struct clk *clk);
336u8 __clk_get_num_parents(struct clk *clk); 348u8 __clk_get_num_parents(struct clk *clk);
337struct clk *__clk_get_parent(struct clk *clk); 349struct clk *__clk_get_parent(struct clk *clk);
338int __clk_get_enable_count(struct clk *clk); 350unsigned int __clk_get_enable_count(struct clk *clk);
339int __clk_get_prepare_count(struct clk *clk); 351unsigned int __clk_get_prepare_count(struct clk *clk);
340unsigned long __clk_get_rate(struct clk *clk); 352unsigned long __clk_get_rate(struct clk *clk);
341unsigned long __clk_get_flags(struct clk *clk); 353unsigned long __clk_get_flags(struct clk *clk);
342int __clk_is_enabled(struct clk *clk); 354bool __clk_is_enabled(struct clk *clk);
343struct clk *__clk_lookup(const char *name); 355struct clk *__clk_lookup(const char *name);
344 356
345/* 357/*
diff --git a/include/linux/clk/mvebu.h b/include/linux/clk/mvebu.h
new file mode 100644
index 00000000000..8c4ae713b06
--- /dev/null
+++ b/include/linux/clk/mvebu.h
@@ -0,0 +1,22 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16
17#ifndef __CLK_MVEBU_H_
18#define __CLK_MVEBU_H_
19
20void __init mvebu_clocks_init(void);
21
22#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
new file mode 100644
index 00000000000..e074fdd5a23
--- /dev/null
+++ b/include/linux/clk/sunxi.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
new file mode 100644
index 00000000000..56be7cd9aa8
--- /dev/null
+++ b/include/linux/clk/zynq.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2012 National Instruments
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __LINUX_CLK_ZYNQ_H_
20#define __LINUX_CLK_ZYNQ_H_
21
22void __init xilinx_zynq_clocks_init(void __iomem *slcr);
23
24#endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index d0ced1011f2..dec7e2d1887 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -23,6 +23,61 @@
23#define COMPAT_USE_64BIT_TIME 0 23#define COMPAT_USE_64BIT_TIME 0
24#endif 24#endif
25 25
26#ifndef __SC_DELOUSE
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif
29
30#define __SC_CCAST1(t1, a1) __SC_DELOUSE(t1,a1)
31#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__)
32#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__)
33#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__)
34#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__)
35#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)
36#define COMPAT_SYSCALL_DEFINE1(name, ...) \
37 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
38#define COMPAT_SYSCALL_DEFINE2(name, ...) \
39 COMPAT_SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
40#define COMPAT_SYSCALL_DEFINE3(name, ...) \
41 COMPAT_SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
42#define COMPAT_SYSCALL_DEFINE4(name, ...) \
43 COMPAT_SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
44#define COMPAT_SYSCALL_DEFINE5(name, ...) \
45 COMPAT_SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
46#define COMPAT_SYSCALL_DEFINE6(name, ...) \
47 COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
48
49#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
50
51#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
52 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)); \
53 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
54 asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__)) \
55 { \
56 return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__)); \
57 } \
58 SYSCALL_ALIAS(compat_sys##name, compat_SyS##name); \
59 static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__))
60
61#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
62
63#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
64 asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__))
65
66#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
67
68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp;
75 int ss_flags;
76 compat_size_t ss_size;
77} compat_stack_t;
78#endif
79#endif
80
26#define compat_jiffies_to_clock_t(x) \ 81#define compat_jiffies_to_clock_t(x) \
27 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
28 83
@@ -284,12 +339,8 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
284 const struct compat_iovec __user *vec, 339 const struct compat_iovec __user *vec,
285 unsigned long vlen, u32 pos_low, u32 pos_high); 340 unsigned long vlen, u32 pos_low, u32 pos_high);
286 341
287int compat_do_execve(const char *filename, const compat_uptr_t __user *argv,
288 const compat_uptr_t __user *envp, struct pt_regs *regs);
289#ifdef __ARCH_WANT_SYS_EXECVE
290asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
291 const compat_uptr_t __user *envp); 343 const compat_uptr_t __user *envp);
292#endif
293 344
294asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 345asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
295 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 346 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
@@ -591,6 +642,16 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
591 642
592asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
593 compat_off_t __user *offset, compat_size_t count); 644 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr);
648
649int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
652
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval);
594 655
595#else 656#else
596 657
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 412bc6c2b02..662fd1b4c42 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -31,6 +31,8 @@
31 31
32#define __linktime_error(message) __attribute__((__error__(message))) 32#define __linktime_error(message) __attribute__((__error__(message)))
33 33
34#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
35
34#if __GNUC_MINOR__ >= 5 36#if __GNUC_MINOR__ >= 5
35/* 37/*
36 * Mark a position in code as unreachable. This can be used to 38 * Mark a position in code as unreachable. This can be used to
@@ -63,3 +65,13 @@
63#define __compiletime_warning(message) __attribute__((warning(message))) 65#define __compiletime_warning(message) __attribute__((warning(message)))
64#define __compiletime_error(message) __attribute__((error(message))) 66#define __compiletime_error(message) __attribute__((error(message)))
65#endif 67#endif
68
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if __GNUC_MINOR__ >= 4
71#define __HAVE_BUILTIN_BSWAP32__
72#define __HAVE_BUILTIN_BSWAP64__
73#endif
74#if __GNUC_MINOR__ >= 8 || (defined(__powerpc__) && __GNUC_MINOR__ >= 6)
75#define __HAVE_BUILTIN_BSWAP16__
76#endif
77#endif
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index d8e636e5607..973ce10c40b 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -29,3 +29,10 @@
29#endif 29#endif
30 30
31#define uninitialized_var(x) x 31#define uninitialized_var(x) x
32
33#ifndef __HAVE_BUILTIN_BSWAP16__
34/* icc has this, but it's called _bswap16 */
35#define __HAVE_BUILTIN_BSWAP16__
36#define __builtin_bswap16 _bswap16
37#endif
38
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index f430e4162f4..dd852b73b28 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -10,6 +10,7 @@
10# define __force __attribute__((force)) 10# define __force __attribute__((force))
11# define __nocast __attribute__((nocast)) 11# define __nocast __attribute__((nocast))
12# define __iomem __attribute__((noderef, address_space(2))) 12# define __iomem __attribute__((noderef, address_space(2)))
13# define __must_hold(x) __attribute__((context(x,1,1)))
13# define __acquires(x) __attribute__((context(x,0,1))) 14# define __acquires(x) __attribute__((context(x,0,1)))
14# define __releases(x) __attribute__((context(x,1,0))) 15# define __releases(x) __attribute__((context(x,1,0)))
15# define __acquire(x) __context__(x,1) 16# define __acquire(x) __context__(x,1)
@@ -33,6 +34,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
33# define __chk_user_ptr(x) (void)0 34# define __chk_user_ptr(x) (void)0
34# define __chk_io_ptr(x) (void)0 35# define __chk_io_ptr(x) (void)0
35# define __builtin_warning(x, y...) (1) 36# define __builtin_warning(x, y...) (1)
37# define __must_hold(x)
36# define __acquires(x) 38# define __acquires(x)
37# define __releases(x) 39# define __releases(x)
38# define __acquire(x) (void)0 40# define __acquire(x) (void)0
@@ -42,6 +44,10 @@ extern void __chk_io_ptr(const volatile void __iomem *);
42# define __rcu 44# define __rcu
43#endif 45#endif
44 46
47/* Indirect macros required for expanded argument pasting, eg. __LINE__. */
48#define ___PASTE(a,b) a##b
49#define __PASTE(a,b) ___PASTE(a,b)
50
45#ifdef __KERNEL__ 51#ifdef __KERNEL__
46 52
47#ifdef __GNUC__ 53#ifdef __GNUC__
@@ -164,6 +170,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
164 (typeof(ptr)) (__ptr + (off)); }) 170 (typeof(ptr)) (__ptr + (off)); })
165#endif 171#endif
166 172
173/* Not-quite-unique ID. */
174#ifndef __UNIQUE_ID
175# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
176#endif
177
167#endif /* __KERNEL__ */ 178#endif /* __KERNEL__ */
168 179
169#endif /* __ASSEMBLY__ */ 180#endif /* __ASSEMBLY__ */
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
new file mode 100644
index 00000000000..e24339ccb7f
--- /dev/null
+++ b/include/linux/context_tracking.h
@@ -0,0 +1,18 @@
1#ifndef _LINUX_CONTEXT_TRACKING_H
2#define _LINUX_CONTEXT_TRACKING_H
3
4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h>
6
7extern void user_enter(void);
8extern void user_exit(void);
9extern void context_tracking_task_switch(struct task_struct *prev,
10 struct task_struct *next);
11#else
12static inline void user_enter(void) { }
13static inline void user_exit(void) { }
14static inline void context_tracking_task_switch(struct task_struct *prev,
15 struct task_struct *next) { }
16#endif /* !CONFIG_CONTEXT_TRACKING */
17
18#endif
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 1d7399314a8..a98f1ca6040 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -13,9 +13,9 @@
13extern int dump_write(struct file *file, const void *addr, int nr); 13extern int dump_write(struct file *file, const void *addr, int nr);
14extern int dump_seek(struct file *file, loff_t off); 14extern int dump_seek(struct file *file, loff_t off);
15#ifdef CONFIG_COREDUMP 15#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs); 16extern void do_coredump(siginfo_t *siginfo);
17#else 17#else
18static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {} 18static inline void do_coredump(siginfo_t *siginfo) {}
19#endif 19#endif
20 20
21#endif /* _LINUX_COREDUMP_H */ 21#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 851530128e6..40b4ef54cc7 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -29,13 +29,13 @@
29#define CPUFREQ_COOLING_START 0 29#define CPUFREQ_COOLING_START 0
30#define CPUFREQ_COOLING_STOP 1 30#define CPUFREQ_COOLING_STOP 1
31 31
32#ifdef CONFIG_CPU_THERMAL 32#if defined(CONFIG_CPU_THERMAL) || defined(CONFIG_CPU_THERMAL_MODULE)
33/** 33/**
34 * cpufreq_cooling_register - function to create cpufreq cooling device. 34 * cpufreq_cooling_register - function to create cpufreq cooling device.
35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen 35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 */ 36 */
37struct thermal_cooling_device *cpufreq_cooling_register( 37struct thermal_cooling_device *cpufreq_cooling_register(
38 struct cpumask *clip_cpus); 38 const struct cpumask *clip_cpus);
39 39
40/** 40/**
41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. 41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
@@ -44,7 +44,7 @@ struct thermal_cooling_device *cpufreq_cooling_register(
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device *cpufreq_cooling_register( 46static inline struct thermal_cooling_device *cpufreq_cooling_register(
47 struct cpumask *clip_cpus) 47 const struct cpumask *clip_cpus)
48{ 48{
49 return NULL; 49 return NULL;
50} 50}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index b60f6ba01d0..a55b88eaf96 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -11,6 +11,7 @@
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/mutex.h> 15#include <linux/mutex.h>
15#include <linux/notifier.h> 16#include <linux/notifier.h>
16#include <linux/threads.h> 17#include <linux/threads.h>
@@ -22,6 +23,8 @@
22#include <asm/div64.h> 23#include <asm/div64.h>
23 24
24#define CPUFREQ_NAME_LEN 16 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)
25 28
26 29
27/********************************************************************* 30/*********************************************************************
@@ -404,6 +407,4 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
404 unsigned int cpu); 407 unsigned int cpu);
405 408
406void cpufreq_frequency_table_put_attr(unsigned int cpu); 409void cpufreq_frequency_table_put_attr(unsigned int cpu);
407
408
409#endif /* _LINUX_CPUFREQ_H */ 410#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 279b1eaa8b7..3711b34dc4f 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -82,13 +82,6 @@ cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
82 st_usage->driver_data = data; 82 st_usage->driver_data = data;
83} 83}
84 84
85struct cpuidle_state_kobj {
86 struct cpuidle_state *state;
87 struct cpuidle_state_usage *state_usage;
88 struct completion kobj_unregister;
89 struct kobject kobj;
90};
91
92struct cpuidle_device { 85struct cpuidle_device {
93 unsigned int registered:1; 86 unsigned int registered:1;
94 unsigned int enabled:1; 87 unsigned int enabled:1;
@@ -98,7 +91,7 @@ struct cpuidle_device {
98 int state_count; 91 int state_count;
99 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 92 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
100 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 93 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
101 94 struct cpuidle_driver_kobj *kobj_driver;
102 struct list_head device_list; 95 struct list_head device_list;
103 struct kobject kobj; 96 struct kobject kobj;
104 struct completion kobj_unregister; 97 struct completion kobj_unregister;
@@ -131,6 +124,7 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
131struct cpuidle_driver { 124struct cpuidle_driver {
132 const char *name; 125 const char *name;
133 struct module *owner; 126 struct module *owner;
127 int refcnt;
134 128
135 unsigned int power_specified:1; 129 unsigned int power_specified:1;
136 /* set to 1 to use the core cpuidle time keeping (for all states). */ 130 /* set to 1 to use the core cpuidle time keeping (for all states). */
@@ -163,6 +157,10 @@ extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
163 struct cpuidle_driver *drv, int index)); 157 struct cpuidle_driver *drv, int index));
164extern int cpuidle_play_dead(void); 158extern int cpuidle_play_dead(void);
165 159
160extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
161extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu);
162extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu);
163
166#else 164#else
167static inline void disable_cpuidle(void) { } 165static inline void disable_cpuidle(void) { }
168static inline int cpuidle_idle_call(void) { return -ENODEV; } 166static inline int cpuidle_idle_call(void) { return -ENODEV; }
@@ -189,7 +187,6 @@ static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
189 struct cpuidle_driver *drv, int index)) 187 struct cpuidle_driver *drv, int index))
190{ return -ENODEV; } 188{ return -ENODEV; }
191static inline int cpuidle_play_dead(void) {return -ENODEV; } 189static inline int cpuidle_play_dead(void) {return -ENODEV; }
192
193#endif 190#endif
194 191
195#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 192#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 838320fc3d1..8c8a60d2940 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -144,7 +144,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
144 return node_possible_map; 144 return node_possible_map;
145} 145}
146 146
147#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) 147#define cpuset_current_mems_allowed (node_states[N_MEMORY])
148static inline void cpuset_init_current_mems_allowed(void) {} 148static inline void cpuset_init_current_mems_allowed(void) {}
149 149
150static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) 150static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index ebbed2ce663..abb2cd50f6b 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -77,21 +77,6 @@ extern int in_group_p(kgid_t);
77extern int in_egroup_p(kgid_t); 77extern int in_egroup_p(kgid_t);
78 78
79/* 79/*
80 * The common credentials for a thread group
81 * - shared by CLONE_THREAD
82 */
83#ifdef CONFIG_KEYS
84struct thread_group_cred {
85 atomic_t usage;
86 pid_t tgid; /* thread group process ID */
87 spinlock_t lock;
88 struct key __rcu *session_keyring; /* keyring inherited over fork */
89 struct key *process_keyring; /* keyring private to this process */
90 struct rcu_head rcu; /* RCU deletion hook */
91};
92#endif
93
94/*
95 * The security context of a task 80 * The security context of a task
96 * 81 *
97 * The parts of the context break down into two categories: 82 * The parts of the context break down into two categories:
@@ -139,6 +124,8 @@ struct cred {
139#ifdef CONFIG_KEYS 124#ifdef CONFIG_KEYS
140 unsigned char jit_keyring; /* default keyring to attach requested 125 unsigned char jit_keyring; /* default keyring to attach requested
141 * keys to */ 126 * keys to */
127 struct key __rcu *session_keyring; /* keyring inherited over fork */
128 struct key *process_keyring; /* keyring private to this process */
142 struct key *thread_keyring; /* keyring private to this thread */ 129 struct key *thread_keyring; /* keyring private to this thread */
143 struct key *request_key_auth; /* assumed request_key authority */ 130 struct key *request_key_auth; /* assumed request_key authority */
144 struct thread_group_cred *tgcred; /* thread-group shared credentials */ 131 struct thread_group_cred *tgcred; /* thread-group shared credentials */
@@ -357,10 +344,8 @@ static inline void put_cred(const struct cred *_cred)
357extern struct user_namespace init_user_ns; 344extern struct user_namespace init_user_ns;
358#ifdef CONFIG_USER_NS 345#ifdef CONFIG_USER_NS
359#define current_user_ns() (current_cred_xxx(user_ns)) 346#define current_user_ns() (current_cred_xxx(user_ns))
360#define task_user_ns(task) (task_cred_xxx((task), user_ns))
361#else 347#else
362#define current_user_ns() (&init_user_ns) 348#define current_user_ns() (&init_user_ns)
363#define task_user_ns(task) (&init_user_ns)
364#endif 349#endif
365 350
366 351
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 59200795482..c1754b59ddd 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -202,7 +202,6 @@ struct dentry_operations {
202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 202#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 203#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 204#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
205#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
206#define DCACHE_MANAGED_DENTRY \ 205#define DCACHE_MANAGED_DENTRY \
207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 206 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
208 207
@@ -408,13 +407,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
408 return dentry->d_flags & DCACHE_MOUNTED; 407 return dentry->d_flags & DCACHE_MOUNTED;
409} 408}
410 409
411static inline bool d_need_lookup(struct dentry *dentry)
412{
413 return dentry->d_flags & DCACHE_NEED_LOOKUP;
414}
415
416extern void d_clear_need_lookup(struct dentry *dentry);
417
418extern int sysctl_vfs_cache_pressure; 410extern int sysctl_vfs_cache_pressure;
419 411
420#endif /* __LINUX_DCACHE_H */ 412#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 281c72a3b9d..e83ef39b3be 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -25,12 +25,12 @@ struct devfreq;
25 * struct devfreq_dev_status - Data given from devfreq user device to 25 * struct devfreq_dev_status - Data given from devfreq user device to
26 * governors. Represents the performance 26 * governors. Represents the performance
27 * statistics. 27 * statistics.
28 * @total_time The total time represented by this instance of 28 * @total_time: The total time represented by this instance of
29 * devfreq_dev_status 29 * devfreq_dev_status
30 * @busy_time The time that the device was working among the 30 * @busy_time: The time that the device was working among the
31 * total_time. 31 * total_time.
32 * @current_frequency The operating frequency. 32 * @current_frequency: The operating frequency.
33 * @private_data An entry not specified by the devfreq framework. 33 * @private_data: An entry not specified by the devfreq framework.
34 * A device and a specific governor may have their 34 * A device and a specific governor may have their
35 * own protocol with private_data. However, because 35 * own protocol with private_data. However, because
36 * this is governor-specific, a governor using this 36 * this is governor-specific, a governor using this
@@ -54,23 +54,27 @@ struct devfreq_dev_status {
54 54
55/** 55/**
56 * struct devfreq_dev_profile - Devfreq's user device profile 56 * struct devfreq_dev_profile - Devfreq's user device profile
57 * @initial_freq The operating frequency when devfreq_add_device() is 57 * @initial_freq: The operating frequency when devfreq_add_device() is
58 * called. 58 * called.
59 * @polling_ms The polling interval in ms. 0 disables polling. 59 * @polling_ms: The polling interval in ms. 0 disables polling.
60 * @target The device should set its operating frequency at 60 * @target: The device should set its operating frequency at
61 * freq or lowest-upper-than-freq value. If freq is 61 * freq or lowest-upper-than-freq value. If freq is
62 * higher than any operable frequency, set maximum. 62 * higher than any operable frequency, set maximum.
63 * Before returning, target function should set 63 * Before returning, target function should set
64 * freq at the current frequency. 64 * freq at the current frequency.
65 * The "flags" parameter's possible values are 65 * The "flags" parameter's possible values are
66 * explained above with "DEVFREQ_FLAG_*" macros. 66 * explained above with "DEVFREQ_FLAG_*" macros.
67 * @get_dev_status The device should provide the current performance 67 * @get_dev_status: The device should provide the current performance
68 * status to devfreq, which is used by governors. 68 * status to devfreq, which is used by governors.
69 * @exit An optional callback that is called when devfreq 69 * @get_cur_freq: The device should provide the current frequency
70 * at which it is operating.
71 * @exit: An optional callback that is called when devfreq
70 * is removing the devfreq object due to error or 72 * is removing the devfreq object due to error or
71 * from devfreq_remove_device() call. If the user 73 * from devfreq_remove_device() call. If the user
72 * has registered devfreq->nb at a notifier-head, 74 * has registered devfreq->nb at a notifier-head,
73 * this is the time to unregister it. 75 * this is the time to unregister it.
76 * @freq_table: Optional list of frequencies to support statistics.
77 * @max_state: The size of freq_table.
74 */ 78 */
75struct devfreq_dev_profile { 79struct devfreq_dev_profile {
76 unsigned long initial_freq; 80 unsigned long initial_freq;
@@ -79,63 +83,63 @@ struct devfreq_dev_profile {
79 int (*target)(struct device *dev, unsigned long *freq, u32 flags); 83 int (*target)(struct device *dev, unsigned long *freq, u32 flags);
80 int (*get_dev_status)(struct device *dev, 84 int (*get_dev_status)(struct device *dev,
81 struct devfreq_dev_status *stat); 85 struct devfreq_dev_status *stat);
86 int (*get_cur_freq)(struct device *dev, unsigned long *freq);
82 void (*exit)(struct device *dev); 87 void (*exit)(struct device *dev);
88
89 unsigned int *freq_table;
90 unsigned int max_state;
83}; 91};
84 92
85/** 93/**
86 * struct devfreq_governor - Devfreq policy governor 94 * struct devfreq_governor - Devfreq policy governor
87 * @name Governor's name 95 * @node: list node - contains registered devfreq governors
88 * @get_target_freq Returns desired operating frequency for the device. 96 * @name: Governor's name
97 * @get_target_freq: Returns desired operating frequency for the device.
89 * Basically, get_target_freq will run 98 * Basically, get_target_freq will run
90 * devfreq_dev_profile.get_dev_status() to get the 99 * devfreq_dev_profile.get_dev_status() to get the
91 * status of the device (load = busy_time / total_time). 100 * status of the device (load = busy_time / total_time).
92 * If no_central_polling is set, this callback is called 101 * If no_central_polling is set, this callback is called
93 * only with update_devfreq() notified by OPP. 102 * only with update_devfreq() notified by OPP.
94 * @init Called when the devfreq is being attached to a device 103 * @event_handler: Callback for devfreq core framework to notify events
95 * @exit Called when the devfreq is being removed from a 104 * to governors. Events include per device governor
96 * device. Governor should stop any internal routines 105 * init and exit, opp changes out of devfreq, suspend
97 * before return because related data may be 106 * and resume of per device devfreq during device idle.
98 * freed after exit().
99 * @no_central_polling Do not use devfreq's central polling mechanism.
100 * When this is set, devfreq will not call
101 * get_target_freq with devfreq_monitor(). However,
102 * devfreq will call get_target_freq with
103 * devfreq_update() notified by OPP framework.
104 * 107 *
105 * Note that the callbacks are called with devfreq->lock locked by devfreq. 108 * Note that the callbacks are called with devfreq->lock locked by devfreq.
106 */ 109 */
107struct devfreq_governor { 110struct devfreq_governor {
111 struct list_head node;
112
108 const char name[DEVFREQ_NAME_LEN]; 113 const char name[DEVFREQ_NAME_LEN];
109 int (*get_target_freq)(struct devfreq *this, unsigned long *freq); 114 int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
110 int (*init)(struct devfreq *this); 115 int (*event_handler)(struct devfreq *devfreq,
111 void (*exit)(struct devfreq *this); 116 unsigned int event, void *data);
112 const bool no_central_polling;
113}; 117};
114 118
115/** 119/**
116 * struct devfreq - Device devfreq structure 120 * struct devfreq - Device devfreq structure
117 * @node list node - contains the devices with devfreq that have been 121 * @node: list node - contains the devices with devfreq that have been
118 * registered. 122 * registered.
119 * @lock a mutex to protect accessing devfreq. 123 * @lock: a mutex to protect accessing devfreq.
120 * @dev device registered by devfreq class. dev.parent is the device 124 * @dev: device registered by devfreq class. dev.parent is the device
121 * using devfreq. 125 * using devfreq.
122 * @profile device-specific devfreq profile 126 * @profile: device-specific devfreq profile
123 * @governor method how to choose frequency based on the usage. 127 * @governor: method how to choose frequency based on the usage.
124 * @nb notifier block used to notify devfreq object that it should 128 * @governor_name: devfreq governor name for use with this devfreq
129 * @nb: notifier block used to notify devfreq object that it should
125 * reevaluate operable frequencies. Devfreq users may use 130 * reevaluate operable frequencies. Devfreq users may use
126 * devfreq.nb to the corresponding register notifier call chain. 131 * devfreq.nb to the corresponding register notifier call chain.
127 * @polling_jiffies interval in jiffies. 132 * @work: delayed work for load monitoring.
128 * @previous_freq previously configured frequency value. 133 * @previous_freq: previously configured frequency value.
129 * @next_polling the number of remaining jiffies to poll with 134 * @data: Private data of the governor. The devfreq framework does not
130 * "devfreq_monitor" executions to reevaluate
131 * frequency/voltage of the device. Set by
132 * profile's polling_ms interval.
133 * @data Private data of the governor. The devfreq framework does not
134 * touch this. 135 * touch this.
135 * @being_removed a flag to mark that this object is being removed in 136 * @min_freq: Limit minimum frequency requested by user (0: none)
136 * order to prevent trying to remove the object multiple times. 137 * @max_freq: Limit maximum frequency requested by user (0: none)
137 * @min_freq Limit minimum frequency requested by user (0: none) 138 * @stop_polling: devfreq polling status of a device.
138 * @max_freq Limit maximum frequency requested by user (0: none) 139 * @total_trans: Number of devfreq transitions
140 * @trans_table: Statistics of devfreq transitions
141 * @time_in_state: Statistics of devfreq states
142 * @last_stat_updated: The last time stat updated
139 * 143 *
140 * This structure stores the devfreq information for a give device. 144 * This structure stores the devfreq information for a give device.
141 * 145 *
@@ -152,26 +156,33 @@ struct devfreq {
152 struct device dev; 156 struct device dev;
153 struct devfreq_dev_profile *profile; 157 struct devfreq_dev_profile *profile;
154 const struct devfreq_governor *governor; 158 const struct devfreq_governor *governor;
159 char governor_name[DEVFREQ_NAME_LEN];
155 struct notifier_block nb; 160 struct notifier_block nb;
161 struct delayed_work work;
156 162
157 unsigned long polling_jiffies;
158 unsigned long previous_freq; 163 unsigned long previous_freq;
159 unsigned int next_polling;
160 164
161 void *data; /* private data for governors */ 165 void *data; /* private data for governors */
162 166
163 bool being_removed;
164
165 unsigned long min_freq; 167 unsigned long min_freq;
166 unsigned long max_freq; 168 unsigned long max_freq;
169 bool stop_polling;
170
171 /* information for device freqeuncy transition */
172 unsigned int total_trans;
173 unsigned int *trans_table;
174 unsigned long *time_in_state;
175 unsigned long last_stat_updated;
167}; 176};
168 177
169#if defined(CONFIG_PM_DEVFREQ) 178#if defined(CONFIG_PM_DEVFREQ)
170extern struct devfreq *devfreq_add_device(struct device *dev, 179extern struct devfreq *devfreq_add_device(struct device *dev,
171 struct devfreq_dev_profile *profile, 180 struct devfreq_dev_profile *profile,
172 const struct devfreq_governor *governor, 181 const char *governor_name,
173 void *data); 182 void *data);
174extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184extern int devfreq_suspend_device(struct devfreq *devfreq);
185extern int devfreq_resume_device(struct devfreq *devfreq);
175 186
176/* Helper functions for devfreq user device driver with OPP. */ 187/* Helper functions for devfreq user device driver with OPP. */
177extern struct opp *devfreq_recommended_opp(struct device *dev, 188extern struct opp *devfreq_recommended_opp(struct device *dev,
@@ -181,23 +192,13 @@ extern int devfreq_register_opp_notifier(struct device *dev,
181extern int devfreq_unregister_opp_notifier(struct device *dev, 192extern int devfreq_unregister_opp_notifier(struct device *dev,
182 struct devfreq *devfreq); 193 struct devfreq *devfreq);
183 194
184#ifdef CONFIG_DEVFREQ_GOV_POWERSAVE 195#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
185extern const struct devfreq_governor devfreq_powersave;
186#endif
187#ifdef CONFIG_DEVFREQ_GOV_PERFORMANCE
188extern const struct devfreq_governor devfreq_performance;
189#endif
190#ifdef CONFIG_DEVFREQ_GOV_USERSPACE
191extern const struct devfreq_governor devfreq_userspace;
192#endif
193#ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
194extern const struct devfreq_governor devfreq_simple_ondemand;
195/** 196/**
196 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq 197 * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
197 * and devfreq_add_device 198 * and devfreq_add_device
198 * @ upthreshold If the load is over this value, the frequency jumps. 199 * @upthreshold: If the load is over this value, the frequency jumps.
199 * Specify 0 to use the default. Valid value = 0 to 100. 200 * Specify 0 to use the default. Valid value = 0 to 100.
200 * @ downdifferential If the load is under upthreshold - downdifferential, 201 * @downdifferential: If the load is under upthreshold - downdifferential,
201 * the governor may consider slowing the frequency down. 202 * the governor may consider slowing the frequency down.
202 * Specify 0 to use the default. Valid value = 0 to 100. 203 * Specify 0 to use the default. Valid value = 0 to 100.
203 * downdifferential < upthreshold must hold. 204 * downdifferential < upthreshold must hold.
@@ -214,7 +215,7 @@ struct devfreq_simple_ondemand_data {
214#else /* !CONFIG_PM_DEVFREQ */ 215#else /* !CONFIG_PM_DEVFREQ */
215static struct devfreq *devfreq_add_device(struct device *dev, 216static struct devfreq *devfreq_add_device(struct device *dev,
216 struct devfreq_dev_profile *profile, 217 struct devfreq_dev_profile *profile,
217 struct devfreq_governor *governor, 218 const char *governor_name,
218 void *data) 219 void *data)
219{ 220{
220 return NULL; 221 return NULL;
@@ -225,6 +226,16 @@ static int devfreq_remove_device(struct devfreq *devfreq)
225 return 0; 226 return 0;
226} 227}
227 228
229static int devfreq_suspend_device(struct devfreq *devfreq)
230{
231 return 0;
232}
233
234static int devfreq_resume_device(struct devfreq *devfreq)
235{
236 return 0;
237}
238
228static struct opp *devfreq_recommended_opp(struct device *dev, 239static struct opp *devfreq_recommended_opp(struct device *dev,
229 unsigned long *freq, u32 flags) 240 unsigned long *freq, u32 flags)
230{ 241{
@@ -243,11 +254,6 @@ static int devfreq_unregister_opp_notifier(struct device *dev,
243 return -EINVAL; 254 return -EINVAL;
244} 255}
245 256
246#define devfreq_powersave NULL
247#define devfreq_performance NULL
248#define devfreq_userspace NULL
249#define devfreq_simple_ondemand NULL
250
251#endif /* CONFIG_PM_DEVFREQ */ 257#endif /* CONFIG_PM_DEVFREQ */
252 258
253#endif /* __LINUX_DEVFREQ_H__ */ 259#endif /* __LINUX_DEVFREQ_H__ */
diff --git a/include/linux/device.h b/include/linux/device.h
index 86ef6ab553b..43dcda937dd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -190,6 +190,7 @@ extern struct klist *bus_get_device_klist(struct bus_type *bus);
190 * @mod_name: Used for built-in modules. 190 * @mod_name: Used for built-in modules.
191 * @suppress_bind_attrs: Disables bind/unbind via sysfs. 191 * @suppress_bind_attrs: Disables bind/unbind via sysfs.
192 * @of_match_table: The open firmware table. 192 * @of_match_table: The open firmware table.
193 * @acpi_match_table: The ACPI match table.
193 * @probe: Called to query the existence of a specific device, 194 * @probe: Called to query the existence of a specific device,
194 * whether this driver can work with it, and bind the driver 195 * whether this driver can work with it, and bind the driver
195 * to a specific device. 196 * to a specific device.
@@ -223,6 +224,7 @@ struct device_driver {
223 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 224 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
224 225
225 const struct of_device_id *of_match_table; 226 const struct of_device_id *of_match_table;
227 const struct acpi_device_id *acpi_match_table;
226 228
227 int (*probe) (struct device *dev); 229 int (*probe) (struct device *dev);
228 int (*remove) (struct device *dev); 230 int (*remove) (struct device *dev);
@@ -496,6 +498,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
496 char *buf); 498 char *buf);
497ssize_t device_store_int(struct device *dev, struct device_attribute *attr, 499ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
498 const char *buf, size_t count); 500 const char *buf, size_t count);
501ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
502 char *buf);
503ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
504 const char *buf, size_t count);
499 505
500#define DEVICE_ATTR(_name, _mode, _show, _store) \ 506#define DEVICE_ATTR(_name, _mode, _show, _store) \
501 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 507 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
@@ -505,6 +511,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
505#define DEVICE_INT_ATTR(_name, _mode, _var) \ 511#define DEVICE_INT_ATTR(_name, _mode, _var) \
506 struct dev_ext_attribute dev_attr_##_name = \ 512 struct dev_ext_attribute dev_attr_##_name = \
507 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } 513 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
514#define DEVICE_BOOL_ATTR(_name, _mode, _var) \
515 struct dev_ext_attribute dev_attr_##_name = \
516 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
508#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ 517#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
509 struct device_attribute dev_attr_##_name = \ 518 struct device_attribute dev_attr_##_name = \
510 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 519 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
@@ -576,6 +585,12 @@ struct device_dma_parameters {
576 unsigned long segment_boundary_mask; 585 unsigned long segment_boundary_mask;
577}; 586};
578 587
588struct acpi_dev_node {
589#ifdef CONFIG_ACPI
590 void *handle;
591#endif
592};
593
579/** 594/**
580 * struct device - The basic device structure 595 * struct device - The basic device structure
581 * @parent: The device's "parent" device, the device to which it is attached. 596 * @parent: The device's "parent" device, the device to which it is attached.
@@ -616,6 +631,7 @@ struct device_dma_parameters {
616 * @dma_mem: Internal for coherent mem override. 631 * @dma_mem: Internal for coherent mem override.
617 * @archdata: For arch-specific additions. 632 * @archdata: For arch-specific additions.
618 * @of_node: Associated device tree node. 633 * @of_node: Associated device tree node.
634 * @acpi_node: Associated ACPI device node.
619 * @devt: For creating the sysfs "dev". 635 * @devt: For creating the sysfs "dev".
620 * @id: device instance 636 * @id: device instance
621 * @devres_lock: Spinlock to protect the resource of the device. 637 * @devres_lock: Spinlock to protect the resource of the device.
@@ -680,6 +696,7 @@ struct device {
680 struct dev_archdata archdata; 696 struct dev_archdata archdata;
681 697
682 struct device_node *of_node; /* associated device tree node */ 698 struct device_node *of_node; /* associated device tree node */
699 struct acpi_dev_node acpi_node; /* associated ACPI device node */
683 700
684 dev_t devt; /* dev_t, creates the sysfs "dev" */ 701 dev_t devt; /* dev_t, creates the sysfs "dev" */
685 u32 id; /* device instance */ 702 u32 id; /* device instance */
@@ -700,6 +717,14 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
700 return container_of(kobj, struct device, kobj); 717 return container_of(kobj, struct device, kobj);
701} 718}
702 719
720#ifdef CONFIG_ACPI
721#define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
722#define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_)
723#else
724#define ACPI_HANDLE(dev) (NULL)
725#define ACPI_HANDLE_SET(dev, _handle_) do { } while (0)
726#endif
727
703/* Get the wakeup routines, which depend on struct device */ 728/* Get the wakeup routines, which depend on struct device */
704#include <linux/pm_wakeup.h> 729#include <linux/pm_wakeup.h>
705 730
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index 5ce0e5fd712..251a2090a55 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -20,28 +20,28 @@
20int devpts_new_index(struct inode *ptmx_inode); 20int devpts_new_index(struct inode *ptmx_inode);
21void devpts_kill_index(struct inode *ptmx_inode, int idx); 21void devpts_kill_index(struct inode *ptmx_inode, int idx);
22/* mknod in devpts */ 22/* mknod in devpts */
23int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty); 23struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index,
24/* get tty structure */ 24 void *priv);
25struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number); 25/* get private structure */
26void *devpts_get_priv(struct inode *pts_inode);
26/* unlink */ 27/* unlink */
27void devpts_pty_kill(struct tty_struct *tty); 28void devpts_pty_kill(struct inode *inode);
28 29
29#else 30#else
30 31
31/* Dummy stubs in the no-pty case */ 32/* Dummy stubs in the no-pty case */
32static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } 33static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
33static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } 34static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
34static inline int devpts_pty_new(struct inode *ptmx_inode, 35static inline struct inode *devpts_pty_new(struct inode *ptmx_inode,
35 struct tty_struct *tty) 36 dev_t device, int index, void *priv)
36{ 37{
37 return -EINVAL; 38 return ERR_PTR(-EINVAL);
38} 39}
39static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode, 40static inline void *devpts_get_priv(struct inode *pts_inode)
40 int number)
41{ 41{
42 return NULL; 42 return NULL;
43} 43}
44static inline void devpts_pty_kill(struct tty_struct *tty) { } 44static inline void devpts_pty_kill(struct inode *inode) { }
45 45
46#endif 46#endif
47 47
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 1d47dcce11e..d02da2c6fc1 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -98,7 +98,7 @@ int dlm_release_lockspace(dlm_lockspace_t *lockspace, int force);
98/* 98/*
99 * dlm_lock 99 * dlm_lock
100 * 100 *
101 * Make an asyncronous request to acquire or convert a lock on a named 101 * Make an asynchronous request to acquire or convert a lock on a named
102 * resource. 102 * resource.
103 * 103 *
104 * lockspace: context for the request 104 * lockspace: context for the request
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index f83f793223f..c8e1831d757 100644
--- a/include/linux/dma-attrs.h
+++ b/include/linux/dma-attrs.h
@@ -17,6 +17,7 @@ enum dma_attr {
17 DMA_ATTR_NON_CONSISTENT, 17 DMA_ATTR_NON_CONSISTENT,
18 DMA_ATTR_NO_KERNEL_MAPPING, 18 DMA_ATTR_NO_KERNEL_MAPPING,
19 DMA_ATTR_SKIP_CPU_SYNC, 19 DMA_ATTR_SKIP_CPU_SYNC,
20 DMA_ATTR_FORCE_CONTIGUOUS,
20 DMA_ATTR_MAX, 21 DMA_ATTR_MAX,
21}; 22};
22 23
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index eb48f3816df..bd2e52ccc4f 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -156,7 +156,6 @@ static inline void get_dma_buf(struct dma_buf *dmabuf)
156 get_file(dmabuf->file); 156 get_file(dmabuf->file);
157} 157}
158 158
159#ifdef CONFIG_DMA_SHARED_BUFFER
160struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 159struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
161 struct device *dev); 160 struct device *dev);
162void dma_buf_detach(struct dma_buf *dmabuf, 161void dma_buf_detach(struct dma_buf *dmabuf,
@@ -184,103 +183,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
184 unsigned long); 183 unsigned long);
185void *dma_buf_vmap(struct dma_buf *); 184void *dma_buf_vmap(struct dma_buf *);
186void dma_buf_vunmap(struct dma_buf *, void *vaddr); 185void dma_buf_vunmap(struct dma_buf *, void *vaddr);
187#else
188
189static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
190 struct device *dev)
191{
192 return ERR_PTR(-ENODEV);
193}
194
195static inline void dma_buf_detach(struct dma_buf *dmabuf,
196 struct dma_buf_attachment *dmabuf_attach)
197{
198 return;
199}
200
201static inline struct dma_buf *dma_buf_export(void *priv,
202 const struct dma_buf_ops *ops,
203 size_t size, int flags)
204{
205 return ERR_PTR(-ENODEV);
206}
207
208static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
209{
210 return -ENODEV;
211}
212
213static inline struct dma_buf *dma_buf_get(int fd)
214{
215 return ERR_PTR(-ENODEV);
216}
217
218static inline void dma_buf_put(struct dma_buf *dmabuf)
219{
220 return;
221}
222
223static inline struct sg_table *dma_buf_map_attachment(
224 struct dma_buf_attachment *attach, enum dma_data_direction write)
225{
226 return ERR_PTR(-ENODEV);
227}
228
229static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
230 struct sg_table *sg, enum dma_data_direction dir)
231{
232 return;
233}
234
235static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
236 size_t start, size_t len,
237 enum dma_data_direction dir)
238{
239 return -ENODEV;
240}
241
242static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
243 size_t start, size_t len,
244 enum dma_data_direction dir)
245{
246}
247
248static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
249 unsigned long pnum)
250{
251 return NULL;
252}
253
254static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
255 unsigned long pnum, void *vaddr)
256{
257}
258
259static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
260{
261 return NULL;
262}
263
264static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
265 unsigned long pnum, void *vaddr)
266{
267}
268
269static inline int dma_buf_mmap(struct dma_buf *dmabuf,
270 struct vm_area_struct *vma,
271 unsigned long pgoff)
272{
273 return -ENODEV;
274}
275
276static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
277{
278 return NULL;
279}
280
281static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
282{
283}
284#endif /* CONFIG_DMA_SHARED_BUFFER */
285 186
286#endif /* __DMA_BUF_H__ */ 187#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 2f303e4b7ed..01b5c84be82 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -68,7 +68,7 @@ struct device;
68extern struct cma *dma_contiguous_default_area; 68extern struct cma *dma_contiguous_default_area;
69 69
70void dma_contiguous_reserve(phys_addr_t addr_limit); 70void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, unsigned long size, 71int dma_declare_contiguous(struct device *dev, phys_addr_t size,
72 phys_addr_t base, phys_addr_t limit); 72 phys_addr_t base, phys_addr_t limit);
73 73
74struct page *dma_alloc_from_contiguous(struct device *dev, int count, 74struct page *dma_alloc_from_contiguous(struct device *dev, int count,
@@ -83,7 +83,7 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
83static inline void dma_contiguous_reserve(phys_addr_t limit) { } 83static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84 84
85static inline 85static inline
86int dma_declare_contiguous(struct device *dev, unsigned long size, 86int dma_declare_contiguous(struct device *dev, phys_addr_t size,
87 phys_addr_t base, phys_addr_t limit) 87 phys_addr_t base, phys_addr_t limit)
88{ 88{
89 return -ENOSYS; 89 return -ENOSYS;
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index 171ad8aedc8..fc0e34ce038 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -39,6 +39,8 @@ extern void debug_dma_map_page(struct device *dev, struct page *page,
39 int direction, dma_addr_t dma_addr, 39 int direction, dma_addr_t dma_addr,
40 bool map_single); 40 bool map_single);
41 41
42extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
43
42extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 44extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
43 size_t size, int direction, bool map_single); 45 size_t size, int direction, bool map_single);
44 46
@@ -105,6 +107,11 @@ static inline void debug_dma_map_page(struct device *dev, struct page *page,
105{ 107{
106} 108}
107 109
110static inline void debug_dma_mapping_error(struct device *dev,
111 dma_addr_t dma_addr)
112{
113}
114
108static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, 115static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
109 size_t size, int direction, 116 size_t size, int direction,
110 bool map_single) 117 bool map_single)
diff --git a/include/linux/dma/ipu-dma.h b/include/linux/dma/ipu-dma.h
new file mode 100644
index 00000000000..18031115c66
--- /dev/null
+++ b/include/linux/dma/ipu-dma.h
@@ -0,0 +1,177 @@
1/*
2 * Copyright (C) 2008
3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
4 *
5 * Copyright (C) 2005-2007 Freescale Semiconductor, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_DMA_IPU_DMA_H
13#define __LINUX_DMA_IPU_DMA_H
14
15#include <linux/types.h>
16#include <linux/dmaengine.h>
17
18/* IPU DMA Controller channel definitions. */
19enum ipu_channel {
20 IDMAC_IC_0 = 0, /* IC (encoding task) to memory */
21 IDMAC_IC_1 = 1, /* IC (viewfinder task) to memory */
22 IDMAC_ADC_0 = 1,
23 IDMAC_IC_2 = 2,
24 IDMAC_ADC_1 = 2,
25 IDMAC_IC_3 = 3,
26 IDMAC_IC_4 = 4,
27 IDMAC_IC_5 = 5,
28 IDMAC_IC_6 = 6,
29 IDMAC_IC_7 = 7, /* IC (sensor data) to memory */
30 IDMAC_IC_8 = 8,
31 IDMAC_IC_9 = 9,
32 IDMAC_IC_10 = 10,
33 IDMAC_IC_11 = 11,
34 IDMAC_IC_12 = 12,
35 IDMAC_IC_13 = 13,
36 IDMAC_SDC_0 = 14, /* Background synchronous display data */
37 IDMAC_SDC_1 = 15, /* Foreground data (overlay) */
38 IDMAC_SDC_2 = 16,
39 IDMAC_SDC_3 = 17,
40 IDMAC_ADC_2 = 18,
41 IDMAC_ADC_3 = 19,
42 IDMAC_ADC_4 = 20,
43 IDMAC_ADC_5 = 21,
44 IDMAC_ADC_6 = 22,
45 IDMAC_ADC_7 = 23,
46 IDMAC_PF_0 = 24,
47 IDMAC_PF_1 = 25,
48 IDMAC_PF_2 = 26,
49 IDMAC_PF_3 = 27,
50 IDMAC_PF_4 = 28,
51 IDMAC_PF_5 = 29,
52 IDMAC_PF_6 = 30,
53 IDMAC_PF_7 = 31,
54};
55
56/* Order significant! */
57enum ipu_channel_status {
58 IPU_CHANNEL_FREE,
59 IPU_CHANNEL_INITIALIZED,
60 IPU_CHANNEL_READY,
61 IPU_CHANNEL_ENABLED,
62};
63
64#define IPU_CHANNELS_NUM 32
65
66enum pixel_fmt {
67 /* 1 byte */
68 IPU_PIX_FMT_GENERIC,
69 IPU_PIX_FMT_RGB332,
70 IPU_PIX_FMT_YUV420P,
71 IPU_PIX_FMT_YUV422P,
72 IPU_PIX_FMT_YUV420P2,
73 IPU_PIX_FMT_YVU422P,
74 /* 2 bytes */
75 IPU_PIX_FMT_RGB565,
76 IPU_PIX_FMT_RGB666,
77 IPU_PIX_FMT_BGR666,
78 IPU_PIX_FMT_YUYV,
79 IPU_PIX_FMT_UYVY,
80 /* 3 bytes */
81 IPU_PIX_FMT_RGB24,
82 IPU_PIX_FMT_BGR24,
83 /* 4 bytes */
84 IPU_PIX_FMT_GENERIC_32,
85 IPU_PIX_FMT_RGB32,
86 IPU_PIX_FMT_BGR32,
87 IPU_PIX_FMT_ABGR32,
88 IPU_PIX_FMT_BGRA32,
89 IPU_PIX_FMT_RGBA32,
90};
91
92enum ipu_color_space {
93 IPU_COLORSPACE_RGB,
94 IPU_COLORSPACE_YCBCR,
95 IPU_COLORSPACE_YUV
96};
97
98/*
99 * Enumeration of IPU rotation modes
100 */
101enum ipu_rotate_mode {
102 /* Note the enum values correspond to BAM value */
103 IPU_ROTATE_NONE = 0,
104 IPU_ROTATE_VERT_FLIP = 1,
105 IPU_ROTATE_HORIZ_FLIP = 2,
106 IPU_ROTATE_180 = 3,
107 IPU_ROTATE_90_RIGHT = 4,
108 IPU_ROTATE_90_RIGHT_VFLIP = 5,
109 IPU_ROTATE_90_RIGHT_HFLIP = 6,
110 IPU_ROTATE_90_LEFT = 7,
111};
112
113/*
114 * Enumeration of DI ports for ADC.
115 */
116enum display_port {
117 DISP0,
118 DISP1,
119 DISP2,
120 DISP3
121};
122
123struct idmac_video_param {
124 unsigned short in_width;
125 unsigned short in_height;
126 uint32_t in_pixel_fmt;
127 unsigned short out_width;
128 unsigned short out_height;
129 uint32_t out_pixel_fmt;
130 unsigned short out_stride;
131 bool graphics_combine_en;
132 bool global_alpha_en;
133 bool key_color_en;
134 enum display_port disp;
135 unsigned short out_left;
136 unsigned short out_top;
137};
138
139/*
140 * Union of initialization parameters for a logical channel. So far only video
141 * parameters are used.
142 */
143union ipu_channel_param {
144 struct idmac_video_param video;
145};
146
147struct idmac_tx_desc {
148 struct dma_async_tx_descriptor txd;
149 struct scatterlist *sg; /* scatterlist for this */
150 unsigned int sg_len; /* tx-descriptor. */
151 struct list_head list;
152};
153
154struct idmac_channel {
155 struct dma_chan dma_chan;
156 dma_cookie_t completed; /* last completed cookie */
157 union ipu_channel_param params;
158 enum ipu_channel link; /* input channel, linked to the output */
159 enum ipu_channel_status status;
160 void *client; /* Only one client per channel */
161 unsigned int n_tx_desc;
162 struct idmac_tx_desc *desc; /* allocated tx-descriptors */
163 struct scatterlist *sg[2]; /* scatterlist elements in buffer-0 and -1 */
164 struct list_head free_list; /* free tx-descriptors */
165 struct list_head queue; /* queued tx-descriptors */
166 spinlock_t lock; /* protects sg[0,1], queue */
167 struct mutex chan_mutex; /* protects status, cookie, free_list */
168 bool sec_chan_en;
169 int active_buffer;
170 unsigned int eof_irq;
171 char eof_name[16]; /* EOF IRQ name for request_irq() */
172};
173
174#define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd)
175#define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan)
176
177#endif /* __LINUX_DMA_IPU_DMA_H */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 47e3d485058..0c5a18ec322 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -51,12 +51,11 @@
51 51
52#endif 52#endif
53 53
54
55extern const char *drbd_buildtag(void); 54extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.13" 55#define REL_VERSION "8.4.2"
57#define API_VERSION 88 56#define API_VERSION 1
58#define PRO_VERSION_MIN 86 57#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 96 58#define PRO_VERSION_MAX 101
60 59
61 60
62enum drbd_io_error_p { 61enum drbd_io_error_p {
@@ -66,7 +65,8 @@ enum drbd_io_error_p {
66}; 65};
67 66
68enum drbd_fencing_p { 67enum drbd_fencing_p {
69 FP_DONT_CARE, 68 FP_NOT_AVAIL = -1, /* Not a policy */
69 FP_DONT_CARE = 0,
70 FP_RESOURCE, 70 FP_RESOURCE,
71 FP_STONITH 71 FP_STONITH
72}; 72};
@@ -102,6 +102,20 @@ enum drbd_on_congestion {
102 OC_DISCONNECT, 102 OC_DISCONNECT,
103}; 103};
104 104
105enum drbd_read_balancing {
106 RB_PREFER_LOCAL,
107 RB_PREFER_REMOTE,
108 RB_ROUND_ROBIN,
109 RB_LEAST_PENDING,
110 RB_CONGESTED_REMOTE,
111 RB_32K_STRIPING,
112 RB_64K_STRIPING,
113 RB_128K_STRIPING,
114 RB_256K_STRIPING,
115 RB_512K_STRIPING,
116 RB_1M_STRIPING,
117};
118
105/* KEEP the order, do not delete or insert. Only append. */ 119/* KEEP the order, do not delete or insert. Only append. */
106enum drbd_ret_code { 120enum drbd_ret_code {
107 ERR_CODE_BASE = 100, 121 ERR_CODE_BASE = 100,
@@ -122,7 +136,7 @@ enum drbd_ret_code {
122 ERR_AUTH_ALG = 120, 136 ERR_AUTH_ALG = 120,
123 ERR_AUTH_ALG_ND = 121, 137 ERR_AUTH_ALG_ND = 121,
124 ERR_NOMEM = 122, 138 ERR_NOMEM = 122,
125 ERR_DISCARD = 123, 139 ERR_DISCARD_IMPOSSIBLE = 123,
126 ERR_DISK_CONFIGURED = 124, 140 ERR_DISK_CONFIGURED = 124,
127 ERR_NET_CONFIGURED = 125, 141 ERR_NET_CONFIGURED = 125,
128 ERR_MANDATORY_TAG = 126, 142 ERR_MANDATORY_TAG = 126,
@@ -130,8 +144,8 @@ enum drbd_ret_code {
130 ERR_INTR = 129, /* EINTR */ 144 ERR_INTR = 129, /* EINTR */
131 ERR_RESIZE_RESYNC = 130, 145 ERR_RESIZE_RESYNC = 130,
132 ERR_NO_PRIMARY = 131, 146 ERR_NO_PRIMARY = 131,
133 ERR_SYNC_AFTER = 132, 147 ERR_RESYNC_AFTER = 132,
134 ERR_SYNC_AFTER_CYCLE = 133, 148 ERR_RESYNC_AFTER_CYCLE = 133,
135 ERR_PAUSE_IS_SET = 134, 149 ERR_PAUSE_IS_SET = 134,
136 ERR_PAUSE_IS_CLEAR = 135, 150 ERR_PAUSE_IS_CLEAR = 135,
137 ERR_PACKET_NR = 137, 151 ERR_PACKET_NR = 137,
@@ -155,6 +169,14 @@ enum drbd_ret_code {
155 ERR_CONG_NOT_PROTO_A = 155, 169 ERR_CONG_NOT_PROTO_A = 155,
156 ERR_PIC_AFTER_DEP = 156, 170 ERR_PIC_AFTER_DEP = 156,
157 ERR_PIC_PEER_DEP = 157, 171 ERR_PIC_PEER_DEP = 157,
172 ERR_RES_NOT_KNOWN = 158,
173 ERR_RES_IN_USE = 159,
174 ERR_MINOR_CONFIGURED = 160,
175 ERR_MINOR_EXISTS = 161,
176 ERR_INVALID_REQUEST = 162,
177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165,
158 180
159 /* insert new ones above this line */ 181 /* insert new ones above this line */
160 AFTER_LAST_ERR_CODE 182 AFTER_LAST_ERR_CODE
@@ -296,7 +318,8 @@ enum drbd_state_rv {
296 SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */ 318 SS_NOT_SUPPORTED = -17, /* drbd-8.2 only */
297 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */ 319 SS_IN_TRANSIENT_STATE = -18, /* Retry after the next state change */
298 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */ 320 SS_CONCURRENT_ST_CHG = -19, /* Concurrent cluster side state change! */
299 SS_AFTER_LAST_ERROR = -20, /* Keep this at bottom */ 321 SS_O_VOL_PEER_PRI = -20,
322 SS_AFTER_LAST_ERROR = -21, /* Keep this at bottom */
300}; 323};
301 324
302/* from drbd_strings.c */ 325/* from drbd_strings.c */
@@ -313,7 +336,9 @@ extern const char *drbd_set_st_err_str(enum drbd_state_rv);
313#define MDF_FULL_SYNC (1 << 3) 336#define MDF_FULL_SYNC (1 << 3)
314#define MDF_WAS_UP_TO_DATE (1 << 4) 337#define MDF_WAS_UP_TO_DATE (1 << 4)
315#define MDF_PEER_OUT_DATED (1 << 5) 338#define MDF_PEER_OUT_DATED (1 << 5)
316#define MDF_CRASHED_PRIMARY (1 << 6) 339#define MDF_CRASHED_PRIMARY (1 << 6)
340#define MDF_AL_CLEAN (1 << 7)
341#define MDF_AL_DISABLED (1 << 8)
317 342
318enum drbd_uuid_index { 343enum drbd_uuid_index {
319 UI_CURRENT, 344 UI_CURRENT,
@@ -333,37 +358,23 @@ enum drbd_timeout_flag {
333 358
334#define UUID_JUST_CREATED ((__u64)4) 359#define UUID_JUST_CREATED ((__u64)4)
335 360
361/* magic numbers used in meta data and network packets */
336#define DRBD_MAGIC 0x83740267 362#define DRBD_MAGIC 0x83740267
337#define BE_DRBD_MAGIC __constant_cpu_to_be32(DRBD_MAGIC)
338#define DRBD_MAGIC_BIG 0x835a 363#define DRBD_MAGIC_BIG 0x835a
339#define BE_DRBD_MAGIC_BIG __constant_cpu_to_be16(DRBD_MAGIC_BIG) 364#define DRBD_MAGIC_100 0x8620ec20
365
366#define DRBD_MD_MAGIC_07 (DRBD_MAGIC+3)
367#define DRBD_MD_MAGIC_08 (DRBD_MAGIC+4)
368#define DRBD_MD_MAGIC_84_UNCLEAN (DRBD_MAGIC+5)
369
370
371/* how I came up with this magic?
372 * base64 decode "actlog==" ;) */
373#define DRBD_AL_MAGIC 0x69cb65a2
340 374
341/* these are of type "int" */ 375/* these are of type "int" */
342#define DRBD_MD_INDEX_INTERNAL -1 376#define DRBD_MD_INDEX_INTERNAL -1
343#define DRBD_MD_INDEX_FLEX_EXT -2 377#define DRBD_MD_INDEX_FLEX_EXT -2
344#define DRBD_MD_INDEX_FLEX_INT -3 378#define DRBD_MD_INDEX_FLEX_INT -3
345 379
346/* Start of the new netlink/connector stuff */
347
348#define DRBD_NL_CREATE_DEVICE 0x01
349#define DRBD_NL_SET_DEFAULTS 0x02
350
351
352/* For searching a vacant cn_idx value */
353#define CN_IDX_STEP 6977
354
355struct drbd_nl_cfg_req {
356 int packet_type;
357 unsigned int drbd_minor;
358 int flags;
359 unsigned short tag_list[];
360};
361
362struct drbd_nl_cfg_reply {
363 int packet_type;
364 unsigned int minor;
365 int ret_code; /* enum ret_code or set_st_err_t */
366 unsigned short tag_list[]; /* only used with get_* calls */
367};
368
369#endif 380#endif
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
new file mode 100644
index 00000000000..d0d8fac8a6e
--- /dev/null
+++ b/include/linux/drbd_genl.h
@@ -0,0 +1,378 @@
1/*
2 * General overview:
3 * full generic netlink message:
4 * |nlmsghdr|genlmsghdr|<payload>
5 *
6 * payload:
7 * |optional fixed size family header|<sequence of netlink attributes>
8 *
9 * sequence of netlink attributes:
10 * I chose to have all "top level" attributes NLA_NESTED,
11 * corresponding to some real struct.
12 * So we have a sequence of |tla, len|<nested nla sequence>
13 *
14 * nested nla sequence:
15 * may be empty, or contain a sequence of netlink attributes
16 * representing the struct fields.
17 *
18 * The tag number of any field (regardless of containing struct)
19 * will be available as T_ ## field_name,
20 * so you cannot have the same field name in two differnt structs.
21 *
22 * The tag numbers themselves are per struct, though,
23 * so should always begin at 1 (not 0, that is the special "NLA_UNSPEC" type,
24 * which we won't use here).
25 * The tag numbers are used as index in the respective nla_policy array.
26 *
27 * GENL_struct(tag_name, tag_number, struct name, struct fields) - struct and policy
28 * genl_magic_struct.h
29 * generates the struct declaration,
30 * generates an entry in the tla enum,
31 * genl_magic_func.h
32 * generates an entry in the static tla policy
33 * with .type = NLA_NESTED
34 * generates the static <struct_name>_nl_policy definition,
35 * and static conversion functions
36 *
37 * genl_magic_func.h
38 *
39 * GENL_mc_group(group)
40 * genl_magic_struct.h
41 * does nothing
42 * genl_magic_func.h
43 * defines and registers the mcast group,
44 * and provides a send helper
45 *
46 * GENL_notification(op_name, op_num, mcast_group, tla list)
47 * These are notifications to userspace.
48 *
49 * genl_magic_struct.h
50 * generates an entry in the genl_ops enum,
51 * genl_magic_func.h
52 * does nothing
53 *
54 * mcast group: the name of the mcast group this notification should be
55 * expected on
56 * tla list: the list of expected top level attributes,
57 * for documentation and sanity checking.
58 *
59 * GENL_op(op_name, op_num, flags and handler, tla list) - "genl operations"
60 * These are requests from userspace.
61 *
62 * _op and _notification share the same "number space",
63 * op_nr will be assigned to "genlmsghdr->cmd"
64 *
65 * genl_magic_struct.h
66 * generates an entry in the genl_ops enum,
67 * genl_magic_func.h
68 * generates an entry in the static genl_ops array,
69 * and static register/unregister functions to
70 * genl_register_family_with_ops().
71 *
72 * flags and handler:
73 * GENL_op_init( .doit = x, .dumpit = y, .flags = something)
74 * GENL_doit(x) => .dumpit = NULL, .flags = GENL_ADMIN_PERM
75 * tla list: the list of expected top level attributes,
76 * for documentation and sanity checking.
77 */
78
79/*
80 * STRUCTS
81 */
82
83/* this is sent kernel -> userland on various error conditions, and contains
84 * informational textual info, which is supposedly human readable.
85 * The computer relevant return code is in the drbd_genlmsghdr.
86 */
87GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply,
88 /* "arbitrary" size strings, nla_policy.len = 0 */
89 __str_field(1, DRBD_GENLA_F_MANDATORY, info_text, 0)
90)
91
92/* Configuration requests typically need a context to operate on.
93 * Possible keys are device minor (fits in the drbd_genlmsghdr),
94 * the replication link (aka connection) name,
95 * and/or the replication group (aka resource) name,
96 * and the volume id within the resource. */
97GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
98 __u32_field(1, DRBD_GENLA_F_MANDATORY, ctx_volume)
99 __str_field(2, DRBD_GENLA_F_MANDATORY, ctx_resource_name, 128)
100 __bin_field(3, DRBD_GENLA_F_MANDATORY, ctx_my_addr, 128)
101 __bin_field(4, DRBD_GENLA_F_MANDATORY, ctx_peer_addr, 128)
102)
103
104GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
105 __str_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, backing_dev, 128)
106 __str_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev, 128)
107 __s32_field(3, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev_idx)
108
109 /* use the resize command to try and change the disk_size */
110 __u64_field(4, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, disk_size)
111 /* we could change the max_bio_bvecs,
112 * but it won't propagate through the stack */
113 __u32_field(5, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, max_bio_bvecs)
114
115 __u32_field_def(6, DRBD_GENLA_F_MANDATORY, on_io_error, DRBD_ON_IO_ERROR_DEF)
116 __u32_field_def(7, DRBD_GENLA_F_MANDATORY, fencing, DRBD_FENCING_DEF)
117
118 __u32_field_def(8, DRBD_GENLA_F_MANDATORY, resync_rate, DRBD_RESYNC_RATE_DEF)
119 __s32_field_def(9, DRBD_GENLA_F_MANDATORY, resync_after, DRBD_MINOR_NUMBER_DEF)
120 __u32_field_def(10, DRBD_GENLA_F_MANDATORY, al_extents, DRBD_AL_EXTENTS_DEF)
121 __u32_field_def(11, DRBD_GENLA_F_MANDATORY, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF)
122 __u32_field_def(12, DRBD_GENLA_F_MANDATORY, c_delay_target, DRBD_C_DELAY_TARGET_DEF)
123 __u32_field_def(13, DRBD_GENLA_F_MANDATORY, c_fill_target, DRBD_C_FILL_TARGET_DEF)
124 __u32_field_def(14, DRBD_GENLA_F_MANDATORY, c_max_rate, DRBD_C_MAX_RATE_DEF)
125 __u32_field_def(15, DRBD_GENLA_F_MANDATORY, c_min_rate, DRBD_C_MIN_RATE_DEF)
126
127 __flg_field_def(16, DRBD_GENLA_F_MANDATORY, disk_barrier, DRBD_DISK_BARRIER_DEF)
128 __flg_field_def(17, DRBD_GENLA_F_MANDATORY, disk_flushes, DRBD_DISK_FLUSHES_DEF)
129 __flg_field_def(18, DRBD_GENLA_F_MANDATORY, disk_drain, DRBD_DISK_DRAIN_DEF)
130 __flg_field_def(19, DRBD_GENLA_F_MANDATORY, md_flushes, DRBD_MD_FLUSHES_DEF)
131 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, disk_timeout, DRBD_DISK_TIMEOUT_DEF)
132 __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF)
133 /* 9: __u32_field_def(22, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF) */
134 __flg_field_def(23, 0 /* OPTIONAL */, al_updates, DRBD_AL_UPDATES_DEF)
135)
136
137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32)
139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
140)
141
142GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
143 __str_field_def(1, DRBD_GENLA_F_MANDATORY | DRBD_F_SENSITIVE,
144 shared_secret, SHARED_SECRET_MAX)
145 __str_field_def(2, DRBD_GENLA_F_MANDATORY, cram_hmac_alg, SHARED_SECRET_MAX)
146 __str_field_def(3, DRBD_GENLA_F_MANDATORY, integrity_alg, SHARED_SECRET_MAX)
147 __str_field_def(4, DRBD_GENLA_F_MANDATORY, verify_alg, SHARED_SECRET_MAX)
148 __str_field_def(5, DRBD_GENLA_F_MANDATORY, csums_alg, SHARED_SECRET_MAX)
149 __u32_field_def(6, DRBD_GENLA_F_MANDATORY, wire_protocol, DRBD_PROTOCOL_DEF)
150 __u32_field_def(7, DRBD_GENLA_F_MANDATORY, connect_int, DRBD_CONNECT_INT_DEF)
151 __u32_field_def(8, DRBD_GENLA_F_MANDATORY, timeout, DRBD_TIMEOUT_DEF)
152 __u32_field_def(9, DRBD_GENLA_F_MANDATORY, ping_int, DRBD_PING_INT_DEF)
153 __u32_field_def(10, DRBD_GENLA_F_MANDATORY, ping_timeo, DRBD_PING_TIMEO_DEF)
154 __u32_field_def(11, DRBD_GENLA_F_MANDATORY, sndbuf_size, DRBD_SNDBUF_SIZE_DEF)
155 __u32_field_def(12, DRBD_GENLA_F_MANDATORY, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF)
156 __u32_field_def(13, DRBD_GENLA_F_MANDATORY, ko_count, DRBD_KO_COUNT_DEF)
157 __u32_field_def(14, DRBD_GENLA_F_MANDATORY, max_buffers, DRBD_MAX_BUFFERS_DEF)
158 __u32_field_def(15, DRBD_GENLA_F_MANDATORY, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF)
159 __u32_field_def(16, DRBD_GENLA_F_MANDATORY, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF)
160 __u32_field_def(17, DRBD_GENLA_F_MANDATORY, after_sb_0p, DRBD_AFTER_SB_0P_DEF)
161 __u32_field_def(18, DRBD_GENLA_F_MANDATORY, after_sb_1p, DRBD_AFTER_SB_1P_DEF)
162 __u32_field_def(19, DRBD_GENLA_F_MANDATORY, after_sb_2p, DRBD_AFTER_SB_2P_DEF)
163 __u32_field_def(20, DRBD_GENLA_F_MANDATORY, rr_conflict, DRBD_RR_CONFLICT_DEF)
164 __u32_field_def(21, DRBD_GENLA_F_MANDATORY, on_congestion, DRBD_ON_CONGESTION_DEF)
165 __u32_field_def(22, DRBD_GENLA_F_MANDATORY, cong_fill, DRBD_CONG_FILL_DEF)
166 __u32_field_def(23, DRBD_GENLA_F_MANDATORY, cong_extents, DRBD_CONG_EXTENTS_DEF)
167 __flg_field_def(24, DRBD_GENLA_F_MANDATORY, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF)
168 __flg_field(25, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, discard_my_data)
169 __flg_field_def(26, DRBD_GENLA_F_MANDATORY, tcp_cork, DRBD_TCP_CORK_DEF)
170 __flg_field_def(27, DRBD_GENLA_F_MANDATORY, always_asbp, DRBD_ALWAYS_ASBP_DEF)
171 __flg_field(28, DRBD_GENLA_F_MANDATORY | DRBD_F_INVARIANT, tentative)
172 __flg_field_def(29, DRBD_GENLA_F_MANDATORY, use_rle, DRBD_USE_RLE_DEF)
173 /* 9: __u32_field_def(30, DRBD_GENLA_F_MANDATORY, fencing_policy, DRBD_FENCING_DEF) */
174)
175
176GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
177 __flg_field(1, DRBD_GENLA_F_MANDATORY, assume_uptodate)
178)
179
180GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184)
185
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
187 /* the reason of the broadcast,
188 * if this is an event triggered broadcast. */
189 __u32_field(1, DRBD_GENLA_F_MANDATORY, sib_reason)
190 __u32_field(2, DRBD_F_REQUIRED, current_state)
191 __u64_field(3, DRBD_GENLA_F_MANDATORY, capacity)
192 __u64_field(4, DRBD_GENLA_F_MANDATORY, ed_uuid)
193
194 /* These are for broadcast from after state change work.
195 * prev_state and new_state are from the moment the state change took
196 * place, new_state is not neccessarily the same as current_state,
197 * there may have been more state changes since. Which will be
198 * broadcasted soon, in their respective after state change work. */
199 __u32_field(5, DRBD_GENLA_F_MANDATORY, prev_state)
200 __u32_field(6, DRBD_GENLA_F_MANDATORY, new_state)
201
202 /* if we have a local disk: */
203 __bin_field(7, DRBD_GENLA_F_MANDATORY, uuids, (UI_SIZE*sizeof(__u64)))
204 __u32_field(8, DRBD_GENLA_F_MANDATORY, disk_flags)
205 __u64_field(9, DRBD_GENLA_F_MANDATORY, bits_total)
206 __u64_field(10, DRBD_GENLA_F_MANDATORY, bits_oos)
207 /* and in case resync or online verify is active */
208 __u64_field(11, DRBD_GENLA_F_MANDATORY, bits_rs_total)
209 __u64_field(12, DRBD_GENLA_F_MANDATORY, bits_rs_failed)
210
211 /* for pre and post notifications of helper execution */
212 __str_field(13, DRBD_GENLA_F_MANDATORY, helper, 32)
213 __u32_field(14, DRBD_GENLA_F_MANDATORY, helper_exit_code)
214
215 __u64_field(15, 0, send_cnt)
216 __u64_field(16, 0, recv_cnt)
217 __u64_field(17, 0, read_cnt)
218 __u64_field(18, 0, writ_cnt)
219 __u64_field(19, 0, al_writ_cnt)
220 __u64_field(20, 0, bm_writ_cnt)
221 __u32_field(21, 0, ap_bio_cnt)
222 __u32_field(22, 0, ap_pending_cnt)
223 __u32_field(23, 0, rs_pending_cnt)
224)
225
226GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms,
227 __u64_field(1, DRBD_GENLA_F_MANDATORY, ov_start_sector)
228 __u64_field(2, DRBD_GENLA_F_MANDATORY, ov_stop_sector)
229)
230
231GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
232 __flg_field(1, DRBD_GENLA_F_MANDATORY, clear_bm)
233)
234
235GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,
236 __u32_field(1, DRBD_F_REQUIRED, timeout_type)
237)
238
239GENL_struct(DRBD_NLA_DISCONNECT_PARMS, 12, disconnect_parms,
240 __flg_field(1, DRBD_GENLA_F_MANDATORY, force_disconnect)
241)
242
243GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms,
244 __flg_field(1, DRBD_GENLA_F_MANDATORY, force_detach)
245)
246
247/*
248 * Notifications and commands (genlmsghdr->cmd)
249 */
250GENL_mc_group(events)
251
252 /* kernel -> userspace announcement of changes */
253GENL_notification(
254 DRBD_EVENT, 1, events,
255 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
256 GENL_tla_expected(DRBD_NLA_STATE_INFO, DRBD_F_REQUIRED)
257 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_GENLA_F_MANDATORY)
258 GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_GENLA_F_MANDATORY)
259 GENL_tla_expected(DRBD_NLA_SYNCER_CONF, DRBD_GENLA_F_MANDATORY)
260)
261
262 /* query kernel for specific or all info */
263GENL_op(
264 DRBD_ADM_GET_STATUS, 2,
265 GENL_op_init(
266 .doit = drbd_adm_get_status,
267 .dumpit = drbd_adm_get_status_all,
268 /* anyone may ask for the status,
269 * it is broadcasted anyways */
270 ),
271 /* To select the object .doit.
272 * Or a subset of objects in .dumpit. */
273 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_GENLA_F_MANDATORY)
274)
275
276 /* add DRBD minor devices as volumes to resources */
277GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_add_minor),
278 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
279GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_delete_minor),
280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
281
282 /* add or delete resources */
283GENL_op(DRBD_ADM_NEW_RESOURCE, 7, GENL_doit(drbd_adm_new_resource),
284 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
285GENL_op(DRBD_ADM_DEL_RESOURCE, 8, GENL_doit(drbd_adm_del_resource),
286 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
287
288GENL_op(DRBD_ADM_RESOURCE_OPTS, 9,
289 GENL_doit(drbd_adm_resource_opts),
290 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
291 GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, DRBD_GENLA_F_MANDATORY)
292)
293
294GENL_op(
295 DRBD_ADM_CONNECT, 10,
296 GENL_doit(drbd_adm_connect),
297 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
298 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
299)
300
301GENL_op(
302 DRBD_ADM_CHG_NET_OPTS, 29,
303 GENL_doit(drbd_adm_net_opts),
304 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
305 GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
306)
307
308GENL_op(DRBD_ADM_DISCONNECT, 11, GENL_doit(drbd_adm_disconnect),
309 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
310
311GENL_op(DRBD_ADM_ATTACH, 12,
312 GENL_doit(drbd_adm_attach),
313 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
314 GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_F_REQUIRED)
315)
316
317GENL_op(DRBD_ADM_CHG_DISK_OPTS, 28,
318 GENL_doit(drbd_adm_disk_opts),
319 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
320 GENL_tla_expected(DRBD_NLA_DISK_OPTS, DRBD_F_REQUIRED)
321)
322
323GENL_op(
324 DRBD_ADM_RESIZE, 13,
325 GENL_doit(drbd_adm_resize),
326 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
327 GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, DRBD_GENLA_F_MANDATORY)
328)
329
330GENL_op(
331 DRBD_ADM_PRIMARY, 14,
332 GENL_doit(drbd_adm_set_role),
333 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
334 GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
335)
336
337GENL_op(
338 DRBD_ADM_SECONDARY, 15,
339 GENL_doit(drbd_adm_set_role),
340 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
341 GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
342)
343
344GENL_op(
345 DRBD_ADM_NEW_C_UUID, 16,
346 GENL_doit(drbd_adm_new_c_uuid),
347 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
348 GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, DRBD_GENLA_F_MANDATORY)
349)
350
351GENL_op(
352 DRBD_ADM_START_OV, 17,
353 GENL_doit(drbd_adm_start_ov),
354 GENL_tla_expected(DRBD_NLA_START_OV_PARMS, DRBD_GENLA_F_MANDATORY)
355)
356
357GENL_op(DRBD_ADM_DETACH, 18, GENL_doit(drbd_adm_detach),
358 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
359 GENL_tla_expected(DRBD_NLA_DETACH_PARMS, DRBD_GENLA_F_MANDATORY))
360
361GENL_op(DRBD_ADM_INVALIDATE, 19, GENL_doit(drbd_adm_invalidate),
362 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
363GENL_op(DRBD_ADM_INVAL_PEER, 20, GENL_doit(drbd_adm_invalidate_peer),
364 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
365GENL_op(DRBD_ADM_PAUSE_SYNC, 21, GENL_doit(drbd_adm_pause_sync),
366 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
367GENL_op(DRBD_ADM_RESUME_SYNC, 22, GENL_doit(drbd_adm_resume_sync),
368 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
369GENL_op(DRBD_ADM_SUSPEND_IO, 23, GENL_doit(drbd_adm_suspend_io),
370 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
371GENL_op(DRBD_ADM_RESUME_IO, 24, GENL_doit(drbd_adm_resume_io),
372 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
373GENL_op(DRBD_ADM_OUTDATE, 25, GENL_doit(drbd_adm_outdate),
374 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
375GENL_op(DRBD_ADM_GET_TIMEOUT_TYPE, 26, GENL_doit(drbd_adm_get_timeout_type),
376 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
377GENL_op(DRBD_ADM_DOWN, 27, GENL_doit(drbd_adm_down),
378 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
diff --git a/include/linux/drbd_genl_api.h b/include/linux/drbd_genl_api.h
new file mode 100644
index 00000000000..9ef50d51e34
--- /dev/null
+++ b/include/linux/drbd_genl_api.h
@@ -0,0 +1,55 @@
1#ifndef DRBD_GENL_STRUCT_H
2#define DRBD_GENL_STRUCT_H
3
4/**
5 * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests
6 * @minor:
7 * For admin requests (user -> kernel): which minor device to operate on.
8 * For (unicast) replies or informational (broadcast) messages
9 * (kernel -> user): which minor device the information is about.
10 * If we do not operate on minors, but on connections or resources,
11 * the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT
12 * is used instead.
13 * @flags: possible operation modifiers (relevant only for user->kernel):
14 * DRBD_GENL_F_SET_DEFAULTS
15 * @volume:
16 * When creating a new minor (adding it to a resource), the resource needs
17 * to know which volume number within the resource this is supposed to be.
18 * The volume number corresponds to the same volume number on the remote side,
19 * whereas the minor number on the remote side may be different
20 * (union with flags).
21 * @ret_code: kernel->userland unicast cfg reply return code (union with flags);
22 */
23struct drbd_genlmsghdr {
24 __u32 minor;
25 union {
26 __u32 flags;
27 __s32 ret_code;
28 };
29};
30
31/* To be used in drbd_genlmsghdr.flags */
32enum {
33 DRBD_GENL_F_SET_DEFAULTS = 1,
34};
35
36enum drbd_state_info_bcast_reason {
37 SIB_GET_STATUS_REPLY = 1,
38 SIB_STATE_CHANGE = 2,
39 SIB_HELPER_PRE = 3,
40 SIB_HELPER_POST = 4,
41 SIB_SYNC_PROGRESS = 5,
42};
43
44/* hack around predefined gcc/cpp "linux=1",
45 * we cannot possibly include <1/drbd_genl.h> */
46#undef linux
47
48#include <linux/drbd.h>
49#define GENL_MAGIC_VERSION API_VERSION
50#define GENL_MAGIC_FAMILY drbd
51#define GENL_MAGIC_FAMILY_HDRSZ sizeof(struct drbd_genlmsghdr)
52#define GENL_MAGIC_INCLUDE_FILE <linux/drbd_genl.h>
53#include <linux/genl_magic_struct.h>
54
55#endif
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index fb670bf603f..1fa19c5f5e6 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -16,29 +16,37 @@
16#define DEBUG_RANGE_CHECK 0 16#define DEBUG_RANGE_CHECK 0
17 17
18#define DRBD_MINOR_COUNT_MIN 1 18#define DRBD_MINOR_COUNT_MIN 1
19#define DRBD_MINOR_COUNT_MAX 256 19#define DRBD_MINOR_COUNT_MAX 255
20#define DRBD_MINOR_COUNT_DEF 32 20#define DRBD_MINOR_COUNT_DEF 32
21#define DRBD_MINOR_COUNT_SCALE '1'
22
23#define DRBD_VOLUME_MAX 65535
21 24
22#define DRBD_DIALOG_REFRESH_MIN 0 25#define DRBD_DIALOG_REFRESH_MIN 0
23#define DRBD_DIALOG_REFRESH_MAX 600 26#define DRBD_DIALOG_REFRESH_MAX 600
27#define DRBD_DIALOG_REFRESH_SCALE '1'
24 28
25/* valid port number */ 29/* valid port number */
26#define DRBD_PORT_MIN 1 30#define DRBD_PORT_MIN 1
27#define DRBD_PORT_MAX 0xffff 31#define DRBD_PORT_MAX 0xffff
32#define DRBD_PORT_SCALE '1'
28 33
29/* startup { */ 34/* startup { */
30 /* if you want more than 3.4 days, disable */ 35 /* if you want more than 3.4 days, disable */
31#define DRBD_WFC_TIMEOUT_MIN 0 36#define DRBD_WFC_TIMEOUT_MIN 0
32#define DRBD_WFC_TIMEOUT_MAX 300000 37#define DRBD_WFC_TIMEOUT_MAX 300000
33#define DRBD_WFC_TIMEOUT_DEF 0 38#define DRBD_WFC_TIMEOUT_DEF 0
39#define DRBD_WFC_TIMEOUT_SCALE '1'
34 40
35#define DRBD_DEGR_WFC_TIMEOUT_MIN 0 41#define DRBD_DEGR_WFC_TIMEOUT_MIN 0
36#define DRBD_DEGR_WFC_TIMEOUT_MAX 300000 42#define DRBD_DEGR_WFC_TIMEOUT_MAX 300000
37#define DRBD_DEGR_WFC_TIMEOUT_DEF 0 43#define DRBD_DEGR_WFC_TIMEOUT_DEF 0
44#define DRBD_DEGR_WFC_TIMEOUT_SCALE '1'
38 45
39#define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0 46#define DRBD_OUTDATED_WFC_TIMEOUT_MIN 0
40#define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000 47#define DRBD_OUTDATED_WFC_TIMEOUT_MAX 300000
41#define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0 48#define DRBD_OUTDATED_WFC_TIMEOUT_DEF 0
49#define DRBD_OUTDATED_WFC_TIMEOUT_SCALE '1'
42/* }*/ 50/* }*/
43 51
44/* net { */ 52/* net { */
@@ -47,75 +55,91 @@
47#define DRBD_TIMEOUT_MIN 1 55#define DRBD_TIMEOUT_MIN 1
48#define DRBD_TIMEOUT_MAX 600 56#define DRBD_TIMEOUT_MAX 600
49#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */ 57#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */
58#define DRBD_TIMEOUT_SCALE '1'
50 59
51 /* If backing disk takes longer than disk_timeout, mark the disk as failed */ 60 /* If backing disk takes longer than disk_timeout, mark the disk as failed */
52#define DRBD_DISK_TIMEOUT_MIN 0 /* 0 = disabled */ 61#define DRBD_DISK_TIMEOUT_MIN 0 /* 0 = disabled */
53#define DRBD_DISK_TIMEOUT_MAX 6000 /* 10 Minutes */ 62#define DRBD_DISK_TIMEOUT_MAX 6000 /* 10 Minutes */
54#define DRBD_DISK_TIMEOUT_DEF 0 /* disabled */ 63#define DRBD_DISK_TIMEOUT_DEF 0 /* disabled */
64#define DRBD_DISK_TIMEOUT_SCALE '1'
55 65
56 /* active connection retries when C_WF_CONNECTION */ 66 /* active connection retries when C_WF_CONNECTION */
57#define DRBD_CONNECT_INT_MIN 1 67#define DRBD_CONNECT_INT_MIN 1
58#define DRBD_CONNECT_INT_MAX 120 68#define DRBD_CONNECT_INT_MAX 120
59#define DRBD_CONNECT_INT_DEF 10 /* seconds */ 69#define DRBD_CONNECT_INT_DEF 10 /* seconds */
70#define DRBD_CONNECT_INT_SCALE '1'
60 71
61 /* keep-alive probes when idle */ 72 /* keep-alive probes when idle */
62#define DRBD_PING_INT_MIN 1 73#define DRBD_PING_INT_MIN 1
63#define DRBD_PING_INT_MAX 120 74#define DRBD_PING_INT_MAX 120
64#define DRBD_PING_INT_DEF 10 75#define DRBD_PING_INT_DEF 10
76#define DRBD_PING_INT_SCALE '1'
65 77
66 /* timeout for the ping packets.*/ 78 /* timeout for the ping packets.*/
67#define DRBD_PING_TIMEO_MIN 1 79#define DRBD_PING_TIMEO_MIN 1
68#define DRBD_PING_TIMEO_MAX 300 80#define DRBD_PING_TIMEO_MAX 300
69#define DRBD_PING_TIMEO_DEF 5 81#define DRBD_PING_TIMEO_DEF 5
82#define DRBD_PING_TIMEO_SCALE '1'
70 83
71 /* max number of write requests between write barriers */ 84 /* max number of write requests between write barriers */
72#define DRBD_MAX_EPOCH_SIZE_MIN 1 85#define DRBD_MAX_EPOCH_SIZE_MIN 1
73#define DRBD_MAX_EPOCH_SIZE_MAX 20000 86#define DRBD_MAX_EPOCH_SIZE_MAX 20000
74#define DRBD_MAX_EPOCH_SIZE_DEF 2048 87#define DRBD_MAX_EPOCH_SIZE_DEF 2048
88#define DRBD_MAX_EPOCH_SIZE_SCALE '1'
75 89
76 /* I don't think that a tcp send buffer of more than 10M is useful */ 90 /* I don't think that a tcp send buffer of more than 10M is useful */
77#define DRBD_SNDBUF_SIZE_MIN 0 91#define DRBD_SNDBUF_SIZE_MIN 0
78#define DRBD_SNDBUF_SIZE_MAX (10<<20) 92#define DRBD_SNDBUF_SIZE_MAX (10<<20)
79#define DRBD_SNDBUF_SIZE_DEF 0 93#define DRBD_SNDBUF_SIZE_DEF 0
94#define DRBD_SNDBUF_SIZE_SCALE '1'
80 95
81#define DRBD_RCVBUF_SIZE_MIN 0 96#define DRBD_RCVBUF_SIZE_MIN 0
82#define DRBD_RCVBUF_SIZE_MAX (10<<20) 97#define DRBD_RCVBUF_SIZE_MAX (10<<20)
83#define DRBD_RCVBUF_SIZE_DEF 0 98#define DRBD_RCVBUF_SIZE_DEF 0
99#define DRBD_RCVBUF_SIZE_SCALE '1'
84 100
85 /* @4k PageSize -> 128kB - 512MB */ 101 /* @4k PageSize -> 128kB - 512MB */
86#define DRBD_MAX_BUFFERS_MIN 32 102#define DRBD_MAX_BUFFERS_MIN 32
87#define DRBD_MAX_BUFFERS_MAX 131072 103#define DRBD_MAX_BUFFERS_MAX 131072
88#define DRBD_MAX_BUFFERS_DEF 2048 104#define DRBD_MAX_BUFFERS_DEF 2048
105#define DRBD_MAX_BUFFERS_SCALE '1'
89 106
90 /* @4k PageSize -> 4kB - 512MB */ 107 /* @4k PageSize -> 4kB - 512MB */
91#define DRBD_UNPLUG_WATERMARK_MIN 1 108#define DRBD_UNPLUG_WATERMARK_MIN 1
92#define DRBD_UNPLUG_WATERMARK_MAX 131072 109#define DRBD_UNPLUG_WATERMARK_MAX 131072
93#define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16) 110#define DRBD_UNPLUG_WATERMARK_DEF (DRBD_MAX_BUFFERS_DEF/16)
111#define DRBD_UNPLUG_WATERMARK_SCALE '1'
94 112
95 /* 0 is disabled. 113 /* 0 is disabled.
96 * 200 should be more than enough even for very short timeouts */ 114 * 200 should be more than enough even for very short timeouts */
97#define DRBD_KO_COUNT_MIN 0 115#define DRBD_KO_COUNT_MIN 0
98#define DRBD_KO_COUNT_MAX 200 116#define DRBD_KO_COUNT_MAX 200
99#define DRBD_KO_COUNT_DEF 0 117#define DRBD_KO_COUNT_DEF 7
118#define DRBD_KO_COUNT_SCALE '1'
100/* } */ 119/* } */
101 120
102/* syncer { */ 121/* syncer { */
103 /* FIXME allow rate to be zero? */ 122 /* FIXME allow rate to be zero? */
104#define DRBD_RATE_MIN 1 123#define DRBD_RESYNC_RATE_MIN 1
105/* channel bonding 10 GbE, or other hardware */ 124/* channel bonding 10 GbE, or other hardware */
106#define DRBD_RATE_MAX (4 << 20) 125#define DRBD_RESYNC_RATE_MAX (4 << 20)
107#define DRBD_RATE_DEF 250 /* kb/second */ 126#define DRBD_RESYNC_RATE_DEF 250
127#define DRBD_RESYNC_RATE_SCALE 'k' /* kilobytes */
108 128
109 /* less than 7 would hit performance unnecessarily. 129 /* less than 7 would hit performance unnecessarily.
110 * 3833 is the largest prime that still does fit 130 * 919 slots context information per transaction,
111 * into 64 sectors of activity log */ 131 * 32k activity log, 4k transaction size,
132 * one transaction in flight:
133 * 919 * 7 = 6433 */
112#define DRBD_AL_EXTENTS_MIN 7 134#define DRBD_AL_EXTENTS_MIN 7
113#define DRBD_AL_EXTENTS_MAX 3833 135#define DRBD_AL_EXTENTS_MAX 6433
114#define DRBD_AL_EXTENTS_DEF 127 136#define DRBD_AL_EXTENTS_DEF 1237
137#define DRBD_AL_EXTENTS_SCALE '1'
115 138
116#define DRBD_AFTER_MIN -1 139#define DRBD_MINOR_NUMBER_MIN -1
117#define DRBD_AFTER_MAX 255 140#define DRBD_MINOR_NUMBER_MAX ((1 << 20) - 1)
118#define DRBD_AFTER_DEF -1 141#define DRBD_MINOR_NUMBER_DEF -1
142#define DRBD_MINOR_NUMBER_SCALE '1'
119 143
120/* } */ 144/* } */
121 145
@@ -124,11 +148,12 @@
124 * the upper limit with 64bit kernel, enough ram and flexible meta data 148 * the upper limit with 64bit kernel, enough ram and flexible meta data
125 * is 1 PiB, currently. */ 149 * is 1 PiB, currently. */
126/* DRBD_MAX_SECTORS */ 150/* DRBD_MAX_SECTORS */
127#define DRBD_DISK_SIZE_SECT_MIN 0 151#define DRBD_DISK_SIZE_MIN 0
128#define DRBD_DISK_SIZE_SECT_MAX (1 * (2LLU << 40)) 152#define DRBD_DISK_SIZE_MAX (1 * (2LLU << 40))
129#define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */ 153#define DRBD_DISK_SIZE_DEF 0 /* = disabled = no user size... */
154#define DRBD_DISK_SIZE_SCALE 's' /* sectors */
130 155
131#define DRBD_ON_IO_ERROR_DEF EP_PASS_ON 156#define DRBD_ON_IO_ERROR_DEF EP_DETACH
132#define DRBD_FENCING_DEF FP_DONT_CARE 157#define DRBD_FENCING_DEF FP_DONT_CARE
133#define DRBD_AFTER_SB_0P_DEF ASB_DISCONNECT 158#define DRBD_AFTER_SB_0P_DEF ASB_DISCONNECT
134#define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT 159#define DRBD_AFTER_SB_1P_DEF ASB_DISCONNECT
@@ -136,38 +161,59 @@
136#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT 161#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
137#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR 162#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
138#define DRBD_ON_CONGESTION_DEF OC_BLOCK 163#define DRBD_ON_CONGESTION_DEF OC_BLOCK
164#define DRBD_READ_BALANCING_DEF RB_PREFER_LOCAL
139 165
140#define DRBD_MAX_BIO_BVECS_MIN 0 166#define DRBD_MAX_BIO_BVECS_MIN 0
141#define DRBD_MAX_BIO_BVECS_MAX 128 167#define DRBD_MAX_BIO_BVECS_MAX 128
142#define DRBD_MAX_BIO_BVECS_DEF 0 168#define DRBD_MAX_BIO_BVECS_DEF 0
169#define DRBD_MAX_BIO_BVECS_SCALE '1'
143 170
144#define DRBD_C_PLAN_AHEAD_MIN 0 171#define DRBD_C_PLAN_AHEAD_MIN 0
145#define DRBD_C_PLAN_AHEAD_MAX 300 172#define DRBD_C_PLAN_AHEAD_MAX 300
146#define DRBD_C_PLAN_AHEAD_DEF 0 /* RS rate controller disabled by default */ 173#define DRBD_C_PLAN_AHEAD_DEF 20
174#define DRBD_C_PLAN_AHEAD_SCALE '1'
147 175
148#define DRBD_C_DELAY_TARGET_MIN 1 176#define DRBD_C_DELAY_TARGET_MIN 1
149#define DRBD_C_DELAY_TARGET_MAX 100 177#define DRBD_C_DELAY_TARGET_MAX 100
150#define DRBD_C_DELAY_TARGET_DEF 10 178#define DRBD_C_DELAY_TARGET_DEF 10
179#define DRBD_C_DELAY_TARGET_SCALE '1'
151 180
152#define DRBD_C_FILL_TARGET_MIN 0 181#define DRBD_C_FILL_TARGET_MIN 0
153#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */ 182#define DRBD_C_FILL_TARGET_MAX (1<<20) /* 500MByte in sec */
154#define DRBD_C_FILL_TARGET_DEF 0 /* By default disabled -> controlled by delay_target */ 183#define DRBD_C_FILL_TARGET_DEF 100 /* Try to place 50KiB in socket send buffer during resync */
184#define DRBD_C_FILL_TARGET_SCALE 's' /* sectors */
155 185
156#define DRBD_C_MAX_RATE_MIN 250 /* kByte/sec */ 186#define DRBD_C_MAX_RATE_MIN 250
157#define DRBD_C_MAX_RATE_MAX (4 << 20) 187#define DRBD_C_MAX_RATE_MAX (4 << 20)
158#define DRBD_C_MAX_RATE_DEF 102400 188#define DRBD_C_MAX_RATE_DEF 102400
189#define DRBD_C_MAX_RATE_SCALE 'k' /* kilobytes */
159 190
160#define DRBD_C_MIN_RATE_MIN 0 /* kByte/sec */ 191#define DRBD_C_MIN_RATE_MIN 0
161#define DRBD_C_MIN_RATE_MAX (4 << 20) 192#define DRBD_C_MIN_RATE_MAX (4 << 20)
162#define DRBD_C_MIN_RATE_DEF 4096 193#define DRBD_C_MIN_RATE_DEF 250
194#define DRBD_C_MIN_RATE_SCALE 'k' /* kilobytes */
163 195
164#define DRBD_CONG_FILL_MIN 0 196#define DRBD_CONG_FILL_MIN 0
165#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */ 197#define DRBD_CONG_FILL_MAX (10<<21) /* 10GByte in sectors */
166#define DRBD_CONG_FILL_DEF 0 198#define DRBD_CONG_FILL_DEF 0
199#define DRBD_CONG_FILL_SCALE 's' /* sectors */
167 200
168#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN 201#define DRBD_CONG_EXTENTS_MIN DRBD_AL_EXTENTS_MIN
169#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX 202#define DRBD_CONG_EXTENTS_MAX DRBD_AL_EXTENTS_MAX
170#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF 203#define DRBD_CONG_EXTENTS_DEF DRBD_AL_EXTENTS_DEF
204#define DRBD_CONG_EXTENTS_SCALE DRBD_AL_EXTENTS_SCALE
205
206#define DRBD_PROTOCOL_DEF DRBD_PROT_C
207
208#define DRBD_DISK_BARRIER_DEF 0
209#define DRBD_DISK_FLUSHES_DEF 1
210#define DRBD_DISK_DRAIN_DEF 1
211#define DRBD_MD_FLUSHES_DEF 1
212#define DRBD_TCP_CORK_DEF 1
213#define DRBD_AL_UPDATES_DEF 1
214
215#define DRBD_ALLOW_TWO_PRIMARIES_DEF 0
216#define DRBD_ALWAYS_ASBP_DEF 0
217#define DRBD_USE_RLE_DEF 1
171 218
172#undef RANGE
173#endif 219#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
deleted file mode 100644
index a8706f08ab3..00000000000
--- a/include/linux/drbd_nl.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 PAKET( name,
3 TYPE ( pn, pr, member )
4 ...
5 )
6
7 You may never reissue one of the pn arguments
8*/
9
10#if !defined(NL_PACKET) || !defined(NL_STRING) || !defined(NL_INTEGER) || !defined(NL_BIT) || !defined(NL_INT64)
11#error "The macros NL_PACKET, NL_STRING, NL_INTEGER, NL_INT64 and NL_BIT needs to be defined"
12#endif
13
14NL_PACKET(primary, 1,
15 NL_BIT( 1, T_MAY_IGNORE, primary_force)
16)
17
18NL_PACKET(secondary, 2, )
19
20NL_PACKET(disk_conf, 3,
21 NL_INT64( 2, T_MAY_IGNORE, disk_size)
22 NL_STRING( 3, T_MANDATORY, backing_dev, 128)
23 NL_STRING( 4, T_MANDATORY, meta_dev, 128)
24 NL_INTEGER( 5, T_MANDATORY, meta_dev_idx)
25 NL_INTEGER( 6, T_MAY_IGNORE, on_io_error)
26 NL_INTEGER( 7, T_MAY_IGNORE, fencing)
27 NL_BIT( 37, T_MAY_IGNORE, use_bmbv)
28 NL_BIT( 53, T_MAY_IGNORE, no_disk_flush)
29 NL_BIT( 54, T_MAY_IGNORE, no_md_flush)
30 /* 55 max_bio_size was available in 8.2.6rc2 */
31 NL_INTEGER( 56, T_MAY_IGNORE, max_bio_bvecs)
32 NL_BIT( 57, T_MAY_IGNORE, no_disk_barrier)
33 NL_BIT( 58, T_MAY_IGNORE, no_disk_drain)
34 NL_INTEGER( 89, T_MAY_IGNORE, disk_timeout)
35)
36
37NL_PACKET(detach, 4,
38 NL_BIT( 88, T_MANDATORY, detach_force)
39)
40
41NL_PACKET(net_conf, 5,
42 NL_STRING( 8, T_MANDATORY, my_addr, 128)
43 NL_STRING( 9, T_MANDATORY, peer_addr, 128)
44 NL_STRING( 10, T_MAY_IGNORE, shared_secret, SHARED_SECRET_MAX)
45 NL_STRING( 11, T_MAY_IGNORE, cram_hmac_alg, SHARED_SECRET_MAX)
46 NL_STRING( 44, T_MAY_IGNORE, integrity_alg, SHARED_SECRET_MAX)
47 NL_INTEGER( 14, T_MAY_IGNORE, timeout)
48 NL_INTEGER( 15, T_MANDATORY, wire_protocol)
49 NL_INTEGER( 16, T_MAY_IGNORE, try_connect_int)
50 NL_INTEGER( 17, T_MAY_IGNORE, ping_int)
51 NL_INTEGER( 18, T_MAY_IGNORE, max_epoch_size)
52 NL_INTEGER( 19, T_MAY_IGNORE, max_buffers)
53 NL_INTEGER( 20, T_MAY_IGNORE, unplug_watermark)
54 NL_INTEGER( 21, T_MAY_IGNORE, sndbuf_size)
55 NL_INTEGER( 22, T_MAY_IGNORE, ko_count)
56 NL_INTEGER( 24, T_MAY_IGNORE, after_sb_0p)
57 NL_INTEGER( 25, T_MAY_IGNORE, after_sb_1p)
58 NL_INTEGER( 26, T_MAY_IGNORE, after_sb_2p)
59 NL_INTEGER( 39, T_MAY_IGNORE, rr_conflict)
60 NL_INTEGER( 40, T_MAY_IGNORE, ping_timeo)
61 NL_INTEGER( 67, T_MAY_IGNORE, rcvbuf_size)
62 NL_INTEGER( 81, T_MAY_IGNORE, on_congestion)
63 NL_INTEGER( 82, T_MAY_IGNORE, cong_fill)
64 NL_INTEGER( 83, T_MAY_IGNORE, cong_extents)
65 /* 59 addr_family was available in GIT, never released */
66 NL_BIT( 60, T_MANDATORY, mind_af)
67 NL_BIT( 27, T_MAY_IGNORE, want_lose)
68 NL_BIT( 28, T_MAY_IGNORE, two_primaries)
69 NL_BIT( 41, T_MAY_IGNORE, always_asbp)
70 NL_BIT( 61, T_MAY_IGNORE, no_cork)
71 NL_BIT( 62, T_MANDATORY, auto_sndbuf_size)
72 NL_BIT( 70, T_MANDATORY, dry_run)
73)
74
75NL_PACKET(disconnect, 6,
76 NL_BIT( 84, T_MAY_IGNORE, force)
77)
78
79NL_PACKET(resize, 7,
80 NL_INT64( 29, T_MAY_IGNORE, resize_size)
81 NL_BIT( 68, T_MAY_IGNORE, resize_force)
82 NL_BIT( 69, T_MANDATORY, no_resync)
83)
84
85NL_PACKET(syncer_conf, 8,
86 NL_INTEGER( 30, T_MAY_IGNORE, rate)
87 NL_INTEGER( 31, T_MAY_IGNORE, after)
88 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
89/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
90 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
91 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
92 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
93 * feature will be reimplemented differently with 8.3.9 */
94 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
95 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
96 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
97 NL_BIT( 65, T_MAY_IGNORE, use_rle)
98 NL_INTEGER( 75, T_MAY_IGNORE, on_no_data)
99 NL_INTEGER( 76, T_MAY_IGNORE, c_plan_ahead)
100 NL_INTEGER( 77, T_MAY_IGNORE, c_delay_target)
101 NL_INTEGER( 78, T_MAY_IGNORE, c_fill_target)
102 NL_INTEGER( 79, T_MAY_IGNORE, c_max_rate)
103 NL_INTEGER( 80, T_MAY_IGNORE, c_min_rate)
104)
105
106NL_PACKET(invalidate, 9, )
107NL_PACKET(invalidate_peer, 10, )
108NL_PACKET(pause_sync, 11, )
109NL_PACKET(resume_sync, 12, )
110NL_PACKET(suspend_io, 13, )
111NL_PACKET(resume_io, 14, )
112NL_PACKET(outdate, 15, )
113NL_PACKET(get_config, 16, )
114NL_PACKET(get_state, 17,
115 NL_INTEGER( 33, T_MAY_IGNORE, state_i)
116)
117
118NL_PACKET(get_uuids, 18,
119 NL_STRING( 34, T_MAY_IGNORE, uuids, (UI_SIZE*sizeof(__u64)))
120 NL_INTEGER( 35, T_MAY_IGNORE, uuids_flags)
121)
122
123NL_PACKET(get_timeout_flag, 19,
124 NL_BIT( 36, T_MAY_IGNORE, use_degraded)
125)
126
127NL_PACKET(call_helper, 20,
128 NL_STRING( 38, T_MAY_IGNORE, helper, 32)
129)
130
131/* Tag nr 42 already allocated in drbd-8.1 development. */
132
133NL_PACKET(sync_progress, 23,
134 NL_INTEGER( 43, T_MAY_IGNORE, sync_progress)
135)
136
137NL_PACKET(dump_ee, 24,
138 NL_STRING( 45, T_MAY_IGNORE, dump_ee_reason, 32)
139 NL_STRING( 46, T_MAY_IGNORE, seen_digest, SHARED_SECRET_MAX)
140 NL_STRING( 47, T_MAY_IGNORE, calc_digest, SHARED_SECRET_MAX)
141 NL_INT64( 48, T_MAY_IGNORE, ee_sector)
142 NL_INT64( 49, T_MAY_IGNORE, ee_block_id)
143 NL_STRING( 50, T_MAY_IGNORE, ee_data, 32 << 10)
144)
145
146NL_PACKET(start_ov, 25,
147 NL_INT64( 66, T_MAY_IGNORE, start_sector)
148)
149
150NL_PACKET(new_c_uuid, 26,
151 NL_BIT( 63, T_MANDATORY, clear_bm)
152)
153
154#ifdef NL_RESPONSE
155NL_RESPONSE(return_code_only, 27)
156#endif
157
158#undef NL_PACKET
159#undef NL_INTEGER
160#undef NL_INT64
161#undef NL_BIT
162#undef NL_STRING
163#undef NL_RESPONSE
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
deleted file mode 100644
index 82de1f9e48b..00000000000
--- a/include/linux/drbd_tag_magic.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef DRBD_TAG_MAGIC_H
2#define DRBD_TAG_MAGIC_H
3
4#define TT_END 0
5#define TT_REMOVED 0xE000
6
7/* declare packet_type enums */
8enum packet_types {
9#define NL_PACKET(name, number, fields) P_ ## name = number,
10#define NL_RESPONSE(name, number) P_ ## name = number,
11#define NL_INTEGER(pn, pr, member)
12#define NL_INT64(pn, pr, member)
13#define NL_BIT(pn, pr, member)
14#define NL_STRING(pn, pr, member, len)
15#include <linux/drbd_nl.h>
16 P_nl_after_last_packet,
17};
18
19/* These struct are used to deduce the size of the tag lists: */
20#define NL_PACKET(name, number, fields) \
21 struct name ## _tag_len_struct { fields };
22#define NL_INTEGER(pn, pr, member) \
23 int member; int tag_and_len ## member;
24#define NL_INT64(pn, pr, member) \
25 __u64 member; int tag_and_len ## member;
26#define NL_BIT(pn, pr, member) \
27 unsigned char member:1; int tag_and_len ## member;
28#define NL_STRING(pn, pr, member, len) \
29 unsigned char member[len]; int member ## _len; \
30 int tag_and_len ## member;
31#include <linux/drbd_nl.h>
32
33/* declare tag-list-sizes */
34static const int tag_list_sizes[] = {
35#define NL_PACKET(name, number, fields) 2 fields ,
36#define NL_INTEGER(pn, pr, member) + 4 + 4
37#define NL_INT64(pn, pr, member) + 4 + 8
38#define NL_BIT(pn, pr, member) + 4 + 1
39#define NL_STRING(pn, pr, member, len) + 4 + (len)
40#include <linux/drbd_nl.h>
41};
42
43/* The two highest bits are used for the tag type */
44#define TT_MASK 0xC000
45#define TT_INTEGER 0x0000
46#define TT_INT64 0x4000
47#define TT_BIT 0x8000
48#define TT_STRING 0xC000
49/* The next bit indicates if processing of the tag is mandatory */
50#define T_MANDATORY 0x2000
51#define T_MAY_IGNORE 0x0000
52#define TN_MASK 0x1fff
53/* The remaining 13 bits are used to enumerate the tags */
54
55#define tag_type(T) ((T) & TT_MASK)
56#define tag_number(T) ((T) & TN_MASK)
57
58/* declare tag enums */
59#define NL_PACKET(name, number, fields) fields
60enum drbd_tags {
61#define NL_INTEGER(pn, pr, member) T_ ## member = pn | TT_INTEGER | pr ,
62#define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr ,
63#define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr ,
64#define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr ,
65#include <linux/drbd_nl.h>
66};
67
68struct tag {
69 const char *name;
70 int type_n_flags;
71 int max_len;
72};
73
74/* declare tag names */
75#define NL_PACKET(name, number, fields) fields
76static const struct tag tag_descriptions[] = {
77#define NL_INTEGER(pn, pr, member) [ pn ] = { #member, TT_INTEGER | pr, sizeof(int) },
78#define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) },
79#define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) },
80#define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) },
81#include <linux/drbd_nl.h>
82};
83
84#endif
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/include/linux/dvb/Kbuild
+++ /dev/null
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
deleted file mode 100644
index 0be6d8f2b52..00000000000
--- a/include/linux/dvb/dmx.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * dmx.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23#ifndef _DVBDMX_H_
24#define _DVBDMX_H_
25
26#include <linux/time.h>
27#include <uapi/linux/dvb/dmx.h>
28
29#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
deleted file mode 100644
index 85c20d92569..00000000000
--- a/include/linux/dvb/video.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * video.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23#ifndef _DVBVIDEO_H_
24#define _DVBVIDEO_H_
25
26#include <linux/compiler.h>
27#include <uapi/linux/dvb/video.h>
28
29#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/earlycpio.h b/include/linux/earlycpio.h
new file mode 100644
index 00000000000..111f46d83d0
--- /dev/null
+++ b/include/linux/earlycpio.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_EARLYCPIO_H
2#define _LINUX_EARLYCPIO_H
3
4#include <linux/types.h>
5
6#define MAX_CPIO_FILE_NAME 18
7
8struct cpio_data {
9 void *data;
10 size_t size;
11 char name[MAX_CPIO_FILE_NAME];
12};
13
14struct cpio_data find_cpio_data(const char *path, void *data, size_t len,
15 long *offset);
16
17#endif /* _LINUX_EARLYCPIO_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index bab9f8473dc..1b8c02b36f7 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -533,6 +533,7 @@ struct csrow_info {
533 533
534 u32 ue_count; /* Uncorrectable Errors for this csrow */ 534 u32 ue_count; /* Uncorrectable Errors for this csrow */
535 u32 ce_count; /* Correctable Errors for this csrow */ 535 u32 ce_count; /* Correctable Errors for this csrow */
536 u32 nr_pages; /* combined pages count of all channels */
536 537
537 struct mem_ctl_info *mci; /* the parent */ 538 struct mem_ctl_info *mci; /* the parent */
538 539
@@ -667,6 +668,8 @@ struct mem_ctl_info {
667 u32 fake_inject_ue; 668 u32 fake_inject_ue;
668 u16 fake_inject_count; 669 u16 fake_inject_count;
669#endif 670#endif
671 __u8 csbased : 1, /* csrow-based memory controller */
672 __resv : 7;
670}; 673};
671 674
672#endif 675#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 8670eb1eb8c..8b84916dc67 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -29,7 +29,12 @@
29#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1))) 29#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1)))
30#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1))) 30#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1)))
31#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1))) 31#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1)))
32#define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1)))
33#define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1)))
34#define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1)))
35#define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1)))
32#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1))) 36#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1)))
37#define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))
33 38
34typedef unsigned long efi_status_t; 39typedef unsigned long efi_status_t;
35typedef u8 efi_bool_t; 40typedef u8 efi_bool_t;
@@ -196,6 +201,77 @@ typedef struct {
196 void *create_event_ex; 201 void *create_event_ex;
197} efi_boot_services_t; 202} efi_boot_services_t;
198 203
204typedef enum {
205 EfiPciIoWidthUint8,
206 EfiPciIoWidthUint16,
207 EfiPciIoWidthUint32,
208 EfiPciIoWidthUint64,
209 EfiPciIoWidthFifoUint8,
210 EfiPciIoWidthFifoUint16,
211 EfiPciIoWidthFifoUint32,
212 EfiPciIoWidthFifoUint64,
213 EfiPciIoWidthFillUint8,
214 EfiPciIoWidthFillUint16,
215 EfiPciIoWidthFillUint32,
216 EfiPciIoWidthFillUint64,
217 EfiPciIoWidthMaximum
218} EFI_PCI_IO_PROTOCOL_WIDTH;
219
220typedef enum {
221 EfiPciIoAttributeOperationGet,
222 EfiPciIoAttributeOperationSet,
223 EfiPciIoAttributeOperationEnable,
224 EfiPciIoAttributeOperationDisable,
225 EfiPciIoAttributeOperationSupported,
226 EfiPciIoAttributeOperationMaximum
227} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
228
229
230typedef struct {
231 void *read;
232 void *write;
233} efi_pci_io_protocol_access_t;
234
235typedef struct {
236 void *poll_mem;
237 void *poll_io;
238 efi_pci_io_protocol_access_t mem;
239 efi_pci_io_protocol_access_t io;
240 efi_pci_io_protocol_access_t pci;
241 void *copy_mem;
242 void *map;
243 void *unmap;
244 void *allocate_buffer;
245 void *free_buffer;
246 void *flush;
247 void *get_location;
248 void *attributes;
249 void *get_bar_attributes;
250 void *set_bar_attributes;
251 uint64_t romsize;
252 void *romimage;
253} efi_pci_io_protocol;
254
255#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001
256#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
257#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
258#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
259#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
260#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
261#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
262#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
263#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
264#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
265#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
266#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
267#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
268#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
269#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
270#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
271#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
272#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
273#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
274
199/* 275/*
200 * Types and defines for EFI ResetSystem 276 * Types and defines for EFI ResetSystem
201 */ 277 */
@@ -643,6 +719,7 @@ struct efivar_operations {
643 efi_get_variable_t *get_variable; 719 efi_get_variable_t *get_variable;
644 efi_get_next_variable_t *get_next_variable; 720 efi_get_next_variable_t *get_next_variable;
645 efi_set_variable_t *set_variable; 721 efi_set_variable_t *set_variable;
722 efi_query_variable_info_t *query_variable_info;
646}; 723};
647 724
648struct efivars { 725struct efivars {
@@ -657,6 +734,7 @@ struct efivars {
657 spinlock_t lock; 734 spinlock_t lock;
658 struct list_head list; 735 struct list_head list;
659 struct kset *kset; 736 struct kset *kset;
737 struct kobject *kobject;
660 struct bin_attribute *new_var, *del_var; 738 struct bin_attribute *new_var, *del_var;
661 const struct efivar_operations *ops; 739 const struct efivar_operations *ops;
662 struct efivar_entry *walk_entry; 740 struct efivar_entry *walk_entry;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index b006ba0a9f4..243eea1e33d 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -51,6 +51,26 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
51#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) 51#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
52#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count) 52#define alloc_etherdev_mq(sizeof_priv, count) alloc_etherdev_mqs(sizeof_priv, count, count)
53 53
54/* Reserved Ethernet Addresses per IEEE 802.1Q */
55static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =
56{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
57
58/**
59 * is_link_local_ether_addr - Determine if given Ethernet address is link-local
60 * @addr: Pointer to a six-byte array containing the Ethernet address
61 *
62 * Return true if address is link local reserved addr (01:80:c2:00:00:0X) per
63 * IEEE 802.1Q 8.6.3 Frame filtering.
64 */
65static inline bool is_link_local_ether_addr(const u8 *addr)
66{
67 __be16 *a = (__be16 *)addr;
68 static const __be16 *b = (const __be16 *)eth_reserved_addr_base;
69 static const __be16 m = cpu_to_be16(0xfff0);
70
71 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0;
72}
73
54/** 74/**
55 * is_zero_ether_addr - Determine if give Ethernet address is all zeros. 75 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
56 * @addr: Pointer to a six-byte array containing the Ethernet address 76 * @addr: Pointer to a six-byte array containing the Ethernet address
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 12291a7ee27..5b9b5b31718 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -83,6 +83,11 @@ enum fid_type {
83 * 64 bit parent inode number. 83 * 64 bit parent inode number.
84 */ 84 */
85 FILEID_NILFS_WITH_PARENT = 0x62, 85 FILEID_NILFS_WITH_PARENT = 0x62,
86
87 /*
88 * Filesystems must not use 0xff file ID.
89 */
90 FILEID_INVALID = 0xff,
86}; 91};
87 92
88struct fid { 93struct fid {
@@ -177,6 +182,8 @@ struct export_operations {
177 int (*commit_metadata)(struct inode *inode); 182 int (*commit_metadata)(struct inode *inode);
178}; 183};
179 184
185extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid,
186 int *max_len, struct inode *parent);
180extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, 187extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
181 int *max_len, int connectable); 188 int *max_len, int connectable);
182extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, 189extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 2c26c14cd71..fcb51c88319 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -23,7 +23,9 @@
23#ifndef __LINUX_EXTCON_H__ 23#ifndef __LINUX_EXTCON_H__
24#define __LINUX_EXTCON_H__ 24#define __LINUX_EXTCON_H__
25 25
26#include <linux/device.h>
26#include <linux/notifier.h> 27#include <linux/notifier.h>
28#include <linux/sysfs.h>
27 29
28#define SUPPORTED_CABLE_MAX 32 30#define SUPPORTED_CABLE_MAX 32
29#define CABLE_NAME_MAX 30 31#define CABLE_NAME_MAX 30
@@ -74,12 +76,12 @@ struct extcon_cable;
74 76
75/** 77/**
76 * struct extcon_dev - An extcon device represents one external connector. 78 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used 79 * @name: The name of this extcon device. Parent device name is used
78 * if NULL. 80 * if NULL.
79 * @supported_cable Array of supported cable names ending with NULL. 81 * @supported_cable: Array of supported cable names ending with NULL.
80 * If supported_cable is NULL, cable name related APIs 82 * If supported_cable is NULL, cable name related APIs
81 * are disabled. 83 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot 84 * @mutually_exclusive: Array of mutually exclusive set of cables that cannot
83 * be attached simultaneously. The array should be 85 * be attached simultaneously. The array should be
84 * ending with NULL or be NULL (no mutually exclusive 86 * ending with NULL or be NULL (no mutually exclusive
85 * cables). For example, if it is { 0x7, 0x30, 0}, then, 87 * cables). For example, if it is { 0x7, 0x30, 0}, then,
@@ -87,21 +89,21 @@ struct extcon_cable;
87 * be attached simulataneously. {0x7, 0} is equivalent to 89 * be attached simulataneously. {0x7, 0} is equivalent to
88 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
89 * can be no simultaneous connections. 91 * can be no simultaneous connections.
90 * @print_name An optional callback to override the method to print the 92 * @print_name: An optional callback to override the method to print the
91 * name of the extcon device. 93 * name of the extcon device.
92 * @print_state An optional callback to override the method to print the 94 * @print_state: An optional callback to override the method to print the
93 * status of the extcon device. 95 * status of the extcon device.
94 * @dev Device of this extcon. Do not provide at register-time. 96 * @dev: Device of this extcon. Do not provide at register-time.
95 * @state Attach/detach state of this extcon. Do not provide at 97 * @state: Attach/detach state of this extcon. Do not provide at
96 * register-time 98 * register-time
97 * @nh Notifier for the state change events from this extcon 99 * @nh: Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that users can search 100 * @entry: To support list of extcon devices so that users can search
99 * for extcon devices based on the extcon name. 101 * for extcon devices based on the extcon name.
100 * @lock 102 * @lock:
101 * @max_supported Internal value to store the number of cables. 103 * @max_supported: Internal value to store the number of cables.
102 * @extcon_dev_type Device_type struct to provide attribute_groups 104 * @extcon_dev_type: Device_type struct to provide attribute_groups
103 * customized for each extcon device. 105 * customized for each extcon device.
104 * @cables Sysfs subdirectories. Each represents one cable. 106 * @cables: Sysfs subdirectories. Each represents one cable.
105 * 107 *
106 * In most cases, users only need to provide "User initializing data" of 108 * In most cases, users only need to provide "User initializing data" of
107 * this struct when registering an extcon. In some exceptional cases, 109 * this struct when registering an extcon. In some exceptional cases,
@@ -137,12 +139,12 @@ struct extcon_dev {
137 139
138/** 140/**
139 * struct extcon_cable - An internal data for each cable of extcon device. 141 * struct extcon_cable - An internal data for each cable of extcon device.
140 * @edev The extcon device 142 * @edev: The extcon device
141 * @cable_index Index of this cable in the edev 143 * @cable_index: Index of this cable in the edev
142 * @attr_g Attribute group for the cable 144 * @attr_g: Attribute group for the cable
143 * @attr_name "name" sysfs entry 145 * @attr_name: "name" sysfs entry
144 * @attr_state "state" sysfs entry 146 * @attr_state: "state" sysfs entry
145 * @attrs Array pointing to attr_name and attr_state for attr_g 147 * @attrs: Array pointing to attr_name and attr_state for attr_g
146 */ 148 */
147struct extcon_cable { 149struct extcon_cable {
148 struct extcon_dev *edev; 150 struct extcon_dev *edev;
@@ -158,11 +160,11 @@ struct extcon_cable {
158/** 160/**
159 * struct extcon_specific_cable_nb - An internal data for 161 * struct extcon_specific_cable_nb - An internal data for
160 * extcon_register_interest(). 162 * extcon_register_interest().
161 * @internal_nb a notifier block bridging extcon notifier and cable notifier. 163 * @internal_nb: a notifier block bridging extcon notifier and cable notifier.
162 * @user_nb user provided notifier block for events from a specific cable. 164 * @user_nb: user provided notifier block for events from a specific cable.
163 * @cable_index the target cable. 165 * @cable_index: the target cable.
164 * @edev the target extcon device. 166 * @edev: the target extcon device.
165 * @previous_value the saved previous event value. 167 * @previous_value: the saved previous event value.
166 */ 168 */
167struct extcon_specific_cable_nb { 169struct extcon_specific_cable_nb {
168 struct notifier_block internal_nb; 170 struct notifier_block internal_nb;
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
new file mode 100644
index 00000000000..f9a12f6243a
--- /dev/null
+++ b/include/linux/f2fs_fs.h
@@ -0,0 +1,413 @@
1/**
2 * include/linux/f2fs_fs.h
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.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 version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef _LINUX_F2FS_FS_H
12#define _LINUX_F2FS_FS_H
13
14#include <linux/pagemap.h>
15#include <linux/types.h>
16
17#define F2FS_SUPER_OFFSET 1024 /* byte-size offset */
18#define F2FS_LOG_SECTOR_SIZE 9 /* 9 bits for 512 byte */
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22
23#define NULL_ADDR 0x0U
24#define NEW_ADDR -1U
25
26#define F2FS_ROOT_INO(sbi) (sbi->root_ino_num)
27#define F2FS_NODE_INO(sbi) (sbi->node_ino_num)
28#define F2FS_META_INO(sbi) (sbi->meta_ino_num)
29
30/* This flag is used by node and meta inodes, and by recovery */
31#define GFP_F2FS_ZERO (GFP_NOFS | __GFP_ZERO)
32
33/*
34 * For further optimization on multi-head logs, on-disk layout supports maximum
35 * 16 logs by default. The number, 16, is expected to cover all the cases
36 * enoughly. The implementaion currently uses no more than 6 logs.
37 * Half the logs are used for nodes, and the other half are used for data.
38 */
39#define MAX_ACTIVE_LOGS 16
40#define MAX_ACTIVE_NODE_LOGS 8
41#define MAX_ACTIVE_DATA_LOGS 8
42
43/*
44 * For superblock
45 */
46struct f2fs_super_block {
47 __le32 magic; /* Magic Number */
48 __le16 major_ver; /* Major Version */
49 __le16 minor_ver; /* Minor Version */
50 __le32 log_sectorsize; /* log2 sector size in bytes */
51 __le32 log_sectors_per_block; /* log2 # of sectors per block */
52 __le32 log_blocksize; /* log2 block size in bytes */
53 __le32 log_blocks_per_seg; /* log2 # of blocks per segment */
54 __le32 segs_per_sec; /* # of segments per section */
55 __le32 secs_per_zone; /* # of sections per zone */
56 __le32 checksum_offset; /* checksum offset inside super block */
57 __le64 block_count; /* total # of user blocks */
58 __le32 section_count; /* total # of sections */
59 __le32 segment_count; /* total # of segments */
60 __le32 segment_count_ckpt; /* # of segments for checkpoint */
61 __le32 segment_count_sit; /* # of segments for SIT */
62 __le32 segment_count_nat; /* # of segments for NAT */
63 __le32 segment_count_ssa; /* # of segments for SSA */
64 __le32 segment_count_main; /* # of segments for main area */
65 __le32 segment0_blkaddr; /* start block address of segment 0 */
66 __le32 cp_blkaddr; /* start block address of checkpoint */
67 __le32 sit_blkaddr; /* start block address of SIT */
68 __le32 nat_blkaddr; /* start block address of NAT */
69 __le32 ssa_blkaddr; /* start block address of SSA */
70 __le32 main_blkaddr; /* start block address of main area */
71 __le32 root_ino; /* root inode number */
72 __le32 node_ino; /* node inode number */
73 __le32 meta_ino; /* meta inode number */
74 __u8 uuid[16]; /* 128-bit uuid for volume */
75 __le16 volume_name[512]; /* volume name */
76 __le32 extension_count; /* # of extensions below */
77 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
78} __packed;
79
80/*
81 * For checkpoint
82 */
83#define CP_ERROR_FLAG 0x00000008
84#define CP_COMPACT_SUM_FLAG 0x00000004
85#define CP_ORPHAN_PRESENT_FLAG 0x00000002
86#define CP_UMOUNT_FLAG 0x00000001
87
88struct f2fs_checkpoint {
89 __le64 checkpoint_ver; /* checkpoint block version number */
90 __le64 user_block_count; /* # of user blocks */
91 __le64 valid_block_count; /* # of valid blocks in main area */
92 __le32 rsvd_segment_count; /* # of reserved segments for gc */
93 __le32 overprov_segment_count; /* # of overprovision segments */
94 __le32 free_segment_count; /* # of free segments in main area */
95
96 /* information of current node segments */
97 __le32 cur_node_segno[MAX_ACTIVE_NODE_LOGS];
98 __le16 cur_node_blkoff[MAX_ACTIVE_NODE_LOGS];
99 /* information of current data segments */
100 __le32 cur_data_segno[MAX_ACTIVE_DATA_LOGS];
101 __le16 cur_data_blkoff[MAX_ACTIVE_DATA_LOGS];
102 __le32 ckpt_flags; /* Flags : umount and journal_present */
103 __le32 cp_pack_total_block_count; /* total # of one cp pack */
104 __le32 cp_pack_start_sum; /* start block number of data summary */
105 __le32 valid_node_count; /* Total number of valid nodes */
106 __le32 valid_inode_count; /* Total number of valid inodes */
107 __le32 next_free_nid; /* Next free node number */
108 __le32 sit_ver_bitmap_bytesize; /* Default value 64 */
109 __le32 nat_ver_bitmap_bytesize; /* Default value 256 */
110 __le32 checksum_offset; /* checksum offset inside cp block */
111 __le64 elapsed_time; /* mounted time */
112 /* allocation type of current segment */
113 unsigned char alloc_type[MAX_ACTIVE_LOGS];
114
115 /* SIT and NAT version bitmap */
116 unsigned char sit_nat_version_bitmap[1];
117} __packed;
118
119/*
120 * For orphan inode management
121 */
122#define F2FS_ORPHANS_PER_BLOCK 1020
123
124struct f2fs_orphan_block {
125 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
126 __le32 reserved; /* reserved */
127 __le16 blk_addr; /* block index in current CP */
128 __le16 blk_count; /* Number of orphan inode blocks in CP */
129 __le32 entry_count; /* Total number of orphan nodes in current CP */
130 __le32 check_sum; /* CRC32 for orphan inode block */
131} __packed;
132
133/*
134 * For NODE structure
135 */
136struct f2fs_extent {
137 __le32 fofs; /* start file offset of the extent */
138 __le32 blk_addr; /* start block address of the extent */
139 __le32 len; /* lengh of the extent */
140} __packed;
141
142#define F2FS_MAX_NAME_LEN 256
143#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
144#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
145#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
146
147struct f2fs_inode {
148 __le16 i_mode; /* file mode */
149 __u8 i_advise; /* file hints */
150 __u8 i_reserved; /* reserved */
151 __le32 i_uid; /* user ID */
152 __le32 i_gid; /* group ID */
153 __le32 i_links; /* links count */
154 __le64 i_size; /* file size in bytes */
155 __le64 i_blocks; /* file size in blocks */
156 __le64 i_atime; /* access time */
157 __le64 i_ctime; /* change time */
158 __le64 i_mtime; /* modification time */
159 __le32 i_atime_nsec; /* access time in nano scale */
160 __le32 i_ctime_nsec; /* change time in nano scale */
161 __le32 i_mtime_nsec; /* modification time in nano scale */
162 __le32 i_generation; /* file version (for NFS) */
163 __le32 i_current_depth; /* only for directory depth */
164 __le32 i_xattr_nid; /* nid to save xattr */
165 __le32 i_flags; /* file attributes */
166 __le32 i_pino; /* parent inode number */
167 __le32 i_namelen; /* file name length */
168 __u8 i_name[F2FS_MAX_NAME_LEN]; /* file name for SPOR */
169
170 struct f2fs_extent i_ext; /* caching a largest extent */
171
172 __le32 i_addr[ADDRS_PER_INODE]; /* Pointers to data blocks */
173
174 __le32 i_nid[5]; /* direct(2), indirect(2),
175 double_indirect(1) node id */
176} __packed;
177
178struct direct_node {
179 __le32 addr[ADDRS_PER_BLOCK]; /* array of data block address */
180} __packed;
181
182struct indirect_node {
183 __le32 nid[NIDS_PER_BLOCK]; /* array of data block address */
184} __packed;
185
186enum {
187 COLD_BIT_SHIFT = 0,
188 FSYNC_BIT_SHIFT,
189 DENT_BIT_SHIFT,
190 OFFSET_BIT_SHIFT
191};
192
193struct node_footer {
194 __le32 nid; /* node id */
195 __le32 ino; /* inode nunmber */
196 __le32 flag; /* include cold/fsync/dentry marks and offset */
197 __le64 cp_ver; /* checkpoint version */
198 __le32 next_blkaddr; /* next node page block address */
199} __packed;
200
201struct f2fs_node {
202 /* can be one of three types: inode, direct, and indirect types */
203 union {
204 struct f2fs_inode i;
205 struct direct_node dn;
206 struct indirect_node in;
207 };
208 struct node_footer footer;
209} __packed;
210
211/*
212 * For NAT entries
213 */
214#define NAT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_nat_entry))
215
216struct f2fs_nat_entry {
217 __u8 version; /* latest version of cached nat entry */
218 __le32 ino; /* inode number */
219 __le32 block_addr; /* block address */
220} __packed;
221
222struct f2fs_nat_block {
223 struct f2fs_nat_entry entries[NAT_ENTRY_PER_BLOCK];
224} __packed;
225
226/*
227 * For SIT entries
228 *
229 * Each segment is 2MB in size by default so that a bitmap for validity of
230 * there-in blocks should occupy 64 bytes, 512 bits.
231 * Not allow to change this.
232 */
233#define SIT_VBLOCK_MAP_SIZE 64
234#define SIT_ENTRY_PER_BLOCK (PAGE_CACHE_SIZE / sizeof(struct f2fs_sit_entry))
235
236/*
237 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
238 * [15:10] : allocation type such as CURSEG_XXXX_TYPE
239 * [9:0] : valid block count
240 */
241#define SIT_VBLOCKS_SHIFT 10
242#define SIT_VBLOCKS_MASK ((1 << SIT_VBLOCKS_SHIFT) - 1)
243#define GET_SIT_VBLOCKS(raw_sit) \
244 (le16_to_cpu((raw_sit)->vblocks) & SIT_VBLOCKS_MASK)
245#define GET_SIT_TYPE(raw_sit) \
246 ((le16_to_cpu((raw_sit)->vblocks) & ~SIT_VBLOCKS_MASK) \
247 >> SIT_VBLOCKS_SHIFT)
248
249struct f2fs_sit_entry {
250 __le16 vblocks; /* reference above */
251 __u8 valid_map[SIT_VBLOCK_MAP_SIZE]; /* bitmap for valid blocks */
252 __le64 mtime; /* segment age for cleaning */
253} __packed;
254
255struct f2fs_sit_block {
256 struct f2fs_sit_entry entries[SIT_ENTRY_PER_BLOCK];
257} __packed;
258
259/*
260 * For segment summary
261 *
262 * One summary block contains exactly 512 summary entries, which represents
263 * exactly 2MB segment by default. Not allow to change the basic units.
264 *
265 * NOTE: For initializing fields, you must use set_summary
266 *
267 * - If data page, nid represents dnode's nid
268 * - If node page, nid represents the node page's nid.
269 *
270 * The ofs_in_node is used by only data page. It represents offset
271 * from node's page's beginning to get a data block address.
272 * ex) data_blkaddr = (block_t)(nodepage_start_address + ofs_in_node)
273 */
274#define ENTRIES_IN_SUM 512
275#define SUMMARY_SIZE (7) /* sizeof(struct summary) */
276#define SUM_FOOTER_SIZE (5) /* sizeof(struct summary_footer) */
277#define SUM_ENTRY_SIZE (SUMMARY_SIZE * ENTRIES_IN_SUM)
278
279/* a summary entry for a 4KB-sized block in a segment */
280struct f2fs_summary {
281 __le32 nid; /* parent node id */
282 union {
283 __u8 reserved[3];
284 struct {
285 __u8 version; /* node version number */
286 __le16 ofs_in_node; /* block index in parent node */
287 } __packed;
288 };
289} __packed;
290
291/* summary block type, node or data, is stored to the summary_footer */
292#define SUM_TYPE_NODE (1)
293#define SUM_TYPE_DATA (0)
294
295struct summary_footer {
296 unsigned char entry_type; /* SUM_TYPE_XXX */
297 __u32 check_sum; /* summary checksum */
298} __packed;
299
300#define SUM_JOURNAL_SIZE (F2FS_BLKSIZE - SUM_FOOTER_SIZE -\
301 SUM_ENTRY_SIZE)
302#define NAT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
303 sizeof(struct nat_journal_entry))
304#define NAT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
305 sizeof(struct nat_journal_entry))
306#define SIT_JOURNAL_ENTRIES ((SUM_JOURNAL_SIZE - 2) /\
307 sizeof(struct sit_journal_entry))
308#define SIT_JOURNAL_RESERVED ((SUM_JOURNAL_SIZE - 2) %\
309 sizeof(struct sit_journal_entry))
310/*
311 * frequently updated NAT/SIT entries can be stored in the spare area in
312 * summary blocks
313 */
314enum {
315 NAT_JOURNAL = 0,
316 SIT_JOURNAL
317};
318
319struct nat_journal_entry {
320 __le32 nid;
321 struct f2fs_nat_entry ne;
322} __packed;
323
324struct nat_journal {
325 struct nat_journal_entry entries[NAT_JOURNAL_ENTRIES];
326 __u8 reserved[NAT_JOURNAL_RESERVED];
327} __packed;
328
329struct sit_journal_entry {
330 __le32 segno;
331 struct f2fs_sit_entry se;
332} __packed;
333
334struct sit_journal {
335 struct sit_journal_entry entries[SIT_JOURNAL_ENTRIES];
336 __u8 reserved[SIT_JOURNAL_RESERVED];
337} __packed;
338
339/* 4KB-sized summary block structure */
340struct f2fs_summary_block {
341 struct f2fs_summary entries[ENTRIES_IN_SUM];
342 union {
343 __le16 n_nats;
344 __le16 n_sits;
345 };
346 /* spare area is used by NAT or SIT journals */
347 union {
348 struct nat_journal nat_j;
349 struct sit_journal sit_j;
350 };
351 struct summary_footer footer;
352} __packed;
353
354/*
355 * For directory operations
356 */
357#define F2FS_DOT_HASH 0
358#define F2FS_DDOT_HASH F2FS_DOT_HASH
359#define F2FS_MAX_HASH (~((0x3ULL) << 62))
360#define F2FS_HASH_COL_BIT ((0x1ULL) << 63)
361
362typedef __le32 f2fs_hash_t;
363
364/* One directory entry slot covers 8bytes-long file name */
365#define F2FS_NAME_LEN 8
366#define F2FS_NAME_LEN_BITS 3
367
368#define GET_DENTRY_SLOTS(x) ((x + F2FS_NAME_LEN - 1) >> F2FS_NAME_LEN_BITS)
369
370/* the number of dentry in a block */
371#define NR_DENTRY_IN_BLOCK 214
372
373/* MAX level for dir lookup */
374#define MAX_DIR_HASH_DEPTH 63
375
376#define SIZE_OF_DIR_ENTRY 11 /* by byte */
377#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
378 BITS_PER_BYTE)
379#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \
380 F2FS_NAME_LEN) * \
381 NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP))
382
383/* One directory entry slot representing F2FS_NAME_LEN-sized file name */
384struct f2fs_dir_entry {
385 __le32 hash_code; /* hash code of file name */
386 __le32 ino; /* inode number */
387 __le16 name_len; /* lengh of file name */
388 __u8 file_type; /* file type */
389} __packed;
390
391/* 4KB-sized directory entry block */
392struct f2fs_dentry_block {
393 /* validity bitmap for directory entries in each block */
394 __u8 dentry_bitmap[SIZE_OF_DENTRY_BITMAP];
395 __u8 reserved[SIZE_OF_RESERVED];
396 struct f2fs_dir_entry dentry[NR_DENTRY_IN_BLOCK];
397 __u8 filename[NR_DENTRY_IN_BLOCK][F2FS_NAME_LEN];
398} __packed;
399
400/* file types used in inode_info->flags */
401enum {
402 F2FS_FT_UNKNOWN,
403 F2FS_FT_REG_FILE,
404 F2FS_FT_DIR,
405 F2FS_FT_CHRDEV,
406 F2FS_FT_BLKDEV,
407 F2FS_FT_FIFO,
408 F2FS_FT_SOCK,
409 F2FS_FT_SYMLINK,
410 F2FS_FT_MAX
411};
412
413#endif /* _LINUX_F2FS_FS_H */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 45052aa814c..fb7dacae052 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -95,7 +95,6 @@ struct task_struct;
95struct files_struct *get_files_struct(struct task_struct *); 95struct files_struct *get_files_struct(struct task_struct *);
96void put_files_struct(struct files_struct *fs); 96void put_files_struct(struct files_struct *fs);
97void reset_files_struct(struct files_struct *); 97void reset_files_struct(struct files_struct *);
98void daemonize_descriptors(void);
99int unshare_files(struct files_struct **); 98int unshare_files(struct files_struct **);
100struct files_struct *dup_fd(struct files_struct *, int *); 99struct files_struct *dup_fd(struct files_struct *, int *);
101void do_close_on_exec(struct files_struct *); 100void do_close_on_exec(struct files_struct *);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 24d251f3bab..c45eabc135e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -45,6 +45,7 @@ extern void sk_unattached_filter_destroy(struct sk_filter *fp);
45extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 45extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
46extern int sk_detach_filter(struct sock *sk); 46extern int sk_detach_filter(struct sock *sk);
47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 47extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
48extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);
48 49
49#ifdef CONFIG_BPF_JIT 50#ifdef CONFIG_BPF_JIT
50extern void bpf_jit_compile(struct sk_filter *fp); 51extern void bpf_jit_compile(struct sk_filter *fp);
@@ -123,6 +124,8 @@ enum {
123 BPF_S_ANC_CPU, 124 BPF_S_ANC_CPU,
124 BPF_S_ANC_ALU_XOR_X, 125 BPF_S_ANC_ALU_XOR_X,
125 BPF_S_ANC_SECCOMP_LD_W, 126 BPF_S_ANC_SECCOMP_LD_W,
127 BPF_S_ANC_VLAN_TAG,
128 BPF_S_ANC_VLAN_TAG_PRESENT,
126}; 129};
127 130
128#endif /* __LINUX_FILTER_H__ */ 131#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index d09af4b67cf..e4238ceaa4d 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -75,35 +75,68 @@ static inline bool cgroup_freezing(struct task_struct *task)
75 */ 75 */
76 76
77 77
78/* Tell the freezer not to count the current task as freezable. */ 78/**
79 * freezer_do_not_count - tell freezer to ignore %current
80 *
81 * Tell freezers to ignore the current task when determining whether the
82 * target frozen state is reached. IOW, the current task will be
83 * considered frozen enough by freezers.
84 *
85 * The caller shouldn't do anything which isn't allowed for a frozen task
86 * until freezer_cont() is called. Usually, freezer[_do_not]_count() pair
87 * wrap a scheduling operation and nothing much else.
88 */
79static inline void freezer_do_not_count(void) 89static inline void freezer_do_not_count(void)
80{ 90{
81 current->flags |= PF_FREEZER_SKIP; 91 current->flags |= PF_FREEZER_SKIP;
82} 92}
83 93
84/* 94/**
85 * Tell the freezer to count the current task as freezable again and try to 95 * freezer_count - tell freezer to stop ignoring %current
86 * freeze it. 96 *
97 * Undo freezer_do_not_count(). It tells freezers that %current should be
98 * considered again and tries to freeze if freezing condition is already in
99 * effect.
87 */ 100 */
88static inline void freezer_count(void) 101static inline void freezer_count(void)
89{ 102{
90 current->flags &= ~PF_FREEZER_SKIP; 103 current->flags &= ~PF_FREEZER_SKIP;
104 /*
105 * If freezing is in progress, the following paired with smp_mb()
106 * in freezer_should_skip() ensures that either we see %true
107 * freezing() or freezer_should_skip() sees !PF_FREEZER_SKIP.
108 */
109 smp_mb();
91 try_to_freeze(); 110 try_to_freeze();
92} 111}
93 112
94/* 113/**
95 * Check if the task should be counted as freezable by the freezer 114 * freezer_should_skip - whether to skip a task when determining frozen
115 * state is reached
116 * @p: task in quesion
117 *
118 * This function is used by freezers after establishing %true freezing() to
119 * test whether a task should be skipped when determining the target frozen
120 * state is reached. IOW, if this function returns %true, @p is considered
121 * frozen enough.
96 */ 122 */
97static inline int freezer_should_skip(struct task_struct *p) 123static inline bool freezer_should_skip(struct task_struct *p)
98{ 124{
99 return !!(p->flags & PF_FREEZER_SKIP); 125 /*
126 * The following smp_mb() paired with the one in freezer_count()
127 * ensures that either freezer_count() sees %true freezing() or we
128 * see cleared %PF_FREEZER_SKIP and return %false. This makes it
129 * impossible for a task to slip frozen state testing after
130 * clearing %PF_FREEZER_SKIP.
131 */
132 smp_mb();
133 return p->flags & PF_FREEZER_SKIP;
100} 134}
101 135
102/* 136/*
103 * These macros are intended to be used whenever you want allow a task that's 137 * These macros are intended to be used whenever you want allow a sleeping
104 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note 138 * task to be frozen. Note that neither return any clear indication of
105 * that neither return any clear indication of whether a freeze event happened 139 * whether a freeze event happened while in this function.
106 * while in this function.
107 */ 140 */
108 141
109/* Like schedule(), but should not block the freezer. */ 142/* Like schedule(), but should not block the freezer. */
@@ -177,6 +210,7 @@ static inline int freeze_kernel_threads(void) { return -ENOSYS; }
177static inline void thaw_processes(void) {} 210static inline void thaw_processes(void) {}
178static inline void thaw_kernel_threads(void) {} 211static inline void thaw_kernel_threads(void) {}
179 212
213static inline bool try_to_freeze_nowarn(void) { return false; }
180static inline bool try_to_freeze(void) { return false; } 214static inline bool try_to_freeze(void) { return false; }
181 215
182static inline void freezer_do_not_count(void) {} 216static inline void freezer_do_not_count(void) {}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 75fe9a13480..7617ee04f06 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -44,6 +44,7 @@ struct vm_area_struct;
44struct vfsmount; 44struct vfsmount;
45struct cred; 45struct cred;
46struct swap_info_struct; 46struct swap_info_struct;
47struct seq_file;
47 48
48extern void __init inode_init(void); 49extern void __init inode_init(void);
49extern void __init inode_init_early(void); 50extern void __init inode_init_early(void);
@@ -418,7 +419,7 @@ struct address_space {
418 struct backing_dev_info *backing_dev_info; /* device readahead, etc */ 419 struct backing_dev_info *backing_dev_info; /* device readahead, etc */
419 spinlock_t private_lock; /* for use by the address_space */ 420 spinlock_t private_lock; /* for use by the address_space */
420 struct list_head private_list; /* ditto */ 421 struct list_head private_list; /* ditto */
421 struct address_space *assoc_mapping; /* ditto */ 422 void *private_data; /* ditto */
422} __attribute__((aligned(sizeof(long)))); 423} __attribute__((aligned(sizeof(long))));
423 /* 424 /*
424 * On most architectures that alignment is already the case; but 425 * On most architectures that alignment is already the case; but
@@ -1444,10 +1445,6 @@ static inline void sb_start_intwrite(struct super_block *sb)
1444 1445
1445extern bool inode_owner_or_capable(const struct inode *inode); 1446extern bool inode_owner_or_capable(const struct inode *inode);
1446 1447
1447/* not quite ready to be deprecated, but... */
1448extern void lock_super(struct super_block *);
1449extern void unlock_super(struct super_block *);
1450
1451/* 1448/*
1452 * VFS helper functions.. 1449 * VFS helper functions..
1453 */ 1450 */
@@ -1543,6 +1540,7 @@ struct file_operations {
1543 int (*setlease)(struct file *, long, struct file_lock **); 1540 int (*setlease)(struct file *, long, struct file_lock **);
1544 long (*fallocate)(struct file *file, int mode, loff_t offset, 1541 long (*fallocate)(struct file *file, int mode, loff_t offset,
1545 loff_t len); 1542 loff_t len);
1543 int (*show_fdinfo)(struct seq_file *m, struct file *f);
1546}; 1544};
1547 1545
1548struct inode_operations { 1546struct inode_operations {
@@ -1563,7 +1561,6 @@ struct inode_operations {
1563 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); 1561 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1564 int (*rename) (struct inode *, struct dentry *, 1562 int (*rename) (struct inode *, struct dentry *,
1565 struct inode *, struct dentry *); 1563 struct inode *, struct dentry *);
1566 void (*truncate) (struct inode *);
1567 int (*setattr) (struct dentry *, struct iattr *); 1564 int (*setattr) (struct dentry *, struct iattr *);
1568 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1565 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1569 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1566 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1578,8 +1575,6 @@ struct inode_operations {
1578 umode_t create_mode, int *opened); 1575 umode_t create_mode, int *opened);
1579} ____cacheline_aligned; 1576} ____cacheline_aligned;
1580 1577
1581struct seq_file;
1582
1583ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1578ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
1584 unsigned long nr_segs, unsigned long fast_segs, 1579 unsigned long nr_segs, unsigned long fast_segs,
1585 struct iovec *fast_pointer, 1580 struct iovec *fast_pointer,
@@ -1810,6 +1805,8 @@ struct file_system_type {
1810#define FS_REQUIRES_DEV 1 1805#define FS_REQUIRES_DEV 1
1811#define FS_BINARY_MOUNTDATA 2 1806#define FS_BINARY_MOUNTDATA 2
1812#define FS_HAS_SUBTYPE 4 1807#define FS_HAS_SUBTYPE 4
1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
1813#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ 1810#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1814#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 1811#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1815 struct dentry *(*mount) (struct file_system_type *, int, 1812 struct dentry *(*mount) (struct file_system_type *, int,
@@ -1997,6 +1994,7 @@ struct filename {
1997 bool separate; /* should "name" be freed? */ 1994 bool separate; /* should "name" be freed? */
1998}; 1995};
1999 1996
1997extern long vfs_truncate(struct path *, loff_t);
2000extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, 1998extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2001 struct file *filp); 1999 struct file *filp);
2002extern int do_fallocate(struct file *file, int mode, loff_t offset, 2000extern int do_fallocate(struct file *file, int mode, loff_t offset,
@@ -2286,9 +2284,9 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
2286#include <linux/err.h> 2284#include <linux/err.h>
2287 2285
2288/* needed for stackable file system support */ 2286/* needed for stackable file system support */
2289extern loff_t default_llseek(struct file *file, loff_t offset, int origin); 2287extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
2290 2288
2291extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); 2289extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
2292 2290
2293extern int inode_init_always(struct super_block *, struct inode *); 2291extern int inode_init_always(struct super_block *, struct inode *);
2294extern void inode_init_once(struct inode *); 2292extern void inode_init_once(struct inode *);
@@ -2396,11 +2394,11 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2396 2394
2397extern void 2395extern void
2398file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2396file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2399extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); 2397extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
2400extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2398extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
2401extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2399extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
2402extern loff_t generic_file_llseek_size(struct file *file, loff_t offset, 2400extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,
2403 int origin, loff_t maxsize, loff_t eof); 2401 int whence, loff_t maxsize, loff_t eof);
2404extern int generic_file_open(struct inode * inode, struct file * filp); 2402extern int generic_file_open(struct inode * inode, struct file * filp);
2405extern int nonseekable_open(struct inode * inode, struct file * filp); 2403extern int nonseekable_open(struct inode * inode, struct file * filp);
2406 2404
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 003dc0fd734..d0ae3a84bcf 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -21,7 +21,6 @@ extern void set_fs_root(struct fs_struct *, struct path *);
21extern void set_fs_pwd(struct fs_struct *, struct path *); 21extern void set_fs_pwd(struct fs_struct *, struct path *);
22extern struct fs_struct *copy_fs_struct(struct fs_struct *); 22extern struct fs_struct *copy_fs_struct(struct fs_struct *);
23extern void free_fs_struct(struct fs_struct *); 23extern void free_fs_struct(struct fs_struct *);
24extern void daemonize_fs_struct(void);
25extern int unshare_fs_struct(void); 24extern int unshare_fs_struct(void);
26 25
27static inline void get_fs_root(struct fs_struct *fs, struct path *root) 26static inline void get_fs_root(struct fs_struct *fs, struct path *root)
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index ce31408b1e4..5dfa0aa216b 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -75,6 +75,16 @@ extern wait_queue_head_t fscache_cache_cleared_wq;
75typedef void (*fscache_operation_release_t)(struct fscache_operation *op); 75typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); 76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77 77
78enum fscache_operation_state {
79 FSCACHE_OP_ST_BLANK, /* Op is not yet submitted */
80 FSCACHE_OP_ST_INITIALISED, /* Op is initialised */
81 FSCACHE_OP_ST_PENDING, /* Op is blocked from running */
82 FSCACHE_OP_ST_IN_PROGRESS, /* Op is in progress */
83 FSCACHE_OP_ST_COMPLETE, /* Op is complete */
84 FSCACHE_OP_ST_CANCELLED, /* Op has been cancelled */
85 FSCACHE_OP_ST_DEAD /* Op is now dead */
86};
87
78struct fscache_operation { 88struct fscache_operation {
79 struct work_struct work; /* record for async ops */ 89 struct work_struct work; /* record for async ops */
80 struct list_head pend_link; /* link in object->pending_ops */ 90 struct list_head pend_link; /* link in object->pending_ops */
@@ -86,10 +96,10 @@ struct fscache_operation {
86#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */ 96#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */
87#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 97#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
88#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 98#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
89#define FSCACHE_OP_DEAD 6 /* op is now dead */ 99#define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */
90#define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */ 100#define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */
91#define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */
92 101
102 enum fscache_operation_state state;
93 atomic_t usage; 103 atomic_t usage;
94 unsigned debug_id; /* debugging ID */ 104 unsigned debug_id; /* debugging ID */
95 105
@@ -106,6 +116,7 @@ extern atomic_t fscache_op_debug_id;
106extern void fscache_op_work_func(struct work_struct *work); 116extern void fscache_op_work_func(struct work_struct *work);
107 117
108extern void fscache_enqueue_operation(struct fscache_operation *); 118extern void fscache_enqueue_operation(struct fscache_operation *);
119extern void fscache_op_complete(struct fscache_operation *, bool);
109extern void fscache_put_operation(struct fscache_operation *); 120extern void fscache_put_operation(struct fscache_operation *);
110 121
111/** 122/**
@@ -122,6 +133,7 @@ static inline void fscache_operation_init(struct fscache_operation *op,
122{ 133{
123 INIT_WORK(&op->work, fscache_op_work_func); 134 INIT_WORK(&op->work, fscache_op_work_func);
124 atomic_set(&op->usage, 1); 135 atomic_set(&op->usage, 1);
136 op->state = FSCACHE_OP_ST_INITIALISED;
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 137 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->processor = processor; 138 op->processor = processor;
127 op->release = release; 139 op->release = release;
@@ -138,6 +150,7 @@ struct fscache_retrieval {
138 void *context; /* netfs read context (pinned) */ 150 void *context; /* netfs read context (pinned) */
139 struct list_head to_do; /* list of things to be done by the backend */ 151 struct list_head to_do; /* list of things to be done by the backend */
140 unsigned long start_time; /* time at which retrieval started */ 152 unsigned long start_time; /* time at which retrieval started */
153 unsigned n_pages; /* number of pages to be retrieved */
141}; 154};
142 155
143typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, 156typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
@@ -174,8 +187,22 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
174} 187}
175 188
176/** 189/**
190 * fscache_retrieval_complete - Record (partial) completion of a retrieval
191 * @op: The retrieval operation affected
192 * @n_pages: The number of pages to account for
193 */
194static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
195 int n_pages)
196{
197 op->n_pages -= n_pages;
198 if (op->n_pages <= 0)
199 fscache_op_complete(&op->op, true);
200}
201
202/**
177 * fscache_put_retrieval - Drop a reference to a retrieval operation 203 * fscache_put_retrieval - Drop a reference to a retrieval operation
178 * @op: The retrieval operation affected 204 * @op: The retrieval operation affected
205 * @n_pages: The number of pages to account for
179 * 206 *
180 * Drop a reference to a retrieval operation. 207 * Drop a reference to a retrieval operation.
181 */ 208 */
@@ -227,6 +254,9 @@ struct fscache_cache_ops {
227 /* store the updated auxiliary data on an object */ 254 /* store the updated auxiliary data on an object */
228 void (*update_object)(struct fscache_object *object); 255 void (*update_object)(struct fscache_object *object);
229 256
257 /* Invalidate an object */
258 void (*invalidate_object)(struct fscache_operation *op);
259
230 /* discard the resources pinned by an object and effect retirement if 260 /* discard the resources pinned by an object and effect retirement if
231 * necessary */ 261 * necessary */
232 void (*drop_object)(struct fscache_object *object); 262 void (*drop_object)(struct fscache_object *object);
@@ -301,11 +331,30 @@ struct fscache_cookie {
301#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ 331#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */
302#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ 332#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */
303#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ 333#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */
334#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
335#define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */
304}; 336};
305 337
306extern struct fscache_cookie fscache_fsdef_index; 338extern struct fscache_cookie fscache_fsdef_index;
307 339
308/* 340/*
341 * Event list for fscache_object::{event_mask,events}
342 */
343enum {
344 FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */
345 FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346 FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347 FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348 FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349 FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */
350 FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351 FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352 NR_FSCACHE_OBJECT_EVENTS
353};
354
355#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356
357/*
309 * on-disk cache file or index handle 358 * on-disk cache file or index handle
310 */ 359 */
311struct fscache_object { 360struct fscache_object {
@@ -317,6 +366,7 @@ struct fscache_object {
317 /* active states */ 366 /* active states */
318 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */ 367 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
319 FSCACHE_OBJECT_ACTIVE, /* object is usable */ 368 FSCACHE_OBJECT_ACTIVE, /* object is usable */
369 FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */
320 FSCACHE_OBJECT_UPDATING, /* object is updating */ 370 FSCACHE_OBJECT_UPDATING, /* object is updating */
321 371
322 /* terminal states */ 372 /* terminal states */
@@ -332,10 +382,10 @@ struct fscache_object {
332 382
333 int debug_id; /* debugging ID */ 383 int debug_id; /* debugging ID */
334 int n_children; /* number of child objects */ 384 int n_children; /* number of child objects */
335 int n_ops; /* number of ops outstanding on object */ 385 int n_ops; /* number of extant ops on object */
336 int n_obj_ops; /* number of object ops outstanding on object */ 386 int n_obj_ops; /* number of object ops outstanding on object */
337 int n_in_progress; /* number of ops in progress */ 387 int n_in_progress; /* number of ops in progress */
338 int n_exclusive; /* number of exclusive ops queued */ 388 int n_exclusive; /* number of exclusive ops queued or in progress */
339 atomic_t n_reads; /* number of read ops in progress */ 389 atomic_t n_reads; /* number of read ops in progress */
340 spinlock_t lock; /* state and operations lock */ 390 spinlock_t lock; /* state and operations lock */
341 391
@@ -343,14 +393,6 @@ struct fscache_object {
343 unsigned long event_mask; /* events this object is interested in */ 393 unsigned long event_mask; /* events this object is interested in */
344 unsigned long events; /* events to be processed by this object 394 unsigned long events; /* events to be processed by this object
345 * (order is important - using fls) */ 395 * (order is important - using fls) */
346#define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */
347#define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */
348#define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */
349#define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */
350#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
351#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
352#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
353#define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/
354 396
355 unsigned long flags; 397 unsigned long flags;
356#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ 398#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
@@ -504,6 +546,9 @@ extern void fscache_withdraw_cache(struct fscache_cache *cache);
504 546
505extern void fscache_io_error(struct fscache_cache *cache); 547extern void fscache_io_error(struct fscache_cache *cache);
506 548
549extern void fscache_mark_page_cached(struct fscache_retrieval *op,
550 struct page *page);
551
507extern void fscache_mark_pages_cached(struct fscache_retrieval *op, 552extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
508 struct pagevec *pagevec); 553 struct pagevec *pagevec);
509 554
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 9ec20dec335..7a086235da4 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -135,14 +135,14 @@ struct fscache_cookie_def {
135 */ 135 */
136 void (*put_context)(void *cookie_netfs_data, void *context); 136 void (*put_context)(void *cookie_netfs_data, void *context);
137 137
138 /* indicate pages that now have cache metadata retained 138 /* indicate page that now have cache metadata retained
139 * - this function should mark the specified pages as now being cached 139 * - this function should mark the specified page as now being cached
140 * - the pages will have been marked with PG_fscache before this is 140 * - the page will have been marked with PG_fscache before this is
141 * called, so this is optional 141 * called, so this is optional
142 */ 142 */
143 void (*mark_pages_cached)(void *cookie_netfs_data, 143 void (*mark_page_cached)(void *cookie_netfs_data,
144 struct address_space *mapping, 144 struct address_space *mapping,
145 struct pagevec *cached_pvec); 145 struct page *page);
146 146
147 /* indicate the cookie is no longer cached 147 /* indicate the cookie is no longer cached
148 * - this function is called when the backing store currently caching 148 * - this function is called when the backing store currently caching
@@ -185,6 +185,8 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern void __fscache_update_cookie(struct fscache_cookie *); 186extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *); 187extern int __fscache_attr_changed(struct fscache_cookie *);
188extern void __fscache_invalidate(struct fscache_cookie *);
189extern void __fscache_wait_on_invalidate(struct fscache_cookie *);
188extern int __fscache_read_or_alloc_page(struct fscache_cookie *, 190extern int __fscache_read_or_alloc_page(struct fscache_cookie *,
189 struct page *, 191 struct page *,
190 fscache_rw_complete_t, 192 fscache_rw_complete_t,
@@ -390,6 +392,42 @@ int fscache_attr_changed(struct fscache_cookie *cookie)
390} 392}
391 393
392/** 394/**
395 * fscache_invalidate - Notify cache that an object needs invalidation
396 * @cookie: The cookie representing the cache object
397 *
398 * Notify the cache that an object is needs to be invalidated and that it
399 * should abort any retrievals or stores it is doing on the cache. The object
400 * is then marked non-caching until such time as the invalidation is complete.
401 *
402 * This can be called with spinlocks held.
403 *
404 * See Documentation/filesystems/caching/netfs-api.txt for a complete
405 * description.
406 */
407static inline
408void fscache_invalidate(struct fscache_cookie *cookie)
409{
410 if (fscache_cookie_valid(cookie))
411 __fscache_invalidate(cookie);
412}
413
414/**
415 * fscache_wait_on_invalidate - Wait for invalidation to complete
416 * @cookie: The cookie representing the cache object
417 *
418 * Wait for the invalidation of an object to complete.
419 *
420 * See Documentation/filesystems/caching/netfs-api.txt for a complete
421 * description.
422 */
423static inline
424void fscache_wait_on_invalidate(struct fscache_cookie *cookie)
425{
426 if (fscache_cookie_valid(cookie))
427 __fscache_wait_on_invalidate(cookie);
428}
429
430/**
393 * fscache_reserve_space - Reserve data space for a cached object 431 * fscache_reserve_space - Reserve data space for a cached object
394 * @cookie: The cookie representing the cache object 432 * @cookie: The cookie representing the cache object
395 * @i_size: The amount of space to be reserved 433 * @i_size: The amount of space to be reserved
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
index 11c16a1fb9e..a1e8277120c 100644
--- a/include/linux/fsl-diu-fb.h
+++ b/include/linux/fsl-diu-fb.h
@@ -47,6 +47,15 @@ struct aoi_display_offset {
47#define MFB_GET_PIXFMT _IOR('M', 8, __u32) 47#define MFB_GET_PIXFMT _IOR('M', 8, __u32)
48 48
49/* 49/*
50 * The MPC5121 BSP comes with a gamma_set utility that initializes the
51 * gamma table. Unfortunately, it uses bad values for the IOCTL commands,
52 * but there's nothing we can do about it now. These ioctls are only
53 * supported on the MPC5121.
54 */
55#define MFB_SET_GAMMA _IOW('M', 1, __u8)
56#define MFB_GET_GAMMA _IOR('M', 1, __u8)
57
58/*
50 * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the 59 * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the
51 * wrong value for 'size' field of the ioctl. The current macros above use the 60 * wrong value for 'size' field of the ioctl. The current macros above use the
52 * right size, but we still need to provide backwards compatibility, at least 61 * right size, but we still need to provide backwards compatibility, at least
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 63d966d5c2e..d5b0910d496 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -88,9 +88,10 @@ struct fsnotify_event_private_data;
88 * if the group is interested in this event. 88 * if the group is interested in this event.
89 * handle_event - main call for a group to handle an fs event 89 * handle_event - main call for a group to handle an fs event
90 * free_group_priv - called when a group refcnt hits 0 to clean up the private union 90 * free_group_priv - called when a group refcnt hits 0 to clean up the private union
91 * freeing-mark - this means that a mark has been flagged to die when everything 91 * freeing_mark - called when a mark is being destroyed for some reason. The group
92 * finishes using it. The function is supplied with what must be a 92 * MUST be holding a reference on each mark and that reference must be
93 * valid group and inode to use to clean up. 93 * dropped in this function. inotify uses this function to send
94 * userspace messages that marks have been removed.
94 */ 95 */
95struct fsnotify_ops { 96struct fsnotify_ops {
96 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, 97 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
@@ -141,12 +142,14 @@ struct fsnotify_group {
141 unsigned int priority; 142 unsigned int priority;
142 143
143 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ 144 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
144 spinlock_t mark_lock; /* protect marks_list */ 145 struct mutex mark_mutex; /* protect marks_list */
145 atomic_t num_marks; /* 1 for each mark and 1 for not being 146 atomic_t num_marks; /* 1 for each mark and 1 for not being
146 * past the point of no return when freeing 147 * past the point of no return when freeing
147 * a group */ 148 * a group */
148 struct list_head marks_list; /* all inode marks for this group */ 149 struct list_head marks_list; /* all inode marks for this group */
149 150
151 struct fasync_struct *fsn_fa; /* async notification */
152
150 /* groups can define private fields here or use the void *private */ 153 /* groups can define private fields here or use the void *private */
151 union { 154 union {
152 void *private; 155 void *private;
@@ -155,7 +158,6 @@ struct fsnotify_group {
155 spinlock_t idr_lock; 158 spinlock_t idr_lock;
156 struct idr idr; 159 struct idr idr;
157 u32 last_wd; 160 u32 last_wd;
158 struct fasync_struct *fa; /* async notification */
159 struct user_struct *user; 161 struct user_struct *user;
160 } inotify_data; 162 } inotify_data;
161#endif 163#endif
@@ -287,7 +289,6 @@ struct fsnotify_mark {
287 struct fsnotify_inode_mark i; 289 struct fsnotify_inode_mark i;
288 struct fsnotify_vfsmount_mark m; 290 struct fsnotify_vfsmount_mark m;
289 }; 291 };
290 struct list_head free_g_list; /* tmp list used when freeing this mark */
291 __u32 ignored_mask; /* events types to ignore */ 292 __u32 ignored_mask; /* events types to ignore */
292#define FSNOTIFY_MARK_FLAG_INODE 0x01 293#define FSNOTIFY_MARK_FLAG_INODE 0x01
293#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02 294#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
@@ -360,11 +361,16 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
360 361
361/* called from fsnotify listeners, such as fanotify or dnotify */ 362/* called from fsnotify listeners, such as fanotify or dnotify */
362 363
363/* get a reference to an existing or create a new group */ 364/* create a new group */
364extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops); 365extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
366/* get reference to a group */
367extern void fsnotify_get_group(struct fsnotify_group *group);
365/* drop reference on a group from fsnotify_alloc_group */ 368/* drop reference on a group from fsnotify_alloc_group */
366extern void fsnotify_put_group(struct fsnotify_group *group); 369extern void fsnotify_put_group(struct fsnotify_group *group);
367 370/* destroy group */
371extern void fsnotify_destroy_group(struct fsnotify_group *group);
372/* fasync handler function */
373extern int fsnotify_fasync(int fd, struct file *file, int on);
368/* take a reference to an event */ 374/* take a reference to an event */
369extern void fsnotify_get_event(struct fsnotify_event *event); 375extern void fsnotify_get_event(struct fsnotify_event *event);
370extern void fsnotify_put_event(struct fsnotify_event *event); 376extern void fsnotify_put_event(struct fsnotify_event *event);
@@ -405,8 +411,13 @@ extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask
405/* attach the mark to both the group and the inode */ 411/* attach the mark to both the group and the inode */
406extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, 412extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
407 struct inode *inode, struct vfsmount *mnt, int allow_dups); 413 struct inode *inode, struct vfsmount *mnt, int allow_dups);
408/* given a mark, flag it to be freed when all references are dropped */ 414extern int fsnotify_add_mark_locked(struct fsnotify_mark *mark, struct fsnotify_group *group,
409extern void fsnotify_destroy_mark(struct fsnotify_mark *mark); 415 struct inode *inode, struct vfsmount *mnt, int allow_dups);
416/* given a group and a mark, flag mark to be freed when all references are dropped */
417extern void fsnotify_destroy_mark(struct fsnotify_mark *mark,
418 struct fsnotify_group *group);
419extern void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,
420 struct fsnotify_group *group);
410/* run all the marks in a group, and clear all of the vfsmount marks */ 421/* run all the marks in a group, and clear all of the vfsmount marks */
411extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group); 422extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
412/* run all the marks in a group, and clear all of the inode marks */ 423/* run all the marks in a group, and clear all of the inode marks */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index a52f2f4fe03..92691d85c32 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -394,7 +394,7 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
394 size_t cnt, loff_t *ppos); 394 size_t cnt, loff_t *ppos);
395ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 395ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
396 size_t cnt, loff_t *ppos); 396 size_t cnt, loff_t *ppos);
397loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin); 397loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
398int ftrace_regex_release(struct inode *inode, struct file *file); 398int ftrace_regex_release(struct inode *inode, struct file *file);
399 399
400void __init 400void __init
@@ -559,7 +559,7 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
559 size_t cnt, loff_t *ppos) { return -ENODEV; } 559 size_t cnt, loff_t *ppos) { return -ENODEV; }
560static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 560static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
561 size_t cnt, loff_t *ppos) { return -ENODEV; } 561 size_t cnt, loff_t *ppos) { return -ENODEV; }
562static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin) 562static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
563{ 563{
564 return -ENODEV; 564 return -ENODEV;
565} 565}
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 642928cf57b..a3d489531d8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -86,6 +86,12 @@ struct trace_iterator {
86 cpumask_var_t started; 86 cpumask_var_t started;
87}; 87};
88 88
89enum trace_iter_flags {
90 TRACE_FILE_LAT_FMT = 1,
91 TRACE_FILE_ANNOTATE = 2,
92 TRACE_FILE_TIME_IN_NS = 4,
93};
94
89 95
90struct trace_event; 96struct trace_event;
91 97
@@ -127,13 +133,13 @@ trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
127void trace_current_buffer_unlock_commit(struct ring_buffer *buffer, 133void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
128 struct ring_buffer_event *event, 134 struct ring_buffer_event *event,
129 unsigned long flags, int pc); 135 unsigned long flags, int pc);
130void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer, 136void trace_buffer_unlock_commit(struct ring_buffer *buffer,
131 struct ring_buffer_event *event, 137 struct ring_buffer_event *event,
132 unsigned long flags, int pc); 138 unsigned long flags, int pc);
133void trace_nowake_buffer_unlock_commit_regs(struct ring_buffer *buffer, 139void trace_buffer_unlock_commit_regs(struct ring_buffer *buffer,
134 struct ring_buffer_event *event, 140 struct ring_buffer_event *event,
135 unsigned long flags, int pc, 141 unsigned long flags, int pc,
136 struct pt_regs *regs); 142 struct pt_regs *regs);
137void trace_current_buffer_discard_commit(struct ring_buffer *buffer, 143void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
138 struct ring_buffer_event *event); 144 struct ring_buffer_event *event);
139 145
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 4f440b3e89f..79b8bba1936 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -88,10 +88,14 @@ struct disk_stats {
88}; 88};
89 89
90#define PARTITION_META_INFO_VOLNAMELTH 64 90#define PARTITION_META_INFO_VOLNAMELTH 64
91#define PARTITION_META_INFO_UUIDLTH 16 91/*
92 * Enough for the string representation of any kind of UUID plus NULL.
93 * EFI UUID is 36 characters. MSDOS UUID is 11 characters.
94 */
95#define PARTITION_META_INFO_UUIDLTH 37
92 96
93struct partition_meta_info { 97struct partition_meta_info {
94 u8 uuid[PARTITION_META_INFO_UUIDLTH]; /* always big endian */ 98 char uuid[PARTITION_META_INFO_UUIDLTH];
95 u8 volname[PARTITION_META_INFO_VOLNAMELTH]; 99 u8 volname[PARTITION_META_INFO_VOLNAMELTH];
96}; 100};
97 101
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
new file mode 100644
index 00000000000..023bc346b87
--- /dev/null
+++ b/include/linux/genl_magic_func.h
@@ -0,0 +1,422 @@
1#ifndef GENL_MAGIC_FUNC_H
2#define GENL_MAGIC_FUNC_H
3
4#include <linux/genl_magic_struct.h>
5
6/*
7 * Magic: declare tla policy {{{1
8 * Magic: declare nested policies
9 * {{{2
10 */
11#undef GENL_mc_group
12#define GENL_mc_group(group)
13
14#undef GENL_notification
15#define GENL_notification(op_name, op_num, mcast_group, tla_list)
16
17#undef GENL_op
18#define GENL_op(op_name, op_num, handler, tla_list)
19
20#undef GENL_struct
21#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
22 [tag_name] = { .type = NLA_NESTED },
23
24static struct nla_policy CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy)[] = {
25#include GENL_MAGIC_INCLUDE_FILE
26};
27
28#undef GENL_struct
29#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
30static struct nla_policy s_name ## _nl_policy[] __read_mostly = \
31{ s_fields };
32
33#undef __field
34#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \
35 __put, __is_signed) \
36 [attr_nr] = { .type = nla_type },
37
38#undef __array
39#define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \
40 __get, __put, __is_signed) \
41 [attr_nr] = { .type = nla_type, \
42 .len = maxlen - (nla_type == NLA_NUL_STRING) },
43
44#include GENL_MAGIC_INCLUDE_FILE
45
46#ifndef __KERNEL__
47#ifndef pr_info
48#define pr_info(args...) fprintf(stderr, args);
49#endif
50#endif
51
52#ifdef GENL_MAGIC_DEBUG
53static void dprint_field(const char *dir, int nla_type,
54 const char *name, void *valp)
55{
56 __u64 val = valp ? *(__u32 *)valp : 1;
57 switch (nla_type) {
58 case NLA_U8: val = (__u8)val;
59 case NLA_U16: val = (__u16)val;
60 case NLA_U32: val = (__u32)val;
61 pr_info("%s attr %s: %d 0x%08x\n", dir,
62 name, (int)val, (unsigned)val);
63 break;
64 case NLA_U64:
65 val = *(__u64*)valp;
66 pr_info("%s attr %s: %lld 0x%08llx\n", dir,
67 name, (long long)val, (unsigned long long)val);
68 break;
69 case NLA_FLAG:
70 if (val)
71 pr_info("%s attr %s: set\n", dir, name);
72 break;
73 }
74}
75
76static void dprint_array(const char *dir, int nla_type,
77 const char *name, const char *val, unsigned len)
78{
79 switch (nla_type) {
80 case NLA_NUL_STRING:
81 if (len && val[len-1] == '\0')
82 len--;
83 pr_info("%s attr %s: [len:%u] '%s'\n", dir, name, len, val);
84 break;
85 default:
86 /* we can always show 4 byte,
87 * thats what nlattr are aligned to. */
88 pr_info("%s attr %s: [len:%u] %02x%02x%02x%02x ...\n",
89 dir, name, len, val[0], val[1], val[2], val[3]);
90 }
91}
92
93#define DPRINT_TLA(a, op, b) pr_info("%s %s %s\n", a, op, b);
94
95/* Name is a member field name of the struct s.
96 * If s is NULL (only parsing, no copy requested in *_from_attrs()),
97 * nla is supposed to point to the attribute containing the information
98 * corresponding to that struct member. */
99#define DPRINT_FIELD(dir, nla_type, name, s, nla) \
100 do { \
101 if (s) \
102 dprint_field(dir, nla_type, #name, &s->name); \
103 else if (nla) \
104 dprint_field(dir, nla_type, #name, \
105 (nla_type == NLA_FLAG) ? NULL \
106 : nla_data(nla)); \
107 } while (0)
108
109#define DPRINT_ARRAY(dir, nla_type, name, s, nla) \
110 do { \
111 if (s) \
112 dprint_array(dir, nla_type, #name, \
113 s->name, s->name ## _len); \
114 else if (nla) \
115 dprint_array(dir, nla_type, #name, \
116 nla_data(nla), nla_len(nla)); \
117 } while (0)
118#else
119#define DPRINT_TLA(a, op, b) do {} while (0)
120#define DPRINT_FIELD(dir, nla_type, name, s, nla) do {} while (0)
121#define DPRINT_ARRAY(dir, nla_type, name, s, nla) do {} while (0)
122#endif
123
124/*
125 * Magic: provide conversion functions {{{1
126 * populate struct from attribute table:
127 * {{{2
128 */
129
130/* processing of generic netlink messages is serialized.
131 * use one static buffer for parsing of nested attributes */
132static struct nlattr *nested_attr_tb[128];
133
134#ifndef BUILD_BUG_ON
135/* Force a compilation error if condition is true */
136#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
137/* Force a compilation error if condition is true, but also produce a
138 result (of value 0 and type size_t), so the expression can be used
139 e.g. in a structure initializer (or where-ever else comma expressions
140 aren't permitted). */
141#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
142#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
143#endif
144
145#undef GENL_struct
146#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
147/* *_from_attrs functions are static, but potentially unused */ \
148static int __ ## s_name ## _from_attrs(struct s_name *s, \
149 struct genl_info *info, bool exclude_invariants) \
150{ \
151 const int maxtype = ARRAY_SIZE(s_name ## _nl_policy)-1; \
152 struct nlattr *tla = info->attrs[tag_number]; \
153 struct nlattr **ntb = nested_attr_tb; \
154 struct nlattr *nla; \
155 int err; \
156 BUILD_BUG_ON(ARRAY_SIZE(s_name ## _nl_policy) > ARRAY_SIZE(nested_attr_tb)); \
157 if (!tla) \
158 return -ENOMSG; \
159 DPRINT_TLA(#s_name, "<=-", #tag_name); \
160 err = drbd_nla_parse_nested(ntb, maxtype, tla, s_name ## _nl_policy); \
161 if (err) \
162 return err; \
163 \
164 s_fields \
165 return 0; \
166} __attribute__((unused)) \
167static int s_name ## _from_attrs(struct s_name *s, \
168 struct genl_info *info) \
169{ \
170 return __ ## s_name ## _from_attrs(s, info, false); \
171} __attribute__((unused)) \
172static int s_name ## _from_attrs_for_change(struct s_name *s, \
173 struct genl_info *info) \
174{ \
175 return __ ## s_name ## _from_attrs(s, info, true); \
176} __attribute__((unused)) \
177
178#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
179 nla = ntb[attr_nr]; \
180 if (nla) { \
181 if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
182 pr_info("<< must not change invariant attr: %s\n", #name); \
183 return -EEXIST; \
184 } \
185 assignment; \
186 } else if (exclude_invariants && ((attr_flag) & DRBD_F_INVARIANT)) { \
187 /* attribute missing from payload, */ \
188 /* which was expected */ \
189 } else if ((attr_flag) & DRBD_F_REQUIRED) { \
190 pr_info("<< missing attr: %s\n", #name); \
191 return -ENOMSG; \
192 }
193
194#undef __field
195#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
196 __is_signed) \
197 __assign(attr_nr, attr_flag, name, nla_type, type, \
198 if (s) \
199 s->name = __get(nla); \
200 DPRINT_FIELD("<<", nla_type, name, s, nla))
201
202/* validate_nla() already checked nla_len <= maxlen appropriately. */
203#undef __array
204#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
205 __get, __put, __is_signed) \
206 __assign(attr_nr, attr_flag, name, nla_type, type, \
207 if (s) \
208 s->name ## _len = \
209 __get(s->name, nla, maxlen); \
210 DPRINT_ARRAY("<<", nla_type, name, s, nla))
211
212#include GENL_MAGIC_INCLUDE_FILE
213
214#undef GENL_struct
215#define GENL_struct(tag_name, tag_number, s_name, s_fields)
216
217/*
218 * Magic: define op number to op name mapping {{{1
219 * {{{2
220 */
221const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd)
222{
223 switch (cmd) {
224#undef GENL_op
225#define GENL_op(op_name, op_num, handler, tla_list) \
226 case op_num: return #op_name;
227#include GENL_MAGIC_INCLUDE_FILE
228 default:
229 return "unknown";
230 }
231}
232
233#ifdef __KERNEL__
234#include <linux/stringify.h>
235/*
236 * Magic: define genl_ops {{{1
237 * {{{2
238 */
239
240#undef GENL_op
241#define GENL_op(op_name, op_num, handler, tla_list) \
242{ \
243 handler \
244 .cmd = op_name, \
245 .policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \
246},
247
248#define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops)
249static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
250#include GENL_MAGIC_INCLUDE_FILE
251};
252
253#undef GENL_op
254#define GENL_op(op_name, op_num, handler, tla_list)
255
256/*
257 * Define the genl_family, multicast groups, {{{1
258 * and provide register/unregister functions.
259 * {{{2
260 */
261#define ZZZ_genl_family CONCAT_(GENL_MAGIC_FAMILY, _genl_family)
262static struct genl_family ZZZ_genl_family __read_mostly = {
263 .id = GENL_ID_GENERATE,
264 .name = __stringify(GENL_MAGIC_FAMILY),
265 .version = GENL_MAGIC_VERSION,
266#ifdef GENL_MAGIC_FAMILY_HDRSZ
267 .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
268#endif
269 .maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1,
270};
271
272/*
273 * Magic: define multicast groups
274 * Magic: define multicast group registration helper
275 */
276#undef GENL_mc_group
277#define GENL_mc_group(group) \
278static struct genl_multicast_group \
279CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group) __read_mostly = { \
280 .name = #group, \
281}; \
282static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \
283 struct sk_buff *skb, gfp_t flags) \
284{ \
285 unsigned int group_id = \
286 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id; \
287 if (!group_id) \
288 return -EINVAL; \
289 return genlmsg_multicast(skb, 0, group_id, flags); \
290}
291
292#include GENL_MAGIC_INCLUDE_FILE
293
294int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
295{
296 int err = genl_register_family_with_ops(&ZZZ_genl_family,
297 ZZZ_genl_ops, ARRAY_SIZE(ZZZ_genl_ops));
298 if (err)
299 return err;
300#undef GENL_mc_group
301#define GENL_mc_group(group) \
302 err = genl_register_mc_group(&ZZZ_genl_family, \
303 &CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group)); \
304 if (err) \
305 goto fail; \
306 else \
307 pr_info("%s: mcg %s: %u\n", #group, \
308 __stringify(GENL_MAGIC_FAMILY), \
309 CONCAT_(GENL_MAGIC_FAMILY, _mcg_ ## group).id);
310
311#include GENL_MAGIC_INCLUDE_FILE
312
313#undef GENL_mc_group
314#define GENL_mc_group(group)
315 return 0;
316fail:
317 genl_unregister_family(&ZZZ_genl_family);
318 return err;
319}
320
321void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void)
322{
323 genl_unregister_family(&ZZZ_genl_family);
324}
325
326/*
327 * Magic: provide conversion functions {{{1
328 * populate skb from struct.
329 * {{{2
330 */
331
332#undef GENL_op
333#define GENL_op(op_name, op_num, handler, tla_list)
334
335#undef GENL_struct
336#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
337static int s_name ## _to_skb(struct sk_buff *skb, struct s_name *s, \
338 const bool exclude_sensitive) \
339{ \
340 struct nlattr *tla = nla_nest_start(skb, tag_number); \
341 if (!tla) \
342 goto nla_put_failure; \
343 DPRINT_TLA(#s_name, "-=>", #tag_name); \
344 s_fields \
345 nla_nest_end(skb, tla); \
346 return 0; \
347 \
348nla_put_failure: \
349 if (tla) \
350 nla_nest_cancel(skb, tla); \
351 return -EMSGSIZE; \
352} \
353static inline int s_name ## _to_priv_skb(struct sk_buff *skb, \
354 struct s_name *s) \
355{ \
356 return s_name ## _to_skb(skb, s, 0); \
357} \
358static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
359 struct s_name *s) \
360{ \
361 return s_name ## _to_skb(skb, s, 1); \
362}
363
364
365#undef __field
366#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
367 __is_signed) \
368 if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
369 DPRINT_FIELD(">>", nla_type, name, s, NULL); \
370 if (__put(skb, attr_nr, s->name)) \
371 goto nla_put_failure; \
372 }
373
374#undef __array
375#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
376 __get, __put, __is_signed) \
377 if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
378 DPRINT_ARRAY(">>",nla_type, name, s, NULL); \
379 if (__put(skb, attr_nr, min_t(int, maxlen, \
380 s->name ## _len + (nla_type == NLA_NUL_STRING)),\
381 s->name)) \
382 goto nla_put_failure; \
383 }
384
385#include GENL_MAGIC_INCLUDE_FILE
386
387
388/* Functions for initializing structs to default values. */
389
390#undef __field
391#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
392 __is_signed)
393#undef __array
394#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
395 __get, __put, __is_signed)
396#undef __u32_field_def
397#define __u32_field_def(attr_nr, attr_flag, name, default) \
398 x->name = default;
399#undef __s32_field_def
400#define __s32_field_def(attr_nr, attr_flag, name, default) \
401 x->name = default;
402#undef __flg_field_def
403#define __flg_field_def(attr_nr, attr_flag, name, default) \
404 x->name = default;
405#undef __str_field_def
406#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
407 memset(x->name, 0, sizeof(x->name)); \
408 x->name ## _len = 0;
409#undef GENL_struct
410#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
411static void set_ ## s_name ## _defaults(struct s_name *x) __attribute__((unused)); \
412static void set_ ## s_name ## _defaults(struct s_name *x) { \
413s_fields \
414}
415
416#include GENL_MAGIC_INCLUDE_FILE
417
418#endif /* __KERNEL__ */
419
420/* }}}1 */
421#endif /* GENL_MAGIC_FUNC_H */
422/* vim: set foldmethod=marker foldlevel=1 nofoldenable : */
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
new file mode 100644
index 00000000000..eecd19b3700
--- /dev/null
+++ b/include/linux/genl_magic_struct.h
@@ -0,0 +1,277 @@
1#ifndef GENL_MAGIC_STRUCT_H
2#define GENL_MAGIC_STRUCT_H
3
4#ifndef GENL_MAGIC_FAMILY
5# error "you need to define GENL_MAGIC_FAMILY before inclusion"
6#endif
7
8#ifndef GENL_MAGIC_VERSION
9# error "you need to define GENL_MAGIC_VERSION before inclusion"
10#endif
11
12#ifndef GENL_MAGIC_INCLUDE_FILE
13# error "you need to define GENL_MAGIC_INCLUDE_FILE before inclusion"
14#endif
15
16#include <linux/genetlink.h>
17#include <linux/types.h>
18
19#define CONCAT__(a,b) a ## b
20#define CONCAT_(a,b) CONCAT__(a,b)
21
22extern int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void);
23extern void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void);
24
25/*
26 * Extension of genl attribute validation policies {{{2
27 */
28
29/*
30 * @DRBD_GENLA_F_MANDATORY: By default, netlink ignores attributes it does not
31 * know about. This flag can be set in nlattr->nla_type to indicate that this
32 * attribute must not be ignored.
33 *
34 * We check and remove this flag in drbd_nla_check_mandatory() before
35 * validating the attribute types and lengths via nla_parse_nested().
36 */
37#define DRBD_GENLA_F_MANDATORY (1 << 14)
38
39/*
40 * Flags specific to drbd and not visible at the netlink layer, used in
41 * <struct>_from_attrs and <struct>_to_skb:
42 *
43 * @DRBD_F_REQUIRED: Attribute is required; a request without this attribute is
44 * invalid.
45 *
46 * @DRBD_F_SENSITIVE: Attribute includes sensitive information and must not be
47 * included in unpriviledged get requests or broadcasts.
48 *
49 * @DRBD_F_INVARIANT: Attribute is set when an object is initially created, but
50 * cannot subsequently be changed.
51 */
52#define DRBD_F_REQUIRED (1 << 0)
53#define DRBD_F_SENSITIVE (1 << 1)
54#define DRBD_F_INVARIANT (1 << 2)
55
56#define __nla_type(x) ((__u16)((x) & NLA_TYPE_MASK & ~DRBD_GENLA_F_MANDATORY))
57
58/* }}}1
59 * MAGIC
60 * multi-include macro expansion magic starts here
61 */
62
63/* MAGIC helpers {{{2 */
64
65/* possible field types */
66#define __flg_field(attr_nr, attr_flag, name) \
67 __field(attr_nr, attr_flag, name, NLA_U8, char, \
68 nla_get_u8, nla_put_u8, false)
69#define __u8_field(attr_nr, attr_flag, name) \
70 __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \
71 nla_get_u8, nla_put_u8, false)
72#define __u16_field(attr_nr, attr_flag, name) \
73 __field(attr_nr, attr_flag, name, NLA_U16, __u16, \
74 nla_get_u16, nla_put_u16, false)
75#define __u32_field(attr_nr, attr_flag, name) \
76 __field(attr_nr, attr_flag, name, NLA_U32, __u32, \
77 nla_get_u32, nla_put_u32, false)
78#define __s32_field(attr_nr, attr_flag, name) \
79 __field(attr_nr, attr_flag, name, NLA_U32, __s32, \
80 nla_get_u32, nla_put_u32, true)
81#define __u64_field(attr_nr, attr_flag, name) \
82 __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
83 nla_get_u64, nla_put_u64, false)
84#define __str_field(attr_nr, attr_flag, name, maxlen) \
85 __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
86 nla_strlcpy, nla_put, false)
87#define __bin_field(attr_nr, attr_flag, name, maxlen) \
88 __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \
89 nla_memcpy, nla_put, false)
90
91/* fields with default values */
92#define __flg_field_def(attr_nr, attr_flag, name, default) \
93 __flg_field(attr_nr, attr_flag, name)
94#define __u32_field_def(attr_nr, attr_flag, name, default) \
95 __u32_field(attr_nr, attr_flag, name)
96#define __s32_field_def(attr_nr, attr_flag, name, default) \
97 __s32_field(attr_nr, attr_flag, name)
98#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
99 __str_field(attr_nr, attr_flag, name, maxlen)
100
101#define GENL_op_init(args...) args
102#define GENL_doit(handler) \
103 .doit = handler, \
104 .flags = GENL_ADMIN_PERM,
105#define GENL_dumpit(handler) \
106 .dumpit = handler, \
107 .flags = GENL_ADMIN_PERM,
108
109/* }}}1
110 * Magic: define the enum symbols for genl_ops
111 * Magic: define the enum symbols for top level attributes
112 * Magic: define the enum symbols for nested attributes
113 * {{{2
114 */
115
116#undef GENL_struct
117#define GENL_struct(tag_name, tag_number, s_name, s_fields)
118
119#undef GENL_mc_group
120#define GENL_mc_group(group)
121
122#undef GENL_notification
123#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
124 op_name = op_num,
125
126#undef GENL_op
127#define GENL_op(op_name, op_num, handler, tla_list) \
128 op_name = op_num,
129
130enum {
131#include GENL_MAGIC_INCLUDE_FILE
132};
133
134#undef GENL_notification
135#define GENL_notification(op_name, op_num, mcast_group, tla_list)
136
137#undef GENL_op
138#define GENL_op(op_name, op_num, handler, attr_list)
139
140#undef GENL_struct
141#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
142 tag_name = tag_number,
143
144enum {
145#include GENL_MAGIC_INCLUDE_FILE
146};
147
148#undef GENL_struct
149#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
150enum { \
151 s_fields \
152};
153
154#undef __field
155#define __field(attr_nr, attr_flag, name, nla_type, type, \
156 __get, __put, __is_signed) \
157 T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
158
159#undef __array
160#define __array(attr_nr, attr_flag, name, nla_type, type, \
161 maxlen, __get, __put, __is_signed) \
162 T_ ## name = (__u16)(attr_nr | ((attr_flag) & DRBD_GENLA_F_MANDATORY)),
163
164#include GENL_MAGIC_INCLUDE_FILE
165
166/* }}}1
167 * Magic: compile time assert unique numbers for operations
168 * Magic: -"- unique numbers for top level attributes
169 * Magic: -"- unique numbers for nested attributes
170 * {{{2
171 */
172
173#undef GENL_struct
174#define GENL_struct(tag_name, tag_number, s_name, s_fields)
175
176#undef GENL_op
177#define GENL_op(op_name, op_num, handler, attr_list) \
178 case op_name:
179
180#undef GENL_notification
181#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
182 case op_name:
183
184static inline void ct_assert_unique_operations(void)
185{
186 switch (0) {
187#include GENL_MAGIC_INCLUDE_FILE
188 ;
189 }
190}
191
192#undef GENL_op
193#define GENL_op(op_name, op_num, handler, attr_list)
194
195#undef GENL_notification
196#define GENL_notification(op_name, op_num, mcast_group, tla_list)
197
198#undef GENL_struct
199#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
200 case tag_number:
201
202static inline void ct_assert_unique_top_level_attributes(void)
203{
204 switch (0) {
205#include GENL_MAGIC_INCLUDE_FILE
206 ;
207 }
208}
209
210#undef GENL_struct
211#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
212static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
213{ \
214 switch (0) { \
215 s_fields \
216 ; \
217 } \
218}
219
220#undef __field
221#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
222 __is_signed) \
223 case attr_nr:
224
225#undef __array
226#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
227 __get, __put, __is_signed) \
228 case attr_nr:
229
230#include GENL_MAGIC_INCLUDE_FILE
231
232/* }}}1
233 * Magic: declare structs
234 * struct <name> {
235 * fields
236 * };
237 * {{{2
238 */
239
240#undef GENL_struct
241#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
242struct s_name { s_fields };
243
244#undef __field
245#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
246 __is_signed) \
247 type name;
248
249#undef __array
250#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
251 __get, __put, __is_signed) \
252 type name[maxlen]; \
253 __u32 name ## _len;
254
255#include GENL_MAGIC_INCLUDE_FILE
256
257#undef GENL_struct
258#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
259enum { \
260 s_fields \
261};
262
263#undef __field
264#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
265 is_signed) \
266 F_ ## name ## _IS_SIGNED = is_signed,
267
268#undef __array
269#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
270 __get, __put, is_signed) \
271 F_ ## name ## _IS_SIGNED = is_signed,
272
273#include GENL_MAGIC_INCLUDE_FILE
274
275/* }}}1 */
276#endif /* GENL_MAGIC_STRUCT_H */
277/* vim: set foldmethod=marker nofoldenable : */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index d0a79678f16..0f615eb23d0 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -30,10 +30,12 @@ struct vm_area_struct;
30#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
31#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
32#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
33#define ___GFP_KMEMCG 0x100000u
33#define ___GFP_NOTRACK 0x200000u 34#define ___GFP_NOTRACK 0x200000u
34#define ___GFP_NO_KSWAPD 0x400000u 35#define ___GFP_NO_KSWAPD 0x400000u
35#define ___GFP_OTHER_NODE 0x800000u 36#define ___GFP_OTHER_NODE 0x800000u
36#define ___GFP_WRITE 0x1000000u 37#define ___GFP_WRITE 0x1000000u
38/* If the above are modified, __GFP_BITS_SHIFT may need updating */
37 39
38/* 40/*
39 * GFP bitmasks.. 41 * GFP bitmasks..
@@ -88,6 +90,7 @@ struct vm_area_struct;
88 90
89#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 91#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
90#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 92#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
93#define __GFP_KMEMCG ((__force gfp_t)___GFP_KMEMCG) /* Allocation comes from a memcg-accounted resource */
91#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 94#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
92 95
93/* 96/*
@@ -266,7 +269,7 @@ static inline enum zone_type gfp_zone(gfp_t flags)
266 269
267static inline int gfp_zonelist(gfp_t flags) 270static inline int gfp_zonelist(gfp_t flags)
268{ 271{
269 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE)) 272 if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE))
270 return 1; 273 return 1;
271 274
272 return 0; 275 return 0;
@@ -364,6 +367,9 @@ extern void free_pages(unsigned long addr, unsigned int order);
364extern void free_hot_cold_page(struct page *page, int cold); 367extern void free_hot_cold_page(struct page *page, int cold);
365extern void free_hot_cold_page_list(struct list_head *list, int cold); 368extern void free_hot_cold_page_list(struct list_head *list, int cold);
366 369
370extern void __free_memcg_kmem_pages(struct page *page, unsigned int order);
371extern void free_memcg_kmem_pages(unsigned long addr, unsigned int order);
372
367#define __free_page(page) __free_pages((page), 0) 373#define __free_page(page) __free_pages((page), 0)
368#define free_page(addr) free_pages((addr), 0) 374#define free_page(addr) free_pages((addr), 0)
369 375
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 2e31e8b3a19..bfe66562153 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -72,9 +72,9 @@ static inline int irq_to_gpio(unsigned int irq)
72 return -EINVAL; 72 return -EINVAL;
73} 73}
74 74
75#endif 75#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
76 76
77#else 77#else /* ! CONFIG_GENERIC_GPIO */
78 78
79#include <linux/kernel.h> 79#include <linux/kernel.h>
80#include <linux/types.h> 80#include <linux/types.h>
@@ -231,6 +231,21 @@ static inline int irq_to_gpio(unsigned irq)
231 return -EINVAL; 231 return -EINVAL;
232} 232}
233 233
234#endif 234static inline int
235gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
236 unsigned int gpio_offset, unsigned int pin_offset,
237 unsigned int npins)
238{
239 WARN_ON(1);
240 return -EINVAL;
241}
242
243static inline void
244gpiochip_remove_pin_ranges(struct gpio_chip *chip)
245{
246 WARN_ON(1);
247}
248
249#endif /* ! CONFIG_GENERIC_GPIO */
235 250
236#endif /* __LINUX_GPIO_H */ 251#endif /* __LINUX_GPIO_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index cab3da3d094..624ef3f45c8 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -4,6 +4,7 @@
4#include <linux/preempt.h> 4#include <linux/preempt.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 <asm/hardirq.h> 8#include <asm/hardirq.h>
8 9
9/* 10/*
@@ -129,16 +130,6 @@ extern void synchronize_irq(unsigned int irq);
129# define synchronize_irq(irq) barrier() 130# define synchronize_irq(irq) barrier()
130#endif 131#endif
131 132
132struct task_struct;
133
134#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING)
135static inline void vtime_account(struct task_struct *tsk)
136{
137}
138#else
139extern void vtime_account(struct task_struct *tsk);
140#endif
141
142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 133#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
143 134
144static inline void rcu_nmi_enter(void) 135static inline void rcu_nmi_enter(void)
@@ -162,7 +153,7 @@ extern void rcu_nmi_exit(void);
162 */ 153 */
163#define __irq_enter() \ 154#define __irq_enter() \
164 do { \ 155 do { \
165 vtime_account(current); \ 156 vtime_account_irq_enter(current); \
166 add_preempt_count(HARDIRQ_OFFSET); \ 157 add_preempt_count(HARDIRQ_OFFSET); \
167 trace_hardirq_enter(); \ 158 trace_hardirq_enter(); \
168 } while (0) 159 } while (0)
@@ -178,7 +169,7 @@ extern void irq_enter(void);
178#define __irq_exit() \ 169#define __irq_exit() \
179 do { \ 170 do { \
180 trace_hardirq_exit(); \ 171 trace_hardirq_exit(); \
181 vtime_account(current); \ 172 vtime_account_irq_exit(current); \
182 sub_preempt_count(HARDIRQ_OFFSET); \ 173 sub_preempt_count(HARDIRQ_OFFSET); \
183 } while (0) 174 } while (0)
184 175
diff --git a/include/linux/hash.h b/include/linux/hash.h
index 24df9e70406..61c97ae22e0 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -1,7 +1,7 @@
1#ifndef _LINUX_HASH_H 1#ifndef _LINUX_HASH_H
2#define _LINUX_HASH_H 2#define _LINUX_HASH_H
3/* Fast hashing routine for ints, longs and pointers. 3/* Fast hashing routine for ints, longs and pointers.
4 (C) 2002 William Lee Irwin III, IBM */ 4 (C) 2002 Nadia Yvette Chambers, IBM */
5 5
6/* 6/*
7 * Knuth recommends primes in approximately golden ratio to the maximum 7 * Knuth recommends primes in approximately golden ratio to the maximum
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
index 1fb26448faa..e69de29bb2d 100644
--- a/include/linux/hdlc/Kbuild
+++ b/include/linux/hdlc/Kbuild
@@ -1 +0,0 @@
1header-y += ioctl.h
diff --git a/include/linux/hdlc/ioctl.h b/include/linux/hdlc/ioctl.h
deleted file mode 100644
index 58397236435..00000000000
--- a/include/linux/hdlc/ioctl.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef __HDLC_IOCTL_H__
2#define __HDLC_IOCTL_H__
3
4
5#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
6
7#define CLOCK_DEFAULT 0 /* Default setting */
8#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
9#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
10#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
11#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
12
13
14#define ENCODING_DEFAULT 0 /* Default setting */
15#define ENCODING_NRZ 1
16#define ENCODING_NRZI 2
17#define ENCODING_FM_MARK 3
18#define ENCODING_FM_SPACE 4
19#define ENCODING_MANCHESTER 5
20
21
22#define PARITY_DEFAULT 0 /* Default setting */
23#define PARITY_NONE 1 /* No parity */
24#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
25#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
26#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
27#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
28#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
29#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
30
31#define LMI_DEFAULT 0 /* Default setting */
32#define LMI_NONE 1 /* No LMI, all PVCs are static */
33#define LMI_ANSI 2 /* ANSI Annex D */
34#define LMI_CCITT 3 /* ITU-T Annex A */
35#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
36
37typedef struct {
38 unsigned int clock_rate; /* bits per second */
39 unsigned int clock_type; /* internal, external, TX-internal etc. */
40 unsigned short loopback;
41} sync_serial_settings; /* V.35, V.24, X.21 */
42
43typedef struct {
44 unsigned int clock_rate; /* bits per second */
45 unsigned int clock_type; /* internal, external, TX-internal etc. */
46 unsigned short loopback;
47 unsigned int slot_map;
48} te1_settings; /* T1, E1 */
49
50typedef struct {
51 unsigned short encoding;
52 unsigned short parity;
53} raw_hdlc_proto;
54
55typedef struct {
56 unsigned int t391;
57 unsigned int t392;
58 unsigned int n391;
59 unsigned int n392;
60 unsigned int n393;
61 unsigned short lmi;
62 unsigned short dce; /* 1 for DCE (network side) operation */
63} fr_proto;
64
65typedef struct {
66 unsigned int dlci;
67} fr_proto_pvc; /* for creating/deleting FR PVCs */
68
69typedef struct {
70 unsigned int dlci;
71 char master[IFNAMSIZ]; /* Name of master FRAD device */
72}fr_proto_pvc_info; /* for returning PVC information only */
73
74typedef struct {
75 unsigned int interval;
76 unsigned int timeout;
77} cisco_proto;
78
79/* PPP doesn't need any info now - supply length = 0 to ioctl */
80
81#endif /* __HDLC_IOCTL_H__ */
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index ca8d7e94eb3..55f277372fe 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -19,7 +19,6 @@
19#ifndef _HID_SENSORS_IDS_H 19#ifndef _HID_SENSORS_IDS_H
20#define _HID_SENSORS_IDS_H 20#define _HID_SENSORS_IDS_H
21 21
22#define HID_UP_SENSOR 0x00200000
23#define HID_MAX_PHY_DEVICES 0xFF 22#define HID_MAX_PHY_DEVICES 0xFF
24 23
25/* Accel 3D (200073) */ 24/* Accel 3D (200073) */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c076041a069..7330a0fef0c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -167,6 +167,7 @@ struct hid_item {
167#define HID_UP_MSVENDOR 0xff000000 167#define HID_UP_MSVENDOR 0xff000000
168#define HID_UP_CUSTOM 0x00ff0000 168#define HID_UP_CUSTOM 0x00ff0000
169#define HID_UP_LOGIVENDOR 0xffbc0000 169#define HID_UP_LOGIVENDOR 0xffbc0000
170#define HID_UP_SENSOR 0x00200000
170 171
171#define HID_USAGE 0x0000ffff 172#define HID_USAGE 0x0000ffff
172 173
@@ -292,6 +293,7 @@ struct hid_item {
292 */ 293 */
293#define HID_GROUP_GENERIC 0x0001 294#define HID_GROUP_GENERIC 0x0001
294#define HID_GROUP_MULTITOUCH 0x0002 295#define HID_GROUP_MULTITOUCH 0x0002
296#define HID_GROUP_SENSOR_HUB 0x0003
295 297
296/* 298/*
297 * This is the global environment of the parser. This information is 299 * This is the global environment of the parser. This information is
@@ -342,6 +344,7 @@ struct hid_collection {
342struct hid_usage { 344struct hid_usage {
343 unsigned hid; /* hid usage code */ 345 unsigned hid; /* hid usage code */
344 unsigned collection_index; /* index into collection array */ 346 unsigned collection_index; /* index into collection array */
347 unsigned usage_index; /* index into usage array */
345 /* hidinput data */ 348 /* hidinput data */
346 __u16 code; /* input driver code */ 349 __u16 code; /* input driver code */
347 __u8 type; /* input driver type */ 350 __u8 type; /* input driver type */
@@ -684,6 +687,7 @@ struct hid_ll_driver {
684 687
685extern int hid_debug; 688extern int hid_debug;
686 689
690extern bool hid_ignore(struct hid_device *);
687extern int hid_add_device(struct hid_device *); 691extern int hid_add_device(struct hid_device *);
688extern void hid_destroy_device(struct hid_device *); 692extern void hid_destroy_device(struct hid_device *);
689 693
@@ -706,6 +710,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
706int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 710int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
707struct hid_field *hidinput_get_led_field(struct hid_device *hid); 711struct hid_field *hidinput_get_led_field(struct hid_device *hid);
708unsigned int hidinput_count_leds(struct hid_device *hid); 712unsigned int hidinput_count_leds(struct hid_device *hid);
713__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
709void hid_output_report(struct hid_report *report, __u8 *data); 714void hid_output_report(struct hid_report *report, __u8 *data);
710struct hid_device *hid_allocate_device(void); 715struct hid_device *hid_allocate_device(void);
711struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 716struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -716,6 +721,7 @@ int hid_connect(struct hid_device *hid, unsigned int connect_mask);
716void hid_disconnect(struct hid_device *hid); 721void hid_disconnect(struct hid_device *hid);
717const struct hid_device_id *hid_match_id(struct hid_device *hdev, 722const struct hid_device_id *hid_match_id(struct hid_device *hdev,
718 const struct hid_device_id *id); 723 const struct hid_device_id *id);
724s32 hid_snto32(__u32 value, unsigned n);
719 725
720/** 726/**
721 * hid_map_usage - map usage input bits 727 * hid_map_usage - map usage input bits
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index b31cb7da034..1d76f8ca90f 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -8,6 +8,10 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct *mm,
8extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, 8extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
9 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, 9 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
10 struct vm_area_struct *vma); 10 struct vm_area_struct *vma);
11extern void huge_pmd_set_accessed(struct mm_struct *mm,
12 struct vm_area_struct *vma,
13 unsigned long address, pmd_t *pmd,
14 pmd_t orig_pmd, int dirty);
11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, 15extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
12 unsigned long address, pmd_t *pmd, 16 unsigned long address, pmd_t *pmd,
13 pmd_t orig_pmd); 17 pmd_t orig_pmd);
@@ -27,7 +31,8 @@ extern int move_huge_pmd(struct vm_area_struct *vma,
27 unsigned long new_addr, unsigned long old_end, 31 unsigned long new_addr, unsigned long old_end,
28 pmd_t *old_pmd, pmd_t *new_pmd); 32 pmd_t *old_pmd, pmd_t *new_pmd);
29extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 33extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
30 unsigned long addr, pgprot_t newprot); 34 unsigned long addr, pgprot_t newprot,
35 int prot_numa);
31 36
32enum transparent_hugepage_flag { 37enum transparent_hugepage_flag {
33 TRANSPARENT_HUGEPAGE_FLAG, 38 TRANSPARENT_HUGEPAGE_FLAG,
@@ -35,6 +40,7 @@ enum transparent_hugepage_flag {
35 TRANSPARENT_HUGEPAGE_DEFRAG_FLAG, 40 TRANSPARENT_HUGEPAGE_DEFRAG_FLAG,
36 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, 41 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG,
37 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, 42 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG,
43 TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG,
38#ifdef CONFIG_DEBUG_VM 44#ifdef CONFIG_DEBUG_VM
39 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG, 45 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG,
40#endif 46#endif
@@ -74,6 +80,9 @@ extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
74 (transparent_hugepage_flags & \ 80 (transparent_hugepage_flags & \
75 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG) && \ 81 (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG) && \
76 (__vma)->vm_flags & VM_HUGEPAGE)) 82 (__vma)->vm_flags & VM_HUGEPAGE))
83#define transparent_hugepage_use_zero_page() \
84 (transparent_hugepage_flags & \
85 (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
77#ifdef CONFIG_DEBUG_VM 86#ifdef CONFIG_DEBUG_VM
78#define transparent_hugepage_debug_cow() \ 87#define transparent_hugepage_debug_cow() \
79 (transparent_hugepage_flags & \ 88 (transparent_hugepage_flags & \
@@ -91,21 +100,25 @@ extern int handle_pte_fault(struct mm_struct *mm,
91 struct vm_area_struct *vma, unsigned long address, 100 struct vm_area_struct *vma, unsigned long address,
92 pte_t *pte, pmd_t *pmd, unsigned int flags); 101 pte_t *pte, pmd_t *pmd, unsigned int flags);
93extern int split_huge_page(struct page *page); 102extern int split_huge_page(struct page *page);
94extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd); 103extern void __split_huge_page_pmd(struct vm_area_struct *vma,
95#define split_huge_page_pmd(__mm, __pmd) \ 104 unsigned long address, pmd_t *pmd);
105#define split_huge_page_pmd(__vma, __address, __pmd) \
96 do { \ 106 do { \
97 pmd_t *____pmd = (__pmd); \ 107 pmd_t *____pmd = (__pmd); \
98 if (unlikely(pmd_trans_huge(*____pmd))) \ 108 if (unlikely(pmd_trans_huge(*____pmd))) \
99 __split_huge_page_pmd(__mm, ____pmd); \ 109 __split_huge_page_pmd(__vma, __address, \
110 ____pmd); \
100 } while (0) 111 } while (0)
101#define wait_split_huge_page(__anon_vma, __pmd) \ 112#define wait_split_huge_page(__anon_vma, __pmd) \
102 do { \ 113 do { \
103 pmd_t *____pmd = (__pmd); \ 114 pmd_t *____pmd = (__pmd); \
104 anon_vma_lock(__anon_vma); \ 115 anon_vma_lock_write(__anon_vma); \
105 anon_vma_unlock(__anon_vma); \ 116 anon_vma_unlock(__anon_vma); \
106 BUG_ON(pmd_trans_splitting(*____pmd) || \ 117 BUG_ON(pmd_trans_splitting(*____pmd) || \
107 pmd_trans_huge(*____pmd)); \ 118 pmd_trans_huge(*____pmd)); \
108 } while (0) 119 } while (0)
120extern void split_huge_page_pmd_mm(struct mm_struct *mm, unsigned long address,
121 pmd_t *pmd);
109#if HPAGE_PMD_ORDER > MAX_ORDER 122#if HPAGE_PMD_ORDER > MAX_ORDER
110#error "hugepages can't be allocated by the buddy allocator" 123#error "hugepages can't be allocated by the buddy allocator"
111#endif 124#endif
@@ -159,6 +172,10 @@ static inline struct page *compound_trans_head(struct page *page)
159 } 172 }
160 return page; 173 return page;
161} 174}
175
176extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
177 unsigned long addr, pmd_t pmd, pmd_t *pmdp);
178
162#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 179#else /* CONFIG_TRANSPARENT_HUGEPAGE */
163#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) 180#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
164#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) 181#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
@@ -173,10 +190,12 @@ static inline int split_huge_page(struct page *page)
173{ 190{
174 return 0; 191 return 0;
175} 192}
176#define split_huge_page_pmd(__mm, __pmd) \ 193#define split_huge_page_pmd(__vma, __address, __pmd) \
177 do { } while (0) 194 do { } while (0)
178#define wait_split_huge_page(__anon_vma, __pmd) \ 195#define wait_split_huge_page(__anon_vma, __pmd) \
179 do { } while (0) 196 do { } while (0)
197#define split_huge_page_pmd_mm(__mm, __address, __pmd) \
198 do { } while (0)
180#define compound_trans_head(page) compound_head(page) 199#define compound_trans_head(page) compound_head(page)
181static inline int hugepage_madvise(struct vm_area_struct *vma, 200static inline int hugepage_madvise(struct vm_area_struct *vma,
182 unsigned long *vm_flags, int advice) 201 unsigned long *vm_flags, int advice)
@@ -195,6 +214,13 @@ static inline int pmd_trans_huge_lock(pmd_t *pmd,
195{ 214{
196 return 0; 215 return 0;
197} 216}
217
218static inline int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma,
219 unsigned long addr, pmd_t pmd, pmd_t *pmdp)
220{
221 return 0;
222}
223
198#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 224#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
199 225
200#endif /* _LINUX_HUGE_MM_H */ 226#endif /* _LINUX_HUGE_MM_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 225164842ab..0c80d3f57a5 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -87,7 +87,7 @@ struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
87 pud_t *pud, int write); 87 pud_t *pud, int write);
88int pmd_huge(pmd_t pmd); 88int pmd_huge(pmd_t pmd);
89int pud_huge(pud_t pmd); 89int pud_huge(pud_t pmd);
90void hugetlb_change_protection(struct vm_area_struct *vma, 90unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
91 unsigned long address, unsigned long end, pgprot_t newprot); 91 unsigned long address, unsigned long end, pgprot_t newprot);
92 92
93#else /* !CONFIG_HUGETLB_PAGE */ 93#else /* !CONFIG_HUGETLB_PAGE */
@@ -132,7 +132,11 @@ static inline void copy_huge_page(struct page *dst, struct page *src)
132{ 132{
133} 133}
134 134
135#define hugetlb_change_protection(vma, address, end, newprot) 135static inline unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
136 unsigned long address, unsigned long end, pgprot_t newprot)
137{
138 return 0;
139}
136 140
137static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb, 141static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb,
138 struct vm_area_struct *vma, unsigned long start, 142 struct vm_area_struct *vma, unsigned long start,
@@ -183,7 +187,8 @@ extern const struct file_operations hugetlbfs_file_operations;
183extern const struct vm_operations_struct hugetlb_vm_ops; 187extern const struct vm_operations_struct hugetlb_vm_ops;
184struct file *hugetlb_file_setup(const char *name, unsigned long addr, 188struct file *hugetlb_file_setup(const char *name, unsigned long addr,
185 size_t size, vm_flags_t acct, 189 size_t size, vm_flags_t acct,
186 struct user_struct **user, int creat_flags); 190 struct user_struct **user, int creat_flags,
191 int page_size_log);
187 192
188static inline int is_file_hugepages(struct file *file) 193static inline int is_file_hugepages(struct file *file)
189{ 194{
@@ -195,12 +200,14 @@ static inline int is_file_hugepages(struct file *file)
195 return 0; 200 return 0;
196} 201}
197 202
203
198#else /* !CONFIG_HUGETLBFS */ 204#else /* !CONFIG_HUGETLBFS */
199 205
200#define is_file_hugepages(file) 0 206#define is_file_hugepages(file) 0
201static inline struct file * 207static inline struct file *
202hugetlb_file_setup(const char *name, unsigned long addr, size_t size, 208hugetlb_file_setup(const char *name, unsigned long addr, size_t size,
203 vm_flags_t acctflag, struct user_struct **user, int creat_flags) 209 vm_flags_t acctflag, struct user_struct **user, int creat_flags,
210 int page_size_log)
204{ 211{
205 return ERR_PTR(-ENOSYS); 212 return ERR_PTR(-ENOSYS);
206} 213}
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index d73878c694b..ce8217f7b5c 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -62,7 +62,7 @@ extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
62 struct page *page); 62 struct page *page);
63extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, 63extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
64 struct hugetlb_cgroup *h_cg); 64 struct hugetlb_cgroup *h_cg);
65extern int hugetlb_cgroup_file_init(int idx) __init; 65extern void hugetlb_cgroup_file_init(void) __init;
66extern void hugetlb_cgroup_migrate(struct page *oldhpage, 66extern void hugetlb_cgroup_migrate(struct page *oldhpage,
67 struct page *newhpage); 67 struct page *newhpage);
68 68
@@ -111,9 +111,8 @@ hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
111 return; 111 return;
112} 112}
113 113
114static inline int __init hugetlb_cgroup_file_init(int idx) 114static inline void hugetlb_cgroup_file_init(void)
115{ 115{
116 return 0;
117} 116}
118 117
119static inline void hugetlb_cgroup_migrate(struct page *oldhpage, 118static inline void hugetlb_cgroup_migrate(struct page *oldhpage,
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 92a0dc75bc7..babe0cf6d56 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -20,8 +20,6 @@
20#define OMAP_I2C_FLAG_NO_FIFO BIT(0) 20#define OMAP_I2C_FLAG_NO_FIFO BIT(0)
21#define OMAP_I2C_FLAG_SIMPLE_CLOCK BIT(1) 21#define OMAP_I2C_FLAG_SIMPLE_CLOCK BIT(1)
22#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2) 22#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2)
23#define OMAP_I2C_FLAG_RESET_REGS_POSTIDLE BIT(3)
24#define OMAP_I2C_FLAG_APPLY_ERRATA_I207 BIT(4)
25#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5) 23#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5)
26#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6) 24#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6)
27/* how the CPU address bus must be translated for I2C unit access */ 25/* how the CPU address bus must be translated for I2C unit access */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 800de224336..d0c4db7b487 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -259,6 +259,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
259 * @platform_data: stored in i2c_client.dev.platform_data 259 * @platform_data: stored in i2c_client.dev.platform_data
260 * @archdata: copied into i2c_client.dev.archdata 260 * @archdata: copied into i2c_client.dev.archdata
261 * @of_node: pointer to OpenFirmware device node 261 * @of_node: pointer to OpenFirmware device node
262 * @acpi_node: ACPI device node
262 * @irq: stored in i2c_client.irq 263 * @irq: stored in i2c_client.irq
263 * 264 *
264 * I2C doesn't actually support hardware probing, although controllers and 265 * I2C doesn't actually support hardware probing, although controllers and
@@ -279,6 +280,7 @@ struct i2c_board_info {
279 void *platform_data; 280 void *platform_data;
280 struct dev_archdata *archdata; 281 struct dev_archdata *archdata;
281 struct device_node *of_node; 282 struct device_node *of_node;
283 struct acpi_dev_node acpi_node;
282 int irq; 284 int irq;
283}; 285};
284 286
@@ -501,4 +503,11 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
501 i2c_del_driver) 503 i2c_del_driver)
502 504
503#endif /* I2C */ 505#endif /* I2C */
506
507#if IS_ENABLED(CONFIG_ACPI_I2C)
508extern void acpi_i2c_register_devices(struct i2c_adapter *adap);
509#else
510static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {}
511#endif
512
504#endif /* _LINUX_I2C_H */ 513#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-hid.h b/include/linux/i2c/i2c-hid.h
new file mode 100644
index 00000000000..60e411d764d
--- /dev/null
+++ b/include/linux/i2c/i2c-hid.h
@@ -0,0 +1,35 @@
1/*
2 * HID over I2C protocol implementation
3 *
4 * Copyright (c) 2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
5 * Copyright (c) 2012 Ecole Nationale de l'Aviation Civile, France
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#ifndef __LINUX_I2C_HID_H
13#define __LINUX_I2C_HID_H
14
15#include <linux/types.h>
16
17/**
18 * struct i2chid_platform_data - used by hid over i2c implementation.
19 * @hid_descriptor_address: i2c register where the HID descriptor is stored.
20 *
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.
23 * The platform driver should also setup the gpio according to the device:
24 *
25 * A typical example is the following:
26 * irq = gpio_to_irq(intr_gpio);
27 * hkdk4412_i2c_devs5[0].irq = irq; // store the irq in i2c_board_info
28 * gpio_request(intr_gpio, "elan-irq");
29 * s3c_gpio_setpull(intr_gpio, S3C_GPIO_PULL_UP);
30 */
31struct i2c_hid_platform_data {
32 u16 hid_descriptor_address;
33};
34
35#endif /* __LINUX_I2C_HID_H */
diff --git a/include/linux/i2c/i2c-sh_mobile.h b/include/linux/i2c/i2c-sh_mobile.h
index beda7081aea..06e3089795f 100644
--- a/include/linux/i2c/i2c-sh_mobile.h
+++ b/include/linux/i2c/i2c-sh_mobile.h
@@ -5,6 +5,7 @@
5 5
6struct i2c_sh_mobile_platform_data { 6struct i2c_sh_mobile_platform_data {
7 unsigned long bus_speed; 7 unsigned long bus_speed;
8 unsigned int clks_per_count;
8}; 9};
9 10
10#endif /* __I2C_SH_MOBILE_H__ */ 11#endif /* __I2C_SH_MOBILE_H__ */
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
index 781e6bd06c3..0767a2a6b2f 100644
--- a/include/linux/i2c/pcf857x.h
+++ b/include/linux/i2c/pcf857x.h
@@ -10,7 +10,6 @@
10 * @setup: optional callback issued once the GPIOs are valid 10 * @setup: optional callback issued once the GPIOs are valid
11 * @teardown: optional callback issued before the GPIOs are invalidated 11 * @teardown: optional callback issued before the GPIOs are invalidated
12 * @context: optional parameter passed to setup() and teardown() 12 * @context: optional parameter passed to setup() and teardown()
13 * @irq: optional interrupt number
14 * 13 *
15 * In addition to the I2C_BOARD_INFO() state appropriate to each chip, 14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
16 * the i2c_board_info used with the pcf875x driver must provide its 15 * the i2c_board_info used with the pcf875x driver must provide its
@@ -40,8 +39,6 @@ struct pcf857x_platform_data {
40 int gpio, unsigned ngpio, 39 int gpio, unsigned ngpio,
41 void *context); 40 void *context);
42 void *context; 41 void *context;
43
44 int irq;
45}; 42};
46 43
47#endif /* __LINUX_PCF857X_H */ 44#endif /* __LINUX_PCF857X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 9a5e2846232..1ff54b114ef 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -39,52 +39,51 @@
39 * address each module uses within a given i2c slave. 39 * address each module uses within a given i2c slave.
40 */ 40 */
41 41
42/* Slave 0 (i2c address 0x48) */ 42enum twl4030_module_ids {
43#define TWL4030_MODULE_USB 0x00 43 TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */
44 44 TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */
45/* Slave 1 (i2c address 0x49) */ 45 TWL4030_MODULE_GPIO,
46#define TWL4030_MODULE_AUDIO_VOICE 0x01 46 TWL4030_MODULE_INTBR,
47#define TWL4030_MODULE_GPIO 0x02 47 TWL4030_MODULE_PIH,
48#define TWL4030_MODULE_INTBR 0x03 48
49#define TWL4030_MODULE_PIH 0x04 49 TWL4030_MODULE_TEST,
50#define TWL4030_MODULE_TEST 0x05 50 TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */
51 51 TWL4030_MODULE_MADC,
52/* Slave 2 (i2c address 0x4a) */ 52 TWL4030_MODULE_INTERRUPTS,
53#define TWL4030_MODULE_KEYPAD 0x06 53 TWL4030_MODULE_LED,
54#define TWL4030_MODULE_MADC 0x07 54
55#define TWL4030_MODULE_INTERRUPTS 0x08 55 TWL4030_MODULE_MAIN_CHARGE,
56#define TWL4030_MODULE_LED 0x09 56 TWL4030_MODULE_PRECHARGE,
57#define TWL4030_MODULE_MAIN_CHARGE 0x0A 57 TWL4030_MODULE_PWM0,
58#define TWL4030_MODULE_PRECHARGE 0x0B 58 TWL4030_MODULE_PWM1,
59#define TWL4030_MODULE_PWM0 0x0C 59 TWL4030_MODULE_PWMA,
60#define TWL4030_MODULE_PWM1 0x0D 60
61#define TWL4030_MODULE_PWMA 0x0E 61 TWL4030_MODULE_PWMB,
62#define TWL4030_MODULE_PWMB 0x0F 62 TWL5031_MODULE_ACCESSORY,
63 63 TWL5031_MODULE_INTERRUPTS,
64#define TWL5031_MODULE_ACCESSORY 0x10 64 TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */
65#define TWL5031_MODULE_INTERRUPTS 0x11 65 TWL4030_MODULE_INT,
66 66
67/* Slave 3 (i2c address 0x4b) */ 67 TWL4030_MODULE_PM_MASTER,
68#define TWL4030_MODULE_BACKUP 0x12 68 TWL4030_MODULE_PM_RECEIVER,
69#define TWL4030_MODULE_INT 0x13 69 TWL4030_MODULE_RTC,
70#define TWL4030_MODULE_PM_MASTER 0x14 70 TWL4030_MODULE_SECURED_REG,
71#define TWL4030_MODULE_PM_RECEIVER 0x15 71 TWL4030_MODULE_LAST,
72#define TWL4030_MODULE_RTC 0x16 72};
73#define TWL4030_MODULE_SECURED_REG 0x17
74 73
74/* Similar functionalities implemented in TWL4030/6030 */
75#define TWL_MODULE_USB TWL4030_MODULE_USB 75#define TWL_MODULE_USB TWL4030_MODULE_USB
76#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
77#define TWL_MODULE_PIH TWL4030_MODULE_PIH 76#define TWL_MODULE_PIH TWL4030_MODULE_PIH
78#define TWL_MODULE_MADC TWL4030_MODULE_MADC
79#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE 77#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 78#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 79#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
82#define TWL_MODULE_RTC TWL4030_MODULE_RTC 80#define TWL_MODULE_RTC TWL4030_MODULE_RTC
83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 81#define TWL_MODULE_PWM TWL4030_MODULE_PWM0
82#define TWL_MODULE_LED TWL4030_MODULE_LED
84 83
85#define TWL6030_MODULE_ID0 0x0D 84#define TWL6030_MODULE_ID0 13
86#define TWL6030_MODULE_ID1 0x0E 85#define TWL6030_MODULE_ID1 14
87#define TWL6030_MODULE_ID2 0x0F 86#define TWL6030_MODULE_ID2 15
88 87
89#define GPIO_INTR_OFFSET 0 88#define GPIO_INTR_OFFSET 0
90#define KEYPAD_INTR_OFFSET 1 89#define KEYPAD_INTR_OFFSET 1
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 87259a44c25..de7e190f1af 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -152,4 +152,15 @@ void ida_simple_remove(struct ida *ida, unsigned int id);
152 152
153void __init idr_init_cache(void); 153void __init idr_init_cache(void);
154 154
155/**
156 * idr_for_each_entry - iterate over an idr's elements of a given type
157 * @idp: idr handle
158 * @entry: the type * to use as cursor
159 * @id: id entry's key
160 */
161#define idr_for_each_entry(idp, entry, id) \
162 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
163 entry != NULL; \
164 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
165
155#endif /* __IDR_H__ */ 166#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 2385119f8bb..f0859cc7386 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -131,6 +131,8 @@
131 131
132#define IEEE80211_MAX_MESH_ID_LEN 32 132#define IEEE80211_MAX_MESH_ID_LEN 32
133 133
134#define IEEE80211_NUM_TIDS 16
135
134#define IEEE80211_QOS_CTL_LEN 2 136#define IEEE80211_QOS_CTL_LEN 2
135/* 1d tag mask */ 137/* 1d tag mask */
136#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 138#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +668,21 @@ struct ieee80211_meshconf_ie {
666} __attribute__ ((packed)); 668} __attribute__ ((packed));
667 669
668/** 670/**
671 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
672 *
673 * @IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS: STA is willing to establish
674 * additional mesh peerings with other mesh STAs
675 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
676 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
677 * is ongoing
678 */
679enum mesh_config_capab_flags {
680 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
681 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
682 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
683};
684
685/**
669 * struct ieee80211_rann_ie 686 * struct ieee80211_rann_ie
670 * 687 *
671 * This structure refers to "Root Announcement information element" 688 * This structure refers to "Root Announcement information element"
@@ -905,6 +922,38 @@ struct ieee80211_tdls_data {
905 } u; 922 } u;
906} __packed; 923} __packed;
907 924
925/*
926 * Peer-to-Peer IE attribute related definitions.
927 */
928/**
929 * enum ieee80211_p2p_attr_id - identifies type of peer-to-peer attribute.
930 */
931enum ieee80211_p2p_attr_id {
932 IEEE80211_P2P_ATTR_STATUS = 0,
933 IEEE80211_P2P_ATTR_MINOR_REASON,
934 IEEE80211_P2P_ATTR_CAPABILITY,
935 IEEE80211_P2P_ATTR_DEVICE_ID,
936 IEEE80211_P2P_ATTR_GO_INTENT,
937 IEEE80211_P2P_ATTR_GO_CONFIG_TIMEOUT,
938 IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
939 IEEE80211_P2P_ATTR_GROUP_BSSID,
940 IEEE80211_P2P_ATTR_EXT_LISTEN_TIMING,
941 IEEE80211_P2P_ATTR_INTENDED_IFACE_ADDR,
942 IEEE80211_P2P_ATTR_MANAGABILITY,
943 IEEE80211_P2P_ATTR_CHANNEL_LIST,
944 IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
945 IEEE80211_P2P_ATTR_DEVICE_INFO,
946 IEEE80211_P2P_ATTR_GROUP_INFO,
947 IEEE80211_P2P_ATTR_GROUP_ID,
948 IEEE80211_P2P_ATTR_INTERFACE,
949 IEEE80211_P2P_ATTR_OPER_CHANNEL,
950 IEEE80211_P2P_ATTR_INVITE_FLAGS,
951 /* 19 - 220: Reserved */
952 IEEE80211_P2P_ATTR_VENDOR_SPECIFIC = 221,
953
954 IEEE80211_P2P_ATTR_MAX
955};
956
908/** 957/**
909 * struct ieee80211_bar - HT Block Ack Request 958 * struct ieee80211_bar - HT Block Ack Request
910 * 959 *
@@ -1107,20 +1156,6 @@ struct ieee80211_ht_operation {
1107#define WLAN_HT_SMPS_CONTROL_STATIC 1 1156#define WLAN_HT_SMPS_CONTROL_STATIC 1
1108#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3 1157#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3
1109 1158
1110#define VHT_MCS_SUPPORTED_SET_SIZE 8
1111
1112struct ieee80211_vht_capabilities {
1113 __le32 vht_capabilities_info;
1114 u8 vht_supported_mcs_set[VHT_MCS_SUPPORTED_SET_SIZE];
1115} __packed;
1116
1117struct ieee80211_vht_operation {
1118 u8 vht_op_info_chwidth;
1119 u8 vht_op_info_chan_center_freq_seg1_idx;
1120 u8 vht_op_info_chan_center_freq_seg2_idx;
1121 __le16 vht_basic_mcs_set;
1122} __packed;
1123
1124/** 1159/**
1125 * struct ieee80211_vht_mcs_info - VHT MCS information 1160 * struct ieee80211_vht_mcs_info - VHT MCS information
1126 * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams 1161 * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams
@@ -1128,11 +1163,13 @@ struct ieee80211_vht_operation {
1128 * STA can receive. Rate expressed in units of 1 Mbps. 1163 * STA can receive. Rate expressed in units of 1 Mbps.
1129 * If this field is 0 this value should not be used to 1164 * If this field is 0 this value should not be used to
1130 * consider the highest RX data rate supported. 1165 * consider the highest RX data rate supported.
1166 * The top 3 bits of this field are reserved.
1131 * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams 1167 * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
1132 * @tx_highest: Indicates highest long GI VHT PPDU data rate 1168 * @tx_highest: Indicates highest long GI VHT PPDU data rate
1133 * STA can transmit. Rate expressed in units of 1 Mbps. 1169 * STA can transmit. Rate expressed in units of 1 Mbps.
1134 * If this field is 0 this value should not be used to 1170 * If this field is 0 this value should not be used to
1135 * consider the highest TX data rate supported. 1171 * consider the highest TX data rate supported.
1172 * The top 3 bits of this field are reserved.
1136 */ 1173 */
1137struct ieee80211_vht_mcs_info { 1174struct ieee80211_vht_mcs_info {
1138 __le16 rx_mcs_map; 1175 __le16 rx_mcs_map;
@@ -1141,38 +1178,107 @@ struct ieee80211_vht_mcs_info {
1141 __le16 tx_highest; 1178 __le16 tx_highest;
1142} __packed; 1179} __packed;
1143 1180
1181/**
1182 * enum ieee80211_vht_mcs_support - VHT MCS support definitions
1183 * @IEEE80211_VHT_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the
1184 * number of streams
1185 * @IEEE80211_VHT_MCS_SUPPORT_0_8: MCSes 0-8 are supported
1186 * @IEEE80211_VHT_MCS_SUPPORT_0_9: MCSes 0-9 are supported
1187 * @IEEE80211_VHT_MCS_NOT_SUPPORTED: This number of streams isn't supported
1188 *
1189 * These definitions are used in each 2-bit subfield of the @rx_mcs_map
1190 * and @tx_mcs_map fields of &struct ieee80211_vht_mcs_info, which are
1191 * both split into 8 subfields by number of streams. These values indicate
1192 * which MCSes are supported for the number of streams the value appears
1193 * for.
1194 */
1195enum ieee80211_vht_mcs_support {
1196 IEEE80211_VHT_MCS_SUPPORT_0_7 = 0,
1197 IEEE80211_VHT_MCS_SUPPORT_0_8 = 1,
1198 IEEE80211_VHT_MCS_SUPPORT_0_9 = 2,
1199 IEEE80211_VHT_MCS_NOT_SUPPORTED = 3,
1200};
1201
1202/**
1203 * struct ieee80211_vht_cap - VHT capabilities
1204 *
1205 * This structure is the "VHT capabilities element" as
1206 * described in 802.11ac D3.0 8.4.2.160
1207 * @vht_cap_info: VHT capability info
1208 * @supp_mcs: VHT MCS supported rates
1209 */
1210struct ieee80211_vht_cap {
1211 __le32 vht_cap_info;
1212 struct ieee80211_vht_mcs_info supp_mcs;
1213} __packed;
1214
1215/**
1216 * enum ieee80211_vht_chanwidth - VHT channel width
1217 * @IEEE80211_VHT_CHANWIDTH_USE_HT: use the HT operation IE to
1218 * determine the channel width (20 or 40 MHz)
1219 * @IEEE80211_VHT_CHANWIDTH_80MHZ: 80 MHz bandwidth
1220 * @IEEE80211_VHT_CHANWIDTH_160MHZ: 160 MHz bandwidth
1221 * @IEEE80211_VHT_CHANWIDTH_80P80MHZ: 80+80 MHz bandwidth
1222 */
1223enum ieee80211_vht_chanwidth {
1224 IEEE80211_VHT_CHANWIDTH_USE_HT = 0,
1225 IEEE80211_VHT_CHANWIDTH_80MHZ = 1,
1226 IEEE80211_VHT_CHANWIDTH_160MHZ = 2,
1227 IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3,
1228};
1229
1230/**
1231 * struct ieee80211_vht_operation - VHT operation IE
1232 *
1233 * This structure is the "VHT operation element" as
1234 * described in 802.11ac D3.0 8.4.2.161
1235 * @chan_width: Operating channel width
1236 * @center_freq_seg1_idx: center freq segment 1 index
1237 * @center_freq_seg2_idx: center freq segment 2 index
1238 * @basic_mcs_set: VHT Basic MCS rate set
1239 */
1240struct ieee80211_vht_operation {
1241 u8 chan_width;
1242 u8 center_freq_seg1_idx;
1243 u8 center_freq_seg2_idx;
1244 __le16 basic_mcs_set;
1245} __packed;
1246
1247
1144#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0 1248#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0
1145#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1 1249#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1
1146#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2 1250#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT 2
1147#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 1251#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3
1148 1252
1149/* 802.11ac VHT Capabilities */ 1253/* 802.11ac VHT Capabilities */
1150#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1254#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1151#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 1255#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
1152#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1153#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1154#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1155#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1156#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1157#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
1158#define IEEE80211_VHT_CAP_TXSTBC 0x00000080 1262#define IEEE80211_VHT_CAP_TXSTBC 0x00000080
1159#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 1263#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100
1160#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 1264#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
1161#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 1265#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
1162#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 1266#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
1163#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 1267#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
1164#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 1268#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
1165#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000 1269#define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX 0x00006000
1166#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000 1270#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX 0x00030000
1167#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 1271#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
1168#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 1272#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
1169#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 1273#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
1170#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 1274#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000
1171#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT 0x00800000 1275#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23
1172#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 1276#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
1173#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 1277 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
1174#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 1278#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000
1175#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 1279#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
1280#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
1281#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
1176 1282
1177/* Authentication algorithms */ 1283/* Authentication algorithms */
1178#define WLAN_AUTH_OPEN 0 1284#define WLAN_AUTH_OPEN 0
@@ -1440,8 +1546,6 @@ enum ieee80211_eid {
1440 1546
1441 WLAN_EID_RSN = 48, 1547 WLAN_EID_RSN = 48,
1442 WLAN_EID_MMIE = 76, 1548 WLAN_EID_MMIE = 76,
1443 WLAN_EID_WPA = 221,
1444 WLAN_EID_GENERIC = 221,
1445 WLAN_EID_VENDOR_SPECIFIC = 221, 1549 WLAN_EID_VENDOR_SPECIFIC = 221,
1446 WLAN_EID_QOS_PARAMETER = 222, 1550 WLAN_EID_QOS_PARAMETER = 222,
1447 1551
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 1cc595a67cc..f4e56ecd0b1 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -4,5 +4,22 @@
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/in6.h> 5#include <linux/in6.h>
6#include <uapi/linux/if_tunnel.h> 6#include <uapi/linux/if_tunnel.h>
7#include <linux/u64_stats_sync.h>
8
9/*
10 * Locking : hash tables are protected by RCU and RTNL
11 */
12
13#define for_each_ip_tunnel_rcu(pos, start) \
14 for (pos = rcu_dereference(start); pos; pos = rcu_dereference(pos->next))
15
16/* often modified stats are per cpu, other are shared (netdev->stats) */
17struct pcpu_tstats {
18 u64 rx_packets;
19 u64 rx_bytes;
20 u64 tx_packets;
21 u64 tx_bytes;
22 struct u64_stats_sync syncp;
23};
7 24
8#endif /* _IF_TUNNEL_H_ */ 25#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index c629b3a1d9a..f3eea18fdf4 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -66,7 +66,8 @@ struct iio_buffer_access_funcs {
66 * @stufftoread: [INTERN] flag to indicate new data. 66 * @stufftoread: [INTERN] flag to indicate new data.
67 * @demux_list: [INTERN] list of operations required to demux the scan. 67 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 **/ 69 * @buffer_list: [INTERN] entry in the devices list of current buffers.
70 */
70struct iio_buffer { 71struct iio_buffer {
71 int length; 72 int length;
72 int bytes_per_datum; 73 int bytes_per_datum;
@@ -81,9 +82,22 @@ struct iio_buffer {
81 const struct attribute_group *attrs; 82 const struct attribute_group *attrs;
82 struct list_head demux_list; 83 struct list_head demux_list;
83 unsigned char *demux_bounce; 84 unsigned char *demux_bounce;
85 struct list_head buffer_list;
84}; 86};
85 87
86/** 88/**
89 * iio_update_buffers() - add or remove buffer from active list
90 * @indio_dev: device to add buffer to
91 * @insert_buffer: buffer to insert
92 * @remove_buffer: buffer_to_remove
93 *
94 * Note this will tear down the all buffering and build it up again
95 */
96int iio_update_buffers(struct iio_dev *indio_dev,
97 struct iio_buffer *insert_buffer,
98 struct iio_buffer *remove_buffer);
99
100/**
87 * iio_buffer_init() - Initialize the buffer structure 101 * iio_buffer_init() - Initialize the buffer structure
88 * @buffer: buffer to be initialized 102 * @buffer: buffer to be initialized
89 **/ 103 **/
@@ -115,11 +129,11 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
115 struct iio_buffer *buffer, int bit); 129 struct iio_buffer *buffer, int bit);
116 130
117/** 131/**
118 * iio_push_to_buffer() - push to a registered buffer. 132 * iio_push_to_buffers() - push to a registered buffer.
119 * @buffer: IIO buffer structure for device 133 * @indio_dev: iio_dev structure for device.
120 * @data: the data to push to the buffer 134 * @data: Full scan.
121 */ 135 */
122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data); 136int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data);
123 137
124int iio_update_demux(struct iio_dev *indio_dev); 138int iio_update_demux(struct iio_dev *indio_dev);
125 139
@@ -181,7 +195,7 @@ bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
181#else /* CONFIG_IIO_BUFFER */ 195#else /* CONFIG_IIO_BUFFER */
182 196
183static inline int iio_buffer_register(struct iio_dev *indio_dev, 197static inline int iio_buffer_register(struct iio_dev *indio_dev,
184 struct iio_chan_spec *channels, 198 const struct iio_chan_spec *channels,
185 int num_channels) 199 int num_channels)
186{ 200{
187 return 0; 201 return 0;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index e875bcf0478..16c35ac045b 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -9,6 +9,8 @@
9 */ 9 */
10#ifndef _IIO_INKERN_CONSUMER_H_ 10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H_ 11#define _IIO_INKERN_CONSUMER_H_
12
13#include <linux/types.h>
12#include <linux/iio/types.h> 14#include <linux/iio/types.h>
13 15
14struct iio_dev; 16struct iio_dev;
@@ -18,10 +20,12 @@ struct iio_chan_spec;
18 * struct iio_channel - everything needed for a consumer to use a channel 20 * struct iio_channel - everything needed for a consumer to use a channel
19 * @indio_dev: Device on which the channel exists. 21 * @indio_dev: Device on which the channel exists.
20 * @channel: Full description of the channel. 22 * @channel: Full description of the channel.
23 * @data: Data about the channel used by consumer.
21 */ 24 */
22struct iio_channel { 25struct iio_channel {
23 struct iio_dev *indio_dev; 26 struct iio_dev *indio_dev;
24 const struct iio_chan_spec *channel; 27 const struct iio_chan_spec *channel;
28 void *data;
25}; 29};
26 30
27/** 31/**
@@ -59,6 +63,52 @@ struct iio_channel *iio_channel_get_all(const char *name);
59 */ 63 */
60void iio_channel_release_all(struct iio_channel *chan); 64void iio_channel_release_all(struct iio_channel *chan);
61 65
66struct iio_cb_buffer;
67/**
68 * iio_channel_get_all_cb() - register callback for triggered capture
69 * @name: Name of client device.
70 * @cb: Callback function.
71 * @private: Private data passed to callback.
72 *
73 * NB right now we have no ability to mux data from multiple devices.
74 * So if the channels requested come from different devices this will
75 * fail.
76 */
77struct iio_cb_buffer *iio_channel_get_all_cb(const char *name,
78 int (*cb)(u8 *data,
79 void *private),
80 void *private);
81/**
82 * iio_channel_release_all_cb() - release and unregister the callback.
83 * @cb_buffer: The callback buffer that was allocated.
84 */
85void iio_channel_release_all_cb(struct iio_cb_buffer *cb_buffer);
86
87/**
88 * iio_channel_start_all_cb() - start the flow of data through callback.
89 * @cb_buff: The callback buffer we are starting.
90 */
91int iio_channel_start_all_cb(struct iio_cb_buffer *cb_buff);
92
93/**
94 * iio_channel_stop_all_cb() - stop the flow of data through the callback.
95 * @cb_buff: The callback buffer we are stopping.
96 */
97void iio_channel_stop_all_cb(struct iio_cb_buffer *cb_buff);
98
99/**
100 * iio_channel_cb_get_channels() - get access to the underlying channels.
101 * @cb_buff: The callback buffer from whom we want the channel
102 * information.
103 *
104 * This function allows one to obtain information about the channels.
105 * Whilst this may allow direct reading if all buffers are disabled, the
106 * primary aim is to allow drivers that are consuming a channel to query
107 * things like scaling of the channel.
108 */
109struct iio_channel
110*iio_channel_cb_get_channels(const struct iio_cb_buffer *cb_buffer);
111
62/** 112/**
63 * iio_read_channel_raw() - read from a given channel 113 * iio_read_channel_raw() - read from a given channel
64 * @chan: The channel being queried. 114 * @chan: The channel being queried.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 7806c24e5bc..da8c776ba0b 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -410,6 +410,7 @@ struct iio_buffer_setup_ops {
410 * and owner 410 * and owner
411 * @event_interface: [INTERN] event chrdevs associated with interrupt lines 411 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
412 * @buffer: [DRIVER] any buffer present 412 * @buffer: [DRIVER] any buffer present
413 * @buffer_list: [INTERN] list of all buffers currently attached
413 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux 414 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
414 * @mlock: [INTERN] lock used to prevent simultaneous device state 415 * @mlock: [INTERN] lock used to prevent simultaneous device state
415 * changes 416 * changes
@@ -448,6 +449,7 @@ struct iio_dev {
448 struct iio_event_interface *event_interface; 449 struct iio_event_interface *event_interface;
449 450
450 struct iio_buffer *buffer; 451 struct iio_buffer *buffer;
452 struct list_head buffer_list;
451 int scan_bytes; 453 int scan_bytes;
452 struct mutex mlock; 454 struct mutex mlock;
453 455
@@ -618,6 +620,9 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
618}; 620};
619#endif 621#endif
620 622
623int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
624 int *fract);
625
621/** 626/**
622 * IIO_DEGREE_TO_RAD() - Convert degree to rad 627 * IIO_DEGREE_TO_RAD() - Convert degree to rad
623 * @deg: A value in degree 628 * @deg: A value in degree
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
new file mode 100644
index 00000000000..ff781dca2e9
--- /dev/null
+++ b/include/linux/iio/imu/adis.h
@@ -0,0 +1,280 @@
1/*
2 * Common library for ADIS16XXX devices
3 *
4 * Copyright 2012 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __IIO_ADIS_H__
11#define __IIO_ADIS_H__
12
13#include <linux/spi/spi.h>
14#include <linux/interrupt.h>
15#include <linux/iio/types.h>
16
17#define ADIS_WRITE_REG(reg) ((0x80 | (reg)))
18#define ADIS_READ_REG(reg) ((reg) & 0x7f)
19
20#define ADIS_PAGE_SIZE 0x80
21#define ADIS_REG_PAGE_ID 0x00
22
23struct adis;
24
25/**
26 * struct adis_data - ADIS chip variant specific data
27 * @read_delay: SPI delay for read operations in us
28 * @write_delay: SPI delay for write operations in us
29 * @glob_cmd_reg: Register address of the GLOB_CMD register
30 * @msc_ctrl_reg: Register address of the MSC_CTRL register
31 * @diag_stat_reg: Register address of the DIAG_STAT register
32 * @status_error_msgs: Array of error messgaes
33 * @status_error_mask:
34 */
35struct adis_data {
36 unsigned int read_delay;
37 unsigned int write_delay;
38
39 unsigned int glob_cmd_reg;
40 unsigned int msc_ctrl_reg;
41 unsigned int diag_stat_reg;
42
43 unsigned int self_test_mask;
44 unsigned int startup_delay;
45
46 const char * const *status_error_msgs;
47 unsigned int status_error_mask;
48
49 int (*enable_irq)(struct adis *adis, bool enable);
50
51 bool has_paging;
52};
53
54struct adis {
55 struct spi_device *spi;
56 struct iio_trigger *trig;
57
58 const struct adis_data *data;
59
60 struct mutex txrx_lock;
61 struct spi_message msg;
62 struct spi_transfer *xfer;
63 unsigned int current_page;
64 void *buffer;
65
66 uint8_t tx[10] ____cacheline_aligned;
67 uint8_t rx[4];
68};
69
70int adis_init(struct adis *adis, struct iio_dev *indio_dev,
71 struct spi_device *spi, const struct adis_data *data);
72int adis_reset(struct adis *adis);
73
74int adis_write_reg(struct adis *adis, unsigned int reg,
75 unsigned int val, unsigned int size);
76int adis_read_reg(struct adis *adis, unsigned int reg,
77 unsigned int *val, unsigned int size);
78
79/**
80 * adis_write_reg_8() - Write single byte to a register
81 * @adis: The adis device
82 * @reg: The address of the register to be written
83 * @value: The value to write
84 */
85static inline int adis_write_reg_8(struct adis *adis, unsigned int reg,
86 uint8_t val)
87{
88 return adis_write_reg(adis, reg, val, 1);
89}
90
91/**
92 * adis_write_reg_16() - Write 2 bytes to a pair of registers
93 * @adis: The adis device
94 * @reg: The address of the lower of the two registers
95 * @value: Value to be written
96 */
97static inline int adis_write_reg_16(struct adis *adis, unsigned int reg,
98 uint16_t val)
99{
100 return adis_write_reg(adis, reg, val, 2);
101}
102
103/**
104 * adis_write_reg_32() - write 4 bytes to four registers
105 * @adis: The adis device
106 * @reg: The address of the lower of the four register
107 * @value: Value to be written
108 */
109static inline int adis_write_reg_32(struct adis *adis, unsigned int reg,
110 uint32_t val)
111{
112 return adis_write_reg(adis, reg, val, 4);
113}
114
115/**
116 * adis_read_reg_16() - read 2 bytes from a 16-bit register
117 * @adis: The adis device
118 * @reg: The address of the lower of the two registers
119 * @val: The value read back from the device
120 */
121static inline int adis_read_reg_16(struct adis *adis, unsigned int reg,
122 uint16_t *val)
123{
124 unsigned int tmp;
125 int ret;
126
127 ret = adis_read_reg(adis, reg, &tmp, 2);
128 *val = tmp;
129
130 return ret;
131}
132
133/**
134 * adis_read_reg_32() - read 4 bytes from a 32-bit register
135 * @adis: The adis device
136 * @reg: The address of the lower of the two registers
137 * @val: The value read back from the device
138 */
139static inline int adis_read_reg_32(struct adis *adis, unsigned int reg,
140 uint32_t *val)
141{
142 unsigned int tmp;
143 int ret;
144
145 ret = adis_read_reg(adis, reg, &tmp, 4);
146 *val = tmp;
147
148 return ret;
149}
150
151int adis_enable_irq(struct adis *adis, bool enable);
152int adis_check_status(struct adis *adis);
153
154int adis_initial_startup(struct adis *adis);
155
156int adis_single_conversion(struct iio_dev *indio_dev,
157 const struct iio_chan_spec *chan, unsigned int error_mask,
158 int *val);
159
160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \
161 .type = IIO_VOLTAGE, \
162 .indexed = 1, \
163 .channel = (chan), \
164 .extend_name = name, \
165 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
166 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
167 .address = (addr), \
168 .scan_index = (si), \
169 .scan_type = { \
170 .sign = 'u', \
171 .realbits = (bits), \
172 .storagebits = 16, \
173 .endianness = IIO_BE, \
174 }, \
175}
176
177#define ADIS_SUPPLY_CHAN(addr, si, bits) \
178 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits)
179
180#define ADIS_AUX_ADC_CHAN(addr, si, bits) \
181 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits)
182
183#define ADIS_TEMP_CHAN(addr, si, bits) { \
184 .type = IIO_TEMP, \
185 .indexed = 1, \
186 .channel = 0, \
187 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
188 IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \
189 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
190 .address = (addr), \
191 .scan_index = (si), \
192 .scan_type = { \
193 .sign = 'u', \
194 .realbits = (bits), \
195 .storagebits = 16, \
196 .endianness = IIO_BE, \
197 }, \
198}
199
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \
201 .type = (_type), \
202 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
205 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
206 info, \
207 .address = (addr), \
208 .scan_index = (si), \
209 .scan_type = { \
210 .sign = 's', \
211 .realbits = (bits), \
212 .storagebits = 16, \
213 .endianness = IIO_BE, \
214 }, \
215}
216
217#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits)
219
220#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits)
222
223#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits)
225
226#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits)
228
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230
231int adis_setup_buffer_and_trigger(struct adis *adis,
232 struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *));
233void adis_cleanup_buffer_and_trigger(struct adis *adis,
234 struct iio_dev *indio_dev);
235
236int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev);
237void adis_remove_trigger(struct adis *adis);
238
239int adis_update_scan_mode(struct iio_dev *indio_dev,
240 const unsigned long *scan_mask);
241
242#else /* CONFIG_IIO_BUFFER */
243
244static inline int adis_setup_buffer_and_trigger(struct adis *adis,
245 struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *))
246{
247 return 0;
248}
249
250static inline void adis_cleanup_buffer_and_trigger(struct adis *adis,
251 struct iio_dev *indio_dev)
252{
253}
254
255static inline int adis_probe_trigger(struct adis *adis,
256 struct iio_dev *indio_dev)
257{
258 return 0;
259}
260
261static inline void adis_remove_trigger(struct adis *adis)
262{
263}
264
265#define adis_update_scan_mode NULL
266
267#endif /* CONFIG_IIO_BUFFER */
268
269#ifdef CONFIG_DEBUG_FS
270
271int adis_debugfs_reg_access(struct iio_dev *indio_dev,
272 unsigned int reg, unsigned int writeval, unsigned int *readval);
273
274#else
275
276#define adis_debugfs_reg_access NULL
277
278#endif
279
280#endif
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
index 809a3f08d5a..1601a2a63a7 100644
--- a/include/linux/iio/machine.h
+++ b/include/linux/iio/machine.h
@@ -19,11 +19,13 @@
19 * @consumer_dev_name: Name to uniquely identify the consumer device. 19 * @consumer_dev_name: Name to uniquely identify the consumer device.
20 * @consumer_channel: Unique name used to identify the channel on the 20 * @consumer_channel: Unique name used to identify the channel on the
21 * consumer side. 21 * consumer side.
22 * @consumer_data: Data about the channel for use by the consumer driver.
22 */ 23 */
23struct iio_map { 24struct iio_map {
24 const char *adc_channel_label; 25 const char *adc_channel_label;
25 const char *consumer_dev_name; 26 const char *consumer_dev_name;
26 const char *consumer_channel; 27 const char *consumer_channel;
28 void *consumer_data;
27}; 29};
28 30
29#endif 31#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 5c647ecfd5b..88bf0f0d27b 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -28,6 +28,7 @@ enum iio_chan_type {
28 IIO_CAPACITANCE, 28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE, 29 IIO_ALTVOLTAGE,
30 IIO_CCT, 30 IIO_CCT,
31 IIO_PRESSURE,
31}; 32};
32 33
33enum iio_modifier { 34enum iio_modifier {
@@ -58,5 +59,6 @@ enum iio_modifier {
58#define IIO_VAL_INT_PLUS_NANO 3 59#define IIO_VAL_INT_PLUS_NANO 3
59#define IIO_VAL_INT_PLUS_MICRO_DB 4 60#define IIO_VAL_INT_PLUS_MICRO_DB 4
60#define IIO_VAL_FRACTIONAL 10 61#define IIO_VAL_FRACTIONAL 10
62#define IIO_VAL_FRACTIONAL_LOG2 11
61 63
62#endif /* _IIO_TYPES_H_ */ 64#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 2c7223d7e73..86c361e947b 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -18,6 +18,7 @@ extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_file_check(struct file *file, int mask); 18extern int ima_file_check(struct file *file, int mask);
19extern void ima_file_free(struct file *file); 19extern void ima_file_free(struct file *file);
20extern int ima_file_mmap(struct file *file, unsigned long prot); 20extern int ima_file_mmap(struct file *file, unsigned long prot);
21extern int ima_module_check(struct file *file);
21 22
22#else 23#else
23static inline int ima_bprm_check(struct linux_binprm *bprm) 24static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -40,6 +41,11 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
40 return 0; 41 return 0;
41} 42}
42 43
44static inline int ima_module_check(struct file *file)
45{
46 return 0;
47}
48
43#endif /* CONFIG_IMA_H */ 49#endif /* CONFIG_IMA_H */
44 50
45#ifdef CONFIG_IMA_APPRAISE 51#ifdef CONFIG_IMA_APPRAISE
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index d032780d0ce..a9d828976a7 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -171,6 +171,9 @@ struct in_ifaddr {
171extern int register_inetaddr_notifier(struct notifier_block *nb); 171extern int register_inetaddr_notifier(struct notifier_block *nb);
172extern int unregister_inetaddr_notifier(struct notifier_block *nb); 172extern int unregister_inetaddr_notifier(struct notifier_block *nb);
173 173
174extern void inet_netconf_notify_devconf(struct net *net, int type, int ifindex,
175 struct ipv4_devconf *devconf);
176
174extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); 177extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
175static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) 178static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
176{ 179{
diff --git a/include/linux/init.h b/include/linux/init.h
index e59041e21df..a799273714a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,13 +93,13 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG */ 96/* Used for HOTPLUG, but that is always enabled now, so just make them noops */
97#define __devinit __section(.devinit.text) __cold notrace 97#define __devinit
98#define __devinitdata __section(.devinit.data) 98#define __devinitdata
99#define __devinitconst __constsection(.devinit.rodata) 99#define __devinitconst
100#define __devexit __section(.devexit.text) __exitused __cold notrace 100#define __devexit
101#define __devexitdata __section(.devexit.data) 101#define __devexitdata
102#define __devexitconst __constsection(.devexit.rodata) 102#define __devexitconst
103 103
104/* Used for HOTPLUG_CPU */ 104/* Used for HOTPLUG_CPU */
105#define __cpuinit __section(.cpuinit.text) __cold notrace 105#define __cpuinit __section(.cpuinit.text) __cold notrace
@@ -126,10 +126,6 @@
126#define __INITRODATA .section ".init.rodata","a",%progbits 126#define __INITRODATA .section ".init.rodata","a",%progbits
127#define __FINITDATA .previous 127#define __FINITDATA .previous
128 128
129#define __DEVINIT .section ".devinit.text", "ax"
130#define __DEVINITDATA .section ".devinit.data", "aw"
131#define __DEVINITRODATA .section ".devinit.rodata", "a"
132
133#define __CPUINIT .section ".cpuinit.text", "ax" 129#define __CPUINIT .section ".cpuinit.text", "ax"
134#define __CPUINITDATA .section ".cpuinit.data", "aw" 130#define __CPUINITDATA .section ".cpuinit.data", "aw"
135#define __CPUINITRODATA .section ".cpuinit.rodata", "a" 131#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
@@ -186,16 +182,16 @@ extern bool initcall_debug;
186 * can point at the same handler without causing duplicate-symbol build errors. 182 * can point at the same handler without causing duplicate-symbol build errors.
187 */ 183 */
188 184
189#define __define_initcall(level,fn,id) \ 185#define __define_initcall(fn, id) \
190 static initcall_t __initcall_##fn##id __used \ 186 static initcall_t __initcall_##fn##id __used \
191 __attribute__((__section__(".initcall" level ".init"))) = fn 187 __attribute__((__section__(".initcall" #id ".init"))) = fn
192 188
193/* 189/*
194 * Early initcalls run before initializing SMP. 190 * Early initcalls run before initializing SMP.
195 * 191 *
196 * Only for built-in code, not modules. 192 * Only for built-in code, not modules.
197 */ 193 */
198#define early_initcall(fn) __define_initcall("early",fn,early) 194#define early_initcall(fn) __define_initcall(fn, early)
199 195
200/* 196/*
201 * A "pure" initcall has no dependencies on anything else, and purely 197 * A "pure" initcall has no dependencies on anything else, and purely
@@ -204,23 +200,23 @@ extern bool initcall_debug;
204 * This only exists for built-in code, not for modules. 200 * This only exists for built-in code, not for modules.
205 * Keep main.c:initcall_level_names[] in sync. 201 * Keep main.c:initcall_level_names[] in sync.
206 */ 202 */
207#define pure_initcall(fn) __define_initcall("0",fn,0) 203#define pure_initcall(fn) __define_initcall(fn, 0)
208 204
209#define core_initcall(fn) __define_initcall("1",fn,1) 205#define core_initcall(fn) __define_initcall(fn, 1)
210#define core_initcall_sync(fn) __define_initcall("1s",fn,1s) 206#define core_initcall_sync(fn) __define_initcall(fn, 1s)
211#define postcore_initcall(fn) __define_initcall("2",fn,2) 207#define postcore_initcall(fn) __define_initcall(fn, 2)
212#define postcore_initcall_sync(fn) __define_initcall("2s",fn,2s) 208#define postcore_initcall_sync(fn) __define_initcall(fn, 2s)
213#define arch_initcall(fn) __define_initcall("3",fn,3) 209#define arch_initcall(fn) __define_initcall(fn, 3)
214#define arch_initcall_sync(fn) __define_initcall("3s",fn,3s) 210#define arch_initcall_sync(fn) __define_initcall(fn, 3s)
215#define subsys_initcall(fn) __define_initcall("4",fn,4) 211#define subsys_initcall(fn) __define_initcall(fn, 4)
216#define subsys_initcall_sync(fn) __define_initcall("4s",fn,4s) 212#define subsys_initcall_sync(fn) __define_initcall(fn, 4s)
217#define fs_initcall(fn) __define_initcall("5",fn,5) 213#define fs_initcall(fn) __define_initcall(fn, 5)
218#define fs_initcall_sync(fn) __define_initcall("5s",fn,5s) 214#define fs_initcall_sync(fn) __define_initcall(fn, 5s)
219#define rootfs_initcall(fn) __define_initcall("rootfs",fn,rootfs) 215#define rootfs_initcall(fn) __define_initcall(fn, rootfs)
220#define device_initcall(fn) __define_initcall("6",fn,6) 216#define device_initcall(fn) __define_initcall(fn, 6)
221#define device_initcall_sync(fn) __define_initcall("6s",fn,6s) 217#define device_initcall_sync(fn) __define_initcall(fn, 6s)
222#define late_initcall(fn) __define_initcall("7",fn,7) 218#define late_initcall(fn) __define_initcall(fn, 7)
223#define late_initcall_sync(fn) __define_initcall("7s",fn,7s) 219#define late_initcall_sync(fn) __define_initcall(fn, 7s)
224 220
225#define __initcall(fn) device_initcall(fn) 221#define __initcall(fn) device_initcall(fn)
226 222
diff --git a/include/linux/input.h b/include/linux/input.h
index cab994ba6d9..82ce323b998 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -112,6 +112,11 @@ struct input_value {
112 * @h_list: list of input handles associated with the device. When 112 * @h_list: list of input handles associated with the device. When
113 * accessing the list dev->mutex must be held 113 * accessing the list dev->mutex must be held
114 * @node: used to place the device onto input_dev_list 114 * @node: used to place the device onto input_dev_list
115 * @num_vals: number of values queued in the current frame
116 * @max_vals: maximum number of values queued in a frame
117 * @vals: array of values queued in the current frame
118 * @devres_managed: indicates that devices is managed with devres framework
119 * and needs not be explicitly unregistered or freed.
115 */ 120 */
116struct input_dev { 121struct input_dev {
117 const char *name; 122 const char *name;
@@ -180,6 +185,8 @@ struct input_dev {
180 unsigned int num_vals; 185 unsigned int num_vals;
181 unsigned int max_vals; 186 unsigned int max_vals;
182 struct input_value *vals; 187 struct input_value *vals;
188
189 bool devres_managed;
183}; 190};
184#define to_input_dev(d) container_of(d, struct input_dev, dev) 191#define to_input_dev(d) container_of(d, struct input_dev, dev)
185 192
@@ -323,7 +330,8 @@ struct input_handle {
323 struct list_head h_node; 330 struct list_head h_node;
324}; 331};
325 332
326struct input_dev *input_allocate_device(void); 333struct input_dev __must_check *input_allocate_device(void);
334struct input_dev __must_check *devm_input_allocate_device(struct device *);
327void input_free_device(struct input_dev *dev); 335void input_free_device(struct input_dev *dev);
328 336
329static inline struct input_dev *input_get_device(struct input_dev *dev) 337static inline struct input_dev *input_get_device(struct input_dev *dev)
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h
index 05e03284b92..6230d76bde5 100644
--- a/include/linux/input/bu21013.h
+++ b/include/linux/input/bu21013.h
@@ -9,13 +9,10 @@
9 9
10/** 10/**
11 * struct bu21013_platform_device - Handle the platform data 11 * struct bu21013_platform_device - Handle the platform data
12 * @cs_en: pointer to the cs enable function
13 * @cs_dis: pointer to the cs disable function
14 * @irq_read_val: pointer to read the pen irq value function
15 * @touch_x_max: touch x max 12 * @touch_x_max: touch x max
16 * @touch_y_max: touch y max 13 * @touch_y_max: touch y max
17 * @cs_pin: chip select pin 14 * @cs_pin: chip select pin
18 * @irq: irq pin 15 * @touch_pin: touch gpio pin
19 * @ext_clk: external clock flag 16 * @ext_clk: external clock flag
20 * @x_flip: x flip flag 17 * @x_flip: x flip flag
21 * @y_flip: y flip flag 18 * @y_flip: y flip flag
@@ -24,13 +21,10 @@
24 * This is used to handle the platform data 21 * This is used to handle the platform data
25 */ 22 */
26struct bu21013_platform_device { 23struct bu21013_platform_device {
27 int (*cs_en)(int reset_pin);
28 int (*cs_dis)(int reset_pin);
29 int (*irq_read_val)(void);
30 int touch_x_max; 24 int touch_x_max;
31 int touch_y_max; 25 int touch_y_max;
32 unsigned int cs_pin; 26 unsigned int cs_pin;
33 unsigned int irq; 27 unsigned int touch_pin;
34 bool ext_clk; 28 bool ext_clk;
35 bool x_flip; 29 bool x_flip;
36 bool y_flip; 30 bool y_flip;
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index cc5cca774ba..2e86bd0bfba 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -69,6 +69,12 @@ static inline bool input_mt_is_active(const struct input_mt_slot *slot)
69 return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0; 69 return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0;
70} 70}
71 71
72static inline bool input_mt_is_used(const struct input_mt *mt,
73 const struct input_mt_slot *slot)
74{
75 return slot->frame == mt->frame;
76}
77
72int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, 78int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
73 unsigned int flags); 79 unsigned int flags);
74void input_mt_destroy_slots(struct input_dev *dev); 80void input_mt_destroy_slots(struct input_dev *dev);
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
new file mode 100644
index 00000000000..49269a2aa32
--- /dev/null
+++ b/include/linux/input/ti_am335x_tsc.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
deleted file mode 100644
index b10a527a92a..00000000000
--- a/include/linux/input/ti_tscadc.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __LINUX_TI_TSCADC_H
2#define __LINUX_TI_TSCADC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 */
11
12struct tsc_data {
13 int wires;
14 int x_plate_resistance;
15};
16
17#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 58b82a22a52..492bc651353 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -25,6 +25,11 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
25 return (struct iphdr *)skb_network_header(skb); 25 return (struct iphdr *)skb_network_header(skb);
26} 26}
27 27
28static inline struct iphdr *inner_ip_hdr(const struct sk_buff *skb)
29{
30 return (struct iphdr *)skb_inner_network_header(skb);
31}
32
28static inline struct iphdr *ipip_hdr(const struct sk_buff *skb) 33static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
29{ 34{
30 return (struct iphdr *)skb_transport_header(skb); 35 return (struct iphdr *)skb_transport_header(skb);
diff --git a/include/linux/ipack.h b/include/linux/ipack.h
new file mode 100644
index 00000000000..fea12cbb2ae
--- /dev/null
+++ b/include/linux/ipack.h
@@ -0,0 +1,245 @@
1/*
2 * Industry-pack bus.
3 *
4 * Copyright (C) 2011-2012 CERN (www.cern.ch)
5 * Author: Samuel Iglesias Gonsalvez <siglesias@igalia.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 Free
9 * Software Foundation; version 2 of the License.
10 */
11
12#include <linux/mod_devicetable.h>
13#include <linux/device.h>
14#include <linux/interrupt.h>
15
16#define IPACK_IDPROM_OFFSET_I 0x01
17#define IPACK_IDPROM_OFFSET_P 0x03
18#define IPACK_IDPROM_OFFSET_A 0x05
19#define IPACK_IDPROM_OFFSET_C 0x07
20#define IPACK_IDPROM_OFFSET_MANUFACTURER_ID 0x09
21#define IPACK_IDPROM_OFFSET_MODEL 0x0B
22#define IPACK_IDPROM_OFFSET_REVISION 0x0D
23#define IPACK_IDPROM_OFFSET_RESERVED 0x0F
24#define IPACK_IDPROM_OFFSET_DRIVER_ID_L 0x11
25#define IPACK_IDPROM_OFFSET_DRIVER_ID_H 0x13
26#define IPACK_IDPROM_OFFSET_NUM_BYTES 0x15
27#define IPACK_IDPROM_OFFSET_CRC 0x17
28
29/*
30 * IndustryPack Fromat, Vendor and Device IDs.
31 */
32
33/* ID section format versions */
34#define IPACK_ID_VERSION_INVALID 0x00
35#define IPACK_ID_VERSION_1 0x01
36#define IPACK_ID_VERSION_2 0x02
37
38/* Vendors and devices. Sort key: vendor first, device next. */
39#define IPACK1_VENDOR_ID_RESERVED1 0x00
40#define IPACK1_VENDOR_ID_RESERVED2 0xFF
41#define IPACK1_VENDOR_ID_UNREGISTRED01 0x01
42#define IPACK1_VENDOR_ID_UNREGISTRED02 0x02
43#define IPACK1_VENDOR_ID_UNREGISTRED03 0x03
44#define IPACK1_VENDOR_ID_UNREGISTRED04 0x04
45#define IPACK1_VENDOR_ID_UNREGISTRED05 0x05
46#define IPACK1_VENDOR_ID_UNREGISTRED06 0x06
47#define IPACK1_VENDOR_ID_UNREGISTRED07 0x07
48#define IPACK1_VENDOR_ID_UNREGISTRED08 0x08
49#define IPACK1_VENDOR_ID_UNREGISTRED09 0x09
50#define IPACK1_VENDOR_ID_UNREGISTRED10 0x0A
51#define IPACK1_VENDOR_ID_UNREGISTRED11 0x0B
52#define IPACK1_VENDOR_ID_UNREGISTRED12 0x0C
53#define IPACK1_VENDOR_ID_UNREGISTRED13 0x0D
54#define IPACK1_VENDOR_ID_UNREGISTRED14 0x0E
55#define IPACK1_VENDOR_ID_UNREGISTRED15 0x0F
56
57#define IPACK1_VENDOR_ID_SBS 0xF0
58#define IPACK1_DEVICE_ID_SBS_OCTAL_232 0x22
59#define IPACK1_DEVICE_ID_SBS_OCTAL_422 0x2A
60#define IPACK1_DEVICE_ID_SBS_OCTAL_485 0x48
61
62struct ipack_bus_ops;
63struct ipack_driver;
64
65enum ipack_space {
66 IPACK_IO_SPACE = 0,
67 IPACK_ID_SPACE,
68 IPACK_INT_SPACE,
69 IPACK_MEM8_SPACE,
70 IPACK_MEM16_SPACE,
71 /* Dummy for counting the number of entries. Must remain the last
72 * entry */
73 IPACK_SPACE_COUNT,
74};
75
76/**
77 */
78struct ipack_region {
79 phys_addr_t start;
80 size_t size;
81};
82
83/**
84 * struct ipack_device
85 *
86 * @slot: Slot where the device is plugged in the carrier board
87 * @bus: ipack_bus_device where the device is plugged to.
88 * @id_space: Virtual address to ID space.
89 * @io_space: Virtual address to IO space.
90 * @mem_space: Virtual address to MEM space.
91 * @dev: device in kernel representation.
92 *
93 * Warning: Direct access to mapped memory is possible but the endianness
94 * is not the same with PCI carrier or VME carrier. The endianness is managed
95 * by the carrier board throught bus->ops.
96 */
97struct ipack_device {
98 unsigned int slot;
99 struct ipack_bus_device *bus;
100 struct device dev;
101 void (*release) (struct ipack_device *dev);
102 struct ipack_region region[IPACK_SPACE_COUNT];
103 u8 *id;
104 size_t id_avail;
105 u32 id_vendor;
106 u32 id_device;
107 u8 id_format;
108 unsigned int id_crc_correct:1;
109 unsigned int speed_8mhz:1;
110 unsigned int speed_32mhz:1;
111};
112
113/**
114 * struct ipack_driver_ops -- Callbacks to IPack device driver
115 *
116 * @probe: Probe function
117 * @remove: Prepare imminent removal of the device. Services provided by the
118 * device should be revoked.
119 */
120
121struct ipack_driver_ops {
122 int (*probe) (struct ipack_device *dev);
123 void (*remove) (struct ipack_device *dev);
124};
125
126/**
127 * struct ipack_driver -- Specific data to each ipack device driver
128 *
129 * @driver: Device driver kernel representation
130 * @ops: Callbacks provided by the IPack device driver
131 */
132struct ipack_driver {
133 struct device_driver driver;
134 const struct ipack_device_id *id_table;
135 const struct ipack_driver_ops *ops;
136};
137
138/**
139 * struct ipack_bus_ops - available operations on a bridge module
140 *
141 * @map_space: map IP address space
142 * @unmap_space: unmap IP address space
143 * @request_irq: request IRQ
144 * @free_irq: free IRQ
145 * @get_clockrate: Returns the clockrate the carrier is currently
146 * communicating with the device at.
147 * @set_clockrate: Sets the clock-rate for carrier / module communication.
148 * Should return -EINVAL if the requested speed is not supported.
149 * @get_error: Returns the error state for the slot the device is attached
150 * to.
151 * @get_timeout: Returns 1 if the communication with the device has
152 * previously timed out.
153 * @reset_timeout: Resets the state returned by get_timeout.
154 */
155struct ipack_bus_ops {
156 int (*request_irq) (struct ipack_device *dev,
157 irqreturn_t (*handler)(void *), void *arg);
158 int (*free_irq) (struct ipack_device *dev);
159 int (*get_clockrate) (struct ipack_device *dev);
160 int (*set_clockrate) (struct ipack_device *dev, int mherz);
161 int (*get_error) (struct ipack_device *dev);
162 int (*get_timeout) (struct ipack_device *dev);
163 int (*reset_timeout) (struct ipack_device *dev);
164};
165
166/**
167 * struct ipack_bus_device
168 *
169 * @dev: pointer to carrier device
170 * @slots: number of slots available
171 * @bus_nr: ipack bus number
172 * @ops: bus operations for the mezzanine drivers
173 */
174struct ipack_bus_device {
175 struct device *parent;
176 int slots;
177 int bus_nr;
178 const struct ipack_bus_ops *ops;
179};
180
181/**
182 * ipack_bus_register -- register a new ipack bus
183 *
184 * @parent: pointer to the parent device, if any.
185 * @slots: number of slots available in the bus device.
186 * @ops: bus operations for the mezzanine drivers.
187 *
188 * The carrier board device should call this function to register itself as
189 * available bus device in ipack.
190 */
191struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
192 const struct ipack_bus_ops *ops);
193
194/**
195 * ipack_bus_unregister -- unregister an ipack bus
196 */
197int ipack_bus_unregister(struct ipack_bus_device *bus);
198
199/**
200 * ipack_driver_register -- Register a new ipack device driver
201 *
202 * Called by a ipack driver to register itself as a driver
203 * that can manage ipack devices.
204 */
205int ipack_driver_register(struct ipack_driver *edrv, struct module *owner,
206 const char *name);
207void ipack_driver_unregister(struct ipack_driver *edrv);
208
209/**
210 * ipack_device_register -- register an IPack device with the kernel
211 * @dev: the new device to register.
212 *
213 * Register a new IPack device ("module" in IndustryPack jargon). The call
214 * is done by the carrier driver. The carrier should populate the fields
215 * bus and slot as well as the region array of @dev prior to calling this
216 * function. The rest of the fields will be allocated and populated
217 * during registration.
218 *
219 * Return zero on success or error code on failure.
220 */
221int ipack_device_register(struct ipack_device *dev);
222void ipack_device_unregister(struct ipack_device *dev);
223
224/**
225 * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table
226 * @_table: device table name
227 *
228 * This macro is used to create a struct ipack_device_id array (a device table)
229 * in a generic manner.
230 */
231#define DEFINE_IPACK_DEVICE_TABLE(_table) \
232 const struct ipack_device_id _table[]
233/**
234 * IPACK_DEVICE - macro used to describe a specific IndustryPack device
235 * @_format: the format version (currently either 1 or 2, 8 bit value)
236 * @vend: the 8 or 24 bit IndustryPack Vendor ID
237 * @dev: the 8 or 16 bit IndustryPack Device ID
238 *
239 * This macro is used to create a struct ipack_device_id that matches a specific
240 * device.
241 */
242#define IPACK_DEVICE(_format, vend, dev) \
243 .format = (_format), \
244 .vendor = (vend), \
245 .device = (dev)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 5499c92a915..fe771978e87 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -67,6 +67,8 @@ struct ipc_namespace {
67 67
68 /* user_ns which owns the ipc ns */ 68 /* user_ns which owns the ipc ns */
69 struct user_namespace *user_ns; 69 struct user_namespace *user_ns;
70
71 unsigned int proc_inum;
70}; 72};
71 73
72extern struct ipc_namespace init_ipc_ns; 74extern struct ipc_namespace init_ipc_ns;
@@ -133,7 +135,8 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
133 135
134#if defined(CONFIG_IPC_NS) 136#if defined(CONFIG_IPC_NS)
135extern struct ipc_namespace *copy_ipcs(unsigned long flags, 137extern struct ipc_namespace *copy_ipcs(unsigned long flags,
136 struct task_struct *tsk); 138 struct user_namespace *user_ns, struct ipc_namespace *ns);
139
137static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 140static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
138{ 141{
139 if (ns) 142 if (ns)
@@ -144,12 +147,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
144extern void put_ipc_ns(struct ipc_namespace *ns); 147extern void put_ipc_ns(struct ipc_namespace *ns);
145#else 148#else
146static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 149static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
147 struct task_struct *tsk) 150 struct user_namespace *user_ns, struct ipc_namespace *ns)
148{ 151{
149 if (flags & CLONE_NEWIPC) 152 if (flags & CLONE_NEWIPC)
150 return ERR_PTR(-EINVAL); 153 return ERR_PTR(-EINVAL);
151 154
152 return tsk->nsproxy->ipc_ns; 155 return ns;
153} 156}
154 157
155static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 158static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index fcb5d44ea63..8ea3fe0b975 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -216,7 +216,7 @@ int ipmi_unregister_smi(ipmi_smi_t intf);
216 216
217/* 217/*
218 * The lower layer reports received messages through this interface. 218 * The lower layer reports received messages through this interface.
219 * The data_size should be zero if this is an asyncronous message. If 219 * The data_size should be zero if this is an asynchronous message. If
220 * the lower layer gets an error sending a message, it should format 220 * the lower layer gets an error sending a message, it should format
221 * an error response in the message response. 221 * an error response in the message response.
222 */ 222 */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index bcba48a9786..faed1e357dd 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -47,6 +47,7 @@ struct ipv6_devconf {
47 __s32 disable_ipv6; 47 __s32 disable_ipv6;
48 __s32 accept_dad; 48 __s32 accept_dad;
49 __s32 force_tllao; 49 __s32 force_tllao;
50 __s32 ndisc_notify;
50 void *sysctl; 51 void *sysctl;
51}; 52};
52 53
@@ -66,6 +67,11 @@ static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
66 return (struct ipv6hdr *)skb_network_header(skb); 67 return (struct ipv6hdr *)skb_network_header(skb);
67} 68}
68 69
70static inline struct ipv6hdr *inner_ipv6_hdr(const struct sk_buff *skb)
71{
72 return (struct ipv6hdr *)skb_inner_network_header(skb);
73}
74
69static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) 75static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
70{ 76{
71 return (struct ipv6hdr *)skb_transport_header(skb); 77 return (struct ipv6hdr *)skb_transport_header(skb);
@@ -363,20 +369,22 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
363#define inet_v6_ipv6only(__sk) 0 369#define inet_v6_ipv6only(__sk) 0
364#endif /* IS_ENABLED(CONFIG_IPV6) */ 370#endif /* IS_ENABLED(CONFIG_IPV6) */
365 371
366#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 372#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
367 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 373 ((inet_sk(__sk)->inet_portpair == (__ports)) && \
368 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \ 374 ((__sk)->sk_family == AF_INET6) && \
369 ((__sk)->sk_family == AF_INET6) && \ 375 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
370 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 376 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
371 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 377 (!(__sk)->sk_bound_dev_if || \
372 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 378 ((__sk)->sk_bound_dev_if == (__dif))) && \
373 379 net_eq(sock_net(__sk), (__net)))
374#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ 380
375 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ 381#define INET6_TW_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
376 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 382 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
377 ((__sk)->sk_family == PF_INET6) && \ 383 ((__sk)->sk_family == AF_INET6) && \
378 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 384 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr)) && \
379 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \ 385 ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr)) && \
380 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 386 (!(__sk)->sk_bound_dev_if || \
387 ((__sk)->sk_bound_dev_if == (__dif))) && \
388 net_eq(sock_net(__sk), (__net)))
381 389
382#endif /* _IPV6_H */ 390#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 216b0ba109d..fdf2c4a238c 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -10,9 +10,6 @@
10 */ 10 */
11 11
12#include <linux/smp.h> 12#include <linux/smp.h>
13
14#ifndef CONFIG_S390
15
16#include <linux/linkage.h> 13#include <linux/linkage.h>
17#include <linux/cache.h> 14#include <linux/cache.h>
18#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -392,6 +389,15 @@ static inline void irq_move_masked_irq(struct irq_data *data) { }
392 389
393extern int no_irq_affinity; 390extern int no_irq_affinity;
394 391
392#ifdef CONFIG_HARDIRQS_SW_RESEND
393int irq_set_parent(int irq, int parent_irq);
394#else
395static inline int irq_set_parent(int irq, int parent_irq)
396{
397 return 0;
398}
399#endif
400
395/* 401/*
396 * Built-in IRQ handlers for various IRQ types, 402 * Built-in IRQ handlers for various IRQ types,
397 * callable via desc->handle_irq() 403 * callable via desc->handle_irq()
@@ -737,8 +743,11 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { }
737static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } 743static inline void irq_gc_unlock(struct irq_chip_generic *gc) { }
738#endif 744#endif
739 745
740#endif /* CONFIG_GENERIC_HARDIRQS */ 746#else /* !CONFIG_GENERIC_HARDIRQS */
741 747
742#endif /* !CONFIG_S390 */ 748extern struct msi_desc *irq_get_msi_desc(unsigned int irq);
749extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
750
751#endif /* CONFIG_GENERIC_HARDIRQS */
743 752
744#endif /* _LINUX_IRQ_H */ 753#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqchip/spear-shirq.h b/include/linux/irqchip/spear-shirq.h
new file mode 100644
index 00000000000..c8be16d213a
--- /dev/null
+++ b/include/linux/irqchip/spear-shirq.h
@@ -0,0 +1,64 @@
1/*
2 * SPEAr platform shared irq layer header file
3 *
4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __SPEAR_SHIRQ_H
13#define __SPEAR_SHIRQ_H
14
15#include <linux/irq.h>
16#include <linux/types.h>
17
18/*
19 * struct shirq_regs: shared irq register configuration
20 *
21 * enb_reg: enable register offset
22 * reset_to_enb: val 1 indicates, we need to clear bit for enabling interrupt
23 * status_reg: status register offset
24 * status_reg_mask: status register valid mask
25 * clear_reg: clear register offset
26 * reset_to_clear: val 1 indicates, we need to clear bit for clearing interrupt
27 */
28struct shirq_regs {
29 u32 enb_reg;
30 u32 reset_to_enb;
31 u32 status_reg;
32 u32 clear_reg;
33 u32 reset_to_clear;
34};
35
36/*
37 * struct spear_shirq: shared irq structure
38 *
39 * irq: hardware irq number
40 * irq_base: base irq in linux domain
41 * irq_nr: no. of shared interrupts in a particular block
42 * irq_bit_off: starting bit offset in the status register
43 * invalid_irq: irq group is currently disabled
44 * base: base address of shared irq register
45 * regs: register configuration for shared irq block
46 */
47struct spear_shirq {
48 u32 irq;
49 u32 irq_base;
50 u32 irq_nr;
51 u32 irq_bit_off;
52 int invalid_irq;
53 void __iomem *base;
54 struct shirq_regs regs;
55};
56
57int __init spear300_shirq_of_init(struct device_node *np,
58 struct device_node *parent);
59int __init spear310_shirq_of_init(struct device_node *np,
60 struct device_node *parent);
61int __init spear320_shirq_of_init(struct device_node *np,
62 struct device_node *parent);
63
64#endif /* __SPEAR_SHIRQ_H */
diff --git a/include/linux/irqchip/sunxi.h b/include/linux/irqchip/sunxi.h
new file mode 100644
index 00000000000..1fe2c2260e2
--- /dev/null
+++ b/include/linux/irqchip/sunxi.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_IRQCHIP_SUNXI_H
18#define __LINUX_IRQCHIP_SUNXI_H
19
20#include <asm/exception.h>
21
22extern void sunxi_init_irq(void);
23
24extern asmlinkage void __exception_irq_entry sunxi_handle_irq(
25 struct pt_regs *regs);
26
27#endif
diff --git a/include/linux/irqchip/versatile-fpga.h b/include/linux/irqchip/versatile-fpga.h
new file mode 100644
index 00000000000..1fac9651d3c
--- /dev/null
+++ b/include/linux/irqchip/versatile-fpga.h
@@ -0,0 +1,13 @@
1#ifndef PLAT_FPGA_IRQ_H
2#define PLAT_FPGA_IRQ_H
3
4struct device_node;
5struct pt_regs;
6
7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node);
10int fpga_irq_of_init(struct device_node *node,
11 struct device_node *parent);
12
13#endif
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 0ba014c5505..623325e2ff9 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -11,6 +11,8 @@
11struct irq_affinity_notify; 11struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct module; 13struct module;
14struct irq_desc;
15
14/** 16/**
15 * struct irq_desc - interrupt descriptor 17 * struct irq_desc - interrupt descriptor
16 * @irq_data: per irq and chip data passed down to chip functions 18 * @irq_data: per irq and chip data passed down to chip functions
@@ -65,6 +67,7 @@ struct irq_desc {
65#ifdef CONFIG_PROC_FS 67#ifdef CONFIG_PROC_FS
66 struct proc_dir_entry *dir; 68 struct proc_dir_entry *dir;
67#endif 69#endif
70 int parent_irq;
68 struct module *owner; 71 struct module *owner;
69 const char *name; 72 const char *name;
70} ____cacheline_internodealigned_in_smp; 73} ____cacheline_internodealigned_in_smp;
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 3efc43f3f16..1be23d9fdac 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1096,7 +1096,6 @@ extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1096void jbd2_journal_set_triggers(struct buffer_head *, 1096void jbd2_journal_set_triggers(struct buffer_head *,
1097 struct jbd2_buffer_trigger_type *type); 1097 struct jbd2_buffer_trigger_type *type);
1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1099extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1100extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1101extern void journal_sync_buffer (struct buffer_head *); 1100extern void journal_sync_buffer (struct buffer_head *);
1102extern void jbd2_journal_invalidatepage(journal_t *, 1101extern void jbd2_journal_invalidatepage(journal_t *,
@@ -1303,15 +1302,21 @@ static inline int jbd_space_needed(journal_t *journal)
1303 1302
1304extern int jbd_blocks_per_page(struct inode *inode); 1303extern int jbd_blocks_per_page(struct inode *inode);
1305 1304
1305/* JBD uses a CRC32 checksum */
1306#define JBD_MAX_CHECKSUM_SIZE 4
1307
1306static inline u32 jbd2_chksum(journal_t *journal, u32 crc, 1308static inline u32 jbd2_chksum(journal_t *journal, u32 crc,
1307 const void *address, unsigned int length) 1309 const void *address, unsigned int length)
1308{ 1310{
1309 struct { 1311 struct {
1310 struct shash_desc shash; 1312 struct shash_desc shash;
1311 char ctx[crypto_shash_descsize(journal->j_chksum_driver)]; 1313 char ctx[JBD_MAX_CHECKSUM_SIZE];
1312 } desc; 1314 } desc;
1313 int err; 1315 int err;
1314 1316
1317 BUG_ON(crypto_shash_descsize(journal->j_chksum_driver) >
1318 JBD_MAX_CHECKSUM_SIZE);
1319
1315 desc.shash.tfm = journal->j_chksum_driver; 1320 desc.shash.tfm = journal->j_chksum_driver;
1316 desc.shash.flags = 0; 1321 desc.shash.flags = 0;
1317 *(u32 *)desc.ctx = crc; 1322 *(u32 *)desc.ctx = crc;
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6b87413da9d..82ed068b1eb 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -70,11 +70,12 @@ extern int register_refined_jiffies(long clock_tick_rate);
70 70
71/* 71/*
72 * The 64-bit value is not atomic - you MUST NOT read it 72 * The 64-bit value is not atomic - you MUST NOT read it
73 * without sampling the sequence number in xtime_lock. 73 * without sampling the sequence number in jiffies_lock.
74 * get_jiffies_64() will do this for you as appropriate. 74 * get_jiffies_64() will do this for you as appropriate.
75 */ 75 */
76extern u64 __jiffy_data jiffies_64; 76extern u64 __jiffy_data jiffies_64;
77extern unsigned long volatile __jiffy_data jiffies; 77extern unsigned long volatile __jiffy_data jiffies;
78extern seqlock_t jiffies_lock;
78 79
79#if (BITS_PER_LONG < 64) 80#if (BITS_PER_LONG < 64)
80u64 get_jiffies_64(void); 81u64 get_jiffies_64(void);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7d8dfc7392f..c566927efcb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -77,13 +77,15 @@
77 77
78/* 78/*
79 * Divide positive or negative dividend by positive divisor and round 79 * Divide positive or negative dividend by positive divisor and round
80 * to closest integer. Result is undefined for negative divisors. 80 * to closest integer. Result is undefined for negative divisors and
81 * for negative dividends if the divisor variable type is unsigned.
81 */ 82 */
82#define DIV_ROUND_CLOSEST(x, divisor)( \ 83#define DIV_ROUND_CLOSEST(x, divisor)( \
83{ \ 84{ \
84 typeof(x) __x = x; \ 85 typeof(x) __x = x; \
85 typeof(divisor) __d = divisor; \ 86 typeof(divisor) __d = divisor; \
86 (((typeof(x))-1) > 0 || (__x) > 0) ? \ 87 (((typeof(x))-1) > 0 || \
88 ((typeof(divisor))-1) > 0 || (__x) > 0) ? \
87 (((__x) + ((__d) / 2)) / (__d)) : \ 89 (((__x) + ((__d) / 2)) / (__d)) : \
88 (((__x) - ((__d) / 2)) / (__d)); \ 90 (((__x) - ((__d) / 2)) / (__d)); \
89} \ 91} \
@@ -220,6 +222,23 @@ int __must_check _kstrtol(const char *s, unsigned int base, long *res);
220 222
221int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); 223int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
222int __must_check kstrtoll(const char *s, unsigned int base, long long *res); 224int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
225
226/**
227 * kstrtoul - convert a string to an unsigned long
228 * @s: The start of the string. The string must be null-terminated, and may also
229 * include a single newline before its terminating null. The first character
230 * may also be a plus sign, but not a minus sign.
231 * @base: The number base to use. The maximum supported base is 16. If base is
232 * given as 0, then the base of the string is automatically detected with the
233 * conventional semantics - If it begins with 0x the number will be parsed as a
234 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
235 * parsed as an octal number. Otherwise it will be parsed as a decimal.
236 * @res: Where to write the result of the conversion on success.
237 *
238 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
239 * Used as a replacement for the obsolete simple_strtoull. Return code must
240 * be checked.
241*/
223static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) 242static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
224{ 243{
225 /* 244 /*
@@ -233,6 +252,22 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign
233 return _kstrtoul(s, base, res); 252 return _kstrtoul(s, base, res);
234} 253}
235 254
255/**
256 * kstrtol - convert a string to a long
257 * @s: The start of the string. The string must be null-terminated, and may also
258 * include a single newline before its terminating null. The first character
259 * may also be a plus sign or a minus sign.
260 * @base: The number base to use. The maximum supported base is 16. If base is
261 * given as 0, then the base of the string is automatically detected with the
262 * conventional semantics - If it begins with 0x the number will be parsed as a
263 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
264 * parsed as an octal number. Otherwise it will be parsed as a decimal.
265 * @res: Where to write the result of the conversion on success.
266 *
267 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
268 * Used as a replacement for the obsolete simple_strtoull. Return code must
269 * be checked.
270 */
236static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) 271static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
237{ 272{
238 /* 273 /*
@@ -527,9 +562,6 @@ __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
527 562
528extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); 563extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
529#else 564#else
530static inline __printf(1, 2)
531int trace_printk(const char *fmt, ...);
532
533static inline void tracing_start(void) { } 565static inline void tracing_start(void) { }
534static inline void tracing_stop(void) { } 566static inline void tracing_stop(void) { }
535static inline void ftrace_off_permanent(void) { } 567static inline void ftrace_off_permanent(void) { }
@@ -539,8 +571,8 @@ static inline void tracing_on(void) { }
539static inline void tracing_off(void) { } 571static inline void tracing_off(void) { }
540static inline int tracing_is_on(void) { return 0; } 572static inline int tracing_is_on(void) { return 0; }
541 573
542static inline int 574static inline __printf(1, 2)
543trace_printk(const char *fmt, ...) 575int trace_printk(const char *fmt, ...)
544{ 576{
545 return 0; 577 return 0;
546} 578}
@@ -687,20 +719,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
687/* Trap pasters of __FUNCTION__ at compile-time */ 719/* Trap pasters of __FUNCTION__ at compile-time */
688#define __FUNCTION__ (__func__) 720#define __FUNCTION__ (__func__)
689 721
690/* This helps us to avoid #ifdef CONFIG_NUMA */
691#ifdef CONFIG_NUMA
692#define NUMA_BUILD 1
693#else
694#define NUMA_BUILD 0
695#endif
696
697/* This helps us avoid #ifdef CONFIG_COMPACTION */
698#ifdef CONFIG_COMPACTION
699#define COMPACTION_BUILD 1
700#else
701#define COMPACTION_BUILD 0
702#endif
703
704/* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */ 722/* This helps us to avoid #ifdef CONFIG_SYMBOL_PREFIX */
705#ifdef CONFIG_SYMBOL_PREFIX 723#ifdef CONFIG_SYMBOL_PREFIX
706#define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX 724#define SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 36d12f0884c..66b70780e91 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -7,6 +7,7 @@
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/vtime.h>
10#include <asm/irq.h> 11#include <asm/irq.h>
11#include <asm/cputime.h> 12#include <asm/cputime.h>
12 13
@@ -126,16 +127,16 @@ extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t)
126extern void account_steal_time(cputime_t); 127extern void account_steal_time(cputime_t);
127extern void account_idle_time(cputime_t); 128extern void account_idle_time(cputime_t);
128 129
129extern void account_process_tick(struct task_struct *, int user);
130extern void account_steal_ticks(unsigned long ticks);
131extern void account_idle_ticks(unsigned long ticks);
132
133#ifdef CONFIG_VIRT_CPU_ACCOUNTING 130#ifdef CONFIG_VIRT_CPU_ACCOUNTING
134extern void vtime_task_switch(struct task_struct *prev); 131static inline void account_process_tick(struct task_struct *tsk, int user)
135extern void vtime_account_system(struct task_struct *tsk); 132{
136extern void vtime_account_idle(struct task_struct *tsk); 133 vtime_account_user(tsk);
134}
137#else 135#else
138static inline void vtime_task_switch(struct task_struct *prev) { } 136extern void account_process_tick(struct task_struct *, int user);
139#endif 137#endif
140 138
139extern void account_steal_ticks(unsigned long ticks);
140extern void account_idle_ticks(unsigned long ticks);
141
141#endif /* _LINUX_KERNEL_STAT_H */ 142#endif /* _LINUX_KERNEL_STAT_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 2393b1c040b..4dfde1161c5 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -265,6 +265,7 @@ extern int key_unlink(struct key *keyring,
265 265
266extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid, 266extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
267 const struct cred *cred, 267 const struct cred *cred,
268 key_perm_t perm,
268 unsigned long flags, 269 unsigned long flags,
269 struct key *dest); 270 struct key *dest);
270 271
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 1e57449395b..939b11268c8 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -203,7 +203,6 @@ extern struct kobject *power_kobj;
203/* The global /sys/firmware/ kobject for people to chain off of */ 203/* The global /sys/firmware/ kobject for people to chain off of */
204extern struct kobject *firmware_kobj; 204extern struct kobject *firmware_kobj;
205 205
206#if defined(CONFIG_HOTPLUG)
207int kobject_uevent(struct kobject *kobj, enum kobject_action action); 206int kobject_uevent(struct kobject *kobj, enum kobject_action action);
208int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 207int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
209 char *envp[]); 208 char *envp[]);
@@ -213,22 +212,5 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...);
213 212
214int kobject_action_type(const char *buf, size_t count, 213int kobject_action_type(const char *buf, size_t count,
215 enum kobject_action *type); 214 enum kobject_action *type);
216#else
217static inline int kobject_uevent(struct kobject *kobj,
218 enum kobject_action action)
219{ return 0; }
220static inline int kobject_uevent_env(struct kobject *kobj,
221 enum kobject_action action,
222 char *envp[])
223{ return 0; }
224
225static inline __printf(2, 3)
226int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
227{ return -ENOMEM; }
228
229static inline int kobject_action_type(const char *buf, size_t count,
230 enum kobject_action *type)
231{ return -EINVAL; }
232#endif
233 215
234#endif /* _KOBJECT_H_ */ 216#endif /* _KOBJECT_H_ */
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 65af6887872..4972e6e9ca9 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -111,4 +111,25 @@ static inline int kref_put_mutex(struct kref *kref,
111 } 111 }
112 return 0; 112 return 0;
113} 113}
114
115/**
116 * kref_get_unless_zero - Increment refcount for object unless it is zero.
117 * @kref: object.
118 *
119 * Return non-zero if the increment succeeded. Otherwise return 0.
120 *
121 * This function is intended to simplify locking around refcounting for
122 * objects that can be looked up from a lookup structure, and which are
123 * removed from that lookup structure in the object destructor.
124 * Operations on such objects require at least a read lock around
125 * lookup + kref_get, and a write lock around kref_put + remove from lookup
126 * structure. Furthermore, RCU implementations become extremely tricky.
127 * With a lookup followed by a kref_get_unless_zero *with return value check*
128 * locking in the kref_put path can be deferred to the actual removal from
129 * the lookup structure and RCU lookups become trivial.
130 */
131static inline int __must_check kref_get_unless_zero(struct kref *kref)
132{
133 return atomic_add_unless(&kref->refcount, 1, 0);
134}
114#endif /* _KREF_H_ */ 135#endif /* _KREF_H_ */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 06177ba10a1..e83512f63df 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -282,6 +282,25 @@ static inline int ktime_equal(const ktime_t cmp1, const ktime_t cmp2)
282 return cmp1.tv64 == cmp2.tv64; 282 return cmp1.tv64 == cmp2.tv64;
283} 283}
284 284
285/**
286 * ktime_compare - Compares two ktime_t variables for less, greater or equal
287 * @cmp1: comparable1
288 * @cmp2: comparable2
289 *
290 * Returns ...
291 * cmp1 < cmp2: return <0
292 * cmp1 == cmp2: return 0
293 * cmp1 > cmp2: return >0
294 */
295static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
296{
297 if (cmp1.tv64 < cmp2.tv64)
298 return -1;
299 if (cmp1.tv64 > cmp2.tv64)
300 return 1;
301 return 0;
302}
303
285static inline s64 ktime_to_us(const ktime_t kt) 304static inline s64 ktime_to_us(const ktime_t kt)
286{ 305{
287 struct timeval tv = ktime_to_timeval(kt); 306 struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ecc554374e4..2c497ab0d03 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -47,28 +47,40 @@
47 47
48/* 48/*
49 * For the normal pfn, the highest 12 bits should be zero, 49 * For the normal pfn, the highest 12 bits should be zero,
50 * so we can mask these bits to indicate the error. 50 * so we can mask bit 62 ~ bit 52 to indicate the error pfn,
51 * mask bit 63 to indicate the noslot pfn.
51 */ 52 */
52#define KVM_PFN_ERR_MASK (0xfffULL << 52) 53#define KVM_PFN_ERR_MASK (0x7ffULL << 52)
54#define KVM_PFN_ERR_NOSLOT_MASK (0xfffULL << 52)
55#define KVM_PFN_NOSLOT (0x1ULL << 63)
53 56
54#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK) 57#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK)
55#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1) 58#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1)
56#define KVM_PFN_ERR_BAD (KVM_PFN_ERR_MASK + 2) 59#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 2)
57#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 3)
58 60
61/*
62 * error pfns indicate that the gfn is in slot but faild to
63 * translate it to pfn on host.
64 */
59static inline bool is_error_pfn(pfn_t pfn) 65static inline bool is_error_pfn(pfn_t pfn)
60{ 66{
61 return !!(pfn & KVM_PFN_ERR_MASK); 67 return !!(pfn & KVM_PFN_ERR_MASK);
62} 68}
63 69
64static inline bool is_noslot_pfn(pfn_t pfn) 70/*
71 * error_noslot pfns indicate that the gfn can not be
72 * translated to pfn - it is not in slot or failed to
73 * translate it to pfn.
74 */
75static inline bool is_error_noslot_pfn(pfn_t pfn)
65{ 76{
66 return pfn == KVM_PFN_ERR_BAD; 77 return !!(pfn & KVM_PFN_ERR_NOSLOT_MASK);
67} 78}
68 79
69static inline bool is_invalid_pfn(pfn_t pfn) 80/* noslot pfn indicates that the gfn is not in slot. */
81static inline bool is_noslot_pfn(pfn_t pfn)
70{ 82{
71 return !is_noslot_pfn(pfn) && is_error_pfn(pfn); 83 return pfn == KVM_PFN_NOSLOT;
72} 84}
73 85
74#define KVM_HVA_ERR_BAD (PAGE_OFFSET) 86#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
@@ -107,6 +119,9 @@ static inline bool is_error_page(struct page *page)
107#define KVM_REQ_IMMEDIATE_EXIT 15 119#define KVM_REQ_IMMEDIATE_EXIT 15
108#define KVM_REQ_PMU 16 120#define KVM_REQ_PMU 16
109#define KVM_REQ_PMI 17 121#define KVM_REQ_PMI 17
122#define KVM_REQ_WATCHDOG 18
123#define KVM_REQ_MASTERCLOCK_UPDATE 19
124#define KVM_REQ_MCLOCK_INPROGRESS 20
110 125
111#define KVM_USERSPACE_IRQ_SOURCE_ID 0 126#define KVM_USERSPACE_IRQ_SOURCE_ID 0
112#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 127#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -516,6 +531,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
516 531
517void kvm_flush_remote_tlbs(struct kvm *kvm); 532void kvm_flush_remote_tlbs(struct kvm *kvm);
518void kvm_reload_remote_mmus(struct kvm *kvm); 533void kvm_reload_remote_mmus(struct kvm *kvm);
534void kvm_make_mclock_inprogress_request(struct kvm *kvm);
519 535
520long kvm_arch_dev_ioctl(struct file *filp, 536long kvm_arch_dev_ioctl(struct file *filp,
521 unsigned int ioctl, unsigned long arg); 537 unsigned int ioctl, unsigned long arg);
@@ -569,9 +585,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
569void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); 585void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
570struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id); 586struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
571int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu); 587int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
588int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu);
572void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu); 589void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
573 590
574int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
575int kvm_arch_hardware_enable(void *garbage); 591int kvm_arch_hardware_enable(void *garbage);
576void kvm_arch_hardware_disable(void *garbage); 592void kvm_arch_hardware_disable(void *garbage);
577int kvm_arch_hardware_setup(void); 593int kvm_arch_hardware_setup(void);
@@ -666,6 +682,7 @@ void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
666 unsigned long *deliver_bitmask); 682 unsigned long *deliver_bitmask);
667#endif 683#endif
668int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level); 684int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level);
685int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
669int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, 686int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
670 int irq_source_id, int level); 687 int irq_source_id, int level);
671void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 688void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
@@ -726,7 +743,11 @@ static inline int kvm_deassign_device(struct kvm *kvm,
726static inline void kvm_guest_enter(void) 743static inline void kvm_guest_enter(void)
727{ 744{
728 BUG_ON(preemptible()); 745 BUG_ON(preemptible());
729 vtime_account(current); 746 /*
747 * This is running in ioctl context so we can avoid
748 * the call to vtime_account() with its unnecessary idle check.
749 */
750 vtime_account_system_irqsafe(current);
730 current->flags |= PF_VCPU; 751 current->flags |= PF_VCPU;
731 /* KVM does not hold any references to rcu protected data when it 752 /* KVM does not hold any references to rcu protected data when it
732 * switches CPU into a guest mode. In fact switching to a guest mode 753 * switches CPU into a guest mode. In fact switching to a guest mode
@@ -740,7 +761,11 @@ static inline void kvm_guest_enter(void)
740 761
741static inline void kvm_guest_exit(void) 762static inline void kvm_guest_exit(void)
742{ 763{
743 vtime_account(current); 764 /*
765 * This is running in ioctl context so we can avoid
766 * the call to vtime_account() with its unnecessary idle check.
767 */
768 vtime_account_system_irqsafe(current);
744 current->flags &= ~PF_VCPU; 769 current->flags &= ~PF_VCPU;
745} 770}
746 771
@@ -830,9 +855,9 @@ extern struct kvm_stats_debugfs_item debugfs_entries[];
830extern struct dentry *kvm_debugfs_dir; 855extern struct dentry *kvm_debugfs_dir;
831 856
832#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER) 857#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
833static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) 858static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
834{ 859{
835 if (unlikely(vcpu->kvm->mmu_notifier_count)) 860 if (unlikely(kvm->mmu_notifier_count))
836 return 1; 861 return 1;
837 /* 862 /*
838 * Ensure the read of mmu_notifier_count happens before the read 863 * Ensure the read of mmu_notifier_count happens before the read
@@ -845,7 +870,7 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
845 * can't rely on kvm->mmu_lock to keep things ordered. 870 * can't rely on kvm->mmu_lock to keep things ordered.
846 */ 871 */
847 smp_rmb(); 872 smp_rmb();
848 if (vcpu->kvm->mmu_notifier_seq != mmu_seq) 873 if (kvm->mmu_notifier_seq != mmu_seq)
849 return 1; 874 return 1;
850 return 0; 875 return 0;
851} 876}
@@ -873,10 +898,20 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
873#ifdef CONFIG_HAVE_KVM_EVENTFD 898#ifdef CONFIG_HAVE_KVM_EVENTFD
874 899
875void kvm_eventfd_init(struct kvm *kvm); 900void kvm_eventfd_init(struct kvm *kvm);
901int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args);
902
903#ifdef CONFIG_HAVE_KVM_IRQCHIP
876int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args); 904int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args);
877void kvm_irqfd_release(struct kvm *kvm); 905void kvm_irqfd_release(struct kvm *kvm);
878void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *); 906void kvm_irq_routing_update(struct kvm *, struct kvm_irq_routing_table *);
879int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args); 907#else
908static inline int kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
909{
910 return -EINVAL;
911}
912
913static inline void kvm_irqfd_release(struct kvm *kvm) {}
914#endif
880 915
881#else 916#else
882 917
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 6e53bb31c22..0d9b5eed714 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -179,6 +179,23 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger,
179 unsigned long *delay_on, 179 unsigned long *delay_on,
180 unsigned long *delay_off, 180 unsigned long *delay_off,
181 int invert); 181 int invert);
182/**
183 * led_trigger_rename_static - rename a trigger
184 * @name: the new trigger name
185 * @trig: the LED trigger to rename
186 *
187 * Change a LED trigger name by copying the string passed in
188 * name into current trigger name, which MUST be large
189 * enough for the new string.
190 *
191 * Note that name must NOT point to the same string used
192 * during LED registration, as that could lead to races.
193 *
194 * This is meant to be used on triggers with statically
195 * allocated name.
196 */
197extern void led_trigger_rename_static(const char *name,
198 struct led_trigger *trig);
182 199
183#else 200#else
184 201
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 77eeeda2b6e..83ba0ab2c91 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -163,6 +163,7 @@ enum {
163 163
164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ 164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */ 165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
166 ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
166 167
167 ATA_DEV_UNKNOWN = 0, /* unknown device */ 168 ATA_DEV_UNKNOWN = 0, /* unknown device */
168 ATA_DEV_ATA = 1, /* ATA device */ 169 ATA_DEV_ATA = 1, /* ATA device */
@@ -1114,6 +1115,10 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
1114#endif /* CONFIG_PM */ 1115#endif /* CONFIG_PM */
1115#endif /* CONFIG_PCI */ 1116#endif /* CONFIG_PCI */
1116 1117
1118struct platform_device;
1119
1120extern int ata_platform_remove_one(struct platform_device *pdev);
1121
1117/* 1122/*
1118 * ACPI - drivers/ata/libata-acpi.c 1123 * ACPI - drivers/ata/libata-acpi.c
1119 */ 1124 */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 6492181bcb1..460b60fa7ad 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -53,10 +53,13 @@ struct loop_device {
53 53
54 spinlock_t lo_lock; 54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list; 55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
56 int lo_state; 57 int lo_state;
57 struct mutex lo_ctl_mutex; 58 struct mutex lo_ctl_mutex;
58 struct task_struct *lo_thread; 59 struct task_struct *lo_thread;
59 wait_queue_head_t lo_event; 60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
60 63
61 struct request_queue *lo_queue; 64 struct request_queue *lo_queue;
62 struct gendisk *lo_disk; 65 struct gendisk *lo_disk;
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index 7a71ffad037..4019013c659 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -52,8 +52,8 @@ We replicate IO (more or less synchronously) to local and remote disk.
52 52
53For crash recovery after replication node failure, 53For crash recovery after replication node failure,
54 we need to resync all regions that have been target of in-flight WRITE IO 54 we need to resync all regions that have been target of in-flight WRITE IO
55 (in use, or "hot", regions), as we don't know wether or not those WRITEs have 55 (in use, or "hot", regions), as we don't know whether or not those WRITEs
56 made it to stable storage. 56 have made it to stable storage.
57 57
58 To avoid a "full resync", we need to persistently track these regions. 58 To avoid a "full resync", we need to persistently track these regions.
59 59
@@ -166,9 +166,11 @@ struct lc_element {
166 /* if we want to track a larger set of objects, 166 /* if we want to track a larger set of objects,
167 * it needs to become arch independend u64 */ 167 * it needs to become arch independend u64 */
168 unsigned lc_number; 168 unsigned lc_number;
169
170 /* special label when on free list */ 169 /* special label when on free list */
171#define LC_FREE (~0U) 170#define LC_FREE (~0U)
171
172 /* for pending changes */
173 unsigned lc_new_number;
172}; 174};
173 175
174struct lru_cache { 176struct lru_cache {
@@ -176,6 +178,7 @@ struct lru_cache {
176 struct list_head lru; 178 struct list_head lru;
177 struct list_head free; 179 struct list_head free;
178 struct list_head in_use; 180 struct list_head in_use;
181 struct list_head to_be_changed;
179 182
180 /* the pre-created kmem cache to allocate the objects from */ 183 /* the pre-created kmem cache to allocate the objects from */
181 struct kmem_cache *lc_cache; 184 struct kmem_cache *lc_cache;
@@ -186,7 +189,7 @@ struct lru_cache {
186 size_t element_off; 189 size_t element_off;
187 190
188 /* number of elements (indices) */ 191 /* number of elements (indices) */
189 unsigned int nr_elements; 192 unsigned int nr_elements;
190 /* Arbitrary limit on maximum tracked objects. Practical limit is much 193 /* Arbitrary limit on maximum tracked objects. Practical limit is much
191 * lower due to allocation failures, probably. For typical use cases, 194 * lower due to allocation failures, probably. For typical use cases,
192 * nr_elements should be a few thousand at most. 195 * nr_elements should be a few thousand at most.
@@ -194,18 +197,19 @@ struct lru_cache {
194 * 8 high bits of .lc_index to be overloaded with flags in the future. */ 197 * 8 high bits of .lc_index to be overloaded with flags in the future. */
195#define LC_MAX_ACTIVE (1<<24) 198#define LC_MAX_ACTIVE (1<<24)
196 199
200 /* allow to accumulate a few (index:label) changes,
201 * but no more than max_pending_changes */
202 unsigned int max_pending_changes;
203 /* number of elements currently on to_be_changed list */
204 unsigned int pending_changes;
205
197 /* statistics */ 206 /* statistics */
198 unsigned used; /* number of lelements currently on in_use list */ 207 unsigned used; /* number of elements currently on in_use list */
199 unsigned long hits, misses, starving, dirty, changed; 208 unsigned long hits, misses, starving, locked, changed;
200 209
201 /* see below: flag-bits for lru_cache */ 210 /* see below: flag-bits for lru_cache */
202 unsigned long flags; 211 unsigned long flags;
203 212
204 /* when changing the label of an index element */
205 unsigned int new_number;
206
207 /* for paranoia when changing the label of an index element */
208 struct lc_element *changing_element;
209 213
210 void *lc_private; 214 void *lc_private;
211 const char *name; 215 const char *name;
@@ -221,10 +225,15 @@ enum {
221 /* debugging aid, to catch concurrent access early. 225 /* debugging aid, to catch concurrent access early.
222 * user needs to guarantee exclusive access by proper locking! */ 226 * user needs to guarantee exclusive access by proper locking! */
223 __LC_PARANOIA, 227 __LC_PARANOIA,
224 /* if we need to change the set, but currently there is a changing 228
225 * transaction pending, we are "dirty", and must deferr further 229 /* annotate that the set is "dirty", possibly accumulating further
226 * changing requests */ 230 * changes, until a transaction is finally triggered */
227 __LC_DIRTY, 231 __LC_DIRTY,
232
233 /* Locked, no further changes allowed.
234 * Also used to serialize changing transactions. */
235 __LC_LOCKED,
236
228 /* if we need to change the set, but currently there is no free nor 237 /* if we need to change the set, but currently there is no free nor
229 * unused element available, we are "starving", and must not give out 238 * unused element available, we are "starving", and must not give out
230 * further references, to guarantee that eventually some refcnt will 239 * further references, to guarantee that eventually some refcnt will
@@ -236,9 +245,11 @@ enum {
236}; 245};
237#define LC_PARANOIA (1<<__LC_PARANOIA) 246#define LC_PARANOIA (1<<__LC_PARANOIA)
238#define LC_DIRTY (1<<__LC_DIRTY) 247#define LC_DIRTY (1<<__LC_DIRTY)
248#define LC_LOCKED (1<<__LC_LOCKED)
239#define LC_STARVING (1<<__LC_STARVING) 249#define LC_STARVING (1<<__LC_STARVING)
240 250
241extern struct lru_cache *lc_create(const char *name, struct kmem_cache *cache, 251extern struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
252 unsigned max_pending_changes,
242 unsigned e_count, size_t e_size, size_t e_off); 253 unsigned e_count, size_t e_size, size_t e_off);
243extern void lc_reset(struct lru_cache *lc); 254extern void lc_reset(struct lru_cache *lc);
244extern void lc_destroy(struct lru_cache *lc); 255extern void lc_destroy(struct lru_cache *lc);
@@ -249,7 +260,7 @@ extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
249extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr); 260extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
250extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr); 261extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr);
251extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e); 262extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e);
252extern void lc_changed(struct lru_cache *lc, struct lc_element *e); 263extern void lc_committed(struct lru_cache *lc);
253 264
254struct seq_file; 265struct seq_file;
255extern size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc); 266extern size_t lc_seq_printf_stats(struct seq_file *seq, struct lru_cache *lc);
@@ -258,32 +269,40 @@ extern void lc_seq_dump_details(struct seq_file *seq, struct lru_cache *lc, char
258 void (*detail) (struct seq_file *, struct lc_element *)); 269 void (*detail) (struct seq_file *, struct lc_element *));
259 270
260/** 271/**
261 * lc_try_lock - can be used to stop lc_get() from changing the tracked set 272 * lc_try_lock_for_transaction - can be used to stop lc_get() from changing the tracked set
262 * @lc: the lru cache to operate on 273 * @lc: the lru cache to operate on
263 * 274 *
264 * Note that the reference counts and order on the active and lru lists may 275 * Allows (expects) the set to be "dirty". Note that the reference counts and
265 * still change. Returns true if we acquired the lock. 276 * order on the active and lru lists may still change. Used to serialize
277 * changing transactions. Returns true if we aquired the lock.
266 */ 278 */
267static inline int lc_try_lock(struct lru_cache *lc) 279static inline int lc_try_lock_for_transaction(struct lru_cache *lc)
268{ 280{
269 return !test_and_set_bit(__LC_DIRTY, &lc->flags); 281 return !test_and_set_bit(__LC_LOCKED, &lc->flags);
270} 282}
271 283
272/** 284/**
285 * lc_try_lock - variant to stop lc_get() from changing the tracked set
286 * @lc: the lru cache to operate on
287 *
288 * Note that the reference counts and order on the active and lru lists may
289 * still change. Only works on a "clean" set. Returns true if we aquired the
290 * lock, which means there are no pending changes, and any further attempt to
291 * change the set will not succeed until the next lc_unlock().
292 */
293extern int lc_try_lock(struct lru_cache *lc);
294
295/**
273 * lc_unlock - unlock @lc, allow lc_get() to change the set again 296 * lc_unlock - unlock @lc, allow lc_get() to change the set again
274 * @lc: the lru cache to operate on 297 * @lc: the lru cache to operate on
275 */ 298 */
276static inline void lc_unlock(struct lru_cache *lc) 299static inline void lc_unlock(struct lru_cache *lc)
277{ 300{
278 clear_bit(__LC_DIRTY, &lc->flags); 301 clear_bit(__LC_DIRTY, &lc->flags);
279 smp_mb__after_clear_bit(); 302 clear_bit_unlock(__LC_LOCKED, &lc->flags);
280} 303}
281 304
282static inline int lc_is_used(struct lru_cache *lc, unsigned int enr) 305extern bool lc_is_used(struct lru_cache *lc, unsigned int enr);
283{
284 struct lc_element *e = lc_find(lc, enr);
285 return e && e->refcnt;
286}
287 306
288#define lc_entry(ptr, type, member) \ 307#define lc_entry(ptr, type, member) \
289 container_of(ptr, type, member) 308 container_of(ptr, type, member)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 11ddc7ffeba..0108a56f814 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -21,11 +21,14 @@
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22#include <linux/cgroup.h> 22#include <linux/cgroup.h>
23#include <linux/vm_event_item.h> 23#include <linux/vm_event_item.h>
24#include <linux/hardirq.h>
25#include <linux/jump_label.h>
24 26
25struct mem_cgroup; 27struct mem_cgroup;
26struct page_cgroup; 28struct page_cgroup;
27struct page; 29struct page;
28struct mm_struct; 30struct mm_struct;
31struct kmem_cache;
29 32
30/* Stats that can be updated by kernel. */ 33/* Stats that can be updated by kernel. */
31enum mem_cgroup_page_stat_item { 34enum mem_cgroup_page_stat_item {
@@ -181,7 +184,14 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
181 gfp_t gfp_mask, 184 gfp_t gfp_mask,
182 unsigned long *total_scanned); 185 unsigned long *total_scanned);
183 186
184void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 187void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
188static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
189 enum vm_event_item idx)
190{
191 if (mem_cgroup_disabled())
192 return;
193 __mem_cgroup_count_vm_event(mm, idx);
194}
185#ifdef CONFIG_TRANSPARENT_HUGEPAGE 195#ifdef CONFIG_TRANSPARENT_HUGEPAGE
186void mem_cgroup_split_huge_fixup(struct page *head); 196void mem_cgroup_split_huge_fixup(struct page *head);
187#endif 197#endif
@@ -407,5 +417,211 @@ static inline void sock_release_memcg(struct sock *sk)
407{ 417{
408} 418}
409#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */ 419#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */
420
421#ifdef CONFIG_MEMCG_KMEM
422extern struct static_key memcg_kmem_enabled_key;
423
424extern int memcg_limited_groups_array_size;
425
426/*
427 * Helper macro to loop through all memcg-specific caches. Callers must still
428 * check if the cache is valid (it is either valid or NULL).
429 * the slab_mutex must be held when looping through those caches
430 */
431#define for_each_memcg_cache_index(_idx) \
432 for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)
433
434static inline bool memcg_kmem_enabled(void)
435{
436 return static_key_false(&memcg_kmem_enabled_key);
437}
438
439/*
440 * In general, we'll do everything in our power to not incur in any overhead
441 * for non-memcg users for the kmem functions. Not even a function call, if we
442 * can avoid it.
443 *
444 * Therefore, we'll inline all those functions so that in the best case, we'll
445 * see that kmemcg is off for everybody and proceed quickly. If it is on,
446 * we'll still do most of the flag checking inline. We check a lot of
447 * conditions, but because they are pretty simple, they are expected to be
448 * fast.
449 */
450bool __memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg,
451 int order);
452void __memcg_kmem_commit_charge(struct page *page,
453 struct mem_cgroup *memcg, int order);
454void __memcg_kmem_uncharge_pages(struct page *page, int order);
455
456int memcg_cache_id(struct mem_cgroup *memcg);
457int memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
458 struct kmem_cache *root_cache);
459void memcg_release_cache(struct kmem_cache *cachep);
460void memcg_cache_list_add(struct mem_cgroup *memcg, struct kmem_cache *cachep);
461
462int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
463void memcg_update_array_size(int num_groups);
464
465struct kmem_cache *
466__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
467
468void mem_cgroup_destroy_cache(struct kmem_cache *cachep);
469void kmem_cache_destroy_memcg_children(struct kmem_cache *s);
470
471/**
472 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
473 * @gfp: the gfp allocation flags.
474 * @memcg: a pointer to the memcg this was charged against.
475 * @order: allocation order.
476 *
477 * returns true if the memcg where the current task belongs can hold this
478 * allocation.
479 *
480 * We return true automatically if this allocation is not to be accounted to
481 * any memcg.
482 */
483static inline bool
484memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
485{
486 if (!memcg_kmem_enabled())
487 return true;
488
489 /*
490 * __GFP_NOFAIL allocations will move on even if charging is not
491 * possible. Therefore we don't even try, and have this allocation
492 * unaccounted. We could in theory charge it with
493 * res_counter_charge_nofail, but we hope those allocations are rare,
494 * and won't be worth the trouble.
495 */
496 if (!(gfp & __GFP_KMEMCG) || (gfp & __GFP_NOFAIL))
497 return true;
498 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
499 return true;
500
501 /* If the test is dying, just let it go. */
502 if (unlikely(fatal_signal_pending(current)))
503 return true;
504
505 return __memcg_kmem_newpage_charge(gfp, memcg, order);
506}
507
508/**
509 * memcg_kmem_uncharge_pages: uncharge pages from memcg
510 * @page: pointer to struct page being freed
511 * @order: allocation order.
512 *
513 * there is no need to specify memcg here, since it is embedded in page_cgroup
514 */
515static inline void
516memcg_kmem_uncharge_pages(struct page *page, int order)
517{
518 if (memcg_kmem_enabled())
519 __memcg_kmem_uncharge_pages(page, order);
520}
521
522/**
523 * memcg_kmem_commit_charge: embeds correct memcg in a page
524 * @page: pointer to struct page recently allocated
525 * @memcg: the memcg structure we charged against
526 * @order: allocation order.
527 *
528 * Needs to be called after memcg_kmem_newpage_charge, regardless of success or
529 * failure of the allocation. if @page is NULL, this function will revert the
530 * charges. Otherwise, it will commit the memcg given by @memcg to the
531 * corresponding page_cgroup.
532 */
533static inline void
534memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
535{
536 if (memcg_kmem_enabled() && memcg)
537 __memcg_kmem_commit_charge(page, memcg, order);
538}
539
540/**
541 * memcg_kmem_get_cache: selects the correct per-memcg cache for allocation
542 * @cachep: the original global kmem cache
543 * @gfp: allocation flags.
544 *
545 * This function assumes that the task allocating, which determines the memcg
546 * in the page allocator, belongs to the same cgroup throughout the whole
547 * process. Misacounting can happen if the task calls memcg_kmem_get_cache()
548 * while belonging to a cgroup, and later on changes. This is considered
549 * acceptable, and should only happen upon task migration.
550 *
551 * Before the cache is created by the memcg core, there is also a possible
552 * imbalance: the task belongs to a memcg, but the cache being allocated from
553 * is the global cache, since the child cache is not yet guaranteed to be
554 * ready. This case is also fine, since in this case the GFP_KMEMCG will not be
555 * passed and the page allocator will not attempt any cgroup accounting.
556 */
557static __always_inline struct kmem_cache *
558memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
559{
560 if (!memcg_kmem_enabled())
561 return cachep;
562 if (gfp & __GFP_NOFAIL)
563 return cachep;
564 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
565 return cachep;
566 if (unlikely(fatal_signal_pending(current)))
567 return cachep;
568
569 return __memcg_kmem_get_cache(cachep, gfp);
570}
571#else
572#define for_each_memcg_cache_index(_idx) \
573 for (; NULL; )
574
575static inline bool memcg_kmem_enabled(void)
576{
577 return false;
578}
579
580static inline bool
581memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
582{
583 return true;
584}
585
586static inline void memcg_kmem_uncharge_pages(struct page *page, int order)
587{
588}
589
590static inline void
591memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
592{
593}
594
595static inline int memcg_cache_id(struct mem_cgroup *memcg)
596{
597 return -1;
598}
599
600static inline int
601memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
602 struct kmem_cache *root_cache)
603{
604 return 0;
605}
606
607static inline void memcg_release_cache(struct kmem_cache *cachep)
608{
609}
610
611static inline void memcg_cache_list_add(struct mem_cgroup *memcg,
612 struct kmem_cache *s)
613{
614}
615
616static inline struct kmem_cache *
617memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
618{
619 return cachep;
620}
621
622static inline void kmem_cache_destroy_memcg_children(struct kmem_cache *s)
623{
624}
625#endif /* CONFIG_MEMCG_KMEM */
410#endif /* _LINUX_MEMCONTROL_H */ 626#endif /* _LINUX_MEMCONTROL_H */
411 627
diff --git a/include/linux/memory.h b/include/linux/memory.h
index ff9a9f8e0ed..45e93b46887 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -53,6 +53,8 @@ int arch_get_memory_phys_device(unsigned long start_pfn);
53struct memory_notify { 53struct memory_notify {
54 unsigned long start_pfn; 54 unsigned long start_pfn;
55 unsigned long nr_pages; 55 unsigned long nr_pages;
56 int status_change_nid_normal;
57 int status_change_nid_high;
56 int status_change_nid; 58 int status_change_nid;
57}; 59};
58 60
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 95573ec4ee6..4a45c4e5002 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -26,6 +26,13 @@ enum {
26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO, 26 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
27}; 27};
28 28
29/* Types for control the zone type of onlined memory */
30enum {
31 ONLINE_KEEP,
32 ONLINE_KERNEL,
33 ONLINE_MOVABLE,
34};
35
29/* 36/*
30 * pgdat resizing functions 37 * pgdat resizing functions
31 */ 38 */
@@ -46,6 +53,10 @@ void pgdat_resize_init(struct pglist_data *pgdat)
46} 53}
47/* 54/*
48 * Zone resizing functions 55 * Zone resizing functions
56 *
57 * Note: any attempt to resize a zone should has pgdat_resize_lock()
58 * zone_span_writelock() both held. This ensure the size of a zone
59 * can't be changed while pgdat_resize_lock() held.
49 */ 60 */
50static inline unsigned zone_span_seqbegin(struct zone *zone) 61static inline unsigned zone_span_seqbegin(struct zone *zone)
51{ 62{
@@ -71,7 +82,7 @@ extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages);
71extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); 82extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
72extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 83extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
73/* VM interface that may be used by firmware interface */ 84/* VM interface that may be used by firmware interface */
74extern int online_pages(unsigned long, unsigned long); 85extern int online_pages(unsigned long, unsigned long, int);
75extern void __offline_isolated_pages(unsigned long, unsigned long); 86extern void __offline_isolated_pages(unsigned long, unsigned long);
76 87
77typedef void (*online_page_callback_t)(struct page *page); 88typedef void (*online_page_callback_t)(struct page *page);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index dbd212723b7..9adc270de7e 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -188,6 +188,8 @@ static inline int vma_migratable(struct vm_area_struct *vma)
188 return 1; 188 return 1;
189} 189}
190 190
191extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
192
191#else 193#else
192 194
193struct mempolicy {}; 195struct mempolicy {};
@@ -307,5 +309,11 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
307 return 0; 309 return 0;
308} 310}
309 311
312static inline int mpol_misplaced(struct page *page, struct vm_area_struct *vma,
313 unsigned long address)
314{
315 return -1; /* no node preference */
316}
317
310#endif /* CONFIG_NUMA */ 318#endif /* CONFIG_NUMA */
311#endif 319#endif
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index a0ca0dca124..478672ed0c3 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -364,6 +364,6 @@ static inline int pm80x_dev_resume(struct device *dev)
364#endif 364#endif
365 365
366extern int pm80x_init(struct i2c_client *client, 366extern int pm80x_init(struct i2c_client *client,
367 const struct i2c_device_id *id) __devinit; 367 const struct i2c_device_id *id);
368extern int pm80x_deinit(struct i2c_client *client); 368extern int pm80x_deinit(struct i2c_client *client);
369#endif /* __LINUX_MFD_88PM80X_H */ 369#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 5d5298d5602..2138bd33021 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -267,39 +267,21 @@ struct abx500_bm_data {
267 int gnd_lift_resistance; 267 int gnd_lift_resistance;
268 const struct abx500_maxim_parameters *maxi; 268 const struct abx500_maxim_parameters *maxi;
269 const struct abx500_bm_capacity_levels *cap_levels; 269 const struct abx500_bm_capacity_levels *cap_levels;
270 const struct abx500_battery_type *bat_type; 270 struct abx500_battery_type *bat_type;
271 const struct abx500_bm_charger_parameters *chg_params; 271 const struct abx500_bm_charger_parameters *chg_params;
272 const struct abx500_fg_parameters *fg_params; 272 const struct abx500_fg_parameters *fg_params;
273}; 273};
274 274
275struct abx500_chargalg_platform_data { 275extern struct abx500_bm_data ab8500_bm_data;
276 char **supplied_to;
277 size_t num_supplicants;
278};
279
280struct abx500_charger_platform_data {
281 char **supplied_to;
282 size_t num_supplicants;
283 bool autopower_cfg;
284};
285 276
286struct abx500_btemp_platform_data { 277enum {
287 char **supplied_to; 278 NTC_EXTERNAL = 0,
288 size_t num_supplicants; 279 NTC_INTERNAL,
289}; 280};
290 281
291struct abx500_fg_platform_data { 282int bmdevs_of_probe(struct device *dev,
292 char **supplied_to; 283 struct device_node *np,
293 size_t num_supplicants; 284 struct abx500_bm_data **battery);
294};
295
296struct abx500_bm_plat_data {
297 struct abx500_bm_data *battery;
298 struct abx500_charger_platform_data *charger;
299 struct abx500_btemp_platform_data *btemp;
300 struct abx500_fg_platform_data *fg;
301 struct abx500_chargalg_platform_data *chargalg;
302};
303 285
304int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 286int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
305 u8 value); 287 u8 value);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 1491044efa1..1cb5698b4d7 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,9 +291,9 @@ struct ab8500_platform_data {
291 struct ab8500_codec_platform_data *codec; 291 struct ab8500_codec_platform_data *codec;
292}; 292};
293 293
294extern int __devinit ab8500_init(struct ab8500 *ab8500, 294extern int ab8500_init(struct ab8500 *ab8500,
295 enum ab8500_version version); 295 enum ab8500_version version);
296extern int __devexit ab8500_exit(struct ab8500 *ab8500); 296extern int ab8500_exit(struct ab8500 *ab8500);
297 297
298extern int ab8500_suspend(struct ab8500 *ab8500); 298extern int ab8500_suspend(struct ab8500 *ab8500);
299 299
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index dd231ac0bb1..a580363a7d2 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -78,6 +78,8 @@ enum arizona_type {
78 78
79#define ARIZONA_NUM_IRQ 50 79#define ARIZONA_NUM_IRQ 50
80 80
81struct snd_soc_dapm_context;
82
81struct arizona { 83struct arizona {
82 struct regmap *regmap; 84 struct regmap *regmap;
83 struct device *dev; 85 struct device *dev;
@@ -98,6 +100,8 @@ struct arizona {
98 100
99 struct mutex clk_lock; 101 struct mutex clk_lock;
100 int clk32k_ref; 102 int clk32k_ref;
103
104 struct snd_soc_dapm_context *dapm;
101}; 105};
102 106
103int arizona_clk32k_enable(struct arizona *arizona); 107int arizona_clk32k_enable(struct arizona *arizona);
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 7ab442905a5..8b1d1daaae1 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -62,6 +62,9 @@
62 62
63#define ARIZONA_MAX_OUTPUT 6 63#define ARIZONA_MAX_OUTPUT 6
64 64
65#define ARIZONA_HAP_ACT_ERM 0
66#define ARIZONA_HAP_ACT_LRA 2
67
65#define ARIZONA_MAX_PDM_SPK 2 68#define ARIZONA_MAX_PDM_SPK 2
66 69
67struct regulator_init_data; 70struct regulator_init_data;
@@ -114,6 +117,9 @@ struct arizona_pdata {
114 117
115 /** PDM speaker format */ 118 /** PDM speaker format */
116 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK]; 119 unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK];
120
121 /** Haptic actuator type */
122 unsigned int hap_act;
117}; 123};
118 124
119#endif 125#endif
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7671a287dfe..1f6fe31a4d5 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -76,6 +76,7 @@
76#define ARIZONA_RATE_ESTIMATOR_3 0x154 76#define ARIZONA_RATE_ESTIMATOR_3 0x154
77#define ARIZONA_RATE_ESTIMATOR_4 0x155 77#define ARIZONA_RATE_ESTIMATOR_4 0x155
78#define ARIZONA_RATE_ESTIMATOR_5 0x156 78#define ARIZONA_RATE_ESTIMATOR_5 0x156
79#define ARIZONA_DYNAMIC_FREQUENCY_SCALING_1 0x161
79#define ARIZONA_FLL1_CONTROL_1 0x171 80#define ARIZONA_FLL1_CONTROL_1 0x171
80#define ARIZONA_FLL1_CONTROL_2 0x172 81#define ARIZONA_FLL1_CONTROL_2 0x172
81#define ARIZONA_FLL1_CONTROL_3 0x173 82#define ARIZONA_FLL1_CONTROL_3 0x173
@@ -110,6 +111,7 @@
110#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA 111#define ARIZONA_FLL2_GPIO_CLOCK 0x1AA
111#define ARIZONA_MIC_CHARGE_PUMP_1 0x200 112#define ARIZONA_MIC_CHARGE_PUMP_1 0x200
112#define ARIZONA_LDO1_CONTROL_1 0x210 113#define ARIZONA_LDO1_CONTROL_1 0x210
114#define ARIZONA_LDO1_CONTROL_2 0x212
113#define ARIZONA_LDO2_CONTROL_1 0x213 115#define ARIZONA_LDO2_CONTROL_1 0x213
114#define ARIZONA_MIC_BIAS_CTRL_1 0x218 116#define ARIZONA_MIC_BIAS_CTRL_1 0x218
115#define ARIZONA_MIC_BIAS_CTRL_2 0x219 117#define ARIZONA_MIC_BIAS_CTRL_2 0x219
@@ -979,6 +981,7 @@
979#define ARIZONA_DSP1_CLOCKING_1 0x1101 981#define ARIZONA_DSP1_CLOCKING_1 0x1101
980#define ARIZONA_DSP1_STATUS_1 0x1104 982#define ARIZONA_DSP1_STATUS_1 0x1104
981#define ARIZONA_DSP1_STATUS_2 0x1105 983#define ARIZONA_DSP1_STATUS_2 0x1105
984#define ARIZONA_DSP1_STATUS_3 0x1106
982#define ARIZONA_DSP2_CONTROL_1 0x1200 985#define ARIZONA_DSP2_CONTROL_1 0x1200
983#define ARIZONA_DSP2_CLOCKING_1 0x1201 986#define ARIZONA_DSP2_CLOCKING_1 0x1201
984#define ARIZONA_DSP2_STATUS_1 0x1204 987#define ARIZONA_DSP2_STATUS_1 0x1204
@@ -1574,6 +1577,13 @@
1574#define ARIZONA_SAMPLE_RATE_DETECT_D_WIDTH 5 /* SAMPLE_RATE_DETECT_D - [4:0] */ 1577#define ARIZONA_SAMPLE_RATE_DETECT_D_WIDTH 5 /* SAMPLE_RATE_DETECT_D - [4:0] */
1575 1578
1576/* 1579/*
1580 * R353 (0x161) - Dynamic Frequency Scaling 1
1581 */
1582#define ARIZONA_SUBSYS_MAX_FREQ 0x0001 /* SUBSYS_MAX_FREQ */
1583#define ARIZONA_SUBSYS_MAX_FREQ_SHIFT 0 /* SUBSYS_MAX_FREQ */
1584#define ARIZONA_SUBSYS_MAX_FREQ_WIDTH 1 /* SUBSYS_MAX_FREQ */
1585
1586/*
1577 * R369 (0x171) - FLL1 Control 1 1587 * R369 (0x171) - FLL1 Control 1
1578 */ 1588 */
1579#define ARIZONA_FLL1_FREERUN 0x0002 /* FLL1_FREERUN */ 1589#define ARIZONA_FLL1_FREERUN 0x0002 /* FLL1_FREERUN */
@@ -1889,6 +1899,13 @@
1889#define ARIZONA_LDO1_ENA_WIDTH 1 /* LDO1_ENA */ 1899#define ARIZONA_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
1890 1900
1891/* 1901/*
1902 * R530 (0x212) - LDO1 Control 2
1903 */
1904#define ARIZONA_LDO1_HI_PWR 0x0001 /* LDO1_HI_PWR */
1905#define ARIZONA_LDO1_HI_PWR_SHIFT 0 /* LDO1_HI_PWR */
1906#define ARIZONA_LDO1_HI_PWR_WIDTH 1 /* LDO1_HI_PWR */
1907
1908/*
1892 * R531 (0x213) - LDO2 Control 1 1909 * R531 (0x213) - LDO2 Control 1
1893 */ 1910 */
1894#define ARIZONA_LDO2_VSEL_MASK 0x07E0 /* LDO2_VSEL - [10:5] */ 1911#define ARIZONA_LDO2_VSEL_MASK 0x07E0 /* LDO2_VSEL - [10:5] */
diff --git a/include/linux/mfd/as3711.h b/include/linux/mfd/as3711.h
new file mode 100644
index 00000000000..38452ce1e89
--- /dev/null
+++ b/include/linux/mfd/as3711.h
@@ -0,0 +1,126 @@
1/*
2 * AS3711 PMIC MFC driver header
3 *
4 * Copyright (C) 2012 Renesas Electronics Corporation
5 * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the version 2 of the GNU General Public License as
9 * published by the Free Software Foundation
10 */
11
12#ifndef MFD_AS3711_H
13#define MFD_AS3711_H
14
15/*
16 * Client data
17 */
18
19/* Register addresses */
20#define AS3711_SD_1_VOLTAGE 0 /* Digital Step-Down */
21#define AS3711_SD_2_VOLTAGE 1
22#define AS3711_SD_3_VOLTAGE 2
23#define AS3711_SD_4_VOLTAGE 3
24#define AS3711_LDO_1_VOLTAGE 4 /* Analog LDO */
25#define AS3711_LDO_2_VOLTAGE 5
26#define AS3711_LDO_3_VOLTAGE 6 /* Digital LDO */
27#define AS3711_LDO_4_VOLTAGE 7
28#define AS3711_LDO_5_VOLTAGE 8
29#define AS3711_LDO_6_VOLTAGE 9
30#define AS3711_LDO_7_VOLTAGE 0xa
31#define AS3711_LDO_8_VOLTAGE 0xb
32#define AS3711_SD_CONTROL 0x10
33#define AS3711_GPIO_SIGNAL_OUT 0x20
34#define AS3711_GPIO_SIGNAL_IN 0x21
35#define AS3711_SD_CONTROL_1 0x30
36#define AS3711_SD_CONTROL_2 0x31
37#define AS3711_CURR_CONTROL 0x40
38#define AS3711_CURR1_VALUE 0x43
39#define AS3711_CURR2_VALUE 0x44
40#define AS3711_CURR3_VALUE 0x45
41#define AS3711_STEPUP_CONTROL_1 0x50
42#define AS3711_STEPUP_CONTROL_2 0x51
43#define AS3711_STEPUP_CONTROL_4 0x53
44#define AS3711_STEPUP_CONTROL_5 0x54
45#define AS3711_REG_STATUS 0x73
46#define AS3711_INTERRUPT_STATUS_1 0x77
47#define AS3711_INTERRUPT_STATUS_2 0x78
48#define AS3711_INTERRUPT_STATUS_3 0x79
49#define AS3711_CHARGER_STATUS_1 0x86
50#define AS3711_CHARGER_STATUS_2 0x87
51#define AS3711_ASIC_ID_1 0x90
52#define AS3711_ASIC_ID_2 0x91
53
54#define AS3711_MAX_REGS 0x92
55
56/* Regulators */
57enum {
58 AS3711_REGULATOR_SD_1,
59 AS3711_REGULATOR_SD_2,
60 AS3711_REGULATOR_SD_3,
61 AS3711_REGULATOR_SD_4,
62 AS3711_REGULATOR_LDO_1,
63 AS3711_REGULATOR_LDO_2,
64 AS3711_REGULATOR_LDO_3,
65 AS3711_REGULATOR_LDO_4,
66 AS3711_REGULATOR_LDO_5,
67 AS3711_REGULATOR_LDO_6,
68 AS3711_REGULATOR_LDO_7,
69 AS3711_REGULATOR_LDO_8,
70
71 AS3711_REGULATOR_MAX,
72};
73
74struct device;
75struct regmap;
76
77struct as3711 {
78 struct device *dev;
79 struct regmap *regmap;
80};
81
82#define AS3711_MAX_STEPDOWN 4
83#define AS3711_MAX_STEPUP 2
84#define AS3711_MAX_LDO 8
85
86enum as3711_su2_feedback {
87 AS3711_SU2_VOLTAGE,
88 AS3711_SU2_CURR1,
89 AS3711_SU2_CURR2,
90 AS3711_SU2_CURR3,
91 AS3711_SU2_CURR_AUTO,
92};
93
94enum as3711_su2_fbprot {
95 AS3711_SU2_LX_SD4,
96 AS3711_SU2_GPIO2,
97 AS3711_SU2_GPIO3,
98 AS3711_SU2_GPIO4,
99};
100
101/*
102 * Platform data
103 */
104
105struct as3711_regulator_pdata {
106 struct regulator_init_data *init_data[AS3711_REGULATOR_MAX];
107};
108
109struct as3711_bl_pdata {
110 const char *su1_fb;
111 int su1_max_uA;
112 const char *su2_fb;
113 int su2_max_uA;
114 enum as3711_su2_feedback su2_feedback;
115 enum as3711_su2_fbprot su2_fbprot;
116 bool su2_auto_curr1;
117 bool su2_auto_curr2;
118 bool su2_auto_curr3;
119};
120
121struct as3711_platform_data {
122 struct as3711_regulator_pdata regulator;
123 struct as3711_bl_pdata backlight;
124};
125
126#endif
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 0507c4c21a7..86dd93de6ff 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -146,4 +146,14 @@ void da9052_device_exit(struct da9052 *da9052);
146 146
147extern struct regmap_config da9052_regmap_config; 147extern struct regmap_config da9052_regmap_config;
148 148
149int da9052_irq_init(struct da9052 *da9052);
150int da9052_irq_exit(struct da9052 *da9052);
151int da9052_request_irq(struct da9052 *da9052, int irq, char *name,
152 irq_handler_t handler, void *data);
153void da9052_free_irq(struct da9052 *da9052, int irq, void *data);
154
155int da9052_enable_irq(struct da9052 *da9052, int irq);
156int da9052_disable_irq(struct da9052 *da9052, int irq);
157int da9052_disable_irq_nosync(struct da9052 *da9052, int irq);
158
149#endif /* __MFD_DA9052_DA9052_H */ 159#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9055/core.h b/include/linux/mfd/da9055/core.h
index c96ad682c59..956afa44599 100644
--- a/include/linux/mfd/da9055/core.h
+++ b/include/linux/mfd/da9055/core.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * da9055 declarations for DA9055 PMICs. 2 * da9055 declarations for DA9055 PMICs.
3 * 3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd. 4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
diff --git a/include/linux/mfd/da9055/pdata.h b/include/linux/mfd/da9055/pdata.h
index 147293b4471..04e092be4b0 100644
--- a/include/linux/mfd/da9055/pdata.h
+++ b/include/linux/mfd/da9055/pdata.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2012 Dialog Semiconductor Ltd. 1/* Copyright (C) 2012 Dialog Semiconductor Ltd.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -25,8 +25,29 @@ struct da9055_pdata {
25 int gpio_base; 25 int gpio_base;
26 26
27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS]; 27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS];
28 bool reset_enable; /* Enable RTC in RESET Mode */ 28 /* Enable RTC in RESET Mode */
29 enum gpio_select *gpio_rsel; /* Select regulator set thru GPIO 1/2 */ 29 bool reset_enable;
30 enum gpio_select *gpio_ren; /* Enable regulator thru GPIO 1/2 */ 30 /*
31 * GPI muxed pin to control
32 * regulator state A/B, 0 if not available.
33 */
34 int *gpio_ren;
35 /*
36 * GPI muxed pin to control
37 * regulator set, 0 if not available.
38 */
39 int *gpio_rsel;
40 /*
41 * Regulator mode control bits value (GPI offset) that
42 * that controls the regulator state, 0 if not available.
43 */
44 enum gpio_select *reg_ren;
45 /*
46 * Regulator mode control bits value (GPI offset) that
47 * controls the regulator set A/B, 0 if not available.
48 */
49 enum gpio_select *reg_rsel;
50 /* GPIOs to enable regulator, 0 if not available */
51 int *ena_gpio;
31}; 52};
32#endif /* __DA9055_PDATA_H */ 53#endif /* __DA9055_PDATA_H */
diff --git a/include/linux/mfd/da9055/reg.h b/include/linux/mfd/da9055/reg.h
index df237ee5480..2b592e072db 100644
--- a/include/linux/mfd/da9055/reg.h
+++ b/include/linux/mfd/da9055/reg.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * DA9055 declarations for DA9055 PMICs. 2 * DA9055 declarations for DA9055 PMICs.
3 * 3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd. 4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index b82f6ee66a0..6ee4247df11 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -515,7 +515,6 @@ enum romcode_read prcmu_get_rc_p2a(void);
515enum ap_pwrst prcmu_get_xp70_current_state(void); 515enum ap_pwrst prcmu_get_xp70_current_state(void);
516bool prcmu_has_arm_maxopp(void); 516bool prcmu_has_arm_maxopp(void);
517struct prcmu_fw_version *prcmu_get_fw_version(void); 517struct prcmu_fw_version *prcmu_get_fw_version(void);
518int prcmu_request_ape_opp_100_voltage(bool enable);
519int prcmu_release_usb_wakeup_state(void); 518int prcmu_release_usb_wakeup_state(void);
520void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 519void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
521 struct prcmu_auto_pm_config *idle); 520 struct prcmu_auto_pm_config *idle);
@@ -564,6 +563,7 @@ int db8500_prcmu_set_arm_opp(u8 opp);
564int db8500_prcmu_get_arm_opp(void); 563int db8500_prcmu_get_arm_opp(void);
565int db8500_prcmu_set_ape_opp(u8 opp); 564int db8500_prcmu_set_ape_opp(u8 opp);
566int db8500_prcmu_get_ape_opp(void); 565int db8500_prcmu_get_ape_opp(void);
566int db8500_prcmu_request_ape_opp_100_voltage(bool enable);
567int db8500_prcmu_set_ddr_opp(u8 opp); 567int db8500_prcmu_set_ddr_opp(u8 opp);
568int db8500_prcmu_get_ddr_opp(void); 568int db8500_prcmu_get_ddr_opp(void);
569 569
@@ -610,7 +610,7 @@ static inline int db8500_prcmu_get_ape_opp(void)
610 return APE_100_OPP; 610 return APE_100_OPP;
611} 611}
612 612
613static inline int prcmu_request_ape_opp_100_voltage(bool enable) 613static inline int db8500_prcmu_request_ape_opp_100_voltage(bool enable)
614{ 614{
615 return 0; 615 return 0;
616} 616}
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index c410d99bd66..c202d6c4d87 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -336,6 +336,11 @@ static inline int prcmu_get_ape_opp(void)
336 return db8500_prcmu_get_ape_opp(); 336 return db8500_prcmu_get_ape_opp();
337} 337}
338 338
339static inline int prcmu_request_ape_opp_100_voltage(bool enable)
340{
341 return db8500_prcmu_request_ape_opp_100_voltage(enable);
342}
343
339static inline void prcmu_system_reset(u16 reset_code) 344static inline void prcmu_system_reset(u16 reset_code)
340{ 345{
341 return db8500_prcmu_system_reset(reset_code); 346 return db8500_prcmu_system_reset(reset_code);
@@ -507,6 +512,11 @@ static inline int prcmu_get_ape_opp(void)
507 return APE_100_OPP; 512 return APE_100_OPP;
508} 513}
509 514
515static inline int prcmu_request_ape_opp_100_voltage(bool enable)
516{
517 return 0;
518}
519
510static inline int prcmu_set_arm_opp(u8 opp) 520static inline int prcmu_set_arm_opp(u8 opp)
511{ 521{
512 return 0; 522 return 0;
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
index cec364bdccf..2a32b16f79c 100644
--- a/include/linux/mfd/lp8788.h
+++ b/include/linux/mfd/lp8788.h
@@ -211,16 +211,16 @@ struct lp8788_chg_param {
211 211
212/* 212/*
213 * struct lp8788_charger_platform_data 213 * struct lp8788_charger_platform_data
214 * @vbatt_adc : adc selection id for battery voltage 214 * @adc_vbatt : adc channel name for battery voltage
215 * @batt_temp_adc : adc selection id for battery temperature 215 * @adc_batt_temp : adc channel name for battery temperature
216 * @max_vbatt_mv : used for calculating battery capacity 216 * @max_vbatt_mv : used for calculating battery capacity
217 * @chg_params : initial charging parameters 217 * @chg_params : initial charging parameters
218 * @num_chg_params : numbers of charging parameters 218 * @num_chg_params : numbers of charging parameters
219 * @charger_event : the charger event can be reported to the platform side 219 * @charger_event : the charger event can be reported to the platform side
220 */ 220 */
221struct lp8788_charger_platform_data { 221struct lp8788_charger_platform_data {
222 enum lp8788_adc_id vbatt_adc; 222 const char *adc_vbatt;
223 enum lp8788_adc_id batt_temp_adc; 223 const char *adc_batt_temp;
224 unsigned int max_vbatt_mv; 224 unsigned int max_vbatt_mv;
225 struct lp8788_chg_param *chg_params; 225 struct lp8788_chg_param *chg_params;
226 int num_chg_params; 226 int num_chg_params;
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 830152cfae3..6ae21bf47d6 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -316,6 +316,7 @@ enum max8997_irq {
316#define MAX8997_NUM_GPIO 12 316#define MAX8997_NUM_GPIO 12
317struct max8997_dev { 317struct max8997_dev {
318 struct device *dev; 318 struct device *dev;
319 struct max8997_platform_data *pdata;
319 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ 320 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
320 struct i2c_client *rtc; /* slave addr 0x0c */ 321 struct i2c_client *rtc; /* slave addr 0x0c */
321 struct i2c_client *haptic; /* slave addr 0x90 */ 322 struct i2c_client *haptic; /* slave addr 0x90 */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 328d8e24b53..1d4a4fe6ac3 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -75,6 +75,7 @@ enum max8998_regulators {
75struct max8997_regulator_data { 75struct max8997_regulator_data {
76 int id; 76 int id;
77 struct regulator_init_data *initdata; 77 struct regulator_init_data *initdata;
78 struct device_node *reg_node;
78}; 79};
79 80
80enum max8997_muic_usb_type { 81enum max8997_muic_usb_type {
diff --git a/include/linux/mfd/menelaus.h b/include/linux/mfd/menelaus.h
new file mode 100644
index 00000000000..f097e89134c
--- /dev/null
+++ b/include/linux/mfd/menelaus.h
@@ -0,0 +1,47 @@
1/*
2 * Functions to access Menelaus power management chip
3 */
4
5#ifndef __ASM_ARCH_MENELAUS_H
6#define __ASM_ARCH_MENELAUS_H
7
8struct device;
9
10struct menelaus_platform_data {
11 int (* late_init)(struct device *dev);
12};
13
14extern int menelaus_register_mmc_callback(void (*callback)(void *data, u8 card_mask),
15 void *data);
16extern void menelaus_unregister_mmc_callback(void);
17extern int menelaus_set_mmc_opendrain(int slot, int enable);
18extern int menelaus_set_mmc_slot(int slot, int enable, int power, int cd_on);
19
20extern int menelaus_set_vmem(unsigned int mV);
21extern int menelaus_set_vio(unsigned int mV);
22extern int menelaus_set_vmmc(unsigned int mV);
23extern int menelaus_set_vaux(unsigned int mV);
24extern int menelaus_set_vdcdc(int dcdc, unsigned int mV);
25extern int menelaus_set_slot_sel(int enable);
26extern int menelaus_get_slot_pin_states(void);
27extern int menelaus_set_vcore_sw(unsigned int mV);
28extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
29
30#define EN_VPLL_SLEEP (1 << 7)
31#define EN_VMMC_SLEEP (1 << 6)
32#define EN_VAUX_SLEEP (1 << 5)
33#define EN_VIO_SLEEP (1 << 4)
34#define EN_VMEM_SLEEP (1 << 3)
35#define EN_DC3_SLEEP (1 << 2)
36#define EN_DC2_SLEEP (1 << 1)
37#define EN_VC_SLEEP (1 << 0)
38
39extern int menelaus_set_regulator_sleep(int enable, u32 val);
40
41#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
42#define omap_has_menelaus() 1
43#else
44#define omap_has_menelaus() 0
45#endif
46
47#endif
diff --git a/include/linux/mfd/pm8xxx/irq.h b/include/linux/mfd/pm8xxx/irq.h
index 4b21769f448..f83d6b43ecb 100644
--- a/include/linux/mfd/pm8xxx/irq.h
+++ b/include/linux/mfd/pm8xxx/irq.h
@@ -37,21 +37,21 @@ struct pm_irq_chip;
37 37
38#ifdef CONFIG_MFD_PM8XXX_IRQ 38#ifdef CONFIG_MFD_PM8XXX_IRQ
39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq); 39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq);
40struct pm_irq_chip * __devinit pm8xxx_irq_init(struct device *dev, 40struct pm_irq_chip *pm8xxx_irq_init(struct device *dev,
41 const struct pm8xxx_irq_platform_data *pdata); 41 const struct pm8xxx_irq_platform_data *pdata);
42int __devexit pm8xxx_irq_exit(struct pm_irq_chip *chip); 42int pm8xxx_irq_exit(struct pm_irq_chip *chip);
43#else 43#else
44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq) 44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq)
45{ 45{
46 return -ENXIO; 46 return -ENXIO;
47} 47}
48static inline struct pm_irq_chip * __devinit pm8xxx_irq_init( 48static inline struct pm_irq_chip *pm8xxx_irq_init(
49 const struct device *dev, 49 const struct device *dev,
50 const struct pm8xxx_irq_platform_data *pdata) 50 const struct pm8xxx_irq_platform_data *pdata)
51{ 51{
52 return ERR_PTR(-ENXIO); 52 return ERR_PTR(-ENXIO);
53} 53}
54static inline int __devexit pm8xxx_irq_exit(struct pm_irq_chip *chip) 54static inline int pm8xxx_irq_exit(struct pm_irq_chip *chip)
55{ 55{
56 return -ENXIO; 56 return -ENXIO;
57} 57}
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 36c242e52ef..fd413ccab91 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -33,6 +33,7 @@
33/* Maximum number of main interrupts */ 33/* Maximum number of main interrupts */
34#define MAX_MAIN_INTERRUPT 5 34#define MAX_MAIN_INTERRUPT 5
35#define RC5T583_MAX_GPEDGE_REG 2 35#define RC5T583_MAX_GPEDGE_REG 2
36#define RC5T583_MAX_INTERRUPT_EN_REGS 8
36#define RC5T583_MAX_INTERRUPT_MASK_REGS 9 37#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
37 38
38/* Interrupt enable register */ 39/* Interrupt enable register */
@@ -304,7 +305,7 @@ struct rc5t583 {
304 uint8_t intc_inten_reg; 305 uint8_t intc_inten_reg;
305 306
306 /* For group interrupt bits and address */ 307 /* For group interrupt bits and address */
307 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS]; 308 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_EN_REGS];
308 309
309 /* For gpio edge */ 310 /* For gpio edge */
310 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG]; 311 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
diff --git a/include/linux/mfd/retu.h b/include/linux/mfd/retu.h
new file mode 100644
index 00000000000..1e2715d5b83
--- /dev/null
+++ b/include/linux/mfd/retu.h
@@ -0,0 +1,22 @@
1/*
2 * Retu MFD driver interface
3 *
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of this
6 * archive for more details.
7 */
8
9#ifndef __LINUX_MFD_RETU_H
10#define __LINUX_MFD_RETU_H
11
12struct retu_dev;
13
14int retu_read(struct retu_dev *, u8);
15int retu_write(struct retu_dev *, u8, u16);
16
17/* Registers */
18#define RETU_REG_WATCHDOG 0x17 /* Watchdog */
19#define RETU_REG_CC1 0x0d /* Common control register 1 */
20#define RETU_REG_STATUS 0x16 /* Status register */
21
22#endif /* __LINUX_MFD_RETU_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
new file mode 100644
index 00000000000..a8d393e3066
--- /dev/null
+++ b/include/linux/mfd/rtsx_common.h
@@ -0,0 +1,48 @@
1/* Driver for Realtek driver-based card reader
2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
4 *
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
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */
22
23#ifndef __RTSX_COMMON_H
24#define __RTSX_COMMON_H
25
26#define DRV_NAME_RTSX_PCI "rtsx_pci"
27#define DRV_NAME_RTSX_PCI_SDMMC "rtsx_pci_sdmmc"
28#define DRV_NAME_RTSX_PCI_MS "rtsx_pci_ms"
29
30#define RTSX_REG_PAIR(addr, val) (((u32)(addr) << 16) | (u8)(val))
31
32#define RTSX_SSC_DEPTH_4M 0x01
33#define RTSX_SSC_DEPTH_2M 0x02
34#define RTSX_SSC_DEPTH_1M 0x03
35#define RTSX_SSC_DEPTH_500K 0x04
36#define RTSX_SSC_DEPTH_250K 0x05
37
38#define RTSX_SD_CARD 0
39#define RTSX_MS_CARD 1
40
41struct platform_device;
42
43struct rtsx_slot {
44 struct platform_device *p_dev;
45 void (*card_event)(struct platform_device *p_dev);
46};
47
48#endif
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
new file mode 100644
index 00000000000..060b721fcbf
--- /dev/null
+++ b/include/linux/mfd/rtsx_pci.h
@@ -0,0 +1,794 @@
1/* Driver for Realtek PCI-Express card reader
2 *
3 * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
4 *
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
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author:
19 * Wei WANG <wei_wang@realsil.com.cn>
20 * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
21 */
22
23#ifndef __RTSX_PCI_H
24#define __RTSX_PCI_H
25
26#include <linux/sched.h>
27#include <linux/pci.h>
28
29#include "rtsx_common.h"
30
31#define MAX_RW_REG_CNT 1024
32
33/* PCI Operation Register Address */
34#define RTSX_HCBAR 0x00
35#define RTSX_HCBCTLR 0x04
36#define RTSX_HDBAR 0x08
37#define RTSX_HDBCTLR 0x0C
38#define RTSX_HAIMR 0x10
39#define RTSX_BIPR 0x14
40#define RTSX_BIER 0x18
41
42/* Host command buffer control register */
43#define STOP_CMD (0x01 << 28)
44
45/* Host data buffer control register */
46#define SDMA_MODE 0x00
47#define ADMA_MODE (0x02 << 26)
48#define STOP_DMA (0x01 << 28)
49#define TRIG_DMA (0x01 << 31)
50
51/* Host access internal memory register */
52#define HAIMR_TRANS_START (0x01 << 31)
53#define HAIMR_READ 0x00
54#define HAIMR_WRITE (0x01 << 30)
55#define HAIMR_READ_START (HAIMR_TRANS_START | HAIMR_READ)
56#define HAIMR_WRITE_START (HAIMR_TRANS_START | HAIMR_WRITE)
57#define HAIMR_TRANS_END (HAIMR_TRANS_START)
58
59/* Bus interrupt pending register */
60#define CMD_DONE_INT (1 << 31)
61#define DATA_DONE_INT (1 << 30)
62#define TRANS_OK_INT (1 << 29)
63#define TRANS_FAIL_INT (1 << 28)
64#define XD_INT (1 << 27)
65#define MS_INT (1 << 26)
66#define SD_INT (1 << 25)
67#define GPIO0_INT (1 << 24)
68#define OC_INT (1 << 23)
69#define SD_WRITE_PROTECT (1 << 19)
70#define XD_EXIST (1 << 18)
71#define MS_EXIST (1 << 17)
72#define SD_EXIST (1 << 16)
73#define DELINK_INT GPIO0_INT
74#define MS_OC_INT (1 << 23)
75#define SD_OC_INT (1 << 22)
76
77#define CARD_INT (XD_INT | MS_INT | SD_INT)
78#define NEED_COMPLETE_INT (DATA_DONE_INT | TRANS_OK_INT | TRANS_FAIL_INT)
79#define RTSX_INT (CMD_DONE_INT | NEED_COMPLETE_INT | \
80 CARD_INT | GPIO0_INT | OC_INT)
81
82#define CARD_EXIST (XD_EXIST | MS_EXIST | SD_EXIST)
83
84/* Bus interrupt enable register */
85#define CMD_DONE_INT_EN (1 << 31)
86#define DATA_DONE_INT_EN (1 << 30)
87#define TRANS_OK_INT_EN (1 << 29)
88#define TRANS_FAIL_INT_EN (1 << 28)
89#define XD_INT_EN (1 << 27)
90#define MS_INT_EN (1 << 26)
91#define SD_INT_EN (1 << 25)
92#define GPIO0_INT_EN (1 << 24)
93#define OC_INT_EN (1 << 23)
94#define DELINK_INT_EN GPIO0_INT_EN
95#define MS_OC_INT_EN (1 << 23)
96#define SD_OC_INT_EN (1 << 22)
97
98#define READ_REG_CMD 0
99#define WRITE_REG_CMD 1
100#define CHECK_REG_CMD 2
101
102/*
103 * macros for easy use
104 */
105#define rtsx_pci_writel(pcr, reg, value) \
106 iowrite32(value, (pcr)->remap_addr + reg)
107#define rtsx_pci_readl(pcr, reg) \
108 ioread32((pcr)->remap_addr + reg)
109#define rtsx_pci_writew(pcr, reg, value) \
110 iowrite16(value, (pcr)->remap_addr + reg)
111#define rtsx_pci_readw(pcr, reg) \
112 ioread16((pcr)->remap_addr + reg)
113#define rtsx_pci_writeb(pcr, reg, value) \
114 iowrite8(value, (pcr)->remap_addr + reg)
115#define rtsx_pci_readb(pcr, reg) \
116 ioread8((pcr)->remap_addr + reg)
117
118#define rtsx_pci_read_config_byte(pcr, where, val) \
119 pci_read_config_byte((pcr)->pci, where, val)
120
121#define rtsx_pci_write_config_byte(pcr, where, val) \
122 pci_write_config_byte((pcr)->pci, where, val)
123
124#define rtsx_pci_read_config_dword(pcr, where, val) \
125 pci_read_config_dword((pcr)->pci, where, val)
126
127#define rtsx_pci_write_config_dword(pcr, where, val) \
128 pci_write_config_dword((pcr)->pci, where, val)
129
130#define STATE_TRANS_NONE 0
131#define STATE_TRANS_CMD 1
132#define STATE_TRANS_BUF 2
133#define STATE_TRANS_SG 3
134
135#define TRANS_NOT_READY 0
136#define TRANS_RESULT_OK 1
137#define TRANS_RESULT_FAIL 2
138#define TRANS_NO_DEVICE 3
139
140#define RTSX_RESV_BUF_LEN 4096
141#define HOST_CMDS_BUF_LEN 1024
142#define HOST_SG_TBL_BUF_LEN (RTSX_RESV_BUF_LEN - HOST_CMDS_BUF_LEN)
143#define HOST_SG_TBL_ITEMS (HOST_SG_TBL_BUF_LEN / 8)
144#define MAX_SG_ITEM_LEN 0x80000
145
146#define HOST_TO_DEVICE 0
147#define DEVICE_TO_HOST 1
148
149#define MAX_PHASE 31
150#define RX_TUNING_CNT 3
151
152/* SG descriptor */
153#define SG_INT 0x04
154#define SG_END 0x02
155#define SG_VALID 0x01
156
157#define SG_NO_OP 0x00
158#define SG_TRANS_DATA (0x02 << 4)
159#define SG_LINK_DESC (0x03 << 4)
160
161/* SD bank voltage */
162#define SD_IO_3V3 0
163#define SD_IO_1V8 1
164
165
166/* Card Clock Enable Register */
167#define SD_CLK_EN 0x04
168#define MS_CLK_EN 0x08
169
170/* Card Select Register */
171#define SD_MOD_SEL 2
172#define MS_MOD_SEL 3
173
174/* Card Output Enable Register */
175#define SD_OUTPUT_EN 0x04
176#define MS_OUTPUT_EN 0x08
177
178/* CARD_SHARE_MODE */
179#define CARD_SHARE_MASK 0x0F
180#define CARD_SHARE_MULTI_LUN 0x00
181#define CARD_SHARE_NORMAL 0x00
182#define CARD_SHARE_48_SD 0x04
183#define CARD_SHARE_48_MS 0x08
184/* CARD_SHARE_MODE for barossa */
185#define CARD_SHARE_BAROSSA_SD 0x01
186#define CARD_SHARE_BAROSSA_MS 0x02
187
188/* SD30_DRIVE_SEL */
189#define DRIVER_TYPE_A 0x05
190#define DRIVER_TYPE_B 0x03
191#define DRIVER_TYPE_C 0x02
192#define DRIVER_TYPE_D 0x01
193
194/* FPDCTL */
195#define SSC_POWER_DOWN 0x01
196#define SD_OC_POWER_DOWN 0x02
197#define ALL_POWER_DOWN 0x07
198#define OC_POWER_DOWN 0x06
199
200/* CLK_CTL */
201#define CHANGE_CLK 0x01
202
203/* LDO_CTL */
204#define BPP_LDO_POWB 0x03
205#define BPP_LDO_ON 0x00
206#define BPP_LDO_SUSPEND 0x02
207#define BPP_LDO_OFF 0x03
208
209/* CD_PAD_CTL */
210#define CD_DISABLE_MASK 0x07
211#define MS_CD_DISABLE 0x04
212#define SD_CD_DISABLE 0x02
213#define XD_CD_DISABLE 0x01
214#define CD_DISABLE 0x07
215#define CD_ENABLE 0x00
216#define MS_CD_EN_ONLY 0x03
217#define SD_CD_EN_ONLY 0x05
218#define XD_CD_EN_ONLY 0x06
219#define FORCE_CD_LOW_MASK 0x38
220#define FORCE_CD_XD_LOW 0x08
221#define FORCE_CD_SD_LOW 0x10
222#define FORCE_CD_MS_LOW 0x20
223#define CD_AUTO_DISABLE 0x40
224
225/* SD_STAT1 */
226#define SD_CRC7_ERR 0x80
227#define SD_CRC16_ERR 0x40
228#define SD_CRC_WRITE_ERR 0x20
229#define SD_CRC_WRITE_ERR_MASK 0x1C
230#define GET_CRC_TIME_OUT 0x02
231#define SD_TUNING_COMPARE_ERR 0x01
232
233/* SD_STAT2 */
234#define SD_RSP_80CLK_TIMEOUT 0x01
235
236/* SD_BUS_STAT */
237#define SD_CLK_TOGGLE_EN 0x80
238#define SD_CLK_FORCE_STOP 0x40
239#define SD_DAT3_STATUS 0x10
240#define SD_DAT2_STATUS 0x08
241#define SD_DAT1_STATUS 0x04
242#define SD_DAT0_STATUS 0x02
243#define SD_CMD_STATUS 0x01
244
245/* SD_PAD_CTL */
246#define SD_IO_USING_1V8 0x80
247#define SD_IO_USING_3V3 0x7F
248#define TYPE_A_DRIVING 0x00
249#define TYPE_B_DRIVING 0x01
250#define TYPE_C_DRIVING 0x02
251#define TYPE_D_DRIVING 0x03
252
253/* SD_SAMPLE_POINT_CTL */
254#define DDR_FIX_RX_DAT 0x00
255#define DDR_VAR_RX_DAT 0x80
256#define DDR_FIX_RX_DAT_EDGE 0x00
257#define DDR_FIX_RX_DAT_14_DELAY 0x40
258#define DDR_FIX_RX_CMD 0x00
259#define DDR_VAR_RX_CMD 0x20
260#define DDR_FIX_RX_CMD_POS_EDGE 0x00
261#define DDR_FIX_RX_CMD_14_DELAY 0x10
262#define SD20_RX_POS_EDGE 0x00
263#define SD20_RX_14_DELAY 0x08
264#define SD20_RX_SEL_MASK 0x08
265
266/* SD_PUSH_POINT_CTL */
267#define DDR_FIX_TX_CMD_DAT 0x00
268#define DDR_VAR_TX_CMD_DAT 0x80
269#define DDR_FIX_TX_DAT_14_TSU 0x00
270#define DDR_FIX_TX_DAT_12_TSU 0x40
271#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
272#define DDR_FIX_TX_CMD_14_AHEAD 0x20
273#define SD20_TX_NEG_EDGE 0x00
274#define SD20_TX_14_AHEAD 0x10
275#define SD20_TX_SEL_MASK 0x10
276#define DDR_VAR_SDCLK_POL_SWAP 0x01
277
278/* SD_TRANSFER */
279#define SD_TRANSFER_START 0x80
280#define SD_TRANSFER_END 0x40
281#define SD_STAT_IDLE 0x20
282#define SD_TRANSFER_ERR 0x10
283/* SD Transfer Mode definition */
284#define SD_TM_NORMAL_WRITE 0x00
285#define SD_TM_AUTO_WRITE_3 0x01
286#define SD_TM_AUTO_WRITE_4 0x02
287#define SD_TM_AUTO_READ_3 0x05
288#define SD_TM_AUTO_READ_4 0x06
289#define SD_TM_CMD_RSP 0x08
290#define SD_TM_AUTO_WRITE_1 0x09
291#define SD_TM_AUTO_WRITE_2 0x0A
292#define SD_TM_NORMAL_READ 0x0C
293#define SD_TM_AUTO_READ_1 0x0D
294#define SD_TM_AUTO_READ_2 0x0E
295#define SD_TM_AUTO_TUNING 0x0F
296
297/* SD_VPTX_CTL / SD_VPRX_CTL */
298#define PHASE_CHANGE 0x80
299#define PHASE_NOT_RESET 0x40
300
301/* SD_DCMPS_TX_CTL / SD_DCMPS_RX_CTL */
302#define DCMPS_CHANGE 0x80
303#define DCMPS_CHANGE_DONE 0x40
304#define DCMPS_ERROR 0x20
305#define DCMPS_CURRENT_PHASE 0x1F
306
307/* SD Configure 1 Register */
308#define SD_CLK_DIVIDE_0 0x00
309#define SD_CLK_DIVIDE_256 0xC0
310#define SD_CLK_DIVIDE_128 0x80
311#define SD_BUS_WIDTH_1BIT 0x00
312#define SD_BUS_WIDTH_4BIT 0x01
313#define SD_BUS_WIDTH_8BIT 0x02
314#define SD_ASYNC_FIFO_NOT_RST 0x10
315#define SD_20_MODE 0x00
316#define SD_DDR_MODE 0x04
317#define SD_30_MODE 0x08
318
319#define SD_CLK_DIVIDE_MASK 0xC0
320
321/* SD_CMD_STATE */
322#define SD_CMD_IDLE 0x80
323
324/* SD_DATA_STATE */
325#define SD_DATA_IDLE 0x80
326
327/* DCM_DRP_CTL */
328#define DCM_RESET 0x08
329#define DCM_LOCKED 0x04
330#define DCM_208M 0x00
331#define DCM_TX 0x01
332#define DCM_RX 0x02
333
334/* DCM_DRP_TRIG */
335#define DRP_START 0x80
336#define DRP_DONE 0x40
337
338/* DCM_DRP_CFG */
339#define DRP_WRITE 0x80
340#define DRP_READ 0x00
341#define DCM_WRITE_ADDRESS_50 0x50
342#define DCM_WRITE_ADDRESS_51 0x51
343#define DCM_READ_ADDRESS_00 0x00
344#define DCM_READ_ADDRESS_51 0x51
345
346/* IRQSTAT0 */
347#define DMA_DONE_INT 0x80
348#define SUSPEND_INT 0x40
349#define LINK_RDY_INT 0x20
350#define LINK_DOWN_INT 0x10
351
352/* DMACTL */
353#define DMA_RST 0x80
354#define DMA_BUSY 0x04
355#define DMA_DIR_TO_CARD 0x00
356#define DMA_DIR_FROM_CARD 0x02
357#define DMA_EN 0x01
358#define DMA_128 (0 << 4)
359#define DMA_256 (1 << 4)
360#define DMA_512 (2 << 4)
361#define DMA_1024 (3 << 4)
362#define DMA_PACK_SIZE_MASK 0x30
363
364/* SSC_CTL1 */
365#define SSC_RSTB 0x80
366#define SSC_8X_EN 0x40
367#define SSC_FIX_FRAC 0x20
368#define SSC_SEL_1M 0x00
369#define SSC_SEL_2M 0x08
370#define SSC_SEL_4M 0x10
371#define SSC_SEL_8M 0x18
372
373/* SSC_CTL2 */
374#define SSC_DEPTH_MASK 0x07
375#define SSC_DEPTH_DISALBE 0x00
376#define SSC_DEPTH_4M 0x01
377#define SSC_DEPTH_2M 0x02
378#define SSC_DEPTH_1M 0x03
379#define SSC_DEPTH_500K 0x04
380#define SSC_DEPTH_250K 0x05
381
382/* System Clock Control Register */
383#define CLK_LOW_FREQ 0x01
384
385/* System Clock Divider Register */
386#define CLK_DIV_1 0x01
387#define CLK_DIV_2 0x02
388#define CLK_DIV_4 0x03
389#define CLK_DIV_8 0x04
390
391/* MS_CFG */
392#define SAMPLE_TIME_RISING 0x00
393#define SAMPLE_TIME_FALLING 0x80
394#define PUSH_TIME_DEFAULT 0x00
395#define PUSH_TIME_ODD 0x40
396#define NO_EXTEND_TOGGLE 0x00
397#define EXTEND_TOGGLE_CHK 0x20
398#define MS_BUS_WIDTH_1 0x00
399#define MS_BUS_WIDTH_4 0x10
400#define MS_BUS_WIDTH_8 0x18
401#define MS_2K_SECTOR_MODE 0x04
402#define MS_512_SECTOR_MODE 0x00
403#define MS_TOGGLE_TIMEOUT_EN 0x00
404#define MS_TOGGLE_TIMEOUT_DISEN 0x01
405#define MS_NO_CHECK_INT 0x02
406
407/* MS_TRANS_CFG */
408#define WAIT_INT 0x80
409#define NO_WAIT_INT 0x00
410#define NO_AUTO_READ_INT_REG 0x00
411#define AUTO_READ_INT_REG 0x40
412#define MS_CRC16_ERR 0x20
413#define MS_RDY_TIMEOUT 0x10
414#define MS_INT_CMDNK 0x08
415#define MS_INT_BREQ 0x04
416#define MS_INT_ERR 0x02
417#define MS_INT_CED 0x01
418
419/* MS_TRANSFER */
420#define MS_TRANSFER_START 0x80
421#define MS_TRANSFER_END 0x40
422#define MS_TRANSFER_ERR 0x20
423#define MS_BS_STATE 0x10
424#define MS_TM_READ_BYTES 0x00
425#define MS_TM_NORMAL_READ 0x01
426#define MS_TM_WRITE_BYTES 0x04
427#define MS_TM_NORMAL_WRITE 0x05
428#define MS_TM_AUTO_READ 0x08
429#define MS_TM_AUTO_WRITE 0x0C
430
431/* SD Configure 2 Register */
432#define SD_CALCULATE_CRC7 0x00
433#define SD_NO_CALCULATE_CRC7 0x80
434#define SD_CHECK_CRC16 0x00
435#define SD_NO_CHECK_CRC16 0x40
436#define SD_NO_CHECK_WAIT_CRC_TO 0x20
437#define SD_WAIT_BUSY_END 0x08
438#define SD_NO_WAIT_BUSY_END 0x00
439#define SD_CHECK_CRC7 0x00
440#define SD_NO_CHECK_CRC7 0x04
441#define SD_RSP_LEN_0 0x00
442#define SD_RSP_LEN_6 0x01
443#define SD_RSP_LEN_17 0x02
444/* SD/MMC Response Type Definition */
445#define SD_RSP_TYPE_R0 0x04
446#define SD_RSP_TYPE_R1 0x01
447#define SD_RSP_TYPE_R1b 0x09
448#define SD_RSP_TYPE_R2 0x02
449#define SD_RSP_TYPE_R3 0x05
450#define SD_RSP_TYPE_R4 0x05
451#define SD_RSP_TYPE_R5 0x01
452#define SD_RSP_TYPE_R6 0x01
453#define SD_RSP_TYPE_R7 0x01
454
455/* SD_CONFIURE3 */
456#define SD_RSP_80CLK_TIMEOUT_EN 0x01
457
458/* Card Transfer Reset Register */
459#define SPI_STOP 0x01
460#define XD_STOP 0x02
461#define SD_STOP 0x04
462#define MS_STOP 0x08
463#define SPI_CLR_ERR 0x10
464#define XD_CLR_ERR 0x20
465#define SD_CLR_ERR 0x40
466#define MS_CLR_ERR 0x80
467
468/* Card Data Source Register */
469#define PINGPONG_BUFFER 0x01
470#define RING_BUFFER 0x00
471
472/* Card Power Control Register */
473#define PMOS_STRG_MASK 0x10
474#define PMOS_STRG_800mA 0x10
475#define PMOS_STRG_400mA 0x00
476#define SD_POWER_OFF 0x03
477#define SD_PARTIAL_POWER_ON 0x01
478#define SD_POWER_ON 0x00
479#define SD_POWER_MASK 0x03
480#define MS_POWER_OFF 0x0C
481#define MS_PARTIAL_POWER_ON 0x04
482#define MS_POWER_ON 0x00
483#define MS_POWER_MASK 0x0C
484#define BPP_POWER_OFF 0x0F
485#define BPP_POWER_5_PERCENT_ON 0x0E
486#define BPP_POWER_10_PERCENT_ON 0x0C
487#define BPP_POWER_15_PERCENT_ON 0x08
488#define BPP_POWER_ON 0x00
489#define BPP_POWER_MASK 0x0F
490
491/* PWR_GATE_CTRL */
492#define PWR_GATE_EN 0x01
493#define LDO3318_PWR_MASK 0x06
494#define LDO_ON 0x00
495#define LDO_SUSPEND 0x04
496#define LDO_OFF 0x06
497
498/* CARD_CLK_SOURCE */
499#define CRC_FIX_CLK (0x00 << 0)
500#define CRC_VAR_CLK0 (0x01 << 0)
501#define CRC_VAR_CLK1 (0x02 << 0)
502#define SD30_FIX_CLK (0x00 << 2)
503#define SD30_VAR_CLK0 (0x01 << 2)
504#define SD30_VAR_CLK1 (0x02 << 2)
505#define SAMPLE_FIX_CLK (0x00 << 4)
506#define SAMPLE_VAR_CLK0 (0x01 << 4)
507#define SAMPLE_VAR_CLK1 (0x02 << 4)
508
509#define MS_CFG 0xFD40
510#define MS_TPC 0xFD41
511#define MS_TRANS_CFG 0xFD42
512#define MS_TRANSFER 0xFD43
513#define MS_INT_REG 0xFD44
514#define MS_BYTE_CNT 0xFD45
515#define MS_SECTOR_CNT_L 0xFD46
516#define MS_SECTOR_CNT_H 0xFD47
517#define MS_DBUS_H 0xFD48
518
519#define SD_CFG1 0xFDA0
520#define SD_CFG2 0xFDA1
521#define SD_CFG3 0xFDA2
522#define SD_STAT1 0xFDA3
523#define SD_STAT2 0xFDA4
524#define SD_BUS_STAT 0xFDA5
525#define SD_PAD_CTL 0xFDA6
526#define SD_SAMPLE_POINT_CTL 0xFDA7
527#define SD_PUSH_POINT_CTL 0xFDA8
528#define SD_CMD0 0xFDA9
529#define SD_CMD1 0xFDAA
530#define SD_CMD2 0xFDAB
531#define SD_CMD3 0xFDAC
532#define SD_CMD4 0xFDAD
533#define SD_CMD5 0xFDAE
534#define SD_BYTE_CNT_L 0xFDAF
535#define SD_BYTE_CNT_H 0xFDB0
536#define SD_BLOCK_CNT_L 0xFDB1
537#define SD_BLOCK_CNT_H 0xFDB2
538#define SD_TRANSFER 0xFDB3
539#define SD_CMD_STATE 0xFDB5
540#define SD_DATA_STATE 0xFDB6
541
542#define SRCTL 0xFC13
543
544#define DCM_DRP_CTL 0xFC23
545#define DCM_DRP_TRIG 0xFC24
546#define DCM_DRP_CFG 0xFC25
547#define DCM_DRP_WR_DATA_L 0xFC26
548#define DCM_DRP_WR_DATA_H 0xFC27
549#define DCM_DRP_RD_DATA_L 0xFC28
550#define DCM_DRP_RD_DATA_H 0xFC29
551#define SD_VPCLK0_CTL 0xFC2A
552#define SD_VPCLK1_CTL 0xFC2B
553#define SD_DCMPS0_CTL 0xFC2C
554#define SD_DCMPS1_CTL 0xFC2D
555#define SD_VPTX_CTL SD_VPCLK0_CTL
556#define SD_VPRX_CTL SD_VPCLK1_CTL
557#define SD_DCMPS_TX_CTL SD_DCMPS0_CTL
558#define SD_DCMPS_RX_CTL SD_DCMPS1_CTL
559#define CARD_CLK_SOURCE 0xFC2E
560
561#define CARD_PWR_CTL 0xFD50
562#define CARD_CLK_SWITCH 0xFD51
563#define CARD_SHARE_MODE 0xFD52
564#define CARD_DRIVE_SEL 0xFD53
565#define CARD_STOP 0xFD54
566#define CARD_OE 0xFD55
567#define CARD_AUTO_BLINK 0xFD56
568#define CARD_GPIO_DIR 0xFD57
569#define CARD_GPIO 0xFD58
570#define CARD_DATA_SOURCE 0xFD5B
571#define CARD_SELECT 0xFD5C
572#define SD30_DRIVE_SEL 0xFD5E
573#define CARD_CLK_EN 0xFD69
574#define SDIO_CTRL 0xFD6B
575#define CD_PAD_CTL 0xFD73
576
577#define FPDCTL 0xFC00
578#define PDINFO 0xFC01
579
580#define CLK_CTL 0xFC02
581#define CLK_DIV 0xFC03
582#define CLK_SEL 0xFC04
583
584#define SSC_DIV_N_0 0xFC0F
585#define SSC_DIV_N_1 0xFC10
586#define SSC_CTL1 0xFC11
587#define SSC_CTL2 0xFC12
588
589#define RCCTL 0xFC14
590
591#define FPGA_PULL_CTL 0xFC1D
592#define OLT_LED_CTL 0xFC1E
593#define GPIO_CTL 0xFC1F
594
595#define LDO_CTL 0xFC1E
596#define SYS_VER 0xFC32
597
598#define CARD_PULL_CTL1 0xFD60
599#define CARD_PULL_CTL2 0xFD61
600#define CARD_PULL_CTL3 0xFD62
601#define CARD_PULL_CTL4 0xFD63
602#define CARD_PULL_CTL5 0xFD64
603#define CARD_PULL_CTL6 0xFD65
604
605/* PCI Express Related Registers */
606#define IRQEN0 0xFE20
607#define IRQSTAT0 0xFE21
608#define IRQEN1 0xFE22
609#define IRQSTAT1 0xFE23
610#define TLPRIEN 0xFE24
611#define TLPRISTAT 0xFE25
612#define TLPTIEN 0xFE26
613#define TLPTISTAT 0xFE27
614#define DMATC0 0xFE28
615#define DMATC1 0xFE29
616#define DMATC2 0xFE2A
617#define DMATC3 0xFE2B
618#define DMACTL 0xFE2C
619#define BCTL 0xFE2D
620#define RBBC0 0xFE2E
621#define RBBC1 0xFE2F
622#define RBDAT 0xFE30
623#define RBCTL 0xFE34
624#define CFGADDR0 0xFE35
625#define CFGADDR1 0xFE36
626#define CFGDATA0 0xFE37
627#define CFGDATA1 0xFE38
628#define CFGDATA2 0xFE39
629#define CFGDATA3 0xFE3A
630#define CFGRWCTL 0xFE3B
631#define PHYRWCTL 0xFE3C
632#define PHYDATA0 0xFE3D
633#define PHYDATA1 0xFE3E
634#define PHYADDR 0xFE3F
635#define MSGRXDATA0 0xFE40
636#define MSGRXDATA1 0xFE41
637#define MSGRXDATA2 0xFE42
638#define MSGRXDATA3 0xFE43
639#define MSGTXDATA0 0xFE44
640#define MSGTXDATA1 0xFE45
641#define MSGTXDATA2 0xFE46
642#define MSGTXDATA3 0xFE47
643#define MSGTXCTL 0xFE48
644#define PETXCFG 0xFE49
645
646#define CDRESUMECTL 0xFE52
647#define WAKE_SEL_CTL 0xFE54
648#define PME_FORCE_CTL 0xFE56
649#define ASPM_FORCE_CTL 0xFE57
650#define PM_CLK_FORCE_CTL 0xFE58
651#define PERST_GLITCH_WIDTH 0xFE5C
652#define CHANGE_LINK_STATE 0xFE5B
653#define RESET_LOAD_REG 0xFE5E
654#define EFUSE_CONTENT 0xFE5F
655#define HOST_SLEEP_STATE 0xFE60
656#define SDIO_CFG 0xFE70
657
658#define NFTS_TX_CTRL 0xFE72
659
660#define PWR_GATE_CTRL 0xFE75
661#define PWD_SUSPEND_EN 0xFE76
662#define LDO_PWR_SEL 0xFE78
663
664#define DUMMY_REG_RESET_0 0xFE90
665
666/* Memory mapping */
667#define SRAM_BASE 0xE600
668#define RBUF_BASE 0xF400
669#define PPBUF_BASE1 0xF800
670#define PPBUF_BASE2 0xFA00
671#define IMAGE_FLAG_ADDR0 0xCE80
672#define IMAGE_FLAG_ADDR1 0xCE81
673
674#define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0)
675
676struct rtsx_pcr;
677
678struct pcr_handle {
679 struct rtsx_pcr *pcr;
680};
681
682struct pcr_ops {
683 int (*extra_init_hw)(struct rtsx_pcr *pcr);
684 int (*optimize_phy)(struct rtsx_pcr *pcr);
685 int (*turn_on_led)(struct rtsx_pcr *pcr);
686 int (*turn_off_led)(struct rtsx_pcr *pcr);
687 int (*enable_auto_blink)(struct rtsx_pcr *pcr);
688 int (*disable_auto_blink)(struct rtsx_pcr *pcr);
689 int (*card_power_on)(struct rtsx_pcr *pcr, int card);
690 int (*card_power_off)(struct rtsx_pcr *pcr, int card);
691 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
692};
693
694enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
695
696struct rtsx_pcr {
697 struct pci_dev *pci;
698 unsigned int id;
699
700 /* pci resources */
701 unsigned long addr;
702 void __iomem *remap_addr;
703 int irq;
704
705 /* host reserved buffer */
706 void *rtsx_resv_buf;
707 dma_addr_t rtsx_resv_buf_addr;
708
709 void *host_cmds_ptr;
710 dma_addr_t host_cmds_addr;
711 int ci;
712
713 void *host_sg_tbl_ptr;
714 dma_addr_t host_sg_tbl_addr;
715 int sgi;
716
717 u32 bier;
718 char trans_result;
719
720 unsigned int card_inserted;
721 unsigned int card_removed;
722
723 struct delayed_work carddet_work;
724 struct delayed_work idle_work;
725
726 spinlock_t lock;
727 struct mutex pcr_mutex;
728 struct completion *done;
729 struct completion *finish_me;
730
731 unsigned int cur_clock;
732 bool ms_pmos;
733 bool remove_pci;
734 bool msi_en;
735
736#define EXTRA_CAPS_SD_SDR50 (1 << 0)
737#define EXTRA_CAPS_SD_SDR104 (1 << 1)
738#define EXTRA_CAPS_SD_DDR50 (1 << 2)
739#define EXTRA_CAPS_MMC_HSDDR (1 << 3)
740#define EXTRA_CAPS_MMC_HS200 (1 << 4)
741#define EXTRA_CAPS_MMC_8BIT (1 << 5)
742 u32 extra_caps;
743
744#define IC_VER_A 0
745#define IC_VER_B 1
746#define IC_VER_C 2
747#define IC_VER_D 3
748 u8 ic_version;
749
750 const u32 *sd_pull_ctl_enable_tbl;
751 const u32 *sd_pull_ctl_disable_tbl;
752 const u32 *ms_pull_ctl_enable_tbl;
753 const u32 *ms_pull_ctl_disable_tbl;
754
755 const struct pcr_ops *ops;
756 enum PDEV_STAT state;
757
758 int num_slots;
759 struct rtsx_slot *slots;
760};
761
762#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
763#define PCI_VID(pcr) ((pcr)->pci->vendor)
764#define PCI_PID(pcr) ((pcr)->pci->device)
765
766void rtsx_pci_start_run(struct rtsx_pcr *pcr);
767int rtsx_pci_write_register(struct rtsx_pcr *pcr, u16 addr, u8 mask, u8 data);
768int rtsx_pci_read_register(struct rtsx_pcr *pcr, u16 addr, u8 *data);
769int rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val);
770int rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val);
771void rtsx_pci_stop_cmd(struct rtsx_pcr *pcr);
772void rtsx_pci_add_cmd(struct rtsx_pcr *pcr,
773 u8 cmd_type, u16 reg_addr, u8 mask, u8 data);
774void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
775int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
776int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
777 int num_sg, bool read, int timeout);
778int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
779int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
780int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
781int rtsx_pci_card_pull_ctl_disable(struct rtsx_pcr *pcr, int card);
782int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
786unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
787void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
788
789static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr)
790{
791 return (u8 *)(pcr->host_cmds_ptr);
792}
793
794#endif
diff --git a/include/linux/mfd/sta2x11-mfd.h b/include/linux/mfd/sta2x11-mfd.h
index d179227e866..9a855ac11cb 100644
--- a/include/linux/mfd/sta2x11-mfd.h
+++ b/include/linux/mfd/sta2x11-mfd.h
@@ -26,6 +26,28 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28 28
29enum sta2x11_mfd_plat_dev {
30 sta2x11_sctl = 0,
31 sta2x11_gpio,
32 sta2x11_scr,
33 sta2x11_time,
34 sta2x11_apbreg,
35 sta2x11_apb_soc_regs,
36 sta2x11_vic,
37 sta2x11_n_mfd_plat_devs,
38};
39
40#define STA2X11_MFD_SCTL_NAME "sta2x11-sctl"
41#define STA2X11_MFD_GPIO_NAME "sta2x11-gpio"
42#define STA2X11_MFD_SCR_NAME "sta2x11-scr"
43#define STA2X11_MFD_TIME_NAME "sta2x11-time"
44#define STA2X11_MFD_APBREG_NAME "sta2x11-apbreg"
45#define STA2X11_MFD_APB_SOC_REGS_NAME "sta2x11-apb-soc-regs"
46#define STA2X11_MFD_VIC_NAME "sta2x11-vic"
47
48extern u32
49__sta2x11_mfd_mask(struct pci_dev *, u32, u32, u32, enum sta2x11_mfd_plat_dev);
50
29/* 51/*
30 * The MFD PCI block includes the GPIO peripherals and other register blocks. 52 * The MFD PCI block includes the GPIO peripherals and other register blocks.
31 * For GPIO, we have 32*4 bits (I use "gsta" for "gpio sta2x11".) 53 * For GPIO, we have 32*4 bits (I use "gsta" for "gpio sta2x11".)
@@ -182,7 +204,11 @@ struct sta2x11_gpio_pdata {
182 * The APB bridge has its own registers, needed by our users as well. 204 * The APB bridge has its own registers, needed by our users as well.
183 * They are accessed with the following read/mask/write function. 205 * They are accessed with the following read/mask/write function.
184 */ 206 */
185u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); 207static inline u32
208sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
209{
210 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_apbreg);
211}
186 212
187/* CAN and MLB */ 213/* CAN and MLB */
188#define APBREG_BSR 0x00 /* Bridge Status Reg */ 214#define APBREG_BSR 0x00 /* Bridge Status Reg */
@@ -211,19 +237,45 @@ u32 sta2x11_apbreg_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val);
211 * The system controller has its own registers. Some of these are accessed 237 * The system controller has its own registers. Some of these are accessed
212 * by out users as well, using the following read/mask/write/function 238 * by out users as well, using the following read/mask/write/function
213 */ 239 */
214u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val); 240static inline
241u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
242{
243 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_sctl);
244}
215 245
216#define SCTL_SCCTL 0x00 /* System controller control register */ 246#define SCTL_SCCTL 0x00 /* System controller control register */
217#define SCTL_ARMCFG 0x04 /* ARM configuration register */ 247#define SCTL_ARMCFG 0x04 /* ARM configuration register */
218#define SCTL_SCPLLCTL 0x08 /* PLL control status register */ 248#define SCTL_SCPLLCTL 0x08 /* PLL control status register */
249
250#define SCTL_SCPLLCTL_AUDIO_PLL_PD BIT(1)
251#define SCTL_SCPLLCTL_FRAC_CONTROL BIT(3)
252#define SCTL_SCPLLCTL_STRB_BYPASS BIT(6)
253#define SCTL_SCPLLCTL_STRB_INPUT BIT(8)
254
219#define SCTL_SCPLLFCTRL 0x0c /* PLL frequency control register */ 255#define SCTL_SCPLLFCTRL 0x0c /* PLL frequency control register */
256
257#define SCTL_SCPLLFCTRL_AUDIO_PLL_NDIV_MASK 0xff
258#define SCTL_SCPLLFCTRL_AUDIO_PLL_NDIV_SHIFT 10
259#define SCTL_SCPLLFCTRL_AUDIO_PLL_IDF_MASK 7
260#define SCTL_SCPLLFCTRL_AUDIO_PLL_IDF_SHIFT 21
261#define SCTL_SCPLLFCTRL_AUDIO_PLL_ODF_MASK 7
262#define SCTL_SCPLLFCTRL_AUDIO_PLL_ODF_SHIFT 18
263#define SCTL_SCPLLFCTRL_DITHER_DISABLE_MASK 0x03
264#define SCTL_SCPLLFCTRL_DITHER_DISABLE_SHIFT 4
265
266
220#define SCTL_SCRESFRACT 0x10 /* PLL fractional input register */ 267#define SCTL_SCRESFRACT 0x10 /* PLL fractional input register */
268
269#define SCTL_SCRESFRACT_MASK 0x0000ffff
270
271
221#define SCTL_SCRESCTRL1 0x14 /* Peripheral reset control 1 */ 272#define SCTL_SCRESCTRL1 0x14 /* Peripheral reset control 1 */
222#define SCTL_SCRESXTRL2 0x18 /* Peripheral reset control 2 */ 273#define SCTL_SCRESXTRL2 0x18 /* Peripheral reset control 2 */
223#define SCTL_SCPEREN0 0x1c /* Peripheral clock enable register 0 */ 274#define SCTL_SCPEREN0 0x1c /* Peripheral clock enable register 0 */
224#define SCTL_SCPEREN1 0x20 /* Peripheral clock enable register 1 */ 275#define SCTL_SCPEREN1 0x20 /* Peripheral clock enable register 1 */
225#define SCTL_SCPEREN2 0x24 /* Peripheral clock enable register 2 */ 276#define SCTL_SCPEREN2 0x24 /* Peripheral clock enable register 2 */
226#define SCTL_SCGRST 0x28 /* Peripheral global reset */ 277#define SCTL_SCGRST 0x28 /* Peripheral global reset */
278#define SCTL_SCPCIECSBRST 0x2c /* PCIe PAB CSB reset status register */
227#define SCTL_SCPCIPMCR1 0x30 /* PCI power management control 1 */ 279#define SCTL_SCPCIPMCR1 0x30 /* PCI power management control 1 */
228#define SCTL_SCPCIPMCR2 0x34 /* PCI power management control 2 */ 280#define SCTL_SCPCIPMCR2 0x34 /* PCI power management control 2 */
229#define SCTL_SCPCIPMSR1 0x38 /* PCI power management status 1 */ 281#define SCTL_SCPCIPMSR1 0x38 /* PCI power management status 1 */
@@ -321,4 +373,146 @@ u32 sta2x11_sctl_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val);
321#define SCTL_SCPEREN1_I2C3 (1 << 16) 373#define SCTL_SCPEREN1_I2C3 (1 << 16)
322#define SCTL_SCPEREN1_USB_PHY (1 << 17) 374#define SCTL_SCPEREN1_USB_PHY (1 << 17)
323 375
376/*
377 * APB-SOC registers
378 */
379static inline
380u32 sta2x11_apb_soc_regs_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val)
381{
382 return __sta2x11_mfd_mask(pdev, reg, mask, val, sta2x11_apb_soc_regs);
383}
384
385#define PCIE_EP1_FUNC3_0_INTR_REG 0x000
386#define PCIE_EP1_FUNC7_4_INTR_REG 0x004
387#define PCIE_EP2_FUNC3_0_INTR_REG 0x008
388#define PCIE_EP2_FUNC7_4_INTR_REG 0x00c
389#define PCIE_EP3_FUNC3_0_INTR_REG 0x010
390#define PCIE_EP3_FUNC7_4_INTR_REG 0x014
391#define PCIE_EP4_FUNC3_0_INTR_REG 0x018
392#define PCIE_EP4_FUNC7_4_INTR_REG 0x01c
393#define PCIE_INTR_ENABLE0_REG 0x020
394#define PCIE_INTR_ENABLE1_REG 0x024
395#define PCIE_EP1_FUNC_TC_REG 0x028
396#define PCIE_EP2_FUNC_TC_REG 0x02c
397#define PCIE_EP3_FUNC_TC_REG 0x030
398#define PCIE_EP4_FUNC_TC_REG 0x034
399#define PCIE_EP1_FUNC_F_REG 0x038
400#define PCIE_EP2_FUNC_F_REG 0x03c
401#define PCIE_EP3_FUNC_F_REG 0x040
402#define PCIE_EP4_FUNC_F_REG 0x044
403#define PCIE_PAB_AMBA_SW_RST_REG 0x048
404#define PCIE_PM_STATUS_0_PORT_0_4 0x04c
405#define PCIE_PM_STATUS_7_0_EP1 0x050
406#define PCIE_PM_STATUS_7_0_EP2 0x054
407#define PCIE_PM_STATUS_7_0_EP3 0x058
408#define PCIE_PM_STATUS_7_0_EP4 0x05c
409#define PCIE_DEV_ID_0_EP1_REG 0x060
410#define PCIE_CC_REV_ID_0_EP1_REG 0x064
411#define PCIE_DEV_ID_1_EP1_REG 0x068
412#define PCIE_CC_REV_ID_1_EP1_REG 0x06c
413#define PCIE_DEV_ID_2_EP1_REG 0x070
414#define PCIE_CC_REV_ID_2_EP1_REG 0x074
415#define PCIE_DEV_ID_3_EP1_REG 0x078
416#define PCIE_CC_REV_ID_3_EP1_REG 0x07c
417#define PCIE_DEV_ID_4_EP1_REG 0x080
418#define PCIE_CC_REV_ID_4_EP1_REG 0x084
419#define PCIE_DEV_ID_5_EP1_REG 0x088
420#define PCIE_CC_REV_ID_5_EP1_REG 0x08c
421#define PCIE_DEV_ID_6_EP1_REG 0x090
422#define PCIE_CC_REV_ID_6_EP1_REG 0x094
423#define PCIE_DEV_ID_7_EP1_REG 0x098
424#define PCIE_CC_REV_ID_7_EP1_REG 0x09c
425#define PCIE_DEV_ID_0_EP2_REG 0x0a0
426#define PCIE_CC_REV_ID_0_EP2_REG 0x0a4
427#define PCIE_DEV_ID_1_EP2_REG 0x0a8
428#define PCIE_CC_REV_ID_1_EP2_REG 0x0ac
429#define PCIE_DEV_ID_2_EP2_REG 0x0b0
430#define PCIE_CC_REV_ID_2_EP2_REG 0x0b4
431#define PCIE_DEV_ID_3_EP2_REG 0x0b8
432#define PCIE_CC_REV_ID_3_EP2_REG 0x0bc
433#define PCIE_DEV_ID_4_EP2_REG 0x0c0
434#define PCIE_CC_REV_ID_4_EP2_REG 0x0c4
435#define PCIE_DEV_ID_5_EP2_REG 0x0c8
436#define PCIE_CC_REV_ID_5_EP2_REG 0x0cc
437#define PCIE_DEV_ID_6_EP2_REG 0x0d0
438#define PCIE_CC_REV_ID_6_EP2_REG 0x0d4
439#define PCIE_DEV_ID_7_EP2_REG 0x0d8
440#define PCIE_CC_REV_ID_7_EP2_REG 0x0dC
441#define PCIE_DEV_ID_0_EP3_REG 0x0e0
442#define PCIE_CC_REV_ID_0_EP3_REG 0x0e4
443#define PCIE_DEV_ID_1_EP3_REG 0x0e8
444#define PCIE_CC_REV_ID_1_EP3_REG 0x0ec
445#define PCIE_DEV_ID_2_EP3_REG 0x0f0
446#define PCIE_CC_REV_ID_2_EP3_REG 0x0f4
447#define PCIE_DEV_ID_3_EP3_REG 0x0f8
448#define PCIE_CC_REV_ID_3_EP3_REG 0x0fc
449#define PCIE_DEV_ID_4_EP3_REG 0x100
450#define PCIE_CC_REV_ID_4_EP3_REG 0x104
451#define PCIE_DEV_ID_5_EP3_REG 0x108
452#define PCIE_CC_REV_ID_5_EP3_REG 0x10c
453#define PCIE_DEV_ID_6_EP3_REG 0x110
454#define PCIE_CC_REV_ID_6_EP3_REG 0x114
455#define PCIE_DEV_ID_7_EP3_REG 0x118
456#define PCIE_CC_REV_ID_7_EP3_REG 0x11c
457#define PCIE_DEV_ID_0_EP4_REG 0x120
458#define PCIE_CC_REV_ID_0_EP4_REG 0x124
459#define PCIE_DEV_ID_1_EP4_REG 0x128
460#define PCIE_CC_REV_ID_1_EP4_REG 0x12c
461#define PCIE_DEV_ID_2_EP4_REG 0x130
462#define PCIE_CC_REV_ID_2_EP4_REG 0x134
463#define PCIE_DEV_ID_3_EP4_REG 0x138
464#define PCIE_CC_REV_ID_3_EP4_REG 0x13c
465#define PCIE_DEV_ID_4_EP4_REG 0x140
466#define PCIE_CC_REV_ID_4_EP4_REG 0x144
467#define PCIE_DEV_ID_5_EP4_REG 0x148
468#define PCIE_CC_REV_ID_5_EP4_REG 0x14c
469#define PCIE_DEV_ID_6_EP4_REG 0x150
470#define PCIE_CC_REV_ID_6_EP4_REG 0x154
471#define PCIE_DEV_ID_7_EP4_REG 0x158
472#define PCIE_CC_REV_ID_7_EP4_REG 0x15c
473#define PCIE_SUBSYS_VEN_ID_REG 0x160
474#define PCIE_COMMON_CLOCK_CONFIG_0_4_0 0x164
475#define PCIE_MIPHYP_SSC_EN_REG 0x168
476#define PCIE_MIPHYP_ADDR_REG 0x16c
477#define PCIE_L1_ASPM_READY_REG 0x170
478#define PCIE_EXT_CFG_RDY_REG 0x174
479#define PCIE_SoC_INT_ROUTER_STATUS0_REG 0x178
480#define PCIE_SoC_INT_ROUTER_STATUS1_REG 0x17c
481#define PCIE_SoC_INT_ROUTER_STATUS2_REG 0x180
482#define PCIE_SoC_INT_ROUTER_STATUS3_REG 0x184
483#define DMA_IP_CTRL_REG 0x324
484#define DISP_BRIDGE_PU_PD_CTRL_REG 0x328
485#define VIP_PU_PD_CTRL_REG 0x32c
486#define USB_MLB_PU_PD_CTRL_REG 0x330
487#define SDIO_PU_PD_MISCFUNC_CTRL_REG1 0x334
488#define SDIO_PU_PD_MISCFUNC_CTRL_REG2 0x338
489#define UART_PU_PD_CTRL_REG 0x33c
490#define ARM_Lock 0x340
491#define SYS_IO_CHAR_REG1 0x344
492#define SYS_IO_CHAR_REG2 0x348
493#define SATA_CORE_ID_REG 0x34c
494#define SATA_CTRL_REG 0x350
495#define I2C_HSFIX_MISC_REG 0x354
496#define SPARE2_RESERVED 0x358
497#define SPARE3_RESERVED 0x35c
498#define MASTER_LOCK_REG 0x368
499#define SYSTEM_CONFIG_STATUS_REG 0x36c
500#define MSP_CLK_CTRL_REG 0x39c
501#define COMPENSATION_REG1 0x3c4
502#define COMPENSATION_REG2 0x3c8
503#define COMPENSATION_REG3 0x3cc
504#define TEST_CTL_REG 0x3d0
505
506/*
507 * SECR (OTP) registers
508 */
509#define STA2X11_SECR_CR 0x00
510#define STA2X11_SECR_FVR0 0x10
511#define STA2X11_SECR_FVR1 0x14
512
513extern int sta2x11_mfd_get_regs_data(struct platform_device *pdev,
514 enum sta2x11_mfd_plat_dev index,
515 void __iomem **regs,
516 spinlock_t **lock);
517
324#endif /* __STA2X11_MFD_H */ 518#endif /* __STA2X11_MFD_H */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index f8d5b4d5843..383ac1512a3 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -62,6 +62,7 @@ struct stmpe_client_info;
62 * @lock: lock protecting I/O operations 62 * @lock: lock protecting I/O operations
63 * @irq_lock: IRQ bus lock 63 * @irq_lock: IRQ bus lock
64 * @dev: device, mostly for dev_dbg() 64 * @dev: device, mostly for dev_dbg()
65 * @irq_domain: IRQ domain
65 * @client: client - i2c or spi 66 * @client: client - i2c or spi
66 * @ci: client specific information 67 * @ci: client specific information
67 * @partnum: part number 68 * @partnum: part number
@@ -79,6 +80,7 @@ struct stmpe {
79 struct mutex lock; 80 struct mutex lock;
80 struct mutex irq_lock; 81 struct mutex irq_lock;
81 struct device *dev; 82 struct device *dev;
83 struct irq_domain *domain;
82 void *client; 84 void *client;
83 struct stmpe_client_info *ci; 85 struct stmpe_client_info *ci;
84 enum stmpe_partnum partnum; 86 enum stmpe_partnum partnum;
@@ -188,7 +190,6 @@ struct stmpe_ts_platform_data {
188 * @id: device id to distinguish between multiple STMPEs on the same board 190 * @id: device id to distinguish between multiple STMPEs on the same board
189 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*) 191 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
190 * @irq_trigger: IRQ trigger to use for the interrupt to the host 192 * @irq_trigger: IRQ trigger to use for the interrupt to the host
191 * @irq_invert_polarity: IRQ line is connected with reversed polarity
192 * @autosleep: bool to enable/disable stmpe autosleep 193 * @autosleep: bool to enable/disable stmpe autosleep
193 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 194 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
194 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or 195 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
@@ -205,7 +206,6 @@ struct stmpe_platform_data {
205 unsigned int blocks; 206 unsigned int blocks;
206 int irq_base; 207 int irq_base;
207 unsigned int irq_trigger; 208 unsigned int irq_trigger;
208 bool irq_invert_polarity;
209 bool autosleep; 209 bool autosleep;
210 bool irq_over_gpio; 210 bool irq_over_gpio;
211 int irq_gpio; 211 int irq_gpio;
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
new file mode 100644
index 00000000000..c79ad5d2f27
--- /dev/null
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -0,0 +1,152 @@
1#ifndef __LINUX_TI_AM335X_TSCADC_MFD_H
2#define __LINUX_TI_AM335X_TSCADC_MFD_H
3
4/*
5 * TI Touch Screen / ADC MFD driver
6 *
7 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.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 as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/mfd/core.h>
20
21#define REG_RAWIRQSTATUS 0x024
22#define REG_IRQSTATUS 0x028
23#define REG_IRQENABLE 0x02C
24#define REG_IRQCLR 0x030
25#define REG_IRQWAKEUP 0x034
26#define REG_CTRL 0x040
27#define REG_ADCFSM 0x044
28#define REG_CLKDIV 0x04C
29#define REG_SE 0x054
30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8))
35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0
38#define REG_FIFO1THR 0xF4
39#define REG_FIFO0 0x100
40#define REG_FIFO1 0x200
41
42/* Register Bitfields */
43/* IRQ wakeup enable */
44#define IRQWKUP_ENB BIT(0)
45
46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51
52/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0)
54#define IRQENB_FIFO0THRES BIT(2)
55#define IRQENB_FIFO1THRES BIT(5)
56#define IRQENB_PENUP BIT(9)
57
58/* Step Configuration */
59#define STEPCONFIG_MODE_MASK (3 << 0)
60#define STEPCONFIG_MODE(val) ((val) << 0)
61#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
62#define STEPCONFIG_AVG_MASK (7 << 2)
63#define STEPCONFIG_AVG(val) ((val) << 2)
64#define STEPCONFIG_AVG_16 STEPCONFIG_AVG(4)
65#define STEPCONFIG_XPP BIT(5)
66#define STEPCONFIG_XNN BIT(6)
67#define STEPCONFIG_YPP BIT(7)
68#define STEPCONFIG_YNN BIT(8)
69#define STEPCONFIG_XNP BIT(9)
70#define STEPCONFIG_YPN BIT(10)
71#define STEPCONFIG_INM_MASK (0xF << 15)
72#define STEPCONFIG_INM(val) ((val) << 15)
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26)
81
82/* Delay register */
83#define STEPDELAY_OPEN_MASK (0x3FFFF << 0)
84#define STEPDELAY_OPEN(val) ((val) << 0)
85#define STEPCONFIG_OPENDLY STEPDELAY_OPEN(0x098)
86#define STEPDELAY_SAMPLE_MASK (0xFF << 24)
87#define STEPDELAY_SAMPLE(val) ((val) << 24)
88#define STEPCONFIG_SAMPLEDLY STEPDELAY_SAMPLE(0)
89
90/* Charge Config */
91#define STEPCHARGE_RFP_MASK (7 << 12)
92#define STEPCHARGE_RFP(val) ((val) << 12)
93#define STEPCHARGE_RFP_XPUL STEPCHARGE_RFP(1)
94#define STEPCHARGE_INM_MASK (0xF << 15)
95#define STEPCHARGE_INM(val) ((val) << 15)
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
103
104/* Charge delay */
105#define CHARGEDLY_OPEN_MASK (0x3FFFF << 0)
106#define CHARGEDLY_OPEN(val) ((val) << 0)
107#define CHARGEDLY_OPENDLY CHARGEDLY_OPEN(1)
108
109/* Control register */
110#define CNTRLREG_TSCSSENB BIT(0)
111#define CNTRLREG_STEPID BIT(1)
112#define CNTRLREG_STEPCONFIGWRT BIT(2)
113#define CNTRLREG_POWERDOWN BIT(4)
114#define CNTRLREG_AFE_CTRL_MASK (3 << 5)
115#define CNTRLREG_AFE_CTRL(val) ((val) << 5)
116#define CNTRLREG_4WIRE CNTRLREG_AFE_CTRL(1)
117#define CNTRLREG_5WIRE CNTRLREG_AFE_CTRL(2)
118#define CNTRLREG_8WIRE CNTRLREG_AFE_CTRL(3)
119#define CNTRLREG_TSCENB BIT(7)
120
121#define ADC_CLK 3000000
122#define MAX_CLK_DIV 7
123#define TOTAL_STEPS 16
124#define TOTAL_CHANNELS 8
125
126#define TSCADC_CELLS 2
127
128enum tscadc_cells {
129 TSC_CELL,
130 ADC_CELL,
131};
132
133struct mfd_tscadc_board {
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137
138struct ti_tscadc_dev {
139 struct device *dev;
140 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base;
142 int irq;
143 struct mfd_cell cells[TSCADC_CELLS];
144
145 /* tsc device */
146 struct titsc *tsc;
147
148 /* adc device */
149 struct adc_device *adc;
150};
151
152#endif
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 6bc31d85462..6694cf43e8b 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -23,37 +23,109 @@
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/regmap.h>
27
28/* TPS65090 IRQs */
29enum {
30 TPS65090_IRQ_VAC_STATUS_CHANGE,
31 TPS65090_IRQ_VSYS_STATUS_CHANGE,
32 TPS65090_IRQ_BAT_STATUS_CHANGE,
33 TPS65090_IRQ_CHARGING_STATUS_CHANGE,
34 TPS65090_IRQ_CHARGING_COMPLETE,
35 TPS65090_IRQ_OVERLOAD_DCDC1,
36 TPS65090_IRQ_OVERLOAD_DCDC2,
37 TPS65090_IRQ_OVERLOAD_DCDC3,
38 TPS65090_IRQ_OVERLOAD_FET1,
39 TPS65090_IRQ_OVERLOAD_FET2,
40 TPS65090_IRQ_OVERLOAD_FET3,
41 TPS65090_IRQ_OVERLOAD_FET4,
42 TPS65090_IRQ_OVERLOAD_FET5,
43 TPS65090_IRQ_OVERLOAD_FET6,
44 TPS65090_IRQ_OVERLOAD_FET7,
45};
46
47/* TPS65090 Regulator ID */
48enum {
49 TPS65090_REGULATOR_DCDC1,
50 TPS65090_REGULATOR_DCDC2,
51 TPS65090_REGULATOR_DCDC3,
52 TPS65090_REGULATOR_FET1,
53 TPS65090_REGULATOR_FET2,
54 TPS65090_REGULATOR_FET3,
55 TPS65090_REGULATOR_FET4,
56 TPS65090_REGULATOR_FET5,
57 TPS65090_REGULATOR_FET6,
58 TPS65090_REGULATOR_FET7,
59 TPS65090_REGULATOR_LDO1,
60 TPS65090_REGULATOR_LDO2,
61
62 /* Last entry for maximum ID */
63 TPS65090_REGULATOR_MAX,
64};
26 65
27struct tps65090 { 66struct tps65090 {
28 struct mutex lock;
29 struct device *dev; 67 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap; 68 struct regmap *rmap;
32 struct irq_chip irq_chip; 69 struct regmap_irq_chip_data *irq_data;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36}; 70};
37 71
38struct tps65090_subdev_info { 72/*
39 int id; 73 * struct tps65090_regulator_plat_data
40 const char *name; 74 *
41 void *platform_data; 75 * @reg_init_data: The regulator init data.
76 * @enable_ext_control: Enable extrenal control or not. Only available for
77 * DCDC1, DCDC2 and DCDC3.
78 * @gpio: Gpio number if external control is enabled and controlled through
79 * gpio.
80 */
81struct tps65090_regulator_plat_data {
82 struct regulator_init_data *reg_init_data;
83 bool enable_ext_control;
84 int gpio;
42}; 85};
43 86
44struct tps65090_platform_data { 87struct tps65090_platform_data {
45 int irq_base; 88 int irq_base;
46 int num_subdevs; 89 struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];
47 struct tps65090_subdev_info *subdevs;
48}; 90};
49 91
50/* 92/*
51 * NOTE: the functions below are not intended for use outside 93 * NOTE: the functions below are not intended for use outside
52 * of the TPS65090 sub-device drivers 94 * of the TPS65090 sub-device drivers
53 */ 95 */
54extern int tps65090_write(struct device *dev, int reg, uint8_t val); 96static inline int tps65090_write(struct device *dev, int reg, uint8_t val)
55extern int tps65090_read(struct device *dev, int reg, uint8_t *val); 97{
56extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); 98 struct tps65090 *tps = dev_get_drvdata(dev);
57extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); 99
100 return regmap_write(tps->rmap, reg, val);
101}
102
103static inline int tps65090_read(struct device *dev, int reg, uint8_t *val)
104{
105 struct tps65090 *tps = dev_get_drvdata(dev);
106 unsigned int temp_val;
107 int ret;
108
109 ret = regmap_read(tps->rmap, reg, &temp_val);
110 if (!ret)
111 *val = temp_val;
112 return ret;
113}
114
115static inline int tps65090_set_bits(struct device *dev, int reg,
116 uint8_t bit_num)
117{
118 struct tps65090 *tps = dev_get_drvdata(dev);
119
120 return regmap_update_bits(tps->rmap, reg, BIT(bit_num), ~0u);
121}
122
123static inline int tps65090_clr_bits(struct device *dev, int reg,
124 uint8_t bit_num)
125{
126 struct tps65090 *tps = dev_get_drvdata(dev);
127
128 return regmap_update_bits(tps->rmap, reg, BIT(bit_num), 0u);
129}
58 130
59#endif /*__LINUX_MFD_TPS65090_H */ 131#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index 2dd12319495..87994542573 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -29,6 +29,7 @@ enum {
29 TPS6586X_ID_LDO_8, 29 TPS6586X_ID_LDO_8,
30 TPS6586X_ID_LDO_9, 30 TPS6586X_ID_LDO_9,
31 TPS6586X_ID_LDO_RTC, 31 TPS6586X_ID_LDO_RTC,
32 TPS6586X_ID_MAX_REGULATOR,
32}; 33};
33 34
34enum { 35enum {
@@ -79,6 +80,8 @@ struct tps6586x_platform_data {
79 int gpio_base; 80 int gpio_base;
80 int irq_base; 81 int irq_base;
81 bool pm_off; 82 bool pm_off;
83
84 struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR];
82}; 85};
83 86
84/* 87/*
@@ -93,5 +96,6 @@ extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
93extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 96extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
94extern int tps6586x_update(struct device *dev, int reg, uint8_t val, 97extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
95 uint8_t mask); 98 uint8_t mask);
99extern int tps6586x_irq_get_virq(struct device *dev, int irq);
96 100
97#endif /*__LINUX_MFD_TPS6586X_H */ 101#endif /*__LINUX_MFD_TPS6586X_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 02e894f3ff4..20e433e551e 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -572,6 +572,49 @@
572#define SPARE_SPARE_MASK 0xFF 572#define SPARE_SPARE_MASK 0xFF
573#define SPARE_SPARE_SHIFT 0 573#define SPARE_SPARE_SHIFT 0
574 574
575#define TPS65910_INT_STS_RTC_PERIOD_IT_MASK 0x80
576#define TPS65910_INT_STS_RTC_PERIOD_IT_SHIFT 7
577#define TPS65910_INT_STS_RTC_ALARM_IT_MASK 0x40
578#define TPS65910_INT_STS_RTC_ALARM_IT_SHIFT 6
579#define TPS65910_INT_STS_HOTDIE_IT_MASK 0x20
580#define TPS65910_INT_STS_HOTDIE_IT_SHIFT 5
581#define TPS65910_INT_STS_PWRHOLD_F_IT_MASK 0x10
582#define TPS65910_INT_STS_PWRHOLD_F_IT_SHIFT 4
583#define TPS65910_INT_STS_PWRON_LP_IT_MASK 0x08
584#define TPS65910_INT_STS_PWRON_LP_IT_SHIFT 3
585#define TPS65910_INT_STS_PWRON_IT_MASK 0x04
586#define TPS65910_INT_STS_PWRON_IT_SHIFT 2
587#define TPS65910_INT_STS_VMBHI_IT_MASK 0x02
588#define TPS65910_INT_STS_VMBHI_IT_SHIFT 1
589#define TPS65910_INT_STS_VMBDCH_IT_MASK 0x01
590#define TPS65910_INT_STS_VMBDCH_IT_SHIFT 0
591
592#define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_MASK 0x80
593#define TPS65910_INT_MSK_RTC_PERIOD_IT_MSK_SHIFT 7
594#define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_MASK 0x40
595#define TPS65910_INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6
596#define TPS65910_INT_MSK_HOTDIE_IT_MSK_MASK 0x20
597#define TPS65910_INT_MSK_HOTDIE_IT_MSK_SHIFT 5
598#define TPS65910_INT_MSK_PWRHOLD_IT_MSK_MASK 0x10
599#define TPS65910_INT_MSK_PWRHOLD_IT_MSK_SHIFT 4
600#define TPS65910_INT_MSK_PWRON_LP_IT_MSK_MASK 0x08
601#define TPS65910_INT_MSK_PWRON_LP_IT_MSK_SHIFT 3
602#define TPS65910_INT_MSK_PWRON_IT_MSK_MASK 0x04
603#define TPS65910_INT_MSK_PWRON_IT_MSK_SHIFT 2
604#define TPS65910_INT_MSK_VMBHI_IT_MSK_MASK 0x02
605#define TPS65910_INT_MSK_VMBHI_IT_MSK_SHIFT 1
606#define TPS65910_INT_MSK_VMBDCH_IT_MSK_MASK 0x01
607#define TPS65910_INT_MSK_VMBDCH_IT_MSK_SHIFT 0
608
609#define TPS65910_INT_STS2_GPIO0_F_IT_SHIFT 2
610#define TPS65910_INT_STS2_GPIO0_F_IT_MASK 0x02
611#define TPS65910_INT_STS2_GPIO0_R_IT_SHIFT 1
612#define TPS65910_INT_STS2_GPIO0_R_IT_MASK 0x01
613
614#define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_SHIFT 2
615#define TPS65910_INT_MSK2_GPIO0_F_IT_MSK_MASK 0x02
616#define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_SHIFT 1
617#define TPS65910_INT_MSK2_GPIO0_R_IT_MSK_MASK 0x01
575 618
576/*Register INT_STS (0x80) register.RegisterDescription */ 619/*Register INT_STS (0x80) register.RegisterDescription */
577#define INT_STS_RTC_PERIOD_IT_MASK 0x80 620#define INT_STS_RTC_PERIOD_IT_MASK 0x80
@@ -580,16 +623,16 @@
580#define INT_STS_RTC_ALARM_IT_SHIFT 6 623#define INT_STS_RTC_ALARM_IT_SHIFT 6
581#define INT_STS_HOTDIE_IT_MASK 0x20 624#define INT_STS_HOTDIE_IT_MASK 0x20
582#define INT_STS_HOTDIE_IT_SHIFT 5 625#define INT_STS_HOTDIE_IT_SHIFT 5
583#define INT_STS_PWRHOLD_IT_MASK 0x10 626#define INT_STS_PWRHOLD_R_IT_MASK 0x10
584#define INT_STS_PWRHOLD_IT_SHIFT 4 627#define INT_STS_PWRHOLD_R_IT_SHIFT 4
585#define INT_STS_PWRON_LP_IT_MASK 0x08 628#define INT_STS_PWRON_LP_IT_MASK 0x08
586#define INT_STS_PWRON_LP_IT_SHIFT 3 629#define INT_STS_PWRON_LP_IT_SHIFT 3
587#define INT_STS_PWRON_IT_MASK 0x04 630#define INT_STS_PWRON_IT_MASK 0x04
588#define INT_STS_PWRON_IT_SHIFT 2 631#define INT_STS_PWRON_IT_SHIFT 2
589#define INT_STS_VMBHI_IT_MASK 0x02 632#define INT_STS_VMBHI_IT_MASK 0x02
590#define INT_STS_VMBHI_IT_SHIFT 1 633#define INT_STS_VMBHI_IT_SHIFT 1
591#define INT_STS_VMBDCH_IT_MASK 0x01 634#define INT_STS_PWRHOLD_F_IT_MASK 0x01
592#define INT_STS_VMBDCH_IT_SHIFT 0 635#define INT_STS_PWRHOLD_F_IT_SHIFT 0
593 636
594 637
595/*Register INT_MSK (0x80) register.RegisterDescription */ 638/*Register INT_MSK (0x80) register.RegisterDescription */
@@ -599,16 +642,16 @@
599#define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6 642#define INT_MSK_RTC_ALARM_IT_MSK_SHIFT 6
600#define INT_MSK_HOTDIE_IT_MSK_MASK 0x20 643#define INT_MSK_HOTDIE_IT_MSK_MASK 0x20
601#define INT_MSK_HOTDIE_IT_MSK_SHIFT 5 644#define INT_MSK_HOTDIE_IT_MSK_SHIFT 5
602#define INT_MSK_PWRHOLD_IT_MSK_MASK 0x10 645#define INT_MSK_PWRHOLD_R_IT_MSK_MASK 0x10
603#define INT_MSK_PWRHOLD_IT_MSK_SHIFT 4 646#define INT_MSK_PWRHOLD_R_IT_MSK_SHIFT 4
604#define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08 647#define INT_MSK_PWRON_LP_IT_MSK_MASK 0x08
605#define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3 648#define INT_MSK_PWRON_LP_IT_MSK_SHIFT 3
606#define INT_MSK_PWRON_IT_MSK_MASK 0x04 649#define INT_MSK_PWRON_IT_MSK_MASK 0x04
607#define INT_MSK_PWRON_IT_MSK_SHIFT 2 650#define INT_MSK_PWRON_IT_MSK_SHIFT 2
608#define INT_MSK_VMBHI_IT_MSK_MASK 0x02 651#define INT_MSK_VMBHI_IT_MSK_MASK 0x02
609#define INT_MSK_VMBHI_IT_MSK_SHIFT 1 652#define INT_MSK_VMBHI_IT_MSK_SHIFT 1
610#define INT_MSK_VMBDCH_IT_MSK_MASK 0x01 653#define INT_MSK_PWRHOLD_F_IT_MSK_MASK 0x01
611#define INT_MSK_VMBDCH_IT_MSK_SHIFT 0 654#define INT_MSK_PWRHOLD_F_IT_MSK_SHIFT 0
612 655
613 656
614/*Register INT_STS2 (0x80) register.RegisterDescription */ 657/*Register INT_STS2 (0x80) register.RegisterDescription */
@@ -650,6 +693,14 @@
650 693
651 694
652/*Register INT_STS3 (0x80) register.RegisterDescription */ 695/*Register INT_STS3 (0x80) register.RegisterDescription */
696#define INT_STS3_PWRDN_IT_MASK 0x80
697#define INT_STS3_PWRDN_IT_SHIFT 7
698#define INT_STS3_VMBCH2_L_IT_MASK 0x40
699#define INT_STS3_VMBCH2_L_IT_SHIFT 6
700#define INT_STS3_VMBCH2_H_IT_MASK 0x20
701#define INT_STS3_VMBCH2_H_IT_SHIFT 5
702#define INT_STS3_WTCHDG_IT_MASK 0x10
703#define INT_STS3_WTCHDG_IT_SHIFT 4
653#define INT_STS3_GPIO5_F_IT_MASK 0x08 704#define INT_STS3_GPIO5_F_IT_MASK 0x08
654#define INT_STS3_GPIO5_F_IT_SHIFT 3 705#define INT_STS3_GPIO5_F_IT_SHIFT 3
655#define INT_STS3_GPIO5_R_IT_MASK 0x04 706#define INT_STS3_GPIO5_R_IT_MASK 0x04
@@ -661,6 +712,14 @@
661 712
662 713
663/*Register INT_MSK3 (0x80) register.RegisterDescription */ 714/*Register INT_MSK3 (0x80) register.RegisterDescription */
715#define INT_MSK3_PWRDN_IT_MSK_MASK 0x80
716#define INT_MSK3_PWRDN_IT_MSK_SHIFT 7
717#define INT_MSK3_VMBCH2_L_IT_MSK_MASK 0x40
718#define INT_MSK3_VMBCH2_L_IT_MSK_SHIFT 6
719#define INT_MSK3_VMBCH2_H_IT_MSK_MASK 0x20
720#define INT_MSK3_VMBCH2_H_IT_MSK_SHIFT 5
721#define INT_MSK3_WTCHDG_IT_MSK_MASK 0x10
722#define INT_MSK3_WTCHDG_IT_MSK_SHIFT 4
664#define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08 723#define INT_MSK3_GPIO5_F_IT_MSK_MASK 0x08
665#define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3 724#define INT_MSK3_GPIO5_F_IT_MSK_SHIFT 3
666#define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04 725#define INT_MSK3_GPIO5_R_IT_MSK_MASK 0x04
@@ -721,34 +780,32 @@
721#define TPS65910_IRQ_GPIO_F 9 780#define TPS65910_IRQ_GPIO_F 9
722#define TPS65910_NUM_IRQ 10 781#define TPS65910_NUM_IRQ 10
723 782
724#define TPS65911_IRQ_VBAT_VMBDCH 0 783#define TPS65911_IRQ_PWRHOLD_F 0
725#define TPS65911_IRQ_VBAT_VMBDCH2L 1 784#define TPS65911_IRQ_VBAT_VMHI 1
726#define TPS65911_IRQ_VBAT_VMBDCH2H 2 785#define TPS65911_IRQ_PWRON 2
727#define TPS65911_IRQ_VBAT_VMHI 3 786#define TPS65911_IRQ_PWRON_LP 3
728#define TPS65911_IRQ_PWRON 4 787#define TPS65911_IRQ_PWRHOLD_R 4
729#define TPS65911_IRQ_PWRON_LP 5 788#define TPS65911_IRQ_HOTDIE 5
730#define TPS65911_IRQ_PWRHOLD_F 6 789#define TPS65911_IRQ_RTC_ALARM 6
731#define TPS65911_IRQ_PWRHOLD_R 7 790#define TPS65911_IRQ_RTC_PERIOD 7
732#define TPS65911_IRQ_HOTDIE 8 791#define TPS65911_IRQ_GPIO0_R 8
733#define TPS65911_IRQ_RTC_ALARM 9 792#define TPS65911_IRQ_GPIO0_F 9
734#define TPS65911_IRQ_RTC_PERIOD 10 793#define TPS65911_IRQ_GPIO1_R 10
735#define TPS65911_IRQ_GPIO0_R 11 794#define TPS65911_IRQ_GPIO1_F 11
736#define TPS65911_IRQ_GPIO0_F 12 795#define TPS65911_IRQ_GPIO2_R 12
737#define TPS65911_IRQ_GPIO1_R 13 796#define TPS65911_IRQ_GPIO2_F 13
738#define TPS65911_IRQ_GPIO1_F 14 797#define TPS65911_IRQ_GPIO3_R 14
739#define TPS65911_IRQ_GPIO2_R 15 798#define TPS65911_IRQ_GPIO3_F 15
740#define TPS65911_IRQ_GPIO2_F 16 799#define TPS65911_IRQ_GPIO4_R 16
741#define TPS65911_IRQ_GPIO3_R 17 800#define TPS65911_IRQ_GPIO4_F 17
742#define TPS65911_IRQ_GPIO3_F 18 801#define TPS65911_IRQ_GPIO5_R 18
743#define TPS65911_IRQ_GPIO4_R 19 802#define TPS65911_IRQ_GPIO5_F 19
744#define TPS65911_IRQ_GPIO4_F 20 803#define TPS65911_IRQ_WTCHDG 20
745#define TPS65911_IRQ_GPIO5_R 21 804#define TPS65911_IRQ_VMBCH2_H 21
746#define TPS65911_IRQ_GPIO5_F 22 805#define TPS65911_IRQ_VMBCH2_L 22
747#define TPS65911_IRQ_WTCHDG 23 806#define TPS65911_IRQ_PWRDN 23
748#define TPS65911_IRQ_PWRDN 24 807
749 808#define TPS65911_NUM_IRQ 24
750#define TPS65911_NUM_IRQ 25
751
752 809
753/* GPIO Register Definitions */ 810/* GPIO Register Definitions */
754#define TPS65910_GPIO_DEB BIT(2) 811#define TPS65910_GPIO_DEB BIT(2)
@@ -836,7 +893,6 @@ struct tps65910 {
836 struct device *dev; 893 struct device *dev;
837 struct i2c_client *i2c_client; 894 struct i2c_client *i2c_client;
838 struct regmap *regmap; 895 struct regmap *regmap;
839 struct mutex io_mutex;
840 unsigned int id; 896 unsigned int id;
841 897
842 /* Client devices */ 898 /* Client devices */
@@ -848,12 +904,8 @@ struct tps65910 {
848 struct tps65910_board *of_plat_data; 904 struct tps65910_board *of_plat_data;
849 905
850 /* IRQ Handling */ 906 /* IRQ Handling */
851 struct mutex irq_lock;
852 int chip_irq; 907 int chip_irq;
853 int irq_base; 908 struct regmap_irq_chip_data *irq_data;
854 int irq_num;
855 u32 irq_mask;
856 struct irq_domain *domain;
857}; 909};
858 910
859struct tps65910_platform_data { 911struct tps65910_platform_data {
@@ -861,10 +913,6 @@ struct tps65910_platform_data {
861 int irq_base; 913 int irq_base;
862}; 914};
863 915
864int tps65910_irq_init(struct tps65910 *tps65910, int irq,
865 struct tps65910_platform_data *pdata);
866int tps65910_irq_exit(struct tps65910 *tps65910);
867
868static inline int tps65910_chip_id(struct tps65910 *tps65910) 916static inline int tps65910_chip_id(struct tps65910 *tps65910)
869{ 917{
870 return tps65910->id; 918 return tps65910->id;
@@ -900,4 +948,9 @@ static inline int tps65910_reg_update_bits(struct tps65910 *tps65910, u8 reg,
900 return regmap_update_bits(tps65910->regmap, reg, mask, val); 948 return regmap_update_bits(tps65910->regmap, reg, mask, val);
901} 949}
902 950
951static inline int tps65910_irq_get_virq(struct tps65910 *tps65910, int irq)
952{
953 return regmap_irq_get_virq(tps65910->irq_data, irq);
954}
955
903#endif /* __LINUX_MFD_TPS65910_H */ 956#endif /* __LINUX_MFD_TPS65910_H */
diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h
new file mode 100644
index 00000000000..2c75c9c9318
--- /dev/null
+++ b/include/linux/mfd/tps80031.h
@@ -0,0 +1,637 @@
1/*
2 * tps80031.h -- TI TPS80031 and TI TPS80032 PMIC driver.
3 *
4 * Copyright (c) 2012, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307, USA
21 */
22
23#ifndef __LINUX_MFD_TPS80031_H
24#define __LINUX_MFD_TPS80031_H
25
26#include <linux/device.h>
27#include <linux/regmap.h>
28
29/* Pull-ups/Pull-downs */
30#define TPS80031_CFG_INPUT_PUPD1 0xF0
31#define TPS80031_CFG_INPUT_PUPD2 0xF1
32#define TPS80031_CFG_INPUT_PUPD3 0xF2
33#define TPS80031_CFG_INPUT_PUPD4 0xF3
34#define TPS80031_CFG_LDO_PD1 0xF4
35#define TPS80031_CFG_LDO_PD2 0xF5
36#define TPS80031_CFG_SMPS_PD 0xF6
37
38/* Real Time Clock */
39#define TPS80031_SECONDS_REG 0x00
40#define TPS80031_MINUTES_REG 0x01
41#define TPS80031_HOURS_REG 0x02
42#define TPS80031_DAYS_REG 0x03
43#define TPS80031_MONTHS_REG 0x04
44#define TPS80031_YEARS_REG 0x05
45#define TPS80031_WEEKS_REG 0x06
46#define TPS80031_ALARM_SECONDS_REG 0x08
47#define TPS80031_ALARM_MINUTES_REG 0x09
48#define TPS80031_ALARM_HOURS_REG 0x0A
49#define TPS80031_ALARM_DAYS_REG 0x0B
50#define TPS80031_ALARM_MONTHS_REG 0x0C
51#define TPS80031_ALARM_YEARS_REG 0x0D
52#define TPS80031_RTC_CTRL_REG 0x10
53#define TPS80031_RTC_STATUS_REG 0x11
54#define TPS80031_RTC_INTERRUPTS_REG 0x12
55#define TPS80031_RTC_COMP_LSB_REG 0x13
56#define TPS80031_RTC_COMP_MSB_REG 0x14
57#define TPS80031_RTC_RESET_STATUS_REG 0x16
58
59/*PMC Master Module */
60#define TPS80031_PHOENIX_START_CONDITION 0x1F
61#define TPS80031_PHOENIX_MSK_TRANSITION 0x20
62#define TPS80031_STS_HW_CONDITIONS 0x21
63#define TPS80031_PHOENIX_LAST_TURNOFF_STS 0x22
64#define TPS80031_VSYSMIN_LO_THRESHOLD 0x23
65#define TPS80031_VSYSMIN_HI_THRESHOLD 0x24
66#define TPS80031_PHOENIX_DEV_ON 0x25
67#define TPS80031_STS_PWR_GRP_STATE 0x27
68#define TPS80031_PH_CFG_VSYSLOW 0x28
69#define TPS80031_PH_STS_BOOT 0x29
70#define TPS80031_PHOENIX_SENS_TRANSITION 0x2A
71#define TPS80031_PHOENIX_SEQ_CFG 0x2B
72#define TPS80031_PRIMARY_WATCHDOG_CFG 0X2C
73#define TPS80031_KEY_PRESS_DUR_CFG 0X2D
74#define TPS80031_SMPS_LDO_SHORT_STS 0x2E
75
76/* PMC Slave Module - Broadcast */
77#define TPS80031_BROADCAST_ADDR_ALL 0x31
78#define TPS80031_BROADCAST_ADDR_REF 0x32
79#define TPS80031_BROADCAST_ADDR_PROV 0x33
80#define TPS80031_BROADCAST_ADDR_CLK_RST 0x34
81
82/* PMC Slave Module SMPS Regulators */
83#define TPS80031_SMPS4_CFG_TRANS 0x41
84#define TPS80031_SMPS4_CFG_STATE 0x42
85#define TPS80031_SMPS4_CFG_VOLTAGE 0x44
86#define TPS80031_VIO_CFG_TRANS 0x47
87#define TPS80031_VIO_CFG_STATE 0x48
88#define TPS80031_VIO_CFG_FORCE 0x49
89#define TPS80031_VIO_CFG_VOLTAGE 0x4A
90#define TPS80031_VIO_CFG_STEP 0x48
91#define TPS80031_SMPS1_CFG_TRANS 0x53
92#define TPS80031_SMPS1_CFG_STATE 0x54
93#define TPS80031_SMPS1_CFG_FORCE 0x55
94#define TPS80031_SMPS1_CFG_VOLTAGE 0x56
95#define TPS80031_SMPS1_CFG_STEP 0x57
96#define TPS80031_SMPS2_CFG_TRANS 0x59
97#define TPS80031_SMPS2_CFG_STATE 0x5A
98#define TPS80031_SMPS2_CFG_FORCE 0x5B
99#define TPS80031_SMPS2_CFG_VOLTAGE 0x5C
100#define TPS80031_SMPS2_CFG_STEP 0x5D
101#define TPS80031_SMPS3_CFG_TRANS 0x65
102#define TPS80031_SMPS3_CFG_STATE 0x66
103#define TPS80031_SMPS3_CFG_VOLTAGE 0x68
104
105/* PMC Slave Module LDO Regulators */
106#define TPS80031_VANA_CFG_TRANS 0x81
107#define TPS80031_VANA_CFG_STATE 0x82
108#define TPS80031_VANA_CFG_VOLTAGE 0x83
109#define TPS80031_LDO2_CFG_TRANS 0x85
110#define TPS80031_LDO2_CFG_STATE 0x86
111#define TPS80031_LDO2_CFG_VOLTAGE 0x87
112#define TPS80031_LDO4_CFG_TRANS 0x89
113#define TPS80031_LDO4_CFG_STATE 0x8A
114#define TPS80031_LDO4_CFG_VOLTAGE 0x8B
115#define TPS80031_LDO3_CFG_TRANS 0x8D
116#define TPS80031_LDO3_CFG_STATE 0x8E
117#define TPS80031_LDO3_CFG_VOLTAGE 0x8F
118#define TPS80031_LDO6_CFG_TRANS 0x91
119#define TPS80031_LDO6_CFG_STATE 0x92
120#define TPS80031_LDO6_CFG_VOLTAGE 0x93
121#define TPS80031_LDOLN_CFG_TRANS 0x95
122#define TPS80031_LDOLN_CFG_STATE 0x96
123#define TPS80031_LDOLN_CFG_VOLTAGE 0x97
124#define TPS80031_LDO5_CFG_TRANS 0x99
125#define TPS80031_LDO5_CFG_STATE 0x9A
126#define TPS80031_LDO5_CFG_VOLTAGE 0x9B
127#define TPS80031_LDO1_CFG_TRANS 0x9D
128#define TPS80031_LDO1_CFG_STATE 0x9E
129#define TPS80031_LDO1_CFG_VOLTAGE 0x9F
130#define TPS80031_LDOUSB_CFG_TRANS 0xA1
131#define TPS80031_LDOUSB_CFG_STATE 0xA2
132#define TPS80031_LDOUSB_CFG_VOLTAGE 0xA3
133#define TPS80031_LDO7_CFG_TRANS 0xA5
134#define TPS80031_LDO7_CFG_STATE 0xA6
135#define TPS80031_LDO7_CFG_VOLTAGE 0xA7
136
137/* PMC Slave Module External Control */
138#define TPS80031_REGEN1_CFG_TRANS 0xAE
139#define TPS80031_REGEN1_CFG_STATE 0xAF
140#define TPS80031_REGEN2_CFG_TRANS 0xB1
141#define TPS80031_REGEN2_CFG_STATE 0xB2
142#define TPS80031_SYSEN_CFG_TRANS 0xB4
143#define TPS80031_SYSEN_CFG_STATE 0xB5
144
145/* PMC Slave Module Internal Control */
146#define TPS80031_NRESPWRON_CFG_TRANS 0xB7
147#define TPS80031_NRESPWRON_CFG_STATE 0xB8
148#define TPS80031_CLK32KAO_CFG_TRANS 0xBA
149#define TPS80031_CLK32KAO_CFG_STATE 0xBB
150#define TPS80031_CLK32KG_CFG_TRANS 0xBD
151#define TPS80031_CLK32KG_CFG_STATE 0xBE
152#define TPS80031_CLK32KAUDIO_CFG_TRANS 0xC0
153#define TPS80031_CLK32KAUDIO_CFG_STATE 0xC1
154#define TPS80031_VRTC_CFG_TRANS 0xC3
155#define TPS80031_VRTC_CFG_STATE 0xC4
156#define TPS80031_BIAS_CFG_TRANS 0xC6
157#define TPS80031_BIAS_CFG_STATE 0xC7
158#define TPS80031_VSYSMIN_HI_CFG_TRANS 0xC9
159#define TPS80031_VSYSMIN_HI_CFG_STATE 0xCA
160#define TPS80031_RC6MHZ_CFG_TRANS 0xCC
161#define TPS80031_RC6MHZ_CFG_STATE 0xCD
162#define TPS80031_TMP_CFG_TRANS 0xCF
163#define TPS80031_TMP_CFG_STATE 0xD0
164
165/* PMC Slave Module resources assignment */
166#define TPS80031_PREQ1_RES_ASS_A 0xD7
167#define TPS80031_PREQ1_RES_ASS_B 0xD8
168#define TPS80031_PREQ1_RES_ASS_C 0xD9
169#define TPS80031_PREQ2_RES_ASS_A 0xDA
170#define TPS80031_PREQ2_RES_ASS_B 0xDB
171#define TPS80031_PREQ2_RES_ASS_C 0xDC
172#define TPS80031_PREQ3_RES_ASS_A 0xDD
173#define TPS80031_PREQ3_RES_ASS_B 0xDE
174#define TPS80031_PREQ3_RES_ASS_C 0xDF
175
176/* PMC Slave Module Miscellaneous */
177#define TPS80031_SMPS_OFFSET 0xE0
178#define TPS80031_SMPS_MULT 0xE3
179#define TPS80031_MISC1 0xE4
180#define TPS80031_MISC2 0xE5
181#define TPS80031_BBSPOR_CFG 0xE6
182#define TPS80031_TMP_CFG 0xE7
183
184/* Battery Charging Controller and Indicator LED */
185#define TPS80031_CONTROLLER_CTRL2 0xDA
186#define TPS80031_CONTROLLER_VSEL_COMP 0xDB
187#define TPS80031_CHARGERUSB_VSYSREG 0xDC
188#define TPS80031_CHARGERUSB_VICHRG_PC 0xDD
189#define TPS80031_LINEAR_CHRG_STS 0xDE
190#define TPS80031_CONTROLLER_INT_MASK 0xE0
191#define TPS80031_CONTROLLER_CTRL1 0xE1
192#define TPS80031_CONTROLLER_WDG 0xE2
193#define TPS80031_CONTROLLER_STAT1 0xE3
194#define TPS80031_CHARGERUSB_INT_STATUS 0xE4
195#define TPS80031_CHARGERUSB_INT_MASK 0xE5
196#define TPS80031_CHARGERUSB_STATUS_INT1 0xE6
197#define TPS80031_CHARGERUSB_STATUS_INT2 0xE7
198#define TPS80031_CHARGERUSB_CTRL1 0xE8
199#define TPS80031_CHARGERUSB_CTRL2 0xE9
200#define TPS80031_CHARGERUSB_CTRL3 0xEA
201#define TPS80031_CHARGERUSB_STAT1 0xEB
202#define TPS80031_CHARGERUSB_VOREG 0xEC
203#define TPS80031_CHARGERUSB_VICHRG 0xED
204#define TPS80031_CHARGERUSB_CINLIMIT 0xEE
205#define TPS80031_CHARGERUSB_CTRLLIMIT1 0xEF
206#define TPS80031_CHARGERUSB_CTRLLIMIT2 0xF0
207#define TPS80031_LED_PWM_CTRL1 0xF4
208#define TPS80031_LED_PWM_CTRL2 0xF5
209
210/* USB On-The-Go */
211#define TPS80031_BACKUP_REG 0xFA
212#define TPS80031_USB_VENDOR_ID_LSB 0x00
213#define TPS80031_USB_VENDOR_ID_MSB 0x01
214#define TPS80031_USB_PRODUCT_ID_LSB 0x02
215#define TPS80031_USB_PRODUCT_ID_MSB 0x03
216#define TPS80031_USB_VBUS_CTRL_SET 0x04
217#define TPS80031_USB_VBUS_CTRL_CLR 0x05
218#define TPS80031_USB_ID_CTRL_SET 0x06
219#define TPS80031_USB_ID_CTRL_CLR 0x07
220#define TPS80031_USB_VBUS_INT_SRC 0x08
221#define TPS80031_USB_VBUS_INT_LATCH_SET 0x09
222#define TPS80031_USB_VBUS_INT_LATCH_CLR 0x0A
223#define TPS80031_USB_VBUS_INT_EN_LO_SET 0x0B
224#define TPS80031_USB_VBUS_INT_EN_LO_CLR 0x0C
225#define TPS80031_USB_VBUS_INT_EN_HI_SET 0x0D
226#define TPS80031_USB_VBUS_INT_EN_HI_CLR 0x0E
227#define TPS80031_USB_ID_INT_SRC 0x0F
228#define TPS80031_USB_ID_INT_LATCH_SET 0x10
229#define TPS80031_USB_ID_INT_LATCH_CLR 0x11
230#define TPS80031_USB_ID_INT_EN_LO_SET 0x12
231#define TPS80031_USB_ID_INT_EN_LO_CLR 0x13
232#define TPS80031_USB_ID_INT_EN_HI_SET 0x14
233#define TPS80031_USB_ID_INT_EN_HI_CLR 0x15
234#define TPS80031_USB_OTG_ADP_CTRL 0x16
235#define TPS80031_USB_OTG_ADP_HIGH 0x17
236#define TPS80031_USB_OTG_ADP_LOW 0x18
237#define TPS80031_USB_OTG_ADP_RISE 0x19
238#define TPS80031_USB_OTG_REVISION 0x1A
239
240/* Gas Gauge */
241#define TPS80031_FG_REG_00 0xC0
242#define TPS80031_FG_REG_01 0xC1
243#define TPS80031_FG_REG_02 0xC2
244#define TPS80031_FG_REG_03 0xC3
245#define TPS80031_FG_REG_04 0xC4
246#define TPS80031_FG_REG_05 0xC5
247#define TPS80031_FG_REG_06 0xC6
248#define TPS80031_FG_REG_07 0xC7
249#define TPS80031_FG_REG_08 0xC8
250#define TPS80031_FG_REG_09 0xC9
251#define TPS80031_FG_REG_10 0xCA
252#define TPS80031_FG_REG_11 0xCB
253
254/* General Purpose ADC */
255#define TPS80031_GPADC_CTRL 0x2E
256#define TPS80031_GPADC_CTRL2 0x2F
257#define TPS80031_RTSELECT_LSB 0x32
258#define TPS80031_RTSELECT_ISB 0x33
259#define TPS80031_RTSELECT_MSB 0x34
260#define TPS80031_GPSELECT_ISB 0x35
261#define TPS80031_CTRL_P1 0x36
262#define TPS80031_RTCH0_LSB 0x37
263#define TPS80031_RTCH0_MSB 0x38
264#define TPS80031_RTCH1_LSB 0x39
265#define TPS80031_RTCH1_MSB 0x3A
266#define TPS80031_GPCH0_LSB 0x3B
267#define TPS80031_GPCH0_MSB 0x3C
268
269/* SIM, MMC and Battery Detection */
270#define TPS80031_SIMDEBOUNCING 0xEB
271#define TPS80031_SIMCTRL 0xEC
272#define TPS80031_MMCDEBOUNCING 0xED
273#define TPS80031_MMCCTRL 0xEE
274#define TPS80031_BATDEBOUNCING 0xEF
275
276/* Vibrator Driver and PWMs */
277#define TPS80031_VIBCTRL 0x9B
278#define TPS80031_VIBMODE 0x9C
279#define TPS80031_PWM1ON 0xBA
280#define TPS80031_PWM1OFF 0xBB
281#define TPS80031_PWM2ON 0xBD
282#define TPS80031_PWM2OFF 0xBE
283
284/* Control Interface */
285#define TPS80031_INT_STS_A 0xD0
286#define TPS80031_INT_STS_B 0xD1
287#define TPS80031_INT_STS_C 0xD2
288#define TPS80031_INT_MSK_LINE_A 0xD3
289#define TPS80031_INT_MSK_LINE_B 0xD4
290#define TPS80031_INT_MSK_LINE_C 0xD5
291#define TPS80031_INT_MSK_STS_A 0xD6
292#define TPS80031_INT_MSK_STS_B 0xD7
293#define TPS80031_INT_MSK_STS_C 0xD8
294#define TPS80031_TOGGLE1 0x90
295#define TPS80031_TOGGLE2 0x91
296#define TPS80031_TOGGLE3 0x92
297#define TPS80031_PWDNSTATUS1 0x93
298#define TPS80031_PWDNSTATUS2 0x94
299#define TPS80031_VALIDITY0 0x17
300#define TPS80031_VALIDITY1 0x18
301#define TPS80031_VALIDITY2 0x19
302#define TPS80031_VALIDITY3 0x1A
303#define TPS80031_VALIDITY4 0x1B
304#define TPS80031_VALIDITY5 0x1C
305#define TPS80031_VALIDITY6 0x1D
306#define TPS80031_VALIDITY7 0x1E
307
308/* Version number related register */
309#define TPS80031_JTAGVERNUM 0x87
310#define TPS80031_EPROM_REV 0xDF
311
312/* GPADC Trimming Bits. */
313#define TPS80031_GPADC_TRIM0 0xCC
314#define TPS80031_GPADC_TRIM1 0xCD
315#define TPS80031_GPADC_TRIM2 0xCE
316#define TPS80031_GPADC_TRIM3 0xCF
317#define TPS80031_GPADC_TRIM4 0xD0
318#define TPS80031_GPADC_TRIM5 0xD1
319#define TPS80031_GPADC_TRIM6 0xD2
320#define TPS80031_GPADC_TRIM7 0xD3
321#define TPS80031_GPADC_TRIM8 0xD4
322#define TPS80031_GPADC_TRIM9 0xD5
323#define TPS80031_GPADC_TRIM10 0xD6
324#define TPS80031_GPADC_TRIM11 0xD7
325#define TPS80031_GPADC_TRIM12 0xD8
326#define TPS80031_GPADC_TRIM13 0xD9
327#define TPS80031_GPADC_TRIM14 0xDA
328#define TPS80031_GPADC_TRIM15 0xDB
329#define TPS80031_GPADC_TRIM16 0xDC
330#define TPS80031_GPADC_TRIM17 0xDD
331#define TPS80031_GPADC_TRIM18 0xDE
332
333/* TPS80031_CONTROLLER_STAT1 bit fields */
334#define TPS80031_CONTROLLER_STAT1_BAT_TEMP 0
335#define TPS80031_CONTROLLER_STAT1_BAT_REMOVED 1
336#define TPS80031_CONTROLLER_STAT1_VBUS_DET 2
337#define TPS80031_CONTROLLER_STAT1_VAC_DET 3
338#define TPS80031_CONTROLLER_STAT1_FAULT_WDG 4
339#define TPS80031_CONTROLLER_STAT1_LINCH_GATED 6
340/* TPS80031_CONTROLLER_INT_MASK bit filed */
341#define TPS80031_CONTROLLER_INT_MASK_MVAC_DET 0
342#define TPS80031_CONTROLLER_INT_MASK_MVBUS_DET 1
343#define TPS80031_CONTROLLER_INT_MASK_MBAT_TEMP 2
344#define TPS80031_CONTROLLER_INT_MASK_MFAULT_WDG 3
345#define TPS80031_CONTROLLER_INT_MASK_MBAT_REMOVED 4
346#define TPS80031_CONTROLLER_INT_MASK_MLINCH_GATED 5
347
348#define TPS80031_CHARGE_CONTROL_SUB_INT_MASK 0x3F
349
350/* TPS80031_PHOENIX_DEV_ON bit field */
351#define TPS80031_DEVOFF 0x1
352
353#define TPS80031_EXT_CONTROL_CFG_TRANS 0
354#define TPS80031_EXT_CONTROL_CFG_STATE 1
355
356/* State register field */
357#define TPS80031_STATE_OFF 0x00
358#define TPS80031_STATE_ON 0x01
359#define TPS80031_STATE_MASK 0x03
360
361/* Trans register field */
362#define TPS80031_TRANS_ACTIVE_OFF 0x00
363#define TPS80031_TRANS_ACTIVE_ON 0x01
364#define TPS80031_TRANS_ACTIVE_MASK 0x03
365#define TPS80031_TRANS_SLEEP_OFF 0x00
366#define TPS80031_TRANS_SLEEP_ON 0x04
367#define TPS80031_TRANS_SLEEP_MASK 0x0C
368#define TPS80031_TRANS_OFF_OFF 0x00
369#define TPS80031_TRANS_OFF_ACTIVE 0x10
370#define TPS80031_TRANS_OFF_MASK 0x30
371
372#define TPS80031_EXT_PWR_REQ (TPS80031_PWR_REQ_INPUT_PREQ1 | \
373 TPS80031_PWR_REQ_INPUT_PREQ2 | \
374 TPS80031_PWR_REQ_INPUT_PREQ3)
375
376/* TPS80031_BBSPOR_CFG bit field */
377#define TPS80031_BBSPOR_CHG_EN 0x8
378#define TPS80031_MAX_REGISTER 0xFF
379
380struct i2c_client;
381
382/* Supported chips */
383enum chips {
384 TPS80031 = 0x00000001,
385 TPS80032 = 0x00000002,
386};
387
388enum {
389 TPS80031_INT_PWRON,
390 TPS80031_INT_RPWRON,
391 TPS80031_INT_SYS_VLOW,
392 TPS80031_INT_RTC_ALARM,
393 TPS80031_INT_RTC_PERIOD,
394 TPS80031_INT_HOT_DIE,
395 TPS80031_INT_VXX_SHORT,
396 TPS80031_INT_SPDURATION,
397 TPS80031_INT_WATCHDOG,
398 TPS80031_INT_BAT,
399 TPS80031_INT_SIM,
400 TPS80031_INT_MMC,
401 TPS80031_INT_RES,
402 TPS80031_INT_GPADC_RT,
403 TPS80031_INT_GPADC_SW2_EOC,
404 TPS80031_INT_CC_AUTOCAL,
405 TPS80031_INT_ID_WKUP,
406 TPS80031_INT_VBUSS_WKUP,
407 TPS80031_INT_ID,
408 TPS80031_INT_VBUS,
409 TPS80031_INT_CHRG_CTRL,
410 TPS80031_INT_EXT_CHRG,
411 TPS80031_INT_INT_CHRG,
412 TPS80031_INT_RES2,
413 TPS80031_INT_BAT_TEMP_OVRANGE,
414 TPS80031_INT_BAT_REMOVED,
415 TPS80031_INT_VBUS_DET,
416 TPS80031_INT_VAC_DET,
417 TPS80031_INT_FAULT_WDG,
418 TPS80031_INT_LINCH_GATED,
419
420 /* Last interrupt id to get the end number */
421 TPS80031_INT_NR,
422};
423
424/* TPS80031 Slave IDs */
425#define TPS80031_NUM_SLAVES 4
426#define TPS80031_SLAVE_ID0 0
427#define TPS80031_SLAVE_ID1 1
428#define TPS80031_SLAVE_ID2 2
429#define TPS80031_SLAVE_ID3 3
430
431/* TPS80031 I2C addresses */
432#define TPS80031_I2C_ID0_ADDR 0x12
433#define TPS80031_I2C_ID1_ADDR 0x48
434#define TPS80031_I2C_ID2_ADDR 0x49
435#define TPS80031_I2C_ID3_ADDR 0x4A
436
437enum {
438 TPS80031_REGULATOR_VIO,
439 TPS80031_REGULATOR_SMPS1,
440 TPS80031_REGULATOR_SMPS2,
441 TPS80031_REGULATOR_SMPS3,
442 TPS80031_REGULATOR_SMPS4,
443 TPS80031_REGULATOR_VANA,
444 TPS80031_REGULATOR_LDO1,
445 TPS80031_REGULATOR_LDO2,
446 TPS80031_REGULATOR_LDO3,
447 TPS80031_REGULATOR_LDO4,
448 TPS80031_REGULATOR_LDO5,
449 TPS80031_REGULATOR_LDO6,
450 TPS80031_REGULATOR_LDO7,
451 TPS80031_REGULATOR_LDOLN,
452 TPS80031_REGULATOR_LDOUSB,
453 TPS80031_REGULATOR_VBUS,
454 TPS80031_REGULATOR_REGEN1,
455 TPS80031_REGULATOR_REGEN2,
456 TPS80031_REGULATOR_SYSEN,
457 TPS80031_REGULATOR_MAX,
458};
459
460/* Different configurations for the rails */
461enum {
462 /* USBLDO input selection */
463 TPS80031_USBLDO_INPUT_VSYS = 0x00000001,
464 TPS80031_USBLDO_INPUT_PMID = 0x00000002,
465
466 /* LDO3 output mode */
467 TPS80031_LDO3_OUTPUT_VIB = 0x00000004,
468
469 /* VBUS configuration */
470 TPS80031_VBUS_DISCHRG_EN_PDN = 0x00000004,
471 TPS80031_VBUS_SW_ONLY = 0x00000008,
472 TPS80031_VBUS_SW_N_ID = 0x00000010,
473};
474
475/* External controls requests */
476enum tps80031_ext_control {
477 TPS80031_PWR_REQ_INPUT_NONE = 0x00000000,
478 TPS80031_PWR_REQ_INPUT_PREQ1 = 0x00000001,
479 TPS80031_PWR_REQ_INPUT_PREQ2 = 0x00000002,
480 TPS80031_PWR_REQ_INPUT_PREQ3 = 0x00000004,
481 TPS80031_PWR_OFF_ON_SLEEP = 0x00000008,
482 TPS80031_PWR_ON_ON_SLEEP = 0x00000010,
483};
484
485enum tps80031_pupd_pins {
486 TPS80031_PREQ1 = 0,
487 TPS80031_PREQ2A,
488 TPS80031_PREQ2B,
489 TPS80031_PREQ2C,
490 TPS80031_PREQ3,
491 TPS80031_NRES_WARM,
492 TPS80031_PWM_FORCE,
493 TPS80031_CHRG_EXT_CHRG_STATZ,
494 TPS80031_SIM,
495 TPS80031_MMC,
496 TPS80031_GPADC_START,
497 TPS80031_DVSI2C_SCL,
498 TPS80031_DVSI2C_SDA,
499 TPS80031_CTLI2C_SCL,
500 TPS80031_CTLI2C_SDA,
501};
502
503enum tps80031_pupd_settings {
504 TPS80031_PUPD_NORMAL,
505 TPS80031_PUPD_PULLDOWN,
506 TPS80031_PUPD_PULLUP,
507};
508
509struct tps80031 {
510 struct device *dev;
511 unsigned long chip_info;
512 int es_version;
513 struct i2c_client *clients[TPS80031_NUM_SLAVES];
514 struct regmap *regmap[TPS80031_NUM_SLAVES];
515 struct regmap_irq_chip_data *irq_data;
516};
517
518struct tps80031_pupd_init_data {
519 int input_pin;
520 int setting;
521};
522
523/*
524 * struct tps80031_regulator_platform_data - tps80031 regulator platform data.
525 *
526 * @reg_init_data: The regulator init data.
527 * @ext_ctrl_flag: External control flag for sleep/power request control.
528 * @config_flags: Configuration flag to configure the rails.
529 * It should be ORed of config enums.
530 */
531
532struct tps80031_regulator_platform_data {
533 struct regulator_init_data *reg_init_data;
534 unsigned int ext_ctrl_flag;
535 unsigned int config_flags;
536};
537
538struct tps80031_platform_data {
539 int irq_base;
540 bool use_power_off;
541 struct tps80031_pupd_init_data *pupd_init_data;
542 int pupd_init_data_size;
543 struct tps80031_regulator_platform_data
544 *regulator_pdata[TPS80031_REGULATOR_MAX];
545};
546
547static inline int tps80031_write(struct device *dev, int sid,
548 int reg, uint8_t val)
549{
550 struct tps80031 *tps80031 = dev_get_drvdata(dev);
551
552 return regmap_write(tps80031->regmap[sid], reg, val);
553}
554
555static inline int tps80031_writes(struct device *dev, int sid, int reg,
556 int len, uint8_t *val)
557{
558 struct tps80031 *tps80031 = dev_get_drvdata(dev);
559
560 return regmap_bulk_write(tps80031->regmap[sid], reg, val, len);
561}
562
563static inline int tps80031_read(struct device *dev, int sid,
564 int reg, uint8_t *val)
565{
566 struct tps80031 *tps80031 = dev_get_drvdata(dev);
567 unsigned int ival;
568 int ret;
569
570 ret = regmap_read(tps80031->regmap[sid], reg, &ival);
571 if (ret < 0) {
572 dev_err(dev, "failed reading from reg 0x%02x\n", reg);
573 return ret;
574 }
575
576 *val = ival;
577 return ret;
578}
579
580static inline int tps80031_reads(struct device *dev, int sid,
581 int reg, int len, uint8_t *val)
582{
583 struct tps80031 *tps80031 = dev_get_drvdata(dev);
584
585 return regmap_bulk_read(tps80031->regmap[sid], reg, val, len);
586}
587
588static inline int tps80031_set_bits(struct device *dev, int sid,
589 int reg, uint8_t bit_mask)
590{
591 struct tps80031 *tps80031 = dev_get_drvdata(dev);
592
593 return regmap_update_bits(tps80031->regmap[sid], reg,
594 bit_mask, bit_mask);
595}
596
597static inline int tps80031_clr_bits(struct device *dev, int sid,
598 int reg, uint8_t bit_mask)
599{
600 struct tps80031 *tps80031 = dev_get_drvdata(dev);
601
602 return regmap_update_bits(tps80031->regmap[sid], reg, bit_mask, 0);
603}
604
605static inline int tps80031_update(struct device *dev, int sid,
606 int reg, uint8_t val, uint8_t mask)
607{
608 struct tps80031 *tps80031 = dev_get_drvdata(dev);
609
610 return regmap_update_bits(tps80031->regmap[sid], reg, mask, val);
611}
612
613static inline unsigned long tps80031_get_chip_info(struct device *dev)
614{
615 struct tps80031 *tps80031 = dev_get_drvdata(dev);
616
617 return tps80031->chip_info;
618}
619
620static inline int tps80031_get_pmu_version(struct device *dev)
621{
622 struct tps80031 *tps80031 = dev_get_drvdata(dev);
623
624 return tps80031->es_version;
625}
626
627static inline int tps80031_irq_get_virq(struct device *dev, int irq)
628{
629 struct tps80031 *tps80031 = dev_get_drvdata(dev);
630
631 return regmap_irq_get_virq(tps80031->irq_data, irq);
632}
633
634extern int tps80031_ext_power_req_config(struct device *dev,
635 unsigned long ext_ctrl_flag, int preq_bit,
636 int state_reg_add, int trans_reg_add);
637#endif /*__LINUX_MFD_TPS80031_H */
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index a8eff4ad9be..94ac944d12f 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -207,10 +207,12 @@ struct twl6040_platform_data {
207}; 207};
208 208
209struct regmap; 209struct regmap;
210struct regmap_irq_chips_data;
210 211
211struct twl6040 { 212struct twl6040 {
212 struct device *dev; 213 struct device *dev;
213 struct regmap *regmap; 214 struct regmap *regmap;
215 struct regmap_irq_chip_data *irq_data;
214 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ 216 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
215 struct mutex mutex; 217 struct mutex mutex;
216 struct mutex irq_mutex; 218 struct mutex irq_mutex;
@@ -228,9 +230,8 @@ struct twl6040 {
228 unsigned int mclk; 230 unsigned int mclk;
229 231
230 unsigned int irq; 232 unsigned int irq;
231 unsigned int irq_base; 233 unsigned int irq_ready;
232 u8 irq_masks_cur; 234 unsigned int irq_th;
233 u8 irq_masks_cache;
234}; 235};
235 236
236int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg); 237int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg);
@@ -245,8 +246,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
245 unsigned int freq_in, unsigned int freq_out); 246 unsigned int freq_in, unsigned int freq_out);
246int twl6040_get_pll(struct twl6040 *twl6040); 247int twl6040_get_pll(struct twl6040 *twl6040);
247unsigned int twl6040_get_sysclk(struct twl6040 *twl6040); 248unsigned int twl6040_get_sysclk(struct twl6040 *twl6040);
248int twl6040_irq_init(struct twl6040 *twl6040); 249
249void twl6040_irq_exit(struct twl6040 *twl6040);
250/* Get the combined status of the vibra control register */ 250/* Get the combined status of the vibra control register */
251int twl6040_get_vibralr_status(struct twl6040 *twl6040); 251int twl6040_get_vibralr_status(struct twl6040 *twl6040);
252 252
diff --git a/include/linux/mfd/viperboard.h b/include/linux/mfd/viperboard.h
new file mode 100644
index 00000000000..193452848c0
--- /dev/null
+++ b/include/linux/mfd/viperboard.h
@@ -0,0 +1,110 @@
1/*
2 * include/linux/mfd/viperboard.h
3 *
4 * Nano River Technologies viperboard definitions
5 *
6 * (C) 2012 by Lemonage GmbH
7 * Author: Lars Poeschel <poeschel@lemonage.de>
8 * All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#ifndef __MFD_VIPERBOARD_H__
18#define __MFD_VIPERBOARD_H__
19
20#include <linux/types.h>
21#include <linux/usb.h>
22
23#define VPRBRD_EP_OUT 0x02
24#define VPRBRD_EP_IN 0x86
25
26#define VPRBRD_I2C_MSG_LEN 512 /* max length of a msg on USB level */
27
28#define VPRBRD_I2C_FREQ_6MHZ 1 /* 6 MBit/s */
29#define VPRBRD_I2C_FREQ_3MHZ 2 /* 3 MBit/s */
30#define VPRBRD_I2C_FREQ_1MHZ 3 /* 1 MBit/s */
31#define VPRBRD_I2C_FREQ_FAST 4 /* 400 kbit/s */
32#define VPRBRD_I2C_FREQ_400KHZ VPRBRD_I2C_FREQ_FAST
33#define VPRBRD_I2C_FREQ_200KHZ 5 /* 200 kbit/s */
34#define VPRBRD_I2C_FREQ_STD 6 /* 100 kbit/s */
35#define VPRBRD_I2C_FREQ_100KHZ VPRBRD_I2C_FREQ_STD
36#define VPRBRD_I2C_FREQ_10KHZ 7 /* 10 kbit/s */
37
38#define VPRBRD_I2C_CMD_WRITE 0x00
39#define VPRBRD_I2C_CMD_READ 0x01
40#define VPRBRD_I2C_CMD_ADDR 0x02
41
42#define VPRBRD_USB_TYPE_OUT 0x40
43#define VPRBRD_USB_TYPE_IN 0xc0
44#define VPRBRD_USB_TIMEOUT_MS 100
45#define VPRBRD_USB_REQUEST_I2C_FREQ 0xe6
46#define VPRBRD_USB_REQUEST_I2C 0xe9
47#define VPRBRD_USB_REQUEST_MAJOR 0xea
48#define VPRBRD_USB_REQUEST_MINOR 0xeb
49#define VPRBRD_USB_REQUEST_ADC 0xec
50#define VPRBRD_USB_REQUEST_GPIOA 0xed
51#define VPRBRD_USB_REQUEST_GPIOB 0xdd
52
53struct vprbrd_i2c_write_hdr {
54 u8 cmd;
55 u16 addr;
56 u8 len1;
57 u8 len2;
58 u8 last;
59 u8 chan;
60 u16 spi;
61} __packed;
62
63struct vprbrd_i2c_read_hdr {
64 u8 cmd;
65 u16 addr;
66 u8 len0;
67 u8 len1;
68 u8 len2;
69 u8 len3;
70 u8 len4;
71 u8 len5;
72 u16 tf1; /* transfer 1 length */
73 u16 tf2; /* transfer 2 length */
74} __packed;
75
76struct vprbrd_i2c_status {
77 u8 unknown[11];
78 u8 status;
79} __packed;
80
81struct vprbrd_i2c_write_msg {
82 struct vprbrd_i2c_write_hdr header;
83 u8 data[VPRBRD_I2C_MSG_LEN
84 - sizeof(struct vprbrd_i2c_write_hdr)];
85} __packed;
86
87struct vprbrd_i2c_read_msg {
88 struct vprbrd_i2c_read_hdr header;
89 u8 data[VPRBRD_I2C_MSG_LEN
90 - sizeof(struct vprbrd_i2c_read_hdr)];
91} __packed;
92
93struct vprbrd_i2c_addr_msg {
94 u8 cmd;
95 u8 addr;
96 u8 unknown1;
97 u16 len;
98 u8 unknown2;
99 u8 unknown3;
100} __packed;
101
102/* Structure to hold all device specific stuff */
103struct vprbrd {
104 struct usb_device *usb_dev; /* the usb device for this device */
105 struct mutex lock;
106 u8 buf[sizeof(struct vprbrd_i2c_write_msg)];
107 struct platform_device pdev;
108};
109
110#endif /* __MFD_VIPERBOARD_H__ */
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 1f173306bf0..ae5c249530b 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -19,6 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h> 20#include <linux/regmap.h>
21 21
22#include <linux/mfd/wm8994/pdata.h>
23
22enum wm8994_type { 24enum wm8994_type {
23 WM8994 = 0, 25 WM8994 = 0,
24 WM8958 = 1, 26 WM8958 = 1,
@@ -55,6 +57,8 @@ struct regulator_bulk_data;
55struct wm8994 { 57struct wm8994 {
56 struct mutex irq_lock; 58 struct mutex irq_lock;
57 59
60 struct wm8994_pdata pdata;
61
58 enum wm8994_type type; 62 enum wm8994_type type;
59 int revision; 63 int revision;
60 int cust_id; 64 int cust_id;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index fc87be4fdc2..8e21a094836 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -176,6 +176,11 @@ struct wm8994_pdata {
176 unsigned int lineout1fb:1; 176 unsigned int lineout1fb:1;
177 unsigned int lineout2fb:1; 177 unsigned int lineout2fb:1;
178 178
179 /* Delay between detecting a jack and starting microphone
180 * detect (specified in ms)
181 */
182 int micdet_delay;
183
179 /* IRQ for microphone detection if brought out directly as a 184 /* IRQ for microphone detection if brought out directly as a
180 * signal. 185 * signal.
181 */ 186 */
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index de201203bc7..adfe8c058f2 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -15,6 +15,7 @@
15 15
16#define MICREL_PHY_ID_MASK 0x00fffff0 16#define MICREL_PHY_ID_MASK 0x00fffff0
17 17
18#define PHY_ID_KSZ8873MLL 0x000e7237
18#define PHY_ID_KSZ9021 0x00221610 19#define PHY_ID_KSZ9021 0x00221610
19#define PHY_ID_KS8737 0x00221720 20#define PHY_ID_KS8737 0x00221720
20#define PHY_ID_KSZ8021 0x00221555 21#define PHY_ID_KSZ8021 0x00221555
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index ce7e6671968..1e9f627967a 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -7,14 +7,41 @@
7 7
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9 9
10/*
11 * Return values from addresss_space_operations.migratepage():
12 * - negative errno on page migration failure;
13 * - zero on page migration success;
14 *
15 * The balloon page migration introduces this special case where a 'distinct'
16 * return code is used to flag a successful page migration to unmap_and_move().
17 * This approach is necessary because page migration can race against balloon
18 * deflation procedure, and for such case we could introduce a nasty page leak
19 * if a successfully migrated balloon page gets released concurrently with
20 * migration's unmap_and_move() wrap-up steps.
21 */
22#define MIGRATEPAGE_SUCCESS 0
23#define MIGRATEPAGE_BALLOON_SUCCESS 1 /* special ret code for balloon page
24 * sucessful migration case.
25 */
26enum migrate_reason {
27 MR_COMPACTION,
28 MR_MEMORY_FAILURE,
29 MR_MEMORY_HOTPLUG,
30 MR_SYSCALL, /* also applies to cpusets */
31 MR_MEMPOLICY_MBIND,
32 MR_NUMA_MISPLACED,
33 MR_CMA
34};
35
10#ifdef CONFIG_MIGRATION 36#ifdef CONFIG_MIGRATION
11 37
12extern void putback_lru_pages(struct list_head *l); 38extern void putback_lru_pages(struct list_head *l);
39extern void putback_movable_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 40extern int migrate_page(struct address_space *,
14 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
15extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, bool offlining, 43 unsigned long private, bool offlining,
17 enum migrate_mode mode); 44 enum migrate_mode mode, int reason);
18extern int migrate_huge_page(struct page *, new_page_t x, 45extern int migrate_huge_page(struct page *, new_page_t x,
19 unsigned long private, bool offlining, 46 unsigned long private, bool offlining,
20 enum migrate_mode mode); 47 enum migrate_mode mode);
@@ -33,9 +60,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
33#else 60#else
34 61
35static inline void putback_lru_pages(struct list_head *l) {} 62static inline void putback_lru_pages(struct list_head *l) {}
63static inline void putback_movable_pages(struct list_head *l) {}
36static inline int migrate_pages(struct list_head *l, new_page_t x, 64static inline int migrate_pages(struct list_head *l, new_page_t x,
37 unsigned long private, bool offlining, 65 unsigned long private, bool offlining,
38 enum migrate_mode mode) { return -ENOSYS; } 66 enum migrate_mode mode, int reason) { return -ENOSYS; }
39static inline int migrate_huge_page(struct page *page, new_page_t x, 67static inline int migrate_huge_page(struct page *page, new_page_t x,
40 unsigned long private, bool offlining, 68 unsigned long private, bool offlining,
41 enum migrate_mode mode) { return -ENOSYS; } 69 enum migrate_mode mode) { return -ENOSYS; }
@@ -64,4 +92,37 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
64#define fail_migrate_page NULL 92#define fail_migrate_page NULL
65 93
66#endif /* CONFIG_MIGRATION */ 94#endif /* CONFIG_MIGRATION */
95
96#ifdef CONFIG_NUMA_BALANCING
97extern int migrate_misplaced_page(struct page *page, int node);
98extern int migrate_misplaced_page(struct page *page, int node);
99extern bool migrate_ratelimited(int node);
100#else
101static inline int migrate_misplaced_page(struct page *page, int node)
102{
103 return -EAGAIN; /* can't migrate now */
104}
105static inline bool migrate_ratelimited(int node)
106{
107 return false;
108}
109#endif /* CONFIG_NUMA_BALANCING */
110
111#if defined(CONFIG_NUMA_BALANCING) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
112extern int migrate_misplaced_transhuge_page(struct mm_struct *mm,
113 struct vm_area_struct *vma,
114 pmd_t *pmd, pmd_t entry,
115 unsigned long address,
116 struct page *page, int node);
117#else
118static inline int migrate_misplaced_transhuge_page(struct mm_struct *mm,
119 struct vm_area_struct *vma,
120 pmd_t *pmd, pmd_t entry,
121 unsigned long address,
122 struct page *page, int node)
123{
124 return -EAGAIN;
125}
126#endif /* CONFIG_NUMA_BALANCING && CONFIG_TRANSPARENT_HUGEPAGE*/
127
67#endif /* _LINUX_MIGRATE_H */ 128#endif /* _LINUX_MIGRATE_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index e0deeb2cc93..09c2300ddb3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -34,6 +34,7 @@
34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 34#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
35#define MPT_MINOR 220 35#define MPT_MINOR 220
36#define MPT2SAS_MINOR 221 36#define MPT2SAS_MINOR 221
37#define MPT3SAS_MINOR 222
37#define UINPUT_MINOR 223 38#define UINPUT_MINOR 223
38#define MISC_MCELOG_MINOR 227 39#define MISC_MCELOG_MINOR 227
39#define HPET_MINOR 228 40#define HPET_MINOR 228
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6d1acb04cd1..20ea939c22a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -142,6 +142,8 @@ enum {
142 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 142 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
143 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 143 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
144 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 144 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
145 MLX4_DEV_CAP_FLAG_64B_EQE = 1LL << 61,
146 MLX4_DEV_CAP_FLAG_64B_CQE = 1LL << 62
145}; 147};
146 148
147enum { 149enum {
@@ -151,6 +153,20 @@ enum {
151 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3 153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3
152}; 154};
153 155
156enum {
157 MLX4_DEV_CAP_64B_EQE_ENABLED = 1LL << 0,
158 MLX4_DEV_CAP_64B_CQE_ENABLED = 1LL << 1
159};
160
161enum {
162 MLX4_USER_DEV_CAP_64B_CQE = 1L << 0
163};
164
165enum {
166 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0
167};
168
169
154#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 170#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
155 171
156enum { 172enum {
@@ -419,6 +435,11 @@ struct mlx4_caps {
419 u32 max_counters; 435 u32 max_counters;
420 u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; 436 u8 port_ib_mtu[MLX4_MAX_PORTS + 1];
421 u16 sqp_demux; 437 u16 sqp_demux;
438 u32 eqe_size;
439 u32 cqe_size;
440 u8 eqe_factor;
441 u32 userspace_caps; /* userspace must be aware of these */
442 u32 function_caps; /* VFs must be aware of these */
422}; 443};
423 444
424struct mlx4_buf_list { 445struct mlx4_buf_list {
@@ -604,6 +625,7 @@ struct mlx4_dev {
604 u8 rev_id; 625 u8 rev_id;
605 char board_id[MLX4_BOARD_ID_LEN]; 626 char board_id[MLX4_BOARD_ID_LEN];
606 int num_vfs; 627 int num_vfs;
628 int oper_log_mgm_entry_size;
607 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 629 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
608 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 630 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
609}; 631};
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bcaab4e6fe9..63204078f72 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -693,6 +693,36 @@ static inline int page_to_nid(const struct page *page)
693} 693}
694#endif 694#endif
695 695
696#ifdef CONFIG_NUMA_BALANCING
697static inline int page_xchg_last_nid(struct page *page, int nid)
698{
699 return xchg(&page->_last_nid, nid);
700}
701
702static inline int page_last_nid(struct page *page)
703{
704 return page->_last_nid;
705}
706static inline void reset_page_last_nid(struct page *page)
707{
708 page->_last_nid = -1;
709}
710#else
711static inline int page_xchg_last_nid(struct page *page, int nid)
712{
713 return page_to_nid(page);
714}
715
716static inline int page_last_nid(struct page *page)
717{
718 return page_to_nid(page);
719}
720
721static inline void reset_page_last_nid(struct page *page)
722{
723}
724#endif
725
696static inline struct zone *page_zone(const struct page *page) 726static inline struct zone *page_zone(const struct page *page)
697{ 727{
698 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 728 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
@@ -977,7 +1007,6 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
977 1007
978extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 1008extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
979extern void truncate_setsize(struct inode *inode, loff_t newsize); 1009extern void truncate_setsize(struct inode *inode, loff_t newsize);
980extern int vmtruncate(struct inode *inode, loff_t offset);
981void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end); 1010void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
982int truncate_inode_page(struct address_space *mapping, struct page *page); 1011int truncate_inode_page(struct address_space *mapping, struct page *page);
983int generic_error_remove_page(struct address_space *mapping, struct page *page); 1012int generic_error_remove_page(struct address_space *mapping, struct page *page);
@@ -1078,6 +1107,9 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,
1078extern unsigned long do_mremap(unsigned long addr, 1107extern unsigned long do_mremap(unsigned long addr,
1079 unsigned long old_len, unsigned long new_len, 1108 unsigned long old_len, unsigned long new_len,
1080 unsigned long flags, unsigned long new_addr); 1109 unsigned long flags, unsigned long new_addr);
1110extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,
1111 unsigned long end, pgprot_t newprot,
1112 int dirty_accountable, int prot_numa);
1081extern int mprotect_fixup(struct vm_area_struct *vma, 1113extern int mprotect_fixup(struct vm_area_struct *vma,
1082 struct vm_area_struct **pprev, unsigned long start, 1114 struct vm_area_struct **pprev, unsigned long start,
1083 unsigned long end, unsigned long newflags); 1115 unsigned long end, unsigned long newflags);
@@ -1456,6 +1488,37 @@ extern unsigned long vm_mmap(struct file *, unsigned long,
1456 unsigned long, unsigned long, 1488 unsigned long, unsigned long,
1457 unsigned long, unsigned long); 1489 unsigned long, unsigned long);
1458 1490
1491struct vm_unmapped_area_info {
1492#define VM_UNMAPPED_AREA_TOPDOWN 1
1493 unsigned long flags;
1494 unsigned long length;
1495 unsigned long low_limit;
1496 unsigned long high_limit;
1497 unsigned long align_mask;
1498 unsigned long align_offset;
1499};
1500
1501extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
1502extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
1503
1504/*
1505 * Search for an unmapped address range.
1506 *
1507 * We are looking for a range that:
1508 * - does not intersect with any VMA;
1509 * - is contained within the [low_limit, high_limit) interval;
1510 * - is at least the desired size.
1511 * - satisfies (begin_addr & align_mask) == (align_offset & align_mask)
1512 */
1513static inline unsigned long
1514vm_unmapped_area(struct vm_unmapped_area_info *info)
1515{
1516 if (!(info->flags & VM_UNMAPPED_AREA_TOPDOWN))
1517 return unmapped_area(info);
1518 else
1519 return unmapped_area_topdown(info);
1520}
1521
1459/* truncate.c */ 1522/* truncate.c */
1460extern void truncate_inode_pages(struct address_space *, loff_t); 1523extern void truncate_inode_pages(struct address_space *, loff_t);
1461extern void truncate_inode_pages_range(struct address_space *, 1524extern void truncate_inode_pages_range(struct address_space *,
@@ -1548,6 +1611,11 @@ static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
1548} 1611}
1549#endif 1612#endif
1550 1613
1614#ifdef CONFIG_ARCH_USES_NUMA_PROT_NONE
1615unsigned long change_prot_numa(struct vm_area_struct *vma,
1616 unsigned long start, unsigned long end);
1617#endif
1618
1551struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); 1619struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr);
1552int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 1620int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1553 unsigned long pfn, unsigned long size, pgprot_t); 1621 unsigned long pfn, unsigned long size, pgprot_t);
@@ -1569,6 +1637,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1569#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 1637#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1570#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1638#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1571#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1639#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1640#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1572 1641
1573typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1642typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1574 void *data); 1643 void *data);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 31f8a3af7d9..f8f5162a357 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -128,10 +128,7 @@ struct page {
128 }; 128 };
129 129
130 struct list_head list; /* slobs list of pages */ 130 struct list_head list; /* slobs list of pages */
131 struct { /* slab fields */ 131 struct slab *slab_page; /* slab fields */
132 struct kmem_cache *slab_cache;
133 struct slab *slab_page;
134 };
135 }; 132 };
136 133
137 /* Remainder is not double word aligned */ 134 /* Remainder is not double word aligned */
@@ -146,7 +143,7 @@ struct page {
146#if USE_SPLIT_PTLOCKS 143#if USE_SPLIT_PTLOCKS
147 spinlock_t ptl; 144 spinlock_t ptl;
148#endif 145#endif
149 struct kmem_cache *slab; /* SLUB: Pointer to slab */ 146 struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */
150 struct page *first_page; /* Compound tail pages */ 147 struct page *first_page; /* Compound tail pages */
151 }; 148 };
152 149
@@ -175,6 +172,10 @@ struct page {
175 */ 172 */
176 void *shadow; 173 void *shadow;
177#endif 174#endif
175
176#ifdef CONFIG_NUMA_BALANCING
177 int _last_nid;
178#endif
178} 179}
179/* 180/*
180 * The struct page can be forced to be double word aligned so that atomic ops 181 * The struct page can be forced to be double word aligned so that atomic ops
@@ -224,7 +225,8 @@ struct vm_region {
224 * library, the executable area etc). 225 * library, the executable area etc).
225 */ 226 */
226struct vm_area_struct { 227struct vm_area_struct {
227 struct mm_struct * vm_mm; /* The address space we belong to. */ 228 /* The first cache line has the info for VMA tree walking. */
229
228 unsigned long vm_start; /* Our start address within vm_mm. */ 230 unsigned long vm_start; /* Our start address within vm_mm. */
229 unsigned long vm_end; /* The first byte after our end address 231 unsigned long vm_end; /* The first byte after our end address
230 within vm_mm. */ 232 within vm_mm. */
@@ -232,11 +234,22 @@ struct vm_area_struct {
232 /* linked list of VM areas per task, sorted by address */ 234 /* linked list of VM areas per task, sorted by address */
233 struct vm_area_struct *vm_next, *vm_prev; 235 struct vm_area_struct *vm_next, *vm_prev;
234 236
237 struct rb_node vm_rb;
238
239 /*
240 * Largest free memory gap in bytes to the left of this VMA.
241 * Either between this VMA and vma->vm_prev, or between one of the
242 * VMAs below us in the VMA rbtree and its ->vm_prev. This helps
243 * get_unmapped_area find a free area of the right size.
244 */
245 unsigned long rb_subtree_gap;
246
247 /* Second cache line starts here. */
248
249 struct mm_struct *vm_mm; /* The address space we belong to. */
235 pgprot_t vm_page_prot; /* Access permissions of this VMA. */ 250 pgprot_t vm_page_prot; /* Access permissions of this VMA. */
236 unsigned long vm_flags; /* Flags, see mm.h. */ 251 unsigned long vm_flags; /* Flags, see mm.h. */
237 252
238 struct rb_node vm_rb;
239
240 /* 253 /*
241 * For areas with an address space and backing store, 254 * For areas with an address space and backing store,
242 * linkage into the address_space->i_mmap interval tree, or 255 * linkage into the address_space->i_mmap interval tree, or
@@ -322,6 +335,7 @@ struct mm_struct {
322 unsigned long task_size; /* size of task vm space */ 335 unsigned long task_size; /* size of task vm space */
323 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */ 336 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
324 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */ 337 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
338 unsigned long highest_vm_end; /* highest vma end address */
325 pgd_t * pgd; 339 pgd_t * pgd;
326 atomic_t mm_users; /* How many users with user space? */ 340 atomic_t mm_users; /* How many users with user space? */
327 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 341 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
@@ -398,9 +412,36 @@ struct mm_struct {
398#ifdef CONFIG_CPUMASK_OFFSTACK 412#ifdef CONFIG_CPUMASK_OFFSTACK
399 struct cpumask cpumask_allocation; 413 struct cpumask cpumask_allocation;
400#endif 414#endif
415#ifdef CONFIG_NUMA_BALANCING
416 /*
417 * numa_next_scan is the next time when the PTEs will me marked
418 * pte_numa to gather statistics and migrate pages to new nodes
419 * if necessary
420 */
421 unsigned long numa_next_scan;
422
423 /* numa_next_reset is when the PTE scanner period will be reset */
424 unsigned long numa_next_reset;
425
426 /* Restart point for scanning and setting pte_numa */
427 unsigned long numa_scan_offset;
428
429 /* numa_scan_seq prevents two threads setting pte_numa */
430 int numa_scan_seq;
431
432 /*
433 * The first node a task was scheduled on. If a task runs on
434 * a different node than Make PTE Scan Go Now.
435 */
436 int first_nid;
437#endif
401 struct uprobes_state uprobes_state; 438 struct uprobes_state uprobes_state;
402}; 439};
403 440
441/* first nid will either be a valid NID or one of these values */
442#define NUMA_PTE_SCAN_INIT -1
443#define NUMA_PTE_SCAN_ACTIVE -2
444
404static inline void mm_init_cpumask(struct mm_struct *mm) 445static inline void mm_init_cpumask(struct mm_struct *mm)
405{ 446{
406#ifdef CONFIG_CPUMASK_OFFSTACK 447#ifdef CONFIG_CPUMASK_OFFSTACK
diff --git a/include/linux/mman.h b/include/linux/mman.h
index d09dde1e57f..9aa863da287 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -11,6 +11,8 @@ extern int sysctl_overcommit_memory;
11extern int sysctl_overcommit_ratio; 11extern int sysctl_overcommit_ratio;
12extern struct percpu_counter vm_committed_as; 12extern struct percpu_counter vm_committed_as;
13 13
14unsigned long vm_memory_committed(void);
15
14static inline void vm_acct_memory(long pages) 16static inline void vm_acct_memory(long pages)
15{ 17{
16 percpu_counter_add(&vm_committed_as, pages); 18 percpu_counter_add(&vm_committed_as, pages);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 943550dfe9e..5c69315d60c 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -85,6 +85,7 @@ struct mmc_ext_csd {
85 bool boot_ro_lockable; 85 bool boot_ro_lockable;
86 u8 raw_exception_status; /* 53 */ 86 u8 raw_exception_status; /* 53 */
87 u8 raw_partition_support; /* 160 */ 87 u8 raw_partition_support; /* 160 */
88 u8 raw_rpmb_size_mult; /* 168 */
88 u8 raw_erased_mem_count; /* 181 */ 89 u8 raw_erased_mem_count; /* 181 */
89 u8 raw_ext_csd_structure; /* 194 */ 90 u8 raw_ext_csd_structure; /* 194 */
90 u8 raw_card_type; /* 196 */ 91 u8 raw_card_type; /* 196 */
@@ -206,6 +207,7 @@ struct mmc_part {
206#define MMC_BLK_DATA_AREA_MAIN (1<<0) 207#define MMC_BLK_DATA_AREA_MAIN (1<<0)
207#define MMC_BLK_DATA_AREA_BOOT (1<<1) 208#define MMC_BLK_DATA_AREA_BOOT (1<<1)
208#define MMC_BLK_DATA_AREA_GP (1<<2) 209#define MMC_BLK_DATA_AREA_GP (1<<2)
210#define MMC_BLK_DATA_AREA_RPMB (1<<3)
209}; 211};
210 212
211/* 213/*
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 9b9cdafc773..5bf7c2274fc 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -170,6 +170,8 @@ extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
170extern unsigned int mmc_calc_max_discard(struct mmc_card *card); 170extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
171 171
172extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); 172extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
173extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
174 bool is_rel_write);
173extern int mmc_hw_reset(struct mmc_host *host); 175extern int mmc_hw_reset(struct mmc_host *host);
174extern int mmc_hw_reset_check(struct mmc_host *host); 176extern int mmc_hw_reset_check(struct mmc_host *host);
175extern int mmc_can_reset(struct mmc_card *card); 177extern int mmc_can_reset(struct mmc_card *card);
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 96531664a06..34be4f47293 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -229,8 +229,9 @@ struct dw_mci_board {
229 u32 quirks; /* Workaround / Quirk flags */ 229 u32 quirks; /* Workaround / Quirk flags */
230 unsigned int bus_hz; /* Clock speed at the cclk_in pad */ 230 unsigned int bus_hz; /* Clock speed at the cclk_in pad */
231 231
232 unsigned int caps; /* Capabilities */ 232 u32 caps; /* Capabilities */
233 unsigned int caps2; /* More capabilities */ 233 u32 caps2; /* More capabilities */
234 u32 pm_caps; /* PM capabilities */
234 /* 235 /*
235 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 236 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
236 * but note that this may not be reliable after a bootloader has used 237 * but note that this may not be reliable after a bootloader has used
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 7abb0e1f7bd..61a10c17aab 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -53,12 +53,12 @@ struct mmc_ios {
53#define MMC_TIMING_LEGACY 0 53#define MMC_TIMING_LEGACY 0
54#define MMC_TIMING_MMC_HS 1 54#define MMC_TIMING_MMC_HS 1
55#define MMC_TIMING_SD_HS 2 55#define MMC_TIMING_SD_HS 2
56#define MMC_TIMING_UHS_SDR12 MMC_TIMING_LEGACY 56#define MMC_TIMING_UHS_SDR12 3
57#define MMC_TIMING_UHS_SDR25 MMC_TIMING_SD_HS 57#define MMC_TIMING_UHS_SDR25 4
58#define MMC_TIMING_UHS_SDR50 3 58#define MMC_TIMING_UHS_SDR50 5
59#define MMC_TIMING_UHS_SDR104 4 59#define MMC_TIMING_UHS_SDR104 6
60#define MMC_TIMING_UHS_DDR50 5 60#define MMC_TIMING_UHS_DDR50 7
61#define MMC_TIMING_MMC_HS200 6 61#define MMC_TIMING_MMC_HS200 8
62 62
63#define MMC_SDR_MODE 0 63#define MMC_SDR_MODE 0
64#define MMC_1_2V_DDR_MODE 1 64#define MMC_1_2V_DDR_MODE 1
@@ -136,6 +136,7 @@ struct mmc_host_ops {
136 void (*enable_preset_value)(struct mmc_host *host, bool enable); 136 void (*enable_preset_value)(struct mmc_host *host, bool enable);
137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
138 void (*hw_reset)(struct mmc_host *host); 138 void (*hw_reset)(struct mmc_host *host);
139 void (*card_event)(struct mmc_host *host);
139}; 140};
140 141
141struct mmc_card; 142struct mmc_card;
@@ -211,7 +212,7 @@ struct mmc_host {
211#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */ 212#define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */
212#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */ 213#define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
213 214
214 unsigned long caps; /* Host capabilities */ 215 u32 caps; /* Host capabilities */
215 216
216#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 217#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
217#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */ 218#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
@@ -241,7 +242,7 @@ struct mmc_host {
241#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 242#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
242#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */ 243#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
243 244
244 unsigned int caps2; /* More host capabilities */ 245 u32 caps2; /* More host capabilities */
245 246
246#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 247#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
247#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 248#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 01e4b394029..94d532e41c6 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -286,6 +286,7 @@ struct _mmc_csd {
286#define EXT_CSD_BKOPS_START 164 /* W */ 286#define EXT_CSD_BKOPS_START 164 /* W */
287#define EXT_CSD_SANITIZE_START 165 /* W */ 287#define EXT_CSD_SANITIZE_START 165 /* W */
288#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 288#define EXT_CSD_WR_REL_PARAM 166 /* RO */
289#define EXT_CSD_RPMB_MULT 168 /* RO */
289#define EXT_CSD_BOOT_WP 173 /* R/W */ 290#define EXT_CSD_BOOT_WP 173 /* R/W */
290#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 291#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
291#define EXT_CSD_PART_CONFIG 179 /* R/W */ 292#define EXT_CSD_PART_CONFIG 179 /* R/W */
@@ -339,6 +340,7 @@ struct _mmc_csd {
339 340
340#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) 341#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
341#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) 342#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
343#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3)
342#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 344#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
343 345
344#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) 346#define EXT_CSD_PART_SUPPORT_PART_EN (0x1)
diff --git a/include/linux/mmc/mxs-mmc.h b/include/linux/mmc/mxs-mmc.h
deleted file mode 100644
index 7c2ad3a7f2f..00000000000
--- a/include/linux/mmc/mxs-mmc.h
+++ /dev/null
@@ -1,19 +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 __LINUX_MMC_MXS_MMC_H__
10#define __LINUX_MMC_MXS_MMC_H__
11
12struct mxs_mmc_platform_data {
13 int wp_gpio; /* write protect pin */
14 unsigned int flags;
15#define SLOTF_4_BIT_CAPABLE (1 << 0)
16#define SLOTF_8_BIT_CAPABLE (1 << 1)
17};
18
19#endif /* __LINUX_MMC_MXS_MMC_H__ */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 1edcb4dad8c..4bbc3301fbb 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -92,6 +92,8 @@ struct sdhci_host {
92 92
93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0) 93#define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1) 94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
95 97
96 int irq; /* Device IRQ */ 98 int irq; /* Device IRQ */
97 void __iomem *ioaddr; /* Mapped address */ 99 void __iomem *ioaddr; /* Mapped address */
@@ -158,8 +160,8 @@ struct sdhci_host {
158 160
159 struct timer_list timer; /* Timer for timeouts */ 161 struct timer_list timer; /* Timer for timeouts */
160 162
161 unsigned int caps; /* Alternative CAPABILITY_0 */ 163 u32 caps; /* Alternative CAPABILITY_0 */
162 unsigned int caps1; /* Alternative CAPABILITY_1 */ 164 u32 caps1; /* Alternative CAPABILITY_1 */
163 165
164 unsigned int ocr_avail_sdio; /* OCR bit masks */ 166 unsigned int ocr_avail_sdio; /* OCR bit masks */
165 unsigned int ocr_avail_sd; 167 unsigned int ocr_avail_sd;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a23923ba826..4bec5be82ca 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -63,10 +63,8 @@ enum {
63 63
64#ifdef CONFIG_CMA 64#ifdef CONFIG_CMA
65# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA) 65# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
66# define cma_wmark_pages(zone) zone->min_cma_pages
67#else 66#else
68# define is_migrate_cma(migratetype) false 67# define is_migrate_cma(migratetype) false
69# define cma_wmark_pages(zone) 0
70#endif 68#endif
71 69
72#define for_each_migratetype_order(order, type) \ 70#define for_each_migratetype_order(order, type) \
@@ -383,13 +381,6 @@ struct zone {
383 /* see spanned/present_pages for more description */ 381 /* see spanned/present_pages for more description */
384 seqlock_t span_seqlock; 382 seqlock_t span_seqlock;
385#endif 383#endif
386#ifdef CONFIG_CMA
387 /*
388 * CMA needs to increase watermark levels during the allocation
389 * process to make sure that the system is not starved.
390 */
391 unsigned long min_cma_pages;
392#endif
393 struct free_area free_area[MAX_ORDER]; 384 struct free_area free_area[MAX_ORDER];
394 385
395#ifndef CONFIG_SPARSEMEM 386#ifndef CONFIG_SPARSEMEM
@@ -469,17 +460,44 @@ struct zone {
469 unsigned long zone_start_pfn; 460 unsigned long zone_start_pfn;
470 461
471 /* 462 /*
472 * zone_start_pfn, spanned_pages and present_pages are all 463 * spanned_pages is the total pages spanned by the zone, including
473 * protected by span_seqlock. It is a seqlock because it has 464 * holes, which is calculated as:
474 * to be read outside of zone->lock, and it is done in the main 465 * spanned_pages = zone_end_pfn - zone_start_pfn;
475 * allocator path. But, it is written quite infrequently. 466 *
467 * present_pages is physical pages existing within the zone, which
468 * is calculated as:
469 * present_pages = spanned_pages - absent_pages(pags in holes);
470 *
471 * managed_pages is present pages managed by the buddy system, which
472 * is calculated as (reserved_pages includes pages allocated by the
473 * bootmem allocator):
474 * managed_pages = present_pages - reserved_pages;
475 *
476 * So present_pages may be used by memory hotplug or memory power
477 * management logic to figure out unmanaged pages by checking
478 * (present_pages - managed_pages). And managed_pages should be used
479 * by page allocator and vm scanner to calculate all kinds of watermarks
480 * and thresholds.
481 *
482 * Locking rules:
476 * 483 *
477 * The lock is declared along with zone->lock because it is 484 * zone_start_pfn and spanned_pages are protected by span_seqlock.
485 * It is a seqlock because it has to be read outside of zone->lock,
486 * and it is done in the main allocator path. But, it is written
487 * quite infrequently.
488 *
489 * The span_seq lock is declared along with zone->lock because it is
478 * frequently read in proximity to zone->lock. It's good to 490 * frequently read in proximity to zone->lock. It's good to
479 * give them a chance of being in the same cacheline. 491 * give them a chance of being in the same cacheline.
492 *
493 * Write access to present_pages and managed_pages at runtime should
494 * be protected by lock_memory_hotplug()/unlock_memory_hotplug().
495 * Any reader who can't tolerant drift of present_pages and
496 * managed_pages should hold memory hotplug lock to get a stable value.
480 */ 497 */
481 unsigned long spanned_pages; /* total size, including holes */ 498 unsigned long spanned_pages;
482 unsigned long present_pages; /* amount of memory (excluding holes) */ 499 unsigned long present_pages;
500 unsigned long managed_pages;
483 501
484 /* 502 /*
485 * rarely used fields: 503 * rarely used fields:
@@ -717,6 +735,19 @@ typedef struct pglist_data {
717 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 735 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */
718 int kswapd_max_order; 736 int kswapd_max_order;
719 enum zone_type classzone_idx; 737 enum zone_type classzone_idx;
738#ifdef CONFIG_NUMA_BALANCING
739 /*
740 * Lock serializing the per destination node AutoNUMA memory
741 * migration rate limiting data.
742 */
743 spinlock_t numabalancing_migrate_lock;
744
745 /* Rate limiting time interval */
746 unsigned long numabalancing_migrate_next_window;
747
748 /* Number of pages migrated during the rate limiting time interval */
749 unsigned long numabalancing_migrate_nr_pages;
750#endif
720} pg_data_t; 751} pg_data_t;
721 752
722#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages) 753#define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 5a8e3903d77..12b2ab51032 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -4,9 +4,10 @@
4 4
5struct mnt_namespace; 5struct mnt_namespace;
6struct fs_struct; 6struct fs_struct;
7struct user_namespace;
7 8
8extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 9extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
9 struct fs_struct *); 10 struct user_namespace *, struct fs_struct *);
10extern void put_mnt_ns(struct mnt_namespace *ns); 11extern void put_mnt_ns(struct mnt_namespace *ns);
11 12
12extern const struct file_operations proc_mounts_operations; 13extern const struct file_operations proc_mounts_operations;
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index d6a58065c09..137b4198fc0 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -16,17 +16,15 @@
16/* Chosen so that structs with an unsigned long line up. */ 16/* Chosen so that structs with an unsigned long line up. */
17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) 17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
18 18
19#define ___module_cat(a,b) __mod_ ## a ## b
20#define __module_cat(a,b) ___module_cat(a,b)
21#ifdef MODULE 19#ifdef MODULE
22#define __MODULE_INFO(tag, name, info) \ 20#define __MODULE_INFO(tag, name, info) \
23static const char __module_cat(name,__LINE__)[] \ 21static const char __UNIQUE_ID(name)[] \
24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \ 22 __used __attribute__((section(".modinfo"), unused, aligned(1))) \
25 = __stringify(tag) "=" info 23 = __stringify(tag) "=" info
26#else /* !MODULE */ 24#else /* !MODULE */
27/* This struct is here for syntactic coherency, it is not used */ 25/* This struct is here for syntactic coherency, it is not used */
28#define __MODULE_INFO(tag, name, info) \ 26#define __MODULE_INFO(tag, name, info) \
29 struct __module_cat(name,__LINE__) {} 27 struct __UNIQUE_ID(name) {}
30#endif 28#endif
31#define __MODULE_PARM_TYPE(name, _type) \ 29#define __MODULE_PARM_TYPE(name, _type) \
32 __MODULE_INFO(parmtype, name##type, #name ":" _type) 30 __MODULE_INFO(parmtype, name##type, #name ":" _type)
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index ed270bd2e4d..4eb0a50d0c5 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/kref.h> 24#include <linux/kref.h>
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/workqueue.h>
26 27
27struct hd_geometry; 28struct hd_geometry;
28struct mtd_info; 29struct mtd_info;
@@ -43,7 +44,8 @@ struct mtd_blktrans_dev {
43 struct kref ref; 44 struct kref ref;
44 struct gendisk *disk; 45 struct gendisk *disk;
45 struct attribute_group *disk_attributes; 46 struct attribute_group *disk_attributes;
46 struct task_struct *thread; 47 struct workqueue_struct *wq;
48 struct work_struct work;
47 struct request_queue *rq; 49 struct request_queue *rq;
48 spinlock_t queue_lock; 50 spinlock_t queue_lock;
49 void *priv; 51 void *priv;
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0f6fea73a1f..407d1e556c3 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -92,12 +92,26 @@
92 * Others use readb/writeb 92 * Others use readb/writeb
93 */ 93 */
94#if defined(__arm__) 94#if defined(__arm__)
95#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) 95static inline u8 ReadDOC_(u32 __iomem *addr, unsigned long reg)
96#define WriteDOC_(d, adr, reg) do{ *(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)) = (__u32)d; wmb();} while(0) 96{
97 return __raw_readl(addr + reg);
98}
99static inline void WriteDOC_(u8 data, u32 __iomem *addr, unsigned long reg)
100{
101 __raw_writel(data, addr + reg);
102 wmb();
103}
97#define DOC_IOREMAP_LEN 0x8000 104#define DOC_IOREMAP_LEN 0x8000
98#elif defined(__ppc__) 105#elif defined(__ppc__)
99#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)))) 106static inline u8 ReadDOC_(u16 __iomem *addr, unsigned long reg)
100#define WriteDOC_(d, adr, reg) do{ *(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)) = (__u16)d; wmb();} while(0) 107{
108 return __raw_readw(addr + reg);
109}
110static inline void WriteDOC_(u8 data, u16 __iomem *addr, unsigned long reg)
111{
112 __raw_writew(data, addr + reg);
113 wmb();
114}
101#define DOC_IOREMAP_LEN 0x4000 115#define DOC_IOREMAP_LEN 0x4000
102#else 116#else
103#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) 117#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg))
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index b20029221fb..d6ed61ef451 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -155,9 +155,6 @@ struct fsmc_nand_platform_data {
155 unsigned int width; 155 unsigned int width;
156 unsigned int bank; 156 unsigned int bank;
157 157
158 /* CLE, ALE offsets */
159 unsigned int cle_off;
160 unsigned int ale_off;
161 enum access_mode mode; 158 enum access_mode mode;
162 159
163 void (*select_bank)(uint32_t bank, uint32_t busw); 160 void (*select_bank)(uint32_t bank, uint32_t busw);
diff --git a/include/linux/mtd/gpmi-nand.h b/include/linux/mtd/gpmi-nand.h
deleted file mode 100644
index ed3c4e09f3d..00000000000
--- a/include/linux/mtd/gpmi-nand.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 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 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
19#ifndef __MACH_MXS_GPMI_NAND_H__
20#define __MACH_MXS_GPMI_NAND_H__
21
22/* The size of the resources is fixed. */
23#define GPMI_NAND_RES_SIZE 6
24
25/* Resource names for the GPMI NAND driver. */
26#define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME "gpmi-nand"
27#define GPMI_NAND_GPMI_INTERRUPT_RES_NAME "GPMI NAND GPMI Interrupt"
28#define GPMI_NAND_BCH_REGS_ADDR_RES_NAME "bch"
29#define GPMI_NAND_BCH_INTERRUPT_RES_NAME "bch"
30#define GPMI_NAND_DMA_CHANNELS_RES_NAME "GPMI NAND DMA Channels"
31#define GPMI_NAND_DMA_INTERRUPT_RES_NAME "gpmi-dma"
32
33/**
34 * struct gpmi_nand_platform_data - GPMI NAND driver platform data.
35 *
36 * This structure communicates platform-specific information to the GPMI NAND
37 * driver that can't be expressed as resources.
38 *
39 * @platform_init: A pointer to a function the driver will call to
40 * initialize the platform (e.g., set up the pin mux).
41 * @min_prop_delay_in_ns: Minimum propagation delay of GPMI signals to and
42 * from the NAND Flash device, in nanoseconds.
43 * @max_prop_delay_in_ns: Maximum propagation delay of GPMI signals to and
44 * from the NAND Flash device, in nanoseconds.
45 * @max_chip_count: The maximum number of chips for which the driver
46 * should configure the hardware. This value most
47 * likely reflects the number of pins that are
48 * connected to a NAND Flash device. If this is
49 * greater than the SoC hardware can support, the
50 * driver will print a message and fail to initialize.
51 * @partitions: An optional pointer to an array of partition
52 * descriptions.
53 * @partition_count: The number of elements in the partitions array.
54 */
55struct gpmi_nand_platform_data {
56 /* SoC hardware information. */
57 int (*platform_init)(void);
58
59 /* NAND Flash information. */
60 unsigned int min_prop_delay_in_ns;
61 unsigned int max_prop_delay_in_ns;
62 unsigned int max_chip_count;
63
64 /* Medium information. */
65 struct mtd_partition *partitions;
66 unsigned partition_count;
67};
68#endif
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 3595a0236b0..f6eb4332ac9 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -328,7 +328,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word
328 328
329static inline map_word map_word_load(struct map_info *map, const void *ptr) 329static inline map_word map_word_load(struct map_info *map, const void *ptr)
330{ 330{
331 map_word r; 331 map_word r = {{0} };
332 332
333 if (map_bankwidth_is_1(map)) 333 if (map_bankwidth_is_1(map))
334 r.x[0] = *(unsigned char *)ptr; 334 r.x[0] = *(unsigned char *)ptr;
@@ -391,7 +391,7 @@ static inline map_word map_word_ff(struct map_info *map)
391 391
392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
393{ 393{
394 map_word r; 394 map_word uninitialized_var(r);
395 395
396 if (map_bankwidth_is_1(map)) 396 if (map_bankwidth_is_1(map))
397 r.x[0] = __raw_readb(map->virt + ofs); 397 r.x[0] = __raw_readb(map->virt + ofs);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 81d61e70459..f9ac2897b86 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -98,7 +98,7 @@ struct mtd_oob_ops {
98}; 98};
99 99
100#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 100#define MTD_MAX_OOBFREE_ENTRIES_LARGE 32
101#define MTD_MAX_ECCPOS_ENTRIES_LARGE 448 101#define MTD_MAX_ECCPOS_ENTRIES_LARGE 640
102/* 102/*
103 * Internal ECC layout control structure. For historical reasons, there is a 103 * Internal ECC layout control structure. For historical reasons, there is a
104 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained 104 * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 24e915957e4..7ccb3c59ed6 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -219,6 +219,13 @@ typedef enum {
219#define NAND_OWN_BUFFERS 0x00020000 219#define NAND_OWN_BUFFERS 0x00020000
220/* Chip may not exist, so silence any errors in scan */ 220/* Chip may not exist, so silence any errors in scan */
221#define NAND_SCAN_SILENT_NODEV 0x00040000 221#define NAND_SCAN_SILENT_NODEV 0x00040000
222/*
223 * Autodetect nand buswidth with readid/onfi.
224 * This suppose the driver will configure the hardware in 8 bits mode
225 * when calling nand_scan_ident, and update its configuration
226 * before calling nand_scan_tail.
227 */
228#define NAND_BUSWIDTH_AUTO 0x00080000
222 229
223/* Options set by nand scan */ 230/* Options set by nand scan */
224/* Nand scan has allocated controller struct */ 231/* Nand scan has allocated controller struct */
@@ -471,8 +478,8 @@ struct nand_buffers {
471 * non 0 if ONFI supported. 478 * non 0 if ONFI supported.
472 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is 479 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
473 * supported, 0 otherwise. 480 * supported, 0 otherwise.
474 * @onfi_set_features [REPLACEABLE] set the features for ONFI nand 481 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
475 * @onfi_get_features [REPLACEABLE] get the features for ONFI nand 482 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
476 * @ecclayout: [REPLACEABLE] the default ECC placement scheme 483 * @ecclayout: [REPLACEABLE] the default ECC placement scheme
477 * @bbt: [INTERN] bad block table pointer 484 * @bbt: [INTERN] bad block table pointer
478 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 485 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index 01e4b15b280..1c28f8879b1 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -20,6 +20,7 @@
20#ifndef __SH_FLCTL_H__ 20#ifndef __SH_FLCTL_H__
21#define __SH_FLCTL_H__ 21#define __SH_FLCTL_H__
22 22
23#include <linux/completion.h>
23#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h> 25#include <linux/mtd/nand.h>
25#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
@@ -107,6 +108,7 @@
107#define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */ 108#define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */
108#define AC1CLR (0x1 << 19) /* ECC FIFO clear */ 109#define AC1CLR (0x1 << 19) /* ECC FIFO clear */
109#define AC0CLR (0x1 << 18) /* Data FIFO clear */ 110#define AC0CLR (0x1 << 18) /* Data FIFO clear */
111#define DREQ0EN (0x1 << 16) /* FLDTFIFODMA Request Enable */
110#define ECERB (0x1 << 9) /* ECC error */ 112#define ECERB (0x1 << 9) /* ECC error */
111#define STERB (0x1 << 8) /* Status error */ 113#define STERB (0x1 << 8) /* Status error */
112#define STERINTE (0x1 << 4) /* Status error enable */ 114#define STERINTE (0x1 << 4) /* Status error enable */
@@ -138,6 +140,8 @@ enum flctl_ecc_res_t {
138 FL_TIMEOUT 140 FL_TIMEOUT
139}; 141};
140 142
143struct dma_chan;
144
141struct sh_flctl { 145struct sh_flctl {
142 struct mtd_info mtd; 146 struct mtd_info mtd;
143 struct nand_chip chip; 147 struct nand_chip chip;
@@ -147,7 +151,7 @@ struct sh_flctl {
147 151
148 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ 152 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
149 int read_bytes; 153 int read_bytes;
150 int index; 154 unsigned int index;
151 int seqin_column; /* column in SEQIN cmd */ 155 int seqin_column; /* column in SEQIN cmd */
152 int seqin_page_addr; /* page_addr in SEQIN cmd */ 156 int seqin_page_addr; /* page_addr in SEQIN cmd */
153 uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */ 157 uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */
@@ -161,6 +165,11 @@ struct sh_flctl {
161 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ 165 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */
162 unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */ 166 unsigned holden:1; /* Hardware has FLHOLDCR and HOLDEN is set */
163 unsigned qos_request:1; /* QoS request to prevent deep power shutdown */ 167 unsigned qos_request:1; /* QoS request to prevent deep power shutdown */
168
169 /* DMA related objects */
170 struct dma_chan *chan_fifo0_rx;
171 struct dma_chan *chan_fifo0_tx;
172 struct completion dma_complete;
164}; 173};
165 174
166struct sh_flctl_platform_data { 175struct sh_flctl_platform_data {
@@ -170,6 +179,9 @@ struct sh_flctl_platform_data {
170 179
171 unsigned has_hwecc:1; 180 unsigned has_hwecc:1;
172 unsigned use_holden:1; 181 unsigned use_holden:1;
182
183 unsigned int slave_id_fifo0_tx;
184 unsigned int slave_id_fifo0_rx;
173}; 185};
174 186
175static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo) 187static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 4bf19d8174e..e998c030061 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -65,8 +65,8 @@ extern int user_path_at_empty(int, const char __user *, unsigned, struct path *,
65 65
66extern int kern_path(const char *, unsigned, struct path *); 66extern int kern_path(const char *, unsigned, struct path *);
67 67
68extern struct dentry *kern_path_create(int, const char *, struct path *, int); 68extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int);
69extern struct dentry *user_path_create(int, const char __user *, struct path *, int); 69extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
70extern void done_path_create(struct path *, struct dentry *); 70extern void done_path_create(struct path *, struct dentry *);
71extern struct dentry *kern_path_locked(const char *, struct path *); 71extern struct dentry *kern_path_locked(const char *, struct path *);
72extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 72extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
@@ -98,4 +98,20 @@ static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
98 ((char *) name)[min(len, maxlen)] = '\0'; 98 ((char *) name)[min(len, maxlen)] = '\0';
99} 99}
100 100
101/**
102 * retry_estale - determine whether the caller should retry an operation
103 * @error: the error that would currently be returned
104 * @flags: flags being used for next lookup attempt
105 *
106 * Check to see if the error code was -ESTALE, and then determine whether
107 * to retry the call based on whether "flags" already has LOOKUP_REVAL set.
108 *
109 * Returns true if the caller should try the operation again.
110 */
111static inline bool
112retry_estale(const long error, const unsigned int flags)
113{
114 return error == -ESTALE && !(flags & LOOKUP_REVAL);
115}
116
101#endif /* _LINUX_NAMEI_H */ 117#endif /* _LINUX_NAMEI_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a848ffc327f..02e0f6b156c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -369,7 +369,7 @@ typedef enum gro_result gro_result_t;
369 * 369 *
370 * If the rx_handler consider the skb should be ignored, it should return 370 * If the rx_handler consider the skb should be ignored, it should return
371 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that 371 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
372 * are registred on exact device (ptype->dev == skb->dev). 372 * are registered on exact device (ptype->dev == skb->dev).
373 * 373 *
374 * If the rx_handler didn't changed skb->dev, but want the skb to be normally 374 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
375 * delivered, it should return RX_HANDLER_PASS. 375 * delivered, it should return RX_HANDLER_PASS.
@@ -887,6 +887,10 @@ struct netdev_fcoe_hbainfo {
887 * struct net_device *dev, int idx) 887 * struct net_device *dev, int idx)
888 * Used to add FDB entries to dump requests. Implementers should add 888 * Used to add FDB entries to dump requests. Implementers should add
889 * entries to skb and update idx with the number of entries. 889 * entries to skb and update idx with the number of entries.
890 *
891 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
892 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
893 * struct net_device *dev)
890 */ 894 */
891struct net_device_ops { 895struct net_device_ops {
892 int (*ndo_init)(struct net_device *dev); 896 int (*ndo_init)(struct net_device *dev);
@@ -998,6 +1002,12 @@ struct net_device_ops {
998 struct netlink_callback *cb, 1002 struct netlink_callback *cb,
999 struct net_device *dev, 1003 struct net_device *dev,
1000 int idx); 1004 int idx);
1005
1006 int (*ndo_bridge_setlink)(struct net_device *dev,
1007 struct nlmsghdr *nlh);
1008 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1009 u32 pid, u32 seq,
1010 struct net_device *dev);
1001}; 1011};
1002 1012
1003/* 1013/*
@@ -1053,6 +1063,12 @@ struct net_device {
1053 netdev_features_t wanted_features; 1063 netdev_features_t wanted_features;
1054 /* mask of features inheritable by VLAN devices */ 1064 /* mask of features inheritable by VLAN devices */
1055 netdev_features_t vlan_features; 1065 netdev_features_t vlan_features;
1066 /* mask of features inherited by encapsulating devices
1067 * This field indicates what encapsulation offloads
1068 * the hardware is capable of doing, and drivers will
1069 * need to set them appropriately.
1070 */
1071 netdev_features_t hw_enc_features;
1056 1072
1057 /* Interface index. Unique device identifier */ 1073 /* Interface index. Unique device identifier */
1058 int ifindex; 1074 int ifindex;
@@ -1502,16 +1518,25 @@ struct packet_type {
1502 struct net_device *, 1518 struct net_device *,
1503 struct packet_type *, 1519 struct packet_type *,
1504 struct net_device *); 1520 struct net_device *);
1521 bool (*id_match)(struct packet_type *ptype,
1522 struct sock *sk);
1523 void *af_packet_priv;
1524 struct list_head list;
1525};
1526
1527struct offload_callbacks {
1505 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1528 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1506 netdev_features_t features); 1529 netdev_features_t features);
1507 int (*gso_send_check)(struct sk_buff *skb); 1530 int (*gso_send_check)(struct sk_buff *skb);
1508 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1531 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1509 struct sk_buff *skb); 1532 struct sk_buff *skb);
1510 int (*gro_complete)(struct sk_buff *skb); 1533 int (*gro_complete)(struct sk_buff *skb);
1511 bool (*id_match)(struct packet_type *ptype, 1534};
1512 struct sock *sk); 1535
1513 void *af_packet_priv; 1536struct packet_offload {
1514 struct list_head list; 1537 __be16 type; /* This is really htons(ether_type). */
1538 struct offload_callbacks callbacks;
1539 struct list_head list;
1515}; 1540};
1516 1541
1517#include <linux/notifier.h> 1542#include <linux/notifier.h>
@@ -1551,6 +1576,8 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1551 1576
1552extern rwlock_t dev_base_lock; /* Device list lock */ 1577extern rwlock_t dev_base_lock; /* Device list lock */
1553 1578
1579extern seqlock_t devnet_rename_seq; /* Device rename lock */
1580
1554 1581
1555#define for_each_netdev(net, d) \ 1582#define for_each_netdev(net, d) \
1556 list_for_each_entry(d, &(net)->dev_base_head, dev_list) 1583 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
@@ -1608,6 +1635,9 @@ extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short
1608extern void dev_add_pack(struct packet_type *pt); 1635extern void dev_add_pack(struct packet_type *pt);
1609extern void dev_remove_pack(struct packet_type *pt); 1636extern void dev_remove_pack(struct packet_type *pt);
1610extern void __dev_remove_pack(struct packet_type *pt); 1637extern void __dev_remove_pack(struct packet_type *pt);
1638extern void dev_add_offload(struct packet_offload *po);
1639extern void dev_remove_offload(struct packet_offload *po);
1640extern void __dev_remove_offload(struct packet_offload *po);
1611 1641
1612extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags, 1642extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1613 unsigned short mask); 1643 unsigned short mask);
@@ -2132,16 +2162,10 @@ extern void dev_kfree_skb_any(struct sk_buff *skb);
2132extern int netif_rx(struct sk_buff *skb); 2162extern int netif_rx(struct sk_buff *skb);
2133extern int netif_rx_ni(struct sk_buff *skb); 2163extern int netif_rx_ni(struct sk_buff *skb);
2134extern int netif_receive_skb(struct sk_buff *skb); 2164extern int netif_receive_skb(struct sk_buff *skb);
2135extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2136 struct sk_buff *skb);
2137extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
2138extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2165extern gro_result_t napi_gro_receive(struct napi_struct *napi,
2139 struct sk_buff *skb); 2166 struct sk_buff *skb);
2140extern void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2167extern void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2141extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2168extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2143 struct sk_buff *skb,
2144 gro_result_t ret);
2145extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2169extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2146 2170
2147static inline void napi_free_frags(struct napi_struct *napi) 2171static inline void napi_free_frags(struct napi_struct *napi)
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 5f84c6229dc..610208b18c0 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -47,15 +47,6 @@ ip6t_ext_hdr(u8 nexthdr)
47 (nexthdr == IPPROTO_DSTOPTS); 47 (nexthdr == IPPROTO_DSTOPTS);
48} 48}
49 49
50enum {
51 IP6T_FH_F_FRAG = (1 << 0),
52 IP6T_FH_F_AUTH = (1 << 1),
53};
54
55/* find specified header and get offset to it */
56extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
57 int target, unsigned short *fragoff, int *fragflg);
58
59#ifdef CONFIG_COMPAT 50#ifdef CONFIG_COMPAT
60#include <net/compat.h> 51#include <net/compat.h>
61 52
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
deleted file mode 100644
index 9890bbaf432..00000000000
--- a/include/linux/nfc/pn544.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.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,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _PN544_H_
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28#define PN544_DRIVER_NAME "pn544"
29#define PN544_MAXWINDOW_SIZE 7
30#define PN544_WINDOW_SIZE 4
31#define PN544_RETRIES 10
32#define PN544_MAX_I2C_TRANSFER 0x0400
33#define PN544_MSG_MAX_SIZE 0x21 /* at normal HCI mode */
34
35/* ioctl */
36#define PN544_CHAR_BASE 'P'
37#define PN544_IOR(num, dtype) _IOR(PN544_CHAR_BASE, num, dtype)
38#define PN544_IOW(num, dtype) _IOW(PN544_CHAR_BASE, num, dtype)
39#define PN544_GET_FW_MODE PN544_IOW(1, unsigned int)
40#define PN544_SET_FW_MODE PN544_IOW(2, unsigned int)
41#define PN544_GET_DEBUG PN544_IOW(3, unsigned int)
42#define PN544_SET_DEBUG PN544_IOW(4, unsigned int)
43
44/* Timing restrictions (ms) */
45#define PN544_RESETVEN_TIME 30 /* 7 */
46#define PN544_PVDDVEN_TIME 0
47#define PN544_VBATVEN_TIME 0
48#define PN544_GPIO4VEN_TIME 0
49#define PN544_WAKEUP_ACK 5
50#define PN544_WAKEUP_GUARD (PN544_WAKEUP_ACK + 1)
51#define PN544_INACTIVITY_TIME 1000
52#define PN544_INTERFRAME_DELAY 200 /* us */
53#define PN544_BAUDRATE_CHANGE 150 /* us */
54
55/* Debug bits */
56#define PN544_DEBUG_BUF 0x01
57#define PN544_DEBUG_READ 0x02
58#define PN544_DEBUG_WRITE 0x04
59#define PN544_DEBUG_IRQ 0x08
60#define PN544_DEBUG_CALLS 0x10
61#define PN544_DEBUG_MODE 0x20
62
63/* Normal (HCI) mode */
64#define PN544_LLC_HCI_OVERHEAD 3 /* header + crc (to length) */
65#define PN544_LLC_MIN_SIZE (1 + PN544_LLC_HCI_OVERHEAD) /* length + */
66#define PN544_LLC_MAX_DATA (PN544_MSG_MAX_SIZE - 2)
67#define PN544_LLC_MAX_HCI_SIZE (PN544_LLC_MAX_DATA - 2)
68
69struct pn544_llc_packet {
70 unsigned char length; /* of rest of packet */
71 unsigned char header;
72 unsigned char data[PN544_LLC_MAX_DATA]; /* includes crc-ccitt */
73};
74
75/* Firmware upgrade mode */
76#define PN544_FW_HEADER_SIZE 3
77/* max fw transfer is 1024bytes, but I2C limits it to 0xC0 */
78#define PN544_MAX_FW_DATA (PN544_MAX_I2C_TRANSFER - PN544_FW_HEADER_SIZE)
79
80struct pn544_fw_packet {
81 unsigned char command; /* status in answer */
82 unsigned char length[2]; /* big-endian order (msf) */
83 unsigned char data[PN544_MAX_FW_DATA];
84};
85
86#ifdef __KERNEL__
87enum {
88 NFC_GPIO_ENABLE,
89 NFC_GPIO_FW_RESET,
90 NFC_GPIO_IRQ
91};
92
93/* board config */
94struct pn544_nfc_platform_data {
95 int (*request_resources) (struct i2c_client *client);
96 void (*free_resources) (void);
97 void (*enable) (int fw);
98 int (*test) (void);
99 void (*disable) (void);
100 int (*get_gpio)(int type);
101};
102#endif /* __KERNEL__ */
103
104#endif /* _PN544_H_ */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index a9e76ee1adc..6c6ed153a9b 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -198,51 +198,4 @@ struct nfs_server {
198#define NFS_CAP_POSIX_LOCK (1U << 14) 198#define NFS_CAP_POSIX_LOCK (1U << 14)
199#define NFS_CAP_UIDGID_NOMAP (1U << 15) 199#define NFS_CAP_UIDGID_NOMAP (1U << 15)
200 200
201
202/* maximum number of slots to use */
203#define NFS4_DEF_SLOT_TABLE_SIZE (16U)
204#define NFS4_MAX_SLOT_TABLE (256U)
205#define NFS4_NO_SLOT ((u32)-1)
206
207#if IS_ENABLED(CONFIG_NFS_V4)
208
209/* Sessions */
210#define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long))
211struct nfs4_slot_table {
212 struct nfs4_slot *slots; /* seqid per slot */
213 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
214 spinlock_t slot_tbl_lock;
215 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
216 u32 max_slots; /* # slots in table */
217 u32 highest_used_slotid; /* sent to server on each SEQ.
218 * op for dynamic resizing */
219 u32 target_max_slots; /* Set by CB_RECALL_SLOT as
220 * the new max_slots */
221 struct completion complete;
222};
223
224static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
225{
226 return sp - tbl->slots;
227}
228
229/*
230 * Session related parameters
231 */
232struct nfs4_session {
233 struct nfs4_sessionid sess_id;
234 u32 flags;
235 unsigned long session_state;
236 u32 hash_alg;
237 u32 ssv_len;
238
239 /* The fore and back channel */
240 struct nfs4_channel_attrs fc_attrs;
241 struct nfs4_slot_table fc_slot_table;
242 struct nfs4_channel_attrs bc_attrs;
243 struct nfs4_slot_table bc_slot_table;
244 struct nfs_client *clp;
245};
246
247#endif /* CONFIG_NFS_V4 */
248#endif 201#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a73ea89789d..29adb12c7ec 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -185,23 +185,20 @@ struct nfs4_channel_attrs {
185 u32 max_reqs; 185 u32 max_reqs;
186}; 186};
187 187
188/* nfs41 sessions slot seqid */ 188struct nfs4_slot;
189struct nfs4_slot {
190 u32 seq_nr;
191};
192
193struct nfs4_sequence_args { 189struct nfs4_sequence_args {
194 struct nfs4_session *sa_session; 190 struct nfs4_slot *sa_slot;
195 u32 sa_slotid; 191 u8 sa_cache_this : 1,
196 u8 sa_cache_this; 192 sa_privileged : 1;
197}; 193};
198 194
199struct nfs4_sequence_res { 195struct nfs4_sequence_res {
200 struct nfs4_session *sr_session;
201 struct nfs4_slot *sr_slot; /* slot used to send request */ 196 struct nfs4_slot *sr_slot; /* slot used to send request */
197 unsigned long sr_timestamp;
202 int sr_status; /* sequence operation status */ 198 int sr_status; /* sequence operation status */
203 unsigned long sr_renewal_time;
204 u32 sr_status_flags; 199 u32 sr_status_flags;
200 u32 sr_highest_slotid;
201 u32 sr_target_highest_slotid;
205}; 202};
206 203
207struct nfs4_get_lease_time_args { 204struct nfs4_get_lease_time_args {
@@ -209,8 +206,8 @@ struct nfs4_get_lease_time_args {
209}; 206};
210 207
211struct nfs4_get_lease_time_res { 208struct nfs4_get_lease_time_res {
212 struct nfs_fsinfo *lr_fsinfo;
213 struct nfs4_sequence_res lr_seq_res; 209 struct nfs4_sequence_res lr_seq_res;
210 struct nfs_fsinfo *lr_fsinfo;
214}; 211};
215 212
216#define PNFS_LAYOUT_MAXSIZE 4096 213#define PNFS_LAYOUT_MAXSIZE 4096
@@ -228,23 +225,23 @@ struct pnfs_layout_range {
228}; 225};
229 226
230struct nfs4_layoutget_args { 227struct nfs4_layoutget_args {
228 struct nfs4_sequence_args seq_args;
231 __u32 type; 229 __u32 type;
232 struct pnfs_layout_range range; 230 struct pnfs_layout_range range;
233 __u64 minlength; 231 __u64 minlength;
234 __u32 maxcount; 232 __u32 maxcount;
235 struct inode *inode; 233 struct inode *inode;
236 struct nfs_open_context *ctx; 234 struct nfs_open_context *ctx;
237 struct nfs4_sequence_args seq_args;
238 nfs4_stateid stateid; 235 nfs4_stateid stateid;
239 struct nfs4_layoutdriver_data layout; 236 struct nfs4_layoutdriver_data layout;
240}; 237};
241 238
242struct nfs4_layoutget_res { 239struct nfs4_layoutget_res {
240 struct nfs4_sequence_res seq_res;
243 __u32 return_on_close; 241 __u32 return_on_close;
244 struct pnfs_layout_range range; 242 struct pnfs_layout_range range;
245 __u32 type; 243 __u32 type;
246 nfs4_stateid stateid; 244 nfs4_stateid stateid;
247 struct nfs4_sequence_res seq_res;
248 struct nfs4_layoutdriver_data *layoutp; 245 struct nfs4_layoutdriver_data *layoutp;
249}; 246};
250 247
@@ -255,38 +252,38 @@ struct nfs4_layoutget {
255}; 252};
256 253
257struct nfs4_getdevicelist_args { 254struct nfs4_getdevicelist_args {
255 struct nfs4_sequence_args seq_args;
258 const struct nfs_fh *fh; 256 const struct nfs_fh *fh;
259 u32 layoutclass; 257 u32 layoutclass;
260 struct nfs4_sequence_args seq_args;
261}; 258};
262 259
263struct nfs4_getdevicelist_res { 260struct nfs4_getdevicelist_res {
264 struct pnfs_devicelist *devlist;
265 struct nfs4_sequence_res seq_res; 261 struct nfs4_sequence_res seq_res;
262 struct pnfs_devicelist *devlist;
266}; 263};
267 264
268struct nfs4_getdeviceinfo_args { 265struct nfs4_getdeviceinfo_args {
269 struct pnfs_device *pdev;
270 struct nfs4_sequence_args seq_args; 266 struct nfs4_sequence_args seq_args;
267 struct pnfs_device *pdev;
271}; 268};
272 269
273struct nfs4_getdeviceinfo_res { 270struct nfs4_getdeviceinfo_res {
274 struct pnfs_device *pdev;
275 struct nfs4_sequence_res seq_res; 271 struct nfs4_sequence_res seq_res;
272 struct pnfs_device *pdev;
276}; 273};
277 274
278struct nfs4_layoutcommit_args { 275struct nfs4_layoutcommit_args {
276 struct nfs4_sequence_args seq_args;
279 nfs4_stateid stateid; 277 nfs4_stateid stateid;
280 __u64 lastbytewritten; 278 __u64 lastbytewritten;
281 struct inode *inode; 279 struct inode *inode;
282 const u32 *bitmask; 280 const u32 *bitmask;
283 struct nfs4_sequence_args seq_args;
284}; 281};
285 282
286struct nfs4_layoutcommit_res { 283struct nfs4_layoutcommit_res {
284 struct nfs4_sequence_res seq_res;
287 struct nfs_fattr *fattr; 285 struct nfs_fattr *fattr;
288 const struct nfs_server *server; 286 const struct nfs_server *server;
289 struct nfs4_sequence_res seq_res;
290 int status; 287 int status;
291}; 288};
292 289
@@ -300,11 +297,11 @@ struct nfs4_layoutcommit_data {
300}; 297};
301 298
302struct nfs4_layoutreturn_args { 299struct nfs4_layoutreturn_args {
300 struct nfs4_sequence_args seq_args;
303 struct pnfs_layout_hdr *layout; 301 struct pnfs_layout_hdr *layout;
304 struct inode *inode; 302 struct inode *inode;
305 nfs4_stateid stateid; 303 nfs4_stateid stateid;
306 __u32 layout_type; 304 __u32 layout_type;
307 struct nfs4_sequence_args seq_args;
308}; 305};
309 306
310struct nfs4_layoutreturn_res { 307struct nfs4_layoutreturn_res {
@@ -330,6 +327,7 @@ struct stateowner_id {
330 * Arguments to the open call. 327 * Arguments to the open call.
331 */ 328 */
332struct nfs_openargs { 329struct nfs_openargs {
330 struct nfs4_sequence_args seq_args;
333 const struct nfs_fh * fh; 331 const struct nfs_fh * fh;
334 struct nfs_seqid * seqid; 332 struct nfs_seqid * seqid;
335 int open_flags; 333 int open_flags;
@@ -350,10 +348,10 @@ struct nfs_openargs {
350 const u32 * bitmask; 348 const u32 * bitmask;
351 const u32 * open_bitmap; 349 const u32 * open_bitmap;
352 __u32 claim; 350 __u32 claim;
353 struct nfs4_sequence_args seq_args;
354}; 351};
355 352
356struct nfs_openres { 353struct nfs_openres {
354 struct nfs4_sequence_res seq_res;
357 nfs4_stateid stateid; 355 nfs4_stateid stateid;
358 struct nfs_fh fh; 356 struct nfs_fh fh;
359 struct nfs4_change_info cinfo; 357 struct nfs4_change_info cinfo;
@@ -368,7 +366,6 @@ struct nfs_openres {
368 __u32 attrset[NFS4_BITMAP_SIZE]; 366 __u32 attrset[NFS4_BITMAP_SIZE];
369 struct nfs4_string *owner; 367 struct nfs4_string *owner;
370 struct nfs4_string *group_owner; 368 struct nfs4_string *group_owner;
371 struct nfs4_sequence_res seq_res;
372 __u32 access_request; 369 __u32 access_request;
373 __u32 access_supported; 370 __u32 access_supported;
374 __u32 access_result; 371 __u32 access_result;
@@ -392,20 +389,20 @@ struct nfs_open_confirmres {
392 * Arguments to the close call. 389 * Arguments to the close call.
393 */ 390 */
394struct nfs_closeargs { 391struct nfs_closeargs {
392 struct nfs4_sequence_args seq_args;
395 struct nfs_fh * fh; 393 struct nfs_fh * fh;
396 nfs4_stateid * stateid; 394 nfs4_stateid * stateid;
397 struct nfs_seqid * seqid; 395 struct nfs_seqid * seqid;
398 fmode_t fmode; 396 fmode_t fmode;
399 const u32 * bitmask; 397 const u32 * bitmask;
400 struct nfs4_sequence_args seq_args;
401}; 398};
402 399
403struct nfs_closeres { 400struct nfs_closeres {
401 struct nfs4_sequence_res seq_res;
404 nfs4_stateid stateid; 402 nfs4_stateid stateid;
405 struct nfs_fattr * fattr; 403 struct nfs_fattr * fattr;
406 struct nfs_seqid * seqid; 404 struct nfs_seqid * seqid;
407 const struct nfs_server *server; 405 const struct nfs_server *server;
408 struct nfs4_sequence_res seq_res;
409}; 406};
410/* 407/*
411 * * Arguments to the lock,lockt, and locku call. 408 * * Arguments to the lock,lockt, and locku call.
@@ -417,6 +414,7 @@ struct nfs_lowner {
417}; 414};
418 415
419struct nfs_lock_args { 416struct nfs_lock_args {
417 struct nfs4_sequence_args seq_args;
420 struct nfs_fh * fh; 418 struct nfs_fh * fh;
421 struct file_lock * fl; 419 struct file_lock * fl;
422 struct nfs_seqid * lock_seqid; 420 struct nfs_seqid * lock_seqid;
@@ -427,40 +425,39 @@ struct nfs_lock_args {
427 unsigned char block : 1; 425 unsigned char block : 1;
428 unsigned char reclaim : 1; 426 unsigned char reclaim : 1;
429 unsigned char new_lock_owner : 1; 427 unsigned char new_lock_owner : 1;
430 struct nfs4_sequence_args seq_args;
431}; 428};
432 429
433struct nfs_lock_res { 430struct nfs_lock_res {
431 struct nfs4_sequence_res seq_res;
434 nfs4_stateid stateid; 432 nfs4_stateid stateid;
435 struct nfs_seqid * lock_seqid; 433 struct nfs_seqid * lock_seqid;
436 struct nfs_seqid * open_seqid; 434 struct nfs_seqid * open_seqid;
437 struct nfs4_sequence_res seq_res;
438}; 435};
439 436
440struct nfs_locku_args { 437struct nfs_locku_args {
438 struct nfs4_sequence_args seq_args;
441 struct nfs_fh * fh; 439 struct nfs_fh * fh;
442 struct file_lock * fl; 440 struct file_lock * fl;
443 struct nfs_seqid * seqid; 441 struct nfs_seqid * seqid;
444 nfs4_stateid * stateid; 442 nfs4_stateid * stateid;
445 struct nfs4_sequence_args seq_args;
446}; 443};
447 444
448struct nfs_locku_res { 445struct nfs_locku_res {
446 struct nfs4_sequence_res seq_res;
449 nfs4_stateid stateid; 447 nfs4_stateid stateid;
450 struct nfs_seqid * seqid; 448 struct nfs_seqid * seqid;
451 struct nfs4_sequence_res seq_res;
452}; 449};
453 450
454struct nfs_lockt_args { 451struct nfs_lockt_args {
452 struct nfs4_sequence_args seq_args;
455 struct nfs_fh * fh; 453 struct nfs_fh * fh;
456 struct file_lock * fl; 454 struct file_lock * fl;
457 struct nfs_lowner lock_owner; 455 struct nfs_lowner lock_owner;
458 struct nfs4_sequence_args seq_args;
459}; 456};
460 457
461struct nfs_lockt_res { 458struct nfs_lockt_res {
462 struct file_lock * denied; /* LOCK, LOCKT failed */
463 struct nfs4_sequence_res seq_res; 459 struct nfs4_sequence_res seq_res;
460 struct file_lock * denied; /* LOCK, LOCKT failed */
464}; 461};
465 462
466struct nfs_release_lockowner_args { 463struct nfs_release_lockowner_args {
@@ -468,22 +465,23 @@ struct nfs_release_lockowner_args {
468}; 465};
469 466
470struct nfs4_delegreturnargs { 467struct nfs4_delegreturnargs {
468 struct nfs4_sequence_args seq_args;
471 const struct nfs_fh *fhandle; 469 const struct nfs_fh *fhandle;
472 const nfs4_stateid *stateid; 470 const nfs4_stateid *stateid;
473 const u32 * bitmask; 471 const u32 * bitmask;
474 struct nfs4_sequence_args seq_args;
475}; 472};
476 473
477struct nfs4_delegreturnres { 474struct nfs4_delegreturnres {
475 struct nfs4_sequence_res seq_res;
478 struct nfs_fattr * fattr; 476 struct nfs_fattr * fattr;
479 const struct nfs_server *server; 477 const struct nfs_server *server;
480 struct nfs4_sequence_res seq_res;
481}; 478};
482 479
483/* 480/*
484 * Arguments to the read call. 481 * Arguments to the read call.
485 */ 482 */
486struct nfs_readargs { 483struct nfs_readargs {
484 struct nfs4_sequence_args seq_args;
487 struct nfs_fh * fh; 485 struct nfs_fh * fh;
488 struct nfs_open_context *context; 486 struct nfs_open_context *context;
489 struct nfs_lock_context *lock_context; 487 struct nfs_lock_context *lock_context;
@@ -491,20 +489,20 @@ struct nfs_readargs {
491 __u32 count; 489 __u32 count;
492 unsigned int pgbase; 490 unsigned int pgbase;
493 struct page ** pages; 491 struct page ** pages;
494 struct nfs4_sequence_args seq_args;
495}; 492};
496 493
497struct nfs_readres { 494struct nfs_readres {
495 struct nfs4_sequence_res seq_res;
498 struct nfs_fattr * fattr; 496 struct nfs_fattr * fattr;
499 __u32 count; 497 __u32 count;
500 int eof; 498 int eof;
501 struct nfs4_sequence_res seq_res;
502}; 499};
503 500
504/* 501/*
505 * Arguments to the write call. 502 * Arguments to the write call.
506 */ 503 */
507struct nfs_writeargs { 504struct nfs_writeargs {
505 struct nfs4_sequence_args seq_args;
508 struct nfs_fh * fh; 506 struct nfs_fh * fh;
509 struct nfs_open_context *context; 507 struct nfs_open_context *context;
510 struct nfs_lock_context *lock_context; 508 struct nfs_lock_context *lock_context;
@@ -514,7 +512,6 @@ struct nfs_writeargs {
514 unsigned int pgbase; 512 unsigned int pgbase;
515 struct page ** pages; 513 struct page ** pages;
516 const u32 * bitmask; 514 const u32 * bitmask;
517 struct nfs4_sequence_args seq_args;
518}; 515};
519 516
520struct nfs_write_verifier { 517struct nfs_write_verifier {
@@ -527,65 +524,65 @@ struct nfs_writeverf {
527}; 524};
528 525
529struct nfs_writeres { 526struct nfs_writeres {
527 struct nfs4_sequence_res seq_res;
530 struct nfs_fattr * fattr; 528 struct nfs_fattr * fattr;
531 struct nfs_writeverf * verf; 529 struct nfs_writeverf * verf;
532 __u32 count; 530 __u32 count;
533 const struct nfs_server *server; 531 const struct nfs_server *server;
534 struct nfs4_sequence_res seq_res;
535}; 532};
536 533
537/* 534/*
538 * Arguments to the commit call. 535 * Arguments to the commit call.
539 */ 536 */
540struct nfs_commitargs { 537struct nfs_commitargs {
538 struct nfs4_sequence_args seq_args;
541 struct nfs_fh *fh; 539 struct nfs_fh *fh;
542 __u64 offset; 540 __u64 offset;
543 __u32 count; 541 __u32 count;
544 const u32 *bitmask; 542 const u32 *bitmask;
545 struct nfs4_sequence_args seq_args;
546}; 543};
547 544
548struct nfs_commitres { 545struct nfs_commitres {
546 struct nfs4_sequence_res seq_res;
549 struct nfs_fattr *fattr; 547 struct nfs_fattr *fattr;
550 struct nfs_writeverf *verf; 548 struct nfs_writeverf *verf;
551 const struct nfs_server *server; 549 const struct nfs_server *server;
552 struct nfs4_sequence_res seq_res;
553}; 550};
554 551
555/* 552/*
556 * Common arguments to the unlink call 553 * Common arguments to the unlink call
557 */ 554 */
558struct nfs_removeargs { 555struct nfs_removeargs {
556 struct nfs4_sequence_args seq_args;
559 const struct nfs_fh *fh; 557 const struct nfs_fh *fh;
560 struct qstr name; 558 struct qstr name;
561 struct nfs4_sequence_args seq_args;
562}; 559};
563 560
564struct nfs_removeres { 561struct nfs_removeres {
562 struct nfs4_sequence_res seq_res;
565 const struct nfs_server *server; 563 const struct nfs_server *server;
566 struct nfs_fattr *dir_attr; 564 struct nfs_fattr *dir_attr;
567 struct nfs4_change_info cinfo; 565 struct nfs4_change_info cinfo;
568 struct nfs4_sequence_res seq_res;
569}; 566};
570 567
571/* 568/*
572 * Common arguments to the rename call 569 * Common arguments to the rename call
573 */ 570 */
574struct nfs_renameargs { 571struct nfs_renameargs {
572 struct nfs4_sequence_args seq_args;
575 const struct nfs_fh *old_dir; 573 const struct nfs_fh *old_dir;
576 const struct nfs_fh *new_dir; 574 const struct nfs_fh *new_dir;
577 const struct qstr *old_name; 575 const struct qstr *old_name;
578 const struct qstr *new_name; 576 const struct qstr *new_name;
579 struct nfs4_sequence_args seq_args;
580}; 577};
581 578
582struct nfs_renameres { 579struct nfs_renameres {
580 struct nfs4_sequence_res seq_res;
583 const struct nfs_server *server; 581 const struct nfs_server *server;
584 struct nfs4_change_info old_cinfo; 582 struct nfs4_change_info old_cinfo;
585 struct nfs_fattr *old_fattr; 583 struct nfs_fattr *old_fattr;
586 struct nfs4_change_info new_cinfo; 584 struct nfs4_change_info new_cinfo;
587 struct nfs_fattr *new_fattr; 585 struct nfs_fattr *new_fattr;
588 struct nfs4_sequence_res seq_res;
589}; 586};
590 587
591/* 588/*
@@ -626,20 +623,20 @@ struct nfs_createargs {
626}; 623};
627 624
628struct nfs_setattrargs { 625struct nfs_setattrargs {
626 struct nfs4_sequence_args seq_args;
629 struct nfs_fh * fh; 627 struct nfs_fh * fh;
630 nfs4_stateid stateid; 628 nfs4_stateid stateid;
631 struct iattr * iap; 629 struct iattr * iap;
632 const struct nfs_server * server; /* Needed for name mapping */ 630 const struct nfs_server * server; /* Needed for name mapping */
633 const u32 * bitmask; 631 const u32 * bitmask;
634 struct nfs4_sequence_args seq_args;
635}; 632};
636 633
637struct nfs_setaclargs { 634struct nfs_setaclargs {
635 struct nfs4_sequence_args seq_args;
638 struct nfs_fh * fh; 636 struct nfs_fh * fh;
639 size_t acl_len; 637 size_t acl_len;
640 unsigned int acl_pgbase; 638 unsigned int acl_pgbase;
641 struct page ** acl_pages; 639 struct page ** acl_pages;
642 struct nfs4_sequence_args seq_args;
643}; 640};
644 641
645struct nfs_setaclres { 642struct nfs_setaclres {
@@ -647,27 +644,27 @@ struct nfs_setaclres {
647}; 644};
648 645
649struct nfs_getaclargs { 646struct nfs_getaclargs {
647 struct nfs4_sequence_args seq_args;
650 struct nfs_fh * fh; 648 struct nfs_fh * fh;
651 size_t acl_len; 649 size_t acl_len;
652 unsigned int acl_pgbase; 650 unsigned int acl_pgbase;
653 struct page ** acl_pages; 651 struct page ** acl_pages;
654 struct nfs4_sequence_args seq_args;
655}; 652};
656 653
657/* getxattr ACL interface flags */ 654/* getxattr ACL interface flags */
658#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */ 655#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
659struct nfs_getaclres { 656struct nfs_getaclres {
657 struct nfs4_sequence_res seq_res;
660 size_t acl_len; 658 size_t acl_len;
661 size_t acl_data_offset; 659 size_t acl_data_offset;
662 int acl_flags; 660 int acl_flags;
663 struct page * acl_scratch; 661 struct page * acl_scratch;
664 struct nfs4_sequence_res seq_res;
665}; 662};
666 663
667struct nfs_setattrres { 664struct nfs_setattrres {
665 struct nfs4_sequence_res seq_res;
668 struct nfs_fattr * fattr; 666 struct nfs_fattr * fattr;
669 const struct nfs_server * server; 667 const struct nfs_server * server;
670 struct nfs4_sequence_res seq_res;
671}; 668};
672 669
673struct nfs_linkargs { 670struct nfs_linkargs {
@@ -832,21 +829,22 @@ struct nfs3_getaclres {
832typedef u64 clientid4; 829typedef u64 clientid4;
833 830
834struct nfs4_accessargs { 831struct nfs4_accessargs {
832 struct nfs4_sequence_args seq_args;
835 const struct nfs_fh * fh; 833 const struct nfs_fh * fh;
836 const u32 * bitmask; 834 const u32 * bitmask;
837 u32 access; 835 u32 access;
838 struct nfs4_sequence_args seq_args;
839}; 836};
840 837
841struct nfs4_accessres { 838struct nfs4_accessres {
839 struct nfs4_sequence_res seq_res;
842 const struct nfs_server * server; 840 const struct nfs_server * server;
843 struct nfs_fattr * fattr; 841 struct nfs_fattr * fattr;
844 u32 supported; 842 u32 supported;
845 u32 access; 843 u32 access;
846 struct nfs4_sequence_res seq_res;
847}; 844};
848 845
849struct nfs4_create_arg { 846struct nfs4_create_arg {
847 struct nfs4_sequence_args seq_args;
850 u32 ftype; 848 u32 ftype;
851 union { 849 union {
852 struct { 850 struct {
@@ -863,88 +861,88 @@ struct nfs4_create_arg {
863 const struct iattr * attrs; 861 const struct iattr * attrs;
864 const struct nfs_fh * dir_fh; 862 const struct nfs_fh * dir_fh;
865 const u32 * bitmask; 863 const u32 * bitmask;
866 struct nfs4_sequence_args seq_args;
867}; 864};
868 865
869struct nfs4_create_res { 866struct nfs4_create_res {
867 struct nfs4_sequence_res seq_res;
870 const struct nfs_server * server; 868 const struct nfs_server * server;
871 struct nfs_fh * fh; 869 struct nfs_fh * fh;
872 struct nfs_fattr * fattr; 870 struct nfs_fattr * fattr;
873 struct nfs4_change_info dir_cinfo; 871 struct nfs4_change_info dir_cinfo;
874 struct nfs4_sequence_res seq_res;
875}; 872};
876 873
877struct nfs4_fsinfo_arg { 874struct nfs4_fsinfo_arg {
875 struct nfs4_sequence_args seq_args;
878 const struct nfs_fh * fh; 876 const struct nfs_fh * fh;
879 const u32 * bitmask; 877 const u32 * bitmask;
880 struct nfs4_sequence_args seq_args;
881}; 878};
882 879
883struct nfs4_fsinfo_res { 880struct nfs4_fsinfo_res {
884 struct nfs_fsinfo *fsinfo;
885 struct nfs4_sequence_res seq_res; 881 struct nfs4_sequence_res seq_res;
882 struct nfs_fsinfo *fsinfo;
886}; 883};
887 884
888struct nfs4_getattr_arg { 885struct nfs4_getattr_arg {
886 struct nfs4_sequence_args seq_args;
889 const struct nfs_fh * fh; 887 const struct nfs_fh * fh;
890 const u32 * bitmask; 888 const u32 * bitmask;
891 struct nfs4_sequence_args seq_args;
892}; 889};
893 890
894struct nfs4_getattr_res { 891struct nfs4_getattr_res {
892 struct nfs4_sequence_res seq_res;
895 const struct nfs_server * server; 893 const struct nfs_server * server;
896 struct nfs_fattr * fattr; 894 struct nfs_fattr * fattr;
897 struct nfs4_sequence_res seq_res;
898}; 895};
899 896
900struct nfs4_link_arg { 897struct nfs4_link_arg {
898 struct nfs4_sequence_args seq_args;
901 const struct nfs_fh * fh; 899 const struct nfs_fh * fh;
902 const struct nfs_fh * dir_fh; 900 const struct nfs_fh * dir_fh;
903 const struct qstr * name; 901 const struct qstr * name;
904 const u32 * bitmask; 902 const u32 * bitmask;
905 struct nfs4_sequence_args seq_args;
906}; 903};
907 904
908struct nfs4_link_res { 905struct nfs4_link_res {
906 struct nfs4_sequence_res seq_res;
909 const struct nfs_server * server; 907 const struct nfs_server * server;
910 struct nfs_fattr * fattr; 908 struct nfs_fattr * fattr;
911 struct nfs4_change_info cinfo; 909 struct nfs4_change_info cinfo;
912 struct nfs_fattr * dir_attr; 910 struct nfs_fattr * dir_attr;
913 struct nfs4_sequence_res seq_res;
914}; 911};
915 912
916 913
917struct nfs4_lookup_arg { 914struct nfs4_lookup_arg {
915 struct nfs4_sequence_args seq_args;
918 const struct nfs_fh * dir_fh; 916 const struct nfs_fh * dir_fh;
919 const struct qstr * name; 917 const struct qstr * name;
920 const u32 * bitmask; 918 const u32 * bitmask;
921 struct nfs4_sequence_args seq_args;
922}; 919};
923 920
924struct nfs4_lookup_res { 921struct nfs4_lookup_res {
922 struct nfs4_sequence_res seq_res;
925 const struct nfs_server * server; 923 const struct nfs_server * server;
926 struct nfs_fattr * fattr; 924 struct nfs_fattr * fattr;
927 struct nfs_fh * fh; 925 struct nfs_fh * fh;
928 struct nfs4_sequence_res seq_res;
929}; 926};
930 927
931struct nfs4_lookup_root_arg { 928struct nfs4_lookup_root_arg {
932 const u32 * bitmask;
933 struct nfs4_sequence_args seq_args; 929 struct nfs4_sequence_args seq_args;
930 const u32 * bitmask;
934}; 931};
935 932
936struct nfs4_pathconf_arg { 933struct nfs4_pathconf_arg {
934 struct nfs4_sequence_args seq_args;
937 const struct nfs_fh * fh; 935 const struct nfs_fh * fh;
938 const u32 * bitmask; 936 const u32 * bitmask;
939 struct nfs4_sequence_args seq_args;
940}; 937};
941 938
942struct nfs4_pathconf_res { 939struct nfs4_pathconf_res {
943 struct nfs_pathconf *pathconf;
944 struct nfs4_sequence_res seq_res; 940 struct nfs4_sequence_res seq_res;
941 struct nfs_pathconf *pathconf;
945}; 942};
946 943
947struct nfs4_readdir_arg { 944struct nfs4_readdir_arg {
945 struct nfs4_sequence_args seq_args;
948 const struct nfs_fh * fh; 946 const struct nfs_fh * fh;
949 u64 cookie; 947 u64 cookie;
950 nfs4_verifier verifier; 948 nfs4_verifier verifier;
@@ -953,21 +951,20 @@ struct nfs4_readdir_arg {
953 unsigned int pgbase; /* zero-copy data */ 951 unsigned int pgbase; /* zero-copy data */
954 const u32 * bitmask; 952 const u32 * bitmask;
955 int plus; 953 int plus;
956 struct nfs4_sequence_args seq_args;
957}; 954};
958 955
959struct nfs4_readdir_res { 956struct nfs4_readdir_res {
957 struct nfs4_sequence_res seq_res;
960 nfs4_verifier verifier; 958 nfs4_verifier verifier;
961 unsigned int pgbase; 959 unsigned int pgbase;
962 struct nfs4_sequence_res seq_res;
963}; 960};
964 961
965struct nfs4_readlink { 962struct nfs4_readlink {
963 struct nfs4_sequence_args seq_args;
966 const struct nfs_fh * fh; 964 const struct nfs_fh * fh;
967 unsigned int pgbase; 965 unsigned int pgbase;
968 unsigned int pglen; /* zero-copy data */ 966 unsigned int pglen; /* zero-copy data */
969 struct page ** pages; /* zero-copy data */ 967 struct page ** pages; /* zero-copy data */
970 struct nfs4_sequence_args seq_args;
971}; 968};
972 969
973struct nfs4_readlink_res { 970struct nfs4_readlink_res {
@@ -993,28 +990,28 @@ struct nfs4_setclientid_res {
993}; 990};
994 991
995struct nfs4_statfs_arg { 992struct nfs4_statfs_arg {
993 struct nfs4_sequence_args seq_args;
996 const struct nfs_fh * fh; 994 const struct nfs_fh * fh;
997 const u32 * bitmask; 995 const u32 * bitmask;
998 struct nfs4_sequence_args seq_args;
999}; 996};
1000 997
1001struct nfs4_statfs_res { 998struct nfs4_statfs_res {
1002 struct nfs_fsstat *fsstat;
1003 struct nfs4_sequence_res seq_res; 999 struct nfs4_sequence_res seq_res;
1000 struct nfs_fsstat *fsstat;
1004}; 1001};
1005 1002
1006struct nfs4_server_caps_arg { 1003struct nfs4_server_caps_arg {
1007 struct nfs_fh *fhandle;
1008 struct nfs4_sequence_args seq_args; 1004 struct nfs4_sequence_args seq_args;
1005 struct nfs_fh *fhandle;
1009}; 1006};
1010 1007
1011struct nfs4_server_caps_res { 1008struct nfs4_server_caps_res {
1009 struct nfs4_sequence_res seq_res;
1012 u32 attr_bitmask[3]; 1010 u32 attr_bitmask[3];
1013 u32 acl_bitmask; 1011 u32 acl_bitmask;
1014 u32 has_links; 1012 u32 has_links;
1015 u32 has_symlinks; 1013 u32 has_symlinks;
1016 u32 fh_expire_type; 1014 u32 fh_expire_type;
1017 struct nfs4_sequence_res seq_res;
1018}; 1015};
1019 1016
1020#define NFS4_PATHNAME_MAXCOMPONENTS 512 1017#define NFS4_PATHNAME_MAXCOMPONENTS 512
@@ -1040,16 +1037,16 @@ struct nfs4_fs_locations {
1040}; 1037};
1041 1038
1042struct nfs4_fs_locations_arg { 1039struct nfs4_fs_locations_arg {
1040 struct nfs4_sequence_args seq_args;
1043 const struct nfs_fh *dir_fh; 1041 const struct nfs_fh *dir_fh;
1044 const struct qstr *name; 1042 const struct qstr *name;
1045 struct page *page; 1043 struct page *page;
1046 const u32 *bitmask; 1044 const u32 *bitmask;
1047 struct nfs4_sequence_args seq_args;
1048}; 1045};
1049 1046
1050struct nfs4_fs_locations_res { 1047struct nfs4_fs_locations_res {
1051 struct nfs4_fs_locations *fs_locations;
1052 struct nfs4_sequence_res seq_res; 1048 struct nfs4_sequence_res seq_res;
1049 struct nfs4_fs_locations *fs_locations;
1053}; 1050};
1054 1051
1055struct nfs4_secinfo_oid { 1052struct nfs4_secinfo_oid {
@@ -1074,14 +1071,14 @@ struct nfs4_secinfo_flavors {
1074}; 1071};
1075 1072
1076struct nfs4_secinfo_arg { 1073struct nfs4_secinfo_arg {
1074 struct nfs4_sequence_args seq_args;
1077 const struct nfs_fh *dir_fh; 1075 const struct nfs_fh *dir_fh;
1078 const struct qstr *name; 1076 const struct qstr *name;
1079 struct nfs4_sequence_args seq_args;
1080}; 1077};
1081 1078
1082struct nfs4_secinfo_res { 1079struct nfs4_secinfo_res {
1083 struct nfs4_secinfo_flavors *flavors;
1084 struct nfs4_sequence_res seq_res; 1080 struct nfs4_sequence_res seq_res;
1081 struct nfs4_secinfo_flavors *flavors;
1085}; 1082};
1086 1083
1087#endif /* CONFIG_NFS_V4 */ 1084#endif /* CONFIG_NFS_V4 */
@@ -1161,9 +1158,9 @@ struct nfs41_create_session_res {
1161}; 1158};
1162 1159
1163struct nfs41_reclaim_complete_args { 1160struct nfs41_reclaim_complete_args {
1161 struct nfs4_sequence_args seq_args;
1164 /* In the future extend to include curr_fh for use with migration */ 1162 /* In the future extend to include curr_fh for use with migration */
1165 unsigned char one_fs:1; 1163 unsigned char one_fs:1;
1166 struct nfs4_sequence_args seq_args;
1167}; 1164};
1168 1165
1169struct nfs41_reclaim_complete_res { 1166struct nfs41_reclaim_complete_res {
@@ -1173,28 +1170,28 @@ struct nfs41_reclaim_complete_res {
1173#define SECINFO_STYLE_CURRENT_FH 0 1170#define SECINFO_STYLE_CURRENT_FH 0
1174#define SECINFO_STYLE_PARENT 1 1171#define SECINFO_STYLE_PARENT 1
1175struct nfs41_secinfo_no_name_args { 1172struct nfs41_secinfo_no_name_args {
1176 int style;
1177 struct nfs4_sequence_args seq_args; 1173 struct nfs4_sequence_args seq_args;
1174 int style;
1178}; 1175};
1179 1176
1180struct nfs41_test_stateid_args { 1177struct nfs41_test_stateid_args {
1181 nfs4_stateid *stateid;
1182 struct nfs4_sequence_args seq_args; 1178 struct nfs4_sequence_args seq_args;
1179 nfs4_stateid *stateid;
1183}; 1180};
1184 1181
1185struct nfs41_test_stateid_res { 1182struct nfs41_test_stateid_res {
1186 unsigned int status;
1187 struct nfs4_sequence_res seq_res; 1183 struct nfs4_sequence_res seq_res;
1184 unsigned int status;
1188}; 1185};
1189 1186
1190struct nfs41_free_stateid_args { 1187struct nfs41_free_stateid_args {
1191 nfs4_stateid *stateid;
1192 struct nfs4_sequence_args seq_args; 1188 struct nfs4_sequence_args seq_args;
1189 nfs4_stateid *stateid;
1193}; 1190};
1194 1191
1195struct nfs41_free_stateid_res { 1192struct nfs41_free_stateid_res {
1196 unsigned int status;
1197 struct nfs4_sequence_res seq_res; 1193 struct nfs4_sequence_res seq_res;
1194 unsigned int status;
1198}; 1195};
1199 1196
1200#else 1197#else
diff --git a/include/linux/node.h b/include/linux/node.h
index 624e53cecc0..2115ad5d6f1 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -27,10 +27,9 @@ struct node {
27}; 27};
28 28
29struct memory_block; 29struct memory_block;
30extern struct node node_devices[]; 30extern struct node *node_devices[];
31typedef void (*node_registration_func_t)(struct node *); 31typedef void (*node_registration_func_t)(struct node *);
32 32
33extern int register_node(struct node *, int, struct node *);
34extern void unregister_node(struct node *node); 33extern void unregister_node(struct node *node);
35#ifdef CONFIG_NUMA 34#ifdef CONFIG_NUMA
36extern int register_one_node(int nid); 35extern int register_one_node(int nid);
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 7afc36334d5..4e2cbfa640b 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -380,6 +380,11 @@ enum node_states {
380#else 380#else
381 N_HIGH_MEMORY = N_NORMAL_MEMORY, 381 N_HIGH_MEMORY = N_NORMAL_MEMORY,
382#endif 382#endif
383#ifdef CONFIG_MOVABLE_NODE
384 N_MEMORY, /* The node has memory(regular, high, movable) */
385#else
386 N_MEMORY = N_HIGH_MEMORY,
387#endif
383 N_CPU, /* The node has one or more cpus */ 388 N_CPU, /* The node has one or more cpus */
384 NR_NODE_STATES 389 NR_NODE_STATES
385}; 390};
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index cc37a55ad00..10e5947491c 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -67,7 +67,7 @@ void exit_task_namespaces(struct task_struct *tsk);
67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); 67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
68void free_nsproxy(struct nsproxy *ns); 68void free_nsproxy(struct nsproxy *ns);
69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, 69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
70 struct fs_struct *); 70 struct cred *, struct fs_struct *);
71int __init nsproxy_cache_init(void); 71int __init nsproxy_cache_init(void);
72 72
73static inline void put_nsproxy(struct nsproxy *ns) 73static inline void put_nsproxy(struct nsproxy *ns)
diff --git a/include/linux/of.h b/include/linux/of.h
index b4e50d56fc7..5ebcc5c8e42 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -22,6 +22,7 @@
22#include <linux/mod_devicetable.h> 22#include <linux/mod_devicetable.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/notifier.h>
25 26
26#include <asm/byteorder.h> 27#include <asm/byteorder.h>
27#include <asm/errno.h> 28#include <asm/errno.h>
@@ -46,7 +47,7 @@ struct device_node {
46 const char *name; 47 const char *name;
47 const char *type; 48 const char *type;
48 phandle phandle; 49 phandle phandle;
49 char *full_name; 50 const char *full_name;
50 51
51 struct property *properties; 52 struct property *properties;
52 struct property *deadprops; /* removed properties */ 53 struct property *deadprops; /* removed properties */
@@ -60,7 +61,7 @@ struct device_node {
60 unsigned long _flags; 61 unsigned long _flags;
61 void *data; 62 void *data;
62#if defined(CONFIG_SPARC) 63#if defined(CONFIG_SPARC)
63 char *path_component_name; 64 const char *path_component_name;
64 unsigned int unique_id; 65 unsigned int unique_id;
65 struct of_irq_controller *irq_trans; 66 struct of_irq_controller *irq_trans;
66#endif 67#endif
@@ -88,14 +89,14 @@ static inline void of_node_put(struct device_node *node) { }
88#ifdef CONFIG_OF 89#ifdef CONFIG_OF
89 90
90/* Pointer for first entry in chain of all nodes. */ 91/* Pointer for first entry in chain of all nodes. */
91extern struct device_node *allnodes; 92extern struct device_node *of_allnodes;
92extern struct device_node *of_chosen; 93extern struct device_node *of_chosen;
93extern struct device_node *of_aliases; 94extern struct device_node *of_aliases;
94extern rwlock_t devtree_lock; 95extern rwlock_t devtree_lock;
95 96
96static inline bool of_have_populated_dt(void) 97static inline bool of_have_populated_dt(void)
97{ 98{
98 return allnodes != NULL; 99 return of_allnodes != NULL;
99} 100}
100 101
101static inline bool of_node_is_root(const struct device_node *node) 102static inline bool of_node_is_root(const struct device_node *node)
@@ -179,11 +180,22 @@ extern struct device_node *of_find_compatible_node(struct device_node *from,
179#define for_each_compatible_node(dn, type, compatible) \ 180#define for_each_compatible_node(dn, type, compatible) \
180 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ 181 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
181 dn = of_find_compatible_node(dn, type, compatible)) 182 dn = of_find_compatible_node(dn, type, compatible))
182extern struct device_node *of_find_matching_node(struct device_node *from, 183extern struct device_node *of_find_matching_node_and_match(
183 const struct of_device_id *matches); 184 struct device_node *from,
185 const struct of_device_id *matches,
186 const struct of_device_id **match);
187static inline struct device_node *of_find_matching_node(
188 struct device_node *from,
189 const struct of_device_id *matches)
190{
191 return of_find_matching_node_and_match(from, matches, NULL);
192}
184#define for_each_matching_node(dn, matches) \ 193#define for_each_matching_node(dn, matches) \
185 for (dn = of_find_matching_node(NULL, matches); dn; \ 194 for (dn = of_find_matching_node(NULL, matches); dn; \
186 dn = of_find_matching_node(dn, matches)) 195 dn = of_find_matching_node(dn, matches))
196#define for_each_matching_node_and_match(dn, matches, match) \
197 for (dn = of_find_matching_node_and_match(NULL, matches, match); \
198 dn; dn = of_find_matching_node_and_match(dn, matches, match))
187extern struct device_node *of_find_node_by_path(const char *path); 199extern struct device_node *of_find_node_by_path(const char *path);
188extern struct device_node *of_find_node_by_phandle(phandle handle); 200extern struct device_node *of_find_node_by_phandle(phandle handle);
189extern struct device_node *of_get_parent(const struct device_node *node); 201extern struct device_node *of_get_parent(const struct device_node *node);
@@ -223,6 +235,10 @@ extern struct device_node *of_find_node_with_property(
223extern struct property *of_find_property(const struct device_node *np, 235extern struct property *of_find_property(const struct device_node *np,
224 const char *name, 236 const char *name,
225 int *lenp); 237 int *lenp);
238extern int of_property_read_u8_array(const struct device_node *np,
239 const char *propname, u8 *out_values, size_t sz);
240extern int of_property_read_u16_array(const struct device_node *np,
241 const char *propname, u16 *out_values, size_t sz);
226extern int of_property_read_u32_array(const struct device_node *np, 242extern int of_property_read_u32_array(const struct device_node *np,
227 const char *propname, 243 const char *propname,
228 u32 *out_values, 244 u32 *out_values,
@@ -255,10 +271,10 @@ extern int of_n_size_cells(struct device_node *np);
255extern const struct of_device_id *of_match_node( 271extern const struct of_device_id *of_match_node(
256 const struct of_device_id *matches, const struct device_node *node); 272 const struct of_device_id *matches, const struct device_node *node);
257extern int of_modalias_node(struct device_node *node, char *modalias, int len); 273extern int of_modalias_node(struct device_node *node, char *modalias, int len);
258extern struct device_node *of_parse_phandle(struct device_node *np, 274extern struct device_node *of_parse_phandle(const struct device_node *np,
259 const char *phandle_name, 275 const char *phandle_name,
260 int index); 276 int index);
261extern int of_parse_phandle_with_args(struct device_node *np, 277extern int of_parse_phandle_with_args(const struct device_node *np,
262 const char *list_name, const char *cells_name, int index, 278 const char *list_name, const char *cells_name, int index,
263 struct of_phandle_args *out_args); 279 struct of_phandle_args *out_args);
264 280
@@ -267,16 +283,28 @@ extern int of_alias_get_id(struct device_node *np, const char *stem);
267 283
268extern int of_machine_is_compatible(const char *compat); 284extern int of_machine_is_compatible(const char *compat);
269 285
270extern int prom_add_property(struct device_node* np, struct property* prop); 286extern int of_add_property(struct device_node *np, struct property *prop);
271extern int prom_remove_property(struct device_node *np, struct property *prop); 287extern int of_remove_property(struct device_node *np, struct property *prop);
272extern int prom_update_property(struct device_node *np, 288extern int of_update_property(struct device_node *np, struct property *newprop);
273 struct property *newprop);
274 289
275#if defined(CONFIG_OF_DYNAMIC)
276/* For updating the device tree at runtime */ 290/* For updating the device tree at runtime */
277extern void of_attach_node(struct device_node *); 291#define OF_RECONFIG_ATTACH_NODE 0x0001
278extern void of_detach_node(struct device_node *); 292#define OF_RECONFIG_DETACH_NODE 0x0002
279#endif 293#define OF_RECONFIG_ADD_PROPERTY 0x0003
294#define OF_RECONFIG_REMOVE_PROPERTY 0x0004
295#define OF_RECONFIG_UPDATE_PROPERTY 0x0005
296
297struct of_prop_reconfig {
298 struct device_node *dn;
299 struct property *prop;
300};
301
302extern int of_reconfig_notifier_register(struct notifier_block *);
303extern int of_reconfig_notifier_unregister(struct notifier_block *);
304extern int of_reconfig_notify(unsigned long, void *);
305
306extern int of_attach_node(struct device_node *);
307extern int of_detach_node(struct device_node *);
280 308
281#define of_match_ptr(_ptr) (_ptr) 309#define of_match_ptr(_ptr) (_ptr)
282 310
@@ -364,6 +392,18 @@ static inline struct device_node *of_find_compatible_node(
364 return NULL; 392 return NULL;
365} 393}
366 394
395static inline int of_property_read_u8_array(const struct device_node *np,
396 const char *propname, u8 *out_values, size_t sz)
397{
398 return -ENOSYS;
399}
400
401static inline int of_property_read_u16_array(const struct device_node *np,
402 const char *propname, u16 *out_values, size_t sz)
403{
404 return -ENOSYS;
405}
406
367static inline int of_property_read_u32_array(const struct device_node *np, 407static inline int of_property_read_u32_array(const struct device_node *np,
368 const char *propname, 408 const char *propname,
369 u32 *out_values, size_t sz) 409 u32 *out_values, size_t sz)
@@ -411,7 +451,7 @@ static inline int of_property_match_string(struct device_node *np,
411 return -ENOSYS; 451 return -ENOSYS;
412} 452}
413 453
414static inline struct device_node *of_parse_phandle(struct device_node *np, 454static inline struct device_node *of_parse_phandle(const struct device_node *np,
415 const char *phandle_name, 455 const char *phandle_name,
416 int index) 456 int index)
417{ 457{
@@ -470,6 +510,20 @@ static inline bool of_property_read_bool(const struct device_node *np,
470 return prop ? true : false; 510 return prop ? true : false;
471} 511}
472 512
513static inline int of_property_read_u8(const struct device_node *np,
514 const char *propname,
515 u8 *out_value)
516{
517 return of_property_read_u8_array(np, propname, out_value, 1);
518}
519
520static inline int of_property_read_u16(const struct device_node *np,
521 const char *propname,
522 u16 *out_value)
523{
524 return of_property_read_u16_array(np, propname, out_value, 1);
525}
526
473static inline int of_property_read_u32(const struct device_node *np, 527static inline int of_property_read_u32(const struct device_node *np,
474 const char *propname, 528 const char *propname,
475 u32 *out_value) 529 u32 *out_value)
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 1cb775f8e66..cfb545cd86b 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -29,6 +29,18 @@ static inline void of_i2c_register_devices(struct i2c_adapter *adap)
29{ 29{
30 return; 30 return;
31} 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}
32#endif /* CONFIG_OF_I2C */ 44#endif /* CONFIG_OF_I2C */
33 45
34#endif /* __LINUX_OF_I2C_H */ 46#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index b47d2040c9f..3863a4dbdf1 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -100,6 +100,7 @@ extern int of_platform_populate(struct device_node *root,
100 100
101#if !defined(CONFIG_OF_ADDRESS) 101#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata; 102struct of_dev_auxdata;
103struct device;
103static inline int of_platform_populate(struct device_node *root, 104static inline int of_platform_populate(struct device_node *root,
104 const struct of_device_id *matches, 105 const struct of_device_id *matches,
105 const struct of_dev_auxdata *lookup, 106 const struct of_dev_auxdata *lookup,
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index eb475a8ea25..7af25a9c9c5 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -19,4 +19,370 @@ static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
19} 19}
20#endif 20#endif
21 21
22/*
23 * Legacy OMAP DMA handling defines and functions
24 *
25 * NOTE: Do not use these any longer.
26 *
27 * Use the generic dmaengine functions as defined in
28 * include/linux/dmaengine.h.
29 *
30 * Copyright (C) 2003 Nokia Corporation
31 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
32 *
33 */
34
35#include <linux/platform_device.h>
36
37#define INT_DMA_LCD 25
38
39#define OMAP1_DMA_TOUT_IRQ (1 << 0)
40#define OMAP_DMA_DROP_IRQ (1 << 1)
41#define OMAP_DMA_HALF_IRQ (1 << 2)
42#define OMAP_DMA_FRAME_IRQ (1 << 3)
43#define OMAP_DMA_LAST_IRQ (1 << 4)
44#define OMAP_DMA_BLOCK_IRQ (1 << 5)
45#define OMAP1_DMA_SYNC_IRQ (1 << 6)
46#define OMAP2_DMA_PKT_IRQ (1 << 7)
47#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
48#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
49#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
50#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
51
52#define OMAP_DMA_CCR_EN (1 << 7)
53#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9)
54#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10)
55#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24)
56#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25)
57
58#define OMAP_DMA_DATA_TYPE_S8 0x00
59#define OMAP_DMA_DATA_TYPE_S16 0x01
60#define OMAP_DMA_DATA_TYPE_S32 0x02
61
62#define OMAP_DMA_SYNC_ELEMENT 0x00
63#define OMAP_DMA_SYNC_FRAME 0x01
64#define OMAP_DMA_SYNC_BLOCK 0x02
65#define OMAP_DMA_SYNC_PACKET 0x03
66
67#define OMAP_DMA_DST_SYNC_PREFETCH 0x02
68#define OMAP_DMA_SRC_SYNC 0x01
69#define OMAP_DMA_DST_SYNC 0x00
70
71#define OMAP_DMA_PORT_EMIFF 0x00
72#define OMAP_DMA_PORT_EMIFS 0x01
73#define OMAP_DMA_PORT_OCP_T1 0x02
74#define OMAP_DMA_PORT_TIPB 0x03
75#define OMAP_DMA_PORT_OCP_T2 0x04
76#define OMAP_DMA_PORT_MPUI 0x05
77
78#define OMAP_DMA_AMODE_CONSTANT 0x00
79#define OMAP_DMA_AMODE_POST_INC 0x01
80#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
81#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
82
83#define DMA_DEFAULT_FIFO_DEPTH 0x10
84#define DMA_DEFAULT_ARB_RATE 0x01
85/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */
86#define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */
87#define DMA_THREAD_RESERVE_ONET (0x01 << 12)
88#define DMA_THREAD_RESERVE_TWOT (0x02 << 12)
89#define DMA_THREAD_RESERVE_THREET (0x03 << 12)
90#define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */
91#define DMA_THREAD_FIFO_75 (0x01 << 14)
92#define DMA_THREAD_FIFO_25 (0x02 << 14)
93#define DMA_THREAD_FIFO_50 (0x03 << 14)
94
95/* DMA4_OCP_SYSCONFIG bits */
96#define DMA_SYSCONFIG_MIDLEMODE_MASK (3 << 12)
97#define DMA_SYSCONFIG_CLOCKACTIVITY_MASK (3 << 8)
98#define DMA_SYSCONFIG_EMUFREE (1 << 5)
99#define DMA_SYSCONFIG_SIDLEMODE_MASK (3 << 3)
100#define DMA_SYSCONFIG_SOFTRESET (1 << 2)
101#define DMA_SYSCONFIG_AUTOIDLE (1 << 0)
102
103#define DMA_SYSCONFIG_MIDLEMODE(n) ((n) << 12)
104#define DMA_SYSCONFIG_SIDLEMODE(n) ((n) << 3)
105
106#define DMA_IDLEMODE_SMARTIDLE 0x2
107#define DMA_IDLEMODE_NO_IDLE 0x1
108#define DMA_IDLEMODE_FORCE_IDLE 0x0
109
110/* Chaining modes*/
111#ifndef CONFIG_ARCH_OMAP1
112#define OMAP_DMA_STATIC_CHAIN 0x1
113#define OMAP_DMA_DYNAMIC_CHAIN 0x2
114#define OMAP_DMA_CHAIN_ACTIVE 0x1
115#define OMAP_DMA_CHAIN_INACTIVE 0x0
116#endif
117
118#define DMA_CH_PRIO_HIGH 0x1
119#define DMA_CH_PRIO_LOW 0x0 /* Def */
120
121/* Errata handling */
122#define IS_DMA_ERRATA(id) (errata & (id))
123#define SET_DMA_ERRATA(id) (errata |= (id))
124
125#define DMA_ERRATA_IFRAME_BUFFERING BIT(0x0)
126#define DMA_ERRATA_PARALLEL_CHANNELS BIT(0x1)
127#define DMA_ERRATA_i378 BIT(0x2)
128#define DMA_ERRATA_i541 BIT(0x3)
129#define DMA_ERRATA_i88 BIT(0x4)
130#define DMA_ERRATA_3_3 BIT(0x5)
131#define DMA_ROMCODE_BUG BIT(0x6)
132
133/* Attributes for OMAP DMA Contrller */
134#define DMA_LINKED_LCH BIT(0x0)
135#define GLOBAL_PRIORITY BIT(0x1)
136#define RESERVE_CHANNEL BIT(0x2)
137#define IS_CSSA_32 BIT(0x3)
138#define IS_CDSA_32 BIT(0x4)
139#define IS_RW_PRIORITY BIT(0x5)
140#define ENABLE_1510_MODE BIT(0x6)
141#define SRC_PORT BIT(0x7)
142#define DST_PORT BIT(0x8)
143#define SRC_INDEX BIT(0x9)
144#define DST_INDEX BIT(0xa)
145#define IS_BURST_ONLY4 BIT(0xb)
146#define CLEAR_CSR_ON_READ BIT(0xc)
147#define IS_WORD_16 BIT(0xd)
148#define ENABLE_16XX_MODE BIT(0xe)
149#define HS_CHANNELS_RESERVED BIT(0xf)
150
151/* Defines for DMA Capabilities */
152#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)
153#define DMA_HAS_CONSTANT_FILL_CAPS (0x1 << 19)
154#define DMA_HAS_DESCRIPTOR_CAPS (0x3 << 20)
155
156enum omap_reg_offsets {
157
158GCR, GSCR, GRST1, HW_ID,
159PCH2_ID, PCH0_ID, PCH1_ID, PCHG_ID,
160PCHD_ID, CAPS_0, CAPS_1, CAPS_2,
161CAPS_3, CAPS_4, PCH2_SR, PCH0_SR,
162PCH1_SR, PCHD_SR, REVISION, IRQSTATUS_L0,
163IRQSTATUS_L1, IRQSTATUS_L2, IRQSTATUS_L3, IRQENABLE_L0,
164IRQENABLE_L1, IRQENABLE_L2, IRQENABLE_L3, SYSSTATUS,
165OCP_SYSCONFIG,
166
167/* omap1+ specific */
168CPC, CCR2, LCH_CTRL,
169
170/* Common registers for all omap's */
171CSDP, CCR, CICR, CSR,
172CEN, CFN, CSFI, CSEI,
173CSAC, CDAC, CDEI,
174CDFI, CLNK_CTRL,
175
176/* Channel specific registers */
177CSSA, CDSA, COLOR,
178CCEN, CCFN,
179
180/* omap3630 and omap4 specific */
181CDP, CNDP, CCDN,
182
183};
184
185enum omap_dma_burst_mode {
186 OMAP_DMA_DATA_BURST_DIS = 0,
187 OMAP_DMA_DATA_BURST_4,
188 OMAP_DMA_DATA_BURST_8,
189 OMAP_DMA_DATA_BURST_16,
190};
191
192enum end_type {
193 OMAP_DMA_LITTLE_ENDIAN = 0,
194 OMAP_DMA_BIG_ENDIAN
195};
196
197enum omap_dma_color_mode {
198 OMAP_DMA_COLOR_DIS = 0,
199 OMAP_DMA_CONSTANT_FILL,
200 OMAP_DMA_TRANSPARENT_COPY
201};
202
203enum omap_dma_write_mode {
204 OMAP_DMA_WRITE_NON_POSTED = 0,
205 OMAP_DMA_WRITE_POSTED,
206 OMAP_DMA_WRITE_LAST_NON_POSTED
207};
208
209enum omap_dma_channel_mode {
210 OMAP_DMA_LCH_2D = 0,
211 OMAP_DMA_LCH_G,
212 OMAP_DMA_LCH_P,
213 OMAP_DMA_LCH_PD
214};
215
216struct omap_dma_channel_params {
217 int data_type; /* data type 8,16,32 */
218 int elem_count; /* number of elements in a frame */
219 int frame_count; /* number of frames in a element */
220
221 int src_port; /* Only on OMAP1 REVISIT: Is this needed? */
222 int src_amode; /* constant, post increment, indexed,
223 double indexed */
224 unsigned long src_start; /* source address : physical */
225 int src_ei; /* source element index */
226 int src_fi; /* source frame index */
227
228 int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */
229 int dst_amode; /* constant, post increment, indexed,
230 double indexed */
231 unsigned long dst_start; /* source address : physical */
232 int dst_ei; /* source element index */
233 int dst_fi; /* source frame index */
234
235 int trigger; /* trigger attached if the channel is
236 synchronized */
237 int sync_mode; /* sycn on element, frame , block or packet */
238 int src_or_dst_synch; /* source synch(1) or destination synch(0) */
239
240 int ie; /* interrupt enabled */
241
242 unsigned char read_prio;/* read priority */
243 unsigned char write_prio;/* write priority */
244
245#ifndef CONFIG_ARCH_OMAP1
246 enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */
247#endif
248};
249
250struct omap_dma_lch {
251 int next_lch;
252 int dev_id;
253 u16 saved_csr;
254 u16 enabled_irqs;
255 const char *dev_name;
256 void (*callback)(int lch, u16 ch_status, void *data);
257 void *data;
258 long flags;
259 /* required for Dynamic chaining */
260 int prev_linked_ch;
261 int next_linked_ch;
262 int state;
263 int chain_id;
264 int status;
265};
266
267struct omap_dma_dev_attr {
268 u32 dev_caps;
269 u16 lch_count;
270 u16 chan_count;
271 struct omap_dma_lch *chan;
272};
273
274/* System DMA platform data structure */
275struct omap_system_dma_plat_info {
276 struct omap_dma_dev_attr *dma_attr;
277 u32 errata;
278 void (*disable_irq_lch)(int lch);
279 void (*show_dma_caps)(void);
280 void (*clear_lch_regs)(int lch);
281 void (*clear_dma)(int lch);
282 void (*dma_write)(u32 val, int reg, int lch);
283 u32 (*dma_read)(int reg, int lch);
284};
285
286#ifdef CONFIG_ARCH_OMAP2PLUS
287#define dma_omap2plus() 1
288#else
289#define dma_omap2plus() 0
22#endif 290#endif
291#define dma_omap1() (!dma_omap2plus())
292#define dma_omap15xx() ((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE)))
293#define dma_omap16xx() ((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE)))
294
295extern void omap_set_dma_priority(int lch, int dst_port, int priority);
296extern int omap_request_dma(int dev_id, const char *dev_name,
297 void (*callback)(int lch, u16 ch_status, void *data),
298 void *data, int *dma_ch);
299extern void omap_enable_dma_irq(int ch, u16 irq_bits);
300extern void omap_disable_dma_irq(int ch, u16 irq_bits);
301extern void omap_free_dma(int ch);
302extern void omap_start_dma(int lch);
303extern void omap_stop_dma(int lch);
304extern void omap_set_dma_transfer_params(int lch, int data_type,
305 int elem_count, int frame_count,
306 int sync_mode,
307 int dma_trigger, int src_or_dst_synch);
308extern void omap_set_dma_color_mode(int lch, enum omap_dma_color_mode mode,
309 u32 color);
310extern void omap_set_dma_write_mode(int lch, enum omap_dma_write_mode mode);
311extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);
312
313extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
314 unsigned long src_start,
315 int src_ei, int src_fi);
316extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
317extern void omap_set_dma_src_data_pack(int lch, int enable);
318extern void omap_set_dma_src_burst_mode(int lch,
319 enum omap_dma_burst_mode burst_mode);
320
321extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
322 unsigned long dest_start,
323 int dst_ei, int dst_fi);
324extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
325extern void omap_set_dma_dest_data_pack(int lch, int enable);
326extern void omap_set_dma_dest_burst_mode(int lch,
327 enum omap_dma_burst_mode burst_mode);
328
329extern void omap_set_dma_params(int lch,
330 struct omap_dma_channel_params *params);
331
332extern void omap_dma_link_lch(int lch_head, int lch_queue);
333extern void omap_dma_unlink_lch(int lch_head, int lch_queue);
334
335extern int omap_set_dma_callback(int lch,
336 void (*callback)(int lch, u16 ch_status, void *data),
337 void *data);
338extern dma_addr_t omap_get_dma_src_pos(int lch);
339extern dma_addr_t omap_get_dma_dst_pos(int lch);
340extern void omap_clear_dma(int lch);
341extern int omap_get_dma_active_status(int lch);
342extern int omap_dma_running(void);
343extern void omap_dma_set_global_params(int arb_rate, int max_fifo_depth,
344 int tparams);
345extern int omap_dma_set_prio_lch(int lch, unsigned char read_prio,
346 unsigned char write_prio);
347extern void omap_set_dma_dst_endian_type(int lch, enum end_type etype);
348extern void omap_set_dma_src_endian_type(int lch, enum end_type etype);
349extern int omap_get_dma_index(int lch, int *ei, int *fi);
350
351void omap_dma_global_context_save(void);
352void omap_dma_global_context_restore(void);
353
354extern void omap_dma_disable_irq(int lch);
355
356/* Chaining APIs */
357#ifndef CONFIG_ARCH_OMAP1
358extern int omap_request_dma_chain(int dev_id, const char *dev_name,
359 void (*callback) (int lch, u16 ch_status,
360 void *data),
361 int *chain_id, int no_of_chans,
362 int chain_mode,
363 struct omap_dma_channel_params params);
364extern int omap_free_dma_chain(int chain_id);
365extern int omap_dma_chain_a_transfer(int chain_id, int src_start,
366 int dest_start, int elem_count,
367 int frame_count, void *callbk_data);
368extern int omap_start_dma_chain_transfers(int chain_id);
369extern int omap_stop_dma_chain_transfers(int chain_id);
370extern int omap_get_dma_chain_index(int chain_id, int *ei, int *fi);
371extern int omap_get_dma_chain_dst_pos(int chain_id);
372extern int omap_get_dma_chain_src_pos(int chain_id);
373
374extern int omap_modify_dma_chain_params(int chain_id,
375 struct omap_dma_channel_params params);
376extern int omap_dma_chain_status(int chain_id);
377#endif
378
379#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP)
380#include <mach/lcd_dma.h>
381#else
382static inline int omap_lcd_dma_running(void)
383{
384 return 0;
385}
386#endif
387
388#endif /* __LINUX_OMAP_DMA_H */
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
new file mode 100644
index 00000000000..cac78de09c0
--- /dev/null
+++ b/include/linux/omap-iommu.h
@@ -0,0 +1,52 @@
1/*
2 * omap iommu: simple virtual address space management
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _INTEL_IOMMU_H_
14#define _INTEL_IOMMU_H_
15
16struct iovm_struct {
17 struct omap_iommu *iommu; /* iommu object which this belongs to */
18 u32 da_start; /* area definition */
19 u32 da_end;
20 u32 flags; /* IOVMF_: see below */
21 struct list_head list; /* linked in ascending order */
22 const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
23 void *va; /* mpu side mapped address */
24};
25
26#define MMU_RAM_ENDIAN_SHIFT 9
27#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
28#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
29#define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
30#define MMU_RAM_ELSZ_SHIFT 7
31#define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
32
33struct iommu_domain;
34
35extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
36extern u32
37omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
38 const struct sg_table *sgt, u32 flags);
39extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
40 struct device *dev, u32 da);
41extern u32
42omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
43 u32 da, size_t bytes, u32 flags);
44extern void
45omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
46 const u32 da);
47extern void *omap_da_to_va(struct device *dev, u32 da);
48
49extern void omap_iommu_save_ctx(struct device *dev);
50extern void omap_iommu_restore_ctx(struct device *dev);
51
52#endif
diff --git a/include/linux/oom.h b/include/linux/oom.h
index fb9826847b8..da60007075b 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -29,8 +29,23 @@ enum oom_scan_t {
29 OOM_SCAN_SELECT, /* always select this thread first */ 29 OOM_SCAN_SELECT, /* always select this thread first */
30}; 30};
31 31
32extern void compare_swap_oom_score_adj(int old_val, int new_val); 32/* Thread is the potential origin of an oom condition; kill first on oom */
33extern int test_set_oom_score_adj(int new_val); 33#define OOM_FLAG_ORIGIN ((__force oom_flags_t)0x1)
34
35static inline void set_current_oom_origin(void)
36{
37 current->signal->oom_flags |= OOM_FLAG_ORIGIN;
38}
39
40static inline void clear_current_oom_origin(void)
41{
42 current->signal->oom_flags &= ~OOM_FLAG_ORIGIN;
43}
44
45static inline bool oom_task_origin(const struct task_struct *p)
46{
47 return !!(p->signal->oom_flags & OOM_FLAG_ORIGIN);
48}
34 49
35extern unsigned long oom_badness(struct task_struct *p, 50extern unsigned long oom_badness(struct task_struct *p,
36 struct mem_cgroup *memcg, const nodemask_t *nodemask, 51 struct mem_cgroup *memcg, const nodemask_t *nodemask,
@@ -49,8 +64,6 @@ extern void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask,
49extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task, 64extern enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
50 unsigned long totalpages, const nodemask_t *nodemask, 65 unsigned long totalpages, const nodemask_t *nodemask,
51 bool force_kill); 66 bool force_kill);
52extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
53 int order);
54 67
55extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 68extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
56 int order, nodemask_t *mask, bool force_kill); 69 int order, nodemask_t *mask, bool force_kill);
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index eb1efa54fe8..d42e174bd0c 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -243,6 +243,7 @@ enum ovs_key_attr {
243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */ 243 OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */ 244 OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */ 245 OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
246 OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
246 __OVS_KEY_ATTR_MAX 247 __OVS_KEY_ATTR_MAX
247}; 248};
248 249
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 76a9539cfd3..a92061e08d4 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -2,7 +2,8 @@
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4 4
5bool has_unmovable_pages(struct zone *zone, struct page *page, int count); 5bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
6 bool skip_hwpoisoned_pages);
6void set_pageblock_migratetype(struct page *page, int migratetype); 7void set_pageblock_migratetype(struct page *page, int migratetype);
7int move_freepages_block(struct zone *zone, struct page *page, 8int move_freepages_block(struct zone *zone, struct page *page,
8 int migratetype); 9 int migratetype);
@@ -21,7 +22,7 @@ int move_freepages(struct zone *zone,
21 */ 22 */
22int 23int
23start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, 24start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
24 unsigned migratetype); 25 unsigned migratetype, bool skip_hwpoisoned_pages);
25 26
26/* 27/*
27 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. 28 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
@@ -34,12 +35,13 @@ undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
34/* 35/*
35 * Test all pages in [start_pfn, end_pfn) are isolated or not. 36 * Test all pages in [start_pfn, end_pfn) are isolated or not.
36 */ 37 */
37int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn); 38int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn,
39 bool skip_hwpoisoned_pages);
38 40
39/* 41/*
40 * Internal functions. Changes pageblock's migrate type. 42 * Internal functions. Changes pageblock's migrate type.
41 */ 43 */
42int set_migratetype_isolate(struct page *page); 44int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages);
43void unset_migratetype_isolate(struct page *page, unsigned migratetype); 45void unset_migratetype_isolate(struct page *page, unsigned migratetype);
44struct page *alloc_migrate_target(struct page *page, unsigned long private, 46struct page *alloc_migrate_target(struct page *page, unsigned long private,
45 int **resultp); 47 int **resultp);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e42c762f0dc..6da609d14c1 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -24,6 +24,7 @@ enum mapping_flags {
24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 24 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */
27}; 28};
28 29
29static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -53,6 +54,21 @@ static inline int mapping_unevictable(struct address_space *mapping)
53 return !!mapping; 54 return !!mapping;
54} 55}
55 56
57static inline void mapping_set_balloon(struct address_space *mapping)
58{
59 set_bit(AS_BALLOON_MAP, &mapping->flags);
60}
61
62static inline void mapping_clear_balloon(struct address_space *mapping)
63{
64 clear_bit(AS_BALLOON_MAP, &mapping->flags);
65}
66
67static inline int mapping_balloon(struct address_space *mapping)
68{
69 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
70}
71
56static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 72static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
57{ 73{
58 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; 74 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ee2179546c6..15472d691ee 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -333,6 +333,8 @@ struct pci_dev {
333 }; 333 };
334 struct pci_ats *ats; /* Address Translation Service */ 334 struct pci_ats *ats; /* Address Translation Service */
335#endif 335#endif
336 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
337 size_t romlen; /* Length of ROM if it's not from the BAR */
336}; 338};
337 339
338static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 340static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -538,6 +540,9 @@ enum pci_ers_result {
538 540
539 /* Device driver is fully recovered and operational */ 541 /* Device driver is fully recovered and operational */
540 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5, 542 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
543
544 /* No AER capabilities registered for the driver */
545 PCI_ERS_RESULT_NO_AER_DRIVER = (__force pci_ers_result_t) 6,
541}; 546};
542 547
543/* PCI bus error event callbacks */ 548/* PCI bus error event callbacks */
@@ -573,6 +578,7 @@ struct pci_driver {
573 int (*resume_early) (struct pci_dev *dev); 578 int (*resume_early) (struct pci_dev *dev);
574 int (*resume) (struct pci_dev *dev); /* Device woken up */ 579 int (*resume) (struct pci_dev *dev); /* Device woken up */
575 void (*shutdown) (struct pci_dev *dev); 580 void (*shutdown) (struct pci_dev *dev);
581 int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* PF pdev */
576 const struct pci_error_handlers *err_handler; 582 const struct pci_error_handlers *err_handler;
577 struct device_driver driver; 583 struct device_driver driver;
578 struct pci_dynids dynids; 584 struct pci_dynids dynids;
@@ -588,7 +594,7 @@ struct pci_driver {
588 * in a generic manner. 594 * in a generic manner.
589 */ 595 */
590#define DEFINE_PCI_DEVICE_TABLE(_table) \ 596#define DEFINE_PCI_DEVICE_TABLE(_table) \
591 const struct pci_device_id _table[] __devinitconst 597 const struct pci_device_id _table[]
592 598
593/** 599/**
594 * PCI_DEVICE - macro used to describe a specific pci device 600 * PCI_DEVICE - macro used to describe a specific pci device
@@ -604,6 +610,20 @@ struct pci_driver {
604 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID 610 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
605 611
606/** 612/**
613 * PCI_DEVICE_SUB - macro used to describe a specific pci device with subsystem
614 * @vend: the 16 bit PCI Vendor ID
615 * @dev: the 16 bit PCI Device ID
616 * @subvend: the 16 bit PCI Subvendor ID
617 * @subdev: the 16 bit PCI Subdevice ID
618 *
619 * This macro is used to create a struct pci_device_id that matches a
620 * specific device with subsystem information.
621 */
622#define PCI_DEVICE_SUB(vend, dev, subvend, subdev) \
623 .vendor = (vend), .device = (dev), \
624 .subvendor = (subvend), .subdevice = (subdev)
625
626/**
607 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class 627 * PCI_DEVICE_CLASS - macro used to describe a specific pci device class
608 * @dev_class: the class, subclass, prog-if triple for this device 628 * @dev_class: the class, subclass, prog-if triple for this device
609 * @dev_class_mask: the class mask for this device 629 * @dev_class_mask: the class mask for this device
@@ -686,7 +706,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
686int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); 706int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax);
687int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); 707int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax);
688void pci_bus_release_busn_res(struct pci_bus *b); 708void pci_bus_release_busn_res(struct pci_bus *b);
689struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, 709struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
690 struct pci_ops *ops, void *sysdata, 710 struct pci_ops *ops, void *sysdata,
691 struct list_head *resources); 711 struct list_head *resources);
692struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 712struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
@@ -712,6 +732,8 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
712extern void pci_dev_put(struct pci_dev *dev); 732extern void pci_dev_put(struct pci_dev *dev);
713extern void pci_remove_bus(struct pci_bus *b); 733extern void pci_remove_bus(struct pci_bus *b);
714extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); 734extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
735void pci_stop_root_bus(struct pci_bus *bus);
736void pci_remove_root_bus(struct pci_bus *bus);
715void pci_setup_cardbus(struct pci_bus *bus); 737void pci_setup_cardbus(struct pci_bus *bus);
716extern void pci_sort_breadthfirst(void); 738extern void pci_sort_breadthfirst(void);
717#define dev_is_pci(d) ((d)->bus == &pci_bus_type) 739#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
@@ -941,10 +963,8 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
941 963
942/* Functions for PCI Hotplug drivers to use */ 964/* Functions for PCI Hotplug drivers to use */
943int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 965int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
944#ifdef CONFIG_HOTPLUG
945unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); 966unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
946unsigned int pci_rescan_bus(struct pci_bus *bus); 967unsigned int pci_rescan_bus(struct pci_bus *bus);
947#endif
948 968
949/* Vital product data routines */ 969/* Vital product data routines */
950ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 970ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -958,6 +978,7 @@ void pci_bus_size_bridges(struct pci_bus *bus);
958int pci_claim_resource(struct pci_dev *, int); 978int pci_claim_resource(struct pci_dev *, int);
959void pci_assign_unassigned_resources(void); 979void pci_assign_unassigned_resources(void);
960void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 980void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
981void pci_assign_unassigned_bus_resources(struct pci_bus *bus);
961void pdev_enable_device(struct pci_dev *); 982void pdev_enable_device(struct pci_dev *);
962int pci_enable_resources(struct pci_dev *, int mask); 983int pci_enable_resources(struct pci_dev *, int mask);
963void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 984void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
@@ -1580,7 +1601,7 @@ extern int pci_pci_problems;
1580 1601
1581extern unsigned long pci_cardbus_io_size; 1602extern unsigned long pci_cardbus_io_size;
1582extern unsigned long pci_cardbus_mem_size; 1603extern unsigned long pci_cardbus_mem_size;
1583extern u8 __devinitdata pci_dfl_cache_line_size; 1604extern u8 pci_dfl_cache_line_size;
1584extern u8 pci_cache_line_size; 1605extern u8 pci_cache_line_size;
1585 1606
1586extern unsigned long pci_hotplug_io_size; 1607extern unsigned long pci_hotplug_io_size;
@@ -1592,6 +1613,7 @@ void pcibios_disable_device(struct pci_dev *dev);
1592void pcibios_set_master(struct pci_dev *dev); 1613void pcibios_set_master(struct pci_dev *dev);
1593int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1614int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1594 enum pcie_reset_state state); 1615 enum pcie_reset_state state);
1616int pcibios_add_device(struct pci_dev *dev);
1595 1617
1596#ifdef CONFIG_PCI_MMCONFIG 1618#ifdef CONFIG_PCI_MMCONFIG
1597extern void __init pci_mmcfg_early_init(void); 1619extern void __init pci_mmcfg_early_init(void);
@@ -1601,7 +1623,7 @@ static inline void pci_mmcfg_early_init(void) { }
1601static inline void pci_mmcfg_late_init(void) { } 1623static inline void pci_mmcfg_late_init(void) { }
1602#endif 1624#endif
1603 1625
1604int pci_ext_cfg_avail(struct pci_dev *dev); 1626int pci_ext_cfg_avail(void);
1605 1627
1606void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1628void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1607 1629
@@ -1610,6 +1632,8 @@ extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1610extern void pci_disable_sriov(struct pci_dev *dev); 1632extern void pci_disable_sriov(struct pci_dev *dev);
1611extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1633extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1612extern int pci_num_vf(struct pci_dev *dev); 1634extern int pci_num_vf(struct pci_dev *dev);
1635extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1636extern int pci_sriov_get_totalvfs(struct pci_dev *dev);
1613#else 1637#else
1614static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1638static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1615{ 1639{
@@ -1626,6 +1650,14 @@ static inline int pci_num_vf(struct pci_dev *dev)
1626{ 1650{
1627 return 0; 1651 return 0;
1628} 1652}
1653static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
1654{
1655 return 0;
1656}
1657static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1658{
1659 return 0;
1660}
1629#endif 1661#endif
1630 1662
1631#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1663#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9d36b829533..0f8447376dd 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1985,6 +1985,9 @@
1985#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 1985#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152
1986#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154 1986#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154
1987#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158 1987#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158
1988#define PCI_DEVICE_ID_EXAR_XR17V352 0x0352
1989#define PCI_DEVICE_ID_EXAR_XR17V354 0x0354
1990#define PCI_DEVICE_ID_EXAR_XR17V358 0x0358
1988 1991
1989#define PCI_VENDOR_ID_MICROGATE 0x13c0 1992#define PCI_VENDOR_ID_MICROGATE 0x13c0
1990#define PCI_DEVICE_ID_MICROGATE_USC 0x0010 1993#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
@@ -2323,6 +2326,8 @@
2323 2326
2324#define PCI_VENDOR_ID_TOPSPIN 0x1867 2327#define PCI_VENDOR_ID_TOPSPIN 0x1867
2325 2328
2329#define PCI_VENDOR_ID_COMMTECH 0x18f7
2330
2326#define PCI_VENDOR_ID_SILAN 0x1904 2331#define PCI_VENDOR_ID_SILAN 0x1904
2327 2332
2328#define PCI_VENDOR_ID_RENESAS 0x1912 2333#define PCI_VENDOR_ID_RENESAS 0x1912
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index bd1e86071e5..3e88c9a7d57 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -1,83 +1,34 @@
1#ifndef _LINUX_PERCPU_RWSEM_H 1#ifndef _LINUX_PERCPU_RWSEM_H
2#define _LINUX_PERCPU_RWSEM_H 2#define _LINUX_PERCPU_RWSEM_H
3 3
4#include <linux/mutex.h> 4#include <linux/atomic.h>
5#include <linux/rwsem.h>
5#include <linux/percpu.h> 6#include <linux/percpu.h>
6#include <linux/rcupdate.h> 7#include <linux/wait.h>
7#include <linux/delay.h> 8#include <linux/lockdep.h>
8 9
9struct percpu_rw_semaphore { 10struct percpu_rw_semaphore {
10 unsigned __percpu *counters; 11 unsigned int __percpu *fast_read_ctr;
11 bool locked; 12 atomic_t write_ctr;
12 struct mutex mtx; 13 struct rw_semaphore rw_sem;
14 atomic_t slow_read_ctr;
15 wait_queue_head_t write_waitq;
13}; 16};
14 17
15#define light_mb() barrier() 18extern void percpu_down_read(struct percpu_rw_semaphore *);
16#define heavy_mb() synchronize_sched_expedited() 19extern void percpu_up_read(struct percpu_rw_semaphore *);
17 20
18static inline void percpu_down_read(struct percpu_rw_semaphore *p) 21extern void percpu_down_write(struct percpu_rw_semaphore *);
19{ 22extern void percpu_up_write(struct percpu_rw_semaphore *);
20 rcu_read_lock_sched();
21 if (unlikely(p->locked)) {
22 rcu_read_unlock_sched();
23 mutex_lock(&p->mtx);
24 this_cpu_inc(*p->counters);
25 mutex_unlock(&p->mtx);
26 return;
27 }
28 this_cpu_inc(*p->counters);
29 rcu_read_unlock_sched();
30 light_mb(); /* A, between read of p->locked and read of data, paired with D */
31}
32 23
33static inline void percpu_up_read(struct percpu_rw_semaphore *p) 24extern int __percpu_init_rwsem(struct percpu_rw_semaphore *,
34{ 25 const char *, struct lock_class_key *);
35 light_mb(); /* B, between read of the data and write to p->counter, paired with C */ 26extern void percpu_free_rwsem(struct percpu_rw_semaphore *);
36 this_cpu_dec(*p->counters);
37}
38 27
39static inline unsigned __percpu_count(unsigned __percpu *counters) 28#define percpu_init_rwsem(brw) \
40{ 29({ \
41 unsigned total = 0; 30 static struct lock_class_key rwsem_key; \
42 int cpu; 31 __percpu_init_rwsem(brw, #brw, &rwsem_key); \
43 32})
44 for_each_possible_cpu(cpu)
45 total += ACCESS_ONCE(*per_cpu_ptr(counters, cpu));
46
47 return total;
48}
49
50static inline void percpu_down_write(struct percpu_rw_semaphore *p)
51{
52 mutex_lock(&p->mtx);
53 p->locked = true;
54 synchronize_sched_expedited(); /* make sure that all readers exit the rcu_read_lock_sched region */
55 while (__percpu_count(p->counters))
56 msleep(1);
57 heavy_mb(); /* C, between read of p->counter and write to data, paired with B */
58}
59
60static inline void percpu_up_write(struct percpu_rw_semaphore *p)
61{
62 heavy_mb(); /* D, between write to data and write to p->locked, paired with A */
63 p->locked = false;
64 mutex_unlock(&p->mtx);
65}
66
67static inline int percpu_init_rwsem(struct percpu_rw_semaphore *p)
68{
69 p->counters = alloc_percpu(unsigned);
70 if (unlikely(!p->counters))
71 return -ENOMEM;
72 p->locked = false;
73 mutex_init(&p->mtx);
74 return 0;
75}
76
77static inline void percpu_free_rwsem(struct percpu_rw_semaphore *p)
78{
79 free_percpu(p->counters);
80 p->counters = NULL; /* catch use after free bugs */
81}
82 33
83#endif 34#endif
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 65e3e87eacc..bf285999273 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -21,6 +21,7 @@ struct pid_namespace {
21 struct kref kref; 21 struct kref kref;
22 struct pidmap pidmap[PIDMAP_ENTRIES]; 22 struct pidmap pidmap[PIDMAP_ENTRIES];
23 int last_pid; 23 int last_pid;
24 int nr_hashed;
24 struct task_struct *child_reaper; 25 struct task_struct *child_reaper;
25 struct kmem_cache *pid_cachep; 26 struct kmem_cache *pid_cachep;
26 unsigned int level; 27 unsigned int level;
@@ -31,9 +32,12 @@ struct pid_namespace {
31#ifdef CONFIG_BSD_PROCESS_ACCT 32#ifdef CONFIG_BSD_PROCESS_ACCT
32 struct bsd_acct_struct *bacct; 33 struct bsd_acct_struct *bacct;
33#endif 34#endif
35 struct user_namespace *user_ns;
36 struct work_struct proc_work;
34 kgid_t pid_gid; 37 kgid_t pid_gid;
35 int hide_pid; 38 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */ 39 int reboot; /* group exit code if this pidns was rebooted */
40 unsigned int proc_inum;
37}; 41};
38 42
39extern struct pid_namespace init_pid_ns; 43extern struct pid_namespace init_pid_ns;
@@ -46,7 +50,8 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
46 return ns; 50 return ns;
47} 51}
48 52
49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 53extern struct pid_namespace *copy_pid_ns(unsigned long flags,
54 struct user_namespace *user_ns, struct pid_namespace *ns);
50extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); 55extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
51extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); 56extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
52extern void put_pid_ns(struct pid_namespace *ns); 57extern void put_pid_ns(struct pid_namespace *ns);
@@ -59,8 +64,8 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
59 return ns; 64 return ns;
60} 65}
61 66
62static inline struct pid_namespace * 67static inline struct pid_namespace *copy_pid_ns(unsigned long flags,
63copy_pid_ns(unsigned long flags, struct pid_namespace *ns) 68 struct user_namespace *user_ns, struct pid_namespace *ns)
64{ 69{
65 if (flags & CLONE_NEWPID) 70 if (flags & CLONE_NEWPID)
66 ns = ERR_PTR(-EINVAL); 71 ns = ERR_PTR(-EINVAL);
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 4f0abb9f1c0..47a1bdd8887 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -46,11 +46,11 @@
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source 46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the 47 * (open emitter). Sending this config will enabale open drain mode, the
48 * argument is ignored. 48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT_DISABLE: disable schmitt-trigger mode on the pin.
49 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in 50 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
50 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, 51 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
51 * the threshold value is given on a custom format as argument when 52 * the threshold value is given on a custom format as argument when
52 * setting pins to this mode. The argument zero turns the schmitt trigger 53 * setting pins to this mode.
53 * off.
54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, 54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
55 * which means it will wait for signals to settle when reading inputs. The 55 * which means it will wait for signals to settle when reading inputs. The
56 * argument gives the debounce time on a custom format. Setting the 56 * argument gives the debounce time on a custom format. Setting the
@@ -74,6 +74,7 @@ enum pin_config_param {
74 PIN_CONFIG_DRIVE_PUSH_PULL, 74 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN, 75 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE, 76 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT_DISABLE,
77 PIN_CONFIG_INPUT_SCHMITT, 78 PIN_CONFIG_INPUT_SCHMITT,
78 PIN_CONFIG_INPUT_DEBOUNCE, 79 PIN_CONFIG_INPUT_DEBOUNCE,
79 PIN_CONFIG_POWER_SOURCE, 80 PIN_CONFIG_POWER_SOURCE,
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 7d087f03e91..04d6700d99a 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -134,6 +134,25 @@ extern void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
134extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev, 134extern void pinctrl_add_gpio_ranges(struct pinctrl_dev *pctldev,
135 struct pinctrl_gpio_range *ranges, 135 struct pinctrl_gpio_range *ranges,
136 unsigned nranges); 136 unsigned nranges);
137extern void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
138 struct pinctrl_gpio_range *range);
139
140extern struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
141 struct pinctrl_gpio_range *range);
142extern struct pinctrl_gpio_range *
143pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
144 unsigned int pin);
145
146#ifdef CONFIG_OF
147extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
148#else
149static inline
150struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
151{
152 return NULL;
153}
154#endif /* CONFIG_OF */
155
137extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); 156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
138extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); 157extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
139#else 158#else
diff --git a/include/linux/platform_data/ad5449.h b/include/linux/platform_data/ad5449.h
new file mode 100644
index 00000000000..bd712bd4b94
--- /dev/null
+++ b/include/linux/platform_data/ad5449.h
@@ -0,0 +1,40 @@
1/*
2 * AD5415, AD5426, AD5429, AD5432, AD5439, AD5443, AD5449 Digital to Analog
3 * Converter driver.
4 *
5 * Copyright 2012 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef __LINUX_PLATFORM_DATA_AD5449_H__
12#define __LINUX_PLATFORM_DATA_AD5449_H__
13
14/**
15 * enum ad5449_sdo_mode - AD5449 SDO pin configuration
16 * @AD5449_SDO_DRIVE_FULL: Drive the SDO pin with full strength.
17 * @AD5449_SDO_DRIVE_WEAK: Drive the SDO pin with not full strength.
18 * @AD5449_SDO_OPEN_DRAIN: Operate the SDO pin in open-drain mode.
19 * @AD5449_SDO_DISABLED: Disable the SDO pin, in this mode it is not possible to
20 * read back from the device.
21 */
22enum ad5449_sdo_mode {
23 AD5449_SDO_DRIVE_FULL = 0x0,
24 AD5449_SDO_DRIVE_WEAK = 0x1,
25 AD5449_SDO_OPEN_DRAIN = 0x2,
26 AD5449_SDO_DISABLED = 0x3,
27};
28
29/**
30 * struct ad5449_platform_data - Platform data for the ad5449 DAC driver
31 * @sdo_mode: SDO pin mode
32 * @hardware_clear_to_midscale: Whether asserting the hardware CLR pin sets the
33 * outputs to midscale (true) or to zero scale(false).
34 */
35struct ad5449_platform_data {
36 enum ad5449_sdo_mode sdo_mode;
37 bool hardware_clear_to_midscale;
38};
39
40#endif
diff --git a/include/linux/platform_data/ad7298.h b/include/linux/platform_data/ad7298.h
new file mode 100644
index 00000000000..fbf8adf1363
--- /dev/null
+++ b/include/linux/platform_data/ad7298.h
@@ -0,0 +1,20 @@
1/*
2 * AD7298 SPI ADC driver
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#ifndef __LINUX_PLATFORM_DATA_AD7298_H__
10#define __LINUX_PLATFORM_DATA_AD7298_H__
11
12/**
13 * struct ad7298_platform_data - Platform data for the ad7298 ADC driver
14 * @ext_ref: Whether to use an external reference voltage.
15 **/
16struct ad7298_platform_data {
17 bool ext_ref;
18};
19
20#endif /* IIO_ADC_AD7298_H_ */
diff --git a/include/linux/platform_data/ad7793.h b/include/linux/platform_data/ad7793.h
new file mode 100644
index 00000000000..7ea6751aae6
--- /dev/null
+++ b/include/linux/platform_data/ad7793.h
@@ -0,0 +1,112 @@
1/*
2 * AD7792/AD7793 SPI ADC driver
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8#ifndef __LINUX_PLATFORM_DATA_AD7793_H__
9#define __LINUX_PLATFORM_DATA_AD7793_H__
10
11/**
12 * enum ad7793_clock_source - AD7793 clock source selection
13 * @AD7793_CLK_SRC_INT: Internal 64 kHz clock, not available at the CLK pin.
14 * @AD7793_CLK_SRC_INT_CO: Internal 64 kHz clock, available at the CLK pin.
15 * @AD7793_CLK_SRC_EXT: Use external clock.
16 * @AD7793_CLK_SRC_EXT_DIV2: Use external clock divided by 2.
17 */
18enum ad7793_clock_source {
19 AD7793_CLK_SRC_INT,
20 AD7793_CLK_SRC_INT_CO,
21 AD7793_CLK_SRC_EXT,
22 AD7793_CLK_SRC_EXT_DIV2,
23};
24
25/**
26 * enum ad7793_bias_voltage - AD7793 bias voltage selection
27 * @AD7793_BIAS_VOLTAGE_DISABLED: Bias voltage generator disabled
28 * @AD7793_BIAS_VOLTAGE_AIN1: Bias voltage connected to AIN1(-).
29 * @AD7793_BIAS_VOLTAGE_AIN2: Bias voltage connected to AIN2(-).
30 * @AD7793_BIAS_VOLTAGE_AIN3: Bias voltage connected to AIN3(-).
31 * Only valid for AD7795/AD7796.
32 */
33enum ad7793_bias_voltage {
34 AD7793_BIAS_VOLTAGE_DISABLED,
35 AD7793_BIAS_VOLTAGE_AIN1,
36 AD7793_BIAS_VOLTAGE_AIN2,
37 AD7793_BIAS_VOLTAGE_AIN3,
38};
39
40/**
41 * enum ad7793_refsel - AD7793 reference voltage selection
42 * @AD7793_REFSEL_REFIN1: External reference applied between REFIN1(+)
43 * and REFIN1(-).
44 * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) and
45 * and REFIN1(-). Only valid for AD7795/AD7796.
46 * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference.
47 */
48enum ad7793_refsel {
49 AD7793_REFSEL_REFIN1 = 0,
50 AD7793_REFSEL_REFIN2 = 1,
51 AD7793_REFSEL_INTERNAL = 2,
52};
53
54/**
55 * enum ad7793_current_source_direction - AD7793 excitation current direction
56 * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: Current source IEXC1 connected to pin
57 * IOUT1, current source IEXC2 connected to pin IOUT2.
58 * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: Current source IEXC2 connected to pin
59 * IOUT1, current source IEXC1 connected to pin IOUT2.
60 * @AD7793_IEXEC1_IEXEC2_IOUT1: Both current sources connected to pin IOUT1.
61 * Only valid when the current sources are set to 10 uA or 210 uA.
62 * @AD7793_IEXEC1_IEXEC2_IOUT2: Both current sources connected to Pin IOUT2.
63 * Only valid when the current ources are set to 10 uA or 210 uA.
64 */
65enum ad7793_current_source_direction {
66 AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0,
67 AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1,
68 AD7793_IEXEC1_IEXEC2_IOUT1 = 2,
69 AD7793_IEXEC1_IEXEC2_IOUT2 = 3,
70};
71
72/**
73 * enum ad7793_excitation_current - AD7793 excitation current selection
74 * @AD7793_IX_DISABLED: Excitation current Disabled.
75 * @AD7793_IX_10uA: Enable 10 micro-ampere excitation current.
76 * @AD7793_IX_210uA: Enable 210 micro-ampere excitation current.
77 * @AD7793_IX_1mA: Enable 1 milli-Ampere excitation current.
78 */
79enum ad7793_excitation_current {
80 AD7793_IX_DISABLED = 0,
81 AD7793_IX_10uA = 1,
82 AD7793_IX_210uA = 2,
83 AD7793_IX_1mA = 3,
84};
85
86/**
87 * struct ad7793_platform_data - AD7793 platform data
88 * @clock_src: Clock source selection
89 * @burnout_current: If set to true the 100nA burnout current is enabled.
90 * @boost_enable: Enable boost for the bias voltage generator.
91 * @buffered: If set to true configure the device for buffered input mode.
92 * @unipolar: If set to true sample in unipolar mode, if set to false sample in
93 * bipolar mode.
94 * @refsel: Reference voltage selection
95 * @bias_voltage: Bias voltage selection
96 * @exitation_current: Excitation current selection
97 * @current_source_direction: Excitation current direction selection
98 */
99struct ad7793_platform_data {
100 enum ad7793_clock_source clock_src;
101 bool burnout_current;
102 bool boost_enable;
103 bool buffered;
104 bool unipolar;
105
106 enum ad7793_refsel refsel;
107 enum ad7793_bias_voltage bias_voltage;
108 enum ad7793_excitation_current exitation_current;
109 enum ad7793_current_source_direction current_source_direction;
110};
111
112#endif /* IIO_ADC_AD7793_H_ */
diff --git a/include/linux/platform_data/ad7887.h b/include/linux/platform_data/ad7887.h
new file mode 100644
index 00000000000..1e06eac3174
--- /dev/null
+++ b/include/linux/platform_data/ad7887.h
@@ -0,0 +1,26 @@
1/*
2 * AD7887 SPI ADC driver
3 *
4 * Copyright 2010 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8#ifndef IIO_ADC_AD7887_H_
9#define IIO_ADC_AD7887_H_
10
11/**
12 * struct ad7887_platform_data - AD7887 ADC driver platform data
13 * @en_dual: Whether to use dual channel mode. If set to true AIN1 becomes the
14 * second input channel, and Vref is internally connected to Vdd. If set to
15 * false the device is used in single channel mode and AIN1/Vref is used as
16 * VREF input.
17 * @use_onchip_ref: Whether to use the onchip reference. If set to true the
18 * internal 2.5V reference is used. If set to false a external reference is
19 * used.
20 */
21struct ad7887_platform_data {
22 bool en_dual;
23 bool use_onchip_ref;
24};
25
26#endif /* IIO_ADC_AD7887_H_ */
diff --git a/include/linux/platform_data/ads7828.h b/include/linux/platform_data/ads7828.h
new file mode 100644
index 00000000000..3245f45f9d7
--- /dev/null
+++ b/include/linux/platform_data/ads7828.h
@@ -0,0 +1,29 @@
1/*
2 * TI ADS7828 A/D Converter platform data definition
3 *
4 * Copyright (c) 2012 Savoir-faire Linux Inc.
5 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
6 *
7 * For further information, see the Documentation/hwmon/ads7828 file.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _PDATA_ADS7828_H
15#define _PDATA_ADS7828_H
16
17/**
18 * struct ads7828_platform_data - optional ADS7828 connectivity info
19 * @diff_input: Differential input mode.
20 * @ext_vref: Use an external voltage reference.
21 * @vref_mv: Voltage reference value, if external.
22 */
23struct ads7828_platform_data {
24 bool diff_input;
25 bool ext_vref;
26 unsigned int vref_mv;
27};
28
29#endif /* _PDATA_ADS7828_H */
diff --git a/include/linux/platform_data/asoc-imx-ssi.h b/include/linux/platform_data/asoc-imx-ssi.h
index 63f3c280423..92c7fd72f63 100644
--- a/include/linux/platform_data/asoc-imx-ssi.h
+++ b/include/linux/platform_data/asoc-imx-ssi.h
@@ -17,5 +17,7 @@ struct imx_ssi_platform_data {
17 void (*ac97_warm_reset)(struct snd_ac97 *ac97); 17 void (*ac97_warm_reset)(struct snd_ac97 *ac97);
18}; 18};
19 19
20extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
21
20#endif /* __MACH_SSI_H */ 22#endif /* __MACH_SSI_H */
21 23
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index aa9875f77c4..88272591a89 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -38,12 +38,6 @@ struct samsung_i2s {
38#define QUIRK_NEED_RSTCLR (1 << 3) 38#define QUIRK_NEED_RSTCLR (1 << 3)
39 /* Quirks of the I2S controller */ 39 /* Quirks of the I2S controller */
40 u32 quirks; 40 u32 quirks;
41
42 /*
43 * Array of clock names that can be used to generate I2S signals.
44 * Also corresponds to clocks of I2SMOD[10]
45 */
46 const char **src_clk;
47 dma_addr_t idma_addr; 41 dma_addr_t idma_addr;
48}; 42};
49 43
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index b0f2c56a8ea..6a293b7fff3 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -8,6 +8,55 @@
8#define __ATMEL_H__ 8#define __ATMEL_H__
9 9
10#include <linux/mtd/nand.h> 10#include <linux/mtd/nand.h>
11#include <linux/mtd/partitions.h>
12#include <linux/device.h>
13#include <linux/i2c.h>
14#include <linux/leds.h>
15#include <linux/spi/spi.h>
16#include <linux/usb/atmel_usba_udc.h>
17#include <linux/atmel-mci.h>
18#include <sound/atmel-ac97c.h>
19#include <linux/serial.h>
20#include <linux/platform_data/macb.h>
21
22/*
23 * at91: 6 USARTs and one DBGU port (SAM9260)
24 * avr32: 4
25 */
26#define ATMEL_MAX_UART 7
27
28 /* USB Device */
29struct at91_udc_data {
30 int vbus_pin; /* high == host powering us */
31 u8 vbus_active_low; /* vbus polarity */
32 u8 vbus_polled; /* Use polling, not interrupt */
33 int pullup_pin; /* active == D+ pulled up */
34 u8 pullup_active_low; /* true == pullup_pin is active low */
35};
36
37 /* Compact Flash */
38struct at91_cf_data {
39 int irq_pin; /* I/O IRQ */
40 int det_pin; /* Card detect */
41 int vcc_pin; /* power switching */
42 int rst_pin; /* card reset */
43 u8 chipselect; /* EBI Chip Select number */
44 u8 flags;
45#define AT91_CF_TRUE_IDE 0x01
46#define AT91_IDE_SWAP_A0_A2 0x02
47};
48
49 /* USB Host */
50#define AT91_MAX_USBH_PORTS 3
51struct at91_usbh_data {
52 int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
53 int overcurrent_pin[AT91_MAX_USBH_PORTS];
54 u8 ports; /* number of ports on root hub */
55 u8 overcurrent_supported;
56 u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
57 u8 overcurrent_status[AT91_MAX_USBH_PORTS];
58 u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
59};
11 60
12 /* NAND / SmartMedia */ 61 /* NAND / SmartMedia */
13struct atmel_nand_data { 62struct atmel_nand_data {
@@ -24,4 +73,28 @@ struct atmel_nand_data {
24 unsigned int num_parts; 73 unsigned int num_parts;
25}; 74};
26 75
76 /* Serial */
77struct atmel_uart_data {
78 int num; /* port num */
79 short use_dma_tx; /* use transmit DMA? */
80 short use_dma_rx; /* use receive DMA? */
81 void __iomem *regs; /* virt. base address, if any */
82 struct serial_rs485 rs485; /* rs485 settings */
83};
84
85 /* Touchscreen Controller */
86struct at91_tsadcc_data {
87 unsigned int adc_clock;
88 u8 pendet_debounce;
89 u8 ts_sample_hold_time;
90};
91
92/* CAN */
93struct at91_can_data {
94 void (*transceiver_switch)(int on);
95};
96
97/* FIXME: this needs a better location, but gets stuff building again */
98extern int at91_suspend_entering_slow_clock(void);
99
27#endif /* __ATMEL_H__ */ 100#endif /* __ATMEL_H__ */
diff --git a/include/linux/platform_data/clk-integrator.h b/include/linux/platform_data/clk-integrator.h
index 83fe9c283bb..280edac9d0a 100644
--- a/include/linux/platform_data/clk-integrator.h
+++ b/include/linux/platform_data/clk-integrator.h
@@ -1 +1,3 @@
1void integrator_clk_init(bool is_cp); 1void integrator_clk_init(bool is_cp);
2void integrator_impd1_clk_init(void __iomem *base, unsigned int id);
3void integrator_impd1_clk_exit(unsigned int id);
diff --git a/include/linux/platform_data/clocksource-nomadik-mtu.h b/include/linux/platform_data/clocksource-nomadik-mtu.h
new file mode 100644
index 00000000000..80088973b73
--- /dev/null
+++ b/include/linux/platform_data/clocksource-nomadik-mtu.h
@@ -0,0 +1,9 @@
1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H
3
4void nmdk_timer_init(void __iomem *base, int irq);
5void nmdk_clkevt_reset(void);
6void nmdk_clksrc_reset(void);
7
8#endif /* __PLAT_MTU_H */
9
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index c4e23d02949..24368a2e8b8 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -18,9 +18,7 @@
18#include <linux/if_ether.h> 18#include <linux/if_ether.h>
19 19
20struct cpsw_slave_data { 20struct cpsw_slave_data {
21 u32 slave_reg_ofs; 21 char phy_id[MII_BUS_ID_SIZE];
22 u32 sliver_reg_ofs;
23 const char *phy_id;
24 int phy_if; 22 int phy_if;
25 u8 mac_addr[ETH_ALEN]; 23 u8 mac_addr[ETH_ALEN];
26}; 24};
@@ -28,27 +26,14 @@ struct cpsw_slave_data {
28struct cpsw_platform_data { 26struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */ 27 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */ 28 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 cpdma_reg_ofs; /* cpdma register offset */
32 u32 cpdma_sram_ofs; /* cpdma sram offset */
33
34 u32 slaves; /* number of slave cpgmac ports */ 29 u32 slaves; /* number of slave cpgmac ports */
35 struct cpsw_slave_data *slave_data; 30 struct cpsw_slave_data *slave_data;
36 31 u32 cpts_active_slave; /* time stamping slave */
37 u32 ale_reg_ofs; /* address lookup engine reg offset */ 32 u32 cpts_clock_mult; /* convert input clock ticks to nanoseconds */
33 u32 cpts_clock_shift; /* convert input clock ticks to nanoseconds */
38 u32 ale_entries; /* ale table size */ 34 u32 ale_entries; /* ale table size */
39
40 u32 host_port_reg_ofs; /* cpsw cpdma host port registers */
41 u32 host_port_num; /* The port number for the host port */
42
43 u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */
44
45 u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/
46 u32 bd_ram_size; /*buffer descriptor ram size */ 35 u32 bd_ram_size; /*buffer descriptor ram size */
47 u32 hw_ram_addr; /*if the HW address for BD RAM is different */
48 bool no_bd_ram; /* no embedded BD ram*/
49
50 u32 rx_descs; /* Number of Rx Descriptios */ 36 u32 rx_descs; /* Number of Rx Descriptios */
51
52 u32 mac_control; /* Mac control register */ 37 u32 mac_control; /* Mac control register */
53}; 38};
54 39
diff --git a/include/linux/platform_data/crypto-ux500.h b/include/linux/platform_data/crypto-ux500.h
index 5b2d0817e26..94df96d9a33 100644
--- a/include/linux/platform_data/crypto-ux500.h
+++ b/include/linux/platform_data/crypto-ux500.h
@@ -7,7 +7,7 @@
7#ifndef _CRYPTO_UX500_H 7#ifndef _CRYPTO_UX500_H
8#define _CRYPTO_UX500_H 8#define _CRYPTO_UX500_H
9#include <linux/dmaengine.h> 9#include <linux/dmaengine.h>
10#include <plat/ste_dma40.h> 10#include <linux/platform_data/dma-ste-dma40.h>
11 11
12struct hash_platform_data { 12struct hash_platform_data {
13 void *mem_to_engine; 13 void *mem_to_engine;
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index d0c5825876f..8db5ae03b6e 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -16,12 +16,13 @@
16#ifndef __DAVINCI_ASP_H 16#ifndef __DAVINCI_ASP_H
17#define __DAVINCI_ASP_H 17#define __DAVINCI_ASP_H
18 18
19#include <linux/genalloc.h>
20
19struct snd_platform_data { 21struct snd_platform_data {
20 u32 tx_dma_offset; 22 u32 tx_dma_offset;
21 u32 rx_dma_offset; 23 u32 rx_dma_offset;
22 int asp_chan_q; /* event queue number for ASP channel */ 24 int asp_chan_q; /* event queue number for ASP channel */
23 int ram_chan_q; /* event queue number for RAM channel */ 25 int ram_chan_q; /* event queue number for RAM channel */
24 unsigned int codec_fmt;
25 /* 26 /*
26 * Allowing this is more efficient and eliminates left and right swaps 27 * Allowing this is more efficient and eliminates left and right swaps
27 * caused by underruns, but will swap the left and right channels 28 * caused by underruns, but will swap the left and right channels
@@ -30,6 +31,7 @@ struct snd_platform_data {
30 unsigned enable_channel_combine:1; 31 unsigned enable_channel_combine:1;
31 unsigned sram_size_playback; 32 unsigned sram_size_playback;
32 unsigned sram_size_capture; 33 unsigned sram_size_capture;
34 struct gen_pool *sram_pool;
33 35
34 /* 36 /*
35 * If McBSP peripheral gets the clock from an external pin, 37 * If McBSP peripheral gets the clock from an external pin,
diff --git a/include/linux/platform_data/db8500_thermal.h b/include/linux/platform_data/db8500_thermal.h
new file mode 100644
index 00000000000..3bf60902e90
--- /dev/null
+++ b/include/linux/platform_data/db8500_thermal.h
@@ -0,0 +1,38 @@
1/*
2 * db8500_thermal.h - DB8500 Thermal Management Implementation
3 *
4 * Copyright (C) 2012 ST-Ericsson
5 * Copyright (C) 2012 Linaro Ltd.
6 *
7 * Author: Hongbo Zhang <hongbo.zhang@linaro.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef _DB8500_THERMAL_H_
21#define _DB8500_THERMAL_H_
22
23#include <linux/thermal.h>
24
25#define COOLING_DEV_MAX 8
26
27struct db8500_trip_point {
28 unsigned long temp;
29 enum thermal_trip_type type;
30 char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH];
31};
32
33struct db8500_thsens_platform_data {
34 struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS];
35 int num_trips;
36};
37
38#endif /* _DB8500_THERMAL_H_ */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index 1b9080385b4..f6d30cc1cb7 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -61,7 +61,9 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return strstr(dev_name(chan->device->dev), "sdma") || 63 return strstr(dev_name(chan->device->dev), "sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx-dma"); 64 !strcmp(dev_name(chan->device->dev), "imx1-dma") ||
65 !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
66 !strcmp(dev_name(chan->device->dev), "imx27-dma");
65} 67}
66 68
67#endif 69#endif
diff --git a/include/linux/platform_data/dma-mv_xor.h b/include/linux/platform_data/dma-mv_xor.h
index 2ba1f7d76ee..8ec18f64e39 100644
--- a/include/linux/platform_data/dma-mv_xor.h
+++ b/include/linux/platform_data/dma-mv_xor.h
@@ -10,15 +10,14 @@
10#include <linux/dmaengine.h> 10#include <linux/dmaengine.h>
11#include <linux/mbus.h> 11#include <linux/mbus.h>
12 12
13#define MV_XOR_SHARED_NAME "mv_xor_shared" 13#define MV_XOR_NAME "mv_xor"
14#define MV_XOR_NAME "mv_xor"
15 14
16struct mv_xor_platform_data { 15struct mv_xor_channel_data {
17 struct platform_device *shared;
18 int hw_id;
19 dma_cap_mask_t cap_mask; 16 dma_cap_mask_t cap_mask;
20 size_t pool_size;
21}; 17};
22 18
19struct mv_xor_platform_data {
20 struct mv_xor_channel_data *channels;
21};
23 22
24#endif 23#endif
diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h
new file mode 100644
index 00000000000..9ff93b06568
--- /dev/null
+++ b/include/linux/platform_data/dma-ste-dma40.h
@@ -0,0 +1,223 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2007-2010
3 * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
4 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8
9#ifndef STE_DMA40_H
10#define STE_DMA40_H
11
12#include <linux/dmaengine.h>
13#include <linux/scatterlist.h>
14#include <linux/workqueue.h>
15#include <linux/interrupt.h>
16
17/*
18 * Maxium size for a single dma descriptor
19 * Size is limited to 16 bits.
20 * Size is in the units of addr-widths (1,2,4,8 bytes)
21 * Larger transfers will be split up to multiple linked desc
22 */
23#define STEDMA40_MAX_SEG_SIZE 0xFFFF
24
25/* dev types for memcpy */
26#define STEDMA40_DEV_DST_MEMORY (-1)
27#define STEDMA40_DEV_SRC_MEMORY (-1)
28
29enum stedma40_mode {
30 STEDMA40_MODE_LOGICAL = 0,
31 STEDMA40_MODE_PHYSICAL,
32 STEDMA40_MODE_OPERATION,
33};
34
35enum stedma40_mode_opt {
36 STEDMA40_PCHAN_BASIC_MODE = 0,
37 STEDMA40_LCHAN_SRC_LOG_DST_LOG = 0,
38 STEDMA40_PCHAN_MODULO_MODE,
39 STEDMA40_PCHAN_DOUBLE_DST_MODE,
40 STEDMA40_LCHAN_SRC_PHY_DST_LOG,
41 STEDMA40_LCHAN_SRC_LOG_DST_PHY,
42};
43
44#define STEDMA40_ESIZE_8_BIT 0x0
45#define STEDMA40_ESIZE_16_BIT 0x1
46#define STEDMA40_ESIZE_32_BIT 0x2
47#define STEDMA40_ESIZE_64_BIT 0x3
48
49/* The value 4 indicates that PEN-reg shall be set to 0 */
50#define STEDMA40_PSIZE_PHY_1 0x4
51#define STEDMA40_PSIZE_PHY_2 0x0
52#define STEDMA40_PSIZE_PHY_4 0x1
53#define STEDMA40_PSIZE_PHY_8 0x2
54#define STEDMA40_PSIZE_PHY_16 0x3
55
56/*
57 * The number of elements differ in logical and
58 * physical mode
59 */
60#define STEDMA40_PSIZE_LOG_1 STEDMA40_PSIZE_PHY_2
61#define STEDMA40_PSIZE_LOG_4 STEDMA40_PSIZE_PHY_4
62#define STEDMA40_PSIZE_LOG_8 STEDMA40_PSIZE_PHY_8
63#define STEDMA40_PSIZE_LOG_16 STEDMA40_PSIZE_PHY_16
64
65/* Maximum number of possible physical channels */
66#define STEDMA40_MAX_PHYS 32
67
68enum stedma40_flow_ctrl {
69 STEDMA40_NO_FLOW_CTRL,
70 STEDMA40_FLOW_CTRL,
71};
72
73enum stedma40_periph_data_width {
74 STEDMA40_BYTE_WIDTH = STEDMA40_ESIZE_8_BIT,
75 STEDMA40_HALFWORD_WIDTH = STEDMA40_ESIZE_16_BIT,
76 STEDMA40_WORD_WIDTH = STEDMA40_ESIZE_32_BIT,
77 STEDMA40_DOUBLEWORD_WIDTH = STEDMA40_ESIZE_64_BIT
78};
79
80enum stedma40_xfer_dir {
81 STEDMA40_MEM_TO_MEM = 1,
82 STEDMA40_MEM_TO_PERIPH,
83 STEDMA40_PERIPH_TO_MEM,
84 STEDMA40_PERIPH_TO_PERIPH
85};
86
87
88/**
89 * struct stedma40_chan_cfg - dst/src channel configuration
90 *
91 * @big_endian: true if the src/dst should be read as big endian
92 * @data_width: Data width of the src/dst hardware
93 * @p_size: Burst size
94 * @flow_ctrl: Flow control on/off.
95 */
96struct stedma40_half_channel_info {
97 bool big_endian;
98 enum stedma40_periph_data_width data_width;
99 int psize;
100 enum stedma40_flow_ctrl flow_ctrl;
101};
102
103/**
104 * struct stedma40_chan_cfg - Structure to be filled by client drivers.
105 *
106 * @dir: MEM 2 MEM, PERIPH 2 MEM , MEM 2 PERIPH, PERIPH 2 PERIPH
107 * @high_priority: true if high-priority
108 * @realtime: true if realtime mode is to be enabled. Only available on DMA40
109 * version 3+, i.e DB8500v2+
110 * @mode: channel mode: physical, logical, or operation
111 * @mode_opt: options for the chosen channel mode
112 * @src_dev_type: Src device type
113 * @dst_dev_type: Dst device type
114 * @src_info: Parameters for dst half channel
115 * @dst_info: Parameters for dst half channel
116 * @use_fixed_channel: if true, use physical channel specified by phy_channel
117 * @phy_channel: physical channel to use, only if use_fixed_channel is true
118 *
119 * This structure has to be filled by the client drivers.
120 * It is recommended to do all dma configurations for clients in the machine.
121 *
122 */
123struct stedma40_chan_cfg {
124 enum stedma40_xfer_dir dir;
125 bool high_priority;
126 bool realtime;
127 enum stedma40_mode mode;
128 enum stedma40_mode_opt mode_opt;
129 int src_dev_type;
130 int dst_dev_type;
131 struct stedma40_half_channel_info src_info;
132 struct stedma40_half_channel_info dst_info;
133
134 bool use_fixed_channel;
135 int phy_channel;
136};
137
138/**
139 * struct stedma40_platform_data - Configuration struct for the dma device.
140 *
141 * @dev_len: length of dev_tx and dev_rx
142 * @dev_tx: mapping between destination event line and io address
143 * @dev_rx: mapping between source event line and io address
144 * @memcpy: list of memcpy event lines
145 * @memcpy_len: length of memcpy
146 * @memcpy_conf_phy: default configuration of physical channel memcpy
147 * @memcpy_conf_log: default configuration of logical channel memcpy
148 * @disabled_channels: A vector, ending with -1, that marks physical channels
149 * that are for different reasons not available for the driver.
150 */
151struct stedma40_platform_data {
152 u32 dev_len;
153 const dma_addr_t *dev_tx;
154 const dma_addr_t *dev_rx;
155 int *memcpy;
156 u32 memcpy_len;
157 struct stedma40_chan_cfg *memcpy_conf_phy;
158 struct stedma40_chan_cfg *memcpy_conf_log;
159 int disabled_channels[STEDMA40_MAX_PHYS];
160 bool use_esram_lcla;
161};
162
163#ifdef CONFIG_STE_DMA40
164
165/**
166 * stedma40_filter() - Provides stedma40_chan_cfg to the
167 * ste_dma40 dma driver via the dmaengine framework.
168 * does some checking of what's provided.
169 *
170 * Never directly called by client. It used by dmaengine.
171 * @chan: dmaengine handle.
172 * @data: Must be of type: struct stedma40_chan_cfg and is
173 * the configuration of the framework.
174 *
175 *
176 */
177
178bool stedma40_filter(struct dma_chan *chan, void *data);
179
180/**
181 * stedma40_slave_mem() - Transfers a raw data buffer to or from a slave
182 * (=device)
183 *
184 * @chan: dmaengine handle
185 * @addr: source or destination physicall address.
186 * @size: bytes to transfer
187 * @direction: direction of transfer
188 * @flags: is actually enum dma_ctrl_flags. See dmaengine.h
189 */
190
191static inline struct
192dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
193 dma_addr_t addr,
194 unsigned int size,
195 enum dma_transfer_direction direction,
196 unsigned long flags)
197{
198 struct scatterlist sg;
199 sg_init_table(&sg, 1);
200 sg.dma_address = addr;
201 sg.length = size;
202
203 return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags);
204}
205
206#else
207static inline bool stedma40_filter(struct dma_chan *chan, void *data)
208{
209 return false;
210}
211
212static inline struct
213dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
214 dma_addr_t addr,
215 unsigned int size,
216 enum dma_transfer_direction direction,
217 unsigned long flags)
218{
219 return NULL;
220}
221#endif
222
223#endif
diff --git a/include/linux/platform_data/dmtimer-omap.h b/include/linux/platform_data/dmtimer-omap.h
new file mode 100644
index 00000000000..a19b78d826e
--- /dev/null
+++ b/include/linux/platform_data/dmtimer-omap.h
@@ -0,0 +1,31 @@
1/*
2 * DMTIMER platform data for TI OMAP platforms
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Author: Jon Hunter <jon-hunter@ti.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 version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
21#define __PLATFORM_DATA_DMTIMER_OMAP_H__
22
23struct dmtimer_platform_data {
24 /* set_timer_src - Only used for OMAP1 devices */
25 int (*set_timer_src)(struct platform_device *pdev, int source);
26 u32 timer_capability;
27 u32 timer_errata;
28 int (*get_context_loss_count)(struct device *);
29};
30
31#endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
index e8741c2678d..5d50b25a73d 100644
--- a/include/linux/platform_data/gpio-omap.h
+++ b/include/linux/platform_data/gpio-omap.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <mach/irqs.h>
30 29
31#define OMAP1_MPUIO_BASE 0xfffb5000 30#define OMAP1_MPUIO_BASE 0xfffb5000
32 31
diff --git a/include/linux/platform_data/gpio-ts5500.h b/include/linux/platform_data/gpio-ts5500.h
new file mode 100644
index 00000000000..b10d11c9bb4
--- /dev/null
+++ b/include/linux/platform_data/gpio-ts5500.h
@@ -0,0 +1,27 @@
1/*
2 * GPIO (DIO) header for Technologic Systems TS-5500
3 *
4 * Copyright (c) 2012 Savoir-faire Linux Inc.
5 * Vivien Didelot <vivien.didelot@savoirfairelinux.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 version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _PDATA_GPIO_TS5500_H
13#define _PDATA_GPIO_TS5500_H
14
15/**
16 * struct ts5500_dio_platform_data - TS-5500 pin block configuration
17 * @base: The GPIO base number to use.
18 * @strap: The only pin connected to an interrupt in a block is input-only.
19 * If you need a bidirectional line which can trigger an IRQ, you
20 * may strap it with an in/out pin. This flag indicates this case.
21 */
22struct ts5500_dio_platform_data {
23 int base;
24 bool strap;
25};
26
27#endif /* _PDATA_GPIO_TS5500_H */
diff --git a/include/linux/platform_data/i2c-cbus-gpio.h b/include/linux/platform_data/i2c-cbus-gpio.h
new file mode 100644
index 00000000000..6faa992a950
--- /dev/null
+++ b/include/linux/platform_data/i2c-cbus-gpio.h
@@ -0,0 +1,27 @@
1/*
2 * i2c-cbus-gpio.h - CBUS I2C platform_data definition
3 *
4 * Copyright (C) 2004-2009 Nokia Corporation
5 *
6 * Written by Felipe Balbi and Aaro Koskinen.
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file "COPYING" in the main directory of this
10 * archive for more details.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __INCLUDE_LINUX_I2C_CBUS_GPIO_H
19#define __INCLUDE_LINUX_I2C_CBUS_GPIO_H
20
21struct i2c_cbus_platform_data {
22 int dat_gpio;
23 int clk_gpio;
24 int sel_gpio;
25};
26
27#endif /* __INCLUDE_LINUX_I2C_CBUS_GPIO_H */
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h
new file mode 100644
index 00000000000..5b429c43a29
--- /dev/null
+++ b/include/linux/platform_data/iommu-omap.h
@@ -0,0 +1,54 @@
1/*
2 * omap iommu: main structures
3 *
4 * Copyright (C) 2008-2009 Nokia Corporation
5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/platform_device.h>
14
15#define MMU_REG_SIZE 256
16
17/**
18 * struct iommu_arch_data - omap iommu private data
19 * @name: name of the iommu device
20 * @iommu_dev: handle of the iommu device
21 *
22 * This is an omap iommu private data object, which binds an iommu user
23 * to its iommu device. This object should be placed at the iommu user's
24 * dev_archdata so generic IOMMU API can be used without having to
25 * utilize omap-specific plumbing anymore.
26 */
27struct omap_iommu_arch_data {
28 const char *name;
29 struct omap_iommu *iommu_dev;
30};
31
32/**
33 * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
34 * @da_start: device address where the va space starts.
35 * @da_end: device address where the va space ends.
36 * @nr_tlb_entries: number of entries supported by the translation
37 * look-aside buffer (TLB).
38 */
39struct omap_mmu_dev_attr {
40 u32 da_start;
41 u32 da_end;
42 int nr_tlb_entries;
43};
44
45struct iommu_platform_data {
46 const char *name;
47 const char *reset_name;
48 int nr_tlb_entries;
49 u32 da_start;
50 u32 da_end;
51
52 int (*assert_reset)(struct platform_device *pdev, const char *name);
53 int (*deassert_reset)(struct platform_device *pdev, const char *name);
54};
diff --git a/include/linux/platform_data/leds-omap.h b/include/linux/platform_data/leds-omap.h
new file mode 100644
index 00000000000..56c9b2a0ada
--- /dev/null
+++ b/include/linux/platform_data/leds-omap.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2006 Samsung Electronics
3 * Kyungmin Park <kyungmin.park@samsung.com>
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 as
7 * published by the Free Software Foundation.
8 */
9#ifndef ASMARM_ARCH_LED_H
10#define ASMARM_ARCH_LED_H
11
12struct omap_led_config {
13 struct led_classdev cdev;
14 s16 gpio;
15};
16
17struct omap_led_platform_data {
18 s16 nr_leds;
19 struct omap_led_config *leds;
20};
21
22#endif
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index 761f3175236..e81f62d24ee 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -89,11 +89,6 @@ enum lp8556_brightness_source {
89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */ 89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
90}; 90};
91 91
92struct lp855x_pwm_data {
93 void (*pwm_set_intensity) (int brightness, int max_brightness);
94 int (*pwm_get_intensity) (int max_brightness);
95};
96
97struct lp855x_rom_data { 92struct lp855x_rom_data {
98 u8 addr; 93 u8 addr;
99 u8 val; 94 u8 val;
@@ -105,7 +100,7 @@ struct lp855x_rom_data {
105 * @mode : brightness control by pwm or lp855x register 100 * @mode : brightness control by pwm or lp855x register
106 * @device_control : value of DEVICE CONTROL register 101 * @device_control : value of DEVICE CONTROL register
107 * @initial_brightness : initial value of backlight brightness 102 * @initial_brightness : initial value of backlight brightness
108 * @pwm_data : platform specific pwm generation functions. 103 * @period_ns : platform specific pwm period value. unit is nano.
109 Only valid when mode is PWM_BASED. 104 Only valid when mode is PWM_BASED.
110 * @load_new_rom_data : 105 * @load_new_rom_data :
111 0 : use default configuration data 106 0 : use default configuration data
@@ -118,7 +113,7 @@ struct lp855x_platform_data {
118 enum lp855x_brightness_ctrl_mode mode; 113 enum lp855x_brightness_ctrl_mode mode;
119 u8 device_control; 114 u8 device_control;
120 int initial_brightness; 115 int initial_brightness;
121 struct lp855x_pwm_data pwm_data; 116 unsigned int period_ns;
122 u8 load_new_rom_data; 117 u8 load_new_rom_data;
123 int size_program; 118 int size_program;
124 struct lp855x_rom_data *rom_data; 119 struct lp855x_rom_data *rom_data;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
index b081c7245ec..044a124bfbb 100644
--- a/include/linux/platform_data/macb.h
+++ b/include/linux/platform_data/macb.h
@@ -12,6 +12,7 @@ struct macb_platform_data {
12 u32 phy_mask; 12 u32 phy_mask;
13 int phy_irq_pin; /* PHY IRQ */ 13 int phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */ 14 u8 is_rmii; /* using RMII interface? */
15 u8 rev_eth_addr; /* reverse Ethernet address byte order */
15}; 16};
16 17
17#endif /* __MACB_PDATA_H__ */ 18#endif /* __MACB_PDATA_H__ */
diff --git a/include/linux/platform_data/mmc-omap.h b/include/linux/platform_data/mmc-omap.h
new file mode 100644
index 00000000000..2bf1b30cb5d
--- /dev/null
+++ b/include/linux/platform_data/mmc-omap.h
@@ -0,0 +1,151 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#define OMAP_MMC_MAX_SLOTS 2
12
13/*
14 * struct omap_mmc_dev_attr.flags possibilities
15 *
16 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
17 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
18 * should be set if this is the case. See for example Section 22.5.3
19 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
20 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
21 *
22 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
23 * don't work correctly on some MMC controller instances on some
24 * OMAP3 SoCs; this flag should be set if this is the case. See
25 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
26 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
27 * Revision F (October 2010) (SPRZ278F).
28 */
29#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
30#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
31
32struct mmc_card;
33
34struct omap_mmc_dev_attr {
35 u8 flags;
36};
37
38struct omap_mmc_platform_data {
39 /* back-link to device */
40 struct device *dev;
41
42 /* number of slots per controller */
43 unsigned nr_slots:2;
44
45 /* set if your board has components or wiring that limits the
46 * maximum frequency on the MMC bus */
47 unsigned int max_freq;
48
49 /* switch the bus to a new slot */
50 int (*switch_slot)(struct device *dev, int slot);
51 /* initialize board-specific MMC functionality, can be NULL if
52 * not supported */
53 int (*init)(struct device *dev);
54 void (*cleanup)(struct device *dev);
55 void (*shutdown)(struct device *dev);
56
57 /* To handle board related suspend/resume functionality for MMC */
58 int (*suspend)(struct device *dev, int slot);
59 int (*resume)(struct device *dev, int slot);
60
61 /* Return context loss count due to PM states changing */
62 int (*get_context_loss_count)(struct device *dev);
63
64 /* Integrating attributes from the omap_hwmod layer */
65 u8 controller_flags;
66
67 /* Register offset deviation */
68 u16 reg_offset;
69
70 struct omap_mmc_slot_data {
71
72 /*
73 * 4/8 wires and any additional host capabilities
74 * need to OR'd all capabilities (ref. linux/mmc/host.h)
75 */
76 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
77 u32 caps; /* Used for the MMC driver on 2430 and later */
78 u32 pm_caps; /* PM capabilities of the mmc */
79
80 /*
81 * nomux means "standard" muxing is wrong on this board, and
82 * that board-specific code handled it before common init logic.
83 */
84 unsigned nomux:1;
85
86 /* switch pin can be for card detect (default) or card cover */
87 unsigned cover:1;
88
89 /* use the internal clock */
90 unsigned internal_clock:1;
91
92 /* nonremovable e.g. eMMC */
93 unsigned nonremovable:1;
94
95 /* Try to sleep or power off when possible */
96 unsigned power_saving:1;
97
98 /* If using power_saving and the MMC power is not to go off */
99 unsigned no_off:1;
100
101 /* eMMC does not handle power off when not in sleep state */
102 unsigned no_regulator_off_init:1;
103
104 /* Regulator off remapped to sleep */
105 unsigned vcc_aux_disable_is_sleep:1;
106
107 /* we can put the features above into this variable */
108#define HSMMC_HAS_PBIAS (1 << 0)
109#define HSMMC_HAS_UPDATED_RESET (1 << 1)
110#define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
111#define MMC_OMAP7XX (1 << 3)
112#define MMC_OMAP15XX (1 << 4)
113#define MMC_OMAP16XX (1 << 5)
114 unsigned features;
115
116 int switch_pin; /* gpio (card detect) */
117 int gpio_wp; /* gpio (write protect) */
118
119 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
120 int (*set_power)(struct device *dev, int slot,
121 int power_on, int vdd);
122 int (*get_ro)(struct device *dev, int slot);
123 void (*remux)(struct device *dev, int slot, int power_on);
124 /* Call back before enabling / disabling regulators */
125 void (*before_set_reg)(struct device *dev, int slot,
126 int power_on, int vdd);
127 /* Call back after enabling / disabling regulators */
128 void (*after_set_reg)(struct device *dev, int slot,
129 int power_on, int vdd);
130 /* if we have special card, init it using this callback */
131 void (*init_card)(struct mmc_card *card);
132
133 /* return MMC cover switch state, can be NULL if not supported.
134 *
135 * possible return values:
136 * 0 - closed
137 * 1 - open
138 */
139 int (*get_cover_state)(struct device *dev, int slot);
140
141 const char *name;
142 u32 ocr_mask;
143
144 /* Card detection IRQs */
145 int card_detect_irq;
146 int (*card_detect)(struct device *dev, int slot);
147
148 unsigned int ban_openended:1;
149
150 } slots[OMAP_MMC_MAX_SLOTS];
151};
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 1a68c1e5fe5..24d32ca34be 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -8,9 +8,13 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <plat/gpmc.h> 11#ifndef _MTD_NAND_OMAP2_H
12#define _MTD_NAND_OMAP2_H
13
12#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
13 15
16#define GPMC_BCH_NUM_REMAINDER 8
17
14enum nand_io { 18enum nand_io {
15 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ 19 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
16 NAND_OMAP_POLLED, /* polled mode, without prefetch */ 20 NAND_OMAP_POLLED, /* polled mode, without prefetch */
@@ -18,10 +22,38 @@ enum nand_io {
18 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ 22 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
19}; 23};
20 24
25enum omap_ecc {
26 /* 1-bit ecc: stored at end of spare area */
27 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
28 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
29 /* 1-bit ecc: stored at beginning of spare area as romcode */
30 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
31 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
32 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
33};
34
35struct gpmc_nand_regs {
36 void __iomem *gpmc_status;
37 void __iomem *gpmc_nand_command;
38 void __iomem *gpmc_nand_address;
39 void __iomem *gpmc_nand_data;
40 void __iomem *gpmc_prefetch_config1;
41 void __iomem *gpmc_prefetch_config2;
42 void __iomem *gpmc_prefetch_control;
43 void __iomem *gpmc_prefetch_status;
44 void __iomem *gpmc_ecc_config;
45 void __iomem *gpmc_ecc_control;
46 void __iomem *gpmc_ecc_size_config;
47 void __iomem *gpmc_ecc1_result;
48 void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
49 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
50 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
52};
53
21struct omap_nand_platform_data { 54struct omap_nand_platform_data {
22 int cs; 55 int cs;
23 struct mtd_partition *parts; 56 struct mtd_partition *parts;
24 struct gpmc_timings *gpmc_t;
25 int nr_parts; 57 int nr_parts;
26 bool dev_ready; 58 bool dev_ready;
27 enum nand_io xfer_type; 59 enum nand_io xfer_type;
@@ -30,14 +62,4 @@ struct omap_nand_platform_data {
30 struct gpmc_nand_regs reg; 62 struct gpmc_nand_regs reg;
31}; 63};
32 64
33/* minimum size for IO mapping */
34#define NAND_IO_SIZE 4
35
36#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
37extern int gpmc_nand_init(struct omap_nand_platform_data *d);
38#else
39static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
40{
41 return 0;
42}
43#endif 65#endif
diff --git a/include/linux/platform_data/mtd-nomadik-nand.h b/include/linux/platform_data/mtd-nomadik-nand.h
deleted file mode 100644
index c3c8254c22a..00000000000
--- a/include/linux/platform_data/mtd-nomadik-nand.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_ARCH_NAND_H
2#define __ASM_ARCH_NAND_H
3
4struct nomadik_nand_platform_data {
5 struct mtd_partition *parts;
6 int nparts;
7 int options;
8 int (*init) (void);
9 int (*exit) (void);
10};
11
12#define NAND_IO_DATA 0x40000000
13#define NAND_IO_CMD 0x40800000
14#define NAND_IO_ADDR 0x41000000
15
16#endif /* __ASM_ARCH_NAND_H */
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
index 2858667d2e4..685af7e8b12 100644
--- a/include/linux/platform_data/mtd-onenand-omap2.h
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -9,17 +9,15 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#ifndef __MTD_ONENAND_OMAP2_H
13#define __MTD_ONENAND_OMAP2_H
14
12#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h> 16#include <linux/mtd/partitions.h>
14 17
15#define ONENAND_SYNC_READ (1 << 0) 18#define ONENAND_SYNC_READ (1 << 0)
16#define ONENAND_SYNC_READWRITE (1 << 1) 19#define ONENAND_SYNC_READWRITE (1 << 1)
17 20#define ONENAND_IN_OMAP34XX (1 << 2)
18struct onenand_freq_info {
19 u16 maf_id;
20 u16 dev_id;
21 u16 ver_id;
22};
23 21
24struct omap_onenand_platform_data { 22struct omap_onenand_platform_data {
25 int cs; 23 int cs;
@@ -27,27 +25,9 @@ struct omap_onenand_platform_data {
27 struct mtd_partition *parts; 25 struct mtd_partition *parts;
28 int nr_parts; 26 int nr_parts;
29 int (*onenand_setup)(void __iomem *, int *freq_ptr); 27 int (*onenand_setup)(void __iomem *, int *freq_ptr);
30 int (*get_freq)(const struct onenand_freq_info *freq_info,
31 bool *clk_dep);
32 int dma_channel; 28 int dma_channel;
33 u8 flags; 29 u8 flags;
34 u8 regulator_can_sleep; 30 u8 regulator_can_sleep;
35 u8 skip_initial_unlocking; 31 u8 skip_initial_unlocking;
36}; 32};
37
38#define ONENAND_MAX_PARTITIONS 8
39
40#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
41 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
42
43extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
44
45#else
46
47#define board_onenand_data NULL
48
49static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
50{
51}
52
53#endif 33#endif
diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h
index c7bef788daa..ee60ef79d79 100644
--- a/include/linux/platform_data/omap-twl4030.h
+++ b/include/linux/platform_data/omap-twl4030.h
@@ -25,8 +25,34 @@
25#ifndef _OMAP_TWL4030_H_ 25#ifndef _OMAP_TWL4030_H_
26#define _OMAP_TWL4030_H_ 26#define _OMAP_TWL4030_H_
27 27
28/* To select if only one channel is connected in a stereo port */
29#define OMAP_TWL4030_LEFT (1 << 0)
30#define OMAP_TWL4030_RIGHT (1 << 1)
31
28struct omap_tw4030_pdata { 32struct omap_tw4030_pdata {
29 const char *card_name; 33 const char *card_name;
34 /* Voice port is connected to McBSP3 */
35 bool voice_connected;
36
37 /* The driver will parse the connection flags if this flag is set */
38 bool custom_routing;
39 /* Flags to indicate connected audio ports. */
40 u8 has_hs;
41 u8 has_hf;
42 u8 has_predriv;
43 u8 has_carkit;
44 bool has_ear;
45
46 bool has_mainmic;
47 bool has_submic;
48 bool has_hsmic;
49 bool has_carkitmic;
50 bool has_digimic0;
51 bool has_digimic1;
52 u8 has_linein;
53
54 /* Jack detect GPIO or <= 0 if it is not implemented */
55 int jack_detect;
30}; 56};
31 57
32#endif /* _OMAP_TWL4030_H_ */ 58#endif /* _OMAP_TWL4030_H_ */
diff --git a/include/linux/platform_data/omap-wd-timer.h b/include/linux/platform_data/omap-wd-timer.h
new file mode 100644
index 00000000000..d75f5f802d9
--- /dev/null
+++ b/include/linux/platform_data/omap-wd-timer.h
@@ -0,0 +1,38 @@
1/*
2 * OMAP2+ WDTIMER-specific function prototypes
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
14#define __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
15
16#include <linux/types.h>
17
18/*
19 * Standardized OMAP reset source bits
20 *
21 * This is a subset of the ones listed in arch/arm/mach-omap2/prm.h
22 * and are the only ones needed in the watchdog driver.
23 */
24#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
25
26/**
27 * struct omap_wd_timer_platform_data - WDTIMER integration to the host SoC
28 * @read_reset_sources - fn ptr for the SoC to indicate the last reset cause
29 *
30 * The function pointed to by @read_reset_sources must return its data
31 * in a standard format - search for RST_SRC_ID_SHIFT in
32 * arch/arm/mach-omap2
33 */
34struct omap_wd_timer_platform_data {
35 u32 (*read_reset_sources)(void);
36};
37
38#endif
diff --git a/include/linux/platform_data/omap_drm.h b/include/linux/platform_data/omap_drm.h
index 3da73bdc203..f4e4a237ebd 100644
--- a/include/linux/platform_data/omap_drm.h
+++ b/include/linux/platform_data/omap_drm.h
@@ -46,6 +46,7 @@ struct omap_kms_platform_data {
46}; 46};
47 47
48struct omap_drm_platform_data { 48struct omap_drm_platform_data {
49 uint32_t omaprev;
49 struct omap_kms_platform_data *kms_pdata; 50 struct omap_kms_platform_data *kms_pdata;
50}; 51};
51 52
diff --git a/include/linux/platform_data/pinctrl-coh901.h b/include/linux/platform_data/pinctrl-coh901.h
index 30dea251b83..dfbc65d1048 100644
--- a/include/linux/platform_data/pinctrl-coh901.h
+++ b/include/linux/platform_data/pinctrl-coh901.h
@@ -13,14 +13,10 @@
13 * struct u300_gpio_platform - U300 GPIO platform data 13 * struct u300_gpio_platform - U300 GPIO platform data
14 * @ports: number of GPIO block ports 14 * @ports: number of GPIO block ports
15 * @gpio_base: first GPIO number for this block (use a free range) 15 * @gpio_base: first GPIO number for this block (use a free range)
16 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
17 * @pinctrl_device: pin control device to spawn as child
18 */ 16 */
19struct u300_gpio_platform { 17struct u300_gpio_platform {
20 u8 ports; 18 u8 ports;
21 int gpio_base; 19 int gpio_base;
22 int gpio_irq_base;
23 struct platform_device *pinctrl_device;
24}; 20};
25 21
26#endif /* __MACH_U300_GPIO_U300_H */ 22#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/include/linux/platform_data/pinctrl-nomadik.h b/include/linux/platform_data/pinctrl-nomadik.h
new file mode 100644
index 00000000000..f73b2f0c55b
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-nomadik.h
@@ -0,0 +1,266 @@
1/*
2 * Structures and registers for GPIO access in the Nomadik SoC
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
6 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
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 __PLAT_NOMADIK_GPIO
14#define __PLAT_NOMADIK_GPIO
15
16/*
17 * pin configurations are represented by 32-bit integers:
18 *
19 * bit 0.. 8 - Pin Number (512 Pins Maximum)
20 * bit 9..10 - Alternate Function Selection
21 * bit 11..12 - Pull up/down state
22 * bit 13 - Sleep mode behaviour
23 * bit 14 - Direction
24 * bit 15 - Value (if output)
25 * bit 16..18 - SLPM pull up/down state
26 * bit 19..20 - SLPM direction
27 * bit 21..22 - SLPM Value (if output)
28 * bit 23..25 - PDIS value (if input)
29 * bit 26 - Gpio mode
30 * bit 27 - Sleep mode
31 *
32 * to facilitate the definition, the following macros are provided
33 *
34 * PIN_CFG_DEFAULT - default config (0):
35 * pull up/down = disabled
36 * sleep mode = input/wakeup
37 * direction = input
38 * value = low
39 * SLPM direction = same as normal
40 * SLPM pull = same as normal
41 * SLPM value = same as normal
42 *
43 * PIN_CFG - default config with alternate function
44 */
45
46typedef unsigned long pin_cfg_t;
47
48#define PIN_NUM_MASK 0x1ff
49#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
50
51#define PIN_ALT_SHIFT 9
52#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
53#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
54#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
55#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
56#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
57#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
58
59#define PIN_PULL_SHIFT 11
60#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
61#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
62#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
63#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
64#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
65
66#define PIN_SLPM_SHIFT 13
67#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
68#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
69#define PIN_SLPM_MAKE_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
70#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
71/* These two replace the above in DB8500v2+ */
72#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
73#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
74#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
75
76#define PIN_SLPM_GPIO PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
77#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
78
79#define PIN_DIR_SHIFT 14
80#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT)
81#define PIN_DIR(x) (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
82#define PIN_DIR_INPUT (0 << PIN_DIR_SHIFT)
83#define PIN_DIR_OUTPUT (1 << PIN_DIR_SHIFT)
84
85#define PIN_VAL_SHIFT 15
86#define PIN_VAL_MASK (0x1 << PIN_VAL_SHIFT)
87#define PIN_VAL(x) (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
88#define PIN_VAL_LOW (0 << PIN_VAL_SHIFT)
89#define PIN_VAL_HIGH (1 << PIN_VAL_SHIFT)
90
91#define PIN_SLPM_PULL_SHIFT 16
92#define PIN_SLPM_PULL_MASK (0x7 << PIN_SLPM_PULL_SHIFT)
93#define PIN_SLPM_PULL(x) \
94 (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
95#define PIN_SLPM_PULL_NONE \
96 ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
97#define PIN_SLPM_PULL_UP \
98 ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
99#define PIN_SLPM_PULL_DOWN \
100 ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
101
102#define PIN_SLPM_DIR_SHIFT 19
103#define PIN_SLPM_DIR_MASK (0x3 << PIN_SLPM_DIR_SHIFT)
104#define PIN_SLPM_DIR(x) \
105 (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
106#define PIN_SLPM_DIR_INPUT ((1 + 0) << PIN_SLPM_DIR_SHIFT)
107#define PIN_SLPM_DIR_OUTPUT ((1 + 1) << PIN_SLPM_DIR_SHIFT)
108
109#define PIN_SLPM_VAL_SHIFT 21
110#define PIN_SLPM_VAL_MASK (0x3 << PIN_SLPM_VAL_SHIFT)
111#define PIN_SLPM_VAL(x) \
112 (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
113#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT)
114#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT)
115
116#define PIN_SLPM_PDIS_SHIFT 23
117#define PIN_SLPM_PDIS_MASK (0x3 << PIN_SLPM_PDIS_SHIFT)
118#define PIN_SLPM_PDIS(x) \
119 (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
120#define PIN_SLPM_PDIS_NO_CHANGE (0 << PIN_SLPM_PDIS_SHIFT)
121#define PIN_SLPM_PDIS_DISABLED (1 << PIN_SLPM_PDIS_SHIFT)
122#define PIN_SLPM_PDIS_ENABLED (2 << PIN_SLPM_PDIS_SHIFT)
123
124#define PIN_LOWEMI_SHIFT 25
125#define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT)
126#define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
127#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
128#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
129
130#define PIN_GPIOMODE_SHIFT 26
131#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
132#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
133#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
134#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
135
136#define PIN_SLEEPMODE_SHIFT 27
137#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
138#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
139#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
140#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
141
142
143/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
144#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
145#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)
146#define PIN_INPUT_NOPULL (PIN_DIR_INPUT | PIN_PULL_NONE)
147#define PIN_OUTPUT_LOW (PIN_DIR_OUTPUT | PIN_VAL_LOW)
148#define PIN_OUTPUT_HIGH (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
149
150#define PIN_SLPM_INPUT_PULLDOWN (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
151#define PIN_SLPM_INPUT_PULLUP (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
152#define PIN_SLPM_INPUT_NOPULL (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
153#define PIN_SLPM_OUTPUT_LOW (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
154#define PIN_SLPM_OUTPUT_HIGH (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
155
156#define PIN_CFG_DEFAULT (0)
157
158#define PIN_CFG(num, alt) \
159 (PIN_CFG_DEFAULT |\
160 (PIN_NUM(num) | PIN_##alt))
161
162#define PIN_CFG_INPUT(num, alt, pull) \
163 (PIN_CFG_DEFAULT |\
164 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
165
166#define PIN_CFG_OUTPUT(num, alt, val) \
167 (PIN_CFG_DEFAULT |\
168 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
169
170/*
171 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
172 * the "gpio" namespace for generic and cross-machine functions
173 */
174
175#define GPIO_BLOCK_SHIFT 5
176#define NMK_GPIO_PER_CHIP (1 << GPIO_BLOCK_SHIFT)
177
178/* Register in the logic block */
179#define NMK_GPIO_DAT 0x00
180#define NMK_GPIO_DATS 0x04
181#define NMK_GPIO_DATC 0x08
182#define NMK_GPIO_PDIS 0x0c
183#define NMK_GPIO_DIR 0x10
184#define NMK_GPIO_DIRS 0x14
185#define NMK_GPIO_DIRC 0x18
186#define NMK_GPIO_SLPC 0x1c
187#define NMK_GPIO_AFSLA 0x20
188#define NMK_GPIO_AFSLB 0x24
189#define NMK_GPIO_LOWEMI 0x28
190
191#define NMK_GPIO_RIMSC 0x40
192#define NMK_GPIO_FIMSC 0x44
193#define NMK_GPIO_IS 0x48
194#define NMK_GPIO_IC 0x4c
195#define NMK_GPIO_RWIMSC 0x50
196#define NMK_GPIO_FWIMSC 0x54
197#define NMK_GPIO_WKS 0x58
198/* These appear in DB8540 and later ASICs */
199#define NMK_GPIO_EDGELEVEL 0x5C
200#define NMK_GPIO_LEVEL 0x60
201
202/* Alternate functions: function C is set in hw by setting both A and B */
203#define NMK_GPIO_ALT_GPIO 0
204#define NMK_GPIO_ALT_A 1
205#define NMK_GPIO_ALT_B 2
206#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
207
208#define NMK_GPIO_ALT_CX_SHIFT 2
209#define NMK_GPIO_ALT_C1 ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
210#define NMK_GPIO_ALT_C2 ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
211#define NMK_GPIO_ALT_C3 ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
212#define NMK_GPIO_ALT_C4 ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
213
214/* Pull up/down values */
215enum nmk_gpio_pull {
216 NMK_GPIO_PULL_NONE,
217 NMK_GPIO_PULL_UP,
218 NMK_GPIO_PULL_DOWN,
219};
220
221/* Sleep mode */
222enum nmk_gpio_slpm {
223 NMK_GPIO_SLPM_INPUT,
224 NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
225 NMK_GPIO_SLPM_NOCHANGE,
226 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
227};
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/*
254 * Platform data to register a block: only the initial gpio/irq number.
255 */
256struct nmk_gpio_platform_data {
257 char *name;
258 int first_gpio;
259 int first_irq;
260 int num_gpio;
261 u32 (*get_secondary_status)(unsigned int bank);
262 void (*set_ioforce)(bool enable);
263 bool supports_sleepmode;
264};
265
266#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/include/linux/platform_data/pn544.h b/include/linux/platform_data/pn544.h
new file mode 100644
index 00000000000..713bfd70334
--- /dev/null
+++ b/include/linux/platform_data/pn544.h
@@ -0,0 +1,44 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) Nokia Corporation
5 *
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com>
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.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,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _PN544_H_
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28enum {
29 NFC_GPIO_ENABLE,
30 NFC_GPIO_FW_RESET,
31 NFC_GPIO_IRQ
32};
33
34/* board config */
35struct pn544_nfc_platform_data {
36 int (*request_resources) (struct i2c_client *client);
37 void (*free_resources) (void);
38 void (*enable) (int fw);
39 int (*test) (void);
40 void (*disable) (void);
41 int (*get_gpio)(int type);
42};
43
44#endif /* _PN544_H_ */
diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h
new file mode 100644
index 00000000000..c6c5e98b5b8
--- /dev/null
+++ b/include/linux/platform_data/pxa2xx_udc.h
@@ -0,0 +1,27 @@
1/*
2 * This supports machine-specific differences in how the PXA2xx
3 * USB Device Controller (UDC) is wired.
4 *
5 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
6 * linux/arch/mach-ixp4xx/<machine>.c and used in
7 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
8 */
9#ifndef PXA2XX_UDC_H
10#define PXA2XX_UDC_H
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here. Note that sometimes the signals go through inverters...
22 */
23 bool gpio_pullup_inverted;
24 int gpio_pullup; /* high == pullup activated */
25};
26
27#endif
diff --git a/include/linux/platform_data/pxa_sdhci.h b/include/linux/platform_data/pxa_sdhci.h
index 59acd987ed3..27d3156d093 100644
--- a/include/linux/platform_data/pxa_sdhci.h
+++ b/include/linux/platform_data/pxa_sdhci.h
@@ -38,6 +38,7 @@
38 * @max_speed: the maximum speed supported 38 * @max_speed: the maximum speed supported
39 * @host_caps: Standard MMC host capabilities bit field. 39 * @host_caps: Standard MMC host capabilities bit field.
40 * @quirks: quirks of platfrom 40 * @quirks: quirks of platfrom
41 * @quirks2: quirks2 of platfrom
41 * @pm_caps: pm_caps of platfrom 42 * @pm_caps: pm_caps of platfrom
42 */ 43 */
43struct sdhci_pxa_platdata { 44struct sdhci_pxa_platdata {
@@ -48,9 +49,10 @@ struct sdhci_pxa_platdata {
48 unsigned int ext_cd_gpio; 49 unsigned int ext_cd_gpio;
49 bool ext_cd_gpio_invert; 50 bool ext_cd_gpio_invert;
50 unsigned int max_speed; 51 unsigned int max_speed;
51 unsigned int host_caps; 52 u32 host_caps;
52 unsigned int host_caps2; 53 u32 host_caps2;
53 unsigned int quirks; 54 unsigned int quirks;
55 unsigned int quirks2;
54 unsigned int pm_caps; 56 unsigned int pm_caps;
55}; 57};
56 58
diff --git a/include/linux/platform_data/sa11x0-serial.h b/include/linux/platform_data/sa11x0-serial.h
new file mode 100644
index 00000000000..4504d5d592f
--- /dev/null
+++ b/include/linux/platform_data/sa11x0-serial.h
@@ -0,0 +1,33 @@
1/*
2 * Author: Nicolas Pitre
3 *
4 * Moved and changed lots, Russell King
5 *
6 * Low level machine dependent UART functions.
7 */
8#ifndef SA11X0_SERIAL_H
9#define SA11X0_SERIAL_H
10
11struct uart_port;
12struct uart_info;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct sa1100_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23};
24
25#ifdef CONFIG_SERIAL_SA1100
26void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
27void sa1100_register_uart(int idx, int port);
28#else
29#define sa1100_register_uart_fns(fns) do { } while (0)
30#define sa1100_register_uart(idx,port) do { } while (0)
31#endif
32
33#endif
diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h
new file mode 100644
index 00000000000..ff9b0aab528
--- /dev/null
+++ b/include/linux/platform_data/serial-omap.h
@@ -0,0 +1,51 @@
1/*
2 * Driver for OMAP-UART controller.
3 * Based on drivers/serial/8250.c
4 *
5 * Copyright (C) 2010 Texas Instruments.
6 *
7 * Authors:
8 * Govindraj R <govindraj.raja@ti.com>
9 * Thara Gopinath <thara@ti.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#ifndef __OMAP_SERIAL_H__
18#define __OMAP_SERIAL_H__
19
20#include <linux/serial_core.h>
21#include <linux/device.h>
22#include <linux/pm_qos.h>
23
24#define DRIVER_NAME "omap_uart"
25
26/*
27 * Use tty device name as ttyO, [O -> OMAP]
28 * in bootargs we specify as console=ttyO0 if uart1
29 * is used as console uart.
30 */
31#define OMAP_SERIAL_NAME "ttyO"
32
33struct omap_uart_port_info {
34 bool dma_enabled; /* To specify DMA Mode */
35 unsigned int uartclk; /* UART clock rate */
36 upf_t flags; /* UPF_* flags */
37 unsigned int dma_rx_buf_size;
38 unsigned int dma_rx_timeout;
39 unsigned int autosuspend_timeout;
40 unsigned int dma_rx_poll_rate;
41 int DTR_gpio;
42 int DTR_inverted;
43 int DTR_present;
44
45 int (*get_context_loss_count)(struct device *);
46 void (*set_forceidle)(struct device *);
47 void (*set_noidle)(struct device *);
48 void (*enable_wakeup)(struct device *, bool);
49};
50
51#endif /* __OMAP_SERIAL_H__ */
diff --git a/include/linux/platform_data/spi-clps711x.h b/include/linux/platform_data/spi-clps711x.h
new file mode 100644
index 00000000000..301956e6314
--- /dev/null
+++ b/include/linux/platform_data/spi-clps711x.h
@@ -0,0 +1,21 @@
1/*
2 * CLPS711X SPI bus driver definitions
3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
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_PLATFORM_DATA_SPI_CLPS711X_H
13#define ____LINUX_PLATFORM_DATA_SPI_CLPS711X_H
14
15/* Board specific platform_data */
16struct spi_clps711x_pdata {
17 int *chipselect; /* Array of GPIO-numbers */
18 int num_chipselect; /* Total count of GPIOs */
19};
20
21#endif
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a357eb26bd2..a65572d5321 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -7,9 +7,13 @@
7 7
8#define OMAP4_MCSPI_REG_OFFSET 0x100 8#define OMAP4_MCSPI_REG_OFFSET 0x100
9 9
10#define MCSPI_PINDIR_D0_IN_D1_OUT 0
11#define MCSPI_PINDIR_D0_OUT_D1_IN 1
12
10struct omap2_mcspi_platform_config { 13struct omap2_mcspi_platform_config {
11 unsigned short num_cs; 14 unsigned short num_cs;
12 unsigned int regs_offset; 15 unsigned int regs_offset;
16 unsigned int pin_dir:1;
13}; 17};
14 18
15struct omap2_mcspi_dev_attr { 19struct omap2_mcspi_dev_attr {
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
new file mode 100644
index 00000000000..e41d5834cb8
--- /dev/null
+++ b/include/linux/platform_data/ti_am335x_adc.h
@@ -0,0 +1,14 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/platform_data/uio_dmem_genirq.h b/include/linux/platform_data/uio_dmem_genirq.h
new file mode 100644
index 00000000000..973c1bb3216
--- /dev/null
+++ b/include/linux/platform_data/uio_dmem_genirq.h
@@ -0,0 +1,26 @@
1/*
2 * include/linux/platform_data/uio_dmem_genirq.h
3 *
4 * Copyright (C) 2012 Damian Hobson-Garcia
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
16#ifndef _UIO_DMEM_GENIRQ_H
17#define _UIO_DMEM_GENIRQ_H
18
19#include <linux/uio_driver.h>
20
21struct uio_dmem_genirq_pdata {
22 struct uio_info uioinfo;
23 unsigned int *dynamic_region_sizes;
24 unsigned int num_dynamic_regions;
25};
26#endif /* _UIO_DMEM_GENIRQ_H */
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
index f39140aabc6..3d47d219827 100644
--- a/include/linux/platform_data/uio_pruss.h
+++ b/include/linux/platform_data/uio_pruss.h
@@ -20,6 +20,7 @@
20 20
21/* To configure the PRUSS INTC base offset for UIO driver */ 21/* To configure the PRUSS INTC base offset for UIO driver */
22struct uio_pruss_pdata { 22struct uio_pruss_pdata {
23 u32 pintc_base; 23 u32 pintc_base;
24 struct gen_pool *sram_pool;
24}; 25};
25#endif /* _UIO_PRUSS_H_ */ 26#endif /* _UIO_PRUSS_H_ */
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
new file mode 100644
index 00000000000..ef65b67c56c
--- /dev/null
+++ b/include/linux/platform_data/usb-omap.h
@@ -0,0 +1,83 @@
1/*
2 * usb-omap.h - Platform data for the various OMAP USB IPs
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * This software is distributed under the terms of the GNU General Public
7 * License ("GPL") version 2, as published by the Free Software Foundation.
8 *
9 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
10 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
12 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
13 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
14 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
15 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
16 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
17 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
18 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
19 * POSSIBILITY OF SUCH DAMAGE.
20 */
21
22#define OMAP3_HS_USB_PORTS 3
23
24enum usbhs_omap_port_mode {
25 OMAP_USBHS_PORT_MODE_UNUSED,
26 OMAP_EHCI_PORT_MODE_PHY,
27 OMAP_EHCI_PORT_MODE_TLL,
28 OMAP_EHCI_PORT_MODE_HSIC,
29 OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
30 OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
31 OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
32 OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
33 OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
34 OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
35 OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
36 OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
37 OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
38 OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
39};
40
41struct usbtll_omap_platform_data {
42 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
43};
44
45struct ehci_hcd_omap_platform_data {
46 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
47 int reset_gpio_port[OMAP3_HS_USB_PORTS];
48 struct regulator *regulator[OMAP3_HS_USB_PORTS];
49 unsigned phy_reset:1;
50};
51
52struct ohci_hcd_omap_platform_data {
53 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
54 unsigned es2_compatibility:1;
55};
56
57struct usbhs_omap_platform_data {
58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
59
60 struct ehci_hcd_omap_platform_data *ehci_data;
61 struct ohci_hcd_omap_platform_data *ohci_data;
62
63 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
64 unsigned single_ulpi_bypass:1;
65};
66
67/*-------------------------------------------------------------------------*/
68
69struct omap_musb_board_data {
70 u8 interface_type;
71 u8 mode;
72 u16 power;
73 unsigned extvbus:1;
74 void (*set_phy_power)(u8 on);
75 void (*clear_irq)(void);
76 void (*set_mode)(u8 mode);
77 void (*reset)(void);
78};
79
80enum musb_interface {
81 MUSB_INTERFACE_ULPI,
82 MUSB_INTERFACE_UTMI
83};
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 5711e9525a2..a9ded9a3c17 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,6 +55,7 @@ extern int platform_add_devices(struct platform_device **, int);
55 55
56struct platform_device_info { 56struct platform_device_info {
57 struct device *parent; 57 struct device *parent;
58 struct acpi_dev_node acpi_node;
58 59
59 const char *name; 60 const char *name;
60 int id; 61 int id;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 007e687c4f6..03d7bb14531 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -546,10 +546,9 @@ struct dev_pm_info {
546 unsigned long active_jiffies; 546 unsigned long active_jiffies;
547 unsigned long suspended_jiffies; 547 unsigned long suspended_jiffies;
548 unsigned long accounting_timestamp; 548 unsigned long accounting_timestamp;
549 struct dev_pm_qos_request *pq_req;
550#endif 549#endif
551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 550 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
552 struct pm_qos_constraints *constraints; 551 struct dev_pm_qos *qos;
553}; 552};
554 553
555extern void update_pm_runtime_accounting(struct device *dev); 554extern void update_pm_runtime_accounting(struct device *dev);
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 9924ea1f22e..5a95013905c 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -20,6 +20,13 @@ enum {
20 PM_QOS_NUM_CLASSES, 20 PM_QOS_NUM_CLASSES,
21}; 21};
22 22
23enum pm_qos_flags_status {
24 PM_QOS_FLAGS_UNDEFINED = -1,
25 PM_QOS_FLAGS_NONE,
26 PM_QOS_FLAGS_SOME,
27 PM_QOS_FLAGS_ALL,
28};
29
23#define PM_QOS_DEFAULT_VALUE -1 30#define PM_QOS_DEFAULT_VALUE -1
24 31
25#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
@@ -27,14 +34,31 @@ enum {
27#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
28#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 35#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0
29 36
37#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
38#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
39
30struct pm_qos_request { 40struct pm_qos_request {
31 struct plist_node node; 41 struct plist_node node;
32 int pm_qos_class; 42 int pm_qos_class;
33 struct delayed_work work; /* for pm_qos_update_request_timeout */ 43 struct delayed_work work; /* for pm_qos_update_request_timeout */
34}; 44};
35 45
46struct pm_qos_flags_request {
47 struct list_head node;
48 s32 flags; /* Do not change to 64 bit */
49};
50
51enum dev_pm_qos_req_type {
52 DEV_PM_QOS_LATENCY = 1,
53 DEV_PM_QOS_FLAGS,
54};
55
36struct dev_pm_qos_request { 56struct dev_pm_qos_request {
37 struct plist_node node; 57 enum dev_pm_qos_req_type type;
58 union {
59 struct plist_node pnode;
60 struct pm_qos_flags_request flr;
61 } data;
38 struct device *dev; 62 struct device *dev;
39}; 63};
40 64
@@ -45,8 +69,8 @@ enum pm_qos_type {
45}; 69};
46 70
47/* 71/*
48 * Note: The lockless read path depends on the CPU accessing 72 * Note: The lockless read path depends on the CPU accessing target_value
49 * target_value atomically. Atomic access is only guaranteed on all CPU 73 * or effective_flags atomically. Atomic access is only guaranteed on all CPU
50 * types linux supports for 32 bit quantites 74 * types linux supports for 32 bit quantites
51 */ 75 */
52struct pm_qos_constraints { 76struct pm_qos_constraints {
@@ -57,6 +81,18 @@ struct pm_qos_constraints {
57 struct blocking_notifier_head *notifiers; 81 struct blocking_notifier_head *notifiers;
58}; 82};
59 83
84struct pm_qos_flags {
85 struct list_head list;
86 s32 effective_flags; /* Do not change to 64 bit */
87};
88
89struct dev_pm_qos {
90 struct pm_qos_constraints latency;
91 struct pm_qos_flags flags;
92 struct dev_pm_qos_request *latency_req;
93 struct dev_pm_qos_request *flags_req;
94};
95
60/* Action requested to pm_qos_update_target */ 96/* Action requested to pm_qos_update_target */
61enum pm_qos_req_action { 97enum pm_qos_req_action {
62 PM_QOS_ADD_REQ, /* Add a new request */ 98 PM_QOS_ADD_REQ, /* Add a new request */
@@ -71,6 +107,9 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
71 107
72int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, 108int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
73 enum pm_qos_req_action action, int value); 109 enum pm_qos_req_action action, int value);
110bool pm_qos_update_flags(struct pm_qos_flags *pqf,
111 struct pm_qos_flags_request *req,
112 enum pm_qos_req_action action, s32 val);
74void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, 113void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
75 s32 value); 114 s32 value);
76void pm_qos_update_request(struct pm_qos_request *req, 115void pm_qos_update_request(struct pm_qos_request *req,
@@ -86,10 +125,12 @@ int pm_qos_request_active(struct pm_qos_request *req);
86s32 pm_qos_read_value(struct pm_qos_constraints *c); 125s32 pm_qos_read_value(struct pm_qos_constraints *c);
87 126
88#ifdef CONFIG_PM 127#ifdef CONFIG_PM
128enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);
129enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev, s32 mask);
89s32 __dev_pm_qos_read_value(struct device *dev); 130s32 __dev_pm_qos_read_value(struct device *dev);
90s32 dev_pm_qos_read_value(struct device *dev); 131s32 dev_pm_qos_read_value(struct device *dev);
91int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 132int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
92 s32 value); 133 enum dev_pm_qos_req_type type, s32 value);
93int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value); 134int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value);
94int dev_pm_qos_remove_request(struct dev_pm_qos_request *req); 135int dev_pm_qos_remove_request(struct dev_pm_qos_request *req);
95int dev_pm_qos_add_notifier(struct device *dev, 136int dev_pm_qos_add_notifier(struct device *dev,
@@ -103,12 +144,19 @@ void dev_pm_qos_constraints_destroy(struct device *dev);
103int dev_pm_qos_add_ancestor_request(struct device *dev, 144int dev_pm_qos_add_ancestor_request(struct device *dev,
104 struct dev_pm_qos_request *req, s32 value); 145 struct dev_pm_qos_request *req, s32 value);
105#else 146#else
147static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
148 s32 mask)
149 { return PM_QOS_FLAGS_UNDEFINED; }
150static inline enum pm_qos_flags_status dev_pm_qos_flags(struct device *dev,
151 s32 mask)
152 { return PM_QOS_FLAGS_UNDEFINED; }
106static inline s32 __dev_pm_qos_read_value(struct device *dev) 153static inline s32 __dev_pm_qos_read_value(struct device *dev)
107 { return 0; } 154 { return 0; }
108static inline s32 dev_pm_qos_read_value(struct device *dev) 155static inline s32 dev_pm_qos_read_value(struct device *dev)
109 { return 0; } 156 { return 0; }
110static inline int dev_pm_qos_add_request(struct device *dev, 157static inline int dev_pm_qos_add_request(struct device *dev,
111 struct dev_pm_qos_request *req, 158 struct dev_pm_qos_request *req,
159 enum dev_pm_qos_req_type type,
112 s32 value) 160 s32 value)
113 { return 0; } 161 { return 0; }
114static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req, 162static inline int dev_pm_qos_update_request(struct dev_pm_qos_request *req,
@@ -144,10 +192,31 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
144#ifdef CONFIG_PM_RUNTIME 192#ifdef CONFIG_PM_RUNTIME
145int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); 193int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
146void dev_pm_qos_hide_latency_limit(struct device *dev); 194void dev_pm_qos_hide_latency_limit(struct device *dev);
195int dev_pm_qos_expose_flags(struct device *dev, s32 value);
196void dev_pm_qos_hide_flags(struct device *dev);
197int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
198
199static inline s32 dev_pm_qos_requested_latency(struct device *dev)
200{
201 return dev->power.qos->latency_req->data.pnode.prio;
202}
203
204static inline s32 dev_pm_qos_requested_flags(struct device *dev)
205{
206 return dev->power.qos->flags_req->data.flr.flags;
207}
147#else 208#else
148static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) 209static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
149 { return 0; } 210 { return 0; }
150static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} 211static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
212static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value)
213 { return 0; }
214static inline void dev_pm_qos_hide_flags(struct device *dev) {}
215static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
216 { return 0; }
217
218static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; }
219static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }
151#endif 220#endif
152 221
153#endif 222#endif
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h
new file mode 100644
index 00000000000..97a1665eaea
--- /dev/null
+++ b/include/linux/power/bq2415x_charger.h
@@ -0,0 +1,95 @@
1/*
2 * bq2415x charger driver
3 *
4 * Copyright (C) 2011-2012 Pali Rohár <pali.rohar@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 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef BQ2415X_CHARGER_H
22#define BQ2415X_CHARGER_H
23
24/*
25 * This is platform data for bq2415x chip. It contains default board
26 * voltages and currents which can be also later configured via sysfs. If
27 * value is -1 then default chip value (specified in datasheet) will be
28 * used.
29 *
30 * Value resistor_sense is needed for for configuring charge and
31 * termination current. It it is less or equal to zero, configuring charge
32 * and termination current will not be possible.
33 *
34 * Function set_mode_hook is needed for automode (setting correct current
35 * limit when charger is connected/disconnected or setting boost mode).
36 * When is NULL, automode function is disabled. When is not NULL, it must
37 * have this prototype:
38 *
39 * int (*set_mode_hook)(
40 * void (*hook)(enum bq2415x_mode mode, void *data),
41 * void *data)
42 *
43 * hook is hook function (see below) and data is pointer to driver private
44 * data
45 *
46 * bq2415x driver will call it as:
47 *
48 * platform_data->set_mode_hook(bq2415x_hook_function, bq2415x_device);
49 *
50 * Board/platform function set_mode_hook return non zero value when hook
51 * function was successful registered. Platform code should call that hook
52 * function (which get from pointer, with data) every time when charger
53 * was connected/disconnected or require to enable boost mode. bq2415x
54 * driver then will set correct current limit, enable/disable charger or
55 * boost mode.
56 *
57 * Hook function has this prototype:
58 *
59 * void hook(enum bq2415x_mode mode, void *data);
60 *
61 * mode is bq2415x mode (charger or boost)
62 * data is pointer to driver private data (which get from
63 * set_charger_type_hook)
64 *
65 * When bq driver is being unloaded, it call function:
66 *
67 * platform_data->set_mode_hook(NULL, NULL);
68 *
69 * (hook function and driver private data are NULL)
70 *
71 * After that board/platform code must not call driver hook function! It
72 * is possible that pointer to hook function will not be valid and calling
73 * will cause undefined result.
74 */
75
76/* Supported modes with maximal current limit */
77enum bq2415x_mode {
78 BQ2415X_MODE_NONE, /* unknown or no charger (100mA) */
79 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */
80 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */
81 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */
82};
83
84struct bq2415x_platform_data {
85 int current_limit; /* mA */
86 int weak_battery_voltage; /* mV */
87 int battery_regulation_voltage; /* mV */
88 int charge_current; /* mA */
89 int termination_current; /* mA */
90 int resistor_sense; /* m ohm */
91 int (*set_mode_hook)(void (*hook)(enum bq2415x_mode mode, void *data),
92 void *data);
93};
94
95#endif
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index 4a496ebc7d7..c0f44c2b006 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -260,8 +260,13 @@ struct omap_sr_nvalue_table {
260 * 260 *
261 * @name: instance name 261 * @name: instance name
262 * @ip_type: Smartreflex IP type. 262 * @ip_type: Smartreflex IP type.
263 * @senp_mod: SENPENABLE value for the sr 263 * @senp_mod: SENPENABLE value of the sr CONFIG register
264 * @senn_mod: SENNENABLE value for sr 264 * @senn_mod: SENNENABLE value for sr CONFIG register
265 * @err_weight ERRWEIGHT value of the sr ERRCONFIG register
266 * @err_maxlimit ERRMAXLIMIT value of the sr ERRCONFIG register
267 * @accum_data ACCUMDATA value of the sr CONFIG register
268 * @senn_avgweight SENNAVGWEIGHT value of the sr AVGWEIGHT register
269 * @senp_avgweight SENPAVGWEIGHT value of the sr AVGWEIGHT register
265 * @nvalue_count: Number of distinct nvalues in the nvalue table 270 * @nvalue_count: Number of distinct nvalues in the nvalue table
266 * @enable_on_init: whether this sr module needs to enabled at 271 * @enable_on_init: whether this sr module needs to enabled at
267 * boot up or not. 272 * boot up or not.
@@ -274,6 +279,11 @@ struct omap_sr_data {
274 int ip_type; 279 int ip_type;
275 u32 senp_mod; 280 u32 senp_mod;
276 u32 senn_mod; 281 u32 senn_mod;
282 u32 err_weight;
283 u32 err_maxlimit;
284 u32 accum_data;
285 u32 senn_avgweight;
286 u32 senp_avgweight;
277 int nvalue_count; 287 int nvalue_count;
278 bool enable_on_init; 288 bool enable_on_init;
279 struct omap_sr_nvalue_table *nvalue_table; 289 struct omap_sr_nvalue_table *nvalue_table;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index e5ef45834c3..1f0ab90aff0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -114,6 +114,8 @@ enum power_supply_property {
114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, 114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX, 116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
117 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT,
118 POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
117 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 119 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
118 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 120 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
119 POWER_SUPPLY_PROP_ENERGY_FULL, 121 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -186,6 +188,7 @@ struct power_supply {
186 struct work_struct changed_work; 188 struct work_struct changed_work;
187#ifdef CONFIG_THERMAL 189#ifdef CONFIG_THERMAL
188 struct thermal_zone_device *tzd; 190 struct thermal_zone_device *tzd;
191 struct thermal_cooling_device *tcd;
189#endif 192#endif
190 193
191#ifdef CONFIG_LEDS_TRIGGERS 194#ifdef CONFIG_LEDS_TRIGGERS
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 3fd2e871ff1..32676b35d2f 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -28,7 +28,11 @@ struct mm_struct;
28 */ 28 */
29 29
30enum { 30enum {
31 PROC_ROOT_INO = 1, 31 PROC_ROOT_INO = 1,
32 PROC_IPC_INIT_INO = 0xEFFFFFFFU,
33 PROC_UTS_INIT_INO = 0xEFFFFFFEU,
34 PROC_USER_INIT_INO = 0xEFFFFFFDU,
35 PROC_PID_INIT_INO = 0xEFFFFFFCU,
32}; 36};
33 37
34/* 38/*
@@ -174,7 +178,10 @@ extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
174 struct proc_dir_entry *parent); 178 struct proc_dir_entry *parent);
175 179
176extern struct file *proc_ns_fget(int fd); 180extern struct file *proc_ns_fget(int fd);
181extern bool proc_ns_inode(struct inode *inode);
177 182
183extern int proc_alloc_inum(unsigned int *pino);
184extern void proc_free_inum(unsigned int inum);
178#else 185#else
179 186
180#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 187#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
@@ -229,6 +236,19 @@ static inline struct file *proc_ns_fget(int fd)
229 return ERR_PTR(-EINVAL); 236 return ERR_PTR(-EINVAL);
230} 237}
231 238
239static inline bool proc_ns_inode(struct inode *inode)
240{
241 return false;
242}
243
244static inline int proc_alloc_inum(unsigned int *inum)
245{
246 *inum = 1;
247 return 0;
248}
249static inline void proc_free_inum(unsigned int inum)
250{
251}
232#endif /* CONFIG_PROC_FS */ 252#endif /* CONFIG_PROC_FS */
233 253
234#if !defined(CONFIG_PROC_KCORE) 254#if !defined(CONFIG_PROC_KCORE)
@@ -247,10 +267,14 @@ struct proc_ns_operations {
247 void *(*get)(struct task_struct *task); 267 void *(*get)(struct task_struct *task);
248 void (*put)(void *ns); 268 void (*put)(void *ns);
249 int (*install)(struct nsproxy *nsproxy, void *ns); 269 int (*install)(struct nsproxy *nsproxy, void *ns);
270 unsigned int (*inum)(void *ns);
250}; 271};
251extern const struct proc_ns_operations netns_operations; 272extern const struct proc_ns_operations netns_operations;
252extern const struct proc_ns_operations utsns_operations; 273extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 274extern const struct proc_ns_operations ipcns_operations;
275extern const struct proc_ns_operations pidns_operations;
276extern const struct proc_ns_operations userns_operations;
277extern const struct proc_ns_operations mntns_operations;
254 278
255union proc_op { 279union proc_op {
256 int (*proc_get_link)(struct dentry *, struct path *); 280 int (*proc_get_link)(struct dentry *, struct path *);
@@ -290,4 +314,7 @@ static inline struct net *PDE_NET(struct proc_dir_entry *pde)
290 return pde->parent->data; 314 return pde->parent->data;
291} 315}
292 316
317#include <linux/signal.h>
318
319void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);
293#endif /* _LINUX_PROC_FS_H */ 320#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index ee3034a4088..1788909d9a9 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -50,16 +50,18 @@ struct pstore_info {
50 int (*open)(struct pstore_info *psi); 50 int (*open)(struct pstore_info *psi);
51 int (*close)(struct pstore_info *psi); 51 int (*close)(struct pstore_info *psi);
52 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 52 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
53 struct timespec *time, char **buf, 53 int *count, struct timespec *time, char **buf,
54 struct pstore_info *psi); 54 struct pstore_info *psi);
55 int (*write)(enum pstore_type_id type, 55 int (*write)(enum pstore_type_id type,
56 enum kmsg_dump_reason reason, u64 *id, 56 enum kmsg_dump_reason reason, u64 *id,
57 unsigned int part, size_t size, struct pstore_info *psi); 57 unsigned int part, int count, size_t size,
58 struct pstore_info *psi);
58 int (*write_buf)(enum pstore_type_id type, 59 int (*write_buf)(enum pstore_type_id type,
59 enum kmsg_dump_reason reason, u64 *id, 60 enum kmsg_dump_reason reason, u64 *id,
60 unsigned int part, const char *buf, size_t size, 61 unsigned int part, const char *buf, size_t size,
61 struct pstore_info *psi); 62 struct pstore_info *psi);
62 int (*erase)(enum pstore_type_id type, u64 id, 63 int (*erase)(enum pstore_type_id type, u64 id,
64 int count, struct timespec time,
63 struct pstore_info *psi); 65 struct pstore_info *psi);
64 void *data; 66 void *data;
65}; 67};
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index e0ff4689d35..1693775ecfe 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -32,6 +32,8 @@
32#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 32#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
33#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP) 33#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
34 34
35#define PT_EXITKILL (PTRACE_O_EXITKILL << PT_OPT_FLAG_SHIFT)
36
35/* single stepping state bits (used on ARM and PA-RISC) */ 37/* single stepping state bits (used on ARM and PA-RISC) */
36#define PT_SINGLESTEP_BIT 31 38#define PT_SINGLESTEP_BIT 31
37#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) 39#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
@@ -329,6 +331,23 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
329#define current_pt_regs() task_pt_regs(current) 331#define current_pt_regs() task_pt_regs(current)
330#endif 332#endif
331 333
334#ifndef ptrace_signal_deliver
335#define ptrace_signal_deliver() ((void)0)
336#endif
337
338/*
339 * unlike current_pt_regs(), this one is equal to task_pt_regs(current)
340 * on *all* architectures; the only reason to have a per-arch definition
341 * is optimisation.
342 */
343#ifndef signal_pt_regs
344#define signal_pt_regs() task_pt_regs(current)
345#endif
346
347#ifndef current_user_stack_pointer
348#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
349#endif
350
332extern int task_current_syscall(struct task_struct *target, long *callno, 351extern int task_current_syscall(struct task_struct *target, long *callno,
333 unsigned long args[6], unsigned int maxargs, 352 unsigned long args[6], unsigned int maxargs,
334 unsigned long *sp, unsigned long *pc); 353 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h
new file mode 100644
index 00000000000..0ca75825b60
--- /dev/null
+++ b/include/linux/pvclock_gtod.h
@@ -0,0 +1,9 @@
1#ifndef _PVCLOCK_GTOD_H
2#define _PVCLOCK_GTOD_H
3
4#include <linux/notifier.h>
5
6extern int pvclock_gtod_register_notifier(struct notifier_block *nb);
7extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb);
8
9#endif /* _PVCLOCK_GTOD_H */
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 112b3143684..6d661f32e0e 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -171,6 +171,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
171 unsigned int index, 171 unsigned int index,
172 const char *label); 172 const char *label);
173 173
174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
175 const struct of_phandle_args *args);
176
174struct pwm_device *pwm_get(struct device *dev, const char *consumer); 177struct pwm_device *pwm_get(struct device *dev, const char *consumer);
175void pwm_put(struct pwm_device *pwm); 178void pwm_put(struct pwm_device *pwm);
176 179
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 640c69ceec9..8dfaa2ce2e9 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -98,6 +98,9 @@ extern const struct raid6_calls raid6_altivec1;
98extern const struct raid6_calls raid6_altivec2; 98extern const struct raid6_calls raid6_altivec2;
99extern const struct raid6_calls raid6_altivec4; 99extern const struct raid6_calls raid6_altivec4;
100extern const struct raid6_calls raid6_altivec8; 100extern const struct raid6_calls raid6_altivec8;
101extern const struct raid6_calls raid6_avx2x1;
102extern const struct raid6_calls raid6_avx2x2;
103extern const struct raid6_calls raid6_avx2x4;
101 104
102struct raid6_recov_calls { 105struct raid6_recov_calls {
103 void (*data2)(int, size_t, int, int, void **); 106 void (*data2)(int, size_t, int, int, void **);
@@ -109,6 +112,7 @@ struct raid6_recov_calls {
109 112
110extern const struct raid6_recov_calls raid6_recov_intx1; 113extern const struct raid6_recov_calls raid6_recov_intx1;
111extern const struct raid6_recov_calls raid6_recov_ssse3; 114extern const struct raid6_recov_calls raid6_recov_ssse3;
115extern const struct raid6_recov_calls raid6_recov_avx2;
112 116
113/* Algorithm list */ 117/* Algorithm list */
114extern const struct raid6_calls * const raid6_algos[]; 118extern const struct raid6_calls * const raid6_algos[];
diff --git a/include/linux/random.h b/include/linux/random.h
index 6330ed47b38..d9846088c2c 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -25,10 +25,19 @@ extern const struct file_operations random_fops, urandom_fops;
25unsigned int get_random_int(void); 25unsigned int get_random_int(void);
26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); 26unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
27 27
28u32 random32(void); 28u32 prandom_u32(void);
29void srandom32(u32 seed); 29void prandom_bytes(void *buf, int nbytes);
30void prandom_seed(u32 seed);
30 31
31u32 prandom32(struct rnd_state *); 32/*
33 * These macros are preserved for backward compatibility and should be
34 * removed as soon as a transition is finished.
35 */
36#define random32() prandom_u32()
37#define srandom32(seed) prandom_seed(seed)
38
39u32 prandom_u32_state(struct rnd_state *);
40void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
32 41
33/* 42/*
34 * Handle minimum values for seeds 43 * Handle minimum values for seeds
@@ -39,11 +48,11 @@ static inline u32 __seed(u32 x, u32 m)
39} 48}
40 49
41/** 50/**
42 * prandom32_seed - set seed for prandom32(). 51 * prandom_seed_state - set seed for prandom_u32_state().
43 * @state: pointer to state structure to receive the seed. 52 * @state: pointer to state structure to receive the seed.
44 * @seed: arbitrary 64-bit value to use as a seed. 53 * @seed: arbitrary 64-bit value to use as a seed.
45 */ 54 */
46static inline void prandom32_seed(struct rnd_state *state, u64 seed) 55static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
47{ 56{
48 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 57 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
49 58
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e0f0fab2041..c92dd28eaa6 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -286,23 +286,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
286 &pos->member != (head); \ 286 &pos->member != (head); \
287 pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) 287 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
288 288
289
290/**
291 * list_for_each_continue_rcu
292 * @pos: the &struct list_head to use as a loop cursor.
293 * @head: the head for your list.
294 *
295 * Iterate over an rcu-protected list, continuing after current point.
296 *
297 * This list-traversal primitive may safely run concurrently with
298 * the _rcu list-mutation primitives such as list_add_rcu()
299 * as long as the traversal is guarded by rcu_read_lock().
300 */
301#define list_for_each_continue_rcu(pos, head) \
302 for ((pos) = rcu_dereference_raw(list_next_rcu(pos)); \
303 (pos) != (head); \
304 (pos) = rcu_dereference_raw(list_next_rcu(pos)))
305
306/** 289/**
307 * list_for_each_entry_continue_rcu - continue iteration over list of given type 290 * list_for_each_entry_continue_rcu - continue iteration over list of given type
308 * @pos: the type * to use as a loop cursor. 291 * @pos: the type * to use as a loop cursor.
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 7c968e4f929..275aa3f1062 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -90,6 +90,25 @@ extern void do_trace_rcu_torture_read(char *rcutorturename,
90 * that started after call_rcu() was invoked. RCU read-side critical 90 * that started after call_rcu() was invoked. RCU read-side critical
91 * sections are delimited by rcu_read_lock() and rcu_read_unlock(), 91 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
92 * and may be nested. 92 * and may be nested.
93 *
94 * Note that all CPUs must agree that the grace period extended beyond
95 * all pre-existing RCU read-side critical section. On systems with more
96 * than one CPU, this means that when "func()" is invoked, each CPU is
97 * guaranteed to have executed a full memory barrier since the end of its
98 * last RCU read-side critical section whose beginning preceded the call
99 * to call_rcu(). It also means that each CPU executing an RCU read-side
100 * critical section that continues beyond the start of "func()" must have
101 * executed a memory barrier after the call_rcu() but before the beginning
102 * of that RCU read-side critical section. Note that these guarantees
103 * include CPUs that are offline, idle, or executing in user mode, as
104 * well as CPUs that are executing in the kernel.
105 *
106 * Furthermore, if CPU A invoked call_rcu() and CPU B invoked the
107 * resulting RCU callback function "func()", then both CPU A and CPU B are
108 * guaranteed to execute a full memory barrier during the time interval
109 * between the call to call_rcu() and the invocation of "func()" -- even
110 * if CPU A and CPU B are the same CPU (but again only if the system has
111 * more than one CPU).
93 */ 112 */
94extern void call_rcu(struct rcu_head *head, 113extern void call_rcu(struct rcu_head *head,
95 void (*func)(struct rcu_head *head)); 114 void (*func)(struct rcu_head *head));
@@ -118,6 +137,9 @@ extern void call_rcu(struct rcu_head *head,
118 * OR 137 * OR
119 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context. 138 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context.
120 * These may be nested. 139 * These may be nested.
140 *
141 * See the description of call_rcu() for more detailed information on
142 * memory ordering guarantees.
121 */ 143 */
122extern void call_rcu_bh(struct rcu_head *head, 144extern void call_rcu_bh(struct rcu_head *head,
123 void (*func)(struct rcu_head *head)); 145 void (*func)(struct rcu_head *head));
@@ -137,6 +159,9 @@ extern void call_rcu_bh(struct rcu_head *head,
137 * OR 159 * OR
138 * anything that disables preemption. 160 * anything that disables preemption.
139 * These may be nested. 161 * These may be nested.
162 *
163 * See the description of call_rcu() for more detailed information on
164 * memory ordering guarantees.
140 */ 165 */
141extern void call_rcu_sched(struct rcu_head *head, 166extern void call_rcu_sched(struct rcu_head *head,
142 void (*func)(struct rcu_head *rcu)); 167 void (*func)(struct rcu_head *rcu));
@@ -197,13 +222,13 @@ extern void rcu_user_enter(void);
197extern void rcu_user_exit(void); 222extern void rcu_user_exit(void);
198extern void rcu_user_enter_after_irq(void); 223extern void rcu_user_enter_after_irq(void);
199extern void rcu_user_exit_after_irq(void); 224extern void rcu_user_exit_after_irq(void);
200extern void rcu_user_hooks_switch(struct task_struct *prev,
201 struct task_struct *next);
202#else 225#else
203static inline void rcu_user_enter(void) { } 226static inline void rcu_user_enter(void) { }
204static inline void rcu_user_exit(void) { } 227static inline void rcu_user_exit(void) { }
205static inline void rcu_user_enter_after_irq(void) { } 228static inline void rcu_user_enter_after_irq(void) { }
206static inline void rcu_user_exit_after_irq(void) { } 229static inline void rcu_user_exit_after_irq(void) { }
230static inline void rcu_user_hooks_switch(struct task_struct *prev,
231 struct task_struct *next) { }
207#endif /* CONFIG_RCU_USER_QS */ 232#endif /* CONFIG_RCU_USER_QS */
208 233
209extern void exit_rcu(void); 234extern void exit_rcu(void);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index e3bcc3f4dcb..b7e95bf942c 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -19,6 +19,7 @@
19struct module; 19struct module;
20struct device; 20struct device;
21struct i2c_client; 21struct i2c_client;
22struct irq_domain;
22struct spi_device; 23struct spi_device;
23struct regmap; 24struct regmap;
24struct regmap_range_cfg; 25struct regmap_range_cfg;
@@ -54,6 +55,39 @@ enum regmap_endian {
54}; 55};
55 56
56/** 57/**
58 * A register range, used for access related checks
59 * (readable/writeable/volatile/precious checks)
60 *
61 * @range_min: address of first register
62 * @range_max: address of last register
63 */
64struct regmap_range {
65 unsigned int range_min;
66 unsigned int range_max;
67};
68
69/*
70 * A table of ranges including some yes ranges and some no ranges.
71 * If a register belongs to a no_range, the corresponding check function
72 * will return false. If a register belongs to a yes range, the corresponding
73 * check function will return true. "no_ranges" are searched first.
74 *
75 * @yes_ranges : pointer to an array of regmap ranges used as "yes ranges"
76 * @n_yes_ranges: size of the above array
77 * @no_ranges: pointer to an array of regmap ranges used as "no ranges"
78 * @n_no_ranges: size of the above array
79 */
80struct regmap_access_table {
81 const struct regmap_range *yes_ranges;
82 unsigned int n_yes_ranges;
83 const struct regmap_range *no_ranges;
84 unsigned int n_no_ranges;
85};
86
87typedef void (*regmap_lock)(void *);
88typedef void (*regmap_unlock)(void *);
89
90/**
57 * Configuration for the register map of a device. 91 * Configuration for the register map of a device.
58 * 92 *
59 * @name: Optional name of the regmap. Useful when a device has multiple 93 * @name: Optional name of the regmap. Useful when a device has multiple
@@ -67,16 +101,39 @@ enum regmap_endian {
67 * @val_bits: Number of bits in a register value, mandatory. 101 * @val_bits: Number of bits in a register value, mandatory.
68 * 102 *
69 * @writeable_reg: Optional callback returning true if the register 103 * @writeable_reg: Optional callback returning true if the register
70 * can be written to. 104 * can be written to. If this field is NULL but wr_table
105 * (see below) is not, the check is performed on such table
106 * (a register is writeable if it belongs to one of the ranges
107 * specified by wr_table).
71 * @readable_reg: Optional callback returning true if the register 108 * @readable_reg: Optional callback returning true if the register
72 * can be read from. 109 * can be read from. If this field is NULL but rd_table
110 * (see below) is not, the check is performed on such table
111 * (a register is readable if it belongs to one of the ranges
112 * specified by rd_table).
73 * @volatile_reg: Optional callback returning true if the register 113 * @volatile_reg: Optional callback returning true if the register
74 * value can't be cached. 114 * value can't be cached. If this field is NULL but
115 * volatile_table (see below) is not, the check is performed on
116 * such table (a register is volatile if it belongs to one of
117 * the ranges specified by volatile_table).
75 * @precious_reg: Optional callback returning true if the rgister 118 * @precious_reg: Optional callback returning true if the rgister
76 * should not be read outside of a call from the driver 119 * should not be read outside of a call from the driver
77 * (eg, a clear on read interrupt status register). 120 * (eg, a clear on read interrupt status register). If this
121 * field is NULL but precious_table (see below) is not, the
122 * check is performed on such table (a register is precious if
123 * it belongs to one of the ranges specified by precious_table).
124 * @lock: Optional lock callback (overrides regmap's default lock
125 * function, based on spinlock or mutex).
126 * @unlock: As above for unlocking.
127 * @lock_arg: this field is passed as the only argument of lock/unlock
128 * functions (ignored in case regular lock/unlock functions
129 * are not overridden).
78 * 130 *
79 * @max_register: Optional, specifies the maximum valid register index. 131 * @max_register: Optional, specifies the maximum valid register index.
132 * @wr_table: Optional, points to a struct regmap_access_table specifying
133 * valid ranges for write access.
134 * @rd_table: As above, for read access.
135 * @volatile_table: As above, for volatile registers.
136 * @precious_table: As above, for precious registers.
80 * @reg_defaults: Power on reset values for registers (for use with 137 * @reg_defaults: Power on reset values for registers (for use with
81 * register cache support). 138 * register cache support).
82 * @num_reg_defaults: Number of elements in reg_defaults. 139 * @num_reg_defaults: Number of elements in reg_defaults.
@@ -116,8 +173,15 @@ struct regmap_config {
116 bool (*readable_reg)(struct device *dev, unsigned int reg); 173 bool (*readable_reg)(struct device *dev, unsigned int reg);
117 bool (*volatile_reg)(struct device *dev, unsigned int reg); 174 bool (*volatile_reg)(struct device *dev, unsigned int reg);
118 bool (*precious_reg)(struct device *dev, unsigned int reg); 175 bool (*precious_reg)(struct device *dev, unsigned int reg);
176 regmap_lock lock;
177 regmap_unlock unlock;
178 void *lock_arg;
119 179
120 unsigned int max_register; 180 unsigned int max_register;
181 const struct regmap_access_table *wr_table;
182 const struct regmap_access_table *rd_table;
183 const struct regmap_access_table *volatile_table;
184 const struct regmap_access_table *precious_table;
121 const struct reg_default *reg_defaults; 185 const struct reg_default *reg_defaults;
122 unsigned int num_reg_defaults; 186 unsigned int num_reg_defaults;
123 enum regcache_type cache_type; 187 enum regcache_type cache_type;
@@ -133,7 +197,7 @@ struct regmap_config {
133 enum regmap_endian val_format_endian; 197 enum regmap_endian val_format_endian;
134 198
135 const struct regmap_range_cfg *ranges; 199 const struct regmap_range_cfg *ranges;
136 unsigned int n_ranges; 200 unsigned int num_ranges;
137}; 201};
138 202
139/** 203/**
@@ -142,6 +206,8 @@ struct regmap_config {
142 * 1. page selector register update; 206 * 1. page selector register update;
143 * 2. access through data window registers. 207 * 2. access through data window registers.
144 * 208 *
209 * @name: Descriptive name for diagnostics
210 *
145 * @range_min: Address of the lowest register address in virtual range. 211 * @range_min: Address of the lowest register address in virtual range.
146 * @range_max: Address of the highest register in virtual range. 212 * @range_max: Address of the highest register in virtual range.
147 * 213 *
@@ -153,6 +219,8 @@ struct regmap_config {
153 * @window_len: Number of registers in data window. 219 * @window_len: Number of registers in data window.
154 */ 220 */
155struct regmap_range_cfg { 221struct regmap_range_cfg {
222 const char *name;
223
156 /* Registers of virtual address range */ 224 /* Registers of virtual address range */
157 unsigned int range_min; 225 unsigned int range_min;
158 unsigned int range_max; 226 unsigned int range_max;
@@ -181,7 +249,9 @@ typedef void (*regmap_hw_free_context)(void *context);
181 * Description of a hardware bus for the register map infrastructure. 249 * Description of a hardware bus for the register map infrastructure.
182 * 250 *
183 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex 251 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
184 * to perform locking. 252 * to perform locking. This field is ignored if custom lock/unlock
253 * functions are used (see fields lock/unlock of
254 * struct regmap_config).
185 * @write: Write operation. 255 * @write: Write operation.
186 * @gather_write: Write operation with split register/value, return -ENOTSUPP 256 * @gather_write: Write operation with split register/value, return -ENOTSUPP
187 * if not implemented on a given device. 257 * if not implemented on a given device.
@@ -262,6 +332,16 @@ void regcache_mark_dirty(struct regmap *map);
262int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 332int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
263 int num_regs); 333 int num_regs);
264 334
335static inline bool regmap_reg_in_range(unsigned int reg,
336 const struct regmap_range *range)
337{
338 return reg >= range->range_min && reg <= range->range_max;
339}
340
341bool regmap_reg_in_ranges(unsigned int reg,
342 const struct regmap_range *ranges,
343 unsigned int nranges);
344
265/** 345/**
266 * Description of an IRQ for the generic regmap irq_chip. 346 * Description of an IRQ for the generic regmap irq_chip.
267 * 347 *
@@ -317,6 +397,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
317void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 397void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
318int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 398int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
319int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq); 399int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
400struct irq_domain *regmap_irq_get_domain(struct regmap_irq_chip_data *data);
320 401
321#else 402#else
322 403
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index c43cd3556b1..7bc732ce6e5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -160,6 +160,7 @@ int regulator_bulk_force_disable(int num_consumers,
160void regulator_bulk_free(int num_consumers, 160void regulator_bulk_free(int num_consumers,
161 struct regulator_bulk_data *consumers); 161 struct regulator_bulk_data *consumers);
162 162
163int regulator_can_change_voltage(struct regulator *regulator);
163int regulator_count_voltages(struct regulator *regulator); 164int regulator_count_voltages(struct regulator *regulator);
164int regulator_list_voltage(struct regulator *regulator, unsigned selector); 165int regulator_list_voltage(struct regulator *regulator, unsigned selector);
165int regulator_is_supported_voltage(struct regulator *regulator, 166int regulator_is_supported_voltage(struct regulator *regulator,
@@ -358,6 +359,10 @@ static inline void regulator_set_drvdata(struct regulator *regulator,
358{ 359{
359} 360}
360 361
362static inline int regulator_count_voltages(struct regulator *regulator)
363{
364 return 0;
365}
361#endif 366#endif
362 367
363static inline int regulator_set_voltage_tol(struct regulator *regulator, 368static inline int regulator_set_voltage_tol(struct regulator *regulator,
@@ -367,4 +372,12 @@ static inline int regulator_set_voltage_tol(struct regulator *regulator,
367 new_uV - tol_uV, new_uV + tol_uV); 372 new_uV - tol_uV, new_uV + tol_uV);
368} 373}
369 374
375static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
376 int target_uV, int tol_uV)
377{
378 return regulator_is_supported_voltage(regulator,
379 target_uV - tol_uV,
380 target_uV + tol_uV);
381}
382
370#endif 383#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 7932a3bf21b..d10bb0f39c5 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -181,10 +181,13 @@ enum regulator_type {
181 * @type: Indicates if the regulator is a voltage or current regulator. 181 * @type: Indicates if the regulator is a voltage or current regulator.
182 * @owner: Module providing the regulator, used for refcounting. 182 * @owner: Module providing the regulator, used for refcounting.
183 * 183 *
184 * @continuous_voltage_range: Indicates if the regulator can set any
185 * voltage within constrains range.
184 * @n_voltages: Number of selectors available for ops.list_voltage(). 186 * @n_voltages: Number of selectors available for ops.list_voltage().
185 * 187 *
186 * @min_uV: Voltage given by the lowest selector (if linear mapping) 188 * @min_uV: Voltage given by the lowest selector (if linear mapping)
187 * @uV_step: Voltage increase with each selector (if linear mapping) 189 * @uV_step: Voltage increase with each selector (if linear mapping)
190 * @linear_min_sel: Minimal selector for starting linear mapping
188 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 191 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
189 * @volt_table: Voltage mapping table (if table based mapping) 192 * @volt_table: Voltage mapping table (if table based mapping)
190 * 193 *
@@ -199,6 +202,7 @@ struct regulator_desc {
199 const char *name; 202 const char *name;
200 const char *supply_name; 203 const char *supply_name;
201 int id; 204 int id;
205 bool continuous_voltage_range;
202 unsigned n_voltages; 206 unsigned n_voltages;
203 struct regulator_ops *ops; 207 struct regulator_ops *ops;
204 int irq; 208 int irq;
@@ -207,6 +211,7 @@ struct regulator_desc {
207 211
208 unsigned int min_uV; 212 unsigned int min_uV;
209 unsigned int uV_step; 213 unsigned int uV_step;
214 unsigned int linear_min_sel;
210 unsigned int ramp_delay; 215 unsigned int ramp_delay;
211 216
212 const unsigned int *volt_table; 217 const unsigned int *volt_table;
diff --git a/include/linux/regulator/max8973-regulator.h b/include/linux/regulator/max8973-regulator.h
new file mode 100644
index 00000000000..f8acc052e35
--- /dev/null
+++ b/include/linux/regulator/max8973-regulator.h
@@ -0,0 +1,72 @@
1/*
2 * max8973-regulator.h -- MAXIM 8973 regulator
3 *
4 * Interface for regulator driver for MAXIM 8973 DC-DC step-down
5 * switching regulator.
6 *
7 * Copyright (C) 2012 NVIDIA Corporation
8
9 * Author: Laxman Dewangan <ldewangan@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *
25 */
26
27#ifndef __LINUX_REGULATOR_MAX8973_H
28#define __LINUX_REGULATOR_MAX8973_H
29
30/*
31 * Control flags for configuration of the device.
32 * Client need to pass this information with ORed
33 */
34#define MAX8973_CONTROL_REMOTE_SENSE_ENABLE 0x00000001
35#define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE 0x00000002
36#define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE 0x00000004
37#define MAX8973_CONTROL_BIAS_ENABLE 0x00000008
38#define MAX8973_CONTROL_PULL_DOWN_ENABLE 0x00000010
39#define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE 0x00000020
40
41#define MAX8973_CONTROL_CLKADV_TRIP_DISABLED 0x00000000
42#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US 0x00010000
43#define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US 0x00020000
44#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS 0x00030000
45
46#define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL 0x00000000
47#define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER 0x00100000
48#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER 0x00200000
49#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER 0x00300000
50
51/*
52 * struct max8973_regulator_platform_data - max8973 regulator platform data.
53 *
54 * @reg_init_data: The regulator init data.
55 * @control_flags: Control flags which are ORed value of above flags to
56 * configure device.
57 * @enable_ext_control: Enable the voltage enable/disable through external
58 * control signal from EN input pin. If it is false then
59 * voltage output will be enabled/disabled through EN bit of
60 * device register.
61 * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic.
62 * @dvs_def_state: Default state of dvs. 1 if it is high else 0.
63 */
64struct max8973_regulator_platform_data {
65 struct regulator_init_data *reg_init_data;
66 unsigned long control_flags;
67 bool enable_ext_control;
68 int dvs_gpio;
69 unsigned dvs_def_state:1;
70};
71
72#endif /* __LINUX_REGULATOR_MAX8973_H */
diff --git a/include/linux/regulator/tps51632-regulator.h b/include/linux/regulator/tps51632-regulator.h
new file mode 100644
index 00000000000..d00841e1a75
--- /dev/null
+++ b/include/linux/regulator/tps51632-regulator.h
@@ -0,0 +1,47 @@
1/*
2 * tps51632-regulator.h -- TPS51632 regulator
3 *
4 * Interface for regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down
5 * Driverless Controller with serial VID control and DVFS.
6 *
7 * Copyright (C) 2012 NVIDIA Corporation
8
9 * Author: Laxman Dewangan <ldewangan@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *
25 */
26
27#ifndef __LINUX_REGULATOR_TPS51632_H
28#define __LINUX_REGULATOR_TPS51632_H
29
30/*
31 * struct tps51632_regulator_platform_data - tps51632 regulator platform data.
32 *
33 * @reg_init_data: The regulator init data.
34 * @enable_pwm_dvfs: Enable PWM DVFS or not.
35 * @dvfs_step_20mV: Step for DVFS is 20mV or 10mV.
36 * @max_voltage_uV: Maximum possible voltage in PWM-DVFS mode.
37 * @base_voltage_uV: Base voltage when PWM-DVFS enabled.
38 */
39struct tps51632_regulator_platform_data {
40 struct regulator_init_data *reg_init_data;
41 bool enable_pwm_dvfs;
42 bool dvfs_step_20mV;
43 int max_voltage_uV;
44 int base_voltage_uV;
45};
46
47#endif /* __LINUX_REGULATOR_TPS51632_H */
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
deleted file mode 100644
index 0fa04b64db3..00000000000
--- a/include/linux/regulator/tps65090-regulator.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 7d7fbe2ef78..5ae8456d967 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -74,14 +74,9 @@ ssize_t res_counter_read(struct res_counter *counter, int member,
74 const char __user *buf, size_t nbytes, loff_t *pos, 74 const char __user *buf, size_t nbytes, loff_t *pos,
75 int (*read_strategy)(unsigned long long val, char *s)); 75 int (*read_strategy)(unsigned long long val, char *s));
76 76
77typedef int (*write_strategy_fn)(const char *buf, unsigned long long *val);
78
79int res_counter_memparse_write_strategy(const char *buf, 77int res_counter_memparse_write_strategy(const char *buf,
80 unsigned long long *res); 78 unsigned long long *res);
81 79
82int res_counter_write(struct res_counter *counter, int member,
83 const char *buffer, write_strategy_fn write_strategy);
84
85/* 80/*
86 * the field descriptors. one for each member of res_counter 81 * the field descriptors. one for each member of res_counter
87 */ 82 */
@@ -130,14 +125,16 @@ int res_counter_charge_nofail(struct res_counter *counter,
130 * 125 *
131 * these calls check for usage underflow and show a warning on the console 126 * these calls check for usage underflow and show a warning on the console
132 * _locked call expects the counter->lock to be taken 127 * _locked call expects the counter->lock to be taken
128 *
129 * returns the total charges still present in @counter.
133 */ 130 */
134 131
135void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 132u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
136void res_counter_uncharge(struct res_counter *counter, unsigned long val); 133u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
137 134
138void res_counter_uncharge_until(struct res_counter *counter, 135u64 res_counter_uncharge_until(struct res_counter *counter,
139 struct res_counter *top, 136 struct res_counter *top,
140 unsigned long val); 137 unsigned long val);
141/** 138/**
142 * res_counter_margin - calculate chargeable space of a counter 139 * res_counter_margin - calculate chargeable space of a counter
143 * @cnt: the counter 140 * @cnt: the counter
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 6c8835f74f7..519777e3fa0 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -159,13 +159,14 @@ int ring_buffer_record_is_on(struct ring_buffer *buffer);
159void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); 159void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
160void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); 160void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
161 161
162unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu); 162u64 ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu);
163unsigned long ring_buffer_bytes_cpu(struct ring_buffer *buffer, int cpu); 163unsigned long ring_buffer_bytes_cpu(struct ring_buffer *buffer, int cpu);
164unsigned long ring_buffer_entries(struct ring_buffer *buffer); 164unsigned long ring_buffer_entries(struct ring_buffer *buffer);
165unsigned long ring_buffer_overruns(struct ring_buffer *buffer); 165unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
166unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 166unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 167unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu); 168unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
169unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu);
169 170
170u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 171u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
171void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 172void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index bfe1f478064..c20635c527a 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -7,7 +7,7 @@
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/mutex.h> 10#include <linux/rwsem.h>
11#include <linux/memcontrol.h> 11#include <linux/memcontrol.h>
12 12
13/* 13/*
@@ -25,8 +25,8 @@
25 * pointing to this anon_vma once its vma list is empty. 25 * pointing to this anon_vma once its vma list is empty.
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 struct anon_vma *root; /* Root of this anon_vma tree */ 28 struct anon_vma *root; /* Root of this anon_vma tree */
29 struct mutex mutex; /* Serialize access to vma list */ 29 struct rw_semaphore rwsem; /* W: modification, R: walking the list */
30 /* 30 /*
31 * The refcount is taken on an anon_vma when there is no 31 * The refcount is taken on an anon_vma when there is no
32 * guarantee that the vma of page tables will exist for 32 * guarantee that the vma of page tables will exist for
@@ -64,7 +64,7 @@ struct anon_vma_chain {
64 struct vm_area_struct *vma; 64 struct vm_area_struct *vma;
65 struct anon_vma *anon_vma; 65 struct anon_vma *anon_vma;
66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ 66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
67 struct rb_node rb; /* locked by anon_vma->mutex */ 67 struct rb_node rb; /* locked by anon_vma->rwsem */
68 unsigned long rb_subtree_last; 68 unsigned long rb_subtree_last;
69#ifdef CONFIG_DEBUG_VM_RB 69#ifdef CONFIG_DEBUG_VM_RB
70 unsigned long cached_vma_start, cached_vma_last; 70 unsigned long cached_vma_start, cached_vma_last;
@@ -108,26 +108,37 @@ static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
108{ 108{
109 struct anon_vma *anon_vma = vma->anon_vma; 109 struct anon_vma *anon_vma = vma->anon_vma;
110 if (anon_vma) 110 if (anon_vma)
111 mutex_lock(&anon_vma->root->mutex); 111 down_write(&anon_vma->root->rwsem);
112} 112}
113 113
114static inline void vma_unlock_anon_vma(struct vm_area_struct *vma) 114static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
115{ 115{
116 struct anon_vma *anon_vma = vma->anon_vma; 116 struct anon_vma *anon_vma = vma->anon_vma;
117 if (anon_vma) 117 if (anon_vma)
118 mutex_unlock(&anon_vma->root->mutex); 118 up_write(&anon_vma->root->rwsem);
119} 119}
120 120
121static inline void anon_vma_lock(struct anon_vma *anon_vma) 121static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
122{ 122{
123 mutex_lock(&anon_vma->root->mutex); 123 down_write(&anon_vma->root->rwsem);
124} 124}
125 125
126static inline void anon_vma_unlock(struct anon_vma *anon_vma) 126static inline void anon_vma_unlock(struct anon_vma *anon_vma)
127{ 127{
128 mutex_unlock(&anon_vma->root->mutex); 128 up_write(&anon_vma->root->rwsem);
129} 129}
130 130
131static inline void anon_vma_lock_read(struct anon_vma *anon_vma)
132{
133 down_read(&anon_vma->root->rwsem);
134}
135
136static inline void anon_vma_unlock_read(struct anon_vma *anon_vma)
137{
138 up_read(&anon_vma->root->rwsem);
139}
140
141
131/* 142/*
132 * anon_vma helper functions. 143 * anon_vma helper functions.
133 */ 144 */
@@ -220,8 +231,8 @@ int try_to_munlock(struct page *);
220/* 231/*
221 * Called by memory-failure.c to kill processes. 232 * Called by memory-failure.c to kill processes.
222 */ 233 */
223struct anon_vma *page_lock_anon_vma(struct page *page); 234struct anon_vma *page_lock_anon_vma_read(struct page *page);
224void page_unlock_anon_vma(struct anon_vma *anon_vma); 235void page_unlock_anon_vma_read(struct anon_vma *anon_vma);
225int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); 236int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma);
226 237
227/* 238/*
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 7002bbfd5d4..489dd7bb28e 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -69,4 +69,7 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
69 struct netlink_callback *cb, 69 struct netlink_callback *cb,
70 struct net_device *dev, 70 struct net_device *dev,
71 int idx); 71 int idx);
72
73extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
74 struct net_device *dev, u16 mode);
72#endif /* __LINUX_RTNETLINK_H */ 75#endif /* __LINUX_RTNETLINK_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0dd42a02df2..206bb089c06 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -107,8 +107,18 @@ 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
110extern unsigned long get_parent_ip(unsigned long addr); 118extern unsigned long get_parent_ip(unsigned long addr);
111 119
120extern void dump_cpu_task(int cpu);
121
112struct seq_file; 122struct seq_file;
113struct cfs_rq; 123struct cfs_rq;
114struct task_group; 124struct task_group;
@@ -434,13 +444,28 @@ struct cpu_itimer {
434}; 444};
435 445
436/** 446/**
447 * struct cputime - snaphsot of system and user cputime
448 * @utime: time spent in user mode
449 * @stime: time spent in system mode
450 *
451 * Gathers a generic snapshot of user and system time.
452 */
453struct cputime {
454 cputime_t utime;
455 cputime_t stime;
456};
457
458/**
437 * struct task_cputime - collected CPU time counts 459 * struct task_cputime - collected CPU time counts
438 * @utime: time spent in user mode, in &cputime_t units 460 * @utime: time spent in user mode, in &cputime_t units
439 * @stime: time spent in kernel mode, in &cputime_t units 461 * @stime: time spent in kernel mode, in &cputime_t units
440 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds 462 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds
441 * 463 *
442 * This structure groups together three kinds of CPU time that are 464 * This is an extension of struct cputime that includes the total runtime
443 * tracked for threads and thread groups. Most things considering 465 * spent by the task from the scheduler point of view.
466 *
467 * As a result, this structure groups together three kinds of CPU time
468 * that are tracked for threads and thread groups. Most things considering
444 * CPU time want to group these counts together and treat all three 469 * CPU time want to group these counts together and treat all three
445 * of them in parallel. 470 * of them in parallel.
446 */ 471 */
@@ -581,7 +606,7 @@ struct signal_struct {
581 cputime_t gtime; 606 cputime_t gtime;
582 cputime_t cgtime; 607 cputime_t cgtime;
583#ifndef CONFIG_VIRT_CPU_ACCOUNTING 608#ifndef CONFIG_VIRT_CPU_ACCOUNTING
584 cputime_t prev_utime, prev_stime; 609 struct cputime prev_cputime;
585#endif 610#endif
586 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 611 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
587 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 612 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
@@ -631,9 +656,10 @@ struct signal_struct {
631 struct rw_semaphore group_rwsem; 656 struct rw_semaphore group_rwsem;
632#endif 657#endif
633 658
634 int oom_score_adj; /* OOM kill score adjustment */ 659 oom_flags_t oom_flags;
635 int oom_score_adj_min; /* OOM kill score adjustment minimum value. 660 short oom_score_adj; /* OOM kill score adjustment */
636 * Only settable by CAP_SYS_RESOURCE. */ 661 short oom_score_adj_min; /* OOM kill score adjustment min value.
662 * Only settable by CAP_SYS_RESOURCE. */
637 663
638 struct mutex cred_guard_mutex; /* guard against foreign influences on 664 struct mutex cred_guard_mutex; /* guard against foreign influences on
639 * credential calculations 665 * credential calculations
@@ -1061,6 +1087,7 @@ struct sched_class {
1061 1087
1062#ifdef CONFIG_SMP 1088#ifdef CONFIG_SMP
1063 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); 1089 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags);
1090 void (*migrate_task_rq)(struct task_struct *p, int next_cpu);
1064 1091
1065 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1092 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1066 void (*post_schedule) (struct rq *this_rq); 1093 void (*post_schedule) (struct rq *this_rq);
@@ -1095,6 +1122,18 @@ struct load_weight {
1095 unsigned long weight, inv_weight; 1122 unsigned long weight, inv_weight;
1096}; 1123};
1097 1124
1125struct sched_avg {
1126 /*
1127 * These sums represent an infinite geometric series and so are bound
1128 * above by 1024/(1-y). Thus we only need a u32 to store them for for all
1129 * choices of y < 1-2^(-32)*1024.
1130 */
1131 u32 runnable_avg_sum, runnable_avg_period;
1132 u64 last_runnable_update;
1133 s64 decay_count;
1134 unsigned long load_avg_contrib;
1135};
1136
1098#ifdef CONFIG_SCHEDSTATS 1137#ifdef CONFIG_SCHEDSTATS
1099struct sched_statistics { 1138struct sched_statistics {
1100 u64 wait_start; 1139 u64 wait_start;
@@ -1155,6 +1194,15 @@ struct sched_entity {
1155 /* rq "owned" by this entity/group: */ 1194 /* rq "owned" by this entity/group: */
1156 struct cfs_rq *my_q; 1195 struct cfs_rq *my_q;
1157#endif 1196#endif
1197/*
1198 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
1199 * removed when useful for applications beyond shares distribution (e.g.
1200 * load-balance).
1201 */
1202#if defined(CONFIG_SMP) && defined(CONFIG_FAIR_GROUP_SCHED)
1203 /* Per-entity load-tracking */
1204 struct sched_avg avg;
1205#endif
1158}; 1206};
1159 1207
1160struct sched_rt_entity { 1208struct sched_rt_entity {
@@ -1318,7 +1366,7 @@ struct task_struct {
1318 cputime_t utime, stime, utimescaled, stimescaled; 1366 cputime_t utime, stime, utimescaled, stimescaled;
1319 cputime_t gtime; 1367 cputime_t gtime;
1320#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1368#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1321 cputime_t prev_utime, prev_stime; 1369 struct cputime prev_cputime;
1322#endif 1370#endif
1323 unsigned long nvcsw, nivcsw; /* context switch counts */ 1371 unsigned long nvcsw, nivcsw; /* context switch counts */
1324 struct timespec start_time; /* monotonic time */ 1372 struct timespec start_time; /* monotonic time */
@@ -1479,6 +1527,14 @@ struct task_struct {
1479 short il_next; 1527 short il_next;
1480 short pref_node_fork; 1528 short pref_node_fork;
1481#endif 1529#endif
1530#ifdef CONFIG_NUMA_BALANCING
1531 int numa_scan_seq;
1532 int numa_migrate_seq;
1533 unsigned int numa_scan_period;
1534 u64 node_stamp; /* migration stamp */
1535 struct callback_head numa_work;
1536#endif /* CONFIG_NUMA_BALANCING */
1537
1482 struct rcu_head rcu; 1538 struct rcu_head rcu;
1483 1539
1484 /* 1540 /*
@@ -1541,6 +1597,7 @@ struct task_struct {
1541 unsigned long nr_pages; /* uncharged usage */ 1597 unsigned long nr_pages; /* uncharged usage */
1542 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1598 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1543 } memcg_batch; 1599 } memcg_batch;
1600 unsigned int memcg_kmem_skip_account;
1544#endif 1601#endif
1545#ifdef CONFIG_HAVE_HW_BREAKPOINT 1602#ifdef CONFIG_HAVE_HW_BREAKPOINT
1546 atomic_t ptrace_bp_refcnt; 1603 atomic_t ptrace_bp_refcnt;
@@ -1553,6 +1610,18 @@ struct task_struct {
1553/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1610/* Future-safe accessor for struct task_struct's cpus_allowed. */
1554#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1611#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1555 1612
1613#ifdef CONFIG_NUMA_BALANCING
1614extern void task_numa_fault(int node, int pages, bool migrated);
1615extern void set_numabalancing_state(bool enabled);
1616#else
1617static inline void task_numa_fault(int node, int pages, bool migrated)
1618{
1619}
1620static inline void set_numabalancing_state(bool enabled)
1621{
1622}
1623#endif
1624
1556/* 1625/*
1557 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 1626 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1558 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH 1627 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
@@ -1710,12 +1779,6 @@ static inline int is_global_init(struct task_struct *tsk)
1710 return tsk->pid == 1; 1779 return tsk->pid == 1;
1711} 1780}
1712 1781
1713/*
1714 * is_container_init:
1715 * check whether in the task is init in its own pid namespace.
1716 */
1717extern int is_container_init(struct task_struct *tsk);
1718
1719extern struct pid *cad_pid; 1782extern struct pid *cad_pid;
1720 1783
1721extern void free_task(struct task_struct *tsk); 1784extern void free_task(struct task_struct *tsk);
@@ -1729,8 +1792,8 @@ static inline void put_task_struct(struct task_struct *t)
1729 __put_task_struct(t); 1792 __put_task_struct(t);
1730} 1793}
1731 1794
1732extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1795extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1733extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1796extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1734 1797
1735/* 1798/*
1736 * Per process flags 1799 * Per process flags
@@ -1844,14 +1907,6 @@ static inline void rcu_copy_process(struct task_struct *p)
1844 1907
1845#endif 1908#endif
1846 1909
1847static inline void rcu_switch(struct task_struct *prev,
1848 struct task_struct *next)
1849{
1850#ifdef CONFIG_RCU_USER_QS
1851 rcu_user_hooks_switch(prev, next);
1852#endif
1853}
1854
1855static inline void tsk_restore_flags(struct task_struct *task, 1910static inline void tsk_restore_flags(struct task_struct *task,
1856 unsigned long orig_flags, unsigned long flags) 1911 unsigned long orig_flags, unsigned long flags)
1857{ 1912{
@@ -1990,6 +2045,13 @@ enum sched_tunable_scaling {
1990}; 2045};
1991extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; 2046extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
1992 2047
2048extern unsigned int sysctl_numa_balancing_scan_delay;
2049extern unsigned int sysctl_numa_balancing_scan_period_min;
2050extern unsigned int sysctl_numa_balancing_scan_period_max;
2051extern unsigned int sysctl_numa_balancing_scan_period_reset;
2052extern unsigned int sysctl_numa_balancing_scan_size;
2053extern unsigned int sysctl_numa_balancing_settle_count;
2054
1993#ifdef CONFIG_SCHED_DEBUG 2055#ifdef CONFIG_SCHED_DEBUG
1994extern unsigned int sysctl_sched_migration_cost; 2056extern unsigned int sysctl_sched_migration_cost;
1995extern unsigned int sysctl_sched_nr_migrate; 2057extern unsigned int sysctl_sched_nr_migrate;
@@ -2271,7 +2333,7 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
2271extern struct mm_struct *dup_mm(struct task_struct *tsk); 2333extern struct mm_struct *dup_mm(struct task_struct *tsk);
2272 2334
2273extern int copy_thread(unsigned long, unsigned long, unsigned long, 2335extern int copy_thread(unsigned long, unsigned long, unsigned long,
2274 struct task_struct *, struct pt_regs *); 2336 struct task_struct *);
2275extern void flush_thread(void); 2337extern void flush_thread(void);
2276extern void exit_thread(void); 2338extern void exit_thread(void);
2277 2339
@@ -2283,18 +2345,15 @@ extern void flush_itimer_signals(void);
2283 2345
2284extern void do_group_exit(int); 2346extern void do_group_exit(int);
2285 2347
2286extern void daemonize(const char *, ...);
2287extern int allow_signal(int); 2348extern int allow_signal(int);
2288extern int disallow_signal(int); 2349extern int disallow_signal(int);
2289 2350
2290extern int do_execve(const char *, 2351extern int do_execve(const char *,
2291 const char __user * const __user *, 2352 const char __user * const __user *,
2292 const char __user * const __user *, struct pt_regs *); 2353 const char __user * const __user *);
2293extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2354extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
2294struct task_struct *fork_idle(int); 2355struct task_struct *fork_idle(int);
2295#ifdef CONFIG_GENERIC_KERNEL_THREAD
2296extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2356extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2297#endif
2298 2357
2299extern void set_task_comm(struct task_struct *tsk, char *from); 2358extern void set_task_comm(struct task_struct *tsk, char *from);
2300extern char *get_task_comm(char *to, struct task_struct *tsk); 2359extern char *get_task_comm(char *to, struct task_struct *tsk);
diff --git a/include/linux/security.h b/include/linux/security.h
index 05e88bdcf7d..0f6afc657f7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -694,6 +694,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
694 * userspace to load a kernel module with the given name. 694 * userspace to load a kernel module with the given name.
695 * @kmod_name name of the module requested by the kernel 695 * @kmod_name name of the module requested by the kernel
696 * Return 0 if successful. 696 * Return 0 if successful.
697 * @kernel_module_from_file:
698 * Load a kernel module from userspace.
699 * @file contains the file structure pointing to the file containing
700 * the kernel module to load. If the module is being loaded from a blob,
701 * this argument will be NULL.
702 * Return 0 if permission is granted.
697 * @task_fix_setuid: 703 * @task_fix_setuid:
698 * Update the module's state after setting one or more of the user 704 * Update the module's state after setting one or more of the user
699 * identity attributes of the current process. The @flags parameter 705 * identity attributes of the current process. The @flags parameter
@@ -1508,6 +1514,7 @@ struct security_operations {
1508 int (*kernel_act_as)(struct cred *new, u32 secid); 1514 int (*kernel_act_as)(struct cred *new, u32 secid);
1509 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1515 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1510 int (*kernel_module_request)(char *kmod_name); 1516 int (*kernel_module_request)(char *kmod_name);
1517 int (*kernel_module_from_file)(struct file *file);
1511 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1518 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1512 int flags); 1519 int flags);
1513 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1520 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
@@ -1765,6 +1772,7 @@ void security_transfer_creds(struct cred *new, const struct cred *old);
1765int security_kernel_act_as(struct cred *new, u32 secid); 1772int security_kernel_act_as(struct cred *new, u32 secid);
1766int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1773int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1767int security_kernel_module_request(char *kmod_name); 1774int security_kernel_module_request(char *kmod_name);
1775int security_kernel_module_from_file(struct file *file);
1768int security_task_fix_setuid(struct cred *new, const struct cred *old, 1776int security_task_fix_setuid(struct cred *new, const struct cred *old,
1769 int flags); 1777 int flags);
1770int security_task_setpgid(struct task_struct *p, pid_t pgid); 1778int security_task_setpgid(struct task_struct *p, pid_t pgid);
@@ -2278,6 +2286,11 @@ static inline int security_kernel_module_request(char *kmod_name)
2278 return 0; 2286 return 0;
2279} 2287}
2280 2288
2289static inline int security_kernel_module_from_file(struct file *file)
2290{
2291 return 0;
2292}
2293
2281static inline int security_task_fix_setuid(struct cred *new, 2294static inline int security_task_fix_setuid(struct cred *new,
2282 const struct cred *old, 2295 const struct cred *old,
2283 int flags) 2296 int flags)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index c174c90fb3f..c490d20b3fb 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -105,6 +105,8 @@ extern int early_serial_setup(struct uart_port *port);
105 105
106extern int serial8250_find_port(struct uart_port *p); 106extern int serial8250_find_port(struct uart_port *p);
107extern int serial8250_find_port_for_earlycon(void); 107extern int serial8250_find_port_for_earlycon(void);
108extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
109extern void serial8250_early_out(struct uart_port *port, int offset, int value);
108extern int setup_early_serial8250_console(char *cmdline); 110extern int setup_early_serial8250_console(char *cmdline);
109extern void serial8250_do_set_termios(struct uart_port *port, 111extern void serial8250_do_set_termios(struct uart_port *port,
110 struct ktermios *termios, struct ktermios *old); 112 struct ktermios *termios, struct ktermios *old);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 3c430228d23..c6690a2a27f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -46,6 +46,8 @@ struct uart_ops {
46 unsigned int (*get_mctrl)(struct uart_port *); 46 unsigned int (*get_mctrl)(struct uart_port *);
47 void (*stop_tx)(struct uart_port *); 47 void (*stop_tx)(struct uart_port *);
48 void (*start_tx)(struct uart_port *); 48 void (*start_tx)(struct uart_port *);
49 void (*throttle)(struct uart_port *);
50 void (*unthrottle)(struct uart_port *);
49 void (*send_xchar)(struct uart_port *, char ch); 51 void (*send_xchar)(struct uart_port *, char ch);
50 void (*stop_rx)(struct uart_port *); 52 void (*stop_rx)(struct uart_port *);
51 void (*enable_ms)(struct uart_port *); 53 void (*enable_ms)(struct uart_port *);
@@ -163,6 +165,10 @@ struct uart_port {
163#define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) 165#define UPF_BUGGY_UART ((__force upf_t) (1 << 14))
164#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15)) 166#define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15))
165#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) 167#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
168/* Port has hardware-assisted h/w flow control (iow, auto-RTS *not* auto-CTS) */
169#define UPF_HARD_FLOW ((__force upf_t) (1 << 21))
170/* Port has hardware-assisted s/w flow control */
171#define UPF_SOFT_FLOW ((__force upf_t) (1 << 22))
166#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 172#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
167#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 173#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
168#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 174#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 50910913b26..60c72395ec6 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -199,4 +199,13 @@ int sh_clk_div6_reparent_register(struct clk *clks, int nr);
199#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 199#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
200#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } 200#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
201 201
202/* .enable_reg will be updated to .mapping on sh_clk_fsidiv_register() */
203#define SH_CLK_FSIDIV(_reg, _parent) \
204{ \
205 .enable_reg = (void __iomem *)_reg, \
206 .parent = _parent, \
207}
208
209int sh_clk_fsidiv_register(struct clk *clks, int nr);
210
202#endif /* __SH_CLOCK_H */ 211#endif /* __SH_CLOCK_H */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index bcf8a6a3ec0..429c1995d75 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -29,6 +29,21 @@ struct shmid_kernel /* private to the kernel */
29#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ 29#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
30#define SHM_NORESERVE 010000 /* don't check for reservations */ 30#define SHM_NORESERVE 010000 /* don't check for reservations */
31 31
32/* Bits [26:31] are reserved */
33
34/*
35 * When SHM_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
36 * This gives us 6 bits, which is enough until someone invents 128 bit address
37 * spaces.
38 *
39 * Assume these are all power of twos.
40 * When 0 use the default page size.
41 */
42#define SHM_HUGE_SHIFT 26
43#define SHM_HUGE_MASK 0x3f
44#define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT)
45#define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT)
46
32#ifdef CONFIG_SYSVIPC 47#ifdef CONFIG_SYSVIPC
33long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr, 48long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr,
34 unsigned long shmlba); 49 unsigned long shmlba);
diff --git a/include/linux/signal.h b/include/linux/signal.h
index e19a011b43b..0a89ffc4846 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -385,4 +385,7 @@ int unhandled_signal(struct task_struct *tsk, int sig);
385 385
386void signals_init(void); 386void signals_init(void);
387 387
388int restore_altstack(const stack_t __user *);
389int __save_altstack(stack_t __user *, unsigned long);
390
388#endif /* _LINUX_SIGNAL_H */ 391#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6a2c34e6d96..320e976d5ab 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -235,11 +235,13 @@ enum {
235/* 235/*
236 * The callback notifies userspace to release buffers when skb DMA is done in 236 * The callback notifies userspace to release buffers when skb DMA is done in
237 * lower device, the skb last reference should be 0 when calling this. 237 * lower device, the skb last reference should be 0 when calling this.
238 * The zerocopy_success argument is true if zero copy transmit occurred,
239 * false on data copy or out of memory error caused by data copy attempt.
238 * The ctx field is used to track device context. 240 * The ctx field is used to track device context.
239 * The desc field is used to track userspace buffer index. 241 * The desc field is used to track userspace buffer index.
240 */ 242 */
241struct ubuf_info { 243struct ubuf_info {
242 void (*callback)(struct ubuf_info *); 244 void (*callback)(struct ubuf_info *, bool zerocopy_success);
243 void *ctx; 245 void *ctx;
244 unsigned long desc; 246 unsigned long desc;
245}; 247};
@@ -374,6 +376,8 @@ typedef unsigned char *sk_buff_data_t;
374 * @mark: Generic packet mark 376 * @mark: Generic packet mark
375 * @dropcount: total number of sk_receive_queue overflows 377 * @dropcount: total number of sk_receive_queue overflows
376 * @vlan_tci: vlan tag control information 378 * @vlan_tci: vlan tag control information
379 * @inner_transport_header: Inner transport layer header (encapsulation)
380 * @inner_network_header: Network layer header (encapsulation)
377 * @transport_header: Transport layer header 381 * @transport_header: Transport layer header
378 * @network_header: Network layer header 382 * @network_header: Network layer header
379 * @mac_header: Link layer header 383 * @mac_header: Link layer header
@@ -469,7 +473,13 @@ struct sk_buff {
469 __u8 wifi_acked:1; 473 __u8 wifi_acked:1;
470 __u8 no_fcs:1; 474 __u8 no_fcs:1;
471 __u8 head_frag:1; 475 __u8 head_frag:1;
472 /* 8/10 bit hole (depending on ndisc_nodetype presence) */ 476 /* Encapsulation protocol and NIC drivers should use
477 * this flag to indicate to each other if the skb contains
478 * encapsulated packet or not and maybe use the inner packet
479 * headers if needed
480 */
481 __u8 encapsulation:1;
482 /* 7/9 bit hole (depending on ndisc_nodetype presence) */
473 kmemcheck_bitfield_end(flags2); 483 kmemcheck_bitfield_end(flags2);
474 484
475#ifdef CONFIG_NET_DMA 485#ifdef CONFIG_NET_DMA
@@ -484,6 +494,8 @@ struct sk_buff {
484 __u32 avail_size; 494 __u32 avail_size;
485 }; 495 };
486 496
497 sk_buff_data_t inner_transport_header;
498 sk_buff_data_t inner_network_header;
487 sk_buff_data_t transport_header; 499 sk_buff_data_t transport_header;
488 sk_buff_data_t network_header; 500 sk_buff_data_t network_header;
489 sk_buff_data_t mac_header; 501 sk_buff_data_t mac_header;
@@ -566,6 +578,7 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
566} 578}
567 579
568extern void kfree_skb(struct sk_buff *skb); 580extern void kfree_skb(struct sk_buff *skb);
581extern void skb_tx_error(struct sk_buff *skb);
569extern void consume_skb(struct sk_buff *skb); 582extern void consume_skb(struct sk_buff *skb);
570extern void __kfree_skb(struct sk_buff *skb); 583extern void __kfree_skb(struct sk_buff *skb);
571extern struct kmem_cache *skbuff_head_cache; 584extern struct kmem_cache *skbuff_head_cache;
@@ -643,7 +656,7 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
643extern void __skb_get_rxhash(struct sk_buff *skb); 656extern void __skb_get_rxhash(struct sk_buff *skb);
644static inline __u32 skb_get_rxhash(struct sk_buff *skb) 657static inline __u32 skb_get_rxhash(struct sk_buff *skb)
645{ 658{
646 if (!skb->rxhash) 659 if (!skb->l4_rxhash)
647 __skb_get_rxhash(skb); 660 __skb_get_rxhash(skb);
648 661
649 return skb->rxhash; 662 return skb->rxhash;
@@ -1432,12 +1445,53 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
1432 skb->tail += len; 1445 skb->tail += len;
1433} 1446}
1434 1447
1448static inline void skb_reset_inner_headers(struct sk_buff *skb)
1449{
1450 skb->inner_network_header = skb->network_header;
1451 skb->inner_transport_header = skb->transport_header;
1452}
1453
1435static inline void skb_reset_mac_len(struct sk_buff *skb) 1454static inline void skb_reset_mac_len(struct sk_buff *skb)
1436{ 1455{
1437 skb->mac_len = skb->network_header - skb->mac_header; 1456 skb->mac_len = skb->network_header - skb->mac_header;
1438} 1457}
1439 1458
1440#ifdef NET_SKBUFF_DATA_USES_OFFSET 1459#ifdef NET_SKBUFF_DATA_USES_OFFSET
1460static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1461 *skb)
1462{
1463 return skb->head + skb->inner_transport_header;
1464}
1465
1466static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1467{
1468 skb->inner_transport_header = skb->data - skb->head;
1469}
1470
1471static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1472 const int offset)
1473{
1474 skb_reset_inner_transport_header(skb);
1475 skb->inner_transport_header += offset;
1476}
1477
1478static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1479{
1480 return skb->head + skb->inner_network_header;
1481}
1482
1483static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1484{
1485 skb->inner_network_header = skb->data - skb->head;
1486}
1487
1488static inline void skb_set_inner_network_header(struct sk_buff *skb,
1489 const int offset)
1490{
1491 skb_reset_inner_network_header(skb);
1492 skb->inner_network_header += offset;
1493}
1494
1441static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1495static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1442{ 1496{
1443 return skb->head + skb->transport_header; 1497 return skb->head + skb->transport_header;
@@ -1493,6 +1547,38 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1493} 1547}
1494 1548
1495#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1549#else /* NET_SKBUFF_DATA_USES_OFFSET */
1550static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1551 *skb)
1552{
1553 return skb->inner_transport_header;
1554}
1555
1556static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1557{
1558 skb->inner_transport_header = skb->data;
1559}
1560
1561static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1562 const int offset)
1563{
1564 skb->inner_transport_header = skb->data + offset;
1565}
1566
1567static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1568{
1569 return skb->inner_network_header;
1570}
1571
1572static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1573{
1574 skb->inner_network_header = skb->data;
1575}
1576
1577static inline void skb_set_inner_network_header(struct sk_buff *skb,
1578 const int offset)
1579{
1580 skb->inner_network_header = skb->data + offset;
1581}
1496 1582
1497static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1583static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1498{ 1584{
@@ -1571,11 +1657,21 @@ static inline u32 skb_network_header_len(const struct sk_buff *skb)
1571 return skb->transport_header - skb->network_header; 1657 return skb->transport_header - skb->network_header;
1572} 1658}
1573 1659
1660static inline u32 skb_inner_network_header_len(const struct sk_buff *skb)
1661{
1662 return skb->inner_transport_header - skb->inner_network_header;
1663}
1664
1574static inline int skb_network_offset(const struct sk_buff *skb) 1665static inline int skb_network_offset(const struct sk_buff *skb)
1575{ 1666{
1576 return skb_network_header(skb) - skb->data; 1667 return skb_network_header(skb) - skb->data;
1577} 1668}
1578 1669
1670static inline int skb_inner_network_offset(const struct sk_buff *skb)
1671{
1672 return skb_inner_network_header(skb) - skb->data;
1673}
1674
1579static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) 1675static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1580{ 1676{
1581 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1677 return pskb_may_pull(skb, skb_network_offset(skb) + len);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 83d1a1454b7..5d168d7e0a2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -11,6 +11,8 @@
11 11
12#include <linux/gfp.h> 12#include <linux/gfp.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/workqueue.h>
15
14 16
15/* 17/*
16 * Flags to pass to kmem_cache_create(). 18 * Flags to pass to kmem_cache_create().
@@ -116,6 +118,7 @@ struct kmem_cache {
116}; 118};
117#endif 119#endif
118 120
121struct mem_cgroup;
119/* 122/*
120 * struct kmem_cache related prototypes 123 * struct kmem_cache related prototypes
121 */ 124 */
@@ -125,10 +128,12 @@ int slab_is_available(void);
125struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 128struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
126 unsigned long, 129 unsigned long,
127 void (*)(void *)); 130 void (*)(void *));
131struct kmem_cache *
132kmem_cache_create_memcg(struct mem_cgroup *, const char *, size_t, size_t,
133 unsigned long, void (*)(void *), struct kmem_cache *);
128void kmem_cache_destroy(struct kmem_cache *); 134void kmem_cache_destroy(struct kmem_cache *);
129int kmem_cache_shrink(struct kmem_cache *); 135int kmem_cache_shrink(struct kmem_cache *);
130void kmem_cache_free(struct kmem_cache *, void *); 136void kmem_cache_free(struct kmem_cache *, void *);
131unsigned int kmem_cache_size(struct kmem_cache *);
132 137
133/* 138/*
134 * Please use this macro to create slab caches. Simply specify the 139 * Please use this macro to create slab caches. Simply specify the
@@ -176,6 +181,48 @@ unsigned int kmem_cache_size(struct kmem_cache *);
176#ifndef ARCH_SLAB_MINALIGN 181#ifndef ARCH_SLAB_MINALIGN
177#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) 182#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
178#endif 183#endif
184/*
185 * This is the main placeholder for memcg-related information in kmem caches.
186 * struct kmem_cache will hold a pointer to it, so the memory cost while
187 * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it
188 * would otherwise be if that would be bundled in kmem_cache: we'll need an
189 * extra pointer chase. But the trade off clearly lays in favor of not
190 * penalizing non-users.
191 *
192 * Both the root cache and the child caches will have it. For the root cache,
193 * this will hold a dynamically allocated array large enough to hold
194 * information about the currently limited memcgs in the system.
195 *
196 * Child caches will hold extra metadata needed for its operation. Fields are:
197 *
198 * @memcg: pointer to the memcg this cache belongs to
199 * @list: list_head for the list of all caches in this memcg
200 * @root_cache: pointer to the global, root cache, this cache was derived from
201 * @dead: set to true after the memcg dies; the cache may still be around.
202 * @nr_pages: number of pages that belongs to this cache.
203 * @destroy: worker to be called whenever we are ready, or believe we may be
204 * ready, to destroy this cache.
205 */
206struct memcg_cache_params {
207 bool is_root_cache;
208 union {
209 struct kmem_cache *memcg_caches[0];
210 struct {
211 struct mem_cgroup *memcg;
212 struct list_head list;
213 struct kmem_cache *root_cache;
214 bool dead;
215 atomic_t nr_pages;
216 struct work_struct destroy;
217 };
218 };
219};
220
221int memcg_update_all_caches(int num_memcgs);
222
223struct seq_file;
224int cache_show(struct kmem_cache *s, struct seq_file *m);
225void print_slabinfo_header(struct seq_file *m);
179 226
180/* 227/*
181 * Common kmalloc functions provided by all allocators 228 * Common kmalloc functions provided by all allocators
@@ -388,6 +435,14 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
388 return kmalloc_node(size, flags | __GFP_ZERO, node); 435 return kmalloc_node(size, flags | __GFP_ZERO, node);
389} 436}
390 437
438/*
439 * Determine the size of a slab object
440 */
441static inline unsigned int kmem_cache_size(struct kmem_cache *s)
442{
443 return s->object_size;
444}
445
391void __init kmem_cache_init_late(void); 446void __init kmem_cache_init_late(void);
392 447
393#endif /* _LINUX_SLAB_H */ 448#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index cc290f0bdb3..8bb6e0eaf3c 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -81,6 +81,9 @@ struct kmem_cache {
81 */ 81 */
82 int obj_offset; 82 int obj_offset;
83#endif /* CONFIG_DEBUG_SLAB */ 83#endif /* CONFIG_DEBUG_SLAB */
84#ifdef CONFIG_MEMCG_KMEM
85 struct memcg_cache_params *memcg_params;
86#endif
84 87
85/* 6) per-cpu/per-node data, touched during every alloc/free */ 88/* 6) per-cpu/per-node data, touched during every alloc/free */
86 /* 89 /*
@@ -89,9 +92,13 @@ struct kmem_cache {
89 * (see kmem_cache_init()) 92 * (see kmem_cache_init())
90 * We still use [NR_CPUS] and not [1] or [0] because cache_cache 93 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
91 * is statically defined, so we reserve the max number of cpus. 94 * is statically defined, so we reserve the max number of cpus.
95 *
96 * We also need to guarantee that the list is able to accomodate a
97 * pointer for each node since "nodelists" uses the remainder of
98 * available pointers.
92 */ 99 */
93 struct kmem_list3 **nodelists; 100 struct kmem_list3 **nodelists;
94 struct array_cache *array[NR_CPUS]; 101 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
95 /* 102 /*
96 * Do not add fields after array[] 103 * Do not add fields after array[]
97 */ 104 */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index df448adb728..9db4825cd39 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -101,6 +101,10 @@ struct kmem_cache {
101#ifdef CONFIG_SYSFS 101#ifdef CONFIG_SYSFS
102 struct kobject kobj; /* For sysfs */ 102 struct kobject kobj; /* For sysfs */
103#endif 103#endif
104#ifdef CONFIG_MEMCG_KMEM
105 struct memcg_cache_params *memcg_params;
106 int max_attr_size; /* for propagation, maximum size of a stored attr */
107#endif
104 108
105#ifdef CONFIG_NUMA 109#ifdef CONFIG_NUMA
106 /* 110 /*
@@ -222,7 +226,10 @@ void *__kmalloc(size_t size, gfp_t flags);
222static __always_inline void * 226static __always_inline void *
223kmalloc_order(size_t size, gfp_t flags, unsigned int order) 227kmalloc_order(size_t size, gfp_t flags, unsigned int order)
224{ 228{
225 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); 229 void *ret;
230
231 flags |= (__GFP_COMP | __GFP_KMEMCG);
232 ret = (void *) __get_free_pages(flags, order);
226 kmemleak_alloc(ret, size, 1, flags); 233 kmemleak_alloc(ret, size, 1, flags);
227 return ret; 234 return ret;
228} 235}
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
index ce718cbce43..f4bf16e16e1 100644
--- a/include/linux/smscphy.h
+++ b/include/linux/smscphy.h
@@ -4,6 +4,7 @@
4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */ 4#define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
5#define MII_LAN83C185_IM 30 /* Interrupt Mask */ 5#define MII_LAN83C185_IM 30 /* Interrupt Mask */
6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */ 6#define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
7#define MII_LAN83C185_SPECIAL_MODES 18 /* Special Modes Register */
7 8
8#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */ 9#define MII_LAN83C185_ISF_INT1 (1<<1) /* Auto-Negotiation Page Received */
9#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */ 10#define MII_LAN83C185_ISF_INT2 (1<<2) /* Parallel Detection Fault */
@@ -22,4 +23,8 @@
22#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */ 23#define MII_LAN83C185_EDPWRDOWN (1 << 13) /* EDPWRDOWN */
23#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */ 24#define MII_LAN83C185_ENERGYON (1 << 1) /* ENERGYON */
24 25
26#define MII_LAN83C185_MODE_MASK 0xE0
27#define MII_LAN83C185_MODE_POWERDOWN 0xC0 /* Power Down mode */
28#define MII_LAN83C185_MODE_ALL 0xE0 /* All capable mode */
29
25#endif /* __LINUX_SMSCPHY_H__ */ 30#endif /* __LINUX_SMSCPHY_H__ */
diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h
new file mode 100644
index 00000000000..786932c62ed
--- /dev/null
+++ b/include/linux/spi/spi-tegra.h
@@ -0,0 +1,40 @@
1/*
2 * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller.
3 *
4 * Copyright (C) 2011 NVIDIA Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _LINUX_SPI_TEGRA_H
22#define _LINUX_SPI_TEGRA_H
23
24struct tegra_spi_platform_data {
25 int dma_req_sel;
26 unsigned int spi_max_frequency;
27};
28
29/*
30 * Controller data from device to pass some info like
31 * hw based chip select can be used or not and if yes
32 * then CS hold and setup time.
33 */
34struct tegra_spi_device_controller_data {
35 bool is_hw_based_cs;
36 int cs_setup_clk_count;
37 int cs_hold_clk_count;
38};
39
40#endif /* _LINUX_SPI_TEGRA_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index fa702aeb503..f62918946d8 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -90,6 +90,7 @@ struct spi_device {
90 void *controller_state; 90 void *controller_state;
91 void *controller_data; 91 void *controller_data;
92 char modalias[SPI_NAME_SIZE]; 92 char modalias[SPI_NAME_SIZE];
93 int cs_gpio; /* chip select gpio */
93 94
94 /* 95 /*
95 * likely need more hooks for more protocol options affecting how 96 * likely need more hooks for more protocol options affecting how
@@ -362,6 +363,8 @@ struct spi_master {
362 int (*transfer_one_message)(struct spi_master *master, 363 int (*transfer_one_message)(struct spi_master *master,
363 struct spi_message *mesg); 364 struct spi_message *mesg);
364 int (*unprepare_transfer_hardware)(struct spi_master *master); 365 int (*unprepare_transfer_hardware)(struct spi_master *master);
366 /* gpio chip select */
367 int *cs_gpios;
365}; 368};
366 369
367static inline void *spi_master_get_devdata(struct spi_master *master) 370static inline void *spi_master_get_devdata(struct spi_master *master)
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 55a5c52cbb2..6eb691b0835 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -16,8 +16,10 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * 17 *
18 * Copyright (C) IBM Corporation, 2006 18 * Copyright (C) IBM Corporation, 2006
19 * Copyright (C) Fujitsu, 2012
19 * 20 *
20 * Author: Paul McKenney <paulmck@us.ibm.com> 21 * Author: Paul McKenney <paulmck@us.ibm.com>
22 * Lai Jiangshan <laijs@cn.fujitsu.com>
21 * 23 *
22 * For detailed explanation of Read-Copy Update mechanism see - 24 * For detailed explanation of Read-Copy Update mechanism see -
23 * Documentation/RCU/ *.txt 25 * Documentation/RCU/ *.txt
@@ -40,6 +42,8 @@ struct rcu_batch {
40 struct rcu_head *head, **tail; 42 struct rcu_head *head, **tail;
41}; 43};
42 44
45#define RCU_BATCH_INIT(name) { NULL, &(name.head) }
46
43struct srcu_struct { 47struct srcu_struct {
44 unsigned completed; 48 unsigned completed;
45 struct srcu_struct_array __percpu *per_cpu_ref; 49 struct srcu_struct_array __percpu *per_cpu_ref;
@@ -70,12 +74,42 @@ int __init_srcu_struct(struct srcu_struct *sp, const char *name,
70 __init_srcu_struct((sp), #sp, &__srcu_key); \ 74 __init_srcu_struct((sp), #sp, &__srcu_key); \
71}) 75})
72 76
77#define __SRCU_DEP_MAP_INIT(srcu_name) .dep_map = { .name = #srcu_name },
73#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 78#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
74 79
75int init_srcu_struct(struct srcu_struct *sp); 80int init_srcu_struct(struct srcu_struct *sp);
76 81
82#define __SRCU_DEP_MAP_INIT(srcu_name)
77#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 83#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
78 84
85void process_srcu(struct work_struct *work);
86
87#define __SRCU_STRUCT_INIT(name) \
88 { \
89 .completed = -300, \
90 .per_cpu_ref = &name##_srcu_array, \
91 .queue_lock = __SPIN_LOCK_UNLOCKED(name.queue_lock), \
92 .running = false, \
93 .batch_queue = RCU_BATCH_INIT(name.batch_queue), \
94 .batch_check0 = RCU_BATCH_INIT(name.batch_check0), \
95 .batch_check1 = RCU_BATCH_INIT(name.batch_check1), \
96 .batch_done = RCU_BATCH_INIT(name.batch_done), \
97 .work = __DELAYED_WORK_INITIALIZER(name.work, process_srcu, 0),\
98 __SRCU_DEP_MAP_INIT(name) \
99 }
100
101/*
102 * define and init a srcu struct at build time.
103 * dont't call init_srcu_struct() nor cleanup_srcu_struct() on it.
104 */
105#define DEFINE_SRCU(name) \
106 static DEFINE_PER_CPU(struct srcu_struct_array, name##_srcu_array);\
107 struct srcu_struct name = __SRCU_STRUCT_INIT(name);
108
109#define DEFINE_STATIC_SRCU(name) \
110 static DEFINE_PER_CPU(struct srcu_struct_array, name##_srcu_array);\
111 static struct srcu_struct name = __SRCU_STRUCT_INIT(name);
112
79/** 113/**
80 * call_srcu() - Queue a callback for invocation after an SRCU grace period 114 * call_srcu() - Queue a callback for invocation after an SRCU grace period
81 * @sp: srcu_struct in queue the callback 115 * @sp: srcu_struct in queue the callback
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index bb674c02f30..22958d68ecf 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -6,8 +6,10 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/gpio.h>
9#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
10#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/platform_device.h>
11 13
12#include <linux/ssb/ssb_regs.h> 14#include <linux/ssb/ssb_regs.h>
13 15
@@ -432,7 +434,11 @@ struct ssb_bus {
432#ifdef CONFIG_SSB_EMBEDDED 434#ifdef CONFIG_SSB_EMBEDDED
433 /* Lock for GPIO register access. */ 435 /* Lock for GPIO register access. */
434 spinlock_t gpio_lock; 436 spinlock_t gpio_lock;
437 struct platform_device *watchdog;
435#endif /* EMBEDDED */ 438#endif /* EMBEDDED */
439#ifdef CONFIG_SSB_DRIVER_GPIO
440 struct gpio_chip gpio;
441#endif /* DRIVER_GPIO */
436 442
437 /* Internal-only stuff follows. Do not touch. */ 443 /* Internal-only stuff follows. Do not touch. */
438 struct list_head list; 444 struct list_head list;
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index c2b02a5c86a..9e492be5244 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -590,7 +590,10 @@ struct ssb_chipcommon {
590 u32 status; 590 u32 status;
591 /* Fast Powerup Delay constant */ 591 /* Fast Powerup Delay constant */
592 u16 fast_pwrup_delay; 592 u16 fast_pwrup_delay;
593 spinlock_t gpio_lock;
593 struct ssb_chipcommon_pmu pmu; 594 struct ssb_chipcommon_pmu pmu;
595 u32 ticks_per_ms;
596 u32 max_timer_ms;
594}; 597};
595 598
596static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) 599static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
@@ -630,8 +633,7 @@ enum ssb_clkmode {
630extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, 633extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
631 enum ssb_clkmode mode); 634 enum ssb_clkmode mode);
632 635
633extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 636extern u32 ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks);
634 u32 ticks);
635 637
636void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value); 638void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value);
637 639
@@ -644,6 +646,8 @@ u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
644u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value); 646u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value);
645u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value); 647u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value);
646u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value); 648u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value);
649u32 ssb_chipco_gpio_pullup(struct ssb_chipcommon *cc, u32 mask, u32 value);
650u32 ssb_chipco_gpio_pulldown(struct ssb_chipcommon *cc, u32 mask, u32 value);
647 651
648#ifdef CONFIG_SSB_SERIAL 652#ifdef CONFIG_SSB_SERIAL
649extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc, 653extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h
index 91161f0aa22..a410e841eb9 100644
--- a/include/linux/ssb/ssb_driver_extif.h
+++ b/include/linux/ssb/ssb_driver_extif.h
@@ -152,12 +152,16 @@
152/* watchdog */ 152/* watchdog */
153#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ 153#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */
154 154
155#define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1)
156#define SSB_EXTIF_WATCHDOG_MAX_TIMER_MS (SSB_EXTIF_WATCHDOG_MAX_TIMER \
157 / (SSB_EXTIF_WATCHDOG_CLK / 1000))
155 158
156 159
157#ifdef CONFIG_SSB_DRIVER_EXTIF 160#ifdef CONFIG_SSB_DRIVER_EXTIF
158 161
159struct ssb_extif { 162struct ssb_extif {
160 struct ssb_device *dev; 163 struct ssb_device *dev;
164 spinlock_t gpio_lock;
161}; 165};
162 166
163static inline bool ssb_extif_available(struct ssb_extif *extif) 167static inline bool ssb_extif_available(struct ssb_extif *extif)
@@ -171,8 +175,7 @@ extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
171extern void ssb_extif_timing_init(struct ssb_extif *extif, 175extern void ssb_extif_timing_init(struct ssb_extif *extif,
172 unsigned long ns); 176 unsigned long ns);
173 177
174extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 178extern u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks);
175 u32 ticks);
176 179
177/* Extif GPIO pin access */ 180/* Extif GPIO pin access */
178u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); 181u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
@@ -205,10 +208,52 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
205} 208}
206 209
207static inline 210static inline
208void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, 211void ssb_extif_timing_init(struct ssb_extif *extif, unsigned long ns)
209 u32 ticks)
210{ 212{
211} 213}
212 214
215static inline
216u32 ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks)
217{
218 return 0;
219}
220
221static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
222{
223 return 0;
224}
225
226static inline u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask,
227 u32 value)
228{
229 return 0;
230}
231
232static inline u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask,
233 u32 value)
234{
235 return 0;
236}
237
238static inline u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask,
239 u32 value)
240{
241 return 0;
242}
243
244static inline u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask,
245 u32 value)
246{
247 return 0;
248}
249
250#ifdef CONFIG_SSB_SERIAL
251static inline int ssb_extif_serial_init(struct ssb_extif *extif,
252 struct ssb_serial_port *ports)
253{
254 return 0;
255}
256#endif /* CONFIG_SSB_SERIAL */
257
213#endif /* CONFIG_SSB_DRIVER_EXTIF */ 258#endif /* CONFIG_SSB_DRIVER_EXTIF */
214#endif /* LINUX_SSB_EXTIFCORE_H_ */ 259#endif /* LINUX_SSB_EXTIFCORE_H_ */
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index 5f44e9740cd..07a9c7a2e08 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -13,6 +13,12 @@ struct ssb_serial_port {
13 unsigned int reg_shift; 13 unsigned int reg_shift;
14}; 14};
15 15
16struct ssb_pflash {
17 bool present;
18 u8 buswidth;
19 u32 window;
20 u32 window_size;
21};
16 22
17struct ssb_mipscore { 23struct ssb_mipscore {
18 struct ssb_device *dev; 24 struct ssb_device *dev;
@@ -20,9 +26,7 @@ struct ssb_mipscore {
20 int nr_serial_ports; 26 int nr_serial_ports;
21 struct ssb_serial_port serial_ports[4]; 27 struct ssb_serial_port serial_ports[4];
22 28
23 u8 flash_buswidth; 29 struct ssb_pflash pflash;
24 u32 flash_window;
25 u32 flash_window_size;
26}; 30};
27 31
28extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 32extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index a0525019e1d..6ecfa02ddba 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -485,7 +485,7 @@
485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4 485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4
486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020 486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020
487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5 487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5
488#define SSB_SPROM8_TEMPDELTA 0x00BA 488#define SSB_SPROM8_TEMPDELTA 0x00BC
489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff 489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff
490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0 490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0
491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00 491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index a1547ea3920..c1b3ed3fb78 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -61,7 +61,7 @@
61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */ 61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */
62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */ 62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */
63 63
64/* AXI DMA Burst length suported */ 64/* AXI DMA Burst length supported */
65#define DMA_AXI_BLEN_4 (1 << 1) 65#define DMA_AXI_BLEN_4 (1 << 1)
66#define DMA_AXI_BLEN_8 (1 << 2) 66#define DMA_AXI_BLEN_8 (1 << 2)
67#define DMA_AXI_BLEN_16 (1 << 3) 67#define DMA_AXI_BLEN_16 (1 << 3)
@@ -104,6 +104,7 @@ struct plat_stmmacenet_data {
104 int bugged_jumbo; 104 int bugged_jumbo;
105 int pmt; 105 int pmt;
106 int force_sf_dma_mode; 106 int force_sf_dma_mode;
107 int riwt_off;
107 void (*fix_mac_speed)(void *priv, unsigned int speed); 108 void (*fix_mac_speed)(void *priv, unsigned int speed);
108 void (*bus_setup)(void __iomem *ioaddr); 109 void (*bus_setup)(void __iomem *ioaddr);
109 int (*init)(struct platform_device *pdev); 110 int (*init)(struct platform_device *pdev);
diff --git a/include/linux/string.h b/include/linux/string.h
index 630125818ca..ac889c5ea11 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -143,4 +143,15 @@ static inline bool strstarts(const char *str, const char *prefix)
143 143
144extern size_t memweight(const void *ptr, size_t bytes); 144extern size_t memweight(const void *ptr, size_t bytes);
145 145
146/**
147 * kbasename - return the last part of a pathname.
148 *
149 * @path: path to extract the filename from.
150 */
151static inline const char *kbasename(const char *path)
152{
153 const char *tail = strrchr(path, '/');
154 return tail ? tail + 1 : path;
155}
156
146#endif /* _LINUX_STRING_H_ */ 157#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index f792794f663..5dc9ee4d616 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -217,6 +217,8 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
217static inline int get_int(char **bpp, int *anint) 217static inline int get_int(char **bpp, int *anint)
218{ 218{
219 char buf[50]; 219 char buf[50];
220 char *ep;
221 int rv;
220 int len = qword_get(bpp, buf, sizeof(buf)); 222 int len = qword_get(bpp, buf, sizeof(buf));
221 223
222 if (len < 0) 224 if (len < 0)
@@ -224,9 +226,11 @@ static inline int get_int(char **bpp, int *anint)
224 if (len == 0) 226 if (len == 0)
225 return -ENOENT; 227 return -ENOENT;
226 228
227 if (kstrtoint(buf, 0, anint)) 229 rv = simple_strtol(buf, &ep, 0);
230 if (*ep)
228 return -EINVAL; 231 return -EINVAL;
229 232
233 *anint = rv;
230 return 0; 234 return 0;
231} 235}
232 236
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index dc0c3cc3ada..b64f8eb0b97 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -192,7 +192,6 @@ struct rpc_wait_queue {
192 pid_t owner; /* process id of last task serviced */ 192 pid_t owner; /* process id of last task serviced */
193 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ 193 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
194 unsigned char priority; /* current priority */ 194 unsigned char priority; /* current priority */
195 unsigned char count; /* # task groups remaining serviced so far */
196 unsigned char nr; /* # tasks remaining for cookie */ 195 unsigned char nr; /* # tasks remaining for cookie */
197 unsigned short qlen; /* total # tasks waiting in queue */ 196 unsigned short qlen; /* total # tasks waiting in queue */
198 struct rpc_timer timer_list; 197 struct rpc_timer timer_list;
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index d83db800fe0..676ddf53b3e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -243,6 +243,7 @@ struct svc_rqst {
243 struct page * rq_pages[RPCSVC_MAXPAGES]; 243 struct page * rq_pages[RPCSVC_MAXPAGES];
244 struct page * *rq_respages; /* points into rq_pages */ 244 struct page * *rq_respages; /* points into rq_pages */
245 int rq_resused; /* number of pages used for result */ 245 int rq_resused; /* number of pages used for result */
246 struct page * *rq_next_page; /* next reply page to use */
246 247
247 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
248 249
@@ -338,9 +339,8 @@ xdr_ressize_check(struct svc_rqst *rqstp, __be32 *p)
338 339
339static inline void svc_free_res_pages(struct svc_rqst *rqstp) 340static inline void svc_free_res_pages(struct svc_rqst *rqstp)
340{ 341{
341 while (rqstp->rq_resused) { 342 while (rqstp->rq_next_page != rqstp->rq_respages) {
342 struct page **pp = (rqstp->rq_respages + 343 struct page **pp = --rqstp->rq_next_page;
343 --rqstp->rq_resused);
344 if (*pp) { 344 if (*pp) {
345 put_page(*pp); 345 put_page(*pp);
346 *pp = NULL; 346 *pp = NULL;
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 92ad02f0dcc..62fd1b756e9 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -26,11 +26,28 @@ struct svc_sock {
26 void (*sk_owspace)(struct sock *); 26 void (*sk_owspace)(struct sock *);
27 27
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 /* On-the-wire fragment header: */
30 u32 sk_tcplen; /* current read length */ 30 __be32 sk_reclen;
31 /* As we receive a record, this includes the length received so
32 * far (including the fragment header): */
33 u32 sk_tcplen;
34 /* Total length of the data (not including fragment headers)
35 * received so far in the fragments making up this rpc: */
36 u32 sk_datalen;
37
31 struct page * sk_pages[RPCSVC_MAXPAGES]; /* received data */ 38 struct page * sk_pages[RPCSVC_MAXPAGES]; /* received data */
32}; 39};
33 40
41static inline u32 svc_sock_reclen(struct svc_sock *svsk)
42{
43 return ntohl(svsk->sk_reclen) & RPC_FRAGMENT_SIZE_MASK;
44}
45
46static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
47{
48 return ntohl(svsk->sk_reclen) & RPC_LAST_STREAM_FRAGMENT;
49}
50
34/* 51/*
35 * Function prototypes. 52 * Function prototypes.
36 */ 53 */
diff --git a/include/linux/sunxi_timer.h b/include/linux/sunxi_timer.h
new file mode 100644
index 00000000000..b9165bba6e6
--- /dev/null
+++ b/include/linux/sunxi_timer.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __SUNXI_TIMER_H
18#define __SUNXI_TIMER_H
19
20#include <asm/mach/time.h>
21
22extern struct sys_timer sunxi_timer;
23
24#endif
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 8d08b3ed406..071d62c214a 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -34,21 +34,25 @@ enum dma_sync_target {
34 SYNC_FOR_CPU = 0, 34 SYNC_FOR_CPU = 0,
35 SYNC_FOR_DEVICE = 1, 35 SYNC_FOR_DEVICE = 1,
36}; 36};
37extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
38 phys_addr_t phys, size_t size,
39 enum dma_data_direction dir);
40 37
41extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr, 38/* define the last possible byte of physical address space as a mapping error */
39#define SWIOTLB_MAP_ERROR (~(phys_addr_t)0x0)
40
41extern phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
42 dma_addr_t tbl_dma_addr,
43 phys_addr_t phys, size_t size,
44 enum dma_data_direction dir);
45
46extern void swiotlb_tbl_unmap_single(struct device *hwdev,
47 phys_addr_t tlb_addr,
42 size_t size, enum dma_data_direction dir); 48 size_t size, enum dma_data_direction dir);
43 49
44extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr, 50extern void swiotlb_tbl_sync_single(struct device *hwdev,
51 phys_addr_t tlb_addr,
45 size_t size, enum dma_data_direction dir, 52 size_t size, enum dma_data_direction dir,
46 enum dma_sync_target target); 53 enum dma_sync_target target);
47 54
48/* Accessory functions. */ 55/* Accessory functions. */
49extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
50 enum dma_data_direction dir);
51
52extern void 56extern void
53*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 57*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
54 dma_addr_t *dma_handle, gfp_t flags); 58 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 727f0cd7392..45e2db27025 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -63,6 +63,7 @@ struct getcpu_cache;
63struct old_linux_dirent; 63struct old_linux_dirent;
64struct perf_event_attr; 64struct perf_event_attr;
65struct file_handle; 65struct file_handle;
66struct sigaltstack;
66 67
67#include <linux/types.h> 68#include <linux/types.h>
68#include <linux/aio_abi.h> 69#include <linux/aio_abi.h>
@@ -299,6 +300,11 @@ asmlinkage long sys_personality(unsigned int personality);
299asmlinkage long sys_sigpending(old_sigset_t __user *set); 300asmlinkage long sys_sigpending(old_sigset_t __user *set);
300asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
301 old_sigset_t __user *oset); 302 old_sigset_t __user *oset);
303#ifdef CONFIG_GENERIC_SIGALTSTACK
304asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
305 struct sigaltstack __user *uoss);
306#endif
307
302asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 308asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
303asmlinkage long sys_setitimer(int which, 309asmlinkage long sys_setitimer(int which,
304 struct itimerval __user *value, 310 struct itimerval __user *value,
@@ -560,10 +566,10 @@ asmlinkage long sys_utime(char __user *filename,
560asmlinkage long sys_utimes(char __user *filename, 566asmlinkage long sys_utimes(char __user *filename,
561 struct timeval __user *utimes); 567 struct timeval __user *utimes);
562asmlinkage long sys_lseek(unsigned int fd, off_t offset, 568asmlinkage long sys_lseek(unsigned int fd, off_t offset,
563 unsigned int origin); 569 unsigned int whence);
564asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 570asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
565 unsigned long offset_low, loff_t __user *result, 571 unsigned long offset_low, loff_t __user *result,
566 unsigned int origin); 572 unsigned int whence);
567asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count); 573asmlinkage long sys_read(unsigned int fd, char __user *buf, size_t count);
568asmlinkage long sys_readahead(int fd, loff_t offset, size_t count); 574asmlinkage long sys_readahead(int fd, loff_t offset, size_t count);
569asmlinkage long sys_readv(unsigned long fd, 575asmlinkage long sys_readv(unsigned long fd,
@@ -827,16 +833,19 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
827 const char __user *pathname); 833 const char __user *pathname);
828asmlinkage long sys_syncfs(int fd); 834asmlinkage long sys_syncfs(int fd);
829 835
830#ifndef CONFIG_GENERIC_KERNEL_EXECVE 836asmlinkage long sys_fork(void);
831int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 837asmlinkage long sys_vfork(void);
838#ifdef CONFIG_CLONE_BACKWARDS
839asmlinkage long sys_clone(unsigned long, unsigned long, int __user *, int,
840 int __user *);
832#else 841#else
833#define kernel_execve(filename, argv, envp) \ 842asmlinkage long sys_clone(unsigned long, unsigned long, int __user *,
834 do_execve(filename, \ 843 int __user *, int);
835 (const char __user *const __user *)argv, \
836 (const char __user *const __user *)envp, \
837 current_pt_regs())
838#endif 844#endif
839 845
846asmlinkage long sys_execve(const char __user *filename,
847 const char __user *const __user *argv,
848 const char __user *const __user *envp);
840 849
841asmlinkage long sys_perf_event_open( 850asmlinkage long sys_perf_event_open(
842 struct perf_event_attr __user *attr_uptr, 851 struct perf_event_attr __user *attr_uptr,
@@ -868,4 +877,5 @@ asmlinkage long sys_process_vm_writev(pid_t pid,
868 877
869asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, 878asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type,
870 unsigned long idx1, unsigned long idx2); 879 unsigned long idx1, unsigned long idx2);
880asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags);
871#endif 881#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index cd844a6a8d5..14a8ff2de11 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -158,8 +158,7 @@ struct ctl_table_root {
158 struct ctl_table_set default_set; 158 struct ctl_table_set default_set;
159 struct ctl_table_set *(*lookup)(struct ctl_table_root *root, 159 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
160 struct nsproxy *namespaces); 160 struct nsproxy *namespaces);
161 int (*permissions)(struct ctl_table_root *root, 161 int (*permissions)(struct ctl_table_header *head, struct ctl_table *table);
162 struct nsproxy *namespaces, struct ctl_table *table);
163}; 162};
164 163
165/* struct ctl_path describes where in the hierarchy a table is added */ 164/* struct ctl_path describes where in the hierarchy a table is added */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 60b7aac15e0..4e1d2283e3c 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -35,6 +35,16 @@ static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
35 return tcp_hdr(skb)->doff * 4; 35 return tcp_hdr(skb)->doff * 4;
36} 36}
37 37
38static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)
39{
40 return (struct tcphdr *)skb_inner_transport_header(skb);
41}
42
43static inline unsigned int inner_tcp_hdrlen(const struct sk_buff *skb)
44{
45 return inner_tcp_hdr(skb)->doff * 4;
46}
47
38static inline unsigned int tcp_optlen(const struct sk_buff *skb) 48static inline unsigned int tcp_optlen(const struct sk_buff *skb)
39{ 49{
40 return (tcp_hdr(skb)->doff - 5) * 4; 50 return (tcp_hdr(skb)->doff - 5) * 4;
diff --git a/include/linux/tegra-ahb.h b/include/linux/tegra-ahb.h
new file mode 100644
index 00000000000..f1cd075ceee
--- /dev/null
+++ b/include/linux/tegra-ahb.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (c) 2012, 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_AHB_H__
15#define __LINUX_AHB_H__
16
17extern int tegra_ahb_enable_smmu(struct device_node *ahb);
18
19#endif /* __LINUX_AHB_H__ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 91b34812cd8..fe82022478e 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -29,6 +29,32 @@
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31 31
32#define THERMAL_TRIPS_NONE -1
33#define THERMAL_MAX_TRIPS 12
34#define THERMAL_NAME_LENGTH 20
35
36/* No upper/lower limit requirement */
37#define THERMAL_NO_LIMIT -1UL
38
39/* Unit conversion macros */
40#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
41 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
42#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
43
44/* Adding event notification support elements */
45#define THERMAL_GENL_FAMILY_NAME "thermal_event"
46#define THERMAL_GENL_VERSION 0x01
47#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
48
49/* Default Thermal Governor */
50#if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE)
51#define DEFAULT_THERMAL_GOVERNOR "step_wise"
52#elif defined(CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE)
53#define DEFAULT_THERMAL_GOVERNOR "fair_share"
54#elif defined(CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE)
55#define DEFAULT_THERMAL_GOVERNOR "user_space"
56#endif
57
32struct thermal_zone_device; 58struct thermal_zone_device;
33struct thermal_cooling_device; 59struct thermal_cooling_device;
34 60
@@ -50,6 +76,30 @@ enum thermal_trend {
50 THERMAL_TREND_DROPPING, /* temperature is dropping */ 76 THERMAL_TREND_DROPPING, /* temperature is dropping */
51}; 77};
52 78
79/* Events supported by Thermal Netlink */
80enum events {
81 THERMAL_AUX0,
82 THERMAL_AUX1,
83 THERMAL_CRITICAL,
84 THERMAL_DEV_FAULT,
85};
86
87/* attributes of thermal_genl_family */
88enum {
89 THERMAL_GENL_ATTR_UNSPEC,
90 THERMAL_GENL_ATTR_EVENT,
91 __THERMAL_GENL_ATTR_MAX,
92};
93#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
94
95/* commands supported by the thermal_genl_family */
96enum {
97 THERMAL_GENL_CMD_UNSPEC,
98 THERMAL_GENL_CMD_EVENT,
99 __THERMAL_GENL_CMD_MAX,
100};
101#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
102
53struct thermal_zone_device_ops { 103struct thermal_zone_device_ops {
54 int (*bind) (struct thermal_zone_device *, 104 int (*bind) (struct thermal_zone_device *,
55 struct thermal_cooling_device *); 105 struct thermal_cooling_device *);
@@ -83,11 +133,6 @@ struct thermal_cooling_device_ops {
83 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); 133 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
84}; 134};
85 135
86#define THERMAL_NO_LIMIT -1UL /* no upper/lower limit requirement */
87
88#define THERMAL_TRIPS_NONE -1
89#define THERMAL_MAX_TRIPS 12
90#define THERMAL_NAME_LENGTH 20
91struct thermal_cooling_device { 136struct thermal_cooling_device {
92 int id; 137 int id;
93 char type[THERMAL_NAME_LENGTH]; 138 char type[THERMAL_NAME_LENGTH];
@@ -100,10 +145,6 @@ struct thermal_cooling_device {
100 struct list_head node; 145 struct list_head node;
101}; 146};
102 147
103#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
104 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
105#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
106
107struct thermal_attr { 148struct thermal_attr {
108 struct device_attribute attr; 149 struct device_attribute attr;
109 char name[THERMAL_NAME_LENGTH]; 150 char name[THERMAL_NAME_LENGTH];
@@ -125,46 +166,61 @@ struct thermal_zone_device {
125 int passive; 166 int passive;
126 unsigned int forced_passive; 167 unsigned int forced_passive;
127 const struct thermal_zone_device_ops *ops; 168 const struct thermal_zone_device_ops *ops;
169 const struct thermal_zone_params *tzp;
170 struct thermal_governor *governor;
128 struct list_head thermal_instances; 171 struct list_head thermal_instances;
129 struct idr idr; 172 struct idr idr;
130 struct mutex lock; /* protect thermal_instances list */ 173 struct mutex lock; /* protect thermal_instances list */
131 struct list_head node; 174 struct list_head node;
132 struct delayed_work poll_queue; 175 struct delayed_work poll_queue;
133}; 176};
134/* Adding event notification support elements */
135#define THERMAL_GENL_FAMILY_NAME "thermal_event"
136#define THERMAL_GENL_VERSION 0x01
137#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group"
138 177
139enum events { 178/* Structure that holds thermal governor information */
140 THERMAL_AUX0, 179struct thermal_governor {
141 THERMAL_AUX1, 180 char name[THERMAL_NAME_LENGTH];
142 THERMAL_CRITICAL, 181 int (*throttle)(struct thermal_zone_device *tz, int trip);
143 THERMAL_DEV_FAULT, 182 struct list_head governor_list;
183 struct module *owner;
144}; 184};
145 185
146struct thermal_genl_event { 186/* Structure that holds binding parameters for a zone */
147 u32 orig; 187struct thermal_bind_params {
148 enum events event; 188 struct thermal_cooling_device *cdev;
189
190 /*
191 * This is a measure of 'how effectively these devices can
192 * cool 'this' thermal zone. The shall be determined by platform
193 * characterization. This is on a 'percentage' scale.
194 * See Documentation/thermal/sysfs-api.txt for more information.
195 */
196 int weight;
197
198 /*
199 * This is a bit mask that gives the binding relation between this
200 * thermal zone and cdev, for a particular trip point.
201 * See Documentation/thermal/sysfs-api.txt for more information.
202 */
203 int trip_mask;
204 int (*match) (struct thermal_zone_device *tz,
205 struct thermal_cooling_device *cdev);
149}; 206};
150/* attributes of thermal_genl_family */ 207
151enum { 208/* Structure to define Thermal Zone parameters */
152 THERMAL_GENL_ATTR_UNSPEC, 209struct thermal_zone_params {
153 THERMAL_GENL_ATTR_EVENT, 210 char governor_name[THERMAL_NAME_LENGTH];
154 __THERMAL_GENL_ATTR_MAX, 211 int num_tbps; /* Number of tbp entries */
212 struct thermal_bind_params *tbp;
155}; 213};
156#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
157 214
158/* commands supported by the thermal_genl_family */ 215struct thermal_genl_event {
159enum { 216 u32 orig;
160 THERMAL_GENL_CMD_UNSPEC, 217 enum events event;
161 THERMAL_GENL_CMD_EVENT,
162 __THERMAL_GENL_CMD_MAX,
163}; 218};
164#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
165 219
220/* Function declarations */
166struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 221struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
167 void *, const struct thermal_zone_device_ops *, int, int); 222 void *, const struct thermal_zone_device_ops *,
223 const struct thermal_zone_params *, int, int);
168void thermal_zone_device_unregister(struct thermal_zone_device *); 224void thermal_zone_device_unregister(struct thermal_zone_device *);
169 225
170int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 226int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
@@ -173,10 +229,20 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
173int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 229int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
174 struct thermal_cooling_device *); 230 struct thermal_cooling_device *);
175void thermal_zone_device_update(struct thermal_zone_device *); 231void thermal_zone_device_update(struct thermal_zone_device *);
232
176struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 233struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
177 const struct thermal_cooling_device_ops *); 234 const struct thermal_cooling_device_ops *);
178void thermal_cooling_device_unregister(struct thermal_cooling_device *); 235void thermal_cooling_device_unregister(struct thermal_cooling_device *);
179 236
237int get_tz_trend(struct thermal_zone_device *, int);
238struct thermal_instance *get_thermal_instance(struct thermal_zone_device *,
239 struct thermal_cooling_device *, int);
240void thermal_cdev_update(struct thermal_cooling_device *);
241void notify_thermal_framework(struct thermal_zone_device *, int);
242
243int thermal_register_governor(struct thermal_governor *);
244void thermal_unregister_governor(struct thermal_governor *);
245
180#ifdef CONFIG_NET 246#ifdef CONFIG_NET
181extern int thermal_generate_netlink_event(u32 orig, enum events event); 247extern int thermal_generate_netlink_event(u32 orig, enum events event);
182#else 248#else
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index ccc1899bd62..e7e04736802 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -61,6 +61,8 @@ extern long do_no_restart_syscall(struct restart_block *parm);
61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK) 61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
62#endif 62#endif
63 63
64#define THREADINFO_GFP_ACCOUNTED (THREADINFO_GFP | __GFP_KMEMCG)
65
64/* 66/*
65 * flag set/clear/test wrappers 67 * flag set/clear/test wrappers
66 * - pass TIF_xxxx constants to these functions 68 * - pass TIF_xxxx constants to these functions
diff --git a/include/linux/tick.h b/include/linux/tick.h
index f37fceb69b7..1a6567b4849 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -142,4 +142,10 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
142static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } 142static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
143# endif /* !NO_HZ */ 143# endif /* !NO_HZ */
144 144
145# ifdef CONFIG_CPU_IDLE_GOV_MENU
146extern void menu_hrtimer_cancel(void);
147# else
148static inline void menu_hrtimer_cancel(void) {}
149# endif /* CONFIG_CPU_IDLE_GOV_MENU */
150
145#endif 151#endif
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
deleted file mode 100644
index 546e2234e4b..00000000000
--- a/include/linux/timecompare.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Utility code which helps transforming between two different time
3 * bases, called "source" and "target" time in this code.
4 *
5 * Source time has to be provided via the timecounter API while target
6 * time is accessed via a function callback whose prototype
7 * intentionally matches ktime_get() and ktime_get_real(). These
8 * interfaces where chosen like this so that the code serves its
9 * initial purpose without additional glue code.
10 *
11 * This purpose is synchronizing a hardware clock in a NIC with system
12 * time, in order to implement the Precision Time Protocol (PTP,
13 * IEEE1588) with more accurate hardware assisted time stamping. In
14 * that context only synchronization against system time (=
15 * ktime_get_real()) is currently needed. But this utility code might
16 * become useful in other situations, which is why it was written as
17 * general purpose utility code.
18 *
19 * The source timecounter is assumed to return monotonically
20 * increasing time (but this code does its best to compensate if that
21 * is not the case) whereas target time may jump.
22 *
23 * The target time corresponding to a source time is determined by
24 * reading target time, reading source time, reading target time
25 * again, then assuming that average target time corresponds to source
26 * time. In other words, the assumption is that reading the source
27 * time is slow and involves equal time for sending the request and
28 * receiving the reply, whereas reading target time is assumed to be
29 * fast.
30 *
31 * Copyright (C) 2009 Intel Corporation.
32 * Author: Patrick Ohly <patrick.ohly@intel.com>
33 *
34 * This program is free software; you can redistribute it and/or modify it
35 * under the terms and conditions of the GNU General Public License,
36 * version 2, as published by the Free Software Foundation.
37 *
38 * This program is distributed in the hope it will be useful, but WITHOUT
39 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
40 * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
41 * more details.
42 *
43 * You should have received a copy of the GNU General Public License along with
44 * this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
46 */
47#ifndef _LINUX_TIMECOMPARE_H
48#define _LINUX_TIMECOMPARE_H
49
50#include <linux/clocksource.h>
51#include <linux/ktime.h>
52
53/**
54 * struct timecompare - stores state and configuration for the two clocks
55 *
56 * Initialize to zero, then set source/target/num_samples.
57 *
58 * Transformation between source time and target time is done with:
59 * target_time = source_time + offset +
60 * (source_time - last_update) * skew /
61 * TIMECOMPARE_SKEW_RESOLUTION
62 *
63 * @source: used to get source time stamps via timecounter_read()
64 * @target: function returning target time (for example, ktime_get
65 * for monotonic time, or ktime_get_real for wall clock)
66 * @num_samples: number of times that source time and target time are to
67 * be compared when determining their offset
68 * @offset: (target time - source time) at the time of the last update
69 * @skew: average (target time - source time) / delta source time *
70 * TIMECOMPARE_SKEW_RESOLUTION
71 * @last_update: last source time stamp when time offset was measured
72 */
73struct timecompare {
74 struct timecounter *source;
75 ktime_t (*target)(void);
76 int num_samples;
77
78 s64 offset;
79 s64 skew;
80 u64 last_update;
81};
82
83/**
84 * timecompare_transform - transform source time stamp into target time base
85 * @sync: context for time sync
86 * @source_tstamp: the result of timecounter_read() or
87 * timecounter_cyc2time()
88 */
89extern ktime_t timecompare_transform(struct timecompare *sync,
90 u64 source_tstamp);
91
92/**
93 * timecompare_offset - measure current (target time - source time) offset
94 * @sync: context for time sync
95 * @offset: average offset during sample period returned here
96 * @source_tstamp: average source time during sample period returned here
97 *
98 * Returns number of samples used. Might be zero (= no result) in the
99 * unlikely case that target time was monotonically decreasing for all
100 * samples (= broken).
101 */
102extern int timecompare_offset(struct timecompare *sync,
103 s64 *offset,
104 u64 *source_tstamp);
105
106extern void __timecompare_update(struct timecompare *sync,
107 u64 source_tstamp);
108
109/**
110 * timecompare_update - update offset and skew by measuring current offset
111 * @sync: context for time sync
112 * @source_tstamp: the result of timecounter_read() or
113 * timecounter_cyc2time(), pass zero to force update
114 *
115 * Updates are only done at most once per second.
116 */
117static inline void timecompare_update(struct timecompare *sync,
118 u64 source_tstamp)
119{
120 if (!source_tstamp ||
121 (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
122 __timecompare_update(sync, source_tstamp);
123}
124
125#endif /* _LINUX_TIMECOMPARE_H */
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h
index 4eb490237d4..d563f37e1a1 100644
--- a/include/linux/trace_clock.h
+++ b/include/linux/trace_clock.h
@@ -12,6 +12,8 @@
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/types.h> 13#include <linux/types.h>
14 14
15#include <asm/trace_clock.h>
16
15extern u64 notrace trace_clock_local(void); 17extern u64 notrace trace_clock_local(void);
16extern u64 notrace trace_clock(void); 18extern u64 notrace trace_clock(void);
17extern u64 notrace trace_clock_global(void); 19extern u64 notrace trace_clock_global(void);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f0b4eb47297..8db1b569c37 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -188,7 +188,9 @@ struct tty_port_operations {
188}; 188};
189 189
190struct tty_port { 190struct tty_port {
191 struct tty_bufhead buf; /* Locked internally */
191 struct tty_struct *tty; /* Back pointer */ 192 struct tty_struct *tty; /* Back pointer */
193 struct tty_struct *itty; /* internal back ptr */
192 const struct tty_port_operations *ops; /* Port operations */ 194 const struct tty_port_operations *ops; /* Port operations */
193 spinlock_t lock; /* Lock protecting tty field */ 195 spinlock_t lock; /* Lock protecting tty field */
194 int blocked_open; /* Waiting to open */ 196 int blocked_open; /* Waiting to open */
@@ -197,6 +199,9 @@ struct tty_port {
197 wait_queue_head_t close_wait; /* Close waiters */ 199 wait_queue_head_t close_wait; /* Close waiters */
198 wait_queue_head_t delta_msr_wait; /* Modem status change */ 200 wait_queue_head_t delta_msr_wait; /* Modem status change */
199 unsigned long flags; /* TTY flags ASY_*/ 201 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 */
200 unsigned char console:1; /* port is a console */ 205 unsigned char console:1; /* port is a console */
201 struct mutex mutex; /* Locking */ 206 struct mutex mutex; /* Locking */
202 struct mutex buf_mutex; /* Buffer alloc lock */ 207 struct mutex buf_mutex; /* Buffer alloc lock */
@@ -235,6 +240,7 @@ struct tty_struct {
235 struct mutex ldisc_mutex; 240 struct mutex ldisc_mutex;
236 struct tty_ldisc *ldisc; 241 struct tty_ldisc *ldisc;
237 242
243 struct mutex atomic_write_lock;
238 struct mutex legacy_mutex; 244 struct mutex legacy_mutex;
239 struct mutex termios_mutex; 245 struct mutex termios_mutex;
240 spinlock_t ctrl_lock; 246 spinlock_t ctrl_lock;
@@ -254,7 +260,6 @@ struct tty_struct {
254 260
255 struct tty_struct *link; 261 struct tty_struct *link;
256 struct fasync_struct *fasync; 262 struct fasync_struct *fasync;
257 struct tty_bufhead buf; /* Locked internally */
258 int alt_speed; /* For magic substitution of 38400 bps */ 263 int alt_speed; /* For magic substitution of 38400 bps */
259 wait_queue_head_t write_wait; 264 wait_queue_head_t write_wait;
260 wait_queue_head_t read_wait; 265 wait_queue_head_t read_wait;
@@ -265,37 +270,10 @@ struct tty_struct {
265 270
266#define N_TTY_BUF_SIZE 4096 271#define N_TTY_BUF_SIZE 4096
267 272
268 /*
269 * The following is data for the N_TTY line discipline. For
270 * historical reasons, this is included in the tty structure.
271 * Mostly locked by the BKL.
272 */
273 unsigned int column;
274 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
275 unsigned char closing:1; 273 unsigned char closing:1;
276 unsigned char echo_overrun:1;
277 unsigned short minimum_to_wake; 274 unsigned short minimum_to_wake;
278 unsigned long overrun_time;
279 int num_overrun;
280 unsigned long process_char_map[256/(8*sizeof(unsigned long))];
281 char *read_buf;
282 int read_head;
283 int read_tail;
284 int read_cnt;
285 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
286 unsigned char *echo_buf;
287 unsigned int echo_pos;
288 unsigned int echo_cnt;
289 int canon_data;
290 unsigned long canon_head;
291 unsigned int canon_column;
292 struct mutex atomic_read_lock;
293 struct mutex atomic_write_lock;
294 struct mutex output_lock;
295 struct mutex echo_lock;
296 unsigned char *write_buf; 275 unsigned char *write_buf;
297 int write_cnt; 276 int write_cnt;
298 spinlock_t read_lock;
299 /* If the tty has a pending do_SAK, queue it here - akpm */ 277 /* If the tty has a pending do_SAK, queue it here - akpm */
300 struct work_struct SAK_work; 278 struct work_struct SAK_work;
301 struct tty_port *port; 279 struct tty_port *port;
@@ -335,8 +313,6 @@ struct tty_file_private {
335#define TTY_PTY_LOCK 16 /* pty private */ 313#define TTY_PTY_LOCK 16 /* pty private */
336#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 314#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
337#define TTY_HUPPED 18 /* Post driver->hangup() */ 315#define TTY_HUPPED 18 /* Post driver->hangup() */
338#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
339#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
340#define TTY_HUPPING 21 /* ->hangup() in progress */ 316#define TTY_HUPPING 21 /* ->hangup() in progress */
341 317
342#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
@@ -412,9 +388,9 @@ extern void disassociate_ctty(int priv);
412extern void no_tty(void); 388extern void no_tty(void);
413extern void tty_flip_buffer_push(struct tty_struct *tty); 389extern void tty_flip_buffer_push(struct tty_struct *tty);
414extern void tty_flush_to_ldisc(struct tty_struct *tty); 390extern void tty_flush_to_ldisc(struct tty_struct *tty);
415extern void tty_buffer_free_all(struct tty_struct *tty); 391extern void tty_buffer_free_all(struct tty_port *port);
416extern void tty_buffer_flush(struct tty_struct *tty); 392extern void tty_buffer_flush(struct tty_struct *tty);
417extern void tty_buffer_init(struct tty_struct *tty); 393extern void tty_buffer_init(struct tty_port *port);
418extern speed_t tty_get_baud_rate(struct tty_struct *tty); 394extern speed_t tty_get_baud_rate(struct tty_struct *tty);
419extern speed_t tty_termios_baud_rate(struct ktermios *termios); 395extern speed_t tty_termios_baud_rate(struct ktermios *termios);
420extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 396extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -479,6 +455,7 @@ extern struct device *tty_port_register_device_attr(struct tty_port *port,
479 const struct attribute_group **attr_grp); 455 const struct attribute_group **attr_grp);
480extern int tty_port_alloc_xmit_buf(struct tty_port *port); 456extern int tty_port_alloc_xmit_buf(struct tty_port *port);
481extern void tty_port_free_xmit_buf(struct tty_port *port); 457extern void tty_port_free_xmit_buf(struct tty_port *port);
458extern void tty_port_destroy(struct tty_port *port);
482extern void tty_port_put(struct tty_port *port); 459extern void tty_port_put(struct tty_port *port);
483 460
484static inline struct tty_port *tty_port_get(struct tty_port *port) 461static inline struct tty_port *tty_port_get(struct tty_port *port)
@@ -535,7 +512,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
535/* tty_audit.c */ 512/* tty_audit.c */
536#ifdef CONFIG_AUDIT 513#ifdef CONFIG_AUDIT
537extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data, 514extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
538 size_t size); 515 size_t size, unsigned icanon);
539extern void tty_audit_exit(void); 516extern void tty_audit_exit(void);
540extern void tty_audit_fork(struct signal_struct *sig); 517extern void tty_audit_fork(struct signal_struct *sig);
541extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 518extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
@@ -544,7 +521,7 @@ extern int tty_audit_push_task(struct task_struct *tsk,
544 kuid_t loginuid, u32 sessionid); 521 kuid_t loginuid, u32 sessionid);
545#else 522#else
546static inline void tty_audit_add_data(struct tty_struct *tty, 523static inline void tty_audit_add_data(struct tty_struct *tty,
547 unsigned char *data, size_t size) 524 unsigned char *data, size_t size, unsigned icanon)
548{ 525{
549} 526}
550static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch) 527static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 9239d033a0a..2002344ed36 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -11,7 +11,7 @@ void tty_schedule_flip(struct tty_struct *tty);
11static inline int tty_insert_flip_char(struct tty_struct *tty, 11static inline int tty_insert_flip_char(struct tty_struct *tty,
12 unsigned char ch, char flag) 12 unsigned char ch, char flag)
13{ 13{
14 struct tty_buffer *tb = tty->buf.tail; 14 struct tty_buffer *tb = tty->port->buf.tail;
15 if (tb && tb->used < tb->size) { 15 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 16 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 17 tb->char_buf_ptr[tb->used++] = ch;
diff --git a/include/linux/types.h b/include/linux/types.h
index 1cc0e4b9a04..4d118ba1134 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -156,6 +156,7 @@ typedef u32 dma_addr_t;
156#endif 156#endif
157typedef unsigned __bitwise__ gfp_t; 157typedef unsigned __bitwise__ gfp_t;
158typedef unsigned __bitwise__ fmode_t; 158typedef unsigned __bitwise__ fmode_t;
159typedef unsigned __bitwise__ oom_flags_t;
159 160
160#ifdef CONFIG_PHYS_ADDR_T_64BIT 161#ifdef CONFIG_PHYS_ADDR_T_64BIT
161typedef u64 phys_addr_t; 162typedef u64 phys_addr_t;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 0b67d779352..9d81de123c9 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -27,6 +27,11 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
27 return (struct udphdr *)skb_transport_header(skb); 27 return (struct udphdr *)skb_transport_header(skb);
28} 28}
29 29
30static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
31{
32 return (struct udphdr *)skb_inner_transport_header(skb);
33}
34
30#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) 35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
31 36
32static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) 37static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask)
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 24594571c5a..4f628a6fc5b 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -97,12 +97,12 @@ extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_con
97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
98extern int uprobe_mmap(struct vm_area_struct *vma); 98extern int uprobe_mmap(struct vm_area_struct *vma);
99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); 99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
100extern void uprobe_start_dup_mmap(void);
101extern void uprobe_end_dup_mmap(void);
100extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 102extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
101extern void uprobe_free_utask(struct task_struct *t); 103extern void uprobe_free_utask(struct task_struct *t);
102extern void uprobe_copy_process(struct task_struct *t); 104extern void uprobe_copy_process(struct task_struct *t);
103extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
104extern void __weak arch_uprobe_enable_step(struct arch_uprobe *arch);
105extern void __weak arch_uprobe_disable_step(struct arch_uprobe *arch);
106extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 106extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
107extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 107extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
108extern void uprobe_notify_resume(struct pt_regs *regs); 108extern void uprobe_notify_resume(struct pt_regs *regs);
@@ -129,6 +129,12 @@ static inline void
129uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) 129uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
130{ 130{
131} 131}
132static inline void uprobe_start_dup_mmap(void)
133{
134}
135static inline void uprobe_end_dup_mmap(void)
136{
137}
132static inline void 138static inline void
133uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) 139uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
134{ 140{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 10278d18709..689b14b26c8 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -482,6 +482,7 @@ struct usb3_lpm_parameters {
482 * @connect_time: time device was first connected 482 * @connect_time: time device was first connected
483 * @do_remote_wakeup: remote wakeup should be enabled 483 * @do_remote_wakeup: remote wakeup should be enabled
484 * @reset_resume: needs reset instead of resume 484 * @reset_resume: needs reset instead of resume
485 * @port_is_suspended: the upstream port is suspended (L2 or U3)
485 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 486 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
486 * specific data for the device. 487 * specific data for the device.
487 * @slot_id: Slot ID assigned by xHCI 488 * @slot_id: Slot ID assigned by xHCI
@@ -560,6 +561,7 @@ struct usb_device {
560 561
561 unsigned do_remote_wakeup:1; 562 unsigned do_remote_wakeup:1;
562 unsigned reset_resume:1; 563 unsigned reset_resume:1;
564 unsigned port_is_suspended:1;
563#endif 565#endif
564 struct wusb_dev *wusb_dev; 566 struct wusb_dev *wusb_dev;
565 int slot_id; 567 int slot_id;
@@ -588,8 +590,9 @@ extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
588 */ 590 */
589#define usb_hub_for_each_child(hdev, port1, child) \ 591#define usb_hub_for_each_child(hdev, port1, child) \
590 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \ 592 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
591 port1 <= hdev->maxchild; \ 593 port1 <= hdev->maxchild; \
592 child = usb_hub_find_child(hdev, ++port1)) 594 child = usb_hub_find_child(hdev, ++port1)) \
595 if (!child) continue; else
593 596
594/* USB device locking */ 597/* USB device locking */
595#define usb_lock_device(udev) device_lock(&(udev)->dev) 598#define usb_lock_device(udev) device_lock(&(udev)->dev)
@@ -805,6 +808,22 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
805 .bcdDevice_hi = (hi) 808 .bcdDevice_hi = (hi)
806 809
807/** 810/**
811 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
812 * @vend: the 16 bit USB Vendor ID
813 * @prod: the 16 bit USB Product ID
814 * @cl: bInterfaceClass value
815 *
816 * This macro is used to create a struct usb_device_id that matches a
817 * specific interface class of devices.
818 */
819#define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \
820 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
821 USB_DEVICE_ID_MATCH_INT_CLASS, \
822 .idVendor = (vend), \
823 .idProduct = (prod), \
824 .bInterfaceClass = (cl)
825
826/**
808 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol 827 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
809 * @vend: the 16 bit USB Vendor ID 828 * @vend: the 16 bit USB Vendor ID
810 * @prod: the 16 bit USB Product ID 829 * @prod: the 16 bit USB Product ID
@@ -1129,8 +1148,8 @@ extern int usb_disabled(void);
1129 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). 1148 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
1130 */ 1149 */
1131#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1150#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
1132#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 1151#define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1133 * ignored */ 1152 * slot in the schedule */
1134#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 1153#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1135#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 1154#define URB_NO_FSBR 0x0020 /* UHCI-specific */
1136#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 1155#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
@@ -1309,15 +1328,20 @@ typedef void (*usb_complete_t)(struct urb *);
1309 * the transfer interval in the endpoint descriptor is logarithmic. 1328 * the transfer interval in the endpoint descriptor is logarithmic.
1310 * Device drivers must convert that value to linear units themselves.) 1329 * Device drivers must convert that value to linear units themselves.)
1311 * 1330 *
1312 * Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling 1331 * If an isochronous endpoint queue isn't already running, the host
1313 * the host controller to schedule the transfer as soon as bandwidth 1332 * controller will schedule a new URB to start as soon as bandwidth
1314 * utilization allows, and then set start_frame to reflect the actual frame 1333 * utilization allows. If the queue is running then a new URB will be
1315 * selected during submission. Otherwise drivers must specify the start_frame 1334 * scheduled to start in the first transfer slot following the end of the
1316 * and handle the case where the transfer can't begin then. However, drivers 1335 * preceding URB, if that slot has not already expired. If the slot has
1317 * won't know how bandwidth is currently allocated, and while they can 1336 * expired (which can happen when IRQ delivery is delayed for a long time),
1318 * find the current frame using usb_get_current_frame_number () they can't 1337 * the scheduling behavior depends on the URB_ISO_ASAP flag. If the flag
1319 * know the range for that frame number. (Ranges for frame counter values 1338 * is clear then the URB will be scheduled to start in the expired slot,
1320 * are HC-specific, and can go from 256 to 65536 frames from "now".) 1339 * implying that some of its packets will not be transferred; if the flag
1340 * is set then the URB will be scheduled in the first unexpired slot,
1341 * breaking the queue's synchronization. Upon URB completion, the
1342 * start_frame field will be set to the (micro)frame number in which the
1343 * transfer was scheduled. Ranges for frame counter values are HC-specific
1344 * and can go from as low as 256 to as high as 65536 frames.
1321 * 1345 *
1322 * Isochronous URBs have a different data transfer model, in part because 1346 * Isochronous URBs have a different data transfer model, in part because
1323 * the quality of service is only "best effort". Callers provide specially 1347 * the quality of service is only "best effort". Callers provide specially
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
new file mode 100644
index 00000000000..3b8f9d4fc3f
--- /dev/null
+++ b/include/linux/usb/cdc_ncm.h
@@ -0,0 +1,134 @@
1/*
2 * Copyright (C) ST-Ericsson 2010-2012
3 * Contact: Alexey Orishko <alexey.orishko@stericsson.com>
4 * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com>
5 *
6 * USB Host Driver for Network Control Model (NCM)
7 * http://www.usb.org/developers/devclass_docs/NCM10.zip
8 *
9 * The NCM encoding, decoding and initialization logic
10 * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h
11 *
12 * This software is available to you under a choice of one of two
13 * licenses. You may choose this file to be licensed under the terms
14 * of the GNU General Public License (GPL) Version 2 or the 2-clause
15 * BSD license listed below:
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 */
38
39#define CDC_NCM_COMM_ALTSETTING_NCM 0
40#define CDC_NCM_COMM_ALTSETTING_MBIM 1
41
42#define CDC_NCM_DATA_ALTSETTING_NCM 1
43#define CDC_NCM_DATA_ALTSETTING_MBIM 2
44
45/* CDC NCM subclass 3.2.1 */
46#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
47
48/* Maximum NTB length */
49#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
50#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
51
52/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
53#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */
54
55/* Minimum value for MaxDatagramSize, ch. 8.1.3 */
56#define CDC_MBIM_MIN_DATAGRAM_SIZE 2048 /* bytes */
57
58#define CDC_NCM_MIN_TX_PKT 512 /* bytes */
59
60/* Default value for MaxDatagramSize */
61#define CDC_NCM_MAX_DATAGRAM_SIZE 8192 /* bytes */
62
63/*
64 * Maximum amount of datagrams in NCM Datagram Pointer Table, not counting
65 * the last NULL entry.
66 */
67#define CDC_NCM_DPT_DATAGRAMS_MAX 40
68
69/* Restart the timer, if amount of datagrams is less than given value */
70#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3
71#define CDC_NCM_TIMER_PENDING_CNT 2
72#define CDC_NCM_TIMER_INTERVAL (400UL * NSEC_PER_USEC)
73
74/* The following macro defines the minimum header space */
75#define CDC_NCM_MIN_HDR_SIZE \
76 (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \
77 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
78
79#define CDC_NCM_NDP_SIZE \
80 (sizeof(struct usb_cdc_ncm_ndp16) + \
81 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
82
83#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
84 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
85#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB)
86
87struct cdc_ncm_ctx {
88 struct usb_cdc_ncm_ntb_parameters ncm_parm;
89 struct hrtimer tx_timer;
90 struct tasklet_struct bh;
91
92 const struct usb_cdc_ncm_desc *func_desc;
93 const struct usb_cdc_mbim_desc *mbim_desc;
94 const struct usb_cdc_header_desc *header_desc;
95 const struct usb_cdc_union_desc *union_desc;
96 const struct usb_cdc_ether_desc *ether_desc;
97
98 struct net_device *netdev;
99 struct usb_device *udev;
100 struct usb_host_endpoint *in_ep;
101 struct usb_host_endpoint *out_ep;
102 struct usb_host_endpoint *status_ep;
103 struct usb_interface *intf;
104 struct usb_interface *control;
105 struct usb_interface *data;
106
107 struct sk_buff *tx_curr_skb;
108 struct sk_buff *tx_rem_skb;
109 __le32 tx_rem_sign;
110
111 spinlock_t mtx;
112 atomic_t stop;
113
114 u32 tx_timer_pending;
115 u32 tx_curr_frame_num;
116 u32 rx_speed;
117 u32 tx_speed;
118 u32 rx_max;
119 u32 tx_max;
120 u32 max_datagram_size;
121 u16 tx_max_datagrams;
122 u16 tx_remainder;
123 u16 tx_modulus;
124 u16 tx_ndp_modulus;
125 u16 tx_seq;
126 u16 rx_seq;
127 u16 connected;
128};
129
130extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
131extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
132extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign);
133extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
134extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset);
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index f8dda062180..b09c37e04a9 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -38,6 +38,7 @@
38#include <linux/version.h> 38#include <linux/version.h>
39#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
40#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
41#include <linux/log2.h>
41 42
42/* 43/*
43 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they 44 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
@@ -51,6 +52,7 @@
51/* big enough to hold our biggest descriptor */ 52/* big enough to hold our biggest descriptor */
52#define USB_COMP_EP0_BUFSIZ 1024 53#define USB_COMP_EP0_BUFSIZ 1024
53 54
55#define USB_MS_TO_HS_INTERVAL(x) (ilog2((x * 1000 / 125)) + 1)
54struct usb_configuration; 56struct usb_configuration;
55 57
56/** 58/**
@@ -117,7 +119,7 @@ struct usb_configuration;
117struct usb_function { 119struct usb_function {
118 const char *name; 120 const char *name;
119 struct usb_gadget_strings **strings; 121 struct usb_gadget_strings **strings;
120 struct usb_descriptor_header **descriptors; 122 struct usb_descriptor_header **fs_descriptors;
121 struct usb_descriptor_header **hs_descriptors; 123 struct usb_descriptor_header **hs_descriptors;
122 struct usb_descriptor_header **ss_descriptors; 124 struct usb_descriptor_header **ss_descriptors;
123 125
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index c9d09f8b7ff..99238b096f7 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -29,6 +29,8 @@
29 * initialization. 29 * initialization.
30 * @port_power_off: set to 1 if the controller needs to be powered down 30 * @port_power_off: set to 1 if the controller needs to be powered down
31 * after initialization. 31 * after initialization.
32 * @no_io_watchdog: set to 1 if the controller does not need the I/O
33 * watchdog to run.
32 * 34 *
33 * These are general configuration options for the EHCI controller. All of 35 * These are general configuration options for the EHCI controller. All of
34 * these options are activating more or less workarounds for some hardware. 36 * these options are activating more or less workarounds for some hardware.
@@ -39,8 +41,7 @@ struct usb_ehci_pdata {
39 unsigned has_synopsys_hc_bug:1; 41 unsigned has_synopsys_hc_bug:1;
40 unsigned big_endian_desc:1; 42 unsigned big_endian_desc:1;
41 unsigned big_endian_mmio:1; 43 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1; 44 unsigned no_io_watchdog:1;
43 unsigned port_power_off:1;
44 45
45 /* Turn on all power and clocks */ 46 /* Turn on all power and clocks */
46 int (*power_on)(struct platform_device *pdev); 47 int (*power_on)(struct platform_device *pdev);
diff --git a/include/linux/usb/ezusb.h b/include/linux/usb/ezusb.h
index fc618d8d1e9..639ee45779f 100644
--- a/include/linux/usb/ezusb.h
+++ b/include/linux/usb/ezusb.h
@@ -1,16 +1,8 @@
1#ifndef __EZUSB_H 1#ifndef __EZUSB_H
2#define __EZUSB_H 2#define __EZUSB_H
3 3
4
5extern int ezusb_writememory(struct usb_device *dev, int address,
6 unsigned char *data, int length, __u8 bRequest);
7
8extern int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit); 4extern int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit);
9extern int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit);
10
11extern int ezusb_fx1_ihex_firmware_download(struct usb_device *dev, 5extern int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
12 const char *firmware_path); 6 const char *firmware_path);
13extern int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
14 const char *firmware_path);
15 7
16#endif /* __EZUSB_H */ 8#endif /* __EZUSB_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 5b6e5088824..0af6569b8cc 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -939,6 +939,13 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
939 kfree(v); 939 kfree(v);
940} 940}
941 941
942struct usb_function;
943int usb_assign_descriptors(struct usb_function *f,
944 struct usb_descriptor_header **fs,
945 struct usb_descriptor_header **hs,
946 struct usb_descriptor_header **ss);
947void usb_free_all_descriptors(struct usb_function *f);
948
942/*-------------------------------------------------------------------------*/ 949/*-------------------------------------------------------------------------*/
943 950
944/* utility to simplify map/unmap of usb_requests to/from DMA */ 951/* utility to simplify map/unmap of usb_requests to/from DMA */
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
index 74e7755168b..012f2b7eb2b 100644
--- a/include/linux/usb/ohci_pdriver.h
+++ b/include/linux/usb/ohci_pdriver.h
@@ -25,6 +25,7 @@
25 * @big_endian_desc: BE descriptors 25 * @big_endian_desc: BE descriptors
26 * @big_endian_mmio: BE registers 26 * @big_endian_mmio: BE registers
27 * @no_big_frame_no: no big endian frame_no shift 27 * @no_big_frame_no: no big endian frame_no shift
28 * @num_ports: number of ports
28 * 29 *
29 * These are general configuration options for the OHCI controller. All of 30 * These are general configuration options for the OHCI controller. All of
30 * these options are activating more or less workarounds for some hardware. 31 * these options are activating more or less workarounds for some hardware.
@@ -33,6 +34,7 @@ struct usb_ohci_pdata {
33 unsigned big_endian_desc:1; 34 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1; 35 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1; 36 unsigned no_big_frame_no:1;
37 unsigned int num_ports;
36 38
37 /* Turn on all power and clocks */ 39 /* Turn on all power and clocks */
38 int (*power_on)(struct platform_device *pdev); 40 int (*power_on)(struct platform_device *pdev);
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 06b5bae35b2..a29ae1eb934 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -10,6 +10,7 @@
10#define __LINUX_USB_PHY_H 10#define __LINUX_USB_PHY_H
11 11
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/usb.h>
13 14
14enum usb_phy_events { 15enum usb_phy_events {
15 USB_EVENT_NONE, /* no events or cable disconnected */ 16 USB_EVENT_NONE, /* no events or cable disconnected */
@@ -99,8 +100,10 @@ struct usb_phy {
99 int suspend); 100 int suspend);
100 101
101 /* notify phy connect status change */ 102 /* notify phy connect status change */
102 int (*notify_connect)(struct usb_phy *x, int port); 103 int (*notify_connect)(struct usb_phy *x,
103 int (*notify_disconnect)(struct usb_phy *x, int port); 104 enum usb_device_speed speed);
105 int (*notify_disconnect)(struct usb_phy *x,
106 enum usb_device_speed speed);
104}; 107};
105 108
106 109
@@ -189,19 +192,19 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
189} 192}
190 193
191static inline int 194static inline int
192usb_phy_notify_connect(struct usb_phy *x, int port) 195usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
193{ 196{
194 if (x->notify_connect) 197 if (x->notify_connect)
195 return x->notify_connect(x, port); 198 return x->notify_connect(x, speed);
196 else 199 else
197 return 0; 200 return 0;
198} 201}
199 202
200static inline int 203static inline int
201usb_phy_notify_disconnect(struct usb_phy *x, int port) 204usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
202{ 205{
203 if (x->notify_disconnect) 206 if (x->notify_disconnect)
204 return x->notify_disconnect(x, port); 207 return x->notify_disconnect(x, speed);
205 else 208 else
206 return 0; 209 return 0;
207} 210}
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index ddbbb7de894..bd45eb7bedc 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -69,6 +69,7 @@ struct usbnet {
69# define EVENT_DEV_ASLEEP 6 69# define EVENT_DEV_ASLEEP 6
70# define EVENT_DEV_OPEN 7 70# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8 71# define EVENT_DEVICE_REPORT_IDLE 8
72# define EVENT_NO_RUNTIME_PM 9
72}; 73};
73 74
74static inline struct usb_driver *driver_of(struct usb_interface *intf) 75static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -163,6 +164,16 @@ extern int usbnet_resume(struct usb_interface *);
163extern void usbnet_disconnect(struct usb_interface *); 164extern void usbnet_disconnect(struct usb_interface *);
164extern void usbnet_device_suggests_idle(struct usbnet *dev); 165extern void usbnet_device_suggests_idle(struct usbnet *dev);
165 166
167extern int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
168 u16 value, u16 index, void *data, u16 size);
169extern int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
170 u16 value, u16 index, const void *data, u16 size);
171extern int usbnet_read_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
172 u16 value, u16 index, void *data, u16 size);
173extern int usbnet_write_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
174 u16 value, u16 index, const void *data, u16 size);
175extern int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
176 u16 value, u16 index, const void *data, u16 size);
166 177
167/* Drivers that reuse some of the standard USB CDC infrastructure 178/* Drivers that reuse some of the standard USB CDC infrastructure
168 * (notably, using multiple interfaces according to the CDC 179 * (notably, using multiple interfaces according to the CDC
@@ -230,4 +241,6 @@ extern void usbnet_set_msglevel(struct net_device *, u32);
230extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); 241extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
231extern int usbnet_nway_reset(struct net_device *net); 242extern int usbnet_nway_reset(struct net_device *net);
232 243
244extern int usbnet_manage_power(struct usbnet *, int);
245
233#endif /* __LINUX_USB_USBNET_H */ 246#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 95142cae446..b9bd2e6c73c 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -25,6 +25,7 @@ struct user_namespace {
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 kuid_t owner; 26 kuid_t owner;
27 kgid_t group; 27 kgid_t group;
28 unsigned int proc_inum;
28}; 29};
29 30
30extern struct user_namespace init_user_ns; 31extern struct user_namespace init_user_ns;
@@ -39,6 +40,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
39} 40}
40 41
41extern int create_user_ns(struct cred *new); 42extern int create_user_ns(struct cred *new);
43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred);
42extern void free_user_ns(struct kref *kref); 44extern void free_user_ns(struct kref *kref);
43 45
44static inline void put_user_ns(struct user_namespace *ns) 46static inline void put_user_ns(struct user_namespace *ns)
@@ -66,6 +68,14 @@ static inline int create_user_ns(struct cred *new)
66 return -EINVAL; 68 return -EINVAL;
67} 69}
68 70
71static inline int unshare_userns(unsigned long unshare_flags,
72 struct cred **new_cred)
73{
74 if (unshare_flags & CLONE_NEWUSER)
75 return -EINVAL;
76 return 0;
77}
78
69static inline void put_user_ns(struct user_namespace *ns) 79static inline void put_user_ns(struct user_namespace *ns)
70{ 80{
71} 81}
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 2b345206722..239e27733d6 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -23,6 +23,7 @@ struct uts_namespace {
23 struct kref kref; 23 struct kref kref;
24 struct new_utsname name; 24 struct new_utsname name;
25 struct user_namespace *user_ns; 25 struct user_namespace *user_ns;
26 unsigned int proc_inum;
26}; 27};
27extern struct uts_namespace init_uts_ns; 28extern struct uts_namespace init_uts_ns;
28 29
@@ -33,7 +34,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
33} 34}
34 35
35extern struct uts_namespace *copy_utsname(unsigned long flags, 36extern struct uts_namespace *copy_utsname(unsigned long flags,
36 struct task_struct *tsk); 37 struct user_namespace *user_ns, struct uts_namespace *old_ns);
37extern void free_uts_ns(struct kref *kref); 38extern void free_uts_ns(struct kref *kref);
38 39
39static inline void put_uts_ns(struct uts_namespace *ns) 40static inline void put_uts_ns(struct uts_namespace *ns)
@@ -50,12 +51,12 @@ static inline void put_uts_ns(struct uts_namespace *ns)
50} 51}
51 52
52static inline struct uts_namespace *copy_utsname(unsigned long flags, 53static inline struct uts_namespace *copy_utsname(unsigned long flags,
53 struct task_struct *tsk) 54 struct user_namespace *user_ns, struct uts_namespace *old_ns)
54{ 55{
55 if (flags & CLONE_NEWUTS) 56 if (flags & CLONE_NEWUTS)
56 return ERR_PTR(-EINVAL); 57 return ERR_PTR(-EINVAL);
57 58
58 return tsk->nsproxy->uts_ns; 59 return old_ns;
59} 60}
60#endif 61#endif
61 62
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
new file mode 100644
index 00000000000..c52215ff424
--- /dev/null
+++ b/include/linux/vexpress.h
@@ -0,0 +1,121 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#ifndef _LINUX_VEXPRESS_H
15#define _LINUX_VEXPRESS_H
16
17#include <linux/device.h>
18
19#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1
21#define VEXPRESS_SITE_DB2 2
22#define VEXPRESS_SITE_MASTER 0xf
23
24#define VEXPRESS_CONFIG_STATUS_DONE 0
25#define VEXPRESS_CONFIG_STATUS_WAIT 1
26
27#define VEXPRESS_GPIO_MMC_CARDIN 0
28#define VEXPRESS_GPIO_MMC_WPROT 1
29#define VEXPRESS_GPIO_FLASH_WPn 2
30
31#define VEXPRESS_RES_FUNC(_site, _func) \
32{ \
33 .start = (_site), \
34 .end = (_func), \
35 .flags = IORESOURCE_BUS, \
36}
37
38/* Config bridge API */
39
40/**
41 * struct vexpress_config_bridge_info - description of the platform
42 * configuration infrastructure bridge.
43 *
44 * @name: Bridge name
45 *
46 * @func_get: Obtains pointer to a configuration function for a given
47 * device or a Device Tree node, to be used with @func_put
48 * and @func_exec. The node pointer should take precedence
49 * over device pointer when both are passed.
50 *
51 * @func_put: Tells the bridge that the function will not be used any
52 * more, so all allocated resources can be released.
53 *
54 * @func_exec: Executes a configuration function read or write operation.
55 * The offset selects a 32 bit word of the value accessed.
56 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
57 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
58 * will be completed in some time or negative value in case
59 * of error.
60 */
61struct vexpress_config_bridge_info {
62 const char *name;
63 void *(*func_get)(struct device *dev, struct device_node *node);
64 void (*func_put)(void *func);
65 int (*func_exec)(void *func, int offset, bool write, u32 *data);
66};
67
68struct vexpress_config_bridge;
69
70struct vexpress_config_bridge *vexpress_config_bridge_register(
71 struct device_node *node,
72 struct vexpress_config_bridge_info *info);
73void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
74
75void vexpress_config_complete(struct vexpress_config_bridge *bridge,
76 int status);
77
78/* Config function API */
79
80struct vexpress_config_func;
81
82struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
83 struct device_node *node);
84#define vexpress_config_func_get_by_dev(dev) \
85 __vexpress_config_func_get(dev, NULL)
86#define vexpress_config_func_get_by_node(node) \
87 __vexpress_config_func_get(NULL, node)
88void vexpress_config_func_put(struct vexpress_config_func *func);
89
90/* Both may sleep! */
91int vexpress_config_read(struct vexpress_config_func *func, int offset,
92 u32 *data);
93int vexpress_config_write(struct vexpress_config_func *func, int offset,
94 u32 data);
95
96/* Platform control */
97
98u32 vexpress_get_procid(int site);
99u32 vexpress_get_hbi(int site);
100void *vexpress_get_24mhz_clock_base(void);
101void vexpress_flags_set(u32 data);
102
103#define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
104#define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
105unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
106
107void vexpress_sysreg_early_init(void __iomem *base);
108void vexpress_sysreg_of_early_init(void);
109
110void vexpress_power_off(void);
111void vexpress_restart(char str, const char *cmd);
112
113/* Clocks */
114
115struct clk *vexpress_osc_setup(struct device *dev);
116void vexpress_osc_of_setup(struct device_node *node);
117
118void vexpress_clk_init(void __iomem *sp810_base);
119void vexpress_clk_of_init(void);
120
121#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 0ee42d9acdc..2c02f3a8d2b 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -78,7 +78,7 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev,
78 * This function acquires VGA resources for the given 78 * This function acquires VGA resources for the given
79 * card and mark those resources locked. If the resource requested 79 * card and mark those resources locked. If the resource requested
80 * are "normal" (and not legacy) resources, the arbiter will first check 80 * are "normal" (and not legacy) resources, the arbiter will first check
81 * wether the card is doing legacy decoding for that type of resource. If 81 * whether the card is doing legacy decoding for that type of resource. If
82 * yes, the lock is "converted" into a legacy resource lock. 82 * yes, the lock is "converted" into a legacy resource lock.
83 * The arbiter will first look for all VGA cards that might conflict 83 * The arbiter will first look for all VGA cards that might conflict
84 * and disable their IOs and/or Memory access, including VGA forwarding 84 * and disable their IOs and/or Memory access, including VGA forwarding
@@ -89,7 +89,7 @@ extern void vga_set_legacy_decoding(struct pci_dev *pdev,
89 * This function will block if some conflicting card is already locking 89 * This function will block if some conflicting card is already locking
90 * one of the required resources (or any resource on a different bus 90 * one of the required resources (or any resource on a different bus
91 * segment, since P2P bridges don't differenciate VGA memory and IO 91 * segment, since P2P bridges don't differenciate VGA memory and IO
92 * afaik). You can indicate wether this blocking should be interruptible 92 * afaik). You can indicate whether this blocking should be interruptible
93 * by a signal (for userland interface) or not. 93 * by a signal (for userland interface) or not.
94 * Must not be called at interrupt time or in atomic context. 94 * Must not be called at interrupt time or in atomic context.
95 * If the card already owns the resources, the function succeeds. 95 * If the card already owns the resources, the function succeeds.
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 533b1157f22..cf8adb1f5b2 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -16,12 +16,20 @@
16 * @name: the name of this virtqueue (mainly for debugging) 16 * @name: the name of this virtqueue (mainly for debugging)
17 * @vdev: the virtio device this queue was created for. 17 * @vdev: the virtio device this queue was created for.
18 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
19 * @index: the zero-based ordinal number for this queue.
20 * @num_free: number of elements we expect to be able to fit.
21 *
22 * A note on @num_free: with indirect buffers, each buffer needs one
23 * element in the queue, otherwise a buffer will need one element per
24 * sg element.
19 */ 25 */
20struct virtqueue { 26struct virtqueue {
21 struct list_head list; 27 struct list_head list;
22 void (*callback)(struct virtqueue *vq); 28 void (*callback)(struct virtqueue *vq);
23 const char *name; 29 const char *name;
24 struct virtio_device *vdev; 30 struct virtio_device *vdev;
31 unsigned int index;
32 unsigned int num_free;
25 void *priv; 33 void *priv;
26}; 34};
27 35
@@ -50,7 +58,11 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 58
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 59unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 60
53int virtqueue_get_queue_index(struct virtqueue *vq); 61/* FIXME: Obsolete accessor, but required for virtio_net merge. */
62static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq)
63{
64 return vq->index;
65}
54 66
55/** 67/**
56 * virtio_device - representation of a device using virtio 68 * virtio_device - representation of a device using virtio
@@ -73,7 +85,11 @@ struct virtio_device {
73 void *priv; 85 void *priv;
74}; 86};
75 87
76#define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) 88static inline struct virtio_device *dev_to_virtio(struct device *_dev)
89{
90 return container_of(_dev, struct virtio_device, dev);
91}
92
77int register_virtio_device(struct virtio_device *dev); 93int register_virtio_device(struct virtio_device *dev);
78void unregister_virtio_device(struct virtio_device *dev); 94void unregister_virtio_device(struct virtio_device *dev);
79 95
@@ -103,6 +119,11 @@ struct virtio_driver {
103#endif 119#endif
104}; 120};
105 121
122static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
123{
124 return container_of(drv, struct virtio_driver, driver);
125}
126
106int register_virtio_driver(struct virtio_driver *drv); 127int register_virtio_driver(struct virtio_driver *drv);
107void unregister_virtio_driver(struct virtio_driver *drv); 128void unregister_virtio_driver(struct virtio_driver *drv);
108#endif /* _LINUX_VIRTIO_H */ 129#endif /* _LINUX_VIRTIO_H */
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
index d6b4440387b..4195b97a3de 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/linux/virtio_scsi.h
@@ -1,7 +1,31 @@
1/*
2 * This header is BSD licensed so anyone can use the definitions to implement
3 * compatible drivers/servers.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
1#ifndef _LINUX_VIRTIO_SCSI_H 27#ifndef _LINUX_VIRTIO_SCSI_H
2#define _LINUX_VIRTIO_SCSI_H 28#define _LINUX_VIRTIO_SCSI_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5 29
6#define VIRTIO_SCSI_CDB_SIZE 32 30#define VIRTIO_SCSI_CDB_SIZE 32
7#define VIRTIO_SCSI_SENSE_SIZE 96 31#define VIRTIO_SCSI_SENSE_SIZE 96
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 3d311459437..fce0a2799d4 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -38,8 +38,18 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 KSWAPD_SKIP_CONGESTION_WAIT, 39 KSWAPD_SKIP_CONGESTION_WAIT,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 40 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_NUMA_BALANCING
42 NUMA_PTE_UPDATES,
43 NUMA_HINT_FAULTS,
44 NUMA_HINT_FAULTS_LOCAL,
45 NUMA_PAGE_MIGRATE,
46#endif
47#ifdef CONFIG_MIGRATION
48 PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
49#endif
41#ifdef CONFIG_COMPACTION 50#ifdef CONFIG_COMPACTION
42 COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED, 51 COMPACTMIGRATE_SCANNED, COMPACTFREE_SCANNED,
52 COMPACTISOLATED,
43 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS, 53 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
44#endif 54#endif
45#ifdef CONFIG_HUGETLB_PAGE 55#ifdef CONFIG_HUGETLB_PAGE
@@ -58,6 +68,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
58 THP_COLLAPSE_ALLOC, 68 THP_COLLAPSE_ALLOC,
59 THP_COLLAPSE_ALLOC_FAILED, 69 THP_COLLAPSE_ALLOC_FAILED,
60 THP_SPLIT, 70 THP_SPLIT,
71 THP_ZERO_PAGE_ALLOC,
72 THP_ZERO_PAGE_ALLOC_FAILED,
61#endif 73#endif
62 NR_VM_EVENT_ITEMS 74 NR_VM_EVENT_ITEMS
63}; 75};
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 92a86b2cce3..a13291f7da8 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -80,6 +80,14 @@ static inline void vm_events_fold_cpu(int cpu)
80 80
81#endif /* CONFIG_VM_EVENT_COUNTERS */ 81#endif /* CONFIG_VM_EVENT_COUNTERS */
82 82
83#ifdef CONFIG_NUMA_BALANCING
84#define count_vm_numa_event(x) count_vm_event(x)
85#define count_vm_numa_events(x, y) count_vm_events(x, y)
86#else
87#define count_vm_numa_event(x) do {} while (0)
88#define count_vm_numa_events(x, y) do {} while (0)
89#endif /* CONFIG_NUMA_BALANCING */
90
83#define __count_zone_vm_events(item, zone, delta) \ 91#define __count_zone_vm_events(item, zone, delta) \
84 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \ 92 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
85 zone_idx(zone), delta) 93 zone_idx(zone), delta)
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
new file mode 100644
index 00000000000..ae30ab58431
--- /dev/null
+++ b/include/linux/vtime.h
@@ -0,0 +1,48 @@
1#ifndef _LINUX_KERNEL_VTIME_H
2#define _LINUX_KERNEL_VTIME_H
3
4struct task_struct;
5
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7extern void vtime_task_switch(struct task_struct *prev);
8extern void vtime_account_system(struct task_struct *tsk);
9extern void vtime_account_system_irqsafe(struct task_struct *tsk);
10extern void vtime_account_idle(struct task_struct *tsk);
11extern void vtime_account_user(struct task_struct *tsk);
12extern void vtime_account(struct task_struct *tsk);
13#else
14static inline void vtime_task_switch(struct task_struct *prev) { }
15static inline void vtime_account_system(struct task_struct *tsk) { }
16static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { }
17static inline void vtime_account(struct task_struct *tsk) { }
18#endif
19
20#ifdef CONFIG_IRQ_TIME_ACCOUNTING
21extern void irqtime_account_irq(struct task_struct *tsk);
22#else
23static inline void irqtime_account_irq(struct task_struct *tsk) { }
24#endif
25
26static inline void vtime_account_irq_enter(struct task_struct *tsk)
27{
28 /*
29 * Hardirq can interrupt idle task anytime. So we need vtime_account()
30 * that performs the idle check in CONFIG_VIRT_CPU_ACCOUNTING.
31 * Softirq can also interrupt idle task directly if it calls
32 * local_bh_enable(). Such case probably don't exist but we never know.
33 * Ksoftirqd is not concerned because idle time is flushed on context
34 * switch. Softirqs in the end of hardirqs are also not a problem because
35 * the idle time is flushed on hardirq time already.
36 */
37 vtime_account(tsk);
38 irqtime_account_irq(tsk);
39}
40
41static inline void vtime_account_irq_exit(struct task_struct *tsk)
42{
43 /* On hard|softirq exit we always account to hard|softirq cputime */
44 vtime_account_system(tsk);
45 irqtime_account_irq(tsk);
46}
47
48#endif /* _LINUX_KERNEL_VTIME_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 168dfe122dd..7cb64d4b499 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -550,6 +550,170 @@ do { \
550 __ret; \ 550 __ret; \
551}) 551})
552 552
553
554#define __wait_event_lock_irq(wq, condition, lock, cmd) \
555do { \
556 DEFINE_WAIT(__wait); \
557 \
558 for (;;) { \
559 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
560 if (condition) \
561 break; \
562 spin_unlock_irq(&lock); \
563 cmd; \
564 schedule(); \
565 spin_lock_irq(&lock); \
566 } \
567 finish_wait(&wq, &__wait); \
568} while (0)
569
570/**
571 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
572 * condition is checked under the lock. This
573 * is expected to be called with the lock
574 * taken.
575 * @wq: the waitqueue to wait on
576 * @condition: a C expression for the event to wait for
577 * @lock: a locked spinlock_t, which will be released before cmd
578 * and schedule() and reacquired afterwards.
579 * @cmd: a command which is invoked outside the critical section before
580 * sleep
581 *
582 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
583 * @condition evaluates to true. The @condition is checked each time
584 * the waitqueue @wq is woken up.
585 *
586 * wake_up() has to be called after changing any variable that could
587 * change the result of the wait condition.
588 *
589 * This is supposed to be called while holding the lock. The lock is
590 * dropped before invoking the cmd and going to sleep and is reacquired
591 * afterwards.
592 */
593#define wait_event_lock_irq_cmd(wq, condition, lock, cmd) \
594do { \
595 if (condition) \
596 break; \
597 __wait_event_lock_irq(wq, condition, lock, cmd); \
598} while (0)
599
600/**
601 * wait_event_lock_irq - sleep until a condition gets true. The
602 * condition is checked under the lock. This
603 * is expected to be called with the lock
604 * taken.
605 * @wq: the waitqueue to wait on
606 * @condition: a C expression for the event to wait for
607 * @lock: a locked spinlock_t, which will be released before schedule()
608 * and reacquired afterwards.
609 *
610 * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
611 * @condition evaluates to true. The @condition is checked each time
612 * the waitqueue @wq is woken up.
613 *
614 * wake_up() has to be called after changing any variable that could
615 * change the result of the wait condition.
616 *
617 * This is supposed to be called while holding the lock. The lock is
618 * dropped before going to sleep and is reacquired afterwards.
619 */
620#define wait_event_lock_irq(wq, condition, lock) \
621do { \
622 if (condition) \
623 break; \
624 __wait_event_lock_irq(wq, condition, lock, ); \
625} while (0)
626
627
628#define __wait_event_interruptible_lock_irq(wq, condition, \
629 lock, ret, cmd) \
630do { \
631 DEFINE_WAIT(__wait); \
632 \
633 for (;;) { \
634 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
635 if (condition) \
636 break; \
637 if (signal_pending(current)) { \
638 ret = -ERESTARTSYS; \
639 break; \
640 } \
641 spin_unlock_irq(&lock); \
642 cmd; \
643 schedule(); \
644 spin_lock_irq(&lock); \
645 } \
646 finish_wait(&wq, &__wait); \
647} while (0)
648
649/**
650 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
651 * The condition is checked under the lock. This is expected to
652 * be called with the lock taken.
653 * @wq: the waitqueue to wait on
654 * @condition: a C expression for the event to wait for
655 * @lock: a locked spinlock_t, which will be released before cmd and
656 * schedule() and reacquired afterwards.
657 * @cmd: a command which is invoked outside the critical section before
658 * sleep
659 *
660 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
661 * @condition evaluates to true or a signal is received. The @condition is
662 * checked each time the waitqueue @wq is woken up.
663 *
664 * wake_up() has to be called after changing any variable that could
665 * change the result of the wait condition.
666 *
667 * This is supposed to be called while holding the lock. The lock is
668 * dropped before invoking the cmd and going to sleep and is reacquired
669 * afterwards.
670 *
671 * The macro will return -ERESTARTSYS if it was interrupted by a signal
672 * and 0 if @condition evaluated to true.
673 */
674#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
675({ \
676 int __ret = 0; \
677 \
678 if (!(condition)) \
679 __wait_event_interruptible_lock_irq(wq, condition, \
680 lock, __ret, cmd); \
681 __ret; \
682})
683
684/**
685 * wait_event_interruptible_lock_irq - sleep until a condition gets true.
686 * The condition is checked under the lock. This is expected
687 * to be called with the lock taken.
688 * @wq: the waitqueue to wait on
689 * @condition: a C expression for the event to wait for
690 * @lock: a locked spinlock_t, which will be released before schedule()
691 * and reacquired afterwards.
692 *
693 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
694 * @condition evaluates to true or signal is received. The @condition is
695 * checked each time the waitqueue @wq is woken up.
696 *
697 * wake_up() has to be called after changing any variable that could
698 * change the result of the wait condition.
699 *
700 * This is supposed to be called while holding the lock. The lock is
701 * dropped before going to sleep and is reacquired afterwards.
702 *
703 * The macro will return -ERESTARTSYS if it was interrupted by a signal
704 * and 0 if @condition evaluated to true.
705 */
706#define wait_event_interruptible_lock_irq(wq, condition, lock) \
707({ \
708 int __ret = 0; \
709 \
710 if (!(condition)) \
711 __wait_event_interruptible_lock_irq(wq, condition, \
712 lock, __ret, ); \
713 __ret; \
714})
715
716
553/* 717/*
554 * These are the old interfaces to sleep waiting for an event. 718 * These are the old interfaces to sleep waiting for an event.
555 * They are racy. DO NOT use them, use the wait_event* interfaces above. 719 * They are racy. DO NOT use them, use the wait_event* interfaces above.
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index b7f45d48b2d..87490ac4bd8 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -105,7 +105,7 @@ struct watchdog_device {
105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0 105#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
106#endif 106#endif
107 107
108/* Use the following function to check wether or not the watchdog is active */ 108/* Use the following function to check whether or not the watchdog is active */
109static inline bool watchdog_active(struct watchdog_device *wdd) 109static inline bool watchdog_active(struct watchdog_device *wdd)
110{ 110{
111 return test_bit(WDOG_ACTIVE, &wdd->status); 111 return test_bit(WDOG_ACTIVE, &wdd->status);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 50c3e8fa06a..b82a83aba31 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -161,14 +161,7 @@ void __bdi_update_bandwidth(struct backing_dev_info *bdi,
161 unsigned long start_time); 161 unsigned long start_time);
162 162
163void page_writeback_init(void); 163void page_writeback_init(void);
164void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 164void balance_dirty_pages_ratelimited(struct address_space *mapping);
165 unsigned long nr_pages_dirtied);
166
167static inline void
168balance_dirty_pages_ratelimited(struct address_space *mapping)
169{
170 balance_dirty_pages_ratelimited_nr(mapping, 1);
171}
172 165
173typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc, 166typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
174 void *data); 167 void *data);