aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h25
-rw-r--r--include/linux/acpi_gpio.h4
-rw-r--r--include/linux/aer.h4
-rw-r--r--include/linux/amba/sp810.h64
-rw-r--r--include/linux/async.h10
-rw-r--r--include/linux/ata.h8
-rw-r--r--include/linux/ata_platform.h12
-rw-r--r--include/linux/audit.h4
-rw-r--r--include/linux/backing-dev.h6
-rw-r--r--include/linux/bcm2835_timer.h22
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h5
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h2
-rw-r--r--include/linux/bcma/bcma_driver_mips.h11
-rw-r--r--include/linux/bcma/bcma_driver_pci.h4
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/bma150.h16
-rw-r--r--include/linux/bootmem.h6
-rw-r--r--include/linux/btrfs.h6
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/bug.h47
-rw-r--r--include/linux/can/dev.h11
-rw-r--r--include/linux/can/led.h51
-rw-r--r--include/linux/can/skb.h45
-rw-r--r--include/linux/ceph/ceph_features.h38
-rw-r--r--include/linux/ceph/ceph_fs.h32
-rw-r--r--include/linux/ceph/decode.h29
-rw-r--r--include/linux/ceph/libceph.h16
-rw-r--r--include/linux/ceph/mdsmap.h4
-rw-r--r--include/linux/ceph/messenger.h2
-rw-r--r--include/linux/ceph/osd_client.h74
-rw-r--r--include/linux/ceph/osdmap.h30
-rw-r--r--include/linux/ceph/rados.h158
-rw-r--r--include/linux/cgroup.h3
-rw-r--r--include/linux/clk-provider.h6
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clk/tegra.h127
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/clocksource.h11
-rw-r--r--include/linux/coda_psdev.h2
-rw-r--r--include/linux/compaction.h9
-rw-r--r--include/linux/compat.h53
-rw-r--r--include/linux/compiler-gcc.h3
-rw-r--r--include/linux/compiler-gcc3.h8
-rw-r--r--include/linux/compiler-gcc4.h36
-rw-r--r--include/linux/compiler.h32
-rw-r--r--include/linux/completion.h3
-rw-r--r--include/linux/console.h7
-rw-r--r--include/linux/context_tracking.h28
-rw-r--r--include/linux/cpu_rmap.h13
-rw-r--r--include/linux/cpufreq.h34
-rw-r--r--include/linux/cpuidle.h24
-rw-r--r--include/linux/cred.h1
-rw-r--r--include/linux/crush/crush.h2
-rw-r--r--include/linux/cyclomx.h77
-rw-r--r--include/linux/cycx_drv.h64
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/debug_locks.h4
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/device-mapper.h49
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/dm-kcopyd.h25
-rw-r--r--include/linux/dma-buf.h6
-rw-r--r--include/linux/dw_apb_timer.h2
-rw-r--r--include/linux/dynamic_debug.h11
-rw-r--r--include/linux/edac.h79
-rw-r--r--include/linux/efi.h27
-rw-r--r--include/linux/elevator.h10
-rw-r--r--include/linux/elf.h4
-rw-r--r--include/linux/etherdevice.h4
-rw-r--r--include/linux/eventfd.h2
-rw-r--r--include/linux/extcon/extcon-gpio.h (renamed from include/linux/extcon/extcon_gpio.h)0
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/firmware-map.h6
-rw-r--r--include/linux/freezer.h8
-rw-r--r--include/linux/fs.h16
-rw-r--r--include/linux/fsl/bestcomm/ata.h30
-rw-r--r--include/linux/fsl/bestcomm/bestcomm.h213
-rw-r--r--include/linux/fsl/bestcomm/bestcomm_priv.h350
-rw-r--r--include/linux/fsl/bestcomm/fec.h61
-rw-r--r--include/linux/fsl/bestcomm/gen_bd.h53
-rw-r--r--include/linux/fsl/bestcomm/sram.h54
-rw-r--r--include/linux/fsnotify.h2
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--include/linux/ftrace_event.h6
-rw-r--r--include/linux/genhd.h10
-rw-r--r--include/linux/gpio.h28
-rw-r--r--include/linux/hardirq.h8
-rw-r--r--include/linux/hashtable.h40
-rw-r--r--include/linux/hdmi.h231
-rw-r--r--include/linux/hid-sensor-hub.h38
-rw-r--r--include/linux/hid-sensor-ids.h9
-rw-r--r--include/linux/hid.h17
-rw-r--r--include/linux/highmem.h6
-rw-r--r--include/linux/hsi/hsi.h6
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/hwmon.h12
-rw-r--r--include/linux/hyperv.h248
-rw-r--r--include/linux/i2c/twl.h84
-rw-r--r--include/linux/idr.h172
-rw-r--r--include/linux/ieee80211.h155
-rw-r--r--include/linux/if_macvlan.h6
-rw-r--r--include/linux/if_team.h7
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/iio/buffer.h13
-rw-r--r--include/linux/iio/common/st_sensors.h280
-rw-r--r--include/linux/iio/common/st_sensors_i2c.h20
-rw-r--r--include/linux/iio/common/st_sensors_spi.h20
-rw-r--r--include/linux/iio/consumer.h14
-rw-r--r--include/linux/iio/driver.h9
-rw-r--r--include/linux/iio/gyro/itg3200.h154
-rw-r--r--include/linux/iio/trigger.h5
-rw-r--r--include/linux/in6.h13
-rw-r--r--include/linux/inetdevice.h6
-rw-r--r--include/linux/init.h21
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input/adxl34x.h2
-rw-r--r--include/linux/input/tegra_kbc.h62
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/iommu.h30
-rw-r--r--include/linux/ipc_namespace.h1
-rw-r--r--include/linux/ipmi.h4
-rw-r--r--include/linux/ipv6.h10
-rw-r--r--include/linux/irq.h8
-rw-r--r--include/linux/irq_work.h22
-rw-r--r--include/linux/irqchip.h16
-rw-r--r--include/linux/irqchip/arm-gic.h79
-rw-r--r--include/linux/irqchip/arm-vic.h36
-rw-r--r--include/linux/jbd2.h44
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kexec.h3
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kprobes.h12
-rw-r--r--include/linux/ksm.h18
-rw-r--r--include/linux/kvm_host.h85
-rw-r--r--include/linux/leds-lp5521.h73
-rw-r--r--include/linux/leds-lp5523.h49
-rw-r--r--include/linux/leds_pwm.h2
-rw-r--r--include/linux/libata.h7
-rw-r--r--include/linux/libps2.h2
-rw-r--r--include/linux/list.h49
-rw-r--r--include/linux/lockd/lockd.h5
-rw-r--r--include/linux/lockdep.h9
-rw-r--r--include/linux/lzo.h15
-rw-r--r--include/linux/mailbox.h17
-rw-r--r--include/linux/memblock.h1
-rw-r--r--include/linux/memcontrol.h9
-rw-r--r--include/linux/memory_hotplug.h20
-rw-r--r--include/linux/mfd/88pm80x.h2
-rw-r--r--include/linux/mfd/abx500.h19
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h66
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h16
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h5
-rw-r--r--include/linux/mfd/abx500/ab8500.h291
-rw-r--r--include/linux/mfd/abx500/ux500_chargalg.h5
-rw-r--r--include/linux/mfd/arizona/core.h4
-rw-r--r--include/linux/mfd/arizona/pdata.h42
-rw-r--r--include/linux/mfd/arizona/registers.h72
-rw-r--r--include/linux/mfd/da9052/da9052.h66
-rw-r--r--include/linux/mfd/da9052/reg.h3
-rw-r--r--include/linux/mfd/db8500-prcmu.h20
-rw-r--r--include/linux/mfd/dbx500-prcmu.h139
-rw-r--r--include/linux/mfd/lp8788.h24
-rw-r--r--include/linux/mfd/max77693-private.h86
-rw-r--r--include/linux/mfd/max77693.h9
-rw-r--r--include/linux/mfd/max8925.h3
-rw-r--r--include/linux/mfd/max8997-private.h64
-rw-r--r--include/linux/mfd/max8997.h25
-rw-r--r--include/linux/mfd/palmas.h52
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h34
-rw-r--r--include/linux/mfd/samsung/core.h11
-rw-r--r--include/linux/mfd/tmio.h18
-rw-r--r--include/linux/micrel_phy.h9
-rw-r--r--include/linux/migrate.h14
-rw-r--r--include/linux/mlx4/device.h30
-rw-r--r--include/linux/mlx4/qp.h19
-rw-r--r--include/linux/mm.h162
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mman.h4
-rw-r--r--include/linux/mmc/card.h22
-rw-r--r--include/linux/mmc/core.h7
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h61
-rw-r--r--include/linux/mmc/mmc.h15
-rw-r--r--include/linux/mmc/sdhci.h1
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h2
-rw-r--r--include/linux/mmu_notifier.h2
-rw-r--r--include/linux/mmzone.h66
-rw-r--r--include/linux/mod_devicetable.h58
-rw-r--r--include/linux/module.h14
-rw-r--r--include/linux/mroute.h2
-rw-r--r--include/linux/mroute6.h2
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/mtd/map.h9
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/netdev_features.h3
-rw-r--r--include/linux/netdevice.h116
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h3
-rw-r--r--include/linux/netfilter/nfnetlink.h4
-rw-r--r--include/linux/netpoll.h28
-rw-r--r--include/linux/nfs4.h6
-rw-r--r--include/linux/nfs_idmap.h9
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/ntb.h83
-rw-r--r--include/linux/of.h13
-rw-r--r--include/linux/of_gpio.h40
-rw-r--r--include/linux/of_serial.h17
-rw-r--r--include/linux/opp.h18
-rw-r--r--include/linux/page-flags-layout.h88
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/page-isolation.h19
-rw-r--r--include/linux/pagemap.h1
-rw-r--r--include/linux/pci.h22
-rw-r--r--include/linux/pci_ids.h27
-rw-r--r--include/linux/percpu_counter.h2
-rw-r--r--include/linux/perf_event.h20
-rw-r--r--include/linux/phy.h6
-rw-r--r--include/linux/pid.h3
-rw-r--r--include/linux/pinctrl/devinfo.h45
-rw-r--r--include/linux/pinctrl/pinconf-generic.h16
-rw-r--r--include/linux/pinctrl/pinctrl.h1
-rw-r--r--include/linux/platform_data/cpsw.h4
-rw-r--r--include/linux/platform_data/dma-coh901318.h72
-rw-r--r--include/linux/platform_data/elm.h54
-rw-r--r--include/linux/platform_data/exynos_thermal.h3
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h2
-rw-r--r--include/linux/platform_data/imx-iram.h41
-rw-r--r--include/linux/platform_data/invensense_mpu6050.h31
-rw-r--r--include/linux/platform_data/leds-lp55xx.h87
-rw-r--r--include/linux/platform_data/lp855x.h19
-rw-r--r--include/linux/platform_data/lp8755.h71
-rw-r--r--include/linux/platform_data/max6697.h36
-rw-r--r--include/linux/platform_data/microread.h35
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/mmc-sdhci-tegra.h28
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h4
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h3
-rw-r--r--include/linux/platform_data/s3c-hsotg.h2
-rw-r--r--include/linux/platform_data/samsung-usbphy.h27
-rw-r--r--include/linux/platform_data/serial-sccnxp.h (renamed from include/linux/platform_data/sccnxp.h)6
-rw-r--r--include/linux/platform_data/sh_ipmmu.h18
-rw-r--r--include/linux/platform_data/spi-omap2-mcspi.h3
-rw-r--r--include/linux/platform_data/tsl2563.h8
-rw-r--r--include/linux/platform_data/usb-omap.h9
-rw-r--r--include/linux/platform_data/usb3503.h19
-rw-r--r--include/linux/platform_data/ux500_wdt.h19
-rw-r--r--include/linux/platform_device.h18
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm2301_charger.h61
-rw-r--r--include/linux/pm_runtime.h10
-rw-r--r--include/linux/power/bq2415x_charger.h3
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/pps_kernel.h17
-rw-r--r--include/linux/printk.h38
-rw-r--r--include/linux/proc_fs.h20
-rw-r--r--include/linux/profile.h13
-rw-r--r--include/linux/pstore.h6
-rw-r--r--include/linux/pstore_ram.h5
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/pwm.h30
-rw-r--r--include/linux/pxa2xx_ssp.h18
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/rbtree_augmented.h14
-rw-r--r--include/linux/rculist.h56
-rw-r--r--include/linux/rcupdate.h15
-rw-r--r--include/linux/regmap.h97
-rw-r--r--include/linux/regulator/driver.h6
-rw-r--r--include/linux/ring_buffer.h1
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/rwsem.h9
-rw-r--r--include/linux/scatterlist.h41
-rw-r--r--include/linux/sched.h240
-rw-r--r--include/linux/sched/rt.h64
-rw-r--r--include/linux/sched/sysctl.h104
-rw-r--r--include/linux/security.h59
-rw-r--r--include/linux/seqlock.h193
-rw-r--r--include/linux/serial_8250.h4
-rw-r--r--include/linux/serial_core.h26
-rw-r--r--include/linux/sh_pfc.h236
-rw-r--r--include/linux/signal.h52
-rw-r--r--include/linux/skbuff.h61
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/linux/smpboot.h5
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/pxa2xx_spi.h108
-rw-r--r--include/linux/spi/spi.h49
-rw-r--r--include/linux/spi/spi_gpio.h4
-rw-r--r--include/linux/srcu.h26
-rw-r--r--include/linux/ssb/ssb_driver_gige.h23
-rw-r--r--include/linux/ssb/ssb_driver_mips.h5
-rw-r--r--include/linux/sunrpc/addr.h170
-rw-r--r--include/linux/sunrpc/auth.h7
-rw-r--r--include/linux/sunrpc/cache.h10
-rw-r--r--include/linux/sunrpc/clnt.h153
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/sunrpc/svcauth.h4
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/sunrpc/xprt.h6
-rw-r--r--include/linux/sunserialcore.h4
-rw-r--r--include/linux/sunxi_timer.h2
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/swap.h49
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h25
-rw-r--r--include/linux/sysfs.h16
-rw-r--r--include/linux/tcp.h4
-rw-r--r--include/linux/tegra-soc.h22
-rw-r--r--include/linux/thermal.h10
-rw-r--r--include/linux/tick.h17
-rw-r--r--include/linux/time.h17
-rw-r--r--include/linux/tsacct_kern.h3
-rw-r--r--include/linux/tty.h50
-rw-r--r--include/linux/tty_driver.h1
-rw-r--r--include/linux/tty_flip.h28
-rw-r--r--include/linux/tty_ldisc.h11
-rw-r--r--include/linux/uprobes.h23
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/usb/composite.h75
-rw-r--r--include/linux/usb/dwc3-omap.h30
-rw-r--r--include/linux/usb/gadget.h13
-rw-r--r--include/linux/usb/hcd.h3
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/omap_control_usb.h92
-rw-r--r--include/linux/usb/omap_usb.h27
-rw-r--r--include/linux/usb/phy.h43
-rw-r--r--include/linux/usb/samsung_usb_phy.h16
-rw-r--r--include/linux/usb/tegra_usb_phy.h16
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/user_namespace.h10
-rw-r--r--include/linux/vexpress.h8
-rw-r--r--include/linux/virtio.h11
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmstat.h2
-rw-r--r--include/linux/vmw_vmci_api.h82
-rw-r--r--include/linux/vmw_vmci_defs.h880
-rw-r--r--include/linux/vt_kern.h3
-rw-r--r--include/linux/vtime.h59
-rw-r--r--include/linux/wanrouter.h127
-rw-r--r--include/linux/wl12xx.h16
-rw-r--r--include/linux/workqueue.h35
-rw-r--r--include/linux/writeback.h6
349 files changed, 8560 insertions, 2968 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3994d7790b23..bcbdd7484e58 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -74,9 +74,10 @@ enum acpi_address_range_id {
74 74
75/* Table Handlers */ 75/* Table Handlers */
76 76
77typedef int (*acpi_table_handler) (struct acpi_table_header *table); 77typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
78 78
79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header,
80 const unsigned long end);
80 81
81#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE 82#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
82void acpi_initrd_override(void *data, size_t size); 83void acpi_initrd_override(void *data, size_t size);
@@ -95,10 +96,14 @@ int acpi_mps_check (void);
95int acpi_numa_init (void); 96int acpi_numa_init (void);
96 97
97int acpi_table_init (void); 98int acpi_table_init (void);
98int acpi_table_parse (char *id, acpi_table_handler handler); 99int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
99int __init acpi_table_parse_entries(char *id, unsigned long table_size, 100int __init acpi_table_parse_entries(char *id, unsigned long table_size,
100 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); 101 int entry_id,
101int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries); 102 acpi_tbl_entry_handler handler,
103 unsigned int max_entries);
104int acpi_table_parse_madt(enum acpi_madt_type id,
105 acpi_tbl_entry_handler handler,
106 unsigned int max_entries);
102int acpi_parse_mcfg (struct acpi_table_header *header); 107int acpi_parse_mcfg (struct acpi_table_header *header);
103void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); 108void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
104 109
@@ -358,8 +363,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
358#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ 363#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
359 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 364 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
360 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \ 365 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
361 (defined(CONFIG_ACPI_CONTAINER) || \ 366 defined(CONFIG_ACPI_CONTAINER)
362 defined(CONFIG_ACPI_CONTAINER_MODULE))
363#define ACPI_HOTPLUG_OST 367#define ACPI_HOTPLUG_OST
364#endif 368#endif
365 369
@@ -511,7 +515,7 @@ static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
511static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } 515static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
512#endif 516#endif
513 517
514#ifdef CONFIG_ACPI_SLEEP 518#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
515int acpi_dev_suspend_late(struct device *dev); 519int acpi_dev_suspend_late(struct device *dev);
516int acpi_dev_resume_early(struct device *dev); 520int acpi_dev_resume_early(struct device *dev);
517int acpi_subsys_prepare(struct device *dev); 521int acpi_subsys_prepare(struct device *dev);
@@ -526,9 +530,14 @@ static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
526#endif 530#endif
527 531
528#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 532#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
533struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
529int acpi_dev_pm_attach(struct device *dev, bool power_on); 534int acpi_dev_pm_attach(struct device *dev, bool power_on);
530void acpi_dev_pm_detach(struct device *dev, bool power_off); 535void acpi_dev_pm_detach(struct device *dev, bool power_off);
531#else 536#else
537static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
538{
539 return NULL;
540}
532static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) 541static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
533{ 542{
534 return -ENODEV; 543 return -ENODEV;
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
index 91615a389b65..b76ebd08ff8e 100644
--- a/include/linux/acpi_gpio.h
+++ b/include/linux/acpi_gpio.h
@@ -2,10 +2,12 @@
2#define _LINUX_ACPI_GPIO_H_ 2#define _LINUX_ACPI_GPIO_H_
3 3
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/gpio.h>
5 6
6#ifdef CONFIG_GPIO_ACPI 7#ifdef CONFIG_GPIO_ACPI
7 8
8int acpi_get_gpio(char *path, int pin); 9int acpi_get_gpio(char *path, int pin);
10void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
9 11
10#else /* CONFIG_GPIO_ACPI */ 12#else /* CONFIG_GPIO_ACPI */
11 13
@@ -14,6 +16,8 @@ static inline int acpi_get_gpio(char *path, int pin)
14 return -ENODEV; 16 return -ENODEV;
15} 17}
16 18
19static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
20
17#endif /* CONFIG_GPIO_ACPI */ 21#endif /* CONFIG_GPIO_ACPI */
18 22
19#endif /* _LINUX_ACPI_GPIO_H_ */ 23#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 544abdb2238c..ec10e1b24c1c 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -49,8 +49,8 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
49} 49}
50#endif 50#endif
51 51
52extern void cper_print_aer(const char *prefix, int cper_severity, 52extern void cper_print_aer(const char *prefix, struct pci_dev *dev,
53 struct aer_capability_regs *aer); 53 int cper_severity, struct aer_capability_regs *aer);
54extern int cper_severity_to_aer(int cper_severity); 54extern int cper_severity_to_aer(int cper_severity);
55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, 55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
56 int severity); 56 int severity);
diff --git a/include/linux/amba/sp810.h b/include/linux/amba/sp810.h
new file mode 100644
index 000000000000..6636430dd0e6
--- /dev/null
+++ b/include/linux/amba/sp810.h
@@ -0,0 +1,64 @@
1/*
2 * arch/arm/include/asm/hardware/sp810.h
3 *
4 * ARM PrimeXsys System Controller SP810 header file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __ASM_ARM_SP810_H
15#define __ASM_ARM_SP810_H
16
17#include <linux/io.h>
18
19/* sysctl registers offset */
20#define SCCTRL 0x000
21#define SCSYSSTAT 0x004
22#define SCIMCTRL 0x008
23#define SCIMSTAT 0x00C
24#define SCXTALCTRL 0x010
25#define SCPLLCTRL 0x014
26#define SCPLLFCTRL 0x018
27#define SCPERCTRL0 0x01C
28#define SCPERCTRL1 0x020
29#define SCPEREN 0x024
30#define SCPERDIS 0x028
31#define SCPERCLKEN 0x02C
32#define SCPERSTAT 0x030
33#define SCSYSID0 0xEE0
34#define SCSYSID1 0xEE4
35#define SCSYSID2 0xEE8
36#define SCSYSID3 0xEEC
37#define SCITCR 0xF00
38#define SCITIR0 0xF04
39#define SCITIR1 0xF08
40#define SCITOR 0xF0C
41#define SCCNTCTRL 0xF10
42#define SCCNTDATA 0xF14
43#define SCCNTSTEP 0xF18
44#define SCPERIPHID0 0xFE0
45#define SCPERIPHID1 0xFE4
46#define SCPERIPHID2 0xFE8
47#define SCPERIPHID3 0xFEC
48#define SCPCELLID0 0xFF0
49#define SCPCELLID1 0xFF4
50#define SCPCELLID2 0xFF8
51#define SCPCELLID3 0xFFC
52
53#define SCCTRL_TIMERENnSEL_SHIFT(n) (15 + ((n) * 2))
54
55static inline void sysctl_soft_reset(void __iomem *base)
56{
57 /* switch to slow mode */
58 writel(0x2, base + SCCTRL);
59
60 /* writing any value to SCSYSSTAT reg will reset system */
61 writel(0, base + SCSYSSTAT);
62}
63
64#endif /* __ASM_ARM_SP810_H */
diff --git a/include/linux/async.h b/include/linux/async.h
index 7a24fe9b44b4..a2e3f18b2ad6 100644
--- a/include/linux/async.h
+++ b/include/linux/async.h
@@ -19,8 +19,7 @@ typedef u64 async_cookie_t;
19typedef void (async_func_ptr) (void *data, async_cookie_t cookie); 19typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
20struct async_domain { 20struct async_domain {
21 struct list_head node; 21 struct list_head node;
22 struct list_head domain; 22 struct list_head pending;
23 int count;
24 unsigned registered:1; 23 unsigned registered:1;
25}; 24};
26 25
@@ -29,8 +28,7 @@ struct async_domain {
29 */ 28 */
30#define ASYNC_DOMAIN(_name) \ 29#define ASYNC_DOMAIN(_name) \
31 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 30 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
32 .domain = LIST_HEAD_INIT(_name.domain), \ 31 .pending = LIST_HEAD_INIT(_name.pending), \
33 .count = 0, \
34 .registered = 1 } 32 .registered = 1 }
35 33
36/* 34/*
@@ -39,8 +37,7 @@ struct async_domain {
39 */ 37 */
40#define ASYNC_DOMAIN_EXCLUSIVE(_name) \ 38#define ASYNC_DOMAIN_EXCLUSIVE(_name) \
41 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ 39 struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
42 .domain = LIST_HEAD_INIT(_name.domain), \ 40 .pending = LIST_HEAD_INIT(_name.pending), \
43 .count = 0, \
44 .registered = 0 } 41 .registered = 0 }
45 42
46extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data); 43extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
@@ -52,4 +49,5 @@ extern void async_synchronize_full_domain(struct async_domain *domain);
52extern void async_synchronize_cookie(async_cookie_t cookie); 49extern void async_synchronize_cookie(async_cookie_t cookie);
53extern void async_synchronize_cookie_domain(async_cookie_t cookie, 50extern void async_synchronize_cookie_domain(async_cookie_t cookie,
54 struct async_domain *domain); 51 struct async_domain *domain);
52extern bool current_is_async(void);
55#endif 53#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 408da9502177..8f7a3d68371a 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -297,10 +297,12 @@ enum {
297 ATA_LOG_SATA_NCQ = 0x10, 297 ATA_LOG_SATA_NCQ = 0x10,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30, 298 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08, 299 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_MDAT = 0x30, 300 ATA_LOG_DEVSLP_OFFSET = 0x30,
301 ATA_LOG_DEVSLP_SIZE = 0x08,
302 ATA_LOG_DEVSLP_MDAT = 0x00,
301 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F, 303 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F,
302 ATA_LOG_DEVSLP_DETO = 0x31, 304 ATA_LOG_DEVSLP_DETO = 0x01,
303 ATA_LOG_DEVSLP_VALID = 0x37, 305 ATA_LOG_DEVSLP_VALID = 0x07,
304 ATA_LOG_DEVSLP_VALID_MASK = 0x80, 306 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
305 307
306 /* READ/WRITE LONG (obsolete) */ 308 /* READ/WRITE LONG (obsolete) */
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index fe9989636b62..b9fde17f767c 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -15,12 +15,12 @@ struct pata_platform_info {
15 unsigned int irq_flags; 15 unsigned int irq_flags;
16}; 16};
17 17
18extern int __devinit __pata_platform_probe(struct device *dev, 18extern int __pata_platform_probe(struct device *dev,
19 struct resource *io_res, 19 struct resource *io_res,
20 struct resource *ctl_res, 20 struct resource *ctl_res,
21 struct resource *irq_res, 21 struct resource *irq_res,
22 unsigned int ioport_shift, 22 unsigned int ioport_shift,
23 int __pio_mask); 23 int __pio_mask);
24 24
25/* 25/*
26 * Marvell SATA private data 26 * Marvell SATA private data
diff --git a/include/linux/audit.h b/include/linux/audit.h
index bce729afbcf9..5a6d718adf34 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -24,6 +24,7 @@
24#define _LINUX_AUDIT_H_ 24#define _LINUX_AUDIT_H_
25 25
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/ptrace.h>
27#include <uapi/linux/audit.h> 28#include <uapi/linux/audit.h>
28 29
29struct audit_sig_info { 30struct audit_sig_info {
@@ -157,7 +158,8 @@ void audit_core_dumps(long signr);
157 158
158static inline void audit_seccomp(unsigned long syscall, long signr, int code) 159static inline void audit_seccomp(unsigned long syscall, long signr, int code)
159{ 160{
160 if (unlikely(!audit_dummy_context())) 161 /* Force a record to be reported if a signal was delivered. */
162 if (signr || unlikely(!audit_dummy_context()))
161 __audit_seccomp(syscall, signr, code); 163 __audit_seccomp(syscall, signr, code);
162} 164}
163 165
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 12731a19ef06..350459910fe1 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -254,6 +254,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
254#define BDI_CAP_EXEC_MAP 0x00000040 254#define BDI_CAP_EXEC_MAP 0x00000040
255#define BDI_CAP_NO_ACCT_WB 0x00000080 255#define BDI_CAP_NO_ACCT_WB 0x00000080
256#define BDI_CAP_SWAP_BACKED 0x00000100 256#define BDI_CAP_SWAP_BACKED 0x00000100
257#define BDI_CAP_STABLE_WRITES 0x00000200
257 258
258#define BDI_CAP_VMFLAGS \ 259#define BDI_CAP_VMFLAGS \
259 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 260 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
@@ -308,6 +309,11 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout);
308int pdflush_proc_obsolete(struct ctl_table *table, int write, 309int pdflush_proc_obsolete(struct ctl_table *table, int write,
309 void __user *buffer, size_t *lenp, loff_t *ppos); 310 void __user *buffer, size_t *lenp, loff_t *ppos);
310 311
312static inline bool bdi_cap_stable_pages_required(struct backing_dev_info *bdi)
313{
314 return bdi->capabilities & BDI_CAP_STABLE_WRITES;
315}
316
311static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) 317static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi)
312{ 318{
313 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK); 319 return !(bdi->capabilities & BDI_CAP_NO_WRITEBACK);
diff --git a/include/linux/bcm2835_timer.h b/include/linux/bcm2835_timer.h
deleted file mode 100644
index 25680fe0903c..000000000000
--- a/include/linux/bcm2835_timer.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Simon Arlott
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
15#ifndef __BCM2835_TIMER_H
16#define __BCM2835_TIMER_H
17
18#include <asm/mach/time.h>
19
20extern struct sys_timer bcm2835_timer;
21
22#endif
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 9a0e3fa3ca95..8390c474f69a 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -27,7 +27,7 @@
27#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */ 27#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */
28#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */ 28#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */
29#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */ 29#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */
30#define BCMA_CC_FLASHT_NFLASH 0x00000200 /* NAND flash */ 30#define BCMA_CC_FLASHT_NAND 0x00000300 /* NAND flash */
31#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */ 31#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */
32#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */ 32#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */
33#define BCMA_PLLTYPE_NONE 0x00000000 33#define BCMA_PLLTYPE_NONE 0x00000000
@@ -528,6 +528,7 @@ struct bcma_sflash {
528 u32 size; 528 u32 size;
529 529
530 struct mtd_info *mtd; 530 struct mtd_info *mtd;
531 void *priv;
531}; 532};
532#endif 533#endif
533 534
@@ -634,4 +635,6 @@ extern void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc,
634 u32 offset, u32 mask, u32 set); 635 u32 offset, u32 mask, u32 set);
635extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid); 636extern void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid);
636 637
638extern u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc);
639
637#endif /* LINUX_BCMA_DRIVER_CC_H_ */ 640#endif /* LINUX_BCMA_DRIVER_CC_H_ */
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index def894b83b0d..4dd1f33e36a2 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -92,7 +92,7 @@ struct bcma_drv_gmac_cmn {
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN 94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); 95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else 96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } 97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif 98#endif
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index 0baf8a56b794..fb61f3fb4ddb 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -28,6 +28,7 @@
28#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048 28#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048
29#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0 29#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0
30 30
31#define BCMA_MIPS_OOBSELINA74 0x004
31#define BCMA_MIPS_OOBSELOUTA30 0x100 32#define BCMA_MIPS_OOBSELOUTA30 0x100
32 33
33struct bcma_device; 34struct bcma_device;
@@ -36,19 +37,23 @@ struct bcma_drv_mips {
36 struct bcma_device *core; 37 struct bcma_device *core;
37 u8 setup_done:1; 38 u8 setup_done:1;
38 u8 early_setup_done:1; 39 u8 early_setup_done:1;
39 unsigned int assigned_irqs;
40}; 40};
41 41
42#ifdef CONFIG_BCMA_DRIVER_MIPS 42#ifdef CONFIG_BCMA_DRIVER_MIPS
43extern 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); 44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45
46extern unsigned int bcma_core_irq(struct bcma_device *core);
45#else 47#else
46static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
47static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } 49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
50
51static inline unsigned int bcma_core_irq(struct bcma_device *core)
52{
53 return 0;
54}
48#endif 55#endif
49 56
50extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 57extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
51 58
52extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
53
54#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ 59#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 41da581e1612..424760f01b9d 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -179,6 +179,8 @@ struct pci_dev;
179#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */ 179#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */
180#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */ 180#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */
181 181
182#define BCMA_CORE_PCI_CFG_DEVCTRL 0xd8
183
182/* PCIE Root Capability Register bits (Host mode only) */ 184/* PCIE Root Capability Register bits (Host mode only) */
183#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 185#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
184 186
@@ -214,7 +216,7 @@ struct bcma_drv_pci {
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 216#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 217#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
216 218
217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 219extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 220extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
219 struct bcma_device *core, bool enable); 221 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); 222extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 0530b9860359..c3a09149f793 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -111,7 +111,6 @@ extern int suid_dumpable;
111extern int setup_arg_pages(struct linux_binprm * bprm, 111extern int setup_arg_pages(struct linux_binprm * bprm,
112 unsigned long stack_top, 112 unsigned long stack_top,
113 int executable_stack); 113 int executable_stack);
114extern int bprm_mm_init(struct linux_binprm *bprm);
115extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); 114extern int bprm_change_interp(char *interp, struct linux_binprm *bprm);
116extern int copy_strings_kernel(int argc, const char *const *argv, 115extern int copy_strings_kernel(int argc, const char *const *argv,
117 struct linux_binprm *bprm); 116 struct linux_binprm *bprm);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f94bc83011ed..78feda9bbae2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -19,6 +19,7 @@
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/bsg.h> 20#include <linux/bsg.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/rcupdate.h>
22 23
23#include <asm/scatterlist.h> 24#include <asm/scatterlist.h>
24 25
@@ -437,6 +438,7 @@ struct request_queue {
437 /* Throttle data */ 438 /* Throttle data */
438 struct throtl_data *td; 439 struct throtl_data *td;
439#endif 440#endif
441 struct rcu_head rcu_head;
440}; 442};
441 443
442#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 444#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -974,7 +976,6 @@ struct blk_plug {
974 unsigned long magic; /* detect uninitialized use-cases */ 976 unsigned long magic; /* detect uninitialized use-cases */
975 struct list_head list; /* requests */ 977 struct list_head list; /* requests */
976 struct list_head cb_list; /* md requires an unplug callback */ 978 struct list_head cb_list; /* md requires an unplug callback */
977 unsigned int should_sort; /* list to be sorted before flushing? */
978}; 979};
979#define BLK_MAX_REQUEST_COUNT 16 980#define BLK_MAX_REQUEST_COUNT 16
980 981
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7c2e030e72f1..0ea61e07a91c 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -12,6 +12,7 @@
12 12
13struct blk_trace { 13struct blk_trace {
14 int trace_state; 14 int trace_state;
15 bool rq_based;
15 struct rchan *rchan; 16 struct rchan *rchan;
16 unsigned long __percpu *sequence; 17 unsigned long __percpu *sequence;
17 unsigned char __percpu *msg_data; 18 unsigned char __percpu *msg_data;
diff --git a/include/linux/bma150.h b/include/linux/bma150.h
index 7911fda23bb4..97ade7cdc870 100644
--- a/include/linux/bma150.h
+++ b/include/linux/bma150.h
@@ -22,6 +22,18 @@
22 22
23#define BMA150_DRIVER "bma150" 23#define BMA150_DRIVER "bma150"
24 24
25#define BMA150_RANGE_2G 0
26#define BMA150_RANGE_4G 1
27#define BMA150_RANGE_8G 2
28
29#define BMA150_BW_25HZ 0
30#define BMA150_BW_50HZ 1
31#define BMA150_BW_100HZ 2
32#define BMA150_BW_190HZ 3
33#define BMA150_BW_375HZ 4
34#define BMA150_BW_750HZ 5
35#define BMA150_BW_1500HZ 6
36
25struct bma150_cfg { 37struct bma150_cfg {
26 bool any_motion_int; /* Set to enable any-motion interrupt */ 38 bool any_motion_int; /* Set to enable any-motion interrupt */
27 bool hg_int; /* Set to enable high-G interrupt */ 39 bool hg_int; /* Set to enable high-G interrupt */
@@ -34,8 +46,8 @@ struct bma150_cfg {
34 unsigned char lg_hyst; /* Low-G hysterisis */ 46 unsigned char lg_hyst; /* Low-G hysterisis */
35 unsigned char lg_dur; /* Low-G duration */ 47 unsigned char lg_dur; /* Low-G duration */
36 unsigned char lg_thres; /* Low-G threshold */ 48 unsigned char lg_thres; /* Low-G threshold */
37 unsigned char range; /* BMA0150_RANGE_xxx (in G) */ 49 unsigned char range; /* one of BMA0150_RANGE_xxx */
38 unsigned char bandwidth; /* BMA0150_BW_xxx (in Hz) */ 50 unsigned char bandwidth; /* one of BMA0150_BW_xxx */
39}; 51};
40 52
41struct bma150_platform_data { 53struct bma150_platform_data {
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 3f778c27f825..cdc3bab01832 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -53,6 +53,7 @@ extern void free_bootmem_node(pg_data_t *pgdat,
53 unsigned long size); 53 unsigned long size);
54extern void free_bootmem(unsigned long physaddr, unsigned long size); 54extern void free_bootmem(unsigned long physaddr, unsigned long size);
55extern void free_bootmem_late(unsigned long physaddr, unsigned long size); 55extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
56extern void __free_pages_bootmem(struct page *page, unsigned int order);
56 57
57/* 58/*
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 59 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
@@ -99,6 +100,9 @@ void *___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
99extern void *__alloc_bootmem_low(unsigned long size, 100extern void *__alloc_bootmem_low(unsigned long size,
100 unsigned long align, 101 unsigned long align,
101 unsigned long goal); 102 unsigned long goal);
103void *__alloc_bootmem_low_nopanic(unsigned long size,
104 unsigned long align,
105 unsigned long goal);
102extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, 106extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
103 unsigned long size, 107 unsigned long size,
104 unsigned long align, 108 unsigned long align,
@@ -132,6 +136,8 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
132 136
133#define alloc_bootmem_low(x) \ 137#define alloc_bootmem_low(x) \
134 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) 138 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
139#define alloc_bootmem_low_pages_nopanic(x) \
140 __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)
135#define alloc_bootmem_low_pages(x) \ 141#define alloc_bootmem_low_pages(x) \
136 __alloc_bootmem_low(x, PAGE_SIZE, 0) 142 __alloc_bootmem_low(x, PAGE_SIZE, 0)
137#define alloc_bootmem_low_pages_node(pgdat, x) \ 143#define alloc_bootmem_low_pages_node(pgdat, x) \
diff --git a/include/linux/btrfs.h b/include/linux/btrfs.h
new file mode 100644
index 000000000000..22d799147db2
--- /dev/null
+++ b/include/linux/btrfs.h
@@ -0,0 +1,6 @@
1#ifndef _LINUX_BTRFS_H
2#define _LINUX_BTRFS_H
3
4#include <uapi/linux/btrfs.h>
5
6#endif /* _LINUX_BTRFS_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 458f497738a4..5afc4f94d110 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -126,7 +126,6 @@ BUFFER_FNS(Write_EIO, write_io_error)
126BUFFER_FNS(Unwritten, unwritten) 126BUFFER_FNS(Unwritten, unwritten)
127 127
128#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 128#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
129#define touch_buffer(bh) mark_page_accessed(bh->b_page)
130 129
131/* If we *know* page->private refers to buffer_heads */ 130/* If we *know* page->private refers to buffer_heads */
132#define page_buffers(page) \ 131#define page_buffers(page) \
@@ -142,6 +141,7 @@ BUFFER_FNS(Unwritten, unwritten)
142 141
143void mark_buffer_dirty(struct buffer_head *bh); 142void mark_buffer_dirty(struct buffer_head *bh);
144void init_buffer(struct buffer_head *, bh_end_io_t *, void *); 143void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
144void touch_buffer(struct buffer_head *bh);
145void set_bh_page(struct buffer_head *bh, 145void set_bh_page(struct buffer_head *bh,
146 struct page *page, unsigned long offset); 146 struct page *page, unsigned long offset);
147int try_to_free_buffers(struct page *); 147int try_to_free_buffers(struct page *);
diff --git a/include/linux/bug.h b/include/linux/bug.h
index b1cf40de847e..7f4818673c41 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -2,6 +2,7 @@
2#define _LINUX_BUG_H 2#define _LINUX_BUG_H
3 3
4#include <asm/bug.h> 4#include <asm/bug.h>
5#include <linux/compiler.h>
5 6
6enum bug_trap_type { 7enum bug_trap_type {
7 BUG_TRAP_TYPE_NONE = 0, 8 BUG_TRAP_TYPE_NONE = 0,
@@ -12,11 +13,12 @@ enum bug_trap_type {
12struct pt_regs; 13struct pt_regs;
13 14
14#ifdef __CHECKER__ 15#ifdef __CHECKER__
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n) 16#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
16#define BUILD_BUG_ON_ZERO(e) (0) 17#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0) 18#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON_INVALID(e) (0) 19#define BUILD_BUG_ON_INVALID(e) (0)
19#define BUILD_BUG_ON(condition) 20#define BUILD_BUG_ON_MSG(cond, msg) (0)
21#define BUILD_BUG_ON(condition) (0)
20#define BUILD_BUG() (0) 22#define BUILD_BUG() (0)
21#else /* __CHECKER__ */ 23#else /* __CHECKER__ */
22 24
@@ -39,29 +41,37 @@ struct pt_regs;
39#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) 41#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
40 42
41/** 43/**
44 * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
45 * error message.
46 * @condition: the condition which the compiler should know is false.
47 *
48 * See BUILD_BUG_ON for description.
49 */
50#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
51
52/**
42 * BUILD_BUG_ON - break compile if a condition is true. 53 * BUILD_BUG_ON - break compile if a condition is true.
43 * @condition: the condition which the compiler should know is false. 54 * @condition: the condition which the compiler should know is false.
44 * 55 *
45 * If you have some code which relies on certain constants being equal, or 56 * If you have some code which relies on certain constants being equal, or
46 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to 57 * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
47 * detect if someone changes it. 58 * detect if someone changes it.
48 * 59 *
49 * The implementation uses gcc's reluctance to create a negative array, but 60 * The implementation uses gcc's reluctance to create a negative array, but gcc
50 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments 61 * (as of 4.4) only emits that error for obvious cases (e.g. not arguments to
51 * to inline functions). So as a fallback we use the optimizer; if it can't 62 * inline functions). Luckily, in 4.3 they added the "error" function
52 * prove the condition is false, it will cause a link error on the undefined 63 * attribute just for this type of case. Thus, we use a negative sized array
53 * "__build_bug_on_failed". This error message can be harder to track down 64 * (should always create an error on gcc versions older than 4.4) and then call
54 * though, hence the two different methods. 65 * an undefined function with the error attribute (should always create an
66 * error on gcc 4.3 and later). If for some reason, neither creates a
67 * compile-time error, we'll still have a link-time error, which is harder to
68 * track down.
55 */ 69 */
56#ifndef __OPTIMIZE__ 70#ifndef __OPTIMIZE__
57#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 71#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
58#else 72#else
59extern int __build_bug_on_failed; 73#define BUILD_BUG_ON(condition) \
60#define BUILD_BUG_ON(condition) \ 74 BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
61 do { \
62 ((void)sizeof(char[1 - 2*!!(condition)])); \
63 if (condition) __build_bug_on_failed = 1; \
64 } while(0)
65#endif 75#endif
66 76
67/** 77/**
@@ -71,12 +81,7 @@ extern int __build_bug_on_failed;
71 * build time, you should use BUILD_BUG to detect if it is 81 * build time, you should use BUILD_BUG to detect if it is
72 * unexpectedly used. 82 * unexpectedly used.
73 */ 83 */
74#define BUILD_BUG() \ 84#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
75 do { \
76 extern void __build_bug_failed(void) \
77 __linktime_error("BUILD_BUG failed"); \
78 __build_bug_failed(); \
79 } while (0)
80 85
81#endif /* __CHECKER__ */ 86#endif /* __CHECKER__ */
82 87
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 2b2fc345afca..fb0ab651a041 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -16,6 +16,7 @@
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/can/netlink.h> 17#include <linux/can/netlink.h>
18#include <linux/can/error.h> 18#include <linux/can/error.h>
19#include <linux/can/led.h>
19 20
20/* 21/*
21 * CAN mode 22 * CAN mode
@@ -52,6 +53,13 @@ struct can_priv {
52 53
53 unsigned int echo_skb_max; 54 unsigned int echo_skb_max;
54 struct sk_buff **echo_skb; 55 struct sk_buff **echo_skb;
56
57#ifdef CONFIG_CAN_LEDS
58 struct led_trigger *tx_led_trig;
59 char tx_led_trig_name[CAN_LED_NAME_SZ];
60 struct led_trigger *rx_led_trig;
61 char rx_led_trig_name[CAN_LED_NAME_SZ];
62#endif
55}; 63};
56 64
57/* 65/*
@@ -98,6 +106,9 @@ u8 can_len2dlc(u8 len);
98struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); 106struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
99void free_candev(struct net_device *dev); 107void free_candev(struct net_device *dev);
100 108
109/* a candev safe wrapper around netdev_priv */
110struct can_priv *safe_candev_priv(struct net_device *dev);
111
101int open_candev(struct net_device *dev); 112int open_candev(struct net_device *dev);
102void close_candev(struct net_device *dev); 113void close_candev(struct net_device *dev);
103 114
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
new file mode 100644
index 000000000000..9c1167baf273
--- /dev/null
+++ b/include/linux/can/led.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2012, Fabio Baltieri <fabio.baltieri@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef CAN_LED_H
10#define CAN_LED_H
11
12#include <linux/if.h>
13#include <linux/leds.h>
14
15enum can_led_event {
16 CAN_LED_EVENT_OPEN,
17 CAN_LED_EVENT_STOP,
18 CAN_LED_EVENT_TX,
19 CAN_LED_EVENT_RX,
20};
21
22#ifdef CONFIG_CAN_LEDS
23
24/* keep space for interface name + "-tx"/"-rx" suffix and null terminator */
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 4)
26
27void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev);
29int __init can_led_notifier_init(void);
30void __exit can_led_notifier_exit(void);
31
32#else
33
34static inline void can_led_event(struct net_device *netdev,
35 enum can_led_event event)
36{
37}
38static inline void devm_can_led_init(struct net_device *netdev)
39{
40}
41static inline int can_led_notifier_init(void)
42{
43 return 0;
44}
45static inline void can_led_notifier_exit(void)
46{
47}
48
49#endif
50
51#endif
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
new file mode 100644
index 000000000000..2f0543f7510c
--- /dev/null
+++ b/include/linux/can/skb.h
@@ -0,0 +1,45 @@
1/*
2 * linux/can/skb.h
3 *
4 * Definitions for the CAN network socket buffer
5 *
6 * Copyright (C) 2012 Oliver Hartkopp <socketcan@hartkopp.net>
7 *
8 */
9
10#ifndef CAN_SKB_H
11#define CAN_SKB_H
12
13#include <linux/types.h>
14#include <linux/can.h>
15
16/*
17 * The struct can_skb_priv is used to transport additional information along
18 * with the stored struct can(fd)_frame that can not be contained in existing
19 * struct sk_buff elements.
20 * N.B. that this information must not be modified in cloned CAN sk_buffs.
21 * To modify the CAN frame content or the struct can_skb_priv content
22 * skb_copy() needs to be used instead of skb_clone().
23 */
24
25/**
26 * struct can_skb_priv - private additional data inside CAN sk_buffs
27 * @ifindex: ifindex of the first interface the CAN frame appeared on
28 * @cf: align to the following CAN frame at skb->data
29 */
30struct can_skb_priv {
31 int ifindex;
32 struct can_frame cf[0];
33};
34
35static inline struct can_skb_priv *can_skb_prv(struct sk_buff *skb)
36{
37 return (struct can_skb_priv *)(skb->head);
38}
39
40static inline void can_skb_reserve(struct sk_buff *skb)
41{
42 skb_reserve(skb, sizeof(struct can_skb_priv));
43}
44
45#endif /* CAN_SKB_H */
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index dad579b0c0e6..76554cecaab2 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -12,16 +12,46 @@
12#define CEPH_FEATURE_MONNAMES (1<<5) 12#define CEPH_FEATURE_MONNAMES (1<<5)
13#define CEPH_FEATURE_RECONNECT_SEQ (1<<6) 13#define CEPH_FEATURE_RECONNECT_SEQ (1<<6)
14#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7) 14#define CEPH_FEATURE_DIRLAYOUTHASH (1<<7)
15/* bits 8-17 defined by user-space; not supported yet here */ 15#define CEPH_FEATURE_OBJECTLOCATOR (1<<8)
16#define CEPH_FEATURE_PGID64 (1<<9)
17#define CEPH_FEATURE_INCSUBOSDMAP (1<<10)
18#define CEPH_FEATURE_PGPOOL3 (1<<11)
19#define CEPH_FEATURE_OSDREPLYMUX (1<<12)
20#define CEPH_FEATURE_OSDENC (1<<13)
21#define CEPH_FEATURE_OMAP (1<<14)
22#define CEPH_FEATURE_MONENC (1<<15)
23#define CEPH_FEATURE_QUERY_T (1<<16)
24#define CEPH_FEATURE_INDEP_PG_MAP (1<<17)
16#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18) 25#define CEPH_FEATURE_CRUSH_TUNABLES (1<<18)
26#define CEPH_FEATURE_CHUNKY_SCRUB (1<<19)
27#define CEPH_FEATURE_MON_NULLROUTE (1<<20)
28#define CEPH_FEATURE_MON_GV (1<<21)
29#define CEPH_FEATURE_BACKFILL_RESERVATION (1<<22)
30#define CEPH_FEATURE_MSG_AUTH (1<<23)
31#define CEPH_FEATURE_RECOVERY_RESERVATION (1<<24)
32#define CEPH_FEATURE_CRUSH_TUNABLES2 (1<<25)
33#define CEPH_FEATURE_CREATEPOOLID (1<<26)
34#define CEPH_FEATURE_REPLY_CREATE_INODE (1<<27)
35#define CEPH_FEATURE_OSD_HBMSGS (1<<28)
36#define CEPH_FEATURE_MDSENC (1<<29)
37#define CEPH_FEATURE_OSDHASHPSPOOL (1<<30)
17 38
18/* 39/*
19 * Features supported. 40 * Features supported.
20 */ 41 */
21#define CEPH_FEATURES_SUPPORTED_DEFAULT \ 42#define CEPH_FEATURES_SUPPORTED_DEFAULT \
22 (CEPH_FEATURE_NOSRCADDR | \ 43 (CEPH_FEATURE_NOSRCADDR | \
23 CEPH_FEATURE_CRUSH_TUNABLES) 44 CEPH_FEATURE_PGID64 | \
45 CEPH_FEATURE_PGPOOL3 | \
46 CEPH_FEATURE_OSDENC | \
47 CEPH_FEATURE_CRUSH_TUNABLES | \
48 CEPH_FEATURE_CRUSH_TUNABLES2 | \
49 CEPH_FEATURE_REPLY_CREATE_INODE | \
50 CEPH_FEATURE_OSDHASHPSPOOL)
24 51
25#define CEPH_FEATURES_REQUIRED_DEFAULT \ 52#define CEPH_FEATURES_REQUIRED_DEFAULT \
26 (CEPH_FEATURE_NOSRCADDR) 53 (CEPH_FEATURE_NOSRCADDR | \
54 CEPH_FEATURE_PGID64 | \
55 CEPH_FEATURE_PGPOOL3 | \
56 CEPH_FEATURE_OSDENC)
27#endif 57#endif
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index cf6f4d998a76..2ad7b860f062 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -21,16 +21,14 @@
21 * internal cluster protocols separately from the public, 21 * internal cluster protocols separately from the public,
22 * client-facing protocol. 22 * client-facing protocol.
23 */ 23 */
24#define CEPH_OSD_PROTOCOL 8 /* cluster internal */
25#define CEPH_MDS_PROTOCOL 12 /* cluster internal */
26#define CEPH_MON_PROTOCOL 5 /* cluster internal */
27#define CEPH_OSDC_PROTOCOL 24 /* server/client */ 24#define CEPH_OSDC_PROTOCOL 24 /* server/client */
28#define CEPH_MDSC_PROTOCOL 32 /* server/client */ 25#define CEPH_MDSC_PROTOCOL 32 /* server/client */
29#define CEPH_MONC_PROTOCOL 15 /* server/client */ 26#define CEPH_MONC_PROTOCOL 15 /* server/client */
30 27
31 28
32#define CEPH_INO_ROOT 1 29#define CEPH_INO_ROOT 1
33#define CEPH_INO_CEPH 2 /* hidden .ceph dir */ 30#define CEPH_INO_CEPH 2 /* hidden .ceph dir */
31#define CEPH_INO_DOTDOT 3 /* used by ceph fuse for parent (..) */
34 32
35/* arbitrary limit on max # of monitors (cluster of 3 is typical) */ 33/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
36#define CEPH_MAX_MON 31 34#define CEPH_MAX_MON 31
@@ -51,7 +49,7 @@ struct ceph_file_layout {
51 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */ 49 __le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
52 50
53 /* object -> pg layout */ 51 /* object -> pg layout */
54 __le32 fl_unused; /* unused; used to be preferred primary (-1) */ 52 __le32 fl_unused; /* unused; used to be preferred primary for pg (-1 for none) */
55 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ 53 __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
56} __attribute__ ((packed)); 54} __attribute__ ((packed));
57 55
@@ -101,6 +99,8 @@ struct ceph_dir_layout {
101#define CEPH_MSG_MON_SUBSCRIBE_ACK 16 99#define CEPH_MSG_MON_SUBSCRIBE_ACK 16
102#define CEPH_MSG_AUTH 17 100#define CEPH_MSG_AUTH 17
103#define CEPH_MSG_AUTH_REPLY 18 101#define CEPH_MSG_AUTH_REPLY 18
102#define CEPH_MSG_MON_GET_VERSION 19
103#define CEPH_MSG_MON_GET_VERSION_REPLY 20
104 104
105/* client <-> mds */ 105/* client <-> mds */
106#define CEPH_MSG_MDS_MAP 21 106#define CEPH_MSG_MDS_MAP 21
@@ -221,6 +221,11 @@ struct ceph_mon_subscribe_ack {
221} __attribute__ ((packed)); 221} __attribute__ ((packed));
222 222
223/* 223/*
224 * mdsmap flags
225 */
226#define CEPH_MDSMAP_DOWN (1<<0) /* cluster deliberately down */
227
228/*
224 * mds states 229 * mds states
225 * > 0 -> in 230 * > 0 -> in
226 * <= 0 -> out 231 * <= 0 -> out
@@ -233,6 +238,7 @@ struct ceph_mon_subscribe_ack {
233#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */ 238#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
234#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */ 239#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */
235#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */ 240#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
241#define CEPH_MDS_STATE_REPLAYONCE -9 /* up, replaying an active node's journal */
236 242
237#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */ 243#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
238#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed 244#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
@@ -264,6 +270,7 @@ extern const char *ceph_mds_state_name(int s);
264#define CEPH_LOCK_IXATTR 2048 270#define CEPH_LOCK_IXATTR 2048
265#define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */ 271#define CEPH_LOCK_IFLOCK 4096 /* advisory file locks */
266#define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */ 272#define CEPH_LOCK_INO 8192 /* immutable inode bits; not a lock */
273#define CEPH_LOCK_IPOLICY 16384 /* policy lock on dirs. MDS internal */
267 274
268/* client_session ops */ 275/* client_session ops */
269enum { 276enum {
@@ -338,6 +345,12 @@ extern const char *ceph_mds_op_name(int op);
338#define CEPH_SETATTR_SIZE 32 345#define CEPH_SETATTR_SIZE 32
339#define CEPH_SETATTR_CTIME 64 346#define CEPH_SETATTR_CTIME 64
340 347
348/*
349 * Ceph setxattr request flags.
350 */
351#define CEPH_XATTR_CREATE 1
352#define CEPH_XATTR_REPLACE 2
353
341union ceph_mds_request_args { 354union ceph_mds_request_args {
342 struct { 355 struct {
343 __le32 mask; /* CEPH_CAP_* */ 356 __le32 mask; /* CEPH_CAP_* */
@@ -522,14 +535,17 @@ int ceph_flags_to_mode(int flags);
522#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */ 535#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
523#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */ 536#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
524 537
538#define CEPH_CAP_SIMPLE_BITS 2
539#define CEPH_CAP_FILE_BITS 8
540
525/* per-lock shift */ 541/* per-lock shift */
526#define CEPH_CAP_SAUTH 2 542#define CEPH_CAP_SAUTH 2
527#define CEPH_CAP_SLINK 4 543#define CEPH_CAP_SLINK 4
528#define CEPH_CAP_SXATTR 6 544#define CEPH_CAP_SXATTR 6
529#define CEPH_CAP_SFILE 8 545#define CEPH_CAP_SFILE 8
530#define CEPH_CAP_SFLOCK 20 546#define CEPH_CAP_SFLOCK 20
531 547
532#define CEPH_CAP_BITS 22 548#define CEPH_CAP_BITS 22
533 549
534/* composed values */ 550/* composed values */
535#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH) 551#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 63d092822bad..360d9d08ca9e 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -52,10 +52,10 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
52 return end >= *p && n <= end - *p; 52 return end >= *p && n <= end - *p;
53} 53}
54 54
55#define ceph_decode_need(p, end, n, bad) \ 55#define ceph_decode_need(p, end, n, bad) \
56 do { \ 56 do { \
57 if (!likely(ceph_has_room(p, end, n))) \ 57 if (!likely(ceph_has_room(p, end, n))) \
58 goto bad; \ 58 goto bad; \
59 } while (0) 59 } while (0)
60 60
61#define ceph_decode_64_safe(p, end, v, bad) \ 61#define ceph_decode_64_safe(p, end, v, bad) \
@@ -99,8 +99,8 @@ static inline int ceph_has_room(void **p, void *end, size_t n)
99 * 99 *
100 * There are two possible failures: 100 * There are two possible failures:
101 * - converting the string would require accessing memory at or 101 * - converting the string would require accessing memory at or
102 * beyond the "end" pointer provided (-E 102 * beyond the "end" pointer provided (-ERANGE)
103 * - memory could not be allocated for the result 103 * - memory could not be allocated for the result (-ENOMEM)
104 */ 104 */
105static inline char *ceph_extract_encoded_string(void **p, void *end, 105static inline char *ceph_extract_encoded_string(void **p, void *end,
106 size_t *lenp, gfp_t gfp) 106 size_t *lenp, gfp_t gfp)
@@ -217,10 +217,10 @@ static inline void ceph_encode_string(void **p, void *end,
217 *p += len; 217 *p += len;
218} 218}
219 219
220#define ceph_encode_need(p, end, n, bad) \ 220#define ceph_encode_need(p, end, n, bad) \
221 do { \ 221 do { \
222 if (!likely(ceph_has_room(p, end, n))) \ 222 if (!likely(ceph_has_room(p, end, n))) \
223 goto bad; \ 223 goto bad; \
224 } while (0) 224 } while (0)
225 225
226#define ceph_encode_64_safe(p, end, v, bad) \ 226#define ceph_encode_64_safe(p, end, v, bad) \
@@ -231,12 +231,17 @@ static inline void ceph_encode_string(void **p, void *end,
231#define ceph_encode_32_safe(p, end, v, bad) \ 231#define ceph_encode_32_safe(p, end, v, bad) \
232 do { \ 232 do { \
233 ceph_encode_need(p, end, sizeof(u32), bad); \ 233 ceph_encode_need(p, end, sizeof(u32), bad); \
234 ceph_encode_32(p, v); \ 234 ceph_encode_32(p, v); \
235 } while (0) 235 } while (0)
236#define ceph_encode_16_safe(p, end, v, bad) \ 236#define ceph_encode_16_safe(p, end, v, bad) \
237 do { \ 237 do { \
238 ceph_encode_need(p, end, sizeof(u16), bad); \ 238 ceph_encode_need(p, end, sizeof(u16), bad); \
239 ceph_encode_16(p, v); \ 239 ceph_encode_16(p, v); \
240 } while (0)
241#define ceph_encode_8_safe(p, end, v, bad) \
242 do { \
243 ceph_encode_need(p, end, sizeof(u8), bad); \
244 ceph_encode_8(p, v); \
240 } while (0) 245 } while (0)
241 246
242#define ceph_encode_copy_safe(p, end, pv, n, bad) \ 247#define ceph_encode_copy_safe(p, end, pv, n, bad) \
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 084d3c622b12..29818fc3fa49 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -193,6 +193,8 @@ static inline int calc_pages_for(u64 off, u64 len)
193} 193}
194 194
195/* ceph_common.c */ 195/* ceph_common.c */
196extern bool libceph_compatible(void *data);
197
196extern const char *ceph_msg_type_name(int type); 198extern const char *ceph_msg_type_name(int type);
197extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); 199extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
198extern struct kmem_cache *ceph_inode_cachep; 200extern struct kmem_cache *ceph_inode_cachep;
@@ -220,7 +222,7 @@ extern int ceph_open_session(struct ceph_client *client);
220/* pagevec.c */ 222/* pagevec.c */
221extern void ceph_release_page_vector(struct page **pages, int num_pages); 223extern void ceph_release_page_vector(struct page **pages, int num_pages);
222 224
223extern struct page **ceph_get_direct_page_vector(const char __user *data, 225extern struct page **ceph_get_direct_page_vector(const void __user *data,
224 int num_pages, 226 int num_pages,
225 bool write_page); 227 bool write_page);
226extern void ceph_put_page_vector(struct page **pages, int num_pages, 228extern void ceph_put_page_vector(struct page **pages, int num_pages,
@@ -228,15 +230,15 @@ extern void ceph_put_page_vector(struct page **pages, int num_pages,
228extern void ceph_release_page_vector(struct page **pages, int num_pages); 230extern void ceph_release_page_vector(struct page **pages, int num_pages);
229extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); 231extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags);
230extern int ceph_copy_user_to_page_vector(struct page **pages, 232extern int ceph_copy_user_to_page_vector(struct page **pages,
231 const char __user *data, 233 const void __user *data,
232 loff_t off, size_t len); 234 loff_t off, size_t len);
233extern int ceph_copy_to_page_vector(struct page **pages, 235extern void ceph_copy_to_page_vector(struct page **pages,
234 const char *data, 236 const void *data,
235 loff_t off, size_t len); 237 loff_t off, size_t len);
236extern int ceph_copy_from_page_vector(struct page **pages, 238extern void ceph_copy_from_page_vector(struct page **pages,
237 char *data, 239 void *data,
238 loff_t off, size_t len); 240 loff_t off, size_t len);
239extern int ceph_copy_page_vector_to_user(struct page **pages, char __user *data, 241extern int ceph_copy_page_vector_to_user(struct page **pages, void __user *data,
240 loff_t off, size_t len); 242 loff_t off, size_t len);
241extern void ceph_zero_page_vector_range(int off, int len, struct page **pages); 243extern void ceph_zero_page_vector_range(int off, int len, struct page **pages);
242 244
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index cb15b5d867c7..87ed09f54800 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -29,8 +29,8 @@ struct ceph_mdsmap {
29 29
30 /* which object pools file data can be stored in */ 30 /* which object pools file data can be stored in */
31 int m_num_data_pg_pools; 31 int m_num_data_pg_pools;
32 u32 *m_data_pg_pools; 32 u64 *m_data_pg_pools;
33 u32 m_cas_pg_pool; 33 u64 m_cas_pg_pool;
34}; 34};
35 35
36static inline struct ceph_entity_addr * 36static inline struct ceph_entity_addr *
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 14ba5ee738a9..60903e0f665c 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -83,9 +83,11 @@ struct ceph_msg {
83 struct list_head list_head; 83 struct list_head list_head;
84 84
85 struct kref kref; 85 struct kref kref;
86#ifdef CONFIG_BLOCK
86 struct bio *bio; /* instead of pages/pagelist */ 87 struct bio *bio; /* instead of pages/pagelist */
87 struct bio *bio_iter; /* bio iterator */ 88 struct bio *bio_iter; /* bio iterator */
88 int bio_seg; /* current bio segment */ 89 int bio_seg; /* current bio segment */
90#endif /* CONFIG_BLOCK */
89 struct ceph_pagelist *trail; /* the trailing part of the data */ 91 struct ceph_pagelist *trail; /* the trailing part of the data */
90 bool front_is_vmalloc; 92 bool front_is_vmalloc;
91 bool more_to_follow; 93 bool more_to_follow;
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index d9b880e977e6..1dd5d466b6f9 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -10,6 +10,7 @@
10#include <linux/ceph/osdmap.h> 10#include <linux/ceph/osdmap.h>
11#include <linux/ceph/messenger.h> 11#include <linux/ceph/messenger.h>
12#include <linux/ceph/auth.h> 12#include <linux/ceph/auth.h>
13#include <linux/ceph/pagelist.h>
13 14
14/* 15/*
15 * Maximum object name size 16 * Maximum object name size
@@ -22,7 +23,6 @@ struct ceph_snap_context;
22struct ceph_osd_request; 23struct ceph_osd_request;
23struct ceph_osd_client; 24struct ceph_osd_client;
24struct ceph_authorizer; 25struct ceph_authorizer;
25struct ceph_pagelist;
26 26
27/* 27/*
28 * completion callback for async writepages 28 * completion callback for async writepages
@@ -47,6 +47,9 @@ struct ceph_osd {
47 struct list_head o_keepalive_item; 47 struct list_head o_keepalive_item;
48}; 48};
49 49
50
51#define CEPH_OSD_MAX_OP 10
52
50/* an in-flight request */ 53/* an in-flight request */
51struct ceph_osd_request { 54struct ceph_osd_request {
52 u64 r_tid; /* unique for this client */ 55 u64 r_tid; /* unique for this client */
@@ -63,9 +66,23 @@ struct ceph_osd_request {
63 struct ceph_connection *r_con_filling_msg; 66 struct ceph_connection *r_con_filling_msg;
64 67
65 struct ceph_msg *r_request, *r_reply; 68 struct ceph_msg *r_request, *r_reply;
66 int r_result;
67 int r_flags; /* any additional flags for the osd */ 69 int r_flags; /* any additional flags for the osd */
68 u32 r_sent; /* >0 if r_request is sending/sent */ 70 u32 r_sent; /* >0 if r_request is sending/sent */
71 int r_num_ops;
72
73 /* encoded message content */
74 struct ceph_osd_op *r_request_ops;
75 /* these are updated on each send */
76 __le32 *r_request_osdmap_epoch;
77 __le32 *r_request_flags;
78 __le64 *r_request_pool;
79 void *r_request_pgid;
80 __le32 *r_request_attempts;
81 struct ceph_eversion *r_request_reassert_version;
82
83 int r_result;
84 int r_reply_op_len[CEPH_OSD_MAX_OP];
85 s32 r_reply_op_result[CEPH_OSD_MAX_OP];
69 int r_got_reply; 86 int r_got_reply;
70 int r_linger; 87 int r_linger;
71 88
@@ -82,6 +99,7 @@ struct ceph_osd_request {
82 99
83 char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */ 100 char r_oid[MAX_OBJ_NAME_SIZE]; /* object name */
84 int r_oid_len; 101 int r_oid_len;
102 u64 r_snapid;
85 unsigned long r_stamp; /* send OR check time */ 103 unsigned long r_stamp; /* send OR check time */
86 104
87 struct ceph_file_layout r_file_layout; 105 struct ceph_file_layout r_file_layout;
@@ -95,7 +113,7 @@ struct ceph_osd_request {
95 struct bio *r_bio; /* instead of pages */ 113 struct bio *r_bio; /* instead of pages */
96#endif 114#endif
97 115
98 struct ceph_pagelist *r_trail; /* trailing part of the data */ 116 struct ceph_pagelist r_trail; /* trailing part of the data */
99}; 117};
100 118
101struct ceph_osd_event { 119struct ceph_osd_event {
@@ -107,7 +125,6 @@ struct ceph_osd_event {
107 struct rb_node node; 125 struct rb_node node;
108 struct list_head osd_node; 126 struct list_head osd_node;
109 struct kref kref; 127 struct kref kref;
110 struct completion completion;
111}; 128};
112 129
113struct ceph_osd_event_work { 130struct ceph_osd_event_work {
@@ -157,7 +174,7 @@ struct ceph_osd_client {
157 174
158struct ceph_osd_req_op { 175struct ceph_osd_req_op {
159 u16 op; /* CEPH_OSD_OP_* */ 176 u16 op; /* CEPH_OSD_OP_* */
160 u32 flags; /* CEPH_OSD_FLAG_* */ 177 u32 payload_len;
161 union { 178 union {
162 struct { 179 struct {
163 u64 offset, length; 180 u64 offset, length;
@@ -166,23 +183,24 @@ struct ceph_osd_req_op {
166 } extent; 183 } extent;
167 struct { 184 struct {
168 const char *name; 185 const char *name;
169 u32 name_len;
170 const char *val; 186 const char *val;
187 u32 name_len;
171 u32 value_len; 188 u32 value_len;
172 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */ 189 __u8 cmp_op; /* CEPH_OSD_CMPXATTR_OP_* */
173 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */ 190 __u8 cmp_mode; /* CEPH_OSD_CMPXATTR_MODE_* */
174 } xattr; 191 } xattr;
175 struct { 192 struct {
176 const char *class_name; 193 const char *class_name;
177 __u8 class_len;
178 const char *method_name; 194 const char *method_name;
179 __u8 method_len;
180 __u8 argc;
181 const char *indata; 195 const char *indata;
182 u32 indata_len; 196 u32 indata_len;
197 __u8 class_len;
198 __u8 method_len;
199 __u8 argc;
183 } cls; 200 } cls;
184 struct { 201 struct {
185 u64 cookie, count; 202 u64 cookie;
203 u64 count;
186 } pgls; 204 } pgls;
187 struct { 205 struct {
188 u64 snapid; 206 u64 snapid;
@@ -190,12 +208,11 @@ struct ceph_osd_req_op {
190 struct { 208 struct {
191 u64 cookie; 209 u64 cookie;
192 u64 ver; 210 u64 ver;
193 __u8 flag;
194 u32 prot_ver; 211 u32 prot_ver;
195 u32 timeout; 212 u32 timeout;
213 __u8 flag;
196 } watch; 214 } watch;
197 }; 215 };
198 u32 payload_len;
199}; 216};
200 217
201extern int ceph_osdc_init(struct ceph_osd_client *osdc, 218extern int ceph_osdc_init(struct ceph_osd_client *osdc,
@@ -207,29 +224,19 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 224extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
208 struct ceph_msg *msg); 225 struct ceph_msg *msg);
209 226
210extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
211 struct ceph_file_layout *layout,
212 u64 snapid,
213 u64 off, u64 *plen, u64 *bno,
214 struct ceph_osd_request *req,
215 struct ceph_osd_req_op *op);
216
217extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 227extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
218 int flags,
219 struct ceph_snap_context *snapc, 228 struct ceph_snap_context *snapc,
220 struct ceph_osd_req_op *ops, 229 unsigned int num_op,
221 bool use_mempool, 230 bool use_mempool,
222 gfp_t gfp_flags, 231 gfp_t gfp_flags);
223 struct page **pages,
224 struct bio *bio);
225 232
226extern void ceph_osdc_build_request(struct ceph_osd_request *req, 233extern void ceph_osdc_build_request(struct ceph_osd_request *req,
227 u64 off, u64 *plen, 234 u64 off, u64 len,
235 unsigned int num_op,
228 struct ceph_osd_req_op *src_ops, 236 struct ceph_osd_req_op *src_ops,
229 struct ceph_snap_context *snapc, 237 struct ceph_snap_context *snapc,
230 struct timespec *mtime, 238 u64 snap_id,
231 const char *oid, 239 struct timespec *mtime);
232 int oid_len);
233 240
234extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, 241extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
235 struct ceph_file_layout *layout, 242 struct ceph_file_layout *layout,
@@ -239,8 +246,7 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
239 int do_sync, u32 truncate_seq, 246 int do_sync, u32 truncate_seq,
240 u64 truncate_size, 247 u64 truncate_size,
241 struct timespec *mtime, 248 struct timespec *mtime,
242 bool use_mempool, int num_reply, 249 bool use_mempool, int page_align);
243 int page_align);
244 250
245extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc, 251extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
246 struct ceph_osd_request *req); 252 struct ceph_osd_request *req);
@@ -279,17 +285,13 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
279 u64 off, u64 len, 285 u64 off, u64 len,
280 u32 truncate_seq, u64 truncate_size, 286 u32 truncate_seq, u64 truncate_size,
281 struct timespec *mtime, 287 struct timespec *mtime,
282 struct page **pages, int nr_pages, 288 struct page **pages, int nr_pages);
283 int flags, int do_sync, bool nofail);
284 289
285/* watch/notify events */ 290/* watch/notify events */
286extern int ceph_osdc_create_event(struct ceph_osd_client *osdc, 291extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
287 void (*event_cb)(u64, u64, u8, void *), 292 void (*event_cb)(u64, u64, u8, void *),
288 int one_shot, void *data, 293 void *data, struct ceph_osd_event **pevent);
289 struct ceph_osd_event **pevent);
290extern void ceph_osdc_cancel_event(struct ceph_osd_event *event); 294extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
291extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
292 unsigned long timeout);
293extern void ceph_osdc_put_event(struct ceph_osd_event *event); 295extern void ceph_osdc_put_event(struct ceph_osd_event *event);
294#endif 296#endif
295 297
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 10a417f9f76f..c819190d1642 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -18,14 +18,31 @@
18 * The map can be updated either via an incremental map (diff) describing 18 * The map can be updated either via an incremental map (diff) describing
19 * the change between two successive epochs, or as a fully encoded map. 19 * the change between two successive epochs, or as a fully encoded map.
20 */ 20 */
21struct ceph_pg {
22 uint64_t pool;
23 uint32_t seed;
24};
25
26#define CEPH_POOL_FLAG_HASHPSPOOL 1
27
21struct ceph_pg_pool_info { 28struct ceph_pg_pool_info {
22 struct rb_node node; 29 struct rb_node node;
23 int id; 30 s64 id;
24 struct ceph_pg_pool v; 31 u8 type;
25 int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask; 32 u8 size;
33 u8 crush_ruleset;
34 u8 object_hash;
35 u32 pg_num, pgp_num;
36 int pg_num_mask, pgp_num_mask;
37 u64 flags;
26 char *name; 38 char *name;
27}; 39};
28 40
41struct ceph_object_locator {
42 uint64_t pool;
43 char *key;
44};
45
29struct ceph_pg_mapping { 46struct ceph_pg_mapping {
30 struct rb_node node; 47 struct rb_node node;
31 struct ceph_pg pgid; 48 struct ceph_pg pgid;
@@ -110,15 +127,16 @@ extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
110 127
111/* calculate mapping of a file extent to an object */ 128/* calculate mapping of a file extent to an object */
112extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 129extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
113 u64 off, u64 *plen, 130 u64 off, u64 len,
114 u64 *bno, u64 *oxoff, u64 *oxlen); 131 u64 *bno, u64 *oxoff, u64 *oxlen);
115 132
116/* calculate mapping of object to a placement group */ 133/* calculate mapping of object to a placement group */
117extern int ceph_calc_object_layout(struct ceph_object_layout *ol, 134extern int ceph_calc_object_layout(struct ceph_pg *pg,
118 const char *oid, 135 const char *oid,
119 struct ceph_file_layout *fl, 136 struct ceph_file_layout *fl,
120 struct ceph_osdmap *osdmap); 137 struct ceph_osdmap *osdmap);
121extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid, 138extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
139 struct ceph_pg pgid,
122 int *acting); 140 int *acting);
123extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 141extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
124 struct ceph_pg pgid); 142 struct ceph_pg pgid);
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 2c04afeead1c..68c96a508ac2 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -9,14 +9,6 @@
9#include <linux/ceph/msgr.h> 9#include <linux/ceph/msgr.h>
10 10
11/* 11/*
12 * osdmap encoding versions
13 */
14#define CEPH_OSDMAP_INC_VERSION 5
15#define CEPH_OSDMAP_INC_VERSION_EXT 6
16#define CEPH_OSDMAP_VERSION 5
17#define CEPH_OSDMAP_VERSION_EXT 6
18
19/*
20 * fs id 12 * fs id
21 */ 13 */
22struct ceph_fsid { 14struct ceph_fsid {
@@ -64,7 +56,7 @@ struct ceph_timespec {
64 * placement group. 56 * placement group.
65 * we encode this into one __le64. 57 * we encode this into one __le64.
66 */ 58 */
67struct ceph_pg { 59struct ceph_pg_v1 {
68 __le16 preferred; /* preferred primary osd */ 60 __le16 preferred; /* preferred primary osd */
69 __le16 ps; /* placement seed */ 61 __le16 ps; /* placement seed */
70 __le32 pool; /* object pool */ 62 __le32 pool; /* object pool */
@@ -91,21 +83,6 @@ struct ceph_pg {
91 83
92#define CEPH_PG_TYPE_REP 1 84#define CEPH_PG_TYPE_REP 1
93#define CEPH_PG_TYPE_RAID4 2 85#define CEPH_PG_TYPE_RAID4 2
94#define CEPH_PG_POOL_VERSION 2
95struct ceph_pg_pool {
96 __u8 type; /* CEPH_PG_TYPE_* */
97 __u8 size; /* number of osds in each pg */
98 __u8 crush_ruleset; /* crush placement rule */
99 __u8 object_hash; /* hash mapping object name to ps */
100 __le32 pg_num, pgp_num; /* number of pg's */
101 __le32 lpg_num, lpgp_num; /* number of localized pg's */
102 __le32 last_change; /* most recent epoch changed */
103 __le64 snap_seq; /* seq for per-pool snapshot */
104 __le32 snap_epoch; /* epoch of last snap */
105 __le32 num_snaps;
106 __le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
107 __le64 auid; /* who owns the pg */
108} __attribute__ ((packed));
109 86
110/* 87/*
111 * stable_mod func is used to control number of placement groups. 88 * stable_mod func is used to control number of placement groups.
@@ -128,7 +105,7 @@ static inline int ceph_stable_mod(int x, int b, int bmask)
128 * object layout - how a given object should be stored. 105 * object layout - how a given object should be stored.
129 */ 106 */
130struct ceph_object_layout { 107struct ceph_object_layout {
131 struct ceph_pg ol_pgid; /* raw pg, with _full_ ps precision. */ 108 struct ceph_pg_v1 ol_pgid; /* raw pg, with _full_ ps precision. */
132 __le32 ol_stripe_unit; /* for per-object parity, if any */ 109 __le32 ol_stripe_unit; /* for per-object parity, if any */
133} __attribute__ ((packed)); 110} __attribute__ ((packed));
134 111
@@ -145,8 +122,12 @@ struct ceph_eversion {
145 */ 122 */
146 123
147/* status bits */ 124/* status bits */
148#define CEPH_OSD_EXISTS 1 125#define CEPH_OSD_EXISTS (1<<0)
149#define CEPH_OSD_UP 2 126#define CEPH_OSD_UP (1<<1)
127#define CEPH_OSD_AUTOOUT (1<<2) /* osd was automatically marked out */
128#define CEPH_OSD_NEW (1<<3) /* osd is new, never marked in */
129
130extern const char *ceph_osd_state_name(int s);
150 131
151/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */ 132/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
152#define CEPH_OSD_IN 0x10000 133#define CEPH_OSD_IN 0x10000
@@ -161,9 +142,25 @@ struct ceph_eversion {
161#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */ 142#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
162#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */ 143#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
163#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */ 144#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
145#define CEPH_OSDMAP_NOUP (1<<5) /* block osd boot */
146#define CEPH_OSDMAP_NODOWN (1<<6) /* block osd mark-down/failure */
147#define CEPH_OSDMAP_NOOUT (1<<7) /* block osd auto mark-out */
148#define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */
149#define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */
150#define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */
151
152/*
153 * The error code to return when an OSD can't handle a write
154 * because it is too large.
155 */
156#define OSD_WRITETOOBIG EMSGSIZE
164 157
165/* 158/*
166 * osd ops 159 * osd ops
160 *
161 * WARNING: do not use these op codes directly. Use the helpers
162 * defined below instead. In certain cases, op code behavior was
163 * redefined, resulting in special-cases in the helpers.
167 */ 164 */
168#define CEPH_OSD_OP_MODE 0xf000 165#define CEPH_OSD_OP_MODE 0xf000
169#define CEPH_OSD_OP_MODE_RD 0x1000 166#define CEPH_OSD_OP_MODE_RD 0x1000
@@ -177,6 +174,7 @@ struct ceph_eversion {
177#define CEPH_OSD_OP_TYPE_ATTR 0x0300 174#define CEPH_OSD_OP_TYPE_ATTR 0x0300
178#define CEPH_OSD_OP_TYPE_EXEC 0x0400 175#define CEPH_OSD_OP_TYPE_EXEC 0x0400
179#define CEPH_OSD_OP_TYPE_PG 0x0500 176#define CEPH_OSD_OP_TYPE_PG 0x0500
177#define CEPH_OSD_OP_TYPE_MULTI 0x0600 /* multiobject */
180 178
181enum { 179enum {
182 /** data **/ 180 /** data **/
@@ -217,6 +215,23 @@ enum {
217 215
218 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15, 216 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
219 217
218 /* omap */
219 CEPH_OSD_OP_OMAPGETKEYS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 17,
220 CEPH_OSD_OP_OMAPGETVALS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 18,
221 CEPH_OSD_OP_OMAPGETHEADER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 19,
222 CEPH_OSD_OP_OMAPGETVALSBYKEYS =
223 CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 20,
224 CEPH_OSD_OP_OMAPSETVALS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 21,
225 CEPH_OSD_OP_OMAPSETHEADER = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 22,
226 CEPH_OSD_OP_OMAPCLEAR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 23,
227 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
228 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
229
230 /** multi **/
231 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
232 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
233 CEPH_OSD_OP_SRC_CMPXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 3,
234
220 /** attrs **/ 235 /** attrs **/
221 /* read */ 236 /* read */
222 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 237 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -238,6 +253,7 @@ enum {
238 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6, 253 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
239 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7, 254 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
240 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8, 255 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
256 CEPH_OSD_OP_SCRUB_MAP = CEPH_OSD_OP_MODE_SUB | 9,
241 257
242 /** lock **/ 258 /** lock **/
243 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, 259 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
@@ -248,10 +264,12 @@ enum {
248 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6, 264 CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
249 265
250 /** exec **/ 266 /** exec **/
267 /* note: the RD bit here is wrong; see special-case below in helper */
251 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1, 268 CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
252 269
253 /** pg **/ 270 /** pg **/
254 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1, 271 CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
272 CEPH_OSD_OP_PGLS_FILTER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 2,
255}; 273};
256 274
257static inline int ceph_osd_op_type_lock(int op) 275static inline int ceph_osd_op_type_lock(int op)
@@ -274,6 +292,10 @@ static inline int ceph_osd_op_type_pg(int op)
274{ 292{
275 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG; 293 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
276} 294}
295static inline int ceph_osd_op_type_multi(int op)
296{
297 return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_MULTI;
298}
277 299
278static inline int ceph_osd_op_mode_subop(int op) 300static inline int ceph_osd_op_mode_subop(int op)
279{ 301{
@@ -281,11 +303,12 @@ static inline int ceph_osd_op_mode_subop(int op)
281} 303}
282static inline int ceph_osd_op_mode_read(int op) 304static inline int ceph_osd_op_mode_read(int op)
283{ 305{
284 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_RD; 306 return (op & CEPH_OSD_OP_MODE_RD) &&
307 op != CEPH_OSD_OP_CALL;
285} 308}
286static inline int ceph_osd_op_mode_modify(int op) 309static inline int ceph_osd_op_mode_modify(int op)
287{ 310{
288 return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_WR; 311 return op & CEPH_OSD_OP_MODE_WR;
289} 312}
290 313
291/* 314/*
@@ -294,34 +317,38 @@ static inline int ceph_osd_op_mode_modify(int op)
294 */ 317 */
295#define CEPH_OSD_TMAP_HDR 'h' 318#define CEPH_OSD_TMAP_HDR 'h'
296#define CEPH_OSD_TMAP_SET 's' 319#define CEPH_OSD_TMAP_SET 's'
320#define CEPH_OSD_TMAP_CREATE 'c' /* create key */
297#define CEPH_OSD_TMAP_RM 'r' 321#define CEPH_OSD_TMAP_RM 'r'
322#define CEPH_OSD_TMAP_RMSLOPPY 'R'
298 323
299extern const char *ceph_osd_op_name(int op); 324extern const char *ceph_osd_op_name(int op);
300 325
301
302/* 326/*
303 * osd op flags 327 * osd op flags
304 * 328 *
305 * An op may be READ, WRITE, or READ|WRITE. 329 * An op may be READ, WRITE, or READ|WRITE.
306 */ 330 */
307enum { 331enum {
308 CEPH_OSD_FLAG_ACK = 1, /* want (or is) "ack" ack */ 332 CEPH_OSD_FLAG_ACK = 0x0001, /* want (or is) "ack" ack */
309 CEPH_OSD_FLAG_ONNVRAM = 2, /* want (or is) "onnvram" ack */ 333 CEPH_OSD_FLAG_ONNVRAM = 0x0002, /* want (or is) "onnvram" ack */
310 CEPH_OSD_FLAG_ONDISK = 4, /* want (or is) "ondisk" ack */ 334 CEPH_OSD_FLAG_ONDISK = 0x0004, /* want (or is) "ondisk" ack */
311 CEPH_OSD_FLAG_RETRY = 8, /* resend attempt */ 335 CEPH_OSD_FLAG_RETRY = 0x0008, /* resend attempt */
312 CEPH_OSD_FLAG_READ = 16, /* op may read */ 336 CEPH_OSD_FLAG_READ = 0x0010, /* op may read */
313 CEPH_OSD_FLAG_WRITE = 32, /* op may write */ 337 CEPH_OSD_FLAG_WRITE = 0x0020, /* op may write */
314 CEPH_OSD_FLAG_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */ 338 CEPH_OSD_FLAG_ORDERSNAP = 0x0040, /* EOLDSNAP if snapc is out of order */
315 CEPH_OSD_FLAG_PEERSTAT = 128, /* msg includes osd_peer_stat */ 339 CEPH_OSD_FLAG_PEERSTAT_OLD = 0x0080, /* DEPRECATED msg includes osd_peer_stat */
316 CEPH_OSD_FLAG_BALANCE_READS = 256, 340 CEPH_OSD_FLAG_BALANCE_READS = 0x0100,
317 CEPH_OSD_FLAG_PARALLELEXEC = 512, /* execute op in parallel */ 341 CEPH_OSD_FLAG_PARALLELEXEC = 0x0200, /* execute op in parallel */
318 CEPH_OSD_FLAG_PGOP = 1024, /* pg op, no object */ 342 CEPH_OSD_FLAG_PGOP = 0x0400, /* pg op, no object */
319 CEPH_OSD_FLAG_EXEC = 2048, /* op may exec */ 343 CEPH_OSD_FLAG_EXEC = 0x0800, /* op may exec */
320 CEPH_OSD_FLAG_EXEC_PUBLIC = 4096, /* op may exec (public) */ 344 CEPH_OSD_FLAG_EXEC_PUBLIC = 0x1000, /* DEPRECATED op may exec (public) */
345 CEPH_OSD_FLAG_LOCALIZE_READS = 0x2000, /* read from nearby replica, if any */
346 CEPH_OSD_FLAG_RWORDERED = 0x4000, /* order wrt concurrent reads */
321}; 347};
322 348
323enum { 349enum {
324 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */ 350 CEPH_OSD_OP_FLAG_EXCL = 1, /* EXCL object create */
351 CEPH_OSD_OP_FLAG_FAILOK = 2, /* continue despite failure */
325}; 352};
326 353
327#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/ 354#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
@@ -381,48 +408,13 @@ struct ceph_osd_op {
381 __le64 ver; 408 __le64 ver;
382 __u8 flag; /* 0 = unwatch, 1 = watch */ 409 __u8 flag; /* 0 = unwatch, 1 = watch */
383 } __attribute__ ((packed)) watch; 410 } __attribute__ ((packed)) watch;
384}; 411 struct {
412 __le64 offset, length;
413 __le64 src_offset;
414 } __attribute__ ((packed)) clonerange;
415 };
385 __le32 payload_len; 416 __le32 payload_len;
386} __attribute__ ((packed)); 417} __attribute__ ((packed));
387 418
388/*
389 * osd request message header. each request may include multiple
390 * ceph_osd_op object operations.
391 */
392struct ceph_osd_request_head {
393 __le32 client_inc; /* client incarnation */
394 struct ceph_object_layout layout; /* pgid */
395 __le32 osdmap_epoch; /* client's osdmap epoch */
396
397 __le32 flags;
398
399 struct ceph_timespec mtime; /* for mutations only */
400 struct ceph_eversion reassert_version; /* if we are replaying op */
401
402 __le32 object_len; /* length of object name */
403
404 __le64 snapid; /* snapid to read */
405 __le64 snap_seq; /* writer's snap context */
406 __le32 num_snaps;
407
408 __le16 num_ops;
409 struct ceph_osd_op ops[]; /* followed by ops[], obj, ticket, snaps */
410} __attribute__ ((packed));
411
412struct ceph_osd_reply_head {
413 __le32 client_inc; /* client incarnation */
414 __le32 flags;
415 struct ceph_object_layout layout;
416 __le32 osdmap_epoch;
417 struct ceph_eversion reassert_version; /* for replaying uncommitted */
418
419 __le32 result; /* result code */
420
421 __le32 object_len; /* length of object name */
422 __le32 num_ops;
423 struct ceph_osd_op ops[0]; /* ops[], object */
424} __attribute__ ((packed));
425
426
427 419
428#endif 420#endif
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7d73905dcba2..900af5964f55 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -203,6 +203,7 @@ struct cgroup {
203 203
204 /* For RCU-protected deletion */ 204 /* For RCU-protected deletion */
205 struct rcu_head rcu_head; 205 struct rcu_head rcu_head;
206 struct work_struct free_work;
206 207
207 /* List of events which userspace want to receive */ 208 /* List of events which userspace want to receive */
208 struct list_head event_list; 209 struct list_head event_list;
@@ -558,6 +559,7 @@ static inline struct cgroup* task_cgroup(struct task_struct *task,
558 559
559struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos, 560struct cgroup *cgroup_next_descendant_pre(struct cgroup *pos,
560 struct cgroup *cgroup); 561 struct cgroup *cgroup);
562struct cgroup *cgroup_rightmost_descendant(struct cgroup *pos);
561 563
562/** 564/**
563 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants 565 * cgroup_for_each_descendant_pre - pre-order walk of a cgroup's descendants
@@ -706,7 +708,6 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
706static inline int cgroup_init_early(void) { return 0; } 708static inline int cgroup_init_early(void) { return 0; }
707static inline int cgroup_init(void) { return 0; } 709static inline int cgroup_init(void) { return 0; }
708static inline void cgroup_fork(struct task_struct *p) {} 710static inline void cgroup_fork(struct task_struct *p) {}
709static inline void cgroup_fork_callbacks(struct task_struct *p) {}
710static inline void cgroup_post_fork(struct task_struct *p) {} 711static inline void cgroup_post_fork(struct task_struct *p) {}
711static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 712static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
712 713
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 4989b8a7bed1..7f197d7addb0 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -379,7 +379,13 @@ struct clk_onecell_data {
379}; 379};
380struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); 380struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
381const char *of_clk_get_parent_name(struct device_node *np, int index); 381const char *of_clk_get_parent_name(struct device_node *np, int index);
382
382void of_clk_init(const struct of_device_id *matches); 383void of_clk_init(const struct of_device_id *matches);
383 384
385#define CLK_OF_DECLARE(name, compat, fn) \
386 static const struct of_device_id __clk_of_table_##name \
387 __used __section(__clk_of_table) \
388 = { .compatible = compat, .data = fn };
389
384#endif /* CONFIG_COMMON_CLK */ 390#endif /* CONFIG_COMMON_CLK */
385#endif /* CLK_PROVIDER_H */ 391#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
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/tegra.h b/include/linux/clk/tegra.h
new file mode 100644
index 000000000000..404d6f940872
--- /dev/null
+++ b/include/linux/clk/tegra.h
@@ -0,0 +1,127 @@
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 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_CLK_TEGRA_H_
18#define __LINUX_CLK_TEGRA_H_
19
20#include <linux/clk.h>
21
22/*
23 * Tegra CPU clock and reset control ops
24 *
25 * wait_for_reset:
26 * keep waiting until the CPU in reset state
27 * put_in_reset:
28 * put the CPU in reset state
29 * out_of_reset:
30 * release the CPU from reset state
31 * enable_clock:
32 * CPU clock un-gate
33 * disable_clock:
34 * CPU clock gate
35 * rail_off_ready:
36 * CPU is ready for rail off
37 * suspend:
38 * save the clock settings when CPU go into low-power state
39 * resume:
40 * restore the clock settings when CPU exit low-power state
41 */
42struct tegra_cpu_car_ops {
43 void (*wait_for_reset)(u32 cpu);
44 void (*put_in_reset)(u32 cpu);
45 void (*out_of_reset)(u32 cpu);
46 void (*enable_clock)(u32 cpu);
47 void (*disable_clock)(u32 cpu);
48#ifdef CONFIG_PM_SLEEP
49 bool (*rail_off_ready)(void);
50 void (*suspend)(void);
51 void (*resume)(void);
52#endif
53};
54
55extern struct tegra_cpu_car_ops *tegra_cpu_car_ops;
56
57static inline void tegra_wait_cpu_in_reset(u32 cpu)
58{
59 if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset))
60 return;
61
62 tegra_cpu_car_ops->wait_for_reset(cpu);
63}
64
65static inline void tegra_put_cpu_in_reset(u32 cpu)
66{
67 if (WARN_ON(!tegra_cpu_car_ops->put_in_reset))
68 return;
69
70 tegra_cpu_car_ops->put_in_reset(cpu);
71}
72
73static inline void tegra_cpu_out_of_reset(u32 cpu)
74{
75 if (WARN_ON(!tegra_cpu_car_ops->out_of_reset))
76 return;
77
78 tegra_cpu_car_ops->out_of_reset(cpu);
79}
80
81static inline void tegra_enable_cpu_clock(u32 cpu)
82{
83 if (WARN_ON(!tegra_cpu_car_ops->enable_clock))
84 return;
85
86 tegra_cpu_car_ops->enable_clock(cpu);
87}
88
89static inline void tegra_disable_cpu_clock(u32 cpu)
90{
91 if (WARN_ON(!tegra_cpu_car_ops->disable_clock))
92 return;
93
94 tegra_cpu_car_ops->disable_clock(cpu);
95}
96
97#ifdef CONFIG_PM_SLEEP
98static inline bool tegra_cpu_rail_off_ready(void)
99{
100 if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready))
101 return false;
102
103 return tegra_cpu_car_ops->rail_off_ready();
104}
105
106static inline void tegra_cpu_clock_suspend(void)
107{
108 if (WARN_ON(!tegra_cpu_car_ops->suspend))
109 return;
110
111 tegra_cpu_car_ops->suspend();
112}
113
114static inline void tegra_cpu_clock_resume(void)
115{
116 if (WARN_ON(!tegra_cpu_car_ops->resume))
117 return;
118
119 tegra_cpu_car_ops->resume();
120}
121#endif
122
123void tegra_periph_reset_deassert(struct clk *c);
124void tegra_periph_reset_assert(struct clk *c);
125void tegra_clocks_init(void);
126
127#endif /* __LINUX_CLK_TEGRA_H_ */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 8a7096fcb01e..66346521cb65 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -161,6 +161,15 @@ clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
161extern void clockevents_suspend(void); 161extern void clockevents_suspend(void);
162extern void clockevents_resume(void); 162extern void clockevents_resume(void);
163 163
164#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
165#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST
166extern void tick_broadcast(const struct cpumask *mask);
167#else
168#define tick_broadcast NULL
169#endif
170extern int tick_receive_broadcast(void);
171#endif
172
164#ifdef CONFIG_GENERIC_CLOCKEVENTS 173#ifdef CONFIG_GENERIC_CLOCKEVENTS
165extern void clockevents_notify(unsigned long reason, void *arg); 174extern void clockevents_notify(unsigned long reason, void *arg);
166#else 175#else
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 4dceaf8ae152..27cfda427dd9 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -332,4 +332,15 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
332 332
333extern int clocksource_i8253_init(void); 333extern int clocksource_i8253_init(void);
334 334
335#ifdef CONFIG_CLKSRC_OF
336extern void clocksource_of_init(void);
337
338#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
339 static const struct of_device_id __clksrc_of_table_##name \
340 __used __section(__clksrc_of_table) \
341 = { .compatible = compat, .data = fn };
342#else
343#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)
344#endif
345
335#endif /* _LINUX_CLOCKSOURCE_H */ 346#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8031d6eef102..5b8721efa948 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -34,7 +34,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid,
34 const char *name, int length, int *type, 34 const char *name, int length, int *type,
35 struct CodaFid *resfid); 35 struct CodaFid *resfid);
36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, 36int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
37 vuid_t uid); 37 kuid_t uid);
38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, 38int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
39 struct file **f); 39 struct file **f);
40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, 40int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 6ecb6dc2f303..091d72e70d8a 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,8 +22,8 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended, struct page **page); 25 bool sync, bool *contended);
26extern int compact_pgdat(pg_data_t *pgdat, int order); 26extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 27extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
29 29
@@ -75,14 +75,13 @@ static inline bool compaction_restarting(struct zone *zone, int order)
75#else 75#else
76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
77 int order, gfp_t gfp_mask, nodemask_t *nodemask, 77 int order, gfp_t gfp_mask, nodemask_t *nodemask,
78 bool sync, bool *contended, struct page **page) 78 bool sync, bool *contended)
79{ 79{
80 return COMPACT_CONTINUE; 80 return COMPACT_CONTINUE;
81} 81}
82 82
83static inline int compact_pgdat(pg_data_t *pgdat, int order) 83static inline void compact_pgdat(pg_data_t *pgdat, int order)
84{ 84{
85 return COMPACT_CONTINUE;
86} 85}
87 86
88static inline void reset_isolation_suitable(pg_data_t *pgdat) 87static inline void reset_isolation_suitable(pg_data_t *pgdat)
diff --git a/include/linux/compat.h b/include/linux/compat.h
index dec7e2d18875..76a87fb57ac2 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -68,7 +68,6 @@
68#ifndef compat_user_stack_pointer 68#ifndef compat_user_stack_pointer
69#define compat_user_stack_pointer() current_user_stack_pointer() 69#define compat_user_stack_pointer() current_user_stack_pointer()
70#endif 70#endif
71#ifdef CONFIG_GENERIC_SIGALTSTACK
72#ifndef compat_sigaltstack /* we'll need that for MIPS */ 71#ifndef compat_sigaltstack /* we'll need that for MIPS */
73typedef struct compat_sigaltstack { 72typedef struct compat_sigaltstack {
74 compat_uptr_t ss_sp; 73 compat_uptr_t ss_sp;
@@ -76,7 +75,6 @@ typedef struct compat_sigaltstack {
76 compat_size_t ss_size; 75 compat_size_t ss_size;
77} compat_stack_t; 76} compat_stack_t;
78#endif 77#endif
79#endif
80 78
81#define compat_jiffies_to_clock_t(x) \ 79#define compat_jiffies_to_clock_t(x) \
82 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 80 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
@@ -142,6 +140,20 @@ typedef struct {
142 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 140 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
143} compat_sigset_t; 141} compat_sigset_t;
144 142
143struct compat_sigaction {
144#ifndef __ARCH_HAS_ODD_SIGACTION
145 compat_uptr_t sa_handler;
146 compat_ulong_t sa_flags;
147#else
148 compat_ulong_t sa_flags;
149 compat_uptr_t sa_handler;
150#endif
151#ifdef __ARCH_HAS_SA_RESTORER
152 compat_uptr_t sa_restorer;
153#endif
154 compat_sigset_t sa_mask __packed;
155};
156
145/* 157/*
146 * These functions operate strictly on struct compat_time* 158 * These functions operate strictly on struct compat_time*
147 */ 159 */
@@ -283,6 +295,15 @@ struct compat_robust_list_head {
283 compat_uptr_t list_op_pending; 295 compat_uptr_t list_op_pending;
284}; 296};
285 297
298#ifdef CONFIG_COMPAT_OLD_SIGACTION
299struct compat_old_sigaction {
300 compat_uptr_t sa_handler;
301 compat_old_sigset_t sa_mask;
302 compat_ulong_t sa_flags;
303 compat_uptr_t sa_restorer;
304};
305#endif
306
286struct compat_statfs; 307struct compat_statfs;
287struct compat_statfs64; 308struct compat_statfs64;
288struct compat_old_linux_dirent; 309struct compat_old_linux_dirent;
@@ -338,6 +359,7 @@ asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
338asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, 359asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
339 const struct compat_iovec __user *vec, 360 const struct compat_iovec __user *vec,
340 unsigned long vlen, u32 pos_low, u32 pos_high); 361 unsigned long vlen, u32 pos_low, u32 pos_high);
362asmlinkage long comat_sys_lseek(unsigned int, compat_off_t, unsigned int);
341 363
342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 364asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
343 const compat_uptr_t __user *envp); 365 const compat_uptr_t __user *envp);
@@ -367,6 +389,11 @@ int get_compat_sigevent(struct sigevent *event,
367 const struct compat_sigevent __user *u_event); 389 const struct compat_sigevent __user *u_event);
368long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, 390long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
369 struct compat_siginfo __user *uinfo); 391 struct compat_siginfo __user *uinfo);
392#ifdef CONFIG_COMPAT_OLD_SIGACTION
393asmlinkage long compat_sys_sigaction(int sig,
394 const struct compat_old_sigaction __user *act,
395 struct compat_old_sigaction __user *oact);
396#endif
370 397
371static inline int compat_timeval_compare(struct compat_timeval *lhs, 398static inline int compat_timeval_compare(struct compat_timeval *lhs,
372 struct compat_timeval *rhs) 399 struct compat_timeval *rhs)
@@ -401,7 +428,8 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
401asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 428asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
402 429
403extern int compat_printk(const char *fmt, ...); 430extern int compat_printk(const char *fmt, ...);
404extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); 431extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
432extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
405 433
406asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, 434asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
407 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 435 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
@@ -503,11 +531,13 @@ asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
503 unsigned int nr_segs, unsigned int flags); 531 unsigned int nr_segs, unsigned int flags);
504asmlinkage long compat_sys_open(const char __user *filename, int flags, 532asmlinkage long compat_sys_open(const char __user *filename, int flags,
505 umode_t mode); 533 umode_t mode);
506asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 534asmlinkage long compat_sys_openat(int dfd, const char __user *filename,
507 int flags, umode_t mode); 535 int flags, umode_t mode);
508asmlinkage long compat_sys_open_by_handle_at(int mountdirfd, 536asmlinkage long compat_sys_open_by_handle_at(int mountdirfd,
509 struct file_handle __user *handle, 537 struct file_handle __user *handle,
510 int flags); 538 int flags);
539asmlinkage long compat_sys_truncate(const char __user *, compat_off_t);
540asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t);
511asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 541asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
512 compat_ulong_t __user *outp, 542 compat_ulong_t __user *outp,
513 compat_ulong_t __user *exp, 543 compat_ulong_t __user *exp,
@@ -592,6 +622,19 @@ asmlinkage long compat_sys_rt_sigtimedwait(compat_sigset_t __user *uthese,
592 struct compat_timespec __user *uts, compat_size_t sigsetsize); 622 struct compat_timespec __user *uts, compat_size_t sigsetsize);
593asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, 623asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset,
594 compat_size_t sigsetsize); 624 compat_size_t sigsetsize);
625asmlinkage long compat_sys_rt_sigprocmask(int how, compat_sigset_t __user *set,
626 compat_sigset_t __user *oset,
627 compat_size_t sigsetsize);
628asmlinkage long compat_sys_rt_sigpending(compat_sigset_t __user *uset,
629 compat_size_t sigsetsize);
630#ifndef CONFIG_ODD_RT_SIGACTION
631asmlinkage long compat_sys_rt_sigaction(int,
632 const struct compat_sigaction __user *,
633 struct compat_sigaction __user *,
634 compat_size_t);
635#endif
636asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
637 struct compat_siginfo __user *uinfo);
595asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); 638asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
596asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 639asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
597 unsigned long arg); 640 unsigned long arg);
@@ -642,13 +685,11 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
642 685
643asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 686asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
644 compat_off_t __user *offset, compat_size_t count); 687 compat_off_t __user *offset, compat_size_t count);
645#ifdef CONFIG_GENERIC_SIGALTSTACK
646asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 688asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,
647 compat_stack_t __user *uoss_ptr); 689 compat_stack_t __user *uoss_ptr);
648 690
649int compat_restore_altstack(const compat_stack_t __user *uss); 691int compat_restore_altstack(const compat_stack_t __user *uss);
650int __compat_save_altstack(compat_stack_t __user *, unsigned long); 692int __compat_save_altstack(compat_stack_t __user *, unsigned long);
651#endif
652 693
653asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, 694asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid,
654 struct compat_timespec __user *interval); 695 struct compat_timespec __user *interval);
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 6a6d7aefe12d..24545cd90a25 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -5,6 +5,9 @@
5/* 5/*
6 * Common definitions for all gcc versions go here. 6 * Common definitions for all gcc versions go here.
7 */ 7 */
8#define GCC_VERSION (__GNUC__ * 10000 \
9 + __GNUC_MINOR__ * 100 \
10 + __GNUC_PATCHLEVEL__)
8 11
9 12
10/* Optimization barrier */ 13/* Optimization barrier */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 37d412436d0f..7d89febe4d79 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -2,22 +2,22 @@
2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5#if __GNUC_MINOR__ < 2 5#if GCC_VERSION < 30200
6# error Sorry, your compiler is too old - please upgrade it. 6# error Sorry, your compiler is too old - please upgrade it.
7#endif 7#endif
8 8
9#if __GNUC_MINOR__ >= 3 9#if GCC_VERSION >= 30300
10# define __used __attribute__((__used__)) 10# define __used __attribute__((__used__))
11#else 11#else
12# define __used __attribute__((__unused__)) 12# define __used __attribute__((__unused__))
13#endif 13#endif
14 14
15#if __GNUC_MINOR__ >= 4 15#if GCC_VERSION >= 30400
16#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
17#endif 17#endif
18 18
19#ifdef CONFIG_GCOV_KERNEL 19#ifdef CONFIG_GCOV_KERNEL
20# if __GNUC_MINOR__ < 4 20# if GCC_VERSION < 30400
21# error "GCOV profiling support for gcc versions below 3.4 not included" 21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */ 22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */ 23#endif /* CONFIG_GCOV_KERNEL */
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 662fd1b4c42a..68b162d92254 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -4,7 +4,7 @@
4 4
5/* GCC 4.1.[01] miscompiles __weak */ 5/* GCC 4.1.[01] miscompiles __weak */
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 7# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
8# error Your version of gcc miscompiles the __weak directive 8# error Your version of gcc miscompiles the __weak directive
9# endif 9# endif
10#endif 10#endif
@@ -13,7 +13,11 @@
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15 15
16#if __GNUC_MINOR__ >= 3 16#if GCC_VERSION >= 40100
17# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
18#endif
19
20#if GCC_VERSION >= 40300
17/* Mark functions as cold. gcc will assume any path leading to a call 21/* Mark functions as cold. gcc will assume any path leading to a call
18 to them will be unlikely. This means a lot of manual unlikely()s 22 to them will be unlikely. This means a lot of manual unlikely()s
19 are unnecessary now for any paths leading to the usual suspects 23 are unnecessary now for any paths leading to the usual suspects
@@ -29,11 +33,15 @@
29 the kernel context */ 33 the kernel context */
30#define __cold __attribute__((__cold__)) 34#define __cold __attribute__((__cold__))
31 35
32#define __linktime_error(message) __attribute__((__error__(message)))
33
34#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) 36#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
35 37
36#if __GNUC_MINOR__ >= 5 38#ifndef __CHECKER__
39# define __compiletime_warning(message) __attribute__((warning(message)))
40# define __compiletime_error(message) __attribute__((error(message)))
41#endif /* __CHECKER__ */
42#endif /* GCC_VERSION >= 40300 */
43
44#if GCC_VERSION >= 40500
37/* 45/*
38 * Mark a position in code as unreachable. This can be used to 46 * Mark a position in code as unreachable. This can be used to
39 * suppress control flow warnings after asm blocks that transfer 47 * suppress control flow warnings after asm blocks that transfer
@@ -48,30 +56,22 @@
48/* Mark a function definition as prohibited from being cloned. */ 56/* Mark a function definition as prohibited from being cloned. */
49#define __noclone __attribute__((__noclone__)) 57#define __noclone __attribute__((__noclone__))
50 58
51#endif 59#endif /* GCC_VERSION >= 40500 */
52#endif
53 60
54#if __GNUC_MINOR__ >= 6 61#if GCC_VERSION >= 40600
55/* 62/*
56 * Tell the optimizer that something else uses this function or variable. 63 * Tell the optimizer that something else uses this function or variable.
57 */ 64 */
58#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
59#endif 66#endif
60 67
61#if __GNUC_MINOR__ > 0
62#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
63#endif
64#if __GNUC_MINOR__ >= 3 && !defined(__CHECKER__)
65#define __compiletime_warning(message) __attribute__((warning(message)))
66#define __compiletime_error(message) __attribute__((error(message)))
67#endif
68 68
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if __GNUC_MINOR__ >= 4 70#if GCC_VERSION >= 40400
71#define __HAVE_BUILTIN_BSWAP32__ 71#define __HAVE_BUILTIN_BSWAP32__
72#define __HAVE_BUILTIN_BSWAP64__ 72#define __HAVE_BUILTIN_BSWAP64__
73#endif 73#endif
74#if __GNUC_MINOR__ >= 8 || (defined(__powerpc__) && __GNUC_MINOR__ >= 6) 74#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
75#define __HAVE_BUILTIN_BSWAP16__ 75#define __HAVE_BUILTIN_BSWAP16__
76#endif 76#endif
77#endif 77#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index dd852b73b286..10b8f23fab0f 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -307,10 +307,36 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
307#endif 307#endif
308#ifndef __compiletime_error 308#ifndef __compiletime_error
309# define __compiletime_error(message) 309# define __compiletime_error(message)
310# define __compiletime_error_fallback(condition) \
311 do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
312#else
313# define __compiletime_error_fallback(condition) do { } while (0)
310#endif 314#endif
311#ifndef __linktime_error 315
312# define __linktime_error(message) 316#define __compiletime_assert(condition, msg, prefix, suffix) \
313#endif 317 do { \
318 bool __cond = !(condition); \
319 extern void prefix ## suffix(void) __compiletime_error(msg); \
320 if (__cond) \
321 prefix ## suffix(); \
322 __compiletime_error_fallback(__cond); \
323 } while (0)
324
325#define _compiletime_assert(condition, msg, prefix, suffix) \
326 __compiletime_assert(condition, msg, prefix, suffix)
327
328/**
329 * compiletime_assert - break build and emit msg if condition is false
330 * @condition: a compile-time constant condition to check
331 * @msg: a message to emit if condition is false
332 *
333 * In tradition of POSIX assert, this macro will break the build if the
334 * supplied condition is *false*, emitting the supplied error message if the
335 * compiler has support to do so.
336 */
337#define compiletime_assert(condition, msg) \
338 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
339
314/* 340/*
315 * Prevent the compiler from merging or refetching accesses. The compiler 341 * Prevent the compiler from merging or refetching accesses. The compiler
316 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 342 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 51494e6b5548..33f0280fd533 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -77,10 +77,13 @@ static inline void init_completion(struct completion *x)
77} 77}
78 78
79extern void wait_for_completion(struct completion *); 79extern void wait_for_completion(struct completion *);
80extern void wait_for_completion_io(struct completion *);
80extern int wait_for_completion_interruptible(struct completion *x); 81extern int wait_for_completion_interruptible(struct completion *x);
81extern int wait_for_completion_killable(struct completion *x); 82extern int wait_for_completion_killable(struct completion *x);
82extern unsigned long wait_for_completion_timeout(struct completion *x, 83extern unsigned long wait_for_completion_timeout(struct completion *x,
83 unsigned long timeout); 84 unsigned long timeout);
85extern unsigned long wait_for_completion_io_timeout(struct completion *x,
86 unsigned long timeout);
84extern long wait_for_completion_interruptible_timeout( 87extern long wait_for_completion_interruptible_timeout(
85 struct completion *x, unsigned long timeout); 88 struct completion *x, unsigned long timeout);
86extern long wait_for_completion_killable_timeout( 89extern long wait_for_completion_killable_timeout(
diff --git a/include/linux/console.h b/include/linux/console.h
index dedb082fe50f..29680a8cda99 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -77,7 +77,9 @@ extern const struct consw prom_con; /* SPARC PROM console */
77int con_is_bound(const struct consw *csw); 77int con_is_bound(const struct consw *csw);
78int register_con_driver(const struct consw *csw, int first, int last); 78int register_con_driver(const struct consw *csw, int first, int last);
79int unregister_con_driver(const struct consw *csw); 79int unregister_con_driver(const struct consw *csw);
80int do_unregister_con_driver(const struct consw *csw);
80int take_over_console(const struct consw *sw, int first, int last, int deflt); 81int take_over_console(const struct consw *sw, int first, int last, int deflt);
82int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
81void give_up_console(const struct consw *sw); 83void give_up_console(const struct consw *sw);
82#ifdef CONFIG_HW_CONSOLE 84#ifdef CONFIG_HW_CONSOLE
83int con_debug_enter(struct vc_data *vc); 85int con_debug_enter(struct vc_data *vc);
@@ -157,7 +159,12 @@ extern int is_console_locked(void);
157extern int braille_register_console(struct console *, int index, 159extern int braille_register_console(struct console *, int index,
158 char *console_options, char *braille_options); 160 char *console_options, char *braille_options);
159extern int braille_unregister_console(struct console *); 161extern int braille_unregister_console(struct console *);
162#ifdef CONFIG_TTY
160extern void console_sysfs_notify(void); 163extern void console_sysfs_notify(void);
164#else
165static inline void console_sysfs_notify(void)
166{ }
167#endif
161extern bool console_suspend_enabled; 168extern bool console_suspend_enabled;
162 169
163/* Suspend and resume console messages over PM events */ 170/* Suspend and resume console messages over PM events */
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index e24339ccb7f0..b28d161c1091 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -3,12 +3,40 @@
3 3
4#ifdef CONFIG_CONTEXT_TRACKING 4#ifdef CONFIG_CONTEXT_TRACKING
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/percpu.h>
7
8struct context_tracking {
9 /*
10 * When active is false, probes are unset in order
11 * to minimize overhead: TIF flags are cleared
12 * and calls to user_enter/exit are ignored. This
13 * may be further optimized using static keys.
14 */
15 bool active;
16 enum {
17 IN_KERNEL = 0,
18 IN_USER,
19 } state;
20};
21
22DECLARE_PER_CPU(struct context_tracking, context_tracking);
23
24static inline bool context_tracking_in_user(void)
25{
26 return __this_cpu_read(context_tracking.state) == IN_USER;
27}
28
29static inline bool context_tracking_active(void)
30{
31 return __this_cpu_read(context_tracking.active);
32}
6 33
7extern void user_enter(void); 34extern void user_enter(void);
8extern void user_exit(void); 35extern void user_exit(void);
9extern void context_tracking_task_switch(struct task_struct *prev, 36extern void context_tracking_task_switch(struct task_struct *prev,
10 struct task_struct *next); 37 struct task_struct *next);
11#else 38#else
39static inline bool context_tracking_in_user(void) { return false; }
12static inline void user_enter(void) { } 40static inline void user_enter(void) { }
13static inline void user_exit(void) { } 41static inline void user_exit(void) { }
14static inline void context_tracking_task_switch(struct task_struct *prev, 42static inline void context_tracking_task_switch(struct task_struct *prev,
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index ac3bbb5b9502..1739510d8994 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -13,9 +13,11 @@
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/gfp.h> 14#include <linux/gfp.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/kref.h>
16 17
17/** 18/**
18 * struct cpu_rmap - CPU affinity reverse-map 19 * struct cpu_rmap - CPU affinity reverse-map
20 * @refcount: kref for object
19 * @size: Number of objects to be reverse-mapped 21 * @size: Number of objects to be reverse-mapped
20 * @used: Number of objects added 22 * @used: Number of objects added
21 * @obj: Pointer to array of object pointers 23 * @obj: Pointer to array of object pointers
@@ -23,6 +25,7 @@
23 * based on affinity masks 25 * based on affinity masks
24 */ 26 */
25struct cpu_rmap { 27struct cpu_rmap {
28 struct kref refcount;
26 u16 size, used; 29 u16 size, used;
27 void **obj; 30 void **obj;
28 struct { 31 struct {
@@ -33,15 +36,7 @@ struct cpu_rmap {
33#define CPU_RMAP_DIST_INF 0xffff 36#define CPU_RMAP_DIST_INF 0xffff
34 37
35extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags); 38extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
36 39extern int cpu_rmap_put(struct cpu_rmap *rmap);
37/**
38 * free_cpu_rmap - free CPU affinity reverse-map
39 * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL
40 */
41static inline void free_cpu_rmap(struct cpu_rmap *rmap)
42{
43 kfree(rmap);
44}
45 40
46extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj); 41extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
47extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index, 42extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index a55b88eaf96a..a22944ca0526 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -89,11 +89,15 @@ struct cpufreq_real_policy {
89}; 89};
90 90
91struct cpufreq_policy { 91struct cpufreq_policy {
92 cpumask_var_t cpus; /* CPUs requiring sw coordination */ 92 /* CPUs sharing clock, require sw coordination */
93 cpumask_var_t related_cpus; /* CPUs with any coordination */ 93 cpumask_var_t cpus; /* Online CPUs only */
94 unsigned int shared_type; /* ANY or ALL affected CPUs 94 cpumask_var_t related_cpus; /* Online + Offline CPUs */
95
96 unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs
95 should set cpufreq */ 97 should set cpufreq */
96 unsigned int cpu; /* cpu nr of registered CPU */ 98 unsigned int cpu; /* cpu nr of CPU managing this policy */
99 unsigned int last_cpu; /* cpu nr of previous CPU that managed
100 * this policy */
97 struct cpufreq_cpuinfo cpuinfo;/* see above */ 101 struct cpufreq_cpuinfo cpuinfo;/* see above */
98 102
99 unsigned int min; /* in kHz */ 103 unsigned int min; /* in kHz */
@@ -112,16 +116,23 @@ struct cpufreq_policy {
112 struct completion kobj_unregister; 116 struct completion kobj_unregister;
113}; 117};
114 118
115#define CPUFREQ_ADJUST (0) 119#define CPUFREQ_ADJUST (0)
116#define CPUFREQ_INCOMPATIBLE (1) 120#define CPUFREQ_INCOMPATIBLE (1)
117#define CPUFREQ_NOTIFY (2) 121#define CPUFREQ_NOTIFY (2)
118#define CPUFREQ_START (3) 122#define CPUFREQ_START (3)
123#define CPUFREQ_UPDATE_POLICY_CPU (4)
119 124
125/* Only for ACPI */
120#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 126#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
121#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 127#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
122#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ 128#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
123#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 129#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
124 130
131static inline bool policy_is_shared(struct cpufreq_policy *policy)
132{
133 return cpumask_weight(policy->cpus) > 1;
134}
135
125/******************** cpufreq transition notifiers *******************/ 136/******************** cpufreq transition notifiers *******************/
126 137
127#define CPUFREQ_PRECHANGE (0) 138#define CPUFREQ_PRECHANGE (0)
@@ -173,6 +184,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
173 184
174struct cpufreq_governor { 185struct cpufreq_governor {
175 char name[CPUFREQ_NAME_LEN]; 186 char name[CPUFREQ_NAME_LEN];
187 int initialized;
176 int (*governor) (struct cpufreq_policy *policy, 188 int (*governor) (struct cpufreq_policy *policy,
177 unsigned int event); 189 unsigned int event);
178 ssize_t (*show_setspeed) (struct cpufreq_policy *policy, 190 ssize_t (*show_setspeed) (struct cpufreq_policy *policy,
@@ -308,6 +320,9 @@ __ATTR(_name, 0444, show_##_name, NULL)
308static struct global_attr _name = \ 320static struct global_attr _name = \
309__ATTR(_name, 0644, show_##_name, store_##_name) 321__ATTR(_name, 0644, show_##_name, store_##_name)
310 322
323struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
324void cpufreq_cpu_put(struct cpufreq_policy *data);
325const char *cpufreq_get_current_driver(void);
311 326
312/********************************************************************* 327/*********************************************************************
313 * CPUFREQ 2.6. INTERFACE * 328 * CPUFREQ 2.6. INTERFACE *
@@ -397,14 +412,13 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
397 412
398/* the following 3 funtions are for cpufreq core use only */ 413/* the following 3 funtions are for cpufreq core use only */
399struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); 414struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
400struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
401void cpufreq_cpu_put(struct cpufreq_policy *data);
402 415
403/* the following are really really optional */ 416/* the following are really really optional */
404extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 417extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
405 418
406void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 419void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
407 unsigned int cpu); 420 unsigned int cpu);
421void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
408 422
409void cpufreq_frequency_table_put_attr(unsigned int cpu); 423void cpufreq_frequency_table_put_attr(unsigned int cpu);
410#endif /* _LINUX_CPUFREQ_H */ 424#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 3711b34dc4f9..480c14dc1ddd 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -32,8 +32,6 @@ struct cpuidle_driver;
32 ****************************/ 32 ****************************/
33 33
34struct cpuidle_state_usage { 34struct cpuidle_state_usage {
35 void *driver_data;
36
37 unsigned long long disable; 35 unsigned long long disable;
38 unsigned long long usage; 36 unsigned long long usage;
39 unsigned long long time; /* in US */ 37 unsigned long long time; /* in US */
@@ -62,26 +60,6 @@ struct cpuidle_state {
62 60
63#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 61#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
64 62
65/**
66 * cpuidle_get_statedata - retrieves private driver state data
67 * @st_usage: the state usage statistics
68 */
69static inline void *cpuidle_get_statedata(struct cpuidle_state_usage *st_usage)
70{
71 return st_usage->driver_data;
72}
73
74/**
75 * cpuidle_set_statedata - stores private driver state data
76 * @st_usage: the state usage statistics
77 * @data: the private data
78 */
79static inline void
80cpuidle_set_statedata(struct cpuidle_state_usage *st_usage, void *data)
81{
82 st_usage->driver_data = data;
83}
84
85struct cpuidle_device { 63struct cpuidle_device {
86 unsigned int registered:1; 64 unsigned int registered:1;
87 unsigned int enabled:1; 65 unsigned int enabled:1;
@@ -126,9 +104,9 @@ struct cpuidle_driver {
126 struct module *owner; 104 struct module *owner;
127 int refcnt; 105 int refcnt;
128 106
129 unsigned int power_specified:1;
130 /* set to 1 to use the core cpuidle time keeping (for all states). */ 107 /* set to 1 to use the core cpuidle time keeping (for all states). */
131 unsigned int en_core_tk_irqen:1; 108 unsigned int en_core_tk_irqen:1;
109 /* states array must be ordered in decreasing power consumption */
132 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 110 struct cpuidle_state states[CPUIDLE_STATE_MAX];
133 int state_count; 111 int state_count;
134 int safe_state_index; 112 int safe_state_index;
diff --git a/include/linux/cred.h b/include/linux/cred.h
index abb2cd50f6b2..04421e825365 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -128,7 +128,6 @@ struct cred {
128 struct key *process_keyring; /* keyring private to this process */ 128 struct key *process_keyring; /* keyring private to this process */
129 struct key *thread_keyring; /* keyring private to this thread */ 129 struct key *thread_keyring; /* keyring private to this thread */
130 struct key *request_key_auth; /* assumed request_key authority */ 130 struct key *request_key_auth; /* assumed request_key authority */
131 struct thread_group_cred *tgcred; /* thread-group shared credentials */
132#endif 131#endif
133#ifdef CONFIG_SECURITY 132#ifdef CONFIG_SECURITY
134 void *security; /* subjective LSM security */ 133 void *security; /* subjective LSM security */
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 25baa287cff7..6a1101f24cfb 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -162,6 +162,8 @@ struct crush_map {
162 __u32 choose_local_fallback_tries; 162 __u32 choose_local_fallback_tries;
163 /* choose attempts before giving up */ 163 /* choose attempts before giving up */
164 __u32 choose_total_tries; 164 __u32 choose_total_tries;
165 /* attempt chooseleaf inner descent once; on failure retry outer descent */
166 __u32 chooseleaf_descend_once;
165}; 167};
166 168
167 169
diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h
deleted file mode 100644
index b88f7f428e58..000000000000
--- a/include/linux/cyclomx.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef _CYCLOMX_H
2#define _CYCLOMX_H
3/*
4* cyclomx.h Cyclom 2X WAN Link Driver.
5* User-level API definitions.
6*
7* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
8*
9* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
10*
11* Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
12*
13* This program is free software; you can redistribute it and/or
14* modify it under the terms of the GNU General Public License
15* as published by the Free Software Foundation; either version
16* 2 of the License, or (at your option) any later version.
17* ============================================================================
18* 2000/07/13 acme remove crap #if KERNEL_VERSION > blah
19* 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
20* and cyclomx_close to cyclomx_mod_dec_use_count
21* 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
22* 1999/01/03 acme judicious use of data types
23* 1998/12/27 acme cleanup: PACKED not needed
24* 1998/08/08 acme Version 0.0.1
25*/
26
27#include <linux/wanrouter.h>
28#include <linux/spinlock.h>
29
30#ifdef __KERNEL__
31/* Kernel Interface */
32
33#include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */
34#include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */
35#ifdef CONFIG_CYCLOMX_X25
36#include <linux/cycx_x25.h>
37#endif
38
39/* Adapter Data Space.
40 * This structure is needed because we handle multiple cards, otherwise
41 * static data would do it.
42 */
43struct cycx_device {
44 char devname[WAN_DRVNAME_SZ + 1];/* card name */
45 struct cycx_hw hw; /* hardware configuration */
46 struct wan_device wandev; /* WAN device data space */
47 u32 state_tick; /* link state timestamp */
48 spinlock_t lock;
49 char in_isr; /* interrupt-in-service flag */
50 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
51 wait_queue_head_t wait_stats; /* to wait for the STATS indication */
52 void __iomem *mbox; /* -> mailbox */
53 void (*isr)(struct cycx_device* card); /* interrupt service routine */
54 int (*exec)(struct cycx_device* card, void* u_cmd, void* u_data);
55 union {
56#ifdef CONFIG_CYCLOMX_X25
57 struct { /* X.25 specific data */
58 u32 lo_pvc;
59 u32 hi_pvc;
60 u32 lo_svc;
61 u32 hi_svc;
62 struct cycx_x25_stats stats;
63 spinlock_t lock;
64 u32 connection_keys;
65 } x;
66#endif
67 } u;
68};
69
70/* Public Functions */
71void cycx_set_state(struct cycx_device *card, int state);
72
73#ifdef CONFIG_CYCLOMX_X25
74int cycx_x25_wan_init(struct cycx_device *card, wandev_conf_t *conf);
75#endif
76#endif /* __KERNEL__ */
77#endif /* _CYCLOMX_H */
diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h
deleted file mode 100644
index 12fe6b0bfcff..000000000000
--- a/include/linux/cycx_drv.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2* cycx_drv.h CYCX Support Module. Kernel API Definitions.
3*
4* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5*
6* Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
7*
8* Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
9*
10* This program is free software; you can redistribute it and/or
11* modify it under the terms of the GNU General Public License
12* as published by the Free Software Foundation; either version
13* 2 of the License, or (at your option) any later version.
14* ============================================================================
15* 1999/10/23 acme cycxhw_t cleanup
16* 1999/01/03 acme more judicious use of data types...
17* uclong, ucchar, etc deleted, the u8, u16, u32
18* types are the portable way to go.
19* 1999/01/03 acme judicious use of data types... u16, u32, etc
20* 1998/12/26 acme FIXED_BUFFERS, CONF_OFFSET,
21* removal of cy_read{bwl}
22* 1998/08/08 acme Initial version.
23*/
24#ifndef _CYCX_DRV_H
25#define _CYCX_DRV_H
26
27#define CYCX_WINDOWSIZE 0x4000 /* default dual-port memory window size */
28#define GEN_CYCX_INTR 0x02
29#define RST_ENABLE 0x04
30#define START_CPU 0x06
31#define RST_DISABLE 0x08
32#define FIXED_BUFFERS 0x08
33#define TEST_PATTERN 0xaa55
34#define CMD_OFFSET 0x20
35#define CONF_OFFSET 0x0380
36#define RESET_OFFSET 0x3c00 /* For reset file load */
37#define DATA_OFFSET 0x0100 /* For code and data files load */
38#define START_OFFSET 0x3ff0 /* 80186 starts here */
39
40/**
41 * struct cycx_hw - Adapter hardware configuration
42 * @fwid - firmware ID
43 * @irq - interrupt request level
44 * @dpmbase - dual-port memory base
45 * @dpmsize - dual-port memory size
46 * @reserved - reserved for future use
47 */
48struct cycx_hw {
49 u32 fwid;
50 int irq;
51 void __iomem *dpmbase;
52 u32 dpmsize;
53 u32 reserved[5];
54};
55
56/* Function Prototypes */
57extern int cycx_setup(struct cycx_hw *hw, void *sfm, u32 len, unsigned long base);
58extern int cycx_down(struct cycx_hw *hw);
59extern int cycx_peek(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
60extern int cycx_poke(struct cycx_hw *hw, u32 addr, void *buf, u32 len);
61extern int cycx_exec(void __iomem *addr);
62
63extern void cycx_intr(struct cycx_hw *hw);
64#endif /* _CYCX_DRV_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c1754b59ddd3..1a6bb81f0fe5 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -145,6 +145,7 @@ enum dentry_d_lock_class
145 145
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int);
148 int (*d_hash)(const struct dentry *, const struct inode *, 149 int (*d_hash)(const struct dentry *, const struct inode *,
149 struct qstr *); 150 struct qstr *);
150 int (*d_compare)(const struct dentry *, const struct inode *, 151 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -192,6 +193,8 @@ struct dentry_operations {
192#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x0200
193#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x0400
194 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800
197
195#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x1000
196 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
197 * dput() */ 200 * dput() */
@@ -293,9 +296,9 @@ extern void d_move(struct dentry *, struct dentry *);
293extern struct dentry *d_ancestor(struct dentry *, struct dentry *); 296extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
294 297
295/* appendix may either be NULL or be used for transname suffixes */ 298/* appendix may either be NULL or be used for transname suffixes */
296extern struct dentry *d_lookup(struct dentry *, struct qstr *); 299extern struct dentry *d_lookup(const struct dentry *, const struct qstr *);
297extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 300extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
298extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 301extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *);
299extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 302extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
300 const struct qstr *name, 303 const struct qstr *name,
301 unsigned *seq, struct inode *inode); 304 unsigned *seq, struct inode *inode);
@@ -333,7 +336,6 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
333extern char *__d_path(const struct path *, const struct path *, char *, int); 336extern char *__d_path(const struct path *, const struct path *, char *, int);
334extern char *d_absolute_path(const struct path *, char *, int); 337extern char *d_absolute_path(const struct path *, char *, int);
335extern char *d_path(const struct path *, char *, int); 338extern char *d_path(const struct path *, char *, int);
336extern char *d_path_with_unreachable(const struct path *, char *, int);
337extern char *dentry_path_raw(struct dentry *, char *, int); 339extern char *dentry_path_raw(struct dentry *, char *, int);
338extern char *dentry_path(struct dentry *, char *, int); 340extern char *dentry_path(struct dentry *, char *, int);
339 341
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 3bd46f766751..a975de1ff59f 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
51extern void debug_show_all_locks(void); 51extern void debug_show_all_locks(void);
52extern void debug_show_held_locks(struct task_struct *task); 52extern void debug_show_held_locks(struct task_struct *task);
53extern void debug_check_no_locks_freed(const void *from, unsigned long len); 53extern void debug_check_no_locks_freed(const void *from, unsigned long len);
54extern void debug_check_no_locks_held(struct task_struct *task); 54extern void debug_check_no_locks_held(void);
55#else 55#else
56static inline void debug_show_all_locks(void) 56static inline void debug_show_all_locks(void)
57{ 57{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
67} 67}
68 68
69static inline void 69static inline void
70debug_check_no_locks_held(struct task_struct *task) 70debug_check_no_locks_held(void)
71{ 71{
72} 72}
73#endif 73#endif
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 66c434f5dd1e..63f2465807d4 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -33,7 +33,7 @@ struct debugfs_reg32 {
33}; 33};
34 34
35struct debugfs_regset32 { 35struct debugfs_regset32 {
36 struct debugfs_reg32 *regs; 36 const struct debugfs_reg32 *regs;
37 int nregs; 37 int nregs;
38 void __iomem *base; 38 void __iomem *base;
39}; 39};
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index bf6afa2fc432..1e483fa7afb4 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -68,8 +68,8 @@ typedef void (*dm_postsuspend_fn) (struct dm_target *ti);
68typedef int (*dm_preresume_fn) (struct dm_target *ti); 68typedef int (*dm_preresume_fn) (struct dm_target *ti);
69typedef void (*dm_resume_fn) (struct dm_target *ti); 69typedef void (*dm_resume_fn) (struct dm_target *ti);
70 70
71typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, 71typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
72 unsigned status_flags, char *result, unsigned maxlen); 72 unsigned status_flags, char *result, unsigned maxlen);
73 73
74typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 74typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
75 75
@@ -175,6 +175,14 @@ struct target_type {
175#define DM_TARGET_IMMUTABLE 0x00000004 175#define DM_TARGET_IMMUTABLE 0x00000004
176#define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE) 176#define dm_target_is_immutable(type) ((type)->features & DM_TARGET_IMMUTABLE)
177 177
178/*
179 * Some targets need to be sent the same WRITE bio severals times so
180 * that they can send copies of it to different devices. This function
181 * examines any supplied bio and returns the number of copies of it the
182 * target requires.
183 */
184typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio);
185
178struct dm_target { 186struct dm_target {
179 struct dm_table *table; 187 struct dm_table *table;
180 struct target_type *type; 188 struct target_type *type;
@@ -187,26 +195,26 @@ struct dm_target {
187 uint32_t max_io_len; 195 uint32_t max_io_len;
188 196
189 /* 197 /*
190 * A number of zero-length barrier requests that will be submitted 198 * A number of zero-length barrier bios that will be submitted
191 * to the target for the purpose of flushing cache. 199 * to the target for the purpose of flushing cache.
192 * 200 *
193 * The request number can be accessed with dm_bio_get_target_request_nr. 201 * The bio number can be accessed with dm_bio_get_target_bio_nr.
194 * It is a responsibility of the target driver to remap these requests 202 * It is a responsibility of the target driver to remap these bios
195 * to the real underlying devices. 203 * to the real underlying devices.
196 */ 204 */
197 unsigned num_flush_requests; 205 unsigned num_flush_bios;
198 206
199 /* 207 /*
200 * The number of discard requests that will be submitted to the target. 208 * The number of discard bios that will be submitted to the target.
201 * The request number can be accessed with dm_bio_get_target_request_nr. 209 * The bio number can be accessed with dm_bio_get_target_bio_nr.
202 */ 210 */
203 unsigned num_discard_requests; 211 unsigned num_discard_bios;
204 212
205 /* 213 /*
206 * The number of WRITE SAME requests that will be submitted to the target. 214 * The number of WRITE SAME bios that will be submitted to the target.
207 * The request number can be accessed with dm_bio_get_target_request_nr. 215 * The bio number can be accessed with dm_bio_get_target_bio_nr.
208 */ 216 */
209 unsigned num_write_same_requests; 217 unsigned num_write_same_bios;
210 218
211 /* 219 /*
212 * The minimum number of extra bytes allocated in each bio for the 220 * The minimum number of extra bytes allocated in each bio for the
@@ -214,6 +222,13 @@ struct dm_target {
214 */ 222 */
215 unsigned per_bio_data_size; 223 unsigned per_bio_data_size;
216 224
225 /*
226 * If defined, this function is called to find out how many
227 * duplicate bios should be sent to the target when writing
228 * data.
229 */
230 dm_num_write_bios_fn num_write_bios;
231
217 /* target specific data */ 232 /* target specific data */
218 void *private; 233 void *private;
219 234
@@ -233,10 +248,10 @@ struct dm_target {
233 bool discards_supported:1; 248 bool discards_supported:1;
234 249
235 /* 250 /*
236 * Set if the target required discard request to be split 251 * Set if the target required discard bios to be split
237 * on max_io_len boundary. 252 * on max_io_len boundary.
238 */ 253 */
239 bool split_discard_requests:1; 254 bool split_discard_bios:1;
240 255
241 /* 256 /*
242 * Set if this target does not return zeroes on discarded blocks. 257 * Set if this target does not return zeroes on discarded blocks.
@@ -261,7 +276,7 @@ struct dm_target_io {
261 struct dm_io *io; 276 struct dm_io *io;
262 struct dm_target *ti; 277 struct dm_target *ti;
263 union map_info info; 278 union map_info info;
264 unsigned target_request_nr; 279 unsigned target_bio_nr;
265 struct bio clone; 280 struct bio clone;
266}; 281};
267 282
@@ -275,9 +290,9 @@ static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
275 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone)); 290 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
276} 291}
277 292
278static inline unsigned dm_bio_get_target_request_nr(const struct bio *bio) 293static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio)
279{ 294{
280 return container_of(bio, struct dm_target_io, clone)->target_request_nr; 295 return container_of(bio, struct dm_target_io, clone)->target_bio_nr;
281} 296}
282 297
283int dm_register_target(struct target_type *t); 298int dm_register_target(struct target_type *t);
diff --git a/include/linux/device.h b/include/linux/device.h
index 43dcda937ddf..9d6464ea99c6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -21,6 +21,7 @@
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pinctrl/devinfo.h>
24#include <linux/pm.h> 25#include <linux/pm.h>
25#include <linux/atomic.h> 26#include <linux/atomic.h>
26#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
@@ -395,8 +396,8 @@ extern int class_for_each_device(struct class *class, struct device *start,
395 void *data, 396 void *data,
396 int (*fn)(struct device *dev, void *data)); 397 int (*fn)(struct device *dev, void *data));
397extern struct device *class_find_device(struct class *class, 398extern struct device *class_find_device(struct class *class,
398 struct device *start, void *data, 399 struct device *start, const void *data,
399 int (*match)(struct device *, void *)); 400 int (*match)(struct device *, const void *));
400 401
401struct class_attribute { 402struct class_attribute {
402 struct attribute attr; 403 struct attribute attr;
@@ -573,6 +574,7 @@ extern int devres_release_group(struct device *dev, void *id);
573extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 574extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
574extern void devm_kfree(struct device *dev, void *p); 575extern void devm_kfree(struct device *dev, void *p);
575 576
577void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
576void __iomem *devm_request_and_ioremap(struct device *dev, 578void __iomem *devm_request_and_ioremap(struct device *dev,
577 struct resource *res); 579 struct resource *res);
578 580
@@ -620,6 +622,8 @@ struct acpi_dev_node {
620 * @pm_domain: Provide callbacks that are executed during system suspend, 622 * @pm_domain: Provide callbacks that are executed during system suspend,
621 * hibernation, system resume and during runtime PM transitions 623 * hibernation, system resume and during runtime PM transitions
622 * along with subsystem-level and driver-level callbacks. 624 * along with subsystem-level and driver-level callbacks.
625 * @pins: For device pin management.
626 * See Documentation/pinctrl.txt for details.
623 * @numa_node: NUMA node this device is close to. 627 * @numa_node: NUMA node this device is close to.
624 * @dma_mask: Dma mask (if dma'ble device). 628 * @dma_mask: Dma mask (if dma'ble device).
625 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 629 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
@@ -672,6 +676,10 @@ struct device {
672 struct dev_pm_info power; 676 struct dev_pm_info power;
673 struct dev_pm_domain *pm_domain; 677 struct dev_pm_domain *pm_domain;
674 678
679#ifdef CONFIG_PINCTRL
680 struct dev_pin_info *pins;
681#endif
682
675#ifdef CONFIG_NUMA 683#ifdef CONFIG_NUMA
676 int numa_node; /* NUMA node this device is close to */ 684 int numa_node; /* NUMA node this device is close to */
677#endif 685#endif
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
index 47d9d376e4e7..f486d636b82e 100644
--- a/include/linux/dm-kcopyd.h
+++ b/include/linux/dm-kcopyd.h
@@ -21,11 +21,34 @@
21 21
22#define DM_KCOPYD_IGNORE_ERROR 1 22#define DM_KCOPYD_IGNORE_ERROR 1
23 23
24struct dm_kcopyd_throttle {
25 unsigned throttle;
26 unsigned num_io_jobs;
27 unsigned io_period;
28 unsigned total_period;
29 unsigned last_jiffies;
30};
31
32/*
33 * kcopyd clients that want to support throttling must pass an initialised
34 * dm_kcopyd_throttle struct into dm_kcopyd_client_create().
35 * Two or more clients may share the same instance of this struct between
36 * them if they wish to be throttled as a group.
37 *
38 * This macro also creates a corresponding module parameter to configure
39 * the amount of throttling.
40 */
41#define DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(name, description) \
42static struct dm_kcopyd_throttle dm_kcopyd_throttle = { 100, 0, 0, 0, 0 }; \
43module_param_named(name, dm_kcopyd_throttle.throttle, uint, 0644); \
44MODULE_PARM_DESC(name, description)
45
24/* 46/*
25 * To use kcopyd you must first create a dm_kcopyd_client object. 47 * To use kcopyd you must first create a dm_kcopyd_client object.
48 * throttle can be NULL if you don't want any throttling.
26 */ 49 */
27struct dm_kcopyd_client; 50struct dm_kcopyd_client;
28struct dm_kcopyd_client *dm_kcopyd_client_create(void); 51struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle);
29void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); 52void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
30 53
31/* 54/*
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index bd2e52ccc4f2..9978b614a1aa 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -53,7 +53,7 @@ struct dma_buf_attachment;
53 * @begin_cpu_access: [optional] called before cpu access to invalidate cpu 53 * @begin_cpu_access: [optional] called before cpu access to invalidate cpu
54 * caches and allocate backing storage (if not yet done) 54 * caches and allocate backing storage (if not yet done)
55 * respectively pin the objet into memory. 55 * respectively pin the objet into memory.
56 * @end_cpu_access: [optional] called after cpu access to flush cashes. 56 * @end_cpu_access: [optional] called after cpu access to flush caches.
57 * @kmap_atomic: maps a page from the buffer into kernel address 57 * @kmap_atomic: maps a page from the buffer into kernel address
58 * space, users may not block until the subsequent unmap call. 58 * space, users may not block until the subsequent unmap call.
59 * This callback must not sleep. 59 * This callback must not sleep.
@@ -119,8 +119,10 @@ struct dma_buf {
119 struct file *file; 119 struct file *file;
120 struct list_head attachments; 120 struct list_head attachments;
121 const struct dma_buf_ops *ops; 121 const struct dma_buf_ops *ops;
122 /* mutex to serialize list manipulation and attach/detach */ 122 /* mutex to serialize list manipulation, attach/detach and vmap/unmap */
123 struct mutex lock; 123 struct mutex lock;
124 unsigned vmapping_counter;
125 void *vmap_ptr;
124 void *priv; 126 void *priv;
125}; 127};
126 128
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 1148575fd134..dd755ce2a5eb 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -53,5 +53,5 @@ void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); 53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs); 54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55 55
56extern struct sys_timer dw_apb_timer; 56extern void dw_apb_timer_init(void);
57#endif /* __DW_APB_TIMER_H__ */ 57#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 6dd4787a798a..2fe93b26b42f 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -95,6 +95,17 @@ do { \
95 ##__VA_ARGS__); \ 95 ##__VA_ARGS__); \
96} while (0) 96} while (0)
97 97
98#define dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
99 groupsize, buf, len, ascii) \
100do { \
101 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
102 __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
103 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
104 print_hex_dump(KERN_DEBUG, prefix_str, \
105 prefix_type, rowsize, groupsize, \
106 buf, len, ascii); \
107} while (0)
108
98#else 109#else
99 110
100#include <linux/string.h> 111#include <linux/string.h>
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 1b8c02b36f76..4fd4999ccb5b 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -14,7 +14,6 @@
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/kobject.h>
18#include <linux/completion.h> 17#include <linux/completion.h>
19#include <linux/workqueue.h> 18#include <linux/workqueue.h>
20#include <linux/debugfs.h> 19#include <linux/debugfs.h>
@@ -48,8 +47,17 @@ static inline void opstate_init(void)
48 return; 47 return;
49} 48}
50 49
50/* Max length of a DIMM label*/
51#define EDAC_MC_LABEL_LEN 31 51#define EDAC_MC_LABEL_LEN 31
52#define MC_PROC_NAME_MAX_LEN 7 52
53/* Maximum size of the location string */
54#define LOCATION_SIZE 80
55
56/* Defines the maximum number of labels that can be reported */
57#define EDAC_MAX_LABELS 8
58
59/* String used to join two or more labels */
60#define OTHER_LABEL " or "
53 61
54/** 62/**
55 * enum dev_type - describe the type of memory DRAM chips used at the stick 63 * enum dev_type - describe the type of memory DRAM chips used at the stick
@@ -101,8 +109,24 @@ enum hw_event_mc_err_type {
101 HW_EVENT_ERR_CORRECTED, 109 HW_EVENT_ERR_CORRECTED,
102 HW_EVENT_ERR_UNCORRECTED, 110 HW_EVENT_ERR_UNCORRECTED,
103 HW_EVENT_ERR_FATAL, 111 HW_EVENT_ERR_FATAL,
112 HW_EVENT_ERR_INFO,
104}; 113};
105 114
115static inline char *mc_event_error_type(const unsigned int err_type)
116{
117 switch (err_type) {
118 case HW_EVENT_ERR_CORRECTED:
119 return "Corrected";
120 case HW_EVENT_ERR_UNCORRECTED:
121 return "Uncorrected";
122 case HW_EVENT_ERR_FATAL:
123 return "Fatal";
124 default:
125 case HW_EVENT_ERR_INFO:
126 return "Info";
127 }
128}
129
106/** 130/**
107 * enum mem_type - memory types. For a more detailed reference, please see 131 * enum mem_type - memory types. For a more detailed reference, please see
108 * http://en.wikipedia.org/wiki/DRAM 132 * http://en.wikipedia.org/wiki/DRAM
@@ -376,6 +400,9 @@ enum scrub_type {
376 * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel" 400 * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel"
377 * @EDAC_MC_LAYER_SLOT: memory layer is named "slot" 401 * @EDAC_MC_LAYER_SLOT: memory layer is named "slot"
378 * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select" 402 * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select"
403 * @EDAC_MC_LAYER_ALL_MEM: memory layout is unknown. All memory is mapped
404 * as a single memory area. This is used when
405 * retrieving errors from a firmware driven driver.
379 * 406 *
380 * This enum is used by the drivers to tell edac_mc_sysfs what name should 407 * This enum is used by the drivers to tell edac_mc_sysfs what name should
381 * be used when describing a memory stick location. 408 * be used when describing a memory stick location.
@@ -385,6 +412,7 @@ enum edac_mc_layer_type {
385 EDAC_MC_LAYER_CHANNEL, 412 EDAC_MC_LAYER_CHANNEL,
386 EDAC_MC_LAYER_SLOT, 413 EDAC_MC_LAYER_SLOT,
387 EDAC_MC_LAYER_CHIP_SELECT, 414 EDAC_MC_LAYER_CHIP_SELECT,
415 EDAC_MC_LAYER_ALL_MEM,
388}; 416};
389 417
390/** 418/**
@@ -551,6 +579,46 @@ struct errcount_attribute_data {
551 int layer0, layer1, layer2; 579 int layer0, layer1, layer2;
552}; 580};
553 581
582/**
583 * edac_raw_error_desc - Raw error report structure
584 * @grain: minimum granularity for an error report, in bytes
585 * @error_count: number of errors of the same type
586 * @top_layer: top layer of the error (layer[0])
587 * @mid_layer: middle layer of the error (layer[1])
588 * @low_layer: low layer of the error (layer[2])
589 * @page_frame_number: page where the error happened
590 * @offset_in_page: page offset
591 * @syndrome: syndrome of the error (or 0 if unknown or if
592 * the syndrome is not applicable)
593 * @msg: error message
594 * @location: location of the error
595 * @label: label of the affected DIMM(s)
596 * @other_detail: other driver-specific detail about the error
597 * @enable_per_layer_report: if false, the error affects all layers
598 * (typically, a memory controller error)
599 */
600struct edac_raw_error_desc {
601 /*
602 * NOTE: everything before grain won't be cleaned by
603 * edac_raw_error_desc_clean()
604 */
605 char location[LOCATION_SIZE];
606 char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS];
607 long grain;
608
609 /* the vars below and grain will be cleaned on every new error report */
610 u16 error_count;
611 int top_layer;
612 int mid_layer;
613 int low_layer;
614 unsigned long page_frame_number;
615 unsigned long offset_in_page;
616 unsigned long syndrome;
617 const char *msg;
618 const char *other_detail;
619 bool enable_per_layer_report;
620};
621
554/* MEMORY controller information structure 622/* MEMORY controller information structure
555 */ 623 */
556struct mem_ctl_info { 624struct mem_ctl_info {
@@ -630,7 +698,6 @@ struct mem_ctl_info {
630 const char *mod_ver; 698 const char *mod_ver;
631 const char *ctl_name; 699 const char *ctl_name;
632 const char *dev_name; 700 const char *dev_name;
633 char proc_name[MC_PROC_NAME_MAX_LEN + 1];
634 void *pvt_info; 701 void *pvt_info;
635 unsigned long start_time; /* mci load start time (in jiffies) */ 702 unsigned long start_time; /* mci load start time (in jiffies) */
636 703
@@ -659,6 +726,12 @@ struct mem_ctl_info {
659 /* work struct for this MC */ 726 /* work struct for this MC */
660 struct delayed_work work; 727 struct delayed_work work;
661 728
729 /*
730 * Used to report an error - by being at the global struct
731 * makes the memory allocated by the EDAC core
732 */
733 struct edac_raw_error_desc error_desc;
734
662 /* the internal state of this controller instance */ 735 /* the internal state of this controller instance */
663 int op_state; 736 int op_state;
664 737
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 8b84916dc671..9bf2f1fcae27 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -618,18 +618,30 @@ extern int __init efi_setup_pcdp_console(char *);
618#endif 618#endif
619 619
620/* 620/*
621 * We play games with efi_enabled so that the compiler will, if possible, remove 621 * We play games with efi_enabled so that the compiler will, if
622 * EFI-related code altogether. 622 * possible, remove EFI-related code altogether.
623 */ 623 */
624#define EFI_BOOT 0 /* Were we booted from EFI? */
625#define EFI_SYSTEM_TABLES 1 /* Can we use EFI system tables? */
626#define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */
627#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
628#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
629#define EFI_64BIT 5 /* Is the firmware 64-bit? */
630
624#ifdef CONFIG_EFI 631#ifdef CONFIG_EFI
625# ifdef CONFIG_X86 632# ifdef CONFIG_X86
626 extern int efi_enabled; 633extern int efi_enabled(int facility);
627 extern bool efi_64bit;
628# else 634# else
629# define efi_enabled 1 635static inline int efi_enabled(int facility)
636{
637 return 1;
638}
630# endif 639# endif
631#else 640#else
632# define efi_enabled 0 641static inline int efi_enabled(int facility)
642{
643 return 0;
644}
633#endif 645#endif
634 646
635/* 647/*
@@ -728,7 +740,8 @@ struct efivars {
728 * 1) ->list - adds, removals, reads, writes 740 * 1) ->list - adds, removals, reads, writes
729 * 2) ops.[gs]et_variable() calls. 741 * 2) ops.[gs]et_variable() calls.
730 * It must not be held when creating sysfs entries or calling kmalloc. 742 * It must not be held when creating sysfs entries or calling kmalloc.
731 * ops.get_next_variable() is only called from register_efivars(), 743 * ops.get_next_variable() is only called from register_efivars()
744 * or efivar_update_sysfs_entries(),
732 * which is protected by the BKL, so that path is safe. 745 * which is protected by the BKL, so that path is safe.
733 */ 746 */
734 spinlock_t lock; 747 spinlock_t lock;
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index c03af7687bb4..acd0312d46fb 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -2,6 +2,7 @@
2#define _LINUX_ELEVATOR_H 2#define _LINUX_ELEVATOR_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/hashtable.h>
5 6
6#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
7 8
@@ -96,6 +97,8 @@ struct elevator_type
96 struct list_head list; 97 struct list_head list;
97}; 98};
98 99
100#define ELV_HASH_BITS 6
101
99/* 102/*
100 * each queue has an elevator_queue associated with it 103 * each queue has an elevator_queue associated with it
101 */ 104 */
@@ -105,8 +108,8 @@ struct elevator_queue
105 void *elevator_data; 108 void *elevator_data;
106 struct kobject kobj; 109 struct kobject kobj;
107 struct mutex sysfs_lock; 110 struct mutex sysfs_lock;
108 struct hlist_head *hash;
109 unsigned int registered:1; 111 unsigned int registered:1;
112 DECLARE_HASHTABLE(hash, ELV_HASH_BITS);
110}; 113};
111 114
112/* 115/*
@@ -138,6 +141,7 @@ extern void elv_drain_elevator(struct request_queue *);
138/* 141/*
139 * io scheduler registration 142 * io scheduler registration
140 */ 143 */
144extern void __init load_default_elevator_module(void);
141extern int elv_register(struct elevator_type *); 145extern int elv_register(struct elevator_type *);
142extern void elv_unregister(struct elevator_type *); 146extern void elv_unregister(struct elevator_type *);
143 147
@@ -206,5 +210,9 @@ enum {
206 INIT_LIST_HEAD(&(rq)->csd.list); \ 210 INIT_LIST_HEAD(&(rq)->csd.list); \
207 } while (0) 211 } while (0)
208 212
213#else /* CONFIG_BLOCK */
214
215static inline void load_default_elevator_module(void) { }
216
209#endif /* CONFIG_BLOCK */ 217#endif /* CONFIG_BLOCK */
210#endif 218#endif
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8c9048e33463..40a3c0e01b2b 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -10,6 +10,10 @@
10 Override in asm/elf.h as needed. */ 10 Override in asm/elf.h as needed. */
11# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 11# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
12#endif 12#endif
13#ifndef SET_PERSONALITY
14#define SET_PERSONALITY(ex) \
15 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
16#endif
13 17
14#if ELF_CLASS == ELFCLASS32 18#if ELF_CLASS == ELFCLASS32
15 19
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 243eea1e33d8..c623861964e4 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -40,6 +40,8 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
40extern void eth_header_cache_update(struct hh_cache *hh, 40extern void eth_header_cache_update(struct hh_cache *hh,
41 const struct net_device *dev, 41 const struct net_device *dev,
42 const unsigned char *haddr); 42 const unsigned char *haddr);
43extern int eth_prepare_mac_addr_change(struct net_device *dev, void *p);
44extern void eth_commit_mac_addr_change(struct net_device *dev, void *p);
43extern int eth_mac_addr(struct net_device *dev, void *p); 45extern int eth_mac_addr(struct net_device *dev, void *p);
44extern int eth_change_mtu(struct net_device *dev, int new_mtu); 46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
45extern int eth_validate_addr(struct net_device *dev); 47extern int eth_validate_addr(struct net_device *dev);
@@ -192,7 +194,7 @@ static inline void eth_zero_addr(u8 *addr)
192 */ 194 */
193static inline void eth_hw_addr_random(struct net_device *dev) 195static inline void eth_hw_addr_random(struct net_device *dev)
194{ 196{
195 dev->addr_assign_type |= NET_ADDR_RANDOM; 197 dev->addr_assign_type = NET_ADDR_RANDOM;
196 eth_random_addr(dev->dev_addr); 198 eth_random_addr(dev->dev_addr);
197} 199}
198 200
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 3c3ef19a625a..cf5d2af61b81 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -13,7 +13,7 @@
13#include <linux/wait.h> 13#include <linux/wait.h>
14 14
15/* 15/*
16 * CAREFUL: Check include/asm-generic/fcntl.h when defining 16 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining
17 * new flags, since they might collide with O_* ones. We want 17 * new flags, since they might collide with O_* ones. We want
18 * to re-use O_* flags that couldn't possibly have a meaning 18 * to re-use O_* flags that couldn't possibly have a meaning
19 * from eventfd, in order to leave a free define-space for 19 * from eventfd, in order to leave a free define-space for
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon-gpio.h
index 2d8307f7d67d..2d8307f7d67d 100644
--- a/include/linux/extcon/extcon_gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c7a95714b1fe..58b98606ac26 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -19,6 +19,8 @@ struct vm_area_struct;
19struct fb_info; 19struct fb_info;
20struct device; 20struct device;
21struct file; 21struct file;
22struct videomode;
23struct device_node;
22 24
23/* Definitions below are used in the parsed monitor specs */ 25/* Definitions below are used in the parsed monitor specs */
24#define FB_DPMS_ACTIVE_OFF 1 26#define FB_DPMS_ACTIVE_OFF 1
@@ -714,6 +716,12 @@ extern void fb_destroy_modedb(struct fb_videomode *modedb);
714extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); 716extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
715extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); 717extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
716 718
719extern int of_get_fb_videomode(struct device_node *np,
720 struct fb_videomode *fb,
721 int index);
722extern int fb_videomode_from_videomode(const struct videomode *vm,
723 struct fb_videomode *fbmode);
724
717/* drivers/video/modedb.c */ 725/* drivers/video/modedb.c */
718#define VESA_MODEDB_SIZE 34 726#define VESA_MODEDB_SIZE 34
719extern void fb_var_to_videomode(struct fb_videomode *mode, 727extern void fb_var_to_videomode(struct fb_videomode *mode,
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index 43fe52fcef0f..71d4fa721db9 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -25,6 +25,7 @@
25 25
26int firmware_map_add_early(u64 start, u64 end, const char *type); 26int firmware_map_add_early(u64 start, u64 end, const char *type);
27int firmware_map_add_hotplug(u64 start, u64 end, const char *type); 27int firmware_map_add_hotplug(u64 start, u64 end, const char *type);
28int firmware_map_remove(u64 start, u64 end, const char *type);
28 29
29#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
30 31
@@ -38,6 +39,11 @@ static inline int firmware_map_add_hotplug(u64 start, u64 end, const char *type)
38 return 0; 39 return 0;
39} 40}
40 41
42static inline int firmware_map_remove(u64 start, u64 end, const char *type)
43{
44 return 0;
45}
46
41#endif /* CONFIG_FIRMWARE_MEMMAP */ 47#endif /* CONFIG_FIRMWARE_MEMMAP */
42 48
43#endif /* _LINUX_FIRMWARE_MAP_H */ 49#endif /* _LINUX_FIRMWARE_MAP_H */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e4238ceaa4d6..043a5cf8b5ba 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
3#ifndef FREEZER_H_INCLUDED 3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/debug_locks.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/wait.h> 8#include <linux/wait.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
@@ -13,6 +14,11 @@ extern bool pm_freezing; /* PM freezing in effect */
13extern bool pm_nosig_freezing; /* PM nosig freezing in effect */ 14extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
14 15
15/* 16/*
17 * Timeout for stopping processes
18 */
19extern unsigned int freeze_timeout_msecs;
20
21/*
16 * Check if a process has been frozen 22 * Check if a process has been frozen
17 */ 23 */
18static inline bool frozen(struct task_struct *p) 24static inline bool frozen(struct task_struct *p)
@@ -43,6 +49,8 @@ extern void thaw_kernel_threads(void);
43 49
44static inline bool try_to_freeze(void) 50static inline bool try_to_freeze(void)
45{ 51{
52 if (!(current->flags & PF_NOFREEZE))
53 debug_check_no_locks_held();
46 might_sleep(); 54 might_sleep();
47 if (likely(!freezing(current))) 55 if (likely(!freezing(current)))
48 return false; 56 return false;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7617ee04f066..4e686a099465 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -301,7 +301,7 @@ size_t iov_iter_copy_from_user(struct page *page,
301 struct iov_iter *i, unsigned long offset, size_t bytes); 301 struct iov_iter *i, unsigned long offset, size_t bytes);
302void iov_iter_advance(struct iov_iter *i, size_t bytes); 302void iov_iter_advance(struct iov_iter *i, size_t bytes);
303int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 303int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
304size_t iov_iter_single_seg_count(struct iov_iter *i); 304size_t iov_iter_single_seg_count(const struct iov_iter *i);
305 305
306static inline void iov_iter_init(struct iov_iter *i, 306static inline void iov_iter_init(struct iov_iter *i,
307 const struct iovec *iov, unsigned long nr_segs, 307 const struct iovec *iov, unsigned long nr_segs,
@@ -769,7 +769,6 @@ struct file {
769 } f_u; 769 } f_u;
770 struct path f_path; 770 struct path f_path;
771#define f_dentry f_path.dentry 771#define f_dentry f_path.dentry
772#define f_vfsmnt f_path.mnt
773 const struct file_operations *f_op; 772 const struct file_operations *f_op;
774 773
775 /* 774 /*
@@ -1807,7 +1806,6 @@ struct file_system_type {
1807#define FS_HAS_SUBTYPE 4 1806#define FS_HAS_SUBTYPE 4
1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ 1807#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 */ 1808#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
1810#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1811#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 1809#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1812 struct dentry *(*mount) (struct file_system_type *, int, 1810 struct dentry *(*mount) (struct file_system_type *, int,
1813 const char *, void *); 1811 const char *, void *);
@@ -2217,6 +2215,11 @@ static inline bool execute_ok(struct inode *inode)
2217 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2215 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2218} 2216}
2219 2217
2218static inline struct inode *file_inode(struct file *f)
2219{
2220 return f->f_path.dentry->d_inode;
2221}
2222
2220/* 2223/*
2221 * get_write_access() gets write permission for a file. 2224 * get_write_access() gets write permission for a file.
2222 * put_write_access() releases this write permission. 2225 * put_write_access() releases this write permission.
@@ -2239,7 +2242,7 @@ static inline int get_write_access(struct inode *inode)
2239} 2242}
2240static inline int deny_write_access(struct file *file) 2243static inline int deny_write_access(struct file *file)
2241{ 2244{
2242 struct inode *inode = file->f_path.dentry->d_inode; 2245 struct inode *inode = file_inode(file);
2243 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; 2246 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY;
2244} 2247}
2245static inline void put_write_access(struct inode * inode) 2248static inline void put_write_access(struct inode * inode)
@@ -2249,7 +2252,7 @@ static inline void put_write_access(struct inode * inode)
2249static inline void allow_write_access(struct file *file) 2252static inline void allow_write_access(struct file *file)
2250{ 2253{
2251 if (file) 2254 if (file)
2252 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2255 atomic_inc(&file_inode(file)->i_writecount);
2253} 2256}
2254#ifdef CONFIG_IMA 2257#ifdef CONFIG_IMA
2255static inline void i_readcount_dec(struct inode *inode) 2258static inline void i_readcount_dec(struct inode *inode)
@@ -2274,6 +2277,7 @@ static inline void i_readcount_inc(struct inode *inode)
2274extern int do_pipe_flags(int *, int); 2277extern int do_pipe_flags(int *, int);
2275 2278
2276extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2279extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2280extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
2277extern struct file * open_exec(const char *); 2281extern struct file * open_exec(const char *);
2278 2282
2279/* fs/dcache.c -- generic fs support functions */ 2283/* fs/dcache.c -- generic fs support functions */
@@ -2463,7 +2467,7 @@ extern int page_symlink(struct inode *inode, const char *symname, int len);
2463extern const struct inode_operations page_symlink_inode_operations; 2467extern const struct inode_operations page_symlink_inode_operations;
2464extern int generic_readlink(struct dentry *, char __user *, int); 2468extern int generic_readlink(struct dentry *, char __user *, int);
2465extern void generic_fillattr(struct inode *, struct kstat *); 2469extern void generic_fillattr(struct inode *, struct kstat *);
2466extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2470extern int vfs_getattr(struct path *, struct kstat *);
2467void __inode_add_bytes(struct inode *inode, loff_t bytes); 2471void __inode_add_bytes(struct inode *inode, loff_t bytes);
2468void inode_add_bytes(struct inode *inode, loff_t bytes); 2472void inode_add_bytes(struct inode *inode, loff_t bytes);
2469void inode_sub_bytes(struct inode *inode, loff_t bytes); 2473void inode_sub_bytes(struct inode *inode, loff_t bytes);
diff --git a/include/linux/fsl/bestcomm/ata.h b/include/linux/fsl/bestcomm/ata.h
new file mode 100644
index 000000000000..0b2371811334
--- /dev/null
+++ b/include/linux/fsl/bestcomm/ata.h
@@ -0,0 +1,30 @@
1/*
2 * Header for Bestcomm ATA task driver
3 *
4 *
5 * Copyright (C) 2006 Freescale - John Rigby
6 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#ifndef __BESTCOMM_ATA_H__
14#define __BESTCOMM_ATA_H__
15
16
17struct bcom_ata_bd {
18 u32 status;
19 u32 src_pa;
20 u32 dst_pa;
21};
22
23extern struct bcom_task * bcom_ata_init(int queue_len, int maxbufsize);
24extern void bcom_ata_rx_prepare(struct bcom_task *tsk);
25extern void bcom_ata_tx_prepare(struct bcom_task *tsk);
26extern void bcom_ata_reset_bd(struct bcom_task *tsk);
27extern void bcom_ata_release(struct bcom_task *tsk);
28
29#endif /* __BESTCOMM_ATA_H__ */
30
diff --git a/include/linux/fsl/bestcomm/bestcomm.h b/include/linux/fsl/bestcomm/bestcomm.h
new file mode 100644
index 000000000000..a0e2e6b19b57
--- /dev/null
+++ b/include/linux/fsl/bestcomm/bestcomm.h
@@ -0,0 +1,213 @@
1/*
2 * Public header for the MPC52xx processor BestComm driver
3 *
4 *
5 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2005 Varma Electronics Oy,
7 * ( by Andrey Volkov <avolkov@varma-el.com> )
8 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
9 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#ifndef __BESTCOMM_H__
17#define __BESTCOMM_H__
18
19/**
20 * struct bcom_bd - Structure describing a generic BestComm buffer descriptor
21 * @status: The current status of this buffer. Exact meaning depends on the
22 * task type
23 * @data: An array of u32 extra data. Size of array is task dependent.
24 *
25 * Note: Don't dereference a bcom_bd pointer as an array. The size of the
26 * bcom_bd is variable. Use bcom_get_bd() instead.
27 */
28struct bcom_bd {
29 u32 status;
30 u32 data[0]; /* variable payload size */
31};
32
33/* ======================================================================== */
34/* Generic task management */
35/* ======================================================================== */
36
37/**
38 * struct bcom_task - Structure describing a loaded BestComm task
39 *
40 * This structure is never built by the driver it self. It's built and
41 * filled the intermediate layer of the BestComm API, the task dependent
42 * support code.
43 *
44 * Most likely you don't need to poke around inside this structure. The
45 * fields are exposed in the header just for the sake of inline functions
46 */
47struct bcom_task {
48 unsigned int tasknum;
49 unsigned int flags;
50 int irq;
51
52 struct bcom_bd *bd;
53 phys_addr_t bd_pa;
54 void **cookie;
55 unsigned short index;
56 unsigned short outdex;
57 unsigned int num_bd;
58 unsigned int bd_size;
59
60 void* priv;
61};
62
63#define BCOM_FLAGS_NONE 0x00000000ul
64#define BCOM_FLAGS_ENABLE_TASK (1ul << 0)
65
66/**
67 * bcom_enable - Enable a BestComm task
68 * @tsk: The BestComm task structure
69 *
70 * This function makes sure the given task is enabled and can be run
71 * by the BestComm engine as needed
72 */
73extern void bcom_enable(struct bcom_task *tsk);
74
75/**
76 * bcom_disable - Disable a BestComm task
77 * @tsk: The BestComm task structure
78 *
79 * This function disable a given task, making sure it's not executed
80 * by the BestComm engine.
81 */
82extern void bcom_disable(struct bcom_task *tsk);
83
84
85/**
86 * bcom_get_task_irq - Returns the irq number of a BestComm task
87 * @tsk: The BestComm task structure
88 */
89static inline int
90bcom_get_task_irq(struct bcom_task *tsk) {
91 return tsk->irq;
92}
93
94/* ======================================================================== */
95/* BD based tasks helpers */
96/* ======================================================================== */
97
98#define BCOM_BD_READY 0x40000000ul
99
100/** _bcom_next_index - Get next input index.
101 * @tsk: pointer to task structure
102 *
103 * Support function; Device drivers should not call this
104 */
105static inline int
106_bcom_next_index(struct bcom_task *tsk)
107{
108 return ((tsk->index + 1) == tsk->num_bd) ? 0 : tsk->index + 1;
109}
110
111/** _bcom_next_outdex - Get next output index.
112 * @tsk: pointer to task structure
113 *
114 * Support function; Device drivers should not call this
115 */
116static inline int
117_bcom_next_outdex(struct bcom_task *tsk)
118{
119 return ((tsk->outdex + 1) == tsk->num_bd) ? 0 : tsk->outdex + 1;
120}
121
122/**
123 * bcom_queue_empty - Checks if a BestComm task BD queue is empty
124 * @tsk: The BestComm task structure
125 */
126static inline int
127bcom_queue_empty(struct bcom_task *tsk)
128{
129 return tsk->index == tsk->outdex;
130}
131
132/**
133 * bcom_queue_full - Checks if a BestComm task BD queue is full
134 * @tsk: The BestComm task structure
135 */
136static inline int
137bcom_queue_full(struct bcom_task *tsk)
138{
139 return tsk->outdex == _bcom_next_index(tsk);
140}
141
142/**
143 * bcom_get_bd - Get a BD from the queue
144 * @tsk: The BestComm task structure
145 * index: Index of the BD to fetch
146 */
147static inline struct bcom_bd
148*bcom_get_bd(struct bcom_task *tsk, unsigned int index)
149{
150 /* A cast to (void*) so the address can be incremented by the
151 * real size instead of by sizeof(struct bcom_bd) */
152 return ((void *)tsk->bd) + (index * tsk->bd_size);
153}
154
155/**
156 * bcom_buffer_done - Checks if a BestComm
157 * @tsk: The BestComm task structure
158 */
159static inline int
160bcom_buffer_done(struct bcom_task *tsk)
161{
162 struct bcom_bd *bd;
163 if (bcom_queue_empty(tsk))
164 return 0;
165
166 bd = bcom_get_bd(tsk, tsk->outdex);
167 return !(bd->status & BCOM_BD_READY);
168}
169
170/**
171 * bcom_prepare_next_buffer - clear status of next available buffer.
172 * @tsk: The BestComm task structure
173 *
174 * Returns pointer to next buffer descriptor
175 */
176static inline struct bcom_bd *
177bcom_prepare_next_buffer(struct bcom_task *tsk)
178{
179 struct bcom_bd *bd;
180
181 bd = bcom_get_bd(tsk, tsk->index);
182 bd->status = 0; /* cleanup last status */
183 return bd;
184}
185
186static inline void
187bcom_submit_next_buffer(struct bcom_task *tsk, void *cookie)
188{
189 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->index);
190
191 tsk->cookie[tsk->index] = cookie;
192 mb(); /* ensure the bd is really up-to-date */
193 bd->status |= BCOM_BD_READY;
194 tsk->index = _bcom_next_index(tsk);
195 if (tsk->flags & BCOM_FLAGS_ENABLE_TASK)
196 bcom_enable(tsk);
197}
198
199static inline void *
200bcom_retrieve_buffer(struct bcom_task *tsk, u32 *p_status, struct bcom_bd **p_bd)
201{
202 void *cookie = tsk->cookie[tsk->outdex];
203 struct bcom_bd *bd = bcom_get_bd(tsk, tsk->outdex);
204
205 if (p_status)
206 *p_status = bd->status;
207 if (p_bd)
208 *p_bd = bd;
209 tsk->outdex = _bcom_next_outdex(tsk);
210 return cookie;
211}
212
213#endif /* __BESTCOMM_H__ */
diff --git a/include/linux/fsl/bestcomm/bestcomm_priv.h b/include/linux/fsl/bestcomm/bestcomm_priv.h
new file mode 100644
index 000000000000..3b52f3ffbdf8
--- /dev/null
+++ b/include/linux/fsl/bestcomm/bestcomm_priv.h
@@ -0,0 +1,350 @@
1/*
2 * Private header for the MPC52xx processor BestComm driver
3 *
4 * By private, we mean that driver should not use it directly. It's meant
5 * to be used by the BestComm engine driver itself and by the intermediate
6 * layer between the core and the drivers.
7 *
8 * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
9 * Copyright (C) 2005 Varma Electronics Oy,
10 * ( by Andrey Volkov <avolkov@varma-el.com> )
11 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
12 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
13 *
14 * This file is licensed under the terms of the GNU General Public License
15 * version 2. This program is licensed "as is" without any warranty of any
16 * kind, whether express or implied.
17 */
18
19#ifndef __BESTCOMM_PRIV_H__
20#define __BESTCOMM_PRIV_H__
21
22#include <linux/spinlock.h>
23#include <linux/of.h>
24#include <asm/io.h>
25#include <asm/mpc52xx.h>
26
27#include "sram.h"
28
29
30/* ======================================================================== */
31/* Engine related stuff */
32/* ======================================================================== */
33
34/* Zones sizes and needed alignments */
35#define BCOM_MAX_TASKS 16
36#define BCOM_MAX_VAR 24
37#define BCOM_MAX_INC 8
38#define BCOM_MAX_FDT 64
39#define BCOM_MAX_CTX 20
40#define BCOM_CTX_SIZE (BCOM_MAX_CTX * sizeof(u32))
41#define BCOM_CTX_ALIGN 0x100
42#define BCOM_VAR_SIZE (BCOM_MAX_VAR * sizeof(u32))
43#define BCOM_INC_SIZE (BCOM_MAX_INC * sizeof(u32))
44#define BCOM_VAR_ALIGN 0x80
45#define BCOM_FDT_SIZE (BCOM_MAX_FDT * sizeof(u32))
46#define BCOM_FDT_ALIGN 0x100
47
48/**
49 * struct bcom_tdt - Task Descriptor Table Entry
50 *
51 */
52struct bcom_tdt {
53 u32 start;
54 u32 stop;
55 u32 var;
56 u32 fdt;
57 u32 exec_status; /* used internally by BestComm engine */
58 u32 mvtp; /* used internally by BestComm engine */
59 u32 context;
60 u32 litbase;
61};
62
63/**
64 * struct bcom_engine
65 *
66 * This holds all info needed globaly to handle the engine
67 */
68struct bcom_engine {
69 struct device_node *ofnode;
70 struct mpc52xx_sdma __iomem *regs;
71 phys_addr_t regs_base;
72
73 struct bcom_tdt *tdt;
74 u32 *ctx;
75 u32 *var;
76 u32 *fdt;
77
78 spinlock_t lock;
79};
80
81extern struct bcom_engine *bcom_eng;
82
83
84/* ======================================================================== */
85/* Tasks related stuff */
86/* ======================================================================== */
87
88/* Tasks image header */
89#define BCOM_TASK_MAGIC 0x4243544B /* 'BCTK' */
90
91struct bcom_task_header {
92 u32 magic;
93 u8 desc_size; /* the size fields */
94 u8 var_size; /* are given in number */
95 u8 inc_size; /* of 32-bits words */
96 u8 first_var;
97 u8 reserved[8];
98};
99
100/* Descriptors structure & co */
101#define BCOM_DESC_NOP 0x000001f8
102#define BCOM_LCD_MASK 0x80000000
103#define BCOM_DRD_EXTENDED 0x40000000
104#define BCOM_DRD_INITIATOR_SHIFT 21
105
106/* Tasks pragma */
107#define BCOM_PRAGMA_BIT_RSV 7 /* reserved pragma bit */
108#define BCOM_PRAGMA_BIT_PRECISE_INC 6 /* increment 0=when possible, */
109 /* 1=iter end */
110#define BCOM_PRAGMA_BIT_RST_ERROR_NO 5 /* don't reset errors on */
111 /* task enable */
112#define BCOM_PRAGMA_BIT_PACK 4 /* pack data enable */
113#define BCOM_PRAGMA_BIT_INTEGER 3 /* data alignment */
114 /* 0=frac(msb), 1=int(lsb) */
115#define BCOM_PRAGMA_BIT_SPECREAD 2 /* XLB speculative read */
116#define BCOM_PRAGMA_BIT_CW 1 /* write line buffer enable */
117#define BCOM_PRAGMA_BIT_RL 0 /* read line buffer enable */
118
119 /* Looks like XLB speculative read generates XLB errors when a buffer
120 * is at the end of the physical memory. i.e. when accessing the
121 * lasts words, the engine tries to prefetch the next but there is no
122 * next ...
123 */
124#define BCOM_STD_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
125 (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
126 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
127 (0 << BCOM_PRAGMA_BIT_PACK) | \
128 (0 << BCOM_PRAGMA_BIT_INTEGER) | \
129 (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
130 (1 << BCOM_PRAGMA_BIT_CW) | \
131 (1 << BCOM_PRAGMA_BIT_RL))
132
133#define BCOM_PCI_PRAGMA ((0 << BCOM_PRAGMA_BIT_RSV) | \
134 (0 << BCOM_PRAGMA_BIT_PRECISE_INC) | \
135 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO) | \
136 (0 << BCOM_PRAGMA_BIT_PACK) | \
137 (1 << BCOM_PRAGMA_BIT_INTEGER) | \
138 (0 << BCOM_PRAGMA_BIT_SPECREAD) | \
139 (1 << BCOM_PRAGMA_BIT_CW) | \
140 (1 << BCOM_PRAGMA_BIT_RL))
141
142#define BCOM_ATA_PRAGMA BCOM_STD_PRAGMA
143#define BCOM_CRC16_DP_0_PRAGMA BCOM_STD_PRAGMA
144#define BCOM_CRC16_DP_1_PRAGMA BCOM_STD_PRAGMA
145#define BCOM_FEC_RX_BD_PRAGMA BCOM_STD_PRAGMA
146#define BCOM_FEC_TX_BD_PRAGMA BCOM_STD_PRAGMA
147#define BCOM_GEN_DP_0_PRAGMA BCOM_STD_PRAGMA
148#define BCOM_GEN_DP_1_PRAGMA BCOM_STD_PRAGMA
149#define BCOM_GEN_DP_2_PRAGMA BCOM_STD_PRAGMA
150#define BCOM_GEN_DP_3_PRAGMA BCOM_STD_PRAGMA
151#define BCOM_GEN_DP_BD_0_PRAGMA BCOM_STD_PRAGMA
152#define BCOM_GEN_DP_BD_1_PRAGMA BCOM_STD_PRAGMA
153#define BCOM_GEN_RX_BD_PRAGMA BCOM_STD_PRAGMA
154#define BCOM_GEN_TX_BD_PRAGMA BCOM_STD_PRAGMA
155#define BCOM_GEN_LPC_PRAGMA BCOM_STD_PRAGMA
156#define BCOM_PCI_RX_PRAGMA BCOM_PCI_PRAGMA
157#define BCOM_PCI_TX_PRAGMA BCOM_PCI_PRAGMA
158
159/* Initiators number */
160#define BCOM_INITIATOR_ALWAYS 0
161#define BCOM_INITIATOR_SCTMR_0 1
162#define BCOM_INITIATOR_SCTMR_1 2
163#define BCOM_INITIATOR_FEC_RX 3
164#define BCOM_INITIATOR_FEC_TX 4
165#define BCOM_INITIATOR_ATA_RX 5
166#define BCOM_INITIATOR_ATA_TX 6
167#define BCOM_INITIATOR_SCPCI_RX 7
168#define BCOM_INITIATOR_SCPCI_TX 8
169#define BCOM_INITIATOR_PSC3_RX 9
170#define BCOM_INITIATOR_PSC3_TX 10
171#define BCOM_INITIATOR_PSC2_RX 11
172#define BCOM_INITIATOR_PSC2_TX 12
173#define BCOM_INITIATOR_PSC1_RX 13
174#define BCOM_INITIATOR_PSC1_TX 14
175#define BCOM_INITIATOR_SCTMR_2 15
176#define BCOM_INITIATOR_SCLPC 16
177#define BCOM_INITIATOR_PSC5_RX 17
178#define BCOM_INITIATOR_PSC5_TX 18
179#define BCOM_INITIATOR_PSC4_RX 19
180#define BCOM_INITIATOR_PSC4_TX 20
181#define BCOM_INITIATOR_I2C2_RX 21
182#define BCOM_INITIATOR_I2C2_TX 22
183#define BCOM_INITIATOR_I2C1_RX 23
184#define BCOM_INITIATOR_I2C1_TX 24
185#define BCOM_INITIATOR_PSC6_RX 25
186#define BCOM_INITIATOR_PSC6_TX 26
187#define BCOM_INITIATOR_IRDA_RX 25
188#define BCOM_INITIATOR_IRDA_TX 26
189#define BCOM_INITIATOR_SCTMR_3 27
190#define BCOM_INITIATOR_SCTMR_4 28
191#define BCOM_INITIATOR_SCTMR_5 29
192#define BCOM_INITIATOR_SCTMR_6 30
193#define BCOM_INITIATOR_SCTMR_7 31
194
195/* Initiators priorities */
196#define BCOM_IPR_ALWAYS 7
197#define BCOM_IPR_SCTMR_0 2
198#define BCOM_IPR_SCTMR_1 2
199#define BCOM_IPR_FEC_RX 6
200#define BCOM_IPR_FEC_TX 5
201#define BCOM_IPR_ATA_RX 7
202#define BCOM_IPR_ATA_TX 7
203#define BCOM_IPR_SCPCI_RX 2
204#define BCOM_IPR_SCPCI_TX 2
205#define BCOM_IPR_PSC3_RX 2
206#define BCOM_IPR_PSC3_TX 2
207#define BCOM_IPR_PSC2_RX 2
208#define BCOM_IPR_PSC2_TX 2
209#define BCOM_IPR_PSC1_RX 2
210#define BCOM_IPR_PSC1_TX 2
211#define BCOM_IPR_SCTMR_2 2
212#define BCOM_IPR_SCLPC 2
213#define BCOM_IPR_PSC5_RX 2
214#define BCOM_IPR_PSC5_TX 2
215#define BCOM_IPR_PSC4_RX 2
216#define BCOM_IPR_PSC4_TX 2
217#define BCOM_IPR_I2C2_RX 2
218#define BCOM_IPR_I2C2_TX 2
219#define BCOM_IPR_I2C1_RX 2
220#define BCOM_IPR_I2C1_TX 2
221#define BCOM_IPR_PSC6_RX 2
222#define BCOM_IPR_PSC6_TX 2
223#define BCOM_IPR_IRDA_RX 2
224#define BCOM_IPR_IRDA_TX 2
225#define BCOM_IPR_SCTMR_3 2
226#define BCOM_IPR_SCTMR_4 2
227#define BCOM_IPR_SCTMR_5 2
228#define BCOM_IPR_SCTMR_6 2
229#define BCOM_IPR_SCTMR_7 2
230
231
232/* ======================================================================== */
233/* API */
234/* ======================================================================== */
235
236extern struct bcom_task *bcom_task_alloc(int bd_count, int bd_size, int priv_size);
237extern void bcom_task_free(struct bcom_task *tsk);
238extern int bcom_load_image(int task, u32 *task_image);
239extern void bcom_set_initiator(int task, int initiator);
240
241
242#define TASK_ENABLE 0x8000
243
244/**
245 * bcom_disable_prefetch - Hook to disable bus prefetching
246 *
247 * ATA DMA and the original MPC5200 need this due to silicon bugs. At the
248 * moment disabling prefetch is a one-way street. There is no mechanism
249 * in place to turn prefetch back on after it has been disabled. There is
250 * no reason it couldn't be done, it would just be more complex to implement.
251 */
252static inline void bcom_disable_prefetch(void)
253{
254 u16 regval;
255
256 regval = in_be16(&bcom_eng->regs->PtdCntrl);
257 out_be16(&bcom_eng->regs->PtdCntrl, regval | 1);
258};
259
260static inline void
261bcom_enable_task(int task)
262{
263 u16 reg;
264 reg = in_be16(&bcom_eng->regs->tcr[task]);
265 out_be16(&bcom_eng->regs->tcr[task], reg | TASK_ENABLE);
266}
267
268static inline void
269bcom_disable_task(int task)
270{
271 u16 reg = in_be16(&bcom_eng->regs->tcr[task]);
272 out_be16(&bcom_eng->regs->tcr[task], reg & ~TASK_ENABLE);
273}
274
275
276static inline u32 *
277bcom_task_desc(int task)
278{
279 return bcom_sram_pa2va(bcom_eng->tdt[task].start);
280}
281
282static inline int
283bcom_task_num_descs(int task)
284{
285 return (bcom_eng->tdt[task].stop - bcom_eng->tdt[task].start)/sizeof(u32) + 1;
286}
287
288static inline u32 *
289bcom_task_var(int task)
290{
291 return bcom_sram_pa2va(bcom_eng->tdt[task].var);
292}
293
294static inline u32 *
295bcom_task_inc(int task)
296{
297 return &bcom_task_var(task)[BCOM_MAX_VAR];
298}
299
300
301static inline int
302bcom_drd_is_extended(u32 desc)
303{
304 return (desc) & BCOM_DRD_EXTENDED;
305}
306
307static inline int
308bcom_desc_is_drd(u32 desc)
309{
310 return !(desc & BCOM_LCD_MASK) && desc != BCOM_DESC_NOP;
311}
312
313static inline int
314bcom_desc_initiator(u32 desc)
315{
316 return (desc >> BCOM_DRD_INITIATOR_SHIFT) & 0x1f;
317}
318
319static inline void
320bcom_set_desc_initiator(u32 *desc, int initiator)
321{
322 *desc = (*desc & ~(0x1f << BCOM_DRD_INITIATOR_SHIFT)) |
323 ((initiator & 0x1f) << BCOM_DRD_INITIATOR_SHIFT);
324}
325
326
327static inline void
328bcom_set_task_pragma(int task, int pragma)
329{
330 u32 *fdt = &bcom_eng->tdt[task].fdt;
331 *fdt = (*fdt & ~0xff) | pragma;
332}
333
334static inline void
335bcom_set_task_auto_start(int task, int next_task)
336{
337 u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
338 out_be16(tcr, (in_be16(tcr) & ~0xff) | 0x00c0 | next_task);
339}
340
341static inline void
342bcom_set_tcr_initiator(int task, int initiator)
343{
344 u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
345 out_be16(tcr, (in_be16(tcr) & ~0x1f00) | ((initiator & 0x1f) << 8));
346}
347
348
349#endif /* __BESTCOMM_PRIV_H__ */
350
diff --git a/include/linux/fsl/bestcomm/fec.h b/include/linux/fsl/bestcomm/fec.h
new file mode 100644
index 000000000000..ee565d94d503
--- /dev/null
+++ b/include/linux/fsl/bestcomm/fec.h
@@ -0,0 +1,61 @@
1/*
2 * Header for Bestcomm FEC tasks driver
3 *
4 *
5 * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2003-2004 MontaVista, Software, Inc.
7 * ( by Dale Farnsworth <dfarnsworth@mvista.com> )
8 *
9 * This file is licensed under the terms of the GNU General Public License
10 * version 2. This program is licensed "as is" without any warranty of any
11 * kind, whether express or implied.
12 */
13
14#ifndef __BESTCOMM_FEC_H__
15#define __BESTCOMM_FEC_H__
16
17
18struct bcom_fec_bd {
19 u32 status;
20 u32 skb_pa;
21};
22
23#define BCOM_FEC_TX_BD_TFD 0x08000000ul /* transmit frame done */
24#define BCOM_FEC_TX_BD_TC 0x04000000ul /* transmit CRC */
25#define BCOM_FEC_TX_BD_ABC 0x02000000ul /* append bad CRC */
26
27#define BCOM_FEC_RX_BD_L 0x08000000ul /* buffer is last in frame */
28#define BCOM_FEC_RX_BD_BC 0x00800000ul /* DA is broadcast */
29#define BCOM_FEC_RX_BD_MC 0x00400000ul /* DA is multicast and not broadcast */
30#define BCOM_FEC_RX_BD_LG 0x00200000ul /* Rx frame length violation */
31#define BCOM_FEC_RX_BD_NO 0x00100000ul /* Rx non-octet aligned frame */
32#define BCOM_FEC_RX_BD_CR 0x00040000ul /* Rx CRC error */
33#define BCOM_FEC_RX_BD_OV 0x00020000ul /* overrun */
34#define BCOM_FEC_RX_BD_TR 0x00010000ul /* Rx frame truncated */
35#define BCOM_FEC_RX_BD_LEN_MASK 0x000007fful /* mask for length of received frame */
36#define BCOM_FEC_RX_BD_ERRORS (BCOM_FEC_RX_BD_LG | BCOM_FEC_RX_BD_NO | \
37 BCOM_FEC_RX_BD_CR | BCOM_FEC_RX_BD_OV | BCOM_FEC_RX_BD_TR)
38
39
40extern struct bcom_task *
41bcom_fec_rx_init(int queue_len, phys_addr_t fifo, int maxbufsize);
42
43extern int
44bcom_fec_rx_reset(struct bcom_task *tsk);
45
46extern void
47bcom_fec_rx_release(struct bcom_task *tsk);
48
49
50extern struct bcom_task *
51bcom_fec_tx_init(int queue_len, phys_addr_t fifo);
52
53extern int
54bcom_fec_tx_reset(struct bcom_task *tsk);
55
56extern void
57bcom_fec_tx_release(struct bcom_task *tsk);
58
59
60#endif /* __BESTCOMM_FEC_H__ */
61
diff --git a/include/linux/fsl/bestcomm/gen_bd.h b/include/linux/fsl/bestcomm/gen_bd.h
new file mode 100644
index 000000000000..de47260e69da
--- /dev/null
+++ b/include/linux/fsl/bestcomm/gen_bd.h
@@ -0,0 +1,53 @@
1/*
2 * Header for Bestcomm General Buffer Descriptor tasks driver
3 *
4 *
5 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2006 AppSpec Computer Technologies Corp.
7 * Jeff Gibbons <jeff.gibbons@appspec.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 *
14 */
15
16#ifndef __BESTCOMM_GEN_BD_H__
17#define __BESTCOMM_GEN_BD_H__
18
19struct bcom_gen_bd {
20 u32 status;
21 u32 buf_pa;
22};
23
24
25extern struct bcom_task *
26bcom_gen_bd_rx_init(int queue_len, phys_addr_t fifo,
27 int initiator, int ipr, int maxbufsize);
28
29extern int
30bcom_gen_bd_rx_reset(struct bcom_task *tsk);
31
32extern void
33bcom_gen_bd_rx_release(struct bcom_task *tsk);
34
35
36extern struct bcom_task *
37bcom_gen_bd_tx_init(int queue_len, phys_addr_t fifo,
38 int initiator, int ipr);
39
40extern int
41bcom_gen_bd_tx_reset(struct bcom_task *tsk);
42
43extern void
44bcom_gen_bd_tx_release(struct bcom_task *tsk);
45
46
47/* PSC support utility wrappers */
48struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len,
49 phys_addr_t fifo, int maxbufsize);
50struct bcom_task * bcom_psc_gen_bd_tx_init(unsigned psc_num, int queue_len,
51 phys_addr_t fifo);
52#endif /* __BESTCOMM_GEN_BD_H__ */
53
diff --git a/include/linux/fsl/bestcomm/sram.h b/include/linux/fsl/bestcomm/sram.h
new file mode 100644
index 000000000000..b6d668963cce
--- /dev/null
+++ b/include/linux/fsl/bestcomm/sram.h
@@ -0,0 +1,54 @@
1/*
2 * Handling of a sram zone for bestcomm
3 *
4 *
5 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef __BESTCOMM_SRAM_H__
13#define __BESTCOMM_SRAM_H__
14
15#include <asm/rheap.h>
16#include <asm/mmu.h>
17#include <linux/spinlock.h>
18
19
20/* Structure used internally */
21 /* The internals are here for the inline functions
22 * sake, certainly not for the user to mess with !
23 */
24struct bcom_sram {
25 phys_addr_t base_phys;
26 void *base_virt;
27 unsigned int size;
28 rh_info_t *rh;
29 spinlock_t lock;
30};
31
32extern struct bcom_sram *bcom_sram;
33
34
35/* Public API */
36extern int bcom_sram_init(struct device_node *sram_node, char *owner);
37extern void bcom_sram_cleanup(void);
38
39extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
40extern void bcom_sram_free(void *ptr);
41
42static inline phys_addr_t bcom_sram_va2pa(void *va) {
43 return bcom_sram->base_phys +
44 (unsigned long)(va - bcom_sram->base_virt);
45}
46
47static inline void *bcom_sram_pa2va(phys_addr_t pa) {
48 return bcom_sram->base_virt +
49 (unsigned long)(pa - bcom_sram->base_phys);
50}
51
52
53#endif /* __BESTCOMM_SRAM_H__ */
54
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 0fbfb4646d1b..a78680a92dba 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -244,7 +244,7 @@ static inline void fsnotify_open(struct file *file)
244static inline void fsnotify_close(struct file *file) 244static inline void fsnotify_close(struct file *file)
245{ 245{
246 struct path *path = &file->f_path; 246 struct path *path = &file->f_path;
247 struct inode *inode = file->f_path.dentry->d_inode; 247 struct inode *inode = file_inode(file);
248 fmode_t mode = file->f_mode; 248 fmode_t mode = file->f_mode;
249 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 249 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
250 250
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 92691d85c320..e5ca8ef50e9b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -74,7 +74,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called 74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called
75 * and passed to the callback. If this flag is set, but the 75 * and passed to the callback. If this flag is set, but the
76 * architecture does not support passing regs 76 * architecture does not support passing regs
77 * (ARCH_SUPPORTS_FTRACE_SAVE_REGS is not defined), then the 77 * (CONFIG_DYNAMIC_FTRACE_WITH_REGS is not defined), then the
78 * ftrace_ops will fail to register, unless the next flag 78 * ftrace_ops will fail to register, unless the next flag
79 * is set. 79 * is set.
80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the 80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the
@@ -418,7 +418,7 @@ void ftrace_modify_all_code(int command);
418#endif 418#endif
419 419
420#ifndef FTRACE_REGS_ADDR 420#ifndef FTRACE_REGS_ADDR
421#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS 421#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
422# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller) 422# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
423#else 423#else
424# define FTRACE_REGS_ADDR FTRACE_ADDR 424# define FTRACE_REGS_ADDR FTRACE_ADDR
@@ -480,7 +480,7 @@ extern int ftrace_make_nop(struct module *mod,
480 */ 480 */
481extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); 481extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
482 482
483#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS 483#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
484/** 484/**
485 * ftrace_modify_call - convert from one addr to another (no nop) 485 * ftrace_modify_call - convert from one addr to another (no nop)
486 * @rec: the mcount call site record 486 * @rec: the mcount call site record
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index a3d489531d83..13a54d0bdfa8 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -49,7 +49,6 @@ struct trace_entry {
49 unsigned char flags; 49 unsigned char flags;
50 unsigned char preempt_count; 50 unsigned char preempt_count;
51 int pid; 51 int pid;
52 int padding;
53}; 52};
54 53
55#define FTRACE_MAX_EVENT \ 54#define FTRACE_MAX_EVENT \
@@ -84,6 +83,9 @@ struct trace_iterator {
84 long idx; 83 long idx;
85 84
86 cpumask_var_t started; 85 cpumask_var_t started;
86
87 /* it's true when current open file is snapshot */
88 bool snapshot;
87}; 89};
88 90
89enum trace_iter_flags { 91enum trace_iter_flags {
@@ -272,7 +274,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
272extern int trace_add_event_call(struct ftrace_event_call *call); 274extern int trace_add_event_call(struct ftrace_event_call *call);
273extern void trace_remove_event_call(struct ftrace_event_call *call); 275extern void trace_remove_event_call(struct ftrace_event_call *call);
274 276
275#define is_signed_type(type) (((type)(-1)) < 0) 277#define is_signed_type(type) (((type)(-1)) < (type)0)
276 278
277int trace_set_clr_event(const char *system, const char *event, int set); 279int trace_set_clr_event(const char *system, const char *event, int set);
278 280
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 79b8bba19363..9f3c275e053e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -231,6 +231,12 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
231 } 231 }
232} 232}
233 233
234static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
235{
236 part_pack_uuid(uuid_str, to);
237 return 0;
238}
239
234static inline int disk_max_parts(struct gendisk *disk) 240static inline int disk_max_parts(struct gendisk *disk)
235{ 241{
236 if (disk->flags & GENHD_FL_EXT_DEVT) 242 if (disk->flags & GENHD_FL_EXT_DEVT)
@@ -718,6 +724,10 @@ static inline dev_t blk_lookup_devt(const char *name, int partno)
718 return devt; 724 return devt;
719} 725}
720 726
727static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
728{
729 return -EINVAL;
730}
721#endif /* CONFIG_BLOCK */ 731#endif /* CONFIG_BLOCK */
722 732
723#endif /* _LINUX_GENHD_H */ 733#endif /* _LINUX_GENHD_H */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index bfe665621536..f6c7ae3e223b 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -94,24 +94,12 @@ static inline int gpio_request(unsigned gpio, const char *label)
94 return -ENOSYS; 94 return -ENOSYS;
95} 95}
96 96
97static inline int devm_gpio_request(struct device *dev, unsigned gpio,
98 const char *label)
99{
100 return -ENOSYS;
101}
102
103static inline int gpio_request_one(unsigned gpio, 97static inline int gpio_request_one(unsigned gpio,
104 unsigned long flags, const char *label) 98 unsigned long flags, const char *label)
105{ 99{
106 return -ENOSYS; 100 return -ENOSYS;
107} 101}
108 102
109static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
110 unsigned long flags, const char *label)
111{
112 return -ENOSYS;
113}
114
115static inline int gpio_request_array(const struct gpio *array, size_t num) 103static inline int gpio_request_array(const struct gpio *array, size_t num)
116{ 104{
117 return -ENOSYS; 105 return -ENOSYS;
@@ -125,14 +113,6 @@ static inline void gpio_free(unsigned gpio)
125 WARN_ON(1); 113 WARN_ON(1);
126} 114}
127 115
128static inline void devm_gpio_free(struct device *dev, unsigned gpio)
129{
130 might_sleep();
131
132 /* GPIO can never have been requested */
133 WARN_ON(1);
134}
135
136static inline void gpio_free_array(const struct gpio *array, size_t num) 116static inline void gpio_free_array(const struct gpio *array, size_t num)
137{ 117{
138 might_sleep(); 118 might_sleep();
@@ -248,4 +228,12 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)
248 228
249#endif /* ! CONFIG_GENERIC_GPIO */ 229#endif /* ! CONFIG_GENERIC_GPIO */
250 230
231struct device;
232
233/* bindings for managed devices that want to request gpios */
234int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
235int devm_gpio_request_one(struct device *dev, unsigned gpio,
236 unsigned long flags, const char *label);
237void devm_gpio_free(struct device *dev, unsigned int gpio);
238
251#endif /* __LINUX_GPIO_H */ 239#endif /* __LINUX_GPIO_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 624ef3f45c8e..29eb805ea4a6 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -153,7 +153,7 @@ extern void rcu_nmi_exit(void);
153 */ 153 */
154#define __irq_enter() \ 154#define __irq_enter() \
155 do { \ 155 do { \
156 vtime_account_irq_enter(current); \ 156 account_irq_enter_time(current); \
157 add_preempt_count(HARDIRQ_OFFSET); \ 157 add_preempt_count(HARDIRQ_OFFSET); \
158 trace_hardirq_enter(); \ 158 trace_hardirq_enter(); \
159 } while (0) 159 } while (0)
@@ -169,7 +169,7 @@ extern void irq_enter(void);
169#define __irq_exit() \ 169#define __irq_exit() \
170 do { \ 170 do { \
171 trace_hardirq_exit(); \ 171 trace_hardirq_exit(); \
172 vtime_account_irq_exit(current); \ 172 account_irq_exit_time(current); \
173 sub_preempt_count(HARDIRQ_OFFSET); \ 173 sub_preempt_count(HARDIRQ_OFFSET); \
174 } while (0) 174 } while (0)
175 175
@@ -180,10 +180,10 @@ extern void irq_exit(void);
180 180
181#define nmi_enter() \ 181#define nmi_enter() \
182 do { \ 182 do { \
183 lockdep_off(); \
183 ftrace_nmi_enter(); \ 184 ftrace_nmi_enter(); \
184 BUG_ON(in_nmi()); \ 185 BUG_ON(in_nmi()); \
185 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 186 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
186 lockdep_off(); \
187 rcu_nmi_enter(); \ 187 rcu_nmi_enter(); \
188 trace_hardirq_enter(); \ 188 trace_hardirq_enter(); \
189 } while (0) 189 } while (0)
@@ -192,10 +192,10 @@ extern void irq_exit(void);
192 do { \ 192 do { \
193 trace_hardirq_exit(); \ 193 trace_hardirq_exit(); \
194 rcu_nmi_exit(); \ 194 rcu_nmi_exit(); \
195 lockdep_on(); \
196 BUG_ON(!in_nmi()); \ 195 BUG_ON(!in_nmi()); \
197 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 196 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
198 ftrace_nmi_exit(); \ 197 ftrace_nmi_exit(); \
198 lockdep_on(); \
199 } while (0) 199 } while (0)
200 200
201#endif /* LINUX_HARDIRQ_H */ 201#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 227c62424f3c..a9df51f5d54c 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -115,51 +115,50 @@ static inline void hash_del_rcu(struct hlist_node *node)
115 * hash_for_each - iterate over a hashtable 115 * hash_for_each - iterate over a hashtable
116 * @name: hashtable to iterate 116 * @name: hashtable to iterate
117 * @bkt: integer to use as bucket loop cursor 117 * @bkt: integer to use as bucket loop cursor
118 * @node: the &struct list_head to use as a loop cursor for each entry
119 * @obj: the type * to use as a loop cursor for each entry 118 * @obj: the type * to use as a loop cursor for each entry
120 * @member: the name of the hlist_node within the struct 119 * @member: the name of the hlist_node within the struct
121 */ 120 */
122#define hash_for_each(name, bkt, node, obj, member) \ 121#define hash_for_each(name, bkt, obj, member) \
123 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 122 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
124 hlist_for_each_entry(obj, node, &name[bkt], member) 123 (bkt)++)\
124 hlist_for_each_entry(obj, &name[bkt], member)
125 125
126/** 126/**
127 * hash_for_each_rcu - iterate over a rcu enabled hashtable 127 * hash_for_each_rcu - iterate over a rcu enabled hashtable
128 * @name: hashtable to iterate 128 * @name: hashtable to iterate
129 * @bkt: integer to use as bucket loop cursor 129 * @bkt: integer to use as bucket loop cursor
130 * @node: the &struct list_head to use as a loop cursor for each entry
131 * @obj: the type * to use as a loop cursor for each entry 130 * @obj: the type * to use as a loop cursor for each entry
132 * @member: the name of the hlist_node within the struct 131 * @member: the name of the hlist_node within the struct
133 */ 132 */
134#define hash_for_each_rcu(name, bkt, node, obj, member) \ 133#define hash_for_each_rcu(name, bkt, obj, member) \
135 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 134 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
136 hlist_for_each_entry_rcu(obj, node, &name[bkt], member) 135 (bkt)++)\
136 hlist_for_each_entry_rcu(obj, &name[bkt], member)
137 137
138/** 138/**
139 * hash_for_each_safe - iterate over a hashtable safe against removal of 139 * hash_for_each_safe - iterate over a hashtable safe against removal of
140 * hash entry 140 * hash entry
141 * @name: hashtable to iterate 141 * @name: hashtable to iterate
142 * @bkt: integer to use as bucket loop cursor 142 * @bkt: integer to use as bucket loop cursor
143 * @node: the &struct list_head to use as a loop cursor for each entry
144 * @tmp: a &struct used for temporary storage 143 * @tmp: a &struct used for temporary storage
145 * @obj: the type * to use as a loop cursor for each entry 144 * @obj: the type * to use as a loop cursor for each entry
146 * @member: the name of the hlist_node within the struct 145 * @member: the name of the hlist_node within the struct
147 */ 146 */
148#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ 147#define hash_for_each_safe(name, bkt, tmp, obj, member) \
149 for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ 148 for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name);\
150 hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) 149 (bkt)++)\
150 hlist_for_each_entry_safe(obj, tmp, &name[bkt], member)
151 151
152/** 152/**
153 * hash_for_each_possible - iterate over all possible objects hashing to the 153 * hash_for_each_possible - iterate over all possible objects hashing to the
154 * same bucket 154 * same bucket
155 * @name: hashtable to iterate 155 * @name: hashtable to iterate
156 * @obj: the type * to use as a loop cursor for each entry 156 * @obj: the type * to use as a loop cursor for each entry
157 * @node: the &struct list_head to use as a loop cursor for each entry
158 * @member: the name of the hlist_node within the struct 157 * @member: the name of the hlist_node within the struct
159 * @key: the key of the objects to iterate over 158 * @key: the key of the objects to iterate over
160 */ 159 */
161#define hash_for_each_possible(name, obj, node, member, key) \ 160#define hash_for_each_possible(name, obj, member, key) \
162 hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 161 hlist_for_each_entry(obj, &name[hash_min(key, HASH_BITS(name))], member)
163 162
164/** 163/**
165 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the 164 * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
@@ -167,25 +166,24 @@ static inline void hash_del_rcu(struct hlist_node *node)
167 * in a rcu enabled hashtable 166 * in a rcu enabled hashtable
168 * @name: hashtable to iterate 167 * @name: hashtable to iterate
169 * @obj: the type * to use as a loop cursor for each entry 168 * @obj: the type * to use as a loop cursor for each entry
170 * @node: the &struct list_head to use as a loop cursor for each entry
171 * @member: the name of the hlist_node within the struct 169 * @member: the name of the hlist_node within the struct
172 * @key: the key of the objects to iterate over 170 * @key: the key of the objects to iterate over
173 */ 171 */
174#define hash_for_each_possible_rcu(name, obj, node, member, key) \ 172#define hash_for_each_possible_rcu(name, obj, member, key) \
175 hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) 173 hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))],\
174 member)
176 175
177/** 176/**
178 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
179 * same bucket safe against removals 178 * same bucket safe against removals
180 * @name: hashtable to iterate 179 * @name: hashtable to iterate
181 * @obj: the type * to use as a loop cursor for each entry 180 * @obj: the type * to use as a loop cursor for each entry
182 * @node: the &struct list_head to use as a loop cursor for each entry
183 * @tmp: a &struct used for temporary storage 181 * @tmp: a &struct used for temporary storage
184 * @member: the name of the hlist_node within the struct 182 * @member: the name of the hlist_node within the struct
185 * @key: the key of the objects to iterate over 183 * @key: the key of the objects to iterate over
186 */ 184 */
187#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ 185#define hash_for_each_possible_safe(name, obj, tmp, member, key) \
188 hlist_for_each_entry_safe(obj, node, tmp, \ 186 hlist_for_each_entry_safe(obj, tmp,\
189 &name[hash_min(key, HASH_BITS(name))], member) 187 &name[hash_min(key, HASH_BITS(name))], member)
190 188
191 189
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
new file mode 100644
index 000000000000..3b589440ecfe
--- /dev/null
+++ b/include/linux/hdmi.h
@@ -0,0 +1,231 @@
1/*
2 * Copyright (C) 2012 Avionic Design GmbH
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_HDMI_H_
10#define __LINUX_HDMI_H_
11
12#include <linux/types.h>
13
14enum hdmi_infoframe_type {
15 HDMI_INFOFRAME_TYPE_VENDOR = 0x81,
16 HDMI_INFOFRAME_TYPE_AVI = 0x82,
17 HDMI_INFOFRAME_TYPE_SPD = 0x83,
18 HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
19};
20
21#define HDMI_INFOFRAME_HEADER_SIZE 4
22#define HDMI_AVI_INFOFRAME_SIZE 13
23#define HDMI_SPD_INFOFRAME_SIZE 25
24#define HDMI_AUDIO_INFOFRAME_SIZE 10
25
26enum hdmi_colorspace {
27 HDMI_COLORSPACE_RGB,
28 HDMI_COLORSPACE_YUV422,
29 HDMI_COLORSPACE_YUV444,
30};
31
32enum hdmi_scan_mode {
33 HDMI_SCAN_MODE_NONE,
34 HDMI_SCAN_MODE_OVERSCAN,
35 HDMI_SCAN_MODE_UNDERSCAN,
36};
37
38enum hdmi_colorimetry {
39 HDMI_COLORIMETRY_NONE,
40 HDMI_COLORIMETRY_ITU_601,
41 HDMI_COLORIMETRY_ITU_709,
42 HDMI_COLORIMETRY_EXTENDED,
43};
44
45enum hdmi_picture_aspect {
46 HDMI_PICTURE_ASPECT_NONE,
47 HDMI_PICTURE_ASPECT_4_3,
48 HDMI_PICTURE_ASPECT_16_9,
49};
50
51enum hdmi_active_aspect {
52 HDMI_ACTIVE_ASPECT_16_9_TOP = 2,
53 HDMI_ACTIVE_ASPECT_14_9_TOP = 3,
54 HDMI_ACTIVE_ASPECT_16_9_CENTER = 4,
55 HDMI_ACTIVE_ASPECT_PICTURE = 8,
56 HDMI_ACTIVE_ASPECT_4_3 = 9,
57 HDMI_ACTIVE_ASPECT_16_9 = 10,
58 HDMI_ACTIVE_ASPECT_14_9 = 11,
59 HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13,
60 HDMI_ACTIVE_ASPECT_16_9_SP_14_9 = 14,
61 HDMI_ACTIVE_ASPECT_16_9_SP_4_3 = 15,
62};
63
64enum hdmi_extended_colorimetry {
65 HDMI_EXTENDED_COLORIMETRY_XV_YCC_601,
66 HDMI_EXTENDED_COLORIMETRY_XV_YCC_709,
67 HDMI_EXTENDED_COLORIMETRY_S_YCC_601,
68 HDMI_EXTENDED_COLORIMETRY_ADOBE_YCC_601,
69 HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB,
70};
71
72enum hdmi_quantization_range {
73 HDMI_QUANTIZATION_RANGE_DEFAULT,
74 HDMI_QUANTIZATION_RANGE_LIMITED,
75 HDMI_QUANTIZATION_RANGE_FULL,
76};
77
78/* non-uniform picture scaling */
79enum hdmi_nups {
80 HDMI_NUPS_UNKNOWN,
81 HDMI_NUPS_HORIZONTAL,
82 HDMI_NUPS_VERTICAL,
83 HDMI_NUPS_BOTH,
84};
85
86enum hdmi_ycc_quantization_range {
87 HDMI_YCC_QUANTIZATION_RANGE_LIMITED,
88 HDMI_YCC_QUANTIZATION_RANGE_FULL,
89};
90
91enum hdmi_content_type {
92 HDMI_CONTENT_TYPE_NONE,
93 HDMI_CONTENT_TYPE_PHOTO,
94 HDMI_CONTENT_TYPE_CINEMA,
95 HDMI_CONTENT_TYPE_GAME,
96};
97
98struct hdmi_avi_infoframe {
99 enum hdmi_infoframe_type type;
100 unsigned char version;
101 unsigned char length;
102 enum hdmi_colorspace colorspace;
103 bool active_info_valid;
104 bool horizontal_bar_valid;
105 bool vertical_bar_valid;
106 enum hdmi_scan_mode scan_mode;
107 enum hdmi_colorimetry colorimetry;
108 enum hdmi_picture_aspect picture_aspect;
109 enum hdmi_active_aspect active_aspect;
110 bool itc;
111 enum hdmi_extended_colorimetry extended_colorimetry;
112 enum hdmi_quantization_range quantization_range;
113 enum hdmi_nups nups;
114 unsigned char video_code;
115 enum hdmi_ycc_quantization_range ycc_quantization_range;
116 enum hdmi_content_type content_type;
117 unsigned char pixel_repeat;
118 unsigned short top_bar;
119 unsigned short bottom_bar;
120 unsigned short left_bar;
121 unsigned short right_bar;
122};
123
124int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);
125ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
126 size_t size);
127
128enum hdmi_spd_sdi {
129 HDMI_SPD_SDI_UNKNOWN,
130 HDMI_SPD_SDI_DSTB,
131 HDMI_SPD_SDI_DVDP,
132 HDMI_SPD_SDI_DVHS,
133 HDMI_SPD_SDI_HDDVR,
134 HDMI_SPD_SDI_DVC,
135 HDMI_SPD_SDI_DSC,
136 HDMI_SPD_SDI_VCD,
137 HDMI_SPD_SDI_GAME,
138 HDMI_SPD_SDI_PC,
139 HDMI_SPD_SDI_BD,
140 HDMI_SPD_SDI_SACD,
141 HDMI_SPD_SDI_HDDVD,
142 HDMI_SPD_SDI_PMP,
143};
144
145struct hdmi_spd_infoframe {
146 enum hdmi_infoframe_type type;
147 unsigned char version;
148 unsigned char length;
149 char vendor[8];
150 char product[16];
151 enum hdmi_spd_sdi sdi;
152};
153
154int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame,
155 const char *vendor, const char *product);
156ssize_t hdmi_spd_infoframe_pack(struct hdmi_spd_infoframe *frame, void *buffer,
157 size_t size);
158
159enum hdmi_audio_coding_type {
160 HDMI_AUDIO_CODING_TYPE_STREAM,
161 HDMI_AUDIO_CODING_TYPE_PCM,
162 HDMI_AUDIO_CODING_TYPE_AC3,
163 HDMI_AUDIO_CODING_TYPE_MPEG1,
164 HDMI_AUDIO_CODING_TYPE_MP3,
165 HDMI_AUDIO_CODING_TYPE_MPEG2,
166 HDMI_AUDIO_CODING_TYPE_AAC_LC,
167 HDMI_AUDIO_CODING_TYPE_DTS,
168 HDMI_AUDIO_CODING_TYPE_ATRAC,
169 HDMI_AUDIO_CODING_TYPE_DSD,
170 HDMI_AUDIO_CODING_TYPE_EAC3,
171 HDMI_AUDIO_CODING_TYPE_DTS_HD,
172 HDMI_AUDIO_CODING_TYPE_MLP,
173 HDMI_AUDIO_CODING_TYPE_DST,
174 HDMI_AUDIO_CODING_TYPE_WMA_PRO,
175};
176
177enum hdmi_audio_sample_size {
178 HDMI_AUDIO_SAMPLE_SIZE_STREAM,
179 HDMI_AUDIO_SAMPLE_SIZE_16,
180 HDMI_AUDIO_SAMPLE_SIZE_20,
181 HDMI_AUDIO_SAMPLE_SIZE_24,
182};
183
184enum hdmi_audio_sample_frequency {
185 HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
186 HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
187 HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
188 HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
189 HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
190 HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
191 HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
192 HDMI_AUDIO_SAMPLE_FREQUENCY_192000,
193};
194
195enum hdmi_audio_coding_type_ext {
196 HDMI_AUDIO_CODING_TYPE_EXT_STREAM,
197 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
198 HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
199 HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
200};
201
202struct hdmi_audio_infoframe {
203 enum hdmi_infoframe_type type;
204 unsigned char version;
205 unsigned char length;
206 unsigned char channels;
207 enum hdmi_audio_coding_type coding_type;
208 enum hdmi_audio_sample_size sample_size;
209 enum hdmi_audio_sample_frequency sample_frequency;
210 enum hdmi_audio_coding_type_ext coding_type_ext;
211 unsigned char channel_allocation;
212 unsigned char level_shift_value;
213 bool downmix_inhibit;
214
215};
216
217int hdmi_audio_infoframe_init(struct hdmi_audio_infoframe *frame);
218ssize_t hdmi_audio_infoframe_pack(struct hdmi_audio_infoframe *frame,
219 void *buffer, size_t size);
220
221struct hdmi_vendor_infoframe {
222 enum hdmi_infoframe_type type;
223 unsigned char version;
224 unsigned char length;
225 u8 data[27];
226};
227
228ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
229 void *buffer, size_t size);
230
231#endif /* _DRM_HDMI_H */
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 0aa5f4c42ae6..ecefb7311dd6 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -157,4 +157,42 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
157*/ 157*/
158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, 158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
159 u32 field_index, s32 *value); 159 u32 field_index, s32 *value);
160
161/* hid-sensor-attributes */
162
163/* Common hid sensor iio structure */
164struct hid_sensor_common {
165 struct hid_sensor_hub_device *hsdev;
166 struct platform_device *pdev;
167 unsigned usage_id;
168 bool data_ready;
169 struct hid_sensor_hub_attribute_info poll;
170 struct hid_sensor_hub_attribute_info report_state;
171 struct hid_sensor_hub_attribute_info power_state;
172 struct hid_sensor_hub_attribute_info sensitivity;
173};
174
175/*Convert from hid unit expo to regular exponent*/
176static inline int hid_sensor_convert_exponent(int unit_expo)
177{
178 if (unit_expo < 0x08)
179 return unit_expo;
180 else if (unit_expo <= 0x0f)
181 return -(0x0f-unit_expo+1);
182 else
183 return 0;
184}
185
186int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
187 u32 usage_id,
188 struct hid_sensor_common *st);
189int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
190 int val1, int val2);
191int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st,
192 int *val1, int *val2);
193int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
194 int val1, int val2);
195int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
196 int *val1, int *val2);
197
160#endif 198#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 55f277372fed..6f24446e7669 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -66,6 +66,15 @@
66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486 66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486
67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487 67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487
68 68
69/* Time (2000a0) */
70#define HID_USAGE_SENSOR_TIME 0x2000a0
71#define HID_USAGE_SENSOR_TIME_YEAR 0x200521
72#define HID_USAGE_SENSOR_TIME_MONTH 0x200522
73#define HID_USAGE_SENSOR_TIME_DAY 0x200523
74#define HID_USAGE_SENSOR_TIME_HOUR 0x200525
75#define HID_USAGE_SENSOR_TIME_MINUTE 0x200526
76#define HID_USAGE_SENSOR_TIME_SECOND 0x200527
77
69/* Units */ 78/* Units */
70#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00 79#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00
71#define HID_USAGE_SENSOR_UNITS_LUX 0x01 80#define HID_USAGE_SENSOR_UNITS_LUX 0x01
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7330a0fef0c0..e14b465b1146 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -589,6 +589,7 @@ struct hid_usage_id {
589 * @raw_event: if report in report_table, this hook is called (NULL means nop) 589 * @raw_event: if report in report_table, this hook is called (NULL means nop)
590 * @usage_table: on which events to call event (NULL means all) 590 * @usage_table: on which events to call event (NULL means all)
591 * @event: if usage in usage_table, this hook is called (NULL means nop) 591 * @event: if usage in usage_table, this hook is called (NULL means nop)
592 * @report: this hook is called after parsing a report (NULL means nop)
592 * @report_fixup: called before report descriptor parsing (NULL means nop) 593 * @report_fixup: called before report descriptor parsing (NULL means nop)
593 * @input_mapping: invoked on input registering before mapping an usage 594 * @input_mapping: invoked on input registering before mapping an usage
594 * @input_mapped: invoked on input registering after mapping an usage 595 * @input_mapped: invoked on input registering after mapping an usage
@@ -627,6 +628,7 @@ struct hid_driver {
627 const struct hid_usage_id *usage_table; 628 const struct hid_usage_id *usage_table;
628 int (*event)(struct hid_device *hdev, struct hid_field *field, 629 int (*event)(struct hid_device *hdev, struct hid_field *field,
629 struct hid_usage *usage, __s32 value); 630 struct hid_usage *usage, __s32 value);
631 void (*report)(struct hid_device *hdev, struct hid_report *report);
630 632
631 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, 633 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
632 unsigned int *size); 634 unsigned int *size);
@@ -700,6 +702,18 @@ extern int __must_check __hid_register_driver(struct hid_driver *,
700 702
701extern void hid_unregister_driver(struct hid_driver *); 703extern void hid_unregister_driver(struct hid_driver *);
702 704
705/**
706 * module_hid_driver() - Helper macro for registering a HID driver
707 * @__hid_driver: hid_driver struct
708 *
709 * Helper macro for HID drivers which do not do anything special in module
710 * init/exit. This eliminates a lot of boilerplate. Each module may only
711 * use this macro once, and calling it replaces module_init() and module_exit()
712 */
713#define module_hid_driver(__hid_driver) \
714 module_driver(__hid_driver, hid_register_driver, \
715 hid_unregister_driver)
716
703extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 717extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
704extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 718extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
705extern int hidinput_connect(struct hid_device *hid, unsigned int force); 719extern int hidinput_connect(struct hid_device *hid, unsigned int force);
@@ -872,9 +886,6 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
872int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 886int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
873 int interrupt); 887 int interrupt);
874 888
875extern int hid_generic_init(void);
876extern void hid_generic_exit(void);
877
878/* HID quirks API */ 889/* HID quirks API */
879u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 890u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
880int usbhid_quirks_init(char **quirks_param); 891int usbhid_quirks_init(char **quirks_param);
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index ef788b5b4a35..7fb31da45d03 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -219,12 +219,6 @@ static inline void zero_user(struct page *page,
219 zero_user_segments(page, start, start + size, 0, 0); 219 zero_user_segments(page, start, start + size, 0, 0);
220} 220}
221 221
222static inline void __deprecated memclear_highpage_flush(struct page *page,
223 unsigned int offset, unsigned int size)
224{
225 zero_user(page, offset, size);
226}
227
228#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE 222#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE
229 223
230static inline void copy_user_highpage(struct page *to, struct page *from, 224static inline void copy_user_highpage(struct page *to, struct page *from,
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 56fae865e272..0dca785288cf 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -121,9 +121,9 @@ static inline int hsi_register_board_info(struct hsi_board_info const *info,
121 * @device: Driver model representation of the device 121 * @device: Driver model representation of the device
122 * @tx_cfg: HSI TX configuration 122 * @tx_cfg: HSI TX configuration
123 * @rx_cfg: HSI RX configuration 123 * @rx_cfg: HSI RX configuration
124 * @e_handler: Callback for handling port events (RX Wake High/Low) 124 * e_handler: Callback for handling port events (RX Wake High/Low)
125 * @pclaimed: Keeps tracks if the clients claimed its associated HSI port 125 * pclaimed: Keeps tracks if the clients claimed its associated HSI port
126 * @nb: Notifier block for port events 126 * nb: Notifier block for port events
127 */ 127 */
128struct hsi_client { 128struct hsi_client {
129 struct device device; 129 struct device device;
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 1d76f8ca90f0..ee1c244a62a1 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -113,7 +113,7 @@ extern void __split_huge_page_pmd(struct vm_area_struct *vma,
113 do { \ 113 do { \
114 pmd_t *____pmd = (__pmd); \ 114 pmd_t *____pmd = (__pmd); \
115 anon_vma_lock_write(__anon_vma); \ 115 anon_vma_lock_write(__anon_vma); \
116 anon_vma_unlock(__anon_vma); \ 116 anon_vma_unlock_write(__anon_vma); \
117 BUG_ON(pmd_trans_splitting(*____pmd) || \ 117 BUG_ON(pmd_trans_splitting(*____pmd) || \
118 pmd_trans_huge(*____pmd)); \ 118 pmd_trans_huge(*____pmd)); \
119 } while (0) 119 } while (0)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 0c80d3f57a5b..16e4e9a643fb 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -43,9 +43,9 @@ int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
43#endif 43#endif
44 44
45int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 45int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
46int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, 46long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
47 struct page **, struct vm_area_struct **, 47 struct page **, struct vm_area_struct **,
48 unsigned long *, int *, int, unsigned int flags); 48 unsigned long *, unsigned long *, long, unsigned int);
49void unmap_hugepage_range(struct vm_area_struct *, 49void unmap_hugepage_range(struct vm_area_struct *,
50 unsigned long, unsigned long, struct page *); 50 unsigned long, unsigned long, struct page *);
51void __unmap_hugepage_range_final(struct mmu_gather *tlb, 51void __unmap_hugepage_range_final(struct mmu_gather *tlb,
@@ -281,7 +281,7 @@ static inline struct hstate *hstate_inode(struct inode *i)
281 281
282static inline struct hstate *hstate_file(struct file *f) 282static inline struct hstate *hstate_file(struct file *f)
283{ 283{
284 return hstate_inode(f->f_dentry->d_inode); 284 return hstate_inode(file_inode(f));
285} 285}
286 286
287static inline struct hstate *hstate_vma(struct vm_area_struct *vma) 287static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 82b29ae6ebb0..b2514f70d591 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -20,16 +20,4 @@ struct device *hwmon_device_register(struct device *dev);
20 20
21void hwmon_device_unregister(struct device *dev); 21void hwmon_device_unregister(struct device *dev);
22 22
23/* Scale user input to sensible values */
24static inline int SENSORS_LIMIT(long value, long low, long high)
25{
26 if (value < low)
27 return low;
28 else if (value > high)
29 return high;
30 else
31 return value;
32}
33
34#endif 23#endif
35
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index e73b852156b1..df77ba9a8166 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -325,14 +325,28 @@ struct hv_ring_buffer {
325 325
326 u32 interrupt_mask; 326 u32 interrupt_mask;
327 327
328 /* Pad it to PAGE_SIZE so that data starts on page boundary */ 328 /*
329 u8 reserved[4084]; 329 * Win8 uses some of the reserved bits to implement
330 330 * interrupt driven flow management. On the send side
331 /* NOTE: 331 * we can request that the receiver interrupt the sender
332 * The interrupt_mask field is used only for channels but since our 332 * when the ring transitions from being full to being able
333 * vmbus connection also uses this data structure and its data starts 333 * to handle a message of size "pending_send_sz".
334 * here, we commented out this field. 334 *
335 * Add necessary state for this enhancement.
335 */ 336 */
337 u32 pending_send_sz;
338
339 u32 reserved1[12];
340
341 union {
342 struct {
343 u32 feat_pending_send_sz:1;
344 };
345 u32 value;
346 } feature_bits;
347
348 /* Pad it to PAGE_SIZE so that data starts on page boundary */
349 u8 reserved2[4028];
336 350
337 /* 351 /*
338 * Ring data starts here + RingDataStartOffset 352 * Ring data starts here + RingDataStartOffset
@@ -405,12 +419,22 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
405 */ 419 */
406#define HV_DRV_VERSION "3.1" 420#define HV_DRV_VERSION "3.1"
407 421
408
409/* 422/*
410 * A revision number of vmbus that is used for ensuring both ends on a 423 * VMBUS version is 32 bit entity broken up into
411 * partition are using compatible versions. 424 * two 16 bit quantities: major_number. minor_number.
425 *
426 * 0 . 13 (Windows Server 2008)
427 * 1 . 1 (Windows 7)
428 * 2 . 4 (Windows 8)
412 */ 429 */
413#define VMBUS_REVISION_NUMBER 13 430
431#define VERSION_WS2008 ((0 << 16) | (13))
432#define VERSION_WIN7 ((1 << 16) | (1))
433#define VERSION_WIN8 ((2 << 16) | (4))
434
435#define VERSION_INVAL -1
436
437#define VERSION_CURRENT VERSION_WIN8
414 438
415/* Make maximum size of pipe payload of 16K */ 439/* Make maximum size of pipe payload of 16K */
416#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) 440#define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384)
@@ -432,9 +456,13 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
432struct vmbus_channel_offer { 456struct vmbus_channel_offer {
433 uuid_le if_type; 457 uuid_le if_type;
434 uuid_le if_instance; 458 uuid_le if_instance;
435 u64 int_latency; /* in 100ns units */ 459
436 u32 if_revision; 460 /*
437 u32 server_ctx_size; /* in bytes */ 461 * These two fields are not currently used.
462 */
463 u64 reserved1;
464 u64 reserved2;
465
438 u16 chn_flags; 466 u16 chn_flags;
439 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */ 467 u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
440 468
@@ -456,7 +484,11 @@ struct vmbus_channel_offer {
456 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES]; 484 unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
457 } pipe; 485 } pipe;
458 } u; 486 } u;
459 u32 padding; 487 /*
488 * The sub_channel_index is defined in win8.
489 */
490 u16 sub_channel_index;
491 u16 reserved3;
460} __packed; 492} __packed;
461 493
462/* Server Flags */ 494/* Server Flags */
@@ -652,7 +684,25 @@ struct vmbus_channel_offer_channel {
652 struct vmbus_channel_offer offer; 684 struct vmbus_channel_offer offer;
653 u32 child_relid; 685 u32 child_relid;
654 u8 monitorid; 686 u8 monitorid;
655 u8 monitor_allocated; 687 /*
688 * win7 and beyond splits this field into a bit field.
689 */
690 u8 monitor_allocated:1;
691 u8 reserved:7;
692 /*
693 * These are new fields added in win7 and later.
694 * Do not access these fields without checking the
695 * negotiated protocol.
696 *
697 * If "is_dedicated_interrupt" is set, we must not set the
698 * associated bit in the channel bitmap while sending the
699 * interrupt to the host.
700 *
701 * connection_id is to be used in signaling the host.
702 */
703 u16 is_dedicated_interrupt:1;
704 u16 reserved1:15;
705 u32 connection_id;
656} __packed; 706} __packed;
657 707
658/* Rescind Offer parameters */ 708/* Rescind Offer parameters */
@@ -683,8 +733,15 @@ struct vmbus_channel_open_channel {
683 /* GPADL for the channel's ring buffer. */ 733 /* GPADL for the channel's ring buffer. */
684 u32 ringbuffer_gpadlhandle; 734 u32 ringbuffer_gpadlhandle;
685 735
686 /* GPADL for the channel's server context save area. */ 736 /*
687 u32 server_contextarea_gpadlhandle; 737 * Starting with win8, this field will be used to specify
738 * the target virtual processor on which to deliver the interrupt for
739 * the host to guest communication.
740 * Prior to win8, incoming channel interrupts would only
741 * be delivered on cpu 0. Setting this value to 0 would
742 * preserve the earlier behavior.
743 */
744 u32 target_vp;
688 745
689 /* 746 /*
690 * The upstream ring buffer begins at offset zero in the memory 747 * The upstream ring buffer begins at offset zero in the memory
@@ -848,6 +905,27 @@ struct vmbus_close_msg {
848 struct vmbus_channel_close_channel msg; 905 struct vmbus_channel_close_channel msg;
849}; 906};
850 907
908/* Define connection identifier type. */
909union hv_connection_id {
910 u32 asu32;
911 struct {
912 u32 id:24;
913 u32 reserved:8;
914 } u;
915};
916
917/* Definition of the hv_signal_event hypercall input structure. */
918struct hv_input_signal_event {
919 union hv_connection_id connectionid;
920 u16 flag_number;
921 u16 rsvdz;
922};
923
924struct hv_input_signal_event_buffer {
925 u64 align8;
926 struct hv_input_signal_event event;
927};
928
851struct vmbus_channel { 929struct vmbus_channel {
852 struct list_head listentry; 930 struct list_head listentry;
853 931
@@ -882,8 +960,42 @@ struct vmbus_channel {
882 960
883 void (*onchannel_callback)(void *context); 961 void (*onchannel_callback)(void *context);
884 void *channel_callback_context; 962 void *channel_callback_context;
963
964 /*
965 * A channel can be marked for efficient (batched)
966 * reading:
967 * If batched_reading is set to "true", we read until the
968 * channel is empty and hold off interrupts from the host
969 * during the entire read process.
970 * If batched_reading is set to "false", the client is not
971 * going to perform batched reading.
972 *
973 * By default we will enable batched reading; specific
974 * drivers that don't want this behavior can turn it off.
975 */
976
977 bool batched_reading;
978
979 bool is_dedicated_interrupt;
980 struct hv_input_signal_event_buffer sig_buf;
981 struct hv_input_signal_event *sig_event;
982
983 /*
984 * Starting with win8, this field will be used to specify
985 * the target virtual processor on which to deliver the interrupt for
986 * the host to guest communication.
987 * Prior to win8, incoming channel interrupts would only
988 * be delivered on cpu 0. Setting this value to 0 would
989 * preserve the earlier behavior.
990 */
991 u32 target_vp;
885}; 992};
886 993
994static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
995{
996 c->batched_reading = state;
997}
998
887void vmbus_onmessage(void *context); 999void vmbus_onmessage(void *context);
888 1000
889int vmbus_request_offers(void); 1001int vmbus_request_offers(void);
@@ -1047,6 +1159,100 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1047 g8, g9, ga, gb, gc, gd, ge, gf }, 1159 g8, g9, ga, gb, gc, gd, ge, gf },
1048 1160
1049/* 1161/*
1162 * GUID definitions of various offer types - services offered to the guest.
1163 */
1164
1165/*
1166 * Network GUID
1167 * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
1168 */
1169#define HV_NIC_GUID \
1170 .guid = { \
1171 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, \
1172 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e \
1173 }
1174
1175/*
1176 * IDE GUID
1177 * {32412632-86cb-44a2-9b5c-50d1417354f5}
1178 */
1179#define HV_IDE_GUID \
1180 .guid = { \
1181 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, \
1182 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 \
1183 }
1184
1185/*
1186 * SCSI GUID
1187 * {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}
1188 */
1189#define HV_SCSI_GUID \
1190 .guid = { \
1191 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, \
1192 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f \
1193 }
1194
1195/*
1196 * Shutdown GUID
1197 * {0e0b6031-5213-4934-818b-38d90ced39db}
1198 */
1199#define HV_SHUTDOWN_GUID \
1200 .guid = { \
1201 0x31, 0x60, 0x0b, 0x0e, 0x13, 0x52, 0x34, 0x49, \
1202 0x81, 0x8b, 0x38, 0xd9, 0x0c, 0xed, 0x39, 0xdb \
1203 }
1204
1205/*
1206 * Time Synch GUID
1207 * {9527E630-D0AE-497b-ADCE-E80AB0175CAF}
1208 */
1209#define HV_TS_GUID \
1210 .guid = { \
1211 0x30, 0xe6, 0x27, 0x95, 0xae, 0xd0, 0x7b, 0x49, \
1212 0xad, 0xce, 0xe8, 0x0a, 0xb0, 0x17, 0x5c, 0xaf \
1213 }
1214
1215/*
1216 * Heartbeat GUID
1217 * {57164f39-9115-4e78-ab55-382f3bd5422d}
1218 */
1219#define HV_HEART_BEAT_GUID \
1220 .guid = { \
1221 0x39, 0x4f, 0x16, 0x57, 0x15, 0x91, 0x78, 0x4e, \
1222 0xab, 0x55, 0x38, 0x2f, 0x3b, 0xd5, 0x42, 0x2d \
1223 }
1224
1225/*
1226 * KVP GUID
1227 * {a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}
1228 */
1229#define HV_KVP_GUID \
1230 .guid = { \
1231 0xe7, 0xf4, 0xa0, 0xa9, 0x45, 0x5a, 0x96, 0x4d, \
1232 0xb8, 0x27, 0x8a, 0x84, 0x1e, 0x8c, 0x3, 0xe6 \
1233 }
1234
1235/*
1236 * Dynamic memory GUID
1237 * {525074dc-8985-46e2-8057-a307dc18a502}
1238 */
1239#define HV_DM_GUID \
1240 .guid = { \
1241 0xdc, 0x74, 0x50, 0X52, 0x85, 0x89, 0xe2, 0x46, \
1242 0x80, 0x57, 0xa3, 0x07, 0xdc, 0x18, 0xa5, 0x02 \
1243 }
1244
1245/*
1246 * Mouse GUID
1247 * {cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}
1248 */
1249#define HV_MOUSE_GUID \
1250 .guid = { \
1251 0x9e, 0xb6, 0xa8, 0xcf, 0x4a, 0x5b, 0xc0, 0x4c, \
1252 0xb9, 0x8b, 0x8b, 0xa1, 0xa1, 0xf3, 0xf9, 0x5a \
1253 }
1254
1255/*
1050 * Common header for Hyper-V ICs 1256 * Common header for Hyper-V ICs
1051 */ 1257 */
1052 1258
@@ -1150,5 +1356,11 @@ int hv_kvp_init(struct hv_util_service *);
1150void hv_kvp_deinit(void); 1356void hv_kvp_deinit(void);
1151void hv_kvp_onchannelcallback(void *); 1357void hv_kvp_onchannelcallback(void *);
1152 1358
1359/*
1360 * Negotiated version with the Host.
1361 */
1362
1363extern __u32 vmbus_proto_version;
1364
1153#endif /* __KERNEL__ */ 1365#endif /* __KERNEL__ */
1154#endif /* _HYPERV_H */ 1366#endif /* _HYPERV_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1ff54b114efc..488debbef895 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -39,51 +39,55 @@
39 * address each module uses within a given i2c slave. 39 * address each module uses within a given i2c slave.
40 */ 40 */
41 41
42/* Module IDs for similar functionalities found in twl4030/twl6030 */
43enum twl_module_ids {
44 TWL_MODULE_USB,
45 TWL_MODULE_PIH,
46 TWL_MODULE_MAIN_CHARGE,
47 TWL_MODULE_PM_MASTER,
48 TWL_MODULE_PM_RECEIVER,
49
50 TWL_MODULE_RTC,
51 TWL_MODULE_PWM,
52 TWL_MODULE_LED,
53 TWL_MODULE_SECURED_REG,
54
55 TWL_MODULE_LAST,
56};
57
58/* Modules only available in twl4030 series */
42enum twl4030_module_ids { 59enum twl4030_module_ids {
43 TWL4030_MODULE_USB = 0, /* Slave 0 (i2c address 0x48) */ 60 TWL4030_MODULE_AUDIO_VOICE = TWL_MODULE_LAST,
44 TWL4030_MODULE_AUDIO_VOICE, /* Slave 1 (i2c address 0x49) */
45 TWL4030_MODULE_GPIO, 61 TWL4030_MODULE_GPIO,
46 TWL4030_MODULE_INTBR, 62 TWL4030_MODULE_INTBR,
47 TWL4030_MODULE_PIH,
48
49 TWL4030_MODULE_TEST, 63 TWL4030_MODULE_TEST,
50 TWL4030_MODULE_KEYPAD, /* Slave 2 (i2c address 0x4a) */ 64 TWL4030_MODULE_KEYPAD,
65
51 TWL4030_MODULE_MADC, 66 TWL4030_MODULE_MADC,
52 TWL4030_MODULE_INTERRUPTS, 67 TWL4030_MODULE_INTERRUPTS,
53 TWL4030_MODULE_LED,
54
55 TWL4030_MODULE_MAIN_CHARGE,
56 TWL4030_MODULE_PRECHARGE, 68 TWL4030_MODULE_PRECHARGE,
57 TWL4030_MODULE_PWM0, 69 TWL4030_MODULE_BACKUP,
58 TWL4030_MODULE_PWM1, 70 TWL4030_MODULE_INT,
59 TWL4030_MODULE_PWMA,
60 71
61 TWL4030_MODULE_PWMB,
62 TWL5031_MODULE_ACCESSORY, 72 TWL5031_MODULE_ACCESSORY,
63 TWL5031_MODULE_INTERRUPTS, 73 TWL5031_MODULE_INTERRUPTS,
64 TWL4030_MODULE_BACKUP, /* Slave 3 (i2c address 0x4b) */
65 TWL4030_MODULE_INT,
66 74
67 TWL4030_MODULE_PM_MASTER,
68 TWL4030_MODULE_PM_RECEIVER,
69 TWL4030_MODULE_RTC,
70 TWL4030_MODULE_SECURED_REG,
71 TWL4030_MODULE_LAST, 75 TWL4030_MODULE_LAST,
72}; 76};
73 77
74/* Similar functionalities implemented in TWL4030/6030 */ 78/* Modules only available in twl6030 series */
75#define TWL_MODULE_USB TWL4030_MODULE_USB 79enum twl6030_module_ids {
76#define TWL_MODULE_PIH TWL4030_MODULE_PIH 80 TWL6030_MODULE_ID0 = TWL_MODULE_LAST,
77#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE 81 TWL6030_MODULE_ID1,
78#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER 82 TWL6030_MODULE_ID2,
79#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER 83 TWL6030_MODULE_GPADC,
80#define TWL_MODULE_RTC TWL4030_MODULE_RTC 84 TWL6030_MODULE_GASGAUGE,
81#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 85
82#define TWL_MODULE_LED TWL4030_MODULE_LED 86 TWL6030_MODULE_LAST,
87};
83 88
84#define TWL6030_MODULE_ID0 13 89/* Until the clients has been converted to use TWL_MODULE_LED */
85#define TWL6030_MODULE_ID1 14 90#define TWL4030_MODULE_LED TWL_MODULE_LED
86#define TWL6030_MODULE_ID2 15
87 91
88#define GPIO_INTR_OFFSET 0 92#define GPIO_INTR_OFFSET 0
89#define KEYPAD_INTR_OFFSET 1 93#define KEYPAD_INTR_OFFSET 1
@@ -171,20 +175,22 @@ TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
171TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 175TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
172 176
173/* 177/*
174 * Read and write single 8-bit registers
175 */
176int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
177int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
178
179/*
180 * Read and write several 8-bit registers at once. 178 * Read and write several 8-bit registers at once.
181 *
182 * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1
183 * for the value, and populate your data starting at offset 1.
184 */ 179 */
185int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 180int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
186int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 181int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
187 182
183/*
184 * Read and write single 8-bit registers
185 */
186static inline int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg) {
187 return twl_i2c_write(mod_no, &val, reg, 1);
188}
189
190static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
191 return twl_i2c_read(mod_no, val, reg, 1);
192}
193
188int twl_get_type(void); 194int twl_get_type(void);
189int twl_get_version(void); 195int twl_get_version(void);
190int twl_get_hfclk_rate(void); 196int twl_get_hfclk_rate(void);
diff --git a/include/linux/idr.h b/include/linux/idr.h
index de7e190f1af4..a6f38b5c34e4 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -17,69 +17,40 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20#if BITS_PER_LONG == 32 20/*
21# define IDR_BITS 5 21 * We want shallower trees and thus more bits covered at each layer. 8
22# define IDR_FULL 0xfffffffful 22 * bits gives us large enough first layer for most use cases and maximum
23/* We can only use two of the bits in the top level because there is 23 * tree depth of 4. Each idr_layer is slightly larger than 2k on 64bit and
24 only one possible bit in the top level (5 bits * 7 levels = 35 24 * 1k on 32bit.
25 bits, but you only use 31 bits in the id). */ 25 */
26# define TOP_LEVEL_FULL (IDR_FULL >> 30) 26#define IDR_BITS 8
27#elif BITS_PER_LONG == 64
28# define IDR_BITS 6
29# define IDR_FULL 0xfffffffffffffffful
30/* We can only use two of the bits in the top level because there is
31 only one possible bit in the top level (6 bits * 6 levels = 36
32 bits, but you only use 31 bits in the id). */
33# define TOP_LEVEL_FULL (IDR_FULL >> 62)
34#else
35# error "BITS_PER_LONG is not 32 or 64"
36#endif
37
38#define IDR_SIZE (1 << IDR_BITS) 27#define IDR_SIZE (1 << IDR_BITS)
39#define IDR_MASK ((1 << IDR_BITS)-1) 28#define IDR_MASK ((1 << IDR_BITS)-1)
40 29
41#define MAX_IDR_SHIFT (sizeof(int)*8 - 1)
42#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
43#define MAX_IDR_MASK (MAX_IDR_BIT - 1)
44
45/* Leave the possibility of an incomplete final layer */
46#define MAX_IDR_LEVEL ((MAX_IDR_SHIFT + IDR_BITS - 1) / IDR_BITS)
47
48/* Number of id_layer structs to leave in free list */
49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
50
51struct idr_layer { 30struct idr_layer {
52 unsigned long bitmap; /* A zero bit means "space here" */ 31 int prefix; /* the ID prefix of this idr_layer */
32 DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */
53 struct idr_layer __rcu *ary[1<<IDR_BITS]; 33 struct idr_layer __rcu *ary[1<<IDR_BITS];
54 int count; /* When zero, we can release it */ 34 int count; /* When zero, we can release it */
55 int layer; /* distance from leaf */ 35 int layer; /* distance from leaf */
56 struct rcu_head rcu_head; 36 struct rcu_head rcu_head;
57}; 37};
58 38
59struct idr { 39struct idr {
60 struct idr_layer __rcu *top; 40 struct idr_layer __rcu *hint; /* the last layer allocated from */
61 struct idr_layer *id_free; 41 struct idr_layer __rcu *top;
62 int layers; /* only valid without concurrent changes */ 42 struct idr_layer *id_free;
63 int id_free_cnt; 43 int layers; /* only valid w/o concurrent changes */
64 spinlock_t lock; 44 int id_free_cnt;
45 spinlock_t lock;
65}; 46};
66 47
67#define IDR_INIT(name) \ 48#define IDR_INIT(name) \
68{ \ 49{ \
69 .top = NULL, \ 50 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70 .id_free = NULL, \
71 .layers = 0, \
72 .id_free_cnt = 0, \
73 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
74} 51}
75#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 52#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
76 53
77/* Actions to be taken after a call to _idr_sub_alloc */
78#define IDR_NEED_TO_GROW -2
79#define IDR_NOMORE_SPACE -3
80
81#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC)
82
83/** 54/**
84 * DOC: idr sync 55 * DOC: idr sync
85 * idr synchronization (stolen from radix-tree.h) 56 * idr synchronization (stolen from radix-tree.h)
@@ -101,19 +72,90 @@ struct idr {
101 * This is what we export. 72 * This is what we export.
102 */ 73 */
103 74
104void *idr_find(struct idr *idp, int id); 75void *idr_find_slowpath(struct idr *idp, int id);
105int idr_pre_get(struct idr *idp, gfp_t gfp_mask); 76int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
106int idr_get_new(struct idr *idp, void *ptr, int *id);
107int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 77int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
78void idr_preload(gfp_t gfp_mask);
79int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask);
108int idr_for_each(struct idr *idp, 80int idr_for_each(struct idr *idp,
109 int (*fn)(int id, void *p, void *data), void *data); 81 int (*fn)(int id, void *p, void *data), void *data);
110void *idr_get_next(struct idr *idp, int *nextid); 82void *idr_get_next(struct idr *idp, int *nextid);
111void *idr_replace(struct idr *idp, void *ptr, int id); 83void *idr_replace(struct idr *idp, void *ptr, int id);
112void idr_remove(struct idr *idp, int id); 84void idr_remove(struct idr *idp, int id);
113void idr_remove_all(struct idr *idp); 85void idr_free(struct idr *idp, int id);
114void idr_destroy(struct idr *idp); 86void idr_destroy(struct idr *idp);
115void idr_init(struct idr *idp); 87void idr_init(struct idr *idp);
116 88
89/**
90 * idr_preload_end - end preload section started with idr_preload()
91 *
92 * Each idr_preload() should be matched with an invocation of this
93 * function. See idr_preload() for details.
94 */
95static inline void idr_preload_end(void)
96{
97 preempt_enable();
98}
99
100/**
101 * idr_find - return pointer for given id
102 * @idp: idr handle
103 * @id: lookup key
104 *
105 * Return the pointer given the id it has been registered with. A %NULL
106 * return indicates that @id is not valid or you passed %NULL in
107 * idr_get_new().
108 *
109 * This function can be called under rcu_read_lock(), given that the leaf
110 * pointers lifetimes are correctly managed.
111 */
112static inline void *idr_find(struct idr *idr, int id)
113{
114 struct idr_layer *hint = rcu_dereference_raw(idr->hint);
115
116 if (hint && (id & ~IDR_MASK) == hint->prefix)
117 return rcu_dereference_raw(hint->ary[id & IDR_MASK]);
118
119 return idr_find_slowpath(idr, id);
120}
121
122/**
123 * idr_get_new - allocate new idr entry
124 * @idp: idr handle
125 * @ptr: pointer you want associated with the id
126 * @id: pointer to the allocated handle
127 *
128 * Simple wrapper around idr_get_new_above() w/ @starting_id of zero.
129 */
130static inline int idr_get_new(struct idr *idp, void *ptr, int *id)
131{
132 return idr_get_new_above(idp, ptr, 0, id);
133}
134
135/**
136 * idr_for_each_entry - iterate over an idr's elements of a given type
137 * @idp: idr handle
138 * @entry: the type * to use as cursor
139 * @id: id entry's key
140 */
141#define idr_for_each_entry(idp, entry, id) \
142 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
143 entry != NULL; \
144 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
145
146void __idr_remove_all(struct idr *idp); /* don't use */
147
148/**
149 * idr_remove_all - remove all ids from the given idr tree
150 * @idp: idr handle
151 *
152 * If you're trying to destroy @idp, calling idr_destroy() is enough.
153 * This is going away. Don't use.
154 */
155static inline void __deprecated idr_remove_all(struct idr *idp)
156{
157 __idr_remove_all(idp);
158}
117 159
118/* 160/*
119 * IDA - IDR based id allocator, use when translation from id to 161 * IDA - IDR based id allocator, use when translation from id to
@@ -136,12 +178,11 @@ struct ida {
136 struct ida_bitmap *free_bitmap; 178 struct ida_bitmap *free_bitmap;
137}; 179};
138 180
139#define IDA_INIT(name) { .idr = IDR_INIT(name), .free_bitmap = NULL, } 181#define IDA_INIT(name) { .idr = IDR_INIT((name).idr), .free_bitmap = NULL, }
140#define DEFINE_IDA(name) struct ida name = IDA_INIT(name) 182#define DEFINE_IDA(name) struct ida name = IDA_INIT(name)
141 183
142int ida_pre_get(struct ida *ida, gfp_t gfp_mask); 184int ida_pre_get(struct ida *ida, gfp_t gfp_mask);
143int ida_get_new_above(struct ida *ida, int starting_id, int *p_id); 185int ida_get_new_above(struct ida *ida, int starting_id, int *p_id);
144int ida_get_new(struct ida *ida, int *p_id);
145void ida_remove(struct ida *ida, int id); 186void ida_remove(struct ida *ida, int id);
146void ida_destroy(struct ida *ida); 187void ida_destroy(struct ida *ida);
147void ida_init(struct ida *ida); 188void ida_init(struct ida *ida);
@@ -150,17 +191,18 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
150 gfp_t gfp_mask); 191 gfp_t gfp_mask);
151void ida_simple_remove(struct ida *ida, unsigned int id); 192void ida_simple_remove(struct ida *ida, unsigned int id);
152 193
153void __init idr_init_cache(void);
154
155/** 194/**
156 * idr_for_each_entry - iterate over an idr's elements of a given type 195 * ida_get_new - allocate new ID
157 * @idp: idr handle 196 * @ida: idr handle
158 * @entry: the type * to use as cursor 197 * @p_id: pointer to the allocated handle
159 * @id: id entry's key 198 *
199 * Simple wrapper around ida_get_new_above() w/ @starting_id of zero.
160 */ 200 */
161#define idr_for_each_entry(idp, entry, id) \ 201static inline int ida_get_new(struct ida *ida, int *p_id)
162 for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \ 202{
163 entry != NULL; \ 203 return ida_get_new_above(ida, 0, p_id);
164 ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) 204}
205
206void __init idr_init_cache(void);
165 207
166#endif /* __IDR_H__ */ 208#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f0859cc73861..7e24fe0cfbcd 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -151,6 +151,11 @@
151/* Mesh Control 802.11s */ 151/* Mesh Control 802.11s */
152#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100 152#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
153 153
154/* Mesh Power Save Level */
155#define IEEE80211_QOS_CTL_MESH_PS_LEVEL 0x0200
156/* Mesh Receiver Service Period Initiated */
157#define IEEE80211_QOS_CTL_RSPI 0x0400
158
154/* U-APSD queue for WMM IEs sent by AP */ 159/* U-APSD queue for WMM IEs sent by AP */
155#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) 160#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
156#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f 161#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f
@@ -180,7 +185,7 @@ struct ieee80211_hdr {
180 u8 addr3[6]; 185 u8 addr3[6];
181 __le16 seq_ctrl; 186 __le16 seq_ctrl;
182 u8 addr4[6]; 187 u8 addr4[6];
183} __attribute__ ((packed)); 188} __packed;
184 189
185struct ieee80211_hdr_3addr { 190struct ieee80211_hdr_3addr {
186 __le16 frame_control; 191 __le16 frame_control;
@@ -189,7 +194,7 @@ struct ieee80211_hdr_3addr {
189 u8 addr2[6]; 194 u8 addr2[6];
190 u8 addr3[6]; 195 u8 addr3[6];
191 __le16 seq_ctrl; 196 __le16 seq_ctrl;
192} __attribute__ ((packed)); 197} __packed;
193 198
194struct ieee80211_qos_hdr { 199struct ieee80211_qos_hdr {
195 __le16 frame_control; 200 __le16 frame_control;
@@ -199,7 +204,7 @@ struct ieee80211_qos_hdr {
199 u8 addr3[6]; 204 u8 addr3[6];
200 __le16 seq_ctrl; 205 __le16 seq_ctrl;
201 __le16 qos_ctrl; 206 __le16 qos_ctrl;
202} __attribute__ ((packed)); 207} __packed;
203 208
204/** 209/**
205 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set 210 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
@@ -576,7 +581,7 @@ struct ieee80211s_hdr {
576 __le32 seqnum; 581 __le32 seqnum;
577 u8 eaddr1[6]; 582 u8 eaddr1[6];
578 u8 eaddr2[6]; 583 u8 eaddr2[6];
579} __attribute__ ((packed)); 584} __packed;
580 585
581/* Mesh flags */ 586/* Mesh flags */
582#define MESH_FLAGS_AE_A4 0x1 587#define MESH_FLAGS_AE_A4 0x1
@@ -614,7 +619,7 @@ struct ieee80211_quiet_ie {
614 u8 period; 619 u8 period;
615 __le16 duration; 620 __le16 duration;
616 __le16 offset; 621 __le16 offset;
617} __attribute__ ((packed)); 622} __packed;
618 623
619/** 624/**
620 * struct ieee80211_msrment_ie 625 * struct ieee80211_msrment_ie
@@ -626,7 +631,7 @@ struct ieee80211_msrment_ie {
626 u8 mode; 631 u8 mode;
627 u8 type; 632 u8 type;
628 u8 request[0]; 633 u8 request[0];
629} __attribute__ ((packed)); 634} __packed;
630 635
631/** 636/**
632 * struct ieee80211_channel_sw_ie 637 * struct ieee80211_channel_sw_ie
@@ -637,7 +642,7 @@ struct ieee80211_channel_sw_ie {
637 u8 mode; 642 u8 mode;
638 u8 new_ch_num; 643 u8 new_ch_num;
639 u8 count; 644 u8 count;
640} __attribute__ ((packed)); 645} __packed;
641 646
642/** 647/**
643 * struct ieee80211_tim 648 * struct ieee80211_tim
@@ -650,7 +655,7 @@ struct ieee80211_tim_ie {
650 u8 bitmap_ctrl; 655 u8 bitmap_ctrl;
651 /* variable size: 1 - 251 bytes */ 656 /* variable size: 1 - 251 bytes */
652 u8 virtual_map[1]; 657 u8 virtual_map[1];
653} __attribute__ ((packed)); 658} __packed;
654 659
655/** 660/**
656 * struct ieee80211_meshconf_ie 661 * struct ieee80211_meshconf_ie
@@ -665,7 +670,7 @@ struct ieee80211_meshconf_ie {
665 u8 meshconf_auth; 670 u8 meshconf_auth;
666 u8 meshconf_form; 671 u8 meshconf_form;
667 u8 meshconf_cap; 672 u8 meshconf_cap;
668} __attribute__ ((packed)); 673} __packed;
669 674
670/** 675/**
671 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags 676 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
@@ -675,11 +680,14 @@ struct ieee80211_meshconf_ie {
675 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs 680 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
676 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure 681 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
677 * is ongoing 682 * is ongoing
683 * @IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL: STA is in deep sleep mode or has
684 * neighbors in deep sleep mode
678 */ 685 */
679enum mesh_config_capab_flags { 686enum mesh_config_capab_flags {
680 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01, 687 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
681 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08, 688 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
682 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20, 689 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
690 IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
683}; 691};
684 692
685/** 693/**
@@ -695,12 +703,41 @@ struct ieee80211_rann_ie {
695 __le32 rann_seq; 703 __le32 rann_seq;
696 __le32 rann_interval; 704 __le32 rann_interval;
697 __le32 rann_metric; 705 __le32 rann_metric;
698} __attribute__ ((packed)); 706} __packed;
699 707
700enum ieee80211_rann_flags { 708enum ieee80211_rann_flags {
701 RANN_FLAG_IS_GATE = 1 << 0, 709 RANN_FLAG_IS_GATE = 1 << 0,
702}; 710};
703 711
712enum ieee80211_ht_chanwidth_values {
713 IEEE80211_HT_CHANWIDTH_20MHZ = 0,
714 IEEE80211_HT_CHANWIDTH_ANY = 1,
715};
716
717/**
718 * enum ieee80211_opmode_bits - VHT operating mode field bits
719 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK: channel width mask
720 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: 20 MHz channel width
721 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
722 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ: 80 MHz channel width
723 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ: 160 MHz or 80+80 MHz channel width
724 * @IEEE80211_OPMODE_NOTIF_RX_NSS_MASK: number of spatial streams mask
725 * (the NSS value is the value of this field + 1)
726 * @IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT: number of spatial streams shift
727 * @IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF: indicates streams in SU-MIMO PPDU
728 * using a beamforming steering matrix
729 */
730enum ieee80211_vht_opmode_bits {
731 IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 3,
732 IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ = 0,
733 IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ = 1,
734 IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ = 2,
735 IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
736 IEEE80211_OPMODE_NOTIF_RX_NSS_MASK = 0x70,
737 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
738 IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
739};
740
704#define WLAN_SA_QUERY_TR_ID_LEN 2 741#define WLAN_SA_QUERY_TR_ID_LEN 2
705 742
706struct ieee80211_mgmt { 743struct ieee80211_mgmt {
@@ -717,33 +754,33 @@ struct ieee80211_mgmt {
717 __le16 status_code; 754 __le16 status_code;
718 /* possibly followed by Challenge text */ 755 /* possibly followed by Challenge text */
719 u8 variable[0]; 756 u8 variable[0];
720 } __attribute__ ((packed)) auth; 757 } __packed auth;
721 struct { 758 struct {
722 __le16 reason_code; 759 __le16 reason_code;
723 } __attribute__ ((packed)) deauth; 760 } __packed deauth;
724 struct { 761 struct {
725 __le16 capab_info; 762 __le16 capab_info;
726 __le16 listen_interval; 763 __le16 listen_interval;
727 /* followed by SSID and Supported rates */ 764 /* followed by SSID and Supported rates */
728 u8 variable[0]; 765 u8 variable[0];
729 } __attribute__ ((packed)) assoc_req; 766 } __packed assoc_req;
730 struct { 767 struct {
731 __le16 capab_info; 768 __le16 capab_info;
732 __le16 status_code; 769 __le16 status_code;
733 __le16 aid; 770 __le16 aid;
734 /* followed by Supported rates */ 771 /* followed by Supported rates */
735 u8 variable[0]; 772 u8 variable[0];
736 } __attribute__ ((packed)) assoc_resp, reassoc_resp; 773 } __packed assoc_resp, reassoc_resp;
737 struct { 774 struct {
738 __le16 capab_info; 775 __le16 capab_info;
739 __le16 listen_interval; 776 __le16 listen_interval;
740 u8 current_ap[6]; 777 u8 current_ap[6];
741 /* followed by SSID and Supported rates */ 778 /* followed by SSID and Supported rates */
742 u8 variable[0]; 779 u8 variable[0];
743 } __attribute__ ((packed)) reassoc_req; 780 } __packed reassoc_req;
744 struct { 781 struct {
745 __le16 reason_code; 782 __le16 reason_code;
746 } __attribute__ ((packed)) disassoc; 783 } __packed disassoc;
747 struct { 784 struct {
748 __le64 timestamp; 785 __le64 timestamp;
749 __le16 beacon_int; 786 __le16 beacon_int;
@@ -751,11 +788,11 @@ struct ieee80211_mgmt {
751 /* followed by some of SSID, Supported rates, 788 /* followed by some of SSID, Supported rates,
752 * FH Params, DS Params, CF Params, IBSS Params, TIM */ 789 * FH Params, DS Params, CF Params, IBSS Params, TIM */
753 u8 variable[0]; 790 u8 variable[0];
754 } __attribute__ ((packed)) beacon; 791 } __packed beacon;
755 struct { 792 struct {
756 /* only variable items: SSID, Supported rates */ 793 /* only variable items: SSID, Supported rates */
757 u8 variable[0]; 794 u8 variable[0];
758 } __attribute__ ((packed)) probe_req; 795 } __packed probe_req;
759 struct { 796 struct {
760 __le64 timestamp; 797 __le64 timestamp;
761 __le16 beacon_int; 798 __le16 beacon_int;
@@ -763,7 +800,7 @@ struct ieee80211_mgmt {
763 /* followed by some of SSID, Supported rates, 800 /* followed by some of SSID, Supported rates,
764 * FH Params, DS Params, CF Params, IBSS Params */ 801 * FH Params, DS Params, CF Params, IBSS Params */
765 u8 variable[0]; 802 u8 variable[0];
766 } __attribute__ ((packed)) probe_resp; 803 } __packed probe_resp;
767 struct { 804 struct {
768 u8 category; 805 u8 category;
769 union { 806 union {
@@ -772,65 +809,73 @@ struct ieee80211_mgmt {
772 u8 dialog_token; 809 u8 dialog_token;
773 u8 status_code; 810 u8 status_code;
774 u8 variable[0]; 811 u8 variable[0];
775 } __attribute__ ((packed)) wme_action; 812 } __packed wme_action;
776 struct{ 813 struct{
777 u8 action_code; 814 u8 action_code;
778 u8 element_id; 815 u8 element_id;
779 u8 length; 816 u8 length;
780 struct ieee80211_channel_sw_ie sw_elem; 817 struct ieee80211_channel_sw_ie sw_elem;
781 } __attribute__((packed)) chan_switch; 818 } __packed chan_switch;
782 struct{ 819 struct{
783 u8 action_code; 820 u8 action_code;
784 u8 dialog_token; 821 u8 dialog_token;
785 u8 element_id; 822 u8 element_id;
786 u8 length; 823 u8 length;
787 struct ieee80211_msrment_ie msr_elem; 824 struct ieee80211_msrment_ie msr_elem;
788 } __attribute__((packed)) measurement; 825 } __packed measurement;
789 struct{ 826 struct{
790 u8 action_code; 827 u8 action_code;
791 u8 dialog_token; 828 u8 dialog_token;
792 __le16 capab; 829 __le16 capab;
793 __le16 timeout; 830 __le16 timeout;
794 __le16 start_seq_num; 831 __le16 start_seq_num;
795 } __attribute__((packed)) addba_req; 832 } __packed addba_req;
796 struct{ 833 struct{
797 u8 action_code; 834 u8 action_code;
798 u8 dialog_token; 835 u8 dialog_token;
799 __le16 status; 836 __le16 status;
800 __le16 capab; 837 __le16 capab;
801 __le16 timeout; 838 __le16 timeout;
802 } __attribute__((packed)) addba_resp; 839 } __packed addba_resp;
803 struct{ 840 struct{
804 u8 action_code; 841 u8 action_code;
805 __le16 params; 842 __le16 params;
806 __le16 reason_code; 843 __le16 reason_code;
807 } __attribute__((packed)) delba; 844 } __packed delba;
808 struct { 845 struct {
809 u8 action_code; 846 u8 action_code;
810 u8 variable[0]; 847 u8 variable[0];
811 } __attribute__((packed)) self_prot; 848 } __packed self_prot;
812 struct{ 849 struct{
813 u8 action_code; 850 u8 action_code;
814 u8 variable[0]; 851 u8 variable[0];
815 } __attribute__((packed)) mesh_action; 852 } __packed mesh_action;
816 struct { 853 struct {
817 u8 action; 854 u8 action;
818 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; 855 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
819 } __attribute__ ((packed)) sa_query; 856 } __packed sa_query;
820 struct { 857 struct {
821 u8 action; 858 u8 action;
822 u8 smps_control; 859 u8 smps_control;
823 } __attribute__ ((packed)) ht_smps; 860 } __packed ht_smps;
861 struct {
862 u8 action_code;
863 u8 chanwidth;
864 } __packed ht_notify_cw;
824 struct { 865 struct {
825 u8 action_code; 866 u8 action_code;
826 u8 dialog_token; 867 u8 dialog_token;
827 __le16 capability; 868 __le16 capability;
828 u8 variable[0]; 869 u8 variable[0];
829 } __packed tdls_discover_resp; 870 } __packed tdls_discover_resp;
871 struct {
872 u8 action_code;
873 u8 operating_mode;
874 } __packed vht_opmode_notif;
830 } u; 875 } u;
831 } __attribute__ ((packed)) action; 876 } __packed action;
832 } u; 877 } u;
833} __attribute__ ((packed)); 878} __packed;
834 879
835/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ 880/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
836#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 881#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
@@ -846,7 +891,7 @@ struct ieee80211_mmie {
846 __le16 key_id; 891 __le16 key_id;
847 u8 sequence_number[6]; 892 u8 sequence_number[6];
848 u8 mic[8]; 893 u8 mic[8];
849} __attribute__ ((packed)); 894} __packed;
850 895
851struct ieee80211_vendor_ie { 896struct ieee80211_vendor_ie {
852 u8 element_id; 897 u8 element_id;
@@ -861,20 +906,20 @@ struct ieee80211_rts {
861 __le16 duration; 906 __le16 duration;
862 u8 ra[6]; 907 u8 ra[6];
863 u8 ta[6]; 908 u8 ta[6];
864} __attribute__ ((packed)); 909} __packed;
865 910
866struct ieee80211_cts { 911struct ieee80211_cts {
867 __le16 frame_control; 912 __le16 frame_control;
868 __le16 duration; 913 __le16 duration;
869 u8 ra[6]; 914 u8 ra[6];
870} __attribute__ ((packed)); 915} __packed;
871 916
872struct ieee80211_pspoll { 917struct ieee80211_pspoll {
873 __le16 frame_control; 918 __le16 frame_control;
874 __le16 aid; 919 __le16 aid;
875 u8 bssid[6]; 920 u8 bssid[6];
876 u8 ta[6]; 921 u8 ta[6];
877} __attribute__ ((packed)); 922} __packed;
878 923
879/* TDLS */ 924/* TDLS */
880 925
@@ -967,7 +1012,7 @@ struct ieee80211_bar {
967 __u8 ta[6]; 1012 __u8 ta[6];
968 __le16 control; 1013 __le16 control;
969 __le16 start_seq_num; 1014 __le16 start_seq_num;
970} __attribute__((packed)); 1015} __packed;
971 1016
972/* 802.11 BAR control masks */ 1017/* 802.11 BAR control masks */
973#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 1018#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
@@ -992,7 +1037,7 @@ struct ieee80211_mcs_info {
992 __le16 rx_highest; 1037 __le16 rx_highest;
993 u8 tx_params; 1038 u8 tx_params;
994 u8 reserved[3]; 1039 u8 reserved[3];
995} __attribute__((packed)); 1040} __packed;
996 1041
997/* 802.11n HT capability MSC set */ 1042/* 802.11n HT capability MSC set */
998#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff 1043#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
@@ -1031,7 +1076,7 @@ struct ieee80211_ht_cap {
1031 __le16 extended_ht_cap_info; 1076 __le16 extended_ht_cap_info;
1032 __le32 tx_BF_cap_info; 1077 __le32 tx_BF_cap_info;
1033 u8 antenna_selection_info; 1078 u8 antenna_selection_info;
1034} __attribute__ ((packed)); 1079} __packed;
1035 1080
1036/* 802.11n HT capabilities masks (for cap_info) */ 1081/* 802.11n HT capabilities masks (for cap_info) */
1037#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 1082#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
@@ -1102,7 +1147,7 @@ struct ieee80211_ht_operation {
1102 __le16 operation_mode; 1147 __le16 operation_mode;
1103 __le16 stbc_param; 1148 __le16 stbc_param;
1104 u8 basic_set[16]; 1149 u8 basic_set[16];
1105} __attribute__ ((packed)); 1150} __packed;
1106 1151
1107/* for ht_param */ 1152/* for ht_param */
1108#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03 1153#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
@@ -1256,6 +1301,7 @@ struct ieee80211_vht_operation {
1256#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1301#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1257#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1302#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1258#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1303#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1304#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
1259#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 1305#define IEEE80211_VHT_CAP_RXLDPC 0x00000010
1260#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 1306#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
1261#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 1307#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
@@ -1311,16 +1357,21 @@ struct ieee80211_vht_operation {
1311#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) 1357#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
1312#define WLAN_CAPABILITY_QOS (1<<9) 1358#define WLAN_CAPABILITY_QOS (1<<9)
1313#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) 1359#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
1360#define WLAN_CAPABILITY_APSD (1<<11)
1361#define WLAN_CAPABILITY_RADIO_MEASURE (1<<12)
1314#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) 1362#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
1363#define WLAN_CAPABILITY_DEL_BACK (1<<14)
1364#define WLAN_CAPABILITY_IMM_BACK (1<<15)
1315 1365
1316/* DMG (60gHz) 802.11ad */ 1366/* DMG (60gHz) 802.11ad */
1317/* type - bits 0..1 */ 1367/* type - bits 0..1 */
1368#define WLAN_CAPABILITY_DMG_TYPE_MASK (3<<0)
1318#define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */ 1369#define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */
1319#define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */ 1370#define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */
1320#define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */ 1371#define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */
1321 1372
1322#define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2) 1373#define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2)
1323#define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3) 1374#define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3)
1324#define WLAN_CAPABILITY_DMG_PRIVACY (1<<4) 1375#define WLAN_CAPABILITY_DMG_PRIVACY (1<<4)
1325#define WLAN_CAPABILITY_DMG_ECPAC (1<<5) 1376#define WLAN_CAPABILITY_DMG_ECPAC (1<<5)
1326 1377
@@ -1576,6 +1627,7 @@ enum ieee80211_eid {
1576 1627
1577 WLAN_EID_VHT_CAPABILITY = 191, 1628 WLAN_EID_VHT_CAPABILITY = 191,
1578 WLAN_EID_VHT_OPERATION = 192, 1629 WLAN_EID_VHT_OPERATION = 192,
1630 WLAN_EID_OPMODE_NOTIF = 199,
1579 1631
1580 /* 802.11ad */ 1632 /* 802.11ad */
1581 WLAN_EID_NON_TX_BSSID_CAP = 83, 1633 WLAN_EID_NON_TX_BSSID_CAP = 83,
@@ -1630,6 +1682,7 @@ enum ieee80211_category {
1630 WLAN_CATEGORY_WMM = 17, 1682 WLAN_CATEGORY_WMM = 17,
1631 WLAN_CATEGORY_FST = 18, 1683 WLAN_CATEGORY_FST = 18,
1632 WLAN_CATEGORY_UNPROT_DMG = 20, 1684 WLAN_CATEGORY_UNPROT_DMG = 20,
1685 WLAN_CATEGORY_VHT = 21,
1633 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1686 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1634 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1687 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1635}; 1688};
@@ -1655,6 +1708,13 @@ enum ieee80211_ht_actioncode {
1655 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, 1708 WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
1656}; 1709};
1657 1710
1711/* VHT action codes */
1712enum ieee80211_vht_actioncode {
1713 WLAN_VHT_ACTION_COMPRESSED_BF = 0,
1714 WLAN_VHT_ACTION_GROUPID_MGMT = 1,
1715 WLAN_VHT_ACTION_OPMODE_NOTIF = 2,
1716};
1717
1658/* Self Protected Action codes */ 1718/* Self Protected Action codes */
1659enum ieee80211_self_protected_actioncode { 1719enum ieee80211_self_protected_actioncode {
1660 WLAN_SP_RESERVED = 0, 1720 WLAN_SP_RESERVED = 0,
@@ -1716,6 +1776,8 @@ enum ieee80211_tdls_actioncode {
1716#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) 1776#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
1717#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) 1777#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
1718 1778
1779#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
1780
1719/* TDLS specific payload type in the LLC/SNAP header */ 1781/* TDLS specific payload type in the LLC/SNAP header */
1720#define WLAN_TDLS_SNAP_RFTYPE 0x2 1782#define WLAN_TDLS_SNAP_RFTYPE 0x2
1721 1783
@@ -1834,14 +1896,14 @@ struct ieee80211_country_ie_triplet {
1834 u8 first_channel; 1896 u8 first_channel;
1835 u8 num_channels; 1897 u8 num_channels;
1836 s8 max_power; 1898 s8 max_power;
1837 } __attribute__ ((packed)) chans; 1899 } __packed chans;
1838 struct { 1900 struct {
1839 u8 reg_extension_id; 1901 u8 reg_extension_id;
1840 u8 reg_class; 1902 u8 reg_class;
1841 u8 coverage_class; 1903 u8 coverage_class;
1842 } __attribute__ ((packed)) ext; 1904 } __packed ext;
1843 }; 1905 };
1844} __attribute__ ((packed)); 1906} __packed;
1845 1907
1846enum ieee80211_timeout_interval_type { 1908enum ieee80211_timeout_interval_type {
1847 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */, 1909 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
@@ -1884,7 +1946,10 @@ enum ieee80211_sa_query_action {
1884/* AKM suite selectors */ 1946/* AKM suite selectors */
1885#define WLAN_AKM_SUITE_8021X 0x000FAC01 1947#define WLAN_AKM_SUITE_8021X 0x000FAC01
1886#define WLAN_AKM_SUITE_PSK 0x000FAC02 1948#define WLAN_AKM_SUITE_PSK 0x000FAC02
1887#define WLAN_AKM_SUITE_SAE 0x000FAC08 1949#define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05
1950#define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06
1951#define WLAN_AKM_SUITE_TDLS 0x000FAC07
1952#define WLAN_AKM_SUITE_SAE 0x000FAC08
1888#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09 1953#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
1889 1954
1890#define WLAN_MAX_KEY_LEN 32 1955#define WLAN_MAX_KEY_LEN 32
@@ -2089,7 +2154,7 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
2089 * @tim_len: length of the TIM IE 2154 * @tim_len: length of the TIM IE
2090 * @aid: the AID to look for 2155 * @aid: the AID to look for
2091 */ 2156 */
2092static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim, 2157static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2093 u8 tim_len, u16 aid) 2158 u8 tim_len, u16 aid)
2094{ 2159{
2095 u8 mask; 2160 u8 mask;
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index f65e8d250f7e..84dde1dd1da4 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -52,6 +52,9 @@ struct macvlan_pcpu_stats {
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16)
54 54
55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
57
55struct macvlan_dev { 58struct macvlan_dev {
56 struct net_device *dev; 59 struct net_device *dev;
57 struct list_head list; 60 struct list_head list;
@@ -59,6 +62,9 @@ struct macvlan_dev {
59 struct macvlan_port *port; 62 struct macvlan_port *port;
60 struct net_device *lowerdev; 63 struct net_device *lowerdev;
61 struct macvlan_pcpu_stats __percpu *pcpu_stats; 64 struct macvlan_pcpu_stats __percpu *pcpu_stats;
65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67
62 enum macvlan_mode mode; 68 enum macvlan_mode mode;
63 u16 flags; 69 u16 flags;
64 int (*receive)(struct sk_buff *skb); 70 int (*receive)(struct sk_buff *skb);
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 0245def2aa93..cfd21e3d5506 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -186,6 +186,7 @@ struct team {
186 186
187 const struct team_mode *mode; 187 const struct team_mode *mode;
188 struct team_mode_ops ops; 188 struct team_mode_ops ops;
189 bool user_carrier_enabled;
189 bool queue_override_enabled; 190 bool queue_override_enabled;
190 struct list_head *qom_lists; /* array of queue override mapping lists */ 191 struct list_head *qom_lists; /* array of queue override mapping lists */
191 long mode_priv[TEAM_MODE_PRIV_LONGS]; 192 long mode_priv[TEAM_MODE_PRIV_LONGS];
@@ -215,11 +216,10 @@ static inline struct hlist_head *team_port_index_hash(struct team *team,
215static inline struct team_port *team_get_port_by_index(struct team *team, 216static inline struct team_port *team_get_port_by_index(struct team *team,
216 int port_index) 217 int port_index)
217{ 218{
218 struct hlist_node *p;
219 struct team_port *port; 219 struct team_port *port;
220 struct hlist_head *head = team_port_index_hash(team, port_index); 220 struct hlist_head *head = team_port_index_hash(team, port_index);
221 221
222 hlist_for_each_entry(port, p, head, hlist) 222 hlist_for_each_entry(port, head, hlist)
223 if (port->index == port_index) 223 if (port->index == port_index)
224 return port; 224 return port;
225 return NULL; 225 return NULL;
@@ -227,11 +227,10 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
227static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 227static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
228 int port_index) 228 int port_index)
229{ 229{
230 struct hlist_node *p;
231 struct team_port *port; 230 struct team_port *port;
232 struct hlist_head *head = team_port_index_hash(team, port_index); 231 struct hlist_head *head = team_port_index_hash(team, port_index);
233 232
234 hlist_for_each_entry_rcu(port, p, head, hlist) 233 hlist_for_each_entry_rcu(port, head, hlist)
235 if (port->index == port_index) 234 if (port->index == port_index)
236 return port; 235 return port;
237 return NULL; 236 return NULL;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d06cc5c8f58c..218a3b686d90 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -331,7 +331,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
331 struct vlan_hdr *vhdr) 331 struct vlan_hdr *vhdr)
332{ 332{
333 __be16 proto; 333 __be16 proto;
334 unsigned char *rawp; 334 unsigned short *rawp;
335 335
336 /* 336 /*
337 * Was a VLAN packet, grab the encapsulated protocol, which the layer 337 * Was a VLAN packet, grab the encapsulated protocol, which the layer
@@ -344,8 +344,8 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
344 return; 344 return;
345 } 345 }
346 346
347 rawp = skb->data; 347 rawp = (unsigned short *)(vhdr + 1);
348 if (*(unsigned short *) rawp == 0xFFFF) 348 if (*rawp == 0xFFFF)
349 /* 349 /*
350 * This is a magic hack to spot IPX packets. Older Novell 350 * This is a magic hack to spot IPX packets. Older Novell
351 * breaks the protocol design and runs IPX over 802.3 without 351 * breaks the protocol design and runs IPX over 802.3 without
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index f3eea18fdf46..2bac0eb8948d 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -103,19 +103,6 @@ int iio_update_buffers(struct iio_dev *indio_dev,
103 **/ 103 **/
104void iio_buffer_init(struct iio_buffer *buffer); 104void iio_buffer_init(struct iio_buffer *buffer);
105 105
106/**
107 * __iio_update_buffer() - update common elements of buffers
108 * @buffer: buffer that is the event source
109 * @bytes_per_datum: size of individual datum including timestamp
110 * @length: number of datums in buffer
111 **/
112static inline void __iio_update_buffer(struct iio_buffer *buffer,
113 int bytes_per_datum, int length)
114{
115 buffer->bytes_per_datum = bytes_per_datum;
116 buffer->length = length;
117}
118
119int iio_scan_mask_query(struct iio_dev *indio_dev, 106int iio_scan_mask_query(struct iio_dev *indio_dev,
120 struct iio_buffer *buffer, int bit); 107 struct iio_buffer *buffer, int bit);
121 108
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
new file mode 100644
index 000000000000..1f86a97ab2e2
--- /dev/null
+++ b/include/linux/iio/common/st_sensors.h
@@ -0,0 +1,280 @@
1/*
2 * STMicroelectronics sensors library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_H
12#define ST_SENSORS_H
13
14#include <linux/i2c.h>
15#include <linux/spi/spi.h>
16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h>
18
19#define ST_SENSORS_TX_MAX_LENGTH 2
20#define ST_SENSORS_RX_MAX_LENGTH 6
21
22#define ST_SENSORS_ODR_LIST_MAX 10
23#define ST_SENSORS_FULLSCALE_AVL_MAX 10
24
25#define ST_SENSORS_NUMBER_ALL_CHANNELS 4
26#define ST_SENSORS_NUMBER_DATA_CHANNELS 3
27#define ST_SENSORS_ENABLE_ALL_AXIS 0x07
28#define ST_SENSORS_BYTE_FOR_CHANNEL 2
29#define ST_SENSORS_SCAN_X 0
30#define ST_SENSORS_SCAN_Y 1
31#define ST_SENSORS_SCAN_Z 2
32#define ST_SENSORS_DEFAULT_12_REALBITS 12
33#define ST_SENSORS_DEFAULT_16_REALBITS 16
34#define ST_SENSORS_DEFAULT_POWER_ON_VALUE 0x01
35#define ST_SENSORS_DEFAULT_POWER_OFF_VALUE 0x00
36#define ST_SENSORS_DEFAULT_WAI_ADDRESS 0x0f
37#define ST_SENSORS_DEFAULT_AXIS_ADDR 0x20
38#define ST_SENSORS_DEFAULT_AXIS_MASK 0x07
39#define ST_SENSORS_DEFAULT_AXIS_N_BIT 3
40
41#define ST_SENSORS_MAX_NAME 17
42#define ST_SENSORS_MAX_4WAI 7
43
44#define ST_SENSORS_LSM_CHANNELS(device_type, index, mod, endian, bits, addr) \
45{ \
46 .type = device_type, \
47 .modified = 1, \
48 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
49 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
50 .scan_index = index, \
51 .channel2 = mod, \
52 .address = addr, \
53 .scan_type = { \
54 .sign = 's', \
55 .realbits = bits, \
56 .shift = 16 - bits, \
57 .storagebits = 16, \
58 .endianness = endian, \
59 }, \
60}
61
62#define ST_SENSOR_DEV_ATTR_SAMP_FREQ() \
63 IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, \
64 st_sensors_sysfs_get_sampling_frequency, \
65 st_sensors_sysfs_set_sampling_frequency)
66
67#define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
68 IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
69 st_sensors_sysfs_sampling_frequency_avail)
70
71#define ST_SENSORS_DEV_ATTR_SCALE_AVAIL(name) \
72 IIO_DEVICE_ATTR(name, S_IRUGO, \
73 st_sensors_sysfs_scale_avail, NULL , 0);
74
75struct st_sensor_odr_avl {
76 unsigned int hz;
77 u8 value;
78};
79
80struct st_sensor_odr {
81 u8 addr;
82 u8 mask;
83 struct st_sensor_odr_avl odr_avl[ST_SENSORS_ODR_LIST_MAX];
84};
85
86struct st_sensor_power {
87 u8 addr;
88 u8 mask;
89 u8 value_off;
90 u8 value_on;
91};
92
93struct st_sensor_axis {
94 u8 addr;
95 u8 mask;
96};
97
98struct st_sensor_fullscale_avl {
99 unsigned int num;
100 u8 value;
101 unsigned int gain;
102 unsigned int gain2;
103};
104
105struct st_sensor_fullscale {
106 u8 addr;
107 u8 mask;
108 struct st_sensor_fullscale_avl fs_avl[ST_SENSORS_FULLSCALE_AVL_MAX];
109};
110
111/**
112 * struct st_sensor_bdu - ST sensor device block data update
113 * @addr: address of the register.
114 * @mask: mask to write the block data update flag.
115 */
116struct st_sensor_bdu {
117 u8 addr;
118 u8 mask;
119};
120
121/**
122 * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
123 * @addr: address of the register.
124 * @mask: mask to write the on/off value.
125 * struct ig1 - represents the Interrupt Generator 1 of sensors.
126 * @en_addr: address of the enable ig1 register.
127 * @en_mask: mask to write the on/off value for enable.
128 */
129struct st_sensor_data_ready_irq {
130 u8 addr;
131 u8 mask;
132 struct {
133 u8 en_addr;
134 u8 en_mask;
135 } ig1;
136};
137
138/**
139 * struct st_sensor_transfer_buffer - ST sensor device I/O buffer
140 * @buf_lock: Mutex to protect rx and tx buffers.
141 * @tx_buf: Buffer used by SPI transfer function to send data to the sensors.
142 * This buffer is used to avoid DMA not-aligned issue.
143 * @rx_buf: Buffer used by SPI transfer to receive data from sensors.
144 * This buffer is used to avoid DMA not-aligned issue.
145 */
146struct st_sensor_transfer_buffer {
147 struct mutex buf_lock;
148 u8 rx_buf[ST_SENSORS_RX_MAX_LENGTH];
149 u8 tx_buf[ST_SENSORS_TX_MAX_LENGTH] ____cacheline_aligned;
150};
151
152/**
153 * struct st_sensor_transfer_function - ST sensor device I/O function
154 * @read_byte: Function used to read one byte.
155 * @write_byte: Function used to write one byte.
156 * @read_multiple_byte: Function used to read multiple byte.
157 */
158struct st_sensor_transfer_function {
159 int (*read_byte) (struct st_sensor_transfer_buffer *tb,
160 struct device *dev, u8 reg_addr, u8 *res_byte);
161 int (*write_byte) (struct st_sensor_transfer_buffer *tb,
162 struct device *dev, u8 reg_addr, u8 data);
163 int (*read_multiple_byte) (struct st_sensor_transfer_buffer *tb,
164 struct device *dev, u8 reg_addr, int len, u8 *data,
165 bool multiread_bit);
166};
167
168/**
169 * struct st_sensors - ST sensors list
170 * @wai: Contents of WhoAmI register.
171 * @sensors_supported: List of supported sensors by struct itself.
172 * @ch: IIO channels for the sensor.
173 * @odr: Output data rate register and ODR list available.
174 * @pw: Power register of the sensor.
175 * @enable_axis: Enable one or more axis of the sensor.
176 * @fs: Full scale register and full scale list available.
177 * @bdu: Block data update register.
178 * @drdy_irq: Data ready register of the sensor.
179 * @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
180 * @bootime: samples to discard when sensor passing from power-down to power-up.
181 */
182struct st_sensors {
183 u8 wai;
184 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
185 struct iio_chan_spec *ch;
186 struct st_sensor_odr odr;
187 struct st_sensor_power pw;
188 struct st_sensor_axis enable_axis;
189 struct st_sensor_fullscale fs;
190 struct st_sensor_bdu bdu;
191 struct st_sensor_data_ready_irq drdy_irq;
192 bool multi_read_bit;
193 unsigned int bootime;
194};
195
196/**
197 * struct st_sensor_data - ST sensor device status
198 * @dev: Pointer to instance of struct device (I2C or SPI).
199 * @trig: The trigger in use by the core driver.
200 * @sensor: Pointer to the current sensor struct in use.
201 * @current_fullscale: Maximum range of measure by the sensor.
202 * @enabled: Status of the sensor (false->off, true->on).
203 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
204 * @buffer_data: Data used by buffer part.
205 * @odr: Output data rate of the sensor [Hz].
206 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
207 * @tf: Transfer function structure used by I/O operations.
208 * @tb: Transfer buffers and mutex used by I/O operations.
209 */
210struct st_sensor_data {
211 struct device *dev;
212 struct iio_trigger *trig;
213 struct st_sensors *sensor;
214 struct st_sensor_fullscale_avl *current_fullscale;
215
216 bool enabled;
217 bool multiread_bit;
218
219 char *buffer_data;
220
221 unsigned int odr;
222
223 unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev);
224
225 const struct st_sensor_transfer_function *tf;
226 struct st_sensor_transfer_buffer tb;
227};
228
229#ifdef CONFIG_IIO_BUFFER
230int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
231 const struct iio_trigger_ops *trigger_ops);
232
233void st_sensors_deallocate_trigger(struct iio_dev *indio_dev);
234
235irqreturn_t st_sensors_trigger_handler(int irq, void *p);
236
237int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf);
238#else
239static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
240 const struct iio_trigger_ops *trigger_ops)
241{
242 return 0;
243}
244static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev)
245{
246 return;
247}
248#endif
249
250int st_sensors_init_sensor(struct iio_dev *indio_dev);
251
252int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
253
254int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable);
255
256int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);
257
258int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable);
259
260int st_sensors_set_fullscale_by_gain(struct iio_dev *indio_dev, int scale);
261
262int st_sensors_read_info_raw(struct iio_dev *indio_dev,
263 struct iio_chan_spec const *ch, int *val);
264
265int st_sensors_check_device_support(struct iio_dev *indio_dev,
266 int num_sensors_list, const struct st_sensors *sensors);
267
268ssize_t st_sensors_sysfs_get_sampling_frequency(struct device *dev,
269 struct device_attribute *attr, char *buf);
270
271ssize_t st_sensors_sysfs_set_sampling_frequency(struct device *dev,
272 struct device_attribute *attr, const char *buf, size_t size);
273
274ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
275 struct device_attribute *attr, char *buf);
276
277ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
278 struct device_attribute *attr, char *buf);
279
280#endif /* ST_SENSORS_H */
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
new file mode 100644
index 000000000000..67d845385ae2
--- /dev/null
+++ b/include/linux/iio/common/st_sensors_i2c.h
@@ -0,0 +1,20 @@
1/*
2 * STMicroelectronics sensors i2c library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_I2C_H
12#define ST_SENSORS_I2C_H
13
14#include <linux/i2c.h>
15#include <linux/iio/common/st_sensors.h>
16
17void st_sensors_i2c_configure(struct iio_dev *indio_dev,
18 struct i2c_client *client, struct st_sensor_data *sdata);
19
20#endif /* ST_SENSORS_I2C_H */
diff --git a/include/linux/iio/common/st_sensors_spi.h b/include/linux/iio/common/st_sensors_spi.h
new file mode 100644
index 000000000000..d964a3563dc6
--- /dev/null
+++ b/include/linux/iio/common/st_sensors_spi.h
@@ -0,0 +1,20 @@
1/*
2 * STMicroelectronics sensors spi library driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 *
8 * Licensed under the GPL-2.
9 */
10
11#ifndef ST_SENSORS_SPI_H
12#define ST_SENSORS_SPI_H
13
14#include <linux/spi/spi.h>
15#include <linux/iio/common/st_sensors.h>
16
17void st_sensors_spi_configure(struct iio_dev *indio_dev,
18 struct spi_device *spi, struct st_sensor_data *sdata);
19
20#endif /* ST_SENSORS_SPI_H */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 16c35ac045bd..833926c91aa8 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -15,6 +15,7 @@
15 15
16struct iio_dev; 16struct iio_dev;
17struct iio_chan_spec; 17struct iio_chan_spec;
18struct device;
18 19
19/** 20/**
20 * struct iio_channel - everything needed for a consumer to use a channel 21 * struct iio_channel - everything needed for a consumer to use a channel
@@ -30,14 +31,15 @@ struct iio_channel {
30 31
31/** 32/**
32 * iio_channel_get() - get description of all that is needed to access channel. 33 * iio_channel_get() - get description of all that is needed to access channel.
33 * @name: Unique name of the device as provided in the iio_map 34 * @dev: Pointer to consumer device. Device name must match
35 * the name of the device as provided in the iio_map
34 * with which the desired provider to consumer mapping 36 * with which the desired provider to consumer mapping
35 * was registered. 37 * was registered.
36 * @consumer_channel: Unique name to identify the channel on the consumer 38 * @consumer_channel: Unique name to identify the channel on the consumer
37 * side. This typically describes the channels use within 39 * side. This typically describes the channels use within
38 * the consumer. E.g. 'battery_voltage' 40 * the consumer. E.g. 'battery_voltage'
39 */ 41 */
40struct iio_channel *iio_channel_get(const char *name, 42struct iio_channel *iio_channel_get(struct device *dev,
41 const char *consumer_channel); 43 const char *consumer_channel);
42 44
43/** 45/**
@@ -48,14 +50,14 @@ void iio_channel_release(struct iio_channel *chan);
48 50
49/** 51/**
50 * iio_channel_get_all() - get all channels associated with a client 52 * iio_channel_get_all() - get all channels associated with a client
51 * @name: name of consumer device. 53 * @dev: Pointer to consumer device.
52 * 54 *
53 * Returns an array of iio_channel structures terminated with one with 55 * Returns an array of iio_channel structures terminated with one with
54 * null iio_dev pointer. 56 * null iio_dev pointer.
55 * This function is used by fairly generic consumers to get all the 57 * This function is used by fairly generic consumers to get all the
56 * channels registered as having this consumer. 58 * channels registered as having this consumer.
57 */ 59 */
58struct iio_channel *iio_channel_get_all(const char *name); 60struct iio_channel *iio_channel_get_all(struct device *dev);
59 61
60/** 62/**
61 * iio_channel_release_all() - reverse iio_channel_get_all 63 * iio_channel_release_all() - reverse iio_channel_get_all
@@ -66,7 +68,7 @@ void iio_channel_release_all(struct iio_channel *chan);
66struct iio_cb_buffer; 68struct iio_cb_buffer;
67/** 69/**
68 * iio_channel_get_all_cb() - register callback for triggered capture 70 * iio_channel_get_all_cb() - register callback for triggered capture
69 * @name: Name of client device. 71 * @dev: Pointer to client device.
70 * @cb: Callback function. 72 * @cb: Callback function.
71 * @private: Private data passed to callback. 73 * @private: Private data passed to callback.
72 * 74 *
@@ -74,7 +76,7 @@ struct iio_cb_buffer;
74 * So if the channels requested come from different devices this will 76 * So if the channels requested come from different devices this will
75 * fail. 77 * fail.
76 */ 78 */
77struct iio_cb_buffer *iio_channel_get_all_cb(const char *name, 79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
78 int (*cb)(u8 *data, 80 int (*cb)(u8 *data,
79 void *private), 81 void *private),
80 void *private); 82 void *private);
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
index a4f8b2e05af5..7dfb10ee2669 100644
--- a/include/linux/iio/driver.h
+++ b/include/linux/iio/driver.h
@@ -22,13 +22,10 @@ int iio_map_array_register(struct iio_dev *indio_dev,
22 struct iio_map *map); 22 struct iio_map *map);
23 23
24/** 24/**
25 * iio_map_array_unregister() - tell the core to remove consumer mappings 25 * iio_map_array_unregister() - tell the core to remove consumer mappings for
26 * the given provider device
26 * @indio_dev: provider device 27 * @indio_dev: provider device
27 * @map: array of mappings to remove. Note these must have same memory
28 * addresses as those originally added not just equal parameter
29 * values.
30 */ 28 */
31int iio_map_array_unregister(struct iio_dev *indio_dev, 29int iio_map_array_unregister(struct iio_dev *indio_dev);
32 struct iio_map *map);
33 30
34#endif 31#endif
diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h
new file mode 100644
index 000000000000..c53f16914b77
--- /dev/null
+++ b/include/linux/iio/gyro/itg3200.h
@@ -0,0 +1,154 @@
1/*
2 * itg3200.h -- support InvenSense ITG3200
3 * Digital 3-Axis Gyroscope driver
4 *
5 * Copyright (c) 2011 Christian Strobel <christian.strobel@iis.fraunhofer.de>
6 * Copyright (c) 2011 Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
7 * Copyright (c) 2012 Thorsten Nowak <thorsten.nowak@iis.fraunhofer.de>
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 I2C_ITG3200_H_
15#define I2C_ITG3200_H_
16
17#include <linux/iio/iio.h>
18
19/* Register with I2C address (34h) */
20#define ITG3200_REG_ADDRESS 0x00
21
22/* Sample rate divider
23 * Range: 0 to 255
24 * Default value: 0x00 */
25#define ITG3200_REG_SAMPLE_RATE_DIV 0x15
26
27/* Digital low pass filter settings */
28#define ITG3200_REG_DLPF 0x16
29/* DLPF full scale range */
30#define ITG3200_DLPF_FS_SEL_2000 0x18
31/* Bandwidth (Hz) and internal sample rate
32 * (kHz) of DLPF */
33#define ITG3200_DLPF_256_8 0x00
34#define ITG3200_DLPF_188_1 0x01
35#define ITG3200_DLPF_98_1 0x02
36#define ITG3200_DLPF_42_1 0x03
37#define ITG3200_DLPF_20_1 0x04
38#define ITG3200_DLPF_10_1 0x05
39#define ITG3200_DLPF_5_1 0x06
40
41#define ITG3200_DLPF_CFG_MASK 0x07
42
43/* Configuration for interrupt operations */
44#define ITG3200_REG_IRQ_CONFIG 0x17
45/* Logic level */
46#define ITG3200_IRQ_ACTIVE_LOW 0x80
47#define ITG3200_IRQ_ACTIVE_HIGH 0x00
48/* Drive type */
49#define ITG3200_IRQ_OPEN_DRAIN 0x40
50#define ITG3200_IRQ_PUSH_PULL 0x00
51/* Latch mode */
52#define ITG3200_IRQ_LATCH_UNTIL_CLEARED 0x20
53#define ITG3200_IRQ_LATCH_50US_PULSE 0x00
54/* Latch clear method */
55#define ITG3200_IRQ_LATCH_CLEAR_ANY 0x10
56#define ITG3200_IRQ_LATCH_CLEAR_STATUS 0x00
57/* Enable interrupt when device is ready */
58#define ITG3200_IRQ_DEVICE_RDY_ENABLE 0x04
59/* Enable interrupt when data is available */
60#define ITG3200_IRQ_DATA_RDY_ENABLE 0x01
61
62/* Determine the status of ITG-3200 interrupts */
63#define ITG3200_REG_IRQ_STATUS 0x1A
64/* Status of 'device is ready'-interrupt */
65#define ITG3200_IRQ_DEVICE_RDY_STATUS 0x04
66/* Status of 'data is available'-interrupt */
67#define ITG3200_IRQ_DATA_RDY_STATUS 0x01
68
69/* Sensor registers */
70#define ITG3200_REG_TEMP_OUT_H 0x1B
71#define ITG3200_REG_TEMP_OUT_L 0x1C
72#define ITG3200_REG_GYRO_XOUT_H 0x1D
73#define ITG3200_REG_GYRO_XOUT_L 0x1E
74#define ITG3200_REG_GYRO_YOUT_H 0x1F
75#define ITG3200_REG_GYRO_YOUT_L 0x20
76#define ITG3200_REG_GYRO_ZOUT_H 0x21
77#define ITG3200_REG_GYRO_ZOUT_L 0x22
78
79/* Power management */
80#define ITG3200_REG_POWER_MANAGEMENT 0x3E
81/* Reset device and internal registers to the
82 * power-up-default settings */
83#define ITG3200_RESET 0x80
84/* Enable low power sleep mode */
85#define ITG3200_SLEEP 0x40
86/* Put according gyroscope in standby mode */
87#define ITG3200_STANDBY_GYRO_X 0x20
88#define ITG3200_STANDBY_GYRO_Y 0x10
89#define ITG3200_STANDBY_GYRO_Z 0x08
90/* Determine the device clock source */
91#define ITG3200_CLK_INTERNAL 0x00
92#define ITG3200_CLK_GYRO_X 0x01
93#define ITG3200_CLK_GYRO_Y 0x02
94#define ITG3200_CLK_GYRO_Z 0x03
95#define ITG3200_CLK_EXT_32K 0x04
96#define ITG3200_CLK_EXT_19M 0x05
97
98
99/**
100 * struct itg3200 - device instance specific data
101 * @i2c: actual i2c_client
102 * @trig: data ready trigger from itg3200 pin
103 **/
104struct itg3200 {
105 struct i2c_client *i2c;
106 struct iio_trigger *trig;
107};
108
109enum ITG3200_SCAN_INDEX {
110 ITG3200_SCAN_TEMP,
111 ITG3200_SCAN_GYRO_X,
112 ITG3200_SCAN_GYRO_Y,
113 ITG3200_SCAN_GYRO_Z,
114 ITG3200_SCAN_ELEMENTS,
115};
116
117int itg3200_write_reg_8(struct iio_dev *indio_dev,
118 u8 reg_address, u8 val);
119
120int itg3200_read_reg_8(struct iio_dev *indio_dev,
121 u8 reg_address, u8 *val);
122
123
124#ifdef CONFIG_IIO_BUFFER
125
126void itg3200_remove_trigger(struct iio_dev *indio_dev);
127int itg3200_probe_trigger(struct iio_dev *indio_dev);
128
129int itg3200_buffer_configure(struct iio_dev *indio_dev);
130void itg3200_buffer_unconfigure(struct iio_dev *indio_dev);
131
132#else /* CONFIG_IIO_BUFFER */
133
134static inline void itg3200_remove_trigger(struct iio_dev *indio_dev)
135{
136}
137
138static inline int itg3200_probe_trigger(struct iio_dev *indio_dev)
139{
140 return 0;
141}
142
143static inline int itg3200_buffer_configure(struct iio_dev *indio_dev)
144{
145 return 0;
146}
147
148static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)
149{
150}
151
152#endif /* CONFIG_IIO_RING_BUFFER */
153
154#endif /* ITG3200_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 20239da1d0f7..c66e0a96f6e8 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -12,6 +12,7 @@
12#ifndef _IIO_TRIGGER_H_ 12#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_ 13#define _IIO_TRIGGER_H_
14 14
15#ifdef CONFIG_IIO_TRIGGER
15struct iio_subirq { 16struct iio_subirq {
16 bool enabled; 17 bool enabled;
17}; 18};
@@ -117,4 +118,8 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
117__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...); 118__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
118void iio_trigger_free(struct iio_trigger *trig); 119void iio_trigger_free(struct iio_trigger *trig);
119 120
121#else
122struct iio_trigger;
123struct iio_trigger_ops;
124#endif
120#endif /* _IIO_TRIGGER_H_ */ 125#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 9e2ae26fb598..34edf1f6c9a3 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -22,6 +22,10 @@
22 22
23#include <uapi/linux/in6.h> 23#include <uapi/linux/in6.h>
24 24
25/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
26 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
27 * in network byte order, not in host byte order as are the IPv4 equivalents
28 */
25extern const struct in6_addr in6addr_any; 29extern const struct in6_addr in6addr_any;
26#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 30#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
27extern const struct in6_addr in6addr_loopback; 31extern const struct in6_addr in6addr_loopback;
@@ -32,4 +36,13 @@ extern const struct in6_addr in6addr_linklocal_allnodes;
32extern const struct in6_addr in6addr_linklocal_allrouters; 36extern const struct in6_addr in6addr_linklocal_allrouters;
33#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ 37#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
34 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } } 38 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
39extern const struct in6_addr in6addr_interfacelocal_allnodes;
40#define IN6ADDR_INTERFACELOCAL_ALLNODES_INIT \
41 { { { 0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
42extern const struct in6_addr in6addr_interfacelocal_allrouters;
43#define IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT \
44 { { { 0xff,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
45extern const struct in6_addr in6addr_sitelocal_allrouters;
46#define IN6ADDR_SITELOCAL_ALLROUTERS_INIT \
47 { { { 0xff,5,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
35#endif 48#endif
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index a9d828976a77..ea1e3b863890 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -166,6 +166,12 @@ struct in_ifaddr {
166 unsigned char ifa_flags; 166 unsigned char ifa_flags;
167 unsigned char ifa_prefixlen; 167 unsigned char ifa_prefixlen;
168 char ifa_label[IFNAMSIZ]; 168 char ifa_label[IFNAMSIZ];
169
170 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
171 __u32 ifa_valid_lft;
172 __u32 ifa_preferred_lft;
173 unsigned long ifa_cstamp; /* created timestamp */
174 unsigned long ifa_tstamp; /* updated timestamp */
169}; 175};
170 176
171extern int register_inetaddr_notifier(struct notifier_block *nb); 177extern int register_inetaddr_notifier(struct notifier_block *nb);
diff --git a/include/linux/init.h b/include/linux/init.h
index a799273714ac..861814710d52 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,14 +93,6 @@
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, but that is always enabled now, so just make them noops */
97#define __devinit
98#define __devinitdata
99#define __devinitconst
100#define __devexit
101#define __devexitdata
102#define __devexitconst
103
104/* Used for HOTPLUG_CPU */ 96/* Used for HOTPLUG_CPU */
105#define __cpuinit __section(.cpuinit.text) __cold notrace 97#define __cpuinit __section(.cpuinit.text) __cold notrace
106#define __cpuinitdata __section(.cpuinit.data) 98#define __cpuinitdata __section(.cpuinit.data)
@@ -161,6 +153,7 @@ extern unsigned int reset_devices;
161/* used by init/main.c */ 153/* used by init/main.c */
162void setup_arch(char **); 154void setup_arch(char **);
163void prepare_namespace(void); 155void prepare_namespace(void);
156void __init load_default_modules(void);
164 157
165extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
166 159
@@ -337,18 +330,6 @@ void __init parse_early_options(char *cmdline);
337#define __INITRODATA_OR_MODULE __INITRODATA 330#define __INITRODATA_OR_MODULE __INITRODATA
338#endif /*CONFIG_MODULES*/ 331#endif /*CONFIG_MODULES*/
339 332
340/* Functions marked as __devexit may be discarded at kernel link time, depending
341 on config options. Newer versions of binutils detect references from
342 retained sections to discarded sections and flag an error. Pointers to
343 __devexit functions must use __devexit_p(function_name), the wrapper will
344 insert either the function_name or NULL, depending on the config options.
345 */
346#if defined(MODULE) || defined(CONFIG_HOTPLUG)
347#define __devexit_p(x) x
348#else
349#define __devexit_p(x) NULL
350#endif
351
352#ifdef MODULE 333#ifdef MODULE
353#define __exit_p(x) x 334#define __exit_p(x) x
354#else 335#else
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6d087c5f57f7..5cd0f0949927 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -10,7 +10,9 @@
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h> 12#include <linux/securebits.h>
13#include <linux/seqlock.h>
13#include <net/net_namespace.h> 14#include <net/net_namespace.h>
15#include <linux/sched/rt.h>
14 16
15#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
16# define INIT_PUSHABLE_TASKS(tsk) \ 18# define INIT_PUSHABLE_TASKS(tsk) \
@@ -141,6 +143,15 @@ extern struct task_group root_task_group;
141# define INIT_PERF_EVENTS(tsk) 143# define INIT_PERF_EVENTS(tsk)
142#endif 144#endif
143 145
146#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
147# define INIT_VTIME(tsk) \
148 .vtime_seqlock = __SEQLOCK_UNLOCKED(tsk.vtime_seqlock), \
149 .vtime_snap = 0, \
150 .vtime_snap_whence = VTIME_SYS,
151#else
152# define INIT_VTIME(tsk)
153#endif
154
144#define INIT_TASK_COMM "swapper" 155#define INIT_TASK_COMM "swapper"
145 156
146/* 157/*
@@ -210,6 +221,7 @@ extern struct task_group root_task_group;
210 INIT_TRACE_RECURSION \ 221 INIT_TRACE_RECURSION \
211 INIT_TASK_RCU_PREEMPT(tsk) \ 222 INIT_TASK_RCU_PREEMPT(tsk) \
212 INIT_CPUSET_SEQ \ 223 INIT_CPUSET_SEQ \
224 INIT_VTIME(tsk) \
213} 225}
214 226
215 227
diff --git a/include/linux/input/adxl34x.h b/include/linux/input/adxl34x.h
index 57e01a7cb006..010d98175efa 100644
--- a/include/linux/input/adxl34x.h
+++ b/include/linux/input/adxl34x.h
@@ -13,6 +13,8 @@
13#ifndef __LINUX_INPUT_ADXL34X_H__ 13#ifndef __LINUX_INPUT_ADXL34X_H__
14#define __LINUX_INPUT_ADXL34X_H__ 14#define __LINUX_INPUT_ADXL34X_H__
15 15
16#include <linux/input.h>
17
16struct adxl34x_platform_data { 18struct adxl34x_platform_data {
17 19
18 /* 20 /*
diff --git a/include/linux/input/tegra_kbc.h b/include/linux/input/tegra_kbc.h
deleted file mode 100644
index a13025612939..000000000000
--- a/include/linux/input/tegra_kbc.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Platform definitions for tegra-kbc keyboard input driver
3 *
4 * Copyright (c) 2010-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 ASMARM_ARCH_TEGRA_KBC_H
22#define ASMARM_ARCH_TEGRA_KBC_H
23
24#include <linux/types.h>
25#include <linux/input/matrix_keypad.h>
26
27#define KBC_MAX_GPIO 24
28#define KBC_MAX_KPENT 8
29
30#define KBC_MAX_ROW 16
31#define KBC_MAX_COL 8
32#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
33
34enum tegra_pin_type {
35 PIN_CFG_IGNORE,
36 PIN_CFG_COL,
37 PIN_CFG_ROW,
38};
39
40struct tegra_kbc_pin_cfg {
41 enum tegra_pin_type type;
42 unsigned char num;
43};
44
45struct tegra_kbc_wake_key {
46 u8 row:4;
47 u8 col:4;
48};
49
50struct tegra_kbc_platform_data {
51 unsigned int debounce_cnt;
52 unsigned int repeat_cnt;
53
54 struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO];
55 const struct matrix_keymap_data *keymap_data;
56
57 u32 wakeup_key;
58 bool wakeup;
59 bool use_fn_map;
60 bool use_ghost_filter;
61};
62#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5e4e6170f43a..5fa5afeeb759 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -268,11 +268,6 @@ struct irq_affinity_notify {
268extern int 268extern int
269irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); 269irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
270 270
271static inline void irq_run_affinity_notifiers(void)
272{
273 flush_scheduled_work();
274}
275
276#else /* CONFIG_SMP */ 271#else /* CONFIG_SMP */
277 272
278static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 273static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index f3b99e1c1042..ba3b8a98a049 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -58,8 +58,10 @@ struct iommu_domain {
58#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 58#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
59 59
60enum iommu_attr { 60enum iommu_attr {
61 DOMAIN_ATTR_MAX,
62 DOMAIN_ATTR_GEOMETRY, 61 DOMAIN_ATTR_GEOMETRY,
62 DOMAIN_ATTR_PAGING,
63 DOMAIN_ATTR_WINDOWS,
64 DOMAIN_ATTR_MAX,
63}; 65};
64 66
65#ifdef CONFIG_IOMMU_API 67#ifdef CONFIG_IOMMU_API
@@ -100,6 +102,16 @@ struct iommu_ops {
100 enum iommu_attr attr, void *data); 102 enum iommu_attr attr, void *data);
101 int (*domain_set_attr)(struct iommu_domain *domain, 103 int (*domain_set_attr)(struct iommu_domain *domain,
102 enum iommu_attr attr, void *data); 104 enum iommu_attr attr, void *data);
105
106 /* Window handling functions */
107 int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr,
108 phys_addr_t paddr, u64 size);
109 void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr);
110 /* Set the numer of window per domain */
111 int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
112 /* Get the numer of window per domain */
113 u32 (*domain_get_windows)(struct iommu_domain *domain);
114
103 unsigned long pgsize_bitmap; 115 unsigned long pgsize_bitmap;
104}; 116};
105 117
@@ -157,6 +169,10 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr,
157extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, 169extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
158 void *data); 170 void *data);
159 171
172/* Window handling function prototypes */
173extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr,
174 phys_addr_t offset, u64 size);
175extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr);
160/** 176/**
161 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 177 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
162 * @domain: the iommu domain where the fault has happened 178 * @domain: the iommu domain where the fault has happened
@@ -239,6 +255,18 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
239 return -ENODEV; 255 return -ENODEV;
240} 256}
241 257
258static inline int iommu_domain_window_enable(struct iommu_domain *domain,
259 u32 wnd_nr, phys_addr_t paddr,
260 u64 size)
261{
262 return -ENODEV;
263}
264
265static inline void iommu_domain_window_disable(struct iommu_domain *domain,
266 u32 wnd_nr)
267{
268}
269
242static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 270static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
243 unsigned long iova) 271 unsigned long iova)
244{ 272{
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index fe771978e877..ae221a7b5092 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -24,6 +24,7 @@ struct ipc_ids {
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rw_mutex;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id;
27}; 28};
28 29
29struct ipc_namespace { 30struct ipc_namespace {
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 1487e7906bbd..1f9f56e28851 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -35,10 +35,6 @@
35 35
36#include <uapi/linux/ipmi.h> 36#include <uapi/linux/ipmi.h>
37 37
38
39/*
40 * The in-kernel interface.
41 */
42#include <linux/list.h> 38#include <linux/list.h>
43#include <linux/proc_fs.h> 39#include <linux/proc_fs.h>
44 40
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index faed1e357dd6..850e95bc766c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -77,11 +77,6 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
77 return (struct ipv6hdr *)skb_transport_header(skb); 77 return (struct ipv6hdr *)skb_transport_header(skb);
78} 78}
79 79
80static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
81{
82 return (ntohl(*(__be32 *)iph) >> 20) & 0xff;
83}
84
85/* 80/*
86 This structure contains results of exthdrs parsing 81 This structure contains results of exthdrs parsing
87 as offsets from skb->nh. 82 as offsets from skb->nh.
@@ -89,7 +84,7 @@ static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
89 84
90struct inet6_skb_parm { 85struct inet6_skb_parm {
91 int iif; 86 int iif;
92 __u16 ra; 87 __be16 ra;
93 __u16 hop; 88 __u16 hop;
94 __u16 dst0; 89 __u16 dst0;
95 __u16 srcrt; 90 __u16 srcrt;
@@ -105,6 +100,7 @@ struct inet6_skb_parm {
105#define IP6SKB_XFRM_TRANSFORMED 1 100#define IP6SKB_XFRM_TRANSFORMED 1
106#define IP6SKB_FORWARDED 2 101#define IP6SKB_FORWARDED 2
107#define IP6SKB_REROUTED 4 102#define IP6SKB_REROUTED 4
103#define IP6SKB_ROUTERALERT 8
108}; 104};
109 105
110#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 106#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -218,7 +214,7 @@ struct ipv6_pinfo {
218 214
219 struct ipv6_mc_socklist __rcu *ipv6_mc_list; 215 struct ipv6_mc_socklist __rcu *ipv6_mc_list;
220 struct ipv6_ac_socklist *ipv6_ac_list; 216 struct ipv6_ac_socklist *ipv6_ac_list;
221 struct ipv6_fl_socklist *ipv6_fl_list; 217 struct ipv6_fl_socklist __rcu *ipv6_fl_list;
222 218
223 struct ipv6_txoptions *opt; 219 struct ipv6_txoptions *opt;
224 struct sk_buff *pktoptions; 220 struct sk_buff *pktoptions;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fdf2c4a238cc..bc4e06611958 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -509,8 +509,11 @@ static inline void irq_set_percpu_devid_flags(unsigned int irq)
509 509
510/* Handle dynamic irq creation and destruction */ 510/* Handle dynamic irq creation and destruction */
511extern unsigned int create_irq_nr(unsigned int irq_want, int node); 511extern unsigned int create_irq_nr(unsigned int irq_want, int node);
512extern unsigned int __create_irqs(unsigned int from, unsigned int count,
513 int node);
512extern int create_irq(void); 514extern int create_irq(void);
513extern void destroy_irq(unsigned int irq); 515extern void destroy_irq(unsigned int irq);
516extern void destroy_irqs(unsigned int irq, unsigned int count);
514 517
515/* 518/*
516 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and 519 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
@@ -528,6 +531,8 @@ extern int irq_set_handler_data(unsigned int irq, void *data);
528extern int irq_set_chip_data(unsigned int irq, void *data); 531extern int irq_set_chip_data(unsigned int irq, void *data);
529extern int irq_set_irq_type(unsigned int irq, unsigned int type); 532extern int irq_set_irq_type(unsigned int irq, unsigned int type);
530extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry); 533extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
534extern int irq_set_msi_desc_off(unsigned int irq_base, unsigned int irq_offset,
535 struct msi_desc *entry);
531extern struct irq_data *irq_get_irq_data(unsigned int irq); 536extern struct irq_data *irq_get_irq_data(unsigned int irq);
532 537
533static inline struct irq_chip *irq_get_chip(unsigned int irq) 538static inline struct irq_chip *irq_get_chip(unsigned int irq)
@@ -590,6 +595,9 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
590#define irq_alloc_desc_from(from, node) \ 595#define irq_alloc_desc_from(from, node) \
591 irq_alloc_descs(-1, from, 1, node) 596 irq_alloc_descs(-1, from, 1, node)
592 597
598#define irq_alloc_descs_from(from, cnt, node) \
599 irq_alloc_descs(-1, from, cnt, node)
600
593void irq_free_descs(unsigned int irq, unsigned int cnt); 601void irq_free_descs(unsigned int irq, unsigned int cnt);
594int irq_reserve_irqs(unsigned int from, unsigned int cnt); 602int irq_reserve_irqs(unsigned int from, unsigned int cnt);
595 603
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 6a9e8f5399e2..f5dbce50466e 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -3,6 +3,20 @@
3 3
4#include <linux/llist.h> 4#include <linux/llist.h>
5 5
6/*
7 * An entry can be in one of four states:
8 *
9 * free NULL, 0 -> {claimed} : free to be used
10 * claimed NULL, 3 -> {pending} : claimed to be enqueued
11 * pending next, 3 -> {busy} : queued, pending callback
12 * busy NULL, 2 -> {free, claimed} : callback in progress, can be claimed
13 */
14
15#define IRQ_WORK_PENDING 1UL
16#define IRQ_WORK_BUSY 2UL
17#define IRQ_WORK_FLAGS 3UL
18#define IRQ_WORK_LAZY 4UL /* Doesn't want IPI, wait for tick */
19
6struct irq_work { 20struct irq_work {
7 unsigned long flags; 21 unsigned long flags;
8 struct llist_node llnode; 22 struct llist_node llnode;
@@ -16,8 +30,14 @@ void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *))
16 work->func = func; 30 work->func = func;
17} 31}
18 32
19bool irq_work_queue(struct irq_work *work); 33void irq_work_queue(struct irq_work *work);
20void irq_work_run(void); 34void irq_work_run(void);
21void irq_work_sync(struct irq_work *work); 35void irq_work_sync(struct irq_work *work);
22 36
37#ifdef CONFIG_IRQ_WORK
38bool irq_work_needs_cpu(void);
39#else
40static bool irq_work_needs_cpu(void) { return false; }
41#endif
42
23#endif /* _LINUX_IRQ_WORK_H */ 43#endif /* _LINUX_IRQ_WORK_H */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
new file mode 100644
index 000000000000..e0006f1d35a0
--- /dev/null
+++ b/include/linux/irqchip.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2012 Thomas Petazzoni
3 *
4 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef _LINUX_IRQCHIP_H
12#define _LINUX_IRQCHIP_H
13
14void irqchip_init(void);
15
16#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
new file mode 100644
index 000000000000..3fd8e4290a1c
--- /dev/null
+++ b/include/linux/irqchip/arm-gic.h
@@ -0,0 +1,79 @@
1/*
2 * include/linux/irqchip/arm-gic.h
3 *
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __LINUX_IRQCHIP_ARM_GIC_H
11#define __LINUX_IRQCHIP_ARM_GIC_H
12
13#define GIC_CPU_CTRL 0x00
14#define GIC_CPU_PRIMASK 0x04
15#define GIC_CPU_BINPOINT 0x08
16#define GIC_CPU_INTACK 0x0c
17#define GIC_CPU_EOI 0x10
18#define GIC_CPU_RUNNINGPRI 0x14
19#define GIC_CPU_HIGHPRI 0x18
20
21#define GIC_DIST_CTRL 0x000
22#define GIC_DIST_CTR 0x004
23#define GIC_DIST_IGROUP 0x080
24#define GIC_DIST_ENABLE_SET 0x100
25#define GIC_DIST_ENABLE_CLEAR 0x180
26#define GIC_DIST_PENDING_SET 0x200
27#define GIC_DIST_PENDING_CLEAR 0x280
28#define GIC_DIST_ACTIVE_SET 0x300
29#define GIC_DIST_ACTIVE_CLEAR 0x380
30#define GIC_DIST_PRI 0x400
31#define GIC_DIST_TARGET 0x800
32#define GIC_DIST_CONFIG 0xc00
33#define GIC_DIST_SOFTINT 0xf00
34
35#define GICH_HCR 0x0
36#define GICH_VTR 0x4
37#define GICH_VMCR 0x8
38#define GICH_MISR 0x10
39#define GICH_EISR0 0x20
40#define GICH_EISR1 0x24
41#define GICH_ELRSR0 0x30
42#define GICH_ELRSR1 0x34
43#define GICH_APR 0xf0
44#define GICH_LR0 0x100
45
46#define GICH_HCR_EN (1 << 0)
47#define GICH_HCR_UIE (1 << 1)
48
49#define GICH_LR_VIRTUALID (0x3ff << 0)
50#define GICH_LR_PHYSID_CPUID_SHIFT (10)
51#define GICH_LR_PHYSID_CPUID (7 << GICH_LR_PHYSID_CPUID_SHIFT)
52#define GICH_LR_STATE (3 << 28)
53#define GICH_LR_PENDING_BIT (1 << 28)
54#define GICH_LR_ACTIVE_BIT (1 << 29)
55#define GICH_LR_EOI (1 << 19)
56
57#define GICH_MISR_EOI (1 << 0)
58#define GICH_MISR_U (1 << 1)
59
60#ifndef __ASSEMBLY__
61
62struct device_node;
63
64extern struct irq_chip gic_arch_extn;
65
66void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
67 u32 offset, struct device_node *);
68void gic_secondary_init(unsigned int);
69void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
70
71static inline void gic_init(unsigned int nr, int start,
72 void __iomem *dist , void __iomem *cpu)
73{
74 gic_init_bases(nr, start, dist, cpu, 0, NULL);
75}
76
77#endif /* __ASSEMBLY */
78
79#endif
diff --git a/include/linux/irqchip/arm-vic.h b/include/linux/irqchip/arm-vic.h
new file mode 100644
index 000000000000..e3c82dc95756
--- /dev/null
+++ b/include/linux/irqchip/arm-vic.h
@@ -0,0 +1,36 @@
1/*
2 * arch/arm/include/asm/hardware/vic.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_HARDWARE_VIC_H
21#define __ASM_ARM_HARDWARE_VIC_H
22
23#include <linux/types.h>
24
25#define VIC_RAW_STATUS 0x08
26#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
27#define VIC_INT_ENABLE_CLEAR 0x14
28
29struct device_node;
30struct pt_regs;
31
32void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
33 u32 resume_sources, struct device_node *node);
34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
35
36#endif
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index e30b66346942..50e5a5e6a712 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -20,7 +20,6 @@
20#ifndef __KERNEL__ 20#ifndef __KERNEL__
21#include "jfs_compat.h" 21#include "jfs_compat.h"
22#define JBD2_DEBUG 22#define JBD2_DEBUG
23#define jfs_debug jbd_debug
24#else 23#else
25 24
26#include <linux/types.h> 25#include <linux/types.h>
@@ -57,7 +56,7 @@
57 * CONFIG_JBD2_DEBUG is on. 56 * CONFIG_JBD2_DEBUG is on.
58 */ 57 */
59#define JBD2_EXPENSIVE_CHECKING 58#define JBD2_EXPENSIVE_CHECKING
60extern u8 jbd2_journal_enable_debug; 59extern ushort jbd2_journal_enable_debug;
61 60
62#define jbd_debug(n, f, a...) \ 61#define jbd_debug(n, f, a...) \
63 do { \ 62 do { \
@@ -397,35 +396,18 @@ struct jbd2_journal_handle
397 int h_err; 396 int h_err;
398 397
399 /* Flags [no locking] */ 398 /* Flags [no locking] */
400 unsigned int h_sync:1; /* sync-on-close */ 399 unsigned int h_sync: 1; /* sync-on-close */
401 unsigned int h_jdata:1; /* force data journaling */ 400 unsigned int h_jdata: 1; /* force data journaling */
402 unsigned int h_aborted:1; /* fatal error on handle */ 401 unsigned int h_aborted: 1; /* fatal error on handle */
403 unsigned int h_cowing:1; /* COWing block to snapshot */ 402 unsigned int h_type: 8; /* for handle statistics */
404 403 unsigned int h_line_no: 16; /* for handle statistics */
405 /* Number of buffers requested by user:
406 * (before adding the COW credits factor) */
407 unsigned int h_base_credits:14;
408
409 /* Number of buffers the user is allowed to dirty:
410 * (counts only buffers dirtied when !h_cowing) */
411 unsigned int h_user_credits:14;
412 404
405 unsigned long h_start_jiffies;
406 unsigned int h_requested_credits;
413 407
414#ifdef CONFIG_DEBUG_LOCK_ALLOC 408#ifdef CONFIG_DEBUG_LOCK_ALLOC
415 struct lockdep_map h_lockdep_map; 409 struct lockdep_map h_lockdep_map;
416#endif 410#endif
417
418#ifdef CONFIG_JBD2_DEBUG
419 /* COW debugging counters: */
420 unsigned int h_cow_moved; /* blocks moved to snapshot */
421 unsigned int h_cow_copied; /* blocks copied to snapshot */
422 unsigned int h_cow_ok_jh; /* blocks already COWed during current
423 transaction */
424 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
425 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
426 unsigned int h_cow_bitmaps; /* COW bitmaps created */
427 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
428#endif
429}; 411};
430 412
431 413
@@ -581,6 +563,11 @@ struct transaction_s
581 unsigned long t_start; 563 unsigned long t_start;
582 564
583 /* 565 /*
566 * When commit was requested
567 */
568 unsigned long t_requested;
569
570 /*
584 * Checkpointing stats [j_checkpoint_sem] 571 * Checkpointing stats [j_checkpoint_sem]
585 */ 572 */
586 struct transaction_chp_stats_s t_chp_stats; 573 struct transaction_chp_stats_s t_chp_stats;
@@ -637,6 +624,7 @@ struct transaction_s
637 624
638struct transaction_run_stats_s { 625struct transaction_run_stats_s {
639 unsigned long rs_wait; 626 unsigned long rs_wait;
627 unsigned long rs_request_delay;
640 unsigned long rs_running; 628 unsigned long rs_running;
641 unsigned long rs_locked; 629 unsigned long rs_locked;
642 unsigned long rs_flushing; 630 unsigned long rs_flushing;
@@ -649,6 +637,7 @@ struct transaction_run_stats_s {
649 637
650struct transaction_stats_s { 638struct transaction_stats_s {
651 unsigned long ts_tid; 639 unsigned long ts_tid;
640 unsigned long ts_requested;
652 struct transaction_run_stats_s run; 641 struct transaction_run_stats_s run;
653}; 642};
654 643
@@ -1086,7 +1075,8 @@ static inline handle_t *journal_current_handle(void)
1086 */ 1075 */
1087 1076
1088extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1077extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1089extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask); 1078extern handle_t *jbd2__journal_start(journal_t *, int nblocks, gfp_t gfp_mask,
1079 unsigned int type, unsigned int line_no);
1090extern int jbd2_journal_restart(handle_t *, int nblocks); 1080extern int jbd2_journal_restart(handle_t *, int nblocks);
1091extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask); 1081extern int jbd2__journal_restart(handle_t *, int nblocks, gfp_t gfp_mask);
1092extern int jbd2_journal_extend (handle_t *, int nblocks); 1082extern int jbd2_journal_extend (handle_t *, int nblocks);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index c566927efcbd..80d36874689b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -398,7 +398,11 @@ extern int panic_on_unrecovered_nmi;
398extern int panic_on_io_nmi; 398extern int panic_on_io_nmi;
399extern int sysctl_panic_on_stackoverflow; 399extern int sysctl_panic_on_stackoverflow;
400extern const char *print_tainted(void); 400extern const char *print_tainted(void);
401extern void add_taint(unsigned flag); 401enum lockdep_ok {
402 LOCKDEP_STILL_OK,
403 LOCKDEP_NOW_UNRELIABLE
404};
405extern void add_taint(unsigned flag, enum lockdep_ok);
402extern int test_taint(unsigned flag); 406extern int test_taint(unsigned flag);
403extern unsigned long get_taint(void); 407extern unsigned long get_taint(void);
404extern int root_mountflags; 408extern int root_mountflags;
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 66b70780e910..ed5f6ed6eb77 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -127,7 +127,7 @@ extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t)
127extern void account_steal_time(cputime_t); 127extern void account_steal_time(cputime_t);
128extern void account_idle_time(cputime_t); 128extern void account_idle_time(cputime_t);
129 129
130#ifdef CONFIG_VIRT_CPU_ACCOUNTING 130#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
131static inline void account_process_tick(struct task_struct *tsk, int user) 131static inline void account_process_tick(struct task_struct *tsk, int user)
132{ 132{
133 vtime_account_user(tsk); 133 vtime_account_user(tsk);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d0b8458a703a..d2e6927bbaae 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -191,6 +191,7 @@ extern struct kimage *kexec_crash_image;
191/* Location of a reserved region to hold the crash kernel. 191/* Location of a reserved region to hold the crash kernel.
192 */ 192 */
193extern struct resource crashk_res; 193extern struct resource crashk_res;
194extern struct resource crashk_low_res;
194typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; 195typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4];
195extern note_buf_t __percpu *crash_notes; 196extern note_buf_t __percpu *crash_notes;
196extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; 197extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
@@ -199,6 +200,8 @@ extern size_t vmcoreinfo_max_size;
199 200
200int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, 201int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
201 unsigned long long *crash_size, unsigned long long *crash_base); 202 unsigned long long *crash_size, unsigned long long *crash_base);
203int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
204 unsigned long long *crash_size, unsigned long long *crash_base);
202int crash_shrink_memory(unsigned long new_size); 205int crash_shrink_memory(unsigned long new_size);
203size_t crash_get_memory_size(void); 206size_t crash_get_memory_size(void);
204void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); 207void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 4dff0c6ed58f..c6e091bf39a5 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -13,7 +13,6 @@
13#ifndef _KGDB_H_ 13#ifndef _KGDB_H_
14#define _KGDB_H_ 14#define _KGDB_H_
15 15
16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 16#include <linux/linkage.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/atomic.h> 18#include <linux/atomic.h>
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 23755ba42abc..4b6ef4d33cc2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -49,16 +49,6 @@
49#define KPROBE_REENTER 0x00000004 49#define KPROBE_REENTER 0x00000004
50#define KPROBE_HIT_SSDONE 0x00000008 50#define KPROBE_HIT_SSDONE 0x00000008
51 51
52/*
53 * If function tracer is enabled and the arch supports full
54 * passing of pt_regs to function tracing, then kprobes can
55 * optimize on top of function tracing.
56 */
57#if defined(CONFIG_FUNCTION_TRACER) && defined(ARCH_SUPPORTS_FTRACE_SAVE_REGS) \
58 && defined(ARCH_SUPPORTS_KPROBES_ON_FTRACE)
59# define KPROBES_CAN_USE_FTRACE
60#endif
61
62/* Attach to insert probes on any functions which should be ignored*/ 52/* Attach to insert probes on any functions which should be ignored*/
63#define __kprobes __attribute__((__section__(".kprobes.text"))) 53#define __kprobes __attribute__((__section__(".kprobes.text")))
64 54
@@ -316,7 +306,7 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table,
316#endif 306#endif
317 307
318#endif /* CONFIG_OPTPROBES */ 308#endif /* CONFIG_OPTPROBES */
319#ifdef KPROBES_CAN_USE_FTRACE 309#ifdef CONFIG_KPROBES_ON_FTRACE
320extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, 310extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
321 struct ftrace_ops *ops, struct pt_regs *regs); 311 struct ftrace_ops *ops, struct pt_regs *regs);
322extern int arch_prepare_kprobe_ftrace(struct kprobe *p); 312extern int arch_prepare_kprobe_ftrace(struct kprobe *p);
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 3319a6967626..45c9b6a17bcb 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -16,9 +16,6 @@
16struct stable_node; 16struct stable_node;
17struct mem_cgroup; 17struct mem_cgroup;
18 18
19struct page *ksm_does_need_to_copy(struct page *page,
20 struct vm_area_struct *vma, unsigned long address);
21
22#ifdef CONFIG_KSM 19#ifdef CONFIG_KSM
23int ksm_madvise(struct vm_area_struct *vma, unsigned long start, 20int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end, int advice, unsigned long *vm_flags); 21 unsigned long end, int advice, unsigned long *vm_flags);
@@ -73,15 +70,8 @@ static inline void set_page_stable_node(struct page *page,
73 * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE, 70 * We'd like to make this conditional on vma->vm_flags & VM_MERGEABLE,
74 * but what if the vma was unmerged while the page was swapped out? 71 * but what if the vma was unmerged while the page was swapped out?
75 */ 72 */
76static inline int ksm_might_need_to_copy(struct page *page, 73struct page *ksm_might_need_to_copy(struct page *page,
77 struct vm_area_struct *vma, unsigned long address) 74 struct vm_area_struct *vma, unsigned long address);
78{
79 struct anon_vma *anon_vma = page_anon_vma(page);
80
81 return anon_vma &&
82 (anon_vma->root != vma->anon_vma->root ||
83 page->index != linear_page_index(vma, address));
84}
85 75
86int page_referenced_ksm(struct page *page, 76int page_referenced_ksm(struct page *page,
87 struct mem_cgroup *memcg, unsigned long *vm_flags); 77 struct mem_cgroup *memcg, unsigned long *vm_flags);
@@ -113,10 +103,10 @@ static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
113 return 0; 103 return 0;
114} 104}
115 105
116static inline int ksm_might_need_to_copy(struct page *page, 106static inline struct page *ksm_might_need_to_copy(struct page *page,
117 struct vm_area_struct *vma, unsigned long address) 107 struct vm_area_struct *vma, unsigned long address)
118{ 108{
119 return 0; 109 return page;
120} 110}
121 111
122static inline int page_referenced_ksm(struct page *page, 112static inline int page_referenced_ksm(struct page *page,
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 2c497ab0d03d..cad77fe09d77 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -22,6 +22,7 @@
22#include <linux/rcupdate.h> 22#include <linux/rcupdate.h>
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/irqflags.h>
25#include <asm/signal.h> 26#include <asm/signal.h>
26 27
27#include <linux/kvm.h> 28#include <linux/kvm.h>
@@ -122,6 +123,8 @@ static inline bool is_error_page(struct page *page)
122#define KVM_REQ_WATCHDOG 18 123#define KVM_REQ_WATCHDOG 18
123#define KVM_REQ_MASTERCLOCK_UPDATE 19 124#define KVM_REQ_MASTERCLOCK_UPDATE 19
124#define KVM_REQ_MCLOCK_INPROGRESS 20 125#define KVM_REQ_MCLOCK_INPROGRESS 20
126#define KVM_REQ_EPR_EXIT 21
127#define KVM_REQ_EOIBITMAP 22
125 128
126#define KVM_USERSPACE_IRQ_SOURCE_ID 0 129#define KVM_USERSPACE_IRQ_SOURCE_ID 0
127#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 130#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -266,12 +269,11 @@ static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
266struct kvm_memory_slot { 269struct kvm_memory_slot {
267 gfn_t base_gfn; 270 gfn_t base_gfn;
268 unsigned long npages; 271 unsigned long npages;
269 unsigned long flags;
270 unsigned long *dirty_bitmap; 272 unsigned long *dirty_bitmap;
271 struct kvm_arch_memory_slot arch; 273 struct kvm_arch_memory_slot arch;
272 unsigned long userspace_addr; 274 unsigned long userspace_addr;
273 int user_alloc; 275 u32 flags;
274 int id; 276 short id;
275}; 277};
276 278
277static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) 279static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
@@ -313,8 +315,12 @@ struct kvm_irq_routing_table {};
313 315
314#endif 316#endif
315 317
318#ifndef KVM_PRIVATE_MEM_SLOTS
319#define KVM_PRIVATE_MEM_SLOTS 0
320#endif
321
316#ifndef KVM_MEM_SLOTS_NUM 322#ifndef KVM_MEM_SLOTS_NUM
317#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) 323#define KVM_MEM_SLOTS_NUM (KVM_USER_MEM_SLOTS + KVM_PRIVATE_MEM_SLOTS)
318#endif 324#endif
319 325
320/* 326/*
@@ -326,7 +332,7 @@ struct kvm_memslots {
326 u64 generation; 332 u64 generation;
327 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; 333 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
328 /* The mapping table from slot id to the index in memslots[]. */ 334 /* The mapping table from slot id to the index in memslots[]. */
329 int id_to_index[KVM_MEM_SLOTS_NUM]; 335 short id_to_index[KVM_MEM_SLOTS_NUM];
330}; 336};
331 337
332struct kvm { 338struct kvm {
@@ -424,7 +430,8 @@ void kvm_exit(void);
424 430
425void kvm_get_kvm(struct kvm *kvm); 431void kvm_get_kvm(struct kvm *kvm);
426void kvm_put_kvm(struct kvm *kvm); 432void kvm_put_kvm(struct kvm *kvm);
427void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new); 433void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new,
434 u64 last_generation);
428 435
429static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 436static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
430{ 437{
@@ -447,10 +454,10 @@ id_to_memslot(struct kvm_memslots *slots, int id)
447 454
448int kvm_set_memory_region(struct kvm *kvm, 455int kvm_set_memory_region(struct kvm *kvm,
449 struct kvm_userspace_memory_region *mem, 456 struct kvm_userspace_memory_region *mem,
450 int user_alloc); 457 bool user_alloc);
451int __kvm_set_memory_region(struct kvm *kvm, 458int __kvm_set_memory_region(struct kvm *kvm,
452 struct kvm_userspace_memory_region *mem, 459 struct kvm_userspace_memory_region *mem,
453 int user_alloc); 460 bool user_alloc);
454void kvm_arch_free_memslot(struct kvm_memory_slot *free, 461void kvm_arch_free_memslot(struct kvm_memory_slot *free,
455 struct kvm_memory_slot *dont); 462 struct kvm_memory_slot *dont);
456int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 463int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
@@ -458,11 +465,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
458 struct kvm_memory_slot *memslot, 465 struct kvm_memory_slot *memslot,
459 struct kvm_memory_slot old, 466 struct kvm_memory_slot old,
460 struct kvm_userspace_memory_region *mem, 467 struct kvm_userspace_memory_region *mem,
461 int user_alloc); 468 bool user_alloc);
462void kvm_arch_commit_memory_region(struct kvm *kvm, 469void kvm_arch_commit_memory_region(struct kvm *kvm,
463 struct kvm_userspace_memory_region *mem, 470 struct kvm_userspace_memory_region *mem,
464 struct kvm_memory_slot old, 471 struct kvm_memory_slot old,
465 int user_alloc); 472 bool user_alloc);
466bool kvm_largepages_enabled(void); 473bool kvm_largepages_enabled(void);
467void kvm_disable_largepages(void); 474void kvm_disable_largepages(void);
468/* flush all memory translations */ 475/* flush all memory translations */
@@ -532,6 +539,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
532void kvm_flush_remote_tlbs(struct kvm *kvm); 539void kvm_flush_remote_tlbs(struct kvm *kvm);
533void kvm_reload_remote_mmus(struct kvm *kvm); 540void kvm_reload_remote_mmus(struct kvm *kvm);
534void kvm_make_mclock_inprogress_request(struct kvm *kvm); 541void kvm_make_mclock_inprogress_request(struct kvm *kvm);
542void kvm_make_update_eoibitmap_request(struct kvm *kvm);
535 543
536long kvm_arch_dev_ioctl(struct file *filp, 544long kvm_arch_dev_ioctl(struct file *filp,
537 unsigned int ioctl, unsigned long arg); 545 unsigned int ioctl, unsigned long arg);
@@ -549,7 +557,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
549int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, 557int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
550 struct 558 struct
551 kvm_userspace_memory_region *mem, 559 kvm_userspace_memory_region *mem,
552 int user_alloc); 560 bool user_alloc);
553int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level); 561int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level);
554long kvm_arch_vm_ioctl(struct file *filp, 562long kvm_arch_vm_ioctl(struct file *filp,
555 unsigned int ioctl, unsigned long arg); 563 unsigned int ioctl, unsigned long arg);
@@ -685,6 +693,7 @@ int 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); 693int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
686int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, 694int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
687 int irq_source_id, int level); 695 int irq_source_id, int level);
696bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
688void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); 697void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
689void kvm_register_irq_ack_notifier(struct kvm *kvm, 698void kvm_register_irq_ack_notifier(struct kvm *kvm,
690 struct kvm_irq_ack_notifier *kian); 699 struct kvm_irq_ack_notifier *kian);
@@ -740,15 +749,52 @@ static inline int kvm_deassign_device(struct kvm *kvm,
740} 749}
741#endif /* CONFIG_IOMMU_API */ 750#endif /* CONFIG_IOMMU_API */
742 751
743static inline void kvm_guest_enter(void) 752static inline void __guest_enter(void)
744{ 753{
745 BUG_ON(preemptible());
746 /* 754 /*
747 * This is running in ioctl context so we can avoid 755 * This is running in ioctl context so we can avoid
748 * the call to vtime_account() with its unnecessary idle check. 756 * the call to vtime_account() with its unnecessary idle check.
749 */ 757 */
750 vtime_account_system_irqsafe(current); 758 vtime_account_system(current);
751 current->flags |= PF_VCPU; 759 current->flags |= PF_VCPU;
760}
761
762static inline void __guest_exit(void)
763{
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(current);
769 current->flags &= ~PF_VCPU;
770}
771
772#ifdef CONFIG_CONTEXT_TRACKING
773extern void guest_enter(void);
774extern void guest_exit(void);
775
776#else /* !CONFIG_CONTEXT_TRACKING */
777static inline void guest_enter(void)
778{
779 __guest_enter();
780}
781
782static inline void guest_exit(void)
783{
784 __guest_exit();
785}
786#endif /* !CONFIG_CONTEXT_TRACKING */
787
788static inline void kvm_guest_enter(void)
789{
790 unsigned long flags;
791
792 BUG_ON(preemptible());
793
794 local_irq_save(flags);
795 guest_enter();
796 local_irq_restore(flags);
797
752 /* KVM does not hold any references to rcu protected data when it 798 /* KVM does not hold any references to rcu protected data when it
753 * switches CPU into a guest mode. In fact switching to a guest mode 799 * switches CPU into a guest mode. In fact switching to a guest mode
754 * is very similar to exiting to userspase from rcu point of view. In 800 * is very similar to exiting to userspase from rcu point of view. In
@@ -761,12 +807,11 @@ static inline void kvm_guest_enter(void)
761 807
762static inline void kvm_guest_exit(void) 808static inline void kvm_guest_exit(void)
763{ 809{
764 /* 810 unsigned long flags;
765 * This is running in ioctl context so we can avoid 811
766 * the call to vtime_account() with its unnecessary idle check. 812 local_irq_save(flags);
767 */ 813 guest_exit();
768 vtime_account_system_irqsafe(current); 814 local_irq_restore(flags);
769 current->flags &= ~PF_VCPU;
770} 815}
771 816
772/* 817/*
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
deleted file mode 100644
index 3f071ec019b2..000000000000
--- a/include/linux/leds-lp5521.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * LP5521 LED chip driver.
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5521_H
24#define __LINUX_LP5521_H
25
26/* See Documentation/leds/leds-lp5521.txt */
27
28struct lp5521_led_config {
29 char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35struct lp5521_led_pattern {
36 u8 *r;
37 u8 *g;
38 u8 *b;
39 u8 size_r;
40 u8 size_g;
41 u8 size_b;
42};
43
44#define LP5521_CLOCK_AUTO 0
45#define LP5521_CLOCK_INT 1
46#define LP5521_CLOCK_EXT 2
47
48/* Bits in CONFIG register */
49#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
50#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
51#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
52#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
53#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
54#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
55#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
56#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
57#define LP5521_CLK_INT 1 /* Internal clock */
58#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
59
60struct lp5521_platform_data {
61 struct lp5521_led_config *led_config;
62 u8 num_channels;
63 u8 clock_mode;
64 int (*setup_resources)(void);
65 void (*release_resources)(void);
66 void (*enable)(bool state);
67 const char *label;
68 u8 update_config;
69 struct lp5521_led_pattern *patterns;
70 int num_patterns;
71};
72
73#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
deleted file mode 100644
index 727877fb406d..000000000000
--- a/include/linux/leds-lp5523.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * LP5523 LED Driver
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5523_H
24#define __LINUX_LP5523_H
25
26/* See Documentation/leds/leds-lp5523.txt */
27
28struct lp5523_led_config {
29 const char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35#define LP5523_CLOCK_AUTO 0
36#define LP5523_CLOCK_INT 1
37#define LP5523_CLOCK_EXT 2
38
39struct lp5523_platform_data {
40 struct lp5523_led_config *led_config;
41 u8 num_channels;
42 u8 clock_mode;
43 int (*setup_resources)(void);
44 void (*release_resources)(void);
45 void (*enable)(bool state);
46 const char *label;
47};
48
49#endif /* __LINUX_LP5523_H */
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
index 33a071167489..a65e9646e4b1 100644
--- a/include/linux/leds_pwm.h
+++ b/include/linux/leds_pwm.h
@@ -7,7 +7,7 @@
7struct led_pwm { 7struct led_pwm {
8 const char *name; 8 const char *name;
9 const char *default_trigger; 9 const char *default_trigger;
10 unsigned pwm_id; 10 unsigned pwm_id __deprecated;
11 u8 active_low; 11 u8 active_low;
12 unsigned max_brightness; 12 unsigned max_brightness;
13 unsigned pwm_period_ns; 13 unsigned pwm_period_ns;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 83ba0ab2c915..91c9d109e5f1 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -620,6 +620,9 @@ struct ata_device {
620 union acpi_object *gtf_cache; 620 union acpi_object *gtf_cache;
621 unsigned int gtf_filter; 621 unsigned int gtf_filter;
622#endif 622#endif
623#ifdef CONFIG_SATA_ZPODD
624 void *zpodd;
625#endif
623 struct device tdev; 626 struct device tdev;
624 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */ 627 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
625 u64 n_sectors; /* size of device, if ATA */ 628 u64 n_sectors; /* size of device, if ATA */
@@ -652,8 +655,8 @@ struct ata_device {
652 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 655 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
653 }; 656 };
654 657
655 /* Identify Device Data Log (30h), SATA Settings (page 08h) */ 658 /* DEVSLP Timing Variables from Identify Device Data Log */
656 u8 sata_settings[ATA_SECT_SIZE]; 659 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
657 660
658 /* error history */ 661 /* error history */
659 int spdn_cnt; 662 int spdn_cnt;
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index 79603a6c356f..4ad06e824f76 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -36,7 +36,7 @@ struct ps2dev {
36 wait_queue_head_t wait; 36 wait_queue_head_t wait;
37 37
38 unsigned long flags; 38 unsigned long flags;
39 unsigned char cmdbuf[6]; 39 unsigned char cmdbuf[8];
40 unsigned char cmdcnt; 40 unsigned char cmdcnt;
41 unsigned char nak; 41 unsigned char nak;
42}; 42};
diff --git a/include/linux/list.h b/include/linux/list.h
index cc6d2aa6b415..d991cc147c98 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -666,54 +666,49 @@ static inline void hlist_move_list(struct hlist_head *old,
666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
667 pos = n) 667 pos = n)
668 668
669#define hlist_entry_safe(ptr, type, member) \
670 (ptr) ? hlist_entry(ptr, type, member) : NULL
671
669/** 672/**
670 * hlist_for_each_entry - iterate over list of given type 673 * hlist_for_each_entry - iterate over list of given type
671 * @tpos: the type * to use as a loop cursor. 674 * @pos: the type * to use as a loop cursor.
672 * @pos: the &struct hlist_node to use as a loop cursor.
673 * @head: the head for your list. 675 * @head: the head for your list.
674 * @member: the name of the hlist_node within the struct. 676 * @member: the name of the hlist_node within the struct.
675 */ 677 */
676#define hlist_for_each_entry(tpos, pos, head, member) \ 678#define hlist_for_each_entry(pos, head, member) \
677 for (pos = (head)->first; \ 679 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
678 pos && \ 680 pos; \
679 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 681 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
680 pos = pos->next)
681 682
682/** 683/**
683 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point 684 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
684 * @tpos: the type * to use as a loop cursor. 685 * @pos: the type * to use as a loop cursor.
685 * @pos: the &struct hlist_node to use as a loop cursor.
686 * @member: the name of the hlist_node within the struct. 686 * @member: the name of the hlist_node within the struct.
687 */ 687 */
688#define hlist_for_each_entry_continue(tpos, pos, member) \ 688#define hlist_for_each_entry_continue(pos, member) \
689 for (pos = (pos)->next; \ 689 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
690 pos && \ 690 pos; \
691 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 691 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
692 pos = pos->next)
693 692
694/** 693/**
695 * hlist_for_each_entry_from - iterate over a hlist continuing from current point 694 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
696 * @tpos: the type * to use as a loop cursor. 695 * @pos: the type * to use as a loop cursor.
697 * @pos: the &struct hlist_node to use as a loop cursor.
698 * @member: the name of the hlist_node within the struct. 696 * @member: the name of the hlist_node within the struct.
699 */ 697 */
700#define hlist_for_each_entry_from(tpos, pos, member) \ 698#define hlist_for_each_entry_from(pos, member) \
701 for (; pos && \ 699 for (; pos; \
702 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 700 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
703 pos = pos->next)
704 701
705/** 702/**
706 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 703 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
707 * @tpos: the type * to use as a loop cursor. 704 * @pos: the type * to use as a loop cursor.
708 * @pos: the &struct hlist_node to use as a loop cursor.
709 * @n: another &struct hlist_node to use as temporary storage 705 * @n: another &struct hlist_node to use as temporary storage
710 * @head: the head for your list. 706 * @head: the head for your list.
711 * @member: the name of the hlist_node within the struct. 707 * @member: the name of the hlist_node within the struct.
712 */ 708 */
713#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ 709#define hlist_for_each_entry_safe(pos, n, head, member) \
714 for (pos = (head)->first; \ 710 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
715 pos && ({ n = pos->next; 1; }) && \ 711 pos && ({ n = pos->member.next; 1; }); \
716 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 712 pos = hlist_entry_safe(n, typeof(*pos), member))
717 pos = n)
718 713
719#endif 714#endif
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index f5a051a79273..dcaad79f54ed 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -212,7 +212,8 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
212__be32 nlmclnt_grant(const struct sockaddr *addr, 212__be32 nlmclnt_grant(const struct sockaddr *addr,
213 const struct nlm_lock *lock); 213 const struct nlm_lock *lock);
214void nlmclnt_recovery(struct nlm_host *); 214void nlmclnt_recovery(struct nlm_host *);
215int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 215int nlmclnt_reclaim(struct nlm_host *, struct file_lock *,
216 struct nlm_rqst *);
216void nlmclnt_next_cookie(struct nlm_cookie *); 217void nlmclnt_next_cookie(struct nlm_cookie *);
217 218
218/* 219/*
@@ -291,7 +292,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
291 292
292static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) 293static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
293{ 294{
294 return file->f_file->f_path.dentry->d_inode; 295 return file_inode(file->f_file);
295} 296}
296 297
297static inline int __nlm_privileged_request4(const struct sockaddr *sap) 298static inline int __nlm_privileged_request4(const struct sockaddr *sap)
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 00e46376e28f..f1e877b79ed8 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -359,7 +359,9 @@ extern void lockdep_trace_alloc(gfp_t mask);
359 359
360#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 360#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
361 361
362#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) 362#define lockdep_assert_held(l) do { \
363 WARN_ON(debug_locks && !lockdep_is_held(l)); \
364 } while (0)
363 365
364#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) 366#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
365 367
@@ -410,7 +412,7 @@ struct lock_class_key { };
410 412
411#define lockdep_depth(tsk) (0) 413#define lockdep_depth(tsk) (0)
412 414
413#define lockdep_assert_held(l) do { } while (0) 415#define lockdep_assert_held(l) do { (void)(l); } while (0)
414 416
415#define lockdep_recursing(tsk) (0) 417#define lockdep_recursing(tsk) (0)
416 418
@@ -524,14 +526,17 @@ static inline void print_irqtrace_events(struct task_struct *curr)
524#ifdef CONFIG_DEBUG_LOCK_ALLOC 526#ifdef CONFIG_DEBUG_LOCK_ALLOC
525# ifdef CONFIG_PROVE_LOCKING 527# ifdef CONFIG_PROVE_LOCKING
526# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 528# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
529# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
527# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) 530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i)
528# else 531# else
529# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) 532# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
533# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i) 534# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
531# endif 535# endif
532# define rwsem_release(l, n, i) lock_release(l, n, i) 536# define rwsem_release(l, n, i) lock_release(l, n, i)
533#else 537#else
534# define rwsem_acquire(l, s, t, i) do { } while (0) 538# define rwsem_acquire(l, s, t, i) do { } while (0)
539# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0)
535# define rwsem_acquire_read(l, s, t, i) do { } while (0) 540# define rwsem_acquire_read(l, s, t, i) do { } while (0)
536# define rwsem_release(l, n, i) do { } while (0) 541# define rwsem_release(l, n, i) do { } while (0)
537#endif 542#endif
diff --git a/include/linux/lzo.h b/include/linux/lzo.h
index d793497ec1ca..a0848d9377e5 100644
--- a/include/linux/lzo.h
+++ b/include/linux/lzo.h
@@ -4,28 +4,28 @@
4 * LZO Public Kernel Interface 4 * LZO Public Kernel Interface
5 * A mini subset of the LZO real-time data compression library 5 * A mini subset of the LZO real-time data compression library
6 * 6 *
7 * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com> 7 * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
8 * 8 *
9 * The full LZO package can be found at: 9 * The full LZO package can be found at:
10 * http://www.oberhumer.com/opensource/lzo/ 10 * http://www.oberhumer.com/opensource/lzo/
11 * 11 *
12 * Changed for kernel use by: 12 * Changed for Linux kernel use by:
13 * Nitin Gupta <nitingupta910@gmail.com> 13 * Nitin Gupta <nitingupta910@gmail.com>
14 * Richard Purdie <rpurdie@openedhand.com> 14 * Richard Purdie <rpurdie@openedhand.com>
15 */ 15 */
16 16
17#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *)) 17#define LZO1X_1_MEM_COMPRESS (8192 * sizeof(unsigned short))
18#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS 18#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
19 19
20#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3) 20#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
21 21
22/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */ 22/* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */
23int lzo1x_1_compress(const unsigned char *src, size_t src_len, 23int lzo1x_1_compress(const unsigned char *src, size_t src_len,
24 unsigned char *dst, size_t *dst_len, void *wrkmem); 24 unsigned char *dst, size_t *dst_len, void *wrkmem);
25 25
26/* safe decompression with overrun testing */ 26/* safe decompression with overrun testing */
27int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, 27int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
28 unsigned char *dst, size_t *dst_len); 28 unsigned char *dst, size_t *dst_len);
29 29
30/* 30/*
31 * Return values (< 0 = Error) 31 * Return values (< 0 = Error)
@@ -40,5 +40,6 @@ int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
40#define LZO_E_EOF_NOT_FOUND (-7) 40#define LZO_E_EOF_NOT_FOUND (-7)
41#define LZO_E_INPUT_NOT_CONSUMED (-8) 41#define LZO_E_INPUT_NOT_CONSUMED (-8)
42#define LZO_E_NOT_YET_IMPLEMENTED (-9) 42#define LZO_E_NOT_YET_IMPLEMENTED (-9)
43#define LZO_E_INVALID_ARGUMENT (-10)
43 44
44#endif 45#endif
diff --git a/include/linux/mailbox.h b/include/linux/mailbox.h
new file mode 100644
index 000000000000..5161f63ec1c8
--- /dev/null
+++ b/include/linux/mailbox.h
@@ -0,0 +1,17 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms and conditions of the GNU General Public License,
4 * version 2, as published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope it will be useful, but WITHOUT
7 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * more details.
10 *
11 * You should have received a copy of the GNU General Public License along with
12 * this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14
15int pl320_ipc_transmit(u32 *data);
16int pl320_ipc_register_notifier(struct notifier_block *nb);
17int pl320_ipc_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index d452ee191066..f388203db7e8 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -155,6 +155,7 @@ phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
155phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, 155phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
156 phys_addr_t max_addr); 156 phys_addr_t max_addr);
157phys_addr_t memblock_phys_mem_size(void); 157phys_addr_t memblock_phys_mem_size(void);
158phys_addr_t memblock_mem_size(unsigned long limit_pfn);
158phys_addr_t memblock_start_of_DRAM(void); 159phys_addr_t memblock_start_of_DRAM(void);
159phys_addr_t memblock_end_of_DRAM(void); 160phys_addr_t memblock_end_of_DRAM(void);
160void memblock_enforce_memory_limit(phys_addr_t memory_limit); 161void memblock_enforce_memory_limit(phys_addr_t memory_limit);
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0108a56f814e..d6183f06d8c1 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -116,7 +116,6 @@ void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
116 * For memory reclaim. 116 * For memory reclaim.
117 */ 117 */
118int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec); 118int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec);
119int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec);
120int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 119int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
121unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list); 120unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list);
122void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int); 121void mem_cgroup_update_lru_size(struct lruvec *, enum lru_list, int);
@@ -321,12 +320,6 @@ mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
321 return 1; 320 return 1;
322} 321}
323 322
324static inline int
325mem_cgroup_inactive_file_is_low(struct lruvec *lruvec)
326{
327 return 1;
328}
329
330static inline unsigned long 323static inline unsigned long
331mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru) 324mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
332{ 325{
@@ -429,7 +422,7 @@ extern int memcg_limited_groups_array_size;
429 * the slab_mutex must be held when looping through those caches 422 * the slab_mutex must be held when looping through those caches
430 */ 423 */
431#define for_each_memcg_cache_index(_idx) \ 424#define for_each_memcg_cache_index(_idx) \
432 for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++) 425 for ((_idx) = 0; (_idx) < memcg_limited_groups_array_size; (_idx)++)
433 426
434static inline bool memcg_kmem_enabled(void) 427static inline bool memcg_kmem_enabled(void)
435{ 428{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 4a45c4e50025..b6a3be7d47bf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -96,6 +96,7 @@ extern void __online_page_free(struct page *page);
96 96
97#ifdef CONFIG_MEMORY_HOTREMOVE 97#ifdef CONFIG_MEMORY_HOTREMOVE
98extern bool is_pageblock_removable_nolock(struct page *page); 98extern bool is_pageblock_removable_nolock(struct page *page);
99extern int arch_remove_memory(u64 start, u64 size);
99#endif /* CONFIG_MEMORY_HOTREMOVE */ 100#endif /* CONFIG_MEMORY_HOTREMOVE */
100 101
101/* reasonably generic interface to expand the physical pages in a zone */ 102/* reasonably generic interface to expand the physical pages in a zone */
@@ -173,17 +174,16 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
173#endif /* CONFIG_NUMA */ 174#endif /* CONFIG_NUMA */
174#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ 175#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
175 176
176#ifdef CONFIG_SPARSEMEM_VMEMMAP 177#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
178extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
179#else
177static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) 180static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
178{ 181{
179} 182}
180static inline void put_page_bootmem(struct page *page)
181{
182}
183#else
184extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
185extern void put_page_bootmem(struct page *page);
186#endif 183#endif
184extern void put_page_bootmem(struct page *page);
185extern void get_page_bootmem(unsigned long ingo, struct page *page,
186 unsigned long type);
187 187
188/* 188/*
189 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug 189 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug
@@ -233,6 +233,7 @@ static inline void unlock_memory_hotplug(void) {}
233#ifdef CONFIG_MEMORY_HOTREMOVE 233#ifdef CONFIG_MEMORY_HOTREMOVE
234 234
235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236extern void try_offline_node(int nid);
236 237
237#else 238#else
238static inline int is_mem_section_removable(unsigned long pfn, 239static inline int is_mem_section_removable(unsigned long pfn,
@@ -240,6 +241,8 @@ static inline int is_mem_section_removable(unsigned long pfn,
240{ 241{
241 return 0; 242 return 0;
242} 243}
244
245static inline void try_offline_node(int nid) {}
243#endif /* CONFIG_MEMORY_HOTREMOVE */ 246#endif /* CONFIG_MEMORY_HOTREMOVE */
244 247
245extern int mem_online_node(int nid); 248extern int mem_online_node(int nid);
@@ -247,7 +250,8 @@ extern int add_memory(int nid, u64 start, u64 size);
247extern int arch_add_memory(int nid, u64 start, u64 size); 250extern int arch_add_memory(int nid, u64 start, u64 size);
248extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 251extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
249extern int offline_memory_block(struct memory_block *mem); 252extern int offline_memory_block(struct memory_block *mem);
250extern int remove_memory(u64 start, u64 size); 253extern bool is_memblock_offlined(struct memory_block *mem);
254extern int remove_memory(int nid, u64 start, u64 size);
251extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 255extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
252 int nr_pages); 256 int nr_pages);
253extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 257extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index 478672ed0c3d..e94537befabd 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -365,5 +365,5 @@ static inline int pm80x_dev_resume(struct device *dev)
365 365
366extern int pm80x_init(struct i2c_client *client, 366extern int pm80x_init(struct i2c_client *client,
367 const struct i2c_device_id *id); 367 const struct i2c_device_id *id);
368extern int pm80x_deinit(struct i2c_client *client); 368extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 369#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 2138bd33021a..9ead60bc66b7 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -131,7 +131,7 @@ struct abx500_maxim_parameters {
131 * @nominal_voltage: Nominal voltage of the battery in mV 131 * @nominal_voltage: Nominal voltage of the battery in mV
132 * @termination_vol: max voltage upto which battery can be charged 132 * @termination_vol: max voltage upto which battery can be charged
133 * @termination_curr battery charging termination current in mA 133 * @termination_curr battery charging termination current in mA
134 * @recharge_vol battery voltage limit that will trigger a new 134 * @recharge_cap battery capacity limit that will trigger a new
135 * full charging cycle in the case where maintenan- 135 * full charging cycle in the case where maintenan-
136 * -ce charging has been disabled 136 * -ce charging has been disabled
137 * @normal_cur_lvl: charger current in normal state in mA 137 * @normal_cur_lvl: charger current in normal state in mA
@@ -160,7 +160,7 @@ struct abx500_battery_type {
160 int nominal_voltage; 160 int nominal_voltage;
161 int termination_vol; 161 int termination_vol;
162 int termination_curr; 162 int termination_curr;
163 int recharge_vol; 163 int recharge_cap;
164 int normal_cur_lvl; 164 int normal_cur_lvl;
165 int normal_vol_lvl; 165 int normal_vol_lvl;
166 int maint_a_cur_lvl; 166 int maint_a_cur_lvl;
@@ -224,6 +224,7 @@ struct abx500_bm_charger_parameters {
224 * @bkup_bat_v voltage which we charge the backup battery with 224 * @bkup_bat_v voltage which we charge the backup battery with
225 * @bkup_bat_i current which we charge the backup battery with 225 * @bkup_bat_i current which we charge the backup battery with
226 * @no_maintenance indicates that maintenance charging is disabled 226 * @no_maintenance indicates that maintenance charging is disabled
227 * @capacity_scaling indicates whether capacity scaling is to be used
227 * @abx500_adc_therm placement of thermistor, batctrl or battemp adc 228 * @abx500_adc_therm placement of thermistor, batctrl or battemp adc
228 * @chg_unknown_bat flag to enable charging of unknown batteries 229 * @chg_unknown_bat flag to enable charging of unknown batteries
229 * @enable_overshoot flag to enable VBAT overshoot control 230 * @enable_overshoot flag to enable VBAT overshoot control
@@ -253,7 +254,11 @@ struct abx500_bm_data {
253 int usb_safety_tmr_h; 254 int usb_safety_tmr_h;
254 int bkup_bat_v; 255 int bkup_bat_v;
255 int bkup_bat_i; 256 int bkup_bat_i;
257 bool autopower_cfg;
258 bool ac_enabled;
259 bool usb_enabled;
256 bool no_maintenance; 260 bool no_maintenance;
261 bool capacity_scaling;
257 bool chg_unknown_bat; 262 bool chg_unknown_bat;
258 bool enable_overshoot; 263 bool enable_overshoot;
259 bool auto_trig; 264 bool auto_trig;
@@ -272,16 +277,14 @@ struct abx500_bm_data {
272 const struct abx500_fg_parameters *fg_params; 277 const struct abx500_fg_parameters *fg_params;
273}; 278};
274 279
275extern struct abx500_bm_data ab8500_bm_data;
276
277enum { 280enum {
278 NTC_EXTERNAL = 0, 281 NTC_EXTERNAL = 0,
279 NTC_INTERNAL, 282 NTC_INTERNAL,
280}; 283};
281 284
282int bmdevs_of_probe(struct device *dev, 285int ab8500_bm_of_probe(struct device *dev,
283 struct device_node *np, 286 struct device_node *np,
284 struct abx500_bm_data **battery); 287 struct abx500_bm_data *bm);
285 288
286int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, 289int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
287 u8 value); 290 u8 value);
@@ -308,6 +311,7 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
308int abx500_get_chip_id(struct device *dev); 311int abx500_get_chip_id(struct device *dev);
309int abx500_event_registers_startup_state_get(struct device *dev, u8 *event); 312int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
310int abx500_startup_irq_enabled(struct device *dev, unsigned int irq); 313int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
314void abx500_dump_all_banks(void);
311 315
312struct abx500_ops { 316struct abx500_ops {
313 int (*get_chip_id) (struct device *); 317 int (*get_chip_id) (struct device *);
@@ -318,6 +322,7 @@ struct abx500_ops {
318 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8); 322 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8);
319 int (*event_registers_startup_state_get) (struct device *, u8 *); 323 int (*event_registers_startup_state_get) (struct device *, u8 *);
320 int (*startup_irq_enabled) (struct device *, unsigned int); 324 int (*startup_irq_enabled) (struct device *, unsigned int);
325 void (*dump_all_banks) (struct device *);
321}; 326};
322 327
323int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops); 328int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 44310c98ee6e..8d35bfe164c8 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -23,6 +23,7 @@
23 * Bank : 0x5 23 * Bank : 0x5
24 */ 24 */
25#define AB8500_USB_LINE_STAT_REG 0x80 25#define AB8500_USB_LINE_STAT_REG 0x80
26#define AB8500_USB_LINK1_STAT_REG 0x94
26 27
27/* 28/*
28 * Charger / status register offfsets 29 * Charger / status register offfsets
@@ -225,6 +226,8 @@
225/* BatCtrl Current Source Constants */ 226/* BatCtrl Current Source Constants */
226#define BAT_CTRL_7U_ENA 0x01 227#define BAT_CTRL_7U_ENA 0x01
227#define BAT_CTRL_20U_ENA 0x02 228#define BAT_CTRL_20U_ENA 0x02
229#define BAT_CTRL_18U_ENA 0x01
230#define BAT_CTRL_16U_ENA 0x02
228#define BAT_CTRL_CMP_ENA 0x04 231#define BAT_CTRL_CMP_ENA 0x04
229#define FORCE_BAT_CTRL_CMP_HIGH 0x08 232#define FORCE_BAT_CTRL_CMP_HIGH 0x08
230#define BAT_CTRL_PULL_UP_ENA 0x10 233#define BAT_CTRL_PULL_UP_ENA 0x10
@@ -355,6 +358,7 @@ struct ab8500_bm_charger_parameters {
355 * @bkup_bat_v voltage which we charge the backup battery with 358 * @bkup_bat_v voltage which we charge the backup battery with
356 * @bkup_bat_i current which we charge the backup battery with 359 * @bkup_bat_i current which we charge the backup battery with
357 * @no_maintenance indicates that maintenance charging is disabled 360 * @no_maintenance indicates that maintenance charging is disabled
361 * @capacity_scaling indicates whether capacity scaling is to be used
358 * @adc_therm placement of thermistor, batctrl or battemp adc 362 * @adc_therm placement of thermistor, batctrl or battemp adc
359 * @chg_unknown_bat flag to enable charging of unknown batteries 363 * @chg_unknown_bat flag to enable charging of unknown batteries
360 * @enable_overshoot flag to enable VBAT overshoot control 364 * @enable_overshoot flag to enable VBAT overshoot control
@@ -383,6 +387,7 @@ struct ab8500_bm_data {
383 int bkup_bat_v; 387 int bkup_bat_v;
384 int bkup_bat_i; 388 int bkup_bat_i;
385 bool no_maintenance; 389 bool no_maintenance;
390 bool capacity_scaling;
386 bool chg_unknown_bat; 391 bool chg_unknown_bat;
387 bool enable_overshoot; 392 bool enable_overshoot;
388 enum abx500_adc_therm adc_therm; 393 enum abx500_adc_therm adc_therm;
@@ -399,30 +404,13 @@ struct ab8500_bm_data {
399 const struct ab8500_fg_parameters *fg_params; 404 const struct ab8500_fg_parameters *fg_params;
400}; 405};
401 406
402struct ab8500_charger_platform_data {
403 char **supplied_to;
404 size_t num_supplicants;
405 bool autopower_cfg;
406};
407
408struct ab8500_btemp_platform_data {
409 char **supplied_to;
410 size_t num_supplicants;
411};
412
413struct ab8500_fg_platform_data {
414 char **supplied_to;
415 size_t num_supplicants;
416};
417
418struct ab8500_chargalg_platform_data {
419 char **supplied_to;
420 size_t num_supplicants;
421};
422struct ab8500_btemp; 407struct ab8500_btemp;
423struct ab8500_gpadc; 408struct ab8500_gpadc;
424struct ab8500_fg; 409struct ab8500_fg;
410
425#ifdef CONFIG_AB8500_BM 411#ifdef CONFIG_AB8500_BM
412extern struct abx500_bm_data ab8500_bm_data;
413
426void ab8500_fg_reinit(void); 414void ab8500_fg_reinit(void);
427void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); 415void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
428struct ab8500_btemp *ab8500_btemp_get(void); 416struct ab8500_btemp *ab8500_btemp_get(void);
@@ -431,44 +419,10 @@ struct ab8500_fg *ab8500_fg_get(void);
431int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev); 419int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);
432int ab8500_fg_inst_curr_start(struct ab8500_fg *di); 420int ab8500_fg_inst_curr_start(struct ab8500_fg *di);
433int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res); 421int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
422int ab8500_fg_inst_curr_started(struct ab8500_fg *di);
434int ab8500_fg_inst_curr_done(struct ab8500_fg *di); 423int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
435 424
436#else 425#else
437int ab8500_fg_inst_curr_done(struct ab8500_fg *di) 426static struct abx500_bm_data ab8500_bm_data;
438{
439}
440static void ab8500_fg_reinit(void)
441{
442}
443static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA)
444{
445}
446static struct ab8500_btemp *ab8500_btemp_get(void)
447{
448 return NULL;
449}
450static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
451{
452 return 0;
453}
454struct ab8500_fg *ab8500_fg_get(void)
455{
456 return NULL;
457}
458static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev)
459{
460 return -ENODEV;
461}
462
463static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
464{
465 return -ENODEV;
466}
467
468static inline int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res)
469{
470 return -ENODEV;
471}
472
473#endif 427#endif
474#endif /* _AB8500_BM_H */ 428#endif /* _AB8500_BM_H */
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 2387c207ea86..172b2f201ae0 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -14,10 +14,20 @@
14 * registers. 14 * registers.
15 */ 15 */
16 16
17struct ab8500_gpio_platform_data { 17struct abx500_gpio_platform_data {
18 int gpio_base; 18 int gpio_base;
19 u32 irq_base; 19};
20 u8 config_reg[8]; 20
21enum abx500_gpio_pull_updown {
22 ABX500_GPIO_PULL_DOWN = 0x0,
23 ABX500_GPIO_PULL_NONE = 0x1,
24 ABX500_GPIO_PULL_UP = 0x3,
25};
26
27enum abx500_gpio_vinsel {
28 ABX500_GPIO_VINSEL_VBAT = 0x0,
29 ABX500_GPIO_VINSEL_VIN_1V8 = 0x1,
30 ABX500_GPIO_VINSEL_VDD_BIF = 0x2,
21}; 31};
22 32
23#endif /* _AB8500_GPIO_H */ 33#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10eb50973c39..ebf12e793db9 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -37,6 +37,11 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
37 return ab8500_sysctrl_write(reg, bits, 0); 37 return ab8500_sysctrl_write(reg, bits, 0);
38} 38}
39 39
40/* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */
41struct ab8500_sysctrl_platform_data {
42 u8 initial_req_buf_config[8];
43};
44
40/* Registers */ 45/* Registers */
41#define AB8500_TURNONSTATUS 0x100 46#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101 47#define AB8500_RESETSTATUS 0x101
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 1cb5698b4d76..9db0bda446a0 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -24,7 +24,7 @@ enum ab8500_version {
24 AB8500_VERSION_AB8500 = 0x0, 24 AB8500_VERSION_AB8500 = 0x0,
25 AB8500_VERSION_AB8505 = 0x1, 25 AB8500_VERSION_AB8505 = 0x1,
26 AB8500_VERSION_AB9540 = 0x2, 26 AB8500_VERSION_AB9540 = 0x2,
27 AB8500_VERSION_AB8540 = 0x3, 27 AB8500_VERSION_AB8540 = 0x4,
28 AB8500_VERSION_UNDEFINED, 28 AB8500_VERSION_UNDEFINED,
29}; 29};
30 30
@@ -32,6 +32,7 @@ enum ab8500_version {
32#define AB8500_CUTEARLY 0x00 32#define AB8500_CUTEARLY 0x00
33#define AB8500_CUT1P0 0x10 33#define AB8500_CUT1P0 0x10
34#define AB8500_CUT1P1 0x11 34#define AB8500_CUT1P1 0x11
35#define AB8500_CUT1P2 0x12 /* Only valid for AB8540 */
35#define AB8500_CUT2P0 0x20 36#define AB8500_CUT2P0 0x20
36#define AB8500_CUT3P0 0x30 37#define AB8500_CUT3P0 0x30
37#define AB8500_CUT3P3 0x33 38#define AB8500_CUT3P3 0x33
@@ -39,6 +40,7 @@ enum ab8500_version {
39/* 40/*
40 * AB8500 bank addresses 41 * AB8500 bank addresses
41 */ 42 */
43#define AB8500_M_FSM_RANK 0x0
42#define AB8500_SYS_CTRL1_BLOCK 0x1 44#define AB8500_SYS_CTRL1_BLOCK 0x1
43#define AB8500_SYS_CTRL2_BLOCK 0x2 45#define AB8500_SYS_CTRL2_BLOCK 0x2
44#define AB8500_REGU_CTRL1 0x3 46#define AB8500_REGU_CTRL1 0x3
@@ -58,6 +60,7 @@ enum ab8500_version {
58#define AB8500_DEVELOPMENT 0x11 60#define AB8500_DEVELOPMENT 0x11
59#define AB8500_DEBUG 0x12 61#define AB8500_DEBUG 0x12
60#define AB8500_PROD_TEST 0x13 62#define AB8500_PROD_TEST 0x13
63#define AB8500_STE_TEST 0x14
61#define AB8500_OTP_EMUL 0x15 64#define AB8500_OTP_EMUL 0x15
62 65
63/* 66/*
@@ -65,11 +68,11 @@ enum ab8500_version {
65 * Values used to index into array ab8500_irq_regoffset[] defined in 68 * Values used to index into array ab8500_irq_regoffset[] defined in
66 * drivers/mdf/ab8500-core.c 69 * drivers/mdf/ab8500-core.c
67 */ 70 */
68/* Definitions for AB8500 and AB9540 */ 71/* Definitions for AB8500, AB9540 and AB8540 */
69/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */ 72/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
70#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */ 73#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
71#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */ 74#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540/8540 */
72#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */ 75#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540/8540 */
73#define AB8500_INT_TEMP_WARM 3 76#define AB8500_INT_TEMP_WARM 3
74#define AB8500_INT_PON_KEY2DB_F 4 77#define AB8500_INT_PON_KEY2DB_F 4
75#define AB8500_INT_PON_KEY2DB_R 5 78#define AB8500_INT_PON_KEY2DB_R 5
@@ -77,18 +80,19 @@ enum ab8500_version {
77#define AB8500_INT_PON_KEY1DB_R 7 80#define AB8500_INT_PON_KEY1DB_R 7
78/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */ 81/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
79#define AB8500_INT_BATT_OVV 8 82#define AB8500_INT_BATT_OVV 8
80#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */ 83#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505/8540 */
81#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */ 84#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505/8540 */
82#define AB8500_INT_VBUS_DET_F 14 85#define AB8500_INT_VBUS_DET_F 14
83#define AB8500_INT_VBUS_DET_R 15 86#define AB8500_INT_VBUS_DET_R 15
84/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */ 87/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
85#define AB8500_INT_VBUS_CH_DROP_END 16 88#define AB8500_INT_VBUS_CH_DROP_END 16
86#define AB8500_INT_RTC_60S 17 89#define AB8500_INT_RTC_60S 17
87#define AB8500_INT_RTC_ALARM 18 90#define AB8500_INT_RTC_ALARM 18
91#define AB8540_INT_BIF_INT 19
88#define AB8500_INT_BAT_CTRL_INDB 20 92#define AB8500_INT_BAT_CTRL_INDB 20
89#define AB8500_INT_CH_WD_EXP 21 93#define AB8500_INT_CH_WD_EXP 21
90#define AB8500_INT_VBUS_OVV 22 94#define AB8500_INT_VBUS_OVV 22
91#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */ 95#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540/8540 */
92/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */ 96/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
93#define AB8500_INT_CCN_CONV_ACC 24 97#define AB8500_INT_CCN_CONV_ACC 24
94#define AB8500_INT_INT_AUD 25 98#define AB8500_INT_INT_AUD 25
@@ -99,7 +103,7 @@ enum ab8500_version {
99#define AB8500_INT_BUP_CHG_NOT_OK 30 103#define AB8500_INT_BUP_CHG_NOT_OK 30
100#define AB8500_INT_BUP_CHG_OK 31 104#define AB8500_INT_BUP_CHG_OK 31
101/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */ 105/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
102#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */ 106#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505/8540 */
103#define AB8500_INT_ACC_DETECT_1DB_F 33 107#define AB8500_INT_ACC_DETECT_1DB_F 33
104#define AB8500_INT_ACC_DETECT_1DB_R 34 108#define AB8500_INT_ACC_DETECT_1DB_R 34
105#define AB8500_INT_ACC_DETECT_22DB_F 35 109#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -108,23 +112,23 @@ enum ab8500_version {
108#define AB8500_INT_ACC_DETECT_21DB_R 38 112#define AB8500_INT_ACC_DETECT_21DB_R 38
109#define AB8500_INT_GP_SW_ADC_CONV_END 39 113#define AB8500_INT_GP_SW_ADC_CONV_END 39
110/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */ 114/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
111#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */ 115#define AB8500_INT_GPIO6R 40 /* not 8505/9540/8540 */
112#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */ 116#define AB8500_INT_GPIO7R 41 /* not 8505/9540/8540 */
113#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */ 117#define AB8500_INT_GPIO8R 42 /* not 8505/9540/8540 */
114#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */ 118#define AB8500_INT_GPIO9R 43 /* not 8505/9540/8540 */
115#define AB8500_INT_GPIO10R 44 119#define AB8500_INT_GPIO10R 44 /* not 8540 */
116#define AB8500_INT_GPIO11R 45 120#define AB8500_INT_GPIO11R 45 /* not 8540 */
117#define AB8500_INT_GPIO12R 46 /* not 8505 */ 121#define AB8500_INT_GPIO12R 46 /* not 8505/8540 */
118#define AB8500_INT_GPIO13R 47 122#define AB8500_INT_GPIO13R 47 /* not 8540 */
119/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */ 123/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
120#define AB8500_INT_GPIO24R 48 /* not 8505 */ 124#define AB8500_INT_GPIO24R 48 /* not 8505/8540 */
121#define AB8500_INT_GPIO25R 49 /* not 8505 */ 125#define AB8500_INT_GPIO25R 49 /* not 8505/8540 */
122#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */ 126#define AB8500_INT_GPIO36R 50 /* not 8505/9540/8540 */
123#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */ 127#define AB8500_INT_GPIO37R 51 /* not 8505/9540/8540 */
124#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */ 128#define AB8500_INT_GPIO38R 52 /* not 8505/9540/8540 */
125#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */ 129#define AB8500_INT_GPIO39R 53 /* not 8505/9540/8540 */
126#define AB8500_INT_GPIO40R 54 130#define AB8500_INT_GPIO40R 54 /* not 8540 */
127#define AB8500_INT_GPIO41R 55 131#define AB8500_INT_GPIO41R 55 /* not 8540 */
128/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */ 132/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
129#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */ 133#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
130#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */ 134#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
@@ -135,14 +139,14 @@ enum ab8500_version {
135#define AB8500_INT_GPIO12F 62 /* not 8505 */ 139#define AB8500_INT_GPIO12F 62 /* not 8505 */
136#define AB8500_INT_GPIO13F 63 140#define AB8500_INT_GPIO13F 63
137/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */ 141/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
138#define AB8500_INT_GPIO24F 64 /* not 8505 */ 142#define AB8500_INT_GPIO24F 64 /* not 8505/8540 */
139#define AB8500_INT_GPIO25F 65 /* not 8505 */ 143#define AB8500_INT_GPIO25F 65 /* not 8505/8540 */
140#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */ 144#define AB8500_INT_GPIO36F 66 /* not 8505/9540/8540 */
141#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */ 145#define AB8500_INT_GPIO37F 67 /* not 8505/9540/8540 */
142#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */ 146#define AB8500_INT_GPIO38F 68 /* not 8505/9540/8540 */
143#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */ 147#define AB8500_INT_GPIO39F 69 /* not 8505/9540/8540 */
144#define AB8500_INT_GPIO40F 70 148#define AB8500_INT_GPIO40F 70 /* not 8540 */
145#define AB8500_INT_GPIO41F 71 149#define AB8500_INT_GPIO41F 71 /* not 8540 */
146/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */ 150/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
147#define AB8500_INT_ADP_SOURCE_ERROR 72 151#define AB8500_INT_ADP_SOURCE_ERROR 72
148#define AB8500_INT_ADP_SINK_ERROR 73 152#define AB8500_INT_ADP_SINK_ERROR 73
@@ -160,42 +164,44 @@ enum ab8500_version {
160#define AB8500_INT_SRP_DETECT 88 164#define AB8500_INT_SRP_DETECT 88
161#define AB8500_INT_USB_CHARGER_NOT_OKR 89 165#define AB8500_INT_USB_CHARGER_NOT_OKR 89
162#define AB8500_INT_ID_WAKEUP_R 90 166#define AB8500_INT_ID_WAKEUP_R 90
167#define AB8500_INT_ID_DET_PLUGR 91 /* 8505/9540 cut2.0 */
163#define AB8500_INT_ID_DET_R1R 92 168#define AB8500_INT_ID_DET_R1R 92
164#define AB8500_INT_ID_DET_R2R 93 169#define AB8500_INT_ID_DET_R2R 93
165#define AB8500_INT_ID_DET_R3R 94 170#define AB8500_INT_ID_DET_R3R 94
166#define AB8500_INT_ID_DET_R4R 95 171#define AB8500_INT_ID_DET_R4R 95
167/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */ 172/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */
168#define AB8500_INT_ID_WAKEUP_F 96 173#define AB8500_INT_ID_WAKEUP_F 96 /* not 8505/9540 */
169#define AB8500_INT_ID_DET_R1F 98 174#define AB8500_INT_ID_DET_PLUGF 97 /* 8505/9540 cut2.0 */
170#define AB8500_INT_ID_DET_R2F 99 175#define AB8500_INT_ID_DET_R1F 98 /* not 8505/9540 */
171#define AB8500_INT_ID_DET_R3F 100 176#define AB8500_INT_ID_DET_R2F 99 /* not 8505/9540 */
172#define AB8500_INT_ID_DET_R4F 101 177#define AB8500_INT_ID_DET_R3F 100 /* not 8505/9540 */
173#define AB8500_INT_CHAUTORESTARTAFTSEC 102 178#define AB8500_INT_ID_DET_R4F 101 /* not 8505/9540 */
179#define AB8500_INT_CHAUTORESTARTAFTSEC 102 /* not 8505/9540 */
174#define AB8500_INT_CHSTOPBYSEC 103 180#define AB8500_INT_CHSTOPBYSEC 103
175/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */ 181/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
176#define AB8500_INT_USB_CH_TH_PROT_F 104 182#define AB8500_INT_USB_CH_TH_PROT_F 104
177#define AB8500_INT_USB_CH_TH_PROT_R 105 183#define AB8500_INT_USB_CH_TH_PROT_R 105
178#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */ 184#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
179#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */ 185#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
180#define AB8500_INT_CHCURLIMNOHSCHIRP 109 186#define AB8500_INT_CHCURLIMNOHSCHIRP 109
181#define AB8500_INT_CHCURLIMHSCHIRP 110 187#define AB8500_INT_CHCURLIMHSCHIRP 110
182#define AB8500_INT_XTAL32K_KO 111 188#define AB8500_INT_XTAL32K_KO 111
183 189
184/* Definitions for AB9540 */ 190/* Definitions for AB9540 / AB8505 */
185/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */ 191/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
186#define AB9540_INT_GPIO50R 113 192#define AB9540_INT_GPIO50R 113 /* not 8540 */
187#define AB9540_INT_GPIO51R 114 /* not 8505 */ 193#define AB9540_INT_GPIO51R 114 /* not 8505/8540 */
188#define AB9540_INT_GPIO52R 115 194#define AB9540_INT_GPIO52R 115 /* not 8540 */
189#define AB9540_INT_GPIO53R 116 195#define AB9540_INT_GPIO53R 116 /* not 8540 */
190#define AB9540_INT_GPIO54R 117 /* not 8505 */ 196#define AB9540_INT_GPIO54R 117 /* not 8505/8540 */
191#define AB9540_INT_IEXT_CH_RF_BFN_R 118 197#define AB9540_INT_IEXT_CH_RF_BFN_R 118
192#define AB9540_INT_IEXT_CH_RF_BFN_F 119
193/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */ 198/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
194#define AB9540_INT_GPIO50F 121 199#define AB9540_INT_GPIO50F 121 /* not 8540 */
195#define AB9540_INT_GPIO51F 122 /* not 8505 */ 200#define AB9540_INT_GPIO51F 122 /* not 8505/8540 */
196#define AB9540_INT_GPIO52F 123 201#define AB9540_INT_GPIO52F 123 /* not 8540 */
197#define AB9540_INT_GPIO53F 124 202#define AB9540_INT_GPIO53F 124 /* not 8540 */
198#define AB9540_INT_GPIO54F 125 /* not 8505 */ 203#define AB9540_INT_GPIO54F 125 /* not 8505/8540 */
204#define AB9540_INT_IEXT_CH_RF_BFN_F 126
199/* ab8500_irq_regoffset[16] -> IT[Source|Latch|Mask]25 */ 205/* ab8500_irq_regoffset[16] -> IT[Source|Latch|Mask]25 */
200#define AB8505_INT_KEYSTUCK 128 206#define AB8505_INT_KEYSTUCK 128
201#define AB8505_INT_IKR 129 207#define AB8505_INT_IKR 129
@@ -204,6 +210,87 @@ enum ab8500_version {
204#define AB8505_INT_KEYDEGLITCH 132 210#define AB8505_INT_KEYDEGLITCH 132
205#define AB8505_INT_MODPWRSTATUSF 134 211#define AB8505_INT_MODPWRSTATUSF 134
206#define AB8505_INT_MODPWRSTATUSR 135 212#define AB8505_INT_MODPWRSTATUSR 135
213/* ab8500_irq_regoffset[17] -> IT[Source|Latch|Mask]6 */
214#define AB8500_INT_HOOK_DET_NEG_F 138
215#define AB8500_INT_HOOK_DET_NEG_R 139
216#define AB8500_INT_HOOK_DET_POS_F 140
217#define AB8500_INT_HOOK_DET_POS_R 141
218#define AB8500_INT_PLUG_DET_COMP_F 142
219#define AB8500_INT_PLUG_DET_COMP_R 143
220/* ab8500_irq_regoffset[18] -> IT[Source|Latch|Mask]23 */
221#define AB8505_INT_COLL 144
222#define AB8505_INT_RESERR 145
223#define AB8505_INT_FRAERR 146
224#define AB8505_INT_COMERR 147
225#define AB8505_INT_SPDSET 148
226#define AB8505_INT_DSENT 149
227#define AB8505_INT_DREC 150
228#define AB8505_INT_ACC_INT 151
229/* ab8500_irq_regoffset[19] -> IT[Source|Latch|Mask]24 */
230#define AB8505_INT_NOPINT 152
231/* ab8540_irq_regoffset[20] -> IT[Source|Latch|Mask]26 */
232#define AB8540_INT_IDPLUGDETCOMPF 160
233#define AB8540_INT_IDPLUGDETCOMPR 161
234#define AB8540_INT_FMDETCOMPLOF 162
235#define AB8540_INT_FMDETCOMPLOR 163
236#define AB8540_INT_FMDETCOMPHIF 164
237#define AB8540_INT_FMDETCOMPHIR 165
238#define AB8540_INT_ID5VDETCOMPF 166
239#define AB8540_INT_ID5VDETCOMPR 167
240/* ab8540_irq_regoffset[21] -> IT[Source|Latch|Mask]27 */
241#define AB8540_INT_GPIO43F 168
242#define AB8540_INT_GPIO43R 169
243#define AB8540_INT_GPIO44F 170
244#define AB8540_INT_GPIO44R 171
245#define AB8540_INT_KEYPOSDETCOMPF 172
246#define AB8540_INT_KEYPOSDETCOMPR 173
247#define AB8540_INT_KEYNEGDETCOMPF 174
248#define AB8540_INT_KEYNEGDETCOMPR 175
249/* ab8540_irq_regoffset[22] -> IT[Source|Latch|Mask]28 */
250#define AB8540_INT_GPIO1VBATF 176
251#define AB8540_INT_GPIO1VBATR 177
252#define AB8540_INT_GPIO2VBATF 178
253#define AB8540_INT_GPIO2VBATR 179
254#define AB8540_INT_GPIO3VBATF 180
255#define AB8540_INT_GPIO3VBATR 181
256#define AB8540_INT_GPIO4VBATF 182
257#define AB8540_INT_GPIO4VBATR 183
258/* ab8540_irq_regoffset[23] -> IT[Source|Latch|Mask]29 */
259#define AB8540_INT_SYSCLKREQ2F 184
260#define AB8540_INT_SYSCLKREQ2R 185
261#define AB8540_INT_SYSCLKREQ3F 186
262#define AB8540_INT_SYSCLKREQ3R 187
263#define AB8540_INT_SYSCLKREQ4F 188
264#define AB8540_INT_SYSCLKREQ4R 189
265#define AB8540_INT_SYSCLKREQ5F 190
266#define AB8540_INT_SYSCLKREQ5R 191
267/* ab8540_irq_regoffset[24] -> IT[Source|Latch|Mask]30 */
268#define AB8540_INT_PWMOUT1F 192
269#define AB8540_INT_PWMOUT1R 193
270#define AB8540_INT_PWMCTRL0F 194
271#define AB8540_INT_PWMCTRL0R 195
272#define AB8540_INT_PWMCTRL1F 196
273#define AB8540_INT_PWMCTRL1R 197
274#define AB8540_INT_SYSCLKREQ6F 198
275#define AB8540_INT_SYSCLKREQ6R 199
276/* ab8540_irq_regoffset[25] -> IT[Source|Latch|Mask]31 */
277#define AB8540_INT_PWMEXTVIBRA1F 200
278#define AB8540_INT_PWMEXTVIBRA1R 201
279#define AB8540_INT_PWMEXTVIBRA2F 202
280#define AB8540_INT_PWMEXTVIBRA2R 203
281#define AB8540_INT_PWMOUT2F 204
282#define AB8540_INT_PWMOUT2R 205
283#define AB8540_INT_PWMOUT3F 206
284#define AB8540_INT_PWMOUT3R 207
285/* ab8540_irq_regoffset[26] -> IT[Source|Latch|Mask]32 */
286#define AB8540_INT_ADDATA2F 208
287#define AB8540_INT_ADDATA2R 209
288#define AB8540_INT_DADATA2F 210
289#define AB8540_INT_DADATA2R 211
290#define AB8540_INT_FSYNC2F 212
291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215
207 294
208/* 295/*
209 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
@@ -213,13 +300,24 @@ enum ab8500_version {
213 * which is larger. 300 * which is larger.
214 */ 301 */
215#define AB8500_NR_IRQS 112 302#define AB8500_NR_IRQS 112
216#define AB8505_NR_IRQS 136 303#define AB8505_NR_IRQS 153
217#define AB9540_NR_IRQS 136 304#define AB9540_NR_IRQS 153
305#define AB8540_NR_IRQS 216
218/* This is set to the roof of any AB8500 chip variant IRQ counts */ 306/* This is set to the roof of any AB8500 chip variant IRQ counts */
219#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS 307#define AB8500_MAX_NR_IRQS AB8540_NR_IRQS
220 308
221#define AB8500_NUM_IRQ_REGS 14 309#define AB8500_NUM_IRQ_REGS 14
222#define AB9540_NUM_IRQ_REGS 17 310#define AB9540_NUM_IRQ_REGS 20
311#define AB8540_NUM_IRQ_REGS 27
312
313/* Turn On Status Event */
314#define AB8500_POR_ON_VBAT 0x01
315#define AB8500_POW_KEY_1_ON 0x02
316#define AB8500_POW_KEY_2_ON 0x04
317#define AB8500_RTC_ALARM 0x08
318#define AB8500_MAIN_CH_DET 0x10
319#define AB8500_VBUS_DET 0x20
320#define AB8500_USB_ID_DET 0x40
223 321
224/** 322/**
225 * struct ab8500 - ab8500 internal structure 323 * struct ab8500 - ab8500 internal structure
@@ -270,10 +368,12 @@ struct regulator_reg_init;
270struct regulator_init_data; 368struct regulator_init_data;
271struct ab8500_gpio_platform_data; 369struct ab8500_gpio_platform_data;
272struct ab8500_codec_platform_data; 370struct ab8500_codec_platform_data;
371struct ab8500_sysctrl_platform_data;
273 372
274/** 373/**
275 * struct ab8500_platform_data - AB8500 platform data 374 * struct ab8500_platform_data - AB8500 platform data
276 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used 375 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
376 * @pm_power_off: Should machine pm power off hook be registered or not
277 * @init: board-specific initialization after detection of ab8500 377 * @init: board-specific initialization after detection of ab8500
278 * @num_regulator_reg_init: number of regulator init registers 378 * @num_regulator_reg_init: number of regulator init registers
279 * @regulator_reg_init: regulator init registers 379 * @regulator_reg_init: regulator init registers
@@ -282,13 +382,15 @@ struct ab8500_codec_platform_data;
282 */ 382 */
283struct ab8500_platform_data { 383struct ab8500_platform_data {
284 int irq_base; 384 int irq_base;
385 bool pm_power_off;
285 void (*init) (struct ab8500 *); 386 void (*init) (struct ab8500 *);
286 int num_regulator_reg_init; 387 int num_regulator_reg_init;
287 struct ab8500_regulator_reg_init *regulator_reg_init; 388 struct ab8500_regulator_reg_init *regulator_reg_init;
288 int num_regulator; 389 int num_regulator;
289 struct regulator_init_data *regulator; 390 struct regulator_init_data *regulator;
290 struct ab8500_gpio_platform_data *gpio; 391 struct abx500_gpio_platform_data *gpio;
291 struct ab8500_codec_platform_data *codec; 392 struct ab8500_codec_platform_data *codec;
393 struct ab8500_sysctrl_platform_data *sysctrl;
292}; 394};
293 395
294extern int ab8500_init(struct ab8500 *ab8500, 396extern int ab8500_init(struct ab8500 *ab8500,
@@ -335,10 +437,87 @@ static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
335 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0)); 437 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
336} 438}
337 439
440static inline int is_ab8500_3p3_or_earlier(struct ab8500 *ab)
441{
442 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT3P3));
443}
444
338/* exclude also ab8505, ab9540... */ 445/* exclude also ab8505, ab9540... */
339static inline int is_ab8500_2p0(struct ab8500 *ab) 446static inline int is_ab8500_2p0(struct ab8500 *ab)
340{ 447{
341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); 448 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
342} 449}
343 450
451static inline int is_ab8505_1p0_or_earlier(struct ab8500 *ab)
452{
453 return (is_ab8505(ab) && (ab->chip_id <= AB8500_CUT1P0));
454}
455
456static inline int is_ab8505_2p0(struct ab8500 *ab)
457{
458 return (is_ab8505(ab) && (ab->chip_id == AB8500_CUT2P0));
459}
460
461static inline int is_ab9540_1p0_or_earlier(struct ab8500 *ab)
462{
463 return (is_ab9540(ab) && (ab->chip_id <= AB8500_CUT1P0));
464}
465
466static inline int is_ab9540_2p0(struct ab8500 *ab)
467{
468 return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT2P0));
469}
470
471/*
472 * Be careful, the marketing name for this chip is 2.1
473 * but the value read from the chip is 3.0 (0x30)
474 */
475static inline int is_ab9540_3p0(struct ab8500 *ab)
476{
477 return (is_ab9540(ab) && (ab->chip_id == AB8500_CUT3P0));
478}
479
480static inline int is_ab8540_1p0_or_earlier(struct ab8500 *ab)
481{
482 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P0);
483}
484
485static inline int is_ab8540_1p1_or_earlier(struct ab8500 *ab)
486{
487 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P1);
488}
489
490static inline int is_ab8540_1p2_or_earlier(struct ab8500 *ab)
491{
492 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT1P2);
493}
494
495static inline int is_ab8540_2p0_or_earlier(struct ab8500 *ab)
496{
497 return is_ab8540(ab) && (ab->chip_id <= AB8500_CUT2P0);
498}
499
500static inline int is_ab8540_2p0(struct ab8500 *ab)
501{
502 return is_ab8540(ab) && (ab->chip_id == AB8500_CUT2P0);
503}
504
505static inline int is_ab8505_2p0_earlier(struct ab8500 *ab)
506{
507 return (is_ab8505(ab) && (ab->chip_id < AB8500_CUT2P0));
508}
509
510static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)
511{
512 return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));
513}
514
515#ifdef CONFIG_AB8500_DEBUG
516void ab8500_dump_all_banks(struct device *dev);
517void ab8500_debug_register_interrupt(int line);
518#else
519static inline void ab8500_dump_all_banks(struct device *dev) {}
520static inline void ab8500_debug_register_interrupt(int line) {}
521#endif
522
344#endif /* MFD_AB8500_H */ 523#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h
index 9b07725750c9..d43ac0f35526 100644
--- a/include/linux/mfd/abx500/ux500_chargalg.h
+++ b/include/linux/mfd/abx500/ux500_chargalg.h
@@ -27,12 +27,17 @@ struct ux500_charger_ops {
27 * @ops ux500 charger operations 27 * @ops ux500 charger operations
28 * @max_out_volt maximum output charger voltage in mV 28 * @max_out_volt maximum output charger voltage in mV
29 * @max_out_curr maximum output charger current in mA 29 * @max_out_curr maximum output charger current in mA
30 * @enabled indicates if this charger is used or not
31 * @external external charger unit (pm2xxx)
30 */ 32 */
31struct ux500_charger { 33struct ux500_charger {
32 struct power_supply psy; 34 struct power_supply psy;
33 struct ux500_charger_ops ops; 35 struct ux500_charger_ops ops;
34 int max_out_volt; 36 int max_out_volt;
35 int max_out_curr; 37 int max_out_curr;
38 int wdt_refresh;
39 bool enabled;
40 bool external;
36}; 41};
37 42
38#endif 43#endif
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index a580363a7d29..a710255528d7 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -75,8 +75,10 @@ enum arizona_type {
75#define ARIZONA_IRQ_DCS_HP_DONE 47 75#define ARIZONA_IRQ_DCS_HP_DONE 47
76#define ARIZONA_IRQ_FLL2_CLOCK_OK 48 76#define ARIZONA_IRQ_FLL2_CLOCK_OK 48
77#define ARIZONA_IRQ_FLL1_CLOCK_OK 49 77#define ARIZONA_IRQ_FLL1_CLOCK_OK 49
78#define ARIZONA_IRQ_MICD_CLAMP_RISE 50
79#define ARIZONA_IRQ_MICD_CLAMP_FALL 51
78 80
79#define ARIZONA_NUM_IRQ 50 81#define ARIZONA_NUM_IRQ 52
80 82
81struct snd_soc_dapm_context; 83struct snd_soc_dapm_context;
82 84
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 8b1d1daaae16..455c51d22d6b 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -56,12 +56,16 @@
56#define ARIZONA_DMIC_MICBIAS2 2 56#define ARIZONA_DMIC_MICBIAS2 2
57#define ARIZONA_DMIC_MICBIAS3 3 57#define ARIZONA_DMIC_MICBIAS3 3
58 58
59#define ARIZONA_MAX_MICBIAS 3
60
59#define ARIZONA_INMODE_DIFF 0 61#define ARIZONA_INMODE_DIFF 0
60#define ARIZONA_INMODE_SE 1 62#define ARIZONA_INMODE_SE 1
61#define ARIZONA_INMODE_DMIC 2 63#define ARIZONA_INMODE_DMIC 2
62 64
63#define ARIZONA_MAX_OUTPUT 6 65#define ARIZONA_MAX_OUTPUT 6
64 66
67#define ARIZONA_MAX_AIF 3
68
65#define ARIZONA_HAP_ACT_ERM 0 69#define ARIZONA_HAP_ACT_ERM 0
66#define ARIZONA_HAP_ACT_LRA 2 70#define ARIZONA_HAP_ACT_LRA 2
67 71
@@ -69,6 +73,13 @@
69 73
70struct regulator_init_data; 74struct regulator_init_data;
71 75
76struct arizona_micbias {
77 int mV; /** Regulated voltage */
78 unsigned int ext_cap:1; /** External capacitor fitted */
79 unsigned int discharge:1; /** Actively discharge */
80 unsigned int fast_start:1; /** Enable aggressive startup ramp rate */
81};
82
72struct arizona_micd_config { 83struct arizona_micd_config {
73 unsigned int src; 84 unsigned int src;
74 unsigned int bias; 85 unsigned int bias;
@@ -96,9 +107,37 @@ struct arizona_pdata {
96 /** Pin state for GPIO pins */ 107 /** Pin state for GPIO pins */
97 int gpio_defaults[ARIZONA_MAX_GPIO]; 108 int gpio_defaults[ARIZONA_MAX_GPIO];
98 109
110 /**
111 * Maximum number of channels clocks will be generated for,
112 * useful for systems where and I2S bus with multiple data
113 * lines is mastered.
114 */
115 int max_channels_clocked[ARIZONA_MAX_AIF];
116
117 /** GPIO5 is used for jack detection */
118 bool jd_gpio5;
119
120 /** Use the headphone detect circuit to identify the accessory */
121 bool hpdet_acc_id;
122
123 /** GPIO used for mic isolation with HPDET */
124 int hpdet_id_gpio;
125
99 /** GPIO for mic detection polarity */ 126 /** GPIO for mic detection polarity */
100 int micd_pol_gpio; 127 int micd_pol_gpio;
101 128
129 /** Mic detect ramp rate */
130 int micd_bias_start_time;
131
132 /** Mic detect sample rate */
133 int micd_rate;
134
135 /** Mic detect debounce level */
136 int micd_dbtime;
137
138 /** Force MICBIAS on for mic detect */
139 bool micd_force_micbias;
140
102 /** Headset polarity configurations */ 141 /** Headset polarity configurations */
103 struct arizona_micd_config *micd_configs; 142 struct arizona_micd_config *micd_configs;
104 int num_micd_configs; 143 int num_micd_configs;
@@ -106,6 +145,9 @@ struct arizona_pdata {
106 /** Reference voltage for DMIC inputs */ 145 /** Reference voltage for DMIC inputs */
107 int dmic_ref[ARIZONA_MAX_INPUT]; 146 int dmic_ref[ARIZONA_MAX_INPUT];
108 147
148 /** MICBIAS configurations */
149 struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS];
150
109 /** Mode of input structures */ 151 /** Mode of input structures */
110 int inmode[ARIZONA_MAX_INPUT]; 152 int inmode[ARIZONA_MAX_INPUT];
111 153
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 1f6fe31a4d5c..340355136069 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -119,6 +119,8 @@
119#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293 119#define ARIZONA_ACCESSORY_DETECT_MODE_1 0x293
120#define ARIZONA_HEADPHONE_DETECT_1 0x29B 120#define ARIZONA_HEADPHONE_DETECT_1 0x29B
121#define ARIZONA_HEADPHONE_DETECT_2 0x29C 121#define ARIZONA_HEADPHONE_DETECT_2 0x29C
122#define ARIZONA_HP_DACVAL 0x29F
123#define ARIZONA_MICD_CLAMP_CONTROL 0x2A2
122#define ARIZONA_MIC_DETECT_1 0x2A3 124#define ARIZONA_MIC_DETECT_1 0x2A3
123#define ARIZONA_MIC_DETECT_2 0x2A4 125#define ARIZONA_MIC_DETECT_2 0x2A4
124#define ARIZONA_MIC_DETECT_3 0x2A5 126#define ARIZONA_MIC_DETECT_3 0x2A5
@@ -982,18 +984,34 @@
982#define ARIZONA_DSP1_STATUS_1 0x1104 984#define ARIZONA_DSP1_STATUS_1 0x1104
983#define ARIZONA_DSP1_STATUS_2 0x1105 985#define ARIZONA_DSP1_STATUS_2 0x1105
984#define ARIZONA_DSP1_STATUS_3 0x1106 986#define ARIZONA_DSP1_STATUS_3 0x1106
987#define ARIZONA_DSP1_SCRATCH_0 0x1140
988#define ARIZONA_DSP1_SCRATCH_1 0x1141
989#define ARIZONA_DSP1_SCRATCH_2 0x1142
990#define ARIZONA_DSP1_SCRATCH_3 0x1143
985#define ARIZONA_DSP2_CONTROL_1 0x1200 991#define ARIZONA_DSP2_CONTROL_1 0x1200
986#define ARIZONA_DSP2_CLOCKING_1 0x1201 992#define ARIZONA_DSP2_CLOCKING_1 0x1201
987#define ARIZONA_DSP2_STATUS_1 0x1204 993#define ARIZONA_DSP2_STATUS_1 0x1204
988#define ARIZONA_DSP2_STATUS_2 0x1205 994#define ARIZONA_DSP2_STATUS_2 0x1205
995#define ARIZONA_DSP2_SCRATCH_0 0x1240
996#define ARIZONA_DSP2_SCRATCH_1 0x1241
997#define ARIZONA_DSP2_SCRATCH_2 0x1242
998#define ARIZONA_DSP2_SCRATCH_3 0x1243
989#define ARIZONA_DSP3_CONTROL_1 0x1300 999#define ARIZONA_DSP3_CONTROL_1 0x1300
990#define ARIZONA_DSP3_CLOCKING_1 0x1301 1000#define ARIZONA_DSP3_CLOCKING_1 0x1301
991#define ARIZONA_DSP3_STATUS_1 0x1304 1001#define ARIZONA_DSP3_STATUS_1 0x1304
992#define ARIZONA_DSP3_STATUS_2 0x1305 1002#define ARIZONA_DSP3_STATUS_2 0x1305
1003#define ARIZONA_DSP3_SCRATCH_0 0x1340
1004#define ARIZONA_DSP3_SCRATCH_1 0x1341
1005#define ARIZONA_DSP3_SCRATCH_2 0x1342
1006#define ARIZONA_DSP3_SCRATCH_3 0x1343
993#define ARIZONA_DSP4_CONTROL_1 0x1400 1007#define ARIZONA_DSP4_CONTROL_1 0x1400
994#define ARIZONA_DSP4_CLOCKING_1 0x1401 1008#define ARIZONA_DSP4_CLOCKING_1 0x1401
995#define ARIZONA_DSP4_STATUS_1 0x1404 1009#define ARIZONA_DSP4_STATUS_1 0x1404
996#define ARIZONA_DSP4_STATUS_2 0x1405 1010#define ARIZONA_DSP4_STATUS_2 0x1405
1011#define ARIZONA_DSP4_SCRATCH_0 0x1440
1012#define ARIZONA_DSP4_SCRATCH_1 0x1441
1013#define ARIZONA_DSP4_SCRATCH_2 0x1442
1014#define ARIZONA_DSP4_SCRATCH_3 0x1443
997 1015
998/* 1016/*
999 * Field Definitions. 1017 * Field Definitions.
@@ -1194,6 +1212,14 @@
1194/* 1212/*
1195 * R64 (0x40) - Wake control 1213 * R64 (0x40) - Wake control
1196 */ 1214 */
1215#define ARIZONA_WKUP_MICD_CLAMP_FALL 0x0080 /* WKUP_MICD_CLAMP_FALL */
1216#define ARIZONA_WKUP_MICD_CLAMP_FALL_MASK 0x0080 /* WKUP_MICD_CLAMP_FALL */
1217#define ARIZONA_WKUP_MICD_CLAMP_FALL_SHIFT 7 /* WKUP_MICD_CLAMP_FALL */
1218#define ARIZONA_WKUP_MICD_CLAMP_FALL_WIDTH 1 /* WKUP_MICD_CLAMP_FALL */
1219#define ARIZONA_WKUP_MICD_CLAMP_RISE 0x0040 /* WKUP_MICD_CLAMP_RISE */
1220#define ARIZONA_WKUP_MICD_CLAMP_RISE_MASK 0x0040 /* WKUP_MICD_CLAMP_RISE */
1221#define ARIZONA_WKUP_MICD_CLAMP_RISE_SHIFT 6 /* WKUP_MICD_CLAMP_RISE */
1222#define ARIZONA_WKUP_MICD_CLAMP_RISE_WIDTH 1 /* WKUP_MICD_CLAMP_RISE */
1197#define ARIZONA_WKUP_GP5_FALL 0x0020 /* WKUP_GP5_FALL */ 1223#define ARIZONA_WKUP_GP5_FALL 0x0020 /* WKUP_GP5_FALL */
1198#define ARIZONA_WKUP_GP5_FALL_MASK 0x0020 /* WKUP_GP5_FALL */ 1224#define ARIZONA_WKUP_GP5_FALL_MASK 0x0020 /* WKUP_GP5_FALL */
1199#define ARIZONA_WKUP_GP5_FALL_SHIFT 5 /* WKUP_GP5_FALL */ 1225#define ARIZONA_WKUP_GP5_FALL_SHIFT 5 /* WKUP_GP5_FALL */
@@ -2035,6 +2061,9 @@
2035/* 2061/*
2036 * R667 (0x29B) - Headphone Detect 1 2062 * R667 (0x29B) - Headphone Detect 1
2037 */ 2063 */
2064#define ARIZONA_HP_IMPEDANCE_RANGE_MASK 0x0600 /* HP_IMPEDANCE_RANGE - [10:9] */
2065#define ARIZONA_HP_IMPEDANCE_RANGE_SHIFT 9 /* HP_IMPEDANCE_RANGE - [10:9] */
2066#define ARIZONA_HP_IMPEDANCE_RANGE_WIDTH 2 /* HP_IMPEDANCE_RANGE - [10:9] */
2038#define ARIZONA_HP_STEP_SIZE 0x0100 /* HP_STEP_SIZE */ 2067#define ARIZONA_HP_STEP_SIZE 0x0100 /* HP_STEP_SIZE */
2039#define ARIZONA_HP_STEP_SIZE_MASK 0x0100 /* HP_STEP_SIZE */ 2068#define ARIZONA_HP_STEP_SIZE_MASK 0x0100 /* HP_STEP_SIZE */
2040#define ARIZONA_HP_STEP_SIZE_SHIFT 8 /* HP_STEP_SIZE */ 2069#define ARIZONA_HP_STEP_SIZE_SHIFT 8 /* HP_STEP_SIZE */
@@ -2069,6 +2098,21 @@
2069#define ARIZONA_HP_LVL_SHIFT 0 /* HP_LVL - [6:0] */ 2098#define ARIZONA_HP_LVL_SHIFT 0 /* HP_LVL - [6:0] */
2070#define ARIZONA_HP_LVL_WIDTH 7 /* HP_LVL - [6:0] */ 2099#define ARIZONA_HP_LVL_WIDTH 7 /* HP_LVL - [6:0] */
2071 2100
2101#define ARIZONA_HP_DONE_B 0x8000 /* HP_DONE */
2102#define ARIZONA_HP_DONE_B_MASK 0x8000 /* HP_DONE */
2103#define ARIZONA_HP_DONE_B_SHIFT 15 /* HP_DONE */
2104#define ARIZONA_HP_DONE_B_WIDTH 1 /* HP_DONE */
2105#define ARIZONA_HP_LVL_B_MASK 0x7FFF /* HP_LVL - [14:0] */
2106#define ARIZONA_HP_LVL_B_SHIFT 0 /* HP_LVL - [14:0] */
2107#define ARIZONA_HP_LVL_B_WIDTH 15 /* HP_LVL - [14:0] */
2108
2109/*
2110 * R674 (0x2A2) - MICD clamp control
2111 */
2112#define ARIZONA_MICD_CLAMP_MODE_MASK 0x000F /* MICD_CLAMP_MODE - [3:0] */
2113#define ARIZONA_MICD_CLAMP_MODE_SHIFT 0 /* MICD_CLAMP_MODE - [3:0] */
2114#define ARIZONA_MICD_CLAMP_MODE_WIDTH 4 /* MICD_CLAMP_MODE - [3:0] */
2115
2072/* 2116/*
2073 * R675 (0x2A3) - Mic Detect 1 2117 * R675 (0x2A3) - Mic Detect 1
2074 */ 2118 */
@@ -5239,6 +5283,14 @@
5239/* 5283/*
5240 * R3408 (0xD50) - AOD wkup and trig 5284 * R3408 (0xD50) - AOD wkup and trig
5241 */ 5285 */
5286#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS 0x0080 /* MICD_CLAMP_FALL_TRIG_STS */
5287#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_MASK 0x0080 /* MICD_CLAMP_FALL_TRIG_STS */
5288#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_SHIFT 7 /* MICD_CLAMP_FALL_TRIG_STS */
5289#define ARIZONA_MICD_CLAMP_FALL_TRIG_STS_WIDTH 1 /* MICD_CLAMP_FALL_TRIG_STS */
5290#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS 0x0040 /* MICD_CLAMP_RISE_TRIG_STS */
5291#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_MASK 0x0040 /* MICD_CLAMP_RISE_TRIG_STS */
5292#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_SHIFT 6 /* MICD_CLAMP_RISE_TRIG_STS */
5293#define ARIZONA_MICD_CLAMP_RISE_TRIG_STS_WIDTH 1 /* MICD_CLAMP_RISE_TRIG_STS */
5242#define ARIZONA_GP5_FALL_TRIG_STS 0x0020 /* GP5_FALL_TRIG_STS */ 5294#define ARIZONA_GP5_FALL_TRIG_STS 0x0020 /* GP5_FALL_TRIG_STS */
5243#define ARIZONA_GP5_FALL_TRIG_STS_MASK 0x0020 /* GP5_FALL_TRIG_STS */ 5295#define ARIZONA_GP5_FALL_TRIG_STS_MASK 0x0020 /* GP5_FALL_TRIG_STS */
5244#define ARIZONA_GP5_FALL_TRIG_STS_SHIFT 5 /* GP5_FALL_TRIG_STS */ 5296#define ARIZONA_GP5_FALL_TRIG_STS_SHIFT 5 /* GP5_FALL_TRIG_STS */
@@ -5267,6 +5319,12 @@
5267/* 5319/*
5268 * R3409 (0xD51) - AOD IRQ1 5320 * R3409 (0xD51) - AOD IRQ1
5269 */ 5321 */
5322#define ARIZONA_MICD_CLAMP_FALL_EINT1 0x0080 /* MICD_CLAMP_FALL_EINT1 */
5323#define ARIZONA_MICD_CLAMP_FALL_EINT1_MASK 0x0080 /* MICD_CLAMP_FALL_EINT1 */
5324#define ARIZONA_MICD_CLAMP_FALL_EINT1_SHIFT 7 /* MICD_CLAMP_FALL_EINT1 */
5325#define ARIZONA_MICD_CLAMP_RISE_EINT1 0x0040 /* MICD_CLAMP_RISE_EINT1 */
5326#define ARIZONA_MICD_CLAMP_RISE_EINT1_MASK 0x0040 /* MICD_CLAMP_RISE_EINT1 */
5327#define ARIZONA_MICD_CLAMP_RISE_EINT1_SHIFT 6 /* MICD_CLAMP_RISE_EINT1 */
5270#define ARIZONA_GP5_FALL_EINT1 0x0020 /* GP5_FALL_EINT1 */ 5328#define ARIZONA_GP5_FALL_EINT1 0x0020 /* GP5_FALL_EINT1 */
5271#define ARIZONA_GP5_FALL_EINT1_MASK 0x0020 /* GP5_FALL_EINT1 */ 5329#define ARIZONA_GP5_FALL_EINT1_MASK 0x0020 /* GP5_FALL_EINT1 */
5272#define ARIZONA_GP5_FALL_EINT1_SHIFT 5 /* GP5_FALL_EINT1 */ 5330#define ARIZONA_GP5_FALL_EINT1_SHIFT 5 /* GP5_FALL_EINT1 */
@@ -5295,6 +5353,12 @@
5295/* 5353/*
5296 * R3410 (0xD52) - AOD IRQ2 5354 * R3410 (0xD52) - AOD IRQ2
5297 */ 5355 */
5356#define ARIZONA_MICD_CLAMP_FALL_EINT2 0x0080 /* MICD_CLAMP_FALL_EINT2 */
5357#define ARIZONA_MICD_CLAMP_FALL_EINT2_MASK 0x0080 /* MICD_CLAMP_FALL_EINT2 */
5358#define ARIZONA_MICD_CLAMP_FALL_EINT2_SHIFT 7 /* MICD_CLAMP_FALL_EINT2 */
5359#define ARIZONA_MICD_CLAMP_RISE_EINT2 0x0040 /* MICD_CLAMP_RISE_EINT2 */
5360#define ARIZONA_MICD_CLAMP_RISE_EINT2_MASK 0x0040 /* MICD_CLAMP_RISE_EINT2 */
5361#define ARIZONA_MICD_CLAMP_RISE_EINT2_SHIFT 6 /* MICD_CLAMP_RISE_EINT2 */
5298#define ARIZONA_GP5_FALL_EINT2 0x0020 /* GP5_FALL_EINT2 */ 5362#define ARIZONA_GP5_FALL_EINT2 0x0020 /* GP5_FALL_EINT2 */
5299#define ARIZONA_GP5_FALL_EINT2_MASK 0x0020 /* GP5_FALL_EINT2 */ 5363#define ARIZONA_GP5_FALL_EINT2_MASK 0x0020 /* GP5_FALL_EINT2 */
5300#define ARIZONA_GP5_FALL_EINT2_SHIFT 5 /* GP5_FALL_EINT2 */ 5364#define ARIZONA_GP5_FALL_EINT2_SHIFT 5 /* GP5_FALL_EINT2 */
@@ -5379,6 +5443,10 @@
5379/* 5443/*
5380 * R3413 (0xD55) - AOD IRQ Raw Status 5444 * R3413 (0xD55) - AOD IRQ Raw Status
5381 */ 5445 */
5446#define ARIZONA_MICD_CLAMP_STS 0x0008 /* MICD_CLAMP_STS */
5447#define ARIZONA_MICD_CLAMP_STS_MASK 0x0008 /* MICD_CLAMP_STS */
5448#define ARIZONA_MICD_CLAMP_STS_SHIFT 3 /* MICD_CLAMP_STS */
5449#define ARIZONA_MICD_CLAMP_STS_WIDTH 1 /* MICD_CLAMP_STS */
5382#define ARIZONA_GP5_STS 0x0004 /* GP5_STS */ 5450#define ARIZONA_GP5_STS 0x0004 /* GP5_STS */
5383#define ARIZONA_GP5_STS_MASK 0x0004 /* GP5_STS */ 5451#define ARIZONA_GP5_STS_MASK 0x0004 /* GP5_STS */
5384#define ARIZONA_GP5_STS_SHIFT 2 /* GP5_STS */ 5452#define ARIZONA_GP5_STS_SHIFT 2 /* GP5_STS */
@@ -5395,6 +5463,10 @@
5395/* 5463/*
5396 * R3414 (0xD56) - Jack detect debounce 5464 * R3414 (0xD56) - Jack detect debounce
5397 */ 5465 */
5466#define ARIZONA_MICD_CLAMP_DB 0x0008 /* MICD_CLAMP_DB */
5467#define ARIZONA_MICD_CLAMP_DB_MASK 0x0008 /* MICD_CLAMP_DB */
5468#define ARIZONA_MICD_CLAMP_DB_SHIFT 3 /* MICD_CLAMP_DB */
5469#define ARIZONA_MICD_CLAMP_DB_WIDTH 1 /* MICD_CLAMP_DB */
5398#define ARIZONA_JD2_DB 0x0002 /* JD2_DB */ 5470#define ARIZONA_JD2_DB 0x0002 /* JD2_DB */
5399#define ARIZONA_JD2_DB_MASK 0x0002 /* JD2_DB */ 5471#define ARIZONA_JD2_DB_MASK 0x0002 /* JD2_DB */
5400#define ARIZONA_JD2_DB_SHIFT 1 /* JD2_DB */ 5472#define ARIZONA_JD2_DB_SHIFT 1 /* JD2_DB */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 86dd93de6ff2..786d02eb79d2 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -99,6 +99,9 @@ struct da9052 {
99 u8 chip_id; 99 u8 chip_id;
100 100
101 int chip_irq; 101 int chip_irq;
102
103 /* SOC I/O transfer related fixes for DA9052/53 */
104 int (*fix_io) (struct da9052 *da9052, unsigned char reg);
102}; 105};
103 106
104/* ADC API */ 107/* ADC API */
@@ -113,32 +116,87 @@ static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
113 ret = regmap_read(da9052->regmap, reg, &val); 116 ret = regmap_read(da9052->regmap, reg, &val);
114 if (ret < 0) 117 if (ret < 0)
115 return ret; 118 return ret;
119
120 if (da9052->fix_io) {
121 ret = da9052->fix_io(da9052, reg);
122 if (ret < 0)
123 return ret;
124 }
125
116 return val; 126 return val;
117} 127}
118 128
119static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg, 129static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
120 unsigned char val) 130 unsigned char val)
121{ 131{
122 return regmap_write(da9052->regmap, reg, val); 132 int ret;
133
134 ret = regmap_write(da9052->regmap, reg, val);
135 if (ret < 0)
136 return ret;
137
138 if (da9052->fix_io) {
139 ret = da9052->fix_io(da9052, reg);
140 if (ret < 0)
141 return ret;
142 }
143
144 return ret;
123} 145}
124 146
125static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg, 147static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
126 unsigned reg_cnt, unsigned char *val) 148 unsigned reg_cnt, unsigned char *val)
127{ 149{
128 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 150 int ret;
151
152 ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
153 if (ret < 0)
154 return ret;
155
156 if (da9052->fix_io) {
157 ret = da9052->fix_io(da9052, reg);
158 if (ret < 0)
159 return ret;
160 }
161
162 return ret;
129} 163}
130 164
131static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, 165static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
132 unsigned reg_cnt, unsigned char *val) 166 unsigned reg_cnt, unsigned char *val)
133{ 167{
134 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 168 int ret;
169
170 ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
171 if (ret < 0)
172 return ret;
173
174 if (da9052->fix_io) {
175 ret = da9052->fix_io(da9052, reg);
176 if (ret < 0)
177 return ret;
178 }
179
180 return ret;
135} 181}
136 182
137static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, 183static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
138 unsigned char bit_mask, 184 unsigned char bit_mask,
139 unsigned char reg_val) 185 unsigned char reg_val)
140{ 186{
141 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); 187 int ret;
188
189 ret = regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
190 if (ret < 0)
191 return ret;
192
193 if (da9052->fix_io) {
194 ret = da9052->fix_io(da9052, reg);
195 if (ret < 0)
196 return ret;
197 }
198
199 return ret;
142} 200}
143 201
144int da9052_device_init(struct da9052 *da9052, u8 chip_id); 202int da9052_device_init(struct da9052 *da9052, u8 chip_id);
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
index b97f7309d7f6..c4dd3a8add21 100644
--- a/include/linux/mfd/da9052/reg.h
+++ b/include/linux/mfd/da9052/reg.h
@@ -34,6 +34,9 @@
34#define DA9052_STATUS_C_REG 3 34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4 35#define DA9052_STATUS_D_REG 4
36 36
37/* PARK REGISTER */
38#define DA9052_PARK_REGISTER DA9052_STATUS_D_REG
39
37/* EVENT REGISTERS */ 40/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5 41#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6 42#define DA9052_EVENT_B_REG 6
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 6ee4247df11e..77a46ae2fc17 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -16,12 +16,6 @@
16/* 16/*
17 * Registers 17 * Registers
18 */ 18 */
19#define DB8500_PRCM_GPIOCR 0x138
20#define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
21#define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
22#define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
23#define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
24
25#define DB8500_PRCM_LINE_VALUE 0x170 19#define DB8500_PRCM_LINE_VALUE 0x170
26#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3) 20#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27 21
@@ -493,20 +487,6 @@ struct prcmu_auto_pm_config {
493 u8 sva_policy; 487 u8 sva_policy;
494}; 488};
495 489
496#define PRCMU_FW_PROJECT_U8500 2
497#define PRCMU_FW_PROJECT_U9500 4
498#define PRCMU_FW_PROJECT_U8500_C2 7
499#define PRCMU_FW_PROJECT_U9500_C2 11
500#define PRCMU_FW_PROJECT_U8520 13
501#define PRCMU_FW_PROJECT_U8420 14
502
503struct prcmu_fw_version {
504 u8 project;
505 u8 api_version;
506 u8 func_version;
507 u8 errata;
508};
509
510#ifdef CONFIG_MFD_DB8500_PRCMU 490#ifdef CONFIG_MFD_DB8500_PRCMU
511 491
512void db8500_prcmu_early_init(void); 492void db8500_prcmu_early_init(void);
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index c202d6c4d879..3abcca91eecd 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -12,6 +12,10 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/err.h> 13#include <linux/err.h>
14 14
15/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
18
15/* PRCMU Wakeup defines */ 19/* PRCMU Wakeup defines */
16enum prcmu_wakeup_index { 20enum prcmu_wakeup_index {
17 PRCMU_WAKEUP_INDEX_RTC, 21 PRCMU_WAKEUP_INDEX_RTC,
@@ -147,6 +151,18 @@ enum prcmu_clock {
147}; 151};
148 152
149/** 153/**
154 * enum prcmu_wdog_id - PRCMU watchdog IDs
155 * @PRCMU_WDOG_ALL: use all timers
156 * @PRCMU_WDOG_CPU1: use first CPU timer only
157 * @PRCMU_WDOG_CPU2: use second CPU timer conly
158 */
159enum prcmu_wdog_id {
160 PRCMU_WDOG_ALL = 0x00,
161 PRCMU_WDOG_CPU1 = 0x01,
162 PRCMU_WDOG_CPU2 = 0x02,
163};
164
165/**
150 * enum ape_opp - APE OPP states definition 166 * enum ape_opp - APE OPP states definition
151 * @APE_OPP_INIT: 167 * @APE_OPP_INIT:
152 * @APE_NO_CHANGE: The APE operating point is unchanged 168 * @APE_NO_CHANGE: The APE operating point is unchanged
@@ -214,12 +230,52 @@ enum ddr_pwrst {
214 DDR_PWR_STATE_OFFHIGHLAT = 0x03 230 DDR_PWR_STATE_OFFHIGHLAT = 0x03
215}; 231};
216 232
233#define DB8500_PRCMU_LEGACY_OFFSET 0xDD4
234
235struct prcmu_pdata
236{
237 bool enable_set_ddr_opp;
238 bool enable_ape_opp_100_voltage;
239 struct ab8500_platform_data *ab_platdata;
240 u32 version_offset;
241 u32 legacy_offset;
242 u32 adt_offset;
243};
244
245#define PRCMU_FW_PROJECT_U8500 2
246#define PRCMU_FW_PROJECT_U8400 3
247#define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */
248#define PRCMU_FW_PROJECT_U8500_MBB 5
249#define PRCMU_FW_PROJECT_U8500_C1 6
250#define PRCMU_FW_PROJECT_U8500_C2 7
251#define PRCMU_FW_PROJECT_U8500_C3 8
252#define PRCMU_FW_PROJECT_U8500_C4 9
253#define PRCMU_FW_PROJECT_U9500_MBL 10
254#define PRCMU_FW_PROJECT_U8500_MBL 11 /* Customer specific */
255#define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */
256#define PRCMU_FW_PROJECT_U8520 13
257#define PRCMU_FW_PROJECT_U8420 14
258#define PRCMU_FW_PROJECT_A9420 20
259/* [32..63] 9540 and derivatives */
260#define PRCMU_FW_PROJECT_U9540 32
261/* [64..95] 8540 and derivatives */
262#define PRCMU_FW_PROJECT_L8540 64
263/* [96..126] 8580 and derivatives */
264#define PRCMU_FW_PROJECT_L8580 96
265
266#define PRCMU_FW_PROJECT_NAME_LEN 20
267struct prcmu_fw_version {
268 u32 project; /* Notice, project shifted with 8 on ux540 */
269 u8 api_version;
270 u8 func_version;
271 u8 errata;
272 char project_name[PRCMU_FW_PROJECT_NAME_LEN];
273};
274
217#include <linux/mfd/db8500-prcmu.h> 275#include <linux/mfd/db8500-prcmu.h>
218 276
219#if defined(CONFIG_UX500_SOC_DB8500) 277#if defined(CONFIG_UX500_SOC_DB8500)
220 278
221#include <mach/id.h>
222
223static inline void __init prcmu_early_init(void) 279static inline void __init prcmu_early_init(void)
224{ 280{
225 return db8500_prcmu_early_init(); 281 return db8500_prcmu_early_init();
@@ -626,85 +682,6 @@ static inline void prcmu_clear(unsigned int reg, u32 bits)
626 prcmu_write_masked(reg, bits, 0); 682 prcmu_write_masked(reg, bits, 0);
627} 683}
628 684
629#if defined(CONFIG_UX500_SOC_DB8500)
630
631/**
632 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
633 */
634static inline void prcmu_enable_spi2(void)
635{
636 if (cpu_is_u8500())
637 prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
638}
639
640/**
641 * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
642 */
643static inline void prcmu_disable_spi2(void)
644{
645 if (cpu_is_u8500())
646 prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
647}
648
649/**
650 * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
651 * and UARTMOD on OtherAlternateC3.
652 */
653static inline void prcmu_enable_stm_mod_uart(void)
654{
655 if (cpu_is_u8500()) {
656 prcmu_set(DB8500_PRCM_GPIOCR,
657 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
658 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
659 }
660}
661
662/**
663 * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
664 * and UARTMOD on OtherAlternateC3.
665 */
666static inline void prcmu_disable_stm_mod_uart(void)
667{
668 if (cpu_is_u8500()) {
669 prcmu_clear(DB8500_PRCM_GPIOCR,
670 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
671 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
672 }
673}
674
675/**
676 * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
677 */
678static inline void prcmu_enable_stm_ape(void)
679{
680 if (cpu_is_u8500()) {
681 prcmu_set(DB8500_PRCM_GPIOCR,
682 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
683 }
684}
685
686/**
687 * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
688 */
689static inline void prcmu_disable_stm_ape(void)
690{
691 if (cpu_is_u8500()) {
692 prcmu_clear(DB8500_PRCM_GPIOCR,
693 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
694 }
695}
696
697#else
698
699static inline void prcmu_enable_spi2(void) {}
700static inline void prcmu_disable_spi2(void) {}
701static inline void prcmu_enable_stm_mod_uart(void) {}
702static inline void prcmu_disable_stm_mod_uart(void) {}
703static inline void prcmu_enable_stm_ape(void) {}
704static inline void prcmu_disable_stm_ape(void) {}
705
706#endif
707
708/* PRCMU QoS APE OPP class */ 685/* PRCMU QoS APE OPP class */
709#define PRCMU_QOS_APE_OPP 1 686#define PRCMU_QOS_APE_OPP 1
710#define PRCMU_QOS_DDR_OPP 2 687#define PRCMU_QOS_DDR_OPP 2
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
index 2a32b16f79cb..786bf6679a28 100644
--- a/include/linux/mfd/lp8788.h
+++ b/include/linux/mfd/lp8788.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/irqdomain.h> 18#include <linux/irqdomain.h>
19#include <linux/pwm.h>
19#include <linux/regmap.h> 20#include <linux/regmap.h>
20 21
21#define LP8788_DEV_BUCK "lp8788-buck" 22#define LP8788_DEV_BUCK "lp8788-buck"
@@ -124,11 +125,6 @@ enum lp8788_bl_ramp_step {
124 LP8788_RAMP_65538us, 125 LP8788_RAMP_65538us,
125}; 126};
126 127
127enum lp8788_bl_pwm_polarity {
128 LP8788_PWM_ACTIVE_HIGH,
129 LP8788_PWM_ACTIVE_LOW,
130};
131
132enum lp8788_isink_scale { 128enum lp8788_isink_scale {
133 LP8788_ISINK_SCALE_100mA, 129 LP8788_ISINK_SCALE_100mA,
134 LP8788_ISINK_SCALE_120mA, 130 LP8788_ISINK_SCALE_120mA,
@@ -229,16 +225,6 @@ struct lp8788_charger_platform_data {
229}; 225};
230 226
231/* 227/*
232 * struct lp8788_bl_pwm_data
233 * @pwm_set_intensity : set duty of pwm
234 * @pwm_get_intensity : get current duty of pwm
235 */
236struct lp8788_bl_pwm_data {
237 void (*pwm_set_intensity) (int brightness, int max_brightness);
238 int (*pwm_get_intensity) (int max_brightness);
239};
240
241/*
242 * struct lp8788_backlight_platform_data 228 * struct lp8788_backlight_platform_data
243 * @name : backlight driver name. (default: "lcd-backlight") 229 * @name : backlight driver name. (default: "lcd-backlight")
244 * @initial_brightness : initial value of backlight brightness 230 * @initial_brightness : initial value of backlight brightness
@@ -248,8 +234,8 @@ struct lp8788_bl_pwm_data {
248 * @rise_time : brightness ramp up step time 234 * @rise_time : brightness ramp up step time
249 * @fall_time : brightness ramp down step time 235 * @fall_time : brightness ramp down step time
250 * @pwm_pol : pwm polarity setting when bl_mode is pwm based 236 * @pwm_pol : pwm polarity setting when bl_mode is pwm based
251 * @pwm_data : platform specific pwm generation functions 237 * @period_ns : platform specific pwm period value. unit is nano.
252 * only valid when bl_mode is pwm based 238 Only valid when bl_mode is LP8788_BL_COMB_PWM_BASED
253 */ 239 */
254struct lp8788_backlight_platform_data { 240struct lp8788_backlight_platform_data {
255 char *name; 241 char *name;
@@ -259,8 +245,8 @@ struct lp8788_backlight_platform_data {
259 enum lp8788_bl_full_scale_current full_scale; 245 enum lp8788_bl_full_scale_current full_scale;
260 enum lp8788_bl_ramp_step rise_time; 246 enum lp8788_bl_ramp_step rise_time;
261 enum lp8788_bl_ramp_step fall_time; 247 enum lp8788_bl_ramp_step fall_time;
262 enum lp8788_bl_pwm_polarity pwm_pol; 248 enum pwm_polarity pwm_pol;
263 struct lp8788_bl_pwm_data pwm_data; 249 unsigned int period_ns;
264}; 250};
265 251
266/* 252/*
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 1eeae5c07915..5b18ecde69b5 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -106,6 +106,92 @@ enum max77693_muic_reg {
106 MAX77693_MUIC_REG_END, 106 MAX77693_MUIC_REG_END,
107}; 107};
108 108
109/* MAX77693 MUIC - STATUS1~3 Register */
110#define STATUS1_ADC_SHIFT (0)
111#define STATUS1_ADCLOW_SHIFT (5)
112#define STATUS1_ADCERR_SHIFT (6)
113#define STATUS1_ADC1K_SHIFT (7)
114#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
115#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT)
116#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT)
117#define STATUS1_ADC1K_MASK (0x1 << STATUS1_ADC1K_SHIFT)
118
119#define STATUS2_CHGTYP_SHIFT (0)
120#define STATUS2_CHGDETRUN_SHIFT (3)
121#define STATUS2_DCDTMR_SHIFT (4)
122#define STATUS2_DXOVP_SHIFT (5)
123#define STATUS2_VBVOLT_SHIFT (6)
124#define STATUS2_VIDRM_SHIFT (7)
125#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
126#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT)
127#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT)
128#define STATUS2_DXOVP_MASK (0x1 << STATUS2_DXOVP_SHIFT)
129#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT)
130#define STATUS2_VIDRM_MASK (0x1 << STATUS2_VIDRM_SHIFT)
131
132#define STATUS3_OVP_SHIFT (2)
133#define STATUS3_OVP_MASK (0x1 << STATUS3_OVP_SHIFT)
134
135/* MAX77693 CDETCTRL1~2 register */
136#define CDETCTRL1_CHGDETEN_SHIFT (0)
137#define CDETCTRL1_CHGTYPMAN_SHIFT (1)
138#define CDETCTRL1_DCDEN_SHIFT (2)
139#define CDETCTRL1_DCD2SCT_SHIFT (3)
140#define CDETCTRL1_CDDELAY_SHIFT (4)
141#define CDETCTRL1_DCDCPL_SHIFT (5)
142#define CDETCTRL1_CDPDET_SHIFT (7)
143#define CDETCTRL1_CHGDETEN_MASK (0x1 << CDETCTRL1_CHGDETEN_SHIFT)
144#define CDETCTRL1_CHGTYPMAN_MASK (0x1 << CDETCTRL1_CHGTYPMAN_SHIFT)
145#define CDETCTRL1_DCDEN_MASK (0x1 << CDETCTRL1_DCDEN_SHIFT)
146#define CDETCTRL1_DCD2SCT_MASK (0x1 << CDETCTRL1_DCD2SCT_SHIFT)
147#define CDETCTRL1_CDDELAY_MASK (0x1 << CDETCTRL1_CDDELAY_SHIFT)
148#define CDETCTRL1_DCDCPL_MASK (0x1 << CDETCTRL1_DCDCPL_SHIFT)
149#define CDETCTRL1_CDPDET_MASK (0x1 << CDETCTRL1_CDPDET_SHIFT)
150
151#define CDETCTRL2_VIDRMEN_SHIFT (1)
152#define CDETCTRL2_DXOVPEN_SHIFT (3)
153#define CDETCTRL2_VIDRMEN_MASK (0x1 << CDETCTRL2_VIDRMEN_SHIFT)
154#define CDETCTRL2_DXOVPEN_MASK (0x1 << CDETCTRL2_DXOVPEN_SHIFT)
155
156/* MAX77693 MUIC - CONTROL1~3 register */
157#define COMN1SW_SHIFT (0)
158#define COMP2SW_SHIFT (3)
159#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
160#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
161#define COMP_SW_MASK (COMP2SW_MASK | COMN1SW_MASK)
162#define CONTROL1_SW_USB ((1 << COMP2SW_SHIFT) \
163 | (1 << COMN1SW_SHIFT))
164#define CONTROL1_SW_AUDIO ((2 << COMP2SW_SHIFT) \
165 | (2 << COMN1SW_SHIFT))
166#define CONTROL1_SW_UART ((3 << COMP2SW_SHIFT) \
167 | (3 << COMN1SW_SHIFT))
168#define CONTROL1_SW_OPEN ((0 << COMP2SW_SHIFT) \
169 | (0 << COMN1SW_SHIFT))
170
171#define CONTROL2_LOWPWR_SHIFT (0)
172#define CONTROL2_ADCEN_SHIFT (1)
173#define CONTROL2_CPEN_SHIFT (2)
174#define CONTROL2_SFOUTASRT_SHIFT (3)
175#define CONTROL2_SFOUTORD_SHIFT (4)
176#define CONTROL2_ACCDET_SHIFT (5)
177#define CONTROL2_USBCPINT_SHIFT (6)
178#define CONTROL2_RCPS_SHIFT (7)
179#define CONTROL2_LOWPWR_MASK (0x1 << CONTROL2_LOWPWR_SHIFT)
180#define CONTROL2_ADCEN_MASK (0x1 << CONTROL2_ADCEN_SHIFT)
181#define CONTROL2_CPEN_MASK (0x1 << CONTROL2_CPEN_SHIFT)
182#define CONTROL2_SFOUTASRT_MASK (0x1 << CONTROL2_SFOUTASRT_SHIFT)
183#define CONTROL2_SFOUTORD_MASK (0x1 << CONTROL2_SFOUTORD_SHIFT)
184#define CONTROL2_ACCDET_MASK (0x1 << CONTROL2_ACCDET_SHIFT)
185#define CONTROL2_USBCPINT_MASK (0x1 << CONTROL2_USBCPINT_SHIFT)
186#define CONTROL2_RCPS_MASK (0x1 << CONTROL2_RCPS_SHIFT)
187
188#define CONTROL3_JIGSET_SHIFT (0)
189#define CONTROL3_BTLDSET_SHIFT (2)
190#define CONTROL3_ADCDBSET_SHIFT (4)
191#define CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
192#define CONTROL3_BTLDSET_MASK (0x3 << CONTROL3_BTLDSET_SHIFT)
193#define CONTROL3_ADCDBSET_MASK (0x3 << CONTROL3_ADCDBSET_SHIFT)
194
109/* Slave addr = 0x90: Haptic */ 195/* Slave addr = 0x90: Haptic */
110enum max77693_haptic_reg { 196enum max77693_haptic_reg {
111 MAX77693_HAPTIC_REG_STATUS = 0x00, 197 MAX77693_HAPTIC_REG_STATUS = 0x00,
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index fe03b2d35d4f..3109a6c5c948 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -38,6 +38,15 @@ struct max77693_reg_data {
38struct max77693_muic_platform_data { 38struct max77693_muic_platform_data {
39 struct max77693_reg_data *init_data; 39 struct max77693_reg_data *init_data;
40 int num_init_data; 40 int num_init_data;
41
42 int detcable_delay_ms;
43
44 /*
45 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
46 * h/w path of COMP2/COMN1 on CONTROL1 register.
47 */
48 int path_usb;
49 int path_uart;
41}; 50};
42 51
43struct max77693_platform_data { 52struct max77693_platform_data {
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 74d8e2969630..ce8502e9e7dc 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -190,6 +190,8 @@ enum {
190 MAX8925_NR_IRQS, 190 MAX8925_NR_IRQS,
191}; 191};
192 192
193
194
193struct max8925_chip { 195struct max8925_chip {
194 struct device *dev; 196 struct device *dev;
195 struct i2c_client *i2c; 197 struct i2c_client *i2c;
@@ -201,7 +203,6 @@ struct max8925_chip {
201 int irq_base; 203 int irq_base;
202 int core_irq; 204 int core_irq;
203 int tsc_irq; 205 int tsc_irq;
204
205 unsigned int wakeup_flag; 206 unsigned int wakeup_flag;
206}; 207};
207 208
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 6ae21bf47d64..fb465dfbb59e 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -194,6 +194,70 @@ enum max8997_muic_reg {
194 MAX8997_MUIC_REG_END = 0xf, 194 MAX8997_MUIC_REG_END = 0xf,
195}; 195};
196 196
197/* MAX8997-MUIC STATUS1 register */
198#define STATUS1_ADC_SHIFT 0
199#define STATUS1_ADCLOW_SHIFT 5
200#define STATUS1_ADCERR_SHIFT 6
201#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
202#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT)
203#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT)
204
205/* MAX8997-MUIC STATUS2 register */
206#define STATUS2_CHGTYP_SHIFT 0
207#define STATUS2_CHGDETRUN_SHIFT 3
208#define STATUS2_DCDTMR_SHIFT 4
209#define STATUS2_DBCHG_SHIFT 5
210#define STATUS2_VBVOLT_SHIFT 6
211#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
212#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT)
213#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT)
214#define STATUS2_DBCHG_MASK (0x1 << STATUS2_DBCHG_SHIFT)
215#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT)
216
217/* MAX8997-MUIC STATUS3 register */
218#define STATUS3_OVP_SHIFT 2
219#define STATUS3_OVP_MASK (0x1 << STATUS3_OVP_SHIFT)
220
221/* MAX8997-MUIC CONTROL1 register */
222#define COMN1SW_SHIFT 0
223#define COMP2SW_SHIFT 3
224#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
225#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
226#define COMP_SW_MASK (COMP2SW_MASK | COMN1SW_MASK)
227
228#define CONTROL1_SW_USB ((1 << COMP2SW_SHIFT) \
229 | (1 << COMN1SW_SHIFT))
230#define CONTROL1_SW_AUDIO ((2 << COMP2SW_SHIFT) \
231 | (2 << COMN1SW_SHIFT))
232#define CONTROL1_SW_UART ((3 << COMP2SW_SHIFT) \
233 | (3 << COMN1SW_SHIFT))
234#define CONTROL1_SW_OPEN ((0 << COMP2SW_SHIFT) \
235 | (0 << COMN1SW_SHIFT))
236
237#define CONTROL2_LOWPWR_SHIFT (0)
238#define CONTROL2_ADCEN_SHIFT (1)
239#define CONTROL2_CPEN_SHIFT (2)
240#define CONTROL2_SFOUTASRT_SHIFT (3)
241#define CONTROL2_SFOUTORD_SHIFT (4)
242#define CONTROL2_ACCDET_SHIFT (5)
243#define CONTROL2_USBCPINT_SHIFT (6)
244#define CONTROL2_RCPS_SHIFT (7)
245#define CONTROL2_LOWPWR_MASK (0x1 << CONTROL2_LOWPWR_SHIFT)
246#define CONTROL2_ADCEN_MASK (0x1 << CONTROL2_ADCEN_SHIFT)
247#define CONTROL2_CPEN_MASK (0x1 << CONTROL2_CPEN_SHIFT)
248#define CONTROL2_SFOUTASRT_MASK (0x1 << CONTROL2_SFOUTASRT_SHIFT)
249#define CONTROL2_SFOUTORD_MASK (0x1 << CONTROL2_SFOUTORD_SHIFT)
250#define CONTROL2_ACCDET_MASK (0x1 << CONTROL2_ACCDET_SHIFT)
251#define CONTROL2_USBCPINT_MASK (0x1 << CONTROL2_USBCPINT_SHIFT)
252#define CONTROL2_RCPS_MASK (0x1 << CONTROL2_RCPS_SHIFT)
253
254#define CONTROL3_JIGSET_SHIFT (0)
255#define CONTROL3_BTLDSET_SHIFT (2)
256#define CONTROL3_ADCDBSET_SHIFT (4)
257#define CONTROL3_JIGSET_MASK (0x3 << CONTROL3_JIGSET_SHIFT)
258#define CONTROL3_BTLDSET_MASK (0x3 << CONTROL3_BTLDSET_SHIFT)
259#define CONTROL3_ADCDBSET_MASK (0x3 << CONTROL3_ADCDBSET_SHIFT)
260
197enum max8997_haptic_reg { 261enum max8997_haptic_reg {
198 MAX8997_HAPTIC_REG_GENERAL = 0x00, 262 MAX8997_HAPTIC_REG_GENERAL = 0x00,
199 MAX8997_HAPTIC_REG_CONF1 = 0x01, 263 MAX8997_HAPTIC_REG_CONF1 = 0x01,
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 1d4a4fe6ac33..cf815577bd68 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -78,21 +78,6 @@ struct max8997_regulator_data {
78 struct device_node *reg_node; 78 struct device_node *reg_node;
79}; 79};
80 80
81enum max8997_muic_usb_type {
82 MAX8997_USB_HOST,
83 MAX8997_USB_DEVICE,
84};
85
86enum max8997_muic_charger_type {
87 MAX8997_CHARGER_TYPE_NONE = 0,
88 MAX8997_CHARGER_TYPE_USB,
89 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
90 MAX8997_CHARGER_TYPE_DEDICATED_CHG,
91 MAX8997_CHARGER_TYPE_500MA,
92 MAX8997_CHARGER_TYPE_1A,
93 MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
94};
95
96struct max8997_muic_reg_data { 81struct max8997_muic_reg_data {
97 u8 addr; 82 u8 addr;
98 u8 data; 83 u8 data;
@@ -107,6 +92,16 @@ struct max8997_muic_reg_data {
107struct max8997_muic_platform_data { 92struct max8997_muic_platform_data {
108 struct max8997_muic_reg_data *init_data; 93 struct max8997_muic_reg_data *init_data;
109 int num_init_data; 94 int num_init_data;
95
96 /* Check cable state after certain delay */
97 int detcable_delay_ms;
98
99 /*
100 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
101 * h/w path of COMP2/COMN1 on CONTROL1 register.
102 */
103 int path_usb;
104 int path_uart;
110}; 105};
111 106
112enum max8997_haptic_motor_type { 107enum max8997_haptic_motor_type {
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 29f6616e12f0..a4d13d7cd001 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -2789,4 +2789,56 @@ enum usb_irq_events {
2789#define PALMAS_GPADC_TRIM15 0xE 2789#define PALMAS_GPADC_TRIM15 0xE
2790#define PALMAS_GPADC_TRIM16 0xF 2790#define PALMAS_GPADC_TRIM16 0xF
2791 2791
2792static inline int palmas_read(struct palmas *palmas, unsigned int base,
2793 unsigned int reg, unsigned int *val)
2794{
2795 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2796 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2797
2798 return regmap_read(palmas->regmap[slave_id], addr, val);
2799}
2800
2801static inline int palmas_write(struct palmas *palmas, unsigned int base,
2802 unsigned int reg, unsigned int value)
2803{
2804 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2805 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2806
2807 return regmap_write(palmas->regmap[slave_id], addr, value);
2808}
2809
2810static inline int palmas_bulk_write(struct palmas *palmas, unsigned int base,
2811 unsigned int reg, const void *val, size_t val_count)
2812{
2813 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2814 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2815
2816 return regmap_bulk_write(palmas->regmap[slave_id], addr,
2817 val, val_count);
2818}
2819
2820static inline int palmas_bulk_read(struct palmas *palmas, unsigned int base,
2821 unsigned int reg, void *val, size_t val_count)
2822{
2823 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2824 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2825
2826 return regmap_bulk_read(palmas->regmap[slave_id], addr,
2827 val, val_count);
2828}
2829
2830static inline int palmas_update_bits(struct palmas *palmas, unsigned int base,
2831 unsigned int reg, unsigned int mask, unsigned int val)
2832{
2833 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2834 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2835
2836 return regmap_update_bits(palmas->regmap[slave_id], addr, mask, val);
2837}
2838
2839static inline int palmas_irq_get_virq(struct palmas *palmas, int irq)
2840{
2841 return regmap_irq_get_virq(palmas->irq_data, irq);
2842}
2843
2792#endif /* __LINUX_MFD_PALMAS_H */ 2844#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index a8d393e3066b..2b13970596f5 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -38,6 +38,9 @@
38#define RTSX_SD_CARD 0 38#define RTSX_SD_CARD 0
39#define RTSX_MS_CARD 1 39#define RTSX_MS_CARD 1
40 40
41#define CLK_TO_DIV_N 0
42#define DIV_N_TO_CLK 1
43
41struct platform_device; 44struct platform_device;
42 45
43struct rtsx_slot { 46struct rtsx_slot {
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 060b721fcbfb..26ea7f1b7caf 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -158,10 +158,9 @@
158#define SG_TRANS_DATA (0x02 << 4) 158#define SG_TRANS_DATA (0x02 << 4)
159#define SG_LINK_DESC (0x03 << 4) 159#define SG_LINK_DESC (0x03 << 4)
160 160
161/* SD bank voltage */ 161/* Output voltage */
162#define SD_IO_3V3 0 162#define OUTPUT_3V3 0
163#define SD_IO_1V8 1 163#define OUTPUT_1V8 1
164
165 164
166/* Card Clock Enable Register */ 165/* Card Clock Enable Register */
167#define SD_CLK_EN 0x04 166#define SD_CLK_EN 0x04
@@ -201,6 +200,20 @@
201#define CHANGE_CLK 0x01 200#define CHANGE_CLK 0x01
202 201
203/* LDO_CTL */ 202/* LDO_CTL */
203#define BPP_ASIC_1V7 0x00
204#define BPP_ASIC_1V8 0x01
205#define BPP_ASIC_1V9 0x02
206#define BPP_ASIC_2V0 0x03
207#define BPP_ASIC_2V7 0x04
208#define BPP_ASIC_2V8 0x05
209#define BPP_ASIC_3V2 0x06
210#define BPP_ASIC_3V3 0x07
211#define BPP_REG_TUNED18 0x07
212#define BPP_TUNED18_SHIFT_8402 5
213#define BPP_TUNED18_SHIFT_8411 4
214#define BPP_PAD_MASK 0x04
215#define BPP_PAD_3V3 0x04
216#define BPP_PAD_1V8 0x00
204#define BPP_LDO_POWB 0x03 217#define BPP_LDO_POWB 0x03
205#define BPP_LDO_ON 0x00 218#define BPP_LDO_ON 0x00
206#define BPP_LDO_SUSPEND 0x02 219#define BPP_LDO_SUSPEND 0x02
@@ -452,7 +465,7 @@
452#define SD_RSP_TYPE_R6 0x01 465#define SD_RSP_TYPE_R6 0x01
453#define SD_RSP_TYPE_R7 0x01 466#define SD_RSP_TYPE_R7 0x01
454 467
455/* SD_CONFIURE3 */ 468/* SD_CONFIGURE3 */
456#define SD_RSP_80CLK_TIMEOUT_EN 0x01 469#define SD_RSP_80CLK_TIMEOUT_EN 0x01
457 470
458/* Card Transfer Reset Register */ 471/* Card Transfer Reset Register */
@@ -568,8 +581,11 @@
568#define CARD_GPIO_DIR 0xFD57 581#define CARD_GPIO_DIR 0xFD57
569#define CARD_GPIO 0xFD58 582#define CARD_GPIO 0xFD58
570#define CARD_DATA_SOURCE 0xFD5B 583#define CARD_DATA_SOURCE 0xFD5B
584#define SD30_CLK_DRIVE_SEL 0xFD5A
571#define CARD_SELECT 0xFD5C 585#define CARD_SELECT 0xFD5C
572#define SD30_DRIVE_SEL 0xFD5E 586#define SD30_DRIVE_SEL 0xFD5E
587#define SD30_CMD_DRIVE_SEL 0xFD5E
588#define SD30_DAT_DRIVE_SEL 0xFD5F
573#define CARD_CLK_EN 0xFD69 589#define CARD_CLK_EN 0xFD69
574#define SDIO_CTRL 0xFD6B 590#define SDIO_CTRL 0xFD6B
575#define CD_PAD_CTL 0xFD73 591#define CD_PAD_CTL 0xFD73
@@ -642,6 +658,8 @@
642#define MSGTXDATA3 0xFE47 658#define MSGTXDATA3 0xFE47
643#define MSGTXCTL 0xFE48 659#define MSGTXCTL 0xFE48
644#define PETXCFG 0xFE49 660#define PETXCFG 0xFE49
661#define LTR_CTL 0xFE4A
662#define OBFF_CFG 0xFE4C
645 663
646#define CDRESUMECTL 0xFE52 664#define CDRESUMECTL 0xFE52
647#define WAKE_SEL_CTL 0xFE54 665#define WAKE_SEL_CTL 0xFE54
@@ -688,7 +706,10 @@ struct pcr_ops {
688 int (*disable_auto_blink)(struct rtsx_pcr *pcr); 706 int (*disable_auto_blink)(struct rtsx_pcr *pcr);
689 int (*card_power_on)(struct rtsx_pcr *pcr, int card); 707 int (*card_power_on)(struct rtsx_pcr *pcr, int card);
690 int (*card_power_off)(struct rtsx_pcr *pcr, int card); 708 int (*card_power_off)(struct rtsx_pcr *pcr, int card);
709 int (*switch_output_voltage)(struct rtsx_pcr *pcr,
710 u8 voltage);
691 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 711 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
712 int (*conv_clk_and_div_n)(int clk, int dir);
692}; 713};
693 714
694enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 715enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -719,6 +740,7 @@ struct rtsx_pcr {
719 740
720 unsigned int card_inserted; 741 unsigned int card_inserted;
721 unsigned int card_removed; 742 unsigned int card_removed;
743 unsigned int card_exist;
722 744
723 struct delayed_work carddet_work; 745 struct delayed_work carddet_work;
724 struct delayed_work idle_work; 746 struct delayed_work idle_work;
@@ -783,6 +805,8 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); 805 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); 806int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); 807int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
808int rtsx_pci_card_exclusive_check(struct rtsx_pcr *pcr, int card);
809int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage);
786unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); 810unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
787void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); 811void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
788 812
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index b50c38f8bc48..f0f4de3b4ccc 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -26,6 +26,7 @@ enum sec_device_type {
26/** 26/**
27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers 27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers
28 * @dev: master device of the chip (can be used to access platform data) 28 * @dev: master device of the chip (can be used to access platform data)
29 * @pdata: pointer to private data used to pass platform data to child
29 * @i2c: i2c client private data for regulator 30 * @i2c: i2c client private data for regulator
30 * @rtc: i2c client private data for rtc 31 * @rtc: i2c client private data for rtc
31 * @iolock: mutex for serializing io access 32 * @iolock: mutex for serializing io access
@@ -39,6 +40,7 @@ enum sec_device_type {
39 */ 40 */
40struct sec_pmic_dev { 41struct sec_pmic_dev {
41 struct device *dev; 42 struct device *dev;
43 struct sec_platform_data *pdata;
42 struct regmap *regmap; 44 struct regmap *regmap;
43 struct i2c_client *i2c; 45 struct i2c_client *i2c;
44 struct i2c_client *rtc; 46 struct i2c_client *rtc;
@@ -82,11 +84,11 @@ struct sec_platform_data {
82 84
83 int buck_gpios[3]; 85 int buck_gpios[3];
84 int buck_ds[3]; 86 int buck_ds[3];
85 int buck2_voltage[8]; 87 unsigned int buck2_voltage[8];
86 bool buck2_gpiodvs; 88 bool buck2_gpiodvs;
87 int buck3_voltage[8]; 89 unsigned int buck3_voltage[8];
88 bool buck3_gpiodvs; 90 bool buck3_gpiodvs;
89 int buck4_voltage[8]; 91 unsigned int buck4_voltage[8];
90 bool buck4_gpiodvs; 92 bool buck4_gpiodvs;
91 93
92 int buck_set1; 94 int buck_set1;
@@ -127,6 +129,7 @@ struct sec_platform_data {
127struct sec_regulator_data { 129struct sec_regulator_data {
128 int id; 130 int id;
129 struct regulator_init_data *initdata; 131 struct regulator_init_data *initdata;
132 struct device_node *reg_node;
130}; 133};
131 134
132/* 135/*
@@ -136,7 +139,7 @@ struct sec_regulator_data {
136 */ 139 */
137struct sec_opmode_data { 140struct sec_opmode_data {
138 int id; 141 int id;
139 int mode; 142 unsigned int mode;
140}; 143};
141 144
142/* 145/*
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index d83af39815ab..99bf3e665997 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -65,12 +65,6 @@
65 */ 65 */
66#define TMIO_MMC_SDIO_IRQ (1 << 2) 66#define TMIO_MMC_SDIO_IRQ (1 << 2)
67/* 67/*
68 * Some platforms can detect card insertion events with controller powered
69 * down, using a GPIO IRQ, in which case they have to fill in cd_irq, cd_gpio,
70 * and cd_flags fields of struct tmio_mmc_data.
71 */
72#define TMIO_MMC_HAS_COLD_CD (1 << 3)
73/*
74 * Some controllers require waiting for the SD bus to become 68 * Some controllers require waiting for the SD bus to become
75 * idle before writing to some registers. 69 * idle before writing to some registers.
76 */ 70 */
@@ -117,18 +111,6 @@ struct tmio_mmc_data {
117}; 111};
118 112
119/* 113/*
120 * This function is deprecated and will be removed soon. Please, convert your
121 * platform to use drivers/mmc/core/cd-gpio.c
122 */
123#include <linux/mmc/host.h>
124static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
125{
126 if (pdata)
127 mmc_detect_change(dev_get_drvdata(pdata->dev),
128 msecs_to_jiffies(100));
129}
130
131/*
132 * data for the NAND controller 114 * data for the NAND controller
133 */ 115 */
134struct tmio_nand_data { 116struct tmio_nand_data {
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index adfe8c058f29..9dbb41a4e250 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -21,8 +21,15 @@
21#define PHY_ID_KSZ8021 0x00221555 21#define PHY_ID_KSZ8021 0x00221555
22#define PHY_ID_KSZ8041 0x00221510 22#define PHY_ID_KSZ8041 0x00221510
23#define PHY_ID_KSZ8051 0x00221550 23#define PHY_ID_KSZ8051 0x00221550
24/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ 24/* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */
25#define PHY_ID_KSZ8001 0x0022161A 25#define PHY_ID_KSZ8001 0x0022161A
26/* same id: KS8081, KS8091 */
27#define PHY_ID_KSZ8081 0x00221560
28#define PHY_ID_KSZ8061 0x00221570
29#define PHY_ID_KSZ9031 0x00221620
30
31#define PHY_ID_KSZ886X 0x00221430
32#define PHY_ID_KSZ8863 0x00221435
26 33
27/* struct phy_device dev_flags definitions */ 34/* struct phy_device dev_flags definitions */
28#define MICREL_PHY_50MHZ_CLK 0x00000001 35#define MICREL_PHY_50MHZ_CLK 0x00000001
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 1e9f627967a3..a405d3dc0f61 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -40,11 +40,9 @@ extern void putback_movable_pages(struct list_head *l);
40extern int migrate_page(struct address_space *, 40extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 41 struct page *, struct page *, enum migrate_mode);
42extern int migrate_pages(struct list_head *l, new_page_t x, 42extern int migrate_pages(struct list_head *l, new_page_t x,
43 unsigned long private, bool offlining, 43 unsigned long private, enum migrate_mode mode, int reason);
44 enum migrate_mode mode, int reason);
45extern int migrate_huge_page(struct page *, new_page_t x, 44extern int migrate_huge_page(struct page *, new_page_t x,
46 unsigned long private, bool offlining, 45 unsigned long private, enum migrate_mode mode);
47 enum migrate_mode mode);
48 46
49extern int fail_migrate_page(struct address_space *, 47extern int fail_migrate_page(struct address_space *,
50 struct page *, struct page *); 48 struct page *, struct page *);
@@ -62,11 +60,11 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
62static inline void putback_lru_pages(struct list_head *l) {} 60static inline void putback_lru_pages(struct list_head *l) {}
63static inline void putback_movable_pages(struct list_head *l) {} 61static inline void putback_movable_pages(struct list_head *l) {}
64static inline int migrate_pages(struct list_head *l, new_page_t x, 62static inline int migrate_pages(struct list_head *l, new_page_t x,
65 unsigned long private, bool offlining, 63 unsigned long private, enum migrate_mode mode, int reason)
66 enum migrate_mode mode, int reason) { return -ENOSYS; } 64 { return -ENOSYS; }
67static inline int migrate_huge_page(struct page *page, new_page_t x, 65static inline int migrate_huge_page(struct page *page, new_page_t x,
68 unsigned long private, bool offlining, 66 unsigned long private, enum migrate_mode mode)
69 enum migrate_mode mode) { return -ENOSYS; } 67 { return -ENOSYS; }
70 68
71static inline int migrate_prep(void) { return -ENOSYS; } 69static inline int migrate_prep(void) { return -ENOSYS; }
72static inline int migrate_prep_local(void) { return -ENOSYS; } 70static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 20ea939c22a6..811f91cf5e8c 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -150,7 +150,8 @@ enum {
150 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0, 150 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
151 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1, 151 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
152 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2, 152 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2,
153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3 153 MLX4_DEV_CAP_FLAG2_FS_EN = 1LL << 3,
154 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4
154}; 155};
155 156
156enum { 157enum {
@@ -170,6 +171,7 @@ enum {
170#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 171#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
171 172
172enum { 173enum {
174 MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1,
173 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, 175 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6,
174 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, 176 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7,
175 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 177 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
@@ -237,7 +239,8 @@ enum {
237 MLX4_PERM_LOCAL_WRITE = 1 << 11, 239 MLX4_PERM_LOCAL_WRITE = 1 << 11,
238 MLX4_PERM_REMOTE_READ = 1 << 12, 240 MLX4_PERM_REMOTE_READ = 1 << 12,
239 MLX4_PERM_REMOTE_WRITE = 1 << 13, 241 MLX4_PERM_REMOTE_WRITE = 1 << 13,
240 MLX4_PERM_ATOMIC = 1 << 14 242 MLX4_PERM_ATOMIC = 1 << 14,
243 MLX4_PERM_BIND_MW = 1 << 15,
241}; 244};
242 245
243enum { 246enum {
@@ -503,6 +506,18 @@ struct mlx4_mr {
503 int enabled; 506 int enabled;
504}; 507};
505 508
509enum mlx4_mw_type {
510 MLX4_MW_TYPE_1 = 1,
511 MLX4_MW_TYPE_2 = 2,
512};
513
514struct mlx4_mw {
515 u32 key;
516 u32 pd;
517 enum mlx4_mw_type type;
518 int enabled;
519};
520
506struct mlx4_fmr { 521struct mlx4_fmr {
507 struct mlx4_mr mr; 522 struct mlx4_mr mr;
508 struct mlx4_mpt_entry *mpt; 523 struct mlx4_mpt_entry *mpt;
@@ -801,8 +816,12 @@ u64 mlx4_mtt_addr(struct mlx4_dev *dev, struct mlx4_mtt *mtt);
801 816
802int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, 817int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
803 int npages, int page_shift, struct mlx4_mr *mr); 818 int npages, int page_shift, struct mlx4_mr *mr);
804void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr); 819int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr);
805int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr); 820int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr);
821int mlx4_mw_alloc(struct mlx4_dev *dev, u32 pd, enum mlx4_mw_type type,
822 struct mlx4_mw *mw);
823void mlx4_mw_free(struct mlx4_dev *dev, struct mlx4_mw *mw);
824int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
806int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 825int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
807 int start_index, int npages, u64 *page_list); 826 int start_index, int npages, u64 *page_list);
808int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 827int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
@@ -955,9 +974,8 @@ int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mo
955 974
956int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); 975int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
957void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 976void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
958int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 977int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port);
959int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); 978int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
960void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
961void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); 979void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
962int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 980int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
963 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 981 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 4b4ad6ffef92..67f46ad6920a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -265,6 +265,11 @@ struct mlx4_wqe_lso_seg {
265 __be32 header[0]; 265 __be32 header[0];
266}; 266};
267 267
268enum mlx4_wqe_bind_seg_flags2 {
269 MLX4_WQE_BIND_ZERO_BASED = (1 << 30),
270 MLX4_WQE_BIND_TYPE_2 = (1 << 31),
271};
272
268struct mlx4_wqe_bind_seg { 273struct mlx4_wqe_bind_seg {
269 __be32 flags1; 274 __be32 flags1;
270 __be32 flags2; 275 __be32 flags2;
@@ -277,9 +282,9 @@ struct mlx4_wqe_bind_seg {
277enum { 282enum {
278 MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27, 283 MLX4_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
279 MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28, 284 MLX4_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
280 MLX4_WQE_FMR_PERM_REMOTE_READ = 1 << 29, 285 MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ = 1 << 29,
281 MLX4_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30, 286 MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE = 1 << 30,
282 MLX4_WQE_FMR_PERM_ATOMIC = 1 << 31 287 MLX4_WQE_FMR_AND_BIND_PERM_ATOMIC = 1 << 31
283}; 288};
284 289
285struct mlx4_wqe_fmr_seg { 290struct mlx4_wqe_fmr_seg {
@@ -304,12 +309,10 @@ struct mlx4_wqe_fmr_ext_seg {
304}; 309};
305 310
306struct mlx4_wqe_local_inval_seg { 311struct mlx4_wqe_local_inval_seg {
307 __be32 flags; 312 u64 reserved1;
308 u32 reserved1;
309 __be32 mem_key; 313 __be32 mem_key;
310 u32 reserved2[2]; 314 u32 reserved2;
311 __be32 guest_id; 315 u64 reserved3[2];
312 __be64 pa;
313}; 316};
314 317
315struct mlx4_wqe_raddr_seg { 318struct mlx4_wqe_raddr_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 63204078f72b..1ede55f292c2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -87,6 +87,7 @@ extern unsigned int kobjsize(const void *objp);
87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
89 89
90#define VM_POPULATE 0x00001000
90#define VM_LOCKED 0x00002000 91#define VM_LOCKED 0x00002000
91#define VM_IO 0x00004000 /* Memory mapped I/O or similar */ 92#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
92 93
@@ -366,7 +367,7 @@ static inline struct page *compound_head(struct page *page)
366 * both from it and to it can be tracked, using atomic_inc_and_test 367 * both from it and to it can be tracked, using atomic_inc_and_test
367 * and atomic_add_negative(-1). 368 * and atomic_add_negative(-1).
368 */ 369 */
369static inline void reset_page_mapcount(struct page *page) 370static inline void page_mapcount_reset(struct page *page)
370{ 371{
371 atomic_set(&(page)->_mapcount, -1); 372 atomic_set(&(page)->_mapcount, -1);
372} 373}
@@ -455,7 +456,6 @@ void put_pages_list(struct list_head *pages);
455 456
456void split_page(struct page *page, unsigned int order); 457void split_page(struct page *page, unsigned int order);
457int split_free_page(struct page *page); 458int split_free_page(struct page *page);
458int capture_free_page(struct page *page, int alloc_order, int migratetype);
459 459
460/* 460/*
461 * Compound pages have a destructor function. Provide a 461 * Compound pages have a destructor function. Provide a
@@ -581,50 +581,11 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
581 * sets it, so none of the operations on it need to be atomic. 581 * sets it, so none of the operations on it need to be atomic.
582 */ 582 */
583 583
584 584/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_NID] | ... | FLAGS | */
585/*
586 * page->flags layout:
587 *
588 * There are three possibilities for how page->flags get
589 * laid out. The first is for the normal case, without
590 * sparsemem. The second is for sparsemem when there is
591 * plenty of space for node and section. The last is when
592 * we have run out of space and have to fall back to an
593 * alternate (slower) way of determining the node.
594 *
595 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
596 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
597 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
598 */
599#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
600#define SECTIONS_WIDTH SECTIONS_SHIFT
601#else
602#define SECTIONS_WIDTH 0
603#endif
604
605#define ZONES_WIDTH ZONES_SHIFT
606
607#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
608#define NODES_WIDTH NODES_SHIFT
609#else
610#ifdef CONFIG_SPARSEMEM_VMEMMAP
611#error "Vmemmap: No space for nodes field in page flags"
612#endif
613#define NODES_WIDTH 0
614#endif
615
616/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
617#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) 585#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
618#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) 586#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
619#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) 587#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
620 588#define LAST_NID_PGOFF (ZONES_PGOFF - LAST_NID_WIDTH)
621/*
622 * We are going to use the flags for the page to node mapping if its in
623 * there. This includes the case where there is no node, so it is implicit.
624 */
625#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
626#define NODE_NOT_IN_PAGE_FLAGS
627#endif
628 589
629/* 590/*
630 * Define the bit shifts to access each section. For non-existent 591 * Define the bit shifts to access each section. For non-existent
@@ -634,6 +595,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
634#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) 595#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
635#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 596#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
636#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 597#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
598#define LAST_NID_PGSHIFT (LAST_NID_PGOFF * (LAST_NID_WIDTH != 0))
637 599
638/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */ 600/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
639#ifdef NODE_NOT_IN_PAGE_FLAGS 601#ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -655,6 +617,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
655#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 617#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
656#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 618#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
657#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 619#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
620#define LAST_NID_MASK ((1UL << LAST_NID_WIDTH) - 1)
658#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 621#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
659 622
660static inline enum zone_type page_zonenum(const struct page *page) 623static inline enum zone_type page_zonenum(const struct page *page)
@@ -662,6 +625,10 @@ static inline enum zone_type page_zonenum(const struct page *page)
662 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 625 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
663} 626}
664 627
628#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
629#define SECTION_IN_PAGE_FLAGS
630#endif
631
665/* 632/*
666 * The identification function is only used by the buddy allocator for 633 * The identification function is only used by the buddy allocator for
667 * determining if two pages could be buddies. We are not really 634 * determining if two pages could be buddies. We are not really
@@ -694,31 +661,48 @@ static inline int page_to_nid(const struct page *page)
694#endif 661#endif
695 662
696#ifdef CONFIG_NUMA_BALANCING 663#ifdef CONFIG_NUMA_BALANCING
697static inline int page_xchg_last_nid(struct page *page, int nid) 664#ifdef LAST_NID_NOT_IN_PAGE_FLAGS
665static inline int page_nid_xchg_last(struct page *page, int nid)
698{ 666{
699 return xchg(&page->_last_nid, nid); 667 return xchg(&page->_last_nid, nid);
700} 668}
701 669
702static inline int page_last_nid(struct page *page) 670static inline int page_nid_last(struct page *page)
703{ 671{
704 return page->_last_nid; 672 return page->_last_nid;
705} 673}
706static inline void reset_page_last_nid(struct page *page) 674static inline void page_nid_reset_last(struct page *page)
707{ 675{
708 page->_last_nid = -1; 676 page->_last_nid = -1;
709} 677}
710#else 678#else
711static inline int page_xchg_last_nid(struct page *page, int nid) 679static inline int page_nid_last(struct page *page)
680{
681 return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK;
682}
683
684extern int page_nid_xchg_last(struct page *page, int nid);
685
686static inline void page_nid_reset_last(struct page *page)
687{
688 int nid = (1 << LAST_NID_SHIFT) - 1;
689
690 page->flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT);
691 page->flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT;
692}
693#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
694#else
695static inline int page_nid_xchg_last(struct page *page, int nid)
712{ 696{
713 return page_to_nid(page); 697 return page_to_nid(page);
714} 698}
715 699
716static inline int page_last_nid(struct page *page) 700static inline int page_nid_last(struct page *page)
717{ 701{
718 return page_to_nid(page); 702 return page_to_nid(page);
719} 703}
720 704
721static inline void reset_page_last_nid(struct page *page) 705static inline void page_nid_reset_last(struct page *page)
722{ 706{
723} 707}
724#endif 708#endif
@@ -728,7 +712,7 @@ static inline struct zone *page_zone(const struct page *page)
728 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 712 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
729} 713}
730 714
731#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 715#ifdef SECTION_IN_PAGE_FLAGS
732static inline void set_page_section(struct page *page, unsigned long section) 716static inline void set_page_section(struct page *page, unsigned long section)
733{ 717{
734 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); 718 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
@@ -758,7 +742,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
758{ 742{
759 set_page_zone(page, zone); 743 set_page_zone(page, zone);
760 set_page_node(page, node); 744 set_page_node(page, node);
761#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 745#ifdef SECTION_IN_PAGE_FLAGS
762 set_page_section(page, pfn_to_section_nr(pfn)); 746 set_page_section(page, pfn_to_section_nr(pfn));
763#endif 747#endif
764} 748}
@@ -818,18 +802,7 @@ void page_address_init(void);
818#define PAGE_MAPPING_KSM 2 802#define PAGE_MAPPING_KSM 2
819#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM) 803#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM)
820 804
821extern struct address_space swapper_space; 805extern struct address_space *page_mapping(struct page *page);
822static inline struct address_space *page_mapping(struct page *page)
823{
824 struct address_space *mapping = page->mapping;
825
826 VM_BUG_ON(PageSlab(page));
827 if (unlikely(PageSwapCache(page)))
828 mapping = &swapper_space;
829 else if ((unsigned long)mapping & PAGE_MAPPING_ANON)
830 mapping = NULL;
831 return mapping;
832}
833 806
834/* Neutral page->mapping pointer to address_space or anon_vma or other */ 807/* Neutral page->mapping pointer to address_space or anon_vma or other */
835static inline void *page_rmapping(struct page *page) 808static inline void *page_rmapping(struct page *page)
@@ -1036,18 +1009,18 @@ static inline int fixup_user_fault(struct task_struct *tsk,
1036} 1009}
1037#endif 1010#endif
1038 1011
1039extern int make_pages_present(unsigned long addr, unsigned long end);
1040extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 1012extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
1041extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, 1013extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
1042 void *buf, int len, int write); 1014 void *buf, int len, int write);
1043 1015
1044int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1016long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1045 unsigned long start, int len, unsigned int foll_flags, 1017 unsigned long start, unsigned long nr_pages,
1046 struct page **pages, struct vm_area_struct **vmas, 1018 unsigned int foll_flags, struct page **pages,
1047 int *nonblocking); 1019 struct vm_area_struct **vmas, int *nonblocking);
1048int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1020long get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
1049 unsigned long start, int nr_pages, int write, int force, 1021 unsigned long start, unsigned long nr_pages,
1050 struct page **pages, struct vm_area_struct **vmas); 1022 int write, int force, struct page **pages,
1023 struct vm_area_struct **vmas);
1051int get_user_pages_fast(unsigned long start, int nr_pages, int write, 1024int get_user_pages_fast(unsigned long start, int nr_pages, int write,
1052 struct page **pages); 1025 struct page **pages);
1053struct kvec; 1026struct kvec;
@@ -1387,7 +1360,6 @@ extern void __init mmap_init(void);
1387extern void show_mem(unsigned int flags); 1360extern void show_mem(unsigned int flags);
1388extern void si_meminfo(struct sysinfo * val); 1361extern void si_meminfo(struct sysinfo * val);
1389extern void si_meminfo_node(struct sysinfo *val, int nid); 1362extern void si_meminfo_node(struct sysinfo *val, int nid);
1390extern int after_bootmem;
1391 1363
1392extern __printf(3, 4) 1364extern __printf(3, 4)
1393void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...); 1365void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...);
@@ -1397,6 +1369,9 @@ extern void setup_per_cpu_pageset(void);
1397extern void zone_pcp_update(struct zone *zone); 1369extern void zone_pcp_update(struct zone *zone);
1398extern void zone_pcp_reset(struct zone *zone); 1370extern void zone_pcp_reset(struct zone *zone);
1399 1371
1372/* page_alloc.c */
1373extern int min_free_kbytes;
1374
1400/* nommu.c */ 1375/* nommu.c */
1401extern atomic_long_t mmap_pages_allocated; 1376extern atomic_long_t mmap_pages_allocated;
1402extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); 1377extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
@@ -1474,13 +1449,24 @@ extern int install_special_mapping(struct mm_struct *mm,
1474extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1449extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1475 1450
1476extern unsigned long mmap_region(struct file *file, unsigned long addr, 1451extern unsigned long mmap_region(struct file *file, unsigned long addr,
1477 unsigned long len, unsigned long flags, 1452 unsigned long len, vm_flags_t vm_flags, unsigned long pgoff);
1478 vm_flags_t vm_flags, unsigned long pgoff); 1453extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1479extern unsigned long do_mmap_pgoff(struct file *, unsigned long, 1454 unsigned long len, unsigned long prot, unsigned long flags,
1480 unsigned long, unsigned long, 1455 unsigned long pgoff, unsigned long *populate);
1481 unsigned long, unsigned long);
1482extern int do_munmap(struct mm_struct *, unsigned long, size_t); 1456extern int do_munmap(struct mm_struct *, unsigned long, size_t);
1483 1457
1458#ifdef CONFIG_MMU
1459extern int __mm_populate(unsigned long addr, unsigned long len,
1460 int ignore_errors);
1461static inline void mm_populate(unsigned long addr, unsigned long len)
1462{
1463 /* Ignore errors */
1464 (void) __mm_populate(addr, len, 1);
1465}
1466#else
1467static inline void mm_populate(unsigned long addr, unsigned long len) {}
1468#endif
1469
1484/* These take the mm semaphore themselves */ 1470/* These take the mm semaphore themselves */
1485extern unsigned long vm_brk(unsigned long, unsigned long); 1471extern unsigned long vm_brk(unsigned long, unsigned long);
1486extern int vm_munmap(unsigned long, size_t); 1472extern int vm_munmap(unsigned long, size_t);
@@ -1625,8 +1611,17 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1625int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, 1611int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
1626 unsigned long pfn); 1612 unsigned long pfn);
1627 1613
1628struct page *follow_page(struct vm_area_struct *, unsigned long address, 1614struct page *follow_page_mask(struct vm_area_struct *vma,
1629 unsigned int foll_flags); 1615 unsigned long address, unsigned int foll_flags,
1616 unsigned int *page_mask);
1617
1618static inline struct page *follow_page(struct vm_area_struct *vma,
1619 unsigned long address, unsigned int foll_flags)
1620{
1621 unsigned int unused_page_mask;
1622 return follow_page_mask(vma, address, foll_flags, &unused_page_mask);
1623}
1624
1630#define FOLL_WRITE 0x01 /* check pte is writable */ 1625#define FOLL_WRITE 0x01 /* check pte is writable */
1631#define FOLL_TOUCH 0x02 /* mark page accessed */ 1626#define FOLL_TOUCH 0x02 /* mark page accessed */
1632#define FOLL_GET 0x04 /* do get_page on page */ 1627#define FOLL_GET 0x04 /* do get_page on page */
@@ -1638,6 +1633,7 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1638#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1633#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1639#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ 1634#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1640#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ 1635#define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
1636#define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
1641 1637
1642typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1638typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1643 void *data); 1639 void *data);
@@ -1709,7 +1705,11 @@ int vmemmap_populate_basepages(struct page *start_page,
1709 unsigned long pages, int node); 1705 unsigned long pages, int node);
1710int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1706int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1711void vmemmap_populate_print_last(void); 1707void vmemmap_populate_print_last(void);
1712 1708#ifdef CONFIG_MEMORY_HOTPLUG
1709void vmemmap_free(struct page *memmap, unsigned long nr_pages);
1710#endif
1711void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
1712 unsigned long size);
1713 1713
1714enum mf_flags { 1714enum mf_flags {
1715 MF_COUNT_INCREASED = 1 << 0, 1715 MF_COUNT_INCREASED = 1 << 0,
@@ -1722,7 +1722,7 @@ extern int unpoison_memory(unsigned long pfn);
1722extern int sysctl_memory_failure_early_kill; 1722extern int sysctl_memory_failure_early_kill;
1723extern int sysctl_memory_failure_recovery; 1723extern int sysctl_memory_failure_recovery;
1724extern void shake_page(struct page *p, int access); 1724extern void shake_page(struct page *p, int access);
1725extern atomic_long_t mce_bad_pages; 1725extern atomic_long_t num_poisoned_pages;
1726extern int soft_offline_page(struct page *page, int flags); 1726extern int soft_offline_page(struct page *page, int flags);
1727 1727
1728extern void dump_page(struct page *page); 1728extern void dump_page(struct page *page);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index f8f5162a3571..ace9a5f01c64 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/page-debug-flags.h> 13#include <linux/page-debug-flags.h>
14#include <linux/uprobes.h> 14#include <linux/uprobes.h>
15#include <linux/page-flags-layout.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/mmu.h> 17#include <asm/mmu.h>
17 18
@@ -173,7 +174,7 @@ struct page {
173 void *shadow; 174 void *shadow;
174#endif 175#endif
175 176
176#ifdef CONFIG_NUMA_BALANCING 177#ifdef LAST_NID_NOT_IN_PAGE_FLAGS
177 int _last_nid; 178 int _last_nid;
178#endif 179#endif
179} 180}
@@ -414,9 +415,9 @@ struct mm_struct {
414#endif 415#endif
415#ifdef CONFIG_NUMA_BALANCING 416#ifdef CONFIG_NUMA_BALANCING
416 /* 417 /*
417 * numa_next_scan is the next time when the PTEs will me marked 418 * numa_next_scan is the next time that the PTEs will be marked
418 * pte_numa to gather statistics and migrate pages to new nodes 419 * pte_numa. NUMA hinting faults will gather statistics and migrate
419 * if necessary 420 * pages to new nodes if necessary.
420 */ 421 */
421 unsigned long numa_next_scan; 422 unsigned long numa_next_scan;
422 423
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9aa863da287f..61c7a87e5d2b 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -79,6 +79,8 @@ calc_vm_flag_bits(unsigned long flags)
79{ 79{
80 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | 80 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
81 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 81 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
82 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 82 ((flags & MAP_LOCKED) ? (VM_LOCKED | VM_POPULATE) : 0) |
83 (((flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE) ?
84 VM_POPULATE : 0);
83} 85}
84#endif /* _LINUX_MMAN_H */ 86#endif /* _LINUX_MMAN_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 5c69315d60cc..61b2c30c903b 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -53,6 +53,9 @@ struct mmc_ext_csd {
53 u8 part_config; 53 u8 part_config;
54 u8 cache_ctrl; 54 u8 cache_ctrl;
55 u8 rst_n_function; 55 u8 rst_n_function;
56 u8 max_packed_writes;
57 u8 max_packed_reads;
58 u8 packed_event_en;
56 unsigned int part_time; /* Units: ms */ 59 unsigned int part_time; /* Units: ms */
57 unsigned int sa_timeout; /* Units: 100ns */ 60 unsigned int sa_timeout; /* Units: 100ns */
58 unsigned int generic_cmd6_time; /* Units: 10ms */ 61 unsigned int generic_cmd6_time; /* Units: 10ms */
@@ -83,7 +86,7 @@ struct mmc_ext_csd {
83 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */ 86 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */
84 unsigned int boot_ro_lock; /* ro lock support */ 87 unsigned int boot_ro_lock; /* ro lock support */
85 bool boot_ro_lockable; 88 bool boot_ro_lockable;
86 u8 raw_exception_status; /* 53 */ 89 u8 raw_exception_status; /* 54 */
87 u8 raw_partition_support; /* 160 */ 90 u8 raw_partition_support; /* 160 */
88 u8 raw_rpmb_size_mult; /* 168 */ 91 u8 raw_rpmb_size_mult; /* 168 */
89 u8 raw_erased_mem_count; /* 181 */ 92 u8 raw_erased_mem_count; /* 181 */
@@ -187,6 +190,18 @@ struct sdio_func_tuple;
187 190
188#define SDIO_MAX_FUNCS 7 191#define SDIO_MAX_FUNCS 7
189 192
193enum mmc_blk_status {
194 MMC_BLK_SUCCESS = 0,
195 MMC_BLK_PARTIAL,
196 MMC_BLK_CMD_ERR,
197 MMC_BLK_RETRY,
198 MMC_BLK_ABORT,
199 MMC_BLK_DATA_ERR,
200 MMC_BLK_ECC_ERR,
201 MMC_BLK_NOMEDIUM,
202 MMC_BLK_NEW_REQUEST,
203};
204
190/* The number of MMC physical partitions. These consist of: 205/* The number of MMC physical partitions. These consist of:
191 * boot partitions (2), general purpose partitions (4) in MMC v4.4. 206 * boot partitions (2), general purpose partitions (4) in MMC v4.4.
192 */ 207 */
@@ -295,6 +310,11 @@ static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
295 card->nr_parts++; 310 card->nr_parts++;
296} 311}
297 312
313static inline bool mmc_large_sector(struct mmc_card *card)
314{
315 return card->ext_csd.data_sector_size == 4096;
316}
317
298/* 318/*
299 * The world is not perfect and supplies us with broken mmc/sdio devices. 319 * The world is not perfect and supplies us with broken mmc/sdio devices.
300 * For at least some of these bugs we need a work-around. 320 * For at least some of these bugs we need a work-around.
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 5bf7c2274fcb..39613b9a6fc5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -18,6 +18,9 @@ struct mmc_request;
18struct mmc_command { 18struct mmc_command {
19 u32 opcode; 19 u32 opcode;
20 u32 arg; 20 u32 arg;
21#define MMC_CMD23_ARG_REL_WR (1 << 31)
22#define MMC_CMD23_ARG_PACKED ((0 << 31) | (1 << 30))
23#define MMC_CMD23_ARG_TAG_REQ (1 << 29)
21 u32 resp[4]; 24 u32 resp[4];
22 unsigned int flags; /* expected response type */ 25 unsigned int flags; /* expected response type */
23#define MMC_RSP_PRESENT (1 << 0) 26#define MMC_RSP_PRESENT (1 << 0)
@@ -120,6 +123,7 @@ struct mmc_data {
120 s32 host_cookie; /* host private data */ 123 s32 host_cookie; /* host private data */
121}; 124};
122 125
126struct mmc_host;
123struct mmc_request { 127struct mmc_request {
124 struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */ 128 struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */
125 struct mmc_command *cmd; 129 struct mmc_command *cmd;
@@ -128,9 +132,9 @@ struct mmc_request {
128 132
129 struct completion completion; 133 struct completion completion;
130 void (*done)(struct mmc_request *);/* completion function */ 134 void (*done)(struct mmc_request *);/* completion function */
135 struct mmc_host *host;
131}; 136};
132 137
133struct mmc_host;
134struct mmc_card; 138struct mmc_card;
135struct mmc_async_req; 139struct mmc_async_req;
136 140
@@ -147,6 +151,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
147extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 151extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
148extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool); 152extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool);
149extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 153extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
154extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
150 155
151#define MMC_ERASE_ARG 0x00000000 156#define MMC_ERASE_ARG 0x00000000
152#define MMC_SECURE_ERASE_ARG 0x80000000 157#define MMC_SECURE_ERASE_ARG 0x80000000
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 34be4f47293c..198f0fa44e9f 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -209,8 +209,10 @@ struct dw_mci_dma_ops {
209#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 209#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
210/* Unreliable card detection */ 210/* Unreliable card detection */
211#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 211#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
212/* Write Protect detection not available */ 212
213#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4) 213/* Slot level quirks */
214/* This slot has no write protect */
215#define DW_MCI_SLOT_QUIRK_NO_WRITE_PROTECT BIT(0)
214 216
215struct dma_pdata; 217struct dma_pdata;
216 218
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 61a10c17aabd..d6f20cc6415e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -131,9 +131,11 @@ struct mmc_host_ops {
131 131
132 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 132 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
133 133
134 /* Check if the card is pulling dat[0:3] low */
135 int (*card_busy)(struct mmc_host *host);
136
134 /* The tuning command opcode value is different for SD and eMMC cards */ 137 /* The tuning command opcode value is different for SD and eMMC cards */
135 int (*execute_tuning)(struct mmc_host *host, u32 opcode); 138 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
136 void (*enable_preset_value)(struct mmc_host *host, bool enable);
137 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
138 void (*hw_reset)(struct mmc_host *host); 140 void (*hw_reset)(struct mmc_host *host);
139 void (*card_event)(struct mmc_host *host); 141 void (*card_event)(struct mmc_host *host);
@@ -170,6 +172,22 @@ struct mmc_slot {
170 void *handler_priv; 172 void *handler_priv;
171}; 173};
172 174
175/**
176 * mmc_context_info - synchronization details for mmc context
177 * @is_done_rcv wake up reason was done request
178 * @is_new_req wake up reason was new request
179 * @is_waiting_last_req mmc context waiting for single running request
180 * @wait wait queue
181 * @lock lock to protect data fields
182 */
183struct mmc_context_info {
184 bool is_done_rcv;
185 bool is_new_req;
186 bool is_waiting_last_req;
187 wait_queue_head_t wait;
188 spinlock_t lock;
189};
190
173struct regulator; 191struct regulator;
174 192
175struct mmc_supply { 193struct mmc_supply {
@@ -258,6 +276,10 @@ struct mmc_host {
258#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
259#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
260#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
279#define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */
280#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR)
261 283
262 mmc_pm_flag_t pm_caps; /* supported pm features */ 284 mmc_pm_flag_t pm_caps; /* supported pm features */
263 285
@@ -331,6 +353,7 @@ struct mmc_host {
331 struct dentry *debugfs_root; 353 struct dentry *debugfs_root;
332 354
333 struct mmc_async_req *areq; /* active async req */ 355 struct mmc_async_req *areq; /* active async req */
356 struct mmc_context_info context_info; /* async synchronization info */
334 357
335#ifdef CONFIG_FAIL_MMC_REQUEST 358#ifdef CONFIG_FAIL_MMC_REQUEST
336 struct fault_attr fail_mmc_request; 359 struct fault_attr fail_mmc_request;
@@ -341,10 +364,11 @@ struct mmc_host {
341 unsigned long private[0] ____cacheline_aligned; 364 unsigned long private[0] ____cacheline_aligned;
342}; 365};
343 366
344extern struct mmc_host *mmc_alloc_host(int extra, struct device *); 367struct mmc_host *mmc_alloc_host(int extra, struct device *);
345extern int mmc_add_host(struct mmc_host *); 368int mmc_add_host(struct mmc_host *);
346extern void mmc_remove_host(struct mmc_host *); 369void mmc_remove_host(struct mmc_host *);
347extern void mmc_free_host(struct mmc_host *); 370void mmc_free_host(struct mmc_host *);
371void mmc_of_parse(struct mmc_host *host);
348 372
349static inline void *mmc_priv(struct mmc_host *host) 373static inline void *mmc_priv(struct mmc_host *host)
350{ 374{
@@ -357,16 +381,16 @@ static inline void *mmc_priv(struct mmc_host *host)
357#define mmc_classdev(x) (&(x)->class_dev) 381#define mmc_classdev(x) (&(x)->class_dev)
358#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 382#define mmc_hostname(x) (dev_name(&(x)->class_dev))
359 383
360extern int mmc_suspend_host(struct mmc_host *); 384int mmc_suspend_host(struct mmc_host *);
361extern int mmc_resume_host(struct mmc_host *); 385int mmc_resume_host(struct mmc_host *);
362 386
363extern int mmc_power_save_host(struct mmc_host *host); 387int mmc_power_save_host(struct mmc_host *host);
364extern int mmc_power_restore_host(struct mmc_host *host); 388int mmc_power_restore_host(struct mmc_host *host);
365 389
366extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 390void mmc_detect_change(struct mmc_host *, unsigned long delay);
367extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 391void mmc_request_done(struct mmc_host *, struct mmc_request *);
368 392
369extern int mmc_cache_ctrl(struct mmc_host *, u8); 393int mmc_cache_ctrl(struct mmc_host *, u8);
370 394
371static inline void mmc_signal_sdio_irq(struct mmc_host *host) 395static inline void mmc_signal_sdio_irq(struct mmc_host *host)
372{ 396{
@@ -434,6 +458,19 @@ static inline int mmc_boot_partition_access(struct mmc_host *host)
434 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 458 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
435} 459}
436 460
461static inline int mmc_host_uhs(struct mmc_host *host)
462{
463 return host->caps &
464 (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
465 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
466 MMC_CAP_UHS_DDR50);
467}
468
469static inline int mmc_host_packed_wr(struct mmc_host *host)
470{
471 return host->caps2 & MMC_CAP2_PACKED_WR;
472}
473
437#ifdef CONFIG_MMC_CLKGATE 474#ifdef CONFIG_MMC_CLKGATE
438void mmc_host_clk_hold(struct mmc_host *host); 475void mmc_host_clk_hold(struct mmc_host *host);
439void mmc_host_clk_release(struct mmc_host *host); 476void mmc_host_clk_release(struct mmc_host *host);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 94d532e41c61..50bcde3677ca 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -139,7 +139,7 @@ static inline bool mmc_op_multi(u32 opcode)
139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
142#define R1_EXCEPTION_EVENT (1 << 6) /* sx, a */ 142#define R1_EXCEPTION_EVENT (1 << 6) /* sr, a */
143#define R1_APP_CMD (1 << 5) /* sr, c */ 143#define R1_APP_CMD (1 << 5) /* sr, c */
144 144
145#define R1_STATE_IDLE 0 145#define R1_STATE_IDLE 0
@@ -275,7 +275,10 @@ struct _mmc_csd {
275#define EXT_CSD_FLUSH_CACHE 32 /* W */ 275#define EXT_CSD_FLUSH_CACHE 32 /* W */
276#define EXT_CSD_CACHE_CTRL 33 /* R/W */ 276#define EXT_CSD_CACHE_CTRL 33 /* R/W */
277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ 277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
278#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO */ 278#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */
279#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */
280#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
279#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 282#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
280#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 283#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
281#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 284#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
@@ -324,6 +327,8 @@ struct _mmc_csd {
324#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
325#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 328#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
326#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 329#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
330#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
331#define EXT_CSD_MAX_PACKED_READS 501 /* RO */
327#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */ 332#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
328#define EXT_CSD_HPI_FEATURES 503 /* RO */ 333#define EXT_CSD_HPI_FEATURES 503 /* RO */
329 334
@@ -385,6 +390,9 @@ struct _mmc_csd {
385#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */ 390#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */
386#define EXT_CSD_PWR_CL_8BIT_SHIFT 4 391#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
387#define EXT_CSD_PWR_CL_4BIT_SHIFT 0 392#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
393
394#define EXT_CSD_PACKED_EVENT_EN BIT(3)
395
388/* 396/*
389 * EXCEPTION_EVENT_STATUS field 397 * EXCEPTION_EVENT_STATUS field
390 */ 398 */
@@ -393,6 +401,9 @@ struct _mmc_csd {
393#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2) 401#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2)
394#define EXT_CSD_PACKED_FAILURE BIT(3) 402#define EXT_CSD_PACKED_FAILURE BIT(3)
395 403
404#define EXT_CSD_PACKED_GENERIC_ERROR BIT(0)
405#define EXT_CSD_PACKED_INDEXED_ERROR BIT(1)
406
396/* 407/*
397 * BKOPS status level 408 * BKOPS status level
398 */ 409 */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 4bbc3301fbbf..b838ffc49e4a 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -94,6 +94,7 @@ struct sdhci_host {
94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1) 94#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
97 98
98 int irq; /* Device IRQ */ 99 int irq; /* Device IRQ */
99 void __iomem *ioaddr; /* Mapped address */ 100 void __iomem *ioaddr; /* Mapped address */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index b65679ffa880..b76bcf0621f6 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -4,7 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct platform_device; 6struct platform_device;
7struct tmio_mmc_data;
8 7
9#define SH_MOBILE_SDHI_IRQ_CARD_DETECT "card_detect" 8#define SH_MOBILE_SDHI_IRQ_CARD_DETECT "card_detect"
10#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard" 9#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
@@ -26,7 +25,6 @@ struct sh_mobile_sdhi_info {
26 unsigned long tmio_caps2; 25 unsigned long tmio_caps2;
27 u32 tmio_ocr_mask; /* available MMC voltages */ 26 u32 tmio_ocr_mask; /* available MMC voltages */
28 unsigned int cd_gpio; 27 unsigned int cd_gpio;
29 struct tmio_mmc_data *pdata;
30 void (*set_pwr)(struct platform_device *pdev, int state); 28 void (*set_pwr)(struct platform_device *pdev, int state);
31 int (*get_cd)(struct platform_device *pdev); 29 int (*get_cd)(struct platform_device *pdev);
32 30
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index bc823c4c028b..deca87452528 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -151,7 +151,7 @@ struct mmu_notifier_ops {
151 * Therefore notifier chains can only be traversed when either 151 * Therefore notifier chains can only be traversed when either
152 * 152 *
153 * 1. mmap_sem is held. 153 * 1. mmap_sem is held.
154 * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->mutex). 154 * 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->rwsem).
155 * 3. No other concurrent thread can access the list (release) 155 * 3. No other concurrent thread can access the list (release)
156 */ 156 */
157struct mmu_notifier { 157struct mmu_notifier {
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 4bec5be82cab..ede274957e05 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -15,7 +15,7 @@
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 17#include <linux/pageblock-flags.h>
18#include <generated/bounds.h> 18#include <linux/page-flags-layout.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <asm/page.h> 20#include <asm/page.h>
21 21
@@ -57,7 +57,9 @@ enum {
57 */ 57 */
58 MIGRATE_CMA, 58 MIGRATE_CMA,
59#endif 59#endif
60#ifdef CONFIG_MEMORY_ISOLATION
60 MIGRATE_ISOLATE, /* can't allocate from here */ 61 MIGRATE_ISOLATE, /* can't allocate from here */
62#endif
61 MIGRATE_TYPES 63 MIGRATE_TYPES
62}; 64};
63 65
@@ -308,24 +310,6 @@ enum zone_type {
308 310
309#ifndef __GENERATING_BOUNDS_H 311#ifndef __GENERATING_BOUNDS_H
310 312
311/*
312 * When a memory allocation must conform to specific limitations (such
313 * as being suitable for DMA) the caller will pass in hints to the
314 * allocator in the gfp_mask, in the zone modifier bits. These bits
315 * are used to select a priority ordered list of memory zones which
316 * match the requested limits. See gfp_zone() in include/linux/gfp.h
317 */
318
319#if MAX_NR_ZONES < 2
320#define ZONES_SHIFT 0
321#elif MAX_NR_ZONES <= 2
322#define ZONES_SHIFT 1
323#elif MAX_NR_ZONES <= 4
324#define ZONES_SHIFT 2
325#else
326#error ZONES_SHIFT -- too many zones configured adjust calculation
327#endif
328
329struct zone { 313struct zone {
330 /* Fields commonly accessed by the page allocator */ 314 /* Fields commonly accessed by the page allocator */
331 315
@@ -503,14 +487,6 @@ struct zone {
503 * rarely used fields: 487 * rarely used fields:
504 */ 488 */
505 const char *name; 489 const char *name;
506#ifdef CONFIG_MEMORY_ISOLATION
507 /*
508 * the number of MIGRATE_ISOLATE *pageblock*.
509 * We need this for free page counting. Look at zone_watermark_ok_safe.
510 * It's protected by zone->lock
511 */
512 int nr_pageblock_isolate;
513#endif
514} ____cacheline_internodealigned_in_smp; 490} ____cacheline_internodealigned_in_smp;
515 491
516typedef enum { 492typedef enum {
@@ -551,6 +527,26 @@ static inline int zone_is_oom_locked(const struct zone *zone)
551 return test_bit(ZONE_OOM_LOCKED, &zone->flags); 527 return test_bit(ZONE_OOM_LOCKED, &zone->flags);
552} 528}
553 529
530static inline unsigned zone_end_pfn(const struct zone *zone)
531{
532 return zone->zone_start_pfn + zone->spanned_pages;
533}
534
535static inline bool zone_spans_pfn(const struct zone *zone, unsigned long pfn)
536{
537 return zone->zone_start_pfn <= pfn && pfn < zone_end_pfn(zone);
538}
539
540static inline bool zone_is_initialized(struct zone *zone)
541{
542 return !!zone->wait_table;
543}
544
545static inline bool zone_is_empty(struct zone *zone)
546{
547 return zone->spanned_pages == 0;
548}
549
554/* 550/*
555 * The "priority" of VM scanning is how much of the queues we will scan in one 551 * The "priority" of VM scanning is how much of the queues we will scan in one
556 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the 552 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -760,11 +756,17 @@ typedef struct pglist_data {
760#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) 756#define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr))
761 757
762#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 758#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
759#define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid))
763 760
764#define node_end_pfn(nid) ({\ 761static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat)
765 pg_data_t *__pgdat = NODE_DATA(nid);\ 762{
766 __pgdat->node_start_pfn + __pgdat->node_spanned_pages;\ 763 return pgdat->node_start_pfn + pgdat->node_spanned_pages;
767}) 764}
765
766static inline bool pgdat_is_empty(pg_data_t *pgdat)
767{
768 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages;
769}
768 770
769#include <linux/memory_hotplug.h> 771#include <linux/memory_hotplug.h>
770 772
@@ -1061,8 +1063,6 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
1061 * PA_SECTION_SHIFT physical address to/from section number 1063 * PA_SECTION_SHIFT physical address to/from section number
1062 * PFN_SECTION_SHIFT pfn to/from section number 1064 * PFN_SECTION_SHIFT pfn to/from section number
1063 */ 1065 */
1064#define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
1065
1066#define PA_SECTION_SHIFT (SECTION_SIZE_BITS) 1066#define PA_SECTION_SHIFT (SECTION_SIZE_BITS)
1067#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT) 1067#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT)
1068 1068
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index fed3def62818..779cf7c4a3d1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -33,8 +33,7 @@ struct ieee1394_device_id {
33 __u32 model_id; 33 __u32 model_id;
34 __u32 specifier_id; 34 __u32 specifier_id;
35 __u32 version; 35 __u32 version;
36 kernel_ulong_t driver_data 36 kernel_ulong_t driver_data;
37 __attribute__((aligned(sizeof(kernel_ulong_t))));
38}; 37};
39 38
40 39
@@ -148,8 +147,7 @@ struct hid_device_id {
148 __u16 group; 147 __u16 group;
149 __u32 vendor; 148 __u32 vendor;
150 __u32 product; 149 __u32 product;
151 kernel_ulong_t driver_data 150 kernel_ulong_t driver_data;
152 __attribute__((aligned(sizeof(kernel_ulong_t))));
153}; 151};
154 152
155/* s390 CCW devices */ 153/* s390 CCW devices */
@@ -173,8 +171,6 @@ struct ccw_device_id {
173struct ap_device_id { 171struct ap_device_id {
174 __u16 match_flags; /* which fields to match against */ 172 __u16 match_flags; /* which fields to match against */
175 __u8 dev_type; /* device type */ 173 __u8 dev_type; /* device type */
176 __u8 pad1;
177 __u32 pad2;
178 kernel_ulong_t driver_info; 174 kernel_ulong_t driver_info;
179}; 175};
180 176
@@ -184,13 +180,10 @@ struct ap_device_id {
184struct css_device_id { 180struct css_device_id {
185 __u8 match_flags; 181 __u8 match_flags;
186 __u8 type; /* subchannel type */ 182 __u8 type; /* subchannel type */
187 __u16 pad2;
188 __u32 pad3;
189 kernel_ulong_t driver_data; 183 kernel_ulong_t driver_data;
190}; 184};
191 185
192#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ 186#define ACPI_ID_LEN 9
193 /* to workaround crosscompile issues */
194 187
195struct acpi_device_id { 188struct acpi_device_id {
196 __u8 id[ACPI_ID_LEN]; 189 __u8 id[ACPI_ID_LEN];
@@ -231,11 +224,7 @@ struct of_device_id
231 char name[32]; 224 char name[32];
232 char type[32]; 225 char type[32];
233 char compatible[128]; 226 char compatible[128];
234#ifdef __KERNEL__
235 const void *data; 227 const void *data;
236#else
237 kernel_ulong_t data;
238#endif
239}; 228};
240 229
241/* VIO */ 230/* VIO */
@@ -260,24 +249,14 @@ struct pcmcia_device_id {
260 /* for pseudo multi-function devices */ 249 /* for pseudo multi-function devices */
261 __u8 device_no; 250 __u8 device_no;
262 251
263 __u32 prod_id_hash[4] 252 __u32 prod_id_hash[4];
264 __attribute__((aligned(sizeof(__u32))));
265 253
266 /* not matched against in kernelspace*/ 254 /* not matched against in kernelspace*/
267#ifdef __KERNEL__
268 const char * prod_id[4]; 255 const char * prod_id[4];
269#else
270 kernel_ulong_t prod_id[4]
271 __attribute__((aligned(sizeof(kernel_ulong_t))));
272#endif
273 256
274 /* not matched against */ 257 /* not matched against */
275 kernel_ulong_t driver_info; 258 kernel_ulong_t driver_info;
276#ifdef __KERNEL__
277 char * cisfile; 259 char * cisfile;
278#else
279 kernel_ulong_t cisfile;
280#endif
281}; 260};
282 261
283#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 262#define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001
@@ -373,8 +352,7 @@ struct sdio_device_id {
373 __u8 class; /* Standard interface or SDIO_ANY_ID */ 352 __u8 class; /* Standard interface or SDIO_ANY_ID */
374 __u16 vendor; /* Vendor or SDIO_ANY_ID */ 353 __u16 vendor; /* Vendor or SDIO_ANY_ID */
375 __u16 device; /* Device ID or SDIO_ANY_ID */ 354 __u16 device; /* Device ID or SDIO_ANY_ID */
376 kernel_ulong_t driver_data /* Data private to the driver */ 355 kernel_ulong_t driver_data; /* Data private to the driver */
377 __attribute__((aligned(sizeof(kernel_ulong_t))));
378}; 356};
379 357
380/* SSB core, see drivers/ssb/ */ 358/* SSB core, see drivers/ssb/ */
@@ -420,8 +398,7 @@ struct virtio_device_id {
420 */ 398 */
421struct hv_vmbus_device_id { 399struct hv_vmbus_device_id {
422 __u8 guid[16]; 400 __u8 guid[16];
423 kernel_ulong_t driver_data /* Data private to the driver */ 401 kernel_ulong_t driver_data; /* Data private to the driver */
424 __attribute__((aligned(sizeof(kernel_ulong_t))));
425}; 402};
426 403
427/* rpmsg */ 404/* rpmsg */
@@ -440,8 +417,7 @@ struct rpmsg_device_id {
440 417
441struct i2c_device_id { 418struct i2c_device_id {
442 char name[I2C_NAME_SIZE]; 419 char name[I2C_NAME_SIZE];
443 kernel_ulong_t driver_data /* Data private to the driver */ 420 kernel_ulong_t driver_data; /* Data private to the driver */
444 __attribute__((aligned(sizeof(kernel_ulong_t))));
445}; 421};
446 422
447/* spi */ 423/* spi */
@@ -451,8 +427,7 @@ struct i2c_device_id {
451 427
452struct spi_device_id { 428struct spi_device_id {
453 char name[SPI_NAME_SIZE]; 429 char name[SPI_NAME_SIZE];
454 kernel_ulong_t driver_data /* Data private to the driver */ 430 kernel_ulong_t driver_data; /* Data private to the driver */
455 __attribute__((aligned(sizeof(kernel_ulong_t))));
456}; 431};
457 432
458/* dmi */ 433/* dmi */
@@ -484,15 +459,6 @@ struct dmi_strmatch {
484 char substr[79]; 459 char substr[79];
485}; 460};
486 461
487#ifndef __KERNEL__
488struct dmi_system_id {
489 kernel_ulong_t callback;
490 kernel_ulong_t ident;
491 struct dmi_strmatch matches[4];
492 kernel_ulong_t driver_data
493 __attribute__((aligned(sizeof(kernel_ulong_t))));
494};
495#else
496struct dmi_system_id { 462struct dmi_system_id {
497 int (*callback)(const struct dmi_system_id *); 463 int (*callback)(const struct dmi_system_id *);
498 const char *ident; 464 const char *ident;
@@ -506,7 +472,6 @@ struct dmi_system_id {
506 * error: storage size of '__mod_dmi_device_table' isn't known 472 * error: storage size of '__mod_dmi_device_table' isn't known
507 */ 473 */
508#define dmi_device_id dmi_system_id 474#define dmi_device_id dmi_system_id
509#endif
510 475
511#define DMI_MATCH(a, b) { a, b } 476#define DMI_MATCH(a, b) { a, b }
512 477
@@ -515,8 +480,7 @@ struct dmi_system_id {
515 480
516struct platform_device_id { 481struct platform_device_id {
517 char name[PLATFORM_NAME_SIZE]; 482 char name[PLATFORM_NAME_SIZE];
518 kernel_ulong_t driver_data 483 kernel_ulong_t driver_data;
519 __attribute__((aligned(sizeof(kernel_ulong_t))));
520}; 484};
521 485
522#define MDIO_MODULE_PREFIX "mdio:" 486#define MDIO_MODULE_PREFIX "mdio:"
@@ -572,11 +536,7 @@ struct isapnp_device_id {
572struct amba_id { 536struct amba_id {
573 unsigned int id; 537 unsigned int id;
574 unsigned int mask; 538 unsigned int mask;
575#ifndef __KERNEL__
576 kernel_ulong_t data;
577#else
578 void *data; 539 void *data;
579#endif
580}; 540};
581 541
582/* 542/*
diff --git a/include/linux/module.h b/include/linux/module.h
index 7760c6d344a3..ead1b5719a12 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -199,11 +199,11 @@ struct module_use {
199 struct module *source, *target; 199 struct module *source, *target;
200}; 200};
201 201
202enum module_state 202enum module_state {
203{ 203 MODULE_STATE_LIVE, /* Normal state. */
204 MODULE_STATE_LIVE, 204 MODULE_STATE_COMING, /* Full formed, running module_init. */
205 MODULE_STATE_COMING, 205 MODULE_STATE_GOING, /* Going away. */
206 MODULE_STATE_GOING, 206 MODULE_STATE_UNFORMED, /* Still setting it up. */
207}; 207};
208 208
209/** 209/**
@@ -396,13 +396,13 @@ bool is_module_address(unsigned long addr);
396bool is_module_percpu_address(unsigned long addr); 396bool is_module_percpu_address(unsigned long addr);
397bool is_module_text_address(unsigned long addr); 397bool is_module_text_address(unsigned long addr);
398 398
399static inline int within_module_core(unsigned long addr, struct module *mod) 399static inline int within_module_core(unsigned long addr, const struct module *mod)
400{ 400{
401 return (unsigned long)mod->module_core <= addr && 401 return (unsigned long)mod->module_core <= addr &&
402 addr < (unsigned long)mod->module_core + mod->core_size; 402 addr < (unsigned long)mod->module_core + mod->core_size;
403} 403}
404 404
405static inline int within_module_init(unsigned long addr, struct module *mod) 405static inline int within_module_init(unsigned long addr, const struct module *mod)
406{ 406{
407 return (unsigned long)mod->module_init <= addr && 407 return (unsigned long)mod->module_init <= addr &&
408 addr < (unsigned long)mod->module_init + mod->init_size; 408 addr < (unsigned long)mod->module_init + mod->init_size;
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index ea00d9162ee5..79aaa9fc1a15 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -9,7 +9,7 @@
9#ifdef CONFIG_IP_MROUTE 9#ifdef CONFIG_IP_MROUTE
10static inline int ip_mroute_opt(int opt) 10static inline int ip_mroute_opt(int opt)
11{ 11{
12 return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10); 12 return (opt >= MRT_BASE) && (opt <= MRT_MAX);
13} 13}
14#else 14#else
15static inline int ip_mroute_opt(int opt) 15static inline int ip_mroute_opt(int opt)
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index a223561ba12e..66982e764051 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -10,7 +10,7 @@
10#ifdef CONFIG_IPV6_MROUTE 10#ifdef CONFIG_IPV6_MROUTE
11static inline int ip6_mroute_opt(int opt) 11static inline int ip6_mroute_opt(int opt)
12{ 12{
13 return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10); 13 return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
14} 14}
15#else 15#else
16static inline int ip6_mroute_opt(int opt) 16static inline int ip6_mroute_opt(int opt)
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 7a4b9e97d29a..391af8d11cce 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -34,7 +34,9 @@ struct msg_queue {
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
36 size_t msgsz, int msgflg); 36 size_t msgsz, int msgflg);
37extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext, 37extern long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
38 size_t msgsz, long msgtyp, int msgflg); 38 int msgflg,
39 long (*msg_fill)(void __user *, struct msg_msg *,
40 size_t));
39 41
40#endif /* _LINUX_MSG_H */ 42#endif /* _LINUX_MSG_H */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index f6eb4332ac92..4b02512e421c 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -245,6 +245,7 @@ struct map_info {
245 unsigned long pfow_base; 245 unsigned long pfow_base;
246 unsigned long map_priv_1; 246 unsigned long map_priv_1;
247 unsigned long map_priv_2; 247 unsigned long map_priv_2;
248 struct device_node *device_node;
248 void *fldrv_priv; 249 void *fldrv_priv;
249 struct mtd_chip_driver *fldrv; 250 struct mtd_chip_driver *fldrv;
250}; 251};
@@ -328,7 +329,7 @@ static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word
328 329
329static inline map_word map_word_load(struct map_info *map, const void *ptr) 330static inline map_word map_word_load(struct map_info *map, const void *ptr)
330{ 331{
331 map_word r = {{0} }; 332 map_word r;
332 333
333 if (map_bankwidth_is_1(map)) 334 if (map_bankwidth_is_1(map))
334 r.x[0] = *(unsigned char *)ptr; 335 r.x[0] = *(unsigned char *)ptr;
@@ -342,6 +343,8 @@ static inline map_word map_word_load(struct map_info *map, const void *ptr)
342#endif 343#endif
343 else if (map_bankwidth_is_large(map)) 344 else if (map_bankwidth_is_large(map))
344 memcpy(r.x, ptr, map->bankwidth); 345 memcpy(r.x, ptr, map->bankwidth);
346 else
347 BUG();
345 348
346 return r; 349 return r;
347} 350}
@@ -391,7 +394,7 @@ static inline map_word map_word_ff(struct map_info *map)
391 394
392static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) 395static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
393{ 396{
394 map_word uninitialized_var(r); 397 map_word r;
395 398
396 if (map_bankwidth_is_1(map)) 399 if (map_bankwidth_is_1(map))
397 r.x[0] = __raw_readb(map->virt + ofs); 400 r.x[0] = __raw_readb(map->virt + ofs);
@@ -425,6 +428,8 @@ static inline void inline_map_write(struct map_info *map, const map_word datum,
425#endif 428#endif
426 else if (map_bankwidth_is_large(map)) 429 else if (map_bankwidth_is_large(map))
427 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth); 430 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
431 else
432 BUG();
428 mb(); 433 mb();
429} 434}
430 435
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e998c030061d..5a5ff57ceed4 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -2,6 +2,7 @@
2#define _LINUX_NAMEI_H 2#define _LINUX_NAMEI_H
3 3
4#include <linux/dcache.h> 4#include <linux/dcache.h>
5#include <linux/errno.h>
5#include <linux/linkage.h> 6#include <linux/linkage.h>
6#include <linux/path.h> 7#include <linux/path.h>
7 8
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5ac32123035a..3dd39340430e 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -41,7 +41,7 @@ enum {
41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */ 41 NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */ 45 /**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */ 46 NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
47 = NETIF_F_GSO_LAST, 47 = NETIF_F_GSO_LAST,
@@ -102,6 +102,7 @@ enum {
102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) 102#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
103#define NETIF_F_RXFCS __NETIF_F(RXFCS) 103#define NETIF_F_RXFCS __NETIF_F(RXFCS)
104#define NETIF_F_RXALL __NETIF_F(RXALL) 104#define NETIF_F_RXALL __NETIF_F(RXALL)
105#define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE)
105 106
106/* Features valid for ethtool to change */ 107/* Features valid for ethtool to change */
107/* = all defined minus driver/device-class-related */ 108/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c599e4782d45..b3d00fa4b314 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,10 +60,15 @@ struct wireless_dev;
60#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops);
65
63/* hardware address assignment types */ 66/* hardware address assignment types */
64#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
65#define NET_ADDR_RANDOM 1 /* address is generated randomly */ 68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
66#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
67 72
68/* Backlog congestion levels */ 73/* Backlog congestion levels */
69#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
@@ -856,8 +861,7 @@ struct netdev_fcoe_hbainfo {
856 * flow_id is a flow ID to be passed to rps_may_expire_flow() later. 861 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
857 * Return the filter ID on success, or a negative error code. 862 * Return the filter ID on success, or a negative error code.
858 * 863 *
859 * Slave management functions (for bridge, bonding, etc). User should 864 * Slave management functions (for bridge, bonding, etc).
860 * call netdev_set_master() to set dev->master properly.
861 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); 865 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
862 * Called to make another netdev an underling. 866 * Called to make another netdev an underling.
863 * 867 *
@@ -880,7 +884,8 @@ struct netdev_fcoe_hbainfo {
880 * struct net_device *dev, 884 * struct net_device *dev,
881 * const unsigned char *addr, u16 flags) 885 * const unsigned char *addr, u16 flags)
882 * Adds an FDB entry to dev for addr. 886 * Adds an FDB entry to dev for addr.
883 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 887 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
888 * struct net_device *dev,
884 * const unsigned char *addr) 889 * const unsigned char *addr)
885 * Deletes the FDB entry from dev coresponding to addr. 890 * Deletes the FDB entry from dev coresponding to addr.
886 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 891 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
@@ -891,6 +896,14 @@ struct netdev_fcoe_hbainfo {
891 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 896 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
892 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 897 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
893 * struct net_device *dev) 898 * struct net_device *dev)
899 *
900 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
901 * Called to change device carrier. Soft-devices (like dummy, team, etc)
902 * which do not represent real hardware may define this to allow their
903 * userspace components to manage their virtual carrier state. Devices
904 * that determine carrier state from physical hardware properties (eg
905 * network cables) or protocol-dependent mechanisms (eg
906 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
894 */ 907 */
895struct net_device_ops { 908struct net_device_ops {
896 int (*ndo_init)(struct net_device *dev); 909 int (*ndo_init)(struct net_device *dev);
@@ -996,6 +1009,7 @@ struct net_device_ops {
996 const unsigned char *addr, 1009 const unsigned char *addr,
997 u16 flags); 1010 u16 flags);
998 int (*ndo_fdb_del)(struct ndmsg *ndm, 1011 int (*ndo_fdb_del)(struct ndmsg *ndm,
1012 struct nlattr *tb[],
999 struct net_device *dev, 1013 struct net_device *dev,
1000 const unsigned char *addr); 1014 const unsigned char *addr);
1001 int (*ndo_fdb_dump)(struct sk_buff *skb, 1015 int (*ndo_fdb_dump)(struct sk_buff *skb,
@@ -1007,7 +1021,12 @@ struct net_device_ops {
1007 struct nlmsghdr *nlh); 1021 struct nlmsghdr *nlh);
1008 int (*ndo_bridge_getlink)(struct sk_buff *skb, 1022 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1009 u32 pid, u32 seq, 1023 u32 pid, u32 seq,
1010 struct net_device *dev); 1024 struct net_device *dev,
1025 u32 filter_mask);
1026 int (*ndo_bridge_dellink)(struct net_device *dev,
1027 struct nlmsghdr *nlh);
1028 int (*ndo_change_carrier)(struct net_device *dev,
1029 bool new_carrier);
1011}; 1030};
1012 1031
1013/* 1032/*
@@ -1158,9 +1177,7 @@ struct net_device {
1158 * avoid dirtying this cache line. 1177 * avoid dirtying this cache line.
1159 */ 1178 */
1160 1179
1161 struct net_device *master; /* Pointer to master device of a group, 1180 struct list_head upper_dev_list; /* List of upper devices */
1162 * which this device is member of.
1163 */
1164 1181
1165 /* Interface address info used in eth_type_trans() */ 1182 /* Interface address info used in eth_type_trans() */
1166 unsigned char *dev_addr; /* hw address, (before bcast 1183 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1260,7 +1277,7 @@ struct net_device {
1260 void (*destructor)(struct net_device *dev); 1277 void (*destructor)(struct net_device *dev);
1261 1278
1262#ifdef CONFIG_NETPOLL 1279#ifdef CONFIG_NETPOLL
1263 struct netpoll_info *npinfo; 1280 struct netpoll_info __rcu *npinfo;
1264#endif 1281#endif
1265 1282
1266#ifdef CONFIG_NET_NS 1283#ifdef CONFIG_NET_NS
@@ -1274,9 +1291,12 @@ struct net_device {
1274 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1291 struct pcpu_lstats __percpu *lstats; /* loopback stats */
1275 struct pcpu_tstats __percpu *tstats; /* tunnel stats */ 1292 struct pcpu_tstats __percpu *tstats; /* tunnel stats */
1276 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1293 struct pcpu_dstats __percpu *dstats; /* dummy stats */
1294 struct pcpu_vstats __percpu *vstats; /* veth stats */
1277 }; 1295 };
1278 /* GARP */ 1296 /* GARP */
1279 struct garp_port __rcu *garp_port; 1297 struct garp_port __rcu *garp_port;
1298 /* MRP */
1299 struct mrp_port __rcu *mrp_port;
1280 1300
1281 /* class/net/name entry */ 1301 /* class/net/name entry */
1282 struct device dev; 1302 struct device dev;
@@ -1393,6 +1413,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1393 1413
1394extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1414extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1395 struct sk_buff *skb); 1415 struct sk_buff *skb);
1416extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1396 1417
1397/* 1418/*
1398 * Net namespace inlines 1419 * Net namespace inlines
@@ -2092,6 +2113,18 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2092 __netif_schedule(txq->qdisc); 2113 __netif_schedule(txq->qdisc);
2093} 2114}
2094 2115
2116#ifdef CONFIG_XPS
2117extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
2118 u16 index);
2119#else
2120static inline int netif_set_xps_queue(struct net_device *dev,
2121 struct cpumask *mask,
2122 u16 index)
2123{
2124 return 0;
2125}
2126#endif
2127
2095/* 2128/*
2096 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used 2129 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
2097 * as a distribution range limit for the returned value. 2130 * as a distribution range limit for the returned value.
@@ -2194,6 +2227,8 @@ extern int dev_set_mtu(struct net_device *, int);
2194extern void dev_set_group(struct net_device *, int); 2227extern void dev_set_group(struct net_device *, int);
2195extern int dev_set_mac_address(struct net_device *, 2228extern int dev_set_mac_address(struct net_device *,
2196 struct sockaddr *); 2229 struct sockaddr *);
2230extern int dev_change_carrier(struct net_device *,
2231 bool new_carrier);
2197extern int dev_hard_start_xmit(struct sk_buff *skb, 2232extern int dev_hard_start_xmit(struct sk_buff *skb,
2198 struct net_device *dev, 2233 struct net_device *dev,
2199 struct netdev_queue *txq); 2234 struct netdev_queue *txq);
@@ -2611,7 +2646,6 @@ extern void netdev_notify_peers(struct net_device *dev);
2611extern void netdev_features_change(struct net_device *dev); 2646extern void netdev_features_change(struct net_device *dev);
2612/* Load a device via the kmod */ 2647/* Load a device via the kmod */
2613extern void dev_load(struct net *net, const char *name); 2648extern void dev_load(struct net *net, const char *name);
2614extern void dev_mcast_init(void);
2615extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2649extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2616 struct rtnl_link_stats64 *storage); 2650 struct rtnl_link_stats64 *storage);
2617extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2651extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
@@ -2621,12 +2655,30 @@ extern int netdev_max_backlog;
2621extern int netdev_tstamp_prequeue; 2655extern int netdev_tstamp_prequeue;
2622extern int weight_p; 2656extern int weight_p;
2623extern int bpf_jit_enable; 2657extern int bpf_jit_enable;
2624extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2658
2625extern int netdev_set_bond_master(struct net_device *dev, 2659extern bool netdev_has_upper_dev(struct net_device *dev,
2626 struct net_device *master); 2660 struct net_device *upper_dev);
2661extern bool netdev_has_any_upper_dev(struct net_device *dev);
2662extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2663extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2664extern int netdev_upper_dev_link(struct net_device *dev,
2665 struct net_device *upper_dev);
2666extern int netdev_master_upper_dev_link(struct net_device *dev,
2667 struct net_device *upper_dev);
2668extern void netdev_upper_dev_unlink(struct net_device *dev,
2669 struct net_device *upper_dev);
2627extern int skb_checksum_help(struct sk_buff *skb); 2670extern int skb_checksum_help(struct sk_buff *skb);
2628extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, 2671extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
2629 netdev_features_t features); 2672 netdev_features_t features, bool tx_path);
2673extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2674 netdev_features_t features);
2675
2676static inline
2677struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
2678{
2679 return __skb_gso_segment(skb, features, true);
2680}
2681
2630#ifdef CONFIG_BUG 2682#ifdef CONFIG_BUG
2631extern void netdev_rx_csum_fault(struct net_device *dev); 2683extern void netdev_rx_csum_fault(struct net_device *dev);
2632#else 2684#else
@@ -2639,9 +2691,9 @@ extern void net_enable_timestamp(void);
2639extern void net_disable_timestamp(void); 2691extern void net_disable_timestamp(void);
2640 2692
2641#ifdef CONFIG_PROC_FS 2693#ifdef CONFIG_PROC_FS
2642extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); 2694extern int __init dev_proc_init(void);
2643extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); 2695#else
2644extern void dev_seq_stop(struct seq_file *seq, void *v); 2696#define dev_proc_init() 0
2645#endif 2697#endif
2646 2698
2647extern int netdev_class_create_file(struct class_attribute *class_attr); 2699extern int netdev_class_create_file(struct class_attribute *class_attr);
@@ -2843,4 +2895,34 @@ do { \
2843}) 2895})
2844#endif 2896#endif
2845 2897
2898/*
2899 * The list of packet types we will receive (as opposed to discard)
2900 * and the routines to invoke.
2901 *
2902 * Why 16. Because with 16 the only overlap we get on a hash of the
2903 * low nibble of the protocol value is RARP/SNAP/X.25.
2904 *
2905 * NOTE: That is no longer true with the addition of VLAN tags. Not
2906 * sure which should go first, but I bet it won't make much
2907 * difference if we are running VLANs. The good news is that
2908 * this protocol won't be in the list unless compiled in, so
2909 * the average user (w/out VLANs) will not be adversely affected.
2910 * --BLG
2911 *
2912 * 0800 IP
2913 * 8100 802.1Q VLAN
2914 * 0001 802.3
2915 * 0002 AX.25
2916 * 0004 802.2
2917 * 8035 RARP
2918 * 0005 SNAP
2919 * 0805 X.25
2920 * 0806 ARP
2921 * 8137 IPX
2922 * 0009 Localtalk
2923 * 86DD IPv6
2924 */
2925#define PTYPE_HASH_SIZE (16)
2926#define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
2927
2846#endif /* _LINUX_NETDEVICE_H */ 2928#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 387bdd02945d..ba7f571a2b1c 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -4,12 +4,15 @@
4 4
5#include <net/netfilter/nf_conntrack_expect.h> 5#include <net/netfilter/nf_conntrack_expect.h>
6 6
7#include <linux/types.h>
8
7#define SIP_PORT 5060 9#define SIP_PORT 5060
8#define SIP_TIMEOUT 3600 10#define SIP_TIMEOUT 3600
9 11
10struct nf_ct_sip_master { 12struct nf_ct_sip_master {
11 unsigned int register_cseq; 13 unsigned int register_cseq;
12 unsigned int invite_cseq; 14 unsigned int invite_cseq;
15 __be16 forced_dport;
13}; 16};
14 17
15enum sip_expectation_classes { 18enum sip_expectation_classes {
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 4966ddec039b..ecbb8e495912 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -34,8 +34,8 @@ extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigne
34extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 34extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
35extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 35extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
36 36
37extern void nfnl_lock(void); 37extern void nfnl_lock(__u8 subsys_id);
38extern void nfnl_unlock(void); 38extern void nfnl_unlock(__u8 subsys_id);
39 39
40#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 40#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
41 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 41 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 66d5379c305e..9d7d8c64f7c8 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -12,28 +12,38 @@
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/list.h> 13#include <linux/list.h>
14 14
15union inet_addr {
16 __u32 all[4];
17 __be32 ip;
18 __be32 ip6[4];
19 struct in_addr in;
20 struct in6_addr in6;
21};
22
15struct netpoll { 23struct netpoll {
16 struct net_device *dev; 24 struct net_device *dev;
17 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
18 const char *name; 26 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 27 void (*rx_hook)(struct netpoll *, int, char *, int);
20 28
21 __be32 local_ip, remote_ip; 29 union inet_addr local_ip, remote_ip;
30 bool ipv6;
22 u16 local_port, remote_port; 31 u16 local_port, remote_port;
23 u8 remote_mac[ETH_ALEN]; 32 u8 remote_mac[ETH_ALEN];
24 33
25 struct list_head rx; /* rx_np list element */ 34 struct list_head rx; /* rx_np list element */
26 struct rcu_head rcu; 35 struct work_struct cleanup_work;
27}; 36};
28 37
29struct netpoll_info { 38struct netpoll_info {
30 atomic_t refcnt; 39 atomic_t refcnt;
31 40
32 int rx_flags; 41 unsigned long rx_flags;
33 spinlock_t rx_lock; 42 spinlock_t rx_lock;
43 struct mutex dev_lock;
34 struct list_head rx_np; /* netpolls that registered an rx_hook */ 44 struct list_head rx_np; /* netpolls that registered an rx_hook */
35 45
36 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
37 struct sk_buff_head txq; 47 struct sk_buff_head txq;
38 48
39 struct delayed_work tx_work; 49 struct delayed_work tx_work;
@@ -42,6 +52,14 @@ struct netpoll_info {
42 struct rcu_head rcu; 52 struct rcu_head rcu;
43}; 53};
44 54
55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev);
58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif
62
45void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 63void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
46void netpoll_print_options(struct netpoll *np); 64void netpoll_print_options(struct netpoll *np);
47int netpoll_parse_options(struct netpoll *np, char *opt); 65int netpoll_parse_options(struct netpoll *np, char *opt);
@@ -50,7 +68,7 @@ int netpoll_setup(struct netpoll *np);
50int netpoll_trap(void); 68int netpoll_trap(void);
51void netpoll_set_trap(int trap); 69void netpoll_set_trap(int trap);
52void __netpoll_cleanup(struct netpoll *np); 70void __netpoll_cleanup(struct netpoll *np);
53void __netpoll_free_rcu(struct netpoll *np); 71void __netpoll_free_async(struct netpoll *np);
54void netpoll_cleanup(struct netpoll *np); 72void netpoll_cleanup(struct netpoll *np);
55int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo); 73int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
56void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 74void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e111fa419a4e..7b8fc73810ad 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -13,6 +13,7 @@
13#define _LINUX_NFS4_H 13#define _LINUX_NFS4_H
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/uidgid.h>
16#include <uapi/linux/nfs4.h> 17#include <uapi/linux/nfs4.h>
17 18
18struct nfs4_ace { 19struct nfs4_ace {
@@ -20,7 +21,10 @@ struct nfs4_ace {
20 uint32_t flag; 21 uint32_t flag;
21 uint32_t access_mask; 22 uint32_t access_mask;
22 int whotype; 23 int whotype;
23 uid_t who; 24 union {
25 kuid_t who_uid;
26 kgid_t who_gid;
27 };
24}; 28};
25 29
26struct nfs4_acl { 30struct nfs4_acl {
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 2dcef3ab58b6..0f4b79da6584 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -36,6 +36,7 @@
36#ifndef NFS_IDMAP_H 36#ifndef NFS_IDMAP_H
37#define NFS_IDMAP_H 37#define NFS_IDMAP_H
38 38
39#include <linux/uidgid.h>
39#include <uapi/linux/nfs_idmap.h> 40#include <uapi/linux/nfs_idmap.h>
40 41
41 42
@@ -67,10 +68,10 @@ void nfs_fattr_init_names(struct nfs_fattr *fattr,
67void nfs_fattr_free_names(struct nfs_fattr *); 68void nfs_fattr_free_names(struct nfs_fattr *);
68void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *); 69void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
69 70
70int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); 71int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, kuid_t *);
71int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); 72int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, kgid_t *);
72int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); 73int nfs_map_uid_to_name(const struct nfs_server *, kuid_t, char *, size_t);
73int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t); 74int nfs_map_gid_to_group(const struct nfs_server *, kgid_t, char *, size_t);
74 75
75extern unsigned int nfs_idmap_cache_timeout; 76extern unsigned int nfs_idmap_cache_timeout;
76#endif /* NFS_IDMAP_H */ 77#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 29adb12c7ecf..4b993d358dad 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -48,8 +48,8 @@ struct nfs_fattr {
48 unsigned int valid; /* which fields are valid */ 48 unsigned int valid; /* which fields are valid */
49 umode_t mode; 49 umode_t mode;
50 __u32 nlink; 50 __u32 nlink;
51 __u32 uid; 51 kuid_t uid;
52 __u32 gid; 52 kgid_t gid;
53 dev_t rdev; 53 dev_t rdev;
54 __u64 size; 54 __u64 size;
55 union { 55 union {
@@ -233,6 +233,7 @@ struct nfs4_layoutget_args {
233 struct inode *inode; 233 struct inode *inode;
234 struct nfs_open_context *ctx; 234 struct nfs_open_context *ctx;
235 nfs4_stateid stateid; 235 nfs4_stateid stateid;
236 unsigned long timestamp;
236 struct nfs4_layoutdriver_data layout; 237 struct nfs4_layoutdriver_data layout;
237}; 238};
238 239
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 24c139288db4..7898c997dfea 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -49,8 +49,8 @@ struct svc_export {
49 struct auth_domain * ex_client; 49 struct auth_domain * ex_client;
50 int ex_flags; 50 int ex_flags;
51 struct path ex_path; 51 struct path ex_path;
52 uid_t ex_anon_uid; 52 kuid_t ex_anon_uid;
53 gid_t ex_anon_gid; 53 kgid_t ex_anon_gid;
54 int ex_fsid; 54 int ex_fsid;
55 unsigned char * ex_uuid; /* 16 byte fsid */ 55 unsigned char * ex_uuid; /* 16 byte fsid */
56 struct nfsd4_fs_locations ex_fslocs; 56 struct nfsd4_fs_locations ex_fslocs;
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
new file mode 100644
index 000000000000..f6a15205853b
--- /dev/null
+++ b/include/linux/ntb.h
@@ -0,0 +1,83 @@
1/*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2012 Intel Corporation. All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
12 *
13 * BSD LICENSE
14 *
15 * Copyright(c) 2012 Intel Corporation. All rights reserved.
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 *
21 * * Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * * Redistributions in binary form must reproduce the above copy
24 * notice, this list of conditions and the following disclaimer in
25 * the documentation and/or other materials provided with the
26 * distribution.
27 * * Neither the name of Intel Corporation nor the names of its
28 * contributors may be used to endorse or promote products derived
29 * from this software without specific prior written permission.
30 *
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 * Intel PCIe NTB Linux driver
44 *
45 * Contact Information:
46 * Jon Mason <jon.mason@intel.com>
47 */
48
49struct ntb_transport_qp;
50
51struct ntb_client {
52 struct device_driver driver;
53 int (*probe) (struct pci_dev *pdev);
54 void (*remove) (struct pci_dev *pdev);
55};
56
57int ntb_register_client(struct ntb_client *drvr);
58void ntb_unregister_client(struct ntb_client *drvr);
59int ntb_register_client_dev(char *device_name);
60void ntb_unregister_client_dev(char *device_name);
61
62struct ntb_queue_handlers {
63 void (*rx_handler) (struct ntb_transport_qp *qp, void *qp_data,
64 void *data, int len);
65 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
66 void *data, int len);
67 void (*event_handler) (void *data, int status);
68};
69
70unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);
71unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp);
72struct ntb_transport_qp *
73ntb_transport_create_queue(void *data, struct pci_dev *pdev,
74 const struct ntb_queue_handlers *handlers);
75void ntb_transport_free_queue(struct ntb_transport_qp *qp);
76int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
77 unsigned int len);
78int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
79 unsigned int len);
80void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len);
81void ntb_transport_link_up(struct ntb_transport_qp *qp);
82void ntb_transport_link_down(struct ntb_transport_qp *qp);
83bool ntb_transport_link_query(struct ntb_transport_qp *qp);
diff --git a/include/linux/of.h b/include/linux/of.h
index 5ebcc5c8e423..a0f129284948 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -92,7 +92,7 @@ static inline void of_node_put(struct device_node *node) { }
92extern struct device_node *of_allnodes; 92extern struct device_node *of_allnodes;
93extern struct device_node *of_chosen; 93extern struct device_node *of_chosen;
94extern struct device_node *of_aliases; 94extern struct device_node *of_aliases;
95extern rwlock_t devtree_lock; 95extern raw_spinlock_t devtree_lock;
96 96
97static inline bool of_have_populated_dt(void) 97static inline bool of_have_populated_dt(void)
98{ 98{
@@ -160,7 +160,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
160 160
161#define OF_BAD_ADDR ((u64)-1) 161#define OF_BAD_ADDR ((u64)-1)
162 162
163static inline const char* of_node_full_name(struct device_node *np) 163static inline const char *of_node_full_name(const struct device_node *np)
164{ 164{
165 return np ? np->full_name : "<no-node>"; 165 return np ? np->full_name : "<no-node>";
166} 166}
@@ -277,6 +277,8 @@ extern struct device_node *of_parse_phandle(const struct device_node *np,
277extern int of_parse_phandle_with_args(const struct device_node *np, 277extern int of_parse_phandle_with_args(const struct device_node *np,
278 const char *list_name, const char *cells_name, int index, 278 const char *list_name, const char *cells_name, int index,
279 struct of_phandle_args *out_args); 279 struct of_phandle_args *out_args);
280extern int of_count_phandle_with_args(const struct device_node *np,
281 const char *list_name, const char *cells_name);
280 282
281extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); 283extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
282extern int of_alias_get_id(struct device_node *np, const char *stem); 284extern int of_alias_get_id(struct device_node *np, const char *stem);
@@ -467,6 +469,13 @@ static inline int of_parse_phandle_with_args(struct device_node *np,
467 return -ENOSYS; 469 return -ENOSYS;
468} 470}
469 471
472static inline int of_count_phandle_with_args(struct device_node *np,
473 const char *list_name,
474 const char *cells_name)
475{
476 return -ENOSYS;
477}
478
470static inline int of_alias_get_id(struct device_node *np, const char *stem) 479static inline int of_alias_get_id(struct device_node *np, const char *stem)
471{ 480{
472 return -ENOSYS; 481 return -ENOSYS;
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index c454f5796747..a83dc6f5008e 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,9 +50,6 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50extern int of_get_named_gpio_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
51 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
52 52
53extern unsigned int of_gpio_named_count(struct device_node *np,
54 const char* propname);
55
56extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
57 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
58 55
@@ -71,12 +68,6 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
71 return -ENOSYS; 68 return -ENOSYS;
72} 69}
73 70
74static inline unsigned int of_gpio_named_count(struct device_node *np,
75 const char* propname)
76{
77 return 0;
78}
79
80static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 71static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
81 const struct of_phandle_args *gpiospec, 72 const struct of_phandle_args *gpiospec,
82 u32 *flags) 73 u32 *flags)
@@ -90,22 +81,37 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
90#endif /* CONFIG_OF_GPIO */ 81#endif /* CONFIG_OF_GPIO */
91 82
92/** 83/**
93 * of_gpio_count - Count GPIOs for a device 84 * of_gpio_named_count() - Count GPIOs for a device
94 * @np: device node to count GPIOs for 85 * @np: device node to count GPIOs for
86 * @propname: property name containing gpio specifier(s)
95 * 87 *
96 * The function returns the count of GPIOs specified for a node. 88 * The function returns the count of GPIOs specified for a node.
89 * Note that the empty GPIO specifiers count too. Returns either
90 * Number of gpios defined in property,
91 * -EINVAL for an incorrectly formed gpios property, or
92 * -ENOENT for a missing gpios property
97 * 93 *
98 * Note that the empty GPIO specifiers counts too. For example, 94 * Example:
99 *
100 * gpios = <0 95 * gpios = <0
101 * &pio1 1 2 96 * &gpio1 1 2
102 * 0 97 * 0
103 * &pio2 3 4>; 98 * &gpio2 3 4>;
99 *
100 * The above example defines four GPIOs, two of which are not specified.
101 * This function will return '4'
102 */
103static inline int of_gpio_named_count(struct device_node *np, const char* propname)
104{
105 return of_count_phandle_with_args(np, propname, "#gpio-cells");
106}
107
108/**
109 * of_gpio_count() - Count GPIOs for a device
110 * @np: device node to count GPIOs for
104 * 111 *
105 * defines four GPIOs (so this function will return 4), two of which 112 * Same as of_gpio_named_count, but hard coded to use the 'gpios' property
106 * are not specified.
107 */ 113 */
108static inline unsigned int of_gpio_count(struct device_node *np) 114static inline int of_gpio_count(struct device_node *np)
109{ 115{
110 return of_gpio_named_count(np, "gpios"); 116 return of_gpio_named_count(np, "gpios");
111} 117}
diff --git a/include/linux/of_serial.h b/include/linux/of_serial.h
deleted file mode 100644
index 4a73ed80b4c0..000000000000
--- a/include/linux/of_serial.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __LINUX_OF_SERIAL_H
2#define __LINUX_OF_SERIAL_H
3
4/*
5 * FIXME remove this file when tegra finishes conversion to open firmware,
6 * expectation is that all quirks will then be self-contained in
7 * drivers/tty/serial/of_serial.c.
8 */
9#ifdef CONFIG_ARCH_TEGRA
10extern void tegra_serial_handle_break(struct uart_port *port);
11#else
12static inline void tegra_serial_handle_break(struct uart_port *port)
13{
14}
15#endif
16
17#endif /* __LINUX_OF_SERIAL */
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 214e0ebcb84d..3aca2b8def33 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -47,15 +47,6 @@ int opp_enable(struct device *dev, unsigned long freq);
47int opp_disable(struct device *dev, unsigned long freq); 47int opp_disable(struct device *dev, unsigned long freq);
48 48
49struct srcu_notifier_head *opp_get_notifier(struct device *dev); 49struct srcu_notifier_head *opp_get_notifier(struct device *dev);
50
51#ifdef CONFIG_OF
52int of_init_opp_table(struct device *dev);
53#else
54static inline int of_init_opp_table(struct device *dev)
55{
56 return -EINVAL;
57}
58#endif /* CONFIG_OF */
59#else 50#else
60static inline unsigned long opp_get_voltage(struct opp *opp) 51static inline unsigned long opp_get_voltage(struct opp *opp)
61{ 52{
@@ -112,6 +103,15 @@ static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev)
112} 103}
113#endif /* CONFIG_PM_OPP */ 104#endif /* CONFIG_PM_OPP */
114 105
106#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
107int of_init_opp_table(struct device *dev);
108#else
109static inline int of_init_opp_table(struct device *dev)
110{
111 return -EINVAL;
112}
113#endif
114
115#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) 115#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
116int opp_init_cpufreq_table(struct device *dev, 116int opp_init_cpufreq_table(struct device *dev,
117 struct cpufreq_frequency_table **table); 117 struct cpufreq_frequency_table **table);
diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
new file mode 100644
index 000000000000..93506a114034
--- /dev/null
+++ b/include/linux/page-flags-layout.h
@@ -0,0 +1,88 @@
1#ifndef PAGE_FLAGS_LAYOUT_H
2#define PAGE_FLAGS_LAYOUT_H
3
4#include <linux/numa.h>
5#include <generated/bounds.h>
6
7/*
8 * When a memory allocation must conform to specific limitations (such
9 * as being suitable for DMA) the caller will pass in hints to the
10 * allocator in the gfp_mask, in the zone modifier bits. These bits
11 * are used to select a priority ordered list of memory zones which
12 * match the requested limits. See gfp_zone() in include/linux/gfp.h
13 */
14#if MAX_NR_ZONES < 2
15#define ZONES_SHIFT 0
16#elif MAX_NR_ZONES <= 2
17#define ZONES_SHIFT 1
18#elif MAX_NR_ZONES <= 4
19#define ZONES_SHIFT 2
20#else
21#error ZONES_SHIFT -- too many zones configured adjust calculation
22#endif
23
24#ifdef CONFIG_SPARSEMEM
25#include <asm/sparsemem.h>
26
27/* SECTION_SHIFT #bits space required to store a section # */
28#define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
29
30#endif /* CONFIG_SPARSEMEM */
31
32/*
33 * page->flags layout:
34 *
35 * There are five possibilities for how page->flags get laid out. The first
36 * pair is for the normal case without sparsemem. The second pair is for
37 * sparsemem when there is plenty of space for node and section information.
38 * The last is when there is insufficient space in page->flags and a separate
39 * lookup is necessary.
40 *
41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
42 * " plus space for last_nid: | NODE | ZONE | LAST_NID ... | FLAGS |
43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
44 * " plus space for last_nid: | SECTION | NODE | ZONE | LAST_NID ... | FLAGS |
45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
46 */
47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
48#define SECTIONS_WIDTH SECTIONS_SHIFT
49#else
50#define SECTIONS_WIDTH 0
51#endif
52
53#define ZONES_WIDTH ZONES_SHIFT
54
55#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
56#define NODES_WIDTH NODES_SHIFT
57#else
58#ifdef CONFIG_SPARSEMEM_VMEMMAP
59#error "Vmemmap: No space for nodes field in page flags"
60#endif
61#define NODES_WIDTH 0
62#endif
63
64#ifdef CONFIG_NUMA_BALANCING
65#define LAST_NID_SHIFT NODES_SHIFT
66#else
67#define LAST_NID_SHIFT 0
68#endif
69
70#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_NID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
71#define LAST_NID_WIDTH LAST_NID_SHIFT
72#else
73#define LAST_NID_WIDTH 0
74#endif
75
76/*
77 * We are going to use the flags for the page to node mapping if its in
78 * there. This includes the case where there is no node, so it is implicit.
79 */
80#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
81#define NODE_NOT_IN_PAGE_FLAGS
82#endif
83
84#if defined(CONFIG_NUMA_BALANCING) && LAST_NID_WIDTH == 0
85#define LAST_NID_NOT_IN_PAGE_FLAGS
86#endif
87
88#endif /* _LINUX_PAGE_FLAGS_LAYOUT */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 70473da47b3f..6d53675c2b54 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -303,21 +303,13 @@ static inline void __SetPageUptodate(struct page *page)
303 303
304static inline void SetPageUptodate(struct page *page) 304static inline void SetPageUptodate(struct page *page)
305{ 305{
306#ifdef CONFIG_S390
307 if (!test_and_set_bit(PG_uptodate, &page->flags))
308 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY, 0);
309#else
310 /* 306 /*
311 * Memory barrier must be issued before setting the PG_uptodate bit, 307 * Memory barrier must be issued before setting the PG_uptodate bit,
312 * so that all previous stores issued in order to bring the page 308 * so that all previous stores issued in order to bring the page
313 * uptodate are actually visible before PageUptodate becomes true. 309 * uptodate are actually visible before PageUptodate becomes true.
314 *
315 * s390 doesn't need an explicit smp_wmb here because the test and
316 * set bit already provides full barriers.
317 */ 310 */
318 smp_wmb(); 311 smp_wmb();
319 set_bit(PG_uptodate, &(page)->flags); 312 set_bit(PG_uptodate, &(page)->flags);
320#endif
321} 313}
322 314
323CLEARPAGEFLAG(Uptodate, uptodate) 315CLEARPAGEFLAG(Uptodate, uptodate)
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index a92061e08d48..3fff8e774067 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -1,6 +1,25 @@
1#ifndef __LINUX_PAGEISOLATION_H 1#ifndef __LINUX_PAGEISOLATION_H
2#define __LINUX_PAGEISOLATION_H 2#define __LINUX_PAGEISOLATION_H
3 3
4#ifdef CONFIG_MEMORY_ISOLATION
5static inline bool is_migrate_isolate_page(struct page *page)
6{
7 return get_pageblock_migratetype(page) == MIGRATE_ISOLATE;
8}
9static inline bool is_migrate_isolate(int migratetype)
10{
11 return migratetype == MIGRATE_ISOLATE;
12}
13#else
14static inline bool is_migrate_isolate_page(struct page *page)
15{
16 return false;
17}
18static inline bool is_migrate_isolate(int migratetype)
19{
20 return false;
21}
22#endif
4 23
5bool has_unmovable_pages(struct zone *zone, struct page *page, int count, 24bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
6 bool skip_hwpoisoned_pages); 25 bool skip_hwpoisoned_pages);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 6da609d14c15..0e38e13eb249 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -414,6 +414,7 @@ static inline void wait_on_page_writeback(struct page *page)
414} 414}
415 415
416extern void end_page_writeback(struct page *page); 416extern void end_page_writeback(struct page *page);
417void wait_for_stable_page(struct page *page);
417 418
418/* 419/*
419 * Add an arbitrary waiter to a page's wait queue 420 * Add an arbitrary waiter to a page's wait queue
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 15472d691ee6..2461033a7987 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -286,6 +286,7 @@ struct pci_dev {
286 unsigned int irq; 286 unsigned int irq;
287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 287 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
288 288
289 bool match_driver; /* Skip attaching driver */
289 /* These fields are used by common fixups */ 290 /* These fields are used by common fixups */
290 unsigned int transparent:1; /* Transparent PCI bridge */ 291 unsigned int transparent:1; /* Transparent PCI bridge */
291 unsigned int multifunction:1;/* Part of multi-function device */ 292 unsigned int multifunction:1;/* Part of multi-function device */
@@ -378,6 +379,8 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
378 void (*release_fn)(struct pci_host_bridge *), 379 void (*release_fn)(struct pci_host_bridge *),
379 void *release_data); 380 void *release_data);
380 381
382int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge);
383
381/* 384/*
382 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 385 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
383 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 386 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
@@ -674,6 +677,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */
674/* Some device drivers need know if pci is initiated */ 677/* Some device drivers need know if pci is initiated */
675extern int no_pci_devices(void); 678extern int no_pci_devices(void);
676 679
680void pcibios_resource_survey_bus(struct pci_bus *bus);
677void pcibios_fixup_bus(struct pci_bus *); 681void pcibios_fixup_bus(struct pci_bus *);
678int __must_check pcibios_enable_device(struct pci_dev *, int mask); 682int __must_check pcibios_enable_device(struct pci_dev *, int mask);
679/* Architecture specific versions may override this (weak) */ 683/* Architecture specific versions may override this (weak) */
@@ -1101,6 +1105,12 @@ static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
1101 return -1; 1105 return -1;
1102} 1106}
1103 1107
1108static inline int
1109pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec)
1110{
1111 return -1;
1112}
1113
1104static inline void pci_msi_shutdown(struct pci_dev *dev) 1114static inline void pci_msi_shutdown(struct pci_dev *dev)
1105{ } 1115{ }
1106static inline void pci_disable_msi(struct pci_dev *dev) 1116static inline void pci_disable_msi(struct pci_dev *dev)
@@ -1132,6 +1142,7 @@ static inline int pci_msi_enabled(void)
1132} 1142}
1133#else 1143#else
1134extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); 1144extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
1145extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
1135extern void pci_msi_shutdown(struct pci_dev *dev); 1146extern void pci_msi_shutdown(struct pci_dev *dev);
1136extern void pci_disable_msi(struct pci_dev *dev); 1147extern void pci_disable_msi(struct pci_dev *dev);
1137extern int pci_msix_table_size(struct pci_dev *dev); 1148extern int pci_msix_table_size(struct pci_dev *dev);
@@ -1693,12 +1704,21 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
1693} 1704}
1694 1705
1695/** 1706/**
1707 * pcie_caps_reg - get the PCIe Capabilities Register
1708 * @dev: PCI device
1709 */
1710static inline u16 pcie_caps_reg(const struct pci_dev *dev)
1711{
1712 return dev->pcie_flags_reg;
1713}
1714
1715/**
1696 * pci_pcie_type - get the PCIe device/port type 1716 * pci_pcie_type - get the PCIe device/port type
1697 * @dev: PCI device 1717 * @dev: PCI device
1698 */ 1718 */
1699static inline int pci_pcie_type(const struct pci_dev *dev) 1719static inline int pci_pcie_type(const struct pci_dev *dev)
1700{ 1720{
1701 return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4; 1721 return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
1702} 1722}
1703 1723
1704void pci_request_acs(void); 1724void pci_request_acs(void);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0eb65796bcb9..f11c1c2609d5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1807,6 +1807,8 @@
1807#define PCI_VENDOR_ID_ESDGMBH 0x12fe 1807#define PCI_VENDOR_ID_ESDGMBH 0x12fe
1808#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111 1808#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111
1809 1809
1810#define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */
1811
1810#define PCI_VENDOR_ID_SIIG 0x131f 1812#define PCI_VENDOR_ID_SIIG 0x131f
1811#define PCI_SUBVENDOR_ID_SIIG 0x131f 1813#define PCI_SUBVENDOR_ID_SIIG 0x131f
1812#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 1814#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
@@ -1868,8 +1870,23 @@
1868#define PCI_VENDOR_ID_QUATECH 0x135C 1870#define PCI_VENDOR_ID_QUATECH 0x135C
1869#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 1871#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
1870#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 1872#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020
1873#define PCI_DEVICE_ID_QUATECH_DSC200 0x0030
1874#define PCI_DEVICE_ID_QUATECH_QSC200 0x0040
1871#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 1875#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050
1872#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 1876#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060
1877#define PCI_DEVICE_ID_QUATECH_QSCP100 0x0120
1878#define PCI_DEVICE_ID_QUATECH_DSCP100 0x0130
1879#define PCI_DEVICE_ID_QUATECH_QSCP200 0x0140
1880#define PCI_DEVICE_ID_QUATECH_DSCP200 0x0150
1881#define PCI_DEVICE_ID_QUATECH_QSCLP100 0x0170
1882#define PCI_DEVICE_ID_QUATECH_DSCLP100 0x0180
1883#define PCI_DEVICE_ID_QUATECH_DSC100E 0x0181
1884#define PCI_DEVICE_ID_QUATECH_SSCLP100 0x0190
1885#define PCI_DEVICE_ID_QUATECH_QSCLP200 0x01A0
1886#define PCI_DEVICE_ID_QUATECH_DSCLP200 0x01B0
1887#define PCI_DEVICE_ID_QUATECH_DSC200E 0x01B1
1888#define PCI_DEVICE_ID_QUATECH_SSCLP200 0x01C0
1889#define PCI_DEVICE_ID_QUATECH_ESCLP100 0x01E0
1873#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278 1890#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278
1874 1891
1875#define PCI_VENDOR_ID_SEALEVEL 0x135e 1892#define PCI_VENDOR_ID_SEALEVEL 0x135e
@@ -2013,6 +2030,10 @@
2013#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 2030#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
2014#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 2031#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
2015 2032
2033#define PCI_VENDOR_ID_ADVANTECH 0x13fe
2034
2035#define PCI_VENDOR_ID_MEILHAUS 0x1402
2036
2016#define PCI_VENDOR_ID_LAVA 0x1407 2037#define PCI_VENDOR_ID_LAVA 0x1407
2017#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ 2038#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
2018#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ 2039#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
@@ -2058,6 +2079,8 @@
2058 2079
2059#define PCI_VENDOR_ID_CHELSIO 0x1425 2080#define PCI_VENDOR_ID_CHELSIO 0x1425
2060 2081
2082#define PCI_VENDOR_ID_ADLINK 0x144a
2083
2061#define PCI_VENDOR_ID_SAMSUNG 0x144d 2084#define PCI_VENDOR_ID_SAMSUNG 0x144d
2062 2085
2063#define PCI_VENDOR_ID_GIGABYTE 0x1458 2086#define PCI_VENDOR_ID_GIGABYTE 0x1458
@@ -2091,6 +2114,8 @@
2091#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 2114#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182
2092#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 2115#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150
2093 2116
2117#define PCI_VENDOR_ID_AMPLICON 0x14dc
2118
2094#define PCI_VENDOR_ID_BCM_GVC 0x14a4 2119#define PCI_VENDOR_ID_BCM_GVC 0x14a4
2095#define PCI_VENDOR_ID_BROADCOM 0x14e4 2120#define PCI_VENDOR_ID_BROADCOM 0x14e4
2096#define PCI_DEVICE_ID_TIGON3_5752 0x1600 2121#define PCI_DEVICE_ID_TIGON3_5752 0x1600
@@ -2127,6 +2152,7 @@
2127#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 2152#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
2128#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 2153#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
2129#define PCI_DEVICE_ID_TIGON3_5756 0x1674 2154#define PCI_DEVICE_ID_TIGON3_5756 0x1674
2155#define PCI_DEVICE_ID_TIGON3_5750 0x1676
2130#define PCI_DEVICE_ID_TIGON3_5751 0x1677 2156#define PCI_DEVICE_ID_TIGON3_5751 0x1677
2131#define PCI_DEVICE_ID_TIGON3_5715 0x1678 2157#define PCI_DEVICE_ID_TIGON3_5715 0x1678
2132#define PCI_DEVICE_ID_TIGON3_5715S 0x1679 2158#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
@@ -2776,6 +2802,7 @@
2776#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0 2802#define PCI_DEVICE_ID_INTEL_JAKETOWN_UBOX 0x3ce0
2777#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2803#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2778#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2804#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2805#define PCI_DEVICE_ID_INTEL_5100_19 0x65f3
2779#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2806#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
2780#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 2807#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6
2781#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030 2808#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index b9df9ed1adc0..d5dd4657c8d6 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -83,7 +83,7 @@ static inline int percpu_counter_initialized(struct percpu_counter *fbc)
83 return (fbc->counters != NULL); 83 return (fbc->counters != NULL);
84} 84}
85 85
86#else 86#else /* !CONFIG_SMP */
87 87
88struct percpu_counter { 88struct percpu_counter {
89 s64 count; 89 s64 count;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 6bfb2faa0b19..e47ee462c2f2 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -135,16 +135,21 @@ struct hw_perf_event {
135 struct { /* software */ 135 struct { /* software */
136 struct hrtimer hrtimer; 136 struct hrtimer hrtimer;
137 }; 137 };
138 struct { /* tracepoint */
139 struct task_struct *tp_target;
140 /* for tp_event->class */
141 struct list_head tp_list;
142 };
138#ifdef CONFIG_HAVE_HW_BREAKPOINT 143#ifdef CONFIG_HAVE_HW_BREAKPOINT
139 struct { /* breakpoint */ 144 struct { /* breakpoint */
140 struct arch_hw_breakpoint info;
141 struct list_head bp_list;
142 /* 145 /*
143 * Crufty hack to avoid the chicken and egg 146 * Crufty hack to avoid the chicken and egg
144 * problem hw_breakpoint has with context 147 * problem hw_breakpoint has with context
145 * creation and event initalization. 148 * creation and event initalization.
146 */ 149 */
147 struct task_struct *bp_target; 150 struct task_struct *bp_target;
151 struct arch_hw_breakpoint info;
152 struct list_head bp_list;
148 }; 153 };
149#endif 154#endif
150 }; 155 };
@@ -817,6 +822,17 @@ do { \
817} while (0) 822} while (0)
818 823
819 824
825struct perf_pmu_events_attr {
826 struct device_attribute attr;
827 u64 id;
828};
829
830#define PMU_EVENT_ATTR(_name, _var, _id, _show) \
831static struct perf_pmu_events_attr _var = { \
832 .attr = __ATTR(_name, 0444, _show, NULL), \
833 .id = _id, \
834};
835
820#define PMU_FORMAT_ATTR(_name, _format) \ 836#define PMU_FORMAT_ATTR(_name, _format) \
821static ssize_t \ 837static ssize_t \
822_name##_show(struct device *dev, \ 838_name##_show(struct device *dev, \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 93b3cf77f564..33999adbf8c8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -506,13 +506,13 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
506int phy_device_register(struct phy_device *phy); 506int phy_device_register(struct phy_device *phy);
507int phy_init_hw(struct phy_device *phydev); 507int phy_init_hw(struct phy_device *phydev);
508struct phy_device * phy_attach(struct net_device *dev, 508struct phy_device * phy_attach(struct net_device *dev,
509 const char *bus_id, u32 flags, phy_interface_t interface); 509 const char *bus_id, phy_interface_t interface);
510struct phy_device *phy_find_first(struct mii_bus *bus); 510struct phy_device *phy_find_first(struct mii_bus *bus);
511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, 511int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
512 void (*handler)(struct net_device *), u32 flags, 512 void (*handler)(struct net_device *),
513 phy_interface_t interface); 513 phy_interface_t interface);
514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 514struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
515 void (*handler)(struct net_device *), u32 flags, 515 void (*handler)(struct net_device *),
516 phy_interface_t interface); 516 phy_interface_t interface);
517void phy_disconnect(struct phy_device *phydev); 517void phy_disconnect(struct phy_device *phydev);
518void phy_detach(struct phy_device *phydev); 518void phy_detach(struct phy_device *phydev);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 2381c973d897..a089a3c447fc 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -176,9 +176,8 @@ pid_t pid_vnr(struct pid *pid);
176 176
177#define do_each_pid_task(pid, type, task) \ 177#define do_each_pid_task(pid, type, task) \
178 do { \ 178 do { \
179 struct hlist_node *pos___; \
180 if ((pid) != NULL) \ 179 if ((pid) != NULL) \
181 hlist_for_each_entry_rcu((task), pos___, \ 180 hlist_for_each_entry_rcu((task), \
182 &(pid)->tasks[type], pids[type].node) { 181 &(pid)->tasks[type], pids[type].node) {
183 182
184 /* 183 /*
diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h
new file mode 100644
index 000000000000..6e5f8a985ea7
--- /dev/null
+++ b/include/linux/pinctrl/devinfo.h
@@ -0,0 +1,45 @@
1/*
2 * Per-device information from the pin control system.
3 * This is the stuff that get included into the device
4 * core.
5 *
6 * Copyright (C) 2012 ST-Ericsson SA
7 * Written on behalf of Linaro for ST-Ericsson
8 * This interface is used in the core to keep track of pins.
9 *
10 * Author: Linus Walleij <linus.walleij@linaro.org>
11 *
12 * License terms: GNU General Public License (GPL) version 2
13 */
14
15#ifndef PINCTRL_DEVINFO_H
16#define PINCTRL_DEVINFO_H
17
18#ifdef CONFIG_PINCTRL
19
20/* The device core acts as a consumer toward pinctrl */
21#include <linux/pinctrl/consumer.h>
22
23/**
24 * struct dev_pin_info - pin state container for devices
25 * @p: pinctrl handle for the containing device
26 * @default_state: the default state for the handle, if found
27 */
28struct dev_pin_info {
29 struct pinctrl *p;
30 struct pinctrl_state *default_state;
31};
32
33extern int pinctrl_bind_pins(struct device *dev);
34
35#else
36
37/* Stubs if we're not using pinctrl */
38
39static inline int pinctrl_bind_pins(struct device *dev)
40{
41 return 0;
42}
43
44#endif /* CONFIG_PINCTRL */
45#endif /* PINCTRL_DEVINFO_H */
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 47a1bdd88878..72474e18f1e0 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -46,7 +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_DRIVE_STRENGTH: the pin will output the current passed as
50 * argument. The argument is in mA.
51 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin.
52 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0,
53 * schmitt-trigger mode is disabled.
50 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in 54 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
51 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, 55 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
52 * the threshold value is given on a custom format as argument when 56 * the threshold value is given on a custom format as argument when
@@ -58,10 +62,15 @@
58 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power 62 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
59 * supplies, the argument to this parameter (on a custom format) tells 63 * supplies, the argument to this parameter (on a custom format) tells
60 * the driver which alternative power source to use. 64 * the driver which alternative power source to use.
65 * @PIN_CONFIG_SLEW_RATE: if the pin can select slew rate, the argument to
66 * this parameter (on a custom format) tells the driver which alternative
67 * slew rate to use.
61 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power 68 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
62 * operation, if several modes of operation are supported these can be 69 * operation, if several modes of operation are supported these can be
63 * passed in the argument on a custom form, else just use argument 1 70 * passed in the argument on a custom form, else just use argument 1
64 * to indicate low power mode, argument 0 turns low power mode off. 71 * to indicate low power mode, argument 0 turns low power mode off.
72 * @PIN_CONFIG_OUTPUT: this will configure the pin in output, use argument
73 * 1 to indicate high level, argument 0 to indicate low level.
65 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if 74 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
66 * you need to pass in custom configurations to the pin controller, use 75 * you need to pass in custom configurations to the pin controller, use
67 * PIN_CONFIG_END+1 as the base offset. 76 * PIN_CONFIG_END+1 as the base offset.
@@ -74,11 +83,14 @@ enum pin_config_param {
74 PIN_CONFIG_DRIVE_PUSH_PULL, 83 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN, 84 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE, 85 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT_DISABLE, 86 PIN_CONFIG_DRIVE_STRENGTH,
87 PIN_CONFIG_INPUT_SCHMITT_ENABLE,
78 PIN_CONFIG_INPUT_SCHMITT, 88 PIN_CONFIG_INPUT_SCHMITT,
79 PIN_CONFIG_INPUT_DEBOUNCE, 89 PIN_CONFIG_INPUT_DEBOUNCE,
80 PIN_CONFIG_POWER_SOURCE, 90 PIN_CONFIG_POWER_SOURCE,
91 PIN_CONFIG_SLEW_RATE,
81 PIN_CONFIG_LOW_POWER_MODE, 92 PIN_CONFIG_LOW_POWER_MODE,
93 PIN_CONFIG_OUTPUT,
82 PIN_CONFIG_END = 0x7FFF, 94 PIN_CONFIG_END = 0x7FFF,
83}; 95};
84 96
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 04d6700d99af..778804df293f 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -154,6 +154,7 @@ struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
154#endif /* CONFIG_OF */ 154#endif /* CONFIG_OF */
155 155
156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev); 156extern const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev);
157extern const char *pinctrl_dev_get_devname(struct pinctrl_dev *pctldev);
157extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev); 158extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
158#else 159#else
159 160
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
index 24368a2e8b87..798fb80b024b 100644
--- a/include/linux/platform_data/cpsw.h
+++ b/include/linux/platform_data/cpsw.h
@@ -21,6 +21,8 @@ struct cpsw_slave_data {
21 char phy_id[MII_BUS_ID_SIZE]; 21 char phy_id[MII_BUS_ID_SIZE];
22 int phy_if; 22 int phy_if;
23 u8 mac_addr[ETH_ALEN]; 23 u8 mac_addr[ETH_ALEN];
24 u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
25
24}; 26};
25 27
26struct cpsw_platform_data { 28struct cpsw_platform_data {
@@ -35,6 +37,8 @@ struct cpsw_platform_data {
35 u32 bd_ram_size; /*buffer descriptor ram size */ 37 u32 bd_ram_size; /*buffer descriptor ram size */
36 u32 rx_descs; /* Number of Rx Descriptios */ 38 u32 rx_descs; /* Number of Rx Descriptios */
37 u32 mac_control; /* Mac control register */ 39 u32 mac_control; /* Mac control register */
40 u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
41 bool dual_emac; /* Enable Dual EMAC mode */
38}; 42};
39 43
40#endif /* __CPSW_H__ */ 44#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dma-coh901318.h b/include/linux/platform_data/dma-coh901318.h
new file mode 100644
index 000000000000..c4cb9590d115
--- /dev/null
+++ b/include/linux/platform_data/dma-coh901318.h
@@ -0,0 +1,72 @@
1/*
2 * Platform data for the COH901318 DMA controller
3 * Copyright (C) 2007-2013 ST-Ericsson
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef PLAT_COH901318_H
8#define PLAT_COH901318_H
9
10#ifdef CONFIG_COH901318
11
12/* We only support the U300 DMA channels */
13#define U300_DMA_MSL_TX_0 0
14#define U300_DMA_MSL_TX_1 1
15#define U300_DMA_MSL_TX_2 2
16#define U300_DMA_MSL_TX_3 3
17#define U300_DMA_MSL_TX_4 4
18#define U300_DMA_MSL_TX_5 5
19#define U300_DMA_MSL_TX_6 6
20#define U300_DMA_MSL_RX_0 7
21#define U300_DMA_MSL_RX_1 8
22#define U300_DMA_MSL_RX_2 9
23#define U300_DMA_MSL_RX_3 10
24#define U300_DMA_MSL_RX_4 11
25#define U300_DMA_MSL_RX_5 12
26#define U300_DMA_MSL_RX_6 13
27#define U300_DMA_MMCSD_RX_TX 14
28#define U300_DMA_MSPRO_TX 15
29#define U300_DMA_MSPRO_RX 16
30#define U300_DMA_UART0_TX 17
31#define U300_DMA_UART0_RX 18
32#define U300_DMA_APEX_TX 19
33#define U300_DMA_APEX_RX 20
34#define U300_DMA_PCM_I2S0_TX 21
35#define U300_DMA_PCM_I2S0_RX 22
36#define U300_DMA_PCM_I2S1_TX 23
37#define U300_DMA_PCM_I2S1_RX 24
38#define U300_DMA_XGAM_CDI 25
39#define U300_DMA_XGAM_PDI 26
40#define U300_DMA_SPI_TX 27
41#define U300_DMA_SPI_RX 28
42#define U300_DMA_GENERAL_PURPOSE_0 29
43#define U300_DMA_GENERAL_PURPOSE_1 30
44#define U300_DMA_GENERAL_PURPOSE_2 31
45#define U300_DMA_GENERAL_PURPOSE_3 32
46#define U300_DMA_GENERAL_PURPOSE_4 33
47#define U300_DMA_GENERAL_PURPOSE_5 34
48#define U300_DMA_GENERAL_PURPOSE_6 35
49#define U300_DMA_GENERAL_PURPOSE_7 36
50#define U300_DMA_GENERAL_PURPOSE_8 37
51#define U300_DMA_UART1_TX 38
52#define U300_DMA_UART1_RX 39
53
54#define U300_DMA_DEVICE_CHANNELS 32
55#define U300_DMA_CHANNELS 40
56
57/**
58 * coh901318_filter_id() - DMA channel filter function
59 * @chan: dma channel handle
60 * @chan_id: id of dma channel to be filter out
61 *
62 * In dma_request_channel() it specifies what channel id to be requested
63 */
64bool coh901318_filter_id(struct dma_chan *chan, void *chan_id);
65#else
66static inline bool coh901318_filter_id(struct dma_chan *chan, void *chan_id)
67{
68 return false;
69}
70#endif
71
72#endif /* PLAT_COH901318_H */
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
new file mode 100644
index 000000000000..1bd5244d1dcd
--- /dev/null
+++ b/include/linux/platform_data/elm.h
@@ -0,0 +1,54 @@
1/*
2 * BCH Error Location Module
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ELM_H
19#define __ELM_H
20
21enum bch_ecc {
22 BCH4_ECC = 0,
23 BCH8_ECC,
24};
25
26/* ELM support 8 error syndrome process */
27#define ERROR_VECTOR_MAX 8
28
29#define BCH8_ECC_OOB_BYTES 13
30#define BCH4_ECC_OOB_BYTES 7
31/* RBL requires 14 byte even though BCH8 uses only 13 byte */
32#define BCH8_SIZE (BCH8_ECC_OOB_BYTES + 1)
33/* Uses 1 extra byte to handle erased pages */
34#define BCH4_SIZE (BCH4_ECC_OOB_BYTES + 1)
35
36/**
37 * struct elm_errorvec - error vector for elm
38 * @error_reported: set true for vectors error is reported
39 * @error_uncorrectable: number of uncorrectable errors
40 * @error_count: number of correctable errors in the sector
41 * @error_loc: buffer for error location
42 *
43 */
44struct elm_errorvec {
45 bool error_reported;
46 bool error_uncorrectable;
47 int error_count;
48 int error_loc[ERROR_VECTOR_MAX];
49};
50
51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
52 struct elm_errorvec *err_vec);
53void elm_config(struct device *dev, enum bch_ecc bch_type);
54#endif /* __ELM_H */
diff --git a/include/linux/platform_data/exynos_thermal.h b/include/linux/platform_data/exynos_thermal.h
index a7bdb2f63b73..da7e6274b175 100644
--- a/include/linux/platform_data/exynos_thermal.h
+++ b/include/linux/platform_data/exynos_thermal.h
@@ -53,6 +53,8 @@ struct freq_clip_table {
53 * struct exynos_tmu_platform_data 53 * struct exynos_tmu_platform_data
54 * @threshold: basic temperature for generating interrupt 54 * @threshold: basic temperature for generating interrupt
55 * 25 <= threshold <= 125 [unit: degree Celsius] 55 * 25 <= threshold <= 125 [unit: degree Celsius]
56 * @threshold_falling: differntial value for setting threshold
57 * of temperature falling interrupt.
56 * @trigger_levels: array for each interrupt levels 58 * @trigger_levels: array for each interrupt levels
57 * [unit: degree Celsius] 59 * [unit: degree Celsius]
58 * 0: temperature for trigger_level0 interrupt 60 * 0: temperature for trigger_level0 interrupt
@@ -97,6 +99,7 @@ struct freq_clip_table {
97 */ 99 */
98struct exynos_tmu_platform_data { 100struct exynos_tmu_platform_data {
99 u8 threshold; 101 u8 threshold;
102 u8 threshold_falling;
100 u8 trigger_levels[4]; 103 u8 trigger_levels[4];
101 bool trigger_level0_en; 104 bool trigger_level0_en;
102 bool trigger_level1_en; 105 bool trigger_level1_en;
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
index 51d52e767a19..2a50048c1c44 100644
--- a/include/linux/platform_data/i2c-s3c2410.h
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -15,6 +15,8 @@
15 15
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */ 16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17 17
18struct platform_device;
19
18/** 20/**
19 * struct s3c2410_platform_i2c - Platform data for s3c I2C. 21 * struct s3c2410_platform_i2c - Platform data for s3c I2C.
20 * @bus_num: The bus number to use (if possible). 22 * @bus_num: The bus number to use (if possible).
diff --git a/include/linux/platform_data/imx-iram.h b/include/linux/platform_data/imx-iram.h
new file mode 100644
index 000000000000..022690c33702
--- /dev/null
+++ b/include/linux/platform_data/imx-iram.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19#include <linux/errno.h>
20
21#ifdef CONFIG_IRAM_ALLOC
22
23int __init iram_init(unsigned long base, unsigned long size);
24void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr);
25void iram_free(unsigned long dma_addr, unsigned int size);
26
27#else
28
29static inline int __init iram_init(unsigned long base, unsigned long size)
30{
31 return -ENOMEM;
32}
33
34static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr)
35{
36 return NULL;
37}
38
39static inline void iram_free(unsigned long base, unsigned long size) {}
40
41#endif
diff --git a/include/linux/platform_data/invensense_mpu6050.h b/include/linux/platform_data/invensense_mpu6050.h
new file mode 100644
index 000000000000..ad3aa7b95f35
--- /dev/null
+++ b/include/linux/platform_data/invensense_mpu6050.h
@@ -0,0 +1,31 @@
1/*
2* Copyright (C) 2012 Invensense, Inc.
3*
4* This software is licensed under the terms of the GNU General Public
5* License version 2, as published by the Free Software Foundation, and
6* may be copied, distributed, and modified under those terms.
7*
8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
12*/
13
14#ifndef __INV_MPU6050_PLATFORM_H_
15#define __INV_MPU6050_PLATFORM_H_
16
17/**
18 * struct inv_mpu6050_platform_data - Platform data for the mpu driver
19 * @orientation: Orientation matrix of the chip
20 *
21 * Contains platform specific information on how to configure the MPU6050 to
22 * work on this platform. The orientation matricies are 3x3 rotation matricies
23 * that are applied to the data to rotate from the mounting orientation to the
24 * platform orientation. The values must be one of 0, 1, or -1 and each row and
25 * column should have exactly 1 non-zero value.
26 */
27struct inv_mpu6050_platform_data {
28 __s8 orientation[9];
29};
30
31#endif
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
new file mode 100644
index 000000000000..1509570d5a3f
--- /dev/null
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -0,0 +1,87 @@
1/*
2 * LP55XX Platform Data Header
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * Derived from leds-lp5521.h, leds-lp5523.h
13 */
14
15#ifndef _LEDS_LP55XX_H
16#define _LEDS_LP55XX_H
17
18/* Clock configuration */
19#define LP55XX_CLOCK_AUTO 0
20#define LP55XX_CLOCK_INT 1
21#define LP55XX_CLOCK_EXT 2
22
23/* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */
24#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
25#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
26#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
27#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
28#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
29#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
30#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
31#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
32#define LP5521_CLK_INT 1 /* Internal clock */
33#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
34
35struct lp55xx_led_config {
36 const char *name;
37 u8 chan_nr;
38 u8 led_current; /* mA x10, 0 if led is not connected */
39 u8 max_current;
40};
41
42struct lp55xx_predef_pattern {
43 u8 *r;
44 u8 *g;
45 u8 *b;
46 u8 size_r;
47 u8 size_g;
48 u8 size_b;
49};
50
51/*
52 * struct lp55xx_platform_data
53 * @led_config : Configurable led class device
54 * @num_channels : Number of LED channels
55 * @label : Used for naming LEDs
56 * @clock_mode : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
57 * @setup_resources : Platform specific function before enabling the chip
58 * @release_resources : Platform specific function after disabling the chip
59 * @enable : EN pin control by platform side
60 * @patterns : Predefined pattern data for RGB channels
61 * @num_patterns : Number of patterns
62 * @update_config : Value of CONFIG register
63 */
64struct lp55xx_platform_data {
65
66 /* LED channel configuration */
67 struct lp55xx_led_config *led_config;
68 u8 num_channels;
69 const char *label;
70
71 /* Clock configuration */
72 u8 clock_mode;
73
74 /* Platform specific functions */
75 int (*setup_resources)(void);
76 void (*release_resources)(void);
77 void (*enable)(bool state);
78
79 /* Predefined pattern data */
80 struct lp55xx_predef_pattern *patterns;
81 unsigned int num_patterns;
82
83 /* _CONFIG register */
84 u8 update_config;
85};
86
87#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index e81f62d24ee2..20ee8b221dbd 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -49,12 +49,24 @@
49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained 49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained
50 when exiting the low power mode */ 50 when exiting the low power mode */
51 51
52/* CONFIG register - LP8557 */
53#define LP8557_PWM_STANDBY BIT(7)
54#define LP8557_PWM_FILTER BIT(6)
55#define LP8557_RELOAD_EPROM BIT(3) /* use it if EPROMs should be reset
56 when the backlight turns on */
57#define LP8557_OFF_OPENLEDS BIT(2)
58#define LP8557_PWM_CONFIG LP8557_PWM_ONLY
59#define LP8557_I2C_CONFIG LP8557_I2C_ONLY
60#define LP8557_COMB1_CONFIG LP8557_COMBINED1
61#define LP8557_COMB2_CONFIG LP8557_COMBINED2
62
52enum lp855x_chip_id { 63enum lp855x_chip_id {
53 LP8550, 64 LP8550,
54 LP8551, 65 LP8551,
55 LP8552, 66 LP8552,
56 LP8553, 67 LP8553,
57 LP8556, 68 LP8556,
69 LP8557,
58}; 70};
59 71
60enum lp855x_brightness_ctrl_mode { 72enum lp855x_brightness_ctrl_mode {
@@ -89,6 +101,13 @@ enum lp8556_brightness_source {
89 LP8556_COMBINED2, /* pwm + i2c after the shaper block */ 101 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
90}; 102};
91 103
104enum lp8557_brightness_source {
105 LP8557_PWM_ONLY,
106 LP8557_I2C_ONLY,
107 LP8557_COMBINED1, /* pwm + i2c after the shaper block */
108 LP8557_COMBINED2, /* pwm + i2c before the shaper block */
109};
110
92struct lp855x_rom_data { 111struct lp855x_rom_data {
93 u8 addr; 112 u8 addr;
94 u8 val; 113 u8 val;
diff --git a/include/linux/platform_data/lp8755.h b/include/linux/platform_data/lp8755.h
new file mode 100644
index 000000000000..a7fd0776c9bf
--- /dev/null
+++ b/include/linux/platform_data/lp8755.h
@@ -0,0 +1,71 @@
1/*
2 * LP8755 High Performance Power Management Unit Driver:System Interface Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * Author: Daniel(Geon Si) Jeong <daniel.jeong@ti.com>
7 * G.Shark Jeong <gshark.jeong@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef _LP8755_H
16#define _LP8755_H
17
18#include <linux/regulator/consumer.h>
19
20#define LP8755_NAME "lp8755-regulator"
21/*
22 *PWR FAULT : power fault detected
23 *OCP : over current protect activated
24 *OVP : over voltage protect activated
25 *TEMP_WARN : thermal warning
26 *TEMP_SHDN : thermal shutdonw detected
27 *I_LOAD : current measured
28 */
29#define LP8755_EVENT_PWR_FAULT REGULATOR_EVENT_FAIL
30#define LP8755_EVENT_OCP REGULATOR_EVENT_OVER_CURRENT
31#define LP8755_EVENT_OVP 0x10000
32#define LP8755_EVENT_TEMP_WARN 0x2000
33#define LP8755_EVENT_TEMP_SHDN REGULATOR_EVENT_OVER_TEMP
34#define LP8755_EVENT_I_LOAD 0x40000
35
36enum lp8755_bucks {
37 LP8755_BUCK0 = 0,
38 LP8755_BUCK1,
39 LP8755_BUCK2,
40 LP8755_BUCK3,
41 LP8755_BUCK4,
42 LP8755_BUCK5,
43 LP8755_BUCK_MAX,
44};
45
46/**
47 * multiphase configuration options
48 */
49enum lp8755_mphase_config {
50 MPHASE_CONF0,
51 MPHASE_CONF1,
52 MPHASE_CONF2,
53 MPHASE_CONF3,
54 MPHASE_CONF4,
55 MPHASE_CONF5,
56 MPHASE_CONF6,
57 MPHASE_CONF7,
58 MPHASE_CONF8,
59 MPHASE_CONF_MAX
60};
61
62/**
63 * struct lp8755_platform_data
64 * @mphase_type : Multiphase Switcher Configurations.
65 * @buck_data : buck0~6 init voltage in uV
66 */
67struct lp8755_platform_data {
68 int mphase;
69 struct regulator_init_data *buck_data[LP8755_BUCK_MAX];
70};
71#endif
diff --git a/include/linux/platform_data/max6697.h b/include/linux/platform_data/max6697.h
new file mode 100644
index 000000000000..ed9d3b3daf02
--- /dev/null
+++ b/include/linux/platform_data/max6697.h
@@ -0,0 +1,36 @@
1/*
2 * max6697.h
3 * Copyright (c) 2012 Guenter Roeck <linux@roeck-us.net>
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
10#ifndef MAX6697_H
11#define MAX6697_H
12
13#include <linux/types.h>
14
15/*
16 * For all bit masks:
17 * bit 0: local temperature
18 * bit 1..7: remote temperatures
19 */
20struct max6697_platform_data {
21 bool smbus_timeout_disable; /* set to disable SMBus timeouts */
22 bool extended_range_enable; /* set to enable extended temp range */
23 bool beta_compensation; /* set to enable beta compensation */
24 u8 alert_mask; /* set bit to 1 to disable alert */
25 u8 over_temperature_mask; /* set bit to 1 to disable */
26 u8 resistance_cancellation; /* set bit to 0 to disable
27 * bit mask for MAX6581,
28 * boolean for other chips
29 */
30 u8 ideality_mask; /* set bit to 0 to disable */
31 u8 ideality_value; /* transistor ideality as per
32 * MAX6581 datasheet
33 */
34};
35
36#endif /* MAX6697_H */
diff --git a/include/linux/platform_data/microread.h b/include/linux/platform_data/microread.h
new file mode 100644
index 000000000000..cfda59b226ee
--- /dev/null
+++ b/include/linux/platform_data/microread.h
@@ -0,0 +1,35 @@
1/*
2 * Driver include for the PN544 NFC chip.
3 *
4 * Copyright (C) 2011 Tieto Poland
5 * Copyright (C) 2012 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _MICROREAD_H
22#define _MICROREAD_H
23
24#include <linux/i2c.h>
25
26#define MICROREAD_DRIVER_NAME "microread"
27
28/* board config platform data for microread */
29struct microread_nfc_platform_data {
30 unsigned int rst_gpio;
31 unsigned int irq_gpio;
32 unsigned int ioh_gpio;
33};
34
35#endif /* _MICROREAD_H */
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index aaf97481f413..b4a0521ce411 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -39,5 +39,6 @@ struct esdhc_platform_data {
39 unsigned int cd_gpio; 39 unsigned int cd_gpio;
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width;
42}; 43};
43#endif /* __ASM_ARCH_IMX_ESDHC_H */ 44#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-sdhci-tegra.h b/include/linux/platform_data/mmc-sdhci-tegra.h
deleted file mode 100644
index 8f8430697686..000000000000
--- a/include/linux/platform_data/mmc-sdhci-tegra.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2009 Palm, Inc.
3 * Author: Yvonne Yip <y@palm.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef __PLATFORM_DATA_TEGRA_SDHCI_H
16#define __PLATFORM_DATA_TEGRA_SDHCI_H
17
18#include <linux/mmc/host.h>
19
20struct tegra_sdhci_platform_data {
21 int cd_gpio;
22 int wp_gpio;
23 int power_gpio;
24 int is_8bit;
25 int pm_flags;
26};
27
28#endif
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 24d32ca34bef..6bf9ef43ddb1 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -60,6 +60,8 @@ struct omap_nand_platform_data {
60 int devsize; 60 int devsize;
61 enum omap_ecc ecc_opt; 61 enum omap_ecc ecc_opt;
62 struct gpmc_nand_regs reg; 62 struct gpmc_nand_regs reg;
63};
64 63
64 /* for passing the partitions */
65 struct device_node *of_node;
66};
65#endif 67#endif
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
index 685af7e8b120..e9a9fb188f97 100644
--- a/include/linux/platform_data/mtd-onenand-omap2.h
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -29,5 +29,8 @@ struct omap_onenand_platform_data {
29 u8 flags; 29 u8 flags;
30 u8 regulator_can_sleep; 30 u8 regulator_can_sleep;
31 u8 skip_initial_unlocking; 31 u8 skip_initial_unlocking;
32
33 /* for passing the partitions */
34 struct device_node *of_node;
32}; 35};
33#endif 36#endif
diff --git a/include/linux/platform_data/s3c-hsotg.h b/include/linux/platform_data/s3c-hsotg.h
index 8b79e0967f9c..3f1cbf95ec3b 100644
--- a/include/linux/platform_data/s3c-hsotg.h
+++ b/include/linux/platform_data/s3c-hsotg.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_USB_S3C_HSOTG_H 15#ifndef __LINUX_USB_S3C_HSOTG_H
16#define __LINUX_USB_S3C_HSOTG_H 16#define __LINUX_USB_S3C_HSOTG_H
17 17
18struct platform_device;
19
18enum s3c_hsotg_dmamode { 20enum s3c_hsotg_dmamode {
19 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */ 21 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
20 S3C_HSOTG_DMA_ONLY, /* always use DMA */ 22 S3C_HSOTG_DMA_ONLY, /* always use DMA */
diff --git a/include/linux/platform_data/samsung-usbphy.h b/include/linux/platform_data/samsung-usbphy.h
new file mode 100644
index 000000000000..1bd24cba982b
--- /dev/null
+++ b/include/linux/platform_data/samsung-usbphy.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 * Author: Praveen Paneri <p.paneri@samsung.com>
5 *
6 * Defines platform data for samsung usb phy driver.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef __SAMSUNG_USBPHY_PLATFORM_H
15#define __SAMSUNG_USBPHY_PLATFORM_H
16
17/**
18 * samsung_usbphy_data - Platform data for USB PHY driver.
19 * @pmu_isolation: Function to control usb phy isolation in PMU.
20 */
21struct samsung_usbphy_data {
22 void (*pmu_isolation)(int on);
23};
24
25extern void samsung_usbphy_set_pdata(struct samsung_usbphy_data *pd);
26
27#endif /* __SAMSUNG_USBPHY_PLATFORM_H */
diff --git a/include/linux/platform_data/sccnxp.h b/include/linux/platform_data/serial-sccnxp.h
index 7311ccd3217f..215574d1e81d 100644
--- a/include/linux/platform_data/sccnxp.h
+++ b/include/linux/platform_data/serial-sccnxp.h
@@ -11,8 +11,8 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#ifndef __SCCNXP_H 14#ifndef _PLATFORM_DATA_SERIAL_SCCNXP_H_
15#define __SCCNXP_H 15#define _PLATFORM_DATA_SERIAL_SCCNXP_H_
16 16
17#define SCCNXP_MAX_UARTS 2 17#define SCCNXP_MAX_UARTS 2
18 18
@@ -84,6 +84,8 @@ struct sccnxp_pdata {
84 const u8 reg_shift; 84 const u8 reg_shift;
85 /* Modem control lines configuration */ 85 /* Modem control lines configuration */
86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS]; 86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS];
87 /* Timer value for polling mode (usecs) */
88 const unsigned int poll_time_us;
87 /* Called during startup */ 89 /* Called during startup */
88 void (*init)(void); 90 void (*init)(void);
89 /* Called before finish */ 91 /* Called before finish */
diff --git a/include/linux/platform_data/sh_ipmmu.h b/include/linux/platform_data/sh_ipmmu.h
new file mode 100644
index 000000000000..39f7405cdac5
--- /dev/null
+++ b/include/linux/platform_data/sh_ipmmu.h
@@ -0,0 +1,18 @@
1/* sh_ipmmu.h
2 *
3 * Copyright (C) 2012 Hideki EIRAKU
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 */
9
10#ifndef __SH_IPMMU_H__
11#define __SH_IPMMU_H__
12
13struct shmobile_ipmmu_platform_data {
14 const char * const *dev_names;
15 unsigned int num_dev_names;
16};
17
18#endif /* __SH_IPMMU_H__ */
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a65572d53211..c100456eab17 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -22,6 +22,9 @@ struct omap2_mcspi_dev_attr {
22 22
23struct omap2_mcspi_device_config { 23struct omap2_mcspi_device_config {
24 unsigned turbo_mode:1; 24 unsigned turbo_mode:1;
25
26 /* toggle chip select after every word */
27 unsigned cs_per_word:1;
25}; 28};
26 29
27#endif 30#endif
diff --git a/include/linux/platform_data/tsl2563.h b/include/linux/platform_data/tsl2563.h
new file mode 100644
index 000000000000..c90d7a09dda7
--- /dev/null
+++ b/include/linux/platform_data/tsl2563.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_TSL2563_H
2#define __LINUX_TSL2563_H
3
4struct tsl2563_platform_data {
5 int cover_comp_gain;
6};
7
8#endif /* __LINUX_TSL2563_H */
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h
index ef65b67c56c3..fa579b4c666b 100644
--- a/include/linux/platform_data/usb-omap.h
+++ b/include/linux/platform_data/usb-omap.h
@@ -55,13 +55,18 @@ struct ohci_hcd_omap_platform_data {
55}; 55};
56 56
57struct usbhs_omap_platform_data { 57struct usbhs_omap_platform_data {
58 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; 58 int nports;
59 enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
60 int reset_gpio_port[OMAP3_HS_USB_PORTS];
61 struct regulator *regulator[OMAP3_HS_USB_PORTS];
59 62
60 struct ehci_hcd_omap_platform_data *ehci_data; 63 struct ehci_hcd_omap_platform_data *ehci_data;
61 struct ohci_hcd_omap_platform_data *ohci_data; 64 struct ohci_hcd_omap_platform_data *ohci_data;
62 65
63 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */ 66 /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */
64 unsigned single_ulpi_bypass:1; 67 unsigned single_ulpi_bypass:1;
68 unsigned es2_compatibility:1;
69 unsigned phy_reset:1;
65}; 70};
66 71
67/*-------------------------------------------------------------------------*/ 72/*-------------------------------------------------------------------------*/
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
new file mode 100644
index 000000000000..85dcc709f7e9
--- /dev/null
+++ b/include/linux/platform_data/usb3503.h
@@ -0,0 +1,19 @@
1#ifndef __USB3503_H__
2#define __USB3503_H__
3
4#define USB3503_I2C_NAME "usb3503"
5
6enum usb3503_mode {
7 USB3503_MODE_UNKNOWN,
8 USB3503_MODE_HUB,
9 USB3503_MODE_STANDBY,
10};
11
12struct usb3503_platform_data {
13 enum usb3503_mode initial_mode;
14 int gpio_intn;
15 int gpio_connect;
16 int gpio_reset;
17};
18
19#endif
diff --git a/include/linux/platform_data/ux500_wdt.h b/include/linux/platform_data/ux500_wdt.h
new file mode 100644
index 000000000000..1689ff4c3bfd
--- /dev/null
+++ b/include/linux/platform_data/ux500_wdt.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) ST Ericsson SA 2011
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * STE Ux500 Watchdog platform data
7 */
8#ifndef __UX500_WDT_H
9#define __UX500_WDT_H
10
11/**
12 * struct ux500_wdt_data
13 */
14struct ux500_wdt_data {
15 unsigned int timeout;
16 bool has_28_bits_resolution;
17};
18
19#endif /* __UX500_WDT_H */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index a9ded9a3c175..c082c71f7225 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -204,6 +204,24 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
204 module_driver(__platform_driver, platform_driver_register, \ 204 module_driver(__platform_driver, platform_driver_register, \
205 platform_driver_unregister) 205 platform_driver_unregister)
206 206
207/* module_platform_driver_probe() - Helper macro for drivers that don't do
208 * anything special in module init/exit. This eliminates a lot of
209 * boilerplate. Each module may only use this macro once, and
210 * calling it replaces module_init() and module_exit()
211 */
212#define module_platform_driver_probe(__platform_driver, __platform_probe) \
213static int __init __platform_driver##_init(void) \
214{ \
215 return platform_driver_probe(&(__platform_driver), \
216 __platform_probe); \
217} \
218module_init(__platform_driver##_init); \
219static void __exit __platform_driver##_exit(void) \
220{ \
221 platform_driver_unregister(&(__platform_driver)); \
222} \
223module_exit(__platform_driver##_exit);
224
207extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 225extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
208 int (*probe)(struct platform_device *), 226 int (*probe)(struct platform_device *),
209 struct resource *res, unsigned int n_res, 227 struct resource *res, unsigned int n_res,
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 03d7bb145311..e5d7230332a4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -31,7 +31,6 @@
31/* 31/*
32 * Callbacks for platform drivers to implement. 32 * Callbacks for platform drivers to implement.
33 */ 33 */
34extern void (*pm_idle)(void);
35extern void (*pm_power_off)(void); 34extern void (*pm_power_off)(void);
36extern void (*pm_power_off_prepare)(void); 35extern void (*pm_power_off_prepare)(void);
37 36
@@ -538,6 +537,7 @@ struct dev_pm_info {
538 unsigned int irq_safe:1; 537 unsigned int irq_safe:1;
539 unsigned int use_autosuspend:1; 538 unsigned int use_autosuspend:1;
540 unsigned int timer_autosuspends:1; 539 unsigned int timer_autosuspends:1;
540 unsigned int memalloc_noio:1;
541 enum rpm_request request; 541 enum rpm_request request;
542 enum rpm_status runtime_status; 542 enum rpm_status runtime_status;
543 int runtime_error; 543 int runtime_error;
diff --git a/include/linux/pm2301_charger.h b/include/linux/pm2301_charger.h
new file mode 100644
index 000000000000..fc3f026922ae
--- /dev/null
+++ b/include/linux/pm2301_charger.h
@@ -0,0 +1,61 @@
1/*
2 * PM2301 charger driver.
3 *
4 * Copyright (C) 2012 ST Ericsson Corporation
5 *
6 * Contact: Olivier LAUNAY (olivier.launay@stericsson.com
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_PM2301_H
24#define __LINUX_PM2301_H
25
26/**
27 * struct pm2xxx_bm_charger_parameters - Charger specific parameters
28 * @ac_volt_max: maximum allowed AC charger voltage in mV
29 * @ac_curr_max: maximum allowed AC charger current in mA
30 */
31struct pm2xxx_bm_charger_parameters {
32 int ac_volt_max;
33 int ac_curr_max;
34};
35
36/**
37 * struct pm2xxx_bm_data - pm2xxx battery management data
38 * @enable_overshoot flag to enable VBAT overshoot control
39 * @chg_params charger parameters
40 */
41struct pm2xxx_bm_data {
42 bool enable_overshoot;
43 const struct pm2xxx_bm_charger_parameters *chg_params;
44};
45
46struct pm2xxx_charger_platform_data {
47 char **supplied_to;
48 size_t num_supplicants;
49 int i2c_bus;
50 const char *label;
51 int irq_number;
52 unsigned int lpn_gpio;
53 int irq_type;
54};
55
56struct pm2xxx_platform_data {
57 struct pm2xxx_charger_platform_data *wall_charger;
58 struct pm2xxx_bm_data *battery;
59};
60
61#endif /* __LINUX_PM2301_H */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index f271860c78d5..7d7e09efff9b 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -47,6 +47,7 @@ extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 47extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
48extern void pm_runtime_update_max_time_suspended(struct device *dev, 48extern void pm_runtime_update_max_time_suspended(struct device *dev,
49 s64 delta_ns); 49 s64 delta_ns);
50extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
50 51
51static inline bool pm_children_suspended(struct device *dev) 52static inline bool pm_children_suspended(struct device *dev)
52{ 53{
@@ -80,6 +81,12 @@ static inline bool pm_runtime_suspended(struct device *dev)
80 && !dev->power.disable_depth; 81 && !dev->power.disable_depth;
81} 82}
82 83
84static inline bool pm_runtime_active(struct device *dev)
85{
86 return dev->power.runtime_status == RPM_ACTIVE
87 || dev->power.disable_depth;
88}
89
83static inline bool pm_runtime_status_suspended(struct device *dev) 90static inline bool pm_runtime_status_suspended(struct device *dev)
84{ 91{
85 return dev->power.runtime_status == RPM_SUSPENDED; 92 return dev->power.runtime_status == RPM_SUSPENDED;
@@ -132,6 +139,7 @@ static inline void pm_runtime_put_noidle(struct device *dev) {}
132static inline bool device_run_wake(struct device *dev) { return false; } 139static inline bool device_run_wake(struct device *dev) { return false; }
133static inline void device_set_run_wake(struct device *dev, bool enable) {} 140static inline void device_set_run_wake(struct device *dev, bool enable) {}
134static inline bool pm_runtime_suspended(struct device *dev) { return false; } 141static inline bool pm_runtime_suspended(struct device *dev) { return false; }
142static inline bool pm_runtime_active(struct device *dev) { return true; }
135static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 143static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
136static inline bool pm_runtime_enabled(struct device *dev) { return false; } 144static inline bool pm_runtime_enabled(struct device *dev) { return false; }
137 145
@@ -149,6 +157,8 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
149 int delay) {} 157 int delay) {}
150static inline unsigned long pm_runtime_autosuspend_expiration( 158static inline unsigned long pm_runtime_autosuspend_expiration(
151 struct device *dev) { return 0; } 159 struct device *dev) { return 0; }
160static inline void pm_runtime_set_memalloc_noio(struct device *dev,
161 bool enable){}
152 162
153#endif /* !CONFIG_PM_RUNTIME */ 163#endif /* !CONFIG_PM_RUNTIME */
154 164
diff --git a/include/linux/power/bq2415x_charger.h b/include/linux/power/bq2415x_charger.h
index 97a1665eaeaf..8dcc0f46fc0a 100644
--- a/include/linux/power/bq2415x_charger.h
+++ b/include/linux/power/bq2415x_charger.h
@@ -75,7 +75,8 @@
75 75
76/* Supported modes with maximal current limit */ 76/* Supported modes with maximal current limit */
77enum bq2415x_mode { 77enum bq2415x_mode {
78 BQ2415X_MODE_NONE, /* unknown or no charger (100mA) */ 78 BQ2415X_MODE_OFF, /* offline mode (charger disabled) */
79 BQ2415X_MODE_NONE, /* unknown charger (100mA) */
79 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */ 80 BQ2415X_MODE_HOST_CHARGER, /* usb host/hub charger (500mA) */
80 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */ 81 BQ2415X_MODE_DEDICATED_CHARGER, /* dedicated charger (unlimited) */
81 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */ 82 BQ2415X_MODE_BOOST, /* boost mode (charging disabled) */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 1f0ab90aff00..002a99f96331 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -54,6 +54,8 @@ enum {
54 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 54 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
55 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 55 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
56 POWER_SUPPLY_HEALTH_COLD, 56 POWER_SUPPLY_HEALTH_COLD,
57 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE,
58 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE,
57}; 59};
58 60
59enum { 61enum {
@@ -224,7 +226,7 @@ struct power_supply_info {
224 int use_for_apm; 226 int use_for_apm;
225}; 227};
226 228
227extern struct power_supply *power_supply_get_by_name(char *name); 229extern struct power_supply *power_supply_get_by_name(const char *name);
228extern void power_supply_changed(struct power_supply *psy); 230extern void power_supply_changed(struct power_supply *psy);
229extern int power_supply_am_i_supplied(struct power_supply *psy); 231extern int power_supply_am_i_supplied(struct power_supply *psy);
230extern int power_supply_set_battery_charged(struct power_supply *psy); 232extern int power_supply_set_battery_charged(struct power_supply *psy);
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 0cc45ae1afd5..7db3eb93a079 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -43,7 +43,7 @@ struct pps_source_info {
43 int event, void *data); /* PPS echo function */ 43 int event, void *data); /* PPS echo function */
44 44
45 struct module *owner; 45 struct module *owner;
46 struct device *dev; 46 struct device *dev; /* Parent device for device_create */
47}; 47};
48 48
49struct pps_event_time { 49struct pps_event_time {
@@ -69,6 +69,7 @@ struct pps_device {
69 wait_queue_head_t queue; /* PPS event queue */ 69 wait_queue_head_t queue; /* PPS event queue */
70 70
71 unsigned int id; /* PPS source unique ID */ 71 unsigned int id; /* PPS source unique ID */
72 void const *lookup_cookie; /* pps_lookup_dev only */
72 struct cdev cdev; 73 struct cdev cdev;
73 struct device *dev; 74 struct device *dev;
74 struct fasync_struct *async_queue; /* fasync method */ 75 struct fasync_struct *async_queue; /* fasync method */
@@ -82,16 +83,26 @@ struct pps_device {
82extern struct device_attribute pps_attrs[]; 83extern struct device_attribute pps_attrs[];
83 84
84/* 85/*
86 * Internal functions.
87 *
88 * These are not actually part of the exported API, but this is a
89 * convenient header file to put them in.
90 */
91
92extern int pps_register_cdev(struct pps_device *pps);
93extern void pps_unregister_cdev(struct pps_device *pps);
94
95/*
85 * Exported functions 96 * Exported functions
86 */ 97 */
87 98
88extern struct pps_device *pps_register_source( 99extern struct pps_device *pps_register_source(
89 struct pps_source_info *info, int default_params); 100 struct pps_source_info *info, int default_params);
90extern void pps_unregister_source(struct pps_device *pps); 101extern void pps_unregister_source(struct pps_device *pps);
91extern int pps_register_cdev(struct pps_device *pps);
92extern void pps_unregister_cdev(struct pps_device *pps);
93extern void pps_event(struct pps_device *pps, 102extern void pps_event(struct pps_device *pps,
94 struct pps_event_time *ts, int event, void *data); 103 struct pps_event_time *ts, int event, void *data);
104/* Look up a pps device by magic cookie */
105struct pps_device *pps_lookup_dev(void const *cookie);
95 106
96static inline void timespec_to_pps_ktime(struct pps_ktime *kt, 107static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
97 struct timespec ts) 108 struct timespec ts)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 9afc01e5a0a6..1249a54d17e0 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -98,9 +98,6 @@ int no_printk(const char *fmt, ...)
98extern asmlinkage __printf(1, 2) 98extern asmlinkage __printf(1, 2)
99void early_printk(const char *fmt, ...); 99void early_printk(const char *fmt, ...);
100 100
101extern int printk_needs_cpu(int cpu);
102extern void printk_tick(void);
103
104#ifdef CONFIG_PRINTK 101#ifdef CONFIG_PRINTK
105asmlinkage __printf(5, 0) 102asmlinkage __printf(5, 0)
106int vprintk_emit(int facility, int level, 103int vprintk_emit(int facility, int level,
@@ -255,6 +252,15 @@ extern void dump_stack(void) __cold;
255 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 252 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
256#define pr_cont_once(fmt, ...) \ 253#define pr_cont_once(fmt, ...) \
257 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) 254 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
255
256#if defined(DEBUG)
257#define pr_devel_once(fmt, ...) \
258 printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
259#else
260#define pr_devel_once(fmt, ...) \
261 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
262#endif
263
258/* If you are writing a driver, please use dev_dbg instead */ 264/* If you are writing a driver, please use dev_dbg instead */
259#if defined(DEBUG) 265#if defined(DEBUG)
260#define pr_debug_once(fmt, ...) \ 266#define pr_debug_once(fmt, ...) \
@@ -298,6 +304,15 @@ extern void dump_stack(void) __cold;
298#define pr_info_ratelimited(fmt, ...) \ 304#define pr_info_ratelimited(fmt, ...) \
299 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 305 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
300/* no pr_cont_ratelimited, don't do that... */ 306/* no pr_cont_ratelimited, don't do that... */
307
308#if defined(DEBUG)
309#define pr_devel_ratelimited(fmt, ...) \
310 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
311#else
312#define pr_devel_ratelimited(fmt, ...) \
313 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
314#endif
315
301/* If you are writing a driver, please use dev_dbg instead */ 316/* If you are writing a driver, please use dev_dbg instead */
302#if defined(DEBUG) 317#if defined(DEBUG)
303#define pr_debug_ratelimited(fmt, ...) \ 318#define pr_debug_ratelimited(fmt, ...) \
@@ -321,8 +336,13 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,
321extern void print_hex_dump(const char *level, const char *prefix_str, 336extern void print_hex_dump(const char *level, const char *prefix_str,
322 int prefix_type, int rowsize, int groupsize, 337 int prefix_type, int rowsize, int groupsize,
323 const void *buf, size_t len, bool ascii); 338 const void *buf, size_t len, bool ascii);
339#if defined(CONFIG_DYNAMIC_DEBUG)
340#define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \
341 dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true)
342#else
324extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 343extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
325 const void *buf, size_t len); 344 const void *buf, size_t len);
345#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
326#else 346#else
327static inline void print_hex_dump(const char *level, const char *prefix_str, 347static inline void print_hex_dump(const char *level, const char *prefix_str,
328 int prefix_type, int rowsize, int groupsize, 348 int prefix_type, int rowsize, int groupsize,
@@ -336,4 +356,16 @@ static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
336 356
337#endif 357#endif
338 358
359#if defined(CONFIG_DYNAMIC_DEBUG)
360#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
361 groupsize, buf, len, ascii) \
362 dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
363 groupsize, buf, len, ascii)
364#else
365#define print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
366 groupsize, buf, len, ascii) \
367 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \
368 groupsize, buf, len, ascii)
369#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
370
339#endif 371#endif
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 32676b35d2f5..8307f2f94d86 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -127,7 +127,12 @@ extern void pid_ns_release_proc(struct pid_namespace *ns);
127 * proc_tty.c 127 * proc_tty.c
128 */ 128 */
129struct tty_driver; 129struct tty_driver;
130#ifdef CONFIG_TTY
130extern void proc_tty_init(void); 131extern void proc_tty_init(void);
132#else
133static inline void proc_tty_init(void)
134{ }
135#endif
131extern void proc_tty_register_driver(struct tty_driver *driver); 136extern void proc_tty_register_driver(struct tty_driver *driver);
132extern void proc_tty_unregister_driver(struct tty_driver *driver); 137extern void proc_tty_unregister_driver(struct tty_driver *driver);
133 138
@@ -171,9 +176,6 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
171 return res; 176 return res;
172} 177}
173 178
174extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
175 const char *name, umode_t mode, const struct file_operations *fops);
176extern void proc_net_remove(struct net *net, const char *name);
177extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, 179extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
178 struct proc_dir_entry *parent); 180 struct proc_dir_entry *parent);
179 181
@@ -184,21 +186,15 @@ extern int proc_alloc_inum(unsigned int *pino);
184extern void proc_free_inum(unsigned int inum); 186extern void proc_free_inum(unsigned int inum);
185#else 187#else
186 188
187#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
188static inline void proc_net_remove(struct net *net, const char *name) {}
189
190static inline void proc_flush_task(struct task_struct *task) 189static inline void proc_flush_task(struct task_struct *task)
191{ 190{
192} 191}
193 192
194static inline struct proc_dir_entry *create_proc_entry(const char *name, 193static inline struct proc_dir_entry *create_proc_entry(const char *name,
195 umode_t mode, struct proc_dir_entry *parent) { return NULL; } 194 umode_t mode, struct proc_dir_entry *parent) { return NULL; }
196static inline struct proc_dir_entry *proc_create(const char *name, 195
197 umode_t mode, struct proc_dir_entry *parent, 196#define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; })
198 const struct file_operations *proc_fops) 197
199{
200 return NULL;
201}
202static inline struct proc_dir_entry *proc_create_data(const char *name, 198static inline struct proc_dir_entry *proc_create_data(const char *name,
203 umode_t mode, struct proc_dir_entry *parent, 199 umode_t mode, struct proc_dir_entry *parent,
204 const struct file_operations *proc_fops, void *data) 200 const struct file_operations *proc_fops, void *data)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index a0fc32279fc0..21123902366d 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -82,9 +82,6 @@ int task_handoff_unregister(struct notifier_block * n);
82int profile_event_register(enum profile_type, struct notifier_block * n); 82int profile_event_register(enum profile_type, struct notifier_block * n);
83int profile_event_unregister(enum profile_type, struct notifier_block * n); 83int profile_event_unregister(enum profile_type, struct notifier_block * n);
84 84
85int register_timer_hook(int (*hook)(struct pt_regs *));
86void unregister_timer_hook(int (*hook)(struct pt_regs *));
87
88struct pt_regs; 85struct pt_regs;
89 86
90#else 87#else
@@ -135,16 +132,6 @@ static inline int profile_event_unregister(enum profile_type t, struct notifier_
135#define profile_handoff_task(a) (0) 132#define profile_handoff_task(a) (0)
136#define profile_munmap(a) do { } while (0) 133#define profile_munmap(a) do { } while (0)
137 134
138static inline int register_timer_hook(int (*hook)(struct pt_regs *))
139{
140 return -ENOSYS;
141}
142
143static inline void unregister_timer_hook(int (*hook)(struct pt_regs *))
144{
145 return;
146}
147
148#endif /* CONFIG_PROFILING */ 135#endif /* CONFIG_PROFILING */
149 136
150#endif /* _LINUX_PROFILE_H */ 137#endif /* _LINUX_PROFILE_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 1788909d9a99..75d01760c911 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -68,12 +68,18 @@ struct pstore_info {
68 68
69#ifdef CONFIG_PSTORE 69#ifdef CONFIG_PSTORE
70extern int pstore_register(struct pstore_info *); 70extern int pstore_register(struct pstore_info *);
71extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
71#else 72#else
72static inline int 73static inline int
73pstore_register(struct pstore_info *psi) 74pstore_register(struct pstore_info *psi)
74{ 75{
75 return -ENODEV; 76 return -ENODEV;
76} 77}
78static inline bool
79pstore_cannot_block_path(enum kmsg_dump_reason reason)
80{
81 return false;
82}
77#endif 83#endif
78 84
79#endif /*_LINUX_PSTORE_H*/ 85#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 098d2a838296..cb6ab5feab67 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -46,9 +46,8 @@ struct persistent_ram_zone {
46 size_t old_log_size; 46 size_t old_log_size;
47}; 47};
48 48
49struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, 49struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
50 size_t size, u32 sig, 50 u32 sig, int ecc_size);
51 int ecc_size);
52void persistent_ram_free(struct persistent_ram_zone *prz); 51void persistent_ram_free(struct persistent_ram_zone *prz);
53void persistent_ram_zap(struct persistent_ram_zone *prz); 52void persistent_ram_zap(struct persistent_ram_zone *prz);
54 53
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 1693775ecfe8..89573a33ab3c 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -45,7 +45,6 @@ extern long arch_ptrace(struct task_struct *child, long request,
45extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 45extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
46extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 46extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
47extern void ptrace_disable(struct task_struct *); 47extern void ptrace_disable(struct task_struct *);
48extern int ptrace_check_attach(struct task_struct *task, bool ignore_state);
49extern int ptrace_request(struct task_struct *child, long request, 48extern int ptrace_request(struct task_struct *child, long request,
50 unsigned long addr, unsigned long data); 49 unsigned long addr, unsigned long data);
51extern void ptrace_notify(int exit_code); 50extern void ptrace_notify(int exit_code);
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 6d661f32e0e4..a4df2042b79c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -146,6 +146,8 @@ struct pwm_ops {
146 * @base: number of first PWM controlled by this chip 146 * @base: number of first PWM controlled by this chip
147 * @npwm: number of PWMs controlled by this chip 147 * @npwm: number of PWMs controlled by this chip
148 * @pwms: array of PWM devices allocated by the framework 148 * @pwms: array of PWM devices allocated by the framework
149 * @can_sleep: must be true if the .config(), .enable() or .disable()
150 * operations may sleep
149 */ 151 */
150struct pwm_chip { 152struct pwm_chip {
151 struct device *dev; 153 struct device *dev;
@@ -159,6 +161,7 @@ struct pwm_chip {
159 struct pwm_device * (*of_xlate)(struct pwm_chip *pc, 161 struct pwm_device * (*of_xlate)(struct pwm_chip *pc,
160 const struct of_phandle_args *args); 162 const struct of_phandle_args *args);
161 unsigned int of_pwm_n_cells; 163 unsigned int of_pwm_n_cells;
164 bool can_sleep;
162}; 165};
163 166
164#if IS_ENABLED(CONFIG_PWM) 167#if IS_ENABLED(CONFIG_PWM)
@@ -174,11 +177,16 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc, 177struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
175 const struct of_phandle_args *args); 178 const struct of_phandle_args *args);
176 179
177struct pwm_device *pwm_get(struct device *dev, const char *consumer); 180struct pwm_device *pwm_get(struct device *dev, const char *con_id);
181struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
178void pwm_put(struct pwm_device *pwm); 182void pwm_put(struct pwm_device *pwm);
179 183
180struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer); 184struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
185struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
186 const char *con_id);
181void devm_pwm_put(struct device *dev, struct pwm_device *pwm); 187void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
188
189bool pwm_can_sleep(struct pwm_device *pwm);
182#else 190#else
183static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data) 191static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
184{ 192{
@@ -213,6 +221,12 @@ static inline struct pwm_device *pwm_get(struct device *dev,
213 return ERR_PTR(-ENODEV); 221 return ERR_PTR(-ENODEV);
214} 222}
215 223
224static inline struct pwm_device *of_pwm_get(struct device_node *np,
225 const char *con_id)
226{
227 return ERR_PTR(-ENODEV);
228}
229
216static inline void pwm_put(struct pwm_device *pwm) 230static inline void pwm_put(struct pwm_device *pwm)
217{ 231{
218} 232}
@@ -223,9 +237,21 @@ static inline struct pwm_device *devm_pwm_get(struct device *dev,
223 return ERR_PTR(-ENODEV); 237 return ERR_PTR(-ENODEV);
224} 238}
225 239
240static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
241 struct device_node *np,
242 const char *con_id)
243{
244 return ERR_PTR(-ENODEV);
245}
246
226static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) 247static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
227{ 248{
228} 249}
250
251static inline bool pwm_can_sleep(struct pwm_device *pwm)
252{
253 return false;
254}
229#endif 255#endif
230 256
231struct pwm_lookup { 257struct pwm_lookup {
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index f36632061c66..467cc6307b62 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -155,6 +155,14 @@
155#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */ 155#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
156#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */ 156#define SSACD_SCDX8 (1 << 7) /* SYSCLK division ratio select */
157 157
158/* LPSS SSP */
159#define SSITF 0x44 /* TX FIFO trigger level */
160#define SSITF_TxLoThresh(x) (((x) - 1) << 8)
161#define SSITF_TxHiThresh(x) ((x) - 1)
162
163#define SSIRF 0x48 /* RX FIFO trigger level */
164#define SSIRF_RxThresh(x) ((x) - 1)
165
158enum pxa_ssp_type { 166enum pxa_ssp_type {
159 SSP_UNDEFINED = 0, 167 SSP_UNDEFINED = 0,
160 PXA25x_SSP, /* pxa 210, 250, 255, 26x */ 168 PXA25x_SSP, /* pxa 210, 250, 255, 26x */
@@ -164,6 +172,7 @@ enum pxa_ssp_type {
164 PXA168_SSP, 172 PXA168_SSP,
165 PXA910_SSP, 173 PXA910_SSP,
166 CE4100_SSP, 174 CE4100_SSP,
175 LPSS_SSP,
167}; 176};
168 177
169struct ssp_device { 178struct ssp_device {
@@ -206,6 +215,15 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
206 return __raw_readl(dev->mmio_base + reg); 215 return __raw_readl(dev->mmio_base + reg);
207} 216}
208 217
218#ifdef CONFIG_ARCH_PXA
209struct ssp_device *pxa_ssp_request(int port, const char *label); 219struct ssp_device *pxa_ssp_request(int port, const char *label);
210void pxa_ssp_free(struct ssp_device *); 220void pxa_ssp_free(struct ssp_device *);
221#else
222static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
223{
224 return NULL;
225}
226static inline void pxa_ssp_free(struct ssp_device *ssp) {}
227#endif
228
211#endif 229#endif
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 58fdef125252..d13371134c59 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -405,6 +405,7 @@ struct quota_module_name {
405#define INIT_QUOTA_MODULE_NAMES {\ 405#define INIT_QUOTA_MODULE_NAMES {\
406 {QFMT_VFS_OLD, "quota_v1"},\ 406 {QFMT_VFS_OLD, "quota_v1"},\
407 {QFMT_VFS_V0, "quota_v2"},\ 407 {QFMT_VFS_V0, "quota_v2"},\
408 {QFMT_VFS_V1, "quota_v2"},\
408 {0, NULL}} 409 {0, NULL}}
409 410
410#endif /* _QUOTA_ */ 411#endif /* _QUOTA_ */
diff --git a/include/linux/random.h b/include/linux/random.h
index d9846088c2c5..347ce553a306 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -74,4 +74,10 @@ static inline int arch_get_random_int(unsigned int *v)
74} 74}
75#endif 75#endif
76 76
77/* Pseudo random number generator from numerical recipes. */
78static inline u32 next_pseudo_random32(u32 seed)
79{
80 return seed * 1664525 + 1013904223;
81}
82
77#endif /* _LINUX_RANDOM_H */ 83#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index 2ac60c9cf644..fea49b5da12a 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -123,9 +123,9 @@ __rb_change_child(struct rb_node *old, struct rb_node *new,
123extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root, 123extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
124 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 124 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
125 125
126static __always_inline void 126static __always_inline struct rb_node *
127rb_erase_augmented(struct rb_node *node, struct rb_root *root, 127__rb_erase_augmented(struct rb_node *node, struct rb_root *root,
128 const struct rb_augment_callbacks *augment) 128 const struct rb_augment_callbacks *augment)
129{ 129{
130 struct rb_node *child = node->rb_right, *tmp = node->rb_left; 130 struct rb_node *child = node->rb_right, *tmp = node->rb_left;
131 struct rb_node *parent, *rebalance; 131 struct rb_node *parent, *rebalance;
@@ -217,6 +217,14 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root,
217 } 217 }
218 218
219 augment->propagate(tmp, NULL); 219 augment->propagate(tmp, NULL);
220 return rebalance;
221}
222
223static __always_inline void
224rb_erase_augmented(struct rb_node *node, struct rb_root *root,
225 const struct rb_augment_callbacks *augment)
226{
227 struct rb_node *rebalance = __rb_erase_augmented(node, root, augment);
220 if (rebalance) 228 if (rebalance)
221 __rb_erase_color(rebalance, root, augment->rotate); 229 __rb_erase_color(rebalance, root, augment->rotate);
222} 230}
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index c92dd28eaa6c..8089e35d47ac 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -445,8 +445,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
445 445
446/** 446/**
447 * hlist_for_each_entry_rcu - iterate over rcu list of given type 447 * hlist_for_each_entry_rcu - iterate over rcu list of given type
448 * @tpos: the type * to use as a loop cursor. 448 * @pos: the type * to use as a loop cursor.
449 * @pos: the &struct hlist_node to use as a loop cursor.
450 * @head: the head for your list. 449 * @head: the head for your list.
451 * @member: the name of the hlist_node within the struct. 450 * @member: the name of the hlist_node within the struct.
452 * 451 *
@@ -454,16 +453,16 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
454 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 453 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
455 * as long as the traversal is guarded by rcu_read_lock(). 454 * as long as the traversal is guarded by rcu_read_lock().
456 */ 455 */
457#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 456#define hlist_for_each_entry_rcu(pos, head, member) \
458 for (pos = rcu_dereference_raw(hlist_first_rcu(head)); \ 457 for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\
459 pos && \ 458 typeof(*(pos)), member); \
460 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 459 pos; \
461 pos = rcu_dereference_raw(hlist_next_rcu(pos))) 460 pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
461 &(pos)->member)), typeof(*(pos)), member))
462 462
463/** 463/**
464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type 464 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
465 * @tpos: the type * to use as a loop cursor. 465 * @pos: the type * to use as a loop cursor.
466 * @pos: the &struct hlist_node to use as a loop cursor.
467 * @head: the head for your list. 466 * @head: the head for your list.
468 * @member: the name of the hlist_node within the struct. 467 * @member: the name of the hlist_node within the struct.
469 * 468 *
@@ -471,35 +470,36 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
471 * the _rcu list-mutation primitives such as hlist_add_head_rcu() 470 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
472 * as long as the traversal is guarded by rcu_read_lock(). 471 * as long as the traversal is guarded by rcu_read_lock().
473 */ 472 */
474#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \ 473#define hlist_for_each_entry_rcu_bh(pos, head, member) \
475 for (pos = rcu_dereference_bh((head)->first); \ 474 for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_first_rcu(head)),\
476 pos && \ 475 typeof(*(pos)), member); \
477 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 476 pos; \
478 pos = rcu_dereference_bh(pos->next)) 477 pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(\
478 &(pos)->member)), typeof(*(pos)), member))
479 479
480/** 480/**
481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point 481 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
482 * @tpos: the type * to use as a loop cursor. 482 * @pos: the type * to use as a loop cursor.
483 * @pos: the &struct hlist_node to use as a loop cursor.
484 * @member: the name of the hlist_node within the struct. 483 * @member: the name of the hlist_node within the struct.
485 */ 484 */
486#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \ 485#define hlist_for_each_entry_continue_rcu(pos, member) \
487 for (pos = rcu_dereference((pos)->next); \ 486 for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
488 pos && \ 487 typeof(*(pos)), member); \
489 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 488 pos; \
490 pos = rcu_dereference(pos->next)) 489 pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
490 typeof(*(pos)), member))
491 491
492/** 492/**
493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point 493 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
494 * @tpos: the type * to use as a loop cursor. 494 * @pos: the type * to use as a loop cursor.
495 * @pos: the &struct hlist_node to use as a loop cursor.
496 * @member: the name of the hlist_node within the struct. 495 * @member: the name of the hlist_node within the struct.
497 */ 496 */
498#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \ 497#define hlist_for_each_entry_continue_rcu_bh(pos, member) \
499 for (pos = rcu_dereference_bh((pos)->next); \ 498 for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
500 pos && \ 499 typeof(*(pos)), member); \
501 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 500 pos; \
502 pos = rcu_dereference_bh(pos->next)) 501 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
502 typeof(*(pos)), member))
503 503
504 504
505#endif /* __KERNEL__ */ 505#endif /* __KERNEL__ */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 275aa3f1062d..b758ce17b309 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -53,7 +53,10 @@ extern int rcutorture_runnable; /* for sysctl */
53extern void rcutorture_record_test_transition(void); 53extern void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54extern void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(char *rcutorturename, 55extern void do_trace_rcu_torture_read(char *rcutorturename,
56 struct rcu_head *rhp); 56 struct rcu_head *rhp,
57 unsigned long secs,
58 unsigned long c_old,
59 unsigned long c);
57#else 60#else
58static inline void rcutorture_record_test_transition(void) 61static inline void rcutorture_record_test_transition(void)
59{ 62{
@@ -63,9 +66,13 @@ static inline void rcutorture_record_progress(unsigned long vernum)
63} 66}
64#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
65extern void do_trace_rcu_torture_read(char *rcutorturename, 68extern void do_trace_rcu_torture_read(char *rcutorturename,
66 struct rcu_head *rhp); 69 struct rcu_head *rhp,
70 unsigned long secs,
71 unsigned long c_old,
72 unsigned long c);
67#else 73#else
68#define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0) 74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
75 do { } while (0)
69#endif 76#endif
70#endif 77#endif
71 78
@@ -749,7 +756,7 @@ static inline void rcu_preempt_sleep_check(void)
749 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU) 756 * preemptible RCU implementations (TREE_PREEMPT_RCU and TINY_PREEMPT_RCU)
750 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may 757 * in CONFIG_PREEMPT kernel builds, RCU read-side critical sections may
751 * be preempted, but explicit blocking is illegal. Finally, in preemptible 758 * be preempted, but explicit blocking is illegal. Finally, in preemptible
752 * RCU implementations in real-time (CONFIG_PREEMPT_RT) kernel builds, 759 * RCU implementations in real-time (with -rt patchset) kernel builds,
753 * RCU read-side critical sections may be preempted and they may also 760 * RCU read-side critical sections may be preempted and they may also
754 * block, but only when acquiring spinlocks that are subject to priority 761 * block, but only when acquiring spinlocks that are subject to priority
755 * inheritance. 762 * inheritance.
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index b7e95bf942c9..bf77dfdabef9 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -28,7 +28,8 @@ struct regmap_range_cfg;
28enum regcache_type { 28enum regcache_type {
29 REGCACHE_NONE, 29 REGCACHE_NONE,
30 REGCACHE_RBTREE, 30 REGCACHE_RBTREE,
31 REGCACHE_COMPRESSED 31 REGCACHE_COMPRESSED,
32 REGCACHE_FLAT,
32}; 33};
33 34
34/** 35/**
@@ -127,7 +128,18 @@ typedef void (*regmap_unlock)(void *);
127 * @lock_arg: this field is passed as the only argument of lock/unlock 128 * @lock_arg: this field is passed as the only argument of lock/unlock
128 * functions (ignored in case regular lock/unlock functions 129 * functions (ignored in case regular lock/unlock functions
129 * are not overridden). 130 * are not overridden).
130 * 131 * @reg_read: Optional callback that if filled will be used to perform
132 * all the reads from the registers. Should only be provided for
133 * devices whos read operation cannot be represented as a simple read
134 * operation on a bus such as SPI, I2C, etc. Most of the devices do
135 * not need this.
136 * @reg_write: Same as above for writing.
137 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
138 * to perform locking. This field is ignored if custom lock/unlock
139 * functions are used (see fields lock/unlock of struct regmap_config).
140 * This field is a duplicate of a similar file in
141 * 'struct regmap_bus' and serves exact same purpose.
142 * Use it only for "no-bus" cases.
131 * @max_register: Optional, specifies the maximum valid register index. 143 * @max_register: Optional, specifies the maximum valid register index.
132 * @wr_table: Optional, points to a struct regmap_access_table specifying 144 * @wr_table: Optional, points to a struct regmap_access_table specifying
133 * valid ranges for write access. 145 * valid ranges for write access.
@@ -177,6 +189,11 @@ struct regmap_config {
177 regmap_unlock unlock; 189 regmap_unlock unlock;
178 void *lock_arg; 190 void *lock_arg;
179 191
192 int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
193 int (*reg_write)(void *context, unsigned int reg, unsigned int val);
194
195 bool fast_io;
196
180 unsigned int max_register; 197 unsigned int max_register;
181 const struct regmap_access_table *wr_table; 198 const struct regmap_access_table *wr_table;
182 const struct regmap_access_table *rd_table; 199 const struct regmap_access_table *rd_table;
@@ -235,14 +252,21 @@ struct regmap_range_cfg {
235 unsigned int window_len; 252 unsigned int window_len;
236}; 253};
237 254
255struct regmap_async;
256
238typedef int (*regmap_hw_write)(void *context, const void *data, 257typedef int (*regmap_hw_write)(void *context, const void *data,
239 size_t count); 258 size_t count);
240typedef int (*regmap_hw_gather_write)(void *context, 259typedef int (*regmap_hw_gather_write)(void *context,
241 const void *reg, size_t reg_len, 260 const void *reg, size_t reg_len,
242 const void *val, size_t val_len); 261 const void *val, size_t val_len);
262typedef int (*regmap_hw_async_write)(void *context,
263 const void *reg, size_t reg_len,
264 const void *val, size_t val_len,
265 struct regmap_async *async);
243typedef int (*regmap_hw_read)(void *context, 266typedef int (*regmap_hw_read)(void *context,
244 const void *reg_buf, size_t reg_size, 267 const void *reg_buf, size_t reg_size,
245 void *val_buf, size_t val_size); 268 void *val_buf, size_t val_size);
269typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
246typedef void (*regmap_hw_free_context)(void *context); 270typedef void (*regmap_hw_free_context)(void *context);
247 271
248/** 272/**
@@ -255,8 +279,11 @@ typedef void (*regmap_hw_free_context)(void *context);
255 * @write: Write operation. 279 * @write: Write operation.
256 * @gather_write: Write operation with split register/value, return -ENOTSUPP 280 * @gather_write: Write operation with split register/value, return -ENOTSUPP
257 * if not implemented on a given device. 281 * if not implemented on a given device.
282 * @async_write: Write operation which completes asynchronously, optional and
283 * must serialise with respect to non-async I/O.
258 * @read: Read operation. Data is returned in the buffer used to transmit 284 * @read: Read operation. Data is returned in the buffer used to transmit
259 * data. 285 * data.
286 * @async_alloc: Allocate a regmap_async() structure.
260 * @read_flag_mask: Mask to be set in the top byte of the register when doing 287 * @read_flag_mask: Mask to be set in the top byte of the register when doing
261 * a read. 288 * a read.
262 * @reg_format_endian_default: Default endianness for formatted register 289 * @reg_format_endian_default: Default endianness for formatted register
@@ -265,13 +292,16 @@ typedef void (*regmap_hw_free_context)(void *context);
265 * @val_format_endian_default: Default endianness for formatted register 292 * @val_format_endian_default: Default endianness for formatted register
266 * values. Used when the regmap_config specifies DEFAULT. If this is 293 * values. Used when the regmap_config specifies DEFAULT. If this is
267 * DEFAULT, BIG is assumed. 294 * DEFAULT, BIG is assumed.
295 * @async_size: Size of struct used for async work.
268 */ 296 */
269struct regmap_bus { 297struct regmap_bus {
270 bool fast_io; 298 bool fast_io;
271 regmap_hw_write write; 299 regmap_hw_write write;
272 regmap_hw_gather_write gather_write; 300 regmap_hw_gather_write gather_write;
301 regmap_hw_async_write async_write;
273 regmap_hw_read read; 302 regmap_hw_read read;
274 regmap_hw_free_context free_context; 303 regmap_hw_free_context free_context;
304 regmap_hw_async_alloc async_alloc;
275 u8 read_flag_mask; 305 u8 read_flag_mask;
276 enum regmap_endian reg_format_endian_default; 306 enum regmap_endian reg_format_endian_default;
277 enum regmap_endian val_format_endian_default; 307 enum regmap_endian val_format_endian_default;
@@ -285,9 +315,9 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
285 const struct regmap_config *config); 315 const struct regmap_config *config);
286struct regmap *regmap_init_spi(struct spi_device *dev, 316struct regmap *regmap_init_spi(struct spi_device *dev,
287 const struct regmap_config *config); 317 const struct regmap_config *config);
288struct regmap *regmap_init_mmio(struct device *dev, 318struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
289 void __iomem *regs, 319 void __iomem *regs,
290 const struct regmap_config *config); 320 const struct regmap_config *config);
291 321
292struct regmap *devm_regmap_init(struct device *dev, 322struct regmap *devm_regmap_init(struct device *dev,
293 const struct regmap_bus *bus, 323 const struct regmap_bus *bus,
@@ -297,9 +327,44 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
297 const struct regmap_config *config); 327 const struct regmap_config *config);
298struct regmap *devm_regmap_init_spi(struct spi_device *dev, 328struct regmap *devm_regmap_init_spi(struct spi_device *dev,
299 const struct regmap_config *config); 329 const struct regmap_config *config);
300struct regmap *devm_regmap_init_mmio(struct device *dev, 330struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
301 void __iomem *regs, 331 void __iomem *regs,
302 const struct regmap_config *config); 332 const struct regmap_config *config);
333
334/**
335 * regmap_init_mmio(): Initialise register map
336 *
337 * @dev: Device that will be interacted with
338 * @regs: Pointer to memory-mapped IO region
339 * @config: Configuration for register map
340 *
341 * The return value will be an ERR_PTR() on error or a valid pointer to
342 * a struct regmap.
343 */
344static inline struct regmap *regmap_init_mmio(struct device *dev,
345 void __iomem *regs,
346 const struct regmap_config *config)
347{
348 return regmap_init_mmio_clk(dev, NULL, regs, config);
349}
350
351/**
352 * devm_regmap_init_mmio(): Initialise managed register map
353 *
354 * @dev: Device that will be interacted with
355 * @regs: Pointer to memory-mapped IO region
356 * @config: Configuration for register map
357 *
358 * The return value will be an ERR_PTR() on error or a valid pointer
359 * to a struct regmap. The regmap will be automatically freed by the
360 * device management code.
361 */
362static inline struct regmap *devm_regmap_init_mmio(struct device *dev,
363 void __iomem *regs,
364 const struct regmap_config *config)
365{
366 return devm_regmap_init_mmio_clk(dev, NULL, regs, config);
367}
303 368
304void regmap_exit(struct regmap *map); 369void regmap_exit(struct regmap *map);
305int regmap_reinit_cache(struct regmap *map, 370int regmap_reinit_cache(struct regmap *map,
@@ -310,6 +375,8 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
310 const void *val, size_t val_len); 375 const void *val, size_t val_len);
311int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 376int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
312 size_t val_count); 377 size_t val_count);
378int regmap_raw_write_async(struct regmap *map, unsigned int reg,
379 const void *val, size_t val_len);
313int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 380int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
314int regmap_raw_read(struct regmap *map, unsigned int reg, 381int regmap_raw_read(struct regmap *map, unsigned int reg,
315 void *val, size_t val_len); 382 void *val, size_t val_len);
@@ -321,6 +388,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
321 unsigned int mask, unsigned int val, 388 unsigned int mask, unsigned int val,
322 bool *change); 389 bool *change);
323int regmap_get_val_bytes(struct regmap *map); 390int regmap_get_val_bytes(struct regmap *map);
391int regmap_async_complete(struct regmap *map);
324 392
325int regcache_sync(struct regmap *map); 393int regcache_sync(struct regmap *map);
326int regcache_sync_region(struct regmap *map, unsigned int min, 394int regcache_sync_region(struct regmap *map, unsigned int min,
@@ -381,6 +449,7 @@ struct regmap_irq_chip {
381 unsigned int wake_base; 449 unsigned int wake_base;
382 unsigned int irq_reg_stride; 450 unsigned int irq_reg_stride;
383 unsigned int mask_invert; 451 unsigned int mask_invert;
452 unsigned int wake_invert;
384 bool runtime_pm; 453 bool runtime_pm;
385 454
386 int num_regs; 455 int num_regs;
@@ -422,6 +491,13 @@ static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
422 return -EINVAL; 491 return -EINVAL;
423} 492}
424 493
494static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
495 const void *val, size_t val_len)
496{
497 WARN_ONCE(1, "regmap API is disabled");
498 return -EINVAL;
499}
500
425static inline int regmap_bulk_write(struct regmap *map, unsigned int reg, 501static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
426 const void *val, size_t val_count) 502 const void *val, size_t val_count)
427{ 503{
@@ -500,6 +576,11 @@ static inline void regcache_mark_dirty(struct regmap *map)
500 WARN_ONCE(1, "regmap API is disabled"); 576 WARN_ONCE(1, "regmap API is disabled");
501} 577}
502 578
579static inline void regmap_async_complete(struct regmap *map)
580{
581 WARN_ONCE(1, "regmap API is disabled");
582}
583
503static inline int regmap_register_patch(struct regmap *map, 584static inline int regmap_register_patch(struct regmap *map,
504 const struct reg_default *regs, 585 const struct reg_default *regs,
505 int num_regs) 586 int num_regs)
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d10bb0f39c5e..23070fd83872 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -193,6 +193,10 @@ enum regulator_type {
193 * 193 *
194 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_ 194 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
195 * @vsel_mask: Mask for register bitfield used for selector 195 * @vsel_mask: Mask for register bitfield used for selector
196 * @apply_reg: Register for initiate voltage change on the output when
197 * using regulator_set_voltage_sel_regmap
198 * @apply_bit: Register bitfield used for initiate voltage change on the
199 * output when using regulator_set_voltage_sel_regmap
196 * @enable_reg: Register for control when using regmap enable/disable ops 200 * @enable_reg: Register for control when using regmap enable/disable ops
197 * @enable_mask: Mask for control when using regmap enable/disable ops 201 * @enable_mask: Mask for control when using regmap enable/disable ops
198 * 202 *
@@ -218,6 +222,8 @@ struct regulator_desc {
218 222
219 unsigned int vsel_reg; 223 unsigned int vsel_reg;
220 unsigned int vsel_mask; 224 unsigned int vsel_mask;
225 unsigned int apply_reg;
226 unsigned int apply_bit;
221 unsigned int enable_reg; 227 unsigned int enable_reg;
222 unsigned int enable_mask; 228 unsigned int enable_mask;
223 unsigned int bypass_reg; 229 unsigned int bypass_reg;
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 519777e3fa01..1342e69542f3 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -167,6 +167,7 @@ unsigned 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); 169unsigned long ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu);
170unsigned long ring_buffer_read_events_cpu(struct ring_buffer *buffer, int cpu);
170 171
171u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 172u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
172void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 173void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index c20635c527a9..6dacb93a6d94 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -123,7 +123,7 @@ static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
123 down_write(&anon_vma->root->rwsem); 123 down_write(&anon_vma->root->rwsem);
124} 124}
125 125
126static inline void anon_vma_unlock(struct anon_vma *anon_vma) 126static inline void anon_vma_unlock_write(struct anon_vma *anon_vma)
127{ 127{
128 up_write(&anon_vma->root->rwsem); 128 up_write(&anon_vma->root->rwsem);
129} 129}
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 9531845c419f..580b24c8b8ca 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -138,6 +138,7 @@ extern void rtc_device_unregister(struct rtc_device *rtc);
138extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 138extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
139extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 139extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
140extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); 140extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
141extern int rtc_set_ntp_time(struct timespec now);
141int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm); 142int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
142extern int rtc_read_alarm(struct rtc_device *rtc, 143extern int rtc_read_alarm(struct rtc_device *rtc,
143 struct rtc_wkalrm *alrm); 144 struct rtc_wkalrm *alrm);
@@ -148,7 +149,7 @@ extern int rtc_initialize_alarm(struct rtc_device *rtc,
148extern void rtc_update_irq(struct rtc_device *rtc, 149extern void rtc_update_irq(struct rtc_device *rtc,
149 unsigned long num, unsigned long events); 150 unsigned long num, unsigned long events);
150 151
151extern struct rtc_device *rtc_class_open(char *name); 152extern struct rtc_device *rtc_class_open(const char *name);
152extern void rtc_class_close(struct rtc_device *rtc); 153extern void rtc_class_close(struct rtc_device *rtc);
153 154
154extern int rtc_irq_register(struct rtc_device *rtc, 155extern int rtc_irq_register(struct rtc_device *rtc,
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 54bd7cd7ecbd..8da67d625e13 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -125,8 +125,17 @@ extern void downgrade_write(struct rw_semaphore *sem);
125 */ 125 */
126extern void down_read_nested(struct rw_semaphore *sem, int subclass); 126extern void down_read_nested(struct rw_semaphore *sem, int subclass);
127extern void down_write_nested(struct rw_semaphore *sem, int subclass); 127extern void down_write_nested(struct rw_semaphore *sem, int subclass);
128extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock);
129
130# define down_write_nest_lock(sem, nest_lock) \
131do { \
132 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
133 _down_write_nest_lock(sem, &(nest_lock)->dep_map); \
134} while (0);
135
128#else 136#else
129# define down_read_nested(sem, subclass) down_read(sem) 137# define down_read_nested(sem, subclass) down_read(sem)
138# define down_write_nest_lock(sem, nest_lock) down_write(sem)
130# define down_write_nested(sem, subclass) down_write(sem) 139# define down_write_nested(sem, subclass) down_write(sem)
131#endif 140#endif
132 141
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 4bd6c06eb28e..2d8bdaef9611 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -231,6 +231,41 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
231 */ 231 */
232#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) 232#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
233 233
234/*
235 * sg page iterator
236 *
237 * Iterates over sg entries page-by-page. On each successful iteration,
238 * @piter->page points to the current page, @piter->sg to the sg holding this
239 * page and @piter->sg_pgoffset to the page's page offset within the sg. The
240 * iteration will stop either when a maximum number of sg entries was reached
241 * or a terminating sg (sg_last(sg) == true) was reached.
242 */
243struct sg_page_iter {
244 struct page *page; /* current page */
245 struct scatterlist *sg; /* sg holding the page */
246 unsigned int sg_pgoffset; /* page offset within the sg */
247
248 /* these are internal states, keep away */
249 unsigned int __nents; /* remaining sg entries */
250 int __pg_advance; /* nr pages to advance at the
251 * next step */
252};
253
254bool __sg_page_iter_next(struct sg_page_iter *piter);
255void __sg_page_iter_start(struct sg_page_iter *piter,
256 struct scatterlist *sglist, unsigned int nents,
257 unsigned long pgoffset);
258
259/**
260 * for_each_sg_page - iterate over the pages of the given sg list
261 * @sglist: sglist to iterate over
262 * @piter: page iterator to hold current page, sg, sg_pgoffset
263 * @nents: maximum number of sg entries to iterate over
264 * @pgoffset: starting page offset
265 */
266#define for_each_sg_page(sglist, piter, nents, pgoffset) \
267 for (__sg_page_iter_start((piter), (sglist), (nents), (pgoffset)); \
268 __sg_page_iter_next(piter);)
234 269
235/* 270/*
236 * Mapping sg iterator 271 * Mapping sg iterator
@@ -258,11 +293,11 @@ struct sg_mapping_iter {
258 void *addr; /* pointer to the mapped area */ 293 void *addr; /* pointer to the mapped area */
259 size_t length; /* length of the mapped area */ 294 size_t length; /* length of the mapped area */
260 size_t consumed; /* number of consumed bytes */ 295 size_t consumed; /* number of consumed bytes */
296 struct sg_page_iter piter; /* page iterator */
261 297
262 /* these are internal states, keep away */ 298 /* these are internal states, keep away */
263 struct scatterlist *__sg; /* current entry */ 299 unsigned int __offset; /* offset within page */
264 unsigned int __nents; /* nr of remaining entries */ 300 unsigned int __remaining; /* remaining bytes on page */
265 unsigned int __offset; /* offset within sg */
266 unsigned int __flags; 301 unsigned int __flags;
267}; 302};
268 303
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 206bb089c06b..d35d2b6ddbfb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -51,6 +51,7 @@ struct sched_param {
51#include <linux/cred.h> 51#include <linux/cred.h>
52#include <linux/llist.h> 52#include <linux/llist.h>
53#include <linux/uidgid.h> 53#include <linux/uidgid.h>
54#include <linux/gfp.h>
54 55
55#include <asm/processor.h> 56#include <asm/processor.h>
56 57
@@ -98,7 +99,6 @@ extern int nr_threads;
98DECLARE_PER_CPU(unsigned long, process_counts); 99DECLARE_PER_CPU(unsigned long, process_counts);
99extern int nr_processes(void); 100extern int nr_processes(void);
100extern unsigned long nr_running(void); 101extern unsigned long nr_running(void);
101extern unsigned long nr_uninterruptible(void);
102extern unsigned long nr_iowait(void); 102extern unsigned long nr_iowait(void);
103extern unsigned long nr_iowait_cpu(int cpu); 103extern unsigned long nr_iowait_cpu(int cpu);
104extern unsigned long this_cpu_load(void); 104extern unsigned long this_cpu_load(void);
@@ -304,19 +304,6 @@ static inline void lockup_detector_init(void)
304} 304}
305#endif 305#endif
306 306
307#ifdef CONFIG_DETECT_HUNG_TASK
308extern unsigned int sysctl_hung_task_panic;
309extern unsigned long sysctl_hung_task_check_count;
310extern unsigned long sysctl_hung_task_timeout_secs;
311extern unsigned long sysctl_hung_task_warnings;
312extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
313 void __user *buffer,
314 size_t *lenp, loff_t *ppos);
315#else
316/* Avoid need for ifdefs elsewhere in the code */
317enum { sysctl_hung_task_timeout_secs = 0 };
318#endif
319
320/* Attach to any functions which should be ignored in wchan output. */ 307/* Attach to any functions which should be ignored in wchan output. */
321#define __sched __attribute__((__section__(".sched.text"))) 308#define __sched __attribute__((__section__(".sched.text")))
322 309
@@ -338,23 +325,6 @@ extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
338struct nsproxy; 325struct nsproxy;
339struct user_namespace; 326struct user_namespace;
340 327
341/*
342 * Default maximum number of active map areas, this limits the number of vmas
343 * per mm struct. Users can overwrite this number by sysctl but there is a
344 * problem.
345 *
346 * When a program's coredump is generated as ELF format, a section is created
347 * per a vma. In ELF, the number of sections is represented in unsigned short.
348 * This means the number of sections should be smaller than 65535 at coredump.
349 * Because the kernel adds some informative sections to a image of program at
350 * generating coredump, we need some margin. The number of extra sections is
351 * 1-3 now and depends on arch. We use "5" as safe margin, here.
352 */
353#define MAPCOUNT_ELF_CORE_MARGIN (5)
354#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
355
356extern int sysctl_max_map_count;
357
358#include <linux/aio.h> 328#include <linux/aio.h>
359 329
360#ifdef CONFIG_MMU 330#ifdef CONFIG_MMU
@@ -376,11 +346,6 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
376extern void set_dumpable(struct mm_struct *mm, int value); 346extern void set_dumpable(struct mm_struct *mm, int value);
377extern int get_dumpable(struct mm_struct *mm); 347extern int get_dumpable(struct mm_struct *mm);
378 348
379/* get/set_dumpable() values */
380#define SUID_DUMPABLE_DISABLED 0
381#define SUID_DUMPABLE_ENABLED 1
382#define SUID_DUMPABLE_SAFE 2
383
384/* mm flags */ 349/* mm flags */
385/* dumpable bits */ 350/* dumpable bits */
386#define MMF_DUMPABLE 0 /* core dump is permitted */ 351#define MMF_DUMPABLE 0 /* core dump is permitted */
@@ -1194,6 +1159,7 @@ struct sched_entity {
1194 /* rq "owned" by this entity/group: */ 1159 /* rq "owned" by this entity/group: */
1195 struct cfs_rq *my_q; 1160 struct cfs_rq *my_q;
1196#endif 1161#endif
1162
1197/* 1163/*
1198 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be 1164 * Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
1199 * removed when useful for applications beyond shares distribution (e.g. 1165 * removed when useful for applications beyond shares distribution (e.g.
@@ -1208,6 +1174,7 @@ struct sched_entity {
1208struct sched_rt_entity { 1174struct sched_rt_entity {
1209 struct list_head run_list; 1175 struct list_head run_list;
1210 unsigned long timeout; 1176 unsigned long timeout;
1177 unsigned long watchdog_stamp;
1211 unsigned int time_slice; 1178 unsigned int time_slice;
1212 1179
1213 struct sched_rt_entity *back; 1180 struct sched_rt_entity *back;
@@ -1220,11 +1187,6 @@ struct sched_rt_entity {
1220#endif 1187#endif
1221}; 1188};
1222 1189
1223/*
1224 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
1225 * Timeslices get refilled after they expire.
1226 */
1227#define RR_TIMESLICE (100 * HZ / 1000)
1228 1190
1229struct rcu_node; 1191struct rcu_node;
1230 1192
@@ -1368,6 +1330,15 @@ struct task_struct {
1368#ifndef CONFIG_VIRT_CPU_ACCOUNTING 1330#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1369 struct cputime prev_cputime; 1331 struct cputime prev_cputime;
1370#endif 1332#endif
1333#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1334 seqlock_t vtime_seqlock;
1335 unsigned long long vtime_snap;
1336 enum {
1337 VTIME_SLEEPING = 0,
1338 VTIME_USER,
1339 VTIME_SYS,
1340 } vtime_snap_whence;
1341#endif
1371 unsigned long nvcsw, nivcsw; /* context switch counts */ 1342 unsigned long nvcsw, nivcsw; /* context switch counts */
1372 struct timespec start_time; /* monotonic time */ 1343 struct timespec start_time; /* monotonic time */
1373 struct timespec real_start_time; /* boot based time */ 1344 struct timespec real_start_time; /* boot based time */
@@ -1622,37 +1593,6 @@ static inline void set_numabalancing_state(bool enabled)
1622} 1593}
1623#endif 1594#endif
1624 1595
1625/*
1626 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1627 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
1628 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
1629 * values are inverted: lower p->prio value means higher priority.
1630 *
1631 * The MAX_USER_RT_PRIO value allows the actual maximum
1632 * RT priority to be separate from the value exported to
1633 * user-space. This allows kernel threads to set their
1634 * priority to a value higher than any user task. Note:
1635 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
1636 */
1637
1638#define MAX_USER_RT_PRIO 100
1639#define MAX_RT_PRIO MAX_USER_RT_PRIO
1640
1641#define MAX_PRIO (MAX_RT_PRIO + 40)
1642#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
1643
1644static inline int rt_prio(int prio)
1645{
1646 if (unlikely(prio < MAX_RT_PRIO))
1647 return 1;
1648 return 0;
1649}
1650
1651static inline int rt_task(struct task_struct *p)
1652{
1653 return rt_prio(p->prio);
1654}
1655
1656static inline struct pid *task_pid(struct task_struct *task) 1596static inline struct pid *task_pid(struct task_struct *task)
1657{ 1597{
1658 return task->pids[PIDTYPE_PID].pid; 1598 return task->pids[PIDTYPE_PID].pid;
@@ -1792,6 +1732,37 @@ static inline void put_task_struct(struct task_struct *t)
1792 __put_task_struct(t); 1732 __put_task_struct(t);
1793} 1733}
1794 1734
1735#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
1736extern void task_cputime(struct task_struct *t,
1737 cputime_t *utime, cputime_t *stime);
1738extern void task_cputime_scaled(struct task_struct *t,
1739 cputime_t *utimescaled, cputime_t *stimescaled);
1740extern cputime_t task_gtime(struct task_struct *t);
1741#else
1742static inline void task_cputime(struct task_struct *t,
1743 cputime_t *utime, cputime_t *stime)
1744{
1745 if (utime)
1746 *utime = t->utime;
1747 if (stime)
1748 *stime = t->stime;
1749}
1750
1751static inline void task_cputime_scaled(struct task_struct *t,
1752 cputime_t *utimescaled,
1753 cputime_t *stimescaled)
1754{
1755 if (utimescaled)
1756 *utimescaled = t->utimescaled;
1757 if (stimescaled)
1758 *stimescaled = t->stimescaled;
1759}
1760
1761static inline cputime_t task_gtime(struct task_struct *t)
1762{
1763 return t->gtime;
1764}
1765#endif
1795extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); 1766extern void task_cputime_adjusted(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); 1767extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);
1797 1768
@@ -1810,10 +1781,12 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1810#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1781#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1811#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ 1782#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1812#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1783#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1784#define PF_USED_ASYNC 0x00004000 /* used async_schedule*(), used by module init */
1813#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1785#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1814#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1786#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1815#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1787#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
1816#define PF_KSWAPD 0x00040000 /* I am kswapd */ 1788#define PF_KSWAPD 0x00040000 /* I am kswapd */
1789#define PF_MEMALLOC_NOIO 0x00080000 /* Allocating memory without IO involved */
1817#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */ 1790#define PF_LESS_THROTTLE 0x00100000 /* Throttle me less: I clean memory */
1818#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1791#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
1819#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ 1792#define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */
@@ -1851,6 +1824,26 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1851#define tsk_used_math(p) ((p)->flags & PF_USED_MATH) 1824#define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
1852#define used_math() tsk_used_math(current) 1825#define used_math() tsk_used_math(current)
1853 1826
1827/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags */
1828static inline gfp_t memalloc_noio_flags(gfp_t flags)
1829{
1830 if (unlikely(current->flags & PF_MEMALLOC_NOIO))
1831 flags &= ~__GFP_IO;
1832 return flags;
1833}
1834
1835static inline unsigned int memalloc_noio_save(void)
1836{
1837 unsigned int flags = current->flags & PF_MEMALLOC_NOIO;
1838 current->flags |= PF_MEMALLOC_NOIO;
1839 return flags;
1840}
1841
1842static inline void memalloc_noio_restore(unsigned int flags)
1843{
1844 current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
1845}
1846
1854/* 1847/*
1855 * task->jobctl flags 1848 * task->jobctl flags
1856 */ 1849 */
@@ -2032,58 +2025,7 @@ extern void wake_up_idle_cpu(int cpu);
2032static inline void wake_up_idle_cpu(int cpu) { } 2025static inline void wake_up_idle_cpu(int cpu) { }
2033#endif 2026#endif
2034 2027
2035extern unsigned int sysctl_sched_latency;
2036extern unsigned int sysctl_sched_min_granularity;
2037extern unsigned int sysctl_sched_wakeup_granularity;
2038extern unsigned int sysctl_sched_child_runs_first;
2039
2040enum sched_tunable_scaling {
2041 SCHED_TUNABLESCALING_NONE,
2042 SCHED_TUNABLESCALING_LOG,
2043 SCHED_TUNABLESCALING_LINEAR,
2044 SCHED_TUNABLESCALING_END,
2045};
2046extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
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
2055#ifdef CONFIG_SCHED_DEBUG
2056extern unsigned int sysctl_sched_migration_cost;
2057extern unsigned int sysctl_sched_nr_migrate;
2058extern unsigned int sysctl_sched_time_avg;
2059extern unsigned int sysctl_timer_migration;
2060extern unsigned int sysctl_sched_shares_window;
2061
2062int sched_proc_update_handler(struct ctl_table *table, int write,
2063 void __user *buffer, size_t *length,
2064 loff_t *ppos);
2065#endif
2066#ifdef CONFIG_SCHED_DEBUG
2067static inline unsigned int get_sysctl_timer_migration(void)
2068{
2069 return sysctl_timer_migration;
2070}
2071#else
2072static inline unsigned int get_sysctl_timer_migration(void)
2073{
2074 return 1;
2075}
2076#endif
2077extern unsigned int sysctl_sched_rt_period;
2078extern int sysctl_sched_rt_runtime;
2079
2080int sched_rt_handler(struct ctl_table *table, int write,
2081 void __user *buffer, size_t *lenp,
2082 loff_t *ppos);
2083
2084#ifdef CONFIG_SCHED_AUTOGROUP 2028#ifdef CONFIG_SCHED_AUTOGROUP
2085extern unsigned int sysctl_sched_autogroup_enabled;
2086
2087extern void sched_autogroup_create_attach(struct task_struct *p); 2029extern void sched_autogroup_create_attach(struct task_struct *p);
2088extern void sched_autogroup_detach(struct task_struct *p); 2030extern void sched_autogroup_detach(struct task_struct *p);
2089extern void sched_autogroup_fork(struct signal_struct *sig); 2031extern void sched_autogroup_fork(struct signal_struct *sig);
@@ -2099,30 +2041,6 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
2099static inline void sched_autogroup_exit(struct signal_struct *sig) { } 2041static inline void sched_autogroup_exit(struct signal_struct *sig) { }
2100#endif 2042#endif
2101 2043
2102#ifdef CONFIG_CFS_BANDWIDTH
2103extern unsigned int sysctl_sched_cfs_bandwidth_slice;
2104#endif
2105
2106#ifdef CONFIG_RT_MUTEXES
2107extern int rt_mutex_getprio(struct task_struct *p);
2108extern void rt_mutex_setprio(struct task_struct *p, int prio);
2109extern void rt_mutex_adjust_pi(struct task_struct *p);
2110static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2111{
2112 return tsk->pi_blocked_on != NULL;
2113}
2114#else
2115static inline int rt_mutex_getprio(struct task_struct *p)
2116{
2117 return p->normal_prio;
2118}
2119# define rt_mutex_adjust_pi(p) do { } while (0)
2120static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2121{
2122 return false;
2123}
2124#endif
2125
2126extern bool yield_to(struct task_struct *p, bool preempt); 2044extern bool yield_to(struct task_struct *p, bool preempt);
2127extern void set_user_nice(struct task_struct *p, long nice); 2045extern void set_user_nice(struct task_struct *p, long nice);
2128extern int task_prio(const struct task_struct *p); 2046extern int task_prio(const struct task_struct *p);
@@ -2258,7 +2176,6 @@ extern struct sigqueue *sigqueue_alloc(void);
2258extern void sigqueue_free(struct sigqueue *); 2176extern void sigqueue_free(struct sigqueue *);
2259extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 2177extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
2260extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); 2178extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *);
2261extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long);
2262 2179
2263static inline void restore_saved_sigmask(void) 2180static inline void restore_saved_sigmask(void)
2264{ 2181{
@@ -2304,6 +2221,17 @@ static inline int sas_ss_flags(unsigned long sp)
2304 : on_sig_stack(sp) ? SS_ONSTACK : 0); 2221 : on_sig_stack(sp) ? SS_ONSTACK : 0);
2305} 2222}
2306 2223
2224static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
2225{
2226 if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp))
2227#ifdef CONFIG_STACK_GROWSUP
2228 return current->sas_ss_sp;
2229#else
2230 return current->sas_ss_sp + current->sas_ss_size;
2231#endif
2232 return sp;
2233}
2234
2307/* 2235/*
2308 * Routines for handling mm_structs 2236 * Routines for handling mm_structs
2309 */ 2237 */
@@ -2713,7 +2641,16 @@ static inline void thread_group_cputime_init(struct signal_struct *sig)
2713extern void recalc_sigpending_and_wake(struct task_struct *t); 2641extern void recalc_sigpending_and_wake(struct task_struct *t);
2714extern void recalc_sigpending(void); 2642extern void recalc_sigpending(void);
2715 2643
2716extern void signal_wake_up(struct task_struct *t, int resume_stopped); 2644extern void signal_wake_up_state(struct task_struct *t, unsigned int state);
2645
2646static inline void signal_wake_up(struct task_struct *t, bool resume)
2647{
2648 signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0);
2649}
2650static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)
2651{
2652 signal_wake_up_state(t, resume ? __TASK_TRACED : 0);
2653}
2717 2654
2718/* 2655/*
2719 * Wrappers for p->thread_info->cpu access. No-op on UP. 2656 * Wrappers for p->thread_info->cpu access. No-op on UP.
@@ -2743,14 +2680,15 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2743extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); 2680extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
2744extern long sched_getaffinity(pid_t pid, struct cpumask *mask); 2681extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2745 2682
2746extern void normalize_rt_tasks(void);
2747
2748#ifdef CONFIG_CGROUP_SCHED 2683#ifdef CONFIG_CGROUP_SCHED
2749 2684
2750extern struct task_group root_task_group; 2685extern struct task_group root_task_group;
2751 2686
2752extern struct task_group *sched_create_group(struct task_group *parent); 2687extern struct task_group *sched_create_group(struct task_group *parent);
2688extern void sched_online_group(struct task_group *tg,
2689 struct task_group *parent);
2753extern void sched_destroy_group(struct task_group *tg); 2690extern void sched_destroy_group(struct task_group *tg);
2691extern void sched_offline_group(struct task_group *tg);
2754extern void sched_move_task(struct task_struct *tsk); 2692extern void sched_move_task(struct task_struct *tsk);
2755#ifdef CONFIG_FAIR_GROUP_SCHED 2693#ifdef CONFIG_FAIR_GROUP_SCHED
2756extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); 2694extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
new file mode 100644
index 000000000000..440434df3627
--- /dev/null
+++ b/include/linux/sched/rt.h
@@ -0,0 +1,64 @@
1#ifndef _SCHED_RT_H
2#define _SCHED_RT_H
3
4/*
5 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
6 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
7 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
8 * values are inverted: lower p->prio value means higher priority.
9 *
10 * The MAX_USER_RT_PRIO value allows the actual maximum
11 * RT priority to be separate from the value exported to
12 * user-space. This allows kernel threads to set their
13 * priority to a value higher than any user task. Note:
14 * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
15 */
16
17#define MAX_USER_RT_PRIO 100
18#define MAX_RT_PRIO MAX_USER_RT_PRIO
19
20#define MAX_PRIO (MAX_RT_PRIO + 40)
21#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
22
23static inline int rt_prio(int prio)
24{
25 if (unlikely(prio < MAX_RT_PRIO))
26 return 1;
27 return 0;
28}
29
30static inline int rt_task(struct task_struct *p)
31{
32 return rt_prio(p->prio);
33}
34
35#ifdef CONFIG_RT_MUTEXES
36extern int rt_mutex_getprio(struct task_struct *p);
37extern void rt_mutex_setprio(struct task_struct *p, int prio);
38extern void rt_mutex_adjust_pi(struct task_struct *p);
39static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
40{
41 return tsk->pi_blocked_on != NULL;
42}
43#else
44static inline int rt_mutex_getprio(struct task_struct *p)
45{
46 return p->normal_prio;
47}
48# define rt_mutex_adjust_pi(p) do { } while (0)
49static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
50{
51 return false;
52}
53#endif
54
55extern void normalize_rt_tasks(void);
56
57
58/*
59 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
60 * Timeslices get refilled after they expire.
61 */
62#define RR_TIMESLICE (100 * HZ / 1000)
63
64#endif /* _SCHED_RT_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
new file mode 100644
index 000000000000..bf8086b2506e
--- /dev/null
+++ b/include/linux/sched/sysctl.h
@@ -0,0 +1,104 @@
1#ifndef _SCHED_SYSCTL_H
2#define _SCHED_SYSCTL_H
3
4#ifdef CONFIG_DETECT_HUNG_TASK
5extern unsigned int sysctl_hung_task_panic;
6extern unsigned long sysctl_hung_task_check_count;
7extern unsigned long sysctl_hung_task_timeout_secs;
8extern unsigned long sysctl_hung_task_warnings;
9extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
10 void __user *buffer,
11 size_t *lenp, loff_t *ppos);
12#else
13/* Avoid need for ifdefs elsewhere in the code */
14enum { sysctl_hung_task_timeout_secs = 0 };
15#endif
16
17/*
18 * Default maximum number of active map areas, this limits the number of vmas
19 * per mm struct. Users can overwrite this number by sysctl but there is a
20 * problem.
21 *
22 * When a program's coredump is generated as ELF format, a section is created
23 * per a vma. In ELF, the number of sections is represented in unsigned short.
24 * This means the number of sections should be smaller than 65535 at coredump.
25 * Because the kernel adds some informative sections to a image of program at
26 * generating coredump, we need some margin. The number of extra sections is
27 * 1-3 now and depends on arch. We use "5" as safe margin, here.
28 */
29#define MAPCOUNT_ELF_CORE_MARGIN (5)
30#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
31
32extern int sysctl_max_map_count;
33
34extern unsigned int sysctl_sched_latency;
35extern unsigned int sysctl_sched_min_granularity;
36extern unsigned int sysctl_sched_wakeup_granularity;
37extern unsigned int sysctl_sched_child_runs_first;
38
39enum sched_tunable_scaling {
40 SCHED_TUNABLESCALING_NONE,
41 SCHED_TUNABLESCALING_LOG,
42 SCHED_TUNABLESCALING_LINEAR,
43 SCHED_TUNABLESCALING_END,
44};
45extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
46
47extern unsigned int sysctl_numa_balancing_scan_delay;
48extern unsigned int sysctl_numa_balancing_scan_period_min;
49extern unsigned int sysctl_numa_balancing_scan_period_max;
50extern unsigned int sysctl_numa_balancing_scan_period_reset;
51extern unsigned int sysctl_numa_balancing_scan_size;
52extern unsigned int sysctl_numa_balancing_settle_count;
53
54#ifdef CONFIG_SCHED_DEBUG
55extern unsigned int sysctl_sched_migration_cost;
56extern unsigned int sysctl_sched_nr_migrate;
57extern unsigned int sysctl_sched_time_avg;
58extern unsigned int sysctl_timer_migration;
59extern unsigned int sysctl_sched_shares_window;
60
61int sched_proc_update_handler(struct ctl_table *table, int write,
62 void __user *buffer, size_t *length,
63 loff_t *ppos);
64#endif
65#ifdef CONFIG_SCHED_DEBUG
66static inline unsigned int get_sysctl_timer_migration(void)
67{
68 return sysctl_timer_migration;
69}
70#else
71static inline unsigned int get_sysctl_timer_migration(void)
72{
73 return 1;
74}
75#endif
76
77/*
78 * control realtime throttling:
79 *
80 * /proc/sys/kernel/sched_rt_period_us
81 * /proc/sys/kernel/sched_rt_runtime_us
82 */
83extern unsigned int sysctl_sched_rt_period;
84extern int sysctl_sched_rt_runtime;
85
86#ifdef CONFIG_CFS_BANDWIDTH
87extern unsigned int sysctl_sched_cfs_bandwidth_slice;
88#endif
89
90#ifdef CONFIG_SCHED_AUTOGROUP
91extern unsigned int sysctl_sched_autogroup_enabled;
92#endif
93
94extern int sched_rr_timeslice;
95
96extern int sched_rr_handler(struct ctl_table *table, int write,
97 void __user *buffer, size_t *lenp,
98 loff_t *ppos);
99
100extern int sched_rt_handler(struct ctl_table *table, int write,
101 void __user *buffer, size_t *lenp,
102 loff_t *ppos);
103
104#endif /* _SCHED_SYSCTL_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 0f6afc657f77..eee7478cda70 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -989,17 +989,29 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
989 * tells the LSM to decrement the number of secmark labeling rules loaded 989 * tells the LSM to decrement the number of secmark labeling rules loaded
990 * @req_classify_flow: 990 * @req_classify_flow:
991 * Sets the flow's sid to the openreq sid. 991 * Sets the flow's sid to the openreq sid.
992 * @tun_dev_alloc_security:
993 * This hook allows a module to allocate a security structure for a TUN
994 * device.
995 * @security pointer to a security structure pointer.
996 * Returns a zero on success, negative values on failure.
997 * @tun_dev_free_security:
998 * This hook allows a module to free the security structure for a TUN
999 * device.
1000 * @security pointer to the TUN device's security structure
992 * @tun_dev_create: 1001 * @tun_dev_create:
993 * Check permissions prior to creating a new TUN device. 1002 * Check permissions prior to creating a new TUN device.
994 * @tun_dev_post_create: 1003 * @tun_dev_attach_queue:
995 * This hook allows a module to update or allocate a per-socket security 1004 * Check permissions prior to attaching to a TUN device queue.
996 * structure. 1005 * @security pointer to the TUN device's security structure.
997 * @sk contains the newly created sock structure.
998 * @tun_dev_attach: 1006 * @tun_dev_attach:
999 * Check permissions prior to attaching to a persistent TUN device. This 1007 * This hook can be used by the module to update any security state
1000 * hook can also be used by the module to update any security state
1001 * associated with the TUN device's sock structure. 1008 * associated with the TUN device's sock structure.
1002 * @sk contains the existing sock structure. 1009 * @sk contains the existing sock structure.
1010 * @security pointer to the TUN device's security structure.
1011 * @tun_dev_open:
1012 * This hook can be used by the module to update any security state
1013 * associated with the TUN device's security structure.
1014 * @security pointer to the TUN devices's security structure.
1003 * 1015 *
1004 * Security hooks for XFRM operations. 1016 * Security hooks for XFRM operations.
1005 * 1017 *
@@ -1620,9 +1632,12 @@ struct security_operations {
1620 void (*secmark_refcount_inc) (void); 1632 void (*secmark_refcount_inc) (void);
1621 void (*secmark_refcount_dec) (void); 1633 void (*secmark_refcount_dec) (void);
1622 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1634 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1623 int (*tun_dev_create)(void); 1635 int (*tun_dev_alloc_security) (void **security);
1624 void (*tun_dev_post_create)(struct sock *sk); 1636 void (*tun_dev_free_security) (void *security);
1625 int (*tun_dev_attach)(struct sock *sk); 1637 int (*tun_dev_create) (void);
1638 int (*tun_dev_attach_queue) (void *security);
1639 int (*tun_dev_attach) (struct sock *sk, void *security);
1640 int (*tun_dev_open) (void *security);
1626#endif /* CONFIG_SECURITY_NETWORK */ 1641#endif /* CONFIG_SECURITY_NETWORK */
1627 1642
1628#ifdef CONFIG_SECURITY_NETWORK_XFRM 1643#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2566,9 +2581,12 @@ void security_inet_conn_established(struct sock *sk,
2566int security_secmark_relabel_packet(u32 secid); 2581int security_secmark_relabel_packet(u32 secid);
2567void security_secmark_refcount_inc(void); 2582void security_secmark_refcount_inc(void);
2568void security_secmark_refcount_dec(void); 2583void security_secmark_refcount_dec(void);
2584int security_tun_dev_alloc_security(void **security);
2585void security_tun_dev_free_security(void *security);
2569int security_tun_dev_create(void); 2586int security_tun_dev_create(void);
2570void security_tun_dev_post_create(struct sock *sk); 2587int security_tun_dev_attach_queue(void *security);
2571int security_tun_dev_attach(struct sock *sk); 2588int security_tun_dev_attach(struct sock *sk, void *security);
2589int security_tun_dev_open(void *security);
2572 2590
2573#else /* CONFIG_SECURITY_NETWORK */ 2591#else /* CONFIG_SECURITY_NETWORK */
2574static inline int security_unix_stream_connect(struct sock *sock, 2592static inline int security_unix_stream_connect(struct sock *sock,
@@ -2733,16 +2751,31 @@ static inline void security_secmark_refcount_dec(void)
2733{ 2751{
2734} 2752}
2735 2753
2754static inline int security_tun_dev_alloc_security(void **security)
2755{
2756 return 0;
2757}
2758
2759static inline void security_tun_dev_free_security(void *security)
2760{
2761}
2762
2736static inline int security_tun_dev_create(void) 2763static inline int security_tun_dev_create(void)
2737{ 2764{
2738 return 0; 2765 return 0;
2739} 2766}
2740 2767
2741static inline void security_tun_dev_post_create(struct sock *sk) 2768static inline int security_tun_dev_attach_queue(void *security)
2769{
2770 return 0;
2771}
2772
2773static inline int security_tun_dev_attach(struct sock *sk, void *security)
2742{ 2774{
2775 return 0;
2743} 2776}
2744 2777
2745static inline int security_tun_dev_attach(struct sock *sk) 2778static inline int security_tun_dev_open(void *security)
2746{ 2779{
2747 return 0; 2780 return 0;
2748} 2781}
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 600060e25ec6..18299057402f 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -30,92 +30,12 @@
30#include <linux/preempt.h> 30#include <linux/preempt.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32 32
33typedef struct {
34 unsigned sequence;
35 spinlock_t lock;
36} seqlock_t;
37
38/*
39 * These macros triggered gcc-3.x compile-time problems. We think these are
40 * OK now. Be cautious.
41 */
42#define __SEQLOCK_UNLOCKED(lockname) \
43 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
44
45#define seqlock_init(x) \
46 do { \
47 (x)->sequence = 0; \
48 spin_lock_init(&(x)->lock); \
49 } while (0)
50
51#define DEFINE_SEQLOCK(x) \
52 seqlock_t x = __SEQLOCK_UNLOCKED(x)
53
54/* Lock out other writers and update the count.
55 * Acts like a normal spin_lock/unlock.
56 * Don't need preempt_disable() because that is in the spin_lock already.
57 */
58static inline void write_seqlock(seqlock_t *sl)
59{
60 spin_lock(&sl->lock);
61 ++sl->sequence;
62 smp_wmb();
63}
64
65static inline void write_sequnlock(seqlock_t *sl)
66{
67 smp_wmb();
68 sl->sequence++;
69 spin_unlock(&sl->lock);
70}
71
72static inline int write_tryseqlock(seqlock_t *sl)
73{
74 int ret = spin_trylock(&sl->lock);
75
76 if (ret) {
77 ++sl->sequence;
78 smp_wmb();
79 }
80 return ret;
81}
82
83/* Start of read calculation -- fetch last complete writer token */
84static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
85{
86 unsigned ret;
87
88repeat:
89 ret = ACCESS_ONCE(sl->sequence);
90 if (unlikely(ret & 1)) {
91 cpu_relax();
92 goto repeat;
93 }
94 smp_rmb();
95
96 return ret;
97}
98
99/*
100 * Test if reader processed invalid data.
101 *
102 * If sequence value changed then writer changed data while in section.
103 */
104static __always_inline int read_seqretry(const seqlock_t *sl, unsigned start)
105{
106 smp_rmb();
107
108 return unlikely(sl->sequence != start);
109}
110
111
112/* 33/*
113 * Version using sequence counter only. 34 * Version using sequence counter only.
114 * This can be used when code has its own mutex protecting the 35 * This can be used when code has its own mutex protecting the
115 * updating starting before the write_seqcountbeqin() and ending 36 * updating starting before the write_seqcountbeqin() and ending
116 * after the write_seqcount_end(). 37 * after the write_seqcount_end().
117 */ 38 */
118
119typedef struct seqcount { 39typedef struct seqcount {
120 unsigned sequence; 40 unsigned sequence;
121} seqcount_t; 41} seqcount_t;
@@ -218,7 +138,6 @@ static inline int __read_seqcount_retry(const seqcount_t *s, unsigned start)
218static inline int read_seqcount_retry(const seqcount_t *s, unsigned start) 138static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
219{ 139{
220 smp_rmb(); 140 smp_rmb();
221
222 return __read_seqcount_retry(s, start); 141 return __read_seqcount_retry(s, start);
223} 142}
224 143
@@ -252,31 +171,101 @@ static inline void write_seqcount_barrier(seqcount_t *s)
252 s->sequence+=2; 171 s->sequence+=2;
253} 172}
254 173
174typedef struct {
175 struct seqcount seqcount;
176 spinlock_t lock;
177} seqlock_t;
178
255/* 179/*
256 * Possible sw/hw IRQ protected versions of the interfaces. 180 * These macros triggered gcc-3.x compile-time problems. We think these are
181 * OK now. Be cautious.
257 */ 182 */
258#define write_seqlock_irqsave(lock, flags) \ 183#define __SEQLOCK_UNLOCKED(lockname) \
259 do { local_irq_save(flags); write_seqlock(lock); } while (0) 184 { \
260#define write_seqlock_irq(lock) \ 185 .seqcount = SEQCNT_ZERO, \
261 do { local_irq_disable(); write_seqlock(lock); } while (0) 186 .lock = __SPIN_LOCK_UNLOCKED(lockname) \
262#define write_seqlock_bh(lock) \ 187 }
263 do { local_bh_disable(); write_seqlock(lock); } while (0) 188
189#define seqlock_init(x) \
190 do { \
191 seqcount_init(&(x)->seqcount); \
192 spin_lock_init(&(x)->lock); \
193 } while (0)
264 194
265#define write_sequnlock_irqrestore(lock, flags) \ 195#define DEFINE_SEQLOCK(x) \
266 do { write_sequnlock(lock); local_irq_restore(flags); } while(0) 196 seqlock_t x = __SEQLOCK_UNLOCKED(x)
267#define write_sequnlock_irq(lock) \
268 do { write_sequnlock(lock); local_irq_enable(); } while(0)
269#define write_sequnlock_bh(lock) \
270 do { write_sequnlock(lock); local_bh_enable(); } while(0)
271 197
272#define read_seqbegin_irqsave(lock, flags) \ 198/*
273 ({ local_irq_save(flags); read_seqbegin(lock); }) 199 * Read side functions for starting and finalizing a read side section.
200 */
201static inline unsigned read_seqbegin(const seqlock_t *sl)
202{
203 return read_seqcount_begin(&sl->seqcount);
204}
274 205
275#define read_seqretry_irqrestore(lock, iv, flags) \ 206static inline unsigned read_seqretry(const seqlock_t *sl, unsigned start)
276 ({ \ 207{
277 int ret = read_seqretry(lock, iv); \ 208 return read_seqcount_retry(&sl->seqcount, start);
278 local_irq_restore(flags); \ 209}
279 ret; \ 210
280 }) 211/*
212 * Lock out other writers and update the count.
213 * Acts like a normal spin_lock/unlock.
214 * Don't need preempt_disable() because that is in the spin_lock already.
215 */
216static inline void write_seqlock(seqlock_t *sl)
217{
218 spin_lock(&sl->lock);
219 write_seqcount_begin(&sl->seqcount);
220}
221
222static inline void write_sequnlock(seqlock_t *sl)
223{
224 write_seqcount_end(&sl->seqcount);
225 spin_unlock(&sl->lock);
226}
227
228static inline void write_seqlock_bh(seqlock_t *sl)
229{
230 spin_lock_bh(&sl->lock);
231 write_seqcount_begin(&sl->seqcount);
232}
233
234static inline void write_sequnlock_bh(seqlock_t *sl)
235{
236 write_seqcount_end(&sl->seqcount);
237 spin_unlock_bh(&sl->lock);
238}
239
240static inline void write_seqlock_irq(seqlock_t *sl)
241{
242 spin_lock_irq(&sl->lock);
243 write_seqcount_begin(&sl->seqcount);
244}
245
246static inline void write_sequnlock_irq(seqlock_t *sl)
247{
248 write_seqcount_end(&sl->seqcount);
249 spin_unlock_irq(&sl->lock);
250}
251
252static inline unsigned long __write_seqlock_irqsave(seqlock_t *sl)
253{
254 unsigned long flags;
255
256 spin_lock_irqsave(&sl->lock, flags);
257 write_seqcount_begin(&sl->seqcount);
258 return flags;
259}
260
261#define write_seqlock_irqsave(lock, flags) \
262 do { flags = __write_seqlock_irqsave(lock); } while (0)
263
264static inline void
265write_sequnlock_irqrestore(seqlock_t *sl, unsigned long flags)
266{
267 write_seqcount_end(&sl->seqcount);
268 spin_unlock_irqrestore(&sl->lock, flags);
269}
281 270
282#endif /* __LINUX_SEQLOCK_H */ 271#endif /* __LINUX_SEQLOCK_H */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index c490d20b3fb8..af47a8af6024 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -59,6 +59,8 @@ enum {
59 PLAT8250_DEV_SM501, 59 PLAT8250_DEV_SM501,
60}; 60};
61 61
62struct uart_8250_dma;
63
62/* 64/*
63 * This should be used by drivers which want to register 65 * This should be used by drivers which want to register
64 * their own 8250 ports without registering their own 66 * their own 8250 ports without registering their own
@@ -91,6 +93,8 @@ struct uart_8250_port {
91#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA 93#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
92 unsigned char msr_saved_flags; 94 unsigned char msr_saved_flags;
93 95
96 struct uart_8250_dma *dma;
97
94 /* 8250 specific callbacks */ 98 /* 8250 specific callbacks */
95 int (*dl_read)(struct uart_8250_port *); 99 int (*dl_read)(struct uart_8250_port *);
96 void (*dl_write)(struct uart_8250_port *, int); 100 void (*dl_write)(struct uart_8250_port *, int);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c6690a2a27fb..87d4bbc773fc 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -29,7 +29,6 @@
29#include <linux/tty.h> 29#include <linux/tty.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/sysrq.h> 31#include <linux/sysrq.h>
32#include <linux/pps_kernel.h>
33#include <uapi/linux/serial_core.h> 32#include <uapi/linux/serial_core.h>
34 33
35struct uart_port; 34struct uart_port;
@@ -37,8 +36,8 @@ struct serial_struct;
37struct device; 36struct device;
38 37
39/* 38/*
40 * This structure describes all the operations that can be 39 * This structure describes all the operations that can be done on the
41 * done on the physical hardware. 40 * physical hardware. See Documentation/serial/driver for details.
42 */ 41 */
43struct uart_ops { 42struct uart_ops {
44 unsigned int (*tx_empty)(struct uart_port *); 43 unsigned int (*tx_empty)(struct uart_port *);
@@ -65,7 +64,7 @@ struct uart_ops {
65 /* 64 /*
66 * Return a string describing the type of the port 65 * Return a string describing the type of the port
67 */ 66 */
68 const char *(*type)(struct uart_port *); 67 const char *(*type)(struct uart_port *);
69 68
70 /* 69 /*
71 * Release IO and memory resources used by the port. 70 * Release IO and memory resources used by the port.
@@ -83,7 +82,7 @@ struct uart_ops {
83 int (*ioctl)(struct uart_port *, unsigned int, unsigned long); 82 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
84#ifdef CONFIG_CONSOLE_POLL 83#ifdef CONFIG_CONSOLE_POLL
85 int (*poll_init)(struct uart_port *); 84 int (*poll_init)(struct uart_port *);
86 void (*poll_put_char)(struct uart_port *, unsigned char); 85 void (*poll_put_char)(struct uart_port *, unsigned char);
87 int (*poll_get_char)(struct uart_port *); 86 int (*poll_get_char)(struct uart_port *);
88#endif 87#endif
89}; 88};
@@ -134,9 +133,8 @@ struct uart_port {
134#define UPIO_HUB6 (1) 133#define UPIO_HUB6 (1)
135#define UPIO_MEM (2) 134#define UPIO_MEM (2)
136#define UPIO_MEM32 (3) 135#define UPIO_MEM32 (3)
137#define UPIO_AU (4) /* Au1x00 type IO */ 136#define UPIO_AU (4) /* Au1x00 and RT288x type IO */
138#define UPIO_TSI (5) /* Tsi108/109 type IO */ 137#define UPIO_TSI (5) /* Tsi108/109 type IO */
139#define UPIO_RM9000 (6) /* RM9000 type IO */
140 138
141 unsigned int read_status_mask; /* driver specific */ 139 unsigned int read_status_mask; /* driver specific */
142 unsigned int ignore_status_mask; /* driver specific */ 140 unsigned int ignore_status_mask; /* driver specific */
@@ -208,13 +206,25 @@ static inline void serial_port_out(struct uart_port *up, int offset, int value)
208 up->serial_out(up, offset, value); 206 up->serial_out(up, offset, value);
209} 207}
210 208
209/**
210 * enum uart_pm_state - power states for UARTs
211 * @UART_PM_STATE_ON: UART is powered, up and operational
212 * @UART_PM_STATE_OFF: UART is powered off
213 * @UART_PM_STATE_UNDEFINED: sentinel
214 */
215enum uart_pm_state {
216 UART_PM_STATE_ON = 0,
217 UART_PM_STATE_OFF = 3, /* number taken from ACPI */
218 UART_PM_STATE_UNDEFINED,
219};
220
211/* 221/*
212 * This is the state information which is persistent across opens. 222 * This is the state information which is persistent across opens.
213 */ 223 */
214struct uart_state { 224struct uart_state {
215 struct tty_port port; 225 struct tty_port port;
216 226
217 int pm_state; 227 enum uart_pm_state pm_state;
218 struct circ_buf xmit; 228 struct circ_buf xmit;
219 229
220 struct uart_port *uart_port; 230 struct uart_port *uart_port;
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
deleted file mode 100644
index c19a0925829a..000000000000
--- a/include/linux/sh_pfc.h
+++ /dev/null
@@ -1,236 +0,0 @@
1/*
2 * SuperH Pin Function Controller Support
3 *
4 * Copyright (c) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __SH_PFC_H
12#define __SH_PFC_H
13
14#include <linux/stringify.h>
15#include <asm-generic/gpio.h>
16
17typedef unsigned short pinmux_enum_t;
18typedef unsigned short pinmux_flag_t;
19
20enum {
21 PINMUX_TYPE_NONE,
22
23 PINMUX_TYPE_FUNCTION,
24 PINMUX_TYPE_GPIO,
25 PINMUX_TYPE_OUTPUT,
26 PINMUX_TYPE_INPUT,
27 PINMUX_TYPE_INPUT_PULLUP,
28 PINMUX_TYPE_INPUT_PULLDOWN,
29
30 PINMUX_FLAG_TYPE, /* must be last */
31};
32
33#define PINMUX_FLAG_DBIT_SHIFT 5
34#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT)
35#define PINMUX_FLAG_DREG_SHIFT 10
36#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT)
37
38struct pinmux_gpio {
39 pinmux_enum_t enum_id;
40 pinmux_flag_t flags;
41 const char *name;
42};
43
44#define PINMUX_GPIO(gpio, data_or_mark) \
45 [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE }
46
47#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
48
49struct pinmux_cfg_reg {
50 unsigned long reg, reg_width, field_width;
51 unsigned long *cnt;
52 pinmux_enum_t *enum_ids;
53 unsigned long *var_field_width;
54};
55
56#define PINMUX_CFG_REG(name, r, r_width, f_width) \
57 .reg = r, .reg_width = r_width, .field_width = f_width, \
58 .cnt = (unsigned long [r_width / f_width]) {}, \
59 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
60
61#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
62 .reg = r, .reg_width = r_width, \
63 .cnt = (unsigned long [r_width]) {}, \
64 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
65 .enum_ids = (pinmux_enum_t [])
66
67struct pinmux_data_reg {
68 unsigned long reg, reg_width, reg_shadow;
69 pinmux_enum_t *enum_ids;
70 void __iomem *mapped_reg;
71};
72
73#define PINMUX_DATA_REG(name, r, r_width) \
74 .reg = r, .reg_width = r_width, \
75 .enum_ids = (pinmux_enum_t [r_width]) \
76
77struct pinmux_irq {
78 int irq;
79 pinmux_enum_t *enum_ids;
80};
81
82#define PINMUX_IRQ(irq_nr, ids...) \
83 { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \
84
85struct pinmux_range {
86 pinmux_enum_t begin;
87 pinmux_enum_t end;
88 pinmux_enum_t force;
89};
90
91struct pfc_window {
92 phys_addr_t phys;
93 void __iomem *virt;
94 unsigned long size;
95};
96
97struct sh_pfc {
98 char *name;
99 pinmux_enum_t reserved_id;
100 struct pinmux_range data;
101 struct pinmux_range input;
102 struct pinmux_range input_pd;
103 struct pinmux_range input_pu;
104 struct pinmux_range output;
105 struct pinmux_range mark;
106 struct pinmux_range function;
107
108 unsigned first_gpio, last_gpio;
109
110 struct pinmux_gpio *gpios;
111 struct pinmux_cfg_reg *cfg_regs;
112 struct pinmux_data_reg *data_regs;
113
114 pinmux_enum_t *gpio_data;
115 unsigned int gpio_data_size;
116
117 struct pinmux_irq *gpio_irq;
118 unsigned int gpio_irq_size;
119
120 spinlock_t lock;
121
122 struct resource *resource;
123 unsigned int num_resources;
124 struct pfc_window *window;
125
126 unsigned long unlock_reg;
127};
128
129/* XXX compat for now */
130#define pinmux_info sh_pfc
131
132/* drivers/sh/pfc/gpio.c */
133int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
134
135/* drivers/sh/pfc/pinctrl.c */
136int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
137
138/* drivers/sh/pfc/core.c */
139int register_sh_pfc(struct sh_pfc *pfc);
140
141int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
142void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
143 unsigned long value);
144int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
145 struct pinmux_data_reg **drp, int *bitp);
146int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
147 pinmux_enum_t *enum_idp);
148int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
149 int cfg_mode);
150
151/* xxx */
152static inline int register_pinmux(struct pinmux_info *pip)
153{
154 struct sh_pfc *pfc = pip;
155 return register_sh_pfc(pfc);
156}
157
158enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
159
160/* helper macro for port */
161#define PORT_1(fn, pfx, sfx) fn(pfx, sfx)
162
163#define PORT_10(fn, pfx, sfx) \
164 PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
165 PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
166 PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
167 PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
168 PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)
169
170#define PORT_90(fn, pfx, sfx) \
171 PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
172 PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
173 PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \
174 PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \
175 PORT_10(fn, pfx##9, sfx)
176
177#define _PORT_ALL(pfx, sfx) pfx##_##sfx
178#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
179#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
180#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
181#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
182
183/* helper macro for pinmux_enum_t */
184#define PORT_DATA_I(nr) \
185 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
186
187#define PORT_DATA_I_PD(nr) \
188 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
189 PORT##nr##_IN, PORT##nr##_IN_PD)
190
191#define PORT_DATA_I_PU(nr) \
192 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
193 PORT##nr##_IN, PORT##nr##_IN_PU)
194
195#define PORT_DATA_I_PU_PD(nr) \
196 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
197 PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
198
199#define PORT_DATA_O(nr) \
200 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
201
202#define PORT_DATA_IO(nr) \
203 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
204 PORT##nr##_IN)
205
206#define PORT_DATA_IO_PD(nr) \
207 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
208 PORT##nr##_IN, PORT##nr##_IN_PD)
209
210#define PORT_DATA_IO_PU(nr) \
211 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
212 PORT##nr##_IN, PORT##nr##_IN_PU)
213
214#define PORT_DATA_IO_PU_PD(nr) \
215 PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
216 PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
217
218/* helper macro for top 4 bits in PORTnCR */
219#define _PCRH(in, in_pd, in_pu, out) \
220 0, (out), (in), 0, \
221 0, 0, 0, 0, \
222 0, 0, (in_pd), 0, \
223 0, 0, (in_pu), 0
224
225#define PORTCR(nr, reg) \
226 { \
227 PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
228 _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
229 PORT##nr##_IN_PU, PORT##nr##_OUT), \
230 PORT##nr##_FN0, PORT##nr##_FN1, \
231 PORT##nr##_FN2, PORT##nr##_FN3, \
232 PORT##nr##_FN4, PORT##nr##_FN5, \
233 PORT##nr##_FN6, PORT##nr##_FN7 } \
234 }
235
236#endif /* __SH_PFC_H */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 0a89ffc48466..a2dcb94ea49d 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -241,9 +241,6 @@ extern int do_send_sig_info(int sig, struct siginfo *info,
241 struct task_struct *p, bool group); 241 struct task_struct *p, bool group);
242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 242extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 243extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
244extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
245 siginfo_t *info);
246extern long do_sigpending(void __user *, unsigned long);
247extern int do_sigtimedwait(const sigset_t *, siginfo_t *, 244extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
248 const struct timespec *); 245 const struct timespec *);
249extern int sigprocmask(int, sigset_t *, sigset_t *); 246extern int sigprocmask(int, sigset_t *, sigset_t *);
@@ -252,10 +249,59 @@ extern void __set_current_blocked(const sigset_t *);
252extern int show_unhandled_signals; 249extern int show_unhandled_signals;
253extern int sigsuspend(sigset_t *); 250extern int sigsuspend(sigset_t *);
254 251
252struct sigaction {
253#ifndef __ARCH_HAS_ODD_SIGACTION
254 __sighandler_t sa_handler;
255 unsigned long sa_flags;
256#else
257 unsigned long sa_flags;
258 __sighandler_t sa_handler;
259#endif
260#ifdef __ARCH_HAS_SA_RESTORER
261 __sigrestore_t sa_restorer;
262#endif
263 sigset_t sa_mask; /* mask last for extensibility */
264};
265
266struct k_sigaction {
267 struct sigaction sa;
268#ifdef __ARCH_HAS_KA_RESTORER
269 __sigrestore_t ka_restorer;
270#endif
271};
272
273#ifdef CONFIG_OLD_SIGACTION
274struct old_sigaction {
275 __sighandler_t sa_handler;
276 old_sigset_t sa_mask;
277 unsigned long sa_flags;
278 __sigrestore_t sa_restorer;
279};
280#endif
281
282struct ksignal {
283 struct k_sigaction ka;
284 siginfo_t info;
285 int sig;
286};
287
255extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 288extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
289extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
256extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); 290extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
257extern void exit_signals(struct task_struct *tsk); 291extern void exit_signals(struct task_struct *tsk);
258 292
293/*
294 * Eventually that'll replace get_signal_to_deliver(); macro for now,
295 * to avoid nastiness with include order.
296 */
297#define get_signal(ksig) \
298({ \
299 struct ksignal *p = (ksig); \
300 p->sig = get_signal_to_deliver(&p->info, &p->ka, \
301 signal_pt_regs(), NULL);\
302 p->sig > 0; \
303})
304
259extern struct kmem_cache *sighand_cachep; 305extern struct kmem_cache *sighand_cachep;
260 306
261int unhandled_signal(struct task_struct *tsk, int sig); 307int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 320e976d5ab8..821c7f45d2a7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -230,6 +230,13 @@ enum {
230 230
231 /* generate wifi status information (where possible) */ 231 /* generate wifi status information (where possible) */
232 SKBTX_WIFI_STATUS = 1 << 4, 232 SKBTX_WIFI_STATUS = 1 << 4,
233
234 /* This indicates at least one fragment might be overwritten
235 * (as in vmsplice(), sendfile() ...)
236 * If we need to compute a TX checksum, we'll need to copy
237 * all frags to avoid possible bad checksum
238 */
239 SKBTX_SHARED_FRAG = 1 << 5,
233}; 240};
234 241
235/* 242/*
@@ -307,6 +314,8 @@ enum {
307 SKB_GSO_TCPV6 = 1 << 4, 314 SKB_GSO_TCPV6 = 1 << 4,
308 315
309 SKB_GSO_FCOE = 1 << 5, 316 SKB_GSO_FCOE = 1 << 5,
317
318 SKB_GSO_GRE = 1 << 6,
310}; 319};
311 320
312#if BITS_PER_LONG > 32 321#if BITS_PER_LONG > 32
@@ -797,6 +806,16 @@ static inline int skb_cloned(const struct sk_buff *skb)
797 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; 806 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
798} 807}
799 808
809static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
810{
811 might_sleep_if(pri & __GFP_WAIT);
812
813 if (skb_cloned(skb))
814 return pskb_expand_head(skb, 0, 0, pri);
815
816 return 0;
817}
818
800/** 819/**
801 * skb_header_cloned - is the header a clone 820 * skb_header_cloned - is the header a clone
802 * @skb: buffer to check 821 * @skb: buffer to check
@@ -1492,6 +1511,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1492 skb->inner_network_header += offset; 1511 skb->inner_network_header += offset;
1493} 1512}
1494 1513
1514static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1515{
1516 return skb->transport_header != ~0U;
1517}
1518
1495static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1519static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1496{ 1520{
1497 return skb->head + skb->transport_header; 1521 return skb->head + skb->transport_header;
@@ -1580,6 +1604,11 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,
1580 skb->inner_network_header = skb->data + offset; 1604 skb->inner_network_header = skb->data + offset;
1581} 1605}
1582 1606
1607static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1608{
1609 return skb->transport_header != NULL;
1610}
1611
1583static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1612static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1584{ 1613{
1585 return skb->transport_header; 1614 return skb->transport_header;
@@ -1815,6 +1844,10 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1815 kfree_skb(skb); 1844 kfree_skb(skb);
1816} 1845}
1817 1846
1847#define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768)
1848#define NETDEV_FRAG_PAGE_MAX_SIZE (PAGE_SIZE << NETDEV_FRAG_PAGE_MAX_ORDER)
1849#define NETDEV_PAGECNT_MAX_BIAS NETDEV_FRAG_PAGE_MAX_SIZE
1850
1818extern void *netdev_alloc_frag(unsigned int fragsz); 1851extern void *netdev_alloc_frag(unsigned int fragsz);
1819 1852
1820extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1853extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
@@ -2191,6 +2224,19 @@ static inline int skb_linearize(struct sk_buff *skb)
2191} 2224}
2192 2225
2193/** 2226/**
2227 * skb_has_shared_frag - can any frag be overwritten
2228 * @skb: buffer to test
2229 *
2230 * Return true if the skb has at least one frag that might be modified
2231 * by an external entity (as in vmsplice()/sendfile())
2232 */
2233static inline bool skb_has_shared_frag(const struct sk_buff *skb)
2234{
2235 return skb_is_nonlinear(skb) &&
2236 skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG;
2237}
2238
2239/**
2194 * skb_linearize_cow - make sure skb is linear and writable 2240 * skb_linearize_cow - make sure skb is linear and writable
2195 * @skb: buffer to process 2241 * @skb: buffer to process
2196 * 2242 *
@@ -2688,6 +2734,21 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2688} 2734}
2689#endif 2735#endif
2690 2736
2737/* Keeps track of mac header offset relative to skb->head.
2738 * It is useful for TSO of Tunneling protocol. e.g. GRE.
2739 * For non-tunnel skb it points to skb_mac_header() and for
2740 * tunnel skb it points to outer mac header. */
2741struct skb_gso_cb {
2742 int mac_offset;
2743};
2744#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2745
2746static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
2747{
2748 return (skb_mac_header(inner_skb) - inner_skb->head) -
2749 SKB_GSO_CB(inner_skb)->mac_offset;
2750}
2751
2691static inline bool skb_is_gso(const struct sk_buff *skb) 2752static inline bool skb_is_gso(const struct sk_buff *skb)
2692{ 2753{
2693 return skb_shinfo(skb)->gso_size; 2754 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/smp.h b/include/linux/smp.h
index dd6f06be3c9f..3e07a7df6478 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -89,7 +89,8 @@ void kick_all_cpus_sync(void);
89#ifdef CONFIG_USE_GENERIC_SMP_HELPERS 89#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
90void __init call_function_init(void); 90void __init call_function_init(void);
91void generic_smp_call_function_single_interrupt(void); 91void generic_smp_call_function_single_interrupt(void);
92void generic_smp_call_function_interrupt(void); 92#define generic_smp_call_function_interrupt \
93 generic_smp_call_function_single_interrupt
93#else 94#else
94static inline void call_function_init(void) { } 95static inline void call_function_init(void) { }
95#endif 96#endif
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index e0106d8581d3..c65dee059913 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -14,6 +14,8 @@ struct smpboot_thread_data;
14 * @thread_should_run: Check whether the thread should run or not. Called with 14 * @thread_should_run: Check whether the thread should run or not. Called with
15 * preemption disabled. 15 * preemption disabled.
16 * @thread_fn: The associated thread function 16 * @thread_fn: The associated thread function
17 * @create: Optional setup function, called when the thread gets
18 * created (Not called from the thread context)
17 * @setup: Optional setup function, called when the thread gets 19 * @setup: Optional setup function, called when the thread gets
18 * operational the first time 20 * operational the first time
19 * @cleanup: Optional cleanup function, called when the thread 21 * @cleanup: Optional cleanup function, called when the thread
@@ -22,6 +24,7 @@ struct smpboot_thread_data;
22 * parked (cpu offline) 24 * parked (cpu offline)
23 * @unpark: Optional unpark function, called when the thread is 25 * @unpark: Optional unpark function, called when the thread is
24 * unparked (cpu online) 26 * unparked (cpu online)
27 * @selfparking: Thread is not parked by the park function.
25 * @thread_comm: The base name of the thread 28 * @thread_comm: The base name of the thread
26 */ 29 */
27struct smp_hotplug_thread { 30struct smp_hotplug_thread {
@@ -29,10 +32,12 @@ struct smp_hotplug_thread {
29 struct list_head list; 32 struct list_head list;
30 int (*thread_should_run)(unsigned int cpu); 33 int (*thread_should_run)(unsigned int cpu);
31 void (*thread_fn)(unsigned int cpu); 34 void (*thread_fn)(unsigned int cpu);
35 void (*create)(unsigned int cpu);
32 void (*setup)(unsigned int cpu); 36 void (*setup)(unsigned int cpu);
33 void (*cleanup)(unsigned int cpu, bool online); 37 void (*cleanup)(unsigned int cpu, bool online);
34 void (*park)(unsigned int cpu); 38 void (*park)(unsigned int cpu);
35 void (*unpark)(unsigned int cpu); 39 void (*unpark)(unsigned int cpu);
40 bool selfparking;
36 const char *thread_comm; 41 const char *thread_comm;
37}; 42};
38 43
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9a546ff853dc..2b9f74b0ffea 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -178,7 +178,8 @@ struct ucred {
178#define AF_CAIF 37 /* CAIF sockets */ 178#define AF_CAIF 37 /* CAIF sockets */
179#define AF_ALG 38 /* Algorithm sockets */ 179#define AF_ALG 38 /* Algorithm sockets */
180#define AF_NFC 39 /* NFC sockets */ 180#define AF_NFC 39 /* NFC sockets */
181#define AF_MAX 40 /* For now.. */ 181#define AF_VSOCK 40 /* vSockets */
182#define AF_MAX 41 /* For now.. */
182 183
183/* Protocol families, same as address families. */ 184/* Protocol families, same as address families. */
184#define PF_UNSPEC AF_UNSPEC 185#define PF_UNSPEC AF_UNSPEC
@@ -221,6 +222,7 @@ struct ucred {
221#define PF_CAIF AF_CAIF 222#define PF_CAIF AF_CAIF
222#define PF_ALG AF_ALG 223#define PF_ALG AF_ALG
223#define PF_NFC AF_NFC 224#define PF_NFC AF_NFC
225#define PF_VSOCK AF_VSOCK
224#define PF_MAX AF_MAX 226#define PF_MAX AF_MAX
225 227
226/* Maximum queue length specifiable by listen. */ 228/* Maximum queue length specifiable by listen. */
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h
index c73d1445c77e..82d5111cd0c2 100644
--- a/include/linux/spi/pxa2xx_spi.h
+++ b/include/linux/spi/pxa2xx_spi.h
@@ -28,6 +28,15 @@ struct pxa2xx_spi_master {
28 u32 clock_enable; 28 u32 clock_enable;
29 u16 num_chipselect; 29 u16 num_chipselect;
30 u8 enable_dma; 30 u8 enable_dma;
31
32 /* DMA engine specific config */
33 int rx_chan_id;
34 int tx_chan_id;
35 int rx_slave_id;
36 int tx_slave_id;
37
38 /* For non-PXA arches */
39 struct ssp_device ssp;
31}; 40};
32 41
33/* spi_board_info.controller_data for SPI slave devices, 42/* spi_board_info.controller_data for SPI slave devices,
@@ -35,6 +44,7 @@ struct pxa2xx_spi_master {
35 */ 44 */
36struct pxa2xx_spi_chip { 45struct pxa2xx_spi_chip {
37 u8 tx_threshold; 46 u8 tx_threshold;
47 u8 tx_hi_threshold;
38 u8 rx_threshold; 48 u8 rx_threshold;
39 u8 dma_burst_size; 49 u8 dma_burst_size;
40 u32 timeout; 50 u32 timeout;
@@ -50,103 +60,5 @@ struct pxa2xx_spi_chip {
50 60
51extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); 61extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info);
52 62
53#else
54/*
55 * This is the implemtation for CE4100 on x86. ARM defines them in mach/ or
56 * plat/ include path.
57 * The CE4100 does not provide DMA support. This bits are here to let the driver
58 * compile and will never be used. Maybe we get DMA support at a later point in
59 * time.
60 */
61
62#define DCSR(n) (n)
63#define DSADR(n) (n)
64#define DTADR(n) (n)
65#define DCMD(n) (n)
66#define DRCMR(n) (n)
67
68#define DCSR_RUN (1 << 31) /* Run Bit */
69#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch */
70#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable */
71#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
72#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
73#define DCSR_ENDINTR (1 << 2) /* End Interrupt */
74#define DCSR_STARTINTR (1 << 1) /* Start Interrupt */
75#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt */
76
77#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable */
78#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
79#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
80#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
81#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
82#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
83#define DCSR_EORINTR (1 << 9) /* The end of Receive */
84
85#define DRCMR_MAPVLD (1 << 7) /* Map Valid */
86#define DRCMR_CHLNUM 0x1f /* mask for Channel Number */
87
88#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor */
89#define DDADR_STOP (1 << 0) /* Stop */
90
91#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
92#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
93#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
94#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
95#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
96#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
97#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
98#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
99#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
100#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
101#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
102#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
103#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
104#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
105
106/*
107 * Descriptor structure for PXA's DMA engine
108 * Note: this structure must always be aligned to a 16-byte boundary.
109 */
110
111typedef enum {
112 DMA_PRIO_HIGH = 0,
113 DMA_PRIO_MEDIUM = 1,
114 DMA_PRIO_LOW = 2
115} pxa_dma_prio;
116
117/*
118 * DMA registration
119 */
120
121static inline int pxa_request_dma(char *name,
122 pxa_dma_prio prio,
123 void (*irq_handler)(int, void *),
124 void *data)
125{
126 return -ENODEV;
127}
128
129static inline void pxa_free_dma(int dma_ch)
130{
131}
132
133/*
134 * The CE4100 does not have the clk framework implemented and SPI clock can
135 * not be switched on/off or the divider changed.
136 */
137static inline void clk_disable(struct clk *clk)
138{
139}
140
141static inline int clk_enable(struct clk *clk)
142{
143 return 0;
144}
145
146static inline unsigned long clk_get_rate(struct clk *clk)
147{
148 return 3686400;
149}
150
151#endif 63#endif
152#endif 64#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index f62918946d86..38c2b925923d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -57,6 +57,8 @@ extern struct bus_type spi_bus_type;
57 * @modalias: Name of the driver to use with this device, or an alias 57 * @modalias: Name of the driver to use with this device, or an alias
58 * for that name. This appears in the sysfs "modalias" attribute 58 * for that name. This appears in the sysfs "modalias" attribute
59 * for driver coldplugging, and in uevents used for hotplugging 59 * for driver coldplugging, and in uevents used for hotplugging
60 * @cs_gpio: gpio number of the chipselect line (optional, -EINVAL when
61 * when not using a GPIO line)
60 * 62 *
61 * A @spi_device is used to interchange data between an SPI slave 63 * A @spi_device is used to interchange data between an SPI slave
62 * (usually a discrete chip) and CPU memory. 64 * (usually a discrete chip) and CPU memory.
@@ -258,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
258 * @unprepare_transfer_hardware: there are currently no more messages on the 260 * @unprepare_transfer_hardware: there are currently no more messages on the
259 * queue so the subsystem notifies the driver that it may relax the 261 * queue so the subsystem notifies the driver that it may relax the
260 * hardware by issuing this call 262 * hardware by issuing this call
263 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
264 * number. Any individual value may be -EINVAL for CS lines that
265 * are not GPIOs (driven by the SPI controller itself).
261 * 266 *
262 * Each SPI master controller can communicate with one or more @spi_device 267 * Each SPI master controller can communicate with one or more @spi_device
263 * children. These make a small bus, sharing MOSI, MISO and SCK signals 268 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -591,6 +596,26 @@ spi_transfer_del(struct spi_transfer *t)
591 list_del(&t->transfer_list); 596 list_del(&t->transfer_list);
592} 597}
593 598
599/**
600 * spi_message_init_with_transfers - Initialize spi_message and append transfers
601 * @m: spi_message to be initialized
602 * @xfers: An array of spi transfers
603 * @num_xfers: Number of items in the xfer array
604 *
605 * This function initializes the given spi_message and adds each spi_transfer in
606 * the given array to the message.
607 */
608static inline void
609spi_message_init_with_transfers(struct spi_message *m,
610struct spi_transfer *xfers, unsigned int num_xfers)
611{
612 unsigned int i;
613
614 spi_message_init(m);
615 for (i = 0; i < num_xfers; ++i)
616 spi_message_add_tail(&xfers[i], m);
617}
618
594/* It's fine to embed message and transaction structures in other data 619/* It's fine to embed message and transaction structures in other data
595 * structures so long as you don't free them while they're in use. 620 * structures so long as you don't free them while they're in use.
596 */ 621 */
@@ -683,6 +708,30 @@ spi_read(struct spi_device *spi, void *buf, size_t len)
683 return spi_sync(spi, &m); 708 return spi_sync(spi, &m);
684} 709}
685 710
711/**
712 * spi_sync_transfer - synchronous SPI data transfer
713 * @spi: device with which data will be exchanged
714 * @xfers: An array of spi_transfers
715 * @num_xfers: Number of items in the xfer array
716 * Context: can sleep
717 *
718 * Does a synchronous SPI data transfer of the given spi_transfer array.
719 *
720 * For more specific semantics see spi_sync().
721 *
722 * It returns zero on success, else a negative error code.
723 */
724static inline int
725spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
726 unsigned int num_xfers)
727{
728 struct spi_message msg;
729
730 spi_message_init_with_transfers(&msg, xfers, num_xfers);
731
732 return spi_sync(spi, &msg);
733}
734
686/* this copies txbuf and rxbuf data; for small transfers only! */ 735/* this copies txbuf and rxbuf data; for small transfers only! */
687extern int spi_write_then_read(struct spi_device *spi, 736extern int spi_write_then_read(struct spi_device *spi,
688 const void *txbuf, unsigned n_tx, 737 const void *txbuf, unsigned n_tx,
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
index 369b3d7d5b95..1634ce31c06d 100644
--- a/include/linux/spi/spi_gpio.h
+++ b/include/linux/spi/spi_gpio.h
@@ -62,8 +62,8 @@
62 */ 62 */
63struct spi_gpio_platform_data { 63struct spi_gpio_platform_data {
64 unsigned sck; 64 unsigned sck;
65 unsigned mosi; 65 unsigned long mosi;
66 unsigned miso; 66 unsigned long miso;
67 67
68 u16 num_chipselect; 68 u16 num_chipselect;
69}; 69};
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 6eb691b08358..04f4121a23ae 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -151,30 +151,14 @@ void srcu_barrier(struct srcu_struct *sp);
151 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot 151 * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
152 * and while lockdep is disabled. 152 * and while lockdep is disabled.
153 * 153 *
154 * Note that if the CPU is in the idle loop from an RCU point of view 154 * Note that SRCU is based on its own statemachine and it doesn't
155 * (ie: that we are in the section between rcu_idle_enter() and 155 * relies on normal RCU, it can be called from the CPU which
156 * rcu_idle_exit()) then srcu_read_lock_held() returns false even if 156 * is in the idle loop from an RCU point of view or offline.
157 * the CPU did an srcu_read_lock(). The reason for this is that RCU
158 * ignores CPUs that are in such a section, considering these as in
159 * extended quiescent state, so such a CPU is effectively never in an
160 * RCU read-side critical section regardless of what RCU primitives it
161 * invokes. This state of affairs is required --- we need to keep an
162 * RCU-free window in idle where the CPU may possibly enter into low
163 * power mode. This way we can notice an extended quiescent state to
164 * other CPUs that started a grace period. Otherwise we would delay any
165 * grace period as long as we run in the idle task.
166 *
167 * Similarly, we avoid claiming an SRCU read lock held if the current
168 * CPU is offline.
169 */ 157 */
170static inline int srcu_read_lock_held(struct srcu_struct *sp) 158static inline int srcu_read_lock_held(struct srcu_struct *sp)
171{ 159{
172 if (!debug_lockdep_rcu_enabled()) 160 if (!debug_lockdep_rcu_enabled())
173 return 1; 161 return 1;
174 if (rcu_is_cpu_idle())
175 return 0;
176 if (!rcu_lockdep_current_cpu_online())
177 return 0;
178 return lock_is_held(&sp->dep_map); 162 return lock_is_held(&sp->dep_map);
179} 163}
180 164
@@ -236,8 +220,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
236 int retval = __srcu_read_lock(sp); 220 int retval = __srcu_read_lock(sp);
237 221
238 rcu_lock_acquire(&(sp)->dep_map); 222 rcu_lock_acquire(&(sp)->dep_map);
239 rcu_lockdep_assert(!rcu_is_cpu_idle(),
240 "srcu_read_lock() used illegally while idle");
241 return retval; 223 return retval;
242} 224}
243 225
@@ -251,8 +233,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
251static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 233static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
252 __releases(sp) 234 __releases(sp)
253{ 235{
254 rcu_lockdep_assert(!rcu_is_cpu_idle(),
255 "srcu_read_unlock() used illegally while idle");
256 rcu_lock_release(&(sp)->dep_map); 236 rcu_lock_release(&(sp)->dep_map);
257 __srcu_read_unlock(sp, idx); 237 __srcu_read_unlock(sp, idx);
258} 238}
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 6b05dcd927ff..86a12b0cb239 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -97,21 +97,16 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
97 return 0; 97 return 0;
98} 98}
99 99
100#ifdef CONFIG_BCM47XX
101#include <asm/mach-bcm47xx/nvram.h>
102/* Get the device MAC address */ 100/* Get the device MAC address */
103static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) 101static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
104{
105 char buf[20];
106 if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
107 return;
108 nvram_parse_macaddr(buf, macaddr);
109}
110#else
111static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
112{ 102{
103 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
104 if (!dev)
105 return -ENODEV;
106
107 memcpy(macaddr, dev->dev->bus->sprom.et0mac, 6);
108 return 0;
113} 109}
114#endif
115 110
116extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, 111extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
117 struct pci_dev *pdev); 112 struct pci_dev *pdev);
@@ -175,6 +170,10 @@ static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
175{ 170{
176 return 0; 171 return 0;
177} 172}
173static inline int ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
174{
175 return -ENODEV;
176}
178 177
179#endif /* CONFIG_SSB_DRIVER_GIGE */ 178#endif /* CONFIG_SSB_DRIVER_GIGE */
180#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ 179#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index 07a9c7a2e088..afe79d40a99e 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -45,6 +45,11 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
45{ 45{
46} 46}
47 47
48static inline unsigned int ssb_mips_irq(struct ssb_device *dev)
49{
50 return 0;
51}
52
48#endif /* CONFIG_SSB_DRIVER_MIPS */ 53#endif /* CONFIG_SSB_DRIVER_MIPS */
49 54
50#endif /* LINUX_SSB_MIPSCORE_H_ */ 55#endif /* LINUX_SSB_MIPSCORE_H_ */
diff --git a/include/linux/sunrpc/addr.h b/include/linux/sunrpc/addr.h
new file mode 100644
index 000000000000..07d8e53bedfc
--- /dev/null
+++ b/include/linux/sunrpc/addr.h
@@ -0,0 +1,170 @@
1/*
2 * linux/include/linux/sunrpc/addr.h
3 *
4 * Various routines for copying and comparing sockaddrs and for
5 * converting them to and from presentation format.
6 */
7#ifndef _LINUX_SUNRPC_ADDR_H
8#define _LINUX_SUNRPC_ADDR_H
9
10#include <linux/socket.h>
11#include <linux/in.h>
12#include <linux/in6.h>
13#include <net/ipv6.h>
14
15size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
16size_t rpc_pton(struct net *, const char *, const size_t,
17 struct sockaddr *, const size_t);
18char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
19size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
20 struct sockaddr *, const size_t);
21
22static inline unsigned short rpc_get_port(const struct sockaddr *sap)
23{
24 switch (sap->sa_family) {
25 case AF_INET:
26 return ntohs(((struct sockaddr_in *)sap)->sin_port);
27 case AF_INET6:
28 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
29 }
30 return 0;
31}
32
33static inline void rpc_set_port(struct sockaddr *sap,
34 const unsigned short port)
35{
36 switch (sap->sa_family) {
37 case AF_INET:
38 ((struct sockaddr_in *)sap)->sin_port = htons(port);
39 break;
40 case AF_INET6:
41 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
42 break;
43 }
44}
45
46#define IPV6_SCOPE_DELIMITER '%'
47#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
48
49static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
50 const struct sockaddr *sap2)
51{
52 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
53 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
54
55 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
56}
57
58static inline bool __rpc_copy_addr4(struct sockaddr *dst,
59 const struct sockaddr *src)
60{
61 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
62 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
63
64 dsin->sin_family = ssin->sin_family;
65 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
66 return true;
67}
68
69#if IS_ENABLED(CONFIG_IPV6)
70static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
71 const struct sockaddr *sap2)
72{
73 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
74 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
75
76 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
77 return false;
78 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
79 return sin1->sin6_scope_id == sin2->sin6_scope_id;
80
81 return true;
82}
83
84static inline bool __rpc_copy_addr6(struct sockaddr *dst,
85 const struct sockaddr *src)
86{
87 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
88 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
89
90 dsin6->sin6_family = ssin6->sin6_family;
91 dsin6->sin6_addr = ssin6->sin6_addr;
92 dsin6->sin6_scope_id = ssin6->sin6_scope_id;
93 return true;
94}
95#else /* !(IS_ENABLED(CONFIG_IPV6) */
96static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
97 const struct sockaddr *sap2)
98{
99 return false;
100}
101
102static inline bool __rpc_copy_addr6(struct sockaddr *dst,
103 const struct sockaddr *src)
104{
105 return false;
106}
107#endif /* !(IS_ENABLED(CONFIG_IPV6) */
108
109/**
110 * rpc_cmp_addr - compare the address portion of two sockaddrs.
111 * @sap1: first sockaddr
112 * @sap2: second sockaddr
113 *
114 * Just compares the family and address portion. Ignores port, but
115 * compares the scope if it's a link-local address.
116 *
117 * Returns true if the addrs are equal, false if they aren't.
118 */
119static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
120 const struct sockaddr *sap2)
121{
122 if (sap1->sa_family == sap2->sa_family) {
123 switch (sap1->sa_family) {
124 case AF_INET:
125 return __rpc_cmp_addr4(sap1, sap2);
126 case AF_INET6:
127 return __rpc_cmp_addr6(sap1, sap2);
128 }
129 }
130 return false;
131}
132
133/**
134 * rpc_copy_addr - copy the address portion of one sockaddr to another
135 * @dst: destination sockaddr
136 * @src: source sockaddr
137 *
138 * Just copies the address portion and family. Ignores port, scope, etc.
139 * Caller is responsible for making certain that dst is large enough to hold
140 * the address in src. Returns true if address family is supported. Returns
141 * false otherwise.
142 */
143static inline bool rpc_copy_addr(struct sockaddr *dst,
144 const struct sockaddr *src)
145{
146 switch (src->sa_family) {
147 case AF_INET:
148 return __rpc_copy_addr4(dst, src);
149 case AF_INET6:
150 return __rpc_copy_addr6(dst, src);
151 }
152 return false;
153}
154
155/**
156 * rpc_get_scope_id - return scopeid for a given sockaddr
157 * @sa: sockaddr to get scopeid from
158 *
159 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
160 * not an AF_INET6 address.
161 */
162static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
163{
164 if (sa->sa_family != AF_INET6)
165 return 0;
166
167 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
168}
169
170#endif /* _LINUX_SUNRPC_ADDR_H */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index f25ba922baaf..58fda1c3c783 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -17,14 +17,15 @@
17 17
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
20#include <linux/uidgid.h>
20 21
21/* size of the nodename buffer */ 22/* size of the nodename buffer */
22#define UNX_MAXNODENAME 32 23#define UNX_MAXNODENAME 32
23 24
24/* Work around the lack of a VFS credential */ 25/* Work around the lack of a VFS credential */
25struct auth_cred { 26struct auth_cred {
26 uid_t uid; 27 kuid_t uid;
27 gid_t gid; 28 kgid_t gid;
28 struct group_info *group_info; 29 struct group_info *group_info;
29 const char *principal; 30 const char *principal;
30 unsigned char machine_cred : 1; 31 unsigned char machine_cred : 1;
@@ -48,7 +49,7 @@ struct rpc_cred {
48 unsigned long cr_flags; /* various flags */ 49 unsigned long cr_flags; /* various flags */
49 atomic_t cr_count; /* ref count */ 50 atomic_t cr_count; /* ref count */
50 51
51 uid_t cr_uid; 52 kuid_t cr_uid;
52 53
53 /* per-flavor data */ 54 /* per-flavor data */
54}; 55};
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 5dc9ee4d616e..303399b1ba59 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -83,6 +83,10 @@ struct cache_detail {
83 int (*cache_upcall)(struct cache_detail *, 83 int (*cache_upcall)(struct cache_detail *,
84 struct cache_head *); 84 struct cache_head *);
85 85
86 void (*cache_request)(struct cache_detail *cd,
87 struct cache_head *ch,
88 char **bpp, int *blen);
89
86 int (*cache_parse)(struct cache_detail *, 90 int (*cache_parse)(struct cache_detail *,
87 char *buf, int len); 91 char *buf, int len);
88 92
@@ -157,11 +161,7 @@ sunrpc_cache_update(struct cache_detail *detail,
157 struct cache_head *new, struct cache_head *old, int hash); 161 struct cache_head *new, struct cache_head *old, int hash);
158 162
159extern int 163extern int
160sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h, 164sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h);
161 void (*cache_request)(struct cache_detail *,
162 struct cache_head *,
163 char **,
164 int *));
165 165
166 166
167extern void cache_clean_deferred(void *owner); 167extern void cache_clean_deferred(void *owner);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 34206b84d8da..2cf4ffaa3cd4 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -160,162 +160,11 @@ void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
160int rpc_protocol(struct rpc_clnt *); 160int rpc_protocol(struct rpc_clnt *);
161struct net * rpc_net_ns(struct rpc_clnt *); 161struct net * rpc_net_ns(struct rpc_clnt *);
162size_t rpc_max_payload(struct rpc_clnt *); 162size_t rpc_max_payload(struct rpc_clnt *);
163unsigned long rpc_get_timeout(struct rpc_clnt *clnt);
163void rpc_force_rebind(struct rpc_clnt *); 164void rpc_force_rebind(struct rpc_clnt *);
164size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 165size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
165const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 166const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
166int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); 167int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
167 168
168size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
169size_t rpc_pton(struct net *, const char *, const size_t,
170 struct sockaddr *, const size_t);
171char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
172size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
173 struct sockaddr *, const size_t);
174
175static inline unsigned short rpc_get_port(const struct sockaddr *sap)
176{
177 switch (sap->sa_family) {
178 case AF_INET:
179 return ntohs(((struct sockaddr_in *)sap)->sin_port);
180 case AF_INET6:
181 return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
182 }
183 return 0;
184}
185
186static inline void rpc_set_port(struct sockaddr *sap,
187 const unsigned short port)
188{
189 switch (sap->sa_family) {
190 case AF_INET:
191 ((struct sockaddr_in *)sap)->sin_port = htons(port);
192 break;
193 case AF_INET6:
194 ((struct sockaddr_in6 *)sap)->sin6_port = htons(port);
195 break;
196 }
197}
198
199#define IPV6_SCOPE_DELIMITER '%'
200#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
201
202static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
203 const struct sockaddr *sap2)
204{
205 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
206 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
207
208 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
209}
210
211static inline bool __rpc_copy_addr4(struct sockaddr *dst,
212 const struct sockaddr *src)
213{
214 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
215 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
216
217 dsin->sin_family = ssin->sin_family;
218 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
219 return true;
220}
221
222#if IS_ENABLED(CONFIG_IPV6)
223static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
224 const struct sockaddr *sap2)
225{
226 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
227 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
228
229 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
230 return false;
231 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
232 return sin1->sin6_scope_id == sin2->sin6_scope_id;
233
234 return true;
235}
236
237static inline bool __rpc_copy_addr6(struct sockaddr *dst,
238 const struct sockaddr *src)
239{
240 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
241 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
242
243 dsin6->sin6_family = ssin6->sin6_family;
244 dsin6->sin6_addr = ssin6->sin6_addr;
245 return true;
246}
247#else /* !(IS_ENABLED(CONFIG_IPV6) */
248static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
249 const struct sockaddr *sap2)
250{
251 return false;
252}
253
254static inline bool __rpc_copy_addr6(struct sockaddr *dst,
255 const struct sockaddr *src)
256{
257 return false;
258}
259#endif /* !(IS_ENABLED(CONFIG_IPV6) */
260
261/**
262 * rpc_cmp_addr - compare the address portion of two sockaddrs.
263 * @sap1: first sockaddr
264 * @sap2: second sockaddr
265 *
266 * Just compares the family and address portion. Ignores port, scope, etc.
267 * Returns true if the addrs are equal, false if they aren't.
268 */
269static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
270 const struct sockaddr *sap2)
271{
272 if (sap1->sa_family == sap2->sa_family) {
273 switch (sap1->sa_family) {
274 case AF_INET:
275 return __rpc_cmp_addr4(sap1, sap2);
276 case AF_INET6:
277 return __rpc_cmp_addr6(sap1, sap2);
278 }
279 }
280 return false;
281}
282
283/**
284 * rpc_copy_addr - copy the address portion of one sockaddr to another
285 * @dst: destination sockaddr
286 * @src: source sockaddr
287 *
288 * Just copies the address portion and family. Ignores port, scope, etc.
289 * Caller is responsible for making certain that dst is large enough to hold
290 * the address in src. Returns true if address family is supported. Returns
291 * false otherwise.
292 */
293static inline bool rpc_copy_addr(struct sockaddr *dst,
294 const struct sockaddr *src)
295{
296 switch (src->sa_family) {
297 case AF_INET:
298 return __rpc_copy_addr4(dst, src);
299 case AF_INET6:
300 return __rpc_copy_addr6(dst, src);
301 }
302 return false;
303}
304
305/**
306 * rpc_get_scope_id - return scopeid for a given sockaddr
307 * @sa: sockaddr to get scopeid from
308 *
309 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
310 * not an AF_INET6 address.
311 */
312static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
313{
314 if (sa->sa_family != AF_INET6)
315 return 0;
316
317 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
318}
319
320#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
321#endif /* _LINUX_SUNRPC_CLNT_H */ 170#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index b64f8eb0b973..84ca436b76c2 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -87,7 +87,6 @@ struct rpc_task {
87 tk_cred_retry : 2, 87 tk_cred_retry : 2,
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90#define tk_xprt tk_client->cl_xprt
91 90
92/* support walking a list of tasks on a wait queue */ 91/* support walking a list of tasks on a wait queue */
93#define task_for_each(task, pos, head) \ 92#define task_for_each(task, pos, head) \
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 676ddf53b3ee..1f0216b9a6c9 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -50,6 +50,7 @@ struct svc_pool {
50 unsigned int sp_nrthreads; /* # of threads in pool */ 50 unsigned int sp_nrthreads; /* # of threads in pool */
51 struct list_head sp_all_threads; /* all server threads */ 51 struct list_head sp_all_threads; /* all server threads */
52 struct svc_pool_stats sp_stats; /* statistics on pool operation */ 52 struct svc_pool_stats sp_stats; /* statistics on pool operation */
53 int sp_task_pending;/* has pending task */
53} ____cacheline_aligned_in_smp; 54} ____cacheline_aligned_in_smp;
54 55
55/* 56/*
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index dd74084a9799..ff374ab30839 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -18,8 +18,8 @@
18#include <linux/cred.h> 18#include <linux/cred.h>
19 19
20struct svc_cred { 20struct svc_cred {
21 uid_t cr_uid; 21 kuid_t cr_uid;
22 gid_t cr_gid; 22 kgid_t cr_gid;
23 struct group_info *cr_group_info; 23 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 24 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 25 char *cr_principal; /* for gss */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 63988990bd36..15f9204ee70b 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -56,7 +56,7 @@ struct xdr_buf {
56 struct kvec head[1], /* RPC header + non-page data */ 56 struct kvec head[1], /* RPC header + non-page data */
57 tail[1]; /* Appended after page data */ 57 tail[1]; /* Appended after page data */
58 58
59 struct page ** pages; /* Array of contiguous pages */ 59 struct page ** pages; /* Array of pages */
60 unsigned int page_base, /* Start of page data */ 60 unsigned int page_base, /* Start of page data */
61 page_len, /* Length of page data */ 61 page_len, /* Length of page data */
62 flags; /* Flags for data disposition */ 62 flags; /* Flags for data disposition */
@@ -152,6 +152,7 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p)
152extern void xdr_shift_buf(struct xdr_buf *, size_t); 152extern void xdr_shift_buf(struct xdr_buf *, size_t);
153extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); 153extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
154extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int); 154extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
155extern void xdr_buf_trim(struct xdr_buf *, unsigned int);
155extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int); 156extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int);
156extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); 157extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
157extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int); 158extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 951cb9b7d02b..30834be03011 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -117,12 +117,12 @@ struct rpc_xprt_ops {
117 void (*alloc_slot)(struct rpc_xprt *xprt, struct rpc_task *task); 117 void (*alloc_slot)(struct rpc_xprt *xprt, struct rpc_task *task);
118 void (*rpcbind)(struct rpc_task *task); 118 void (*rpcbind)(struct rpc_task *task);
119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
120 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task);
121 void * (*buf_alloc)(struct rpc_task *task, size_t size); 121 void * (*buf_alloc)(struct rpc_task *task, size_t size);
122 void (*buf_free)(void *buffer); 122 void (*buf_free)(void *buffer);
123 int (*send_request)(struct rpc_task *task); 123 int (*send_request)(struct rpc_task *task);
124 void (*set_retrans_timeout)(struct rpc_task *task); 124 void (*set_retrans_timeout)(struct rpc_task *task);
125 void (*timer)(struct rpc_task *task); 125 void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task);
126 void (*release_request)(struct rpc_task *task); 126 void (*release_request)(struct rpc_task *task);
127 void (*close)(struct rpc_xprt *xprt); 127 void (*close)(struct rpc_xprt *xprt);
128 void (*destroy)(struct rpc_xprt *xprt); 128 void (*destroy)(struct rpc_xprt *xprt);
@@ -313,7 +313,7 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
313void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 313void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
314void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 314void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
315void xprt_write_space(struct rpc_xprt *xprt); 315void xprt_write_space(struct rpc_xprt *xprt);
316void xprt_adjust_cwnd(struct rpc_task *task, int result); 316void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
317struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 317struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
318void xprt_complete_rqst(struct rpc_task *task, int copied); 318void xprt_complete_rqst(struct rpc_task *task, int copied);
319void xprt_release_rqst_cong(struct rpc_task *task); 319void xprt_release_rqst_cong(struct rpc_task *task);
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h
index 68e7430bb0fe..dbe4d7fca1b8 100644
--- a/include/linux/sunserialcore.h
+++ b/include/linux/sunserialcore.h
@@ -13,6 +13,10 @@
13#ifndef _SERIAL_SUN_H 13#ifndef _SERIAL_SUN_H
14#define _SERIAL_SUN_H 14#define _SERIAL_SUN_H
15 15
16#include <linux/device.h>
17#include <linux/serial_core.h>
18#include <linux/console.h>
19
16/* Serial keyboard defines for L1-A processing... */ 20/* Serial keyboard defines for L1-A processing... */
17#define SUNKBD_RESET 0xff 21#define SUNKBD_RESET 0xff
18#define SUNKBD_L1 0x01 22#define SUNKBD_L1 0x01
diff --git a/include/linux/sunxi_timer.h b/include/linux/sunxi_timer.h
index b9165bba6e61..18081787e5f3 100644
--- a/include/linux/sunxi_timer.h
+++ b/include/linux/sunxi_timer.h
@@ -19,6 +19,6 @@
19 19
20#include <asm/mach/time.h> 20#include <asm/mach/time.h>
21 21
22extern struct sys_timer sunxi_timer; 22void sunxi_timer_init(void);
23 23
24#endif 24#endif
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 0c808d7fa579..d4e3f16d5e89 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -34,8 +34,10 @@ static inline void pm_restore_console(void)
34typedef int __bitwise suspend_state_t; 34typedef int __bitwise suspend_state_t;
35 35
36#define PM_SUSPEND_ON ((__force suspend_state_t) 0) 36#define PM_SUSPEND_ON ((__force suspend_state_t) 0)
37#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1) 37#define PM_SUSPEND_FREEZE ((__force suspend_state_t) 1)
38#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 2)
38#define PM_SUSPEND_MEM ((__force suspend_state_t) 3) 39#define PM_SUSPEND_MEM ((__force suspend_state_t) 3)
40#define PM_SUSPEND_MIN PM_SUSPEND_FREEZE
39#define PM_SUSPEND_MAX ((__force suspend_state_t) 4) 41#define PM_SUSPEND_MAX ((__force suspend_state_t) 4)
40 42
41enum suspend_stat_step { 43enum suspend_stat_step {
@@ -192,6 +194,7 @@ struct platform_suspend_ops {
192 */ 194 */
193extern void suspend_set_ops(const struct platform_suspend_ops *ops); 195extern void suspend_set_ops(const struct platform_suspend_ops *ops);
194extern int suspend_valid_only_mem(suspend_state_t state); 196extern int suspend_valid_only_mem(suspend_state_t state);
197extern void freeze_wake(void);
195 198
196/** 199/**
197 * arch_suspend_disable_irqs - disable IRQs for suspend 200 * arch_suspend_disable_irqs - disable IRQs for suspend
@@ -217,6 +220,7 @@ extern int pm_suspend(suspend_state_t state);
217 220
218static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 221static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
219static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 222static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
223static inline void freeze_wake(void) {}
220#endif /* !CONFIG_SUSPEND */ 224#endif /* !CONFIG_SUSPEND */
221 225
222/* struct pbe is used for creating lists of pages that should be restored 226/* struct pbe is used for creating lists of pages that should be restored
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 68df9c17fbbb..2818a123f3ea 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -8,7 +8,7 @@
8#include <linux/memcontrol.h> 8#include <linux/memcontrol.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/node.h> 10#include <linux/node.h>
11 11#include <linux/fs.h>
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <asm/page.h> 13#include <asm/page.h>
14 14
@@ -156,7 +156,7 @@ enum {
156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 156 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
157}; 157};
158 158
159#define SWAP_CLUSTER_MAX 32 159#define SWAP_CLUSTER_MAX 32UL
160#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 160#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
161 161
162/* 162/*
@@ -202,6 +202,18 @@ struct swap_info_struct {
202 unsigned long *frontswap_map; /* frontswap in-use, one bit per page */ 202 unsigned long *frontswap_map; /* frontswap in-use, one bit per page */
203 atomic_t frontswap_pages; /* frontswap pages in-use counter */ 203 atomic_t frontswap_pages; /* frontswap pages in-use counter */
204#endif 204#endif
205 spinlock_t lock; /*
206 * protect map scan related fields like
207 * swap_map, lowest_bit, highest_bit,
208 * inuse_pages, cluster_next,
209 * cluster_nr, lowest_alloc and
210 * highest_alloc. other fields are only
211 * changed at swapon/swapoff, so are
212 * protected by swap_lock. changing
213 * flags need hold this lock and
214 * swap_lock. If both locks need hold,
215 * hold swap_lock first.
216 */
205}; 217};
206 218
207struct swap_list_t { 219struct swap_list_t {
@@ -209,15 +221,12 @@ struct swap_list_t {
209 int next; /* swapfile to be used next */ 221 int next; /* swapfile to be used next */
210}; 222};
211 223
212/* Swap 50% full? Release swapcache more aggressively.. */
213#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
214
215/* linux/mm/page_alloc.c */ 224/* linux/mm/page_alloc.c */
216extern unsigned long totalram_pages; 225extern unsigned long totalram_pages;
217extern unsigned long totalreserve_pages; 226extern unsigned long totalreserve_pages;
218extern unsigned long dirty_balance_reserve; 227extern unsigned long dirty_balance_reserve;
219extern unsigned int nr_free_buffer_pages(void); 228extern unsigned long nr_free_buffer_pages(void);
220extern unsigned int nr_free_pagecache_pages(void); 229extern unsigned long nr_free_pagecache_pages(void);
221 230
222/* Definition of global_page_state not available yet */ 231/* Definition of global_page_state not available yet */
223#define nr_free_pages() global_page_state(NR_FREE_PAGES) 232#define nr_free_pages() global_page_state(NR_FREE_PAGES)
@@ -266,7 +275,7 @@ extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
266extern unsigned long shrink_all_memory(unsigned long nr_pages); 275extern unsigned long shrink_all_memory(unsigned long nr_pages);
267extern int vm_swappiness; 276extern int vm_swappiness;
268extern int remove_mapping(struct address_space *mapping, struct page *page); 277extern int remove_mapping(struct address_space *mapping, struct page *page);
269extern long vm_total_pages; 278extern unsigned long vm_total_pages;
270 279
271#ifdef CONFIG_NUMA 280#ifdef CONFIG_NUMA
272extern int zone_reclaim_mode; 281extern int zone_reclaim_mode;
@@ -330,8 +339,9 @@ int generic_swapfile_activate(struct swap_info_struct *, struct file *,
330 sector_t *); 339 sector_t *);
331 340
332/* linux/mm/swap_state.c */ 341/* linux/mm/swap_state.c */
333extern struct address_space swapper_space; 342extern struct address_space swapper_spaces[];
334#define total_swapcache_pages swapper_space.nrpages 343#define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])
344extern unsigned long total_swapcache_pages(void);
335extern void show_swap_cache_info(void); 345extern void show_swap_cache_info(void);
336extern int add_to_swap(struct page *); 346extern int add_to_swap(struct page *);
337extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); 347extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
@@ -346,8 +356,20 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
346 struct vm_area_struct *vma, unsigned long addr); 356 struct vm_area_struct *vma, unsigned long addr);
347 357
348/* linux/mm/swapfile.c */ 358/* linux/mm/swapfile.c */
349extern long nr_swap_pages; 359extern atomic_long_t nr_swap_pages;
350extern long total_swap_pages; 360extern long total_swap_pages;
361
362/* Swap 50% full? Release swapcache more aggressively.. */
363static inline bool vm_swap_full(void)
364{
365 return atomic_long_read(&nr_swap_pages) * 2 < total_swap_pages;
366}
367
368static inline long get_nr_swap_pages(void)
369{
370 return atomic_long_read(&nr_swap_pages);
371}
372
351extern void si_swapinfo(struct sysinfo *); 373extern void si_swapinfo(struct sysinfo *);
352extern swp_entry_t get_swap_page(void); 374extern swp_entry_t get_swap_page(void);
353extern swp_entry_t get_swap_page_of_type(int); 375extern swp_entry_t get_swap_page_of_type(int);
@@ -380,9 +402,10 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
380 402
381#else /* CONFIG_SWAP */ 403#else /* CONFIG_SWAP */
382 404
383#define nr_swap_pages 0L 405#define get_nr_swap_pages() 0L
384#define total_swap_pages 0L 406#define total_swap_pages 0L
385#define total_swapcache_pages 0UL 407#define total_swapcache_pages() 0UL
408#define vm_swap_full() 0
386 409
387#define si_swapinfo(val) \ 410#define si_swapinfo(val) \
388 do { (val)->freeswap = (val)->totalswap = 0; } while (0) 411 do { (val)->freeswap = (val)->totalswap = 0; } while (0)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 071d62c214a6..2de42f9401d2 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -23,7 +23,7 @@ extern int swiotlb_force;
23#define IO_TLB_SHIFT 11 23#define IO_TLB_SHIFT 11
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swiotlb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs); 28extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
29 29
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 45e2db270255..313a8e0a6553 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -68,11 +68,11 @@ struct sigaltstack;
68#include <linux/types.h> 68#include <linux/types.h>
69#include <linux/aio_abi.h> 69#include <linux/aio_abi.h>
70#include <linux/capability.h> 70#include <linux/capability.h>
71#include <linux/signal.h>
71#include <linux/list.h> 72#include <linux/list.h>
72#include <linux/bug.h> 73#include <linux/bug.h>
73#include <linux/sem.h> 74#include <linux/sem.h>
74#include <asm/siginfo.h> 75#include <asm/siginfo.h>
75#include <asm/signal.h>
76#include <linux/unistd.h> 76#include <linux/unistd.h>
77#include <linux/quota.h> 77#include <linux/quota.h>
78#include <linux/key.h> 78#include <linux/key.h>
@@ -300,10 +300,8 @@ asmlinkage long sys_personality(unsigned int personality);
300asmlinkage long sys_sigpending(old_sigset_t __user *set); 300asmlinkage long sys_sigpending(old_sigset_t __user *set);
301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 301asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
302 old_sigset_t __user *oset); 302 old_sigset_t __user *oset);
303#ifdef CONFIG_GENERIC_SIGALTSTACK
304asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss, 303asmlinkage long sys_sigaltstack(const struct sigaltstack __user *uss,
305 struct sigaltstack __user *uoss); 304 struct sigaltstack __user *uoss);
306#endif
307 305
308asmlinkage long sys_getitimer(int which, struct itimerval __user *value); 306asmlinkage long sys_getitimer(int which, struct itimerval __user *value);
309asmlinkage long sys_setitimer(int which, 307asmlinkage long sys_setitimer(int which,
@@ -377,6 +375,27 @@ asmlinkage long sys_init_module(void __user *umod, unsigned long len,
377asmlinkage long sys_delete_module(const char __user *name_user, 375asmlinkage long sys_delete_module(const char __user *name_user,
378 unsigned int flags); 376 unsigned int flags);
379 377
378#ifdef CONFIG_OLD_SIGSUSPEND
379asmlinkage long sys_sigsuspend(old_sigset_t mask);
380#endif
381
382#ifdef CONFIG_OLD_SIGSUSPEND3
383asmlinkage long sys_sigsuspend(int unused1, int unused2, old_sigset_t mask);
384#endif
385
386asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
387
388#ifdef CONFIG_OLD_SIGACTION
389asmlinkage long sys_sigaction(int, const struct old_sigaction __user *,
390 struct old_sigaction __user *);
391#endif
392
393#ifndef CONFIG_ODD_RT_SIGACTION
394asmlinkage long sys_rt_sigaction(int,
395 const struct sigaction __user *,
396 struct sigaction __user *,
397 size_t);
398#endif
380asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set, 399asmlinkage long sys_rt_sigprocmask(int how, sigset_t __user *set,
381 sigset_t __user *oset, size_t sigsetsize); 400 sigset_t __user *oset, size_t sigsetsize);
382asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); 401asmlinkage long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 381f06db2fe5..e2cee22f578a 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -181,6 +181,10 @@ int sysfs_merge_group(struct kobject *kobj,
181 const struct attribute_group *grp); 181 const struct attribute_group *grp);
182void sysfs_unmerge_group(struct kobject *kobj, 182void sysfs_unmerge_group(struct kobject *kobj,
183 const struct attribute_group *grp); 183 const struct attribute_group *grp);
184int sysfs_add_link_to_group(struct kobject *kobj, const char *group_name,
185 struct kobject *target, const char *link_name);
186void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
187 const char *link_name);
184 188
185void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 189void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
186void sysfs_notify_dirent(struct sysfs_dirent *sd); 190void sysfs_notify_dirent(struct sysfs_dirent *sd);
@@ -326,6 +330,18 @@ static inline void sysfs_unmerge_group(struct kobject *kobj,
326{ 330{
327} 331}
328 332
333static inline int sysfs_add_link_to_group(struct kobject *kobj,
334 const char *group_name, struct kobject *target,
335 const char *link_name)
336{
337 return 0;
338}
339
340static inline void sysfs_remove_link_from_group(struct kobject *kobj,
341 const char *group_name, const char *link_name)
342{
343}
344
329static inline void sysfs_notify(struct kobject *kobj, const char *dir, 345static inline void sysfs_notify(struct kobject *kobj, const char *dir,
330 const char *attr) 346 const char *attr)
331{ 347{
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4e1d2283e3cc..f28408c07dc2 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -162,6 +162,8 @@ struct tcp_sock {
162 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 162 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
163 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 163 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
164 164
165 u32 tsoffset; /* timestamp offset */
166
165 struct list_head tsq_node; /* anchor in tsq_tasklet.head list */ 167 struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
166 unsigned long tsq_flags; 168 unsigned long tsq_flags;
167 169
@@ -246,7 +248,6 @@ struct tcp_sock {
246 u32 sacked_out; /* SACK'd packets */ 248 u32 sacked_out; /* SACK'd packets */
247 u32 fackets_out; /* FACK'd packets */ 249 u32 fackets_out; /* FACK'd packets */
248 u32 tso_deferred; 250 u32 tso_deferred;
249 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
250 251
251 /* from STCP, retrans queue hinting */ 252 /* from STCP, retrans queue hinting */
252 struct sk_buff* lost_skb_hint; 253 struct sk_buff* lost_skb_hint;
@@ -354,6 +355,7 @@ struct tcp_timewait_sock {
354 u32 tw_rcv_nxt; 355 u32 tw_rcv_nxt;
355 u32 tw_snd_nxt; 356 u32 tw_snd_nxt;
356 u32 tw_rcv_wnd; 357 u32 tw_rcv_wnd;
358 u32 tw_ts_offset;
357 u32 tw_ts_recent; 359 u32 tw_ts_recent;
358 long tw_ts_recent_stamp; 360 long tw_ts_recent_stamp;
359#ifdef CONFIG_TCP_MD5SIG 361#ifdef CONFIG_TCP_MD5SIG
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
new file mode 100644
index 000000000000..95f611d78f3a
--- /dev/null
+++ b/include/linux/tegra-soc.h
@@ -0,0 +1,22 @@
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 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __LINUX_TEGRA_SOC_H_
18#define __LINUX_TEGRA_SOC_H_
19
20u32 tegra_read_chipid(void);
21
22#endif /* __LINUX_TEGRA_SOC_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fe82022478e7..f0bd7f90a90d 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -74,6 +74,8 @@ enum thermal_trend {
74 THERMAL_TREND_STABLE, /* temperature is stable */ 74 THERMAL_TREND_STABLE, /* temperature is stable */
75 THERMAL_TREND_RAISING, /* temperature is raising */ 75 THERMAL_TREND_RAISING, /* temperature is raising */
76 THERMAL_TREND_DROPPING, /* temperature is dropping */ 76 THERMAL_TREND_DROPPING, /* temperature is dropping */
77 THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */
78 THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */
77}; 79};
78 80
79/* Events supported by Thermal Netlink */ 81/* Events supported by Thermal Netlink */
@@ -121,6 +123,7 @@ struct thermal_zone_device_ops {
121 int (*set_trip_hyst) (struct thermal_zone_device *, int, 123 int (*set_trip_hyst) (struct thermal_zone_device *, int,
122 unsigned long); 124 unsigned long);
123 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 125 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
126 int (*set_emul_temp) (struct thermal_zone_device *, unsigned long);
124 int (*get_trend) (struct thermal_zone_device *, int, 127 int (*get_trend) (struct thermal_zone_device *, int,
125 enum thermal_trend *); 128 enum thermal_trend *);
126 int (*notify) (struct thermal_zone_device *, int, 129 int (*notify) (struct thermal_zone_device *, int,
@@ -163,6 +166,7 @@ struct thermal_zone_device {
163 int polling_delay; 166 int polling_delay;
164 int temperature; 167 int temperature;
165 int last_temperature; 168 int last_temperature;
169 int emul_temperature;
166 int passive; 170 int passive;
167 unsigned int forced_passive; 171 unsigned int forced_passive;
168 const struct thermal_zone_device_ops *ops; 172 const struct thermal_zone_device_ops *ops;
@@ -244,9 +248,11 @@ int thermal_register_governor(struct thermal_governor *);
244void thermal_unregister_governor(struct thermal_governor *); 248void thermal_unregister_governor(struct thermal_governor *);
245 249
246#ifdef CONFIG_NET 250#ifdef CONFIG_NET
247extern int thermal_generate_netlink_event(u32 orig, enum events event); 251extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
252 enum events event);
248#else 253#else
249static inline int thermal_generate_netlink_event(u32 orig, enum events event) 254static int thermal_generate_netlink_event(struct thermal_zone_device *tz,
255 enum events event)
250{ 256{
251 return 0; 257 return 0;
252} 258}
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 1a6567b48492..553272e6af55 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -8,6 +8,8 @@
8 8
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/percpu.h>
12#include <linux/hrtimer.h>
11 13
12#ifdef CONFIG_GENERIC_CLOCKEVENTS 14#ifdef CONFIG_GENERIC_CLOCKEVENTS
13 15
@@ -122,13 +124,26 @@ static inline int tick_oneshot_mode_active(void) { return 0; }
122#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 124#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
123 125
124# ifdef CONFIG_NO_HZ 126# ifdef CONFIG_NO_HZ
127DECLARE_PER_CPU(struct tick_sched, tick_cpu_sched);
128
129static inline int tick_nohz_tick_stopped(void)
130{
131 return __this_cpu_read(tick_cpu_sched.tick_stopped);
132}
133
125extern void tick_nohz_idle_enter(void); 134extern void tick_nohz_idle_enter(void);
126extern void tick_nohz_idle_exit(void); 135extern void tick_nohz_idle_exit(void);
127extern void tick_nohz_irq_exit(void); 136extern void tick_nohz_irq_exit(void);
128extern ktime_t tick_nohz_get_sleep_length(void); 137extern ktime_t tick_nohz_get_sleep_length(void);
129extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 138extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
130extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time); 139extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
131# else 140
141# else /* !CONFIG_NO_HZ */
142static inline int tick_nohz_tick_stopped(void)
143{
144 return 0;
145}
146
132static inline void tick_nohz_idle_enter(void) { } 147static inline void tick_nohz_idle_enter(void) { }
133static inline void tick_nohz_idle_exit(void) { } 148static inline void tick_nohz_idle_exit(void) { }
134 149
diff --git a/include/linux/time.h b/include/linux/time.h
index 4d358e9d10f1..d4835dfdf25e 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -115,8 +115,20 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
115 return true; 115 return true;
116} 116}
117 117
118extern bool persistent_clock_exist;
119
120#ifdef ALWAYS_USE_PERSISTENT_CLOCK
121#define has_persistent_clock() true
122#else
123static inline bool has_persistent_clock(void)
124{
125 return persistent_clock_exist;
126}
127#endif
128
118extern void read_persistent_clock(struct timespec *ts); 129extern void read_persistent_clock(struct timespec *ts);
119extern void read_boot_clock(struct timespec *ts); 130extern void read_boot_clock(struct timespec *ts);
131extern int persistent_clock_is_local;
120extern int update_persistent_clock(struct timespec now); 132extern int update_persistent_clock(struct timespec now);
121void timekeeping_init(void); 133void timekeeping_init(void);
122extern int timekeeping_suspended; 134extern int timekeeping_suspended;
@@ -142,9 +154,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
142 * finer then tick granular time. 154 * finer then tick granular time.
143 */ 155 */
144#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET 156#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
145extern u32 arch_gettimeoffset(void); 157extern u32 (*arch_gettimeoffset)(void);
146#else
147static inline u32 arch_gettimeoffset(void) { return 0; }
148#endif 158#endif
149 159
150extern void do_gettimeofday(struct timeval *tv); 160extern void do_gettimeofday(struct timeval *tv);
@@ -158,6 +168,7 @@ extern int do_setitimer(int which, struct itimerval *value,
158 struct itimerval *ovalue); 168 struct itimerval *ovalue);
159extern unsigned int alarm_setitimer(unsigned int seconds); 169extern unsigned int alarm_setitimer(unsigned int seconds);
160extern int do_getitimer(int which, struct itimerval *value); 170extern int do_getitimer(int which, struct itimerval *value);
171extern int __getnstimeofday(struct timespec *tv);
161extern void getnstimeofday(struct timespec *tv); 172extern void getnstimeofday(struct timespec *tv);
162extern void getrawmonotonic(struct timespec *ts); 173extern void getrawmonotonic(struct timespec *ts);
163extern void getnstime_raw_and_real(struct timespec *ts_raw, 174extern void getnstime_raw_and_real(struct timespec *ts_raw,
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
index 44893e5ec8f7..3251965bf4cc 100644
--- a/include/linux/tsacct_kern.h
+++ b/include/linux/tsacct_kern.h
@@ -23,12 +23,15 @@ static inline void bacct_add_tsk(struct user_namespace *user_ns,
23#ifdef CONFIG_TASK_XACCT 23#ifdef CONFIG_TASK_XACCT
24extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p); 24extern void xacct_add_tsk(struct taskstats *stats, struct task_struct *p);
25extern void acct_update_integrals(struct task_struct *tsk); 25extern void acct_update_integrals(struct task_struct *tsk);
26extern void acct_account_cputime(struct task_struct *tsk);
26extern void acct_clear_integrals(struct task_struct *tsk); 27extern void acct_clear_integrals(struct task_struct *tsk);
27#else 28#else
28static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p) 29static inline void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
29{} 30{}
30static inline void acct_update_integrals(struct task_struct *tsk) 31static inline void acct_update_integrals(struct task_struct *tsk)
31{} 32{}
33static inline void acct_account_cputime(struct task_struct *tsk)
34{}
32static inline void acct_clear_integrals(struct task_struct *tsk) 35static inline void acct_clear_integrals(struct task_struct *tsk)
33{} 36{}
34#endif /* CONFIG_TASK_XACCT */ 37#endif /* CONFIG_TASK_XACCT */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 8db1b569c37a..c75d886b0307 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -202,7 +202,8 @@ struct tty_port {
202 unsigned long iflags; /* TTYP_ internal flags */ 202 unsigned long iflags; /* TTYP_ internal flags */
203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */ 203#define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */
204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */ 204#define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */
205 unsigned char console:1; /* port is a console */ 205 unsigned char console:1, /* port is a console */
206 low_latency:1; /* direct buffer flush */
206 struct mutex mutex; /* Locking */ 207 struct mutex mutex; /* Locking */
207 struct mutex buf_mutex; /* Buffer alloc lock */ 208 struct mutex buf_mutex; /* Buffer alloc lock */
208 unsigned char *xmit_buf; /* Optional buffer */ 209 unsigned char *xmit_buf; /* Optional buffer */
@@ -254,7 +255,7 @@ struct tty_struct {
254 int count; 255 int count;
255 struct winsize winsize; /* termios mutex */ 256 struct winsize winsize; /* termios mutex */
256 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 257 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
257 unsigned char low_latency:1, warned:1; 258 unsigned char warned:1;
258 unsigned char ctrl_status; /* ctrl_lock */ 259 unsigned char ctrl_status; /* ctrl_lock */
259 unsigned int receive_room; /* Bytes free for queue */ 260 unsigned int receive_room; /* Bytes free for queue */
260 261
@@ -317,11 +318,43 @@ struct tty_file_private {
317 318
318#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 319#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
319 320
321#ifdef CONFIG_TTY
322extern void console_init(void);
323extern void tty_kref_put(struct tty_struct *tty);
324extern struct pid *tty_get_pgrp(struct tty_struct *tty);
325extern void tty_vhangup_self(void);
326extern void disassociate_ctty(int priv);
327extern dev_t tty_devnum(struct tty_struct *tty);
328extern void proc_clear_tty(struct task_struct *p);
329extern struct tty_struct *get_current_tty(void);
330/* tty_io.c */
331extern int __init tty_init(void);
332#else
333static inline void console_init(void)
334{ }
335static inline void tty_kref_put(struct tty_struct *tty)
336{ }
337static inline struct pid *tty_get_pgrp(struct tty_struct *tty)
338{ return NULL; }
339static inline void tty_vhangup_self(void)
340{ }
341static inline void disassociate_ctty(int priv)
342{ }
343static inline dev_t tty_devnum(struct tty_struct *tty)
344{ return 0; }
345static inline void proc_clear_tty(struct task_struct *p)
346{ }
347static inline struct tty_struct *get_current_tty(void)
348{ return NULL; }
349/* tty_io.c */
350static inline int __init tty_init(void)
351{ return 0; }
352#endif
353
320extern void tty_write_flush(struct tty_struct *); 354extern void tty_write_flush(struct tty_struct *);
321 355
322extern struct ktermios tty_std_termios; 356extern struct ktermios tty_std_termios;
323 357
324extern void console_init(void);
325extern int vcs_init(void); 358extern int vcs_init(void);
326 359
327extern struct class *tty_class; 360extern struct class *tty_class;
@@ -341,7 +374,6 @@ static inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
341 kref_get(&tty->kref); 374 kref_get(&tty->kref);
342 return tty; 375 return tty;
343} 376}
344extern void tty_kref_put(struct tty_struct *tty);
345 377
346extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 378extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
347 const char *routine); 379 const char *routine);
@@ -373,20 +405,16 @@ extern void tty_driver_remove_tty(struct tty_driver *driver,
373 struct tty_struct *tty); 405 struct tty_struct *tty);
374extern void tty_free_termios(struct tty_struct *tty); 406extern void tty_free_termios(struct tty_struct *tty);
375extern int is_current_pgrp_orphaned(void); 407extern int is_current_pgrp_orphaned(void);
376extern struct pid *tty_get_pgrp(struct tty_struct *tty);
377extern int is_ignored(int sig); 408extern int is_ignored(int sig);
378extern int tty_signal(int sig, struct tty_struct *tty); 409extern int tty_signal(int sig, struct tty_struct *tty);
379extern void tty_hangup(struct tty_struct *tty); 410extern void tty_hangup(struct tty_struct *tty);
380extern void tty_vhangup(struct tty_struct *tty); 411extern void tty_vhangup(struct tty_struct *tty);
381extern void tty_vhangup_locked(struct tty_struct *tty); 412extern void tty_vhangup_locked(struct tty_struct *tty);
382extern void tty_vhangup_self(void);
383extern void tty_unhangup(struct file *filp); 413extern void tty_unhangup(struct file *filp);
384extern int tty_hung_up_p(struct file *filp); 414extern int tty_hung_up_p(struct file *filp);
385extern void do_SAK(struct tty_struct *tty); 415extern void do_SAK(struct tty_struct *tty);
386extern void __do_SAK(struct tty_struct *tty); 416extern void __do_SAK(struct tty_struct *tty);
387extern void disassociate_ctty(int priv);
388extern void no_tty(void); 417extern void no_tty(void);
389extern void tty_flip_buffer_push(struct tty_struct *tty);
390extern void tty_flush_to_ldisc(struct tty_struct *tty); 418extern void tty_flush_to_ldisc(struct tty_struct *tty);
391extern void tty_buffer_free_all(struct tty_port *port); 419extern void tty_buffer_free_all(struct tty_port *port);
392extern void tty_buffer_flush(struct tty_struct *tty); 420extern void tty_buffer_flush(struct tty_struct *tty);
@@ -415,9 +443,6 @@ extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
415extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 443extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
416 unsigned int cmd, unsigned long arg); 444 unsigned int cmd, unsigned long arg);
417extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 445extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
418extern dev_t tty_devnum(struct tty_struct *tty);
419extern void proc_clear_tty(struct task_struct *p);
420extern struct tty_struct *get_current_tty(void);
421extern void tty_default_fops(struct file_operations *fops); 446extern void tty_default_fops(struct file_operations *fops);
422extern struct tty_struct *alloc_tty_struct(void); 447extern struct tty_struct *alloc_tty_struct(void);
423extern int tty_alloc_file(struct file *file); 448extern int tty_alloc_file(struct file *file);
@@ -543,9 +568,6 @@ static inline int tty_audit_push_task(struct task_struct *tsk,
543} 568}
544#endif 569#endif
545 570
546/* tty_io.c */
547extern int __init tty_init(void);
548
549/* tty_ioctl.c */ 571/* tty_ioctl.c */
550extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, 572extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
551 unsigned int cmd, unsigned long arg); 573 unsigned int cmd, unsigned long arg);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index dd976cfb6131..756a60989294 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -40,6 +40,7 @@
40 * void (*close)(struct tty_struct * tty, struct file * filp); 40 * void (*close)(struct tty_struct * tty, struct file * filp);
41 * 41 *
42 * This routine is called when a particular tty device is closed. 42 * This routine is called when a particular tty device is closed.
43 * Note: called even if the corresponding open() failed.
43 * 44 *
44 * Required method. 45 * Required method.
45 * 46 *
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 2002344ed36a..e0f252633b47 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,28 +1,34 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); 4extern int tty_buffer_request_room(struct tty_port *port, size_t size);
5extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); 5extern int tty_insert_flip_string_flags(struct tty_port *port,
6extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); 6 const unsigned char *chars, const char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); 7extern int tty_insert_flip_string_fixed_flag(struct tty_port *port,
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); 8 const unsigned char *chars, char flag, size_t size);
9void tty_schedule_flip(struct tty_struct *tty); 9extern int tty_prepare_flip_string(struct tty_port *port,
10 unsigned char **chars, size_t size);
11extern int tty_prepare_flip_string_flags(struct tty_port *port,
12 unsigned char **chars, char **flags, size_t size);
13extern void tty_flip_buffer_push(struct tty_port *port);
14void tty_schedule_flip(struct tty_port *port);
10 15
11static inline int tty_insert_flip_char(struct tty_struct *tty, 16static inline int tty_insert_flip_char(struct tty_port *port,
12 unsigned char ch, char flag) 17 unsigned char ch, char flag)
13{ 18{
14 struct tty_buffer *tb = tty->port->buf.tail; 19 struct tty_buffer *tb = port->buf.tail;
15 if (tb && tb->used < tb->size) { 20 if (tb && tb->used < tb->size) {
16 tb->flag_buf_ptr[tb->used] = flag; 21 tb->flag_buf_ptr[tb->used] = flag;
17 tb->char_buf_ptr[tb->used++] = ch; 22 tb->char_buf_ptr[tb->used++] = ch;
18 return 1; 23 return 1;
19 } 24 }
20 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 25 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
21} 26}
22 27
23static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) 28static inline int tty_insert_flip_string(struct tty_port *port,
29 const unsigned char *chars, size_t size)
24{ 30{
25 return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); 31 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
26} 32}
27 33
28#endif /* _LINUX_TTY_FLIP_H */ 34#endif /* _LINUX_TTY_FLIP_H */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index fb79dd8d1537..455a0d7bf220 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -100,16 +100,14 @@
100 * seek to perform this action quickly but should wait until 100 * seek to perform this action quickly but should wait until
101 * any pending driver I/O is completed. 101 * any pending driver I/O is completed.
102 * 102 *
103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status, 103 * void (*dcd_change)(struct tty_struct *tty, unsigned int status)
104 * struct pps_event_time *ts)
105 * 104 *
106 * Tells the discipline that the DCD pin has changed its status and 105 * Tells the discipline that the DCD pin has changed its status.
107 * the relative timestamp. Pointer ts cannot be NULL. 106 * Used exclusively by the N_PPS (Pulse-Per-Second) line discipline.
108 */ 107 */
109 108
110#include <linux/fs.h> 109#include <linux/fs.h>
111#include <linux/wait.h> 110#include <linux/wait.h>
112#include <linux/pps_kernel.h>
113#include <linux/wait.h> 111#include <linux/wait.h>
114 112
115struct tty_ldisc_ops { 113struct tty_ldisc_ops {
@@ -144,8 +142,7 @@ struct tty_ldisc_ops {
144 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 142 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
145 char *fp, int count); 143 char *fp, int count);
146 void (*write_wakeup)(struct tty_struct *); 144 void (*write_wakeup)(struct tty_struct *);
147 void (*dcd_change)(struct tty_struct *, unsigned int, 145 void (*dcd_change)(struct tty_struct *, unsigned int);
148 struct pps_event_time *);
149 146
150 struct module *owner; 147 struct module *owner;
151 148
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4f628a6fc5b4..02b83db8e2c5 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -35,13 +35,20 @@ struct inode;
35# include <asm/uprobes.h> 35# include <asm/uprobes.h>
36#endif 36#endif
37 37
38#define UPROBE_HANDLER_REMOVE 1
39#define UPROBE_HANDLER_MASK 1
40
41enum uprobe_filter_ctx {
42 UPROBE_FILTER_REGISTER,
43 UPROBE_FILTER_UNREGISTER,
44 UPROBE_FILTER_MMAP,
45};
46
38struct uprobe_consumer { 47struct uprobe_consumer {
39 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); 48 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
40 /* 49 bool (*filter)(struct uprobe_consumer *self,
41 * filter is optional; If a filter exists, handler is run 50 enum uprobe_filter_ctx ctx,
42 * if and only if filter returns true. 51 struct mm_struct *mm);
43 */
44 bool (*filter)(struct uprobe_consumer *self, struct task_struct *task);
45 52
46 struct uprobe_consumer *next; 53 struct uprobe_consumer *next;
47}; 54};
@@ -94,6 +101,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
94extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
95extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
96extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 103extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
104extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
97extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 105extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
98extern int uprobe_mmap(struct vm_area_struct *vma); 106extern int uprobe_mmap(struct vm_area_struct *vma);
99extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); 107extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
@@ -117,6 +125,11 @@ uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
117{ 125{
118 return -ENOSYS; 126 return -ENOSYS;
119} 127}
128static inline int
129uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool add)
130{
131 return -ENOSYS;
132}
120static inline void 133static inline void
121uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) 134uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
122{ 135{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 689b14b26c8d..4d22d0f6167a 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -357,6 +357,8 @@ struct usb_bus {
357 int bandwidth_int_reqs; /* number of Interrupt requests */ 357 int bandwidth_int_reqs; /* number of Interrupt requests */
358 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 358 int bandwidth_isoc_reqs; /* number of Isoc. requests */
359 359
360 unsigned resuming_ports; /* bit array: resuming root-hub ports */
361
360#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 362#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
361 struct mon_bus *mon_bus; /* non-null when associated */ 363 struct mon_bus *mon_bus; /* non-null when associated */
362 int monitored; /* non-zero when monitored */ 364 int monitored; /* non-zero when monitored */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b09c37e04a91..3c671c1b37f6 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -77,6 +77,8 @@ struct usb_configuration;
77 * in interface or class descriptors; endpoints; I/O buffers; and so on. 77 * in interface or class descriptors; endpoints; I/O buffers; and so on.
78 * @unbind: Reverses @bind; called as a side effect of unregistering the 78 * @unbind: Reverses @bind; called as a side effect of unregistering the
79 * driver which added this function. 79 * driver which added this function.
80 * @free_func: free the struct usb_function.
81 * @mod: (internal) points to the module that created this structure.
80 * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may 82 * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
81 * initialize usb_ep.driver data at this time (when it is used). 83 * initialize usb_ep.driver data at this time (when it is used).
82 * Note that setting an interface to its current altsetting resets 84 * Note that setting an interface to its current altsetting resets
@@ -116,6 +118,7 @@ struct usb_configuration;
116 * two or more distinct instances within the same configuration, providing 118 * two or more distinct instances within the same configuration, providing
117 * several independent logical data links to a USB host. 119 * several independent logical data links to a USB host.
118 */ 120 */
121
119struct usb_function { 122struct usb_function {
120 const char *name; 123 const char *name;
121 struct usb_gadget_strings **strings; 124 struct usb_gadget_strings **strings;
@@ -136,6 +139,8 @@ struct usb_function {
136 struct usb_function *); 139 struct usb_function *);
137 void (*unbind)(struct usb_configuration *, 140 void (*unbind)(struct usb_configuration *,
138 struct usb_function *); 141 struct usb_function *);
142 void (*free_func)(struct usb_function *f);
143 struct module *mod;
139 144
140 /* runtime state management */ 145 /* runtime state management */
141 int (*set_alt)(struct usb_function *, 146 int (*set_alt)(struct usb_function *,
@@ -156,6 +161,7 @@ struct usb_function {
156 /* internals */ 161 /* internals */
157 struct list_head list; 162 struct list_head list;
158 DECLARE_BITMAP(endpoints, 32); 163 DECLARE_BITMAP(endpoints, 32);
164 const struct usb_function_instance *fi;
159}; 165};
160 166
161int usb_add_function(struct usb_configuration *, struct usb_function *); 167int usb_add_function(struct usb_configuration *, struct usb_function *);
@@ -184,7 +190,8 @@ int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
184 * @bConfigurationValue: Copied into configuration descriptor. 190 * @bConfigurationValue: Copied into configuration descriptor.
185 * @iConfiguration: Copied into configuration descriptor. 191 * @iConfiguration: Copied into configuration descriptor.
186 * @bmAttributes: Copied into configuration descriptor. 192 * @bmAttributes: Copied into configuration descriptor.
187 * @bMaxPower: Copied into configuration descriptor. 193 * @MaxPower: Power consumtion in mA. Used to compute bMaxPower in the
194 * configuration descriptor after considering the bus speed.
188 * @cdev: assigned by @usb_add_config() before calling @bind(); this is 195 * @cdev: assigned by @usb_add_config() before calling @bind(); this is
189 * the device associated with this configuration. 196 * the device associated with this configuration.
190 * 197 *
@@ -230,7 +237,7 @@ struct usb_configuration {
230 u8 bConfigurationValue; 237 u8 bConfigurationValue;
231 u8 iConfiguration; 238 u8 iConfiguration;
232 u8 bmAttributes; 239 u8 bmAttributes;
233 u8 bMaxPower; 240 u16 MaxPower;
234 241
235 struct usb_composite_dev *cdev; 242 struct usb_composite_dev *cdev;
236 243
@@ -316,7 +323,15 @@ struct usb_composite_driver {
316extern int usb_composite_probe(struct usb_composite_driver *driver); 323extern int usb_composite_probe(struct usb_composite_driver *driver);
317extern void usb_composite_unregister(struct usb_composite_driver *driver); 324extern void usb_composite_unregister(struct usb_composite_driver *driver);
318extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 325extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
326extern int composite_dev_prepare(struct usb_composite_driver *composite,
327 struct usb_composite_dev *cdev);
328void composite_dev_cleanup(struct usb_composite_dev *cdev);
319 329
330static inline struct usb_composite_driver *to_cdriver(
331 struct usb_gadget_driver *gdrv)
332{
333 return container_of(gdrv, struct usb_composite_driver, gadget_driver);
334}
320 335
321/** 336/**
322 * struct usb_composite_device - represents one composite usb gadget 337 * struct usb_composite_device - represents one composite usb gadget
@@ -360,6 +375,7 @@ struct usb_composite_dev {
360 unsigned int suspended:1; 375 unsigned int suspended:1;
361 struct usb_device_descriptor desc; 376 struct usb_device_descriptor desc;
362 struct list_head configs; 377 struct list_head configs;
378 struct list_head gstrings;
363 struct usb_composite_driver *driver; 379 struct usb_composite_driver *driver;
364 u8 next_string_id; 380 u8 next_string_id;
365 char *def_manufacturer; 381 char *def_manufacturer;
@@ -381,8 +397,15 @@ struct usb_composite_dev {
381extern int usb_string_id(struct usb_composite_dev *c); 397extern int usb_string_id(struct usb_composite_dev *c);
382extern int usb_string_ids_tab(struct usb_composite_dev *c, 398extern int usb_string_ids_tab(struct usb_composite_dev *c,
383 struct usb_string *str); 399 struct usb_string *str);
400extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev,
401 struct usb_gadget_strings **sp, unsigned n_strings);
402
384extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 403extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
385 404
405extern void composite_disconnect(struct usb_gadget *gadget);
406extern int composite_setup(struct usb_gadget *gadget,
407 const struct usb_ctrlrequest *ctrl);
408
386/* 409/*
387 * Some systems will need runtime overrides for the product identifiers 410 * Some systems will need runtime overrides for the product identifiers
388 * published in the device descriptor, either numbers or strings or both. 411 * published in the device descriptor, either numbers or strings or both.
@@ -431,6 +454,54 @@ static inline u16 get_default_bcdDevice(void)
431 return bcdDevice; 454 return bcdDevice;
432} 455}
433 456
457struct usb_function_driver {
458 const char *name;
459 struct module *mod;
460 struct list_head list;
461 struct usb_function_instance *(*alloc_inst)(void);
462 struct usb_function *(*alloc_func)(struct usb_function_instance *inst);
463};
464
465struct usb_function_instance {
466 struct usb_function_driver *fd;
467 void (*free_func_inst)(struct usb_function_instance *inst);
468};
469
470void usb_function_unregister(struct usb_function_driver *f);
471int usb_function_register(struct usb_function_driver *newf);
472void usb_put_function_instance(struct usb_function_instance *fi);
473void usb_put_function(struct usb_function *f);
474struct usb_function_instance *usb_get_function_instance(const char *name);
475struct usb_function *usb_get_function(struct usb_function_instance *fi);
476
477struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev,
478 int val);
479int usb_add_config_only(struct usb_composite_dev *cdev,
480 struct usb_configuration *config);
481void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
482
483#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
484 static struct usb_function_driver _name ## usb_func = { \
485 .name = __stringify(_name), \
486 .mod = THIS_MODULE, \
487 .alloc_inst = _inst_alloc, \
488 .alloc_func = _func_alloc, \
489 }; \
490 MODULE_ALIAS("usbfunc:"__stringify(_name));
491
492#define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc) \
493 DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
494 static int __init _name ## mod_init(void) \
495 { \
496 return usb_function_register(&_name ## usb_func); \
497 } \
498 static void __exit _name ## mod_exit(void) \
499 { \
500 usb_function_unregister(&_name ## usb_func); \
501 } \
502 module_init(_name ## mod_init); \
503 module_exit(_name ## mod_exit)
504
434/* messaging utils */ 505/* messaging utils */
435#define DBG(d, fmt, args...) \ 506#define DBG(d, fmt, args...) \
436 dev_dbg(&(d)->gadget->dev , fmt , ## args) 507 dev_dbg(&(d)->gadget->dev , fmt , ## args)
diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h
new file mode 100644
index 000000000000..51eae14477f7
--- /dev/null
+++ b/include/linux/usb/dwc3-omap.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2013 by Texas Instruments
3 *
4 * The Inventra Controller Driver for Linux is free software; you
5 * can redistribute it and/or modify it under the terms of the GNU
6 * General Public License version 2 as published by the Free Software
7 * Foundation.
8 */
9
10#ifndef __DWC3_OMAP_H__
11#define __DWC3_OMAP_H__
12
13enum omap_dwc3_vbus_id_status {
14 OMAP_DWC3_UNKNOWN = 0,
15 OMAP_DWC3_ID_GROUND,
16 OMAP_DWC3_ID_FLOAT,
17 OMAP_DWC3_VBUS_VALID,
18 OMAP_DWC3_VBUS_OFF,
19};
20
21#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
22extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
23#else
24static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
25{
26 return;
27}
28#endif
29
30#endif /* __DWC3_OMAP_H__ */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0af6569b8cc6..2e297e80d59a 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -471,12 +471,6 @@ struct usb_gadget_ops {
471 struct usb_gadget_driver *); 471 struct usb_gadget_driver *);
472 int (*udc_stop)(struct usb_gadget *, 472 int (*udc_stop)(struct usb_gadget *,
473 struct usb_gadget_driver *); 473 struct usb_gadget_driver *);
474
475 /* Those two are deprecated */
476 int (*start)(struct usb_gadget_driver *,
477 int (*bind)(struct usb_gadget *,
478 struct usb_gadget_driver *driver));
479 int (*stop)(struct usb_gadget_driver *);
480}; 474};
481 475
482/** 476/**
@@ -880,6 +874,8 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
880 874
881extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); 875extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
882extern void usb_del_gadget_udc(struct usb_gadget *gadget); 876extern void usb_del_gadget_udc(struct usb_gadget *gadget);
877extern int udc_attach_driver(const char *name,
878 struct usb_gadget_driver *driver);
883 879
884/*-------------------------------------------------------------------------*/ 880/*-------------------------------------------------------------------------*/
885 881
@@ -911,6 +907,11 @@ struct usb_gadget_strings {
911 struct usb_string *strings; 907 struct usb_string *strings;
912}; 908};
913 909
910struct usb_gadget_string_container {
911 struct list_head list;
912 u8 *stash[0];
913};
914
914/* put descriptor for string with that id into buf (buflen >= 256) */ 915/* put descriptor for string with that id into buf (buflen >= 256) */
915int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); 916int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
916 917
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 608050b2545f..0a78df5f6cfd 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -430,6 +430,9 @@ extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
430extern void usb_wakeup_notification(struct usb_device *hdev, 430extern void usb_wakeup_notification(struct usb_device *hdev,
431 unsigned int portnum); 431 unsigned int portnum);
432 432
433extern void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum);
434extern void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum);
435
433/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 436/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
434#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 437#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
435#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) 438#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index eb505250940a..053c26841cc3 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,6 +99,8 @@ struct musb_hdrc_platform_data {
99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ 99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
100 u8 mode; 100 u8 mode;
101 101
102 u8 has_mailbox:1;
103
102 /* for clk_get() */ 104 /* for clk_get() */
103 const char *clock; 105 const char *clock;
104 106
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
new file mode 100644
index 000000000000..27b5b8c931b0
--- /dev/null
+++ b/include/linux/usb/omap_control_usb.h
@@ -0,0 +1,92 @@
1/*
2 * omap_control_usb.h - Header file for the USB part of control module.
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
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
19#ifndef __OMAP_CONTROL_USB_H__
20#define __OMAP_CONTROL_USB_H__
21
22struct omap_control_usb {
23 struct device *dev;
24
25 u32 __iomem *dev_conf;
26 u32 __iomem *otghs_control;
27 u32 __iomem *phy_power;
28
29 struct clk *sys_clk;
30
31 u32 type;
32};
33
34struct omap_control_usb_platform_data {
35 u8 type;
36};
37
38enum omap_control_usb_mode {
39 USB_MODE_UNDEFINED = 0,
40 USB_MODE_HOST,
41 USB_MODE_DEVICE,
42 USB_MODE_DISCONNECT,
43};
44
45/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
46#define OMAP_CTRL_DEV_TYPE1 0x1
47#define OMAP_CTRL_DEV_TYPE2 0x2
48
49#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50
51#define OMAP_CTRL_DEV_AVALID BIT(0)
52#define OMAP_CTRL_DEV_BVALID BIT(1)
53#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
54#define OMAP_CTRL_DEV_SESSEND BIT(3)
55#define OMAP_CTRL_DEV_IDDIG BIT(4)
56
57#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
58#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
59
60#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
61#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
62
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
65
66#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
67extern struct device *omap_get_control_dev(void);
68extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb3_phy_power(struct device *dev, bool on);
70extern void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode);
72#else
73static inline struct device *omap_get_control_dev(void)
74{
75 return ERR_PTR(-ENODEV);
76}
77
78static inline void omap_control_usb_phy_power(struct device *dev, int on)
79{
80}
81
82static inline void omap_control_usb3_phy_power(struct device *dev, int on)
83{
84}
85
86static inline void omap_control_usb_set_mode(struct device *dev,
87 enum omap_control_usb_mode mode)
88{
89}
90#endif
91
92#endif /* __OMAP_CONTROL_USB_H__ */
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 0ea17f8ae820..6ae29360e1d2 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -19,19 +19,29 @@
19#ifndef __DRIVERS_OMAP_USB2_H 19#ifndef __DRIVERS_OMAP_USB2_H
20#define __DRIVERS_OMAP_USB2_H 20#define __DRIVERS_OMAP_USB2_H
21 21
22#include <linux/io.h>
22#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
23 24
25struct usb_dpll_params {
26 u16 m;
27 u8 n;
28 u8 freq:3;
29 u8 sd;
30 u32 mf;
31};
32
24struct omap_usb { 33struct omap_usb {
25 struct usb_phy phy; 34 struct usb_phy phy;
26 struct phy_companion *comparator; 35 struct phy_companion *comparator;
36 void __iomem *pll_ctrl_base;
27 struct device *dev; 37 struct device *dev;
28 u32 __iomem *control_dev; 38 struct device *control_dev;
29 struct clk *wkupclk; 39 struct clk *wkupclk;
40 struct clk *sys_clk;
41 struct clk *optclk;
30 u8 is_suspended:1; 42 u8 is_suspended:1;
31}; 43};
32 44
33#define PHY_PD 0x1
34
35#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 45#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
36 46
37#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 47#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
@@ -43,4 +53,15 @@ static inline int omap_usb2_set_comparator(struct phy_companion *comparator)
43} 53}
44#endif 54#endif
45 55
56static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset)
57{
58 return __raw_readl(addr + offset);
59}
60
61static inline void omap_usb_writel(void __iomem *addr, unsigned offset,
62 u32 data)
63{
64 __raw_writel(data, addr + offset);
65}
66
46#endif /* __DRIVERS_OMAP_USB_H */ 67#endif /* __DRIVERS_OMAP_USB_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index a29ae1eb9346..15847cbdb512 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -106,9 +106,25 @@ struct usb_phy {
106 enum usb_device_speed speed); 106 enum usb_device_speed speed);
107}; 107};
108 108
109/**
110 * struct usb_phy_bind - represent the binding for the phy
111 * @dev_name: the device name of the device that will bind to the phy
112 * @phy_dev_name: the device name of the phy
113 * @index: used if a single controller uses multiple phys
114 * @phy: reference to the phy
115 * @list: to maintain a linked list of the binding information
116 */
117struct usb_phy_bind {
118 const char *dev_name;
119 const char *phy_dev_name;
120 u8 index;
121 struct usb_phy *phy;
122 struct list_head list;
123};
109 124
110/* for board-specific init logic */ 125/* for board-specific init logic */
111extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type); 126extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
127extern int usb_add_phy_dev(struct usb_phy *);
112extern void usb_remove_phy(struct usb_phy *); 128extern void usb_remove_phy(struct usb_phy *);
113 129
114/* helpers for direct access thru low-level io interface */ 130/* helpers for direct access thru low-level io interface */
@@ -149,8 +165,14 @@ usb_phy_shutdown(struct usb_phy *x)
149extern struct usb_phy *usb_get_phy(enum usb_phy_type type); 165extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
150extern struct usb_phy *devm_usb_get_phy(struct device *dev, 166extern struct usb_phy *devm_usb_get_phy(struct device *dev,
151 enum usb_phy_type type); 167 enum usb_phy_type type);
168extern struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index);
169extern struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index);
170extern struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
171 const char *phandle, u8 index);
152extern void usb_put_phy(struct usb_phy *); 172extern void usb_put_phy(struct usb_phy *);
153extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x); 173extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
174extern int usb_bind_phy(const char *dev_name, u8 index,
175 const char *phy_dev_name);
154#else 176#else
155static inline struct usb_phy *usb_get_phy(enum usb_phy_type type) 177static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
156{ 178{
@@ -163,6 +185,22 @@ static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
163 return NULL; 185 return NULL;
164} 186}
165 187
188static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
189{
190 return NULL;
191}
192
193static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
194{
195 return NULL;
196}
197
198static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
199 const char *phandle, u8 index)
200{
201 return NULL;
202}
203
166static inline void usb_put_phy(struct usb_phy *x) 204static inline void usb_put_phy(struct usb_phy *x)
167{ 205{
168} 206}
@@ -171,6 +209,11 @@ static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x)
171{ 209{
172} 210}
173 211
212static inline int usb_bind_phy(const char *dev_name, u8 index,
213 const char *phy_dev_name)
214{
215 return -EOPNOTSUPP;
216}
174#endif 217#endif
175 218
176static inline int 219static inline int
diff --git a/include/linux/usb/samsung_usb_phy.h b/include/linux/usb/samsung_usb_phy.h
new file mode 100644
index 000000000000..916782699f1c
--- /dev/null
+++ b/include/linux/usb/samsung_usb_phy.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2012 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * Defines phy types for samsung usb phy controllers - HOST or DEIVCE.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13enum samsung_usb_phy_type {
14 USB_PHY_TYPE_DEVICE,
15 USB_PHY_TYPE_HOST,
16};
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index 176b1ca06ae4..9ebebe906925 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -59,22 +59,24 @@ struct tegra_usb_phy {
59 struct usb_phy *ulpi; 59 struct usb_phy *ulpi;
60 struct usb_phy u_phy; 60 struct usb_phy u_phy;
61 struct device *dev; 61 struct device *dev;
62 bool is_legacy_phy;
63 bool is_ulpi_phy;
62}; 64};
63 65
64struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, 66struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
65 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); 67 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode);
66 68
67void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy); 69void tegra_usb_phy_preresume(struct usb_phy *phy);
68 70
69void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy); 71void tegra_usb_phy_postresume(struct usb_phy *phy);
70 72
71void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); 73void tegra_ehci_phy_restore_start(struct usb_phy *phy,
74 enum tegra_usb_phy_port_speed port_speed);
72 75
73void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); 76void tegra_ehci_phy_restore_end(struct usb_phy *phy);
74 77
75void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, 78void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val);
76 enum tegra_usb_phy_port_speed port_speed);
77 79
78void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); 80void tegra_ehci_set_phcd(struct usb_phy *x, bool enable);
79 81
80#endif /* __TEGRA_USB_PHY_H */ 82#endif /* __TEGRA_USB_PHY_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7bedc8..0e5ac93bab10 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -33,6 +33,7 @@ struct usbnet {
33 wait_queue_head_t *wait; 33 wait_queue_head_t *wait;
34 struct mutex phy_mutex; 34 struct mutex phy_mutex;
35 unsigned char suspend_count; 35 unsigned char suspend_count;
36 unsigned char pkt_cnt, pkt_err;
36 37
37 /* i/o info: pipes etc */ 38 /* i/o info: pipes etc */
38 unsigned in, out; 39 unsigned in, out;
@@ -70,6 +71,7 @@ struct usbnet {
70# define EVENT_DEV_OPEN 7 71# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8 72# define EVENT_DEVICE_REPORT_IDLE 8
72# define EVENT_NO_RUNTIME_PM 9 73# define EVENT_NO_RUNTIME_PM 9
74# define EVENT_RX_KILL 10
73}; 75};
74 76
75static inline struct usb_driver *driver_of(struct usb_interface *intf) 77static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -107,6 +109,7 @@ struct driver_info {
107 */ 109 */
108#define FLAG_MULTI_PACKET 0x2000 110#define FLAG_MULTI_PACKET 0x2000
109#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ 111#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
112#define FLAG_NOARP 0x8000 /* device can't do ARP */
110 113
111 /* init device ... can sleep, or cause probe() failure */ 114 /* init device ... can sleep, or cause probe() failure */
112 int (*bind)(struct usbnet *, struct usb_interface *); 115 int (*bind)(struct usbnet *, struct usb_interface *);
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b9bd2e6c73cc..4ce009324933 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -21,7 +21,7 @@ struct user_namespace {
21 struct uid_gid_map uid_map; 21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map; 22 struct uid_gid_map gid_map;
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 struct kref kref; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 kuid_t owner; 26 kuid_t owner;
27 kgid_t group; 27 kgid_t group;
@@ -35,18 +35,18 @@ extern struct user_namespace init_user_ns;
35static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 35static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
36{ 36{
37 if (ns) 37 if (ns)
38 kref_get(&ns->kref); 38 atomic_inc(&ns->count);
39 return ns; 39 return ns;
40} 40}
41 41
42extern int create_user_ns(struct cred *new); 42extern int create_user_ns(struct cred *new);
43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred); 43extern int unshare_userns(unsigned long unshare_flags, struct cred **new_cred);
44extern void free_user_ns(struct kref *kref); 44extern void free_user_ns(struct user_namespace *ns);
45 45
46static inline void put_user_ns(struct user_namespace *ns) 46static inline void put_user_ns(struct user_namespace *ns)
47{ 47{
48 if (ns) 48 if (ns && atomic_dec_and_test(&ns->count))
49 kref_put(&ns->kref, free_user_ns); 49 free_user_ns(ns);
50} 50}
51 51
52struct seq_operations; 52struct seq_operations;
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index c52215ff4245..75818744ab59 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -27,6 +27,14 @@
27#define VEXPRESS_GPIO_MMC_CARDIN 0 27#define VEXPRESS_GPIO_MMC_CARDIN 0
28#define VEXPRESS_GPIO_MMC_WPROT 1 28#define VEXPRESS_GPIO_MMC_WPROT 1
29#define VEXPRESS_GPIO_FLASH_WPn 2 29#define VEXPRESS_GPIO_FLASH_WPn 2
30#define VEXPRESS_GPIO_LED0 3
31#define VEXPRESS_GPIO_LED1 4
32#define VEXPRESS_GPIO_LED2 5
33#define VEXPRESS_GPIO_LED3 6
34#define VEXPRESS_GPIO_LED4 7
35#define VEXPRESS_GPIO_LED5 8
36#define VEXPRESS_GPIO_LED6 9
37#define VEXPRESS_GPIO_LED7 10
30 38
31#define VEXPRESS_RES_FUNC(_site, _func) \ 39#define VEXPRESS_RES_FUNC(_site, _func) \
32{ \ 40{ \
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index cf8adb1f5b2c..ff6714e6d0f5 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -78,7 +78,7 @@ struct virtio_device {
78 int index; 78 int index;
79 struct device dev; 79 struct device dev;
80 struct virtio_device_id id; 80 struct virtio_device_id id;
81 struct virtio_config_ops *config; 81 const struct virtio_config_ops *config;
82 struct list_head vqs; 82 struct list_head vqs;
83 /* Note that this is a Linux set_bit-style bitmap. */ 83 /* Note that this is a Linux set_bit-style bitmap. */
84 unsigned long features[1]; 84 unsigned long features[1];
@@ -126,4 +126,13 @@ static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
126 126
127int register_virtio_driver(struct virtio_driver *drv); 127int register_virtio_driver(struct virtio_driver *drv);
128void unregister_virtio_driver(struct virtio_driver *drv); 128void unregister_virtio_driver(struct virtio_driver *drv);
129
130/* module_virtio_driver() - Helper macro for drivers that don't do
131 * anything special in module init/exit. This eliminates a lot of
132 * boilerplate. Each module may only use this macro once, and
133 * calling it replaces module_init() and module_exit()
134 */
135#define module_virtio_driver(__virtio_driver) \
136 module_driver(__virtio_driver, register_virtio_driver, \
137 unregister_virtio_driver)
129#endif /* _LINUX_VIRTIO_H */ 138#endif /* _LINUX_VIRTIO_H */
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index fce0a2799d43..bd6cf61142be 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -36,7 +36,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36#endif 36#endif
37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, 37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 KSWAPD_SKIP_CONGESTION_WAIT,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 39 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_NUMA_BALANCING 40#ifdef CONFIG_NUMA_BALANCING
42 NUMA_PTE_UPDATES, 41 NUMA_PTE_UPDATES,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index a13291f7da88..5fd71a7d0dfd 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -85,7 +85,7 @@ static inline void vm_events_fold_cpu(int cpu)
85#define count_vm_numa_events(x, y) count_vm_events(x, y) 85#define count_vm_numa_events(x, y) count_vm_events(x, y)
86#else 86#else
87#define count_vm_numa_event(x) do {} while (0) 87#define count_vm_numa_event(x) do {} while (0)
88#define count_vm_numa_events(x, y) do {} while (0) 88#define count_vm_numa_events(x, y) do { (void)(y); } while (0)
89#endif /* CONFIG_NUMA_BALANCING */ 89#endif /* CONFIG_NUMA_BALANCING */
90 90
91#define __count_zone_vm_events(item, zone, delta) \ 91#define __count_zone_vm_events(item, zone, delta) \
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
new file mode 100644
index 000000000000..023430e265fe
--- /dev/null
+++ b/include/linux/vmw_vmci_api.h
@@ -0,0 +1,82 @@
1/*
2 * VMware VMCI Driver
3 *
4 * Copyright (C) 2012 VMware, Inc. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation version 2 and no 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 MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#ifndef __VMW_VMCI_API_H__
17#define __VMW_VMCI_API_H__
18
19#include <linux/uidgid.h>
20#include <linux/vmw_vmci_defs.h>
21
22#undef VMCI_KERNEL_API_VERSION
23#define VMCI_KERNEL_API_VERSION_1 1
24#define VMCI_KERNEL_API_VERSION_2 2
25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
26
27typedef void (vmci_device_shutdown_fn) (void *device_registration,
28 void *user_data);
29
30int vmci_datagram_create_handle(u32 resource_id, u32 flags,
31 vmci_datagram_recv_cb recv_cb,
32 void *client_data,
33 struct vmci_handle *out_handle);
34int vmci_datagram_create_handle_priv(u32 resource_id, u32 flags, u32 priv_flags,
35 vmci_datagram_recv_cb recv_cb,
36 void *client_data,
37 struct vmci_handle *out_handle);
38int vmci_datagram_destroy_handle(struct vmci_handle handle);
39int vmci_datagram_send(struct vmci_datagram *msg);
40int vmci_doorbell_create(struct vmci_handle *handle, u32 flags,
41 u32 priv_flags,
42 vmci_callback notify_cb, void *client_data);
43int vmci_doorbell_destroy(struct vmci_handle handle);
44int vmci_doorbell_notify(struct vmci_handle handle, u32 priv_flags);
45u32 vmci_get_context_id(void);
46bool vmci_is_context_owner(u32 context_id, kuid_t uid);
47
48int vmci_event_subscribe(u32 event,
49 vmci_event_cb callback, void *callback_data,
50 u32 *subid);
51int vmci_event_unsubscribe(u32 subid);
52u32 vmci_context_get_priv_flags(u32 context_id);
53int vmci_qpair_alloc(struct vmci_qp **qpair,
54 struct vmci_handle *handle,
55 u64 produce_qsize,
56 u64 consume_qsize,
57 u32 peer, u32 flags, u32 priv_flags);
58int vmci_qpair_detach(struct vmci_qp **qpair);
59int vmci_qpair_get_produce_indexes(const struct vmci_qp *qpair,
60 u64 *producer_tail,
61 u64 *consumer_head);
62int vmci_qpair_get_consume_indexes(const struct vmci_qp *qpair,
63 u64 *consumer_tail,
64 u64 *producer_head);
65s64 vmci_qpair_produce_free_space(const struct vmci_qp *qpair);
66s64 vmci_qpair_produce_buf_ready(const struct vmci_qp *qpair);
67s64 vmci_qpair_consume_free_space(const struct vmci_qp *qpair);
68s64 vmci_qpair_consume_buf_ready(const struct vmci_qp *qpair);
69ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
70 const void *buf, size_t buf_size, int mode);
71ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
72 void *buf, size_t buf_size, int mode);
73ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
74 int mode);
75ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
76 void *iov, size_t iov_size, int mode);
77ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
78 void *iov, size_t iov_size, int mode);
79ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, void *iov, size_t iov_size,
80 int mode);
81
82#endif /* !__VMW_VMCI_API_H__ */
diff --git a/include/linux/vmw_vmci_defs.h b/include/linux/vmw_vmci_defs.h
new file mode 100644
index 000000000000..65ac54c61c18
--- /dev/null
+++ b/include/linux/vmw_vmci_defs.h
@@ -0,0 +1,880 @@
1/*
2 * VMware VMCI Driver
3 *
4 * Copyright (C) 2012 VMware, Inc. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation version 2 and no 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 MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16#ifndef _VMW_VMCI_DEF_H_
17#define _VMW_VMCI_DEF_H_
18
19#include <linux/atomic.h>
20
21/* Register offsets. */
22#define VMCI_STATUS_ADDR 0x00
23#define VMCI_CONTROL_ADDR 0x04
24#define VMCI_ICR_ADDR 0x08
25#define VMCI_IMR_ADDR 0x0c
26#define VMCI_DATA_OUT_ADDR 0x10
27#define VMCI_DATA_IN_ADDR 0x14
28#define VMCI_CAPS_ADDR 0x18
29#define VMCI_RESULT_LOW_ADDR 0x1c
30#define VMCI_RESULT_HIGH_ADDR 0x20
31
32/* Max number of devices. */
33#define VMCI_MAX_DEVICES 1
34
35/* Status register bits. */
36#define VMCI_STATUS_INT_ON 0x1
37
38/* Control register bits. */
39#define VMCI_CONTROL_RESET 0x1
40#define VMCI_CONTROL_INT_ENABLE 0x2
41#define VMCI_CONTROL_INT_DISABLE 0x4
42
43/* Capabilities register bits. */
44#define VMCI_CAPS_HYPERCALL 0x1
45#define VMCI_CAPS_GUESTCALL 0x2
46#define VMCI_CAPS_DATAGRAM 0x4
47#define VMCI_CAPS_NOTIFICATIONS 0x8
48
49/* Interrupt Cause register bits. */
50#define VMCI_ICR_DATAGRAM 0x1
51#define VMCI_ICR_NOTIFICATION 0x2
52
53/* Interrupt Mask register bits. */
54#define VMCI_IMR_DATAGRAM 0x1
55#define VMCI_IMR_NOTIFICATION 0x2
56
57/* Interrupt type. */
58enum {
59 VMCI_INTR_TYPE_INTX = 0,
60 VMCI_INTR_TYPE_MSI = 1,
61 VMCI_INTR_TYPE_MSIX = 2,
62};
63
64/* Maximum MSI/MSI-X interrupt vectors in the device. */
65#define VMCI_MAX_INTRS 2
66
67/*
68 * Supported interrupt vectors. There is one for each ICR value above,
69 * but here they indicate the position in the vector array/message ID.
70 */
71enum {
72 VMCI_INTR_DATAGRAM = 0,
73 VMCI_INTR_NOTIFICATION = 1,
74};
75
76/*
77 * A single VMCI device has an upper limit of 128MB on the amount of
78 * memory that can be used for queue pairs.
79 */
80#define VMCI_MAX_GUEST_QP_MEMORY (128 * 1024 * 1024)
81
82/*
83 * Queues with pre-mapped data pages must be small, so that we don't pin
84 * too much kernel memory (especially on vmkernel). We limit a queuepair to
85 * 32 KB, or 16 KB per queue for symmetrical pairs.
86 */
87#define VMCI_MAX_PINNED_QP_MEMORY (32 * 1024)
88
89/*
90 * We have a fixed set of resource IDs available in the VMX.
91 * This allows us to have a very simple implementation since we statically
92 * know how many will create datagram handles. If a new caller arrives and
93 * we have run out of slots we can manually increment the maximum size of
94 * available resource IDs.
95 *
96 * VMCI reserved hypervisor datagram resource IDs.
97 */
98enum {
99 VMCI_RESOURCES_QUERY = 0,
100 VMCI_GET_CONTEXT_ID = 1,
101 VMCI_SET_NOTIFY_BITMAP = 2,
102 VMCI_DOORBELL_LINK = 3,
103 VMCI_DOORBELL_UNLINK = 4,
104 VMCI_DOORBELL_NOTIFY = 5,
105 /*
106 * VMCI_DATAGRAM_REQUEST_MAP and VMCI_DATAGRAM_REMOVE_MAP are
107 * obsoleted by the removal of VM to VM communication.
108 */
109 VMCI_DATAGRAM_REQUEST_MAP = 6,
110 VMCI_DATAGRAM_REMOVE_MAP = 7,
111 VMCI_EVENT_SUBSCRIBE = 8,
112 VMCI_EVENT_UNSUBSCRIBE = 9,
113 VMCI_QUEUEPAIR_ALLOC = 10,
114 VMCI_QUEUEPAIR_DETACH = 11,
115
116 /*
117 * VMCI_VSOCK_VMX_LOOKUP was assigned to 12 for Fusion 3.0/3.1,
118 * WS 7.0/7.1 and ESX 4.1
119 */
120 VMCI_HGFS_TRANSPORT = 13,
121 VMCI_UNITY_PBRPC_REGISTER = 14,
122 VMCI_RPC_PRIVILEGED = 15,
123 VMCI_RPC_UNPRIVILEGED = 16,
124 VMCI_RESOURCE_MAX = 17,
125};
126
127/*
128 * struct vmci_handle - Ownership information structure
129 * @context: The VMX context ID.
130 * @resource: The resource ID (used for locating in resource hash).
131 *
132 * The vmci_handle structure is used to track resources used within
133 * vmw_vmci.
134 */
135struct vmci_handle {
136 u32 context;
137 u32 resource;
138};
139
140#define vmci_make_handle(_cid, _rid) \
141 (struct vmci_handle){ .context = _cid, .resource = _rid }
142
143static inline bool vmci_handle_is_equal(struct vmci_handle h1,
144 struct vmci_handle h2)
145{
146 return h1.context == h2.context && h1.resource == h2.resource;
147}
148
149#define VMCI_INVALID_ID ~0
150static const struct vmci_handle VMCI_INVALID_HANDLE = {
151 .context = VMCI_INVALID_ID,
152 .resource = VMCI_INVALID_ID
153};
154
155static inline bool vmci_handle_is_invalid(struct vmci_handle h)
156{
157 return vmci_handle_is_equal(h, VMCI_INVALID_HANDLE);
158}
159
160/*
161 * The below defines can be used to send anonymous requests.
162 * This also indicates that no response is expected.
163 */
164#define VMCI_ANON_SRC_CONTEXT_ID VMCI_INVALID_ID
165#define VMCI_ANON_SRC_RESOURCE_ID VMCI_INVALID_ID
166static const struct vmci_handle VMCI_ANON_SRC_HANDLE = {
167 .context = VMCI_ANON_SRC_CONTEXT_ID,
168 .resource = VMCI_ANON_SRC_RESOURCE_ID
169};
170
171/* The lowest 16 context ids are reserved for internal use. */
172#define VMCI_RESERVED_CID_LIMIT ((u32) 16)
173
174/*
175 * Hypervisor context id, used for calling into hypervisor
176 * supplied services from the VM.
177 */
178#define VMCI_HYPERVISOR_CONTEXT_ID 0
179
180/*
181 * Well-known context id, a logical context that contains a set of
182 * well-known services. This context ID is now obsolete.
183 */
184#define VMCI_WELL_KNOWN_CONTEXT_ID 1
185
186/*
187 * Context ID used by host endpoints.
188 */
189#define VMCI_HOST_CONTEXT_ID 2
190
191#define VMCI_CONTEXT_IS_VM(_cid) (VMCI_INVALID_ID != (_cid) && \
192 (_cid) > VMCI_HOST_CONTEXT_ID)
193
194/*
195 * The VMCI_CONTEXT_RESOURCE_ID is used together with vmci_make_handle to make
196 * handles that refer to a specific context.
197 */
198#define VMCI_CONTEXT_RESOURCE_ID 0
199
200/*
201 * VMCI error codes.
202 */
203enum {
204 VMCI_SUCCESS_QUEUEPAIR_ATTACH = 5,
205 VMCI_SUCCESS_QUEUEPAIR_CREATE = 4,
206 VMCI_SUCCESS_LAST_DETACH = 3,
207 VMCI_SUCCESS_ACCESS_GRANTED = 2,
208 VMCI_SUCCESS_ENTRY_DEAD = 1,
209 VMCI_SUCCESS = 0,
210 VMCI_ERROR_INVALID_RESOURCE = (-1),
211 VMCI_ERROR_INVALID_ARGS = (-2),
212 VMCI_ERROR_NO_MEM = (-3),
213 VMCI_ERROR_DATAGRAM_FAILED = (-4),
214 VMCI_ERROR_MORE_DATA = (-5),
215 VMCI_ERROR_NO_MORE_DATAGRAMS = (-6),
216 VMCI_ERROR_NO_ACCESS = (-7),
217 VMCI_ERROR_NO_HANDLE = (-8),
218 VMCI_ERROR_DUPLICATE_ENTRY = (-9),
219 VMCI_ERROR_DST_UNREACHABLE = (-10),
220 VMCI_ERROR_PAYLOAD_TOO_LARGE = (-11),
221 VMCI_ERROR_INVALID_PRIV = (-12),
222 VMCI_ERROR_GENERIC = (-13),
223 VMCI_ERROR_PAGE_ALREADY_SHARED = (-14),
224 VMCI_ERROR_CANNOT_SHARE_PAGE = (-15),
225 VMCI_ERROR_CANNOT_UNSHARE_PAGE = (-16),
226 VMCI_ERROR_NO_PROCESS = (-17),
227 VMCI_ERROR_NO_DATAGRAM = (-18),
228 VMCI_ERROR_NO_RESOURCES = (-19),
229 VMCI_ERROR_UNAVAILABLE = (-20),
230 VMCI_ERROR_NOT_FOUND = (-21),
231 VMCI_ERROR_ALREADY_EXISTS = (-22),
232 VMCI_ERROR_NOT_PAGE_ALIGNED = (-23),
233 VMCI_ERROR_INVALID_SIZE = (-24),
234 VMCI_ERROR_REGION_ALREADY_SHARED = (-25),
235 VMCI_ERROR_TIMEOUT = (-26),
236 VMCI_ERROR_DATAGRAM_INCOMPLETE = (-27),
237 VMCI_ERROR_INCORRECT_IRQL = (-28),
238 VMCI_ERROR_EVENT_UNKNOWN = (-29),
239 VMCI_ERROR_OBSOLETE = (-30),
240 VMCI_ERROR_QUEUEPAIR_MISMATCH = (-31),
241 VMCI_ERROR_QUEUEPAIR_NOTSET = (-32),
242 VMCI_ERROR_QUEUEPAIR_NOTOWNER = (-33),
243 VMCI_ERROR_QUEUEPAIR_NOTATTACHED = (-34),
244 VMCI_ERROR_QUEUEPAIR_NOSPACE = (-35),
245 VMCI_ERROR_QUEUEPAIR_NODATA = (-36),
246 VMCI_ERROR_BUSMEM_INVALIDATION = (-37),
247 VMCI_ERROR_MODULE_NOT_LOADED = (-38),
248 VMCI_ERROR_DEVICE_NOT_FOUND = (-39),
249 VMCI_ERROR_QUEUEPAIR_NOT_READY = (-40),
250 VMCI_ERROR_WOULD_BLOCK = (-41),
251
252 /* VMCI clients should return error code within this range */
253 VMCI_ERROR_CLIENT_MIN = (-500),
254 VMCI_ERROR_CLIENT_MAX = (-550),
255
256 /* Internal error codes. */
257 VMCI_SHAREDMEM_ERROR_BAD_CONTEXT = (-1000),
258};
259
260/* VMCI reserved events. */
261enum {
262 /* Only applicable to guest endpoints */
263 VMCI_EVENT_CTX_ID_UPDATE = 0,
264
265 /* Applicable to guest and host */
266 VMCI_EVENT_CTX_REMOVED = 1,
267
268 /* Only applicable to guest endpoints */
269 VMCI_EVENT_QP_RESUMED = 2,
270
271 /* Applicable to guest and host */
272 VMCI_EVENT_QP_PEER_ATTACH = 3,
273
274 /* Applicable to guest and host */
275 VMCI_EVENT_QP_PEER_DETACH = 4,
276
277 /*
278 * Applicable to VMX and vmk. On vmk,
279 * this event has the Context payload type.
280 */
281 VMCI_EVENT_MEM_ACCESS_ON = 5,
282
283 /*
284 * Applicable to VMX and vmk. Same as
285 * above for the payload type.
286 */
287 VMCI_EVENT_MEM_ACCESS_OFF = 6,
288 VMCI_EVENT_MAX = 7,
289};
290
291/*
292 * Of the above events, a few are reserved for use in the VMX, and
293 * other endpoints (guest and host kernel) should not use them. For
294 * the rest of the events, we allow both host and guest endpoints to
295 * subscribe to them, to maintain the same API for host and guest
296 * endpoints.
297 */
298#define VMCI_EVENT_VALID_VMX(_event) ((_event) == VMCI_EVENT_MEM_ACCESS_ON || \
299 (_event) == VMCI_EVENT_MEM_ACCESS_OFF)
300
301#define VMCI_EVENT_VALID(_event) ((_event) < VMCI_EVENT_MAX && \
302 !VMCI_EVENT_VALID_VMX(_event))
303
304/* Reserved guest datagram resource ids. */
305#define VMCI_EVENT_HANDLER 0
306
307/*
308 * VMCI coarse-grained privileges (per context or host
309 * process/endpoint. An entity with the restricted flag is only
310 * allowed to interact with the hypervisor and trusted entities.
311 */
312enum {
313 VMCI_NO_PRIVILEGE_FLAGS = 0,
314 VMCI_PRIVILEGE_FLAG_RESTRICTED = 1,
315 VMCI_PRIVILEGE_FLAG_TRUSTED = 2,
316 VMCI_PRIVILEGE_ALL_FLAGS = (VMCI_PRIVILEGE_FLAG_RESTRICTED |
317 VMCI_PRIVILEGE_FLAG_TRUSTED),
318 VMCI_DEFAULT_PROC_PRIVILEGE_FLAGS = VMCI_NO_PRIVILEGE_FLAGS,
319 VMCI_LEAST_PRIVILEGE_FLAGS = VMCI_PRIVILEGE_FLAG_RESTRICTED,
320 VMCI_MAX_PRIVILEGE_FLAGS = VMCI_PRIVILEGE_FLAG_TRUSTED,
321};
322
323/* 0 through VMCI_RESERVED_RESOURCE_ID_MAX are reserved. */
324#define VMCI_RESERVED_RESOURCE_ID_MAX 1023
325
326/*
327 * Driver version.
328 *
329 * Increment major version when you make an incompatible change.
330 * Compatibility goes both ways (old driver with new executable
331 * as well as new driver with old executable).
332 */
333
334/* Never change VMCI_VERSION_SHIFT_WIDTH */
335#define VMCI_VERSION_SHIFT_WIDTH 16
336#define VMCI_MAKE_VERSION(_major, _minor) \
337 ((_major) << VMCI_VERSION_SHIFT_WIDTH | (u16) (_minor))
338
339#define VMCI_VERSION_MAJOR(v) ((u32) (v) >> VMCI_VERSION_SHIFT_WIDTH)
340#define VMCI_VERSION_MINOR(v) ((u16) (v))
341
342/*
343 * VMCI_VERSION is always the current version. Subsequently listed
344 * versions are ways of detecting previous versions of the connecting
345 * application (i.e., VMX).
346 *
347 * VMCI_VERSION_NOVMVM: This version removed support for VM to VM
348 * communication.
349 *
350 * VMCI_VERSION_NOTIFY: This version introduced doorbell notification
351 * support.
352 *
353 * VMCI_VERSION_HOSTQP: This version introduced host end point support
354 * for hosted products.
355 *
356 * VMCI_VERSION_PREHOSTQP: This is the version prior to the adoption of
357 * support for host end-points.
358 *
359 * VMCI_VERSION_PREVERS2: This fictional version number is intended to
360 * represent the version of a VMX which doesn't call into the driver
361 * with ioctl VERSION2 and thus doesn't establish its version with the
362 * driver.
363 */
364
365#define VMCI_VERSION VMCI_VERSION_NOVMVM
366#define VMCI_VERSION_NOVMVM VMCI_MAKE_VERSION(11, 0)
367#define VMCI_VERSION_NOTIFY VMCI_MAKE_VERSION(10, 0)
368#define VMCI_VERSION_HOSTQP VMCI_MAKE_VERSION(9, 0)
369#define VMCI_VERSION_PREHOSTQP VMCI_MAKE_VERSION(8, 0)
370#define VMCI_VERSION_PREVERS2 VMCI_MAKE_VERSION(1, 0)
371
372#define VMCI_SOCKETS_MAKE_VERSION(_p) \
373 ((((_p)[0] & 0xFF) << 24) | (((_p)[1] & 0xFF) << 16) | ((_p)[2]))
374
375/*
376 * The VMCI IOCTLs. We use identity code 7, as noted in ioctl-number.h, and
377 * we start at sequence 9f. This gives us the same values that our shipping
378 * products use, starting at 1951, provided we leave out the direction and
379 * structure size. Note that VMMon occupies the block following us, starting
380 * at 2001.
381 */
382#define IOCTL_VMCI_VERSION _IO(7, 0x9f) /* 1951 */
383#define IOCTL_VMCI_INIT_CONTEXT _IO(7, 0xa0)
384#define IOCTL_VMCI_QUEUEPAIR_SETVA _IO(7, 0xa4)
385#define IOCTL_VMCI_NOTIFY_RESOURCE _IO(7, 0xa5)
386#define IOCTL_VMCI_NOTIFICATIONS_RECEIVE _IO(7, 0xa6)
387#define IOCTL_VMCI_VERSION2 _IO(7, 0xa7)
388#define IOCTL_VMCI_QUEUEPAIR_ALLOC _IO(7, 0xa8)
389#define IOCTL_VMCI_QUEUEPAIR_SETPAGEFILE _IO(7, 0xa9)
390#define IOCTL_VMCI_QUEUEPAIR_DETACH _IO(7, 0xaa)
391#define IOCTL_VMCI_DATAGRAM_SEND _IO(7, 0xab)
392#define IOCTL_VMCI_DATAGRAM_RECEIVE _IO(7, 0xac)
393#define IOCTL_VMCI_CTX_ADD_NOTIFICATION _IO(7, 0xaf)
394#define IOCTL_VMCI_CTX_REMOVE_NOTIFICATION _IO(7, 0xb0)
395#define IOCTL_VMCI_CTX_GET_CPT_STATE _IO(7, 0xb1)
396#define IOCTL_VMCI_CTX_SET_CPT_STATE _IO(7, 0xb2)
397#define IOCTL_VMCI_GET_CONTEXT_ID _IO(7, 0xb3)
398#define IOCTL_VMCI_SOCKETS_VERSION _IO(7, 0xb4)
399#define IOCTL_VMCI_SOCKETS_GET_AF_VALUE _IO(7, 0xb8)
400#define IOCTL_VMCI_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
401#define IOCTL_VMCI_SET_NOTIFY _IO(7, 0xcb) /* 1995 */
402/*IOCTL_VMMON_START _IO(7, 0xd1)*/ /* 2001 */
403
404/*
405 * struct vmci_queue_header - VMCI Queue Header information.
406 *
407 * A Queue cannot stand by itself as designed. Each Queue's header
408 * contains a pointer into itself (the producer_tail) and into its peer
409 * (consumer_head). The reason for the separation is one of
410 * accessibility: Each end-point can modify two things: where the next
411 * location to enqueue is within its produce_q (producer_tail); and
412 * where the next dequeue location is in its consume_q (consumer_head).
413 *
414 * An end-point cannot modify the pointers of its peer (guest to
415 * guest; NOTE that in the host both queue headers are mapped r/w).
416 * But, each end-point needs read access to both Queue header
417 * structures in order to determine how much space is used (or left)
418 * in the Queue. This is because for an end-point to know how full
419 * its produce_q is, it needs to use the consumer_head that points into
420 * the produce_q but -that- consumer_head is in the Queue header for
421 * that end-points consume_q.
422 *
423 * Thoroughly confused? Sorry.
424 *
425 * producer_tail: the point to enqueue new entrants. When you approach
426 * a line in a store, for example, you walk up to the tail.
427 *
428 * consumer_head: the point in the queue from which the next element is
429 * dequeued. In other words, who is next in line is he who is at the
430 * head of the line.
431 *
432 * Also, producer_tail points to an empty byte in the Queue, whereas
433 * consumer_head points to a valid byte of data (unless producer_tail ==
434 * consumer_head in which case consumer_head does not point to a valid
435 * byte of data).
436 *
437 * For a queue of buffer 'size' bytes, the tail and head pointers will be in
438 * the range [0, size-1].
439 *
440 * If produce_q_header->producer_tail == consume_q_header->consumer_head
441 * then the produce_q is empty.
442 */
443struct vmci_queue_header {
444 /* All fields are 64bit and aligned. */
445 struct vmci_handle handle; /* Identifier. */
446 atomic64_t producer_tail; /* Offset in this queue. */
447 atomic64_t consumer_head; /* Offset in peer queue. */
448};
449
450/*
451 * struct vmci_datagram - Base struct for vmci datagrams.
452 * @dst: A vmci_handle that tracks the destination of the datagram.
453 * @src: A vmci_handle that tracks the source of the datagram.
454 * @payload_size: The size of the payload.
455 *
456 * vmci_datagram structs are used when sending vmci datagrams. They include
457 * the necessary source and destination information to properly route
458 * the information along with the size of the package.
459 */
460struct vmci_datagram {
461 struct vmci_handle dst;
462 struct vmci_handle src;
463 u64 payload_size;
464};
465
466/*
467 * Second flag is for creating a well-known handle instead of a per context
468 * handle. Next flag is for deferring datagram delivery, so that the
469 * datagram callback is invoked in a delayed context (not interrupt context).
470 */
471#define VMCI_FLAG_DG_NONE 0
472#define VMCI_FLAG_WELLKNOWN_DG_HND 0x1
473#define VMCI_FLAG_ANYCID_DG_HND 0x2
474#define VMCI_FLAG_DG_DELAYED_CB 0x4
475
476/*
477 * Maximum supported size of a VMCI datagram for routable datagrams.
478 * Datagrams going to the hypervisor are allowed to be larger.
479 */
480#define VMCI_MAX_DG_SIZE (17 * 4096)
481#define VMCI_MAX_DG_PAYLOAD_SIZE (VMCI_MAX_DG_SIZE - \
482 sizeof(struct vmci_datagram))
483#define VMCI_DG_PAYLOAD(_dg) (void *)((char *)(_dg) + \
484 sizeof(struct vmci_datagram))
485#define VMCI_DG_HEADERSIZE sizeof(struct vmci_datagram)
486#define VMCI_DG_SIZE(_dg) (VMCI_DG_HEADERSIZE + (size_t)(_dg)->payload_size)
487#define VMCI_DG_SIZE_ALIGNED(_dg) ((VMCI_DG_SIZE(_dg) + 7) & (~((size_t) 0x7)))
488#define VMCI_MAX_DATAGRAM_QUEUE_SIZE (VMCI_MAX_DG_SIZE * 2)
489
490struct vmci_event_payload_qp {
491 struct vmci_handle handle; /* queue_pair handle. */
492 u32 peer_id; /* Context id of attaching/detaching VM. */
493 u32 _pad;
494};
495
496/* Flags for VMCI queue_pair API. */
497enum {
498 /* Fail alloc if QP not created by peer. */
499 VMCI_QPFLAG_ATTACH_ONLY = 1 << 0,
500
501 /* Only allow attaches from local context. */
502 VMCI_QPFLAG_LOCAL = 1 << 1,
503
504 /* Host won't block when guest is quiesced. */
505 VMCI_QPFLAG_NONBLOCK = 1 << 2,
506
507 /* Pin data pages in ESX. Used with NONBLOCK */
508 VMCI_QPFLAG_PINNED = 1 << 3,
509
510 /* Update the following flag when adding new flags. */
511 VMCI_QP_ALL_FLAGS = (VMCI_QPFLAG_ATTACH_ONLY | VMCI_QPFLAG_LOCAL |
512 VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED),
513
514 /* Convenience flags */
515 VMCI_QP_ASYMM = (VMCI_QPFLAG_NONBLOCK | VMCI_QPFLAG_PINNED),
516 VMCI_QP_ASYMM_PEER = (VMCI_QPFLAG_ATTACH_ONLY | VMCI_QP_ASYMM),
517};
518
519/*
520 * We allow at least 1024 more event datagrams from the hypervisor past the
521 * normally allowed datagrams pending for a given context. We define this
522 * limit on event datagrams from the hypervisor to guard against DoS attack
523 * from a malicious VM which could repeatedly attach to and detach from a queue
524 * pair, causing events to be queued at the destination VM. However, the rate
525 * at which such events can be generated is small since it requires a VM exit
526 * and handling of queue pair attach/detach call at the hypervisor. Event
527 * datagrams may be queued up at the destination VM if it has interrupts
528 * disabled or if it is not draining events for some other reason. 1024
529 * datagrams is a grossly conservative estimate of the time for which
530 * interrupts may be disabled in the destination VM, but at the same time does
531 * not exacerbate the memory pressure problem on the host by much (size of each
532 * event datagram is small).
533 */
534#define VMCI_MAX_DATAGRAM_AND_EVENT_QUEUE_SIZE \
535 (VMCI_MAX_DATAGRAM_QUEUE_SIZE + \
536 1024 * (sizeof(struct vmci_datagram) + \
537 sizeof(struct vmci_event_data_max)))
538
539/*
540 * Struct used for querying, via VMCI_RESOURCES_QUERY, the availability of
541 * hypervisor resources. Struct size is 16 bytes. All fields in struct are
542 * aligned to their natural alignment.
543 */
544struct vmci_resource_query_hdr {
545 struct vmci_datagram hdr;
546 u32 num_resources;
547 u32 _padding;
548};
549
550/*
551 * Convenience struct for negotiating vectors. Must match layout of
552 * VMCIResourceQueryHdr minus the struct vmci_datagram header.
553 */
554struct vmci_resource_query_msg {
555 u32 num_resources;
556 u32 _padding;
557 u32 resources[1];
558};
559
560/*
561 * The maximum number of resources that can be queried using
562 * VMCI_RESOURCE_QUERY is 31, as the result is encoded in the lower 31
563 * bits of a positive return value. Negative values are reserved for
564 * errors.
565 */
566#define VMCI_RESOURCE_QUERY_MAX_NUM 31
567
568/* Maximum size for the VMCI_RESOURCE_QUERY request. */
569#define VMCI_RESOURCE_QUERY_MAX_SIZE \
570 (sizeof(struct vmci_resource_query_hdr) + \
571 sizeof(u32) * VMCI_RESOURCE_QUERY_MAX_NUM)
572
573/*
574 * Struct used for setting the notification bitmap. All fields in
575 * struct are aligned to their natural alignment.
576 */
577struct vmci_notify_bm_set_msg {
578 struct vmci_datagram hdr;
579 u32 bitmap_ppn;
580 u32 _pad;
581};
582
583/*
584 * Struct used for linking a doorbell handle with an index in the
585 * notify bitmap. All fields in struct are aligned to their natural
586 * alignment.
587 */
588struct vmci_doorbell_link_msg {
589 struct vmci_datagram hdr;
590 struct vmci_handle handle;
591 u64 notify_idx;
592};
593
594/*
595 * Struct used for unlinking a doorbell handle from an index in the
596 * notify bitmap. All fields in struct are aligned to their natural
597 * alignment.
598 */
599struct vmci_doorbell_unlink_msg {
600 struct vmci_datagram hdr;
601 struct vmci_handle handle;
602};
603
604/*
605 * Struct used for generating a notification on a doorbell handle. All
606 * fields in struct are aligned to their natural alignment.
607 */
608struct vmci_doorbell_notify_msg {
609 struct vmci_datagram hdr;
610 struct vmci_handle handle;
611};
612
613/*
614 * This struct is used to contain data for events. Size of this struct is a
615 * multiple of 8 bytes, and all fields are aligned to their natural alignment.
616 */
617struct vmci_event_data {
618 u32 event; /* 4 bytes. */
619 u32 _pad;
620 /* Event payload is put here. */
621};
622
623/*
624 * Define the different VMCI_EVENT payload data types here. All structs must
625 * be a multiple of 8 bytes, and fields must be aligned to their natural
626 * alignment.
627 */
628struct vmci_event_payld_ctx {
629 u32 context_id; /* 4 bytes. */
630 u32 _pad;
631};
632
633struct vmci_event_payld_qp {
634 struct vmci_handle handle; /* queue_pair handle. */
635 u32 peer_id; /* Context id of attaching/detaching VM. */
636 u32 _pad;
637};
638
639/*
640 * We define the following struct to get the size of the maximum event
641 * data the hypervisor may send to the guest. If adding a new event
642 * payload type above, add it to the following struct too (inside the
643 * union).
644 */
645struct vmci_event_data_max {
646 struct vmci_event_data event_data;
647 union {
648 struct vmci_event_payld_ctx context_payload;
649 struct vmci_event_payld_qp qp_payload;
650 } ev_data_payload;
651};
652
653/*
654 * Struct used for VMCI_EVENT_SUBSCRIBE/UNSUBSCRIBE and
655 * VMCI_EVENT_HANDLER messages. Struct size is 32 bytes. All fields
656 * in struct are aligned to their natural alignment.
657 */
658struct vmci_event_msg {
659 struct vmci_datagram hdr;
660
661 /* Has event type and payload. */
662 struct vmci_event_data event_data;
663
664 /* Payload gets put here. */
665};
666
667/* Event with context payload. */
668struct vmci_event_ctx {
669 struct vmci_event_msg msg;
670 struct vmci_event_payld_ctx payload;
671};
672
673/* Event with QP payload. */
674struct vmci_event_qp {
675 struct vmci_event_msg msg;
676 struct vmci_event_payld_qp payload;
677};
678
679/*
680 * Structs used for queue_pair alloc and detach messages. We align fields of
681 * these structs to 64bit boundaries.
682 */
683struct vmci_qp_alloc_msg {
684 struct vmci_datagram hdr;
685 struct vmci_handle handle;
686 u32 peer;
687 u32 flags;
688 u64 produce_size;
689 u64 consume_size;
690 u64 num_ppns;
691
692 /* List of PPNs placed here. */
693};
694
695struct vmci_qp_detach_msg {
696 struct vmci_datagram hdr;
697 struct vmci_handle handle;
698};
699
700/* VMCI Doorbell API. */
701#define VMCI_FLAG_DELAYED_CB 0x01
702
703typedef void (*vmci_callback) (void *client_data);
704
705/*
706 * struct vmci_qp - A vmw_vmci queue pair handle.
707 *
708 * This structure is used as a handle to a queue pair created by
709 * VMCI. It is intentionally left opaque to clients.
710 */
711struct vmci_qp;
712
713/* Callback needed for correctly waiting on events. */
714typedef int (*vmci_datagram_recv_cb) (void *client_data,
715 struct vmci_datagram *msg);
716
717/* VMCI Event API. */
718typedef void (*vmci_event_cb) (u32 sub_id, const struct vmci_event_data *ed,
719 void *client_data);
720
721/*
722 * We use the following inline function to access the payload data
723 * associated with an event data.
724 */
725static inline const void *
726vmci_event_data_const_payload(const struct vmci_event_data *ev_data)
727{
728 return (const char *)ev_data + sizeof(*ev_data);
729}
730
731static inline void *vmci_event_data_payload(struct vmci_event_data *ev_data)
732{
733 return (void *)vmci_event_data_const_payload(ev_data);
734}
735
736/*
737 * Helper to add a given offset to a head or tail pointer. Wraps the
738 * value of the pointer around the max size of the queue.
739 */
740static inline void vmci_qp_add_pointer(atomic64_t *var,
741 size_t add,
742 u64 size)
743{
744 u64 new_val = atomic64_read(var);
745
746 if (new_val >= size - add)
747 new_val -= size;
748
749 new_val += add;
750
751 atomic64_set(var, new_val);
752}
753
754/*
755 * Helper routine to get the Producer Tail from the supplied queue.
756 */
757static inline u64
758vmci_q_header_producer_tail(const struct vmci_queue_header *q_header)
759{
760 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
761 return atomic64_read(&qh->producer_tail);
762}
763
764/*
765 * Helper routine to get the Consumer Head from the supplied queue.
766 */
767static inline u64
768vmci_q_header_consumer_head(const struct vmci_queue_header *q_header)
769{
770 struct vmci_queue_header *qh = (struct vmci_queue_header *)q_header;
771 return atomic64_read(&qh->consumer_head);
772}
773
774/*
775 * Helper routine to increment the Producer Tail. Fundamentally,
776 * vmci_qp_add_pointer() is used to manipulate the tail itself.
777 */
778static inline void
779vmci_q_header_add_producer_tail(struct vmci_queue_header *q_header,
780 size_t add,
781 u64 queue_size)
782{
783 vmci_qp_add_pointer(&q_header->producer_tail, add, queue_size);
784}
785
786/*
787 * Helper routine to increment the Consumer Head. Fundamentally,
788 * vmci_qp_add_pointer() is used to manipulate the head itself.
789 */
790static inline void
791vmci_q_header_add_consumer_head(struct vmci_queue_header *q_header,
792 size_t add,
793 u64 queue_size)
794{
795 vmci_qp_add_pointer(&q_header->consumer_head, add, queue_size);
796}
797
798/*
799 * Helper routine for getting the head and the tail pointer for a queue.
800 * Both the VMCIQueues are needed to get both the pointers for one queue.
801 */
802static inline void
803vmci_q_header_get_pointers(const struct vmci_queue_header *produce_q_header,
804 const struct vmci_queue_header *consume_q_header,
805 u64 *producer_tail,
806 u64 *consumer_head)
807{
808 if (producer_tail)
809 *producer_tail = vmci_q_header_producer_tail(produce_q_header);
810
811 if (consumer_head)
812 *consumer_head = vmci_q_header_consumer_head(consume_q_header);
813}
814
815static inline void vmci_q_header_init(struct vmci_queue_header *q_header,
816 const struct vmci_handle handle)
817{
818 q_header->handle = handle;
819 atomic64_set(&q_header->producer_tail, 0);
820 atomic64_set(&q_header->consumer_head, 0);
821}
822
823/*
824 * Finds available free space in a produce queue to enqueue more
825 * data or reports an error if queue pair corruption is detected.
826 */
827static s64
828vmci_q_header_free_space(const struct vmci_queue_header *produce_q_header,
829 const struct vmci_queue_header *consume_q_header,
830 const u64 produce_q_size)
831{
832 u64 tail;
833 u64 head;
834 u64 free_space;
835
836 tail = vmci_q_header_producer_tail(produce_q_header);
837 head = vmci_q_header_consumer_head(consume_q_header);
838
839 if (tail >= produce_q_size || head >= produce_q_size)
840 return VMCI_ERROR_INVALID_SIZE;
841
842 /*
843 * Deduct 1 to avoid tail becoming equal to head which causes
844 * ambiguity. If head and tail are equal it means that the
845 * queue is empty.
846 */
847 if (tail >= head)
848 free_space = produce_q_size - (tail - head) - 1;
849 else
850 free_space = head - tail - 1;
851
852 return free_space;
853}
854
855/*
856 * vmci_q_header_free_space() does all the heavy lifting of
857 * determing the number of free bytes in a Queue. This routine,
858 * then subtracts that size from the full size of the Queue so
859 * the caller knows how many bytes are ready to be dequeued.
860 * Results:
861 * On success, available data size in bytes (up to MAX_INT64).
862 * On failure, appropriate error code.
863 */
864static inline s64
865vmci_q_header_buf_ready(const struct vmci_queue_header *consume_q_header,
866 const struct vmci_queue_header *produce_q_header,
867 const u64 consume_q_size)
868{
869 s64 free_space;
870
871 free_space = vmci_q_header_free_space(consume_q_header,
872 produce_q_header, consume_q_size);
873 if (free_space < VMCI_SUCCESS)
874 return free_space;
875
876 return consume_q_size - free_space - 1;
877}
878
879
880#endif /* _VMW_VMCI_DEF_H_ */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 50ae7d0c279e..e8d65718560b 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -47,6 +47,7 @@ int con_set_cmap(unsigned char __user *cmap);
47int con_get_cmap(unsigned char __user *cmap); 47int con_get_cmap(unsigned char __user *cmap);
48void scrollback(struct vc_data *vc, int lines); 48void scrollback(struct vc_data *vc, int lines);
49void scrollfront(struct vc_data *vc, int lines); 49void scrollfront(struct vc_data *vc, int lines);
50void clear_buffer_attributes(struct vc_data *vc);
50void update_region(struct vc_data *vc, unsigned long start, int count); 51void update_region(struct vc_data *vc, unsigned long start, int count);
51void redraw_screen(struct vc_data *vc, int is_switch); 52void redraw_screen(struct vc_data *vc, int is_switch);
52#define update_screen(x) redraw_screen(x, 0) 53#define update_screen(x) redraw_screen(x, 0)
@@ -130,6 +131,8 @@ void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
130int vt_waitactive(int n); 131int vt_waitactive(int n);
131void change_console(struct vc_data *new_vc); 132void change_console(struct vc_data *new_vc);
132void reset_vc(struct vc_data *vc); 133void reset_vc(struct vc_data *vc);
134extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
135 int deflt);
133extern int unbind_con_driver(const struct consw *csw, int first, int last, 136extern int unbind_con_driver(const struct consw *csw, int first, int last,
134 int deflt); 137 int deflt);
135int vty_init(const struct file_operations *console_fops); 138int vty_init(const struct file_operations *console_fops);
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index ae30ab58431a..71a5782d8c59 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -6,15 +6,46 @@ struct task_struct;
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING 6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7extern void vtime_task_switch(struct task_struct *prev); 7extern void vtime_task_switch(struct task_struct *prev);
8extern void vtime_account_system(struct task_struct *tsk); 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); 9extern void vtime_account_idle(struct task_struct *tsk);
11extern void vtime_account_user(struct task_struct *tsk); 10extern void vtime_account_user(struct task_struct *tsk);
12extern void vtime_account(struct task_struct *tsk); 11extern void vtime_account_irq_enter(struct task_struct *tsk);
13#else 12
13#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
14static inline bool vtime_accounting_enabled(void) { return true; }
15#endif
16
17#else /* !CONFIG_VIRT_CPU_ACCOUNTING */
18
14static inline void vtime_task_switch(struct task_struct *prev) { } 19static inline void vtime_task_switch(struct task_struct *prev) { }
15static inline void vtime_account_system(struct task_struct *tsk) { } 20static inline void vtime_account_system(struct task_struct *tsk) { }
16static inline void vtime_account_system_irqsafe(struct task_struct *tsk) { } 21static inline void vtime_account_user(struct task_struct *tsk) { }
17static inline void vtime_account(struct task_struct *tsk) { } 22static inline void vtime_account_irq_enter(struct task_struct *tsk) { }
23static inline bool vtime_accounting_enabled(void) { return false; }
24#endif
25
26#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
27extern void arch_vtime_task_switch(struct task_struct *tsk);
28extern void vtime_account_irq_exit(struct task_struct *tsk);
29extern bool vtime_accounting_enabled(void);
30extern void vtime_user_enter(struct task_struct *tsk);
31static inline void vtime_user_exit(struct task_struct *tsk)
32{
33 vtime_account_user(tsk);
34}
35extern void vtime_guest_enter(struct task_struct *tsk);
36extern void vtime_guest_exit(struct task_struct *tsk);
37extern void vtime_init_idle(struct task_struct *tsk);
38#else
39static inline void vtime_account_irq_exit(struct task_struct *tsk)
40{
41 /* On hard|softirq exit we always account to hard|softirq cputime */
42 vtime_account_system(tsk);
43}
44static inline void vtime_user_enter(struct task_struct *tsk) { }
45static inline void vtime_user_exit(struct task_struct *tsk) { }
46static inline void vtime_guest_enter(struct task_struct *tsk) { }
47static inline void vtime_guest_exit(struct task_struct *tsk) { }
48static inline void vtime_init_idle(struct task_struct *tsk) { }
18#endif 49#endif
19 50
20#ifdef CONFIG_IRQ_TIME_ACCOUNTING 51#ifdef CONFIG_IRQ_TIME_ACCOUNTING
@@ -23,25 +54,15 @@ extern void irqtime_account_irq(struct task_struct *tsk);
23static inline void irqtime_account_irq(struct task_struct *tsk) { } 54static inline void irqtime_account_irq(struct task_struct *tsk) { }
24#endif 55#endif
25 56
26static inline void vtime_account_irq_enter(struct task_struct *tsk) 57static inline void account_irq_enter_time(struct task_struct *tsk)
27{ 58{
28 /* 59 vtime_account_irq_enter(tsk);
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); 60 irqtime_account_irq(tsk);
39} 61}
40 62
41static inline void vtime_account_irq_exit(struct task_struct *tsk) 63static inline void account_irq_exit_time(struct task_struct *tsk)
42{ 64{
43 /* On hard|softirq exit we always account to hard|softirq cputime */ 65 vtime_account_irq_exit(tsk);
44 vtime_account_system(tsk);
45 irqtime_account_irq(tsk); 66 irqtime_account_irq(tsk);
46} 67}
47 68
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index cec4b4159767..8198a63cf459 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -1,129 +1,10 @@
1/***************************************************************************** 1/*
2* wanrouter.h Definitions for the WAN Multiprotocol Router Module. 2 * wanrouter.h Legacy declarations kept around until X25 is removed
3* This module provides API and common services for WAN Link 3 */
4* Drivers and is completely hardware-independent. 4
5*
6* Author: Nenad Corbic <ncorbic@sangoma.com>
7* Gideon Hack
8* Additions: Arnaldo Melo
9*
10* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State
18* Feb 24, 2000 Nenad Corbic Added support for socket based x25api
19* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol.
20* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
21* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
22* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
23* WAN_DISCONNECTING state added
24* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
25* Jun 12, 1998 David Fong Added Cisco HDLC support.
26* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
27* 'wanif_conf_t'
28* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
29* Added 'authenticator' to 'wan_ppp_conf_t'
30* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
31* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
32* Added 'enable_IPX' and 'network_number' to
33* 'wan_device_t'. Also added defines for
34* UDP PACKET TYPE, Interrupt test, critical values
35* for RACE conditions.
36* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to
37* 'wan_fr_conf_t' to configure a list of dlci(s)
38* for a NODE
39* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t'
40* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t'
41* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t'
42* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t'
43* Jan 16, 1997 Gene Kozin router_devlist made public
44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
45*****************************************************************************/
46#ifndef _ROUTER_H 5#ifndef _ROUTER_H
47#define _ROUTER_H 6#define _ROUTER_H
48 7
49#include <uapi/linux/wanrouter.h> 8#include <uapi/linux/wanrouter.h>
50 9
51/****** Kernel Interface ****************************************************/
52
53#include <linux/fs.h> /* support for device drivers */
54#include <linux/proc_fs.h> /* proc filesystem pragmatics */
55#include <linux/netdevice.h> /* support for network drivers */
56#include <linux/spinlock.h> /* Support for SMP Locking */
57
58/*----------------------------------------------------------------------------
59 * WAN device data space.
60 */
61struct wan_device {
62 unsigned magic; /* magic number */
63 char* name; /* -> WAN device name (ASCIIZ) */
64 void* private; /* -> driver private data */
65 unsigned config_id; /* Configuration ID */
66 /****** hardware configuration ******/
67 unsigned ioport; /* adapter I/O port base #1 */
68 char S514_cpu_no[1]; /* PCI CPU Number */
69 unsigned char S514_slot_no; /* PCI Slot Number */
70 unsigned long maddr; /* dual-port memory address */
71 unsigned msize; /* dual-port memory size */
72 int irq; /* interrupt request level */
73 int dma; /* DMA request level */
74 unsigned bps; /* data transfer rate */
75 unsigned mtu; /* max physical transmit unit size */
76 unsigned udp_port; /* UDP port for management */
77 unsigned char ttl; /* Time To Live for UDP security */
78 unsigned enable_tx_int; /* Transmit Interrupt enabled or not */
79 char interface; /* RS-232/V.35, etc. */
80 char clocking; /* external/internal */
81 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
82 char station; /* DTE/DCE, primary/secondary, etc. */
83 char connection; /* permanent/switched/on-demand */
84 char signalling; /* Signalling RS232 or V35 */
85 char read_mode; /* read mode: Polling or interrupt */
86 char new_if_cnt; /* Number of interfaces per wanpipe */
87 char del_if_cnt; /* Number of times del_if() gets called */
88 unsigned char piggyback; /* Piggibacking a port */
89 unsigned hw_opt[4]; /* other hardware options */
90 /****** status and statistics *******/
91 char state; /* device state */
92 char api_status; /* device api status */
93 struct net_device_stats stats; /* interface statistics */
94 unsigned reserved[16]; /* reserved for future use */
95 unsigned long critical; /* critical section flag */
96 spinlock_t lock; /* Support for SMP Locking */
97
98 /****** device management methods ***/
99 int (*setup) (struct wan_device *wandev, wandev_conf_t *conf);
100 int (*shutdown) (struct wan_device *wandev);
101 int (*update) (struct wan_device *wandev);
102 int (*ioctl) (struct wan_device *wandev, unsigned cmd,
103 unsigned long arg);
104 int (*new_if)(struct wan_device *wandev, struct net_device *dev,
105 wanif_conf_t *conf);
106 int (*del_if)(struct wan_device *wandev, struct net_device *dev);
107 /****** maintained by the router ****/
108 struct wan_device* next; /* -> next device */
109 struct net_device* dev; /* list of network interfaces */
110 unsigned ndev; /* number of interfaces */
111 struct proc_dir_entry *dent; /* proc filesystem entry */
112};
113
114/* Public functions available for device drivers */
115extern int register_wan_device(struct wan_device *wandev);
116extern int unregister_wan_device(char *name);
117
118/* Proc interface functions. These must not be called by the drivers! */
119extern int wanrouter_proc_init(void);
120extern void wanrouter_proc_cleanup(void);
121extern int wanrouter_proc_add(struct wan_device *wandev);
122extern int wanrouter_proc_delete(struct wan_device *wandev);
123extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
124
125/* Public Data */
126/* list of registered devices */
127extern struct wan_device *wanrouter_router_devlist;
128
129#endif /* _ROUTER_H */ 10#endif /* _ROUTER_H */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 0d6373195d32..a54fe82e704b 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -24,6 +24,8 @@
24#ifndef _LINUX_WL12XX_H 24#ifndef _LINUX_WL12XX_H
25#define _LINUX_WL12XX_H 25#define _LINUX_WL12XX_H
26 26
27#include <linux/err.h>
28
27/* Reference clock values */ 29/* Reference clock values */
28enum { 30enum {
29 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */ 31 WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */
@@ -55,17 +57,17 @@ struct wl12xx_platform_data {
55 int board_tcxo_clock; 57 int board_tcxo_clock;
56 unsigned long platform_quirks; 58 unsigned long platform_quirks;
57 bool pwr_in_suspend; 59 bool pwr_in_suspend;
58
59 struct wl1271_if_operations *ops;
60}; 60};
61 61
62/* Platform does not support level trigger interrupts */ 62/* Platform does not support level trigger interrupts */
63#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0) 63#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
64 64
65#ifdef CONFIG_WL12XX_PLATFORM_DATA 65#ifdef CONFIG_WILINK_PLATFORM_DATA
66 66
67int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); 67int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 68
69struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70
69#else 71#else
70 72
71static inline 73static inline
@@ -74,8 +76,12 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
74 return -ENOSYS; 76 return -ENOSYS;
75} 77}
76 78
77#endif 79static inline
80struct wl12xx_platform_data *wl12xx_get_platform_data(void)
81{
82 return ERR_PTR(-ENODATA);
83}
78 84
79struct wl12xx_platform_data *wl12xx_get_platform_data(void); 85#endif
80 86
81#endif 87#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2b58905d3504..8afab27cdbc2 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -27,7 +27,7 @@ void delayed_work_timer_fn(unsigned long __data);
27enum { 27enum {
28 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */ 28 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
29 WORK_STRUCT_DELAYED_BIT = 1, /* work item is delayed */ 29 WORK_STRUCT_DELAYED_BIT = 1, /* work item is delayed */
30 WORK_STRUCT_CWQ_BIT = 2, /* data points to cwq */ 30 WORK_STRUCT_PWQ_BIT = 2, /* data points to pwq */
31 WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */ 31 WORK_STRUCT_LINKED_BIT = 3, /* next work is linked to this one */
32#ifdef CONFIG_DEBUG_OBJECTS_WORK 32#ifdef CONFIG_DEBUG_OBJECTS_WORK
33 WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */ 33 WORK_STRUCT_STATIC_BIT = 4, /* static initializer (debugobjects) */
@@ -40,7 +40,7 @@ enum {
40 40
41 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT, 41 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
42 WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT, 42 WORK_STRUCT_DELAYED = 1 << WORK_STRUCT_DELAYED_BIT,
43 WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT, 43 WORK_STRUCT_PWQ = 1 << WORK_STRUCT_PWQ_BIT,
44 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT, 44 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
45#ifdef CONFIG_DEBUG_OBJECTS_WORK 45#ifdef CONFIG_DEBUG_OBJECTS_WORK
46 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT, 46 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
@@ -57,29 +57,36 @@ enum {
57 57
58 /* special cpu IDs */ 58 /* special cpu IDs */
59 WORK_CPU_UNBOUND = NR_CPUS, 59 WORK_CPU_UNBOUND = NR_CPUS,
60 WORK_CPU_NONE = NR_CPUS + 1, 60 WORK_CPU_END = NR_CPUS + 1,
61 WORK_CPU_LAST = WORK_CPU_NONE,
62 61
63 /* 62 /*
64 * Reserve 7 bits off of cwq pointer w/ debugobjects turned 63 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off.
65 * off. This makes cwqs aligned to 256 bytes and allows 15 64 * This makes pwqs aligned to 256 bytes and allows 15 workqueue
66 * workqueue flush colors. 65 * flush colors.
67 */ 66 */
68 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + 67 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
69 WORK_STRUCT_COLOR_BITS, 68 WORK_STRUCT_COLOR_BITS,
70 69
71 /* data contains off-queue information when !WORK_STRUCT_CWQ */ 70 /* data contains off-queue information when !WORK_STRUCT_PWQ */
72 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS, 71 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS,
73 72
74 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), 73 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE),
75 74
75 /*
76 * When a work item is off queue, its high bits point to the last
77 * pool it was on. Cap at 31 bits and use the highest number to
78 * indicate that no pool is associated.
79 */
76 WORK_OFFQ_FLAG_BITS = 1, 80 WORK_OFFQ_FLAG_BITS = 1,
77 WORK_OFFQ_CPU_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS, 81 WORK_OFFQ_POOL_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS,
82 WORK_OFFQ_LEFT = BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT,
83 WORK_OFFQ_POOL_BITS = WORK_OFFQ_LEFT <= 31 ? WORK_OFFQ_LEFT : 31,
84 WORK_OFFQ_POOL_NONE = (1LU << WORK_OFFQ_POOL_BITS) - 1,
78 85
79 /* convenience constants */ 86 /* convenience constants */
80 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, 87 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
81 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, 88 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
82 WORK_STRUCT_NO_CPU = (unsigned long)WORK_CPU_NONE << WORK_OFFQ_CPU_SHIFT, 89 WORK_STRUCT_NO_POOL = (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT,
83 90
84 /* bit mask for work_busy() return values */ 91 /* bit mask for work_busy() return values */
85 WORK_BUSY_PENDING = 1 << 0, 92 WORK_BUSY_PENDING = 1 << 0,
@@ -95,13 +102,16 @@ struct work_struct {
95#endif 102#endif
96}; 103};
97 104
98#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU) 105#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL)
99#define WORK_DATA_STATIC_INIT() \ 106#define WORK_DATA_STATIC_INIT() \
100 ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU | WORK_STRUCT_STATIC) 107 ATOMIC_LONG_INIT(WORK_STRUCT_NO_POOL | WORK_STRUCT_STATIC)
101 108
102struct delayed_work { 109struct delayed_work {
103 struct work_struct work; 110 struct work_struct work;
104 struct timer_list timer; 111 struct timer_list timer;
112
113 /* target workqueue and CPU ->timer uses to queue ->work */
114 struct workqueue_struct *wq;
105 int cpu; 115 int cpu;
106}; 116};
107 117
@@ -426,7 +436,6 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
426extern void workqueue_set_max_active(struct workqueue_struct *wq, 436extern void workqueue_set_max_active(struct workqueue_struct *wq,
427 int max_active); 437 int max_active);
428extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); 438extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq);
429extern unsigned int work_cpu(struct work_struct *work);
430extern unsigned int work_busy(struct work_struct *work); 439extern unsigned int work_busy(struct work_struct *work);
431 440
432/* 441/*
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b82a83aba311..9a9367c0c076 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -87,9 +87,9 @@ int inode_wait(void *);
87void writeback_inodes_sb(struct super_block *, enum wb_reason reason); 87void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
88void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, 88void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
89 enum wb_reason reason); 89 enum wb_reason reason);
90int writeback_inodes_sb_if_idle(struct super_block *, enum wb_reason reason); 90int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason);
91int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr, 91int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
92 enum wb_reason reason); 92 enum wb_reason reason);
93void sync_inodes_sb(struct super_block *); 93void sync_inodes_sb(struct super_block *);
94long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, 94long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
95 enum wb_reason reason); 95 enum wb_reason reason);