aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/altera_uart.h4
-rw-r--r--include/linux/amba/bus.h45
-rw-r--r--include/linux/amba/mmci.h22
-rw-r--r--include/linux/amba/pl022.h5
-rw-r--r--include/linux/amd-iommu.h2
-rw-r--r--include/linux/apple_bl.h26
-rw-r--r--include/linux/atmdev.h3
-rw-r--r--include/linux/atmel_tc.h10
-rw-r--r--include/linux/atomic.h2
-rw-r--r--include/linux/attribute_container.h3
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/bcma/bcma.h9
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h26
-rw-r--r--include/linux/bcma/bcma_driver_pci.h125
-rw-r--r--include/linux/bcma/bcma_regs.h27
-rw-r--r--include/linux/binfmts.h10
-rw-r--r--include/linux/bio.h9
-rw-r--r--include/linux/bit_spinlock.h1
-rw-r--r--include/linux/bitops.h13
-rw-r--r--include/linux/bug.h61
-rw-r--r--include/linux/c2port.h3
-rw-r--r--include/linux/can/dev.h2
-rw-r--r--include/linux/cdrom.h1
-rw-r--r--include/linux/ceph/decode.h3
-rw-r--r--include/linux/ceph/libceph.h3
-rw-r--r--include/linux/ceph/mdsmap.h1
-rw-r--r--include/linux/ceph/messenger.h5
-rw-r--r--include/linux/cgroup.h72
-rw-r--r--include/linux/cleancache.h24
-rw-r--r--include/linux/clk-private.h196
-rw-r--r--include/linux/clk-provider.h300
-rw-r--r--include/linux/clk.h68
-rw-r--r--include/linux/clocksource.h7
-rw-r--r--include/linux/compaction.h20
-rw-r--r--include/linux/compiler-gcc.h3
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/connector.h1
-rw-r--r--include/linux/cpu.h10
-rw-r--r--include/linux/cpufreq.h3
-rw-r--r--include/linux/cpumask.h1
-rw-r--r--include/linux/cpuset.h47
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/crypto.h8
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/dccp.h8
-rw-r--r--include/linux/debug_locks.h1
-rw-r--r--include/linux/debugfs.h4
-rw-r--r--include/linux/devfreq.h25
-rw-r--r--include/linux/device.h21
-rw-r--r--include/linux/dma-buf.h2
-rw-r--r--include/linux/dmaengine.h1
-rw-r--r--include/linux/dynamic_debug.h19
-rw-r--r--include/linux/edac.h6
-rw-r--r--include/linux/efi.h45
-rw-r--r--include/linux/elfcore.h1
-rw-r--r--include/linux/errno.h1
-rw-r--r--include/linux/etherdevice.h13
-rw-r--r--include/linux/ethtool.h23
-rw-r--r--include/linux/ext3_fs.h1
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/firewire-cdev.h39
-rw-r--r--include/linux/firewire.h19
-rw-r--r--include/linux/fs.h24
-rw-r--r--include/linux/fsnotify.h1
-rw-r--r--include/linux/ftrace.h77
-rw-r--r--include/linux/ftrace_event.h9
-rw-r--r--include/linux/gfs2_ondisk.h1
-rw-r--r--include/linux/gpio.h7
-rw-r--r--include/linux/highmem.h80
-rw-r--r--include/linux/huge_mm.h28
-rw-r--r--include/linux/hugetlb.h45
-rw-r--r--include/linux/hwmon-sysfs.h2
-rw-r--r--include/linux/hwmon.h2
-rw-r--r--include/linux/hwspinlock.h2
-rw-r--r--include/linux/hyperv.h173
-rw-r--r--include/linux/i2c-algo-bit.h4
-rw-r--r--include/linux/i2c-algo-pcf.h3
-rw-r--r--include/linux/i2c-dev.h3
-rw-r--r--include/linux/i2c-mux.h3
-rw-r--r--include/linux/i2c-smbus.h3
-rw-r--r--include/linux/i2c.h3
-rw-r--r--include/linux/i2c/at24.h35
-rw-r--r--include/linux/i2c/tc35876x.h11
-rw-r--r--include/linux/i2c/twl.h16
-rw-r--r--include/linux/i2o.h1
-rw-r--r--include/linux/ide.h3
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_ppp.h174
-rw-r--r--include/linux/if_vlan.h8
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init_task.h10
-rw-r--r--include/linux/input.h27
-rw-r--r--include/linux/input/cyttsp.h58
-rw-r--r--include/linux/input/ili210x.h10
-rw-r--r--include/linux/input/kxtj9.h11
-rw-r--r--include/linux/input/matrix_keypad.h19
-rw-r--r--include/linux/input/mt.h8
-rw-r--r--include/linux/input/ti_tscadc.h17
-rw-r--r--include/linux/interrupt.h7
-rw-r--r--include/linux/io-mapping.h1
-rw-r--r--include/linux/ioport.h6
-rw-r--r--include/linux/ipmi.h2
-rw-r--r--include/linux/ipmi_smi.h3
-rw-r--r--include/linux/ipv6.h8
-rw-r--r--include/linux/irqdomain.h191
-rw-r--r--include/linux/isdn.h2
-rw-r--r--include/linux/ivtv.h6
-rw-r--r--include/linux/jbd2.h12
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/jump_label.h162
-rw-r--r--include/linux/jz4740-adc.h2
-rw-r--r--include/linux/kbd_kern.h7
-rw-r--r--include/linux/kernel-page-flags.h1
-rw-r--r--include/linux/kernel.h85
-rw-r--r--include/linux/key.h3
-rw-r--r--include/linux/keyboard.h2
-rw-r--r--include/linux/kmod.h18
-rw-r--r--include/linux/kprobes.h1
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/led-lm3530.h9
-rw-r--r--include/linux/leds-lp5521.h25
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/linux/lockd/bind.h1
-rw-r--r--include/linux/lockd/lockd.h7
-rw-r--r--include/linux/lockd/xdr4.h2
-rw-r--r--include/linux/lp855x.h131
-rw-r--r--include/linux/magic.h19
-rw-r--r--include/linux/maple.h2
-rw-r--r--include/linux/math64.h4
-rw-r--r--include/linux/mdio.h10
-rw-r--r--include/linux/memcontrol.h58
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mfd/88pm860x.h23
-rw-r--r--include/linux/mfd/abx500.h10
-rw-r--r--include/linux/mfd/abx500/ab5500.h2
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h4
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h43
-rw-r--r--include/linux/mfd/abx500/ab8500.h212
-rw-r--r--include/linux/mfd/anatop.h40
-rw-r--r--include/linux/mfd/da9052/da9052.h2
-rw-r--r--include/linux/mfd/db8500-prcmu.h183
-rw-r--r--include/linux/mfd/dbx500-prcmu.h414
-rw-r--r--include/linux/mfd/max8997.h53
-rw-r--r--include/linux/mfd/mc13xxx.h16
-rw-r--r--include/linux/mfd/mcp.h14
-rw-r--r--include/linux/mfd/pm8xxx/pm8921.h1
-rw-r--r--include/linux/mfd/rc5t583.h295
-rw-r--r--include/linux/mfd/stmpe.h5
-rw-r--r--include/linux/mfd/tc3589x.h2
-rw-r--r--include/linux/mfd/tps65090.h46
-rw-r--r--include/linux/mfd/tps65217.h283
-rw-r--r--include/linux/mfd/tps65910.h18
-rw-r--r--include/linux/mfd/ucb1x00.h38
-rw-r--r--include/linux/mfd/wm8994/pdata.h4
-rw-r--r--include/linux/migrate.h2
-rw-r--r--include/linux/mlx4/device.h17
-rw-r--r--include/linux/mlx4/driver.h1
-rw-r--r--include/linux/mlx4/qp.h5
-rw-r--r--include/linux/mm.h41
-rw-r--r--include/linux/mmc/card.h1
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/host.h1
-rw-r--r--include/linux/mmc/ioctl.h3
-rw-r--r--include/linux/mmzone.h1
-rw-r--r--include/linux/mod_devicetable.h30
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h132
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/ipset/ip_set.h35
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h119
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h12
-rw-r--r--include/linux/netfilter/nfnetlink_cttimeout.h114
-rw-r--r--include/linux/netfilter/xt_CT.h12
-rw-r--r--include/linux/netfilter/xt_LOG.h19
-rw-r--r--include/linux/netfilter_ipv4/Kbuild2
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h20
-rw-r--r--include/linux/netfilter_ipv4/ipt_realm.h7
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h2
-rw-r--r--include/linux/netlink.h30
-rw-r--r--include/linux/nfc.h8
-rw-r--r--include/linux/nfs.h2
-rw-r--r--include/linux/nfs4.h7
-rw-r--r--include/linux/nfs_fs.h46
-rw-r--r--include/linux/nfs_fs_i.h4
-rw-r--r--include/linux/nfs_fs_sb.h23
-rw-r--r--include/linux/nfs_idmap.h22
-rw-r--r--include/linux/nfs_iostat.h2
-rw-r--r--include/linux/nfs_page.h27
-rw-r--r--include/linux/nfs_xdr.h65
-rw-r--r--include/linux/nilfs2_fs.h1
-rw-r--r--include/linux/nl80211.h72
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/of.h43
-rw-r--r--include/linux/of_address.h33
-rw-r--r--include/linux/of_device.h11
-rw-r--r--include/linux/of_gpio.h27
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/of_mtd.h19
-rw-r--r--include/linux/of_platform.h15
-rw-r--r--include/linux/omapfb.h32
-rw-r--r--include/linux/oom.h2
-rw-r--r--include/linux/opp.h1
-rw-r--r--include/linux/padata.h6
-rw-r--r--include/linux/page-flags.h21
-rw-r--r--include/linux/page_cgroup.h33
-rw-r--r--include/linux/pci.h138
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/perf_event.h108
-rw-r--r--include/linux/phy.h5
-rw-r--r--include/linux/pid_namespace.h1
-rw-r--r--include/linux/pinctrl/consumer.h159
-rw-r--r--include/linux/pinctrl/machine.h190
-rw-r--r--include/linux/pinctrl/pinconf-generic.h114
-rw-r--r--include/linux/pinctrl/pinconf.h44
-rw-r--r--include/linux/pinctrl/pinctrl-state.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/pinctrl/pinmux.h52
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pkt_sched.h21
-rw-r--r--include/linux/platform_data/atmel.h27
-rw-r--r--include/linux/platform_data/cpsw.h55
-rw-r--r--include/linux/platform_data/dwc3-exynos.h24
-rw-r--r--include/linux/platform_data/efm32-uart.h18
-rw-r--r--include/linux/platform_data/omap-abe-twl6040.h49
-rw-r--r--include/linux/platform_data/omap4-keypad.h13
-rw-r--r--include/linux/platform_data/tegra_emc.h34
-rw-r--r--include/linux/pm.h59
-rw-r--r--include/linux/pm_domain.h27
-rw-r--r--include/linux/pm_qos.h64
-rw-r--r--include/linux/pm_wakeup.h22
-rw-r--r--include/linux/poll.h37
-rw-r--r--include/linux/posix_acl.h1
-rw-r--r--include/linux/power_supply.h3
-rw-r--r--include/linux/ppp-comp.h38
-rw-r--r--include/linux/ppp-ioctl.h119
-rw-r--r--include/linux/ppp_defs.h38
-rw-r--r--include/linux/prctl.h10
-rw-r--r--include/linux/preempt.h5
-rw-r--r--include/linux/printk.h18
-rw-r--r--include/linux/ptrace.h45
-rw-r--r--include/linux/qnx6_fs.h134
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/md_p.h6
-rw-r--r--include/linux/rar_register.h60
-rw-r--r--include/linux/rcupdate.h86
-rw-r--r--include/linux/rcutiny.h10
-rw-r--r--include/linux/rcutree.h19
-rw-r--r--include/linux/regmap.h134
-rw-r--r--include/linux/regset.h1
-rw-r--r--include/linux/regulator/ab8500.h70
-rw-r--r--include/linux/regulator/bq24022.h24
-rw-r--r--include/linux/regulator/consumer.h25
-rw-r--r--include/linux/regulator/driver.h6
-rw-r--r--include/linux/regulator/fixed.h13
-rw-r--r--include/linux/regulator/machine.h2
-rw-r--r--include/linux/regulator/tps62360.h57
-rw-r--r--include/linux/reiserfs_acl.h76
-rw-r--r--include/linux/reiserfs_fs.h2334
-rw-r--r--include/linux/reiserfs_fs_i.h63
-rw-r--r--include/linux/reiserfs_fs_sb.h554
-rw-r--r--include/linux/reiserfs_xattr.h128
-rw-r--r--include/linux/relay.h1
-rw-r--r--include/linux/remoteproc.h478
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/rio_drv.h1
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/rpmsg.h326
-rw-r--r--include/linux/sa11x0-dma.h24
-rw-r--r--include/linux/scatterlist.h6
-rw-r--r--include/linux/sched.h68
-rw-r--r--include/linux/security.h82
-rw-r--r--include/linux/seq_file.h6
-rw-r--r--include/linux/serial.h4
-rw-r--r--include/linux/serialP.h142
-rw-r--r--include/linux/serial_core.h12
-rw-r--r--include/linux/serial_pnx8xxx.h1
-rw-r--r--include/linux/sh_clk.h5
-rw-r--r--include/linux/sh_eth.h1
-rw-r--r--include/linux/skbuff.h49
-rw-r--r--include/linux/slub_def.h1
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/mmc_spi.h2
-rw-r--r--include/linux/spi/orion_spi.h1
-rw-r--r--include/linux/spi/s3c24xx.h26
-rw-r--r--include/linux/spi/sh_hspi.h23
-rw-r--r--include/linux/spi/spi.h53
-rw-r--r--include/linux/spinlock.h5
-rw-r--r--include/linux/srcu.h15
-rw-r--r--include/linux/ssb/ssb.h108
-rw-r--r--include/linux/ssb/ssb_driver_gige.h1
-rw-r--r--include/linux/ssb/ssb_regs.h34
-rw-r--r--include/linux/static_key.h1
-rw-r--r--include/linux/sunrpc/auth.h2
-rw-r--r--include/linux/sunrpc/bc_xprt.h2
-rw-r--r--include/linux/sunrpc/cache.h8
-rw-r--r--include/linux/sunrpc/clnt.h40
-rw-r--r--include/linux/sunrpc/debug.h26
-rw-r--r--include/linux/sunrpc/metrics.h6
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h46
-rw-r--r--include/linux/sunrpc/sched.h24
-rw-r--r--include/linux/sunrpc/stats.h22
-rw-r--r--include/linux/sunrpc/svc.h13
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sunrpc/svcauth.h3
-rw-r--r--include/linux/sunrpc/svcauth_gss.h2
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xprt.h11
-rw-r--r--include/linux/sunrpc/xprtsock.h12
-rw-r--r--include/linux/sunserialcore.h33
-rw-r--r--include/linux/suspend.h4
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/swapops.h1
-rw-r--r--include/linux/sys_soc.h37
-rw-r--r--include/linux/syscalls.h1
-rw-r--r--include/linux/sysctl.h106
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/timex.h17
-rw-r--r--include/linux/trace_seq.h4
-rw-r--r--include/linux/tracehook.h9
-rw-r--r--include/linux/tracepoint.h28
-rw-r--r--include/linux/transport_class.h1
-rw-r--r--include/linux/tty.h6
-rw-r--r--include/linux/tty_driver.h8
-rw-r--r--include/linux/usb.h10
-rw-r--r--include/linux/usb/audio-v2.h21
-rw-r--r--include/linux/usb/cdc-wdm.h19
-rw-r--r--include/linux/usb/ch11.h5
-rw-r--r--include/linux/usb/ch9.h5
-rw-r--r--include/linux/usb/ehci_pdriver.h46
-rw-r--r--include/linux/usb/gadget.h10
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/intel_mid_otg.h6
-rw-r--r--include/linux/usb/msm_hsusb.h2
-rw-r--r--include/linux/usb/ohci_pdriver.h38
-rw-r--r--include/linux/usb/otg.h164
-rw-r--r--include/linux/usb/renesas_usbhs.h1
-rw-r--r--include/linux/usb/serial.h36
-rw-r--r--include/linux/usb/storage.h38
-rw-r--r--include/linux/usb/uas.h69
-rw-r--r--include/linux/usb/ulpi.h4
-rw-r--r--include/linux/videodev2.h149
-rw-r--r--include/linux/virtio_config.h1
-rw-r--r--include/linux/virtio_ids.h2
-rw-r--r--include/linux/virtio_scsi.h114
-rw-r--r--include/linux/vt_kern.h26
-rw-r--r--include/linux/wait.h5
-rw-r--r--include/linux/watchdog.h4
-rw-r--r--include/linux/wimax/debug.h2
-rw-r--r--include/linux/writeback.h2
363 files changed, 8650 insertions, 5424 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index c94e71781b79..a25555381097 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -238,6 +238,7 @@ header-y += magic.h
238header-y += major.h 238header-y += major.h
239header-y += map_to_7segment.h 239header-y += map_to_7segment.h
240header-y += matroxfb.h 240header-y += matroxfb.h
241header-y += mdio.h
241header-y += media.h 242header-y += media.h
242header-y += mempolicy.h 243header-y += mempolicy.h
243header-y += meye.h 244header-y += meye.h
@@ -304,6 +305,7 @@ header-y += poll.h
304header-y += posix_types.h 305header-y += posix_types.h
305header-y += ppdev.h 306header-y += ppdev.h
306header-y += ppp-comp.h 307header-y += ppp-comp.h
308header-y += ppp-ioctl.h
307header-y += ppp_defs.h 309header-y += ppp_defs.h
308header-y += pps.h 310header-y += pps.h
309header-y += prctl.h 311header-y += prctl.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 3f968665899b..f53fea61f40a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val);
151extern int ec_transaction(u8 command, 151extern int ec_transaction(u8 command,
152 const u8 *wdata, unsigned wdata_len, 152 const u8 *wdata, unsigned wdata_len,
153 u8 *rdata, unsigned rdata_len); 153 u8 *rdata, unsigned rdata_len);
154extern acpi_handle ec_get_handle(void);
154 155
155#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) 156#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
156 157
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
index a10a90791976..c022c82db7ca 100644
--- a/include/linux/altera_uart.h
+++ b/include/linux/altera_uart.h
@@ -5,8 +5,6 @@
5#ifndef __ALTUART_H 5#ifndef __ALTUART_H
6#define __ALTUART_H 6#define __ALTUART_H
7 7
8#include <linux/init.h>
9
10struct altera_uart_platform_uart { 8struct altera_uart_platform_uart {
11 unsigned long mapbase; /* Physical address base */ 9 unsigned long mapbase; /* Physical address base */
12 unsigned int irq; /* Interrupt vector */ 10 unsigned int irq; /* Interrupt vector */
@@ -14,6 +12,4 @@ struct altera_uart_platform_uart {
14 unsigned int bus_shift; /* Bus shift (address stride) */ 12 unsigned int bus_shift; /* Bus shift (address stride) */
15}; 13};
16 14
17int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp);
18
19#endif /* __ALTUART_H */ 15#endif /* __ALTUART_H */
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 724c69c40bb8..7847e197730a 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -60,6 +60,9 @@ extern struct bus_type amba_bustype;
60 60
61int amba_driver_register(struct amba_driver *); 61int amba_driver_register(struct amba_driver *);
62void amba_driver_unregister(struct amba_driver *); 62void amba_driver_unregister(struct amba_driver *);
63struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
64void amba_device_put(struct amba_device *);
65int amba_device_add(struct amba_device *, struct resource *);
63int amba_device_register(struct amba_device *, struct resource *); 66int amba_device_register(struct amba_device *, struct resource *);
64void amba_device_unregister(struct amba_device *); 67void amba_device_unregister(struct amba_device *);
65struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 68struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
@@ -89,4 +92,46 @@ void amba_release_regions(struct amba_device *);
89#define amba_manf(d) AMBA_MANF_BITS((d)->periphid) 92#define amba_manf(d) AMBA_MANF_BITS((d)->periphid)
90#define amba_part(d) AMBA_PART_BITS((d)->periphid) 93#define amba_part(d) AMBA_PART_BITS((d)->periphid)
91 94
95#define __AMBA_DEV(busid, data, mask) \
96 { \
97 .coherent_dma_mask = mask, \
98 .init_name = busid, \
99 .platform_data = data, \
100 }
101
102/*
103 * APB devices do not themselves have the ability to address memory,
104 * so DMA masks should be zero (much like USB peripheral devices.)
105 * The DMA controller DMA masks should be used instead (much like
106 * USB host controllers in conventional PCs.)
107 */
108#define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \
109struct amba_device name##_device = { \
110 .dev = __AMBA_DEV(busid, data, 0), \
111 .res = DEFINE_RES_MEM(base, SZ_4K), \
112 .irq = irqs, \
113 .periphid = id, \
114}
115
116/*
117 * AHB devices are DMA capable, so set their DMA masks
118 */
119#define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \
120struct amba_device name##_device = { \
121 .dev = __AMBA_DEV(busid, data, ~0ULL), \
122 .res = DEFINE_RES_MEM(base, SZ_4K), \
123 .dma_mask = ~0ULL, \
124 .irq = irqs, \
125 .periphid = id, \
126}
127
128/*
129 * module_amba_driver() - Helper macro for drivers that don't do anything
130 * special in module init/exit. This eliminates a lot of boilerplate. Each
131 * module may only use this macro once, and calling it replaces module_init()
132 * and module_exit()
133 */
134#define module_amba_driver(__amba_drv) \
135 module_driver(__amba_drv, amba_driver_register, amba_driver_unregister)
136
92#endif 137#endif
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 0101e9c17fa1..32a89cf5ec45 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,6 +6,19 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9
10/*
11 * These defines is places here due to access is needed from machine
12 * configuration files. The ST Micro version does not have ROD and
13 * reuse the voltage registers for direction settings.
14 */
15#define MCI_ST_DATA2DIREN (1 << 2)
16#define MCI_ST_CMDDIREN (1 << 3)
17#define MCI_ST_DATA0DIREN (1 << 4)
18#define MCI_ST_DATA31DIREN (1 << 5)
19#define MCI_ST_FBCLKEN (1 << 7)
20#define MCI_ST_DATA74DIREN (1 << 8)
21
9/* Just some dummy forwarding */ 22/* Just some dummy forwarding */
10struct dma_chan; 23struct dma_chan;
11 24
@@ -18,7 +31,8 @@ struct dma_chan;
18 * @ocr_mask: available voltages on the 4 pins from the block, this 31 * @ocr_mask: available voltages on the 4 pins from the block, this
19 * is ignored if a regulator is used, see the MMC_VDD_* masks in 32 * is ignored if a regulator is used, see the MMC_VDD_* masks in
20 * mmc/host.h 33 * mmc/host.h
21 * @vdd_handler: a callback function to translate a MMC_VDD_* 34 * @ios_handler: a callback function to act on specfic ios changes,
35 * used for example to control a levelshifter
22 * mask into a value to be binary (or set some other custom bits 36 * mask into a value to be binary (or set some other custom bits
23 * in MMCIPWR) or:ed and written into the MMCIPWR register of the 37 * in MMCIPWR) or:ed and written into the MMCIPWR register of the
24 * block. May also control external power based on the power_mode. 38 * block. May also control external power based on the power_mode.
@@ -31,6 +45,8 @@ struct dma_chan;
31 * @capabilities: the capabilities of the block as implemented in 45 * @capabilities: the capabilities of the block as implemented in
32 * this platform, signify anything MMC_CAP_* from mmc/host.h 46 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h 47 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
48 * @sigdir: a bit field indicating for what bits in the MMC bus the host
49 * should enable signal direction indication.
34 * @dma_filter: function used to select an appropriate RX and TX 50 * @dma_filter: function used to select an appropriate RX and TX
35 * DMA channel to be used for DMA, if and only if you're deploying the 51 * DMA channel to be used for DMA, if and only if you're deploying the
36 * generic DMA engine 52 * generic DMA engine
@@ -46,14 +62,14 @@ struct dma_chan;
46struct mmci_platform_data { 62struct mmci_platform_data {
47 unsigned int f_max; 63 unsigned int f_max;
48 unsigned int ocr_mask; 64 unsigned int ocr_mask;
49 u32 (*vdd_handler)(struct device *, unsigned int vdd, 65 int (*ios_handler)(struct device *, struct mmc_ios *);
50 unsigned char power_mode);
51 unsigned int (*status)(struct device *); 66 unsigned int (*status)(struct device *);
52 int gpio_wp; 67 int gpio_wp;
53 int gpio_cd; 68 int gpio_cd;
54 bool cd_invert; 69 bool cd_invert;
55 unsigned long capabilities; 70 unsigned long capabilities;
56 unsigned long capabilities2; 71 unsigned long capabilities2;
72 u32 sigdir;
57 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 73 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
58 void *dma_rx_param; 74 void *dma_rx_param;
59 void *dma_tx_param; 75 void *dma_tx_param;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 572f637299c9..b8c51124ed19 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -25,8 +25,6 @@
25#ifndef _SSP_PL022_H 25#ifndef _SSP_PL022_H
26#define _SSP_PL022_H 26#define _SSP_PL022_H
27 27
28#include <linux/device.h>
29
30/** 28/**
31 * whether SSP is in loopback mode or not 29 * whether SSP is in loopback mode or not
32 */ 30 */
@@ -241,6 +239,8 @@ struct dma_chan;
241 * @autosuspend_delay: delay in ms following transfer completion before the 239 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0 240 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately. 241 * indicates no delay and the device will be suspended immediately.
242 * @rt: indicates the controller should run the message pump with realtime
243 * priority to minimise the transfer latency on the bus.
244 */ 244 */
245struct pl022_ssp_controller { 245struct pl022_ssp_controller {
246 u16 bus_id; 246 u16 bus_id;
@@ -250,6 +250,7 @@ struct pl022_ssp_controller {
250 void *dma_rx_param; 250 void *dma_rx_param;
251 void *dma_tx_param; 251 void *dma_tx_param;
252 int autosuspend_delay; 252 int autosuspend_delay;
253 bool rt;
253}; 254};
254 255
255/** 256/**
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index ef00610837d4..15f6b9edd0b1 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -28,7 +28,7 @@ struct task_struct;
28struct pci_dev; 28struct pci_dev;
29 29
30extern int amd_iommu_detect(void); 30extern int amd_iommu_detect(void);
31 31extern int amd_iommu_init_hardware(void);
32 32
33/** 33/**
34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device 34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device
diff --git a/include/linux/apple_bl.h b/include/linux/apple_bl.h
new file mode 100644
index 000000000000..47bedc0eee69
--- /dev/null
+++ b/include/linux/apple_bl.h
@@ -0,0 +1,26 @@
1/*
2 * apple_bl exported symbols
3 */
4
5#ifndef _LINUX_APPLE_BL_H
6#define _LINUX_APPLE_BL_H
7
8#ifdef CONFIG_BACKLIGHT_APPLE
9
10extern int apple_bl_register(void);
11extern void apple_bl_unregister(void);
12
13#else /* !CONFIG_BACKLIGHT_APPLE */
14
15static inline int apple_bl_register(void)
16{
17 return 0;
18}
19
20static inline void apple_bl_unregister(void)
21{
22}
23
24#endif /* !CONFIG_BACKLIGHT_APPLE */
25
26#endif /* _LINUX_APPLE_BL_H */
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index f4ff882cb2da..06fd4bbc58f6 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -213,10 +213,10 @@ struct atm_cirange {
213 213
214#ifdef __KERNEL__ 214#ifdef __KERNEL__
215 215
216#include <linux/device.h>
217#include <linux/wait.h> /* wait_queue_head_t */ 216#include <linux/wait.h> /* wait_queue_head_t */
218#include <linux/time.h> /* struct timeval */ 217#include <linux/time.h> /* struct timeval */
219#include <linux/net.h> 218#include <linux/net.h>
219#include <linux/bug.h>
220#include <linux/skbuff.h> /* struct sk_buff */ 220#include <linux/skbuff.h> /* struct sk_buff */
221#include <linux/uio.h> 221#include <linux/uio.h>
222#include <net/sock.h> 222#include <net/sock.h>
@@ -249,6 +249,7 @@ struct k_atm_dev_stats {
249 struct k_atm_aal_stats aal5; 249 struct k_atm_aal_stats aal5;
250}; 250};
251 251
252struct device;
252 253
253enum { 254enum {
254 ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared 255 ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 53ba65e30caa..1d14b1dc1aee 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -34,10 +34,19 @@
34struct clk; 34struct clk;
35 35
36/** 36/**
37 * struct atmel_tcb_config - SoC data for a Timer/Counter Block
38 * @counter_width: size in bits of a timer counter register
39 */
40struct atmel_tcb_config {
41 size_t counter_width;
42};
43
44/**
37 * struct atmel_tc - information about a Timer/Counter Block 45 * struct atmel_tc - information about a Timer/Counter Block
38 * @pdev: physical device 46 * @pdev: physical device
39 * @iomem: resource associated with the I/O register 47 * @iomem: resource associated with the I/O register
40 * @regs: mapping through which the I/O registers can be accessed 48 * @regs: mapping through which the I/O registers can be accessed
49 * @tcb_config: configuration data from SoC
41 * @irq: irq for each of the three channels 50 * @irq: irq for each of the three channels
42 * @clk: internal clock source for each of the three channels 51 * @clk: internal clock source for each of the three channels
43 * @node: list node, for tclib internal use 52 * @node: list node, for tclib internal use
@@ -54,6 +63,7 @@ struct atmel_tc {
54 struct platform_device *pdev; 63 struct platform_device *pdev;
55 struct resource *iomem; 64 struct resource *iomem;
56 void __iomem *regs; 65 void __iomem *regs;
66 struct atmel_tcb_config *tcb_config;
57 int irq[3]; 67 int irq[3];
58 struct clk *clk[3]; 68 struct clk *clk[3];
59 struct list_head node; 69 struct list_head node;
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index 42b77b5446d2..70cfcb2d63c4 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -24,7 +24,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
24 * Atomically increments @v by 1, so long as @v is non-zero. 24 * Atomically increments @v by 1, so long as @v is non-zero.
25 * Returns non-zero if @v was non-zero, and zero otherwise. 25 * Returns non-zero if @v was non-zero, and zero otherwise.
26 */ 26 */
27#ifndef atomic_inc_not_zero
27#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 28#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
29#endif
28 30
29/** 31/**
30 * atomic_inc_not_zero_hint - increment if not null 32 * atomic_inc_not_zero_hint - increment if not null
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index c3ab81428c66..896c6892f327 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -9,10 +9,11 @@
9#ifndef _ATTRIBUTE_CONTAINER_H_ 9#ifndef _ATTRIBUTE_CONTAINER_H_
10#define _ATTRIBUTE_CONTAINER_H_ 10#define _ATTRIBUTE_CONTAINER_H_
11 11
12#include <linux/device.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <linux/klist.h> 13#include <linux/klist.h>
15 14
15struct device;
16
16struct attribute_container { 17struct attribute_container {
17 struct list_head node; 18 struct list_head node;
18 struct klist containers; 19 struct klist containers;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 9ff7a2c48b50..ed3ef1972496 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -684,7 +684,7 @@ extern void audit_log_untrustedstring(struct audit_buffer *ab,
684 const char *string); 684 const char *string);
685extern void audit_log_d_path(struct audit_buffer *ab, 685extern void audit_log_d_path(struct audit_buffer *ab,
686 const char *prefix, 686 const char *prefix,
687 struct path *path); 687 const struct path *path);
688extern void audit_log_key(struct audit_buffer *ab, 688extern void audit_log_key(struct audit_buffer *ab,
689 char *key); 689 char *key);
690extern void audit_log_lost(const char *message); 690extern void audit_log_lost(const char *message);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 83c209f39493..5af9a075498f 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -136,6 +136,7 @@ struct bcma_device {
136 bool dev_registered; 136 bool dev_registered;
137 137
138 u8 core_index; 138 u8 core_index;
139 u8 core_unit;
139 140
140 u32 addr; 141 u32 addr;
141 u32 wrap; 142 u32 wrap;
@@ -175,6 +176,12 @@ int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
175 176
176extern void bcma_driver_unregister(struct bcma_driver *drv); 177extern void bcma_driver_unregister(struct bcma_driver *drv);
177 178
179/* Set a fallback SPROM.
180 * See kdoc at the function definition for complete documentation. */
181extern int bcma_arch_register_fallback_sprom(
182 int (*sprom_callback)(struct bcma_bus *bus,
183 struct ssb_sprom *out));
184
178struct bcma_bus { 185struct bcma_bus {
179 /* The MMIO area. */ 186 /* The MMIO area. */
180 void __iomem *mmio; 187 void __iomem *mmio;
@@ -195,6 +202,7 @@ struct bcma_bus {
195 struct list_head cores; 202 struct list_head cores;
196 u8 nr_cores; 203 u8 nr_cores;
197 u8 init_done:1; 204 u8 init_done:1;
205 u8 num;
198 206
199 struct bcma_drv_cc drv_cc; 207 struct bcma_drv_cc drv_cc;
200 struct bcma_drv_pci drv_pci; 208 struct bcma_drv_pci drv_pci;
@@ -282,6 +290,7 @@ static inline void bcma_maskset16(struct bcma_device *cc,
282 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); 290 bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set);
283} 291}
284 292
293extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid);
285extern bool bcma_core_is_enabled(struct bcma_device *core); 294extern bool bcma_core_is_enabled(struct bcma_device *core);
286extern void bcma_core_disable(struct bcma_device *core, u32 flags); 295extern void bcma_core_disable(struct bcma_device *core, u32 flags);
287extern int bcma_core_enable(struct bcma_device *core, u32 flags); 296extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index a33086a7530b..8bbfe31fbac8 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -56,6 +56,9 @@
56#define BCMA_CC_OTPS_HW_PROTECT 0x00000001 56#define BCMA_CC_OTPS_HW_PROTECT 0x00000001
57#define BCMA_CC_OTPS_SW_PROTECT 0x00000002 57#define BCMA_CC_OTPS_SW_PROTECT 0x00000002
58#define BCMA_CC_OTPS_CID_PROTECT 0x00000004 58#define BCMA_CC_OTPS_CID_PROTECT 0x00000004
59#define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */
60#define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8
61#define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */
59#define BCMA_CC_OTPC 0x0014 /* OTP control */ 62#define BCMA_CC_OTPC 0x0014 /* OTP control */
60#define BCMA_CC_OTPC_RECWAIT 0xFF000000 63#define BCMA_CC_OTPC_RECWAIT 0xFF000000
61#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 64#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00
@@ -72,6 +75,8 @@
72#define BCMA_CC_OTPP_READ 0x40000000 75#define BCMA_CC_OTPP_READ 0x40000000
73#define BCMA_CC_OTPP_START 0x80000000 76#define BCMA_CC_OTPP_START 0x80000000
74#define BCMA_CC_OTPP_BUSY 0x80000000 77#define BCMA_CC_OTPP_BUSY 0x80000000
78#define BCMA_CC_OTPL 0x001C /* OTP layout */
79#define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */
75#define BCMA_CC_IRQSTAT 0x0020 80#define BCMA_CC_IRQSTAT 0x0020
76#define BCMA_CC_IRQMASK 0x0024 81#define BCMA_CC_IRQMASK 0x0024
77#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ 82#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */
@@ -79,6 +84,10 @@
79#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ 84#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */
80#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ 85#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */
81#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ 86#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */
87#define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1
88#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2
89#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2
90#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4
82#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ 91#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */
83#define BCMA_CC_JCMD_START 0x80000000 92#define BCMA_CC_JCMD_START 0x80000000
84#define BCMA_CC_JCMD_BUSY 0x80000000 93#define BCMA_CC_JCMD_BUSY 0x80000000
@@ -181,6 +190,22 @@
181#define BCMA_CC_FLASH_CFG 0x0128 190#define BCMA_CC_FLASH_CFG 0x0128
182#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ 191#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */
183#define BCMA_CC_FLASH_WAITCNT 0x012C 192#define BCMA_CC_FLASH_WAITCNT 0x012C
193#define BCMA_CC_SROM_CONTROL 0x0190
194#define BCMA_CC_SROM_CONTROL_START 0x80000000
195#define BCMA_CC_SROM_CONTROL_BUSY 0x80000000
196#define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000
197#define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000
198#define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000
199#define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000
200#define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000
201#define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010
202#define BCMA_CC_SROM_CONTROL_LOCK 0x00000008
203#define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006
204#define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000
205#define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002
206#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004
207#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1
208#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001
184/* 0x1E0 is defined as shared BCMA_CLKCTLST */ 209/* 0x1E0 is defined as shared BCMA_CLKCTLST */
185#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 210#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
186#define BCMA_CC_UART0_DATA 0x0300 211#define BCMA_CC_UART0_DATA 0x0300
@@ -240,7 +265,6 @@
240#define BCMA_CC_PLLCTL_ADDR 0x0660 265#define BCMA_CC_PLLCTL_ADDR 0x0660
241#define BCMA_CC_PLLCTL_DATA 0x0664 266#define BCMA_CC_PLLCTL_DATA 0x0664
242#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 267#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
243#define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */
244 268
245/* Divider allocation in 4716/47162/5356 */ 269/* Divider allocation in 4716/47162/5356 */
246#define BCMA_CC_PMU5_MAINPLL_CPU 1 270#define BCMA_CC_PMU5_MAINPLL_CPU 1
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3871b668caf9..46c71e27d31f 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -53,6 +53,35 @@ struct pci_dev;
53#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 53#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000
54#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ 54#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */
55#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 55#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000
56#define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */
57#define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */
58#define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */
59#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */
60#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2
61#define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */
62#define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */
63#define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */
64#define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */
65#define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */
66#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */
67#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */
68#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */
69#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */
70#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */
71#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */
72#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */
73#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */
74#define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */
75#define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */
76#define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */
77#define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */
78#define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */
79#define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */
80#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */
81#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */
82#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */
83#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */
84#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */
56#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ 85#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */
57#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ 86#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */
58#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
@@ -72,20 +101,114 @@ struct pci_dev;
72#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ 101#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */
73#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ 102#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */
74 103
104/* PCIE protocol PHY diagnostic registers */
105#define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */
106#define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */
107#define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */
108#define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */
109#define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */
110#define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */
111#define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */
112#define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */
113#define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */
114#define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */
115#define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */
116#define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */
117#define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */
118#define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */
119#define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */
120#define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */
121#define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */
122
123/* PCIE protocol DLLP diagnostic registers */
124#define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */
125#define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */
126#define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */
127#define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16)
128#define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */
129#define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */
130#define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */
131#define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */
132#define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */
133#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
134#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
135#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
136#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
137#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
138#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
139#define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */
140#define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */
141#define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */
142#define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */
143#define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */
144#define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */
145#define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */
146#define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */
147
148/* SERDES RX registers */
149#define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */
150#define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */
151#define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */
152#define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */
153#define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */
154#define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */
155
156/* SERDES PLL registers */
157#define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */
158#define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */
159
75/* PCIcore specific boardflags */ 160/* PCIcore specific boardflags */
76#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ 161#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */
77 162
163/* PCIE Config space accessing MACROS */
164#define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */
165#define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */
166#define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */
167#define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */
168
169#define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */
170#define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */
171#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */
172#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */
173
174/* PCIE Root Capability Register bits (Host mode only) */
175#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001
176
177struct bcma_drv_pci;
178
179#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
180struct bcma_drv_pci_host {
181 struct bcma_drv_pci *pdev;
182
183 u32 host_cfg_addr;
184 spinlock_t cfgspace_lock;
185
186 struct pci_controller pci_controller;
187 struct pci_ops pci_ops;
188 struct resource mem_resource;
189 struct resource io_resource;
190};
191#endif
192
78struct bcma_drv_pci { 193struct bcma_drv_pci {
79 struct bcma_device *core; 194 struct bcma_device *core;
80 u8 setup_done:1; 195 u8 setup_done:1;
196 u8 hostmode:1;
197
198#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
199 struct bcma_drv_pci_host *host_controller;
200#endif
81}; 201};
82 202
83/* Register access */ 203/* Register access */
84#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 204#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
85#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 205#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
86 206
87extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 207extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
88extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 208extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
89 struct bcma_device *core, bool enable); 209 struct bcma_device *core, bool enable);
90 210
211extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
212extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
213
91#endif /* LINUX_BCMA_DRIVER_PCI_H_ */ 214#endif /* LINUX_BCMA_DRIVER_PCI_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index 9faae2ae02e8..5a71d5719640 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -56,4 +56,31 @@
56#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ 56#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */
57#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ 57#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */
58 58
59/* SiliconBackplane Address Map.
60 * All regions may not exist on all chips.
61 */
62#define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */
63#define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */
64#define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024)
65#define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */
66#define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */
67#define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */
68
69
70#define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */
71#define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */
72#define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */
73#define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2
74 * (2 ZettaBytes), low 32 bits
75 */
76#define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2
77 * (2 ZettaBytes), high 32 bits
78 */
79
80#define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */
81#define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */
82#define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2
83 * (2 ZettaBytes), high 32 bits
84 */
85
59#endif /* LINUX_BCMA_REGS_H_ */ 86#endif /* LINUX_BCMA_REGS_H_ */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 0092102db2de..366422bc1633 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -92,17 +92,17 @@ struct linux_binfmt {
92 unsigned long min_coredump; /* minimal dump size */ 92 unsigned long min_coredump; /* minimal dump size */
93}; 93};
94 94
95extern int __register_binfmt(struct linux_binfmt *fmt, int insert); 95extern void __register_binfmt(struct linux_binfmt *fmt, int insert);
96 96
97/* Registration of default binfmt handlers */ 97/* Registration of default binfmt handlers */
98static inline int register_binfmt(struct linux_binfmt *fmt) 98static inline void register_binfmt(struct linux_binfmt *fmt)
99{ 99{
100 return __register_binfmt(fmt, 0); 100 __register_binfmt(fmt, 0);
101} 101}
102/* Same as above, but adds a new binfmt at the top of the list */ 102/* Same as above, but adds a new binfmt at the top of the list */
103static inline int insert_binfmt(struct linux_binfmt *fmt) 103static inline void insert_binfmt(struct linux_binfmt *fmt)
104{ 104{
105 return __register_binfmt(fmt, 1); 105 __register_binfmt(fmt, 1);
106} 106}
107 107
108extern void unregister_binfmt(struct linux_binfmt *); 108extern void unregister_binfmt(struct linux_binfmt *);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 129a9c097958..4d94eb8bcbcc 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -23,6 +23,7 @@
23#include <linux/highmem.h> 23#include <linux/highmem.h>
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26#include <linux/bug.h>
26 27
27#ifdef CONFIG_BLOCK 28#ifdef CONFIG_BLOCK
28 29
@@ -101,10 +102,10 @@ static inline int bio_has_allocated_vec(struct bio *bio)
101 * I/O completely on that queue (see ide-dma for example) 102 * I/O completely on that queue (see ide-dma for example)
102 */ 103 */
103#define __bio_kmap_atomic(bio, idx, kmtype) \ 104#define __bio_kmap_atomic(bio, idx, kmtype) \
104 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ 105 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
105 bio_iovec_idx((bio), (idx))->bv_offset) 106 bio_iovec_idx((bio), (idx))->bv_offset)
106 107
107#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) 108#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr)
108 109
109/* 110/*
110 * merge helpers etc 111 * merge helpers etc
@@ -317,7 +318,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
317 * balancing is a lot nicer this way 318 * balancing is a lot nicer this way
318 */ 319 */
319 local_irq_save(*flags); 320 local_irq_save(*flags);
320 addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); 321 addr = (unsigned long) kmap_atomic(bvec->bv_page);
321 322
322 BUG_ON(addr & ~PAGE_MASK); 323 BUG_ON(addr & ~PAGE_MASK);
323 324
@@ -328,7 +329,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
328{ 329{
329 unsigned long ptr = (unsigned long) buffer & PAGE_MASK; 330 unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
330 331
331 kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); 332 kunmap_atomic((void *) ptr);
332 local_irq_restore(*flags); 333 local_irq_restore(*flags);
333} 334}
334 335
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index ac4d9f8b52e9..3b5bafce4337 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -4,6 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/preempt.h> 5#include <linux/preempt.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/bug.h>
7 8
8/* 9/*
9 * bit-based spin_lock() 10 * bit-based spin_lock()
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 94300fe46cce..a3b6b82108b9 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -27,11 +27,22 @@ extern unsigned long __sw_hweight64(__u64 w);
27 (bit) = find_next_bit((addr), (size), (bit) + 1)) 27 (bit) = find_next_bit((addr), (size), (bit) + 1))
28 28
29/* same as for_each_set_bit() but use bit as value to start with */ 29/* same as for_each_set_bit() but use bit as value to start with */
30#define for_each_set_bit_cont(bit, addr, size) \ 30#define for_each_set_bit_from(bit, addr, size) \
31 for ((bit) = find_next_bit((addr), (size), (bit)); \ 31 for ((bit) = find_next_bit((addr), (size), (bit)); \
32 (bit) < (size); \ 32 (bit) < (size); \
33 (bit) = find_next_bit((addr), (size), (bit) + 1)) 33 (bit) = find_next_bit((addr), (size), (bit) + 1))
34 34
35#define for_each_clear_bit(bit, addr, size) \
36 for ((bit) = find_first_zero_bit((addr), (size)); \
37 (bit) < (size); \
38 (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
39
40/* same as for_each_clear_bit() but use bit as value to start with */
41#define for_each_clear_bit_from(bit, addr, size) \
42 for ((bit) = find_next_zero_bit((addr), (size), (bit)); \
43 (bit) < (size); \
44 (bit) = find_next_zero_bit((addr), (size), (bit) + 1))
45
35static __inline__ int get_bitmask_order(unsigned int count) 46static __inline__ int get_bitmask_order(unsigned int count)
36{ 47{
37 int order; 48 int order;
diff --git a/include/linux/bug.h b/include/linux/bug.h
index d276b5510c83..72961c39576a 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -11,6 +11,67 @@ enum bug_trap_type {
11 11
12struct pt_regs; 12struct pt_regs;
13 13
14#ifdef __CHECKER__
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
16#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON(condition)
19#define BUILD_BUG() (0)
20#else /* __CHECKER__ */
21
22/* Force a compilation error if a constant expression is not a power of 2 */
23#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
24 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
25
26/* Force a compilation error if condition is true, but also produce a
27 result (of value 0 and type size_t), so the expression can be used
28 e.g. in a structure initializer (or where-ever else comma expressions
29 aren't permitted). */
30#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
31#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
32
33/**
34 * BUILD_BUG_ON - break compile if a condition is true.
35 * @condition: the condition which the compiler should know is false.
36 *
37 * If you have some code which relies on certain constants being equal, or
38 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
39 * detect if someone changes it.
40 *
41 * The implementation uses gcc's reluctance to create a negative array, but
42 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
43 * to inline functions). So as a fallback we use the optimizer; if it can't
44 * prove the condition is false, it will cause a link error on the undefined
45 * "__build_bug_on_failed". This error message can be harder to track down
46 * though, hence the two different methods.
47 */
48#ifndef __OPTIMIZE__
49#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
50#else
51extern int __build_bug_on_failed;
52#define BUILD_BUG_ON(condition) \
53 do { \
54 ((void)sizeof(char[1 - 2*!!(condition)])); \
55 if (condition) __build_bug_on_failed = 1; \
56 } while(0)
57#endif
58
59/**
60 * BUILD_BUG - break compile if used.
61 *
62 * If you have some code that you expect the compiler to eliminate at
63 * build time, you should use BUILD_BUG to detect if it is
64 * unexpectedly used.
65 */
66#define BUILD_BUG() \
67 do { \
68 extern void __build_bug_failed(void) \
69 __linktime_error("BUILD_BUG failed"); \
70 __build_bug_failed(); \
71 } while (0)
72
73#endif /* __CHECKER__ */
74
14#ifdef CONFIG_GENERIC_BUG 75#ifdef CONFIG_GENERIC_BUG
15#include <asm-generic/bug.h> 76#include <asm-generic/bug.h>
16 77
diff --git a/include/linux/c2port.h b/include/linux/c2port.h
index a2f7d7413f30..4efabcb51347 100644
--- a/include/linux/c2port.h
+++ b/include/linux/c2port.h
@@ -9,11 +9,12 @@
9 * the Free Software Foundation 9 * the Free Software Foundation
10 */ 10 */
11 11
12#include <linux/device.h>
13#include <linux/kmemcheck.h> 12#include <linux/kmemcheck.h>
14 13
15#define C2PORT_NAME_LEN 32 14#define C2PORT_NAME_LEN 32
16 15
16struct device;
17
17/* 18/*
18 * C2 port basic structs 19 * C2 port basic structs
19 */ 20 */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index a0969fcb72b9..5d2efe7e3f1b 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev);
92 92
93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, 93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
94 unsigned int idx); 94 unsigned int idx);
95void can_get_echo_skb(struct net_device *dev, unsigned int idx); 95unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
96void can_free_echo_skb(struct net_device *dev, unsigned int idx); 96void can_free_echo_skb(struct net_device *dev, unsigned int idx);
97 97
98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 7c48029dffe6..dfd7f187c351 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -910,7 +910,6 @@ struct mode_page_header {
910 910
911#ifdef __KERNEL__ 911#ifdef __KERNEL__
912#include <linux/fs.h> /* not really needed, later.. */ 912#include <linux/fs.h> /* not really needed, later.. */
913#include <linux/device.h>
914#include <linux/list.h> 913#include <linux/list.h>
915 914
916struct packet_command 915struct packet_command
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index c5b6939fb32a..220ae21e819b 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -1,8 +1,9 @@
1#ifndef __CEPH_DECODE_H 1#ifndef __CEPH_DECODE_H
2#define __CEPH_DECODE_H 2#define __CEPH_DECODE_H
3 3
4#include <asm/unaligned.h> 4#include <linux/bug.h>
5#include <linux/time.h> 5#include <linux/time.h>
6#include <asm/unaligned.h>
6 7
7#include "types.h" 8#include "types.h"
8 9
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 95bd8502e715..e71d683982a6 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -7,6 +7,7 @@
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/completion.h> 8#include <linux/completion.h>
9#include <linux/exportfs.h> 9#include <linux/exportfs.h>
10#include <linux/bug.h>
10#include <linux/fs.h> 11#include <linux/fs.h>
11#include <linux/mempool.h> 12#include <linux/mempool.h>
12#include <linux/pagemap.h> 13#include <linux/pagemap.h>
@@ -207,7 +208,7 @@ extern struct kmem_cache *ceph_cap_cachep;
207extern struct kmem_cache *ceph_dentry_cachep; 208extern struct kmem_cache *ceph_dentry_cachep;
208extern struct kmem_cache *ceph_file_cachep; 209extern struct kmem_cache *ceph_file_cachep;
209 210
210extern int ceph_parse_options(struct ceph_options **popt, char *options, 211extern struct ceph_options *ceph_parse_options(char *options,
211 const char *dev_name, const char *dev_name_end, 212 const char *dev_name, const char *dev_name_end,
212 int (*parse_extra_token)(char *c, void *private), 213 int (*parse_extra_token)(char *c, void *private),
213 void *private); 214 void *private);
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index 4c5cb0880bba..9935fac8c107 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -1,6 +1,7 @@
1#ifndef _FS_CEPH_MDSMAP_H 1#ifndef _FS_CEPH_MDSMAP_H
2#define _FS_CEPH_MDSMAP_H 2#define _FS_CEPH_MDSMAP_H
3 3
4#include <linux/bug.h>
4#include "types.h" 5#include "types.h"
5 6
6/* 7/*
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index ffbeb2c217b4..3bff047f6b0f 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -14,8 +14,6 @@
14struct ceph_msg; 14struct ceph_msg;
15struct ceph_connection; 15struct ceph_connection;
16 16
17extern struct workqueue_struct *ceph_msgr_wq; /* receive work queue */
18
19/* 17/*
20 * Ceph defines these callbacks for handling connection events. 18 * Ceph defines these callbacks for handling connection events.
21 */ 19 */
@@ -54,7 +52,6 @@ struct ceph_connection_operations {
54struct ceph_messenger { 52struct ceph_messenger {
55 struct ceph_entity_inst inst; /* my name+address */ 53 struct ceph_entity_inst inst; /* my name+address */
56 struct ceph_entity_addr my_enc_addr; 54 struct ceph_entity_addr my_enc_addr;
57 struct page *zero_page; /* used in certain error cases */
58 55
59 bool nocrc; 56 bool nocrc;
60 57
@@ -101,7 +98,7 @@ struct ceph_msg {
101struct ceph_msg_pos { 98struct ceph_msg_pos {
102 int page, page_pos; /* which page; offset in page */ 99 int page, page_pos; /* which page; offset in page */
103 int data_pos; /* offset in data payload */ 100 int data_pos; /* offset in data payload */
104 int did_page_crc; /* true if we've calculated crc for current page */ 101 bool did_page_crc; /* true if we've calculated crc for current page */
105}; 102};
106 103
107/* ceph connection fault delay defaults, for exponential backoff */ 104/* ceph connection fault delay defaults, for exponential backoff */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e9b602151caf..5a85b3415c1b 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -160,38 +160,6 @@ enum {
160 CGRP_CLONE_CHILDREN, 160 CGRP_CLONE_CHILDREN,
161}; 161};
162 162
163/* which pidlist file are we talking about? */
164enum cgroup_filetype {
165 CGROUP_FILE_PROCS,
166 CGROUP_FILE_TASKS,
167};
168
169/*
170 * A pidlist is a list of pids that virtually represents the contents of one
171 * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists,
172 * a pair (one each for procs, tasks) for each pid namespace that's relevant
173 * to the cgroup.
174 */
175struct cgroup_pidlist {
176 /*
177 * used to find which pidlist is wanted. doesn't change as long as
178 * this particular list stays in the list.
179 */
180 struct { enum cgroup_filetype type; struct pid_namespace *ns; } key;
181 /* array of xids */
182 pid_t *list;
183 /* how many elements the above list has */
184 int length;
185 /* how many files are using the current array */
186 int use_count;
187 /* each of these stored in a list by its cgroup */
188 struct list_head links;
189 /* pointer to the cgroup we belong to, for list removal purposes */
190 struct cgroup *owner;
191 /* protects the other fields */
192 struct rw_semaphore mutex;
193};
194
195struct cgroup { 163struct cgroup {
196 unsigned long flags; /* "unsigned long" so bitops work */ 164 unsigned long flags; /* "unsigned long" so bitops work */
197 165
@@ -484,23 +452,18 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
484 */ 452 */
485 453
486struct cgroup_subsys { 454struct cgroup_subsys {
487 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 455 struct cgroup_subsys_state *(*create)(struct cgroup *cgrp);
488 struct cgroup *cgrp); 456 int (*pre_destroy)(struct cgroup *cgrp);
489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 457 void (*destroy)(struct cgroup *cgrp);
490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 458 int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 459 void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
492 struct cgroup_taskset *tset); 460 void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
493 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 461 void (*fork)(struct task_struct *task);
494 struct cgroup_taskset *tset); 462 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
495 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 463 struct task_struct *task);
496 struct cgroup_taskset *tset); 464 int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
497 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 465 void (*post_clone)(struct cgroup *cgrp);
498 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 466 void (*bind)(struct cgroup *root);
499 struct cgroup *old_cgrp, struct task_struct *task);
500 int (*populate)(struct cgroup_subsys *ss,
501 struct cgroup *cgrp);
502 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
503 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
504 467
505 int subsys_id; 468 int subsys_id;
506 int active; 469 int active;
@@ -535,7 +498,7 @@ struct cgroup_subsys {
535 struct list_head sibling; 498 struct list_head sibling;
536 /* used when use_id == true */ 499 /* used when use_id == true */
537 struct idr idr; 500 struct idr idr;
538 rwlock_t id_lock; 501 spinlock_t id_lock;
539 502
540 /* should be defined only by modular subsystems */ 503 /* should be defined only by modular subsystems */
541 struct module *module; 504 struct module *module;
@@ -602,11 +565,6 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan);
602int cgroup_attach_task(struct cgroup *, struct task_struct *); 565int cgroup_attach_task(struct cgroup *, struct task_struct *);
603int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 566int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
604 567
605static inline int cgroup_attach_task_current_cg(struct task_struct *tsk)
606{
607 return cgroup_attach_task_all(current, tsk);
608}
609
610/* 568/*
611 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works 569 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
612 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. 570 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
@@ -669,10 +627,6 @@ static inline int cgroup_attach_task_all(struct task_struct *from,
669{ 627{
670 return 0; 628 return 0;
671} 629}
672static inline int cgroup_attach_task_current_cg(struct task_struct *t)
673{
674 return 0;
675}
676 630
677#endif /* !CONFIG_CGROUPS */ 631#endif /* !CONFIG_CGROUPS */
678 632
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
index 04ffb2e6c9d0..42e55deee757 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -28,9 +28,9 @@ struct cleancache_ops {
28 pgoff_t, struct page *); 28 pgoff_t, struct page *);
29 void (*put_page)(int, struct cleancache_filekey, 29 void (*put_page)(int, struct cleancache_filekey,
30 pgoff_t, struct page *); 30 pgoff_t, struct page *);
31 void (*flush_page)(int, struct cleancache_filekey, pgoff_t); 31 void (*invalidate_page)(int, struct cleancache_filekey, pgoff_t);
32 void (*flush_inode)(int, struct cleancache_filekey); 32 void (*invalidate_inode)(int, struct cleancache_filekey);
33 void (*flush_fs)(int); 33 void (*invalidate_fs)(int);
34}; 34};
35 35
36extern struct cleancache_ops 36extern struct cleancache_ops
@@ -39,9 +39,9 @@ extern void __cleancache_init_fs(struct super_block *);
39extern void __cleancache_init_shared_fs(char *, struct super_block *); 39extern void __cleancache_init_shared_fs(char *, struct super_block *);
40extern int __cleancache_get_page(struct page *); 40extern int __cleancache_get_page(struct page *);
41extern void __cleancache_put_page(struct page *); 41extern void __cleancache_put_page(struct page *);
42extern void __cleancache_flush_page(struct address_space *, struct page *); 42extern void __cleancache_invalidate_page(struct address_space *, struct page *);
43extern void __cleancache_flush_inode(struct address_space *); 43extern void __cleancache_invalidate_inode(struct address_space *);
44extern void __cleancache_flush_fs(struct super_block *); 44extern void __cleancache_invalidate_fs(struct super_block *);
45extern int cleancache_enabled; 45extern int cleancache_enabled;
46 46
47#ifdef CONFIG_CLEANCACHE 47#ifdef CONFIG_CLEANCACHE
@@ -99,24 +99,24 @@ static inline void cleancache_put_page(struct page *page)
99 __cleancache_put_page(page); 99 __cleancache_put_page(page);
100} 100}
101 101
102static inline void cleancache_flush_page(struct address_space *mapping, 102static inline void cleancache_invalidate_page(struct address_space *mapping,
103 struct page *page) 103 struct page *page)
104{ 104{
105 /* careful... page->mapping is NULL sometimes when this is called */ 105 /* careful... page->mapping is NULL sometimes when this is called */
106 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) 106 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping))
107 __cleancache_flush_page(mapping, page); 107 __cleancache_invalidate_page(mapping, page);
108} 108}
109 109
110static inline void cleancache_flush_inode(struct address_space *mapping) 110static inline void cleancache_invalidate_inode(struct address_space *mapping)
111{ 111{
112 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) 112 if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping))
113 __cleancache_flush_inode(mapping); 113 __cleancache_invalidate_inode(mapping);
114} 114}
115 115
116static inline void cleancache_flush_fs(struct super_block *sb) 116static inline void cleancache_invalidate_fs(struct super_block *sb)
117{ 117{
118 if (cleancache_enabled) 118 if (cleancache_enabled)
119 __cleancache_flush_fs(sb); 119 __cleancache_invalidate_fs(sb);
120} 120}
121 121
122#endif /* _LINUX_CLEANCACHE_H */ 122#endif /* _LINUX_CLEANCACHE_H */
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
new file mode 100644
index 000000000000..5e4312b6f5cc
--- /dev/null
+++ b/include/linux/clk-private.h
@@ -0,0 +1,196 @@
1/*
2 * linux/include/linux/clk-private.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PRIVATE_H
12#define __LINUX_CLK_PRIVATE_H
13
14#include <linux/clk-provider.h>
15#include <linux/list.h>
16
17/*
18 * WARNING: Do not include clk-private.h from any file that implements struct
19 * clk_ops. Doing so is a layering violation!
20 *
21 * This header exists only to allow for statically initialized clock data. Any
22 * static clock data must be defined in a separate file from the logic that
23 * implements the clock operations for that same data.
24 */
25
26#ifdef CONFIG_COMMON_CLK
27
28struct clk {
29 const char *name;
30 const struct clk_ops *ops;
31 struct clk_hw *hw;
32 struct clk *parent;
33 char **parent_names;
34 struct clk **parents;
35 u8 num_parents;
36 unsigned long rate;
37 unsigned long new_rate;
38 unsigned long flags;
39 unsigned int enable_count;
40 unsigned int prepare_count;
41 struct hlist_head children;
42 struct hlist_node child_node;
43 unsigned int notifier_count;
44#ifdef CONFIG_COMMON_CLK_DEBUG
45 struct dentry *dentry;
46#endif
47};
48
49/*
50 * DOC: Basic clock implementations common to many platforms
51 *
52 * Each basic clock hardware type is comprised of a structure describing the
53 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
54 * unique flags for that hardware type, a registration function and an
55 * alternative macro for static initialization
56 */
57
58extern struct clk_ops clk_fixed_rate_ops;
59
60#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
61 _fixed_rate_flags) \
62 static struct clk _name; \
63 static char *_name##_parent_names[] = {}; \
64 static struct clk_fixed_rate _name##_hw = { \
65 .hw = { \
66 .clk = &_name, \
67 }, \
68 .fixed_rate = _rate, \
69 .flags = _fixed_rate_flags, \
70 }; \
71 static struct clk _name = { \
72 .name = #_name, \
73 .ops = &clk_fixed_rate_ops, \
74 .hw = &_name##_hw.hw, \
75 .parent_names = _name##_parent_names, \
76 .num_parents = \
77 ARRAY_SIZE(_name##_parent_names), \
78 .flags = _flags, \
79 };
80
81extern struct clk_ops clk_gate_ops;
82
83#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
84 _flags, _reg, _bit_idx, \
85 _gate_flags, _lock) \
86 static struct clk _name; \
87 static char *_name##_parent_names[] = { \
88 _parent_name, \
89 }; \
90 static struct clk *_name##_parents[] = { \
91 _parent_ptr, \
92 }; \
93 static struct clk_gate _name##_hw = { \
94 .hw = { \
95 .clk = &_name, \
96 }, \
97 .reg = _reg, \
98 .bit_idx = _bit_idx, \
99 .flags = _gate_flags, \
100 .lock = _lock, \
101 }; \
102 static struct clk _name = { \
103 .name = #_name, \
104 .ops = &clk_gate_ops, \
105 .hw = &_name##_hw.hw, \
106 .parent_names = _name##_parent_names, \
107 .num_parents = \
108 ARRAY_SIZE(_name##_parent_names), \
109 .parents = _name##_parents, \
110 .flags = _flags, \
111 };
112
113extern struct clk_ops clk_divider_ops;
114
115#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
116 _flags, _reg, _shift, _width, \
117 _divider_flags, _lock) \
118 static struct clk _name; \
119 static char *_name##_parent_names[] = { \
120 _parent_name, \
121 }; \
122 static struct clk *_name##_parents[] = { \
123 _parent_ptr, \
124 }; \
125 static struct clk_divider _name##_hw = { \
126 .hw = { \
127 .clk = &_name, \
128 }, \
129 .reg = _reg, \
130 .shift = _shift, \
131 .width = _width, \
132 .flags = _divider_flags, \
133 .lock = _lock, \
134 }; \
135 static struct clk _name = { \
136 .name = #_name, \
137 .ops = &clk_divider_ops, \
138 .hw = &_name##_hw.hw, \
139 .parent_names = _name##_parent_names, \
140 .num_parents = \
141 ARRAY_SIZE(_name##_parent_names), \
142 .parents = _name##_parents, \
143 .flags = _flags, \
144 };
145
146extern struct clk_ops clk_mux_ops;
147
148#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
149 _reg, _shift, _width, \
150 _mux_flags, _lock) \
151 static struct clk _name; \
152 static struct clk_mux _name##_hw = { \
153 .hw = { \
154 .clk = &_name, \
155 }, \
156 .reg = _reg, \
157 .shift = _shift, \
158 .width = _width, \
159 .flags = _mux_flags, \
160 .lock = _lock, \
161 }; \
162 static struct clk _name = { \
163 .name = #_name, \
164 .ops = &clk_mux_ops, \
165 .hw = &_name##_hw.hw, \
166 .parent_names = _parent_names, \
167 .num_parents = \
168 ARRAY_SIZE(_parent_names), \
169 .parents = _parents, \
170 .flags = _flags, \
171 };
172
173/**
174 * __clk_init - initialize the data structures in a struct clk
175 * @dev: device initializing this clk, placeholder for now
176 * @clk: clk being initialized
177 *
178 * Initializes the lists in struct clk, queries the hardware for the
179 * parent and rate and sets them both.
180 *
181 * Any struct clk passed into __clk_init must have the following members
182 * populated:
183 * .name
184 * .ops
185 * .hw
186 * .parent_names
187 * .num_parents
188 * .flags
189 *
190 * It is not necessary to call clk_register if __clk_init is used directly with
191 * statically initialized clock data.
192 */
193void __clk_init(struct device *dev, struct clk *clk);
194
195#endif /* CONFIG_COMMON_CLK */
196#endif /* CLK_PRIVATE_H */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
new file mode 100644
index 000000000000..5508897ad376
--- /dev/null
+++ b/include/linux/clk-provider.h
@@ -0,0 +1,300 @@
1/*
2 * linux/include/linux/clk-provider.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PROVIDER_H
12#define __LINUX_CLK_PROVIDER_H
13
14#include <linux/clk.h>
15
16#ifdef CONFIG_COMMON_CLK
17
18/**
19 * struct clk_hw - handle for traversing from a struct clk to its corresponding
20 * hardware-specific structure. struct clk_hw should be declared within struct
21 * clk_foo and then referenced by the struct clk instance that uses struct
22 * clk_foo's clk_ops
23 *
24 * clk: pointer to the struct clk instance that points back to this struct
25 * clk_hw instance
26 */
27struct clk_hw {
28 struct clk *clk;
29};
30
31/*
32 * flags used across common struct clk. these flags should only affect the
33 * top-level framework. custom flags for dealing with hardware specifics
34 * belong in struct clk_foo
35 */
36#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate change */
37#define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
38#define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
39#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
40#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
41
42/**
43 * struct clk_ops - Callback operations for hardware clocks; these are to
44 * be provided by the clock implementation, and will be called by drivers
45 * through the clk_* api.
46 *
47 * @prepare: Prepare the clock for enabling. This must not return until
48 * the clock is fully prepared, and it's safe to call clk_enable.
49 * This callback is intended to allow clock implementations to
50 * do any initialisation that may sleep. Called with
51 * prepare_lock held.
52 *
53 * @unprepare: Release the clock from its prepared state. This will typically
54 * undo any work done in the @prepare callback. Called with
55 * prepare_lock held.
56 *
57 * @enable: Enable the clock atomically. This must not return until the
58 * clock is generating a valid clock signal, usable by consumer
59 * devices. Called with enable_lock held. This function must not
60 * sleep.
61 *
62 * @disable: Disable the clock atomically. Called with enable_lock held.
63 * This function must not sleep.
64 *
65 * @recalc_rate Recalculate the rate of this clock, by quering hardware. The
66 * parent rate is an input parameter. It is up to the caller to
67 * insure that the prepare_mutex is held across this call.
68 * Returns the calculated rate. Optional, but recommended - if
69 * this op is not set then clock rate will be initialized to 0.
70 *
71 * @round_rate: Given a target rate as input, returns the closest rate actually
72 * supported by the clock.
73 *
74 * @get_parent: Queries the hardware to determine the parent of a clock. The
75 * return value is a u8 which specifies the index corresponding to
76 * the parent clock. This index can be applied to either the
77 * .parent_names or .parents arrays. In short, this function
78 * translates the parent value read from hardware into an array
79 * index. Currently only called when the clock is initialized by
80 * __clk_init. This callback is mandatory for clocks with
81 * multiple parents. It is optional (and unnecessary) for clocks
82 * with 0 or 1 parents.
83 *
84 * @set_parent: Change the input source of this clock; for clocks with multiple
85 * possible parents specify a new parent by passing in the index
86 * as a u8 corresponding to the parent in either the .parent_names
87 * or .parents arrays. This function in affect translates an
88 * array index into the value programmed into the hardware.
89 * Returns 0 on success, -EERROR otherwise.
90 *
91 * @set_rate: Change the rate of this clock. If this callback returns
92 * CLK_SET_RATE_PARENT, the rate change will be propagated to the
93 * parent clock (which may propagate again if the parent clock
94 * also sets this flag). The requested rate of the parent is
95 * passed back from the callback in the second 'unsigned long *'
96 * argument. Note that it is up to the hardware clock's set_rate
97 * implementation to insure that clocks do not run out of spec
98 * when propgating the call to set_rate up to the parent. One way
99 * to do this is to gate the clock (via clk_disable and/or
100 * clk_unprepare) before calling clk_set_rate, then ungating it
101 * afterward. If your clock also has the CLK_GATE_SET_RATE flag
102 * set then this will insure safety. Returns 0 on success,
103 * -EERROR otherwise.
104 *
105 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
106 * implementations to split any work between atomic (enable) and sleepable
107 * (prepare) contexts. If enabling a clock requires code that might sleep,
108 * this must be done in clk_prepare. Clock enable code that will never be
109 * called in a sleepable context may be implement in clk_enable.
110 *
111 * Typically, drivers will call clk_prepare when a clock may be needed later
112 * (eg. when a device is opened), and clk_enable when the clock is actually
113 * required (eg. from an interrupt). Note that clk_prepare MUST have been
114 * called before clk_enable.
115 */
116struct clk_ops {
117 int (*prepare)(struct clk_hw *hw);
118 void (*unprepare)(struct clk_hw *hw);
119 int (*enable)(struct clk_hw *hw);
120 void (*disable)(struct clk_hw *hw);
121 int (*is_enabled)(struct clk_hw *hw);
122 unsigned long (*recalc_rate)(struct clk_hw *hw,
123 unsigned long parent_rate);
124 long (*round_rate)(struct clk_hw *hw, unsigned long,
125 unsigned long *);
126 int (*set_parent)(struct clk_hw *hw, u8 index);
127 u8 (*get_parent)(struct clk_hw *hw);
128 int (*set_rate)(struct clk_hw *hw, unsigned long);
129 void (*init)(struct clk_hw *hw);
130};
131
132/*
133 * DOC: Basic clock implementations common to many platforms
134 *
135 * Each basic clock hardware type is comprised of a structure describing the
136 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
137 * unique flags for that hardware type, a registration function and an
138 * alternative macro for static initialization
139 */
140
141/**
142 * struct clk_fixed_rate - fixed-rate clock
143 * @hw: handle between common and hardware-specific interfaces
144 * @fixed_rate: constant frequency of clock
145 */
146struct clk_fixed_rate {
147 struct clk_hw hw;
148 unsigned long fixed_rate;
149 u8 flags;
150};
151
152struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
153 const char *parent_name, unsigned long flags,
154 unsigned long fixed_rate);
155
156/**
157 * struct clk_gate - gating clock
158 *
159 * @hw: handle between common and hardware-specific interfaces
160 * @reg: register controlling gate
161 * @bit_idx: single bit controlling gate
162 * @flags: hardware-specific flags
163 * @lock: register lock
164 *
165 * Clock which can gate its output. Implements .enable & .disable
166 *
167 * Flags:
168 * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to
169 * enable the clock. Setting this flag does the opposite: setting the bit
170 * disable the clock and clearing it enables the clock
171 */
172struct clk_gate {
173 struct clk_hw hw;
174 void __iomem *reg;
175 u8 bit_idx;
176 u8 flags;
177 spinlock_t *lock;
178 char *parent[1];
179};
180
181#define CLK_GATE_SET_TO_DISABLE BIT(0)
182
183struct clk *clk_register_gate(struct device *dev, const char *name,
184 const char *parent_name, unsigned long flags,
185 void __iomem *reg, u8 bit_idx,
186 u8 clk_gate_flags, spinlock_t *lock);
187
188/**
189 * struct clk_divider - adjustable divider clock
190 *
191 * @hw: handle between common and hardware-specific interfaces
192 * @reg: register containing the divider
193 * @shift: shift to the divider bit field
194 * @width: width of the divider bit field
195 * @lock: register lock
196 *
197 * Clock with an adjustable divider affecting its output frequency. Implements
198 * .recalc_rate, .set_rate and .round_rate
199 *
200 * Flags:
201 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
202 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
203 * the raw value read from the register, with the value of zero considered
204 * invalid
205 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
206 * the hardware register
207 */
208struct clk_divider {
209 struct clk_hw hw;
210 void __iomem *reg;
211 u8 shift;
212 u8 width;
213 u8 flags;
214 spinlock_t *lock;
215 char *parent[1];
216};
217
218#define CLK_DIVIDER_ONE_BASED BIT(0)
219#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
220
221struct clk *clk_register_divider(struct device *dev, const char *name,
222 const char *parent_name, unsigned long flags,
223 void __iomem *reg, u8 shift, u8 width,
224 u8 clk_divider_flags, spinlock_t *lock);
225
226/**
227 * struct clk_mux - multiplexer clock
228 *
229 * @hw: handle between common and hardware-specific interfaces
230 * @reg: register controlling multiplexer
231 * @shift: shift to multiplexer bit field
232 * @width: width of mutliplexer bit field
233 * @num_clks: number of parent clocks
234 * @lock: register lock
235 *
236 * Clock with multiple selectable parents. Implements .get_parent, .set_parent
237 * and .recalc_rate
238 *
239 * Flags:
240 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
241 * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two)
242 */
243struct clk_mux {
244 struct clk_hw hw;
245 void __iomem *reg;
246 u8 shift;
247 u8 width;
248 u8 flags;
249 spinlock_t *lock;
250};
251
252#define CLK_MUX_INDEX_ONE BIT(0)
253#define CLK_MUX_INDEX_BIT BIT(1)
254
255struct clk *clk_register_mux(struct device *dev, const char *name,
256 char **parent_names, u8 num_parents, unsigned long flags,
257 void __iomem *reg, u8 shift, u8 width,
258 u8 clk_mux_flags, spinlock_t *lock);
259
260/**
261 * clk_register - allocate a new clock, register it and return an opaque cookie
262 * @dev: device that is registering this clock
263 * @name: clock name
264 * @ops: operations this clock supports
265 * @hw: link to hardware-specific clock data
266 * @parent_names: array of string names for all possible parents
267 * @num_parents: number of possible parents
268 * @flags: framework-level hints and quirks
269 *
270 * clk_register is the primary interface for populating the clock tree with new
271 * clock nodes. It returns a pointer to the newly allocated struct clk which
272 * cannot be dereferenced by driver code but may be used in conjuction with the
273 * rest of the clock API.
274 */
275struct clk *clk_register(struct device *dev, const char *name,
276 const struct clk_ops *ops, struct clk_hw *hw,
277 char **parent_names, u8 num_parents, unsigned long flags);
278
279/* helper functions */
280const char *__clk_get_name(struct clk *clk);
281struct clk_hw *__clk_get_hw(struct clk *clk);
282u8 __clk_get_num_parents(struct clk *clk);
283struct clk *__clk_get_parent(struct clk *clk);
284inline int __clk_get_enable_count(struct clk *clk);
285inline int __clk_get_prepare_count(struct clk *clk);
286unsigned long __clk_get_rate(struct clk *clk);
287unsigned long __clk_get_flags(struct clk *clk);
288int __clk_is_enabled(struct clk *clk);
289struct clk *__clk_lookup(const char *name);
290
291/*
292 * FIXME clock api without lock protection
293 */
294int __clk_prepare(struct clk *clk);
295void __clk_unprepare(struct clk *clk);
296void __clk_reparent(struct clk *clk, struct clk *new_parent);
297unsigned long __clk_round_rate(struct clk *clk, unsigned long rate);
298
299#endif /* CONFIG_COMMON_CLK */
300#endif /* CLK_PROVIDER_H */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b9d46fa154b4..b0252726df61 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2004 ARM Limited. 4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited. 5 * Written by Deep Blue Solutions Limited.
6 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -12,18 +13,75 @@
12#define __LINUX_CLK_H 13#define __LINUX_CLK_H
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/notifier.h>
15 17
16struct device; 18struct device;
17 19
18/* 20struct clk;
19 * The base API. 21
22#ifdef CONFIG_COMMON_CLK
23
24/**
25 * DOC: clk notifier callback types
26 *
27 * PRE_RATE_CHANGE - called immediately before the clk rate is changed,
28 * to indicate that the rate change will proceed. Drivers must
29 * immediately terminate any operations that will be affected by the
30 * rate change. Callbacks may either return NOTIFY_DONE or
31 * NOTIFY_STOP.
32 *
33 * ABORT_RATE_CHANGE: called if the rate change failed for some reason
34 * after PRE_RATE_CHANGE. In this case, all registered notifiers on
35 * the clk will be called with ABORT_RATE_CHANGE. Callbacks must
36 * always return NOTIFY_DONE.
37 *
38 * POST_RATE_CHANGE - called after the clk rate change has successfully
39 * completed. Callbacks must always return NOTIFY_DONE.
40 *
20 */ 41 */
42#define PRE_RATE_CHANGE BIT(0)
43#define POST_RATE_CHANGE BIT(1)
44#define ABORT_RATE_CHANGE BIT(2)
21 45
46/**
47 * struct clk_notifier - associate a clk with a notifier
48 * @clk: struct clk * to associate the notifier with
49 * @notifier_head: a blocking_notifier_head for this clk
50 * @node: linked list pointers
51 *
52 * A list of struct clk_notifier is maintained by the notifier code.
53 * An entry is created whenever code registers the first notifier on a
54 * particular @clk. Future notifiers on that @clk are added to the
55 * @notifier_head.
56 */
57struct clk_notifier {
58 struct clk *clk;
59 struct srcu_notifier_head notifier_head;
60 struct list_head node;
61};
22 62
23/* 63/**
24 * struct clk - an machine class defined object / cookie. 64 * struct clk_notifier_data - rate data to pass to the notifier callback
65 * @clk: struct clk * being changed
66 * @old_rate: previous rate of this clk
67 * @new_rate: new rate of this clk
68 *
69 * For a pre-notifier, old_rate is the clk's rate before this rate
70 * change, and new_rate is what the rate will be in the future. For a
71 * post-notifier, old_rate and new_rate are both set to the clk's
72 * current rate (this was done to optimize the implementation).
25 */ 73 */
26struct clk; 74struct clk_notifier_data {
75 struct clk *clk;
76 unsigned long old_rate;
77 unsigned long new_rate;
78};
79
80int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
81
82int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
83
84#endif /* !CONFIG_COMMON_CLK */
27 85
28/** 86/**
29 * clk_get - lookup and obtain a reference to a clock producer. 87 * clk_get - lookup and obtain a reference to a clock producer.
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 081147da0564..fbe89e17124e 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -319,13 +319,6 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
319 __clocksource_updatefreq_scale(cs, 1000, khz); 319 __clocksource_updatefreq_scale(cs, 1000, khz);
320} 320}
321 321
322static inline void
323clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
324{
325 return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
326 NSEC_PER_SEC, minsec);
327}
328
329#ifdef CONFIG_GENERIC_TIME_VSYSCALL 322#ifdef CONFIG_GENERIC_TIME_VSYSCALL
330extern void 323extern void
331update_vsyscall(struct timespec *ts, struct timespec *wtm, 324update_vsyscall(struct timespec *ts, struct timespec *wtm,
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index bb2bbdbe5464..51a90b7f2d60 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -23,6 +23,7 @@ extern 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); 25 bool sync);
26extern int compact_pgdat(pg_data_t *pgdat, int order);
26extern unsigned long compaction_suitable(struct zone *zone, int order); 27extern unsigned long compaction_suitable(struct zone *zone, int order);
27 28
28/* Do not skip compaction more than 64 times */ 29/* Do not skip compaction more than 64 times */
@@ -33,20 +34,26 @@ extern unsigned long compaction_suitable(struct zone *zone, int order);
33 * allocation success. 1 << compact_defer_limit compactions are skipped up 34 * allocation success. 1 << compact_defer_limit compactions are skipped up
34 * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT 35 * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT
35 */ 36 */
36static inline void defer_compaction(struct zone *zone) 37static inline void defer_compaction(struct zone *zone, int order)
37{ 38{
38 zone->compact_considered = 0; 39 zone->compact_considered = 0;
39 zone->compact_defer_shift++; 40 zone->compact_defer_shift++;
40 41
42 if (order < zone->compact_order_failed)
43 zone->compact_order_failed = order;
44
41 if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) 45 if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT)
42 zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; 46 zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT;
43} 47}
44 48
45/* Returns true if compaction should be skipped this time */ 49/* Returns true if compaction should be skipped this time */
46static inline bool compaction_deferred(struct zone *zone) 50static inline bool compaction_deferred(struct zone *zone, int order)
47{ 51{
48 unsigned long defer_limit = 1UL << zone->compact_defer_shift; 52 unsigned long defer_limit = 1UL << zone->compact_defer_shift;
49 53
54 if (order < zone->compact_order_failed)
55 return false;
56
50 /* Avoid possible overflow */ 57 /* Avoid possible overflow */
51 if (++zone->compact_considered > defer_limit) 58 if (++zone->compact_considered > defer_limit)
52 zone->compact_considered = defer_limit; 59 zone->compact_considered = defer_limit;
@@ -62,16 +69,21 @@ static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
62 return COMPACT_CONTINUE; 69 return COMPACT_CONTINUE;
63} 70}
64 71
72static inline int compact_pgdat(pg_data_t *pgdat, int order)
73{
74 return COMPACT_CONTINUE;
75}
76
65static inline unsigned long compaction_suitable(struct zone *zone, int order) 77static inline unsigned long compaction_suitable(struct zone *zone, int order)
66{ 78{
67 return COMPACT_SKIPPED; 79 return COMPACT_SKIPPED;
68} 80}
69 81
70static inline void defer_compaction(struct zone *zone) 82static inline void defer_compaction(struct zone *zone, int order)
71{ 83{
72} 84}
73 85
74static inline bool compaction_deferred(struct zone *zone) 86static inline bool compaction_deferred(struct zone *zone, int order)
75{ 87{
76 return 1; 88 return 1;
77} 89}
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 3fd17c249221..e5834aa24b9e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -87,7 +87,8 @@
87 */ 87 */
88#define __pure __attribute__((pure)) 88#define __pure __attribute__((pure))
89#define __aligned(x) __attribute__((aligned(x))) 89#define __aligned(x) __attribute__((aligned(x)))
90#define __printf(a,b) __attribute__((format(printf,a,b))) 90#define __printf(a, b) __attribute__((format(printf, a, b)))
91#define __scanf(a, b) __attribute__((format(scanf, a, b)))
91#define noinline __attribute__((noinline)) 92#define noinline __attribute__((noinline))
92#define __attribute_const__ __attribute__((__const__)) 93#define __attribute_const__ __attribute__((__const__))
93#define __maybe_unused __attribute__((unused)) 94#define __maybe_unused __attribute__((unused))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 4a243546d142..923d093c9cea 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -236,7 +236,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
236 236
237/* 237/*
238 * Rather then using noinline to prevent stack consumption, use 238 * Rather then using noinline to prevent stack consumption, use
239 * noinline_for_stack instead. For documentaiton reasons. 239 * noinline_for_stack instead. For documentation reasons.
240 */ 240 */
241#define noinline_for_stack noinline 241#define noinline_for_stack noinline
242 242
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 3c9c54fd5690..76384074262d 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -43,6 +43,7 @@
43#define CN_IDX_DRBD 0x8 43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1 44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */ 45#define CN_KVP_IDX 0x9 /* HyperV KVP */
46#define CN_KVP_VAL 0x1 /* queries from the kernel */
46 47
47#define CN_NETLINK_USERS 10 /* Highest index + 1 */ 48#define CN_NETLINK_USERS 10 /* Highest index + 1 */
48 49
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 1f6587590a1a..ee28844ae68e 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -14,11 +14,12 @@
14#ifndef _LINUX_CPU_H_ 14#ifndef _LINUX_CPU_H_
15#define _LINUX_CPU_H_ 15#define _LINUX_CPU_H_
16 16
17#include <linux/device.h>
18#include <linux/node.h> 17#include <linux/node.h>
19#include <linux/compiler.h> 18#include <linux/compiler.h>
20#include <linux/cpumask.h> 19#include <linux/cpumask.h>
21 20
21struct device;
22
22struct cpu { 23struct cpu {
23 int node_id; /* The node which contains the CPU */ 24 int node_id; /* The node which contains the CPU */
24 int hotpluggable; /* creates sysfs control file if hotpluggable */ 25 int hotpluggable; /* creates sysfs control file if hotpluggable */
@@ -44,6 +45,13 @@ extern ssize_t arch_cpu_release(const char *, size_t);
44#endif 45#endif
45struct notifier_block; 46struct notifier_block;
46 47
48#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
49extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env);
50extern ssize_t arch_print_cpu_modalias(struct device *dev,
51 struct device_attribute *attr,
52 char *bufptr);
53#endif
54
47/* 55/*
48 * CPU notifier priorities. 56 * CPU notifier priorities.
49 */ 57 */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 6216115c7789..b60f6ba01d0c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -14,7 +14,6 @@
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/threads.h> 16#include <linux/threads.h>
17#include <linux/device.h>
18#include <linux/kobject.h> 17#include <linux/kobject.h>
19#include <linux/sysfs.h> 18#include <linux/sysfs.h>
20#include <linux/completion.h> 19#include <linux/completion.h>
@@ -35,6 +34,7 @@
35#ifdef CONFIG_CPU_FREQ 34#ifdef CONFIG_CPU_FREQ
36int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 35int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
37int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 36int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
37extern void disable_cpufreq(void);
38#else /* CONFIG_CPU_FREQ */ 38#else /* CONFIG_CPU_FREQ */
39static inline int cpufreq_register_notifier(struct notifier_block *nb, 39static inline int cpufreq_register_notifier(struct notifier_block *nb,
40 unsigned int list) 40 unsigned int list)
@@ -46,6 +46,7 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
46{ 46{
47 return 0; 47 return 0;
48} 48}
49static inline void disable_cpufreq(void) { }
49#endif /* CONFIG_CPU_FREQ */ 50#endif /* CONFIG_CPU_FREQ */
50 51
51/* if (cpufreq_driver->target) exists, the ->governor decides what frequency 52/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 4f7a63237471..7b9b75a529be 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <linux/bitmap.h> 11#include <linux/bitmap.h>
12#include <linux/bug.h>
12 13
13typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 14typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
14 15
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index e9eaec522655..7a7e5fd2a277 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -89,42 +89,33 @@ extern void rebuild_sched_domains(void);
89extern void cpuset_print_task_mems_allowed(struct task_struct *p); 89extern void cpuset_print_task_mems_allowed(struct task_struct *p);
90 90
91/* 91/*
92 * reading current mems_allowed and mempolicy in the fastpath must protected 92 * get_mems_allowed is required when making decisions involving mems_allowed
93 * by get_mems_allowed() 93 * such as during page allocation. mems_allowed can be updated in parallel
94 * and depending on the new value an operation can fail potentially causing
95 * process failure. A retry loop with get_mems_allowed and put_mems_allowed
96 * prevents these artificial failures.
94 */ 97 */
95static inline void get_mems_allowed(void) 98static inline unsigned int get_mems_allowed(void)
96{ 99{
97 current->mems_allowed_change_disable++; 100 return read_seqcount_begin(&current->mems_allowed_seq);
98
99 /*
100 * ensure that reading mems_allowed and mempolicy happens after the
101 * update of ->mems_allowed_change_disable.
102 *
103 * the write-side task finds ->mems_allowed_change_disable is not 0,
104 * and knows the read-side task is reading mems_allowed or mempolicy,
105 * so it will clear old bits lazily.
106 */
107 smp_mb();
108} 101}
109 102
110static inline void put_mems_allowed(void) 103/*
104 * If this returns false, the operation that took place after get_mems_allowed
105 * may have failed. It is up to the caller to retry the operation if
106 * appropriate.
107 */
108static inline bool put_mems_allowed(unsigned int seq)
111{ 109{
112 /* 110 return !read_seqcount_retry(&current->mems_allowed_seq, seq);
113 * ensure that reading mems_allowed and mempolicy before reducing
114 * mems_allowed_change_disable.
115 *
116 * the write-side task will know that the read-side task is still
117 * reading mems_allowed or mempolicy, don't clears old bits in the
118 * nodemask.
119 */
120 smp_mb();
121 --ACCESS_ONCE(current->mems_allowed_change_disable);
122} 111}
123 112
124static inline void set_mems_allowed(nodemask_t nodemask) 113static inline void set_mems_allowed(nodemask_t nodemask)
125{ 114{
126 task_lock(current); 115 task_lock(current);
116 write_seqcount_begin(&current->mems_allowed_seq);
127 current->mems_allowed = nodemask; 117 current->mems_allowed = nodemask;
118 write_seqcount_end(&current->mems_allowed_seq);
128 task_unlock(current); 119 task_unlock(current);
129} 120}
130 121
@@ -234,12 +225,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
234{ 225{
235} 226}
236 227
237static inline void get_mems_allowed(void) 228static inline unsigned int get_mems_allowed(void)
238{ 229{
230 return 0;
239} 231}
240 232
241static inline void put_mems_allowed(void) 233static inline bool put_mems_allowed(unsigned int seq)
242{ 234{
235 return true;
243} 236}
244 237
245#endif /* !CONFIG_CPUSETS */ 238#endif /* !CONFIG_CPUSETS */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index b936763f2236..37e4f8da7cdf 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -3,7 +3,6 @@
3 3
4#ifdef CONFIG_CRASH_DUMP 4#ifdef CONFIG_CRASH_DUMP
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/device.h>
7#include <linux/proc_fs.h> 6#include <linux/proc_fs.h>
8#include <linux/elf.h> 7#include <linux/elf.h>
9 8
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 391a259b2cc9..68267b64bb98 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,6 +11,8 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
15
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 16#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 17
16/* 18/*
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 8a94217b298e..b92eadf92d72 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -20,6 +20,7 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/bug.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/string.h> 25#include <linux/string.h>
25#include <linux/uaccess.h> 26#include <linux/uaccess.h>
@@ -75,6 +76,11 @@
75 */ 76 */
76#define CRYPTO_ALG_INSTANCE 0x00000800 77#define CRYPTO_ALG_INSTANCE 0x00000800
77 78
79/* Set this bit if the algorithm provided is hardware accelerated but
80 * not available to userspace via instruction set or so.
81 */
82#define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000
83
78/* 84/*
79 * Transform masks and values (for crt_flags). 85 * Transform masks and values (for crt_flags).
80 */ 86 */
@@ -309,6 +315,8 @@ struct crypto_alg {
309 */ 315 */
310int crypto_register_alg(struct crypto_alg *alg); 316int crypto_register_alg(struct crypto_alg *alg);
311int crypto_unregister_alg(struct crypto_alg *alg); 317int crypto_unregister_alg(struct crypto_alg *alg);
318int crypto_register_algs(struct crypto_alg *algs, int count);
319int crypto_unregister_algs(struct crypto_alg *algs, int count);
312 320
313/* 321/*
314 * Algorithm query interface. 322 * Algorithm query interface.
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index ff5f5256d175..7e11f1418203 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -222,7 +222,6 @@ extern void shrink_dcache_for_umount(struct super_block *);
222extern int d_invalidate(struct dentry *); 222extern int d_invalidate(struct dentry *);
223 223
224/* only used at mount-time */ 224/* only used at mount-time */
225extern struct dentry * d_alloc_root(struct inode *);
226extern struct dentry * d_make_root(struct inode *); 225extern struct dentry * d_make_root(struct inode *);
227 226
228/* <clickety>-<click> the ramfs-type tree */ 227/* <clickety>-<click> the ramfs-type tree */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 710c04302a15..eaf95a023af4 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -376,8 +376,10 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
376/** 376/**
377 * struct dccp_request_sock - represent DCCP-specific connection request 377 * struct dccp_request_sock - represent DCCP-specific connection request
378 * @dreq_inet_rsk: structure inherited from 378 * @dreq_inet_rsk: structure inherited from
379 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 379 * @dreq_iss: initial sequence number, sent on the first Response (RFC 4340, 7.1)
380 * @dreq_isr: initial sequence number received on the Request 380 * @dreq_gss: greatest sequence number sent (for retransmitted Responses)
381 * @dreq_isr: initial sequence number received in the first Request
382 * @dreq_gsr: greatest sequence number received (for retransmitted Request(s))
381 * @dreq_service: service code present on the Request (there is just one) 383 * @dreq_service: service code present on the Request (there is just one)
382 * @dreq_featneg: feature negotiation options for this connection 384 * @dreq_featneg: feature negotiation options for this connection
383 * The following two fields are analogous to the ones in dccp_sock: 385 * The following two fields are analogous to the ones in dccp_sock:
@@ -387,7 +389,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
387struct dccp_request_sock { 389struct dccp_request_sock {
388 struct inet_request_sock dreq_inet_rsk; 390 struct inet_request_sock dreq_inet_rsk;
389 __u64 dreq_iss; 391 __u64 dreq_iss;
392 __u64 dreq_gss;
390 __u64 dreq_isr; 393 __u64 dreq_isr;
394 __u64 dreq_gsr;
391 __be32 dreq_service; 395 __be32 dreq_service;
392 struct list_head dreq_featneg; 396 struct list_head dreq_featneg;
393 __u32 dreq_timestamp_echo; 397 __u32 dreq_timestamp_echo;
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 5033fb88c107..94f20c1488a1 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/atomic.h> 5#include <linux/atomic.h>
6#include <linux/bug.h>
6#include <asm/system.h> 7#include <asm/system.h>
7 8
8struct task_struct; 9struct task_struct;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 6169c26fd8c8..ae36b72c22f3 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -86,7 +86,7 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
86 struct dentry *parent, 86 struct dentry *parent,
87 struct debugfs_blob_wrapper *blob); 87 struct debugfs_blob_wrapper *blob);
88 88
89struct dentry *debugfs_create_regset32(const char *name, mode_t mode, 89struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
90 struct dentry *parent, 90 struct dentry *parent,
91 struct debugfs_regset32 *regset); 91 struct debugfs_regset32 *regset);
92 92
@@ -208,7 +208,7 @@ static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
208} 208}
209 209
210static inline struct dentry *debugfs_create_regset32(const char *name, 210static inline struct dentry *debugfs_create_regset32(const char *name,
211 mode_t mode, struct dentry *parent, 211 umode_t mode, struct dentry *parent,
212 struct debugfs_regset32 *regset) 212 struct debugfs_regset32 *regset)
213{ 213{
214 return ERR_PTR(-ENODEV); 214 return ERR_PTR(-ENODEV);
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index 98ce8124b1cc..281c72a3b9d5 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -44,6 +44,14 @@ struct devfreq_dev_status {
44 void *private_data; 44 void *private_data;
45}; 45};
46 46
47/*
48 * The resulting frequency should be at most this. (this bound is the
49 * least upper bound; thus, the resulting freq should be lower or same)
50 * If the flag is not set, the resulting frequency should be at most the
51 * bound (greatest lower bound)
52 */
53#define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1
54
47/** 55/**
48 * struct devfreq_dev_profile - Devfreq's user device profile 56 * struct devfreq_dev_profile - Devfreq's user device profile
49 * @initial_freq The operating frequency when devfreq_add_device() is 57 * @initial_freq The operating frequency when devfreq_add_device() is
@@ -54,6 +62,8 @@ struct devfreq_dev_status {
54 * higher than any operable frequency, set maximum. 62 * higher than any operable frequency, set maximum.
55 * Before returning, target function should set 63 * Before returning, target function should set
56 * freq at the current frequency. 64 * freq at the current frequency.
65 * The "flags" parameter's possible values are
66 * explained above with "DEVFREQ_FLAG_*" macros.
57 * @get_dev_status The device should provide the current performance 67 * @get_dev_status The device should provide the current performance
58 * status to devfreq, which is used by governors. 68 * status to devfreq, which is used by governors.
59 * @exit An optional callback that is called when devfreq 69 * @exit An optional callback that is called when devfreq
@@ -66,7 +76,7 @@ struct devfreq_dev_profile {
66 unsigned long initial_freq; 76 unsigned long initial_freq;
67 unsigned int polling_ms; 77 unsigned int polling_ms;
68 78
69 int (*target)(struct device *dev, unsigned long *freq); 79 int (*target)(struct device *dev, unsigned long *freq, u32 flags);
70 int (*get_dev_status)(struct device *dev, 80 int (*get_dev_status)(struct device *dev,
71 struct devfreq_dev_status *stat); 81 struct devfreq_dev_status *stat);
72 void (*exit)(struct device *dev); 82 void (*exit)(struct device *dev);
@@ -124,6 +134,8 @@ struct devfreq_governor {
124 * touch this. 134 * touch this.
125 * @being_removed a flag to mark that this object is being removed in 135 * @being_removed a flag to mark that this object is being removed in
126 * order to prevent trying to remove the object multiple times. 136 * order to prevent trying to remove the object multiple times.
137 * @min_freq Limit minimum frequency requested by user (0: none)
138 * @max_freq Limit maximum frequency requested by user (0: none)
127 * 139 *
128 * This structure stores the devfreq information for a give device. 140 * This structure stores the devfreq information for a give device.
129 * 141 *
@@ -149,6 +161,9 @@ struct devfreq {
149 void *data; /* private data for governors */ 161 void *data; /* private data for governors */
150 162
151 bool being_removed; 163 bool being_removed;
164
165 unsigned long min_freq;
166 unsigned long max_freq;
152}; 167};
153 168
154#if defined(CONFIG_PM_DEVFREQ) 169#if defined(CONFIG_PM_DEVFREQ)
@@ -160,7 +175,7 @@ extern int devfreq_remove_device(struct devfreq *devfreq);
160 175
161/* Helper functions for devfreq user device driver with OPP. */ 176/* Helper functions for devfreq user device driver with OPP. */
162extern struct opp *devfreq_recommended_opp(struct device *dev, 177extern struct opp *devfreq_recommended_opp(struct device *dev,
163 unsigned long *freq); 178 unsigned long *freq, u32 flags);
164extern int devfreq_register_opp_notifier(struct device *dev, 179extern int devfreq_register_opp_notifier(struct device *dev,
165 struct devfreq *devfreq); 180 struct devfreq *devfreq);
166extern int devfreq_unregister_opp_notifier(struct device *dev, 181extern int devfreq_unregister_opp_notifier(struct device *dev,
@@ -200,18 +215,18 @@ struct devfreq_simple_ondemand_data {
200static struct devfreq *devfreq_add_device(struct device *dev, 215static struct devfreq *devfreq_add_device(struct device *dev,
201 struct devfreq_dev_profile *profile, 216 struct devfreq_dev_profile *profile,
202 struct devfreq_governor *governor, 217 struct devfreq_governor *governor,
203 void *data); 218 void *data)
204{ 219{
205 return NULL; 220 return NULL;
206} 221}
207 222
208static int devfreq_remove_device(struct devfreq *devfreq); 223static int devfreq_remove_device(struct devfreq *devfreq)
209{ 224{
210 return 0; 225 return 0;
211} 226}
212 227
213static struct opp *devfreq_recommended_opp(struct device *dev, 228static struct opp *devfreq_recommended_opp(struct device *dev,
214 unsigned long *freq) 229 unsigned long *freq, u32 flags)
215{ 230{
216 return -EINVAL; 231 return -EINVAL;
217} 232}
diff --git a/include/linux/device.h b/include/linux/device.h
index b63fb393aa58..5ad17cccdd71 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -238,8 +238,6 @@ struct device_driver {
238extern int __must_check driver_register(struct device_driver *drv); 238extern int __must_check driver_register(struct device_driver *drv);
239extern void driver_unregister(struct device_driver *drv); 239extern void driver_unregister(struct device_driver *drv);
240 240
241extern struct device_driver *get_driver(struct device_driver *drv);
242extern void put_driver(struct device_driver *drv);
243extern struct device_driver *driver_find(const char *name, 241extern struct device_driver *driver_find(const char *name,
244 struct bus_type *bus); 242 struct bus_type *bus);
245extern int driver_probe_done(void); 243extern int driver_probe_done(void);
@@ -264,10 +262,6 @@ extern int __must_check driver_create_file(struct device_driver *driver,
264extern void driver_remove_file(struct device_driver *driver, 262extern void driver_remove_file(struct device_driver *driver,
265 const struct driver_attribute *attr); 263 const struct driver_attribute *attr);
266 264
267extern int __must_check driver_add_kobj(struct device_driver *drv,
268 struct kobject *kobj,
269 const char *fmt, ...);
270
271extern int __must_check driver_for_each_device(struct device_driver *drv, 265extern int __must_check driver_for_each_device(struct device_driver *drv,
272 struct device *start, 266 struct device *start,
273 void *data, 267 void *data,
@@ -946,14 +940,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
946 940
947#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 941#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
948 942
949#if defined(DEBUG) 943#if defined(CONFIG_DYNAMIC_DEBUG)
950#define dev_dbg(dev, format, arg...) \
951 dev_printk(KERN_DEBUG, dev, format, ##arg)
952#elif defined(CONFIG_DYNAMIC_DEBUG)
953#define dev_dbg(dev, format, ...) \ 944#define dev_dbg(dev, format, ...) \
954do { \ 945do { \
955 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 946 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
956} while (0) 947} while (0)
948#elif defined(DEBUG)
949#define dev_dbg(dev, format, arg...) \
950 dev_printk(KERN_DEBUG, dev, format, ##arg)
957#else 951#else
958#define dev_dbg(dev, format, arg...) \ 952#define dev_dbg(dev, format, arg...) \
959({ \ 953({ \
@@ -1007,19 +1001,20 @@ extern long sysfs_deprecated;
1007 * @__driver: driver name 1001 * @__driver: driver name
1008 * @__register: register function for this driver type 1002 * @__register: register function for this driver type
1009 * @__unregister: unregister function for this driver type 1003 * @__unregister: unregister function for this driver type
1004 * @...: Additional arguments to be passed to __register and __unregister.
1010 * 1005 *
1011 * Use this macro to construct bus specific macros for registering 1006 * Use this macro to construct bus specific macros for registering
1012 * drivers, and do not use it on its own. 1007 * drivers, and do not use it on its own.
1013 */ 1008 */
1014#define module_driver(__driver, __register, __unregister) \ 1009#define module_driver(__driver, __register, __unregister, ...) \
1015static int __init __driver##_init(void) \ 1010static int __init __driver##_init(void) \
1016{ \ 1011{ \
1017 return __register(&(__driver)); \ 1012 return __register(&(__driver) , ##__VA_ARGS__); \
1018} \ 1013} \
1019module_init(__driver##_init); \ 1014module_init(__driver##_init); \
1020static void __exit __driver##_exit(void) \ 1015static void __exit __driver##_exit(void) \
1021{ \ 1016{ \
1022 __unregister(&(__driver)); \ 1017 __unregister(&(__driver) , ##__VA_ARGS__); \
1023} \ 1018} \
1024module_exit(__driver##_exit); 1019module_exit(__driver##_exit);
1025 1020
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index f8ac076afa52..887dcd487062 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -26,11 +26,11 @@
26 26
27#include <linux/file.h> 27#include <linux/file.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h> 29#include <linux/scatterlist.h>
31#include <linux/list.h> 30#include <linux/list.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
33 32
33struct device;
34struct dma_buf; 34struct dma_buf;
35struct dma_buf_attachment; 35struct dma_buf_attachment;
36 36
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 679b349d9b66..a5966f691ef8 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/bug.h>
26#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
27#include <linux/bitmap.h> 28#include <linux/bitmap.h>
28#include <asm/page.h> 29#include <asm/page.h>
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 0564e3c39882..7e3c53a900d8 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -15,20 +15,24 @@ struct _ddebug {
15 const char *function; 15 const char *function;
16 const char *filename; 16 const char *filename;
17 const char *format; 17 const char *format;
18 unsigned int lineno:24; 18 unsigned int lineno:18;
19 /* 19 /*
20 * The flags field controls the behaviour at the callsite. 20 * The flags field controls the behaviour at the callsite.
21 * The bits here are changed dynamically when the user 21 * The bits here are changed dynamically when the user
22 * writes commands to <debugfs>/dynamic_debug/control 22 * writes commands to <debugfs>/dynamic_debug/control
23 */ 23 */
24#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 24#define _DPRINTK_FLAGS_NONE 0
25#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
25#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) 26#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
26#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) 27#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
27#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) 28#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
28#define _DPRINTK_FLAGS_INCL_TID (1<<4) 29#define _DPRINTK_FLAGS_INCL_TID (1<<4)
30#if defined DEBUG
31#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
32#else
29#define _DPRINTK_FLAGS_DEFAULT 0 33#define _DPRINTK_FLAGS_DEFAULT 0
34#endif
30 unsigned int flags:8; 35 unsigned int flags:8;
31 char enabled;
32} __attribute__((aligned(8))); 36} __attribute__((aligned(8)));
33 37
34 38
@@ -62,21 +66,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
62 .format = (fmt), \ 66 .format = (fmt), \
63 .lineno = __LINE__, \ 67 .lineno = __LINE__, \
64 .flags = _DPRINTK_FLAGS_DEFAULT, \ 68 .flags = _DPRINTK_FLAGS_DEFAULT, \
65 .enabled = false, \
66 } 69 }
67 70
68#define dynamic_pr_debug(fmt, ...) \ 71#define dynamic_pr_debug(fmt, ...) \
69do { \ 72do { \
70 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 73 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
71 if (unlikely(descriptor.enabled)) \ 74 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
72 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ 75 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
73 ##__VA_ARGS__); \ 76 ##__VA_ARGS__); \
74} while (0) 77} while (0)
75 78
76#define dynamic_dev_dbg(dev, fmt, ...) \ 79#define dynamic_dev_dbg(dev, fmt, ...) \
77do { \ 80do { \
78 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 81 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
79 if (unlikely(descriptor.enabled)) \ 82 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
80 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 83 __dynamic_dev_dbg(&descriptor, dev, fmt, \
81 ##__VA_ARGS__); \ 84 ##__VA_ARGS__); \
82} while (0) 85} while (0)
@@ -84,7 +87,7 @@ do { \
84#define dynamic_netdev_dbg(dev, fmt, ...) \ 87#define dynamic_netdev_dbg(dev, fmt, ...) \
85do { \ 88do { \
86 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 89 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
87 if (unlikely(descriptor.enabled)) \ 90 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
88 __dynamic_netdev_dbg(&descriptor, dev, fmt, \ 91 __dynamic_netdev_dbg(&descriptor, dev, fmt, \
89 ##__VA_ARGS__); \ 92 ##__VA_ARGS__); \
90} while (0) 93} while (0)
diff --git a/include/linux/edac.h b/include/linux/edac.h
index e3e3d26c638e..c621d762bb2c 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,11 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/device.h> 16#include <linux/kobject.h>
17#include <linux/completion.h>
18#include <linux/workqueue.h>
19
20struct device;
17 21
18#define EDAC_OPSTATE_INVAL -1 22#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 23#define EDAC_OPSTATE_POLL 0
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 37c300712e02..47fbf6b3dc77 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -315,6 +315,16 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
315 315
316typedef struct { 316typedef struct {
317 efi_guid_t guid; 317 efi_guid_t guid;
318 u64 table;
319} efi_config_table_64_t;
320
321typedef struct {
322 efi_guid_t guid;
323 u32 table;
324} efi_config_table_32_t;
325
326typedef struct {
327 efi_guid_t guid;
318 unsigned long table; 328 unsigned long table;
319} efi_config_table_t; 329} efi_config_table_t;
320 330
@@ -329,6 +339,40 @@ typedef struct {
329 339
330typedef struct { 340typedef struct {
331 efi_table_hdr_t hdr; 341 efi_table_hdr_t hdr;
342 u64 fw_vendor; /* physical addr of CHAR16 vendor string */
343 u32 fw_revision;
344 u32 __pad1;
345 u64 con_in_handle;
346 u64 con_in;
347 u64 con_out_handle;
348 u64 con_out;
349 u64 stderr_handle;
350 u64 stderr;
351 u64 runtime;
352 u64 boottime;
353 u32 nr_tables;
354 u32 __pad2;
355 u64 tables;
356} efi_system_table_64_t;
357
358typedef struct {
359 efi_table_hdr_t hdr;
360 u32 fw_vendor; /* physical addr of CHAR16 vendor string */
361 u32 fw_revision;
362 u32 con_in_handle;
363 u32 con_in;
364 u32 con_out_handle;
365 u32 con_out;
366 u32 stderr_handle;
367 u32 stderr;
368 u32 runtime;
369 u32 boottime;
370 u32 nr_tables;
371 u32 tables;
372} efi_system_table_32_t;
373
374typedef struct {
375 efi_table_hdr_t hdr;
332 unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ 376 unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */
333 u32 fw_revision; 377 u32 fw_revision;
334 unsigned long con_in_handle; 378 unsigned long con_in_handle;
@@ -497,6 +541,7 @@ extern int __init efi_setup_pcdp_console(char *);
497#ifdef CONFIG_EFI 541#ifdef CONFIG_EFI
498# ifdef CONFIG_X86 542# ifdef CONFIG_X86
499 extern int efi_enabled; 543 extern int efi_enabled;
544 extern bool efi_64bit;
500# else 545# else
501# define efi_enabled 1 546# define efi_enabled 1
502# endif 547# endif
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 394a3e0e4a6b..0698c79fbcb2 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -6,6 +6,7 @@
6#include <linux/time.h> 6#include <linux/time.h>
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8#include <linux/user.h> 8#include <linux/user.h>
9#include <linux/bug.h>
9#endif 10#endif
10#include <linux/ptrace.h> 11#include <linux/ptrace.h>
11#include <linux/elf.h> 12#include <linux/elf.h>
diff --git a/include/linux/errno.h b/include/linux/errno.h
index 46685832ed99..2d09bfa5c262 100644
--- a/include/linux/errno.h
+++ b/include/linux/errno.h
@@ -16,6 +16,7 @@
16#define ERESTARTNOHAND 514 /* restart if no handler.. */ 16#define ERESTARTNOHAND 514 /* restart if no handler.. */
17#define ENOIOCTLCMD 515 /* No ioctl command */ 17#define ENOIOCTLCMD 515 /* No ioctl command */
18#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ 18#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
19#define EPROBE_DEFER 517 /* Driver requests probe retry */
19 20
20/* Defined for the NFSv3 protocol */ 21/* Defined for the NFSv3 protocol */
21#define EBADHANDLE 521 /* Illegal NFS file handle */ 22#define EBADHANDLE 521 /* Illegal NFS file handle */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 05955cf09937..8a1835855faa 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr)
140} 140}
141 141
142/** 142/**
143 * dev_hw_addr_random - Create random MAC and set device flag 143 * eth_hw_addr_random - Generate software assigned random Ethernet and
144 * set device flag
144 * @dev: pointer to net_device structure 145 * @dev: pointer to net_device structure
145 * @hwaddr: Pointer to a six-byte array containing the Ethernet address
146 * 146 *
147 * Generate random MAC to be used by a device and set addr_assign_type 147 * Generate a random Ethernet address (MAC) to be used by a net device
148 * so the state can be read by sysfs and be used by udev. 148 * and set addr_assign_type so the state can be read by sysfs and be
149 * used by userspace.
149 */ 150 */
150static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr) 151static inline void eth_hw_addr_random(struct net_device *dev)
151{ 152{
152 dev->addr_assign_type |= NET_ADDR_RANDOM; 153 dev->addr_assign_type |= NET_ADDR_RANDOM;
153 random_ether_addr(hwaddr); 154 random_ether_addr(dev->dev_addr);
154} 155}
155 156
156/** 157/**
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index da5b2de99ae4..e1d9e0ede309 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -30,10 +30,15 @@ struct ethtool_cmd {
30 * access it */ 30 * access it */
31 __u8 duplex; /* Duplex, half or full */ 31 __u8 duplex; /* Duplex, half or full */
32 __u8 port; /* Which connector port */ 32 __u8 port; /* Which connector port */
33 __u8 phy_address; 33 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45).
34 * May be read-only or read-write
35 * depending on the driver.
36 */
34 __u8 transceiver; /* Which transceiver to use */ 37 __u8 transceiver; /* Which transceiver to use */
35 __u8 autoneg; /* Enable or disable autonegotiation */ 38 __u8 autoneg; /* Enable or disable autonegotiation */
36 __u8 mdio_support; 39 __u8 mdio_support; /* MDIO protocols supported. Read-only.
40 * Not set by all drivers.
41 */
37 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 42 __u32 maxtxpkt; /* Tx pkts before generating tx int */
38 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 43 __u32 maxrxpkt; /* Rx pkts before generating rx int */
39 __u16 speed_hi; /* The forced speed (upper 44 __u16 speed_hi; /* The forced speed (upper
@@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
59 return (ep->speed_hi << 16) | ep->speed; 64 return (ep->speed_hi << 16) | ep->speed;
60} 65}
61 66
67/* Device supports clause 22 register access to PHY or peripherals
68 * using the interface defined in <linux/mii.h>. This should not be
69 * set if there are known to be no such peripherals present or if
70 * the driver only emulates clause 22 registers for compatibility.
71 */
72#define ETH_MDIO_SUPPORTS_C22 1
73
74/* Device supports clause 45 register access to PHY or peripherals
75 * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
76 * This should not be set if there are known to be no such peripherals
77 * present.
78 */
79#define ETH_MDIO_SUPPORTS_C45 2
80
62#define ETHTOOL_FWVERS_LEN 32 81#define ETHTOOL_FWVERS_LEN 32
63#define ETHTOOL_BUSINFO_LEN 32 82#define ETHTOOL_BUSINFO_LEN 32
64/* these strings are set to whatever the driver author decides... */ 83/* these strings are set to whatever the driver author decides... */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index f957085d40ed..f5a84eef6ed2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h> 20#include <linux/magic.h>
21#include <linux/bug.h>
21 22
22/* 23/*
23 * The second extended filesystem constants/structures 24 * The second extended filesystem constants/structures
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c18122f40543..d31cb682e173 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -407,7 +407,6 @@ struct fb_cursor {
407 407
408#include <linux/fs.h> 408#include <linux/fs.h>
409#include <linux/init.h> 409#include <linux/init.h>
410#include <linux/device.h>
411#include <linux/workqueue.h> 410#include <linux/workqueue.h>
412#include <linux/notifier.h> 411#include <linux/notifier.h>
413#include <linux/list.h> 412#include <linux/list.h>
@@ -1003,6 +1002,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
1003/* drivers/video/fbmem.c */ 1002/* drivers/video/fbmem.c */
1004extern int register_framebuffer(struct fb_info *fb_info); 1003extern int register_framebuffer(struct fb_info *fb_info);
1005extern int unregister_framebuffer(struct fb_info *fb_info); 1004extern int unregister_framebuffer(struct fb_info *fb_info);
1005extern int unlink_framebuffer(struct fb_info *fb_info);
1006extern void remove_conflicting_framebuffers(struct apertures_struct *a, 1006extern void remove_conflicting_framebuffers(struct apertures_struct *a,
1007 const char *name, bool primary); 1007 const char *name, bool primary);
1008extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 1008extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
diff --git a/include/linux/file.h b/include/linux/file.h
index 21a79958541c..58bf158c53d9 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -12,7 +12,6 @@
12struct file; 12struct file;
13 13
14extern void fput(struct file *); 14extern void fput(struct file *);
15extern void drop_file_write_access(struct file *file);
16 15
17struct file_operations; 16struct file_operations;
18struct vfsmount; 17struct vfsmount;
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 357dbfc2829e..d50036953497 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -207,12 +207,16 @@ struct fw_cdev_event_request2 {
207 * @closure: See &fw_cdev_event_common; 207 * @closure: See &fw_cdev_event_common;
208 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl 208 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
209 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT 209 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
210 * @cycle: Cycle counter of the interrupt packet 210 * @cycle: Cycle counter of the last completed packet
211 * @header_length: Total length of following headers, in bytes 211 * @header_length: Total length of following headers, in bytes
212 * @header: Stripped headers, if any 212 * @header: Stripped headers, if any
213 * 213 *
214 * This event is sent when the controller has completed an &fw_cdev_iso_packet 214 * This event is sent when the controller has completed an &fw_cdev_iso_packet
215 * with the %FW_CDEV_ISO_INTERRUPT bit set. 215 * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
216 * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
217 * without the interrupt bit set that the kernel's internal buffer for @header
218 * is about to overflow. (In the last case, kernels with ABI version < 5 drop
219 * header data up to the next interrupt packet.)
216 * 220 *
217 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): 221 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
218 * 222 *
@@ -267,9 +271,9 @@ struct fw_cdev_event_iso_interrupt {
267 * 271 *
268 * This event is sent in multichannel contexts (context type 272 * This event is sent in multichannel contexts (context type
269 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer 273 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
270 * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens 274 * chunks that have been completely filled and that have the
271 * when a packet is completed and/or when a buffer chunk is completed depends 275 * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with
272 * on the hardware implementation. 276 * %FW_CDEV_IOC_FLUSH_ISO.
273 * 277 *
274 * The buffer is continuously filled with the following data, per packet: 278 * The buffer is continuously filled with the following data, per packet:
275 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, 279 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
@@ -419,6 +423,9 @@ union fw_cdev_event {
419#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) 423#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
420#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) 424#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
421 425
426/* available since kernel version 3.4 */
427#define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso)
428
422/* 429/*
423 * ABI version history 430 * ABI version history
424 * 1 (2.6.22) - initial version 431 * 1 (2.6.22) - initial version
@@ -441,6 +448,9 @@ union fw_cdev_event {
441 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, 448 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
442 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and 449 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
443 * %FW_CDEV_IOC_SET_ISO_CHANNELS 450 * %FW_CDEV_IOC_SET_ISO_CHANNELS
451 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to
452 * avoid dropping data
453 * - added %FW_CDEV_IOC_FLUSH_ISO
444 */ 454 */
445 455
446/** 456/**
@@ -851,6 +861,25 @@ struct fw_cdev_stop_iso {
851}; 861};
852 862
853/** 863/**
864 * struct fw_cdev_flush_iso - flush completed iso packets
865 * @handle: handle of isochronous context to flush
866 *
867 * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts,
868 * report any completed packets.
869 *
870 * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current
871 * offset in the receive buffer, if it has changed; this is typically in the
872 * middle of some buffer chunk.
873 *
874 * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
875 * events generated by this ioctl are sent synchronously, i.e., are available
876 * for reading from the file descriptor when this ioctl returns.
877 */
878struct fw_cdev_flush_iso {
879 __u32 handle;
880};
881
882/**
854 * struct fw_cdev_get_cycle_timer - read cycle timer register 883 * struct fw_cdev_get_cycle_timer - read cycle timer register
855 * @local_time: system time, in microseconds since the Epoch 884 * @local_time: system time, in microseconds since the Epoch
856 * @cycle_timer: Cycle Time register contents 885 * @cycle_timer: Cycle Time register contents
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 84ccf8e04fa6..4db7b68f0582 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -2,7 +2,6 @@
2#define _LINUX_FIREWIRE_H 2#define _LINUX_FIREWIRE_H
3 3
4#include <linux/completion.h> 4#include <linux/completion.h>
5#include <linux/device.h>
6#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/kref.h> 7#include <linux/kref.h>
@@ -17,9 +16,6 @@
17#include <linux/atomic.h> 16#include <linux/atomic.h>
18#include <asm/byteorder.h> 17#include <asm/byteorder.h>
19 18
20#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
21#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
22
23#define CSR_REGISTER_BASE 0xfffff0000000ULL 19#define CSR_REGISTER_BASE 0xfffff0000000ULL
24 20
25/* register offsets are relative to CSR_REGISTER_BASE */ 21/* register offsets are relative to CSR_REGISTER_BASE */
@@ -68,6 +64,8 @@
68#define CSR_MODEL 0x17 64#define CSR_MODEL 0x17
69#define CSR_DIRECTORY_ID 0x20 65#define CSR_DIRECTORY_ID 0x20
70 66
67struct device;
68
71struct fw_csr_iterator { 69struct fw_csr_iterator {
72 const u32 *p; 70 const u32 *p;
73 const u32 *end; 71 const u32 *end;
@@ -203,18 +201,6 @@ static inline int fw_device_is_shutdown(struct fw_device *device)
203 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; 201 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
204} 202}
205 203
206static inline struct fw_device *fw_device_get(struct fw_device *device)
207{
208 get_device(&device->device);
209
210 return device;
211}
212
213static inline void fw_device_put(struct fw_device *device)
214{
215 put_device(&device->device);
216}
217
218int fw_device_enable_phys_dma(struct fw_device *device); 204int fw_device_enable_phys_dma(struct fw_device *device);
219 205
220/* 206/*
@@ -441,6 +427,7 @@ int fw_iso_context_queue(struct fw_iso_context *ctx,
441 struct fw_iso_buffer *buffer, 427 struct fw_iso_buffer *buffer,
442 unsigned long payload); 428 unsigned long payload);
443void fw_iso_context_queue_flush(struct fw_iso_context *ctx); 429void fw_iso_context_queue_flush(struct fw_iso_context *ctx);
430int fw_iso_context_flush_completions(struct fw_iso_context *ctx);
444int fw_iso_context_start(struct fw_iso_context *ctx, 431int fw_iso_context_start(struct fw_iso_context *ctx,
445 int cycle, int sync, int tags); 432 int cycle, int sync, int tags);
446int fw_iso_context_stop(struct fw_iso_context *ctx); 433int fw_iso_context_stop(struct fw_iso_context *ctx);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 69cd5bb640f5..c437f914d537 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -389,6 +389,7 @@ struct inodes_stat_t {
389#include <linux/prio_tree.h> 389#include <linux/prio_tree.h>
390#include <linux/init.h> 390#include <linux/init.h>
391#include <linux/pid.h> 391#include <linux/pid.h>
392#include <linux/bug.h>
392#include <linux/mutex.h> 393#include <linux/mutex.h>
393#include <linux/capability.h> 394#include <linux/capability.h>
394#include <linux/semaphore.h> 395#include <linux/semaphore.h>
@@ -1459,6 +1460,7 @@ struct super_block {
1459 u8 s_uuid[16]; /* UUID */ 1460 u8 s_uuid[16]; /* UUID */
1460 1461
1461 void *s_fs_info; /* Filesystem private info */ 1462 void *s_fs_info; /* Filesystem private info */
1463 unsigned int s_max_links;
1462 fmode_t s_mode; 1464 fmode_t s_mode;
1463 1465
1464 /* Granularity of c/m/atime in ns. 1466 /* Granularity of c/m/atime in ns.
@@ -1811,11 +1813,11 @@ static inline void inode_inc_iversion(struct inode *inode)
1811 spin_unlock(&inode->i_lock); 1813 spin_unlock(&inode->i_lock);
1812} 1814}
1813 1815
1814extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1816extern void touch_atime(struct path *);
1815static inline void file_accessed(struct file *file) 1817static inline void file_accessed(struct file *file)
1816{ 1818{
1817 if (!(file->f_flags & O_NOATIME)) 1819 if (!(file->f_flags & O_NOATIME))
1818 touch_atime(file->f_path.mnt, file->f_path.dentry); 1820 touch_atime(&file->f_path);
1819} 1821}
1820 1822
1821int sync_inode(struct inode *inode, struct writeback_control *wbc); 1823int sync_inode(struct inode *inode, struct writeback_control *wbc);
@@ -1870,19 +1872,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1870 const struct dentry_operations *dops, 1872 const struct dentry_operations *dops,
1871 unsigned long); 1873 unsigned long);
1872 1874
1873static inline void sb_mark_dirty(struct super_block *sb)
1874{
1875 sb->s_dirt = 1;
1876}
1877static inline void sb_mark_clean(struct super_block *sb)
1878{
1879 sb->s_dirt = 0;
1880}
1881static inline int sb_is_dirty(struct super_block *sb)
1882{
1883 return sb->s_dirt;
1884}
1885
1886/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1875/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1887#define fops_get(fops) \ 1876#define fops_get(fops) \
1888 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) 1877 (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
@@ -2304,7 +2293,10 @@ extern struct inode * igrab(struct inode *);
2304extern ino_t iunique(struct super_block *, ino_t); 2293extern ino_t iunique(struct super_block *, ino_t);
2305extern int inode_needs_sync(struct inode *inode); 2294extern int inode_needs_sync(struct inode *inode);
2306extern int generic_delete_inode(struct inode *inode); 2295extern int generic_delete_inode(struct inode *inode);
2307extern int generic_drop_inode(struct inode *inode); 2296static inline int generic_drop_inode(struct inode *inode)
2297{
2298 return !inode->i_nlink || inode_unhashed(inode);
2299}
2308 2300
2309extern struct inode *ilookup5_nowait(struct super_block *sb, 2301extern struct inode *ilookup5_nowait(struct super_block *sb,
2310 unsigned long hashval, int (*test)(struct inode *, void *), 2302 unsigned long hashval, int (*test)(struct inode *, void *),
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2a53f10712b3..a6dfe6944564 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -14,6 +14,7 @@
14#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
15#include <linux/audit.h> 15#include <linux/audit.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/bug.h>
17 18
18/* 19/*
19 * fsnotify_d_instantiate - instantiate a dentry for inode 20 * fsnotify_d_instantiate - instantiate a dentry for inode
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 028e26f0bf08..72a6cabb4d5b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -31,16 +31,33 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
31 31
32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
33 33
34/*
35 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
36 * set in the flags member.
37 *
38 * ENABLED - set/unset when ftrace_ops is registered/unregistered
39 * GLOBAL - set manualy by ftrace_ops user to denote the ftrace_ops
40 * is part of the global tracers sharing the same filter
41 * via set_ftrace_* debugfs files.
42 * DYNAMIC - set when ftrace_ops is registered to denote dynamically
43 * allocated ftrace_ops which need special care
44 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops
45 * could be controled by following calls:
46 * ftrace_function_local_enable
47 * ftrace_function_local_disable
48 */
34enum { 49enum {
35 FTRACE_OPS_FL_ENABLED = 1 << 0, 50 FTRACE_OPS_FL_ENABLED = 1 << 0,
36 FTRACE_OPS_FL_GLOBAL = 1 << 1, 51 FTRACE_OPS_FL_GLOBAL = 1 << 1,
37 FTRACE_OPS_FL_DYNAMIC = 1 << 2, 52 FTRACE_OPS_FL_DYNAMIC = 1 << 2,
53 FTRACE_OPS_FL_CONTROL = 1 << 3,
38}; 54};
39 55
40struct ftrace_ops { 56struct ftrace_ops {
41 ftrace_func_t func; 57 ftrace_func_t func;
42 struct ftrace_ops *next; 58 struct ftrace_ops *next;
43 unsigned long flags; 59 unsigned long flags;
60 int __percpu *disabled;
44#ifdef CONFIG_DYNAMIC_FTRACE 61#ifdef CONFIG_DYNAMIC_FTRACE
45 struct ftrace_hash *notrace_hash; 62 struct ftrace_hash *notrace_hash;
46 struct ftrace_hash *filter_hash; 63 struct ftrace_hash *filter_hash;
@@ -97,6 +114,55 @@ int register_ftrace_function(struct ftrace_ops *ops);
97int unregister_ftrace_function(struct ftrace_ops *ops); 114int unregister_ftrace_function(struct ftrace_ops *ops);
98void clear_ftrace_function(void); 115void clear_ftrace_function(void);
99 116
117/**
118 * ftrace_function_local_enable - enable controlled ftrace_ops on current cpu
119 *
120 * This function enables tracing on current cpu by decreasing
121 * the per cpu control variable.
122 * It must be called with preemption disabled and only on ftrace_ops
123 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
124 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
125 */
126static inline void ftrace_function_local_enable(struct ftrace_ops *ops)
127{
128 if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
129 return;
130
131 (*this_cpu_ptr(ops->disabled))--;
132}
133
134/**
135 * ftrace_function_local_disable - enable controlled ftrace_ops on current cpu
136 *
137 * This function enables tracing on current cpu by decreasing
138 * the per cpu control variable.
139 * It must be called with preemption disabled and only on ftrace_ops
140 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
141 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
142 */
143static inline void ftrace_function_local_disable(struct ftrace_ops *ops)
144{
145 if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
146 return;
147
148 (*this_cpu_ptr(ops->disabled))++;
149}
150
151/**
152 * ftrace_function_local_disabled - returns ftrace_ops disabled value
153 * on current cpu
154 *
155 * This function returns value of ftrace_ops::disabled on current cpu.
156 * It must be called with preemption disabled and only on ftrace_ops
157 * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
158 * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
159 */
160static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
161{
162 WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL));
163 return *this_cpu_ptr(ops->disabled);
164}
165
100extern void ftrace_stub(unsigned long a0, unsigned long a1); 166extern void ftrace_stub(unsigned long a0, unsigned long a1);
101 167
102#else /* !CONFIG_FUNCTION_TRACER */ 168#else /* !CONFIG_FUNCTION_TRACER */
@@ -178,12 +244,13 @@ struct dyn_ftrace {
178}; 244};
179 245
180int ftrace_force_update(void); 246int ftrace_force_update(void);
181void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 247int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
182 int len, int reset); 248 int len, int reset);
183void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 249int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
184 int len, int reset); 250 int len, int reset);
185void ftrace_set_global_filter(unsigned char *buf, int len, int reset); 251void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
186void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); 252void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
253void ftrace_free_filter(struct ftrace_ops *ops);
187 254
188int register_ftrace_command(struct ftrace_func_command *cmd); 255int register_ftrace_command(struct ftrace_func_command *cmd);
189int unregister_ftrace_command(struct ftrace_func_command *cmd); 256int unregister_ftrace_command(struct ftrace_func_command *cmd);
@@ -314,9 +381,6 @@ extern void ftrace_enable_daemon(void);
314#else 381#else
315static inline int skip_trace(unsigned long ip) { return 0; } 382static inline int skip_trace(unsigned long ip) { return 0; }
316static inline int ftrace_force_update(void) { return 0; } 383static inline int ftrace_force_update(void) { return 0; }
317static inline void ftrace_set_filter(unsigned char *buf, int len, int reset)
318{
319}
320static inline void ftrace_disable_daemon(void) { } 384static inline void ftrace_disable_daemon(void) { }
321static inline void ftrace_enable_daemon(void) { } 385static inline void ftrace_enable_daemon(void) { }
322static inline void ftrace_release_mod(struct module *mod) {} 386static inline void ftrace_release_mod(struct module *mod) {}
@@ -340,6 +404,9 @@ static inline int ftrace_text_reserved(void *start, void *end)
340 */ 404 */
341#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; }) 405#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
342#define ftrace_set_early_filter(ops, buf, enable) do { } while (0) 406#define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
407#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
408#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
409#define ftrace_free_filter(ops) do { } while (0)
343 410
344static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, 411static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
345 size_t cnt, loff_t *ppos) { return -ENODEV; } 412 size_t cnt, loff_t *ppos) { return -ENODEV; }
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c3da42dd22ba..dd478fc8f9f5 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -146,6 +146,10 @@ enum trace_reg {
146 TRACE_REG_UNREGISTER, 146 TRACE_REG_UNREGISTER,
147 TRACE_REG_PERF_REGISTER, 147 TRACE_REG_PERF_REGISTER,
148 TRACE_REG_PERF_UNREGISTER, 148 TRACE_REG_PERF_UNREGISTER,
149 TRACE_REG_PERF_OPEN,
150 TRACE_REG_PERF_CLOSE,
151 TRACE_REG_PERF_ADD,
152 TRACE_REG_PERF_DEL,
149}; 153};
150 154
151struct ftrace_event_call; 155struct ftrace_event_call;
@@ -157,7 +161,7 @@ struct ftrace_event_class {
157 void *perf_probe; 161 void *perf_probe;
158#endif 162#endif
159 int (*reg)(struct ftrace_event_call *event, 163 int (*reg)(struct ftrace_event_call *event,
160 enum trace_reg type); 164 enum trace_reg type, void *data);
161 int (*define_fields)(struct ftrace_event_call *); 165 int (*define_fields)(struct ftrace_event_call *);
162 struct list_head *(*get_fields)(struct ftrace_event_call *); 166 struct list_head *(*get_fields)(struct ftrace_event_call *);
163 struct list_head fields; 167 struct list_head fields;
@@ -165,7 +169,7 @@ struct ftrace_event_class {
165}; 169};
166 170
167extern int ftrace_event_reg(struct ftrace_event_call *event, 171extern int ftrace_event_reg(struct ftrace_event_call *event,
168 enum trace_reg type); 172 enum trace_reg type, void *data);
169 173
170enum { 174enum {
171 TRACE_EVENT_FL_ENABLED_BIT, 175 TRACE_EVENT_FL_ENABLED_BIT,
@@ -241,6 +245,7 @@ enum {
241 FILTER_STATIC_STRING, 245 FILTER_STATIC_STRING,
242 FILTER_DYN_STRING, 246 FILTER_DYN_STRING,
243 FILTER_PTR_STRING, 247 FILTER_PTR_STRING,
248 FILTER_TRACE_FN,
244}; 249};
245 250
246#define EVENT_STORAGE_SIZE 128 251#define EVENT_STORAGE_SIZE 128
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index b148087f49a6..fa98bdb073b9 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -168,6 +168,7 @@ struct gfs2_rindex {
168#define GFS2_RGF_METAONLY 0x00000002 168#define GFS2_RGF_METAONLY 0x00000002
169#define GFS2_RGF_DATAONLY 0x00000004 169#define GFS2_RGF_DATAONLY 0x00000004
170#define GFS2_RGF_NOALLOC 0x00000008 170#define GFS2_RGF_NOALLOC 0x00000008
171#define GFS2_RGF_TRIMMED 0x00000010
171 172
172struct gfs2_rgrp { 173struct gfs2_rgrp {
173 struct gfs2_meta_header rg_header; 174 struct gfs2_meta_header rg_header;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 38ac48b7d3a8..6155ecf192b0 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,6 +14,12 @@
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16 16
17/* Gpio pin is open drain */
18#define GPIOF_OPEN_DRAIN (1 << 2)
19
20/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3)
22
17/** 23/**
18 * struct gpio - a structure describing a GPIO with configuration 24 * struct gpio - a structure describing a GPIO with configuration
19 * @gpio: the GPIO number 25 * @gpio: the GPIO number
@@ -34,6 +40,7 @@ struct gpio {
34#include <linux/kernel.h> 40#include <linux/kernel.h>
35#include <linux/types.h> 41#include <linux/types.h>
36#include <linux/errno.h> 42#include <linux/errno.h>
43#include <linux/bug.h>
37 44
38struct device; 45struct device;
39struct gpio_chip; 46struct gpio_chip;
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 3a93f73a8acc..d3999b4e26cc 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/bug.h>
6#include <linux/mm.h> 7#include <linux/mm.h>
7#include <linux/uaccess.h> 8#include <linux/uaccess.h>
8#include <linux/hardirq.h> 9#include <linux/hardirq.h>
@@ -55,12 +56,12 @@ static inline void kunmap(struct page *page)
55{ 56{
56} 57}
57 58
58static inline void *__kmap_atomic(struct page *page) 59static inline void *kmap_atomic(struct page *page)
59{ 60{
60 pagefault_disable(); 61 pagefault_disable();
61 return page_address(page); 62 return page_address(page);
62} 63}
63#define kmap_atomic_prot(page, prot) __kmap_atomic(page) 64#define kmap_atomic_prot(page, prot) kmap_atomic(page)
64 65
65static inline void __kunmap_atomic(void *addr) 66static inline void __kunmap_atomic(void *addr)
66{ 67{
@@ -109,27 +110,62 @@ static inline void kmap_atomic_idx_pop(void)
109#endif 110#endif
110 111
111/* 112/*
112 * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. 113 * NOTE:
114 * kmap_atomic() and kunmap_atomic() with two arguments are deprecated.
115 * We only keep them for backward compatibility, any usage of them
116 * are now warned.
113 */ 117 */
114#define kmap_atomic(page, args...) __kmap_atomic(page) 118
119#define PASTE(a, b) a ## b
120#define PASTE2(a, b) PASTE(a, b)
121
122#define NARG_(_2, _1, n, ...) n
123#define NARG(...) NARG_(__VA_ARGS__, 2, 1, :)
124
125static inline void __deprecated *kmap_atomic_deprecated(struct page *page,
126 enum km_type km)
127{
128 return kmap_atomic(page);
129}
130
131#define kmap_atomic1(...) kmap_atomic(__VA_ARGS__)
132#define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__)
133#define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
134
135static inline void __deprecated __kunmap_atomic_deprecated(void *addr,
136 enum km_type km)
137{
138 __kunmap_atomic(addr);
139}
115 140
116/* 141/*
117 * Prevent people trying to call kunmap_atomic() as if it were kunmap() 142 * Prevent people trying to call kunmap_atomic() as if it were kunmap()
118 * kunmap_atomic() should get the return value of kmap_atomic, not the page. 143 * kunmap_atomic() should get the return value of kmap_atomic, not the page.
119 */ 144 */
120#define kunmap_atomic(addr, args...) \ 145#define kunmap_atomic_deprecated(addr, km) \
121do { \ 146do { \
122 BUILD_BUG_ON(__same_type((addr), struct page *)); \ 147 BUILD_BUG_ON(__same_type((addr), struct page *)); \
123 __kunmap_atomic(addr); \ 148 __kunmap_atomic_deprecated(addr, km); \
124} while (0) 149} while (0)
125 150
151#define kunmap_atomic_withcheck(addr) \
152do { \
153 BUILD_BUG_ON(__same_type((addr), struct page *)); \
154 __kunmap_atomic(addr); \
155} while (0)
156
157#define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__)
158#define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__)
159#define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__))
160/**** End of C pre-processor tricks for deprecated macros ****/
161
126/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 162/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
127#ifndef clear_user_highpage 163#ifndef clear_user_highpage
128static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 164static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
129{ 165{
130 void *addr = kmap_atomic(page, KM_USER0); 166 void *addr = kmap_atomic(page);
131 clear_user_page(addr, vaddr, page); 167 clear_user_page(addr, vaddr, page);
132 kunmap_atomic(addr, KM_USER0); 168 kunmap_atomic(addr);
133} 169}
134#endif 170#endif
135 171
@@ -180,16 +216,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
180 216
181static inline void clear_highpage(struct page *page) 217static inline void clear_highpage(struct page *page)
182{ 218{
183 void *kaddr = kmap_atomic(page, KM_USER0); 219 void *kaddr = kmap_atomic(page);
184 clear_page(kaddr); 220 clear_page(kaddr);
185 kunmap_atomic(kaddr, KM_USER0); 221 kunmap_atomic(kaddr);
186} 222}
187 223
188static inline void zero_user_segments(struct page *page, 224static inline void zero_user_segments(struct page *page,
189 unsigned start1, unsigned end1, 225 unsigned start1, unsigned end1,
190 unsigned start2, unsigned end2) 226 unsigned start2, unsigned end2)
191{ 227{
192 void *kaddr = kmap_atomic(page, KM_USER0); 228 void *kaddr = kmap_atomic(page);
193 229
194 BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); 230 BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE);
195 231
@@ -199,7 +235,7 @@ static inline void zero_user_segments(struct page *page,
199 if (end2 > start2) 235 if (end2 > start2)
200 memset(kaddr + start2, 0, end2 - start2); 236 memset(kaddr + start2, 0, end2 - start2);
201 237
202 kunmap_atomic(kaddr, KM_USER0); 238 kunmap_atomic(kaddr);
203 flush_dcache_page(page); 239 flush_dcache_page(page);
204} 240}
205 241
@@ -228,11 +264,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from,
228{ 264{
229 char *vfrom, *vto; 265 char *vfrom, *vto;
230 266
231 vfrom = kmap_atomic(from, KM_USER0); 267 vfrom = kmap_atomic(from);
232 vto = kmap_atomic(to, KM_USER1); 268 vto = kmap_atomic(to);
233 copy_user_page(vto, vfrom, vaddr, to); 269 copy_user_page(vto, vfrom, vaddr, to);
234 kunmap_atomic(vto, KM_USER1); 270 kunmap_atomic(vto);
235 kunmap_atomic(vfrom, KM_USER0); 271 kunmap_atomic(vfrom);
236} 272}
237 273
238#endif 274#endif
@@ -241,11 +277,11 @@ static inline void copy_highpage(struct page *to, struct page *from)
241{ 277{
242 char *vfrom, *vto; 278 char *vfrom, *vto;
243 279
244 vfrom = kmap_atomic(from, KM_USER0); 280 vfrom = kmap_atomic(from);
245 vto = kmap_atomic(to, KM_USER1); 281 vto = kmap_atomic(to);
246 copy_page(vto, vfrom); 282 copy_page(vto, vfrom);
247 kunmap_atomic(vto, KM_USER1); 283 kunmap_atomic(vto);
248 kunmap_atomic(vfrom, KM_USER0); 284 kunmap_atomic(vfrom);
249} 285}
250 286
251#endif /* _LINUX_HIGHMEM_H */ 287#endif /* _LINUX_HIGHMEM_H */
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 1b921299abc4..c8af7a2efb52 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -51,6 +51,9 @@ extern pmd_t *page_check_address_pmd(struct page *page,
51 unsigned long address, 51 unsigned long address,
52 enum page_check_address_pmd_flag flag); 52 enum page_check_address_pmd_flag flag);
53 53
54#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
55#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
56
54#ifdef CONFIG_TRANSPARENT_HUGEPAGE 57#ifdef CONFIG_TRANSPARENT_HUGEPAGE
55#define HPAGE_PMD_SHIFT HPAGE_SHIFT 58#define HPAGE_PMD_SHIFT HPAGE_SHIFT
56#define HPAGE_PMD_MASK HPAGE_MASK 59#define HPAGE_PMD_MASK HPAGE_MASK
@@ -102,8 +105,6 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd);
102 BUG_ON(pmd_trans_splitting(*____pmd) || \ 105 BUG_ON(pmd_trans_splitting(*____pmd) || \
103 pmd_trans_huge(*____pmd)); \ 106 pmd_trans_huge(*____pmd)); \
104 } while (0) 107 } while (0)
105#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
106#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
107#if HPAGE_PMD_ORDER > MAX_ORDER 108#if HPAGE_PMD_ORDER > MAX_ORDER
108#error "hugepages can't be allocated by the buddy allocator" 109#error "hugepages can't be allocated by the buddy allocator"
109#endif 110#endif
@@ -113,6 +114,18 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma,
113 unsigned long start, 114 unsigned long start,
114 unsigned long end, 115 unsigned long end,
115 long adjust_next); 116 long adjust_next);
117extern int __pmd_trans_huge_lock(pmd_t *pmd,
118 struct vm_area_struct *vma);
119/* mmap_sem must be held on entry */
120static inline int pmd_trans_huge_lock(pmd_t *pmd,
121 struct vm_area_struct *vma)
122{
123 VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem));
124 if (pmd_trans_huge(*pmd))
125 return __pmd_trans_huge_lock(pmd, vma);
126 else
127 return 0;
128}
116static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, 129static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
117 unsigned long start, 130 unsigned long start,
118 unsigned long end, 131 unsigned long end,
@@ -146,9 +159,9 @@ static inline struct page *compound_trans_head(struct page *page)
146 return page; 159 return page;
147} 160}
148#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 161#else /* CONFIG_TRANSPARENT_HUGEPAGE */
149#define HPAGE_PMD_SHIFT ({ BUG(); 0; }) 162#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
150#define HPAGE_PMD_MASK ({ BUG(); 0; }) 163#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
151#define HPAGE_PMD_SIZE ({ BUG(); 0; }) 164#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
152 165
153#define hpage_nr_pages(x) 1 166#define hpage_nr_pages(x) 1
154 167
@@ -176,6 +189,11 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
176 long adjust_next) 189 long adjust_next)
177{ 190{
178} 191}
192static inline int pmd_trans_huge_lock(pmd_t *pmd,
193 struct vm_area_struct *vma)
194{
195 return 0;
196}
179#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
180 198
181#endif /* _LINUX_HUGE_MM_H */ 199#endif /* _LINUX_HUGE_MM_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d9d6c868b86b..000837e126e6 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -14,6 +14,15 @@ struct user_struct;
14#include <linux/shm.h> 14#include <linux/shm.h>
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16 16
17struct hugepage_subpool {
18 spinlock_t lock;
19 long count;
20 long max_hpages, used_hpages;
21};
22
23struct hugepage_subpool *hugepage_new_subpool(long nr_blocks);
24void hugepage_put_subpool(struct hugepage_subpool *spool);
25
17int PageHuge(struct page *page); 26int PageHuge(struct page *page);
18 27
19void reset_vma_resv_huge_pages(struct vm_area_struct *vma); 28void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
@@ -128,35 +137,14 @@ enum {
128}; 137};
129 138
130#ifdef CONFIG_HUGETLBFS 139#ifdef CONFIG_HUGETLBFS
131struct hugetlbfs_config {
132 uid_t uid;
133 gid_t gid;
134 umode_t mode;
135 long nr_blocks;
136 long nr_inodes;
137 struct hstate *hstate;
138};
139
140struct hugetlbfs_sb_info { 140struct hugetlbfs_sb_info {
141 long max_blocks; /* blocks allowed */
142 long free_blocks; /* blocks free */
143 long max_inodes; /* inodes allowed */ 141 long max_inodes; /* inodes allowed */
144 long free_inodes; /* inodes free */ 142 long free_inodes; /* inodes free */
145 spinlock_t stat_lock; 143 spinlock_t stat_lock;
146 struct hstate *hstate; 144 struct hstate *hstate;
145 struct hugepage_subpool *spool;
147}; 146};
148 147
149
150struct hugetlbfs_inode_info {
151 struct shared_policy policy;
152 struct inode vfs_inode;
153};
154
155static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode)
156{
157 return container_of(inode, struct hugetlbfs_inode_info, vfs_inode);
158}
159
160static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) 148static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
161{ 149{
162 return sb->s_fs_info; 150 return sb->s_fs_info;
@@ -164,10 +152,9 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
164 152
165extern const struct file_operations hugetlbfs_file_operations; 153extern const struct file_operations hugetlbfs_file_operations;
166extern const struct vm_operations_struct hugetlb_vm_ops; 154extern const struct vm_operations_struct hugetlb_vm_ops;
167struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, 155struct file *hugetlb_file_setup(const char *name, unsigned long addr,
156 size_t size, vm_flags_t acct,
168 struct user_struct **user, int creat_flags); 157 struct user_struct **user, int creat_flags);
169int hugetlb_get_quota(struct address_space *mapping, long delta);
170void hugetlb_put_quota(struct address_space *mapping, long delta);
171 158
172static inline int is_file_hugepages(struct file *file) 159static inline int is_file_hugepages(struct file *file)
173{ 160{
@@ -179,15 +166,11 @@ static inline int is_file_hugepages(struct file *file)
179 return 0; 166 return 0;
180} 167}
181 168
182static inline void set_file_hugepages(struct file *file)
183{
184 file->f_op = &hugetlbfs_file_operations;
185}
186#else /* !CONFIG_HUGETLBFS */ 169#else /* !CONFIG_HUGETLBFS */
187 170
188#define is_file_hugepages(file) 0 171#define is_file_hugepages(file) 0
189#define set_file_hugepages(file) BUG() 172static inline struct file *
190static inline struct file *hugetlb_file_setup(const char *name, size_t size, 173hugetlb_file_setup(const char *name, unsigned long addr, size_t size,
191 vm_flags_t acctflag, struct user_struct **user, int creat_flags) 174 vm_flags_t acctflag, struct user_struct **user, int creat_flags)
192{ 175{
193 return ERR_PTR(-ENOSYS); 176 return ERR_PTR(-ENOSYS);
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index a90c09d331c1..1c7b89ae6bdc 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -20,6 +20,8 @@
20#ifndef _LINUX_HWMON_SYSFS_H 20#ifndef _LINUX_HWMON_SYSFS_H
21#define _LINUX_HWMON_SYSFS_H 21#define _LINUX_HWMON_SYSFS_H
22 22
23#include <linux/device.h>
24
23struct sensor_device_attribute{ 25struct sensor_device_attribute{
24 struct device_attribute dev_attr; 26 struct device_attribute dev_attr;
25 int index; 27 int index;
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 6b6ee702b007..82b29ae6ebb0 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -14,7 +14,7 @@
14#ifndef _HWMON_H_ 14#ifndef _HWMON_H_
15#define _HWMON_H_ 15#define _HWMON_H_
16 16
17#include <linux/device.h> 17struct device;
18 18
19struct device *hwmon_device_register(struct device *dev); 19struct device *hwmon_device_register(struct device *dev);
20 20
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
index aad6bd4b3efd..3343298e40e8 100644
--- a/include/linux/hwspinlock.h
+++ b/include/linux/hwspinlock.h
@@ -20,12 +20,12 @@
20 20
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/device.h>
24 23
25/* hwspinlock mode argument */ 24/* hwspinlock mode argument */
26#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ 25#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
27#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ 26#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
28 27
28struct device;
29struct hwspinlock; 29struct hwspinlock;
30struct hwspinlock_device; 30struct hwspinlock_device;
31struct hwspinlock_ops; 31struct hwspinlock_ops;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 0ae065a5fcb2..5852545e6bba 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -25,6 +25,173 @@
25#ifndef _HYPERV_H 25#ifndef _HYPERV_H
26#define _HYPERV_H 26#define _HYPERV_H
27 27
28#include <linux/types.h>
29
30/*
31 * An implementation of HyperV key value pair (KVP) functionality for Linux.
32 *
33 *
34 * Copyright (C) 2010, Novell, Inc.
35 * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
36 *
37 */
38
39/*
40 * Maximum value size - used for both key names and value data, and includes
41 * any applicable NULL terminators.
42 *
43 * Note: This limit is somewhat arbitrary, but falls easily within what is
44 * supported for all native guests (back to Win 2000) and what is reasonable
45 * for the IC KVP exchange functionality. Note that Windows Me/98/95 are
46 * limited to 255 character key names.
47 *
48 * MSDN recommends not storing data values larger than 2048 bytes in the
49 * registry.
50 *
51 * Note: This value is used in defining the KVP exchange message - this value
52 * cannot be modified without affecting the message size and compatibility.
53 */
54
55/*
56 * bytes, including any null terminators
57 */
58#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
59
60
61/*
62 * Maximum key size - the registry limit for the length of an entry name
63 * is 256 characters, including the null terminator
64 */
65
66#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
67
68/*
69 * In Linux, we implement the KVP functionality in two components:
70 * 1) The kernel component which is packaged as part of the hv_utils driver
71 * is responsible for communicating with the host and responsible for
72 * implementing the host/guest protocol. 2) A user level daemon that is
73 * responsible for data gathering.
74 *
75 * Host/Guest Protocol: The host iterates over an index and expects the guest
76 * to assign a key name to the index and also return the value corresponding to
77 * the key. The host will have atmost one KVP transaction outstanding at any
78 * given point in time. The host side iteration stops when the guest returns
79 * an error. Microsoft has specified the following mapping of key names to
80 * host specified index:
81 *
82 * Index Key Name
83 * 0 FullyQualifiedDomainName
84 * 1 IntegrationServicesVersion
85 * 2 NetworkAddressIPv4
86 * 3 NetworkAddressIPv6
87 * 4 OSBuildNumber
88 * 5 OSName
89 * 6 OSMajorVersion
90 * 7 OSMinorVersion
91 * 8 OSVersion
92 * 9 ProcessorArchitecture
93 *
94 * The Windows host expects the Key Name and Key Value to be encoded in utf16.
95 *
96 * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
97 * data gathering functionality in a user mode daemon. The user level daemon
98 * is also responsible for binding the key name to the index as well. The
99 * kernel and user-level daemon communicate using a connector channel.
100 *
101 * The user mode component first registers with the
102 * the kernel component. Subsequently, the kernel component requests, data
103 * for the specified keys. In response to this message the user mode component
104 * fills in the value corresponding to the specified key. We overload the
105 * sequence field in the cn_msg header to define our KVP message types.
106 *
107 *
108 * The kernel component simply acts as a conduit for communication between the
109 * Windows host and the user-level daemon. The kernel component passes up the
110 * index received from the Host to the user-level daemon. If the index is
111 * valid (supported), the corresponding key as well as its
112 * value (both are strings) is returned. If the index is invalid
113 * (not supported), a NULL key string is returned.
114 */
115
116
117/*
118 * Registry value types.
119 */
120
121#define REG_SZ 1
122#define REG_U32 4
123#define REG_U64 8
124
125enum hv_kvp_exchg_op {
126 KVP_OP_GET = 0,
127 KVP_OP_SET,
128 KVP_OP_DELETE,
129 KVP_OP_ENUMERATE,
130 KVP_OP_REGISTER,
131 KVP_OP_COUNT /* Number of operations, must be last. */
132};
133
134enum hv_kvp_exchg_pool {
135 KVP_POOL_EXTERNAL = 0,
136 KVP_POOL_GUEST,
137 KVP_POOL_AUTO,
138 KVP_POOL_AUTO_EXTERNAL,
139 KVP_POOL_AUTO_INTERNAL,
140 KVP_POOL_COUNT /* Number of pools, must be last. */
141};
142
143struct hv_kvp_hdr {
144 __u8 operation;
145 __u8 pool;
146 __u16 pad;
147} __attribute__((packed));
148
149struct hv_kvp_exchg_msg_value {
150 __u32 value_type;
151 __u32 key_size;
152 __u32 value_size;
153 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
154 union {
155 __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
156 __u32 value_u32;
157 __u64 value_u64;
158 };
159} __attribute__((packed));
160
161struct hv_kvp_msg_enumerate {
162 __u32 index;
163 struct hv_kvp_exchg_msg_value data;
164} __attribute__((packed));
165
166struct hv_kvp_msg_get {
167 struct hv_kvp_exchg_msg_value data;
168};
169
170struct hv_kvp_msg_set {
171 struct hv_kvp_exchg_msg_value data;
172};
173
174struct hv_kvp_msg_delete {
175 __u32 key_size;
176 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
177};
178
179struct hv_kvp_register {
180 __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
181};
182
183struct hv_kvp_msg {
184 struct hv_kvp_hdr kvp_hdr;
185 union {
186 struct hv_kvp_msg_get kvp_get;
187 struct hv_kvp_msg_set kvp_set;
188 struct hv_kvp_msg_delete kvp_delete;
189 struct hv_kvp_msg_enumerate kvp_enum_data;
190 struct hv_kvp_register kvp_register;
191 } body;
192} __attribute__((packed));
193
194#ifdef __KERNEL__
28#include <linux/scatterlist.h> 195#include <linux/scatterlist.h>
29#include <linux/list.h> 196#include <linux/list.h>
30#include <linux/uuid.h> 197#include <linux/uuid.h>
@@ -785,6 +952,7 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
785 952
786#define HV_S_OK 0x00000000 953#define HV_S_OK 0x00000000
787#define HV_E_FAIL 0x80004005 954#define HV_E_FAIL 0x80004005
955#define HV_S_CONT 0x80070103
788#define HV_ERROR_NOT_SUPPORTED 0x80070032 956#define HV_ERROR_NOT_SUPPORTED 0x80070032
789#define HV_ERROR_MACHINE_LOCKED 0x800704F7 957#define HV_ERROR_MACHINE_LOCKED 0x800704F7
790 958
@@ -870,4 +1038,9 @@ struct hyperv_service_callback {
870extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1038extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *,
871 struct icmsg_negotiate *, u8 *); 1039 struct icmsg_negotiate *, u8 *);
872 1040
1041int hv_kvp_init(struct hv_util_service *);
1042void hv_kvp_deinit(void);
1043void hv_kvp_onchannelcallback(void *);
1044
1045#endif /* __KERNEL__ */
873#endif /* _HYPERV_H */ 1046#endif /* _HYPERV_H */
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 4f98148c11c3..63904ba6887e 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -15,7 +15,8 @@
15 15
16 You should have received a copy of the GNU General Public License 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 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 MA 02110-1301 USA. */
19/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
20 21
21/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
@@ -49,5 +50,6 @@ struct i2c_algo_bit_data {
49 50
50int i2c_bit_add_bus(struct i2c_adapter *); 51int i2c_bit_add_bus(struct i2c_adapter *);
51int i2c_bit_add_numbered_bus(struct i2c_adapter *); 52int i2c_bit_add_numbered_bus(struct i2c_adapter *);
53extern const struct i2c_algorithm i2c_bit_algo;
52 54
53#endif /* _LINUX_I2C_ALGO_BIT_H */ 55#endif /* _LINUX_I2C_ALGO_BIT_H */
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 0f91a957a690..538e8f41a319 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 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 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA. */
20/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
21 22
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index fd53bfd26470..8a7406b2114d 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -16,7 +16,8 @@
16 16
17 You should have received a copy of the GNU General Public License 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 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA.
20*/ 21*/
21 22
22#ifndef _LINUX_I2C_DEV_H 23#ifndef _LINUX_I2C_DEV_H
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 34536effd652..747f0cde4164 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -18,7 +18,8 @@
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA.
22 */ 23 */
23 24
24#ifndef _LINUX_I2C_MUX_H 25#ifndef _LINUX_I2C_MUX_H
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
index 63f57a8c8b31..017fb40f702a 100644
--- a/include/linux/i2c-smbus.h
+++ b/include/linux/i2c-smbus.h
@@ -15,7 +15,8 @@
15 * 15 *
16 * You should have received a copy of the GNU General Public License 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 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301 USA.
19 */ 20 */
20 21
21#ifndef _LINUX_I2C_SMBUS_H 22#ifndef _LINUX_I2C_SMBUS_H
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8e25a9167f13..195d8b3d9cfb 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -17,7 +17,8 @@
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 MA 02110-1301 USA. */
21/* ------------------------------------------------------------------------- */ 22/* ------------------------------------------------------------------------- */
22 23
23/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
index 8ace93024d60..285025a9cdc9 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/i2c/at24.h
@@ -1,19 +1,42 @@
1/*
2 * at24.h - platform_data for the at24 (generic eeprom) driver
3 * (C) Copyright 2008 by Pengutronix
4 * (C) Copyright 2012 by Wolfram Sang
5 * same license as the driver
6 */
7
1#ifndef _LINUX_AT24_H 8#ifndef _LINUX_AT24_H
2#define _LINUX_AT24_H 9#define _LINUX_AT24_H
3 10
4#include <linux/types.h> 11#include <linux/types.h>
5#include <linux/memory.h> 12#include <linux/memory.h>
6 13
7/* 14/**
8 * As seen through Linux I2C, differences between the most common types of I2C 15 * struct at24_platform_data - data to set up at24 (generic eeprom) driver
9 * memory include: 16 * @byte_len: size of eeprom in byte
10 * - How much memory is available (usually specified in bit)? 17 * @page_size: number of byte which can be written in one go
11 * - What write page size does it support? 18 * @flags: tunable options, check AT24_FLAG_* defines
12 * - Special flags (16 bit addresses, read_only, world readable...)? 19 * @setup: an optional callback invoked after eeprom is probed; enables kernel
20 code to access eeprom via memory_accessor, see example
21 * @context: optional parameter passed to setup()
13 * 22 *
14 * If you set up a custom eeprom type, please double-check the parameters. 23 * If you set up a custom eeprom type, please double-check the parameters.
15 * Especially page_size needs extra care, as you risk data loss if your value 24 * Especially page_size needs extra care, as you risk data loss if your value
16 * is bigger than what the chip actually supports! 25 * is bigger than what the chip actually supports!
26 *
27 * An example in pseudo code for a setup() callback:
28 *
29 * void get_mac_addr(struct memory_accessor *mem_acc, void *context)
30 * {
31 * u8 *mac_addr = ethernet_pdata->mac_addr;
32 * off_t offset = context;
33 *
34 * // Read MAC addr from EEPROM
35 * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN)
36 * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
37 * }
38 *
39 * This function pointer and context can now be set up in at24_platform_data.
17 */ 40 */
18 41
19struct at24_platform_data { 42struct at24_platform_data {
diff --git a/include/linux/i2c/tc35876x.h b/include/linux/i2c/tc35876x.h
new file mode 100644
index 000000000000..cd6a51c71e7e
--- /dev/null
+++ b/include/linux/i2c/tc35876x.h
@@ -0,0 +1,11 @@
1
2#ifndef _TC35876X_H
3#define _TC35876X_H
4
5struct tc35876x_platform_data {
6 int gpio_bridge_reset;
7 int gpio_panel_bl_en;
8 int gpio_panel_vadd;
9};
10
11#endif /* _TC35876X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 78d3465251d6..2463b6100333 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -712,6 +712,9 @@ struct twl4030_platform_data {
712 struct regulator_init_data *vaux1; 712 struct regulator_init_data *vaux1;
713 struct regulator_init_data *vaux2; 713 struct regulator_init_data *vaux2;
714 struct regulator_init_data *vaux3; 714 struct regulator_init_data *vaux3;
715 struct regulator_init_data *vdd1;
716 struct regulator_init_data *vdd2;
717 struct regulator_init_data *vdd3;
715 /* TWL4030 LDO regulators */ 718 /* TWL4030 LDO regulators */
716 struct regulator_init_data *vpll1; 719 struct regulator_init_data *vpll1;
717 struct regulator_init_data *vpll2; 720 struct regulator_init_data *vpll2;
@@ -720,8 +723,6 @@ struct twl4030_platform_data {
720 struct regulator_init_data *vsim; 723 struct regulator_init_data *vsim;
721 struct regulator_init_data *vaux4; 724 struct regulator_init_data *vaux4;
722 struct regulator_init_data *vio; 725 struct regulator_init_data *vio;
723 struct regulator_init_data *vdd1;
724 struct regulator_init_data *vdd2;
725 struct regulator_init_data *vintana1; 726 struct regulator_init_data *vintana1;
726 struct regulator_init_data *vintana2; 727 struct regulator_init_data *vintana2;
727 struct regulator_init_data *vintdig; 728 struct regulator_init_data *vintdig;
@@ -733,6 +734,8 @@ struct twl4030_platform_data {
733 struct regulator_init_data *vcxio; 734 struct regulator_init_data *vcxio;
734 struct regulator_init_data *vusb; 735 struct regulator_init_data *vusb;
735 struct regulator_init_data *clk32kg; 736 struct regulator_init_data *clk32kg;
737 struct regulator_init_data *v1v8;
738 struct regulator_init_data *v2v1;
736 /* TWL6025 LDO regulators */ 739 /* TWL6025 LDO regulators */
737 struct regulator_init_data *ldo1; 740 struct regulator_init_data *ldo1;
738 struct regulator_init_data *ldo2; 741 struct regulator_init_data *ldo2;
@@ -749,9 +752,16 @@ struct twl4030_platform_data {
749 struct regulator_init_data *vio6025; 752 struct regulator_init_data *vio6025;
750}; 753};
751 754
755struct twl_regulator_driver_data {
756 int (*set_voltage)(void *data, int target_uV);
757 int (*get_voltage)(void *data);
758 void *data;
759 unsigned long features;
760};
761
752/*----------------------------------------------------------------------*/ 762/*----------------------------------------------------------------------*/
753 763
754int twl4030_sih_setup(int module); 764int twl4030_sih_setup(struct device *dev, int module, int irq_base);
755 765
756/* Offsets to Power Registers */ 766/* Offsets to Power Registers */
757#define TWL4030_VDAC_DEV_GRP 0x3B 767#define TWL4030_VDAC_DEV_GRP 0x3B
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index a6deef4f4f67..d23c3c20b201 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -24,6 +24,7 @@
24#define I2O_MAX_DRIVERS 8 24#define I2O_MAX_DRIVERS 8
25 25
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/bug.h>
27#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
28#include <linux/string.h> 29#include <linux/string.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 501370b61ee5..7afe15f916da 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -14,7 +14,6 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/device.h>
18#include <linux/pci.h> 17#include <linux/pci.h>
19#include <linux/completion.h> 18#include <linux/completion.h>
20#include <linux/pm.h> 19#include <linux/pm.h>
@@ -43,6 +42,8 @@
43#define ERROR_RESET 3 /* Reset controller every 4th retry */ 42#define ERROR_RESET 3 /* Reset controller every 4th retry */
44#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 43#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
45 44
45struct device;
46
46/* Error codes returned in rq->errors to the higher part of the driver. */ 47/* Error codes returned in rq->errors to the higher part of the driver. */
47enum { 48enum {
48 IDE_DRV_ERROR_GENERAL = 101, 49 IDE_DRV_ERROR_GENERAL = 101,
diff --git a/include/linux/if.h b/include/linux/if.h
index 06b6ef60c821..f995c663c493 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -80,6 +80,8 @@
80 * skbs on transmit */ 80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */ 82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84
83 85
84#define IF_GET_IFACE 0x0001 /* for querying only */ 86#define IF_GET_IFACE 0x0001 /* for querying only */
85#define IF_GET_PROTO 0x0002 87#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index c9ad38322576..9048fabb7a4e 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -1,173 +1 @@
1/* #include <linux/ppp-ioctl.h>
2 * if_ppp.h - Point-to-Point Protocol definitions.
3 *
4 * Copyright (c) 1989 Carnegie Mellon University.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms are permitted
8 * provided that the above copyright notice and this paragraph are
9 * duplicated in all such forms and that any documentation,
10 * advertising materials, and other materials related to such
11 * distribution and use acknowledge that the software was developed
12 * by Carnegie Mellon University. The name of the
13 * University may not be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 */
20
21/*
22 * ==FILEVERSION 20050812==
23 *
24 * NOTE TO MAINTAINERS:
25 * If you modify this file at all, please set the above date.
26 * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
27 * if everyone increases the FILEVERSION number above, then scripts
28 * can do the right thing when deciding whether to install a new if_ppp.h
29 * file. Don't change the format of that line otherwise, so the
30 * installation script can recognize it.
31 */
32
33#ifndef _IF_PPP_H_
34#define _IF_PPP_H_
35
36#include <linux/types.h>
37#include <linux/compiler.h>
38
39/*
40 * Packet sizes
41 */
42
43#define PPP_MTU 1500 /* Default MTU (size of Info field) */
44#define PPP_MAXMRU 65000 /* Largest MRU we allow */
45#define PROTO_IPX 0x002b /* protocol numbers */
46#define PROTO_DNA_RT 0x0027 /* DNA Routing */
47
48
49/*
50 * Bit definitions for flags.
51 */
52
53#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
54#define SC_COMP_AC 0x00000002 /* header compression (output) */
55#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
56#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
57#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
58#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
59#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
60#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
61#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
62#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
63#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
64#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */
65#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
66#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
67#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */
68#define SC_DEBUG 0x00010000 /* enable debug messages */
69#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
70#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
71#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
72#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
73#define SC_SYNC 0x00200000 /* synchronous serial mode */
74#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */
75#define SC_MASK 0x0f600fff /* bits that user can change */
76
77/* state bits */
78#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
79#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
80#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
81#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
82#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
83#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
84#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
85
86/*
87 * Ioctl definitions.
88 */
89
90struct npioctl {
91 int protocol; /* PPP protocol, e.g. PPP_IP */
92 enum NPmode mode;
93};
94
95/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
96struct ppp_option_data {
97 __u8 __user *ptr;
98 __u32 length;
99 int transmit;
100};
101
102struct ifpppstatsreq {
103 struct ifreq b;
104 struct ppp_stats stats; /* statistic information */
105};
106
107struct ifpppcstatsreq {
108 struct ifreq b;
109 struct ppp_comp_stats stats;
110};
111
112/* For PPPIOCGL2TPSTATS */
113struct pppol2tp_ioc_stats {
114 __u16 tunnel_id; /* redundant */
115 __u16 session_id; /* if zero, get tunnel stats */
116 __u32 using_ipsec:1; /* valid only for session_id == 0 */
117 __aligned_u64 tx_packets;
118 __aligned_u64 tx_bytes;
119 __aligned_u64 tx_errors;
120 __aligned_u64 rx_packets;
121 __aligned_u64 rx_bytes;
122 __aligned_u64 rx_seq_discards;
123 __aligned_u64 rx_oos_packets;
124 __aligned_u64 rx_errors;
125};
126
127#define ifr__name b.ifr_ifrn.ifrn_name
128#define stats_ptr b.ifr_ifru.ifru_data
129
130/*
131 * Ioctl definitions.
132 */
133
134#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
135#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
136#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
137#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
138#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
139#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
140#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
141#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
142#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
143#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
144#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
145#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
146#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
147#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
148#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
149#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
150#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */
151#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */
152#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
153#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
154#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
155#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
156#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
157#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */
158#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
159#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
160#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
161#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */
162#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */
163#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
164
165#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
166#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
167#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
168
169#if !defined(ifr_mtu)
170#define ifr_mtu ifr_ifru.ifru_metric
171#endif
172
173#endif /* _IF_PPP_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 13aff1e2183b..a810987cb80e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -17,11 +17,11 @@
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
20#include <linux/bug.h>
20 21
21#define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) 22#define VLAN_HLEN 4 /* The additional bytes required by VLAN
22 * that VLAN requires. 23 * (in addition to the Ethernet header)
23 */ 24 */
24#define VLAN_ETH_ALEN 6 /* Octets in one ethernet addr */
25#define VLAN_ETH_HLEN 18 /* Total octets in header. */ 25#define VLAN_ETH_HLEN 18 /* Total octets in header. */
26#define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ 26#define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */
27 27
@@ -177,7 +177,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
177 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 177 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
178 178
179 /* Move the mac addresses to the beginning of the new header. */ 179 /* Move the mac addresses to the beginning of the new header. */
180 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); 180 memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
181 skb->mac_header -= VLAN_HLEN; 181 skb->mac_header -= VLAN_HLEN;
182 182
183 /* first, the ethernet type */ 183 /* first, the ethernet type */
diff --git a/include/linux/in.h b/include/linux/in.h
index 01129c0ea87c..e0337f11d92e 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -111,6 +111,7 @@ struct in_addr {
111#define MCAST_LEAVE_SOURCE_GROUP 47 111#define MCAST_LEAVE_SOURCE_GROUP 47
112#define MCAST_MSFILTER 48 112#define MCAST_MSFILTER 48
113#define IP_MULTICAST_ALL 49 113#define IP_MULTICAST_ALL 49
114#define IP_UNICAST_IF 50
114 115
115#define MCAST_EXCLUDE 0 116#define MCAST_EXCLUDE 0
116#define MCAST_INCLUDE 1 117#define MCAST_INCLUDE 1
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 097a34b55560..5c83d9e3eb8f 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -271,6 +271,7 @@ struct in6_flowlabel_req {
271#define IPV6_ORIGDSTADDR 74 271#define IPV6_ORIGDSTADDR 74
272#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR 272#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
273#define IPV6_TRANSPARENT 75 273#define IPV6_TRANSPARENT 75
274#define IPV6_UNICAST_IF 76
274 275
275/* 276/*
276 * Multicast Routing: 277 * Multicast Routing:
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5f8146695b7f..597f4a9f3240 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -139,6 +139,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
139 IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) 139 IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS)))
140 140
141#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) 141#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER)
142#define IN_DEV_ARP_ACCEPT(in_dev) IN_DEV_ORCONF((in_dev), ARP_ACCEPT)
142#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) 143#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
143#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) 144#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 145#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 9c66b1ada9d7..e4baff5f7ff4 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -29,6 +29,13 @@ extern struct fs_struct init_fs;
29#define INIT_GROUP_RWSEM(sig) 29#define INIT_GROUP_RWSEM(sig)
30#endif 30#endif
31 31
32#ifdef CONFIG_CPUSETS
33#define INIT_CPUSET_SEQ \
34 .mems_allowed_seq = SEQCNT_ZERO,
35#else
36#define INIT_CPUSET_SEQ
37#endif
38
32#define INIT_SIGNALS(sig) { \ 39#define INIT_SIGNALS(sig) { \
33 .nr_threads = 1, \ 40 .nr_threads = 1, \
34 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 41 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
@@ -149,7 +156,7 @@ extern struct cred init_cred;
149 }, \ 156 }, \
150 .rt = { \ 157 .rt = { \
151 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ 158 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
152 .time_slice = HZ, \ 159 .time_slice = RR_TIMESLICE, \
153 .nr_cpus_allowed = NR_CPUS, \ 160 .nr_cpus_allowed = NR_CPUS, \
154 }, \ 161 }, \
155 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 162 .tasks = LIST_HEAD_INIT(tsk.tasks), \
@@ -192,6 +199,7 @@ extern struct cred init_cred;
192 INIT_FTRACE_GRAPH \ 199 INIT_FTRACE_GRAPH \
193 INIT_TRACE_RECURSION \ 200 INIT_TRACE_RECURSION \
194 INIT_TASK_RCU_PREEMPT(tsk) \ 201 INIT_TASK_RCU_PREEMPT(tsk) \
202 INIT_CPUSET_SEQ \
195} 203}
196 204
197 205
diff --git a/include/linux/input.h b/include/linux/input.h
index 3862e32c4eeb..a81671453575 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -114,6 +114,31 @@ struct input_keymap_entry {
114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ 115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
116 116
117/**
118 * EVIOCGMTSLOTS(len) - get MT slot values
119 *
120 * The ioctl buffer argument should be binary equivalent to
121 *
122 * struct input_mt_request_layout {
123 * __u32 code;
124 * __s32 values[num_slots];
125 * };
126 *
127 * where num_slots is the (arbitrary) number of MT slots to extract.
128 *
129 * The ioctl size argument (len) is the size of the buffer, which
130 * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is
131 * too small to fit all available slots, the first num_slots are
132 * returned.
133 *
134 * Before the call, code is set to the wanted ABS_MT event type. On
135 * return, values[] is filled with the slot values for the specified
136 * ABS_MT code.
137 *
138 * If the request code is not an ABS_MT value, -EINVAL is returned.
139 */
140#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len)
141
117#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ 142#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
118#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 143#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
119#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 144#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
@@ -129,6 +154,8 @@ struct input_keymap_entry {
129 154
130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 155#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
131 156
157#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
158
132/* 159/*
133 * Device properties and quirks 160 * Device properties and quirks
134 */ 161 */
diff --git a/include/linux/input/cyttsp.h b/include/linux/input/cyttsp.h
new file mode 100644
index 000000000000..5af7c66f1fca
--- /dev/null
+++ b/include/linux/input/cyttsp.h
@@ -0,0 +1,58 @@
1/*
2 * Header file for:
3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
4 * For use with Cypress Txx3xx parts.
5 * Supported parts include:
6 * CY8CTST341
7 * CY8CTMA340
8 *
9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
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 * version 2, and only version 2, as published by the
15 * Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 *
26 * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
27 *
28 */
29#ifndef _CYTTSP_H_
30#define _CYTTSP_H_
31
32#define CY_SPI_NAME "cyttsp-spi"
33#define CY_I2C_NAME "cyttsp-i2c"
34/* Active Power state scanning/processing refresh interval */
35#define CY_ACT_INTRVL_DFLT 0x00 /* ms */
36/* touch timeout for the Active power */
37#define CY_TCH_TMOUT_DFLT 0xFF /* ms */
38/* Low Power state scanning/processing refresh interval */
39#define CY_LP_INTRVL_DFLT 0x0A /* ms */
40/* Active distance in pixels for a gesture to be reported */
41#define CY_ACT_DIST_DFLT 0xF8 /* pixels */
42
43struct cyttsp_platform_data {
44 u32 maxx;
45 u32 maxy;
46 bool use_hndshk;
47 u8 act_dist; /* Active distance */
48 u8 act_intrvl; /* Active refresh interval; ms */
49 u8 tch_tmout; /* Active touch timeout; ms */
50 u8 lp_intrvl; /* Low power refresh interval; ms */
51 int (*init)(void);
52 void (*exit)(void);
53 char *name;
54 s16 irq_gpio;
55 u8 *bl_keys;
56};
57
58#endif /* _CYTTSP_H_ */
diff --git a/include/linux/input/ili210x.h b/include/linux/input/ili210x.h
new file mode 100644
index 000000000000..a5471245a13c
--- /dev/null
+++ b/include/linux/input/ili210x.h
@@ -0,0 +1,10 @@
1#ifndef _ILI210X_H
2#define _ILI210X_H
3
4struct ili210x_platform_data {
5 unsigned long irq_flags;
6 unsigned int poll_period;
7 bool (*get_pendown_state)(void);
8};
9
10#endif
diff --git a/include/linux/input/kxtj9.h b/include/linux/input/kxtj9.h
index f6bac89537b8..d415579b56fe 100644
--- a/include/linux/input/kxtj9.h
+++ b/include/linux/input/kxtj9.h
@@ -24,6 +24,7 @@
24 24
25struct kxtj9_platform_data { 25struct kxtj9_platform_data {
26 unsigned int min_interval; /* minimum poll interval (in milli-seconds) */ 26 unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
27 unsigned int init_interval; /* initial poll interval (in milli-seconds) */
27 28
28 /* 29 /*
29 * By default, x is axis 0, y is axis 1, z is axis 2; these can be 30 * By default, x is axis 0, y is axis 1, z is axis 2; these can be
@@ -52,16 +53,6 @@ struct kxtj9_platform_data {
52 #define KXTJ9_G_8G (1 << 4) 53 #define KXTJ9_G_8G (1 << 4)
53 u8 g_range; 54 u8 g_range;
54 55
55 /* DATA_CTRL_REG: controls the output data rate of the part */
56 #define ODR12_5F 0
57 #define ODR25F 1
58 #define ODR50F 2
59 #define ODR100F 3
60 #define ODR200F 4
61 #define ODR400F 5
62 #define ODR800F 6
63 u8 data_odr_init;
64
65 int (*init)(void); 56 int (*init)(void);
66 void (*exit)(void); 57 void (*exit)(void);
67 int (*power_on)(void); 58 int (*power_on)(void);
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index fe7c4b9ae270..6c07ced0af81 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/input.h> 5#include <linux/input.h>
6#include <linux/of.h>
6 7
7#define MATRIX_MAX_ROWS 32 8#define MATRIX_MAX_ROWS 32
8#define MATRIX_MAX_COLS 32 9#define MATRIX_MAX_COLS 32
@@ -106,4 +107,22 @@ matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
106 __clear_bit(KEY_RESERVED, keybit); 107 __clear_bit(KEY_RESERVED, keybit);
107} 108}
108 109
110#ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP
111struct matrix_keymap_data *
112matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname);
113
114void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd);
115#else
116static inline struct matrix_keymap_data *
117matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname)
118{
119 return NULL;
120}
121
122static inline void
123matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd)
124{
125}
126#endif
127
109#endif /* _MATRIX_KEYPAD_H */ 128#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 318bb82325a6..f86737586e19 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -48,10 +48,14 @@ static inline void input_mt_slot(struct input_dev *dev, int slot)
48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot); 48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
49} 49}
50 50
51static inline bool input_is_mt_value(int axis)
52{
53 return axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST;
54}
55
51static inline bool input_is_mt_axis(int axis) 56static inline bool input_is_mt_axis(int axis)
52{ 57{
53 return axis == ABS_MT_SLOT || 58 return axis == ABS_MT_SLOT || input_is_mt_value(axis);
54 (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
55} 59}
56 60
57void input_mt_report_slot_state(struct input_dev *dev, 61void input_mt_report_slot_state(struct input_dev *dev,
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h
new file mode 100644
index 000000000000..b10a527a92a4
--- /dev/null
+++ b/include/linux/input/ti_tscadc.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_TI_TSCADC_H
2#define __LINUX_TI_TSCADC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 */
11
12struct tsc_data {
13 int wires;
14 int x_plate_resistance;
15};
16
17#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a64b00e286f5..3f830e005118 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -20,7 +20,6 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <trace/events/irq.h>
24 23
25/* 24/*
26 * These correspond to the IORESOURCE_IRQ_* defines in 25 * These correspond to the IORESOURCE_IRQ_* defines in
@@ -456,11 +455,7 @@ asmlinkage void do_softirq(void);
456asmlinkage void __do_softirq(void); 455asmlinkage void __do_softirq(void);
457extern void open_softirq(int nr, void (*action)(struct softirq_action *)); 456extern void open_softirq(int nr, void (*action)(struct softirq_action *));
458extern void softirq_init(void); 457extern void softirq_init(void);
459static inline void __raise_softirq_irqoff(unsigned int nr) 458extern void __raise_softirq_irqoff(unsigned int nr);
460{
461 trace_softirq_raise(nr);
462 or_softirq_pending(1UL << nr);
463}
464 459
465extern void raise_softirq_irqoff(unsigned int nr); 460extern void raise_softirq_irqoff(unsigned int nr);
466extern void raise_softirq(unsigned int nr); 461extern void raise_softirq(unsigned int nr);
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index e44e84f0156c..657fab4efab3 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/bug.h>
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/page.h> 25#include <asm/page.h>
25 26
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 9d57a71775b5..e885ba23de70 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -23,12 +23,6 @@ struct resource {
23 struct resource *parent, *sibling, *child; 23 struct resource *parent, *sibling, *child;
24}; 24};
25 25
26struct resource_list {
27 struct resource_list *next;
28 struct resource *res;
29 struct pci_dev *dev;
30};
31
32/* 26/*
33 * IO resources have these defined flags. 27 * IO resources have these defined flags.
34 */ 28 */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index bbd156bb953b..48dcba9b2065 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -220,10 +220,10 @@ struct kernel_ipmi_msg {
220 * The in-kernel interface. 220 * The in-kernel interface.
221 */ 221 */
222#include <linux/list.h> 222#include <linux/list.h>
223#include <linux/device.h>
224#include <linux/proc_fs.h> 223#include <linux/proc_fs.h>
225 224
226struct module; 225struct module;
226struct device;
227 227
228/* Opaque type for a IPMI message user. One of these is needed to 228/* Opaque type for a IPMI message user. One of these is needed to
229 send and receive messages. */ 229 send and receive messages. */
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 3ef0d8b6aa6f..fcb5d44ea635 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -36,10 +36,11 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/device.h>
40#include <linux/platform_device.h> 39#include <linux/platform_device.h>
41#include <linux/ipmi.h> 40#include <linux/ipmi.h>
42 41
42struct device;
43
43/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
44 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
45 46
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 6318268dcaf5..8260ef779762 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
233 return (struct ipv6hdr *)skb_transport_header(skb); 233 return (struct ipv6hdr *)skb_transport_header(skb);
234} 234}
235 235
236static inline __u8 ipv6_tclass(const struct ipv6hdr *iph)
237{
238 return (ntohl(*(__be32 *)iph) >> 20) & 0xff;
239}
240
236/* 241/*
237 This structure contains results of exthdrs parsing 242 This structure contains results of exthdrs parsing
238 as offsets from skb->nh. 243 as offsets from skb->nh.
@@ -324,6 +329,7 @@ struct ipv6_pinfo {
324 __unused_2:6; 329 __unused_2:6;
325 __s16 mcast_hops:9; 330 __s16 mcast_hops:9;
326#endif 331#endif
332 int ucast_oif;
327 int mcast_oif; 333 int mcast_oif;
328 334
329 /* pktoption flags */ 335 /* pktoption flags */
@@ -360,7 +366,7 @@ struct ipv6_pinfo {
360 dontfrag:1; 366 dontfrag:1;
361 __u8 min_hopcount; 367 __u8 min_hopcount;
362 __u8 tclass; 368 __u8 tclass;
363 __u8 padding; 369 __u8 rcv_tclass;
364 370
365 __u32 dst_cookie; 371 __u32 dst_cookie;
366 372
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index bd4272b61a14..ead4a4215797 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -9,99 +9,182 @@
9 * representation into a hardware irq number that can be mapped back to a 9 * representation into a hardware irq number that can be mapped back to a
10 * Linux irq number without any extra platform support code. 10 * Linux irq number without any extra platform support code.
11 * 11 *
12 * irq_domain is expected to be embedded in an interrupt controller's private 12 * Interrupt controller "domain" data structure. This could be defined as a
13 * data structure. 13 * irq domain controller. That is, it handles the mapping between hardware
14 * and virtual interrupt numbers for a given interrupt domain. The domain
15 * structure is generally created by the PIC code for a given PIC instance
16 * (though a domain can cover more than one PIC if they have a flat number
17 * model). It's the domain callbacks that are responsible for setting the
18 * irq_chip on a given irq_desc after it's been mapped.
19 *
20 * The host code and data structures are agnostic to whether or not
21 * we use an open firmware device-tree. We do have references to struct
22 * device_node in two places: in irq_find_host() to find the host matching
23 * a given interrupt controller node, and of course as an argument to its
24 * counterpart domain->ops->match() callback. However, those are treated as
25 * generic pointers by the core and the fact that it's actually a device-node
26 * pointer is purely a convention between callers and implementation. This
27 * code could thus be used on other architectures by replacing those two
28 * by some sort of arch-specific void * "token" used to identify interrupt
29 * controllers.
14 */ 30 */
31
15#ifndef _LINUX_IRQDOMAIN_H 32#ifndef _LINUX_IRQDOMAIN_H
16#define _LINUX_IRQDOMAIN_H 33#define _LINUX_IRQDOMAIN_H
17 34
18#include <linux/irq.h> 35#include <linux/types.h>
19#include <linux/mod_devicetable.h> 36#include <linux/radix-tree.h>
20 37
21#ifdef CONFIG_IRQ_DOMAIN
22struct device_node; 38struct device_node;
23struct irq_domain; 39struct irq_domain;
40struct of_device_id;
41
42/* Number of irqs reserved for a legacy isa controller */
43#define NUM_ISA_INTERRUPTS 16
44
45/* This type is the placeholder for a hardware interrupt number. It has to
46 * be big enough to enclose whatever representation is used by a given
47 * platform.
48 */
49typedef unsigned long irq_hw_number_t;
24 50
25/** 51/**
26 * struct irq_domain_ops - Methods for irq_domain objects 52 * struct irq_domain_ops - Methods for irq_domain objects
27 * @to_irq: (optional) given a local hardware irq number, return the linux 53 * @match: Match an interrupt controller device node to a host, returns
28 * irq number. If to_irq is not implemented, then the irq_domain 54 * 1 on a match
29 * will use this translation: irq = (domain->irq_base + hwirq) 55 * @map: Create or update a mapping between a virtual irq number and a hw
30 * @dt_translate: Given a device tree node and interrupt specifier, decode 56 * irq number. This is called only once for a given mapping.
31 * the hardware irq number and linux irq type value. 57 * @unmap: Dispose of such a mapping
58 * @xlate: Given a device tree node and interrupt specifier, decode
59 * the hardware irq number and linux irq type value.
60 *
61 * Functions below are provided by the driver and called whenever a new mapping
62 * is created or an old mapping is disposed. The driver can then proceed to
63 * whatever internal data structures management is required. It also needs
64 * to setup the irq_desc when returning from map().
32 */ 65 */
33struct irq_domain_ops { 66struct irq_domain_ops {
34 unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); 67 int (*match)(struct irq_domain *d, struct device_node *node);
35 68 int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
36#ifdef CONFIG_OF 69 void (*unmap)(struct irq_domain *d, unsigned int virq);
37 int (*dt_translate)(struct irq_domain *d, struct device_node *node, 70 int (*xlate)(struct irq_domain *d, struct device_node *node,
38 const u32 *intspec, unsigned int intsize, 71 const u32 *intspec, unsigned int intsize,
39 unsigned long *out_hwirq, unsigned int *out_type); 72 unsigned long *out_hwirq, unsigned int *out_type);
40#endif /* CONFIG_OF */
41}; 73};
42 74
43/** 75/**
44 * struct irq_domain - Hardware interrupt number translation object 76 * struct irq_domain - Hardware interrupt number translation object
45 * @list: Element in global irq_domain list. 77 * @link: Element in global irq_domain list.
78 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This
79 * will be one of the IRQ_DOMAIN_MAP_* values.
80 * @revmap_data: Revmap method specific data.
81 * @ops: pointer to irq_domain methods
82 * @host_data: private data pointer for use by owner. Not touched by irq_domain
83 * core code.
46 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 84 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator
47 * of the irq_domain is responsible for allocating the array of 85 * of the irq_domain is responsible for allocating the array of
48 * irq_desc structures. 86 * irq_desc structures.
49 * @nr_irq: Number of irqs managed by the irq domain 87 * @nr_irq: Number of irqs managed by the irq domain
50 * @hwirq_base: Starting number for hwirqs managed by the irq domain 88 * @hwirq_base: Starting number for hwirqs managed by the irq domain
51 * @ops: pointer to irq_domain methods
52 * @priv: private data pointer for use by owner. Not touched by irq_domain
53 * core code.
54 * @of_node: (optional) Pointer to device tree nodes associated with the 89 * @of_node: (optional) Pointer to device tree nodes associated with the
55 * irq_domain. Used when decoding device tree interrupt specifiers. 90 * irq_domain. Used when decoding device tree interrupt specifiers.
56 */ 91 */
57struct irq_domain { 92struct irq_domain {
58 struct list_head list; 93 struct list_head link;
59 unsigned int irq_base; 94
60 unsigned int nr_irq; 95 /* type of reverse mapping_technique */
61 unsigned int hwirq_base; 96 unsigned int revmap_type;
97 union {
98 struct {
99 unsigned int size;
100 unsigned int first_irq;
101 irq_hw_number_t first_hwirq;
102 } legacy;
103 struct {
104 unsigned int size;
105 unsigned int *revmap;
106 } linear;
107 struct radix_tree_root tree;
108 } revmap_data;
62 const struct irq_domain_ops *ops; 109 const struct irq_domain_ops *ops;
63 void *priv; 110 void *host_data;
111 irq_hw_number_t inval_irq;
112
113 /* Optional device node pointer */
64 struct device_node *of_node; 114 struct device_node *of_node;
65}; 115};
66 116
67/** 117#ifdef CONFIG_IRQ_DOMAIN
68 * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number 118struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
69 * 119 unsigned int size,
70 * Returns the linux irq number associated with a hardware irq. By default, 120 unsigned int first_irq,
71 * the mapping is irq == domain->irq_base + hwirq, but this mapping can 121 irq_hw_number_t first_hwirq,
72 * be overridden if the irq_domain implements a .to_irq() hook. 122 const struct irq_domain_ops *ops,
73 */ 123 void *host_data);
74static inline unsigned int irq_domain_to_irq(struct irq_domain *d, 124struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
75 unsigned long hwirq) 125 unsigned int size,
126 const struct irq_domain_ops *ops,
127 void *host_data);
128struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
129 const struct irq_domain_ops *ops,
130 void *host_data);
131struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
132 const struct irq_domain_ops *ops,
133 void *host_data);
134
135extern struct irq_domain *irq_find_host(struct device_node *node);
136extern void irq_set_default_host(struct irq_domain *host);
137extern void irq_set_virq_count(unsigned int count);
138
139static inline struct irq_domain *irq_domain_add_legacy_isa(
140 struct device_node *of_node,
141 const struct irq_domain_ops *ops,
142 void *host_data)
76{ 143{
77 if (d->ops->to_irq) 144 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
78 return d->ops->to_irq(d, hwirq); 145 host_data);
79 if (WARN_ON(hwirq < d->hwirq_base))
80 return 0;
81 return d->irq_base + hwirq - d->hwirq_base;
82} 146}
147extern struct irq_domain *irq_find_host(struct device_node *node);
148extern void irq_set_default_host(struct irq_domain *host);
149extern void irq_set_virq_count(unsigned int count);
83 150
84#define irq_domain_for_each_hwirq(d, hw) \
85 for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++)
86 151
87#define irq_domain_for_each_irq(d, hw, irq) \ 152extern unsigned int irq_create_mapping(struct irq_domain *host,
88 for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ 153 irq_hw_number_t hwirq);
89 hw < d->hwirq_base + d->nr_irq; \ 154extern void irq_dispose_mapping(unsigned int virq);
90 hw++, irq = irq_domain_to_irq(d, hw)) 155extern unsigned int irq_find_mapping(struct irq_domain *host,
156 irq_hw_number_t hwirq);
157extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
158extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq,
159 irq_hw_number_t hwirq);
160extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
161 irq_hw_number_t hwirq);
162extern unsigned int irq_linear_revmap(struct irq_domain *host,
163 irq_hw_number_t hwirq);
91 164
92extern void irq_domain_add(struct irq_domain *domain); 165extern const struct irq_domain_ops irq_domain_simple_ops;
93extern void irq_domain_del(struct irq_domain *domain);
94 166
95extern struct irq_domain_ops irq_domain_simple_ops; 167/* stock xlate functions */
96#endif /* CONFIG_IRQ_DOMAIN */ 168int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr,
169 const u32 *intspec, unsigned int intsize,
170 irq_hw_number_t *out_hwirq, unsigned int *out_type);
171int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr,
172 const u32 *intspec, unsigned int intsize,
173 irq_hw_number_t *out_hwirq, unsigned int *out_type);
174int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
175 const u32 *intspec, unsigned int intsize,
176 irq_hw_number_t *out_hwirq, unsigned int *out_type);
97 177
98#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) 178#if defined(CONFIG_OF_IRQ)
99extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
100extern void irq_domain_generate_simple(const struct of_device_id *match, 179extern void irq_domain_generate_simple(const struct of_device_id *match,
101 u64 phys_base, unsigned int irq_start); 180 u64 phys_base, unsigned int irq_start);
102#else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 181#else /* CONFIG_OF_IRQ */
103static inline void irq_domain_generate_simple(const struct of_device_id *match, 182static inline void irq_domain_generate_simple(const struct of_device_id *match,
104 u64 phys_base, unsigned int irq_start) { } 183 u64 phys_base, unsigned int irq_start) { }
105#endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ 184#endif /* !CONFIG_OF_IRQ */
185
186#else /* CONFIG_IRQ_DOMAIN */
187static inline void irq_dispose_mapping(unsigned int virq) { }
188#endif /* !CONFIG_IRQ_DOMAIN */
106 189
107#endif /* _LINUX_IRQDOMAIN_H */ 190#endif /* _LINUX_IRQDOMAIN_H */
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 4ccf95d681b4..292f27a793d4 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -187,7 +187,7 @@ typedef struct {
187#endif 187#endif
188 188
189#include <linux/ppp_defs.h> 189#include <linux/ppp_defs.h>
190#include <linux/if_ppp.h> 190#include <linux/ppp-ioctl.h>
191 191
192#include <linux/isdn_ppp.h> 192#include <linux/isdn_ppp.h>
193#endif 193#endif
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 062d20f74322..42bf725751af 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -58,7 +58,11 @@ struct ivtv_dma_frame {
58 __u32 src_height; 58 __u32 src_height;
59}; 59};
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62
63/* Select the passthrough mode (if the argument is non-zero). In the passthrough
64 mode the output of the encoder is passed immediately into the decoder. */
65#define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int)
62 66
63/* Deprecated defines: applications should use the defines from videodev2.h */ 67/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B 68#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 5557baefed60..912c30a8ddb1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -971,6 +971,10 @@ extern void __journal_clean_data_list(transaction_t *transaction);
971/* Log buffer allocation */ 971/* Log buffer allocation */
972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); 972extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
973int jbd2_journal_next_log_block(journal_t *, unsigned long long *); 973int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
974int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
975 unsigned long *block);
976void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
977void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
974 978
975/* Commit management */ 979/* Commit management */
976extern void jbd2_journal_commit_transaction(journal_t *); 980extern void jbd2_journal_commit_transaction(journal_t *);
@@ -1020,6 +1024,11 @@ jbd2_journal_write_metadata_buffer(transaction_t *transaction,
1020/* Transaction locking */ 1024/* Transaction locking */
1021extern void __wait_on_journal (journal_t *); 1025extern void __wait_on_journal (journal_t *);
1022 1026
1027/* Transaction cache support */
1028extern void jbd2_journal_destroy_transaction_cache(void);
1029extern int jbd2_journal_init_transaction_cache(void);
1030extern void jbd2_journal_free_transaction(transaction_t *);
1031
1023/* 1032/*
1024 * Journal locking. 1033 * Journal locking.
1025 * 1034 *
@@ -1082,7 +1091,8 @@ extern int jbd2_journal_destroy (journal_t *);
1082extern int jbd2_journal_recover (journal_t *journal); 1091extern int jbd2_journal_recover (journal_t *journal);
1083extern int jbd2_journal_wipe (journal_t *, int); 1092extern int jbd2_journal_wipe (journal_t *, int);
1084extern int jbd2_journal_skip_recovery (journal_t *); 1093extern int jbd2_journal_skip_recovery (journal_t *);
1085extern void jbd2_journal_update_superblock (journal_t *, int); 1094extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
1095 unsigned long, int);
1086extern void __jbd2_journal_abort_hard (journal_t *); 1096extern void __jbd2_journal_abort_hard (journal_t *);
1087extern void jbd2_journal_abort (journal_t *, int); 1097extern void jbd2_journal_abort (journal_t *, int);
1088extern int jbd2_journal_errno (journal_t *); 1098extern int jbd2_journal_errno (journal_t *);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 423cb6d78ee0..c18b46f8aeeb 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -66,6 +66,8 @@ struct journal_head {
66 * transaction (if there is one). Only applies to buffers on a 66 * transaction (if there is one). Only applies to buffers on a
67 * transaction's data or metadata journaling list. 67 * transaction's data or metadata journaling list.
68 * [j_list_lock] [jbd_lock_bh_state()] 68 * [j_list_lock] [jbd_lock_bh_state()]
69 * Either of these locks is enough for reading, both are needed for
70 * changes.
69 */ 71 */
70 transaction_t *b_transaction; 72 transaction_t *b_transaction;
71 73
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 5ce8b140428f..c513a40510f5 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -1,22 +1,69 @@
1#ifndef _LINUX_JUMP_LABEL_H 1#ifndef _LINUX_JUMP_LABEL_H
2#define _LINUX_JUMP_LABEL_H 2#define _LINUX_JUMP_LABEL_H
3 3
4/*
5 * Jump label support
6 *
7 * Copyright (C) 2009-2012 Jason Baron <jbaron@redhat.com>
8 * Copyright (C) 2011-2012 Peter Zijlstra <pzijlstr@redhat.com>
9 *
10 * Jump labels provide an interface to generate dynamic branches using
11 * self-modifying code. Assuming toolchain and architecture support the result
12 * of a "if (static_key_false(&key))" statement is a unconditional branch (which
13 * defaults to false - and the true block is placed out of line).
14 *
15 * However at runtime we can change the branch target using
16 * static_key_slow_{inc,dec}(). These function as a 'reference' count on the key
17 * object and for as long as there are references all branches referring to
18 * that particular key will point to the (out of line) true block.
19 *
20 * Since this relies on modifying code the static_key_slow_{inc,dec}() functions
21 * must be considered absolute slow paths (machine wide synchronization etc.).
22 * OTOH, since the affected branches are unconditional their runtime overhead
23 * will be absolutely minimal, esp. in the default (off) case where the total
24 * effect is a single NOP of appropriate size. The on case will patch in a jump
25 * to the out-of-line block.
26 *
27 * When the control is directly exposed to userspace it is prudent to delay the
28 * decrement to avoid high frequency code modifications which can (and do)
29 * cause significant performance degradation. Struct static_key_deferred and
30 * static_key_slow_dec_deferred() provide for this.
31 *
32 * Lacking toolchain and or architecture support, it falls back to a simple
33 * conditional branch.
34 *
35 * struct static_key my_key = STATIC_KEY_INIT_TRUE;
36 *
37 * if (static_key_true(&my_key)) {
38 * }
39 *
40 * will result in the true case being in-line and starts the key with a single
41 * reference. Mixing static_key_true() and static_key_false() on the same key is not
42 * allowed.
43 *
44 * Not initializing the key (static data is initialized to 0s anyway) is the
45 * same as using STATIC_KEY_INIT_FALSE and static_key_false() is
46 * equivalent with static_branch().
47 *
48*/
49
4#include <linux/types.h> 50#include <linux/types.h>
5#include <linux/compiler.h> 51#include <linux/compiler.h>
6#include <linux/workqueue.h> 52#include <linux/workqueue.h>
7 53
8#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL) 54#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
9 55
10struct jump_label_key { 56struct static_key {
11 atomic_t enabled; 57 atomic_t enabled;
58/* Set lsb bit to 1 if branch is default true, 0 ot */
12 struct jump_entry *entries; 59 struct jump_entry *entries;
13#ifdef CONFIG_MODULES 60#ifdef CONFIG_MODULES
14 struct jump_label_mod *next; 61 struct static_key_mod *next;
15#endif 62#endif
16}; 63};
17 64
18struct jump_label_key_deferred { 65struct static_key_deferred {
19 struct jump_label_key key; 66 struct static_key key;
20 unsigned long timeout; 67 unsigned long timeout;
21 struct delayed_work work; 68 struct delayed_work work;
22}; 69};
@@ -34,13 +81,34 @@ struct module;
34 81
35#ifdef HAVE_JUMP_LABEL 82#ifdef HAVE_JUMP_LABEL
36 83
37#ifdef CONFIG_MODULES 84#define JUMP_LABEL_TRUE_BRANCH 1UL
38#define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL, NULL} 85
39#else 86static
40#define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL} 87inline struct jump_entry *jump_label_get_entries(struct static_key *key)
41#endif 88{
89 return (struct jump_entry *)((unsigned long)key->entries
90 & ~JUMP_LABEL_TRUE_BRANCH);
91}
42 92
43static __always_inline bool static_branch(struct jump_label_key *key) 93static inline bool jump_label_get_branch_default(struct static_key *key)
94{
95 if ((unsigned long)key->entries & JUMP_LABEL_TRUE_BRANCH)
96 return true;
97 return false;
98}
99
100static __always_inline bool static_key_false(struct static_key *key)
101{
102 return arch_static_branch(key);
103}
104
105static __always_inline bool static_key_true(struct static_key *key)
106{
107 return !static_key_false(key);
108}
109
110/* Deprecated. Please use 'static_key_false() instead. */
111static __always_inline bool static_branch(struct static_key *key)
44{ 112{
45 return arch_static_branch(key); 113 return arch_static_branch(key);
46} 114}
@@ -56,21 +124,23 @@ extern void arch_jump_label_transform(struct jump_entry *entry,
56extern void arch_jump_label_transform_static(struct jump_entry *entry, 124extern void arch_jump_label_transform_static(struct jump_entry *entry,
57 enum jump_label_type type); 125 enum jump_label_type type);
58extern int jump_label_text_reserved(void *start, void *end); 126extern int jump_label_text_reserved(void *start, void *end);
59extern void jump_label_inc(struct jump_label_key *key); 127extern void static_key_slow_inc(struct static_key *key);
60extern void jump_label_dec(struct jump_label_key *key); 128extern void static_key_slow_dec(struct static_key *key);
61extern void jump_label_dec_deferred(struct jump_label_key_deferred *key); 129extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
62extern bool jump_label_enabled(struct jump_label_key *key);
63extern void jump_label_apply_nops(struct module *mod); 130extern void jump_label_apply_nops(struct module *mod);
64extern void jump_label_rate_limit(struct jump_label_key_deferred *key, 131extern void
65 unsigned long rl); 132jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
133
134#define STATIC_KEY_INIT_TRUE ((struct static_key) \
135 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 })
136#define STATIC_KEY_INIT_FALSE ((struct static_key) \
137 { .enabled = ATOMIC_INIT(0), .entries = (void *)0 })
66 138
67#else /* !HAVE_JUMP_LABEL */ 139#else /* !HAVE_JUMP_LABEL */
68 140
69#include <linux/atomic.h> 141#include <linux/atomic.h>
70 142
71#define JUMP_LABEL_INIT {ATOMIC_INIT(0)} 143struct static_key {
72
73struct jump_label_key {
74 atomic_t enabled; 144 atomic_t enabled;
75}; 145};
76 146
@@ -78,30 +148,45 @@ static __always_inline void jump_label_init(void)
78{ 148{
79} 149}
80 150
81struct jump_label_key_deferred { 151struct static_key_deferred {
82 struct jump_label_key key; 152 struct static_key key;
83}; 153};
84 154
85static __always_inline bool static_branch(struct jump_label_key *key) 155static __always_inline bool static_key_false(struct static_key *key)
156{
157 if (unlikely(atomic_read(&key->enabled)) > 0)
158 return true;
159 return false;
160}
161
162static __always_inline bool static_key_true(struct static_key *key)
86{ 163{
87 if (unlikely(atomic_read(&key->enabled))) 164 if (likely(atomic_read(&key->enabled)) > 0)
88 return true; 165 return true;
89 return false; 166 return false;
90} 167}
91 168
92static inline void jump_label_inc(struct jump_label_key *key) 169/* Deprecated. Please use 'static_key_false() instead. */
170static __always_inline bool static_branch(struct static_key *key)
171{
172 if (unlikely(atomic_read(&key->enabled)) > 0)
173 return true;
174 return false;
175}
176
177static inline void static_key_slow_inc(struct static_key *key)
93{ 178{
94 atomic_inc(&key->enabled); 179 atomic_inc(&key->enabled);
95} 180}
96 181
97static inline void jump_label_dec(struct jump_label_key *key) 182static inline void static_key_slow_dec(struct static_key *key)
98{ 183{
99 atomic_dec(&key->enabled); 184 atomic_dec(&key->enabled);
100} 185}
101 186
102static inline void jump_label_dec_deferred(struct jump_label_key_deferred *key) 187static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
103{ 188{
104 jump_label_dec(&key->key); 189 static_key_slow_dec(&key->key);
105} 190}
106 191
107static inline int jump_label_text_reserved(void *start, void *end) 192static inline int jump_label_text_reserved(void *start, void *end)
@@ -112,23 +197,30 @@ static inline int jump_label_text_reserved(void *start, void *end)
112static inline void jump_label_lock(void) {} 197static inline void jump_label_lock(void) {}
113static inline void jump_label_unlock(void) {} 198static inline void jump_label_unlock(void) {}
114 199
115static inline bool jump_label_enabled(struct jump_label_key *key)
116{
117 return !!atomic_read(&key->enabled);
118}
119
120static inline int jump_label_apply_nops(struct module *mod) 200static inline int jump_label_apply_nops(struct module *mod)
121{ 201{
122 return 0; 202 return 0;
123} 203}
124 204
125static inline void jump_label_rate_limit(struct jump_label_key_deferred *key, 205static inline void
206jump_label_rate_limit(struct static_key_deferred *key,
126 unsigned long rl) 207 unsigned long rl)
127{ 208{
128} 209}
210
211#define STATIC_KEY_INIT_TRUE ((struct static_key) \
212 { .enabled = ATOMIC_INIT(1) })
213#define STATIC_KEY_INIT_FALSE ((struct static_key) \
214 { .enabled = ATOMIC_INIT(0) })
215
129#endif /* HAVE_JUMP_LABEL */ 216#endif /* HAVE_JUMP_LABEL */
130 217
131#define jump_label_key_enabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(1), }) 218#define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
132#define jump_label_key_disabled ((struct jump_label_key){ .enabled = ATOMIC_INIT(0), }) 219#define jump_label_enabled static_key_enabled
220
221static inline bool static_key_enabled(struct static_key *key)
222{
223 return (atomic_read(&key->enabled) > 0);
224}
133 225
134#endif /* _LINUX_JUMP_LABEL_H */ 226#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h
index 9053f95e9687..8184578fbfa4 100644
--- a/include/linux/jz4740-adc.h
+++ b/include/linux/jz4740-adc.h
@@ -2,7 +2,7 @@
2#ifndef __LINUX_JZ4740_ADC 2#ifndef __LINUX_JZ4740_ADC
3#define __LINUX_JZ4740_ADC 3#define __LINUX_JZ4740_ADC
4 4
5#include <linux/device.h> 5struct device;
6 6
7/* 7/*
8 * jz4740_adc_set_config - Configure a JZ4740 adc device 8 * jz4740_adc_set_config - Configure a JZ4740 adc device
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index ec2d17bc1f1e..daf4a3a40ee0 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -7,8 +7,6 @@
7 7
8extern struct tasklet_struct keyboard_tasklet; 8extern struct tasklet_struct keyboard_tasklet;
9 9
10extern int shift_state;
11
12extern char *func_table[MAX_NR_FUNC]; 10extern char *func_table[MAX_NR_FUNC];
13extern char func_buf[]; 11extern char func_buf[];
14extern char *funcbufptr; 12extern char *funcbufptr;
@@ -65,8 +63,6 @@ struct kbd_struct {
65#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ 63#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */
66}; 64};
67 65
68extern struct kbd_struct kbd_table[];
69
70extern int kbd_init(void); 66extern int kbd_init(void);
71 67
72extern unsigned char getledstate(void); 68extern unsigned char getledstate(void);
@@ -79,6 +75,7 @@ extern void (*kbd_ledfunc)(unsigned int led);
79extern int set_console(int nr); 75extern int set_console(int nr);
80extern void schedule_console_callback(void); 76extern void schedule_console_callback(void);
81 77
78/* FIXME: review locking for vt.c callers */
82static inline void set_leds(void) 79static inline void set_leds(void)
83{ 80{
84 tasklet_schedule(&keyboard_tasklet); 81 tasklet_schedule(&keyboard_tasklet);
@@ -142,8 +139,6 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
142 139
143struct console; 140struct console;
144 141
145int getkeycode(unsigned int scancode);
146int setkeycode(unsigned int scancode, unsigned int keycode);
147void compute_shiftstate(void); 142void compute_shiftstate(void);
148 143
149/* defkeymap.c */ 144/* defkeymap.c */
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index bd92a89f4b0a..26a65711676f 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -30,6 +30,7 @@
30#define KPF_NOPAGE 20 30#define KPF_NOPAGE 20
31 31
32#define KPF_KSM 21 32#define KPF_KSM 21
33#define KPF_THP 22
33 34
34/* kernel hacking assistances 35/* kernel hacking assistances
35 * WARNING: subject to change, never rely on them! 36 * WARNING: subject to change, never rely on them!
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8343422240a..5db52d0ff1d4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,7 +20,6 @@
20#include <linux/printk.h> 20#include <linux/printk.h>
21#include <linux/dynamic_debug.h> 21#include <linux/dynamic_debug.h>
22#include <asm/byteorder.h> 22#include <asm/byteorder.h>
23#include <asm/bug.h>
24 23
25#define USHRT_MAX ((u16)(~0U)) 24#define USHRT_MAX ((u16)(~0U))
26#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 25#define SHRT_MAX ((s16)(USHRT_MAX>>1))
@@ -85,6 +84,19 @@
85} \ 84} \
86) 85)
87 86
87/*
88 * Multiplies an integer by a fraction, while avoiding unnecessary
89 * overflow or loss of precision.
90 */
91#define mult_frac(x, numer, denom)( \
92{ \
93 typeof(x) quot = (x) / (denom); \
94 typeof(x) rem = (x) % (denom); \
95 (quot * (numer)) + ((rem * (numer)) / (denom)); \
96} \
97)
98
99
88#define _RET_IP_ (unsigned long)__builtin_return_address(0) 100#define _RET_IP_ (unsigned long)__builtin_return_address(0)
89#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 101#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
90 102
@@ -299,6 +311,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int);
299#define strict_strtoull kstrtoull 311#define strict_strtoull kstrtoull
300#define strict_strtoll kstrtoll 312#define strict_strtoll kstrtoll
301 313
314extern int num_to_str(char *buf, int size, unsigned long long num);
315
302/* lib/printf utilities */ 316/* lib/printf utilities */
303 317
304extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); 318extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
@@ -315,10 +329,10 @@ extern __printf(2, 3)
315char *kasprintf(gfp_t gfp, const char *fmt, ...); 329char *kasprintf(gfp_t gfp, const char *fmt, ...);
316extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); 330extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
317 331
318extern int sscanf(const char *, const char *, ...) 332extern __scanf(2, 3)
319 __attribute__ ((format (scanf, 2, 3))); 333int sscanf(const char *, const char *, ...);
320extern int vsscanf(const char *, const char *, va_list) 334extern __scanf(2, 0)
321 __attribute__ ((format (scanf, 2, 0))); 335int vsscanf(const char *, const char *, va_list);
322 336
323extern int get_option(char **str, int *pint); 337extern int get_option(char **str, int *pint);
324extern char *get_options(const char *str, int nints, int *ints); 338extern char *get_options(const char *str, int nints, int *ints);
@@ -662,67 +676,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
662 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 676 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
663 (type *)( (char *)__mptr - offsetof(type,member) );}) 677 (type *)( (char *)__mptr - offsetof(type,member) );})
664 678
665#ifdef __CHECKER__
666#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
667#define BUILD_BUG_ON_ZERO(e) (0)
668#define BUILD_BUG_ON_NULL(e) ((void*)0)
669#define BUILD_BUG_ON(condition)
670#define BUILD_BUG() (0)
671#else /* __CHECKER__ */
672
673/* Force a compilation error if a constant expression is not a power of 2 */
674#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
675 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
676
677/* Force a compilation error if condition is true, but also produce a
678 result (of value 0 and type size_t), so the expression can be used
679 e.g. in a structure initializer (or where-ever else comma expressions
680 aren't permitted). */
681#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
682#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
683
684/**
685 * BUILD_BUG_ON - break compile if a condition is true.
686 * @condition: the condition which the compiler should know is false.
687 *
688 * If you have some code which relies on certain constants being equal, or
689 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
690 * detect if someone changes it.
691 *
692 * The implementation uses gcc's reluctance to create a negative array, but
693 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
694 * to inline functions). So as a fallback we use the optimizer; if it can't
695 * prove the condition is false, it will cause a link error on the undefined
696 * "__build_bug_on_failed". This error message can be harder to track down
697 * though, hence the two different methods.
698 */
699#ifndef __OPTIMIZE__
700#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
701#else
702extern int __build_bug_on_failed;
703#define BUILD_BUG_ON(condition) \
704 do { \
705 ((void)sizeof(char[1 - 2*!!(condition)])); \
706 if (condition) __build_bug_on_failed = 1; \
707 } while(0)
708#endif
709
710/**
711 * BUILD_BUG - break compile if used.
712 *
713 * If you have some code that you expect the compiler to eliminate at
714 * build time, you should use BUILD_BUG to detect if it is
715 * unexpectedly used.
716 */
717#define BUILD_BUG() \
718 do { \
719 extern void __build_bug_failed(void) \
720 __linktime_error("BUILD_BUG failed"); \
721 __build_bug_failed(); \
722 } while (0)
723
724#endif /* __CHECKER__ */
725
726/* Trap pasters of __FUNCTION__ at compile-time */ 679/* Trap pasters of __FUNCTION__ at compile-time */
727#define __FUNCTION__ (__func__) 680#define __FUNCTION__ (__func__)
728 681
diff --git a/include/linux/key.h b/include/linux/key.h
index 5253471cd2ea..96933b1e5d24 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -155,6 +155,7 @@ struct key {
155#define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ 155#define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */
156#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ 156#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */
157#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ 157#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
158#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
158 159
159 /* the description string 160 /* the description string
160 * - this is used to match a key against search criteria 161 * - this is used to match a key against search criteria
@@ -276,6 +277,8 @@ static inline key_serial_t key_serial(const struct key *key)
276 return key ? key->serial : 0; 277 return key ? key->serial : 0;
277} 278}
278 279
280extern void key_set_timeout(struct key *, unsigned);
281
279/** 282/**
280 * key_is_instantiated - Determine if a key has been positively instantiated 283 * key_is_instantiated - Determine if a key has been positively instantiated
281 * @key: The key to check. 284 * @key: The key to check.
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 33a63f62d57f..86e5214ae735 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -24,8 +24,6 @@
24 24
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26struct notifier_block; 26struct notifier_block;
27extern const int NR_TYPES;
28extern const int max_vals[];
29extern unsigned short *key_maps[MAX_NR_KEYMAPS]; 27extern unsigned short *key_maps[MAX_NR_KEYMAPS];
30extern unsigned short plain_map[NR_KEYS]; 28extern unsigned short plain_map[NR_KEYS];
31 29
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 722f477c4ef7..9efeae679106 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
48struct cred; 48struct cred;
49struct file; 49struct file;
50 50
51enum umh_wait { 51#define UMH_NO_WAIT 0 /* don't wait at all */
52 UMH_NO_WAIT = -1, /* don't wait at all */ 52#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */
53 UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ 53#define UMH_WAIT_PROC 2 /* wait for the process to complete */
54 UMH_WAIT_PROC = 1, /* wait for the process to complete */ 54#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
55};
56 55
57struct subprocess_info { 56struct subprocess_info {
58 struct work_struct work; 57 struct work_struct work;
@@ -60,7 +59,7 @@ struct subprocess_info {
60 char *path; 59 char *path;
61 char **argv; 60 char **argv;
62 char **envp; 61 char **envp;
63 enum umh_wait wait; 62 int wait;
64 int retval; 63 int retval;
65 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
66 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
@@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info,
78 void *data); 77 void *data);
79 78
80/* Actually execute the sub-process */ 79/* Actually execute the sub-process */
81int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); 80int call_usermodehelper_exec(struct subprocess_info *info, int wait);
82 81
83/* Free the subprocess_info. This is only needed if you're not going 82/* Free the subprocess_info. This is only needed if you're not going
84 to call call_usermodehelper_exec */ 83 to call call_usermodehelper_exec */
85void call_usermodehelper_freeinfo(struct subprocess_info *info); 84void call_usermodehelper_freeinfo(struct subprocess_info *info);
86 85
87static inline int 86static inline int
88call_usermodehelper_fns(char *path, char **argv, char **envp, 87call_usermodehelper_fns(char *path, char **argv, char **envp, int wait,
89 enum umh_wait wait,
90 int (*init)(struct subprocess_info *info, struct cred *new), 88 int (*init)(struct subprocess_info *info, struct cred *new),
91 void (*cleanup)(struct subprocess_info *), void *data) 89 void (*cleanup)(struct subprocess_info *), void *data)
92{ 90{
@@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp,
104} 102}
105 103
106static inline int 104static inline int
107call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 105call_usermodehelper(char *path, char **argv, char **envp, int wait)
108{ 106{
109 return call_usermodehelper_fns(path, argv, envp, wait, 107 return call_usermodehelper_fns(path, argv, envp, wait,
110 NULL, NULL, NULL); 108 NULL, NULL, NULL);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index dce6e4dbeda7..b6e1f8c00577 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -33,6 +33,7 @@
33#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/notifier.h> 34#include <linux/notifier.h>
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/bug.h>
36#include <linux/percpu.h> 37#include <linux/percpu.h>
37#include <linux/spinlock.h> 38#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 39#include <linux/rcupdate.h>
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 900c76337e8f..ca1b153585d3 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -13,6 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/bug.h>
16#include <linux/mm.h> 17#include <linux/mm.h>
17#include <linux/mmu_notifier.h> 18#include <linux/mmu_notifier.h>
18#include <linux/preempt.h> 19#include <linux/preempt.h>
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
index 8eb12357a110..eeae6e742471 100644
--- a/include/linux/led-lm3530.h
+++ b/include/linux/led-lm3530.h
@@ -72,6 +72,12 @@ enum lm3530_als_mode {
72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ 72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */
73}; 73};
74 74
75/* PWM Platform Specific Data */
76struct lm3530_pwm_data {
77 void (*pwm_set_intensity) (int brightness, int max_brightness);
78 int (*pwm_get_intensity) (int max_brightness);
79};
80
75/** 81/**
76 * struct lm3530_platform_data 82 * struct lm3530_platform_data
77 * @mode: mode of operation i.e. Manual, ALS or PWM 83 * @mode: mode of operation i.e. Manual, ALS or PWM
@@ -87,6 +93,7 @@ enum lm3530_als_mode {
87 * @als_vmin: als input voltage calibrated for max brightness in mV 93 * @als_vmin: als input voltage calibrated for max brightness in mV
88 * @als_vmax: als input voltage calibrated for min brightness in mV 94 * @als_vmax: als input voltage calibrated for min brightness in mV
89 * @brt_val: brightness value (0-255) 95 * @brt_val: brightness value (0-255)
96 * @pwm_data: PWM control functions (only valid when the mode is PWM)
90 */ 97 */
91struct lm3530_platform_data { 98struct lm3530_platform_data {
92 enum lm3530_mode mode; 99 enum lm3530_mode mode;
@@ -107,6 +114,8 @@ struct lm3530_platform_data {
107 u32 als_vmax; 114 u32 als_vmax;
108 115
109 u8 brt_val; 116 u8 brt_val;
117
118 struct lm3530_pwm_data pwm_data;
110}; 119};
111 120
112#endif /* _LINUX_LED_LM3530_H__ */ 121#endif /* _LINUX_LED_LM3530_H__ */
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
index fd548d2a8775..3f071ec019b2 100644
--- a/include/linux/leds-lp5521.h
+++ b/include/linux/leds-lp5521.h
@@ -26,15 +26,37 @@
26/* See Documentation/leds/leds-lp5521.txt */ 26/* See Documentation/leds/leds-lp5521.txt */
27 27
28struct lp5521_led_config { 28struct lp5521_led_config {
29 char *name;
29 u8 chan_nr; 30 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */ 31 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current; 32 u8 max_current;
32}; 33};
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
34#define LP5521_CLOCK_AUTO 0 44#define LP5521_CLOCK_AUTO 0
35#define LP5521_CLOCK_INT 1 45#define LP5521_CLOCK_INT 1
36#define LP5521_CLOCK_EXT 2 46#define LP5521_CLOCK_EXT 2
37 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
38struct lp5521_platform_data { 60struct lp5521_platform_data {
39 struct lp5521_led_config *led_config; 61 struct lp5521_led_config *led_config;
40 u8 num_channels; 62 u8 num_channels;
@@ -43,6 +65,9 @@ struct lp5521_platform_data {
43 void (*release_resources)(void); 65 void (*release_resources)(void);
44 void (*enable)(bool state); 66 void (*enable)(bool state);
45 const char *label; 67 const char *label;
68 u8 update_config;
69 struct lp5521_led_pattern *patterns;
70 int num_patterns;
46}; 71};
47 72
48#endif /* __LINUX_LP5521_H */ 73#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index cafc09a64fe4..42378d637ffb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -996,6 +996,7 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
996extern void ata_sas_port_destroy(struct ata_port *); 996extern void ata_sas_port_destroy(struct ata_port *);
997extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 997extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
998 struct ata_port_info *, struct Scsi_Host *); 998 struct ata_port_info *, struct Scsi_Host *);
999extern int ata_sas_async_port_init(struct ata_port *);
999extern int ata_sas_port_init(struct ata_port *); 1000extern int ata_sas_port_init(struct ata_port *);
1000extern int ata_sas_port_start(struct ata_port *ap); 1001extern int ata_sas_port_start(struct ata_port *ap);
1001extern void ata_sas_port_stop(struct ata_port *ap); 1002extern void ata_sas_port_stop(struct ata_port *ap);
@@ -1147,6 +1148,7 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1147 * EH - drivers/ata/libata-eh.c 1148 * EH - drivers/ata/libata-eh.c
1148 */ 1149 */
1149extern void ata_port_schedule_eh(struct ata_port *ap); 1150extern void ata_port_schedule_eh(struct ata_port *ap);
1151extern void ata_port_wait_eh(struct ata_port *ap);
1150extern int ata_link_abort(struct ata_link *link); 1152extern int ata_link_abort(struct ata_link *link);
1151extern int ata_port_abort(struct ata_port *ap); 1153extern int ata_port_abort(struct ata_port *ap);
1152extern int ata_port_freeze(struct ata_port *ap); 1154extern int ata_port_freeze(struct ata_port *ap);
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index fbc48f898521..11a966e5f829 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -42,6 +42,7 @@ struct nlmclnt_initdata {
42 unsigned short protocol; 42 unsigned short protocol;
43 u32 nfs_version; 43 u32 nfs_version;
44 int noresvport; 44 int noresvport;
45 struct net *net;
45}; 46};
46 47
47/* 48/*
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 88a114fce477..f04ce6ac6d04 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -67,6 +67,7 @@ struct nlm_host {
67 struct list_head h_reclaim; /* Locks in RECLAIM state */ 67 struct list_head h_reclaim; /* Locks in RECLAIM state */
68 struct nsm_handle *h_nsmhandle; /* NSM status handle */ 68 struct nsm_handle *h_nsmhandle; /* NSM status handle */
69 char *h_addrbuf; /* address eyecatcher */ 69 char *h_addrbuf; /* address eyecatcher */
70 struct net *net; /* host net */
70}; 71};
71 72
72/* 73/*
@@ -188,7 +189,7 @@ struct nlm_block {
188/* 189/*
189 * Global variables 190 * Global variables
190 */ 191 */
191extern struct rpc_program nlm_program; 192extern const struct rpc_program nlm_program;
192extern struct svc_procedure nlmsvc_procedures[]; 193extern struct svc_procedure nlmsvc_procedures[];
193#ifdef CONFIG_LOCKD_V4 194#ifdef CONFIG_LOCKD_V4
194extern struct svc_procedure nlmsvc_procedures4[]; 195extern struct svc_procedure nlmsvc_procedures4[];
@@ -222,7 +223,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
222 const unsigned short protocol, 223 const unsigned short protocol,
223 const u32 version, 224 const u32 version,
224 const char *hostname, 225 const char *hostname,
225 int noresvport); 226 int noresvport,
227 struct net *net);
226void nlmclnt_release_host(struct nlm_host *); 228void nlmclnt_release_host(struct nlm_host *);
227struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, 229struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
228 const char *hostname, 230 const char *hostname,
@@ -232,6 +234,7 @@ struct rpc_clnt * nlm_bind_host(struct nlm_host *);
232void nlm_rebind_host(struct nlm_host *); 234void nlm_rebind_host(struct nlm_host *);
233struct nlm_host * nlm_get_host(struct nlm_host *); 235struct nlm_host * nlm_get_host(struct nlm_host *);
234void nlm_shutdown_hosts(void); 236void nlm_shutdown_hosts(void);
237void nlm_shutdown_hosts_net(struct net *net);
235void nlm_host_rebooted(const struct nlm_reboot *); 238void nlm_host_rebooted(const struct nlm_reboot *);
236 239
237/* 240/*
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index 7353821341ed..e58c88b52ce1 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -42,6 +42,6 @@ int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
42int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); 42int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
43int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); 43int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
44 */ 44 */
45extern struct rpc_version nlm_version4; 45extern const struct rpc_version nlm_version4;
46 46
47#endif /* LOCKD_XDR4_H */ 47#endif /* LOCKD_XDR4_H */
diff --git a/include/linux/lp855x.h b/include/linux/lp855x.h
new file mode 100644
index 000000000000..781a490a451b
--- /dev/null
+++ b/include/linux/lp855x.h
@@ -0,0 +1,131 @@
1/*
2 * LP855x Backlight Driver
3 *
4 * Copyright (C) 2011 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef _LP855X_H
13#define _LP855X_H
14
15#define BL_CTL_SHFT (0)
16#define BRT_MODE_SHFT (1)
17#define BRT_MODE_MASK (0x06)
18
19/* Enable backlight. Only valid when BRT_MODE=10(I2C only) */
20#define ENABLE_BL (1)
21#define DISABLE_BL (0)
22
23#define I2C_CONFIG(id) id ## _I2C_CONFIG
24#define PWM_CONFIG(id) id ## _PWM_CONFIG
25
26/* DEVICE CONTROL register - LP8550 */
27#define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT)
28#define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
29 (LP8550_I2C_ONLY << BRT_MODE_SHFT))
30
31/* DEVICE CONTROL register - LP8551 */
32#define LP8551_PWM_CONFIG LP8550_PWM_CONFIG
33#define LP8551_I2C_CONFIG LP8550_I2C_CONFIG
34
35/* DEVICE CONTROL register - LP8552 */
36#define LP8552_PWM_CONFIG LP8550_PWM_CONFIG
37#define LP8552_I2C_CONFIG LP8550_I2C_CONFIG
38
39/* DEVICE CONTROL register - LP8553 */
40#define LP8553_PWM_CONFIG LP8550_PWM_CONFIG
41#define LP8553_I2C_CONFIG LP8550_I2C_CONFIG
42
43/* DEVICE CONTROL register - LP8556 */
44#define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT)
45#define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT)
46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
47 (LP8556_I2C_ONLY << BRT_MODE_SHFT))
48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT)
49
50/* ROM area boundary */
51#define EEPROM_START (0xA0)
52#define EEPROM_END (0xA7)
53#define EPROM_START (0xA0)
54#define EPROM_END (0xAF)
55
56enum lp855x_chip_id {
57 LP8550,
58 LP8551,
59 LP8552,
60 LP8553,
61 LP8556,
62};
63
64enum lp855x_brightness_ctrl_mode {
65 PWM_BASED = 1,
66 REGISTER_BASED,
67};
68
69enum lp8550_brighntess_source {
70 LP8550_PWM_ONLY,
71 LP8550_I2C_ONLY = 2,
72};
73
74enum lp8551_brighntess_source {
75 LP8551_PWM_ONLY = LP8550_PWM_ONLY,
76 LP8551_I2C_ONLY = LP8550_I2C_ONLY,
77};
78
79enum lp8552_brighntess_source {
80 LP8552_PWM_ONLY = LP8550_PWM_ONLY,
81 LP8552_I2C_ONLY = LP8550_I2C_ONLY,
82};
83
84enum lp8553_brighntess_source {
85 LP8553_PWM_ONLY = LP8550_PWM_ONLY,
86 LP8553_I2C_ONLY = LP8550_I2C_ONLY,
87};
88
89enum lp8556_brightness_source {
90 LP8556_PWM_ONLY,
91 LP8556_COMBINED1, /* pwm + i2c before the shaper block */
92 LP8556_I2C_ONLY,
93 LP8556_COMBINED2, /* pwm + i2c after the shaper block */
94};
95
96struct lp855x_pwm_data {
97 void (*pwm_set_intensity) (int brightness, int max_brightness);
98 int (*pwm_get_intensity) (int max_brightness);
99};
100
101struct lp855x_rom_data {
102 u8 addr;
103 u8 val;
104};
105
106/**
107 * struct lp855x_platform_data
108 * @name : Backlight driver name. If it is not defined, default name is set.
109 * @mode : brightness control by pwm or lp855x register
110 * @device_control : value of DEVICE CONTROL register
111 * @initial_brightness : initial value of backlight brightness
112 * @pwm_data : platform specific pwm generation functions.
113 Only valid when mode is PWM_BASED.
114 * @load_new_rom_data :
115 0 : use default configuration data
116 1 : update values of eeprom or eprom registers on loading driver
117 * @size_program : total size of lp855x_rom_data
118 * @rom_data : list of new eeprom/eprom registers
119 */
120struct lp855x_platform_data {
121 char *name;
122 enum lp855x_brightness_ctrl_mode mode;
123 u8 device_control;
124 int initial_brightness;
125 struct lp855x_pwm_data pwm_data;
126 u8 load_new_rom_data;
127 int size_program;
128 struct lp855x_rom_data *rom_data;
129};
130
131#endif
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 2d4beab0d5b7..e15192cb9cf4 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -9,7 +9,6 @@
9#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ 9#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ 10#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */
11#define DEBUGFS_MAGIC 0x64626720 11#define DEBUGFS_MAGIC 0x64626720
12#define SYSFS_MAGIC 0x62656572
13#define SECURITYFS_MAGIC 0x73636673 12#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c 13#define SELINUX_MAGIC 0xf97cff8c
15#define RAMFS_MAGIC 0x858458f6 /* some random number */ 14#define RAMFS_MAGIC 0x858458f6 /* some random number */
@@ -27,7 +26,6 @@
27#define HPFS_SUPER_MAGIC 0xf995e849 26#define HPFS_SUPER_MAGIC 0xf995e849
28#define ISOFS_SUPER_MAGIC 0x9660 27#define ISOFS_SUPER_MAGIC 0x9660
29#define JFFS2_SUPER_MAGIC 0x72b6 28#define JFFS2_SUPER_MAGIC 0x72b6
30#define ANON_INODE_FS_MAGIC 0x09041934
31#define PSTOREFS_MAGIC 0x6165676C 29#define PSTOREFS_MAGIC 0x6165676C
32 30
33#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ 31#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */
@@ -40,8 +38,8 @@
40#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ 38#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */
41#define NFS_SUPER_MAGIC 0x6969 39#define NFS_SUPER_MAGIC 0x6969
42#define OPENPROM_SUPER_MAGIC 0x9fa1 40#define OPENPROM_SUPER_MAGIC 0x9fa1
43#define PROC_SUPER_MAGIC 0x9fa0
44#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ 41#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
42#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */
45 43
46#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ 44#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
47 /* used by file system utilities that 45 /* used by file system utilities that
@@ -51,15 +49,24 @@
51#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" 49#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
52 50
53#define SMB_SUPER_MAGIC 0x517B 51#define SMB_SUPER_MAGIC 0x517B
54#define USBDEVICE_SUPER_MAGIC 0x9fa2
55#define CGROUP_SUPER_MAGIC 0x27e0eb 52#define CGROUP_SUPER_MAGIC 0x27e0eb
56 53
57#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
58 54
59#define STACK_END_MAGIC 0x57AC6E9D 55#define STACK_END_MAGIC 0x57AC6E9D
60 56
57#define V9FS_MAGIC 0x01021997
58
59#define BDEVFS_MAGIC 0x62646576
60#define BINFMTFS_MAGIC 0x42494e4d
61#define DEVPTS_SUPER_MAGIC 0x1cd1 61#define DEVPTS_SUPER_MAGIC 0x1cd1
62#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
63#define PIPEFS_MAGIC 0x50495045
64#define PROC_SUPER_MAGIC 0x9fa0
62#define SOCKFS_MAGIC 0x534F434B 65#define SOCKFS_MAGIC 0x534F434B
63#define V9FS_MAGIC 0x01021997 66#define SYSFS_MAGIC 0x62656572
67#define USBDEVICE_SUPER_MAGIC 0x9fa2
68#define MTD_INODE_FS_MAGIC 0x11307854
69#define ANON_INODE_FS_MAGIC 0x09041934
70
64 71
65#endif /* __LINUX_MAGIC_H__ */ 72#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/maple.h b/include/linux/maple.h
index d9a51b9b3300..c37288b23e0c 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -1,9 +1,9 @@
1#ifndef __LINUX_MAPLE_H 1#ifndef __LINUX_MAPLE_H
2#define __LINUX_MAPLE_H 2#define __LINUX_MAPLE_H
3 3
4#include <linux/device.h>
5#include <mach/maple.h> 4#include <mach/maple.h>
6 5
6struct device;
7extern struct bus_type maple_bus_type; 7extern struct bus_type maple_bus_type;
8 8
9/* Maple Bus command and response codes */ 9/* Maple Bus command and response codes */
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 23fcdfcba81b..b8ba85544721 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -6,6 +6,8 @@
6 6
7#if BITS_PER_LONG == 64 7#if BITS_PER_LONG == 64
8 8
9#define div64_long(x,y) div64_s64((x),(y))
10
9/** 11/**
10 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder 12 * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
11 * 13 *
@@ -45,6 +47,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor)
45 47
46#elif BITS_PER_LONG == 32 48#elif BITS_PER_LONG == 32
47 49
50#define div64_long(x,y) div_s64((x),(y))
51
48#ifndef div_u64_rem 52#ifndef div_u64_rem
49static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) 53static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
50{ 54{
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index b1494aced217..dfb947959ec9 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -10,6 +10,7 @@
10#ifndef __LINUX_MDIO_H__ 10#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__ 11#define __LINUX_MDIO_H__
12 12
13#include <linux/types.h>
13#include <linux/mii.h> 14#include <linux/mii.h>
14 15
15/* MDIO Manageable Devices (MMDs). */ 16/* MDIO Manageable Devices (MMDs). */
@@ -273,6 +274,8 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad)
273 return MDIO_PHY_ID_C45 | (prtad << 5) | devad; 274 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
274} 275}
275 276
277#ifdef __KERNEL__
278
276static inline bool mdio_phy_id_is_c45(int phy_id) 279static inline bool mdio_phy_id_is_c45(int phy_id)
277{ 280{
278 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); 281 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
@@ -288,11 +291,6 @@ static inline __u16 mdio_phy_id_devad(int phy_id)
288 return phy_id & MDIO_PHY_ID_DEVAD; 291 return phy_id & MDIO_PHY_ID_DEVAD;
289} 292}
290 293
291#define MDIO_SUPPORTS_C22 1
292#define MDIO_SUPPORTS_C45 2
293
294#ifdef __KERNEL__
295
296/** 294/**
297 * struct mdio_if_info - Ethernet controller MDIO interface 295 * struct mdio_if_info - Ethernet controller MDIO interface
298 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) 296 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
@@ -321,6 +319,8 @@ struct mdio_if_info {
321 319
322#define MDIO_PRTAD_NONE (-1) 320#define MDIO_PRTAD_NONE (-1)
323#define MDIO_DEVAD_NONE (-1) 321#define MDIO_DEVAD_NONE (-1)
322#define MDIO_SUPPORTS_C22 1
323#define MDIO_SUPPORTS_C45 2
324#define MDIO_EMULATE_C22 4 324#define MDIO_EMULATE_C22 4
325 325
326struct ethtool_cmd; 326struct ethtool_cmd;
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b80de520670b..f94efd2f6c27 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_end(void);
77extern void mem_cgroup_uncharge_page(struct page *page); 77extern void mem_cgroup_uncharge_page(struct page *page);
78extern void mem_cgroup_uncharge_cache_page(struct page *page); 78extern void mem_cgroup_uncharge_cache_page(struct page *page);
79 79
80extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask); 80extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
81 int order);
81int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); 82int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg);
82 83
83extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 84extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
@@ -140,6 +141,34 @@ static inline bool mem_cgroup_disabled(void)
140 return false; 141 return false;
141} 142}
142 143
144void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked,
145 unsigned long *flags);
146
147extern atomic_t memcg_moving;
148
149static inline void mem_cgroup_begin_update_page_stat(struct page *page,
150 bool *locked, unsigned long *flags)
151{
152 if (mem_cgroup_disabled())
153 return;
154 rcu_read_lock();
155 *locked = false;
156 if (atomic_read(&memcg_moving))
157 __mem_cgroup_begin_update_page_stat(page, locked, flags);
158}
159
160void __mem_cgroup_end_update_page_stat(struct page *page,
161 unsigned long *flags);
162static inline void mem_cgroup_end_update_page_stat(struct page *page,
163 bool *locked, unsigned long *flags)
164{
165 if (mem_cgroup_disabled())
166 return;
167 if (*locked)
168 __mem_cgroup_end_update_page_stat(page, flags);
169 rcu_read_unlock();
170}
171
143void mem_cgroup_update_page_stat(struct page *page, 172void mem_cgroup_update_page_stat(struct page *page,
144 enum mem_cgroup_page_stat_item idx, 173 enum mem_cgroup_page_stat_item idx,
145 int val); 174 int val);
@@ -298,21 +327,6 @@ static inline void mem_cgroup_iter_break(struct mem_cgroup *root,
298{ 327{
299} 328}
300 329
301static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg)
302{
303 return 0;
304}
305
306static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *memcg,
307 int priority)
308{
309}
310
311static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *memcg,
312 int priority)
313{
314}
315
316static inline bool mem_cgroup_disabled(void) 330static inline bool mem_cgroup_disabled(void)
317{ 331{
318 return true; 332 return true;
@@ -355,6 +369,16 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
355{ 369{
356} 370}
357 371
372static inline void mem_cgroup_begin_update_page_stat(struct page *page,
373 bool *locked, unsigned long *flags)
374{
375}
376
377static inline void mem_cgroup_end_update_page_stat(struct page *page,
378 bool *locked, unsigned long *flags)
379{
380}
381
358static inline void mem_cgroup_inc_page_stat(struct page *page, 382static inline void mem_cgroup_inc_page_stat(struct page *page,
359 enum mem_cgroup_page_stat_item idx) 383 enum mem_cgroup_page_stat_item idx)
360{ 384{
@@ -391,7 +415,7 @@ static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
391 struct page *newpage) 415 struct page *newpage)
392{ 416{
393} 417}
394#endif /* CONFIG_CGROUP_MEM_CONT */ 418#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
395 419
396#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 420#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
397static inline bool 421static inline bool
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 0b8e2a742600..910550f3b70e 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -4,6 +4,7 @@
4#include <linux/mmzone.h> 4#include <linux/mmzone.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/notifier.h> 6#include <linux/notifier.h>
7#include <linux/bug.h>
7 8
8struct page; 9struct page;
9struct zone; 10struct zone;
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 92be3476c9f5..84d071ade1d8 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -263,6 +263,22 @@ enum {
263#define PM8607_PD_PREBIAS_MASK (0x1F << 0) 263#define PM8607_PD_PREBIAS_MASK (0x1F << 0)
264#define PM8607_PD_PRECHG_MASK (7 << 5) 264#define PM8607_PD_PRECHG_MASK (7 << 5)
265 265
266#define PM8606_REF_GP_OSC_OFF 0
267#define PM8606_REF_GP_OSC_ON 1
268#define PM8606_REF_GP_OSC_UNKNOWN 2
269
270/* Clients of reference group and 8MHz oscillator in 88PM8606 */
271enum pm8606_ref_gp_and_osc_clients {
272 REF_GP_NO_CLIENTS = 0,
273 WLED1_DUTY = (1<<0), /*PF 0x02.7:0*/
274 WLED2_DUTY = (1<<1), /*PF 0x04.7:0*/
275 WLED3_DUTY = (1<<2), /*PF 0x06.7:0*/
276 RGB1_ENABLE = (1<<3), /*PF 0x07.1*/
277 RGB2_ENABLE = (1<<4), /*PF 0x07.2*/
278 LDO_VBR_EN = (1<<5), /*PF 0x12.0*/
279 REF_GP_MAX_CLIENT = 0xFFFF
280};
281
266/* Interrupt Number in 88PM8607 */ 282/* Interrupt Number in 88PM8607 */
267enum { 283enum {
268 PM8607_IRQ_ONKEY, 284 PM8607_IRQ_ONKEY,
@@ -298,6 +314,7 @@ enum {
298struct pm860x_chip { 314struct pm860x_chip {
299 struct device *dev; 315 struct device *dev;
300 struct mutex irq_lock; 316 struct mutex irq_lock;
317 struct mutex osc_lock;
301 struct i2c_client *client; 318 struct i2c_client *client;
302 struct i2c_client *companion; /* companion chip client */ 319 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap; 320 struct regmap *regmap;
@@ -305,12 +322,15 @@ struct pm860x_chip {
305 322
306 int buck3_double; /* DVC ramp slope double */ 323 int buck3_double; /* DVC ramp slope double */
307 unsigned short companion_addr; 324 unsigned short companion_addr;
325 unsigned short osc_vote;
308 int id; 326 int id;
309 int irq_mode; 327 int irq_mode;
310 int irq_base; 328 int irq_base;
311 int core_irq; 329 int core_irq;
312 unsigned char chip_version; 330 unsigned char chip_version;
331 unsigned char osc_status;
313 332
333 unsigned int wakeup_flag;
314}; 334};
315 335
316enum { 336enum {
@@ -369,6 +389,9 @@ struct pm860x_platform_data {
369 int num_regulators; 389 int num_regulators;
370}; 390};
371 391
392extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short);
393extern int pm8606_osc_disable(struct pm860x_chip *, unsigned short);
394
372extern int pm860x_reg_read(struct i2c_client *, int); 395extern int pm860x_reg_read(struct i2c_client *, int);
373extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 396extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
374extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 397extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 9970337ff041..5fa697477b71 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -14,9 +14,10 @@
14 * Author: Rickard Andersson <rickard.andersson@stericsson.com> 14 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
15 */ 15 */
16 16
17#include <linux/device.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19 18
19struct device;
20
20#ifndef MFD_ABX500_H 21#ifndef MFD_ABX500_H
21#define MFD_ABX500_H 22#define MFD_ABX500_H
22 23
@@ -33,13 +34,6 @@
33#define AB5500_1_1 0x21 34#define AB5500_1_1 0x21
34#define AB5500_2_0 0x24 35#define AB5500_2_0 0x24
35 36
36/* AB8500 CIDs*/
37#define AB8500_CUT1P0 0x10
38#define AB8500_CUT1P1 0x11
39#define AB8500_CUT2P0 0x20
40#define AB8500_CUT3P0 0x30
41#define AB8500_CUT3P3 0x33
42
43/* 37/*
44 * AB3100, EVENTA1, A2 and A3 event register flags 38 * AB3100, EVENTA1, A2 and A3 event register flags
45 * these are catenated into a single 32-bit flag in the code 39 * these are catenated into a single 32-bit flag in the code
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae933..54f820ed73bb 100644
--- a/include/linux/mfd/abx500/ab5500.h
+++ b/include/linux/mfd/abx500/ab5500.h
@@ -6,7 +6,7 @@
6#ifndef MFD_AB5500_H 6#ifndef MFD_AB5500_H
7#define MFD_AB5500_H 7#define MFD_AB5500_H
8 8
9#include <linux/device.h> 9struct device;
10 10
11enum ab5500_devid { 11enum ab5500_devid {
12 AB5500_DEVID_ADC, 12 AB5500_DEVID_ADC,
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..2387c207ea86 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -10,12 +10,14 @@
10 10
11/* 11/*
12 * Platform data to register a block: only the initial gpio/irq number. 12 * Platform data to register a block: only the initial gpio/irq number.
13 * Array sizes are large enough to contain all AB8500 and AB9540 GPIO
14 * registers.
13 */ 15 */
14 16
15struct ab8500_gpio_platform_data { 17struct ab8500_gpio_platform_data {
16 int gpio_base; 18 int gpio_base;
17 u32 irq_base; 19 u32 irq_base;
18 u8 config_reg[7]; 20 u8 config_reg[8];
19}; 21};
20 22
21#endif /* _AB8500_GPIO_H */ 23#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10eb50973c39 100644
--- a/include/linux/mfd/abx500/ab8500-sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
@@ -71,6 +71,13 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
71#define AB8500_SWATCTRL 0x230 71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232 72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233 73#define AB8500_VSIMSYSCLKCTRL 0x233
74#define AB9540_SYSCLK12BUFCTRL 0x234
75#define AB9540_SYSCLK12CONFCTRL 0x235
76#define AB9540_SYSCLK12BUFCTRL2 0x236
77#define AB9540_SYSCLK12BUF1VALID 0x237
78#define AB9540_SYSCLK12BUF2VALID 0x238
79#define AB9540_SYSCLK12BUF3VALID 0x239
80#define AB9540_SYSCLK12BUF4VALID 0x23A
74 81
75/* Bits */ 82/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0) 83#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
@@ -251,4 +258,40 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6) 258#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7) 259#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253 260
261#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA BIT(0)
262#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA BIT(1)
263#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA BIT(2)
264#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA BIT(3)
265#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK 0x0F
266#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE BIT(4)
267#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE BIT(5)
268#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE BIT(6)
269#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE BIT(7)
270#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK 0xF0
271
272#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA BIT(0)
273#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL BIT(1)
274#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_MASK 0x0C
275#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL_SHIFT 2
276#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX BIT(4)
277#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX BIT(5)
278#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID BIT(6)
279
280#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA BIT(0)
281#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA BIT(1)
282#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA BIT(2)
283#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA BIT(3)
284
285#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK 0xFF
286#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT 0
287
288#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK 0xFF
289#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT 0
290
291#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK 0xFF
292#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT 0
293
294#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF
295#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0
296
254#endif /* __AB8500_SYSCTRL_H */ 297#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..fccc3002f271 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -7,7 +7,32 @@
7#ifndef MFD_AB8500_H 7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H 8#define MFD_AB8500_H
9 9
10#include <linux/device.h> 10#include <linux/mutex.h>
11
12struct device;
13
14/*
15 * AB IC versions
16 *
17 * AB8500_VERSION_AB8500 should be 0xFF but will never be read as need a
18 * non-supported multi-byte I2C access via PRCMU. Set to 0x00 to ease the
19 * print of version string.
20 */
21enum ab8500_version {
22 AB8500_VERSION_AB8500 = 0x0,
23 AB8500_VERSION_AB8505 = 0x1,
24 AB8500_VERSION_AB9540 = 0x2,
25 AB8500_VERSION_AB8540 = 0x3,
26 AB8500_VERSION_UNDEFINED,
27};
28
29/* AB8500 CIDs*/
30#define AB8500_CUTEARLY 0x00
31#define AB8500_CUT1P0 0x10
32#define AB8500_CUT1P1 0x11
33#define AB8500_CUT2P0 0x20
34#define AB8500_CUT3P0 0x30
35#define AB8500_CUT3P3 0x33
11 36
12/* 37/*
13 * AB8500 bank addresses 38 * AB8500 bank addresses
@@ -35,30 +60,34 @@
35 60
36/* 61/*
37 * Interrupts 62 * Interrupts
63 * Values used to index into array ab8500_irq_regoffset[] defined in
64 * drivers/mdf/ab8500-core.c
38 */ 65 */
39 66/* Definitions for AB8500 and AB9540 */
40#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 67/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
41#define AB8500_INT_UN_PLUG_TV_DET 1 68#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
42#define AB8500_INT_PLUG_TV_DET 2 69#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */
70#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */
43#define AB8500_INT_TEMP_WARM 3 71#define AB8500_INT_TEMP_WARM 3
44#define AB8500_INT_PON_KEY2DB_F 4 72#define AB8500_INT_PON_KEY2DB_F 4
45#define AB8500_INT_PON_KEY2DB_R 5 73#define AB8500_INT_PON_KEY2DB_R 5
46#define AB8500_INT_PON_KEY1DB_F 6 74#define AB8500_INT_PON_KEY1DB_F 6
47#define AB8500_INT_PON_KEY1DB_R 7 75#define AB8500_INT_PON_KEY1DB_R 7
76/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
48#define AB8500_INT_BATT_OVV 8 77#define AB8500_INT_BATT_OVV 8
49#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 78#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */
50#define AB8500_INT_MAIN_CH_PLUG_DET 11 79#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */
51#define AB8500_INT_USB_ID_DET_F 12
52#define AB8500_INT_USB_ID_DET_R 13
53#define AB8500_INT_VBUS_DET_F 14 80#define AB8500_INT_VBUS_DET_F 14
54#define AB8500_INT_VBUS_DET_R 15 81#define AB8500_INT_VBUS_DET_R 15
82/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
55#define AB8500_INT_VBUS_CH_DROP_END 16 83#define AB8500_INT_VBUS_CH_DROP_END 16
56#define AB8500_INT_RTC_60S 17 84#define AB8500_INT_RTC_60S 17
57#define AB8500_INT_RTC_ALARM 18 85#define AB8500_INT_RTC_ALARM 18
58#define AB8500_INT_BAT_CTRL_INDB 20 86#define AB8500_INT_BAT_CTRL_INDB 20
59#define AB8500_INT_CH_WD_EXP 21 87#define AB8500_INT_CH_WD_EXP 21
60#define AB8500_INT_VBUS_OVV 22 88#define AB8500_INT_VBUS_OVV 22
61#define AB8500_INT_MAIN_CH_DROP_END 23 89#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */
90/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
62#define AB8500_INT_CCN_CONV_ACC 24 91#define AB8500_INT_CCN_CONV_ACC 24
63#define AB8500_INT_INT_AUD 25 92#define AB8500_INT_INT_AUD 25
64#define AB8500_INT_CCEOC 26 93#define AB8500_INT_CCEOC 26
@@ -67,7 +96,8 @@
67#define AB8500_INT_LOW_BAT_R 29 96#define AB8500_INT_LOW_BAT_R 29
68#define AB8500_INT_BUP_CHG_NOT_OK 30 97#define AB8500_INT_BUP_CHG_NOT_OK 30
69#define AB8500_INT_BUP_CHG_OK 31 98#define AB8500_INT_BUP_CHG_OK 31
70#define AB8500_INT_GP_HW_ADC_CONV_END 32 99/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
100#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */
71#define AB8500_INT_ACC_DETECT_1DB_F 33 101#define AB8500_INT_ACC_DETECT_1DB_F 33
72#define AB8500_INT_ACC_DETECT_1DB_R 34 102#define AB8500_INT_ACC_DETECT_1DB_R 34
73#define AB8500_INT_ACC_DETECT_22DB_F 35 103#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -75,38 +105,43 @@
75#define AB8500_INT_ACC_DETECT_21DB_F 37 105#define AB8500_INT_ACC_DETECT_21DB_F 37
76#define AB8500_INT_ACC_DETECT_21DB_R 38 106#define AB8500_INT_ACC_DETECT_21DB_R 38
77#define AB8500_INT_GP_SW_ADC_CONV_END 39 107#define AB8500_INT_GP_SW_ADC_CONV_END 39
78#define AB8500_INT_GPIO6R 40 108/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
79#define AB8500_INT_GPIO7R 41 109#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */
80#define AB8500_INT_GPIO8R 42 110#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */
81#define AB8500_INT_GPIO9R 43 111#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */
112#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */
82#define AB8500_INT_GPIO10R 44 113#define AB8500_INT_GPIO10R 44
83#define AB8500_INT_GPIO11R 45 114#define AB8500_INT_GPIO11R 45
84#define AB8500_INT_GPIO12R 46 115#define AB8500_INT_GPIO12R 46 /* not 8505 */
85#define AB8500_INT_GPIO13R 47 116#define AB8500_INT_GPIO13R 47
86#define AB8500_INT_GPIO24R 48 117/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
87#define AB8500_INT_GPIO25R 49 118#define AB8500_INT_GPIO24R 48 /* not 8505 */
88#define AB8500_INT_GPIO36R 50 119#define AB8500_INT_GPIO25R 49 /* not 8505 */
89#define AB8500_INT_GPIO37R 51 120#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */
90#define AB8500_INT_GPIO38R 52 121#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */
91#define AB8500_INT_GPIO39R 53 122#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */
123#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */
92#define AB8500_INT_GPIO40R 54 124#define AB8500_INT_GPIO40R 54
93#define AB8500_INT_GPIO41R 55 125#define AB8500_INT_GPIO41R 55
94#define AB8500_INT_GPIO6F 56 126/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
95#define AB8500_INT_GPIO7F 57 127#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
96#define AB8500_INT_GPIO8F 58 128#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
97#define AB8500_INT_GPIO9F 59 129#define AB8500_INT_GPIO8F 58 /* not 8505/9540 */
130#define AB8500_INT_GPIO9F 59 /* not 8505/9540 */
98#define AB8500_INT_GPIO10F 60 131#define AB8500_INT_GPIO10F 60
99#define AB8500_INT_GPIO11F 61 132#define AB8500_INT_GPIO11F 61
100#define AB8500_INT_GPIO12F 62 133#define AB8500_INT_GPIO12F 62 /* not 8505 */
101#define AB8500_INT_GPIO13F 63 134#define AB8500_INT_GPIO13F 63
102#define AB8500_INT_GPIO24F 64 135/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
103#define AB8500_INT_GPIO25F 65 136#define AB8500_INT_GPIO24F 64 /* not 8505 */
104#define AB8500_INT_GPIO36F 66 137#define AB8500_INT_GPIO25F 65 /* not 8505 */
105#define AB8500_INT_GPIO37F 67 138#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */
106#define AB8500_INT_GPIO38F 68 139#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */
107#define AB8500_INT_GPIO39F 69 140#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */
141#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */
108#define AB8500_INT_GPIO40F 70 142#define AB8500_INT_GPIO40F 70
109#define AB8500_INT_GPIO41F 71 143#define AB8500_INT_GPIO41F 71
144/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
110#define AB8500_INT_ADP_SOURCE_ERROR 72 145#define AB8500_INT_ADP_SOURCE_ERROR 72
111#define AB8500_INT_ADP_SINK_ERROR 73 146#define AB8500_INT_ADP_SINK_ERROR 73
112#define AB8500_INT_ADP_PROBE_PLUG 74 147#define AB8500_INT_ADP_PROBE_PLUG 74
@@ -114,30 +149,67 @@
114#define AB8500_INT_ADP_SENSE_OFF 76 149#define AB8500_INT_ADP_SENSE_OFF 76
115#define AB8500_INT_USB_PHY_POWER_ERR 78 150#define AB8500_INT_USB_PHY_POWER_ERR 78
116#define AB8500_INT_USB_LINK_STATUS 79 151#define AB8500_INT_USB_LINK_STATUS 79
152/* ab8500_irq_regoffset[10] -> IT[Source|Latch|Mask]19 */
117#define AB8500_INT_BTEMP_LOW 80 153#define AB8500_INT_BTEMP_LOW 80
118#define AB8500_INT_BTEMP_LOW_MEDIUM 81 154#define AB8500_INT_BTEMP_LOW_MEDIUM 81
119#define AB8500_INT_BTEMP_MEDIUM_HIGH 82 155#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
120#define AB8500_INT_BTEMP_HIGH 83 156#define AB8500_INT_BTEMP_HIGH 83
121#define AB8500_INT_USB_CHARGER_NOT_OK 89 157/* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */
158#define AB8500_INT_SRP_DETECT 88
159#define AB8500_INT_USB_CHARGER_NOT_OKR 89
122#define AB8500_INT_ID_WAKEUP_R 90 160#define AB8500_INT_ID_WAKEUP_R 90
123#define AB8500_INT_ID_DET_R1R 92 161#define AB8500_INT_ID_DET_R1R 92
124#define AB8500_INT_ID_DET_R2R 93 162#define AB8500_INT_ID_DET_R2R 93
125#define AB8500_INT_ID_DET_R3R 94 163#define AB8500_INT_ID_DET_R3R 94
126#define AB8500_INT_ID_DET_R4R 95 164#define AB8500_INT_ID_DET_R4R 95
165/* ab8500_irq_regoffset[12] -> IT[Source|Latch|Mask]21 */
127#define AB8500_INT_ID_WAKEUP_F 96 166#define AB8500_INT_ID_WAKEUP_F 96
128#define AB8500_INT_ID_DET_R1F 98 167#define AB8500_INT_ID_DET_R1F 98
129#define AB8500_INT_ID_DET_R2F 99 168#define AB8500_INT_ID_DET_R2F 99
130#define AB8500_INT_ID_DET_R3F 100 169#define AB8500_INT_ID_DET_R3F 100
131#define AB8500_INT_ID_DET_R4F 101 170#define AB8500_INT_ID_DET_R4F 101
132#define AB8500_INT_USB_CHG_DET_DONE 102 171#define AB8500_INT_CHAUTORESTARTAFTSEC 102
172#define AB8500_INT_CHSTOPBYSEC 103
173/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
133#define AB8500_INT_USB_CH_TH_PROT_F 104 174#define AB8500_INT_USB_CH_TH_PROT_F 104
134#define AB8500_INT_USB_CH_TH_PROT_R 105 175#define AB8500_INT_USB_CH_TH_PROT_R 105
135#define AB8500_INT_MAIN_CH_TH_PROT_F 106 176#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
136#define AB8500_INT_MAIN_CH_TH_PROT_R 107 177#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
137#define AB8500_INT_USB_CHARGER_NOT_OKF 111 178#define AB8500_INT_CHCURLIMNOHSCHIRP 109
179#define AB8500_INT_CHCURLIMHSCHIRP 110
180#define AB8500_INT_XTAL32K_KO 111
138 181
182/* Definitions for AB9540 */
183/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
184#define AB9540_INT_GPIO50R 113
185#define AB9540_INT_GPIO51R 114 /* not 8505 */
186#define AB9540_INT_GPIO52R 115
187#define AB9540_INT_GPIO53R 116
188#define AB9540_INT_GPIO54R 117 /* not 8505 */
189#define AB9540_INT_IEXT_CH_RF_BFN_R 118
190#define AB9540_INT_IEXT_CH_RF_BFN_F 119
191/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
192#define AB9540_INT_GPIO50F 121
193#define AB9540_INT_GPIO51F 122 /* not 8505 */
194#define AB9540_INT_GPIO52F 123
195#define AB9540_INT_GPIO53F 124
196#define AB9540_INT_GPIO54F 125 /* not 8505 */
197
198/*
199 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
200 * entire platform. This is a "compile time" constant so this must be set to
201 * the largest possible value that may be encountered with different AB SOCs.
202 * Of the currently supported AB devices, AB8500 and AB9540, it is the AB9540
203 * which is larger.
204 */
139#define AB8500_NR_IRQS 112 205#define AB8500_NR_IRQS 112
206#define AB8505_NR_IRQS 128
207#define AB9540_NR_IRQS 128
208/* This is set to the roof of any AB8500 chip variant IRQ counts */
209#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS
210
140#define AB8500_NUM_IRQ_REGS 14 211#define AB8500_NUM_IRQ_REGS 14
212#define AB9540_NUM_IRQ_REGS 17
141 213
142/** 214/**
143 * struct ab8500 - ab8500 internal structure 215 * struct ab8500 - ab8500 internal structure
@@ -145,13 +217,18 @@
145 * @lock: read/write operations lock 217 * @lock: read/write operations lock
146 * @irq_lock: genirq bus lock 218 * @irq_lock: genirq bus lock
147 * @irq: irq line 219 * @irq: irq line
220 * @version: chip version id (e.g. ab8500 or ab9540)
148 * @chip_id: chip revision id 221 * @chip_id: chip revision id
149 * @write: register write 222 * @write: register write
223 * @write_masked: masked register write
150 * @read: register read 224 * @read: register read
151 * @rx_buf: rx buf for SPI 225 * @rx_buf: rx buf for SPI
152 * @tx_buf: tx buf for SPI 226 * @tx_buf: tx buf for SPI
153 * @mask: cache of IRQ regs for bus lock 227 * @mask: cache of IRQ regs for bus lock
154 * @oldmask: cache of previous IRQ regs for bus lock 228 * @oldmask: cache of previous IRQ regs for bus lock
229 * @mask_size: Actual number of valid entries in mask[], oldmask[] and
230 * irq_reg_offset
231 * @irq_reg_offset: Array of offsets into IRQ registers
155 */ 232 */
156struct ab8500 { 233struct ab8500 {
157 struct device *dev; 234 struct device *dev;
@@ -160,16 +237,20 @@ struct ab8500 {
160 237
161 int irq_base; 238 int irq_base;
162 int irq; 239 int irq;
240 enum ab8500_version version;
163 u8 chip_id; 241 u8 chip_id;
164 242
165 int (*write) (struct ab8500 *a8500, u16 addr, u8 data); 243 int (*write)(struct ab8500 *ab8500, u16 addr, u8 data);
166 int (*read) (struct ab8500 *a8500, u16 addr); 244 int (*write_masked)(struct ab8500 *ab8500, u16 addr, u8 mask, u8 data);
245 int (*read)(struct ab8500 *ab8500, u16 addr);
167 246
168 unsigned long tx_buf[4]; 247 unsigned long tx_buf[4];
169 unsigned long rx_buf[4]; 248 unsigned long rx_buf[4];
170 249
171 u8 mask[AB8500_NUM_IRQ_REGS]; 250 u8 *mask;
172 u8 oldmask[AB8500_NUM_IRQ_REGS]; 251 u8 *oldmask;
252 int mask_size;
253 const int *irq_reg_offset;
173}; 254};
174 255
175struct regulator_reg_init; 256struct regulator_reg_init;
@@ -195,7 +276,52 @@ struct ab8500_platform_data {
195 struct ab8500_gpio_platform_data *gpio; 276 struct ab8500_gpio_platform_data *gpio;
196}; 277};
197 278
198extern int __devinit ab8500_init(struct ab8500 *ab8500); 279extern int __devinit ab8500_init(struct ab8500 *ab8500,
280 enum ab8500_version version);
199extern int __devexit ab8500_exit(struct ab8500 *ab8500); 281extern int __devexit ab8500_exit(struct ab8500 *ab8500);
200 282
283static inline int is_ab8500(struct ab8500 *ab)
284{
285 return ab->version == AB8500_VERSION_AB8500;
286}
287
288static inline int is_ab8505(struct ab8500 *ab)
289{
290 return ab->version == AB8500_VERSION_AB8505;
291}
292
293static inline int is_ab9540(struct ab8500 *ab)
294{
295 return ab->version == AB8500_VERSION_AB9540;
296}
297
298static inline int is_ab8540(struct ab8500 *ab)
299{
300 return ab->version == AB8500_VERSION_AB8540;
301}
302
303/* exclude also ab8505, ab9540... */
304static inline int is_ab8500_1p0_or_earlier(struct ab8500 *ab)
305{
306 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P0));
307}
308
309/* exclude also ab8505, ab9540... */
310static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab)
311{
312 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1));
313}
314
315/* exclude also ab8505, ab9540... */
316static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
317{
318 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
319}
320
321/* exclude also ab8505, ab9540... */
322static inline int is_ab8500_2p0(struct ab8500 *ab)
323{
324 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
325}
326
201#endif /* MFD_AB8500_H */ 327#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/anatop.h b/include/linux/mfd/anatop.h
new file mode 100644
index 000000000000..22c1007d3ec5
--- /dev/null
+++ b/include/linux/mfd/anatop.h
@@ -0,0 +1,40 @@
1/*
2 * anatop.h - Anatop MFD driver
3 *
4 * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
5 * Copyright (C) 2012 Linaro
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_ANATOP_H
23#define __LINUX_MFD_ANATOP_H
24
25#include <linux/spinlock.h>
26
27/**
28 * anatop - MFD data
29 * @ioreg: ioremap register
30 * @reglock: spinlock for register read/write
31 */
32struct anatop {
33 void *ioreg;
34 spinlock_t reglock;
35};
36
37extern u32 anatop_get_bits(struct anatop *, u32, int, int);
38extern void anatop_set_bits(struct anatop *, u32, int, int, u32);
39
40#endif /* __LINUX_MFD_ANATOP_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 5702d1be13b4..7ffbd6e9e7fc 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -76,8 +76,6 @@ enum da9052_chip_id {
76struct da9052_pdata; 76struct da9052_pdata;
77 77
78struct da9052 { 78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev; 79 struct device *dev;
82 struct regmap *regmap; 80 struct regmap *regmap;
83 81
diff --git a/include/linux/mfd/db8500-prcmu.h b/include/linux/mfd/db8500-prcmu.h
index 60d27f7bfc1f..b3a43b1263fe 100644
--- a/include/linux/mfd/db8500-prcmu.h
+++ b/include/linux/mfd/db8500-prcmu.h
@@ -11,6 +11,24 @@
11#define __MFD_DB8500_PRCMU_H 11#define __MFD_DB8500_PRCMU_H
12 12
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/bitops.h>
15
16/*
17 * Registers
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
26#define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
27
28#define DB8500_PRCM_DSI_SW_RESET 0x324
29#define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0)
30#define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1)
31#define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2)
14 32
15/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */ 33/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
16 34
@@ -421,40 +439,22 @@ enum auto_enable {
421/* End of file previously known as prcmu-fw-defs_v1.h */ 439/* End of file previously known as prcmu-fw-defs_v1.h */
422 440
423/** 441/**
424 * enum hw_acc_dev - enum for hw accelerators 442 * enum prcmu_power_status - results from set_power_state
425 * @HW_ACC_SVAMMDSP: for SVAMMDSP 443 * @PRCMU_SLEEP_OK: Sleep went ok
426 * @HW_ACC_SVAPIPE: for SVAPIPE 444 * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok
427 * @HW_ACC_SIAMMDSP: for SIAMMDSP 445 * @PRCMU_IDLE_OK: Idle went ok
428 * @HW_ACC_SIAPIPE: for SIAPIPE 446 * @PRCMU_DEEPIDLE_OK: DeepIdle went ok
429 * @HW_ACC_SGA: for SGA 447 * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected
430 * @HW_ACC_B2R2: for B2R2 448 * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected
431 * @HW_ACC_MCDE: for MCDE
432 * @HW_ACC_ESRAM1: for ESRAM1
433 * @HW_ACC_ESRAM2: for ESRAM2
434 * @HW_ACC_ESRAM3: for ESRAM3
435 * @HW_ACC_ESRAM4: for ESRAM4
436 * @NUM_HW_ACC: number of hardware accelerators
437 *
438 * Different hw accelerators which can be turned ON/
439 * OFF or put into retention (MMDSPs and ESRAMs).
440 * Used with EPOD API.
441 * 449 *
442 * NOTE! Deprecated, to be removed when all users switched over to use the
443 * regulator API.
444 */ 450 */
445enum hw_acc_dev { 451enum prcmu_power_status {
446 HW_ACC_SVAMMDSP, 452 PRCMU_SLEEP_OK = 0xf3,
447 HW_ACC_SVAPIPE, 453 PRCMU_DEEP_SLEEP_OK = 0xf6,
448 HW_ACC_SIAMMDSP, 454 PRCMU_IDLE_OK = 0xf0,
449 HW_ACC_SIAPIPE, 455 PRCMU_DEEPIDLE_OK = 0xe3,
450 HW_ACC_SGA, 456 PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91,
451 HW_ACC_B2R2, 457 PRCMU_ARMPENDINGIT_ER = 0x93,
452 HW_ACC_MCDE,
453 HW_ACC_ESRAM1,
454 HW_ACC_ESRAM2,
455 HW_ACC_ESRAM3,
456 HW_ACC_ESRAM4,
457 NUM_HW_ACC
458}; 458};
459 459
460/* 460/*
@@ -493,6 +493,20 @@ struct prcmu_auto_pm_config {
493 u8 sva_policy; 493 u8 sva_policy;
494}; 494};
495 495
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
496#ifdef CONFIG_MFD_DB8500_PRCMU 510#ifdef CONFIG_MFD_DB8500_PRCMU
497 511
498void db8500_prcmu_early_init(void); 512void db8500_prcmu_early_init(void);
@@ -500,42 +514,41 @@ int prcmu_set_rc_a2p(enum romcode_write);
500enum romcode_read prcmu_get_rc_p2a(void); 514enum romcode_read prcmu_get_rc_p2a(void);
501enum ap_pwrst prcmu_get_xp70_current_state(void); 515enum ap_pwrst prcmu_get_xp70_current_state(void);
502bool prcmu_has_arm_maxopp(void); 516bool prcmu_has_arm_maxopp(void);
503bool prcmu_is_u8400(void); 517struct prcmu_fw_version *prcmu_get_fw_version(void);
504int prcmu_set_ape_opp(u8 opp);
505int prcmu_get_ape_opp(void);
506int prcmu_request_ape_opp_100_voltage(bool enable); 518int prcmu_request_ape_opp_100_voltage(bool enable);
507int prcmu_release_usb_wakeup_state(void); 519int prcmu_release_usb_wakeup_state(void);
508int prcmu_set_ddr_opp(u8 opp);
509int prcmu_get_ddr_opp(void);
510/* NOTE! Use regulator framework instead */
511int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
512void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 520void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
513 struct prcmu_auto_pm_config *idle); 521 struct prcmu_auto_pm_config *idle);
514bool prcmu_is_auto_pm_enabled(void); 522bool prcmu_is_auto_pm_enabled(void);
515 523
516int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 524int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
517int prcmu_set_clock_divider(u8 clock, u8 divider); 525int prcmu_set_clock_divider(u8 clock, u8 divider);
518int prcmu_config_hotdog(u8 threshold); 526int db8500_prcmu_config_hotdog(u8 threshold);
519int prcmu_config_hotmon(u8 low, u8 high); 527int db8500_prcmu_config_hotmon(u8 low, u8 high);
520int prcmu_start_temp_sense(u16 cycles32k); 528int db8500_prcmu_start_temp_sense(u16 cycles32k);
521int prcmu_stop_temp_sense(void); 529int db8500_prcmu_stop_temp_sense(void);
522int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 530int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
523int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 531int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
524 532
525void prcmu_ac_wake_req(void); 533void prcmu_ac_wake_req(void);
526void prcmu_ac_sleep_req(void); 534void prcmu_ac_sleep_req(void);
527void prcmu_modem_reset(void); 535void db8500_prcmu_modem_reset(void);
528void prcmu_enable_spi2(void);
529void prcmu_disable_spi2(void);
530 536
531int prcmu_config_a9wdog(u8 num, bool sleep_auto_off); 537int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
532int prcmu_enable_a9wdog(u8 id); 538int db8500_prcmu_enable_a9wdog(u8 id);
533int prcmu_disable_a9wdog(u8 id); 539int db8500_prcmu_disable_a9wdog(u8 id);
534int prcmu_kick_a9wdog(u8 id); 540int db8500_prcmu_kick_a9wdog(u8 id);
535int prcmu_load_a9wdog(u8 id, u32 val); 541int db8500_prcmu_load_a9wdog(u8 id, u32 val);
536 542
537void db8500_prcmu_system_reset(u16 reset_code); 543void db8500_prcmu_system_reset(u16 reset_code);
538int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll); 544int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
545u8 db8500_prcmu_get_power_state_result(void);
546int db8500_prcmu_gic_decouple(void);
547int db8500_prcmu_gic_recouple(void);
548int db8500_prcmu_copy_gic_settings(void);
549bool db8500_prcmu_gic_pending_irq(void);
550bool db8500_prcmu_pending_irq(void);
551bool db8500_prcmu_is_cpu_in_wfi(int cpu);
539void db8500_prcmu_enable_wakeups(u32 wakeups); 552void db8500_prcmu_enable_wakeups(u32 wakeups);
540int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state); 553int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
541int db8500_prcmu_request_clock(u8 clock, bool enable); 554int db8500_prcmu_request_clock(u8 clock, bool enable);
@@ -549,6 +562,14 @@ u16 db8500_prcmu_get_reset_code(void);
549bool db8500_prcmu_is_ac_wake_requested(void); 562bool db8500_prcmu_is_ac_wake_requested(void);
550int db8500_prcmu_set_arm_opp(u8 opp); 563int db8500_prcmu_set_arm_opp(u8 opp);
551int db8500_prcmu_get_arm_opp(void); 564int db8500_prcmu_get_arm_opp(void);
565int db8500_prcmu_set_ape_opp(u8 opp);
566int db8500_prcmu_get_ape_opp(void);
567int db8500_prcmu_set_ddr_opp(u8 opp);
568int db8500_prcmu_get_ddr_opp(void);
569
570u32 db8500_prcmu_read(unsigned int reg);
571void db8500_prcmu_write(unsigned int reg, u32 value);
572void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
552 573
553#else /* !CONFIG_MFD_DB8500_PRCMU */ 574#else /* !CONFIG_MFD_DB8500_PRCMU */
554 575
@@ -574,17 +595,17 @@ static inline bool prcmu_has_arm_maxopp(void)
574 return false; 595 return false;
575} 596}
576 597
577static inline bool prcmu_is_u8400(void) 598static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
578{ 599{
579 return false; 600 return NULL;
580} 601}
581 602
582static inline int prcmu_set_ape_opp(u8 opp) 603static inline int db8500_prcmu_set_ape_opp(u8 opp)
583{ 604{
584 return 0; 605 return 0;
585} 606}
586 607
587static inline int prcmu_get_ape_opp(void) 608static inline int db8500_prcmu_get_ape_opp(void)
588{ 609{
589 return APE_100_OPP; 610 return APE_100_OPP;
590} 611}
@@ -599,21 +620,16 @@ static inline int prcmu_release_usb_wakeup_state(void)
599 return 0; 620 return 0;
600} 621}
601 622
602static inline int prcmu_set_ddr_opp(u8 opp) 623static inline int db8500_prcmu_set_ddr_opp(u8 opp)
603{ 624{
604 return 0; 625 return 0;
605} 626}
606 627
607static inline int prcmu_get_ddr_opp(void) 628static inline int db8500_prcmu_get_ddr_opp(void)
608{ 629{
609 return DDR_100_OPP; 630 return DDR_100_OPP;
610} 631}
611 632
612static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
613{
614 return 0;
615}
616
617static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep, 633static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
618 struct prcmu_auto_pm_config *idle) 634 struct prcmu_auto_pm_config *idle)
619{ 635{
@@ -634,22 +650,22 @@ static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
634 return 0; 650 return 0;
635} 651}
636 652
637static inline int prcmu_config_hotdog(u8 threshold) 653static inline int db8500_prcmu_config_hotdog(u8 threshold)
638{ 654{
639 return 0; 655 return 0;
640} 656}
641 657
642static inline int prcmu_config_hotmon(u8 low, u8 high) 658static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
643{ 659{
644 return 0; 660 return 0;
645} 661}
646 662
647static inline int prcmu_start_temp_sense(u16 cycles32k) 663static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
648{ 664{
649 return 0; 665 return 0;
650} 666}
651 667
652static inline int prcmu_stop_temp_sense(void) 668static inline int db8500_prcmu_stop_temp_sense(void)
653{ 669{
654 return 0; 670 return 0;
655} 671}
@@ -668,22 +684,17 @@ static inline void prcmu_ac_wake_req(void) {}
668 684
669static inline void prcmu_ac_sleep_req(void) {} 685static inline void prcmu_ac_sleep_req(void) {}
670 686
671static inline void prcmu_modem_reset(void) {} 687static inline void db8500_prcmu_modem_reset(void) {}
672 688
673static inline int prcmu_enable_spi2(void) 689static inline void db8500_prcmu_system_reset(u16 reset_code) {}
674{
675 return 0;
676}
677 690
678static inline int prcmu_disable_spi2(void) 691static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
692 bool keep_ap_pll)
679{ 693{
680 return 0; 694 return 0;
681} 695}
682 696
683static inline void db8500_prcmu_system_reset(u16 reset_code) {} 697static inline u8 db8500_prcmu_get_power_state_result(void)
684
685static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
686 bool keep_ap_pll)
687{ 698{
688 return 0; 699 return 0;
689} 700}
@@ -729,27 +740,27 @@ static inline u16 db8500_prcmu_get_reset_code(void)
729 return 0; 740 return 0;
730} 741}
731 742
732static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) 743static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
733{ 744{
734 return 0; 745 return 0;
735} 746}
736 747
737static inline int prcmu_enable_a9wdog(u8 id) 748static inline int db8500_prcmu_enable_a9wdog(u8 id)
738{ 749{
739 return 0; 750 return 0;
740} 751}
741 752
742static inline int prcmu_disable_a9wdog(u8 id) 753static inline int db8500_prcmu_disable_a9wdog(u8 id)
743{ 754{
744 return 0; 755 return 0;
745} 756}
746 757
747static inline int prcmu_kick_a9wdog(u8 id) 758static inline int db8500_prcmu_kick_a9wdog(u8 id)
748{ 759{
749 return 0; 760 return 0;
750} 761}
751 762
752static inline int prcmu_load_a9wdog(u8 id, u32 val) 763static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
753{ 764{
754 return 0; 765 return 0;
755} 766}
@@ -769,6 +780,16 @@ static inline int db8500_prcmu_get_arm_opp(void)
769 return 0; 780 return 0;
770} 781}
771 782
783static inline u32 db8500_prcmu_read(unsigned int reg)
784{
785 return 0;
786}
787
788static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
789
790static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
791 u32 value) {}
792
772#endif /* !CONFIG_MFD_DB8500_PRCMU */ 793#endif /* !CONFIG_MFD_DB8500_PRCMU */
773 794
774#endif /* __MFD_DB8500_PRCMU_H */ 795#endif /* __MFD_DB8500_PRCMU_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index bac942f959c1..d7674eb7305f 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -10,7 +10,7 @@
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <asm/mach-types.h> 13#include <linux/err.h>
14 14
15/* PRCMU Wakeup defines */ 15/* PRCMU Wakeup defines */
16enum prcmu_wakeup_index { 16enum prcmu_wakeup_index {
@@ -80,6 +80,29 @@ enum prcmu_wakeup_index {
80#define EPOD_STATE_ON_CLK_OFF 0x03 80#define EPOD_STATE_ON_CLK_OFF 0x03
81#define EPOD_STATE_ON 0x04 81#define EPOD_STATE_ON 0x04
82 82
83/* DB5500 CLKOUT IDs */
84enum {
85 DB5500_CLKOUT0 = 0,
86 DB5500_CLKOUT1,
87};
88
89/* DB5500 CLKOUTx sources */
90enum {
91 DB5500_CLKOUT_REF_CLK_SEL0,
92 DB5500_CLKOUT_RTC_CLK0_SEL0,
93 DB5500_CLKOUT_ULP_CLK_SEL0,
94 DB5500_CLKOUT_STATIC0,
95 DB5500_CLKOUT_REFCLK,
96 DB5500_CLKOUT_ULPCLK,
97 DB5500_CLKOUT_ARMCLK,
98 DB5500_CLKOUT_SYSACC0CLK,
99 DB5500_CLKOUT_SOC0PLLCLK,
100 DB5500_CLKOUT_SOC1PLLCLK,
101 DB5500_CLKOUT_DDRPLLCLK,
102 DB5500_CLKOUT_TVCLK,
103 DB5500_CLKOUT_IRDACLK,
104};
105
83/* 106/*
84 * CLKOUT sources 107 * CLKOUT sources
85 */ 108 */
@@ -111,6 +134,7 @@ enum prcmu_clock {
111 PRCMU_MSP1CLK, 134 PRCMU_MSP1CLK,
112 PRCMU_I2CCLK, 135 PRCMU_I2CCLK,
113 PRCMU_SDMMCCLK, 136 PRCMU_SDMMCCLK,
137 PRCMU_SPARE1CLK,
114 PRCMU_SLIMCLK, 138 PRCMU_SLIMCLK,
115 PRCMU_PER1CLK, 139 PRCMU_PER1CLK,
116 PRCMU_PER2CLK, 140 PRCMU_PER2CLK,
@@ -139,12 +163,20 @@ enum prcmu_clock {
139 PRCMU_IRRCCLK, 163 PRCMU_IRRCCLK,
140 PRCMU_SIACLK, 164 PRCMU_SIACLK,
141 PRCMU_SVACLK, 165 PRCMU_SVACLK,
166 PRCMU_ACLK,
142 PRCMU_NUM_REG_CLOCKS, 167 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS, 168 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
169 PRCMU_CDCLK,
144 PRCMU_TIMCLK, 170 PRCMU_TIMCLK,
145 PRCMU_PLLSOC0, 171 PRCMU_PLLSOC0,
146 PRCMU_PLLSOC1, 172 PRCMU_PLLSOC1,
147 PRCMU_PLLDDR, 173 PRCMU_PLLDDR,
174 PRCMU_PLLDSI,
175 PRCMU_DSI0CLK,
176 PRCMU_DSI1CLK,
177 PRCMU_DSI0ESCCLK,
178 PRCMU_DSI1ESCCLK,
179 PRCMU_DSI2ESCCLK,
148}; 180};
149 181
150/** 182/**
@@ -153,12 +185,14 @@ enum prcmu_clock {
153 * @APE_NO_CHANGE: The APE operating point is unchanged 185 * @APE_NO_CHANGE: The APE operating point is unchanged
154 * @APE_100_OPP: The new APE operating point is ape100opp 186 * @APE_100_OPP: The new APE operating point is ape100opp
155 * @APE_50_OPP: 50% 187 * @APE_50_OPP: 50%
188 * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
156 */ 189 */
157enum ape_opp { 190enum ape_opp {
158 APE_OPP_INIT = 0x00, 191 APE_OPP_INIT = 0x00,
159 APE_NO_CHANGE = 0x01, 192 APE_NO_CHANGE = 0x01,
160 APE_100_OPP = 0x02, 193 APE_100_OPP = 0x02,
161 APE_50_OPP = 0x03 194 APE_50_OPP = 0x03,
195 APE_50_PARTLY_25_OPP = 0xFF,
162}; 196};
163 197
164/** 198/**
@@ -218,9 +252,11 @@ enum ddr_pwrst {
218 252
219#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 253#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
220 254
255#include <mach/id.h>
256
221static inline void __init prcmu_early_init(void) 257static inline void __init prcmu_early_init(void)
222{ 258{
223 if (machine_is_u5500()) 259 if (cpu_is_u5500())
224 return db5500_prcmu_early_init(); 260 return db5500_prcmu_early_init();
225 else 261 else
226 return db8500_prcmu_early_init(); 262 return db8500_prcmu_early_init();
@@ -229,7 +265,7 @@ static inline void __init prcmu_early_init(void)
229static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 265static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
230 bool keep_ap_pll) 266 bool keep_ap_pll)
231{ 267{
232 if (machine_is_u5500()) 268 if (cpu_is_u5500())
233 return db5500_prcmu_set_power_state(state, keep_ulp_clk, 269 return db5500_prcmu_set_power_state(state, keep_ulp_clk,
234 keep_ap_pll); 270 keep_ap_pll);
235 else 271 else
@@ -237,9 +273,65 @@ static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
237 keep_ap_pll); 273 keep_ap_pll);
238} 274}
239 275
276static inline u8 prcmu_get_power_state_result(void)
277{
278 if (cpu_is_u5500())
279 return -EINVAL;
280 else
281 return db8500_prcmu_get_power_state_result();
282}
283
284static inline int prcmu_gic_decouple(void)
285{
286 if (cpu_is_u5500())
287 return -EINVAL;
288 else
289 return db8500_prcmu_gic_decouple();
290}
291
292static inline int prcmu_gic_recouple(void)
293{
294 if (cpu_is_u5500())
295 return -EINVAL;
296 else
297 return db8500_prcmu_gic_recouple();
298}
299
300static inline bool prcmu_gic_pending_irq(void)
301{
302 if (cpu_is_u5500())
303 return -EINVAL;
304 else
305 return db8500_prcmu_gic_pending_irq();
306}
307
308static inline bool prcmu_is_cpu_in_wfi(int cpu)
309{
310 if (cpu_is_u5500())
311 return -EINVAL;
312 else
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314}
315
316static inline int prcmu_copy_gic_settings(void)
317{
318 if (cpu_is_u5500())
319 return -EINVAL;
320 else
321 return db8500_prcmu_copy_gic_settings();
322}
323
324static inline bool prcmu_pending_irq(void)
325{
326 if (cpu_is_u5500())
327 return -EINVAL;
328 else
329 return db8500_prcmu_pending_irq();
330}
331
240static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 332static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
241{ 333{
242 if (machine_is_u5500()) 334 if (cpu_is_u5500())
243 return -EINVAL; 335 return -EINVAL;
244 else 336 else
245 return db8500_prcmu_set_epod(epod_id, epod_state); 337 return db8500_prcmu_set_epod(epod_id, epod_state);
@@ -247,7 +339,7 @@ static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
247 339
248static inline void prcmu_enable_wakeups(u32 wakeups) 340static inline void prcmu_enable_wakeups(u32 wakeups)
249{ 341{
250 if (machine_is_u5500()) 342 if (cpu_is_u5500())
251 db5500_prcmu_enable_wakeups(wakeups); 343 db5500_prcmu_enable_wakeups(wakeups);
252 else 344 else
253 db8500_prcmu_enable_wakeups(wakeups); 345 db8500_prcmu_enable_wakeups(wakeups);
@@ -260,7 +352,7 @@ static inline void prcmu_disable_wakeups(void)
260 352
261static inline void prcmu_config_abb_event_readout(u32 abb_events) 353static inline void prcmu_config_abb_event_readout(u32 abb_events)
262{ 354{
263 if (machine_is_u5500()) 355 if (cpu_is_u5500())
264 db5500_prcmu_config_abb_event_readout(abb_events); 356 db5500_prcmu_config_abb_event_readout(abb_events);
265 else 357 else
266 db8500_prcmu_config_abb_event_readout(abb_events); 358 db8500_prcmu_config_abb_event_readout(abb_events);
@@ -268,7 +360,7 @@ static inline void prcmu_config_abb_event_readout(u32 abb_events)
268 360
269static inline void prcmu_get_abb_event_buffer(void __iomem **buf) 361static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
270{ 362{
271 if (machine_is_u5500()) 363 if (cpu_is_u5500())
272 db5500_prcmu_get_abb_event_buffer(buf); 364 db5500_prcmu_get_abb_event_buffer(buf);
273 else 365 else
274 db8500_prcmu_get_abb_event_buffer(buf); 366 db8500_prcmu_get_abb_event_buffer(buf);
@@ -276,25 +368,40 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
276 368
277int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 369int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
278int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 370int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
371int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
279 372
280int prcmu_config_clkout(u8 clkout, u8 source, u8 div); 373int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
281 374
282static inline int prcmu_request_clock(u8 clock, bool enable) 375static inline int prcmu_request_clock(u8 clock, bool enable)
283{ 376{
284 if (machine_is_u5500()) 377 if (cpu_is_u5500())
285 return db5500_prcmu_request_clock(clock, enable); 378 return db5500_prcmu_request_clock(clock, enable);
286 else 379 else
287 return db8500_prcmu_request_clock(clock, enable); 380 return db8500_prcmu_request_clock(clock, enable);
288} 381}
289 382
290int prcmu_set_ape_opp(u8 opp); 383unsigned long prcmu_clock_rate(u8 clock);
291int prcmu_get_ape_opp(void); 384long prcmu_round_clock_rate(u8 clock, unsigned long rate);
292int prcmu_set_ddr_opp(u8 opp); 385int prcmu_set_clock_rate(u8 clock, unsigned long rate);
293int prcmu_get_ddr_opp(void); 386
387static inline int prcmu_set_ddr_opp(u8 opp)
388{
389 if (cpu_is_u5500())
390 return -EINVAL;
391 else
392 return db8500_prcmu_set_ddr_opp(opp);
393}
394static inline int prcmu_get_ddr_opp(void)
395{
396 if (cpu_is_u5500())
397 return -EINVAL;
398 else
399 return db8500_prcmu_get_ddr_opp();
400}
294 401
295static inline int prcmu_set_arm_opp(u8 opp) 402static inline int prcmu_set_arm_opp(u8 opp)
296{ 403{
297 if (machine_is_u5500()) 404 if (cpu_is_u5500())
298 return -EINVAL; 405 return -EINVAL;
299 else 406 else
300 return db8500_prcmu_set_arm_opp(opp); 407 return db8500_prcmu_set_arm_opp(opp);
@@ -302,15 +409,31 @@ static inline int prcmu_set_arm_opp(u8 opp)
302 409
303static inline int prcmu_get_arm_opp(void) 410static inline int prcmu_get_arm_opp(void)
304{ 411{
305 if (machine_is_u5500()) 412 if (cpu_is_u5500())
306 return -EINVAL; 413 return -EINVAL;
307 else 414 else
308 return db8500_prcmu_get_arm_opp(); 415 return db8500_prcmu_get_arm_opp();
309} 416}
310 417
418static inline int prcmu_set_ape_opp(u8 opp)
419{
420 if (cpu_is_u5500())
421 return -EINVAL;
422 else
423 return db8500_prcmu_set_ape_opp(opp);
424}
425
426static inline int prcmu_get_ape_opp(void)
427{
428 if (cpu_is_u5500())
429 return -EINVAL;
430 else
431 return db8500_prcmu_get_ape_opp();
432}
433
311static inline void prcmu_system_reset(u16 reset_code) 434static inline void prcmu_system_reset(u16 reset_code)
312{ 435{
313 if (machine_is_u5500()) 436 if (cpu_is_u5500())
314 return db5500_prcmu_system_reset(reset_code); 437 return db5500_prcmu_system_reset(reset_code);
315 else 438 else
316 return db8500_prcmu_system_reset(reset_code); 439 return db8500_prcmu_system_reset(reset_code);
@@ -318,7 +441,7 @@ static inline void prcmu_system_reset(u16 reset_code)
318 441
319static inline u16 prcmu_get_reset_code(void) 442static inline u16 prcmu_get_reset_code(void)
320{ 443{
321 if (machine_is_u5500()) 444 if (cpu_is_u5500())
322 return db5500_prcmu_get_reset_code(); 445 return db5500_prcmu_get_reset_code();
323 else 446 else
324 return db8500_prcmu_get_reset_code(); 447 return db8500_prcmu_get_reset_code();
@@ -326,10 +449,17 @@ static inline u16 prcmu_get_reset_code(void)
326 449
327void prcmu_ac_wake_req(void); 450void prcmu_ac_wake_req(void);
328void prcmu_ac_sleep_req(void); 451void prcmu_ac_sleep_req(void);
329void prcmu_modem_reset(void); 452static inline void prcmu_modem_reset(void)
453{
454 if (cpu_is_u5500())
455 return;
456 else
457 return db8500_prcmu_modem_reset();
458}
459
330static inline bool prcmu_is_ac_wake_requested(void) 460static inline bool prcmu_is_ac_wake_requested(void)
331{ 461{
332 if (machine_is_u5500()) 462 if (cpu_is_u5500())
333 return db5500_prcmu_is_ac_wake_requested(); 463 return db5500_prcmu_is_ac_wake_requested();
334 else 464 else
335 return db8500_prcmu_is_ac_wake_requested(); 465 return db8500_prcmu_is_ac_wake_requested();
@@ -337,7 +467,7 @@ static inline bool prcmu_is_ac_wake_requested(void)
337 467
338static inline int prcmu_set_display_clocks(void) 468static inline int prcmu_set_display_clocks(void)
339{ 469{
340 if (machine_is_u5500()) 470 if (cpu_is_u5500())
341 return db5500_prcmu_set_display_clocks(); 471 return db5500_prcmu_set_display_clocks();
342 else 472 else
343 return db8500_prcmu_set_display_clocks(); 473 return db8500_prcmu_set_display_clocks();
@@ -345,7 +475,7 @@ static inline int prcmu_set_display_clocks(void)
345 475
346static inline int prcmu_disable_dsipll(void) 476static inline int prcmu_disable_dsipll(void)
347{ 477{
348 if (machine_is_u5500()) 478 if (cpu_is_u5500())
349 return db5500_prcmu_disable_dsipll(); 479 return db5500_prcmu_disable_dsipll();
350 else 480 else
351 return db8500_prcmu_disable_dsipll(); 481 return db8500_prcmu_disable_dsipll();
@@ -353,7 +483,7 @@ static inline int prcmu_disable_dsipll(void)
353 483
354static inline int prcmu_enable_dsipll(void) 484static inline int prcmu_enable_dsipll(void)
355{ 485{
356 if (machine_is_u5500()) 486 if (cpu_is_u5500())
357 return db5500_prcmu_enable_dsipll(); 487 return db5500_prcmu_enable_dsipll();
358 else 488 else
359 return db8500_prcmu_enable_dsipll(); 489 return db8500_prcmu_enable_dsipll();
@@ -361,11 +491,107 @@ static inline int prcmu_enable_dsipll(void)
361 491
362static inline int prcmu_config_esram0_deep_sleep(u8 state) 492static inline int prcmu_config_esram0_deep_sleep(u8 state)
363{ 493{
364 if (machine_is_u5500()) 494 if (cpu_is_u5500())
365 return -EINVAL; 495 return -EINVAL;
366 else 496 else
367 return db8500_prcmu_config_esram0_deep_sleep(state); 497 return db8500_prcmu_config_esram0_deep_sleep(state);
368} 498}
499
500static inline int prcmu_config_hotdog(u8 threshold)
501{
502 if (cpu_is_u5500())
503 return -EINVAL;
504 else
505 return db8500_prcmu_config_hotdog(threshold);
506}
507
508static inline int prcmu_config_hotmon(u8 low, u8 high)
509{
510 if (cpu_is_u5500())
511 return -EINVAL;
512 else
513 return db8500_prcmu_config_hotmon(low, high);
514}
515
516static inline int prcmu_start_temp_sense(u16 cycles32k)
517{
518 if (cpu_is_u5500())
519 return -EINVAL;
520 else
521 return db8500_prcmu_start_temp_sense(cycles32k);
522}
523
524static inline int prcmu_stop_temp_sense(void)
525{
526 if (cpu_is_u5500())
527 return -EINVAL;
528 else
529 return db8500_prcmu_stop_temp_sense();
530}
531
532static inline u32 prcmu_read(unsigned int reg)
533{
534 if (cpu_is_u5500())
535 return -EINVAL;
536 else
537 return db8500_prcmu_read(reg);
538}
539
540static inline void prcmu_write(unsigned int reg, u32 value)
541{
542 if (cpu_is_u5500())
543 return;
544 else
545 db8500_prcmu_write(reg, value);
546}
547
548static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
549{
550 if (cpu_is_u5500())
551 return;
552 else
553 db8500_prcmu_write_masked(reg, mask, value);
554}
555
556static inline int prcmu_enable_a9wdog(u8 id)
557{
558 if (cpu_is_u5500())
559 return -EINVAL;
560 else
561 return db8500_prcmu_enable_a9wdog(id);
562}
563
564static inline int prcmu_disable_a9wdog(u8 id)
565{
566 if (cpu_is_u5500())
567 return -EINVAL;
568 else
569 return db8500_prcmu_disable_a9wdog(id);
570}
571
572static inline int prcmu_kick_a9wdog(u8 id)
573{
574 if (cpu_is_u5500())
575 return -EINVAL;
576 else
577 return db8500_prcmu_kick_a9wdog(id);
578}
579
580static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
581{
582 if (cpu_is_u5500())
583 return -EINVAL;
584 else
585 return db8500_prcmu_load_a9wdog(id, timeout);
586}
587
588static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
589{
590 if (cpu_is_u5500())
591 return -EINVAL;
592 else
593 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
594}
369#else 595#else
370 596
371static inline void __init prcmu_early_init(void) {} 597static inline void __init prcmu_early_init(void) {}
@@ -395,6 +621,12 @@ static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
395 return -ENOSYS; 621 return -ENOSYS;
396} 622}
397 623
624static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
625 u8 size)
626{
627 return -ENOSYS;
628}
629
398static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) 630static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
399{ 631{
400 return 0; 632 return 0;
@@ -405,6 +637,21 @@ static inline int prcmu_request_clock(u8 clock, bool enable)
405 return 0; 637 return 0;
406} 638}
407 639
640static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
641{
642 return 0;
643}
644
645static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
646{
647 return 0;
648}
649
650static inline unsigned long prcmu_clock_rate(u8 clock)
651{
652 return 0;
653}
654
408static inline int prcmu_set_ape_opp(u8 opp) 655static inline int prcmu_set_ape_opp(u8 opp)
409{ 656{
410 return 0; 657 return 0;
@@ -480,14 +727,133 @@ static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
480 *buf = NULL; 727 *buf = NULL;
481} 728}
482 729
730static inline int prcmu_config_hotdog(u8 threshold)
731{
732 return 0;
733}
734
735static inline int prcmu_config_hotmon(u8 low, u8 high)
736{
737 return 0;
738}
739
740static inline int prcmu_start_temp_sense(u16 cycles32k)
741{
742 return 0;
743}
744
745static inline int prcmu_stop_temp_sense(void)
746{
747 return 0;
748}
749
750static inline u32 prcmu_read(unsigned int reg)
751{
752 return 0;
753}
754
755static inline void prcmu_write(unsigned int reg, u32 value) {}
756
757static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
758
759#endif
760
761static inline void prcmu_set(unsigned int reg, u32 bits)
762{
763 prcmu_write_masked(reg, bits, bits);
764}
765
766static inline void prcmu_clear(unsigned int reg, u32 bits)
767{
768 prcmu_write_masked(reg, bits, 0);
769}
770
771#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
772
773/**
774 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
775 */
776static inline void prcmu_enable_spi2(void)
777{
778 if (cpu_is_u8500())
779 prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
780}
781
782/**
783 * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
784 */
785static inline void prcmu_disable_spi2(void)
786{
787 if (cpu_is_u8500())
788 prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
789}
790
791/**
792 * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
793 * and UARTMOD on OtherAlternateC3.
794 */
795static inline void prcmu_enable_stm_mod_uart(void)
796{
797 if (cpu_is_u8500()) {
798 prcmu_set(DB8500_PRCM_GPIOCR,
799 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
800 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
801 }
802}
803
804/**
805 * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
806 * and UARTMOD on OtherAlternateC3.
807 */
808static inline void prcmu_disable_stm_mod_uart(void)
809{
810 if (cpu_is_u8500()) {
811 prcmu_clear(DB8500_PRCM_GPIOCR,
812 (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
813 DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
814 }
815}
816
817/**
818 * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
819 */
820static inline void prcmu_enable_stm_ape(void)
821{
822 if (cpu_is_u8500()) {
823 prcmu_set(DB8500_PRCM_GPIOCR,
824 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
825 }
826}
827
828/**
829 * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
830 */
831static inline void prcmu_disable_stm_ape(void)
832{
833 if (cpu_is_u8500()) {
834 prcmu_clear(DB8500_PRCM_GPIOCR,
835 DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
836 }
837}
838
839#else
840
841static inline void prcmu_enable_spi2(void) {}
842static inline void prcmu_disable_spi2(void) {}
843static inline void prcmu_enable_stm_mod_uart(void) {}
844static inline void prcmu_disable_stm_mod_uart(void) {}
845static inline void prcmu_enable_stm_ape(void) {}
846static inline void prcmu_disable_stm_ape(void) {}
847
483#endif 848#endif
484 849
485/* PRCMU QoS APE OPP class */ 850/* PRCMU QoS APE OPP class */
486#define PRCMU_QOS_APE_OPP 1 851#define PRCMU_QOS_APE_OPP 1
487#define PRCMU_QOS_DDR_OPP 2 852#define PRCMU_QOS_DDR_OPP 2
853#define PRCMU_QOS_ARM_OPP 3
488#define PRCMU_QOS_DEFAULT_VALUE -1 854#define PRCMU_QOS_DEFAULT_VALUE -1
489 855
490#ifdef CONFIG_UX500_PRCMU_QOS_POWER 856#ifdef CONFIG_DBX500_PRCMU_QOS_POWER
491 857
492unsigned long prcmu_qos_get_cpufreq_opp_delay(void); 858unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
493void prcmu_qos_set_cpufreq_opp_delay(unsigned long); 859void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index fff590521e50..28726dd540f2 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -131,6 +131,55 @@ struct max8997_muic_platform_data {
131 int num_init_data; 131 int num_init_data;
132}; 132};
133 133
134enum max8997_haptic_motor_type {
135 MAX8997_HAPTIC_ERM,
136 MAX8997_HAPTIC_LRA,
137};
138
139enum max8997_haptic_pulse_mode {
140 MAX8997_EXTERNAL_MODE,
141 MAX8997_INTERNAL_MODE,
142};
143
144enum max8997_haptic_pwm_divisor {
145 MAX8997_PWM_DIVISOR_32,
146 MAX8997_PWM_DIVISOR_64,
147 MAX8997_PWM_DIVISOR_128,
148 MAX8997_PWM_DIVISOR_256,
149};
150
151/**
152 * max8997_haptic_platform_data
153 * @pwm_channel_id: channel number of PWM device
154 * valid for MAX8997_EXTERNAL_MODE
155 * @pwm_period: period in nano second for PWM device
156 * valid for MAX8997_EXTERNAL_MODE
157 * @type: motor type
158 * @mode: pulse mode
159 * MAX8997_EXTERNAL_MODE: external PWM device is used to control motor
160 * MAX8997_INTERNAL_MODE: internal pulse generator is used to control motor
161 * @pwm_divisor: divisor for external PWM device
162 * @internal_mode_pattern: internal mode pattern for internal mode
163 * [0 - 3]: valid pattern number
164 * @pattern_cycle: the number of cycles of the waveform
165 * for the internal mode pattern
166 * [0 - 15]: available cycles
167 * @pattern_signal_period: period of the waveform for the internal mode pattern
168 * [0 - 255]: available period
169 */
170struct max8997_haptic_platform_data {
171 unsigned int pwm_channel_id;
172 unsigned int pwm_period;
173
174 enum max8997_haptic_motor_type type;
175 enum max8997_haptic_pulse_mode mode;
176 enum max8997_haptic_pwm_divisor pwm_divisor;
177
178 unsigned int internal_mode_pattern;
179 unsigned int pattern_cycle;
180 unsigned int pattern_signal_period;
181};
182
134enum max8997_led_mode { 183enum max8997_led_mode {
135 MAX8997_NONE, 184 MAX8997_NONE,
136 MAX8997_FLASH_MODE, 185 MAX8997_FLASH_MODE,
@@ -192,7 +241,9 @@ struct max8997_platform_data {
192 /* ---- MUIC ---- */ 241 /* ---- MUIC ---- */
193 struct max8997_muic_platform_data *muic_pdata; 242 struct max8997_muic_platform_data *muic_pdata;
194 243
195 /* HAPTIC: Not implemented */ 244 /* ---- HAPTIC ---- */
245 struct max8997_haptic_platform_data *haptic_pdata;
246
196 /* RTC: Not implemented */ 247 /* RTC: Not implemented */
197 /* ---- LED ---- */ 248 /* ---- LED ---- */
198 struct max8997_led_platform_data *led_pdata; 249 struct max8997_led_platform_data *led_pdata;
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index b86ee45c8b03..10e038bac8dd 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -38,7 +38,8 @@ int mc13xxx_irq_ack(struct mc13xxx *mc13xxx, int irq);
38int mc13xxx_get_flags(struct mc13xxx *mc13xxx); 38int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
39 39
40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, 40int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
41 unsigned int mode, unsigned int channel, unsigned int *sample); 41 unsigned int mode, unsigned int channel,
42 u8 ato, bool atox, unsigned int *sample);
42 43
43#define MC13XXX_IRQ_ADCDONE 0 44#define MC13XXX_IRQ_ADCDONE 0
44#define MC13XXX_IRQ_ADCBISDONE 1 45#define MC13XXX_IRQ_ADCBISDONE 1
@@ -157,6 +158,18 @@ struct mc13xxx_buttons_platform_data {
157 unsigned short b3on_key; 158 unsigned short b3on_key;
158}; 159};
159 160
161struct mc13xxx_ts_platform_data {
162 /* Delay between Touchscreen polarization and ADC Conversion.
163 * Given in clock ticks of a 32 kHz clock which gives a granularity of
164 * about 30.5ms */
165 u8 ato;
166
167#define MC13783_TS_ATO_FIRST false
168#define MC13783_TS_ATO_EACH true
169 /* Use the ATO delay only for the first conversion or for each one */
170 bool atox;
171};
172
160struct mc13xxx_platform_data { 173struct mc13xxx_platform_data {
161#define MC13XXX_USE_TOUCHSCREEN (1 << 0) 174#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
162#define MC13XXX_USE_CODEC (1 << 1) 175#define MC13XXX_USE_CODEC (1 << 1)
@@ -167,6 +180,7 @@ struct mc13xxx_platform_data {
167 struct mc13xxx_regulator_platform_data regulators; 180 struct mc13xxx_regulator_platform_data regulators;
168 struct mc13xxx_leds_platform_data *leds; 181 struct mc13xxx_leds_platform_data *leds;
169 struct mc13xxx_buttons_platform_data *buttons; 182 struct mc13xxx_buttons_platform_data *buttons;
183 struct mc13xxx_ts_platform_data touch;
170}; 184};
171 185
172#define MC13XXX_ADC_MODE_TS 1 186#define MC13XXX_ADC_MODE_TS 1
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index f88c1cc0cb0f..a9e8bd157673 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -10,8 +10,6 @@
10#ifndef MCP_H 10#ifndef MCP_H
11#define MCP_H 11#define MCP_H
12 12
13#include <mach/dma.h>
14
15struct mcp_ops; 13struct mcp_ops;
16 14
17struct mcp { 15struct mcp {
@@ -21,12 +19,7 @@ struct mcp {
21 int use_count; 19 int use_count;
22 unsigned int sclk_rate; 20 unsigned int sclk_rate;
23 unsigned int rw_timeout; 21 unsigned int rw_timeout;
24 dma_device_t dma_audio_rd;
25 dma_device_t dma_audio_wr;
26 dma_device_t dma_telco_rd;
27 dma_device_t dma_telco_wr;
28 struct device attached_device; 22 struct device attached_device;
29 int gpio_base;
30}; 23};
31 24
32struct mcp_ops { 25struct mcp_ops {
@@ -47,15 +40,14 @@ void mcp_disable(struct mcp *);
47#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 40#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
48 41
49struct mcp *mcp_host_alloc(struct device *, size_t); 42struct mcp *mcp_host_alloc(struct device *, size_t);
50int mcp_host_register(struct mcp *); 43int mcp_host_add(struct mcp *, void *);
51void mcp_host_unregister(struct mcp *); 44void mcp_host_del(struct mcp *);
45void mcp_host_free(struct mcp *);
52 46
53struct mcp_driver { 47struct mcp_driver {
54 struct device_driver drv; 48 struct device_driver drv;
55 int (*probe)(struct mcp *); 49 int (*probe)(struct mcp *);
56 void (*remove)(struct mcp *); 50 void (*remove)(struct mcp *);
57 int (*suspend)(struct mcp *, pm_message_t);
58 int (*resume)(struct mcp *);
59}; 51};
60 52
61int mcp_driver_register(struct mcp_driver *); 53int mcp_driver_register(struct mcp_driver *);
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h
index d5517fd32d1b..00fa3de7659d 100644
--- a/include/linux/mfd/pm8xxx/pm8921.h
+++ b/include/linux/mfd/pm8xxx/pm8921.h
@@ -18,7 +18,6 @@
18#ifndef __MFD_PM8921_H 18#ifndef __MFD_PM8921_H
19#define __MFD_PM8921_H 19#define __MFD_PM8921_H
20 20
21#include <linux/device.h>
22#include <linux/mfd/pm8xxx/irq.h> 21#include <linux/mfd/pm8xxx/irq.h>
23 22
24#define PM8921_NR_IRQS 256 23#define PM8921_NR_IRQS 256
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
new file mode 100644
index 000000000000..a2c61609d21d
--- /dev/null
+++ b/include/linux/mfd/rc5t583.h
@@ -0,0 +1,295 @@
1/*
2 * Core driver interface to access RICOH_RC5T583 power management chip.
3 *
4 * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved.
5 * Author: Laxman dewangan <ldewangan@nvidia.com>
6 *
7 * Based on code
8 * Copyright (C) 2011 RICOH COMPANY,LTD
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef __LINUX_MFD_RC5T583_H
25#define __LINUX_MFD_RC5T583_H
26
27#include <linux/mutex.h>
28#include <linux/types.h>
29
30#define RC5T583_MAX_REGS 0xF8
31
32/* Maximum number of main interrupts */
33#define MAX_MAIN_INTERRUPT 5
34#define RC5T583_MAX_GPEDGE_REG 2
35#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
36
37/* Interrupt enable register */
38#define RC5T583_INT_EN_SYS1 0x19
39#define RC5T583_INT_EN_SYS2 0x1D
40#define RC5T583_INT_EN_DCDC 0x41
41#define RC5T583_INT_EN_RTC 0xED
42#define RC5T583_INT_EN_ADC1 0x90
43#define RC5T583_INT_EN_ADC2 0x91
44#define RC5T583_INT_EN_ADC3 0x92
45
46/* Interrupt status registers (monitor regs in Ricoh)*/
47#define RC5T583_INTC_INTPOL 0xAD
48#define RC5T583_INTC_INTEN 0xAE
49#define RC5T583_INTC_INTMON 0xAF
50
51#define RC5T583_INT_MON_GRP 0xAF
52#define RC5T583_INT_MON_SYS1 0x1B
53#define RC5T583_INT_MON_SYS2 0x1F
54#define RC5T583_INT_MON_DCDC 0x43
55#define RC5T583_INT_MON_RTC 0xEE
56
57/* Interrupt clearing registers */
58#define RC5T583_INT_IR_SYS1 0x1A
59#define RC5T583_INT_IR_SYS2 0x1E
60#define RC5T583_INT_IR_DCDC 0x42
61#define RC5T583_INT_IR_RTC 0xEE
62#define RC5T583_INT_IR_ADCL 0x94
63#define RC5T583_INT_IR_ADCH 0x95
64#define RC5T583_INT_IR_ADCEND 0x96
65#define RC5T583_INT_IR_GPIOR 0xA9
66#define RC5T583_INT_IR_GPIOF 0xAA
67
68/* Sleep sequence registers */
69#define RC5T583_SLPSEQ1 0x21
70#define RC5T583_SLPSEQ2 0x22
71#define RC5T583_SLPSEQ3 0x23
72#define RC5T583_SLPSEQ4 0x24
73#define RC5T583_SLPSEQ5 0x25
74#define RC5T583_SLPSEQ6 0x26
75#define RC5T583_SLPSEQ7 0x27
76#define RC5T583_SLPSEQ8 0x28
77#define RC5T583_SLPSEQ9 0x29
78#define RC5T583_SLPSEQ10 0x2A
79#define RC5T583_SLPSEQ11 0x2B
80
81/* Regulator registers */
82#define RC5T583_REG_DC0CTL 0x30
83#define RC5T583_REG_DC0DAC 0x31
84#define RC5T583_REG_DC0LATCTL 0x32
85#define RC5T583_REG_SR0CTL 0x33
86
87#define RC5T583_REG_DC1CTL 0x34
88#define RC5T583_REG_DC1DAC 0x35
89#define RC5T583_REG_DC1LATCTL 0x36
90#define RC5T583_REG_SR1CTL 0x37
91
92#define RC5T583_REG_DC2CTL 0x38
93#define RC5T583_REG_DC2DAC 0x39
94#define RC5T583_REG_DC2LATCTL 0x3A
95#define RC5T583_REG_SR2CTL 0x3B
96
97#define RC5T583_REG_DC3CTL 0x3C
98#define RC5T583_REG_DC3DAC 0x3D
99#define RC5T583_REG_DC3LATCTL 0x3E
100#define RC5T583_REG_SR3CTL 0x3F
101
102
103#define RC5T583_REG_LDOEN1 0x50
104#define RC5T583_REG_LDOEN2 0x51
105#define RC5T583_REG_LDODIS1 0x52
106#define RC5T583_REG_LDODIS2 0x53
107
108#define RC5T583_REG_LDO0DAC 0x54
109#define RC5T583_REG_LDO1DAC 0x55
110#define RC5T583_REG_LDO2DAC 0x56
111#define RC5T583_REG_LDO3DAC 0x57
112#define RC5T583_REG_LDO4DAC 0x58
113#define RC5T583_REG_LDO5DAC 0x59
114#define RC5T583_REG_LDO6DAC 0x5A
115#define RC5T583_REG_LDO7DAC 0x5B
116#define RC5T583_REG_LDO8DAC 0x5C
117#define RC5T583_REG_LDO9DAC 0x5D
118
119#define RC5T583_REG_DC0DAC_DS 0x60
120#define RC5T583_REG_DC1DAC_DS 0x61
121#define RC5T583_REG_DC2DAC_DS 0x62
122#define RC5T583_REG_DC3DAC_DS 0x63
123
124#define RC5T583_REG_LDO0DAC_DS 0x64
125#define RC5T583_REG_LDO1DAC_DS 0x65
126#define RC5T583_REG_LDO2DAC_DS 0x66
127#define RC5T583_REG_LDO3DAC_DS 0x67
128#define RC5T583_REG_LDO4DAC_DS 0x68
129#define RC5T583_REG_LDO5DAC_DS 0x69
130#define RC5T583_REG_LDO6DAC_DS 0x6A
131#define RC5T583_REG_LDO7DAC_DS 0x6B
132#define RC5T583_REG_LDO8DAC_DS 0x6C
133#define RC5T583_REG_LDO9DAC_DS 0x6D
134
135/* GPIO register base address */
136#define RC5T583_GPIO_IOSEL 0xA0
137#define RC5T583_GPIO_PDEN 0xA1
138#define RC5T583_GPIO_IOOUT 0xA2
139#define RC5T583_GPIO_PGSEL 0xA3
140#define RC5T583_GPIO_GPINV 0xA4
141#define RC5T583_GPIO_GPDEB 0xA5
142#define RC5T583_GPIO_GPEDGE1 0xA6
143#define RC5T583_GPIO_GPEDGE2 0xA7
144#define RC5T583_GPIO_EN_INT 0xA8
145#define RC5T583_GPIO_MON_IOIN 0xAB
146#define RC5T583_GPIO_GPOFUNC 0xAC
147
148/* RICOH_RC5T583 IRQ definitions */
149enum {
150 RC5T583_IRQ_ONKEY,
151 RC5T583_IRQ_ACOK,
152 RC5T583_IRQ_LIDOPEN,
153 RC5T583_IRQ_PREOT,
154 RC5T583_IRQ_CLKSTP,
155 RC5T583_IRQ_ONKEY_OFF,
156 RC5T583_IRQ_WD,
157 RC5T583_IRQ_EN_PWRREQ1,
158 RC5T583_IRQ_EN_PWRREQ2,
159 RC5T583_IRQ_PRE_VINDET,
160
161 RC5T583_IRQ_DC0LIM,
162 RC5T583_IRQ_DC1LIM,
163 RC5T583_IRQ_DC2LIM,
164 RC5T583_IRQ_DC3LIM,
165
166 RC5T583_IRQ_CTC,
167 RC5T583_IRQ_YALE,
168 RC5T583_IRQ_DALE,
169 RC5T583_IRQ_WALE,
170
171 RC5T583_IRQ_AIN1L,
172 RC5T583_IRQ_AIN2L,
173 RC5T583_IRQ_AIN3L,
174 RC5T583_IRQ_VBATL,
175 RC5T583_IRQ_VIN3L,
176 RC5T583_IRQ_VIN8L,
177 RC5T583_IRQ_AIN1H,
178 RC5T583_IRQ_AIN2H,
179 RC5T583_IRQ_AIN3H,
180 RC5T583_IRQ_VBATH,
181 RC5T583_IRQ_VIN3H,
182 RC5T583_IRQ_VIN8H,
183 RC5T583_IRQ_ADCEND,
184
185 RC5T583_IRQ_GPIO0,
186 RC5T583_IRQ_GPIO1,
187 RC5T583_IRQ_GPIO2,
188 RC5T583_IRQ_GPIO3,
189 RC5T583_IRQ_GPIO4,
190 RC5T583_IRQ_GPIO5,
191 RC5T583_IRQ_GPIO6,
192 RC5T583_IRQ_GPIO7,
193
194 /* Should be last entry */
195 RC5T583_MAX_IRQS,
196};
197
198/* Ricoh583 gpio definitions */
199enum {
200 RC5T583_GPIO0,
201 RC5T583_GPIO1,
202 RC5T583_GPIO2,
203 RC5T583_GPIO3,
204 RC5T583_GPIO4,
205 RC5T583_GPIO5,
206 RC5T583_GPIO6,
207 RC5T583_GPIO7,
208
209 /* Should be last entry */
210 RC5T583_MAX_GPIO,
211};
212
213enum {
214 RC5T583_DS_NONE,
215 RC5T583_DS_DC0,
216 RC5T583_DS_DC1,
217 RC5T583_DS_DC2,
218 RC5T583_DS_DC3,
219 RC5T583_DS_LDO0,
220 RC5T583_DS_LDO1,
221 RC5T583_DS_LDO2,
222 RC5T583_DS_LDO3,
223 RC5T583_DS_LDO4,
224 RC5T583_DS_LDO5,
225 RC5T583_DS_LDO6,
226 RC5T583_DS_LDO7,
227 RC5T583_DS_LDO8,
228 RC5T583_DS_LDO9,
229 RC5T583_DS_PSO0,
230 RC5T583_DS_PSO1,
231 RC5T583_DS_PSO2,
232 RC5T583_DS_PSO3,
233 RC5T583_DS_PSO4,
234 RC5T583_DS_PSO5,
235 RC5T583_DS_PSO6,
236 RC5T583_DS_PSO7,
237
238 /* Should be last entry */
239 RC5T583_DS_MAX,
240};
241
242/*
243 * Ricoh pmic RC5T583 supports sleep through two external controls.
244 * The output of gpios and regulator can be enable/disable through
245 * this external signals.
246 */
247enum {
248 RC5T583_EXT_PWRREQ1_CONTROL = 0x1,
249 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
250};
251
252struct rc5t583 {
253 struct device *dev;
254 struct regmap *regmap;
255 int chip_irq;
256 int irq_base;
257 struct mutex irq_lock;
258 unsigned long group_irq_en[MAX_MAIN_INTERRUPT];
259
260 /* For main interrupt bits in INTC */
261 uint8_t intc_inten_reg;
262
263 /* For group interrupt bits and address */
264 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS];
265
266 /* For gpio edge */
267 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
268};
269
270/*
271 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
272 * The board specific data is provided through this structure.
273 * @irq_base: Irq base number on which this device registers their interrupts.
274 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
275 */
276
277struct rc5t583_platform_data {
278 int irq_base;
279 bool enable_shutdown;
280};
281
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val);
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val);
284int rc5t583_set_bits(struct device *dev, unsigned int reg,
285 unsigned int bit_mask);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg,
287 unsigned int bit_mask);
288int rc5t583_update(struct device *dev, unsigned int reg,
289 unsigned int val, unsigned int mask);
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
293int rc5t583_irq_exit(struct rc5t583 *rc5t583);
294
295#endif
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index ca1d7a347600..8516fd1eaabc 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -8,7 +8,9 @@
8#ifndef __LINUX_MFD_STMPE_H 8#ifndef __LINUX_MFD_STMPE_H
9#define __LINUX_MFD_STMPE_H 9#define __LINUX_MFD_STMPE_H
10 10
11#include <linux/device.h> 11#include <linux/mutex.h>
12
13struct device;
12 14
13enum stmpe_block { 15enum stmpe_block {
14 STMPE_BLOCK_GPIO = 1 << 0, 16 STMPE_BLOCK_GPIO = 1 << 0,
@@ -26,6 +28,7 @@ enum stmpe_partnum {
26 STMPE1601, 28 STMPE1601,
27 STMPE2401, 29 STMPE2401,
28 STMPE2403, 30 STMPE2403,
31 STMPE_NBR_PARTS
29}; 32};
30 33
31/* 34/*
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 16c76e124f9c..3acb3a8e3af5 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -7,7 +7,7 @@
7#ifndef __LINUX_MFD_TC3589x_H 7#ifndef __LINUX_MFD_TC3589x_H
8#define __LINUX_MFD_TC3589x_H 8#define __LINUX_MFD_TC3589x_H
9 9
10#include <linux/device.h> 10struct device;
11 11
12enum tx3589x_block { 12enum tx3589x_block {
13 TC3589x_BLOCK_GPIO = 1 << 0, 13 TC3589x_BLOCK_GPIO = 1 << 0,
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
new file mode 100644
index 000000000000..38e31c55adbb
--- /dev/null
+++ b/include/linux/mfd/tps65090.h
@@ -0,0 +1,46 @@
1/*
2 * Core driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (C) 2012 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
22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H
24
25struct tps65090_subdev_info {
26 int id;
27 const char *name;
28 void *platform_data;
29};
30
31struct tps65090_platform_data {
32 int irq_base;
33 int num_subdevs;
34 struct tps65090_subdev_info *subdevs;
35};
36
37/*
38 * NOTE: the functions below are not intended for use outside
39 * of the TPS65090 sub-device drivers
40 */
41extern int tps65090_write(struct device *dev, int reg, uint8_t val);
42extern int tps65090_read(struct device *dev, int reg, uint8_t *val);
43extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num);
44extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num);
45
46#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
new file mode 100644
index 000000000000..e030ef9a64ee
--- /dev/null
+++ b/include/linux/mfd/tps65217.h
@@ -0,0 +1,283 @@
1/*
2 * linux/mfd/tps65217.h
3 *
4 * Functions to access TPS65217 power management chip.
5 *
6 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.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 as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_MFD_TPS65217_H
19#define __LINUX_MFD_TPS65217_H
20
21#include <linux/i2c.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24
25/* I2C ID for TPS65217 part */
26#define TPS65217_I2C_ID 0x24
27
28/* All register addresses */
29#define TPS65217_REG_CHIPID 0X00
30#define TPS65217_REG_PPATH 0X01
31#define TPS65217_REG_INT 0X02
32#define TPS65217_REG_CHGCONFIG0 0X03
33#define TPS65217_REG_CHGCONFIG1 0X04
34#define TPS65217_REG_CHGCONFIG2 0X05
35#define TPS65217_REG_CHGCONFIG3 0X06
36#define TPS65217_REG_WLEDCTRL1 0X07
37#define TPS65217_REG_WLEDCTRL2 0X08
38#define TPS65217_REG_MUXCTRL 0X09
39#define TPS65217_REG_STATUS 0X0A
40#define TPS65217_REG_PASSWORD 0X0B
41#define TPS65217_REG_PGOOD 0X0C
42#define TPS65217_REG_DEFPG 0X0D
43#define TPS65217_REG_DEFDCDC1 0X0E
44#define TPS65217_REG_DEFDCDC2 0X0F
45#define TPS65217_REG_DEFDCDC3 0X10
46#define TPS65217_REG_DEFSLEW 0X11
47#define TPS65217_REG_DEFLDO1 0X12
48#define TPS65217_REG_DEFLDO2 0X13
49#define TPS65217_REG_DEFLS1 0X14
50#define TPS65217_REG_DEFLS2 0X15
51#define TPS65217_REG_ENABLE 0X16
52#define TPS65217_REG_DEFUVLO 0X18
53#define TPS65217_REG_SEQ1 0X19
54#define TPS65217_REG_SEQ2 0X1A
55#define TPS65217_REG_SEQ3 0X1B
56#define TPS65217_REG_SEQ4 0X1C
57#define TPS65217_REG_SEQ5 0X1D
58#define TPS65217_REG_SEQ6 0X1E
59
60/* Register field definitions */
61#define TPS65217_CHIPID_CHIP_MASK 0xF0
62#define TPS65217_CHIPID_REV_MASK 0x0F
63
64#define TPS65217_PPATH_ACSINK_ENABLE BIT(7)
65#define TPS65217_PPATH_USBSINK_ENABLE BIT(6)
66#define TPS65217_PPATH_AC_PW_ENABLE BIT(5)
67#define TPS65217_PPATH_USB_PW_ENABLE BIT(4)
68#define TPS65217_PPATH_AC_CURRENT_MASK 0x0C
69#define TPS65217_PPATH_USB_CURRENT_MASK 0x03
70
71#define TPS65217_INT_PBM BIT(6)
72#define TPS65217_INT_ACM BIT(5)
73#define TPS65217_INT_USBM BIT(4)
74#define TPS65217_INT_PBI BIT(2)
75#define TPS65217_INT_ACI BIT(1)
76#define TPS65217_INT_USBI BIT(0)
77
78#define TPS65217_CHGCONFIG0_TREG BIT(7)
79#define TPS65217_CHGCONFIG0_DPPM BIT(6)
80#define TPS65217_CHGCONFIG0_TSUSP BIT(5)
81#define TPS65217_CHGCONFIG0_TERMI BIT(4)
82#define TPS65217_CHGCONFIG0_ACTIVE BIT(3)
83#define TPS65217_CHGCONFIG0_CHGTOUT BIT(2)
84#define TPS65217_CHGCONFIG0_PCHGTOUT BIT(1)
85#define TPS65217_CHGCONFIG0_BATTEMP BIT(0)
86
87#define TPS65217_CHGCONFIG1_TMR_MASK 0xC0
88#define TPS65217_CHGCONFIG1_TMR_ENABLE BIT(5)
89#define TPS65217_CHGCONFIG1_NTC_TYPE BIT(4)
90#define TPS65217_CHGCONFIG1_RESET BIT(3)
91#define TPS65217_CHGCONFIG1_TERM BIT(2)
92#define TPS65217_CHGCONFIG1_SUSP BIT(1)
93#define TPS65217_CHGCONFIG1_CHG_EN BIT(0)
94
95#define TPS65217_CHGCONFIG2_DYNTMR BIT(7)
96#define TPS65217_CHGCONFIG2_VPREGHG BIT(6)
97#define TPS65217_CHGCONFIG2_VOREG_MASK 0x30
98
99#define TPS65217_CHGCONFIG3_ICHRG_MASK 0xC0
100#define TPS65217_CHGCONFIG3_DPPMTH_MASK 0x30
101#define TPS65217_CHGCONFIG2_PCHRGT BIT(3)
102#define TPS65217_CHGCONFIG2_TERMIF 0x06
103#define TPS65217_CHGCONFIG2_TRANGE BIT(0)
104
105#define TPS65217_WLEDCTRL1_ISINK_ENABLE BIT(3)
106#define TPS65217_WLEDCTRL1_ISEL BIT(2)
107#define TPS65217_WLEDCTRL1_FDIM_MASK 0x03
108
109#define TPS65217_WLEDCTRL2_DUTY_MASK 0x7F
110
111#define TPS65217_MUXCTRL_MUX_MASK 0x07
112
113#define TPS65217_STATUS_OFF BIT(7)
114#define TPS65217_STATUS_ACPWR BIT(3)
115#define TPS65217_STATUS_USBPWR BIT(2)
116#define TPS65217_STATUS_PB BIT(0)
117
118#define TPS65217_PASSWORD_REGS_UNLOCK 0x7D
119
120#define TPS65217_PGOOD_LDO3_PG BIT(6)
121#define TPS65217_PGOOD_LDO4_PG BIT(5)
122#define TPS65217_PGOOD_DC1_PG BIT(4)
123#define TPS65217_PGOOD_DC2_PG BIT(3)
124#define TPS65217_PGOOD_DC3_PG BIT(2)
125#define TPS65217_PGOOD_LDO1_PG BIT(1)
126#define TPS65217_PGOOD_LDO2_PG BIT(0)
127
128#define TPS65217_DEFPG_LDO1PGM BIT(3)
129#define TPS65217_DEFPG_LDO2PGM BIT(2)
130#define TPS65217_DEFPG_PGDLY_MASK 0x03
131
132#define TPS65217_DEFDCDCX_XADJX BIT(7)
133#define TPS65217_DEFDCDCX_DCDC_MASK 0x3F
134
135#define TPS65217_DEFSLEW_GO BIT(7)
136#define TPS65217_DEFSLEW_GODSBL BIT(6)
137#define TPS65217_DEFSLEW_PFM_EN1 BIT(5)
138#define TPS65217_DEFSLEW_PFM_EN2 BIT(4)
139#define TPS65217_DEFSLEW_PFM_EN3 BIT(3)
140#define TPS65217_DEFSLEW_SLEW_MASK 0x07
141
142#define TPS65217_DEFLDO1_LDO1_MASK 0x0F
143
144#define TPS65217_DEFLDO2_TRACK BIT(6)
145#define TPS65217_DEFLDO2_LDO2_MASK 0x3F
146
147#define TPS65217_DEFLDO3_LDO3_EN BIT(5)
148#define TPS65217_DEFLDO3_LDO3_MASK 0x1F
149
150#define TPS65217_DEFLDO4_LDO4_EN BIT(5)
151#define TPS65217_DEFLDO4_LDO4_MASK 0x1F
152
153#define TPS65217_ENABLE_LS1_EN BIT(6)
154#define TPS65217_ENABLE_LS2_EN BIT(5)
155#define TPS65217_ENABLE_DC1_EN BIT(4)
156#define TPS65217_ENABLE_DC2_EN BIT(3)
157#define TPS65217_ENABLE_DC3_EN BIT(2)
158#define TPS65217_ENABLE_LDO1_EN BIT(1)
159#define TPS65217_ENABLE_LDO2_EN BIT(0)
160
161#define TPS65217_DEFUVLO_UVLOHYS BIT(2)
162#define TPS65217_DEFUVLO_UVLO_MASK 0x03
163
164#define TPS65217_SEQ1_DC1_SEQ_MASK 0xF0
165#define TPS65217_SEQ1_DC2_SEQ_MASK 0x0F
166
167#define TPS65217_SEQ2_DC3_SEQ_MASK 0xF0
168#define TPS65217_SEQ2_LDO1_SEQ_MASK 0x0F
169
170#define TPS65217_SEQ3_LDO2_SEQ_MASK 0xF0
171#define TPS65217_SEQ3_LDO3_SEQ_MASK 0x0F
172
173#define TPS65217_SEQ4_LDO4_SEQ_MASK 0xF0
174
175#define TPS65217_SEQ5_DLY1_MASK 0xC0
176#define TPS65217_SEQ5_DLY2_MASK 0x30
177#define TPS65217_SEQ5_DLY3_MASK 0x0C
178#define TPS65217_SEQ5_DLY4_MASK 0x03
179
180#define TPS65217_SEQ6_DLY5_MASK 0xC0
181#define TPS65217_SEQ6_DLY6_MASK 0x30
182#define TPS65217_SEQ6_SEQUP BIT(2)
183#define TPS65217_SEQ6_SEQDWN BIT(1)
184#define TPS65217_SEQ6_INSTDWN BIT(0)
185
186#define TPS65217_MAX_REGISTER 0x1E
187#define TPS65217_PROTECT_NONE 0
188#define TPS65217_PROTECT_L1 1
189#define TPS65217_PROTECT_L2 2
190
191
192enum tps65217_regulator_id {
193 /* DCDC's */
194 TPS65217_DCDC_1,
195 TPS65217_DCDC_2,
196 TPS65217_DCDC_3,
197 /* LDOs */
198 TPS65217_LDO_1,
199 TPS65217_LDO_2,
200 TPS65217_LDO_3,
201 TPS65217_LDO_4,
202};
203
204#define TPS65217_MAX_REG_ID TPS65217_LDO_4
205
206/* Number of step-down converters available */
207#define TPS65217_NUM_DCDC 3
208/* Number of LDO voltage regulators available */
209#define TPS65217_NUM_LDO 4
210/* Number of total regulators available */
211#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
212
213/**
214 * struct tps65217_board - packages regulator init data
215 * @tps65217_regulator_data: regulator initialization values
216 *
217 * Board data may be used to initialize regulator.
218 */
219struct tps65217_board {
220 struct regulator_init_data *tps65217_init_data;
221};
222
223/**
224 * struct tps_info - packages regulator constraints
225 * @name: Voltage regulator name
226 * @min_uV: minimum micro volts
227 * @max_uV: minimum micro volts
228 * @vsel_to_uv: Function pointer to get voltage from selector
229 * @uv_to_vsel: Function pointer to get selector from voltage
230 * @table: Table for non-uniform voltage step-size
231 * @table_len: Length of the voltage table
232 * @enable_mask: Regulator enable mask bits
233 * @set_vout_reg: Regulator output voltage set register
234 * @set_vout_mask: Regulator output voltage set mask
235 *
236 * This data is used to check the regualtor voltage limits while setting.
237 */
238struct tps_info {
239 const char *name;
240 int min_uV;
241 int max_uV;
242 int (*vsel_to_uv)(unsigned int vsel);
243 int (*uv_to_vsel)(int uV, unsigned int *vsel);
244 const int *table;
245 unsigned int table_len;
246 unsigned int enable_mask;
247 unsigned int set_vout_reg;
248 unsigned int set_vout_mask;
249};
250
251/**
252 * struct tps65217 - tps65217 sub-driver chip access routines
253 *
254 * Device data may be used to access the TPS65217 chip
255 */
256
257struct tps65217 {
258 struct device *dev;
259 struct tps65217_board *pdata;
260 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
261 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
262 struct tps_info *info[TPS65217_NUM_REGULATOR];
263 struct regmap *regmap;
264
265 /* Client devices */
266 struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR];
267};
268
269static inline struct tps65217 *dev_to_tps65217(struct device *dev)
270{
271 return dev_get_drvdata(dev);
272}
273
274int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,
275 unsigned int *val);
276int tps65217_reg_write(struct tps65217 *tps, unsigned int reg,
277 unsigned int val, unsigned int level);
278int tps65217_set_bits(struct tps65217 *tps, unsigned int reg,
279 unsigned int mask, unsigned int val, unsigned int level);
280int tps65217_clear_bits(struct tps65217 *tps, unsigned int reg,
281 unsigned int mask, unsigned int level);
282
283#endif /* __LINUX_MFD_TPS65217_H */
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index d0cb12eba402..1c6c2860d1a6 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -17,6 +17,8 @@
17#ifndef __LINUX_MFD_TPS65910_H 17#ifndef __LINUX_MFD_TPS65910_H
18#define __LINUX_MFD_TPS65910_H 18#define __LINUX_MFD_TPS65910_H
19 19
20#include <linux/gpio.h>
21
20/* TPS chip id list */ 22/* TPS chip id list */
21#define TPS65910 0 23#define TPS65910 0
22#define TPS65911 1 24#define TPS65911 1
@@ -657,6 +659,8 @@
657 659
658 660
659/*Register GPIO (0x80) register.RegisterDescription */ 661/*Register GPIO (0x80) register.RegisterDescription */
662#define GPIO_SLEEP_MASK 0x80
663#define GPIO_SLEEP_SHIFT 7
660#define GPIO_DEB_MASK 0x10 664#define GPIO_DEB_MASK 0x10
661#define GPIO_DEB_SHIFT 4 665#define GPIO_DEB_SHIFT 4
662#define GPIO_PUEN_MASK 0x08 666#define GPIO_PUEN_MASK 0x08
@@ -740,6 +744,11 @@
740#define TPS65910_GPIO_STS BIT(1) 744#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 745#define TPS65910_GPIO_SET BIT(0)
742 746
747/* Max number of TPS65910/11 GPIOs */
748#define TPS65910_NUM_GPIO 6
749#define TPS65911_NUM_GPIO 9
750#define TPS6591X_MAX_NUM_GPIO 9
751
743/* Regulator Index Definitions */ 752/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0 753#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1 754#define TPS65910_REG_VIO 1
@@ -768,6 +777,12 @@
768/* Max number of TPS65910/11 regulators */ 777/* Max number of TPS65910/11 regulators */
769#define TPS65910_NUM_REGS 13 778#define TPS65910_NUM_REGS 13
770 779
780/* External sleep controls through EN1/EN2/EN3/SLEEP inputs */
781#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1
782#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2
783#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4
784#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8
785
771/** 786/**
772 * struct tps65910_board 787 * struct tps65910_board
773 * Board platform data may be used to initialize regulators. 788 * Board platform data may be used to initialize regulators.
@@ -779,6 +794,8 @@ struct tps65910_board {
779 int irq_base; 794 int irq_base;
780 int vmbch_threshold; 795 int vmbch_threshold;
781 int vmbch2_threshold; 796 int vmbch2_threshold;
797 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
798 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
782 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; 799 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
783}; 800};
784 801
@@ -789,6 +806,7 @@ struct tps65910_board {
789struct tps65910 { 806struct tps65910 {
790 struct device *dev; 807 struct device *dev;
791 struct i2c_client *i2c_client; 808 struct i2c_client *i2c_client;
809 struct regmap *regmap;
792 struct mutex io_mutex; 810 struct mutex io_mutex;
793 unsigned int id; 811 unsigned int id;
794 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); 812 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest);
diff --git a/include/linux/mfd/ucb1x00.h b/include/linux/mfd/ucb1x00.h
index 4321f044d1e4..28af41756360 100644
--- a/include/linux/mfd/ucb1x00.h
+++ b/include/linux/mfd/ucb1x00.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/mfd/mcp.h> 13#include <linux/mfd/mcp.h>
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/semaphore.h> 15#include <linux/mutex.h>
16 16
17#define UCB_IO_DATA 0x00 17#define UCB_IO_DATA 0x00
18#define UCB_IO_DIR 0x01 18#define UCB_IO_DIR 0x01
@@ -104,17 +104,27 @@
104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 104#define UCB_MODE_DYN_VFLAG_ENA (1 << 12)
105#define UCB_MODE_AUD_OFF_CAN (1 << 13) 105#define UCB_MODE_AUD_OFF_CAN (1 << 13)
106 106
107enum ucb1x00_reset {
108 UCB_RST_PROBE,
109 UCB_RST_RESUME,
110 UCB_RST_SUSPEND,
111 UCB_RST_REMOVE,
112 UCB_RST_PROBE_FAIL,
113};
107 114
108struct ucb1x00_irq { 115struct ucb1x00_plat_data {
109 void *devid; 116 void (*reset)(enum ucb1x00_reset);
110 void (*fn)(int, void *); 117 unsigned irq_base;
118 int gpio_base;
119 unsigned can_wakeup;
111}; 120};
112 121
113struct ucb1x00 { 122struct ucb1x00 {
114 spinlock_t lock; 123 raw_spinlock_t irq_lock;
115 struct mcp *mcp; 124 struct mcp *mcp;
116 unsigned int irq; 125 unsigned int irq;
117 struct semaphore adc_sem; 126 int irq_base;
127 struct mutex adc_mutex;
118 spinlock_t io_lock; 128 spinlock_t io_lock;
119 u16 id; 129 u16 id;
120 u16 io_dir; 130 u16 io_dir;
@@ -122,7 +132,8 @@ struct ucb1x00 {
122 u16 adc_cr; 132 u16 adc_cr;
123 u16 irq_fal_enbl; 133 u16 irq_fal_enbl;
124 u16 irq_ris_enbl; 134 u16 irq_ris_enbl;
125 struct ucb1x00_irq irq_handler[16]; 135 u16 irq_mask;
136 u16 irq_wake;
126 struct device dev; 137 struct device dev;
127 struct list_head node; 138 struct list_head node;
128 struct list_head devs; 139 struct list_head devs;
@@ -144,7 +155,7 @@ struct ucb1x00_driver {
144 struct list_head devs; 155 struct list_head devs;
145 int (*add)(struct ucb1x00_dev *dev); 156 int (*add)(struct ucb1x00_dev *dev);
146 void (*remove)(struct ucb1x00_dev *dev); 157 void (*remove)(struct ucb1x00_dev *dev);
147 int (*suspend)(struct ucb1x00_dev *dev, pm_message_t state); 158 int (*suspend)(struct ucb1x00_dev *dev);
148 int (*resume)(struct ucb1x00_dev *dev); 159 int (*resume)(struct ucb1x00_dev *dev);
149}; 160};
150 161
@@ -245,15 +256,4 @@ unsigned int ucb1x00_adc_read(struct ucb1x00 *ucb, int adc_channel, int sync);
245void ucb1x00_adc_enable(struct ucb1x00 *ucb); 256void ucb1x00_adc_enable(struct ucb1x00 *ucb);
246void ucb1x00_adc_disable(struct ucb1x00 *ucb); 257void ucb1x00_adc_disable(struct ucb1x00 *ucb);
247 258
248/*
249 * Which edges of the IRQ do you want to control today?
250 */
251#define UCB_RISING (1 << 0)
252#define UCB_FALLING (1 << 1)
253
254int ucb1x00_hook_irq(struct ucb1x00 *ucb, unsigned int idx, void (*fn)(int, void *), void *devid);
255void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
256void ucb1x00_disable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges);
257int ucb1x00_free_irq(struct ucb1x00 *ucb, unsigned int idx, void *devid);
258
259#endif 259#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 3fb1f407d5e6..893267bb6229 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -22,7 +22,6 @@ struct wm8994_ldo_pdata {
22 /** GPIOs to enable regulator, 0 or less if not available */ 22 /** GPIOs to enable regulator, 0 or less if not available */
23 int enable; 23 int enable;
24 24
25 const char *supply;
26 const struct regulator_init_data *init_data; 25 const struct regulator_init_data *init_data;
27}; 26};
28 27
@@ -185,6 +184,9 @@ struct wm8994_pdata {
185 unsigned int jd_scthr:2; 184 unsigned int jd_scthr:2;
186 unsigned int jd_thr:2; 185 unsigned int jd_thr:2;
187 186
187 /* Configure WM1811 jack detection for use with external capacitor */
188 unsigned int jd_ext_cap:1;
189
188 /* WM8958 microphone bias configuration */ 190 /* WM8958 microphone bias configuration */
189 int micbias[2]; 191 int micbias[2];
190 192
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 05ed2828a553..855c337b20c3 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -8,7 +8,6 @@
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9 9
10#ifdef CONFIG_MIGRATION 10#ifdef CONFIG_MIGRATION
11#define PAGE_MIGRATION 1
12 11
13extern void putback_lru_pages(struct list_head *l); 12extern void putback_lru_pages(struct list_head *l);
14extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
@@ -32,7 +31,6 @@ extern void migrate_page_copy(struct page *newpage, struct page *page);
32extern int migrate_huge_page_move_mapping(struct address_space *mapping, 31extern int migrate_huge_page_move_mapping(struct address_space *mapping,
33 struct page *newpage, struct page *page); 32 struct page *newpage, struct page *page);
34#else 33#else
35#define PAGE_MIGRATION 0
36 34
37static inline void putback_lru_pages(struct list_head *l) {} 35static inline void putback_lru_pages(struct list_head *l) {}
38static inline int migrate_pages(struct list_head *l, new_page_t x, 36static inline int migrate_pages(struct list_head *l, new_page_t x,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index aea61905499b..834c96c5d879 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -101,10 +101,6 @@ enum {
101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
102 102
103enum { 103enum {
104 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
105};
106
107enum {
108 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, 104 MLX4_BMME_FLAG_LOCAL_INV = 1 << 6,
109 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, 105 MLX4_BMME_FLAG_REMOTE_INV = 1 << 7,
110 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, 106 MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9,
@@ -133,6 +129,7 @@ enum mlx4_event {
133 MLX4_EVENT_TYPE_CMD = 0x0a, 129 MLX4_EVENT_TYPE_CMD = 0x0a,
134 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, 130 MLX4_EVENT_TYPE_VEP_UPDATE = 0x19,
135 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, 131 MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18,
132 MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b,
136 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, 133 MLX4_EVENT_TYPE_FLR_EVENT = 0x1c,
137 MLX4_EVENT_TYPE_NONE = 0xff, 134 MLX4_EVENT_TYPE_NONE = 0xff,
138}; 135};
@@ -143,6 +140,10 @@ enum {
143}; 140};
144 141
145enum { 142enum {
143 MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0,
144};
145
146enum {
146 MLX4_PERM_LOCAL_READ = 1 << 10, 147 MLX4_PERM_LOCAL_READ = 1 << 10,
147 MLX4_PERM_LOCAL_WRITE = 1 << 11, 148 MLX4_PERM_LOCAL_WRITE = 1 << 11,
148 MLX4_PERM_REMOTE_READ = 1 << 12, 149 MLX4_PERM_REMOTE_READ = 1 << 12,
@@ -273,6 +274,7 @@ struct mlx4_caps {
273 int num_comp_vectors; 274 int num_comp_vectors;
274 int comp_pool; 275 int comp_pool;
275 int num_mpts; 276 int num_mpts;
277 int max_fmr_maps;
276 int num_mtts; 278 int num_mtts;
277 int fmr_reserved_mtts; 279 int fmr_reserved_mtts;
278 int reserved_mtts; 280 int reserved_mtts;
@@ -308,7 +310,7 @@ struct mlx4_caps {
308 u32 port_mask[MLX4_MAX_PORTS + 1]; 310 u32 port_mask[MLX4_MAX_PORTS + 1];
309 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 311 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
310 u32 max_counters; 312 u32 max_counters;
311 u8 ext_port_cap[MLX4_MAX_PORTS + 1]; 313 u8 port_ib_mtu[MLX4_MAX_PORTS + 1];
312}; 314};
313 315
314struct mlx4_buf_list { 316struct mlx4_buf_list {
@@ -622,7 +624,10 @@ int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); 624int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); 625void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
624void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); 626void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
625 627int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
628 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
629int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
630 u8 promisc);
626int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 631int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
627int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 632int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
628void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 633void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index e1eebf78caba..5f1298b1b5ef 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -33,7 +33,6 @@
33#ifndef MLX4_DRIVER_H 33#ifndef MLX4_DRIVER_H
34#define MLX4_DRIVER_H 34#define MLX4_DRIVER_H
35 35
36#include <linux/device.h>
37#include <linux/mlx4/device.h> 36#include <linux/mlx4/device.h>
38 37
39struct mlx4_dev; 38struct mlx4_dev;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bee8fa231276..091f9e7dc8b9 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg {
212 * [1] SE (solicited event) 212 * [1] SE (solicited event)
213 * [0] FL (force loopback) 213 * [0] FL (force loopback)
214 */ 214 */
215 __be32 srcrb_flags; 215 union {
216 __be32 srcrb_flags;
217 __be16 srcrb_flags16[2];
218 };
216 /* 219 /*
217 * imm is immediate data for send/RDMA write w/ immediate; 220 * imm is immediate data for send/RDMA write w/ immediate;
218 * also invalidation key for send with invalidate; input 221 * also invalidation key for send with invalidate; input
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 17b27cd269c4..cf7982336103 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -6,6 +6,7 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/bug.h>
9#include <linux/list.h> 10#include <linux/list.h>
10#include <linux/mmzone.h> 11#include <linux/mmzone.h>
11#include <linux/rbtree.h> 12#include <linux/rbtree.h>
@@ -111,7 +112,7 @@ extern unsigned int kobjsize(const void *objp);
111#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ 112#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
112#endif 113#endif
113#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 114#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
114#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 115#define VM_NODUMP 0x04000000 /* Do not include in the core dump */
115 116
116#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 117#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
117#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
@@ -893,9 +894,9 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
893 894
894int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, 895int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
895 unsigned long size); 896 unsigned long size);
896unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 897void zap_page_range(struct vm_area_struct *vma, unsigned long address,
897 unsigned long size, struct zap_details *); 898 unsigned long size, struct zap_details *);
898unsigned long unmap_vmas(struct mmu_gather *tlb, 899void unmap_vmas(struct mmu_gather *tlb,
899 struct vm_area_struct *start_vma, unsigned long start_addr, 900 struct vm_area_struct *start_vma, unsigned long start_addr,
900 unsigned long end_addr, unsigned long *nr_accounted, 901 unsigned long end_addr, unsigned long *nr_accounted,
901 struct zap_details *); 902 struct zap_details *);
@@ -1040,6 +1041,9 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma,
1040 !vma_growsup(vma->vm_next, addr); 1041 !vma_growsup(vma->vm_next, addr);
1041} 1042}
1042 1043
1044extern pid_t
1045vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group);
1046
1043extern unsigned long move_page_tables(struct vm_area_struct *vma, 1047extern unsigned long move_page_tables(struct vm_area_struct *vma,
1044 unsigned long old_addr, struct vm_area_struct *new_vma, 1048 unsigned long old_addr, struct vm_area_struct *new_vma,
1045 unsigned long new_addr, unsigned long len); 1049 unsigned long new_addr, unsigned long len);
@@ -1058,19 +1062,20 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
1058/* 1062/*
1059 * per-process(per-mm_struct) statistics. 1063 * per-process(per-mm_struct) statistics.
1060 */ 1064 */
1061static inline void set_mm_counter(struct mm_struct *mm, int member, long value)
1062{
1063 atomic_long_set(&mm->rss_stat.count[member], value);
1064}
1065
1066#if defined(SPLIT_RSS_COUNTING)
1067unsigned long get_mm_counter(struct mm_struct *mm, int member);
1068#else
1069static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) 1065static inline unsigned long get_mm_counter(struct mm_struct *mm, int member)
1070{ 1066{
1071 return atomic_long_read(&mm->rss_stat.count[member]); 1067 long val = atomic_long_read(&mm->rss_stat.count[member]);
1072} 1068
1069#ifdef SPLIT_RSS_COUNTING
1070 /*
1071 * counter is updated in asynchronous manner and may go to minus.
1072 * But it's never be expected number for users.
1073 */
1074 if (val < 0)
1075 val = 0;
1073#endif 1076#endif
1077 return (unsigned long)val;
1078}
1074 1079
1075static inline void add_mm_counter(struct mm_struct *mm, int member, long value) 1080static inline void add_mm_counter(struct mm_struct *mm, int member, long value)
1076{ 1081{
@@ -1127,9 +1132,9 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss,
1127} 1132}
1128 1133
1129#if defined(SPLIT_RSS_COUNTING) 1134#if defined(SPLIT_RSS_COUNTING)
1130void sync_mm_rss(struct task_struct *task, struct mm_struct *mm); 1135void sync_mm_rss(struct mm_struct *mm);
1131#else 1136#else
1132static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm) 1137static inline void sync_mm_rss(struct mm_struct *mm)
1133{ 1138{
1134} 1139}
1135#endif 1140#endif
@@ -1291,8 +1296,6 @@ extern void get_pfn_range_for_nid(unsigned int nid,
1291extern unsigned long find_min_pfn_with_active_regions(void); 1296extern unsigned long find_min_pfn_with_active_regions(void);
1292extern void free_bootmem_with_active_regions(int nid, 1297extern void free_bootmem_with_active_regions(int nid,
1293 unsigned long max_low_pfn); 1298 unsigned long max_low_pfn);
1294int add_from_early_node_map(struct range *range, int az,
1295 int nr_range, int nid);
1296extern void sparse_memory_present_with_active_regions(int nid); 1299extern void sparse_memory_present_with_active_regions(int nid);
1297 1300
1298#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ 1301#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
@@ -1598,9 +1601,9 @@ void vmemmap_populate_print_last(void);
1598 1601
1599enum mf_flags { 1602enum mf_flags {
1600 MF_COUNT_INCREASED = 1 << 0, 1603 MF_COUNT_INCREASED = 1 << 0,
1604 MF_ACTION_REQUIRED = 1 << 1,
1601}; 1605};
1602extern void memory_failure(unsigned long pfn, int trapno); 1606extern int memory_failure(unsigned long pfn, int trapno, int flags);
1603extern int __memory_failure(unsigned long pfn, int trapno, int flags);
1604extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); 1607extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
1605extern int unpoison_memory(unsigned long pfn); 1608extern int unpoison_memory(unsigned long pfn);
1606extern int sysctl_memory_failure_early_kill; 1609extern int sysctl_memory_failure_early_kill;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 19a41d1737af..6faa145c81e3 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -10,6 +10,7 @@
10#ifndef LINUX_MMC_CARD_H 10#ifndef LINUX_MMC_CARD_H
11#define LINUX_MMC_CARD_H 11#define LINUX_MMC_CARD_H
12 12
13#include <linux/device.h>
13#include <linux/mmc/core.h> 14#include <linux/mmc/core.h>
14#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
15 16
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 87a976cc5654..2e6a681fceb2 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -9,7 +9,7 @@
9#define LINUX_MMC_CORE_H 9#define LINUX_MMC_CORE_H
10 10
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/device.h> 12#include <linux/completion.h>
13 13
14struct request; 14struct request;
15struct mmc_data; 15struct mmc_data;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ee2b0363c040..91924e8c642b 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/device.h>
15#include <linux/fault-inject.h> 16#include <linux/fault-inject.h>
16 17
17#include <linux/mmc/core.h> 18#include <linux/mmc/core.h>
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h
index 8fa5bc5f8059..1f5e68923929 100644
--- a/include/linux/mmc/ioctl.h
+++ b/include/linux/mmc/ioctl.h
@@ -1,5 +1,8 @@
1#ifndef LINUX_MMC_IOCTL_H 1#ifndef LINUX_MMC_IOCTL_H
2#define LINUX_MMC_IOCTL_H 2#define LINUX_MMC_IOCTL_H
3
4#include <linux/types.h>
5
3struct mmc_ioc_cmd { 6struct mmc_ioc_cmd {
4 /* Implies direction of data. true = write, false = read */ 7 /* Implies direction of data. true = write, false = read */
5 int write_flag; 8 int write_flag;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 650ba2fb3301..dff711509661 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -365,6 +365,7 @@ struct zone {
365 */ 365 */
366 unsigned int compact_considered; 366 unsigned int compact_considered;
367 unsigned int compact_defer_shift; 367 unsigned int compact_defer_shift;
368 int compact_order_failed;
368#endif 369#endif
369 370
370 ZONE_PADDING(_pad1_) 371 ZONE_PADDING(_pad1_)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 83ac0713ed0a..501da4cb8a6d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -414,6 +414,15 @@ struct hv_vmbus_device_id {
414 __attribute__((aligned(sizeof(kernel_ulong_t)))); 414 __attribute__((aligned(sizeof(kernel_ulong_t))));
415}; 415};
416 416
417/* rpmsg */
418
419#define RPMSG_NAME_SIZE 32
420#define RPMSG_DEVICE_MODALIAS_FMT "rpmsg:%s"
421
422struct rpmsg_device_id {
423 char name[RPMSG_NAME_SIZE];
424};
425
417/* i2c */ 426/* i2c */
418 427
419#define I2C_NAME_SIZE 20 428#define I2C_NAME_SIZE 20
@@ -560,4 +569,25 @@ struct amba_id {
560#endif 569#endif
561}; 570};
562 571
572/*
573 * Match x86 CPUs for CPU specific drivers.
574 * See documentation of "x86_match_cpu" for details.
575 */
576
577struct x86_cpu_id {
578 __u16 vendor;
579 __u16 family;
580 __u16 model;
581 __u16 feature; /* bit index */
582 kernel_ulong_t driver_data;
583};
584
585#define X86_FEATURE_MATCH(x) \
586 { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
587
588#define X86_VENDOR_ANY 0xffff
589#define X86_FAMILY_ANY 0
590#define X86_MODEL_ANY 0
591#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
592
563#endif /* LINUX_MOD_DEVICETABLE_H */ 593#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d5d2ec6494bb..37ef6b194089 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/bug.h>
25#include <linux/interrupt.h> 26#include <linux/interrupt.h>
26#include <linux/mtd/flashchip.h> 27#include <linux/mtd/flashchip.h>
27#include <linux/mtd/map.h> 28#include <linux/mtd/map.h>
diff --git a/include/linux/net.h b/include/linux/net.h
index b29923006b11..be60c7f5e145 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -206,6 +206,7 @@ struct proto_ops {
206 int offset, size_t size, int flags); 206 int offset, size_t size, int flags);
207 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, 207 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
208 struct pipe_inode_info *pipe, size_t len, unsigned int flags); 208 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
209 void (*set_peek_off)(struct sock *sk, int val);
209}; 210};
210 211
211#define DECLARE_SOCKADDR(type, dst, src) \ 212#define DECLARE_SOCKADDR(type, dst, src) \
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 77f5202977ce..5ac32123035a 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -54,6 +54,8 @@ enum {
54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ 54 NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */
55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ 55 NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */
56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */ 56 NETIF_F_LOOPBACK_BIT, /* Enable loopback */
57 NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */
58 NETIF_F_RXALL_BIT, /* Receive errored frames too */
57 59
58 /* 60 /*
59 * Add your fresh new feature above and remember to update 61 * Add your fresh new feature above and remember to update
@@ -98,6 +100,8 @@ enum {
98#define NETIF_F_TSO __NETIF_F(TSO) 100#define NETIF_F_TSO __NETIF_F(TSO)
99#define NETIF_F_UFO __NETIF_F(UFO) 101#define NETIF_F_UFO __NETIF_F(UFO)
100#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)
104#define NETIF_F_RXALL __NETIF_F(RXALL)
101 105
102/* Features valid for ethtool to change */ 106/* Features valid for ethtool to change */
103/* = all defined minus driver/device-class-related */ 107/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0eac07c95255..1f77540bdc95 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -33,12 +33,12 @@
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34#include <linux/pm_qos.h> 34#include <linux/pm_qos.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <linux/bug.h>
36#include <linux/delay.h> 37#include <linux/delay.h>
37#include <linux/atomic.h> 38#include <linux/atomic.h>
38#include <asm/cache.h> 39#include <asm/cache.h>
39#include <asm/byteorder.h> 40#include <asm/byteorder.h>
40 41
41#include <linux/device.h>
42#include <linux/percpu.h> 42#include <linux/percpu.h>
43#include <linux/rculist.h> 43#include <linux/rculist.h>
44#include <linux/dmaengine.h> 44#include <linux/dmaengine.h>
@@ -56,6 +56,7 @@
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57 57
58struct netpoll_info; 58struct netpoll_info;
59struct device;
59struct phy_device; 60struct phy_device;
60/* 802.11 specific */ 61/* 802.11 specific */
61struct wireless_dev; 62struct wireless_dev;
@@ -214,8 +215,8 @@ enum {
214#include <linux/skbuff.h> 215#include <linux/skbuff.h>
215 216
216#ifdef CONFIG_RPS 217#ifdef CONFIG_RPS
217#include <linux/jump_label.h> 218#include <linux/static_key.h>
218extern struct jump_label_key rps_needed; 219extern struct static_key rps_needed;
219#endif 220#endif
220 221
221struct neighbour; 222struct neighbour;
@@ -417,7 +418,7 @@ typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
417 418
418extern void __napi_schedule(struct napi_struct *n); 419extern void __napi_schedule(struct napi_struct *n);
419 420
420static inline int napi_disable_pending(struct napi_struct *n) 421static inline bool napi_disable_pending(struct napi_struct *n)
421{ 422{
422 return test_bit(NAPI_STATE_DISABLE, &n->state); 423 return test_bit(NAPI_STATE_DISABLE, &n->state);
423} 424}
@@ -431,7 +432,7 @@ static inline int napi_disable_pending(struct napi_struct *n)
431 * insure only one NAPI poll instance runs. We also make 432 * insure only one NAPI poll instance runs. We also make
432 * sure there is no pending NAPI disable. 433 * sure there is no pending NAPI disable.
433 */ 434 */
434static inline int napi_schedule_prep(struct napi_struct *n) 435static inline bool napi_schedule_prep(struct napi_struct *n)
435{ 436{
436 return !napi_disable_pending(n) && 437 return !napi_disable_pending(n) &&
437 !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 438 !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
@@ -451,13 +452,13 @@ static inline void napi_schedule(struct napi_struct *n)
451} 452}
452 453
453/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ 454/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
454static inline int napi_reschedule(struct napi_struct *napi) 455static inline bool napi_reschedule(struct napi_struct *napi)
455{ 456{
456 if (napi_schedule_prep(napi)) { 457 if (napi_schedule_prep(napi)) {
457 __napi_schedule(napi); 458 __napi_schedule(napi);
458 return 1; 459 return true;
459 } 460 }
460 return 0; 461 return false;
461} 462}
462 463
463/** 464/**
@@ -1082,7 +1083,8 @@ struct net_device {
1082 const struct header_ops *header_ops; 1083 const struct header_ops *header_ops;
1083 1084
1084 unsigned int flags; /* interface flags (a la BSD) */ 1085 unsigned int flags; /* interface flags (a la BSD) */
1085 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ 1086 unsigned int priv_flags; /* Like 'flags' but invisible to userspace.
1087 * See if.h for definitions. */
1086 unsigned short gflags; 1088 unsigned short gflags;
1087 unsigned short padded; /* How much padding added by alloc_netdev() */ 1089 unsigned short padded; /* How much padding added by alloc_netdev() */
1088 1090
@@ -1867,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev)
1867 } 1869 }
1868} 1870}
1869 1871
1870static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) 1872static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1871{ 1873{
1872 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); 1874 return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
1873} 1875}
@@ -1878,17 +1880,17 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
1878 * 1880 *
1879 * Test if transmit queue on device is currently unable to send. 1881 * Test if transmit queue on device is currently unable to send.
1880 */ 1882 */
1881static inline int netif_queue_stopped(const struct net_device *dev) 1883static inline bool netif_queue_stopped(const struct net_device *dev)
1882{ 1884{
1883 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1885 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1884} 1886}
1885 1887
1886static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue) 1888static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
1887{ 1889{
1888 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 1890 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
1889} 1891}
1890 1892
1891static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 1893static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
1892{ 1894{
1893 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 1895 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
1894} 1896}
@@ -1898,12 +1900,22 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
1898{ 1900{
1899#ifdef CONFIG_BQL 1901#ifdef CONFIG_BQL
1900 dql_queued(&dev_queue->dql, bytes); 1902 dql_queued(&dev_queue->dql, bytes);
1901 if (unlikely(dql_avail(&dev_queue->dql) < 0)) { 1903
1902 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); 1904 if (likely(dql_avail(&dev_queue->dql) >= 0))
1903 if (unlikely(dql_avail(&dev_queue->dql) >= 0)) 1905 return;
1904 clear_bit(__QUEUE_STATE_STACK_XOFF, 1906
1905 &dev_queue->state); 1907 set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1906 } 1908
1909 /*
1910 * The XOFF flag must be set before checking the dql_avail below,
1911 * because in netdev_tx_completed_queue we update the dql_completed
1912 * before checking the XOFF flag.
1913 */
1914 smp_mb();
1915
1916 /* check again in case another CPU has just made room avail */
1917 if (unlikely(dql_avail(&dev_queue->dql) >= 0))
1918 clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state);
1907#endif 1919#endif
1908} 1920}
1909 1921
@@ -1916,16 +1928,23 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1916 unsigned pkts, unsigned bytes) 1928 unsigned pkts, unsigned bytes)
1917{ 1929{
1918#ifdef CONFIG_BQL 1930#ifdef CONFIG_BQL
1919 if (likely(bytes)) { 1931 if (unlikely(!bytes))
1920 dql_completed(&dev_queue->dql, bytes); 1932 return;
1921 if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF, 1933
1922 &dev_queue->state) && 1934 dql_completed(&dev_queue->dql, bytes);
1923 dql_avail(&dev_queue->dql) >= 0)) { 1935
1924 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, 1936 /*
1925 &dev_queue->state)) 1937 * Without the memory barrier there is a small possiblity that
1926 netif_schedule_queue(dev_queue); 1938 * netdev_tx_sent_queue will miss the update and cause the queue to
1927 } 1939 * be stopped forever
1928 } 1940 */
1941 smp_mb();
1942
1943 if (dql_avail(&dev_queue->dql) < 0)
1944 return;
1945
1946 if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state))
1947 netif_schedule_queue(dev_queue);
1929#endif 1948#endif
1930} 1949}
1931 1950
@@ -1938,6 +1957,7 @@ static inline void netdev_completed_queue(struct net_device *dev,
1938static inline void netdev_tx_reset_queue(struct netdev_queue *q) 1957static inline void netdev_tx_reset_queue(struct netdev_queue *q)
1939{ 1958{
1940#ifdef CONFIG_BQL 1959#ifdef CONFIG_BQL
1960 clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state);
1941 dql_reset(&q->dql); 1961 dql_reset(&q->dql);
1942#endif 1962#endif
1943} 1963}
@@ -1953,7 +1973,7 @@ static inline void netdev_reset_queue(struct net_device *dev_queue)
1953 * 1973 *
1954 * Test if the device has been brought up. 1974 * Test if the device has been brought up.
1955 */ 1975 */
1956static inline int netif_running(const struct net_device *dev) 1976static inline bool netif_running(const struct net_device *dev)
1957{ 1977{
1958 return test_bit(__LINK_STATE_START, &dev->state); 1978 return test_bit(__LINK_STATE_START, &dev->state);
1959} 1979}
@@ -2003,16 +2023,16 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
2003 * 2023 *
2004 * Check individual transmit queue of a device with multiple transmit queues. 2024 * Check individual transmit queue of a device with multiple transmit queues.
2005 */ 2025 */
2006static inline int __netif_subqueue_stopped(const struct net_device *dev, 2026static inline bool __netif_subqueue_stopped(const struct net_device *dev,
2007 u16 queue_index) 2027 u16 queue_index)
2008{ 2028{
2009 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2029 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2010 2030
2011 return netif_tx_queue_stopped(txq); 2031 return netif_tx_queue_stopped(txq);
2012} 2032}
2013 2033
2014static inline int netif_subqueue_stopped(const struct net_device *dev, 2034static inline bool netif_subqueue_stopped(const struct net_device *dev,
2015 struct sk_buff *skb) 2035 struct sk_buff *skb)
2016{ 2036{
2017 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); 2037 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
2018} 2038}
@@ -2051,7 +2071,7 @@ static inline u16 skb_tx_hash(const struct net_device *dev,
2051 * 2071 *
2052 * Check if device has multiple transmit queues 2072 * Check if device has multiple transmit queues
2053 */ 2073 */
2054static inline int netif_is_multiqueue(const struct net_device *dev) 2074static inline bool netif_is_multiqueue(const struct net_device *dev)
2055{ 2075{
2056 return dev->num_tx_queues > 1; 2076 return dev->num_tx_queues > 1;
2057} 2077}
@@ -2121,7 +2141,7 @@ extern int netdev_rx_handler_register(struct net_device *dev,
2121 void *rx_handler_data); 2141 void *rx_handler_data);
2122extern void netdev_rx_handler_unregister(struct net_device *dev); 2142extern void netdev_rx_handler_unregister(struct net_device *dev);
2123 2143
2124extern int dev_valid_name(const char *name); 2144extern bool dev_valid_name(const char *name);
2125extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2145extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2126extern int dev_ethtool(struct net *net, struct ifreq *); 2146extern int dev_ethtool(struct net *net, struct ifreq *);
2127extern unsigned dev_get_flags(const struct net_device *); 2147extern unsigned dev_get_flags(const struct net_device *);
@@ -2187,7 +2207,7 @@ extern void linkwatch_forget_dev(struct net_device *dev);
2187 * 2207 *
2188 * Check if carrier is present on device 2208 * Check if carrier is present on device
2189 */ 2209 */
2190static inline int netif_carrier_ok(const struct net_device *dev) 2210static inline bool netif_carrier_ok(const struct net_device *dev)
2191{ 2211{
2192 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 2212 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
2193} 2213}
@@ -2239,7 +2259,7 @@ static inline void netif_dormant_off(struct net_device *dev)
2239 * 2259 *
2240 * Check if carrier is present on device 2260 * Check if carrier is present on device
2241 */ 2261 */
2242static inline int netif_dormant(const struct net_device *dev) 2262static inline bool netif_dormant(const struct net_device *dev)
2243{ 2263{
2244 return test_bit(__LINK_STATE_DORMANT, &dev->state); 2264 return test_bit(__LINK_STATE_DORMANT, &dev->state);
2245} 2265}
@@ -2251,7 +2271,7 @@ static inline int netif_dormant(const struct net_device *dev)
2251 * 2271 *
2252 * Check if carrier is operational 2272 * Check if carrier is operational
2253 */ 2273 */
2254static inline int netif_oper_up(const struct net_device *dev) 2274static inline bool netif_oper_up(const struct net_device *dev)
2255{ 2275{
2256 return (dev->operstate == IF_OPER_UP || 2276 return (dev->operstate == IF_OPER_UP ||
2257 dev->operstate == IF_OPER_UNKNOWN /* backward compat */); 2277 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
@@ -2263,7 +2283,7 @@ static inline int netif_oper_up(const struct net_device *dev)
2263 * 2283 *
2264 * Check if device has not been removed from system. 2284 * Check if device has not been removed from system.
2265 */ 2285 */
2266static inline int netif_device_present(struct net_device *dev) 2286static inline bool netif_device_present(struct net_device *dev)
2267{ 2287{
2268 return test_bit(__LINK_STATE_PRESENT, &dev->state); 2288 return test_bit(__LINK_STATE_PRESENT, &dev->state);
2269} 2289}
@@ -2333,9 +2353,9 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
2333 txq->xmit_lock_owner = smp_processor_id(); 2353 txq->xmit_lock_owner = smp_processor_id();
2334} 2354}
2335 2355
2336static inline int __netif_tx_trylock(struct netdev_queue *txq) 2356static inline bool __netif_tx_trylock(struct netdev_queue *txq)
2337{ 2357{
2338 int ok = spin_trylock(&txq->_xmit_lock); 2358 bool ok = spin_trylock(&txq->_xmit_lock);
2339 if (likely(ok)) 2359 if (likely(ok))
2340 txq->xmit_lock_owner = smp_processor_id(); 2360 txq->xmit_lock_owner = smp_processor_id();
2341 return ok; 2361 return ok;
@@ -2556,6 +2576,8 @@ extern void dev_load(struct net *net, const char *name);
2556extern void dev_mcast_init(void); 2576extern void dev_mcast_init(void);
2557extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2577extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2558 struct rtnl_link_stats64 *storage); 2578 struct rtnl_link_stats64 *storage);
2579extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
2580 const struct net_device_stats *netdev_stats);
2559 2581
2560extern int netdev_max_backlog; 2582extern int netdev_max_backlog;
2561extern int netdev_tstamp_prequeue; 2583extern int netdev_tstamp_prequeue;
@@ -2611,7 +2633,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2611 2633
2612netdev_features_t netif_skb_features(struct sk_buff *skb); 2634netdev_features_t netif_skb_features(struct sk_buff *skb);
2613 2635
2614static inline int net_gso_ok(netdev_features_t features, int gso_type) 2636static inline bool net_gso_ok(netdev_features_t features, int gso_type)
2615{ 2637{
2616 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; 2638 netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
2617 2639
@@ -2626,17 +2648,18 @@ static inline int net_gso_ok(netdev_features_t features, int gso_type)
2626 return (features & feature) == feature; 2648 return (features & feature) == feature;
2627} 2649}
2628 2650
2629static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features) 2651static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
2630{ 2652{
2631 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2653 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2632 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2654 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2633} 2655}
2634 2656
2635static inline int netif_needs_gso(struct sk_buff *skb, 2657static inline bool netif_needs_gso(struct sk_buff *skb,
2636 netdev_features_t features) 2658 netdev_features_t features)
2637{ 2659{
2638 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 2660 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2639 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2661 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
2662 (skb->ip_summed != CHECKSUM_UNNECESSARY)));
2640} 2663}
2641 2664
2642static inline void netif_set_gso_max_size(struct net_device *dev, 2665static inline void netif_set_gso_max_size(struct net_device *dev,
@@ -2645,11 +2668,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2645 dev->gso_max_size = size; 2668 dev->gso_max_size = size;
2646} 2669}
2647 2670
2648static inline int netif_is_bond_slave(struct net_device *dev) 2671static inline bool netif_is_bond_slave(struct net_device *dev)
2649{ 2672{
2650 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 2673 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2651} 2674}
2652 2675
2676static inline bool netif_supports_nofcs(struct net_device *dev)
2677{
2678 return dev->priv_flags & IFF_SUPP_NOFCS;
2679}
2680
2653extern struct pernet_operations __net_initdata loopback_net_ops; 2681extern struct pernet_operations __net_initdata loopback_net_ops;
2654 2682
2655/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2683/* Logging, debugging and troubleshooting/diagnostic helpers. */
@@ -2687,14 +2715,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...);
2687#define MODULE_ALIAS_NETDEV(device) \ 2715#define MODULE_ALIAS_NETDEV(device) \
2688 MODULE_ALIAS("netdev-" device) 2716 MODULE_ALIAS("netdev-" device)
2689 2717
2690#if defined(DEBUG) 2718#if defined(CONFIG_DYNAMIC_DEBUG)
2691#define netdev_dbg(__dev, format, args...) \
2692 netdev_printk(KERN_DEBUG, __dev, format, ##args)
2693#elif defined(CONFIG_DYNAMIC_DEBUG)
2694#define netdev_dbg(__dev, format, args...) \ 2719#define netdev_dbg(__dev, format, args...) \
2695do { \ 2720do { \
2696 dynamic_netdev_dbg(__dev, format, ##args); \ 2721 dynamic_netdev_dbg(__dev, format, ##args); \
2697} while (0) 2722} while (0)
2723#elif defined(DEBUG)
2724#define netdev_dbg(__dev, format, args...) \
2725 netdev_printk(KERN_DEBUG, __dev, format, ##args)
2698#else 2726#else
2699#define netdev_dbg(__dev, format, args...) \ 2727#define netdev_dbg(__dev, format, args...) \
2700({ \ 2728({ \
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index b809265607d0..29734be334c1 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -163,13 +163,13 @@ extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 164
165#if defined(CONFIG_JUMP_LABEL) 165#if defined(CONFIG_JUMP_LABEL)
166#include <linux/jump_label.h> 166#include <linux/static_key.h>
167extern struct jump_label_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 167extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook) 168static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
169{ 169{
170 if (__builtin_constant_p(pf) && 170 if (__builtin_constant_p(pf) &&
171 __builtin_constant_p(hook)) 171 __builtin_constant_p(hook))
172 return static_branch(&nf_hooks_needed[pf][hook]); 172 return static_key_false(&nf_hooks_needed[pf][hook]);
173 173
174 return !list_empty(&nf_hooks[pf][hook]); 174 return !list_empty(&nf_hooks[pf][hook]);
175} 175}
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index e144f54185c0..1697036336b6 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -10,6 +10,7 @@ header-y += nfnetlink.h
10header-y += nfnetlink_acct.h 10header-y += nfnetlink_acct.h
11header-y += nfnetlink_compat.h 11header-y += nfnetlink_compat.h
12header-y += nfnetlink_conntrack.h 12header-y += nfnetlink_conntrack.h
13header-y += nfnetlink_cttimeout.h
13header-y += nfnetlink_log.h 14header-y += nfnetlink_log.h
14header-y += nfnetlink_queue.h 15header-y += nfnetlink_queue.h
15header-y += x_tables.h 16header-y += x_tables.h
@@ -22,6 +23,7 @@ header-y += xt_CT.h
22header-y += xt_DSCP.h 23header-y += xt_DSCP.h
23header-y += xt_IDLETIMER.h 24header-y += xt_IDLETIMER.h
24header-y += xt_LED.h 25header-y += xt_LED.h
26header-y += xt_LOG.h
25header-y += xt_MARK.h 27header-y += xt_MARK.h
26header-y += xt_nfacct.h 28header-y += xt_nfacct.h
27header-y += xt_NFLOG.h 29header-y += xt_NFLOG.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 3540c6e262f7..2f8e18a23227 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -11,6 +11,8 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14#include <linux/types.h>
15
14/* The protocol version */ 16/* The protocol version */
15#define IPSET_PROTOCOL 6 17#define IPSET_PROTOCOL 6
16 18
@@ -148,6 +150,7 @@ enum ipset_cmd_flags {
148 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), 150 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
149 IPSET_FLAG_BIT_LIST_HEADER = 2, 151 IPSET_FLAG_BIT_LIST_HEADER = 2,
150 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), 152 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
153 IPSET_FLAG_CMD_MAX = 15, /* Lower half */
151}; 154};
152 155
153/* Flags at CADT attribute level */ 156/* Flags at CADT attribute level */
@@ -156,6 +159,9 @@ enum ipset_cadt_flags {
156 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), 159 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
157 IPSET_FLAG_BIT_PHYSDEV = 1, 160 IPSET_FLAG_BIT_PHYSDEV = 1,
158 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), 161 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
162 IPSET_FLAG_BIT_NOMATCH = 2,
163 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
164 IPSET_FLAG_CADT_MAX = 15, /* Upper half */
159}; 165};
160 166
161/* Commands with settype-specific attributes */ 167/* Commands with settype-specific attributes */
@@ -168,19 +174,10 @@ enum ipset_adt {
168 IPSET_CADT_MAX, 174 IPSET_CADT_MAX,
169}; 175};
170 176
171#ifdef __KERNEL__
172#include <linux/ip.h>
173#include <linux/ipv6.h>
174#include <linux/netlink.h>
175#include <linux/netfilter.h>
176#include <linux/netfilter/x_tables.h>
177#include <linux/vmalloc.h>
178#include <net/netlink.h>
179
180/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t 177/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
181 * and IPSET_INVALID_ID if you want to increase the max number of sets. 178 * and IPSET_INVALID_ID if you want to increase the max number of sets.
182 */ 179 */
183typedef u16 ip_set_id_t; 180typedef __u16 ip_set_id_t;
184 181
185#define IPSET_INVALID_ID 65535 182#define IPSET_INVALID_ID 65535
186 183
@@ -203,6 +200,15 @@ enum ip_set_kopt {
203 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), 200 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
204}; 201};
205 202
203#ifdef __KERNEL__
204#include <linux/ip.h>
205#include <linux/ipv6.h>
206#include <linux/netlink.h>
207#include <linux/netfilter.h>
208#include <linux/netfilter/x_tables.h>
209#include <linux/vmalloc.h>
210#include <net/netlink.h>
211
206/* Set features */ 212/* Set features */
207enum ip_set_feature { 213enum ip_set_feature {
208 IPSET_TYPE_IP_FLAG = 0, 214 IPSET_TYPE_IP_FLAG = 0,
@@ -288,7 +294,10 @@ struct ip_set_type {
288 u8 features; 294 u8 features;
289 /* Set type dimension */ 295 /* Set type dimension */
290 u8 dimension; 296 u8 dimension;
291 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ 297 /*
298 * Supported family: may be NFPROTO_UNSPEC for both
299 * NFPROTO_IPV4/NFPROTO_IPV6.
300 */
292 u8 family; 301 u8 family;
293 /* Type revisions */ 302 /* Type revisions */
294 u8 revision_min, revision_max; 303 u8 revision_min, revision_max;
@@ -450,6 +459,8 @@ bitmap_bytes(u32 a, u32 b)
450 return 4 * ((((b - a + 8) / 8) + 3) / 4); 459 return 4 * ((((b - a + 8) / 8) + 3) / 4);
451} 460}
452 461
462#endif /* __KERNEL__ */
463
453/* Interface to iptables/ip6tables */ 464/* Interface to iptables/ip6tables */
454 465
455#define SO_IP_SET 83 466#define SO_IP_SET 83
@@ -475,6 +486,4 @@ struct ip_set_req_version {
475 unsigned version; 486 unsigned version;
476}; 487};
477 488
478#endif /* __KERNEL__ */
479
480#endif /*_IP_SET_H */ 489#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index b89fb79cb44f..05a5d72680be 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -113,6 +113,12 @@ htable_bits(u32 hashsize)
113} 113}
114 114
115#ifdef IP_SET_HASH_WITH_NETS 115#ifdef IP_SET_HASH_WITH_NETS
116#ifdef IP_SET_HASH_WITH_NETS_PACKED
117/* When cidr is packed with nomatch, cidr - 1 is stored in the entry */
118#define CIDR(cidr) (cidr + 1)
119#else
120#define CIDR(cidr) (cidr)
121#endif
116 122
117#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) 123#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
118 124
@@ -262,6 +268,12 @@ ip_set_hash_destroy(struct ip_set *set)
262#define type_pf_data_list TOKEN(TYPE, PF, _data_list) 268#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
263#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) 269#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
264#define type_pf_data_next TOKEN(TYPE, PF, _data_next) 270#define type_pf_data_next TOKEN(TYPE, PF, _data_next)
271#define type_pf_data_flags TOKEN(TYPE, PF, _data_flags)
272#ifdef IP_SET_HASH_WITH_NETS
273#define type_pf_data_match TOKEN(TYPE, PF, _data_match)
274#else
275#define type_pf_data_match(d) 1
276#endif
265 277
266#define type_pf_elem TOKEN(TYPE, PF, _elem) 278#define type_pf_elem TOKEN(TYPE, PF, _elem)
267#define type_pf_telem TOKEN(TYPE, PF, _telem) 279#define type_pf_telem TOKEN(TYPE, PF, _telem)
@@ -308,8 +320,10 @@ ip_set_hash_destroy(struct ip_set *set)
308 * we spare the maintenance of the internal counters. */ 320 * we spare the maintenance of the internal counters. */
309static int 321static int
310type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, 322type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
311 u8 ahash_max) 323 u8 ahash_max, u32 cadt_flags)
312{ 324{
325 struct type_pf_elem *data;
326
313 if (n->pos >= n->size) { 327 if (n->pos >= n->size) {
314 void *tmp; 328 void *tmp;
315 329
@@ -330,7 +344,13 @@ type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
330 n->value = tmp; 344 n->value = tmp;
331 n->size += AHASH_INIT_SIZE; 345 n->size += AHASH_INIT_SIZE;
332 } 346 }
333 type_pf_data_copy(ahash_data(n, n->pos++), value); 347 data = ahash_data(n, n->pos++);
348 type_pf_data_copy(data, value);
349#ifdef IP_SET_HASH_WITH_NETS
350 /* Resizing won't overwrite stored flags */
351 if (cadt_flags)
352 type_pf_data_flags(data, cadt_flags);
353#endif
334 return 0; 354 return 0;
335} 355}
336 356
@@ -353,9 +373,12 @@ retry:
353 htable_bits++; 373 htable_bits++;
354 pr_debug("attempt to resize set %s from %u to %u, t %p\n", 374 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
355 set->name, orig->htable_bits, htable_bits, orig); 375 set->name, orig->htable_bits, htable_bits, orig);
356 if (!htable_bits) 376 if (!htable_bits) {
357 /* In case we have plenty of memory :-) */ 377 /* In case we have plenty of memory :-) */
378 pr_warning("Cannot increase the hashsize of set %s further\n",
379 set->name);
358 return -IPSET_ERR_HASH_FULL; 380 return -IPSET_ERR_HASH_FULL;
381 }
359 t = ip_set_alloc(sizeof(*t) 382 t = ip_set_alloc(sizeof(*t)
360 + jhash_size(htable_bits) * sizeof(struct hbucket)); 383 + jhash_size(htable_bits) * sizeof(struct hbucket));
361 if (!t) 384 if (!t)
@@ -368,7 +391,7 @@ retry:
368 for (j = 0; j < n->pos; j++) { 391 for (j = 0; j < n->pos; j++) {
369 data = ahash_data(n, j); 392 data = ahash_data(n, j);
370 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 393 m = hbucket(t, HKEY(data, h->initval, htable_bits));
371 ret = type_pf_elem_add(m, data, AHASH_MAX(h)); 394 ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0);
372 if (ret < 0) { 395 if (ret < 0) {
373 read_unlock_bh(&set->lock); 396 read_unlock_bh(&set->lock);
374 ahash_destroy(t); 397 ahash_destroy(t);
@@ -406,9 +429,14 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
406 struct hbucket *n; 429 struct hbucket *n;
407 int i, ret = 0; 430 int i, ret = 0;
408 u32 key, multi = 0; 431 u32 key, multi = 0;
432 u32 cadt_flags = flags >> 16;
409 433
410 if (h->elements >= h->maxelem) 434 if (h->elements >= h->maxelem) {
435 if (net_ratelimit())
436 pr_warning("Set %s is full, maxelem %u reached\n",
437 set->name, h->maxelem);
411 return -IPSET_ERR_HASH_FULL; 438 return -IPSET_ERR_HASH_FULL;
439 }
412 440
413 rcu_read_lock_bh(); 441 rcu_read_lock_bh();
414 t = rcu_dereference_bh(h->table); 442 t = rcu_dereference_bh(h->table);
@@ -416,11 +444,17 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
416 n = hbucket(t, key); 444 n = hbucket(t, key);
417 for (i = 0; i < n->pos; i++) 445 for (i = 0; i < n->pos; i++)
418 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { 446 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) {
447#ifdef IP_SET_HASH_WITH_NETS
448 if (flags & IPSET_FLAG_EXIST)
449 /* Support overwriting just the flags */
450 type_pf_data_flags(ahash_data(n, i),
451 cadt_flags);
452#endif
419 ret = -IPSET_ERR_EXIST; 453 ret = -IPSET_ERR_EXIST;
420 goto out; 454 goto out;
421 } 455 }
422 TUNE_AHASH_MAX(h, multi); 456 TUNE_AHASH_MAX(h, multi);
423 ret = type_pf_elem_add(n, value, AHASH_MAX(h)); 457 ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags);
424 if (ret != 0) { 458 if (ret != 0) {
425 if (ret == -EAGAIN) 459 if (ret == -EAGAIN)
426 type_pf_data_next(h, d); 460 type_pf_data_next(h, d);
@@ -428,7 +462,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
428 } 462 }
429 463
430#ifdef IP_SET_HASH_WITH_NETS 464#ifdef IP_SET_HASH_WITH_NETS
431 add_cidr(h, d->cidr, HOST_MASK); 465 add_cidr(h, CIDR(d->cidr), HOST_MASK);
432#endif 466#endif
433 h->elements++; 467 h->elements++;
434out: 468out:
@@ -463,7 +497,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
463 n->pos--; 497 n->pos--;
464 h->elements--; 498 h->elements--;
465#ifdef IP_SET_HASH_WITH_NETS 499#ifdef IP_SET_HASH_WITH_NETS
466 del_cidr(h, d->cidr, HOST_MASK); 500 del_cidr(h, CIDR(d->cidr), HOST_MASK);
467#endif 501#endif
468 if (n->pos + AHASH_INIT_SIZE < n->size) { 502 if (n->pos + AHASH_INIT_SIZE < n->size) {
469 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 503 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -506,7 +540,7 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
506 for (i = 0; i < n->pos; i++) { 540 for (i = 0; i < n->pos; i++) {
507 data = ahash_data(n, i); 541 data = ahash_data(n, i);
508 if (type_pf_data_equal(data, d, &multi)) 542 if (type_pf_data_equal(data, d, &multi))
509 return 1; 543 return type_pf_data_match(data);
510 } 544 }
511 } 545 }
512 return 0; 546 return 0;
@@ -528,7 +562,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
528#ifdef IP_SET_HASH_WITH_NETS 562#ifdef IP_SET_HASH_WITH_NETS
529 /* If we test an IP address and not a network address, 563 /* If we test an IP address and not a network address,
530 * try all possible network sizes */ 564 * try all possible network sizes */
531 if (d->cidr == SET_HOST_MASK(set->family)) 565 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
532 return type_pf_test_cidrs(set, d, timeout); 566 return type_pf_test_cidrs(set, d, timeout);
533#endif 567#endif
534 568
@@ -537,7 +571,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
537 for (i = 0; i < n->pos; i++) { 571 for (i = 0; i < n->pos; i++) {
538 data = ahash_data(n, i); 572 data = ahash_data(n, i);
539 if (type_pf_data_equal(data, d, &multi)) 573 if (type_pf_data_equal(data, d, &multi))
540 return 1; 574 return type_pf_data_match(data);
541 } 575 }
542 return 0; 576 return 0;
543} 577}
@@ -693,7 +727,7 @@ type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
693 727
694static int 728static int
695type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, 729type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
696 u8 ahash_max, u32 timeout) 730 u8 ahash_max, u32 cadt_flags, u32 timeout)
697{ 731{
698 struct type_pf_elem *data; 732 struct type_pf_elem *data;
699 733
@@ -720,6 +754,11 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
720 data = ahash_tdata(n, n->pos++); 754 data = ahash_tdata(n, n->pos++);
721 type_pf_data_copy(data, value); 755 type_pf_data_copy(data, value);
722 type_pf_data_timeout_set(data, timeout); 756 type_pf_data_timeout_set(data, timeout);
757#ifdef IP_SET_HASH_WITH_NETS
758 /* Resizing won't overwrite stored flags */
759 if (cadt_flags)
760 type_pf_data_flags(data, cadt_flags);
761#endif
723 return 0; 762 return 0;
724} 763}
725 764
@@ -740,7 +779,7 @@ type_pf_expire(struct ip_set_hash *h)
740 if (type_pf_data_expired(data)) { 779 if (type_pf_data_expired(data)) {
741 pr_debug("expired %u/%u\n", i, j); 780 pr_debug("expired %u/%u\n", i, j);
742#ifdef IP_SET_HASH_WITH_NETS 781#ifdef IP_SET_HASH_WITH_NETS
743 del_cidr(h, data->cidr, HOST_MASK); 782 del_cidr(h, CIDR(data->cidr), HOST_MASK);
744#endif 783#endif
745 if (j != n->pos - 1) 784 if (j != n->pos - 1)
746 /* Not last one */ 785 /* Not last one */
@@ -790,9 +829,12 @@ type_pf_tresize(struct ip_set *set, bool retried)
790retry: 829retry:
791 ret = 0; 830 ret = 0;
792 htable_bits++; 831 htable_bits++;
793 if (!htable_bits) 832 if (!htable_bits) {
794 /* In case we have plenty of memory :-) */ 833 /* In case we have plenty of memory :-) */
834 pr_warning("Cannot increase the hashsize of set %s further\n",
835 set->name);
795 return -IPSET_ERR_HASH_FULL; 836 return -IPSET_ERR_HASH_FULL;
837 }
796 t = ip_set_alloc(sizeof(*t) 838 t = ip_set_alloc(sizeof(*t)
797 + jhash_size(htable_bits) * sizeof(struct hbucket)); 839 + jhash_size(htable_bits) * sizeof(struct hbucket));
798 if (!t) 840 if (!t)
@@ -805,7 +847,7 @@ retry:
805 for (j = 0; j < n->pos; j++) { 847 for (j = 0; j < n->pos; j++) {
806 data = ahash_tdata(n, j); 848 data = ahash_tdata(n, j);
807 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 849 m = hbucket(t, HKEY(data, h->initval, htable_bits));
808 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 850 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0,
809 type_pf_data_timeout(data)); 851 type_pf_data_timeout(data));
810 if (ret < 0) { 852 if (ret < 0) {
811 read_unlock_bh(&set->lock); 853 read_unlock_bh(&set->lock);
@@ -839,12 +881,17 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
839 int ret = 0, i, j = AHASH_MAX(h) + 1; 881 int ret = 0, i, j = AHASH_MAX(h) + 1;
840 bool flag_exist = flags & IPSET_FLAG_EXIST; 882 bool flag_exist = flags & IPSET_FLAG_EXIST;
841 u32 key, multi = 0; 883 u32 key, multi = 0;
884 u32 cadt_flags = flags >> 16;
842 885
843 if (h->elements >= h->maxelem) 886 if (h->elements >= h->maxelem)
844 /* FIXME: when set is full, we slow down here */ 887 /* FIXME: when set is full, we slow down here */
845 type_pf_expire(h); 888 type_pf_expire(h);
846 if (h->elements >= h->maxelem) 889 if (h->elements >= h->maxelem) {
890 if (net_ratelimit())
891 pr_warning("Set %s is full, maxelem %u reached\n",
892 set->name, h->maxelem);
847 return -IPSET_ERR_HASH_FULL; 893 return -IPSET_ERR_HASH_FULL;
894 }
848 895
849 rcu_read_lock_bh(); 896 rcu_read_lock_bh();
850 t = rcu_dereference_bh(h->table); 897 t = rcu_dereference_bh(h->table);
@@ -854,6 +901,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
854 data = ahash_tdata(n, i); 901 data = ahash_tdata(n, i);
855 if (type_pf_data_equal(data, d, &multi)) { 902 if (type_pf_data_equal(data, d, &multi)) {
856 if (type_pf_data_expired(data) || flag_exist) 903 if (type_pf_data_expired(data) || flag_exist)
904 /* Just timeout value may be updated */
857 j = i; 905 j = i;
858 else { 906 else {
859 ret = -IPSET_ERR_EXIST; 907 ret = -IPSET_ERR_EXIST;
@@ -866,15 +914,18 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
866 if (j != AHASH_MAX(h) + 1) { 914 if (j != AHASH_MAX(h) + 1) {
867 data = ahash_tdata(n, j); 915 data = ahash_tdata(n, j);
868#ifdef IP_SET_HASH_WITH_NETS 916#ifdef IP_SET_HASH_WITH_NETS
869 del_cidr(h, data->cidr, HOST_MASK); 917 del_cidr(h, CIDR(data->cidr), HOST_MASK);
870 add_cidr(h, d->cidr, HOST_MASK); 918 add_cidr(h, CIDR(d->cidr), HOST_MASK);
871#endif 919#endif
872 type_pf_data_copy(data, d); 920 type_pf_data_copy(data, d);
873 type_pf_data_timeout_set(data, timeout); 921 type_pf_data_timeout_set(data, timeout);
922#ifdef IP_SET_HASH_WITH_NETS
923 type_pf_data_flags(data, cadt_flags);
924#endif
874 goto out; 925 goto out;
875 } 926 }
876 TUNE_AHASH_MAX(h, multi); 927 TUNE_AHASH_MAX(h, multi);
877 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), timeout); 928 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout);
878 if (ret != 0) { 929 if (ret != 0) {
879 if (ret == -EAGAIN) 930 if (ret == -EAGAIN)
880 type_pf_data_next(h, d); 931 type_pf_data_next(h, d);
@@ -882,7 +933,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
882 } 933 }
883 934
884#ifdef IP_SET_HASH_WITH_NETS 935#ifdef IP_SET_HASH_WITH_NETS
885 add_cidr(h, d->cidr, HOST_MASK); 936 add_cidr(h, CIDR(d->cidr), HOST_MASK);
886#endif 937#endif
887 h->elements++; 938 h->elements++;
888out: 939out:
@@ -916,7 +967,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
916 n->pos--; 967 n->pos--;
917 h->elements--; 968 h->elements--;
918#ifdef IP_SET_HASH_WITH_NETS 969#ifdef IP_SET_HASH_WITH_NETS
919 del_cidr(h, d->cidr, HOST_MASK); 970 del_cidr(h, CIDR(d->cidr), HOST_MASK);
920#endif 971#endif
921 if (n->pos + AHASH_INIT_SIZE < n->size) { 972 if (n->pos + AHASH_INIT_SIZE < n->size) {
922 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 973 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -954,8 +1005,17 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
954 n = hbucket(t, key); 1005 n = hbucket(t, key);
955 for (i = 0; i < n->pos; i++) { 1006 for (i = 0; i < n->pos; i++) {
956 data = ahash_tdata(n, i); 1007 data = ahash_tdata(n, i);
957 if (type_pf_data_equal(data, d, &multi)) 1008#ifdef IP_SET_HASH_WITH_MULTI
958 return !type_pf_data_expired(data); 1009 if (type_pf_data_equal(data, d, &multi)) {
1010 if (!type_pf_data_expired(data))
1011 return type_pf_data_match(data);
1012 multi = 0;
1013 }
1014#else
1015 if (type_pf_data_equal(data, d, &multi) &&
1016 !type_pf_data_expired(data))
1017 return type_pf_data_match(data);
1018#endif
959 } 1019 }
960 } 1020 }
961 return 0; 1021 return 0;
@@ -973,15 +1033,16 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags)
973 u32 key, multi = 0; 1033 u32 key, multi = 0;
974 1034
975#ifdef IP_SET_HASH_WITH_NETS 1035#ifdef IP_SET_HASH_WITH_NETS
976 if (d->cidr == SET_HOST_MASK(set->family)) 1036 if (CIDR(d->cidr) == SET_HOST_MASK(set->family))
977 return type_pf_ttest_cidrs(set, d, timeout); 1037 return type_pf_ttest_cidrs(set, d, timeout);
978#endif 1038#endif
979 key = HKEY(d, h->initval, t->htable_bits); 1039 key = HKEY(d, h->initval, t->htable_bits);
980 n = hbucket(t, key); 1040 n = hbucket(t, key);
981 for (i = 0; i < n->pos; i++) { 1041 for (i = 0; i < n->pos; i++) {
982 data = ahash_tdata(n, i); 1042 data = ahash_tdata(n, i);
983 if (type_pf_data_equal(data, d, &multi)) 1043 if (type_pf_data_equal(data, d, &multi) &&
984 return !type_pf_data_expired(data); 1044 !type_pf_data_expired(data))
1045 return type_pf_data_match(data);
985 } 1046 }
986 return 0; 1047 return 0;
987} 1048}
@@ -1094,14 +1155,17 @@ type_pf_gc_init(struct ip_set *set)
1094#undef type_pf_data_isnull 1155#undef type_pf_data_isnull
1095#undef type_pf_data_copy 1156#undef type_pf_data_copy
1096#undef type_pf_data_zero_out 1157#undef type_pf_data_zero_out
1158#undef type_pf_data_netmask
1097#undef type_pf_data_list 1159#undef type_pf_data_list
1098#undef type_pf_data_tlist 1160#undef type_pf_data_tlist
1161#undef type_pf_data_next
1162#undef type_pf_data_flags
1163#undef type_pf_data_match
1099 1164
1100#undef type_pf_elem 1165#undef type_pf_elem
1101#undef type_pf_telem 1166#undef type_pf_telem
1102#undef type_pf_data_timeout 1167#undef type_pf_data_timeout
1103#undef type_pf_data_expired 1168#undef type_pf_data_expired
1104#undef type_pf_data_netmask
1105#undef type_pf_data_timeout_set 1169#undef type_pf_data_timeout_set
1106 1170
1107#undef type_pf_elem_add 1171#undef type_pf_elem_add
@@ -1111,6 +1175,7 @@ type_pf_gc_init(struct ip_set *set)
1111#undef type_pf_test 1175#undef type_pf_test
1112 1176
1113#undef type_pf_elem_tadd 1177#undef type_pf_elem_tadd
1178#undef type_pf_del_telem
1114#undef type_pf_expire 1179#undef type_pf_expire
1115#undef type_pf_tadd 1180#undef type_pf_tadd
1116#undef type_pf_tdel 1181#undef type_pf_tdel
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 6e135f97e59a..e59868ae12d4 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -18,7 +18,10 @@ enum tcp_conntrack {
18 TCP_CONNTRACK_LISTEN, /* obsolete */ 18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN 19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
20 TCP_CONNTRACK_MAX, 20 TCP_CONNTRACK_MAX,
21 TCP_CONNTRACK_IGNORE 21 TCP_CONNTRACK_IGNORE,
22 TCP_CONNTRACK_RETRANS,
23 TCP_CONNTRACK_UNACK,
24 TCP_CONNTRACK_TIMEOUT_MAX
22}; 25};
23 26
24/* Window scaling is advertised by the sender */ 27/* Window scaling is advertised by the sender */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index b64454c2f79f..6fd1f0d07e64 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -49,7 +49,8 @@ struct nfgenmsg {
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_ACCT 7 51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_COUNT 8 52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_COUNT 9
53 54
54#ifdef __KERNEL__ 55#ifdef __KERNEL__
55 56
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index debf1aefd753..e58e4b93c108 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -43,6 +43,7 @@ enum ctattr_type {
43 CTA_ZONE, 43 CTA_ZONE,
44 CTA_SECCTX, 44 CTA_SECCTX,
45 CTA_TIMESTAMP, 45 CTA_TIMESTAMP,
46 CTA_MARK_MASK,
46 __CTA_MAX 47 __CTA_MAX
47}; 48};
48#define CTA_MAX (__CTA_MAX - 1) 49#define CTA_MAX (__CTA_MAX - 1)
@@ -172,10 +173,21 @@ enum ctattr_expect {
172 CTA_EXPECT_HELP_NAME, 173 CTA_EXPECT_HELP_NAME,
173 CTA_EXPECT_ZONE, 174 CTA_EXPECT_ZONE,
174 CTA_EXPECT_FLAGS, 175 CTA_EXPECT_FLAGS,
176 CTA_EXPECT_CLASS,
177 CTA_EXPECT_NAT,
178 CTA_EXPECT_FN,
175 __CTA_EXPECT_MAX 179 __CTA_EXPECT_MAX
176}; 180};
177#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) 181#define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
178 182
183enum ctattr_expect_nat {
184 CTA_EXPECT_NAT_UNSPEC,
185 CTA_EXPECT_NAT_DIR,
186 CTA_EXPECT_NAT_TUPLE,
187 __CTA_EXPECT_NAT_MAX
188};
189#define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1)
190
179enum ctattr_help { 191enum ctattr_help {
180 CTA_HELP_UNSPEC, 192 CTA_HELP_UNSPEC,
181 CTA_HELP_NAME, 193 CTA_HELP_NAME,
diff --git a/include/linux/netfilter/nfnetlink_cttimeout.h b/include/linux/netfilter/nfnetlink_cttimeout.h
new file mode 100644
index 000000000000..a2810a7c5e30
--- /dev/null
+++ b/include/linux/netfilter/nfnetlink_cttimeout.h
@@ -0,0 +1,114 @@
1#ifndef _CTTIMEOUT_NETLINK_H
2#define _CTTIMEOUT_NETLINK_H
3#include <linux/netfilter/nfnetlink.h>
4
5enum ctnl_timeout_msg_types {
6 IPCTNL_MSG_TIMEOUT_NEW,
7 IPCTNL_MSG_TIMEOUT_GET,
8 IPCTNL_MSG_TIMEOUT_DELETE,
9
10 IPCTNL_MSG_TIMEOUT_MAX
11};
12
13enum ctattr_timeout {
14 CTA_TIMEOUT_UNSPEC,
15 CTA_TIMEOUT_NAME,
16 CTA_TIMEOUT_L3PROTO,
17 CTA_TIMEOUT_L4PROTO,
18 CTA_TIMEOUT_DATA,
19 CTA_TIMEOUT_USE,
20 __CTA_TIMEOUT_MAX
21};
22#define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1)
23
24enum ctattr_timeout_generic {
25 CTA_TIMEOUT_GENERIC_UNSPEC,
26 CTA_TIMEOUT_GENERIC_TIMEOUT,
27 __CTA_TIMEOUT_GENERIC_MAX
28};
29#define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1)
30
31enum ctattr_timeout_tcp {
32 CTA_TIMEOUT_TCP_UNSPEC,
33 CTA_TIMEOUT_TCP_SYN_SENT,
34 CTA_TIMEOUT_TCP_SYN_RECV,
35 CTA_TIMEOUT_TCP_ESTABLISHED,
36 CTA_TIMEOUT_TCP_FIN_WAIT,
37 CTA_TIMEOUT_TCP_CLOSE_WAIT,
38 CTA_TIMEOUT_TCP_LAST_ACK,
39 CTA_TIMEOUT_TCP_TIME_WAIT,
40 CTA_TIMEOUT_TCP_CLOSE,
41 CTA_TIMEOUT_TCP_SYN_SENT2,
42 CTA_TIMEOUT_TCP_RETRANS,
43 CTA_TIMEOUT_TCP_UNACK,
44 __CTA_TIMEOUT_TCP_MAX
45};
46#define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1)
47
48enum ctattr_timeout_udp {
49 CTA_TIMEOUT_UDP_UNSPEC,
50 CTA_TIMEOUT_UDP_UNREPLIED,
51 CTA_TIMEOUT_UDP_REPLIED,
52 __CTA_TIMEOUT_UDP_MAX
53};
54#define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1)
55
56enum ctattr_timeout_udplite {
57 CTA_TIMEOUT_UDPLITE_UNSPEC,
58 CTA_TIMEOUT_UDPLITE_UNREPLIED,
59 CTA_TIMEOUT_UDPLITE_REPLIED,
60 __CTA_TIMEOUT_UDPLITE_MAX
61};
62#define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1)
63
64enum ctattr_timeout_icmp {
65 CTA_TIMEOUT_ICMP_UNSPEC,
66 CTA_TIMEOUT_ICMP_TIMEOUT,
67 __CTA_TIMEOUT_ICMP_MAX
68};
69#define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1)
70
71enum ctattr_timeout_dccp {
72 CTA_TIMEOUT_DCCP_UNSPEC,
73 CTA_TIMEOUT_DCCP_REQUEST,
74 CTA_TIMEOUT_DCCP_RESPOND,
75 CTA_TIMEOUT_DCCP_PARTOPEN,
76 CTA_TIMEOUT_DCCP_OPEN,
77 CTA_TIMEOUT_DCCP_CLOSEREQ,
78 CTA_TIMEOUT_DCCP_CLOSING,
79 CTA_TIMEOUT_DCCP_TIMEWAIT,
80 __CTA_TIMEOUT_DCCP_MAX
81};
82#define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1)
83
84enum ctattr_timeout_sctp {
85 CTA_TIMEOUT_SCTP_UNSPEC,
86 CTA_TIMEOUT_SCTP_CLOSED,
87 CTA_TIMEOUT_SCTP_COOKIE_WAIT,
88 CTA_TIMEOUT_SCTP_COOKIE_ECHOED,
89 CTA_TIMEOUT_SCTP_ESTABLISHED,
90 CTA_TIMEOUT_SCTP_SHUTDOWN_SENT,
91 CTA_TIMEOUT_SCTP_SHUTDOWN_RECD,
92 CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT,
93 __CTA_TIMEOUT_SCTP_MAX
94};
95#define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1)
96
97enum ctattr_timeout_icmpv6 {
98 CTA_TIMEOUT_ICMPV6_UNSPEC,
99 CTA_TIMEOUT_ICMPV6_TIMEOUT,
100 __CTA_TIMEOUT_ICMPV6_MAX
101};
102#define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1)
103
104enum ctattr_timeout_gre {
105 CTA_TIMEOUT_GRE_UNSPEC,
106 CTA_TIMEOUT_GRE_UNREPLIED,
107 CTA_TIMEOUT_GRE_REPLIED,
108 __CTA_TIMEOUT_GRE_MAX
109};
110#define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1)
111
112#define CTNL_TIMEOUT_NAME_MAX 32
113
114#endif
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index b56e76811c04..a064b8af360c 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -16,4 +16,16 @@ struct xt_ct_target_info {
16 struct nf_conn *ct __attribute__((aligned(8))); 16 struct nf_conn *ct __attribute__((aligned(8)));
17}; 17};
18 18
19struct xt_ct_target_info_v1 {
20 __u16 flags;
21 __u16 zone;
22 __u32 ct_events;
23 __u32 exp_events;
24 char helper[16];
25 char timeout[32];
26
27 /* Used internally by the kernel */
28 struct nf_conn *ct __attribute__((aligned(8)));
29};
30
19#endif /* _XT_CT_H */ 31#endif /* _XT_CT_H */
diff --git a/include/linux/netfilter/xt_LOG.h b/include/linux/netfilter/xt_LOG.h
new file mode 100644
index 000000000000..cac079095305
--- /dev/null
+++ b/include/linux/netfilter/xt_LOG.h
@@ -0,0 +1,19 @@
1#ifndef _XT_LOG_H
2#define _XT_LOG_H
3
4/* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */
5#define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define XT_LOG_TCPOPT 0x02 /* Log TCP options */
7#define XT_LOG_IPOPT 0x04 /* Log IP options */
8#define XT_LOG_UID 0x08 /* Log UID owning local socket */
9#define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define XT_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define XT_LOG_MASK 0x2f
12
13struct xt_log_info {
14 unsigned char level;
15 unsigned char logflags;
16 char prefix[30];
17};
18
19#endif /* _XT_LOG_H */
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index f9930c87fff3..31f8bec95650 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -4,11 +4,9 @@ header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h 4header-y += ipt_ECN.h
5header-y += ipt_LOG.h 5header-y += ipt_LOG.h
6header-y += ipt_REJECT.h 6header-y += ipt_REJECT.h
7header-y += ipt_SAME.h
8header-y += ipt_TTL.h 7header-y += ipt_TTL.h
9header-y += ipt_ULOG.h 8header-y += ipt_ULOG.h
10header-y += ipt_addrtype.h 9header-y += ipt_addrtype.h
11header-y += ipt_ah.h 10header-y += ipt_ah.h
12header-y += ipt_ecn.h 11header-y += ipt_ecn.h
13header-y += ipt_realm.h
14header-y += ipt_ttl.h 12header-y += ipt_ttl.h
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index dcdbadf9fd4a..5d8152077d71 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_LOG_H 1#ifndef _IPT_LOG_H
2#define _IPT_LOG_H 2#define _IPT_LOG_H
3 3
4#warning "Please update iptables, this file will be removed soon!"
5
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ 6/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
5#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 7#define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ 8#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
deleted file mode 100644
index 5bca78267afd..000000000000
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IPT_SAME_H
2#define _IPT_SAME_H
3
4#include <linux/types.h>
5
6#define IPT_SAME_MAX_RANGE 10
7
8#define IPT_SAME_NODST 0x01
9
10struct ipt_same_info {
11 unsigned char info;
12 __u32 rangesize;
13 __u32 ipnum;
14 __u32 *iparray;
15
16 /* hangs off end. */
17 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
18};
19
20#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h
deleted file mode 100644
index b3996eaa0188..000000000000
--- a/include/linux/netfilter_ipv4/ipt_realm.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _IPT_REALM_H
2#define _IPT_REALM_H
3
4#include <linux/netfilter/xt_realm.h>
5#define ipt_realm_info xt_realm_info
6
7#endif /* _IPT_REALM_H */
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 9dd5579e02ec..3dd0bc4e0735 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_LOG_H 1#ifndef _IP6T_LOG_H
2#define _IP6T_LOG_H 2#define _IP6T_LOG_H
3 3
4#warning "Please update iptables, this file will be removed soon!"
5
4/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ 6/* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */
5#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ 7#define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ 8#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 52e48959cfa1..a2092f582a78 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -225,6 +225,7 @@ struct netlink_callback {
225 int (*dump)(struct sk_buff * skb, 225 int (*dump)(struct sk_buff * skb,
226 struct netlink_callback *cb); 226 struct netlink_callback *cb);
227 int (*done)(struct netlink_callback *cb); 227 int (*done)(struct netlink_callback *cb);
228 void *data;
228 u16 family; 229 u16 family;
229 u16 min_dump_alloc; 230 u16 min_dump_alloc;
230 unsigned int prev_seq, seq; 231 unsigned int prev_seq, seq;
@@ -237,22 +238,8 @@ struct netlink_notify {
237 int protocol; 238 int protocol;
238}; 239};
239 240
240static __inline__ struct nlmsghdr * 241struct nlmsghdr *
241__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) 242__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags);
242{
243 struct nlmsghdr *nlh;
244 int size = NLMSG_LENGTH(len);
245
246 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
247 nlh->nlmsg_type = type;
248 nlh->nlmsg_len = size;
249 nlh->nlmsg_flags = flags;
250 nlh->nlmsg_pid = pid;
251 nlh->nlmsg_seq = seq;
252 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
253 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
254 return nlh;
255}
256 243
257#define NLMSG_NEW(skb, pid, seq, type, len, flags) \ 244#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
258({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ 245({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
@@ -262,11 +249,16 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
262#define NLMSG_PUT(skb, pid, seq, type, len) \ 249#define NLMSG_PUT(skb, pid, seq, type, len) \
263 NLMSG_NEW(skb, pid, seq, type, len, 0) 250 NLMSG_NEW(skb, pid, seq, type, len, 0)
264 251
252struct netlink_dump_control {
253 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
254 int (*done)(struct netlink_callback*);
255 void *data;
256 u16 min_dump_alloc;
257};
258
265extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 259extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
266 const struct nlmsghdr *nlh, 260 const struct nlmsghdr *nlh,
267 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 261 struct netlink_dump_control *control);
268 int (*done)(struct netlink_callback*),
269 u16 min_dump_alloc);
270 262
271 263
272#define NL_NONROOT_RECV 0x1 264#define NL_NONROOT_RECV 0x1
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 01d4e5d60325..39c1fcf089c0 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -89,6 +89,8 @@ enum nfc_commands {
89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 89 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
90 * target is not NFC-Forum compliant) 90 * target is not NFC-Forum compliant)
91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes 91 * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes
92 * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes
93 * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes
92 * @NFC_ATTR_COMM_MODE: Passive or active mode 94 * @NFC_ATTR_COMM_MODE: Passive or active mode
93 * @NFC_ATTR_RF_MODE: Initiator or target 95 * @NFC_ATTR_RF_MODE: Initiator or target
94 */ 96 */
@@ -101,14 +103,20 @@ enum nfc_attrs {
101 NFC_ATTR_TARGET_SENS_RES, 103 NFC_ATTR_TARGET_SENS_RES,
102 NFC_ATTR_TARGET_SEL_RES, 104 NFC_ATTR_TARGET_SEL_RES,
103 NFC_ATTR_TARGET_NFCID1, 105 NFC_ATTR_TARGET_NFCID1,
106 NFC_ATTR_TARGET_SENSB_RES,
107 NFC_ATTR_TARGET_SENSF_RES,
104 NFC_ATTR_COMM_MODE, 108 NFC_ATTR_COMM_MODE,
105 NFC_ATTR_RF_MODE, 109 NFC_ATTR_RF_MODE,
110 NFC_ATTR_DEVICE_POWERED,
106/* private: internal use only */ 111/* private: internal use only */
107 __NFC_ATTR_AFTER_LAST 112 __NFC_ATTR_AFTER_LAST
108}; 113};
109#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) 114#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1)
110 115
111#define NFC_DEVICE_NAME_MAXSIZE 8 116#define NFC_DEVICE_NAME_MAXSIZE 8
117#define NFC_NFCID1_MAXSIZE 10
118#define NFC_SENSB_RES_MAXSIZE 12
119#define NFC_SENSF_RES_MAXSIZE 18
112 120
113/* NFC protocols */ 121/* NFC protocols */
114#define NFC_PROTO_JEWEL 1 122#define NFC_PROTO_JEWEL 1
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 8c6ee44914cb..6d1fb63f5922 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -29,7 +29,7 @@
29#define NFS_MNT_VERSION 1 29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3 30#define NFS_MNT3_VERSION 3
31 31
32#define NFS_PIPE_DIRNAME "/nfs" 32#define NFS_PIPE_DIRNAME "nfs"
33 33
34/* 34/*
35 * NFS stats. The good thing with these values is that NFSv3 errors are 35 * NFS stats. The good thing with these values is that NFSv3 errors are
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 32345c2805c0..834df8bf08b6 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -183,15 +183,12 @@ struct nfs4_acl {
183 183
184typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 184typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
185 185
186struct nfs41_stateid { 186struct nfs_stateid4 {
187 __be32 seqid; 187 __be32 seqid;
188 char other[NFS4_STATEID_OTHER_SIZE]; 188 char other[NFS4_STATEID_OTHER_SIZE];
189} __attribute__ ((packed)); 189} __attribute__ ((packed));
190 190
191typedef union { 191typedef struct nfs_stateid4 nfs4_stateid;
192 char data[NFS4_STATEID_SIZE];
193 struct nfs41_stateid stateid;
194} nfs4_stateid;
195 192
196enum nfs_opnum4 { 193enum nfs_opnum4 {
197 OP_ACCESS = 3, 194 OP_ACCESS = 3,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8c29950d2fa5..52a1bdb4ee2b 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -38,6 +38,13 @@
38 38
39#ifdef __KERNEL__ 39#ifdef __KERNEL__
40 40
41/*
42 * Enable dprintk() debugging support for nfs client.
43 */
44#ifdef CONFIG_NFS_DEBUG
45# define NFS_DEBUG
46#endif
47
41#include <linux/in.h> 48#include <linux/in.h>
42#include <linux/mm.h> 49#include <linux/mm.h>
43#include <linux/pagemap.h> 50#include <linux/pagemap.h>
@@ -171,13 +178,9 @@ struct nfs_inode {
171 */ 178 */
172 __be32 cookieverf[2]; 179 __be32 cookieverf[2];
173 180
174 /*
175 * This is the list of dirty unwritten pages.
176 */
177 struct radix_tree_root nfs_page_tree;
178
179 unsigned long npages; 181 unsigned long npages;
180 unsigned long ncommit; 182 unsigned long ncommit;
183 struct list_head commit_list;
181 184
182 /* Open contexts for shared mmap writes */ 185 /* Open contexts for shared mmap writes */
183 struct list_head open_files; 186 struct list_head open_files;
@@ -395,6 +398,29 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
395 kfree(fh); 398 kfree(fh);
396} 399}
397 400
401#ifdef NFS_DEBUG
402extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh);
403static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
404{
405 return _nfs_display_fhandle_hash(fh);
406}
407extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
408#define nfs_display_fhandle(fh, caption) \
409 do { \
410 if (unlikely(nfs_debug & NFSDBG_FACILITY)) \
411 _nfs_display_fhandle(fh, caption); \
412 } while (0)
413#else
414static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
415{
416 return 0;
417}
418static inline void nfs_display_fhandle(const struct nfs_fh *fh,
419 const char *caption)
420{
421}
422#endif
423
398/* 424/*
399 * linux/fs/nfs/nfsroot.c 425 * linux/fs/nfs/nfsroot.c
400 */ 426 */
@@ -632,19 +658,13 @@ nfs_fileid_to_ino_t(u64 fileid)
632 658
633#ifdef __KERNEL__ 659#ifdef __KERNEL__
634 660
635/*
636 * Enable debugging support for nfs client.
637 * Requires RPC_DEBUG.
638 */
639#ifdef RPC_DEBUG
640# define NFS_DEBUG
641#endif
642
643# undef ifdebug 661# undef ifdebug
644# ifdef NFS_DEBUG 662# ifdef NFS_DEBUG
645# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 663# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))
664# define NFS_IFDEBUG(x) x
646# else 665# else
647# define ifdebug(fac) if (0) 666# define ifdebug(fac) if (0)
667# define NFS_IFDEBUG(x)
648# endif 668# endif
649#endif /* __KERNEL */ 669#endif /* __KERNEL */
650 670
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index 861730275ba0..a5c50d97341e 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -1,10 +1,6 @@
1#ifndef _NFS_FS_I 1#ifndef _NFS_FS_I
2#define _NFS_FS_I 2#define _NFS_FS_I
3 3
4#include <asm/types.h>
5#include <linux/list.h>
6#include <linux/nfs.h>
7
8struct nlm_lockowner; 4struct nlm_lockowner;
9 5
10/* 6/*
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index ba4d7656ecfd..7073fc74481c 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/idr.h>
6#include <linux/wait.h> 7#include <linux/wait.h>
7#include <linux/nfs_xdr.h> 8#include <linux/nfs_xdr.h>
8#include <linux/sunrpc/xprt.h> 9#include <linux/sunrpc/xprt.h>
@@ -17,6 +18,7 @@ struct nfs4_sequence_res;
17struct nfs_server; 18struct nfs_server;
18struct nfs4_minor_version_ops; 19struct nfs4_minor_version_ops;
19struct server_scope; 20struct server_scope;
21struct nfs41_impl_id;
20 22
21/* 23/*
22 * The nfs_client identifies our client state to the server. 24 * The nfs_client identifies our client state to the server.
@@ -85,6 +87,8 @@ struct nfs_client {
85#endif 87#endif
86 88
87 struct server_scope *server_scope; /* from exchange_id */ 89 struct server_scope *server_scope; /* from exchange_id */
90 struct nfs41_impl_id *impl_id; /* from exchange_id */
91 struct net *net;
88}; 92};
89 93
90/* 94/*
@@ -144,15 +148,18 @@ struct nfs_server {
144 u32 acl_bitmask; /* V4 bitmask representing the ACEs 148 u32 acl_bitmask; /* V4 bitmask representing the ACEs
145 that are supported on this 149 that are supported on this
146 filesystem */ 150 filesystem */
151 u32 fh_expire_type; /* V4 bitmask representing file
152 handle volatility type for
153 this filesystem */
147 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ 154 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
148 struct rpc_wait_queue roc_rpcwaitq; 155 struct rpc_wait_queue roc_rpcwaitq;
149 void *pnfs_ld_data; /* per mount point data */ 156 void *pnfs_ld_data; /* per mount point data */
150 157
151 /* the following fields are protected by nfs_client->cl_lock */ 158 /* the following fields are protected by nfs_client->cl_lock */
152 struct rb_root state_owners; 159 struct rb_root state_owners;
153 struct rb_root openowner_id;
154 struct rb_root lockowner_id;
155#endif 160#endif
161 struct ida openowner_id;
162 struct ida lockowner_id;
156 struct list_head state_owners_lru; 163 struct list_head state_owners_lru;
157 struct list_head layouts; 164 struct list_head layouts;
158 struct list_head delegations; 165 struct list_head delegations;
@@ -188,21 +195,23 @@ struct nfs_server {
188 195
189 196
190/* maximum number of slots to use */ 197/* maximum number of slots to use */
191#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE 198#define NFS4_DEF_SLOT_TABLE_SIZE (16U)
199#define NFS4_MAX_SLOT_TABLE (256U)
200#define NFS4_NO_SLOT ((u32)-1)
192 201
193#if defined(CONFIG_NFS_V4) 202#if defined(CONFIG_NFS_V4)
194 203
195/* Sessions */ 204/* Sessions */
196#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) 205#define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long))
197struct nfs4_slot_table { 206struct nfs4_slot_table {
198 struct nfs4_slot *slots; /* seqid per slot */ 207 struct nfs4_slot *slots; /* seqid per slot */
199 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ 208 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
200 spinlock_t slot_tbl_lock; 209 spinlock_t slot_tbl_lock;
201 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ 210 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
202 int max_slots; /* # slots in table */ 211 u32 max_slots; /* # slots in table */
203 int highest_used_slotid; /* sent to server on each SEQ. 212 u32 highest_used_slotid; /* sent to server on each SEQ.
204 * op for dynamic resizing */ 213 * op for dynamic resizing */
205 int target_max_slots; /* Set by CB_RECALL_SLOT as 214 u32 target_max_slots; /* Set by CB_RECALL_SLOT as
206 * the new max_slots */ 215 * the new max_slots */
207 struct completion complete; 216 struct completion complete;
208}; 217};
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 308c18877018..7eed2012d288 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -69,36 +69,22 @@ struct nfs_server;
69struct nfs_fattr; 69struct nfs_fattr;
70struct nfs4_string; 70struct nfs4_string;
71 71
72#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 72#ifdef CONFIG_NFS_V4
73
74int nfs_idmap_init(void); 73int nfs_idmap_init(void);
75void nfs_idmap_quit(void); 74void nfs_idmap_quit(void);
76 75#else
77static inline int nfs_idmap_new(struct nfs_client *clp)
78{
79 return 0;
80}
81
82static inline void nfs_idmap_delete(struct nfs_client *clp)
83{
84}
85
86#else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */
87
88static inline int nfs_idmap_init(void) 76static inline int nfs_idmap_init(void)
89{ 77{
90 return 0; 78 return 0;
91} 79}
92 80
93static inline void nfs_idmap_quit(void) 81static inline void nfs_idmap_quit(void)
94{ 82{}
95} 83#endif
96 84
97int nfs_idmap_new(struct nfs_client *); 85int nfs_idmap_new(struct nfs_client *);
98void nfs_idmap_delete(struct nfs_client *); 86void nfs_idmap_delete(struct nfs_client *);
99 87
100#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
101
102void nfs_fattr_init_names(struct nfs_fattr *fattr, 88void nfs_fattr_init_names(struct nfs_fattr *fattr,
103 struct nfs4_string *owner_name, 89 struct nfs4_string *owner_name,
104 struct nfs4_string *group_name); 90 struct nfs4_string *group_name);
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 8866bb3502ee..9dcbbe9a51fb 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -21,7 +21,7 @@
21#ifndef _LINUX_NFS_IOSTAT 21#ifndef _LINUX_NFS_IOSTAT
22#define _LINUX_NFS_IOSTAT 22#define _LINUX_NFS_IOSTAT
23 23
24#define NFS_IOSTAT_VERS "1.0" 24#define NFS_IOSTAT_VERS "1.1"
25 25
26/* 26/*
27 * NFS byte counters 27 * NFS byte counters
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index ab465fe8c3d6..eac30d6bec17 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -19,12 +19,6 @@
19#include <linux/kref.h> 19#include <linux/kref.h>
20 20
21/* 21/*
22 * Valid flags for the radix tree
23 */
24#define NFS_PAGE_TAG_LOCKED 0
25#define NFS_PAGE_TAG_COMMIT 1
26
27/*
28 * Valid flags for a dirty buffer 22 * Valid flags for a dirty buffer
29 */ 23 */
30enum { 24enum {
@@ -33,16 +27,13 @@ enum {
33 PG_CLEAN, 27 PG_CLEAN,
34 PG_NEED_COMMIT, 28 PG_NEED_COMMIT,
35 PG_NEED_RESCHED, 29 PG_NEED_RESCHED,
36 PG_PNFS_COMMIT,
37 PG_PARTIAL_READ_FAILED, 30 PG_PARTIAL_READ_FAILED,
31 PG_COMMIT_TO_DS,
38}; 32};
39 33
40struct nfs_inode; 34struct nfs_inode;
41struct nfs_page { 35struct nfs_page {
42 union { 36 struct list_head wb_list; /* Defines state of page: */
43 struct list_head wb_list; /* Defines state of page: */
44 struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */
45 };
46 struct page *wb_page; /* page to read in/write out */ 37 struct page *wb_page; /* page to read in/write out */
47 struct nfs_open_context *wb_context; /* File state context info */ 38 struct nfs_open_context *wb_context; /* File state context info */
48 struct nfs_lock_context *wb_lock_context; /* lock context info */ 39 struct nfs_lock_context *wb_lock_context; /* lock context info */
@@ -90,8 +81,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
90extern void nfs_release_request(struct nfs_page *req); 81extern void nfs_release_request(struct nfs_page *req);
91 82
92 83
93extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
94 pgoff_t idx_start, unsigned int npages, int tag);
95extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 84extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
96 struct inode *inode, 85 struct inode *inode,
97 const struct nfs_pageio_ops *pg_ops, 86 const struct nfs_pageio_ops *pg_ops,
@@ -106,8 +95,6 @@ extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
106 struct nfs_page *req); 95 struct nfs_page *req);
107extern int nfs_wait_on_request(struct nfs_page *); 96extern int nfs_wait_on_request(struct nfs_page *);
108extern void nfs_unlock_request(struct nfs_page *req); 97extern void nfs_unlock_request(struct nfs_page *req);
109extern int nfs_set_page_tag_locked(struct nfs_page *req);
110extern void nfs_clear_page_tag_locked(struct nfs_page *req);
111 98
112/* 99/*
113 * Lock the page of an asynchronous request without getting a new reference 100 * Lock the page of an asynchronous request without getting a new reference
@@ -118,6 +105,16 @@ nfs_lock_request_dontget(struct nfs_page *req)
118 return !test_and_set_bit(PG_BUSY, &req->wb_flags); 105 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
119} 106}
120 107
108static inline int
109nfs_lock_request(struct nfs_page *req)
110{
111 if (test_and_set_bit(PG_BUSY, &req->wb_flags))
112 return 0;
113 kref_get(&req->wb_kref);
114 return 1;
115}
116
117
121/** 118/**
122 * nfs_list_add_request - Insert a request into a list 119 * nfs_list_add_request - Insert a request into a list
123 * @req: request 120 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index d6ba9a12591e..bfd0d1bf6707 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -2,7 +2,6 @@
2#define _LINUX_NFS_XDR_H 2#define _LINUX_NFS_XDR_H
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h>
6#include <linux/sunrpc/gss_api.h> 5#include <linux/sunrpc/gss_api.h>
7 6
8/* 7/*
@@ -89,11 +88,12 @@ struct nfs_fattr {
89#define NFS_ATTR_FATTR_PRECTIME (1U << 16) 88#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
90#define NFS_ATTR_FATTR_CHANGE (1U << 17) 89#define NFS_ATTR_FATTR_CHANGE (1U << 17)
91#define NFS_ATTR_FATTR_PRECHANGE (1U << 18) 90#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 91#define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ 92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) 93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22) 94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23) 95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
97 97
98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
99 | NFS_ATTR_FATTR_MODE \ 99 | NFS_ATTR_FATTR_MODE \
@@ -182,7 +182,7 @@ struct nfs4_slot {
182 182
183struct nfs4_sequence_args { 183struct nfs4_sequence_args {
184 struct nfs4_session *sa_session; 184 struct nfs4_session *sa_session;
185 u8 sa_slotid; 185 u32 sa_slotid;
186 u8 sa_cache_this; 186 u8 sa_cache_this;
187}; 187};
188 188
@@ -977,6 +977,7 @@ struct nfs4_server_caps_res {
977 u32 acl_bitmask; 977 u32 acl_bitmask;
978 u32 has_links; 978 u32 has_links;
979 u32 has_symlinks; 979 u32 has_symlinks;
980 u32 fh_expire_type;
980 struct nfs4_sequence_res seq_res; 981 struct nfs4_sequence_res seq_res;
981}; 982};
982 983
@@ -1055,14 +1056,6 @@ struct nfstime4 {
1055}; 1056};
1056 1057
1057#ifdef CONFIG_NFS_V4_1 1058#ifdef CONFIG_NFS_V4_1
1058struct nfs_impl_id4 {
1059 u32 domain_len;
1060 char *domain;
1061 u32 name_len;
1062 char *name;
1063 struct nfstime4 date;
1064};
1065
1066#define NFS4_EXCHANGE_ID_LEN (48) 1059#define NFS4_EXCHANGE_ID_LEN (48)
1067struct nfs41_exchange_id_args { 1060struct nfs41_exchange_id_args {
1068 struct nfs_client *client; 1061 struct nfs_client *client;
@@ -1083,10 +1076,17 @@ struct server_scope {
1083 char server_scope[NFS4_OPAQUE_LIMIT]; 1076 char server_scope[NFS4_OPAQUE_LIMIT];
1084}; 1077};
1085 1078
1079struct nfs41_impl_id {
1080 char domain[NFS4_OPAQUE_LIMIT + 1];
1081 char name[NFS4_OPAQUE_LIMIT + 1];
1082 struct nfstime4 date;
1083};
1084
1086struct nfs41_exchange_id_res { 1085struct nfs41_exchange_id_res {
1087 struct nfs_client *client; 1086 struct nfs_client *client;
1088 u32 flags; 1087 u32 flags;
1089 struct server_scope *server_scope; 1088 struct server_scope *server_scope;
1089 struct nfs41_impl_id *impl_id;
1090}; 1090};
1091 1091
1092struct nfs41_create_session_args { 1092struct nfs41_create_session_args {
@@ -1192,6 +1192,27 @@ struct nfs_write_data {
1192 struct page *page_array[NFS_PAGEVEC_SIZE]; 1192 struct page *page_array[NFS_PAGEVEC_SIZE];
1193}; 1193};
1194 1194
1195struct nfs_unlinkdata {
1196 struct hlist_node list;
1197 struct nfs_removeargs args;
1198 struct nfs_removeres res;
1199 struct inode *dir;
1200 struct rpc_cred *cred;
1201 struct nfs_fattr dir_attr;
1202};
1203
1204struct nfs_renamedata {
1205 struct nfs_renameargs args;
1206 struct nfs_renameres res;
1207 struct rpc_cred *cred;
1208 struct inode *old_dir;
1209 struct dentry *old_dentry;
1210 struct nfs_fattr old_fattr;
1211 struct inode *new_dir;
1212 struct dentry *new_dentry;
1213 struct nfs_fattr new_fattr;
1214};
1215
1195struct nfs_access_entry; 1216struct nfs_access_entry;
1196struct nfs_client; 1217struct nfs_client;
1197struct rpc_timeout; 1218struct rpc_timeout;
@@ -1221,10 +1242,12 @@ struct nfs_rpc_ops {
1221 struct iattr *, int, struct nfs_open_context *); 1242 struct iattr *, int, struct nfs_open_context *);
1222 int (*remove) (struct inode *, struct qstr *); 1243 int (*remove) (struct inode *, struct qstr *);
1223 void (*unlink_setup) (struct rpc_message *, struct inode *dir); 1244 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1245 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1224 int (*unlink_done) (struct rpc_task *, struct inode *); 1246 int (*unlink_done) (struct rpc_task *, struct inode *);
1225 int (*rename) (struct inode *, struct qstr *, 1247 int (*rename) (struct inode *, struct qstr *,
1226 struct inode *, struct qstr *); 1248 struct inode *, struct qstr *);
1227 void (*rename_setup) (struct rpc_message *msg, struct inode *dir); 1249 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1250 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1228 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); 1251 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1229 int (*link) (struct inode *, struct inode *, struct qstr *); 1252 int (*link) (struct inode *, struct inode *, struct qstr *);
1230 int (*symlink) (struct inode *, struct dentry *, struct page *, 1253 int (*symlink) (struct inode *, struct dentry *, struct page *,
@@ -1244,8 +1267,10 @@ struct nfs_rpc_ops {
1244 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1267 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1245 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1268 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1246 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1269 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1270 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1247 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1271 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1248 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1272 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1273 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1249 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1274 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1250 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); 1275 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
1251 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 1276 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
@@ -1275,11 +1300,11 @@ struct nfs_rpc_ops {
1275extern const struct nfs_rpc_ops nfs_v2_clientops; 1300extern const struct nfs_rpc_ops nfs_v2_clientops;
1276extern const struct nfs_rpc_ops nfs_v3_clientops; 1301extern const struct nfs_rpc_ops nfs_v3_clientops;
1277extern const struct nfs_rpc_ops nfs_v4_clientops; 1302extern const struct nfs_rpc_ops nfs_v4_clientops;
1278extern struct rpc_version nfs_version2; 1303extern const struct rpc_version nfs_version2;
1279extern struct rpc_version nfs_version3; 1304extern const struct rpc_version nfs_version3;
1280extern struct rpc_version nfs_version4; 1305extern const struct rpc_version nfs_version4;
1281 1306
1282extern struct rpc_version nfsacl_version3; 1307extern const struct rpc_version nfsacl_version3;
1283extern struct rpc_program nfsacl_program; 1308extern const struct rpc_program nfsacl_program;
1284 1309
1285#endif 1310#endif
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 7454ad7451b4..89bd4a4dcfb4 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -41,6 +41,7 @@
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43#include <linux/magic.h> 43#include <linux/magic.h>
44#include <linux/bug.h>
44 45
45 46
46#define NILFS_INODE_BMAP_SIZE 7 47#define NILFS_INODE_BMAP_SIZE 7
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 0f5ff3739820..e474f6e780cc 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -156,21 +156,23 @@
156 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 156 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
157 * or %NL80211_ATTR_MAC. 157 * or %NL80211_ATTR_MAC.
158 * 158 *
159 * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a 159 * @NL80211_CMD_GET_BEACON: (not used)
160 * %NL80222_CMD_NEW_BEACON message) 160 * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
161 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface 161 * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL
162 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, 162 * attributes. For drivers that generate the beacon and probe responses
163 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. 163 * internally, the following attributes must be provided: %NL80211_ATTR_IE,
164 * Following attributes are provided for drivers that generate full Beacon 164 * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP.
165 * and Probe Response frames internally: %NL80211_ATTR_SSID, 165 * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters
166 * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that
167 * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL,
168 * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID,
166 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, 169 * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
167 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, 170 * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
168 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, 171 * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
169 * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, 172 * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
170 * %NL80211_ATTR_IE_ASSOC_RESP. 173 * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
171 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 174 * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
172 * parameters are like for %NL80211_CMD_SET_BEACON. 175 * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
173 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
174 * 176 *
175 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by 177 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
176 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. 178 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
@@ -367,6 +369,11 @@
367 * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, 369 * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
368 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and 370 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
369 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. 371 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
372 * Background scan period can optionally be
373 * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
374 * if not specified default background scan configuration
375 * in driver is used and if period value is 0, bg scan will be disabled.
376 * This attribute is ignored if driver does not support roam scan.
370 * It is also sent as an event, with the BSSID and response IEs when the 377 * It is also sent as an event, with the BSSID and response IEs when the
371 * connection is established or failed to be established. This can be 378 * connection is established or failed to be established. This can be
372 * determined by the STATUS_CODE attribute. 379 * determined by the STATUS_CODE attribute.
@@ -565,8 +572,10 @@ enum nl80211_commands {
565 572
566 NL80211_CMD_GET_BEACON, 573 NL80211_CMD_GET_BEACON,
567 NL80211_CMD_SET_BEACON, 574 NL80211_CMD_SET_BEACON,
568 NL80211_CMD_NEW_BEACON, 575 NL80211_CMD_START_AP,
569 NL80211_CMD_DEL_BEACON, 576 NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP,
577 NL80211_CMD_STOP_AP,
578 NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP,
570 579
571 NL80211_CMD_GET_STATION, 580 NL80211_CMD_GET_STATION,
572 NL80211_CMD_SET_STATION, 581 NL80211_CMD_SET_STATION,
@@ -1193,6 +1202,19 @@ enum nl80211_commands {
1193 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of 1202 * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
1194 * up to 16 TIDs. 1203 * up to 16 TIDs.
1195 * 1204 *
1205 * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be
1206 * used by the drivers which has MLME in firmware and does not have support
1207 * to report per station tx/rx activity to free up the staion entry from
1208 * the list. This needs to be used when the driver advertises the
1209 * capability to timeout the stations.
1210 *
1211 * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int);
1212 * this attribute is (depending on the driver capabilities) added to
1213 * received frames indicated with %NL80211_CMD_FRAME.
1214 *
1215 * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds
1216 * or 0 to disable background scan.
1217 *
1196 * @NL80211_ATTR_MAX: highest attribute number currently defined 1218 * @NL80211_ATTR_MAX: highest attribute number currently defined
1197 * @__NL80211_ATTR_AFTER_LAST: internal use 1219 * @__NL80211_ATTR_AFTER_LAST: internal use
1198 */ 1220 */
@@ -1438,6 +1460,12 @@ enum nl80211_attrs {
1438 1460
1439 NL80211_ATTR_NOACK_MAP, 1461 NL80211_ATTR_NOACK_MAP,
1440 1462
1463 NL80211_ATTR_INACTIVITY_TIMEOUT,
1464
1465 NL80211_ATTR_RX_SIGNAL_DBM,
1466
1467 NL80211_ATTR_BG_SCAN_PERIOD,
1468
1441 /* add attributes here, update the policy in nl80211.c */ 1469 /* add attributes here, update the policy in nl80211.c */
1442 1470
1443 __NL80211_ATTR_AFTER_LAST, 1471 __NL80211_ATTR_AFTER_LAST,
@@ -1475,6 +1503,7 @@ enum nl80211_attrs {
1475#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS 1503#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
1476 1504
1477#define NL80211_MAX_SUPP_RATES 32 1505#define NL80211_MAX_SUPP_RATES 32
1506#define NL80211_MAX_SUPP_HT_RATES 77
1478#define NL80211_MAX_SUPP_REG_RULES 32 1507#define NL80211_MAX_SUPP_REG_RULES 32
1479#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 1508#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
1480#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 1509#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
@@ -2104,6 +2133,13 @@ enum nl80211_mntr_flags {
2104 * TUs) during which a mesh STA can send only one Action frame containing a 2133 * TUs) during which a mesh STA can send only one Action frame containing a
2105 * PERR element. 2134 * PERR element.
2106 * 2135 *
2136 * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding
2137 * or forwarding entity (default is TRUE - forwarding entity)
2138 *
2139 * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the
2140 * threshold for average signal strength of candidate station to establish
2141 * a peer link.
2142 *
2107 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2143 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
2108 * 2144 *
2109 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2145 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -2128,6 +2164,8 @@ enum nl80211_meshconf_params {
2128 NL80211_MESHCONF_HWMP_RANN_INTERVAL, 2164 NL80211_MESHCONF_HWMP_RANN_INTERVAL,
2129 NL80211_MESHCONF_GATE_ANNOUNCEMENTS, 2165 NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
2130 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, 2166 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2167 NL80211_MESHCONF_FORWARDING,
2168 NL80211_MESHCONF_RSSI_THRESHOLD,
2131 2169
2132 /* keep last */ 2170 /* keep last */
2133 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2171 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2401,12 +2439,15 @@ enum nl80211_key_attributes {
2401 * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with 2439 * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
2402 * 1 = 500 kbps) but without the IE length restriction (at most 2440 * 1 = 500 kbps) but without the IE length restriction (at most
2403 * %NL80211_MAX_SUPP_RATES in a single array). 2441 * %NL80211_MAX_SUPP_RATES in a single array).
2442 * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection
2443 * in an array of MCS numbers.
2404 * @__NL80211_TXRATE_AFTER_LAST: internal 2444 * @__NL80211_TXRATE_AFTER_LAST: internal
2405 * @NL80211_TXRATE_MAX: highest TX rate attribute 2445 * @NL80211_TXRATE_MAX: highest TX rate attribute
2406 */ 2446 */
2407enum nl80211_tx_rate_attributes { 2447enum nl80211_tx_rate_attributes {
2408 __NL80211_TXRATE_INVALID, 2448 __NL80211_TXRATE_INVALID,
2409 NL80211_TXRATE_LEGACY, 2449 NL80211_TXRATE_LEGACY,
2450 NL80211_TXRATE_MCS,
2410 2451
2411 /* keep last */ 2452 /* keep last */
2412 __NL80211_TXRATE_AFTER_LAST, 2453 __NL80211_TXRATE_AFTER_LAST,
@@ -2792,10 +2833,13 @@ enum nl80211_ap_sme_features {
2792 * TX status to the socket error queue when requested with the 2833 * TX status to the socket error queue when requested with the
2793 * socket option. 2834 * socket option.
2794 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. 2835 * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
2836 * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
2837 * the connected inactive stations in AP mode.
2795 */ 2838 */
2796enum nl80211_feature_flags { 2839enum nl80211_feature_flags {
2797 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 2840 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
2798 NL80211_FEATURE_HT_IBSS = 1 << 1, 2841 NL80211_FEATURE_HT_IBSS = 1 << 1,
2842 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
2799}; 2843};
2800 2844
2801/** 2845/**
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 2d304efc89df..db50840e6355 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -14,7 +14,7 @@
14 * may be used to reset the timeout - for code which intentionally 14 * may be used to reset the timeout - for code which intentionally
15 * disables interrupts for a long time. This call is stateless. 15 * disables interrupts for a long time. This call is stateless.
16 */ 16 */
17#if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) 17#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
18#include <asm/nmi.h> 18#include <asm/nmi.h>
19extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
20#else 20#else
diff --git a/include/linux/of.h b/include/linux/of.h
index 92cf6ad35e0e..ba5d8494f2e1 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -58,6 +58,9 @@ struct device_node {
58 struct kref kref; 58 struct kref kref;
59 unsigned long _flags; 59 unsigned long _flags;
60 void *data; 60 void *data;
61#if defined(CONFIG_EEH)
62 struct eeh_dev *edev;
63#endif
61#if defined(CONFIG_SPARC) 64#if defined(CONFIG_SPARC)
62 char *path_component_name; 65 char *path_component_name;
63 unsigned int unique_id; 66 unsigned int unique_id;
@@ -72,19 +75,24 @@ struct of_phandle_args {
72 uint32_t args[MAX_PHANDLE_ARGS]; 75 uint32_t args[MAX_PHANDLE_ARGS];
73}; 76};
74 77
75#if defined(CONFIG_SPARC) || !defined(CONFIG_OF) 78#if defined(CONFIG_EEH)
79static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
80{
81 return dn->edev;
82}
83#endif
84
85#ifdef CONFIG_OF_DYNAMIC
86extern struct device_node *of_node_get(struct device_node *node);
87extern void of_node_put(struct device_node *node);
88#else /* CONFIG_OF_DYNAMIC */
76/* Dummy ref counting routines - to be implemented later */ 89/* Dummy ref counting routines - to be implemented later */
77static inline struct device_node *of_node_get(struct device_node *node) 90static inline struct device_node *of_node_get(struct device_node *node)
78{ 91{
79 return node; 92 return node;
80} 93}
81static inline void of_node_put(struct device_node *node) 94static inline void of_node_put(struct device_node *node) { }
82{ 95#endif /* !CONFIG_OF_DYNAMIC */
83}
84#else
85extern struct device_node *of_node_get(struct device_node *node);
86extern void of_node_put(struct device_node *node);
87#endif
88 96
89#ifdef CONFIG_OF 97#ifdef CONFIG_OF
90 98
@@ -217,6 +225,9 @@ extern int of_property_read_string(struct device_node *np,
217extern int of_property_read_string_index(struct device_node *np, 225extern int of_property_read_string_index(struct device_node *np,
218 const char *propname, 226 const char *propname,
219 int index, const char **output); 227 int index, const char **output);
228extern int of_property_match_string(struct device_node *np,
229 const char *propname,
230 const char *string);
220extern int of_property_count_strings(struct device_node *np, 231extern int of_property_count_strings(struct device_node *np,
221 const char *propname); 232 const char *propname);
222extern int of_device_is_compatible(const struct device_node *device, 233extern int of_device_is_compatible(const struct device_node *device,
@@ -350,6 +361,22 @@ static inline int of_machine_is_compatible(const char *compat)
350#define of_match_node(_matches, _node) NULL 361#define of_match_node(_matches, _node) NULL
351#endif /* CONFIG_OF */ 362#endif /* CONFIG_OF */
352 363
364/**
365 * of_property_read_bool - Findfrom a property
366 * @np: device node from which the property value is to be read.
367 * @propname: name of the property to be searched.
368 *
369 * Search for a property in a device node.
370 * Returns true if the property exist false otherwise.
371 */
372static inline bool of_property_read_bool(const struct device_node *np,
373 const char *propname)
374{
375 struct property *prop = of_find_property(np, propname, NULL);
376
377 return prop ? true : false;
378}
379
353static inline int of_property_read_u32(const struct device_node *np, 380static inline int of_property_read_u32(const struct device_node *np,
354 const char *propname, 381 const char *propname,
355 u32 *out_value) 382 u32 *out_value)
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 3118623c2c1f..01b925ad8d78 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,6 +4,7 @@
4#include <linux/errno.h> 4#include <linux/errno.h>
5#include <linux/of.h> 5#include <linux/of.h>
6 6
7#ifdef CONFIG_OF_ADDRESS
7extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 8extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
8extern int of_address_to_resource(struct device_node *dev, int index, 9extern int of_address_to_resource(struct device_node *dev, int index,
9 struct resource *r); 10 struct resource *r);
@@ -25,12 +26,37 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
25#define pci_address_to_pio pci_address_to_pio 26#define pci_address_to_pio pci_address_to_pio
26#endif 27#endif
27 28
28#ifdef CONFIG_PCI 29#else /* CONFIG_OF_ADDRESS */
30static inline int of_address_to_resource(struct device_node *dev, int index,
31 struct resource *r)
32{
33 return -EINVAL;
34}
35static inline struct device_node *of_find_matching_node_by_address(
36 struct device_node *from,
37 const struct of_device_id *matches,
38 u64 base_address)
39{
40 return NULL;
41}
42static inline void __iomem *of_iomap(struct device_node *device, int index)
43{
44 return NULL;
45}
46static inline const u32 *of_get_address(struct device_node *dev, int index,
47 u64 *size, unsigned int *flags)
48{
49 return NULL;
50}
51#endif /* CONFIG_OF_ADDRESS */
52
53
54#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
29extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 55extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
30 u64 *size, unsigned int *flags); 56 u64 *size, unsigned int *flags);
31extern int of_pci_address_to_resource(struct device_node *dev, int bar, 57extern int of_pci_address_to_resource(struct device_node *dev, int bar,
32 struct resource *r); 58 struct resource *r);
33#else /* CONFIG_PCI */ 59#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
34static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 60static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
35 struct resource *r) 61 struct resource *r)
36{ 62{
@@ -42,8 +68,7 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
42{ 68{
43 return NULL; 69 return NULL;
44} 70}
45#endif /* CONFIG_PCI */ 71#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
46
47 72
48#endif /* __OF_ADDRESS_H */ 73#endif /* __OF_ADDRESS_H */
49 74
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index ae5638480ef2..901b7435e890 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -5,10 +5,11 @@
5#include <linux/of_platform.h> /* temporary until merge */ 5#include <linux/of_platform.h> /* temporary until merge */
6 6
7#ifdef CONFIG_OF_DEVICE 7#ifdef CONFIG_OF_DEVICE
8#include <linux/device.h>
9#include <linux/of.h> 8#include <linux/of.h>
10#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
11 10
11struct device;
12
12extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
13 const struct of_device_id *matches, const struct device *dev); 14 const struct of_device_id *matches, const struct device *dev);
14extern void of_device_make_bus_id(struct device *dev); 15extern void of_device_make_bus_id(struct device *dev);
@@ -34,7 +35,8 @@ extern void of_device_unregister(struct platform_device *ofdev);
34extern ssize_t of_device_get_modalias(struct device *dev, 35extern ssize_t of_device_get_modalias(struct device *dev,
35 char *str, ssize_t len); 36 char *str, ssize_t len);
36 37
37extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); 38extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
39extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
38 40
39static inline void of_device_node_put(struct device *dev) 41static inline void of_device_node_put(struct device *dev)
40{ 42{
@@ -49,7 +51,10 @@ static inline int of_driver_match_device(struct device *dev,
49 return 0; 51 return 0;
50} 52}
51 53
52static inline int of_device_uevent(struct device *dev, 54static inline void of_device_uevent(struct device *dev,
55 struct kobj_uevent_env *env) { }
56
57static inline int of_device_uevent_modalias(struct device *dev,
53 struct kobj_uevent_env *env) 58 struct kobj_uevent_env *env)
54{ 59{
55 return -ENODEV; 60 return -ENODEV;
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index b254052a49d7..81733d12cbea 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -50,7 +50,8 @@ 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_count(struct device_node *np); 53extern unsigned int of_gpio_named_count(struct device_node *np,
54 const char* propname);
54 55
55extern int of_mm_gpiochip_add(struct device_node *np, 56extern int of_mm_gpiochip_add(struct device_node *np,
56 struct of_mm_gpio_chip *mm_gc); 57 struct of_mm_gpio_chip *mm_gc);
@@ -71,7 +72,8 @@ static inline int of_get_named_gpio_flags(struct device_node *np,
71 return -ENOSYS; 72 return -ENOSYS;
72} 73}
73 74
74static inline unsigned int of_gpio_count(struct device_node *np) 75static inline unsigned int of_gpio_named_count(struct device_node *np,
76 const char* propname)
75{ 77{
76 return 0; 78 return 0;
77} 79}
@@ -89,6 +91,27 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
89#endif /* CONFIG_OF_GPIO */ 91#endif /* CONFIG_OF_GPIO */
90 92
91/** 93/**
94 * of_gpio_count - Count GPIOs for a device
95 * @np: device node to count GPIOs for
96 *
97 * The function returns the count of GPIOs specified for a node.
98 *
99 * Note that the empty GPIO specifiers counts too. For example,
100 *
101 * gpios = <0
102 * &pio1 1 2
103 * 0
104 * &pio2 3 4>;
105 *
106 * defines four GPIOs (so this function will return 4), two of which
107 * are not specified.
108 */
109static inline unsigned int of_gpio_count(struct device_node *np)
110{
111 return of_gpio_named_count(np, "gpios");
112}
113
114/**
92 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API 115 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
93 * @np: device node to get GPIO from 116 * @np: device node to get GPIO from
94 * @index: index of the GPIO 117 * @index: index of the GPIO
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d0307eed20c9..d229ad3edee0 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -6,6 +6,7 @@ struct of_irq;
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/errno.h> 7#include <linux/errno.h>
8#include <linux/irq.h> 8#include <linux/irq.h>
9#include <linux/irqdomain.h>
9#include <linux/ioport.h> 10#include <linux/ioport.h>
10#include <linux/of.h> 11#include <linux/of.h>
11 12
@@ -65,9 +66,6 @@ extern int of_irq_map_one(struct device_node *device, int index,
65extern unsigned int irq_create_of_mapping(struct device_node *controller, 66extern unsigned int irq_create_of_mapping(struct device_node *controller,
66 const u32 *intspec, 67 const u32 *intspec,
67 unsigned int intsize); 68 unsigned int intsize);
68#ifdef CONFIG_IRQ_DOMAIN
69extern void irq_dispose_mapping(unsigned int irq);
70#endif
71extern int of_irq_to_resource(struct device_node *dev, int index, 69extern int of_irq_to_resource(struct device_node *dev, int index,
72 struct resource *r); 70 struct resource *r);
73extern int of_irq_count(struct device_node *dev); 71extern int of_irq_count(struct device_node *dev);
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
new file mode 100644
index 000000000000..bae1b6094c63
--- /dev/null
+++ b/include/linux/of_mtd.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * OF helpers for mtd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MTD_H
10#define __LINUX_OF_NET_H
11
12#ifdef CONFIG_OF_MTD
13#include <linux/of.h>
14extern const int of_get_nand_ecc_mode(struct device_node *np);
15int of_get_nand_bus_width(struct device_node *np);
16bool of_get_nand_on_flash_bbt(struct device_node *np);
17#endif
18
19#endif /* __LINUX_OF_MTD_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 040ce2f6e8de..b47d2040c9f2 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
81 struct device *parent); 81 struct device *parent);
82extern struct platform_device *of_find_device_by_node(struct device_node *np); 82extern struct platform_device *of_find_device_by_node(struct device_node *np);
83 83
84#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ 84#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
85/* Platform devices and busses creation */ 85/* Platform devices and busses creation */
86extern struct platform_device *of_platform_device_create(struct device_node *np, 86extern struct platform_device *of_platform_device_create(struct device_node *np,
87 const char *bus_id, 87 const char *bus_id,
@@ -94,8 +94,19 @@ extern int of_platform_populate(struct device_node *root,
94 const struct of_device_id *matches, 94 const struct of_device_id *matches,
95 const struct of_dev_auxdata *lookup, 95 const struct of_dev_auxdata *lookup,
96 struct device *parent); 96 struct device *parent);
97#endif /* !CONFIG_SPARC */ 97#endif /* CONFIG_OF_ADDRESS */
98 98
99#endif /* CONFIG_OF_DEVICE */ 99#endif /* CONFIG_OF_DEVICE */
100 100
101#if !defined(CONFIG_OF_ADDRESS)
102struct of_dev_auxdata;
103static inline int of_platform_populate(struct device_node *root,
104 const struct of_device_id *matches,
105 const struct of_dev_auxdata *lookup,
106 struct device *parent)
107{
108 return -ENODEV;
109}
110#endif /* !CONFIG_OF_ADDRESS */
111
101#endif /* _LINUX_OF_PLATFORM_H */ 112#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index c0b018790f07..4ff57e81051d 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -222,41 +222,11 @@ struct omapfb_display_info {
222 222
223#include <plat/board.h> 223#include <plat/board.h>
224 224
225#ifdef CONFIG_ARCH_OMAP1
226#define OMAPFB_PLANE_NUM 1
227#else
228#define OMAPFB_PLANE_NUM 3
229#endif
230
231struct omapfb_mem_region {
232 u32 paddr;
233 void __iomem *vaddr;
234 unsigned long size;
235 u8 type; /* OMAPFB_PLANE_MEM_* */
236 enum omapfb_color_format format;/* OMAPFB_COLOR_* */
237 unsigned format_used:1; /* Must be set when format is set.
238 * Needed b/c of the badly chosen 0
239 * base for OMAPFB_COLOR_* values
240 */
241 unsigned alloc:1; /* allocated by the driver */
242 unsigned map:1; /* kernel mapped by the driver */
243};
244
245struct omapfb_mem_desc {
246 int region_cnt;
247 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
248};
249
250struct omapfb_platform_data { 225struct omapfb_platform_data {
251 struct omap_lcd_config lcd; 226 struct omap_lcd_config lcd;
252 struct omapfb_mem_desc mem_desc;
253 void *ctrl_platform_data;
254}; 227};
255 228
256/* in arch/arm/plat-omap/fb.c */ 229void __init omapfb_set_lcd_config(const struct omap_lcd_config *config);
257extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
258extern void omapfb_set_ctrl_platform_data(void *pdata);
259extern void omapfb_reserve_sdram_memblock(void);
260 230
261#endif 231#endif
262 232
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 552fba9c7d5a..3d7647536b03 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -49,7 +49,7 @@ extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
50 50
51extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 51extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
52 int order, nodemask_t *mask); 52 int order, nodemask_t *mask, bool force_kill);
53extern int register_oom_notifier(struct notifier_block *nb); 53extern int register_oom_notifier(struct notifier_block *nb);
54extern int unregister_oom_notifier(struct notifier_block *nb); 54extern int unregister_oom_notifier(struct notifier_block *nb);
55 55
diff --git a/include/linux/opp.h b/include/linux/opp.h
index ee94b33080c2..2a4e5faee904 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20 20
21struct opp; 21struct opp;
22struct device;
22 23
23enum opp_event { 24enum opp_event {
24 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, 25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 4633b2f726b6..86292beebfe2 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -46,7 +46,6 @@ struct padata_priv {
46 struct list_head list; 46 struct list_head list;
47 struct parallel_data *pd; 47 struct parallel_data *pd;
48 int cb_cpu; 48 int cb_cpu;
49 int seq_nr;
50 int info; 49 int info;
51 void (*parallel)(struct padata_priv *padata); 50 void (*parallel)(struct padata_priv *padata);
52 void (*serial)(struct padata_priv *padata); 51 void (*serial)(struct padata_priv *padata);
@@ -116,7 +115,6 @@ struct padata_cpumask {
116 * @pinst: padata instance. 115 * @pinst: padata instance.
117 * @pqueue: percpu padata queues used for parallelization. 116 * @pqueue: percpu padata queues used for parallelization.
118 * @squeue: percpu padata queues used for serialuzation. 117 * @squeue: percpu padata queues used for serialuzation.
119 * @seq_nr: The sequence number that will be attached to the next object.
120 * @reorder_objects: Number of objects waiting in the reorder queues. 118 * @reorder_objects: Number of objects waiting in the reorder queues.
121 * @refcnt: Number of objects holding a reference on this parallel_data. 119 * @refcnt: Number of objects holding a reference on this parallel_data.
122 * @max_seq_nr: Maximal used sequence number. 120 * @max_seq_nr: Maximal used sequence number.
@@ -129,12 +127,12 @@ struct parallel_data {
129 struct padata_instance *pinst; 127 struct padata_instance *pinst;
130 struct padata_parallel_queue __percpu *pqueue; 128 struct padata_parallel_queue __percpu *pqueue;
131 struct padata_serial_queue __percpu *squeue; 129 struct padata_serial_queue __percpu *squeue;
132 atomic_t seq_nr;
133 atomic_t reorder_objects; 130 atomic_t reorder_objects;
134 atomic_t refcnt; 131 atomic_t refcnt;
135 unsigned int max_seq_nr;
136 struct padata_cpumask cpumask; 132 struct padata_cpumask cpumask;
137 spinlock_t lock ____cacheline_aligned; 133 spinlock_t lock ____cacheline_aligned;
134 spinlock_t seq_lock;
135 unsigned int seq_nr;
138 unsigned int processed; 136 unsigned int processed;
139 struct timer_list timer; 137 struct timer_list timer;
140}; 138};
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e90a673be67e..c88d2a9451af 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,6 +6,7 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/bug.h>
9#ifndef __GENERATING_BOUNDS_H 10#ifndef __GENERATING_BOUNDS_H
10#include <linux/mm_types.h> 11#include <linux/mm_types.h>
11#include <generated/bounds.h> 12#include <generated/bounds.h>
@@ -414,11 +415,26 @@ static inline int PageTransHuge(struct page *page)
414 return PageHead(page); 415 return PageHead(page);
415} 416}
416 417
418/*
419 * PageTransCompound returns true for both transparent huge pages
420 * and hugetlbfs pages, so it should only be called when it's known
421 * that hugetlbfs pages aren't involved.
422 */
417static inline int PageTransCompound(struct page *page) 423static inline int PageTransCompound(struct page *page)
418{ 424{
419 return PageCompound(page); 425 return PageCompound(page);
420} 426}
421 427
428/*
429 * PageTransTail returns true for both transparent huge pages
430 * and hugetlbfs pages, so it should only be called when it's known
431 * that hugetlbfs pages aren't involved.
432 */
433static inline int PageTransTail(struct page *page)
434{
435 return PageTail(page);
436}
437
422#else 438#else
423 439
424static inline int PageTransHuge(struct page *page) 440static inline int PageTransHuge(struct page *page)
@@ -430,6 +446,11 @@ static inline int PageTransCompound(struct page *page)
430{ 446{
431 return 0; 447 return 0;
432} 448}
449
450static inline int PageTransTail(struct page *page)
451{
452 return 0;
453}
433#endif 454#endif
434 455
435#ifdef CONFIG_MMU 456#ifdef CONFIG_MMU
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index a2d11771c84b..a88cdba27809 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -4,12 +4,8 @@
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
7 PCG_CACHE, /* charged as cache */
8 PCG_USED, /* this object is in use. */ 7 PCG_USED, /* this object is in use. */
9 PCG_MIGRATION, /* under page migration */ 8 PCG_MIGRATION, /* under page migration */
10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 __NR_PCG_FLAGS, 9 __NR_PCG_FLAGS,
14}; 10};
15 11
@@ -64,19 +60,10 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
64static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ 60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
65 { return test_and_clear_bit(PCG_##lname, &pc->flags); } 61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
66 62
67/* Cache flag is set only once (at allocation) */
68TESTPCGFLAG(Cache, CACHE)
69CLEARPCGFLAG(Cache, CACHE)
70SETPCGFLAG(Cache, CACHE)
71
72TESTPCGFLAG(Used, USED) 63TESTPCGFLAG(Used, USED)
73CLEARPCGFLAG(Used, USED) 64CLEARPCGFLAG(Used, USED)
74SETPCGFLAG(Used, USED) 65SETPCGFLAG(Used, USED)
75 66
76SETPCGFLAG(FileMapped, FILE_MAPPED)
77CLEARPCGFLAG(FileMapped, FILE_MAPPED)
78TESTPCGFLAG(FileMapped, FILE_MAPPED)
79
80SETPCGFLAG(Migration, MIGRATION) 67SETPCGFLAG(Migration, MIGRATION)
81CLEARPCGFLAG(Migration, MIGRATION) 68CLEARPCGFLAG(Migration, MIGRATION)
82TESTPCGFLAG(Migration, MIGRATION) 69TESTPCGFLAG(Migration, MIGRATION)
@@ -85,7 +72,7 @@ static inline void lock_page_cgroup(struct page_cgroup *pc)
85{ 72{
86 /* 73 /*
87 * Don't take this lock in IRQ context. 74 * Don't take this lock in IRQ context.
88 * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION 75 * This lock is for pc->mem_cgroup, USED, MIGRATION
89 */ 76 */
90 bit_spin_lock(PCG_LOCK, &pc->flags); 77 bit_spin_lock(PCG_LOCK, &pc->flags);
91} 78}
@@ -95,24 +82,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc)
95 bit_spin_unlock(PCG_LOCK, &pc->flags); 82 bit_spin_unlock(PCG_LOCK, &pc->flags);
96} 83}
97 84
98static inline void move_lock_page_cgroup(struct page_cgroup *pc,
99 unsigned long *flags)
100{
101 /*
102 * We know updates to pc->flags of page cache's stats are from both of
103 * usual context or IRQ context. Disable IRQ to avoid deadlock.
104 */
105 local_irq_save(*flags);
106 bit_spin_lock(PCG_MOVE_LOCK, &pc->flags);
107}
108
109static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
110 unsigned long *flags)
111{
112 bit_spin_unlock(PCG_MOVE_LOCK, &pc->flags);
113 local_irq_restore(*flags);
114}
115
116#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 85#else /* CONFIG_CGROUP_MEM_RES_CTLR */
117struct page_cgroup; 86struct page_cgroup;
118 87
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a16b1df3deff..e444f5b49118 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -299,7 +299,6 @@ struct pci_dev {
299 */ 299 */
300 unsigned int irq; 300 unsigned int irq;
301 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 301 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
302 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
303 302
304 /* These fields are used by common fixups */ 303 /* These fields are used by common fixups */
305 unsigned int transparent:1; /* Transparent PCI bridge */ 304 unsigned int transparent:1; /* Transparent PCI bridge */
@@ -369,24 +368,17 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
369 return (pdev->error_state != pci_channel_io_normal); 368 return (pdev->error_state != pci_channel_io_normal);
370} 369}
371 370
372static inline struct pci_cap_saved_state *pci_find_saved_cap( 371struct pci_host_bridge_window {
373 struct pci_dev *pci_dev, char cap) 372 struct list_head list;
374{ 373 struct resource *res; /* host bridge aperture (CPU address) */
375 struct pci_cap_saved_state *tmp; 374 resource_size_t offset; /* bus address + offset = CPU address */
376 struct hlist_node *pos; 375};
377
378 hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) {
379 if (tmp->cap.cap_nr == cap)
380 return tmp;
381 }
382 return NULL;
383}
384 376
385static inline void pci_add_saved_cap(struct pci_dev *pci_dev, 377struct pci_host_bridge {
386 struct pci_cap_saved_state *new_cap) 378 struct list_head list;
387{ 379 struct pci_bus *bus; /* root bus */
388 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 380 struct list_head windows; /* pci_host_bridge_windows */
389} 381};
390 382
391/* 383/*
392 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
@@ -656,6 +648,10 @@ void pci_fixup_cardbus(struct pci_bus *);
656 648
657/* Generic PCI functions used internally */ 649/* Generic PCI functions used internally */
658 650
651void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
652 struct resource *res);
653void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
654 struct pci_bus_region *region);
659void pcibios_scan_specific_bus(int busn); 655void pcibios_scan_specific_bus(int busn);
660extern struct pci_bus *pci_find_bus(int domain, int busnr); 656extern struct pci_bus *pci_find_bus(int domain, int busnr);
661void pci_bus_add_devices(const struct pci_bus *bus); 657void pci_bus_add_devices(const struct pci_bus *bus);
@@ -690,7 +686,8 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
690extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 686extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
691extern void pci_dev_put(struct pci_dev *dev); 687extern void pci_dev_put(struct pci_dev *dev);
692extern void pci_remove_bus(struct pci_bus *b); 688extern void pci_remove_bus(struct pci_bus *b);
693extern void pci_remove_bus_device(struct pci_dev *dev); 689extern void __pci_remove_bus_device(struct pci_dev *dev);
690extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
694extern void pci_stop_bus_device(struct pci_dev *dev); 691extern void pci_stop_bus_device(struct pci_dev *dev);
695void pci_setup_cardbus(struct pci_bus *bus); 692void pci_setup_cardbus(struct pci_bus *bus);
696extern void pci_sort_breadthfirst(void); 693extern void pci_sort_breadthfirst(void);
@@ -746,28 +743,28 @@ int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
746 int where, u32 val); 743 int where, u32 val);
747struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); 744struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops);
748 745
749static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 746static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val)
750{ 747{
751 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); 748 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
752} 749}
753static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) 750static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val)
754{ 751{
755 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); 752 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
756} 753}
757static inline int pci_read_config_dword(struct pci_dev *dev, int where, 754static inline int pci_read_config_dword(const struct pci_dev *dev, int where,
758 u32 *val) 755 u32 *val)
759{ 756{
760 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); 757 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
761} 758}
762static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) 759static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val)
763{ 760{
764 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); 761 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
765} 762}
766static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) 763static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val)
767{ 764{
768 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); 765 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
769} 766}
770static inline int pci_write_config_dword(struct pci_dev *dev, int where, 767static inline int pci_write_config_dword(const struct pci_dev *dev, int where,
771 u32 val) 768 u32 val)
772{ 769{
773 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); 770 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
@@ -817,6 +814,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
817int pcie_get_mps(struct pci_dev *dev); 814int pcie_get_mps(struct pci_dev *dev);
818int pcie_set_mps(struct pci_dev *dev, int mps); 815int pcie_set_mps(struct pci_dev *dev, int mps);
819int __pci_reset_function(struct pci_dev *dev); 816int __pci_reset_function(struct pci_dev *dev);
817int __pci_reset_function_locked(struct pci_dev *dev);
820int pci_reset_function(struct pci_dev *dev); 818int pci_reset_function(struct pci_dev *dev);
821void pci_update_resource(struct pci_dev *dev, int resno); 819void pci_update_resource(struct pci_dev *dev, int resno);
822int __must_check pci_assign_resource(struct pci_dev *dev, int i); 820int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -882,6 +880,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev);
882/* Functions for PCI Hotplug drivers to use */ 880/* Functions for PCI Hotplug drivers to use */
883int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 881int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
884#ifdef CONFIG_HOTPLUG 882#ifdef CONFIG_HOTPLUG
883unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge);
885unsigned int pci_rescan_bus(struct pci_bus *bus); 884unsigned int pci_rescan_bus(struct pci_bus *bus);
886#endif 885#endif
887 886
@@ -891,13 +890,13 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
891int pci_vpd_truncate(struct pci_dev *dev, size_t size); 890int pci_vpd_truncate(struct pci_dev *dev, size_t size);
892 891
893/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 892/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
893resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
894void pci_bus_assign_resources(const struct pci_bus *bus); 894void pci_bus_assign_resources(const struct pci_bus *bus);
895void pci_bus_size_bridges(struct pci_bus *bus); 895void pci_bus_size_bridges(struct pci_bus *bus);
896int pci_claim_resource(struct pci_dev *, int); 896int pci_claim_resource(struct pci_dev *, int);
897void pci_assign_unassigned_resources(void); 897void pci_assign_unassigned_resources(void);
898void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); 898void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge);
899void pdev_enable_device(struct pci_dev *); 899void pdev_enable_device(struct pci_dev *);
900void pdev_sort_resources(struct pci_dev *, struct resource_list *);
901int pci_enable_resources(struct pci_dev *, int mask); 900int pci_enable_resources(struct pci_dev *, int mask);
902void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 901void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
903 int (*)(const struct pci_dev *, u8, u8)); 902 int (*)(const struct pci_dev *, u8, u8));
@@ -914,6 +913,8 @@ void pci_release_selected_regions(struct pci_dev *, int);
914 913
915/* drivers/pci/bus.c */ 914/* drivers/pci/bus.c */
916void pci_add_resource(struct list_head *resources, struct resource *res); 915void pci_add_resource(struct list_head *resources, struct resource *res);
916void pci_add_resource_offset(struct list_head *resources, struct resource *res,
917 resource_size_t offset);
917void pci_free_resource_list(struct list_head *resources); 918void pci_free_resource_list(struct list_head *resources);
918void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 919void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
919struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 920struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
@@ -946,7 +947,20 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *,
946 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 947 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
947 948
948void pci_unregister_driver(struct pci_driver *dev); 949void pci_unregister_driver(struct pci_driver *dev);
949void pci_remove_behind_bridge(struct pci_dev *dev); 950
951/**
952 * module_pci_driver() - Helper macro for registering a PCI driver
953 * @__pci_driver: pci_driver struct
954 *
955 * Helper macro for PCI drivers which do not do anything special in module
956 * init/exit. This eliminates a lot of boilerplate. Each module may only
957 * use this macro once, and calling it replaces module_init() and module_exit()
958 */
959#define module_pci_driver(__pci_driver) \
960 module_driver(__pci_driver, pci_register_driver, \
961 pci_unregister_driver)
962
963void pci_stop_and_remove_behind_bridge(struct pci_dev *dev);
950struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 964struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
951int pci_add_dynid(struct pci_driver *drv, 965int pci_add_dynid(struct pci_driver *drv,
952 unsigned int vendor, unsigned int device, 966 unsigned int vendor, unsigned int device,
@@ -1382,7 +1396,10 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1382 */ 1396 */
1383 1397
1384struct pci_fixup { 1398struct pci_fixup {
1385 u16 vendor, device; /* You can use PCI_ANY_ID here of course */ 1399 u16 vendor; /* You can use PCI_ANY_ID here of course */
1400 u16 device; /* You can use PCI_ANY_ID here of course */
1401 u32 class; /* You can use PCI_ANY_ID here too */
1402 unsigned int class_shift; /* should be 0, 8, 16 */
1386 void (*hook)(struct pci_dev *dev); 1403 void (*hook)(struct pci_dev *dev);
1387}; 1404};
1388 1405
@@ -1397,30 +1414,68 @@ enum pci_fixup_pass {
1397}; 1414};
1398 1415
1399/* Anonymous variables would be nice... */ 1416/* Anonymous variables would be nice... */
1400#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 1417#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1401 static const struct pci_fixup __pci_fixup_##name __used \ 1418 class_shift, hook) \
1402 __attribute__((__section__(#section))) = { vendor, device, hook }; 1419 static const struct pci_fixup const __pci_fixup_##name __used \
1420 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1421 = { vendor, device, class, class_shift, hook };
1422
1423#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
1424 class_shift, hook) \
1425 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1426 vendor##device##hook, vendor, device, class, class_shift, hook)
1427#define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \
1428 class_shift, hook) \
1429 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1430 vendor##device##hook, vendor, device, class, class_shift, hook)
1431#define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \
1432 class_shift, hook) \
1433 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1434 vendor##device##hook, vendor, device, class, class_shift, hook)
1435#define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \
1436 class_shift, hook) \
1437 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1438 vendor##device##hook, vendor, device, class, class_shift, hook)
1439#define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \
1440 class_shift, hook) \
1441 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1442 resume##vendor##device##hook, vendor, device, class, \
1443 class_shift, hook)
1444#define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \
1445 class_shift, hook) \
1446 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1447 resume_early##vendor##device##hook, vendor, device, \
1448 class, class_shift, hook)
1449#define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \
1450 class_shift, hook) \
1451 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1452 suspend##vendor##device##hook, vendor, device, class, \
1453 class_shift, hook)
1454
1403#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1455#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
1404 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1456 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
1405 vendor##device##hook, vendor, device, hook) 1457 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1406#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ 1458#define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \
1407 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ 1459 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
1408 vendor##device##hook, vendor, device, hook) 1460 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1409#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ 1461#define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \
1410 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ 1462 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
1411 vendor##device##hook, vendor, device, hook) 1463 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1412#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ 1464#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
1413 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ 1465 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
1414 vendor##device##hook, vendor, device, hook) 1466 vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook)
1415#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1467#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1416 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1468 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1417 resume##vendor##device##hook, vendor, device, hook) 1469 resume##vendor##device##hook, vendor, device, \
1470 PCI_ANY_ID, 0, hook)
1418#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ 1471#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1419 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ 1472 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1420 resume_early##vendor##device##hook, vendor, device, hook) 1473 resume_early##vendor##device##hook, vendor, device, \
1474 PCI_ANY_ID, 0, hook)
1421#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ 1475#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1422 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ 1476 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1423 suspend##vendor##device##hook, vendor, device, hook) 1477 suspend##vendor##device##hook, vendor, device, \
1478 PCI_ANY_ID, 0, hook)
1424 1479
1425#ifdef CONFIG_PCI_QUIRKS 1480#ifdef CONFIG_PCI_QUIRKS
1426void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1481void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
@@ -1647,6 +1702,13 @@ static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
1647static inline void pci_release_bus_of_node(struct pci_bus *bus) { } 1702static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
1648#endif /* CONFIG_OF */ 1703#endif /* CONFIG_OF */
1649 1704
1705#ifdef CONFIG_EEH
1706static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
1707{
1708 return pdev->dev.archdata.edev;
1709}
1710#endif
1711
1650/** 1712/**
1651 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1713 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
1652 * @pdev: the PCI device 1714 * @pdev: the PCI device
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 31d77af2ef42..3329965ed63f 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2105,6 +2105,7 @@
2105#define PCI_DEVICE_ID_NX2_57711E 0x1650 2105#define PCI_DEVICE_ID_NX2_57711E 0x1650
2106#define PCI_DEVICE_ID_TIGON3_5705 0x1653 2106#define PCI_DEVICE_ID_TIGON3_5705 0x1653
2107#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 2107#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
2108#define PCI_DEVICE_ID_TIGON3_5719 0x1657
2108#define PCI_DEVICE_ID_TIGON3_5721 0x1659 2109#define PCI_DEVICE_ID_TIGON3_5721 0x1659
2109#define PCI_DEVICE_ID_TIGON3_5722 0x165a 2110#define PCI_DEVICE_ID_TIGON3_5722 0x165a
2110#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2111#define PCI_DEVICE_ID_TIGON3_5723 0x165b
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e41a10f5ae83..4b608f543412 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -391,6 +391,7 @@
391#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ 391#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
394#define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */
394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ 395#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
395#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ 396#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 397#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index abb2776be1ba..bd9f55a5958d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -129,11 +129,40 @@ enum perf_event_sample_format {
129 PERF_SAMPLE_PERIOD = 1U << 8, 129 PERF_SAMPLE_PERIOD = 1U << 8,
130 PERF_SAMPLE_STREAM_ID = 1U << 9, 130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10, 131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
132 133
133 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ 134 PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */
134}; 135};
135 136
136/* 137/*
138 * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
139 *
140 * If the user does not pass priv level information via branch_sample_type,
141 * the kernel uses the event's priv level. Branch and event priv levels do
142 * not have to match. Branch priv level is checked for permissions.
143 *
144 * The branch types can be combined, however BRANCH_ANY covers all types
145 * of branches and therefore it supersedes all the other types.
146 */
147enum perf_branch_sample_type {
148 PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */
149 PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */
150 PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */
151
152 PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */
153 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
154 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
155 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
156
157 PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */
158};
159
160#define PERF_SAMPLE_BRANCH_PLM_ALL \
161 (PERF_SAMPLE_BRANCH_USER|\
162 PERF_SAMPLE_BRANCH_KERNEL|\
163 PERF_SAMPLE_BRANCH_HV)
164
165/*
137 * The format of the data returned by read() on a perf event fd, 166 * The format of the data returned by read() on a perf event fd,
138 * as specified by attr.read_format: 167 * as specified by attr.read_format:
139 * 168 *
@@ -163,6 +192,8 @@ enum perf_event_read_format {
163}; 192};
164 193
165#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ 194#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
195#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
196#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
166 197
167/* 198/*
168 * Hardware event_id to monitor via a performance monitoring event: 199 * Hardware event_id to monitor via a performance monitoring event:
@@ -240,6 +271,7 @@ struct perf_event_attr {
240 __u64 bp_len; 271 __u64 bp_len;
241 __u64 config2; /* extension of config1 */ 272 __u64 config2; /* extension of config1 */
242 }; 273 };
274 __u64 branch_sample_type; /* enum branch_sample_type */
243}; 275};
244 276
245/* 277/*
@@ -291,12 +323,14 @@ struct perf_event_mmap_page {
291 __s64 offset; /* add to hardware event value */ 323 __s64 offset; /* add to hardware event value */
292 __u64 time_enabled; /* time event active */ 324 __u64 time_enabled; /* time event active */
293 __u64 time_running; /* time event on cpu */ 325 __u64 time_running; /* time event on cpu */
326 __u32 time_mult, time_shift;
327 __u64 time_offset;
294 328
295 /* 329 /*
296 * Hole for extension of the self monitor capabilities 330 * Hole for extension of the self monitor capabilities
297 */ 331 */
298 332
299 __u64 __reserved[123]; /* align to 1k */ 333 __u64 __reserved[121]; /* align to 1k */
300 334
301 /* 335 /*
302 * Control data for the mmap() data buffer. 336 * Control data for the mmap() data buffer.
@@ -456,6 +490,8 @@ enum perf_event_type {
456 * 490 *
457 * { u32 size; 491 * { u32 size;
458 * char data[size];}&& PERF_SAMPLE_RAW 492 * char data[size];}&& PERF_SAMPLE_RAW
493 *
494 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
459 * }; 495 * };
460 */ 496 */
461 PERF_RECORD_SAMPLE = 9, 497 PERF_RECORD_SAMPLE = 9,
@@ -512,7 +548,7 @@ struct perf_guest_info_callbacks {
512#include <linux/ftrace.h> 548#include <linux/ftrace.h>
513#include <linux/cpu.h> 549#include <linux/cpu.h>
514#include <linux/irq_work.h> 550#include <linux/irq_work.h>
515#include <linux/jump_label.h> 551#include <linux/static_key.h>
516#include <linux/atomic.h> 552#include <linux/atomic.h>
517#include <asm/local.h> 553#include <asm/local.h>
518 554
@@ -528,12 +564,34 @@ struct perf_raw_record {
528 void *data; 564 void *data;
529}; 565};
530 566
567/*
568 * single taken branch record layout:
569 *
570 * from: source instruction (may not always be a branch insn)
571 * to: branch target
572 * mispred: branch target was mispredicted
573 * predicted: branch target was predicted
574 *
575 * support for mispred, predicted is optional. In case it
576 * is not supported mispred = predicted = 0.
577 */
531struct perf_branch_entry { 578struct perf_branch_entry {
532 __u64 from; 579 __u64 from;
533 __u64 to; 580 __u64 to;
534 __u64 flags; 581 __u64 mispred:1, /* target mispredicted */
582 predicted:1,/* target predicted */
583 reserved:62;
535}; 584};
536 585
586/*
587 * branch stack layout:
588 * nr: number of taken branches stored in entries[]
589 *
590 * Note that nr can vary from sample to sample
591 * branches (to, from) are stored from most recent
592 * to least recent, i.e., entries[0] contains the most
593 * recent branch.
594 */
537struct perf_branch_stack { 595struct perf_branch_stack {
538 __u64 nr; 596 __u64 nr;
539 struct perf_branch_entry entries[0]; 597 struct perf_branch_entry entries[0];
@@ -564,7 +622,9 @@ struct hw_perf_event {
564 unsigned long event_base; 622 unsigned long event_base;
565 int idx; 623 int idx;
566 int last_cpu; 624 int last_cpu;
625
567 struct hw_perf_event_extra extra_reg; 626 struct hw_perf_event_extra extra_reg;
627 struct hw_perf_event_extra branch_reg;
568 }; 628 };
569 struct { /* software */ 629 struct { /* software */
570 struct hrtimer hrtimer; 630 struct hrtimer hrtimer;
@@ -616,6 +676,7 @@ struct pmu {
616 struct list_head entry; 676 struct list_head entry;
617 677
618 struct device *dev; 678 struct device *dev;
679 const struct attribute_group **attr_groups;
619 char *name; 680 char *name;
620 int type; 681 int type;
621 682
@@ -681,6 +742,17 @@ struct pmu {
681 * for each successful ->add() during the transaction. 742 * for each successful ->add() during the transaction.
682 */ 743 */
683 void (*cancel_txn) (struct pmu *pmu); /* optional */ 744 void (*cancel_txn) (struct pmu *pmu); /* optional */
745
746 /*
747 * Will return the value for perf_event_mmap_page::index for this event,
748 * if no implementation is provided it will default to: event->hw.idx + 1.
749 */
750 int (*event_idx) (struct perf_event *event); /*optional */
751
752 /*
753 * flush branch stack on context-switches (needed in cpu-wide mode)
754 */
755 void (*flush_branch_stack) (void);
684}; 756};
685 757
686/** 758/**
@@ -850,6 +922,9 @@ struct perf_event {
850#ifdef CONFIG_EVENT_TRACING 922#ifdef CONFIG_EVENT_TRACING
851 struct ftrace_event_call *tp_event; 923 struct ftrace_event_call *tp_event;
852 struct event_filter *filter; 924 struct event_filter *filter;
925#ifdef CONFIG_FUNCTION_TRACER
926 struct ftrace_ops ftrace_ops;
927#endif
853#endif 928#endif
854 929
855#ifdef CONFIG_CGROUP_PERF 930#ifdef CONFIG_CGROUP_PERF
@@ -911,7 +986,8 @@ struct perf_event_context {
911 u64 parent_gen; 986 u64 parent_gen;
912 u64 generation; 987 u64 generation;
913 int pin_count; 988 int pin_count;
914 int nr_cgroups; /* cgroup events present */ 989 int nr_cgroups; /* cgroup evts */
990 int nr_branch_stack; /* branch_stack evt */
915 struct rcu_head rcu_head; 991 struct rcu_head rcu_head;
916}; 992};
917 993
@@ -976,6 +1052,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr,
976extern u64 perf_event_read_value(struct perf_event *event, 1052extern u64 perf_event_read_value(struct perf_event *event,
977 u64 *enabled, u64 *running); 1053 u64 *enabled, u64 *running);
978 1054
1055
979struct perf_sample_data { 1056struct perf_sample_data {
980 u64 type; 1057 u64 type;
981 1058
@@ -995,12 +1072,14 @@ struct perf_sample_data {
995 u64 period; 1072 u64 period;
996 struct perf_callchain_entry *callchain; 1073 struct perf_callchain_entry *callchain;
997 struct perf_raw_record *raw; 1074 struct perf_raw_record *raw;
1075 struct perf_branch_stack *br_stack;
998}; 1076};
999 1077
1000static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1078static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr)
1001{ 1079{
1002 data->addr = addr; 1080 data->addr = addr;
1003 data->raw = NULL; 1081 data->raw = NULL;
1082 data->br_stack = NULL;
1004} 1083}
1005 1084
1006extern void perf_output_sample(struct perf_output_handle *handle, 1085extern void perf_output_sample(struct perf_output_handle *handle,
@@ -1029,7 +1108,7 @@ static inline int is_software_event(struct perf_event *event)
1029 return event->pmu->task_ctx_nr == perf_sw_context; 1108 return event->pmu->task_ctx_nr == perf_sw_context;
1030} 1109}
1031 1110
1032extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; 1111extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
1033 1112
1034extern void __perf_sw_event(u32, u64, struct pt_regs *, u64); 1113extern void __perf_sw_event(u32, u64, struct pt_regs *, u64);
1035 1114
@@ -1057,7 +1136,7 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1057{ 1136{
1058 struct pt_regs hot_regs; 1137 struct pt_regs hot_regs;
1059 1138
1060 if (static_branch(&perf_swevent_enabled[event_id])) { 1139 if (static_key_false(&perf_swevent_enabled[event_id])) {
1061 if (!regs) { 1140 if (!regs) {
1062 perf_fetch_caller_regs(&hot_regs); 1141 perf_fetch_caller_regs(&hot_regs);
1063 regs = &hot_regs; 1142 regs = &hot_regs;
@@ -1066,12 +1145,12 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1066 } 1145 }
1067} 1146}
1068 1147
1069extern struct jump_label_key_deferred perf_sched_events; 1148extern struct static_key_deferred perf_sched_events;
1070 1149
1071static inline void perf_event_task_sched_in(struct task_struct *prev, 1150static inline void perf_event_task_sched_in(struct task_struct *prev,
1072 struct task_struct *task) 1151 struct task_struct *task)
1073{ 1152{
1074 if (static_branch(&perf_sched_events.key)) 1153 if (static_key_false(&perf_sched_events.key))
1075 __perf_event_task_sched_in(prev, task); 1154 __perf_event_task_sched_in(prev, task);
1076} 1155}
1077 1156
@@ -1080,7 +1159,7 @@ static inline void perf_event_task_sched_out(struct task_struct *prev,
1080{ 1159{
1081 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1160 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1082 1161
1083 if (static_branch(&perf_sched_events.key)) 1162 if (static_key_false(&perf_sched_events.key))
1084 __perf_event_task_sched_out(prev, next); 1163 __perf_event_task_sched_out(prev, next);
1085} 1164}
1086 1165
@@ -1139,6 +1218,11 @@ extern void perf_bp_event(struct perf_event *event, void *data);
1139# define perf_instruction_pointer(regs) instruction_pointer(regs) 1218# define perf_instruction_pointer(regs) instruction_pointer(regs)
1140#endif 1219#endif
1141 1220
1221static inline bool has_branch_stack(struct perf_event *event)
1222{
1223 return event->attr.sample_type & PERF_SAMPLE_BRANCH_STACK;
1224}
1225
1142extern int perf_output_begin(struct perf_output_handle *handle, 1226extern int perf_output_begin(struct perf_output_handle *handle,
1143 struct perf_event *event, unsigned int size); 1227 struct perf_event *event, unsigned int size);
1144extern void perf_output_end(struct perf_output_handle *handle); 1228extern void perf_output_end(struct perf_output_handle *handle);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index c599f7eca1e7..6fe0a37d4abf 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -19,7 +19,6 @@
19#define __PHY_H 19#define __PHY_H
20 20
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/device.h>
23#include <linux/ethtool.h> 22#include <linux/ethtool.h>
24#include <linux/mii.h> 23#include <linux/mii.h>
25#include <linux/timer.h> 24#include <linux/timer.h>
@@ -88,6 +87,9 @@ typedef enum {
88 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ 87 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
89#define MII_ADDR_C45 (1<<30) 88#define MII_ADDR_C45 (1<<30)
90 89
90struct device;
91struct sk_buff;
92
91/* 93/*
92 * The Bus class for PHYs. Devices which provide access to 94 * The Bus class for PHYs. Devices which provide access to
93 * PHYs should register using this structure 95 * PHYs should register using this structure
@@ -241,7 +243,6 @@ enum phy_state {
241 PHY_RESUMING 243 PHY_RESUMING
242}; 244};
243 245
244struct sk_buff;
245 246
246/* phy_device: An instance of a PHY 247/* phy_device: An instance of a PHY
247 * 248 *
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index e7cf6669ac34..f5bd679be46b 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -2,6 +2,7 @@
2#define _LINUX_PID_NS_H 2#define _LINUX_PID_NS_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/bug.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/threads.h> 7#include <linux/threads.h>
7#include <linux/nsproxy.h> 8#include <linux/nsproxy.h>
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
new file mode 100644
index 000000000000..191e72688481
--- /dev/null
+++ b/include/linux/pinctrl/consumer.h
@@ -0,0 +1,159 @@
1/*
2 * Consumer interface the pin control subsystem
3 *
4 * Copyright (C) 2012 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * Based on bits of regulator core, gpio core and clk core
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_CONSUMER_H
13#define __LINUX_PINCTRL_CONSUMER_H
14
15#include <linux/err.h>
16#include <linux/list.h>
17#include <linux/seq_file.h>
18#include "pinctrl-state.h"
19
20/* This struct is private to the core and should be regarded as a cookie */
21struct pinctrl;
22struct pinctrl_state;
23
24#ifdef CONFIG_PINCTRL
25
26/* External interface to pin control */
27extern int pinctrl_request_gpio(unsigned gpio);
28extern void pinctrl_free_gpio(unsigned gpio);
29extern int pinctrl_gpio_direction_input(unsigned gpio);
30extern int pinctrl_gpio_direction_output(unsigned gpio);
31
32extern struct pinctrl * __must_check pinctrl_get(struct device *dev);
33extern void pinctrl_put(struct pinctrl *p);
34extern struct pinctrl_state * __must_check pinctrl_lookup_state(
35 struct pinctrl *p,
36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38
39#else /* !CONFIG_PINCTRL */
40
41static inline int pinctrl_request_gpio(unsigned gpio)
42{
43 return 0;
44}
45
46static inline void pinctrl_free_gpio(unsigned gpio)
47{
48}
49
50static inline int pinctrl_gpio_direction_input(unsigned gpio)
51{
52 return 0;
53}
54
55static inline int pinctrl_gpio_direction_output(unsigned gpio)
56{
57 return 0;
58}
59
60static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
61{
62 return NULL;
63}
64
65static inline void pinctrl_put(struct pinctrl *p)
66{
67}
68
69static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
70 struct pinctrl *p,
71 const char *name)
72{
73 return NULL;
74}
75
76static inline int pinctrl_select_state(struct pinctrl *p,
77 struct pinctrl_state *s)
78{
79 return 0;
80}
81
82#endif /* CONFIG_PINCTRL */
83
84static inline struct pinctrl * __must_check pinctrl_get_select(
85 struct device *dev, const char *name)
86{
87 struct pinctrl *p;
88 struct pinctrl_state *s;
89 int ret;
90
91 p = pinctrl_get(dev);
92 if (IS_ERR(p))
93 return p;
94
95 s = pinctrl_lookup_state(p, name);
96 if (IS_ERR(s)) {
97 pinctrl_put(p);
98 return ERR_PTR(PTR_ERR(s));
99 }
100
101 ret = pinctrl_select_state(p, s);
102 if (ret < 0) {
103 pinctrl_put(p);
104 return ERR_PTR(ret);
105 }
106
107 return p;
108}
109
110static inline struct pinctrl * __must_check pinctrl_get_select_default(
111 struct device *dev)
112{
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114}
115
116#ifdef CONFIG_PINCONF
117
118extern int pin_config_get(const char *dev_name, const char *name,
119 unsigned long *config);
120extern int pin_config_set(const char *dev_name, const char *name,
121 unsigned long config);
122extern int pin_config_group_get(const char *dev_name,
123 const char *pin_group,
124 unsigned long *config);
125extern int pin_config_group_set(const char *dev_name,
126 const char *pin_group,
127 unsigned long config);
128
129#else
130
131static inline int pin_config_get(const char *dev_name, const char *name,
132 unsigned long *config)
133{
134 return 0;
135}
136
137static inline int pin_config_set(const char *dev_name, const char *name,
138 unsigned long config)
139{
140 return 0;
141}
142
143static inline int pin_config_group_get(const char *dev_name,
144 const char *pin_group,
145 unsigned long *config)
146{
147 return 0;
148}
149
150static inline int pin_config_group_set(const char *dev_name,
151 const char *pin_group,
152 unsigned long config)
153{
154 return 0;
155}
156
157#endif
158
159#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index d0aecb7f6fb9..fee4349364f7 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -9,87 +9,153 @@
9 * 9 *
10 * License terms: GNU General Public License (GPL) version 2 10 * License terms: GNU General Public License (GPL) version 2
11 */ 11 */
12#ifndef __LINUX_PINMUX_MACHINE_H 12#ifndef __LINUX_PINCTRL_MACHINE_H
13#define __LINUX_PINMUX_MACHINE_H 13#define __LINUX_PINCTRL_MACHINE_H
14
15#include "pinctrl-state.h"
16
17enum pinctrl_map_type {
18 PIN_MAP_TYPE_INVALID,
19 PIN_MAP_TYPE_DUMMY_STATE,
20 PIN_MAP_TYPE_MUX_GROUP,
21 PIN_MAP_TYPE_CONFIGS_PIN,
22 PIN_MAP_TYPE_CONFIGS_GROUP,
23};
24
25/**
26 * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP
27 * @group: the name of the group whose mux function is to be configured. This
28 * field may be left NULL, and the first applicable group for the function
29 * will be used.
30 * @function: the mux function to select for the group
31 */
32struct pinctrl_map_mux {
33 const char *group;
34 const char *function;
35};
14 36
15/** 37/**
16 * struct pinmux_map - boards/machines shall provide this map for devices 38 * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_*
39 * @group_or_pin: the name of the pin or group whose configuration parameters
40 * are to be configured.
41 * @configs: a pointer to an array of config parameters/values to program into
42 * hardware. Each individual pin controller defines the format and meaning
43 * of config parameters.
44 * @num_configs: the number of entries in array @configs
45 */
46struct pinctrl_map_configs {
47 const char *group_or_pin;
48 unsigned long *configs;
49 unsigned num_configs;
50};
51
52/**
53 * struct pinctrl_map - boards/machines shall provide this map for devices
54 * @dev_name: the name of the device using this specific mapping, the name
55 * must be the same as in your struct device*. If this name is set to the
56 * same name as the pin controllers own dev_name(), the map entry will be
57 * hogged by the driver itself upon registration
17 * @name: the name of this specific map entry for the particular machine. 58 * @name: the name of this specific map entry for the particular machine.
18 * This is the second parameter passed to pinmux_get() when you want 59 * This is the parameter passed to pinmux_lookup_state()
19 * to have several mappings to the same device 60 * @type: the type of mapping table entry
20 * @ctrl_dev: the pin control device to be used by this mapping, may be NULL
21 * if you provide .ctrl_dev_name instead (this is more common)
22 * @ctrl_dev_name: the name of the device controlling this specific mapping, 61 * @ctrl_dev_name: the name of the device controlling this specific mapping,
23 * the name must be the same as in your struct device*, may be NULL if 62 * the name must be the same as in your struct device*. This field is not
24 * you provide .ctrl_dev instead 63 * used for PIN_MAP_TYPE_DUMMY_STATE
25 * @function: a function in the driver to use for this mapping, the driver 64 * @data: Data specific to the mapping type
26 * will lookup the function referenced by this ID on the specified
27 * pin control device
28 * @group: sometimes a function can map to different pin groups, so this
29 * selects a certain specific pin group to activate for the function, if
30 * left as NULL, the first applicable group will be used
31 * @dev: the device using this specific mapping, may be NULL if you provide
32 * .dev_name instead (this is more common)
33 * @dev_name: the name of the device using this specific mapping, the name
34 * must be the same as in your struct device*, may be NULL if you
35 * provide .dev instead
36 * @hog_on_boot: if this is set to true, the pin control subsystem will itself
37 * hog the mappings as the pinmux device drivers are attached, so this is
38 * typically used with system maps (mux mappings without an assigned
39 * device) that you want to get hogged and enabled by default as soon as
40 * a pinmux device supporting it is registered. These maps will not be
41 * disabled and put until the system shuts down.
42 */ 65 */
43struct pinmux_map { 66struct pinctrl_map {
67 const char *dev_name;
44 const char *name; 68 const char *name;
45 struct device *ctrl_dev; 69 enum pinctrl_map_type type;
46 const char *ctrl_dev_name; 70 const char *ctrl_dev_name;
47 const char *function; 71 union {
48 const char *group; 72 struct pinctrl_map_mux mux;
49 struct device *dev; 73 struct pinctrl_map_configs configs;
50 const char *dev_name; 74 } data;
51 bool hog_on_boot;
52}; 75};
53 76
54/* 77/* Convenience macros to create mapping table entries */
55 * Convenience macro to set a simple map from a certain pin controller and a
56 * certain function to a named device
57 */
58#define PINMUX_MAP(a, b, c, d) \
59 { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d }
60 78
61/* 79#define PIN_MAP_DUMMY_STATE(dev, state) \
62 * Convenience macro to map a system function onto a certain pinctrl device. 80 { \
63 * System functions are not assigned to a particular device. 81 .dev_name = dev, \
64 */ 82 .name = state, \
65#define PINMUX_MAP_SYS(a, b, c) \ 83 .type = PIN_MAP_TYPE_DUMMY_STATE, \
66 { .name = a, .ctrl_dev_name = b, .function = c } 84 }
67 85
68/* 86#define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \
69 * Convenience macro to map a system function onto a certain pinctrl device, 87 { \
70 * to be hogged by the pinmux core until the system shuts down. 88 .dev_name = dev, \
71 */ 89 .name = state, \
72#define PINMUX_MAP_SYS_HOG(a, b, c) \ 90 .type = PIN_MAP_TYPE_MUX_GROUP, \
73 { .name = a, .ctrl_dev_name = b, .function = c, \ 91 .ctrl_dev_name = pinctrl, \
74 .hog_on_boot = true } 92 .data.mux = { \
93 .group = grp, \
94 .function = func, \
95 }, \
96 }
75 97
76/* 98#define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \
77 * Convenience macro to map a system function onto a certain pinctrl device 99 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func)
78 * using a specified group, to be hogged by the pinmux core until the system 100
79 * shuts down. 101#define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \
80 */ 102 PIN_MAP_MUX_GROUP(dev, state, dev, grp, func)
81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ 103
82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ 104#define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \
83 .hog_on_boot = true } 105 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func)
106
107#define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \
108 { \
109 .dev_name = dev, \
110 .name = state, \
111 .type = PIN_MAP_TYPE_CONFIGS_PIN, \
112 .ctrl_dev_name = pinctrl, \
113 .data.configs = { \
114 .group_or_pin = pin, \
115 .configs = cfgs, \
116 .num_configs = ARRAY_SIZE(cfgs), \
117 }, \
118 }
119
120#define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \
121 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs)
122
123#define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \
124 PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs)
125
126#define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \
127 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs)
128
129#define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \
130 { \
131 .dev_name = dev, \
132 .name = state, \
133 .type = PIN_MAP_TYPE_CONFIGS_GROUP, \
134 .ctrl_dev_name = pinctrl, \
135 .data.configs = { \
136 .group_or_pin = grp, \
137 .configs = cfgs, \
138 .num_configs = ARRAY_SIZE(cfgs), \
139 }, \
140 }
141
142#define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \
143 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs)
144
145#define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \
146 PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs)
147
148#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
149 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
84 150
85#ifdef CONFIG_PINMUX 151#ifdef CONFIG_PINMUX
86 152
87extern int pinmux_register_mappings(struct pinmux_map const *map, 153extern int pinctrl_register_mappings(struct pinctrl_map const *map,
88 unsigned num_maps); 154 unsigned num_maps);
89 155
90#else 156#else
91 157
92static inline int pinmux_register_mappings(struct pinmux_map const *map, 158static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
93 unsigned num_maps) 159 unsigned num_maps)
94{ 160{
95 return 0; 161 return 0;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
new file mode 100644
index 000000000000..4f0abb9f1c09
--- /dev/null
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -0,0 +1,114 @@
1/*
2 * Interface the generic pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H
13#define __LINUX_PINCTRL_PINCONF_GENERIC_H
14
15/*
16 * You shouldn't even be able to compile with these enums etc unless you're
17 * using generic pin config. That is why this is defined out.
18 */
19#ifdef CONFIG_GENERIC_PINCONF
20
21/**
22 * enum pin_config_param - possible pin configuration parameters
23 * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
24 * transition from say pull-up to pull-down implies that you disable
25 * pull-up in the process, this setting disables all biasing.
26 * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: the pin will be set to a high impedance
27 * mode, also know as "third-state" (tristate) or "high-Z" or "floating".
28 * On output pins this effectively disconnects the pin, which is useful
29 * if for example some other pin is going to drive the signal connected
30 * to it for a while. Pins used for input are usually always high
31 * impedance.
32 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
33 * impedance to VDD). If the argument is != 0 pull-up is enabled,
34 * if it is 0, pull-up is disabled.
35 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
36 * impedance to GROUND). If the argument is != 0 pull-down is enabled,
37 * if it is 0, pull-down is disabled.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Sending this config will enabale
41 * push-pull mode, the argument is ignored.
42 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open
43 * collector) which means it is usually wired with other output ports
44 * which are then pulled up with an external resistor. Sending this
45 * config will enabale open drain mode, the argument is ignored.
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
48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
50 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
51 * the threshold value is given on a custom format as argument when
52 * setting pins to this mode. The argument zero turns the schmitt trigger
53 * off.
54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
55 * which means it will wait for signals to settle when reading inputs. The
56 * argument gives the debounce time on a custom format. Setting the
57 * argument to zero turns debouncing off.
58 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
59 * supplies, the argument to this parameter (on a custom format) tells
60 * the driver which alternative power source to use.
61 * @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
63 * 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.
65 * @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
67 * PIN_CONFIG_END+1 as the base offset.
68 */
69enum pin_config_param {
70 PIN_CONFIG_BIAS_DISABLE,
71 PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
72 PIN_CONFIG_BIAS_PULL_UP,
73 PIN_CONFIG_BIAS_PULL_DOWN,
74 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT,
78 PIN_CONFIG_INPUT_DEBOUNCE,
79 PIN_CONFIG_POWER_SOURCE,
80 PIN_CONFIG_LOW_POWER_MODE,
81 PIN_CONFIG_END = 0x7FFF,
82};
83
84/*
85 * Helpful configuration macro to be used in tables etc.
86 */
87#define PIN_CONF_PACKED(p, a) ((a << 16) | ((unsigned long) p & 0xffffUL))
88
89/*
90 * The following inlines stuffs a configuration parameter and data value
91 * into and out of an unsigned long argument, as used by the generic pin config
92 * system. We put the parameter in the lower 16 bits and the argument in the
93 * upper 16 bits.
94 */
95
96static inline enum pin_config_param pinconf_to_config_param(unsigned long config)
97{
98 return (enum pin_config_param) (config & 0xffffUL);
99}
100
101static inline u16 pinconf_to_config_argument(unsigned long config)
102{
103 return (enum pin_config_param) ((config >> 16) & 0xffffUL);
104}
105
106static inline unsigned long pinconf_to_config_packed(enum pin_config_param param,
107 u16 argument)
108{
109 return PIN_CONF_PACKED(param, argument);
110}
111
112#endif /* CONFIG_GENERIC_PINCONF */
113
114#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 477922cf043a..ec431f03362d 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -20,6 +20,8 @@ struct seq_file;
20/** 20/**
21 * struct pinconf_ops - pin config operations, to be implemented by 21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers. 22 * pin configuration capable drivers.
23 * @is_generic: for pin controllers that want to use the generic interface,
24 * this flag tells the framework that it's generic.
23 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
@@ -33,6 +35,9 @@ struct seq_file;
33 * per-device info for a certain group in debugfs 35 * per-device info for a certain group in debugfs
34 */ 36 */
35struct pinconf_ops { 37struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF
39 bool is_generic;
40#endif
36 int (*pin_config_get) (struct pinctrl_dev *pctldev, 41 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin, 42 unsigned pin,
38 unsigned long *config); 43 unsigned long *config);
@@ -53,45 +58,6 @@ struct pinconf_ops {
53 unsigned selector); 58 unsigned selector);
54}; 59};
55 60
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif 61#endif
96 62
97#endif /* __LINUX_PINCTRL_PINCONF_H */ 63#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
new file mode 100644
index 000000000000..3920e28b4da7
--- /dev/null
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -0,0 +1,6 @@
1/*
2 * Standard pin control state definitions
3 */
4
5#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 8bd22ee7aa09..4e9f0788c221 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -15,10 +15,11 @@
15#ifdef CONFIG_PINCTRL 15#ifdef CONFIG_PINCTRL
16 16
17#include <linux/radix-tree.h> 17#include <linux/radix-tree.h>
18#include <linux/spinlock.h>
19#include <linux/list.h> 18#include <linux/list.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include "pinctrl-state.h"
21 21
22struct device;
22struct pinctrl_dev; 23struct pinctrl_dev;
23struct pinmux_ops; 24struct pinmux_ops;
24struct pinconf_ops; 25struct pinconf_ops;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 937b3e2fa36f..47e9237edd47 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -16,9 +16,6 @@
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include "pinctrl.h" 17#include "pinctrl.h"
18 18
19/* This struct is private to the core and should be regarded as a cookie */
20struct pinmux;
21
22#ifdef CONFIG_PINMUX 19#ifdef CONFIG_PINMUX
23 20
24struct pinctrl_dev; 21struct pinctrl_dev;
@@ -88,55 +85,6 @@ struct pinmux_ops {
88 bool input); 85 bool input);
89}; 86};
90 87
91/* External interface to pinmux */
92extern int pinmux_request_gpio(unsigned gpio);
93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
97extern void pinmux_put(struct pinmux *pmx);
98extern int pinmux_enable(struct pinmux *pmx);
99extern void pinmux_disable(struct pinmux *pmx);
100
101#else /* !CONFIG_PINMUX */
102
103static inline int pinmux_request_gpio(unsigned gpio)
104{
105 return 0;
106}
107
108static inline void pinmux_free_gpio(unsigned gpio)
109{
110}
111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
123{
124 return NULL;
125}
126
127static inline void pinmux_put(struct pinmux *pmx)
128{
129}
130
131static inline int pinmux_enable(struct pinmux *pmx)
132{
133 return 0;
134}
135
136static inline void pinmux_disable(struct pinmux *pmx)
137{
138}
139
140#endif /* CONFIG_PINMUX */ 88#endif /* CONFIG_PINMUX */
141 89
142#endif /* __LINUX_PINCTRL_PINMUX_H */ 90#endif /* __LINUX_PINCTRL_PINMUX_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 77257c92155a..6d626ff0cfd0 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_PIPE_FS_I_H 1#ifndef _LINUX_PIPE_FS_I_H
2#define _LINUX_PIPE_FS_I_H 2#define _LINUX_PIPE_FS_I_H
3 3
4#define PIPEFS_MAGIC 0x50495045
5
6#define PIPE_DEF_BUFFERS 16 4#define PIPE_DEF_BUFFERS 16
7 5
8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ 6#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 0d5b79365d03..410b33d014d2 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -127,6 +127,27 @@ struct tc_multiq_qopt {
127 __u16 max_bands; /* Maximum number of queues */ 127 __u16 max_bands; /* Maximum number of queues */
128}; 128};
129 129
130/* PLUG section */
131
132#define TCQ_PLUG_BUFFER 0
133#define TCQ_PLUG_RELEASE_ONE 1
134#define TCQ_PLUG_RELEASE_INDEFINITE 2
135#define TCQ_PLUG_LIMIT 3
136
137struct tc_plug_qopt {
138 /* TCQ_PLUG_BUFFER: Inset a plug into the queue and
139 * buffer any incoming packets
140 * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head
141 * to beginning of the next plug.
142 * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue.
143 * Stop buffering packets until the next TCQ_PLUG_BUFFER
144 * command is received (just act as a pass-thru queue).
145 * TCQ_PLUG_LIMIT: Increase/decrease queue size
146 */
147 int action;
148 __u32 limit;
149};
150
130/* TBF section */ 151/* TBF section */
131 152
132struct tc_tbf_qopt { 153struct tc_tbf_qopt {
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
new file mode 100644
index 000000000000..d056263545b1
--- /dev/null
+++ b/include/linux/platform_data/atmel.h
@@ -0,0 +1,27 @@
1/*
2 * atmel platform data
3 *
4 * GPL v2 Only
5 */
6
7#ifndef __ATMEL_NAND_H__
8#define __ATMEL_NAND_H__
9
10#include <linux/mtd/nand.h>
11
12 /* NAND / SmartMedia */
13struct atmel_nand_data {
14 int enable_pin; /* chip enable */
15 int det_pin; /* card detect */
16 int rdy_pin; /* ready/busy */
17 u8 rdy_pin_active_low; /* rdy_pin value is inverted */
18 u8 ale; /* address line number connected to ALE */
19 u8 cle; /* address line number connected to CLE */
20 u8 bus_width_16; /* buswidth is 16 bit */
21 u8 ecc_mode; /* ecc mode */
22 u8 on_flash_bbt; /* bbt on flash */
23 struct mtd_partition *parts;
24 unsigned int num_parts;
25};
26
27#endif /* __ATMEL_NAND_H__ */
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h
new file mode 100644
index 000000000000..c4e23d029498
--- /dev/null
+++ b/include/linux/platform_data/cpsw.h
@@ -0,0 +1,55 @@
1/*
2 * Texas Instruments Ethernet Switch Driver
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef __CPSW_H__
16#define __CPSW_H__
17
18#include <linux/if_ether.h>
19
20struct cpsw_slave_data {
21 u32 slave_reg_ofs;
22 u32 sliver_reg_ofs;
23 const char *phy_id;
24 int phy_if;
25 u8 mac_addr[ETH_ALEN];
26};
27
28struct cpsw_platform_data {
29 u32 ss_reg_ofs; /* Subsystem control register offset */
30 u32 channels; /* number of cpdma channels (symmetric) */
31 u32 cpdma_reg_ofs; /* cpdma register offset */
32 u32 cpdma_sram_ofs; /* cpdma sram offset */
33
34 u32 slaves; /* number of slave cpgmac ports */
35 struct cpsw_slave_data *slave_data;
36
37 u32 ale_reg_ofs; /* address lookup engine reg offset */
38 u32 ale_entries; /* ale table size */
39
40 u32 host_port_reg_ofs; /* cpsw cpdma host port registers */
41 u32 host_port_num; /* The port number for the host port */
42
43 u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */
44
45 u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/
46 u32 bd_ram_size; /*buffer descriptor ram size */
47 u32 hw_ram_addr; /*if the HW address for BD RAM is different */
48 bool no_bd_ram; /* no embedded BD ram*/
49
50 u32 rx_descs; /* Number of Rx Descriptios */
51
52 u32 mac_control; /* Mac control register */
53};
54
55#endif /* __CPSW_H__ */
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h
new file mode 100644
index 000000000000..5eb7da9b3772
--- /dev/null
+++ b/include/linux/platform_data/dwc3-exynos.h
@@ -0,0 +1,24 @@
1/**
2 * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header.
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef _DWC3_EXYNOS_H_
16#define _DWC3_EXYNOS_H_
17
18struct dwc3_exynos_data {
19 int phy_type;
20 int (*phy_init)(struct platform_device *pdev, int type);
21 int (*phy_exit)(struct platform_device *pdev, int type);
22};
23
24#endif /* _DWC3_EXYNOS_H_ */
diff --git a/include/linux/platform_data/efm32-uart.h b/include/linux/platform_data/efm32-uart.h
new file mode 100644
index 000000000000..ed0e975b3c54
--- /dev/null
+++ b/include/linux/platform_data/efm32-uart.h
@@ -0,0 +1,18 @@
1/*
2 *
3 *
4 */
5#ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__
6#define __LINUX_PLATFORM_DATA_EFM32_UART_H__
7
8#include <linux/types.h>
9
10/**
11 * struct efm32_uart_pdata
12 * @location: pinmux location for the I/O pins (to be written to the ROUTE
13 * register)
14 */
15struct efm32_uart_pdata {
16 u8 location;
17};
18#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ */
diff --git a/include/linux/platform_data/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h
new file mode 100644
index 000000000000..5d298ac10fc2
--- /dev/null
+++ b/include/linux/platform_data/omap-abe-twl6040.h
@@ -0,0 +1,49 @@
1/**
2 * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header.
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
5 * All rights reserved.
6 *
7 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
23
24#ifndef _OMAP_ABE_TWL6040_H_
25#define _OMAP_ABE_TWL6040_H_
26
27/* To select if only one channel is connected in a stereo port */
28#define ABE_TWL6040_LEFT (1 << 0)
29#define ABE_TWL6040_RIGHT (1 << 1)
30
31struct omap_abe_twl6040_data {
32 char *card_name;
33 /* Feature flags for connected audio pins */
34 u8 has_hs;
35 u8 has_hf;
36 bool has_ep;
37 u8 has_aux;
38 u8 has_vibra;
39 bool has_dmic;
40 bool has_hsmic;
41 bool has_mainmic;
42 bool has_submic;
43 u8 has_afm;
44 /* Other features */
45 bool jack_detection; /* board can detect jack events */
46 int mclk_freq; /* MCLK frequency speed for twl6040 */
47};
48
49#endif /* _OMAP_ABE_TWL6040_H_ */
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
new file mode 100644
index 000000000000..4eef5fb05a17
--- /dev/null
+++ b/include/linux/platform_data/omap4-keypad.h
@@ -0,0 +1,13 @@
1#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
2#define __LINUX_INPUT_OMAP4_KEYPAD_H
3
4#include <linux/input/matrix_keypad.h>
5
6struct omap4_keypad_platform_data {
7 const struct matrix_keymap_data *keymap_data;
8
9 u8 rows;
10 u8 cols;
11};
12
13#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h
new file mode 100644
index 000000000000..df67505e98f8
--- /dev/null
+++ b/include/linux/platform_data/tegra_emc.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 * Olof Johansson <olof@lixom.net>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
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 __TEGRA_EMC_H_
20#define __TEGRA_EMC_H_
21
22#define TEGRA_EMC_NUM_REGS 46
23
24struct tegra_emc_table {
25 unsigned long rate;
26 u32 regs[TEGRA_EMC_NUM_REGS];
27};
28
29struct tegra_emc_pdata {
30 int num_tables;
31 struct tegra_emc_table *tables;
32};
33
34#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e4982ac3fbbc..715305e05123 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -110,6 +110,10 @@ typedef struct pm_message {
110 * Subsystem-level @suspend() is executed for all devices after invoking 110 * Subsystem-level @suspend() is executed for all devices after invoking
111 * subsystem-level @prepare() for all of them. 111 * subsystem-level @prepare() for all of them.
112 * 112 *
113 * @suspend_late: Continue operations started by @suspend(). For a number of
114 * devices @suspend_late() may point to the same callback routine as the
115 * runtime suspend callback.
116 *
113 * @resume: Executed after waking the system up from a sleep state in which the 117 * @resume: Executed after waking the system up from a sleep state in which the
114 * contents of main memory were preserved. The exact action to perform 118 * contents of main memory were preserved. The exact action to perform
115 * depends on the device's subsystem, but generally the driver is expected 119 * depends on the device's subsystem, but generally the driver is expected
@@ -122,6 +126,10 @@ typedef struct pm_message {
122 * Subsystem-level @resume() is executed for all devices after invoking 126 * Subsystem-level @resume() is executed for all devices after invoking
123 * subsystem-level @resume_noirq() for all of them. 127 * subsystem-level @resume_noirq() for all of them.
124 * 128 *
129 * @resume_early: Prepare to execute @resume(). For a number of devices
130 * @resume_early() may point to the same callback routine as the runtime
131 * resume callback.
132 *
125 * @freeze: Hibernation-specific, executed before creating a hibernation image. 133 * @freeze: Hibernation-specific, executed before creating a hibernation image.
126 * Analogous to @suspend(), but it should not enable the device to signal 134 * Analogous to @suspend(), but it should not enable the device to signal
127 * wakeup events or change its power state. The majority of subsystems 135 * wakeup events or change its power state. The majority of subsystems
@@ -131,6 +139,10 @@ typedef struct pm_message {
131 * Subsystem-level @freeze() is executed for all devices after invoking 139 * Subsystem-level @freeze() is executed for all devices after invoking
132 * subsystem-level @prepare() for all of them. 140 * subsystem-level @prepare() for all of them.
133 * 141 *
142 * @freeze_late: Continue operations started by @freeze(). Analogous to
143 * @suspend_late(), but it should not enable the device to signal wakeup
144 * events or change its power state.
145 *
134 * @thaw: Hibernation-specific, executed after creating a hibernation image OR 146 * @thaw: Hibernation-specific, executed after creating a hibernation image OR
135 * if the creation of an image has failed. Also executed after a failing 147 * if the creation of an image has failed. Also executed after a failing
136 * attempt to restore the contents of main memory from such an image. 148 * attempt to restore the contents of main memory from such an image.
@@ -140,15 +152,23 @@ typedef struct pm_message {
140 * subsystem-level @thaw_noirq() for all of them. It also may be executed 152 * subsystem-level @thaw_noirq() for all of them. It also may be executed
141 * directly after @freeze() in case of a transition error. 153 * directly after @freeze() in case of a transition error.
142 * 154 *
155 * @thaw_early: Prepare to execute @thaw(). Undo the changes made by the
156 * preceding @freeze_late().
157 *
143 * @poweroff: Hibernation-specific, executed after saving a hibernation image. 158 * @poweroff: Hibernation-specific, executed after saving a hibernation image.
144 * Analogous to @suspend(), but it need not save the device's settings in 159 * Analogous to @suspend(), but it need not save the device's settings in
145 * memory. 160 * memory.
146 * Subsystem-level @poweroff() is executed for all devices after invoking 161 * Subsystem-level @poweroff() is executed for all devices after invoking
147 * subsystem-level @prepare() for all of them. 162 * subsystem-level @prepare() for all of them.
148 * 163 *
164 * @poweroff_late: Continue operations started by @poweroff(). Analogous to
165 * @suspend_late(), but it need not save the device's settings in memory.
166 *
149 * @restore: Hibernation-specific, executed after restoring the contents of main 167 * @restore: Hibernation-specific, executed after restoring the contents of main
150 * memory from a hibernation image, analogous to @resume(). 168 * memory from a hibernation image, analogous to @resume().
151 * 169 *
170 * @restore_early: Prepare to execute @restore(), analogous to @resume_early().
171 *
152 * @suspend_noirq: Complete the actions started by @suspend(). Carry out any 172 * @suspend_noirq: Complete the actions started by @suspend(). Carry out any
153 * additional operations required for suspending the device that might be 173 * additional operations required for suspending the device that might be
154 * racing with its driver's interrupt handler, which is guaranteed not to 174 * racing with its driver's interrupt handler, which is guaranteed not to
@@ -158,9 +178,10 @@ typedef struct pm_message {
158 * @suspend_noirq() has returned successfully. If the device can generate 178 * @suspend_noirq() has returned successfully. If the device can generate
159 * system wakeup signals and is enabled to wake up the system, it should be 179 * system wakeup signals and is enabled to wake up the system, it should be
160 * configured to do so at that time. However, depending on the platform 180 * configured to do so at that time. However, depending on the platform
161 * and device's subsystem, @suspend() may be allowed to put the device into 181 * and device's subsystem, @suspend() or @suspend_late() may be allowed to
162 * the low-power state and configure it to generate wakeup signals, in 182 * put the device into the low-power state and configure it to generate
163 * which case it generally is not necessary to define @suspend_noirq(). 183 * wakeup signals, in which case it generally is not necessary to define
184 * @suspend_noirq().
164 * 185 *
165 * @resume_noirq: Prepare for the execution of @resume() by carrying out any 186 * @resume_noirq: Prepare for the execution of @resume() by carrying out any
166 * operations required for resuming the device that might be racing with 187 * operations required for resuming the device that might be racing with
@@ -171,9 +192,9 @@ typedef struct pm_message {
171 * additional operations required for freezing the device that might be 192 * additional operations required for freezing the device that might be
172 * racing with its driver's interrupt handler, which is guaranteed not to 193 * racing with its driver's interrupt handler, which is guaranteed not to
173 * run while @freeze_noirq() is being executed. 194 * run while @freeze_noirq() is being executed.
174 * The power state of the device should not be changed by either @freeze() 195 * The power state of the device should not be changed by either @freeze(),
175 * or @freeze_noirq() and it should not be configured to signal system 196 * or @freeze_late(), or @freeze_noirq() and it should not be configured to
176 * wakeup by any of these callbacks. 197 * signal system wakeup by any of these callbacks.
177 * 198 *
178 * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any 199 * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any
179 * operations required for thawing the device that might be racing with its 200 * operations required for thawing the device that might be racing with its
@@ -249,6 +270,12 @@ struct dev_pm_ops {
249 int (*thaw)(struct device *dev); 270 int (*thaw)(struct device *dev);
250 int (*poweroff)(struct device *dev); 271 int (*poweroff)(struct device *dev);
251 int (*restore)(struct device *dev); 272 int (*restore)(struct device *dev);
273 int (*suspend_late)(struct device *dev);
274 int (*resume_early)(struct device *dev);
275 int (*freeze_late)(struct device *dev);
276 int (*thaw_early)(struct device *dev);
277 int (*poweroff_late)(struct device *dev);
278 int (*restore_early)(struct device *dev);
252 int (*suspend_noirq)(struct device *dev); 279 int (*suspend_noirq)(struct device *dev);
253 int (*resume_noirq)(struct device *dev); 280 int (*resume_noirq)(struct device *dev);
254 int (*freeze_noirq)(struct device *dev); 281 int (*freeze_noirq)(struct device *dev);
@@ -293,6 +320,15 @@ const struct dev_pm_ops name = { \
293/* 320/*
294 * Use this for defining a set of PM operations to be used in all situations 321 * Use this for defining a set of PM operations to be used in all situations
295 * (sustem suspend, hibernation or runtime PM). 322 * (sustem suspend, hibernation or runtime PM).
323 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should
324 * be different from the corresponding runtime PM callbacks, .runtime_suspend(),
325 * and .runtime_resume(), because .runtime_suspend() always works on an already
326 * quiescent device, while .suspend() should assume that the device may be doing
327 * something when it is called (it should ensure that the device will be
328 * quiescent after it has returned). Therefore it's better to point the "late"
329 * suspend and "early" resume callback pointers, .suspend_late() and
330 * .resume_early(), to the same routines as .runtime_suspend() and
331 * .runtime_resume(), respectively (and analogously for hibernation).
296 */ 332 */
297#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ 333#define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
298const struct dev_pm_ops name = { \ 334const struct dev_pm_ops name = { \
@@ -510,6 +546,7 @@ struct dev_pm_info {
510 unsigned long accounting_timestamp; 546 unsigned long accounting_timestamp;
511 ktime_t suspend_time; 547 ktime_t suspend_time;
512 s64 max_time_suspended_ns; 548 s64 max_time_suspended_ns;
549 struct dev_pm_qos_request *pq_req;
513#endif 550#endif
514 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
515 struct pm_qos_constraints *constraints; 552 struct pm_qos_constraints *constraints;
@@ -584,13 +621,13 @@ struct dev_pm_domain {
584 621
585#ifdef CONFIG_PM_SLEEP 622#ifdef CONFIG_PM_SLEEP
586extern void device_pm_lock(void); 623extern void device_pm_lock(void);
587extern void dpm_resume_noirq(pm_message_t state); 624extern void dpm_resume_start(pm_message_t state);
588extern void dpm_resume_end(pm_message_t state); 625extern void dpm_resume_end(pm_message_t state);
589extern void dpm_resume(pm_message_t state); 626extern void dpm_resume(pm_message_t state);
590extern void dpm_complete(pm_message_t state); 627extern void dpm_complete(pm_message_t state);
591 628
592extern void device_pm_unlock(void); 629extern void device_pm_unlock(void);
593extern int dpm_suspend_noirq(pm_message_t state); 630extern int dpm_suspend_end(pm_message_t state);
594extern int dpm_suspend_start(pm_message_t state); 631extern int dpm_suspend_start(pm_message_t state);
595extern int dpm_suspend(pm_message_t state); 632extern int dpm_suspend(pm_message_t state);
596extern int dpm_prepare(pm_message_t state); 633extern int dpm_prepare(pm_message_t state);
@@ -605,17 +642,23 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
605extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); 642extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
606 643
607extern int pm_generic_prepare(struct device *dev); 644extern int pm_generic_prepare(struct device *dev);
645extern int pm_generic_suspend_late(struct device *dev);
608extern int pm_generic_suspend_noirq(struct device *dev); 646extern int pm_generic_suspend_noirq(struct device *dev);
609extern int pm_generic_suspend(struct device *dev); 647extern int pm_generic_suspend(struct device *dev);
648extern int pm_generic_resume_early(struct device *dev);
610extern int pm_generic_resume_noirq(struct device *dev); 649extern int pm_generic_resume_noirq(struct device *dev);
611extern int pm_generic_resume(struct device *dev); 650extern int pm_generic_resume(struct device *dev);
612extern int pm_generic_freeze_noirq(struct device *dev); 651extern int pm_generic_freeze_noirq(struct device *dev);
652extern int pm_generic_freeze_late(struct device *dev);
613extern int pm_generic_freeze(struct device *dev); 653extern int pm_generic_freeze(struct device *dev);
614extern int pm_generic_thaw_noirq(struct device *dev); 654extern int pm_generic_thaw_noirq(struct device *dev);
655extern int pm_generic_thaw_early(struct device *dev);
615extern int pm_generic_thaw(struct device *dev); 656extern int pm_generic_thaw(struct device *dev);
616extern int pm_generic_restore_noirq(struct device *dev); 657extern int pm_generic_restore_noirq(struct device *dev);
658extern int pm_generic_restore_early(struct device *dev);
617extern int pm_generic_restore(struct device *dev); 659extern int pm_generic_restore(struct device *dev);
618extern int pm_generic_poweroff_noirq(struct device *dev); 660extern int pm_generic_poweroff_noirq(struct device *dev);
661extern int pm_generic_poweroff_late(struct device *dev);
619extern int pm_generic_poweroff(struct device *dev); 662extern int pm_generic_poweroff(struct device *dev);
620extern void pm_generic_complete(struct device *dev); 663extern void pm_generic_complete(struct device *dev);
621 664
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index a03a0ad998b8..91f8286106ea 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,7 +10,10 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/mutex.h>
14#include <linux/pm.h>
13#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h>
14 17
15enum gpd_status { 18enum gpd_status {
16 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 19 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,6 +73,7 @@ struct generic_pm_domain {
70 s64 break_even_ns; /* Power break even for the entire domain. */ 73 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time; 75 ktime_t power_off_time;
76 struct device_node *of_node; /* Node in device tree */
73}; 77};
74 78
75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 79static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -97,14 +101,15 @@ struct generic_pm_domain_data {
97 struct gpd_dev_ops ops; 101 struct gpd_dev_ops ops;
98 struct gpd_timing_data td; 102 struct gpd_timing_data td;
99 bool need_restore; 103 bool need_restore;
104 bool always_on;
100}; 105};
101 106
107#ifdef CONFIG_PM_GENERIC_DOMAINS
102static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) 108static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
103{ 109{
104 return container_of(pdd, struct generic_pm_domain_data, base); 110 return container_of(pdd, struct generic_pm_domain_data, base);
105} 111}
106 112
107#ifdef CONFIG_PM_GENERIC_DOMAINS
108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) 113static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
109{ 114{
110 return to_gpd_data(dev->power.subsys_data->domain_data); 115 return to_gpd_data(dev->power.subsys_data->domain_data);
@@ -117,14 +122,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev, 122 struct device *dev,
118 struct gpd_timing_data *td); 123 struct gpd_timing_data *td);
119 124
125extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
126 struct device *dev,
127 struct gpd_timing_data *td);
128
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 129static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev) 130 struct device *dev)
122{ 131{
123 return __pm_genpd_add_device(genpd, dev, NULL); 132 return __pm_genpd_add_device(genpd, dev, NULL);
124} 133}
125 134
135static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
136 struct device *dev)
137{
138 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
139}
140
126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
127 struct device *dev); 142 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val);
128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
129 struct generic_pm_domain *new_subdomain); 145 struct generic_pm_domain *new_subdomain);
130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -143,6 +159,10 @@ extern bool default_stop_ok(struct device *dev);
143extern struct dev_power_governor pm_domain_always_on_gov; 159extern struct dev_power_governor pm_domain_always_on_gov;
144#else 160#else
145 161
162static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{
164 return ERR_PTR(-ENOSYS);
165}
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{ 167{
148 return ERR_PTR(-ENOSYS); 168 return ERR_PTR(-ENOSYS);
@@ -163,6 +183,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
163{ 183{
164 return -ENOSYS; 184 return -ENOSYS;
165} 185}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
166static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
167 struct generic_pm_domain *new_sd) 188 struct generic_pm_domain *new_sd)
168{ 189{
@@ -183,7 +204,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{ 204{
184 return -ENOSYS; 205 return -ENOSYS;
185} 206}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) 207static inline void pm_genpd_init(struct generic_pm_domain *genpd,
208 struct dev_power_governor *gov, bool is_off)
187{ 209{
188} 210}
189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 211static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
@@ -194,6 +216,7 @@ static inline bool default_stop_ok(struct device *dev)
194{ 216{
195 return false; 217 return false;
196} 218}
219#define simple_qos_governor NULL
197#define pm_domain_always_on_gov NULL 220#define pm_domain_always_on_gov NULL
198#endif 221#endif
199 222
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 4d99e4e6ef83..2e9191a712f3 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -9,12 +9,16 @@
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10#include <linux/device.h> 10#include <linux/device.h>
11 11
12#define PM_QOS_RESERVED 0 12enum {
13#define PM_QOS_CPU_DMA_LATENCY 1 13 PM_QOS_RESERVED = 0,
14#define PM_QOS_NETWORK_LATENCY 2 14 PM_QOS_CPU_DMA_LATENCY,
15#define PM_QOS_NETWORK_THROUGHPUT 3 15 PM_QOS_NETWORK_LATENCY,
16 PM_QOS_NETWORK_THROUGHPUT,
17
18 /* insert new class ID */
19 PM_QOS_NUM_CLASSES,
20};
16 21
17#define PM_QOS_NUM_CLASSES 4
18#define PM_QOS_DEFAULT_VALUE -1 22#define PM_QOS_DEFAULT_VALUE -1
19 23
20#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 24#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
@@ -63,7 +67,6 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req)
63 return req->dev != 0; 67 return req->dev != 0;
64} 68}
65 69
66#ifdef CONFIG_PM
67int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, 70int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
68 enum pm_qos_req_action action, int value); 71 enum pm_qos_req_action action, int value);
69void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, 72void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
@@ -78,6 +81,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
78int pm_qos_request_active(struct pm_qos_request *req); 81int pm_qos_request_active(struct pm_qos_request *req);
79s32 pm_qos_read_value(struct pm_qos_constraints *c); 82s32 pm_qos_read_value(struct pm_qos_constraints *c);
80 83
84#ifdef CONFIG_PM
81s32 __dev_pm_qos_read_value(struct device *dev); 85s32 __dev_pm_qos_read_value(struct device *dev);
82s32 dev_pm_qos_read_value(struct device *dev); 86s32 dev_pm_qos_read_value(struct device *dev);
83int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, 87int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
@@ -95,45 +99,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev);
95int dev_pm_qos_add_ancestor_request(struct device *dev, 99int dev_pm_qos_add_ancestor_request(struct device *dev,
96 struct dev_pm_qos_request *req, s32 value); 100 struct dev_pm_qos_request *req, s32 value);
97#else 101#else
98static inline int pm_qos_update_target(struct pm_qos_constraints *c,
99 struct plist_node *node,
100 enum pm_qos_req_action action,
101 int value)
102 { return 0; }
103static inline void pm_qos_add_request(struct pm_qos_request *req,
104 int pm_qos_class, s32 value)
105 { return; }
106static inline void pm_qos_update_request(struct pm_qos_request *req,
107 s32 new_value)
108 { return; }
109static inline void pm_qos_remove_request(struct pm_qos_request *req)
110 { return; }
111
112static inline int pm_qos_request(int pm_qos_class)
113{
114 switch (pm_qos_class) {
115 case PM_QOS_CPU_DMA_LATENCY:
116 return PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
117 case PM_QOS_NETWORK_LATENCY:
118 return PM_QOS_NETWORK_LAT_DEFAULT_VALUE;
119 case PM_QOS_NETWORK_THROUGHPUT:
120 return PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE;
121 default:
122 return PM_QOS_DEFAULT_VALUE;
123 }
124}
125
126static inline int pm_qos_add_notifier(int pm_qos_class,
127 struct notifier_block *notifier)
128 { return 0; }
129static inline int pm_qos_remove_notifier(int pm_qos_class,
130 struct notifier_block *notifier)
131 { return 0; }
132static inline int pm_qos_request_active(struct pm_qos_request *req)
133 { return 0; }
134static inline s32 pm_qos_read_value(struct pm_qos_constraints *c)
135 { return 0; }
136
137static inline s32 __dev_pm_qos_read_value(struct device *dev) 102static inline s32 __dev_pm_qos_read_value(struct device *dev)
138 { return 0; } 103 { return 0; }
139static inline s32 dev_pm_qos_read_value(struct device *dev) 104static inline s32 dev_pm_qos_read_value(struct device *dev)
@@ -172,4 +137,13 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
172 { return 0; } 137 { return 0; }
173#endif 138#endif
174 139
140#ifdef CONFIG_PM_RUNTIME
141int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
142void dev_pm_qos_hide_latency_limit(struct device *dev);
143#else
144static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
145 { return 0; }
146static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
147#endif
148
175#endif 149#endif
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index a32da962d693..d9f05113e5fb 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -41,7 +41,7 @@
41 * @active: Status of the wakeup source. 41 * @active: Status of the wakeup source.
42 */ 42 */
43struct wakeup_source { 43struct wakeup_source {
44 char *name; 44 const char *name;
45 struct list_head entry; 45 struct list_head entry;
46 spinlock_t lock; 46 spinlock_t lock;
47 struct timer_list timer; 47 struct timer_list timer;
@@ -73,7 +73,9 @@ static inline bool device_may_wakeup(struct device *dev)
73} 73}
74 74
75/* drivers/base/power/wakeup.c */ 75/* drivers/base/power/wakeup.c */
76extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name);
76extern struct wakeup_source *wakeup_source_create(const char *name); 77extern struct wakeup_source *wakeup_source_create(const char *name);
78extern void wakeup_source_drop(struct wakeup_source *ws);
77extern void wakeup_source_destroy(struct wakeup_source *ws); 79extern void wakeup_source_destroy(struct wakeup_source *ws);
78extern void wakeup_source_add(struct wakeup_source *ws); 80extern void wakeup_source_add(struct wakeup_source *ws);
79extern void wakeup_source_remove(struct wakeup_source *ws); 81extern void wakeup_source_remove(struct wakeup_source *ws);
@@ -103,11 +105,16 @@ static inline bool device_can_wakeup(struct device *dev)
103 return dev->power.can_wakeup; 105 return dev->power.can_wakeup;
104} 106}
105 107
108static inline void wakeup_source_prepare(struct wakeup_source *ws,
109 const char *name) {}
110
106static inline struct wakeup_source *wakeup_source_create(const char *name) 111static inline struct wakeup_source *wakeup_source_create(const char *name)
107{ 112{
108 return NULL; 113 return NULL;
109} 114}
110 115
116static inline void wakeup_source_drop(struct wakeup_source *ws) {}
117
111static inline void wakeup_source_destroy(struct wakeup_source *ws) {} 118static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
112 119
113static inline void wakeup_source_add(struct wakeup_source *ws) {} 120static inline void wakeup_source_add(struct wakeup_source *ws) {}
@@ -165,4 +172,17 @@ static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
165 172
166#endif /* !CONFIG_PM_SLEEP */ 173#endif /* !CONFIG_PM_SLEEP */
167 174
175static inline void wakeup_source_init(struct wakeup_source *ws,
176 const char *name)
177{
178 wakeup_source_prepare(ws, name);
179 wakeup_source_add(ws);
180}
181
182static inline void wakeup_source_trash(struct wakeup_source *ws)
183{
184 wakeup_source_remove(ws);
185 wakeup_source_drop(ws);
186}
187
168#endif /* _LINUX_PM_WAKEUP_H */ 188#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/poll.h b/include/linux/poll.h
index cf40010ce0cd..48fe8bc398d1 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -32,21 +32,46 @@ struct poll_table_struct;
32 */ 32 */
33typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); 33typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
34 34
35/*
36 * Do not touch the structure directly, use the access functions
37 * poll_does_not_wait() and poll_requested_events() instead.
38 */
35typedef struct poll_table_struct { 39typedef struct poll_table_struct {
36 poll_queue_proc qproc; 40 poll_queue_proc _qproc;
37 unsigned long key; 41 unsigned long _key;
38} poll_table; 42} poll_table;
39 43
40static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 44static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
41{ 45{
42 if (p && wait_address) 46 if (p && p->_qproc && wait_address)
43 p->qproc(filp, wait_address, p); 47 p->_qproc(filp, wait_address, p);
48}
49
50/*
51 * Return true if it is guaranteed that poll will not wait. This is the case
52 * if the poll() of another file descriptor in the set got an event, so there
53 * is no need for waiting.
54 */
55static inline bool poll_does_not_wait(const poll_table *p)
56{
57 return p == NULL || p->_qproc == NULL;
58}
59
60/*
61 * Return the set of events that the application wants to poll for.
62 * This is useful for drivers that need to know whether a DMA transfer has
63 * to be started implicitly on poll(). You typically only want to do that
64 * if the application is actually polling for POLLIN and/or POLLOUT.
65 */
66static inline unsigned long poll_requested_events(const poll_table *p)
67{
68 return p ? p->_key : ~0UL;
44} 69}
45 70
46static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 71static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
47{ 72{
48 pt->qproc = qproc; 73 pt->_qproc = qproc;
49 pt->key = ~0UL; /* all events enabled */ 74 pt->_key = ~0UL; /* all events enabled */
50} 75}
51 76
52struct poll_table_entry { 77struct poll_table_entry {
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index b7681102a4b9..11bad91c4433 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -8,6 +8,7 @@
8#ifndef __LINUX_POSIX_ACL_H 8#ifndef __LINUX_POSIX_ACL_H
9#define __LINUX_POSIX_ACL_H 9#define __LINUX_POSIX_ACL_H
10 10
11#include <linux/bug.h>
11#include <linux/slab.h> 12#include <linux/slab.h>
12#include <linux/rcupdate.h> 13#include <linux/rcupdate.h>
13 14
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index fa9b962aec12..c38c13db8832 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -13,10 +13,11 @@
13#ifndef __LINUX_POWER_SUPPLY_H__ 13#ifndef __LINUX_POWER_SUPPLY_H__
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h>
17#include <linux/workqueue.h> 16#include <linux/workqueue.h>
18#include <linux/leds.h> 17#include <linux/leds.h>
19 18
19struct device;
20
20/* 21/*
21 * All voltages, currents, charges, energies, time and temperatures in uV, 22 * All voltages, currents, charges, energies, time and temperatures in uV,
22 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise 23 * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index b8d4ddd22736..e53ff65935dd 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -1,42 +1,12 @@
1/* 1/*
2 * ppp-comp.h - Definitions for doing PPP packet compression. 2 * ppp-comp.h - Definitions for doing PPP packet compression.
3 * 3 *
4 * Copyright (c) 1994 The Australian National University. 4 * Copyright 1994-1998 Paul Mackerras.
5 * All rights reserved.
6 * 5 *
7 * Permission to use, copy, modify, and distribute this software and its 6 * This program is free software; you can redistribute it and/or
8 * documentation is hereby granted, provided that the above copyright 7 * modify it under the terms of the GNU General Public License
9 * notice appears in all copies. This software is provided without any 8 * version 2 as published by the Free Software Foundation.
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
12 * any purpose.
13 *
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18 * OF SUCH DAMAGE.
19 *
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS.
26 */ 9 */
27
28/*
29 * ==FILEVERSION 980319==
30 *
31 * NOTE TO MAINTAINERS:
32 * If you modify this file at all, please set the above date.
33 * ppp-comp.h is shipped with a PPP distribution as well as with the kernel;
34 * if everyone increases the FILEVERSION number above, then scripts
35 * can do the right thing when deciding whether to install a new ppp-comp.h
36 * file. Don't change the format of that line otherwise, so the
37 * installation script can recognize it.
38 */
39
40#ifndef _NET_PPP_COMP_H 10#ifndef _NET_PPP_COMP_H
41#define _NET_PPP_COMP_H 11#define _NET_PPP_COMP_H
42 12
diff --git a/include/linux/ppp-ioctl.h b/include/linux/ppp-ioctl.h
new file mode 100644
index 000000000000..2d9a8859550a
--- /dev/null
+++ b/include/linux/ppp-ioctl.h
@@ -0,0 +1,119 @@
1/*
2 * ppp-ioctl.h - PPP ioctl definitions.
3 *
4 * Copyright 1999-2002 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10#ifndef _PPP_IOCTL_H
11#define _PPP_IOCTL_H
12
13#include <linux/types.h>
14#include <linux/compiler.h>
15
16/*
17 * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS.
18 */
19#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
20#define SC_COMP_AC 0x00000002 /* header compression (output) */
21#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
22#define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */
23#define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */
24#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
25#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
26#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
27#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
28#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
29#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
30#define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */
31#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
32#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
33#define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */
34#define SC_DEBUG 0x00010000 /* enable debug messages */
35#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
36#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
37#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
38#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
39#define SC_SYNC 0x00200000 /* synchronous serial mode */
40#define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */
41#define SC_MASK 0x0f600fff /* bits that user can change */
42
43/* state bits */
44#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
45#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
46#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
47#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
48#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
49#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
50#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
51
52/* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */
53struct npioctl {
54 int protocol; /* PPP protocol, e.g. PPP_IP */
55 enum NPmode mode;
56};
57
58/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
59struct ppp_option_data {
60 __u8 __user *ptr;
61 __u32 length;
62 int transmit;
63};
64
65/* For PPPIOCGL2TPSTATS */
66struct pppol2tp_ioc_stats {
67 __u16 tunnel_id; /* redundant */
68 __u16 session_id; /* if zero, get tunnel stats */
69 __u32 using_ipsec:1; /* valid only for session_id == 0 */
70 __aligned_u64 tx_packets;
71 __aligned_u64 tx_bytes;
72 __aligned_u64 tx_errors;
73 __aligned_u64 rx_packets;
74 __aligned_u64 rx_bytes;
75 __aligned_u64 rx_seq_discards;
76 __aligned_u64 rx_oos_packets;
77 __aligned_u64 rx_errors;
78};
79
80/*
81 * Ioctl definitions.
82 */
83
84#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */
85#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */
86#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */
87#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */
88#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */
89#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */
90#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */
91#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */
92#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */
93#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */
94#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
95#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
96#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */
97#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
98#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
99#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
100#define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */
101#define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */
102#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
103#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
104#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
105#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
106#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
107#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */
108#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
109#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
110#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
111#define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */
112#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */
113#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
114
115#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
116#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
117#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
118
119#endif /* _PPP_IOCTL_H */
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index 0f93ed6b4a88..ba416f67eb62 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -1,44 +1,14 @@
1/* 1/*
2 * ppp_defs.h - PPP definitions. 2 * ppp_defs.h - PPP definitions.
3 * 3 *
4 * Copyright (c) 1994 The Australian National University. 4 * Copyright 1994-2000 Paul Mackerras.
5 * All rights reserved.
6 * 5 *
7 * Permission to use, copy, modify, and distribute this software and its 6 * This program is free software; you can redistribute it and/or
8 * documentation is hereby granted, provided that the above copyright 7 * modify it under the terms of the GNU General Public License
9 * notice appears in all copies. This software is provided without any 8 * version 2 as published by the Free Software Foundation.
10 * warranty, express or implied. The Australian National University
11 * makes no representations about the suitability of this software for
12 * any purpose.
13 *
14 * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15 * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17 * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18 * OF SUCH DAMAGE.
19 *
20 * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24 * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25 * OR MODIFICATIONS.
26 */ 9 */
27
28#include <linux/types.h> 10#include <linux/types.h>
29 11
30/*
31 * ==FILEVERSION 20000114==
32 *
33 * NOTE TO MAINTAINERS:
34 * If you modify this file at all, please set the above date.
35 * ppp_defs.h is shipped with a PPP distribution as well as with the kernel;
36 * if everyone increases the FILEVERSION number above, then scripts
37 * can do the right thing when deciding whether to install a new ppp_defs.h
38 * file. Don't change the format of that line otherwise, so the
39 * installation script can recognize it.
40 */
41
42#ifndef _PPP_DEFS_H_ 12#ifndef _PPP_DEFS_H_
43#define _PPP_DEFS_H_ 13#define _PPP_DEFS_H_
44 14
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 7ddc7f1b480f..e0cfec2490aa 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -114,4 +114,14 @@
114# define PR_SET_MM_START_BRK 6 114# define PR_SET_MM_START_BRK 6
115# define PR_SET_MM_BRK 7 115# define PR_SET_MM_BRK 7
116 116
117/*
118 * Set specific pid that is allowed to ptrace the current task.
119 * A value of 0 mean "no process".
120 */
121#define PR_SET_PTRACER 0x59616d61
122# define PR_SET_PTRACER_ANY ((unsigned long)-1)
123
124#define PR_SET_CHILD_SUBREAPER 36
125#define PR_GET_CHILD_SUBREAPER 37
126
117#endif /* _LINUX_PRCTL_H */ 127#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 58969b2a8a82..5a710b9c578e 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -48,12 +48,14 @@ do { \
48 barrier(); \ 48 barrier(); \
49} while (0) 49} while (0)
50 50
51#define preempt_enable_no_resched() \ 51#define sched_preempt_enable_no_resched() \
52do { \ 52do { \
53 barrier(); \ 53 barrier(); \
54 dec_preempt_count(); \ 54 dec_preempt_count(); \
55} while (0) 55} while (0)
56 56
57#define preempt_enable_no_resched() sched_preempt_enable_no_resched()
58
57#define preempt_enable() \ 59#define preempt_enable() \
58do { \ 60do { \
59 preempt_enable_no_resched(); \ 61 preempt_enable_no_resched(); \
@@ -92,6 +94,7 @@ do { \
92#else /* !CONFIG_PREEMPT_COUNT */ 94#else /* !CONFIG_PREEMPT_COUNT */
93 95
94#define preempt_disable() do { } while (0) 96#define preempt_disable() do { } while (0)
97#define sched_preempt_enable_no_resched() do { } while (0)
95#define preempt_enable_no_resched() do { } while (0) 98#define preempt_enable_no_resched() do { } while (0)
96#define preempt_enable() do { } while (0) 99#define preempt_enable() do { } while (0)
97 100
diff --git a/include/linux/printk.h b/include/linux/printk.h
index f0e22f75143f..0525927f203f 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -101,6 +101,11 @@ asmlinkage __printf(1, 2) __cold
101int printk(const char *fmt, ...); 101int printk(const char *fmt, ...);
102 102
103/* 103/*
104 * Special printk facility for scheduler use only, _DO_NOT_USE_ !
105 */
106__printf(1, 2) __cold int printk_sched(const char *fmt, ...);
107
108/*
104 * Please don't use printk_ratelimit(), because it shares ratelimiting state 109 * Please don't use printk_ratelimit(), because it shares ratelimiting state
105 * with all other unrelated printk_ratelimit() callsites. Instead use 110 * with all other unrelated printk_ratelimit() callsites. Instead use
106 * printk_ratelimited() or plain old __ratelimit(). 111 * printk_ratelimited() or plain old __ratelimit().
@@ -127,6 +132,11 @@ int printk(const char *s, ...)
127{ 132{
128 return 0; 133 return 0;
129} 134}
135static inline __printf(1, 2) __cold
136int printk_sched(const char *s, ...)
137{
138 return 0;
139}
130static inline int printk_ratelimit(void) 140static inline int printk_ratelimit(void)
131{ 141{
132 return 0; 142 return 0;
@@ -180,13 +190,13 @@ extern void dump_stack(void) __cold;
180#endif 190#endif
181 191
182/* If you are writing a driver, please use dev_dbg instead */ 192/* If you are writing a driver, please use dev_dbg instead */
183#if defined(DEBUG) 193#if defined(CONFIG_DYNAMIC_DEBUG)
184#define pr_debug(fmt, ...) \
185 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
186#elif defined(CONFIG_DYNAMIC_DEBUG)
187/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 194/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
188#define pr_debug(fmt, ...) \ 195#define pr_debug(fmt, ...) \
189 dynamic_pr_debug(fmt, ##__VA_ARGS__) 196 dynamic_pr_debug(fmt, ##__VA_ARGS__)
197#elif defined(DEBUG)
198#define pr_debug(fmt, ...) \
199 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
190#else 200#else
191#define pr_debug(fmt, ...) \ 201#define pr_debug(fmt, ...) \
192 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 202 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index c2f1f6a5fcb8..5c719627c2aa 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -51,20 +51,6 @@
51#define PTRACE_INTERRUPT 0x4207 51#define PTRACE_INTERRUPT 0x4207
52#define PTRACE_LISTEN 0x4208 52#define PTRACE_LISTEN 0x4208
53 53
54/* flags in @data for PTRACE_SEIZE */
55#define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */
56
57/* options set using PTRACE_SETOPTIONS */
58#define PTRACE_O_TRACESYSGOOD 0x00000001
59#define PTRACE_O_TRACEFORK 0x00000002
60#define PTRACE_O_TRACEVFORK 0x00000004
61#define PTRACE_O_TRACECLONE 0x00000008
62#define PTRACE_O_TRACEEXEC 0x00000010
63#define PTRACE_O_TRACEVFORKDONE 0x00000020
64#define PTRACE_O_TRACEEXIT 0x00000040
65
66#define PTRACE_O_MASK 0x0000007f
67
68/* Wait extended result codes for the above trace options. */ 54/* Wait extended result codes for the above trace options. */
69#define PTRACE_EVENT_FORK 1 55#define PTRACE_EVENT_FORK 1
70#define PTRACE_EVENT_VFORK 2 56#define PTRACE_EVENT_VFORK 2
@@ -72,7 +58,19 @@
72#define PTRACE_EVENT_EXEC 4 58#define PTRACE_EVENT_EXEC 4
73#define PTRACE_EVENT_VFORK_DONE 5 59#define PTRACE_EVENT_VFORK_DONE 5
74#define PTRACE_EVENT_EXIT 6 60#define PTRACE_EVENT_EXIT 6
75#define PTRACE_EVENT_STOP 7 61/* Extended result codes which enabled by means other than options. */
62#define PTRACE_EVENT_STOP 128
63
64/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
65#define PTRACE_O_TRACESYSGOOD 1
66#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
67#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
68#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
69#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
70#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
71#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
72
73#define PTRACE_O_MASK 0x0000007f
76 74
77#include <asm/ptrace.h> 75#include <asm/ptrace.h>
78 76
@@ -88,13 +86,12 @@
88#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ 86#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */
89#define PT_PTRACED 0x00000001 87#define PT_PTRACED 0x00000001
90#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ 88#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */
91#define PT_TRACESYSGOOD 0x00000004 89#define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */
92#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */
93 90
91#define PT_OPT_FLAG_SHIFT 3
94/* PT_TRACE_* event enable flags */ 92/* PT_TRACE_* event enable flags */
95#define PT_EVENT_FLAG_SHIFT 4 93#define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event)))
96#define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1)) 94#define PT_TRACESYSGOOD PT_EVENT_FLAG(0)
97
98#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) 95#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK)
99#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) 96#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK)
100#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) 97#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE)
@@ -102,8 +99,6 @@
102#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) 99#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
103#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 100#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
104 101
105#define PT_TRACE_MASK 0x000003f4
106
107/* single stepping state bits (used on ARM and PA-RISC) */ 102/* single stepping state bits (used on ARM and PA-RISC) */
108#define PT_SINGLESTEP_BIT 31 103#define PT_SINGLESTEP_BIT 31
109#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) 104#define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT)
@@ -113,6 +108,7 @@
113#include <linux/compiler.h> /* For unlikely. */ 108#include <linux/compiler.h> /* For unlikely. */
114#include <linux/sched.h> /* For struct task_struct. */ 109#include <linux/sched.h> /* For struct task_struct. */
115#include <linux/err.h> /* for IS_ERR_VALUE */ 110#include <linux/err.h> /* for IS_ERR_VALUE */
111#include <linux/bug.h> /* For BUG_ON. */
116 112
117 113
118extern long arch_ptrace(struct task_struct *child, long request, 114extern long arch_ptrace(struct task_struct *child, long request,
@@ -199,9 +195,10 @@ static inline void ptrace_event(int event, unsigned long message)
199 if (unlikely(ptrace_event_enabled(current, event))) { 195 if (unlikely(ptrace_event_enabled(current, event))) {
200 current->ptrace_message = message; 196 current->ptrace_message = message;
201 ptrace_notify((event << 8) | SIGTRAP); 197 ptrace_notify((event << 8) | SIGTRAP);
202 } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { 198 } else if (event == PTRACE_EVENT_EXEC) {
203 /* legacy EXEC report via SIGTRAP */ 199 /* legacy EXEC report via SIGTRAP */
204 send_sig(SIGTRAP, current, 0); 200 if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED)
201 send_sig(SIGTRAP, current, 0);
205 } 202 }
206} 203}
207 204
diff --git a/include/linux/qnx6_fs.h b/include/linux/qnx6_fs.h
new file mode 100644
index 000000000000..26049eab9010
--- /dev/null
+++ b/include/linux/qnx6_fs.h
@@ -0,0 +1,134 @@
1/*
2 * Name : qnx6_fs.h
3 * Author : Kai Bankett
4 * Function : qnx6 global filesystem definitions
5 * History : 17-01-2012 created
6 */
7#ifndef _LINUX_QNX6_FS_H
8#define _LINUX_QNX6_FS_H
9
10#include <linux/types.h>
11#include <linux/magic.h>
12
13#define QNX6_ROOT_INO 1
14
15/* for di_status */
16#define QNX6_FILE_DIRECTORY 0x01
17#define QNX6_FILE_DELETED 0x02
18#define QNX6_FILE_NORMAL 0x03
19
20#define QNX6_SUPERBLOCK_SIZE 0x200 /* superblock always is 512 bytes */
21#define QNX6_SUPERBLOCK_AREA 0x1000 /* area reserved for superblock */
22#define QNX6_BOOTBLOCK_SIZE 0x2000 /* heading bootblock area */
23#define QNX6_DIR_ENTRY_SIZE 0x20 /* dir entry size of 32 bytes */
24#define QNX6_INODE_SIZE 0x80 /* each inode is 128 bytes */
25#define QNX6_INODE_SIZE_BITS 7 /* inode entry size shift */
26
27#define QNX6_NO_DIRECT_POINTERS 16 /* 16 blockptrs in sbl/inode */
28#define QNX6_PTR_MAX_LEVELS 5 /* maximum indirect levels */
29
30/* for filenames */
31#define QNX6_SHORT_NAME_MAX 27
32#define QNX6_LONG_NAME_MAX 510
33
34/* list of mount options */
35#define QNX6_MOUNT_MMI_FS 0x010000 /* mount as Audi MMI 3G fs */
36
37/*
38 * This is the original qnx6 inode layout on disk.
39 * Each inode is 128 byte long.
40 */
41struct qnx6_inode_entry {
42 __fs64 di_size;
43 __fs32 di_uid;
44 __fs32 di_gid;
45 __fs32 di_ftime;
46 __fs32 di_mtime;
47 __fs32 di_atime;
48 __fs32 di_ctime;
49 __fs16 di_mode;
50 __fs16 di_ext_mode;
51 __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS];
52 __u8 di_filelevels;
53 __u8 di_status;
54 __u8 di_unknown2[2];
55 __fs32 di_zero2[6];
56};
57
58/*
59 * Each directory entry is maximum 32 bytes long.
60 * If more characters or special characters required it is stored
61 * in the longfilenames structure.
62 */
63struct qnx6_dir_entry {
64 __fs32 de_inode;
65 __u8 de_size;
66 char de_fname[QNX6_SHORT_NAME_MAX];
67};
68
69/*
70 * Longfilename direntries have a different structure
71 */
72struct qnx6_long_dir_entry {
73 __fs32 de_inode;
74 __u8 de_size;
75 __u8 de_unknown[3];
76 __fs32 de_long_inode;
77 __fs32 de_checksum;
78};
79
80struct qnx6_long_filename {
81 __fs16 lf_size;
82 __u8 lf_fname[QNX6_LONG_NAME_MAX];
83};
84
85struct qnx6_root_node {
86 __fs64 size;
87 __fs32 ptr[QNX6_NO_DIRECT_POINTERS];
88 __u8 levels;
89 __u8 mode;
90 __u8 spare[6];
91};
92
93struct qnx6_super_block {
94 __fs32 sb_magic;
95 __fs32 sb_checksum;
96 __fs64 sb_serial;
97 __fs32 sb_ctime; /* time the fs was created */
98 __fs32 sb_atime; /* last access time */
99 __fs32 sb_flags;
100 __fs16 sb_version1; /* filesystem version information */
101 __fs16 sb_version2; /* filesystem version information */
102 __u8 sb_volumeid[16];
103 __fs32 sb_blocksize;
104 __fs32 sb_num_inodes;
105 __fs32 sb_free_inodes;
106 __fs32 sb_num_blocks;
107 __fs32 sb_free_blocks;
108 __fs32 sb_allocgroup;
109 struct qnx6_root_node Inode;
110 struct qnx6_root_node Bitmap;
111 struct qnx6_root_node Longfile;
112 struct qnx6_root_node Unknown;
113};
114
115/* Audi MMI 3G superblock layout is different to plain qnx6 */
116struct qnx6_mmi_super_block {
117 __fs32 sb_magic;
118 __fs32 sb_checksum;
119 __fs64 sb_serial;
120 __u8 sb_spare0[12];
121 __u8 sb_id[12];
122 __fs32 sb_blocksize;
123 __fs32 sb_num_inodes;
124 __fs32 sb_free_inodes;
125 __fs32 sb_num_blocks;
126 __fs32 sb_free_blocks;
127 __u8 sb_spare1[4];
128 struct qnx6_root_node Inode;
129 struct qnx6_root_node Bitmap;
130 struct qnx6_root_node Longfile;
131 struct qnx6_root_node Unknown;
132};
133
134#endif
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 07e360b1b282..e9a48234e693 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/preempt.h> 23#include <linux/preempt.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/bug.h>
25#include <linux/kernel.h> 26#include <linux/kernel.h>
26#include <linux/rcupdate.h> 27#include <linux/rcupdate.h>
27 28
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 6f6df86f1ae5..8c0a3adc5df5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -281,6 +281,10 @@ struct mdp_superblock_1 {
281 * active device with same 'role'. 281 * active device with same 'role'.
282 * 'recovery_offset' is also set. 282 * 'recovery_offset' is also set.
283 */ 283 */
284#define MD_FEATURE_ALL (1|2|4|8|16) 284#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
285 |MD_FEATURE_RECOVERY_OFFSET \
286 |MD_FEATURE_RESHAPE_ACTIVE \
287 |MD_FEATURE_BAD_BLOCKS \
288 |MD_FEATURE_REPLACEMENT)
285 289
286#endif 290#endif
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h
deleted file mode 100644
index 5c6118189363..000000000000
--- a/include/linux/rar_register.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2010 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public
13 * License along with this program; if not, write to the Free
14 * Software Foundation, Inc., 59 Temple Place - Suite 330,
15 * Boston, MA 02111-1307, USA.
16 * The full GNU General Public License is included in this
17 * distribution in the file called COPYING.
18 */
19
20
21#ifndef _RAR_REGISTER_H
22#define _RAR_REGISTER_H
23
24#include <linux/types.h>
25
26/* following are used both in drivers as well as user space apps */
27
28#define RAR_TYPE_VIDEO 0
29#define RAR_TYPE_AUDIO 1
30#define RAR_TYPE_IMAGE 2
31#define RAR_TYPE_DATA 3
32
33#ifdef __KERNEL__
34
35struct rar_device;
36
37#if defined(CONFIG_RAR_REGISTER)
38int register_rar(int num,
39 int (*callback)(unsigned long data), unsigned long data);
40void unregister_rar(int num);
41int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end);
42int rar_lock(int rar_index);
43#else
44extern void unregister_rar(int num) { }
45extern int rar_lock(int rar_index) { return -EIO; }
46
47extern inline int register_rar(int num,
48 int (*callback)(unsigned long data), unsigned long data)
49{
50 return -ENODEV;
51}
52
53extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end)
54{
55 return -ENODEV;
56}
57#endif /* RAR_REGISTER */
58
59#endif /* __KERNEL__ */
60#endif /* _RAR_REGISTER_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 81c04f4348ec..20fb776a1d4a 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -42,6 +42,7 @@
42#include <linux/lockdep.h> 42#include <linux/lockdep.h>
43#include <linux/completion.h> 43#include <linux/completion.h>
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h>
45#include <linux/compiler.h> 46#include <linux/compiler.h>
46 47
47#ifdef CONFIG_RCU_TORTURE_TEST 48#ifdef CONFIG_RCU_TORTURE_TEST
@@ -190,6 +191,33 @@ extern void rcu_idle_exit(void);
190extern void rcu_irq_enter(void); 191extern void rcu_irq_enter(void);
191extern void rcu_irq_exit(void); 192extern void rcu_irq_exit(void);
192 193
194/**
195 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
196 * @a: Code that RCU needs to pay attention to.
197 *
198 * RCU, RCU-bh, and RCU-sched read-side critical sections are forbidden
199 * in the inner idle loop, that is, between the rcu_idle_enter() and
200 * the rcu_idle_exit() -- RCU will happily ignore any such read-side
201 * critical sections. However, things like powertop need tracepoints
202 * in the inner idle loop.
203 *
204 * This macro provides the way out: RCU_NONIDLE(do_something_with_RCU())
205 * will tell RCU that it needs to pay attending, invoke its argument
206 * (in this example, a call to the do_something_with_RCU() function),
207 * and then tell RCU to go back to ignoring this CPU. It is permissible
208 * to nest RCU_NONIDLE() wrappers, but the nesting level is currently
209 * quite limited. If deeper nesting is required, it will be necessary
210 * to adjust DYNTICK_TASK_NESTING_VALUE accordingly.
211 *
212 * This macro may be used from process-level code only.
213 */
214#define RCU_NONIDLE(a) \
215 do { \
216 rcu_idle_exit(); \
217 do { a; } while (0); \
218 rcu_idle_enter(); \
219 } while (0)
220
193/* 221/*
194 * Infrastructure to implement the synchronize_() primitives in 222 * Infrastructure to implement the synchronize_() primitives in
195 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 223 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
@@ -226,6 +254,15 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
226} 254}
227#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 255#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
228 256
257#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU)
258bool rcu_lockdep_current_cpu_online(void);
259#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
260static inline bool rcu_lockdep_current_cpu_online(void)
261{
262 return 1;
263}
264#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
265
229#ifdef CONFIG_DEBUG_LOCK_ALLOC 266#ifdef CONFIG_DEBUG_LOCK_ALLOC
230 267
231#ifdef CONFIG_PROVE_RCU 268#ifdef CONFIG_PROVE_RCU
@@ -239,13 +276,11 @@ static inline int rcu_is_cpu_idle(void)
239 276
240static inline void rcu_lock_acquire(struct lockdep_map *map) 277static inline void rcu_lock_acquire(struct lockdep_map *map)
241{ 278{
242 WARN_ON_ONCE(rcu_is_cpu_idle());
243 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); 279 lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_);
244} 280}
245 281
246static inline void rcu_lock_release(struct lockdep_map *map) 282static inline void rcu_lock_release(struct lockdep_map *map)
247{ 283{
248 WARN_ON_ONCE(rcu_is_cpu_idle());
249 lock_release(map, 1, _THIS_IP_); 284 lock_release(map, 1, _THIS_IP_);
250} 285}
251 286
@@ -270,6 +305,9 @@ extern int debug_lockdep_rcu_enabled(void);
270 * occur in the same context, for example, it is illegal to invoke 305 * occur in the same context, for example, it is illegal to invoke
271 * rcu_read_unlock() in process context if the matching rcu_read_lock() 306 * rcu_read_unlock() in process context if the matching rcu_read_lock()
272 * was invoked from within an irq handler. 307 * was invoked from within an irq handler.
308 *
309 * Note that rcu_read_lock() is disallowed if the CPU is either idle or
310 * offline from an RCU perspective, so check for those as well.
273 */ 311 */
274static inline int rcu_read_lock_held(void) 312static inline int rcu_read_lock_held(void)
275{ 313{
@@ -277,6 +315,8 @@ static inline int rcu_read_lock_held(void)
277 return 1; 315 return 1;
278 if (rcu_is_cpu_idle()) 316 if (rcu_is_cpu_idle())
279 return 0; 317 return 0;
318 if (!rcu_lockdep_current_cpu_online())
319 return 0;
280 return lock_is_held(&rcu_lock_map); 320 return lock_is_held(&rcu_lock_map);
281} 321}
282 322
@@ -313,6 +353,9 @@ extern int rcu_read_lock_bh_held(void);
313 * notice an extended quiescent state to other CPUs that started a grace 353 * notice an extended quiescent state to other CPUs that started a grace
314 * period. Otherwise we would delay any grace period as long as we run in 354 * period. Otherwise we would delay any grace period as long as we run in
315 * the idle task. 355 * the idle task.
356 *
357 * Similarly, we avoid claiming an SRCU read lock held if the current
358 * CPU is offline.
316 */ 359 */
317#ifdef CONFIG_PREEMPT_COUNT 360#ifdef CONFIG_PREEMPT_COUNT
318static inline int rcu_read_lock_sched_held(void) 361static inline int rcu_read_lock_sched_held(void)
@@ -323,6 +366,8 @@ static inline int rcu_read_lock_sched_held(void)
323 return 1; 366 return 1;
324 if (rcu_is_cpu_idle()) 367 if (rcu_is_cpu_idle())
325 return 0; 368 return 0;
369 if (!rcu_lockdep_current_cpu_online())
370 return 0;
326 if (debug_locks) 371 if (debug_locks)
327 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 372 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
328 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 373 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
@@ -374,15 +419,29 @@ extern int rcu_my_thread_group_empty(void);
374 */ 419 */
375#define rcu_lockdep_assert(c, s) \ 420#define rcu_lockdep_assert(c, s) \
376 do { \ 421 do { \
377 static bool __warned; \ 422 static bool __section(.data.unlikely) __warned; \
378 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ 423 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
379 __warned = true; \ 424 __warned = true; \
380 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ 425 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \
381 } \ 426 } \
382 } while (0) 427 } while (0)
383 428
429#if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU)
430static inline void rcu_preempt_sleep_check(void)
431{
432 rcu_lockdep_assert(!lock_is_held(&rcu_lock_map),
433 "Illegal context switch in RCU read-side "
434 "critical section");
435}
436#else /* #ifdef CONFIG_PROVE_RCU */
437static inline void rcu_preempt_sleep_check(void)
438{
439}
440#endif /* #else #ifdef CONFIG_PROVE_RCU */
441
384#define rcu_sleep_check() \ 442#define rcu_sleep_check() \
385 do { \ 443 do { \
444 rcu_preempt_sleep_check(); \
386 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ 445 rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \
387 "Illegal context switch in RCU-bh" \ 446 "Illegal context switch in RCU-bh" \
388 " read-side critical section"); \ 447 " read-side critical section"); \
@@ -470,6 +529,13 @@ extern int rcu_my_thread_group_empty(void);
470 * NULL. Although rcu_access_pointer() may also be used in cases where 529 * NULL. Although rcu_access_pointer() may also be used in cases where
471 * update-side locks prevent the value of the pointer from changing, you 530 * update-side locks prevent the value of the pointer from changing, you
472 * should instead use rcu_dereference_protected() for this use case. 531 * should instead use rcu_dereference_protected() for this use case.
532 *
533 * It is also permissible to use rcu_access_pointer() when read-side
534 * access to the pointer was removed at least one grace period ago, as
535 * is the case in the context of the RCU callback that is freeing up
536 * the data, or after a synchronize_rcu() returns. This can be useful
537 * when tearing down multi-linked structures after a grace period
538 * has elapsed.
473 */ 539 */
474#define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) 540#define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu)
475 541
@@ -659,6 +725,8 @@ static inline void rcu_read_lock(void)
659 __rcu_read_lock(); 725 __rcu_read_lock();
660 __acquire(RCU); 726 __acquire(RCU);
661 rcu_lock_acquire(&rcu_lock_map); 727 rcu_lock_acquire(&rcu_lock_map);
728 rcu_lockdep_assert(!rcu_is_cpu_idle(),
729 "rcu_read_lock() used illegally while idle");
662} 730}
663 731
664/* 732/*
@@ -678,6 +746,8 @@ static inline void rcu_read_lock(void)
678 */ 746 */
679static inline void rcu_read_unlock(void) 747static inline void rcu_read_unlock(void)
680{ 748{
749 rcu_lockdep_assert(!rcu_is_cpu_idle(),
750 "rcu_read_unlock() used illegally while idle");
681 rcu_lock_release(&rcu_lock_map); 751 rcu_lock_release(&rcu_lock_map);
682 __release(RCU); 752 __release(RCU);
683 __rcu_read_unlock(); 753 __rcu_read_unlock();
@@ -705,6 +775,8 @@ static inline void rcu_read_lock_bh(void)
705 local_bh_disable(); 775 local_bh_disable();
706 __acquire(RCU_BH); 776 __acquire(RCU_BH);
707 rcu_lock_acquire(&rcu_bh_lock_map); 777 rcu_lock_acquire(&rcu_bh_lock_map);
778 rcu_lockdep_assert(!rcu_is_cpu_idle(),
779 "rcu_read_lock_bh() used illegally while idle");
708} 780}
709 781
710/* 782/*
@@ -714,6 +786,8 @@ static inline void rcu_read_lock_bh(void)
714 */ 786 */
715static inline void rcu_read_unlock_bh(void) 787static inline void rcu_read_unlock_bh(void)
716{ 788{
789 rcu_lockdep_assert(!rcu_is_cpu_idle(),
790 "rcu_read_unlock_bh() used illegally while idle");
717 rcu_lock_release(&rcu_bh_lock_map); 791 rcu_lock_release(&rcu_bh_lock_map);
718 __release(RCU_BH); 792 __release(RCU_BH);
719 local_bh_enable(); 793 local_bh_enable();
@@ -737,6 +811,8 @@ static inline void rcu_read_lock_sched(void)
737 preempt_disable(); 811 preempt_disable();
738 __acquire(RCU_SCHED); 812 __acquire(RCU_SCHED);
739 rcu_lock_acquire(&rcu_sched_lock_map); 813 rcu_lock_acquire(&rcu_sched_lock_map);
814 rcu_lockdep_assert(!rcu_is_cpu_idle(),
815 "rcu_read_lock_sched() used illegally while idle");
740} 816}
741 817
742/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ 818/* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */
@@ -753,6 +829,8 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
753 */ 829 */
754static inline void rcu_read_unlock_sched(void) 830static inline void rcu_read_unlock_sched(void)
755{ 831{
832 rcu_lockdep_assert(!rcu_is_cpu_idle(),
833 "rcu_read_unlock_sched() used illegally while idle");
756 rcu_lock_release(&rcu_sched_lock_map); 834 rcu_lock_release(&rcu_sched_lock_map);
757 __release(RCU_SCHED); 835 __release(RCU_SCHED);
758 preempt_enable(); 836 preempt_enable();
@@ -841,7 +919,7 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
841 /* See the kfree_rcu() header comment. */ 919 /* See the kfree_rcu() header comment. */
842 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); 920 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset));
843 921
844 call_rcu(head, (rcu_callback)offset); 922 kfree_call_rcu(head, (rcu_callback)offset);
845} 923}
846 924
847/** 925/**
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 00b7a5e493d2..e93df77176d1 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -27,13 +27,9 @@
27 27
28#include <linux/cache.h> 28#include <linux/cache.h>
29 29
30#ifdef CONFIG_RCU_BOOST
31static inline void rcu_init(void) 30static inline void rcu_init(void)
32{ 31{
33} 32}
34#else /* #ifdef CONFIG_RCU_BOOST */
35void rcu_init(void);
36#endif /* #else #ifdef CONFIG_RCU_BOOST */
37 33
38static inline void rcu_barrier_bh(void) 34static inline void rcu_barrier_bh(void)
39{ 35{
@@ -83,6 +79,12 @@ static inline void synchronize_sched_expedited(void)
83 synchronize_sched(); 79 synchronize_sched();
84} 80}
85 81
82static inline void kfree_call_rcu(struct rcu_head *head,
83 void (*func)(struct rcu_head *rcu))
84{
85 call_rcu(head, func);
86}
87
86#ifdef CONFIG_TINY_RCU 88#ifdef CONFIG_TINY_RCU
87 89
88static inline void rcu_preempt_note_context_switch(void) 90static inline void rcu_preempt_note_context_switch(void)
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 67458468f1a8..e8ee5dd0854c 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -61,6 +61,24 @@ extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void); 61extern void synchronize_sched_expedited(void);
62extern void synchronize_rcu_expedited(void); 62extern void synchronize_rcu_expedited(void);
63 63
64void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
65
66/**
67 * synchronize_rcu_bh_expedited - Brute-force RCU-bh grace period
68 *
69 * Wait for an RCU-bh grace period to elapse, but use a "big hammer"
70 * approach to force the grace period to end quickly. This consumes
71 * significant time on all CPUs and is unfriendly to real-time workloads,
72 * so is thus not recommended for any sort of common-case code. In fact,
73 * if you are using synchronize_rcu_bh_expedited() in a loop, please
74 * restructure your code to batch your updates, and then use a single
75 * synchronize_rcu_bh() instead.
76 *
77 * Note that it is illegal to call this function while holding any lock
78 * that is acquired by a CPU-hotplug notifier. And yes, it is also illegal
79 * to call this function from a CPU-hotplug notifier. Failing to observe
80 * these restriction will result in deadlock.
81 */
64static inline void synchronize_rcu_bh_expedited(void) 82static inline void synchronize_rcu_bh_expedited(void)
65{ 83{
66 synchronize_sched_expedited(); 84 synchronize_sched_expedited();
@@ -83,6 +101,7 @@ extern void rcu_sched_force_quiescent_state(void);
83/* A context switch is a grace period for RCU-sched and RCU-bh. */ 101/* A context switch is a grace period for RCU-sched and RCU-bh. */
84static inline int rcu_blocking_is_gp(void) 102static inline int rcu_blocking_is_gp(void)
85{ 103{
104 might_sleep(); /* Check for RCU read-side critical section. */
86 return num_online_cpus() == 1; 105 return num_online_cpus() == 1;
87} 106}
88 107
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index eb93921cdd30..a90abb6bfa64 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -13,12 +13,13 @@
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15
16#include <linux/device.h>
17#include <linux/list.h> 16#include <linux/list.h>
18 17
19struct module; 18struct module;
19struct device;
20struct i2c_client; 20struct i2c_client;
21struct spi_device; 21struct spi_device;
22struct regmap;
22 23
23/* An enum of all the supported cache types */ 24/* An enum of all the supported cache types */
24enum regcache_type { 25enum regcache_type {
@@ -40,10 +41,13 @@ struct reg_default {
40 unsigned int def; 41 unsigned int def;
41}; 42};
42 43
44#ifdef CONFIG_REGMAP
45
43/** 46/**
44 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
45 * 48 *
46 * @reg_bits: Number of bits in a register address, mandatory. 49 * @reg_bits: Number of bits in a register address, mandatory.
50 * @pad_bits: Number of bits of padding between register and value.
47 * @val_bits: Number of bits in a register value, mandatory. 51 * @val_bits: Number of bits in a register value, mandatory.
48 * 52 *
49 * @writeable_reg: Optional callback returning true if the register 53 * @writeable_reg: Optional callback returning true if the register
@@ -74,6 +78,7 @@ struct reg_default {
74 */ 78 */
75struct regmap_config { 79struct regmap_config {
76 int reg_bits; 80 int reg_bits;
81 int pad_bits;
77 int val_bits; 82 int val_bits;
78 83
79 bool (*writeable_reg)(struct device *dev, unsigned int reg); 84 bool (*writeable_reg)(struct device *dev, unsigned int reg);
@@ -127,12 +132,22 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
127struct regmap *regmap_init_spi(struct spi_device *dev, 132struct regmap *regmap_init_spi(struct spi_device *dev,
128 const struct regmap_config *config); 133 const struct regmap_config *config);
129 134
135struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus,
137 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config);
142
130void regmap_exit(struct regmap *map); 143void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map, 144int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config); 145 const struct regmap_config *config);
133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
134int regmap_raw_write(struct regmap *map, unsigned int reg, 147int regmap_raw_write(struct regmap *map, unsigned int reg,
135 const void *val, size_t val_len); 148 const void *val, size_t val_len);
149int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
150 size_t val_count);
136int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 151int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
137int regmap_raw_read(struct regmap *map, unsigned int reg, 152int regmap_raw_read(struct regmap *map, unsigned int reg,
138 void *val, size_t val_len); 153 void *val, size_t val_len);
@@ -143,12 +158,18 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
143int regmap_update_bits_check(struct regmap *map, unsigned int reg, 158int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val, 159 unsigned int mask, unsigned int val,
145 bool *change); 160 bool *change);
161int regmap_get_val_bytes(struct regmap *map);
146 162
147int regcache_sync(struct regmap *map); 163int regcache_sync(struct regmap *map);
164int regcache_sync_region(struct regmap *map, unsigned int min,
165 unsigned int max);
148void regcache_cache_only(struct regmap *map, bool enable); 166void regcache_cache_only(struct regmap *map, bool enable);
149void regcache_cache_bypass(struct regmap *map, bool enable); 167void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map); 168void regcache_mark_dirty(struct regmap *map);
151 169
170int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
171 int num_regs);
172
152/** 173/**
153 * Description of an IRQ for the generic regmap irq_chip. 174 * Description of an IRQ for the generic regmap irq_chip.
154 * 175 *
@@ -197,4 +218,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
197void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
199 220
221#else
222
223/*
224 * These stubs should only ever be called by generic code which has
225 * regmap based facilities, if they ever get called at runtime
226 * something is going wrong and something probably needs to select
227 * REGMAP.
228 */
229
230static inline int regmap_write(struct regmap *map, unsigned int reg,
231 unsigned int val)
232{
233 WARN_ONCE(1, "regmap API is disabled");
234 return -EINVAL;
235}
236
237static inline int regmap_raw_write(struct regmap *map, unsigned int reg,
238 const void *val, size_t val_len)
239{
240 WARN_ONCE(1, "regmap API is disabled");
241 return -EINVAL;
242}
243
244static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
245 const void *val, size_t val_count)
246{
247 WARN_ONCE(1, "regmap API is disabled");
248 return -EINVAL;
249}
250
251static inline int regmap_read(struct regmap *map, unsigned int reg,
252 unsigned int *val)
253{
254 WARN_ONCE(1, "regmap API is disabled");
255 return -EINVAL;
256}
257
258static inline int regmap_raw_read(struct regmap *map, unsigned int reg,
259 void *val, size_t val_len)
260{
261 WARN_ONCE(1, "regmap API is disabled");
262 return -EINVAL;
263}
264
265static inline int regmap_bulk_read(struct regmap *map, unsigned int reg,
266 void *val, size_t val_count)
267{
268 WARN_ONCE(1, "regmap API is disabled");
269 return -EINVAL;
270}
271
272static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
273 unsigned int mask, unsigned int val)
274{
275 WARN_ONCE(1, "regmap API is disabled");
276 return -EINVAL;
277}
278
279static inline int regmap_update_bits_check(struct regmap *map,
280 unsigned int reg,
281 unsigned int mask, unsigned int val,
282 bool *change)
283{
284 WARN_ONCE(1, "regmap API is disabled");
285 return -EINVAL;
286}
287
288static inline int regmap_get_val_bytes(struct regmap *map)
289{
290 WARN_ONCE(1, "regmap API is disabled");
291 return -EINVAL;
292}
293
294static inline int regcache_sync(struct regmap *map)
295{
296 WARN_ONCE(1, "regmap API is disabled");
297 return -EINVAL;
298}
299
300static inline int regcache_sync_region(struct regmap *map, unsigned int min,
301 unsigned int max)
302{
303 WARN_ONCE(1, "regmap API is disabled");
304 return -EINVAL;
305}
306
307static inline void regcache_cache_only(struct regmap *map, bool enable)
308{
309 WARN_ONCE(1, "regmap API is disabled");
310}
311
312static inline void regcache_cache_bypass(struct regmap *map, bool enable)
313{
314 WARN_ONCE(1, "regmap API is disabled");
315}
316
317static inline void regcache_mark_dirty(struct regmap *map)
318{
319 WARN_ONCE(1, "regmap API is disabled");
320}
321
322static inline int regmap_register_patch(struct regmap *map,
323 const struct reg_default *regs,
324 int num_regs)
325{
326 WARN_ONCE(1, "regmap API is disabled");
327 return -EINVAL;
328}
329
330#endif
331
200#endif 332#endif
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 686f37327a49..8e0c9febf495 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/bug.h>
18#include <linux/uaccess.h> 19#include <linux/uaccess.h>
19struct task_struct; 20struct task_struct;
20struct user_regset; 21struct user_regset;
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 76579f964a29..7bd73bbdfd1b 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -26,7 +26,26 @@ enum ab8500_regulator_id {
26 AB8500_NUM_REGULATORS, 26 AB8500_NUM_REGULATORS,
27}; 27};
28 28
29/* AB8500 register initialization */ 29/* AB9450 regulators */
30enum ab9540_regulator_id {
31 AB9540_LDO_AUX1,
32 AB9540_LDO_AUX2,
33 AB9540_LDO_AUX3,
34 AB9540_LDO_AUX4,
35 AB9540_LDO_INTCORE,
36 AB9540_LDO_TVOUT,
37 AB9540_LDO_USB,
38 AB9540_LDO_AUDIO,
39 AB9540_LDO_ANAMIC1,
40 AB9540_LDO_ANAMIC2,
41 AB9540_LDO_DMIC,
42 AB9540_LDO_ANA,
43 AB9540_SYSCLKREQ_2,
44 AB9540_SYSCLKREQ_4,
45 AB9540_NUM_REGULATORS,
46};
47
48/* AB8500 and AB9540 register initialization */
30struct ab8500_regulator_reg_init { 49struct ab8500_regulator_reg_init {
31 int id; 50 int id;
32 u8 value; 51 u8 value;
@@ -71,4 +90,53 @@ enum ab8500_regulator_reg {
71 AB8500_NUM_REGULATOR_REGISTERS, 90 AB8500_NUM_REGULATOR_REGISTERS,
72}; 91};
73 92
93
94/* AB9540 registers */
95enum ab9540_regulator_reg {
96 AB9540_REGUREQUESTCTRL1,
97 AB9540_REGUREQUESTCTRL2,
98 AB9540_REGUREQUESTCTRL3,
99 AB9540_REGUREQUESTCTRL4,
100 AB9540_REGUSYSCLKREQ1HPVALID1,
101 AB9540_REGUSYSCLKREQ1HPVALID2,
102 AB9540_REGUHWHPREQ1VALID1,
103 AB9540_REGUHWHPREQ1VALID2,
104 AB9540_REGUHWHPREQ2VALID1,
105 AB9540_REGUHWHPREQ2VALID2,
106 AB9540_REGUSWHPREQVALID1,
107 AB9540_REGUSWHPREQVALID2,
108 AB9540_REGUSYSCLKREQVALID1,
109 AB9540_REGUSYSCLKREQVALID2,
110 AB9540_REGUVAUX4REQVALID,
111 AB9540_REGUMISC1,
112 AB9540_VAUDIOSUPPLY,
113 AB9540_REGUCTRL1VAMIC,
114 AB9540_VSMPS1REGU,
115 AB9540_VSMPS2REGU,
116 AB9540_VSMPS3REGU, /* NOTE! PRCMU register */
117 AB9540_VPLLVANAREGU,
118 AB9540_EXTSUPPLYREGU,
119 AB9540_VAUX12REGU,
120 AB9540_VRF1VAUX3REGU,
121 AB9540_VSMPS1SEL1,
122 AB9540_VSMPS1SEL2,
123 AB9540_VSMPS1SEL3,
124 AB9540_VSMPS2SEL1,
125 AB9540_VSMPS2SEL2,
126 AB9540_VSMPS2SEL3,
127 AB9540_VSMPS3SEL1, /* NOTE! PRCMU register */
128 AB9540_VSMPS3SEL2, /* NOTE! PRCMU register */
129 AB9540_VAUX1SEL,
130 AB9540_VAUX2SEL,
131 AB9540_VRF1VAUX3SEL,
132 AB9540_REGUCTRL2SPARE,
133 AB9540_VAUX4REQCTRL,
134 AB9540_VAUX4REGU,
135 AB9540_VAUX4SEL,
136 AB9540_REGUCTRLDISCH,
137 AB9540_REGUCTRLDISCH2,
138 AB9540_REGUCTRLDISCH3,
139 AB9540_NUM_REGULATOR_REGISTERS,
140};
141
74#endif 142#endif
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
deleted file mode 100644
index a6d014005d49..000000000000
--- a/include/linux/regulator/bq24022.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
3 * 1-Cell Li-Ion Charger connected via GPIOs.
4 *
5 * Copyright (c) 2008 Philipp Zabel
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13struct regulator_init_data;
14
15/**
16 * bq24022_mach_info - platform data for bq24022
17 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
18 * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
19 */
20struct bq24022_mach_info {
21 int gpio_nce;
22 int gpio_iset2;
23 struct regulator_init_data *init_data;
24};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f2698a0edfc4..4ed1b30ac5fc 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -35,7 +35,8 @@
35#ifndef __LINUX_REGULATOR_CONSUMER_H_ 35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_ 36#define __LINUX_REGULATOR_CONSUMER_H_
37 37
38#include <linux/device.h> 38struct device;
39struct notifier_block;
39 40
40/* 41/*
41 * Regulator operating modes. 42 * Regulator operating modes.
@@ -132,9 +133,12 @@ struct regulator_bulk_data {
132/* regulator get and put */ 133/* regulator get and put */
133struct regulator *__must_check regulator_get(struct device *dev, 134struct regulator *__must_check regulator_get(struct device *dev,
134 const char *id); 135 const char *id);
136struct regulator *__must_check devm_regulator_get(struct device *dev,
137 const char *id);
135struct regulator *__must_check regulator_get_exclusive(struct device *dev, 138struct regulator *__must_check regulator_get_exclusive(struct device *dev,
136 const char *id); 139 const char *id);
137void regulator_put(struct regulator *regulator); 140void regulator_put(struct regulator *regulator);
141void devm_regulator_put(struct regulator *regulator);
138 142
139/* regulator output control and status */ 143/* regulator output control and status */
140int regulator_enable(struct regulator *regulator); 144int regulator_enable(struct regulator *regulator);
@@ -145,6 +149,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms);
145 149
146int regulator_bulk_get(struct device *dev, int num_consumers, 150int regulator_bulk_get(struct device *dev, int num_consumers,
147 struct regulator_bulk_data *consumers); 151 struct regulator_bulk_data *consumers);
152int devm_regulator_bulk_get(struct device *dev, int num_consumers,
153 struct regulator_bulk_data *consumers);
148int regulator_bulk_enable(int num_consumers, 154int regulator_bulk_enable(int num_consumers,
149 struct regulator_bulk_data *consumers); 155 struct regulator_bulk_data *consumers);
150int regulator_bulk_disable(int num_consumers, 156int regulator_bulk_disable(int num_consumers,
@@ -200,10 +206,21 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
200 */ 206 */
201 return NULL; 207 return NULL;
202} 208}
209
210static inline struct regulator *__must_check
211devm_regulator_get(struct device *dev, const char *id)
212{
213 return NULL;
214}
215
203static inline void regulator_put(struct regulator *regulator) 216static inline void regulator_put(struct regulator *regulator)
204{ 217{
205} 218}
206 219
220static inline void devm_regulator_put(struct regulator *regulator)
221{
222}
223
207static inline int regulator_enable(struct regulator *regulator) 224static inline int regulator_enable(struct regulator *regulator)
208{ 225{
209 return 0; 226 return 0;
@@ -237,6 +254,12 @@ static inline int regulator_bulk_get(struct device *dev,
237 return 0; 254 return 0;
238} 255}
239 256
257static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers,
258 struct regulator_bulk_data *consumers)
259{
260 return 0;
261}
262
240static inline int regulator_bulk_enable(int num_consumers, 263static inline int regulator_bulk_enable(int num_consumers,
241 struct regulator_bulk_data *consumers) 264 struct regulator_bulk_data *consumers)
242{ 265{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 4214b9a9d1c9..fa8b55b8191c 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -104,7 +104,7 @@ struct regulator_ops {
104 int (*disable) (struct regulator_dev *); 104 int (*disable) (struct regulator_dev *);
105 int (*is_enabled) (struct regulator_dev *); 105 int (*is_enabled) (struct regulator_dev *);
106 106
107 /* get/set regulator operating mode (defined in regulator.h) */ 107 /* get/set regulator operating mode (defined in consumer.h) */
108 int (*set_mode) (struct regulator_dev *, unsigned int mode); 108 int (*set_mode) (struct regulator_dev *, unsigned int mode);
109 unsigned int (*get_mode) (struct regulator_dev *); 109 unsigned int (*get_mode) (struct regulator_dev *);
110 110
@@ -135,7 +135,7 @@ struct regulator_ops {
135 int (*set_suspend_enable) (struct regulator_dev *); 135 int (*set_suspend_enable) (struct regulator_dev *);
136 int (*set_suspend_disable) (struct regulator_dev *); 136 int (*set_suspend_disable) (struct regulator_dev *);
137 137
138 /* set regulator suspend operating mode (defined in regulator.h) */ 138 /* set regulator suspend operating mode (defined in consumer.h) */
139 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); 139 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
140}; 140};
141 141
@@ -207,9 +207,7 @@ struct regulator_dev {
207 207
208 void *reg_data; /* regulator_dev data */ 208 void *reg_data; /* regulator_dev data */
209 209
210#ifdef CONFIG_DEBUG_FS
211 struct dentry *debugfs; 210 struct dentry *debugfs;
212#endif
213}; 211};
214 212
215struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index ffd7d508e726..936a7d8c11a9 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -48,4 +48,17 @@ struct fixed_voltage_config {
48 struct regulator_init_data *init_data; 48 struct regulator_init_data *init_data;
49}; 49};
50 50
51struct regulator_consumer_supply;
52
53#if IS_ENABLED(CONFIG_REGULATOR)
54struct platform_device *regulator_register_fixed(int id,
55 struct regulator_consumer_supply *supplies, int num_supplies);
56#else
57static inline struct platform_device *regulator_register_fixed(int id,
58 struct regulator_consumer_supply *supplies, int num_supplies)
59{
60 return NULL;
61}
62#endif
63
51#endif 64#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index f3f13fd5868f..7abb16093312 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -139,12 +139,10 @@ struct regulation_constraints {
139 * make struct device available late such as I2C and is the preferred 139 * make struct device available late such as I2C and is the preferred
140 * form. 140 * form.
141 * 141 *
142 * @dev: Device structure for the consumer.
143 * @dev_name: Result of dev_name() for the consumer. 142 * @dev_name: Result of dev_name() for the consumer.
144 * @supply: Name for the supply. 143 * @supply: Name for the supply.
145 */ 144 */
146struct regulator_consumer_supply { 145struct regulator_consumer_supply {
147 struct device *dev; /* consumer */
148 const char *dev_name; /* dev_name() for consumer */ 146 const char *dev_name; /* dev_name() for consumer */
149 const char *supply; /* consumer supply - e.g. "vcc" */ 147 const char *supply; /* consumer supply - e.g. "vcc" */
150}; 148};
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
new file mode 100644
index 000000000000..6a5c1b2c751e
--- /dev/null
+++ b/include/linux/regulator/tps62360.h
@@ -0,0 +1,57 @@
1/*
2 * tps62360.h -- TI tps62360
3 *
4 * Interface for regulator driver for TI TPS62360 Processor core supply
5 *
6 * Copyright (C) 2012 NVIDIA Corporation
7
8 * Author: Laxman Dewangan <ldewangan@nvidia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 *
24 */
25
26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H
28
29#include <linux/regulator/machine.h>
30
31/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 *
34 * @reg_init_data: The regulator init data.
35 * @en_force_pwm: Enable force pwm or not.
36 * @en_discharge: Enable discharge the output capacitor via internal
37 * register.
38 * @en_internal_pulldn: internal pull down enable or not.
39 * @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with
40 * fixed logic.
41 * @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with
42 * fixed logic.
43 * @vsel0_def_state: Default state of vsel0. 1 if it is high else 0.
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */
46struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge;
50 bool en_internal_pulldn;
51 int vsel0_gpio;
52 int vsel1_gpio;
53 int vsel0_def_state;
54 int vsel1_def_state;
55};
56
57#endif /* __LINUX_REGULATOR_TPS62360_H */
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
deleted file mode 100644
index f096b80e73d8..000000000000
--- a/include/linux/reiserfs_acl.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#include <linux/init.h>
2#include <linux/posix_acl.h>
3
4#define REISERFS_ACL_VERSION 0x0001
5
6typedef struct {
7 __le16 e_tag;
8 __le16 e_perm;
9 __le32 e_id;
10} reiserfs_acl_entry;
11
12typedef struct {
13 __le16 e_tag;
14 __le16 e_perm;
15} reiserfs_acl_entry_short;
16
17typedef struct {
18 __le32 a_version;
19} reiserfs_acl_header;
20
21static inline size_t reiserfs_acl_size(int count)
22{
23 if (count <= 4) {
24 return sizeof(reiserfs_acl_header) +
25 count * sizeof(reiserfs_acl_entry_short);
26 } else {
27 return sizeof(reiserfs_acl_header) +
28 4 * sizeof(reiserfs_acl_entry_short) +
29 (count - 4) * sizeof(reiserfs_acl_entry);
30 }
31}
32
33static inline int reiserfs_acl_count(size_t size)
34{
35 ssize_t s;
36 size -= sizeof(reiserfs_acl_header);
37 s = size - 4 * sizeof(reiserfs_acl_entry_short);
38 if (s < 0) {
39 if (size % sizeof(reiserfs_acl_entry_short))
40 return -1;
41 return size / sizeof(reiserfs_acl_entry_short);
42 } else {
43 if (s % sizeof(reiserfs_acl_entry))
44 return -1;
45 return s / sizeof(reiserfs_acl_entry) + 4;
46 }
47}
48
49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51int reiserfs_acl_chmod(struct inode *inode);
52int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry,
54 struct inode *inode);
55int reiserfs_cache_default_acl(struct inode *dir);
56extern const struct xattr_handler reiserfs_posix_acl_default_handler;
57extern const struct xattr_handler reiserfs_posix_acl_access_handler;
58
59#else
60
61#define reiserfs_cache_default_acl(inode) 0
62#define reiserfs_get_acl NULL
63
64static inline int reiserfs_acl_chmod(struct inode *inode)
65{
66 return 0;
67}
68
69static inline int
70reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
71 const struct inode *dir, struct dentry *dentry,
72 struct inode *inode)
73{
74 return 0;
75}
76#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 2213ddcce20c..ea3700cd7367 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1,32 +1,12 @@
1/* 1/*
2 * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details 2 * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details
3 */ 3 */
4
5 /* this file has an amazingly stupid
6 name, yura please fix it to be
7 reiserfs.h, and merge all the rest
8 of our .h files that are in this
9 directory into it. */
10
11#ifndef _LINUX_REISER_FS_H 4#ifndef _LINUX_REISER_FS_H
12#define _LINUX_REISER_FS_H 5#define _LINUX_REISER_FS_H
13 6
14#include <linux/types.h> 7#include <linux/types.h>
15#include <linux/magic.h> 8#include <linux/magic.h>
16 9
17#ifdef __KERNEL__
18#include <linux/slab.h>
19#include <linux/interrupt.h>
20#include <linux/sched.h>
21#include <linux/workqueue.h>
22#include <asm/unaligned.h>
23#include <linux/bitops.h>
24#include <linux/proc_fs.h>
25#include <linux/buffer_head.h>
26#include <linux/reiserfs_fs_i.h>
27#include <linux/reiserfs_fs_sb.h>
28#endif
29
30/* 10/*
31 * include/linux/reiser_fs.h 11 * include/linux/reiser_fs.h
32 * 12 *
@@ -43,2318 +23,4 @@
43#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION 23#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION
44#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION 24#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION
45 25
46#ifdef __KERNEL__
47/* the 32 bit compat definitions with int argument */
48#define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int)
49#define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
50#define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
51#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION
52#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION
53
54/*
55 * Locking primitives. The write lock is a per superblock
56 * special mutex that has properties close to the Big Kernel Lock
57 * which was used in the previous locking scheme.
58 */
59void reiserfs_write_lock(struct super_block *s);
60void reiserfs_write_unlock(struct super_block *s);
61int reiserfs_write_lock_once(struct super_block *s);
62void reiserfs_write_unlock_once(struct super_block *s, int lock_depth);
63
64#ifdef CONFIG_REISERFS_CHECK
65void reiserfs_lock_check_recursive(struct super_block *s);
66#else
67static inline void reiserfs_lock_check_recursive(struct super_block *s) { }
68#endif
69
70/*
71 * Several mutexes depend on the write lock.
72 * However sometimes we want to relax the write lock while we hold
73 * these mutexes, according to the release/reacquire on schedule()
74 * properties of the Bkl that were used.
75 * Reiserfs performances and locking were based on this scheme.
76 * Now that the write lock is a mutex and not the bkl anymore, doing so
77 * may result in a deadlock:
78 *
79 * A acquire write_lock
80 * A acquire j_commit_mutex
81 * A release write_lock and wait for something
82 * B acquire write_lock
83 * B can't acquire j_commit_mutex and sleep
84 * A can't acquire write lock anymore
85 * deadlock
86 *
87 * What we do here is avoiding such deadlock by playing the same game
88 * than the Bkl: if we can't acquire a mutex that depends on the write lock,
89 * we release the write lock, wait a bit and then retry.
90 *
91 * The mutexes concerned by this hack are:
92 * - The commit mutex of a journal list
93 * - The flush mutex
94 * - The journal lock
95 * - The inode mutex
96 */
97static inline void reiserfs_mutex_lock_safe(struct mutex *m,
98 struct super_block *s)
99{
100 reiserfs_lock_check_recursive(s);
101 reiserfs_write_unlock(s);
102 mutex_lock(m);
103 reiserfs_write_lock(s);
104}
105
106static inline void
107reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass,
108 struct super_block *s)
109{
110 reiserfs_lock_check_recursive(s);
111 reiserfs_write_unlock(s);
112 mutex_lock_nested(m, subclass);
113 reiserfs_write_lock(s);
114}
115
116static inline void
117reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s)
118{
119 reiserfs_lock_check_recursive(s);
120 reiserfs_write_unlock(s);
121 down_read(sem);
122 reiserfs_write_lock(s);
123}
124
125/*
126 * When we schedule, we usually want to also release the write lock,
127 * according to the previous bkl based locking scheme of reiserfs.
128 */
129static inline void reiserfs_cond_resched(struct super_block *s)
130{
131 if (need_resched()) {
132 reiserfs_write_unlock(s);
133 schedule();
134 reiserfs_write_lock(s);
135 }
136}
137
138struct fid;
139
140/* in reading the #defines, it may help to understand that they employ
141 the following abbreviations:
142
143 B = Buffer
144 I = Item header
145 H = Height within the tree (should be changed to LEV)
146 N = Number of the item in the node
147 STAT = stat data
148 DEH = Directory Entry Header
149 EC = Entry Count
150 E = Entry number
151 UL = Unsigned Long
152 BLKH = BLocK Header
153 UNFM = UNForMatted node
154 DC = Disk Child
155 P = Path
156
157 These #defines are named by concatenating these abbreviations,
158 where first comes the arguments, and last comes the return value,
159 of the macro.
160
161*/
162
163#define USE_INODE_GENERATION_COUNTER
164
165#define REISERFS_PREALLOCATE
166#define DISPLACE_NEW_PACKING_LOCALITIES
167#define PREALLOCATION_SIZE 9
168
169/* n must be power of 2 */
170#define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u))
171
172// to be ok for alpha and others we have to align structures to 8 byte
173// boundary.
174// FIXME: do not change 4 by anything else: there is code which relies on that
175#define ROUND_UP(x) _ROUND_UP(x,8LL)
176
177/* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug
178** messages.
179*/
180#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
181
182void __reiserfs_warning(struct super_block *s, const char *id,
183 const char *func, const char *fmt, ...);
184#define reiserfs_warning(s, id, fmt, args...) \
185 __reiserfs_warning(s, id, __func__, fmt, ##args)
186/* assertions handling */
187
188/** always check a condition and panic if it's false. */
189#define __RASSERT(cond, scond, format, args...) \
190do { \
191 if (!(cond)) \
192 reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
193 __FILE__ ":%i:%s: " format "\n", \
194 in_interrupt() ? -1 : task_pid_nr(current), \
195 __LINE__, __func__ , ##args); \
196} while (0)
197
198#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
199
200#if defined( CONFIG_REISERFS_CHECK )
201#define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args)
202#else
203#define RFALSE( cond, format, args... ) do {;} while( 0 )
204#endif
205
206#define CONSTF __attribute_const__
207/*
208 * Disk Data Structures
209 */
210
211/***************************************************************************/
212/* SUPER BLOCK */
213/***************************************************************************/
214
215/*
216 * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs
217 * the version in RAM is part of a larger structure containing fields never written to disk.
218 */
219#define UNSET_HASH 0 // read_super will guess about, what hash names
220 // in directories were sorted with
221#define TEA_HASH 1
222#define YURA_HASH 2
223#define R5_HASH 3
224#define DEFAULT_HASH R5_HASH
225
226struct journal_params {
227 __le32 jp_journal_1st_block; /* where does journal start from on its
228 * device */
229 __le32 jp_journal_dev; /* journal device st_rdev */
230 __le32 jp_journal_size; /* size of the journal */
231 __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */
232 __le32 jp_journal_magic; /* random value made on fs creation (this
233 * was sb_journal_block_count) */
234 __le32 jp_journal_max_batch; /* max number of blocks to batch into a
235 * trans */
236 __le32 jp_journal_max_commit_age; /* in seconds, how old can an async
237 * commit be */
238 __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction
239 * be */
240};
241
242/* this is the super from 3.5.X, where X >= 10 */
243struct reiserfs_super_block_v1 {
244 __le32 s_block_count; /* blocks count */
245 __le32 s_free_blocks; /* free blocks count */
246 __le32 s_root_block; /* root block number */
247 struct journal_params s_journal;
248 __le16 s_blocksize; /* block size */
249 __le16 s_oid_maxsize; /* max size of object id array, see
250 * get_objectid() commentary */
251 __le16 s_oid_cursize; /* current size of object id array */
252 __le16 s_umount_state; /* this is set to 1 when filesystem was
253 * umounted, to 2 - when not */
254 char s_magic[10]; /* reiserfs magic string indicates that
255 * file system is reiserfs:
256 * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
257 __le16 s_fs_state; /* it is set to used by fsck to mark which
258 * phase of rebuilding is done */
259 __le32 s_hash_function_code; /* indicate, what hash function is being use
260 * to sort names in a directory*/
261 __le16 s_tree_height; /* height of disk tree */
262 __le16 s_bmap_nr; /* amount of bitmap blocks needed to address
263 * each block of file system */
264 __le16 s_version; /* this field is only reliable on filesystem
265 * with non-standard journal */
266 __le16 s_reserved_for_journal; /* size in blocks of journal area on main
267 * device, we need to keep after
268 * making fs with non-standard journal */
269} __attribute__ ((__packed__));
270
271#define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1))
272
273/* this is the on disk super block */
274struct reiserfs_super_block {
275 struct reiserfs_super_block_v1 s_v1;
276 __le32 s_inode_generation;
277 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
278 unsigned char s_uuid[16]; /* filesystem unique identifier */
279 unsigned char s_label[16]; /* filesystem volume label */
280 __le16 s_mnt_count; /* Count of mounts since last fsck */
281 __le16 s_max_mnt_count; /* Maximum mounts before check */
282 __le32 s_lastcheck; /* Timestamp of last fsck */
283 __le32 s_check_interval; /* Interval between checks */
284 char s_unused[76]; /* zero filled by mkreiserfs and
285 * reiserfs_convert_objectid_map_v1()
286 * so any additions must be updated
287 * there as well. */
288} __attribute__ ((__packed__));
289
290#define SB_SIZE (sizeof(struct reiserfs_super_block))
291
292#define REISERFS_VERSION_1 0
293#define REISERFS_VERSION_2 2
294
295// on-disk super block fields converted to cpu form
296#define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs)
297#define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1))
298#define SB_BLOCKSIZE(s) \
299 le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize))
300#define SB_BLOCK_COUNT(s) \
301 le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_block_count))
302#define SB_FREE_BLOCKS(s) \
303 le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks))
304#define SB_REISERFS_MAGIC(s) \
305 (SB_V1_DISK_SUPER_BLOCK(s)->s_magic)
306#define SB_ROOT_BLOCK(s) \
307 le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_root_block))
308#define SB_TREE_HEIGHT(s) \
309 le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height))
310#define SB_REISERFS_STATE(s) \
311 le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state))
312#define SB_VERSION(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_version))
313#define SB_BMAP_NR(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr))
314
315#define PUT_SB_BLOCK_COUNT(s, val) \
316 do { SB_V1_DISK_SUPER_BLOCK(s)->s_block_count = cpu_to_le32(val); } while (0)
317#define PUT_SB_FREE_BLOCKS(s, val) \
318 do { SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks = cpu_to_le32(val); } while (0)
319#define PUT_SB_ROOT_BLOCK(s, val) \
320 do { SB_V1_DISK_SUPER_BLOCK(s)->s_root_block = cpu_to_le32(val); } while (0)
321#define PUT_SB_TREE_HEIGHT(s, val) \
322 do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0)
323#define PUT_SB_REISERFS_STATE(s, val) \
324 do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0)
325#define PUT_SB_VERSION(s, val) \
326 do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0)
327#define PUT_SB_BMAP_NR(s, val) \
328 do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0)
329
330#define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal)
331#define SB_ONDISK_JOURNAL_SIZE(s) \
332 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size))
333#define SB_ONDISK_JOURNAL_1st_BLOCK(s) \
334 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_1st_block))
335#define SB_ONDISK_JOURNAL_DEVICE(s) \
336 le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev))
337#define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \
338 le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal))
339
340#define is_block_in_log_or_reserved_area(s, block) \
341 block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \
342 && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \
343 ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \
344 SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s)))
345
346int is_reiserfs_3_5(struct reiserfs_super_block *rs);
347int is_reiserfs_3_6(struct reiserfs_super_block *rs);
348int is_reiserfs_jr(struct reiserfs_super_block *rs);
349
350/* ReiserFS leaves the first 64k unused, so that partition labels have
351 enough space. If someone wants to write a fancy bootloader that
352 needs more than 64k, let us know, and this will be increased in size.
353 This number must be larger than than the largest block size on any
354 platform, or code will break. -Hans */
355#define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024)
356#define REISERFS_FIRST_BLOCK unused_define
357#define REISERFS_JOURNAL_OFFSET_IN_BYTES REISERFS_DISK_OFFSET_IN_BYTES
358
359/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
360#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
361
362/* reiserfs internal error code (used by search_by_key and fix_nodes)) */
363#define CARRY_ON 0
364#define REPEAT_SEARCH -1
365#define IO_ERROR -2
366#define NO_DISK_SPACE -3
367#define NO_BALANCING_NEEDED (-4)
368#define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5)
369#define QUOTA_EXCEEDED -6
370
371typedef __u32 b_blocknr_t;
372typedef __le32 unp_t;
373
374struct unfm_nodeinfo {
375 unp_t unfm_nodenum;
376 unsigned short unfm_freespace;
377};
378
379/* there are two formats of keys: 3.5 and 3.6
380 */
381#define KEY_FORMAT_3_5 0
382#define KEY_FORMAT_3_6 1
383
384/* there are two stat datas */
385#define STAT_DATA_V1 0
386#define STAT_DATA_V2 1
387
388static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode)
389{
390 return container_of(inode, struct reiserfs_inode_info, vfs_inode);
391}
392
393static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
394{
395 return sb->s_fs_info;
396}
397
398/* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16
399 * which overflows on large file systems. */
400static inline __u32 reiserfs_bmap_count(struct super_block *sb)
401{
402 return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1;
403}
404
405static inline int bmap_would_wrap(unsigned bmap_nr)
406{
407 return bmap_nr > ((1LL << 16) - 1);
408}
409
410/** this says about version of key of all items (but stat data) the
411 object consists of */
412#define get_inode_item_key_version( inode ) \
413 ((REISERFS_I(inode)->i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5)
414
415#define set_inode_item_key_version( inode, version ) \
416 ({ if((version)==KEY_FORMAT_3_6) \
417 REISERFS_I(inode)->i_flags |= i_item_key_version_mask; \
418 else \
419 REISERFS_I(inode)->i_flags &= ~i_item_key_version_mask; })
420
421#define get_inode_sd_version(inode) \
422 ((REISERFS_I(inode)->i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1)
423
424#define set_inode_sd_version(inode, version) \
425 ({ if((version)==STAT_DATA_V2) \
426 REISERFS_I(inode)->i_flags |= i_stat_data_version_mask; \
427 else \
428 REISERFS_I(inode)->i_flags &= ~i_stat_data_version_mask; })
429
430/* This is an aggressive tail suppression policy, I am hoping it
431 improves our benchmarks. The principle behind it is that percentage
432 space saving is what matters, not absolute space saving. This is
433 non-intuitive, but it helps to understand it if you consider that the
434 cost to access 4 blocks is not much more than the cost to access 1
435 block, if you have to do a seek and rotate. A tail risks a
436 non-linear disk access that is significant as a percentage of total
437 time cost for a 4 block file and saves an amount of space that is
438 less significant as a percentage of space, or so goes the hypothesis.
439 -Hans */
440#define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \
441(\
442 (!(n_tail_size)) || \
443 (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \
444 ( (n_file_size) >= (n_block_size) * 4 ) || \
445 ( ( (n_file_size) >= (n_block_size) * 3 ) && \
446 ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \
447 ( ( (n_file_size) >= (n_block_size) * 2 ) && \
448 ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \
449 ( ( (n_file_size) >= (n_block_size) ) && \
450 ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \
451)
452
453/* Another strategy for tails, this one means only create a tail if all the
454 file would fit into one DIRECT item.
455 Primary intention for this one is to increase performance by decreasing
456 seeking.
457*/
458#define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \
459(\
460 (!(n_tail_size)) || \
461 (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \
462)
463
464/*
465 * values for s_umount_state field
466 */
467#define REISERFS_VALID_FS 1
468#define REISERFS_ERROR_FS 2
469
470//
471// there are 5 item types currently
472//
473#define TYPE_STAT_DATA 0
474#define TYPE_INDIRECT 1
475#define TYPE_DIRECT 2
476#define TYPE_DIRENTRY 3
477#define TYPE_MAXTYPE 3
478#define TYPE_ANY 15 // FIXME: comment is required
479
480/***************************************************************************/
481/* KEY & ITEM HEAD */
482/***************************************************************************/
483
484//
485// directories use this key as well as old files
486//
487struct offset_v1 {
488 __le32 k_offset;
489 __le32 k_uniqueness;
490} __attribute__ ((__packed__));
491
492struct offset_v2 {
493 __le64 v;
494} __attribute__ ((__packed__));
495
496static inline __u16 offset_v2_k_type(const struct offset_v2 *v2)
497{
498 __u8 type = le64_to_cpu(v2->v) >> 60;
499 return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY;
500}
501
502static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type)
503{
504 v2->v =
505 (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60);
506}
507
508static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2)
509{
510 return le64_to_cpu(v2->v) & (~0ULL >> 4);
511}
512
513static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset)
514{
515 offset &= (~0ULL >> 4);
516 v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
517}
518
519/* Key of an item determines its location in the S+tree, and
520 is composed of 4 components */
521struct reiserfs_key {
522 __le32 k_dir_id; /* packing locality: by default parent
523 directory object id */
524 __le32 k_objectid; /* object identifier */
525 union {
526 struct offset_v1 k_offset_v1;
527 struct offset_v2 k_offset_v2;
528 } __attribute__ ((__packed__)) u;
529} __attribute__ ((__packed__));
530
531struct in_core_key {
532 __u32 k_dir_id; /* packing locality: by default parent
533 directory object id */
534 __u32 k_objectid; /* object identifier */
535 __u64 k_offset;
536 __u8 k_type;
537};
538
539struct cpu_key {
540 struct in_core_key on_disk_key;
541 int version;
542 int key_length; /* 3 in all cases but direct2indirect and
543 indirect2direct conversion */
544};
545
546/* Our function for comparing keys can compare keys of different
547 lengths. It takes as a parameter the length of the keys it is to
548 compare. These defines are used in determining what is to be passed
549 to it as that parameter. */
550#define REISERFS_FULL_KEY_LEN 4
551#define REISERFS_SHORT_KEY_LEN 2
552
553/* The result of the key compare */
554#define FIRST_GREATER 1
555#define SECOND_GREATER -1
556#define KEYS_IDENTICAL 0
557#define KEY_FOUND 1
558#define KEY_NOT_FOUND 0
559
560#define KEY_SIZE (sizeof(struct reiserfs_key))
561#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32))
562
563/* return values for search_by_key and clones */
564#define ITEM_FOUND 1
565#define ITEM_NOT_FOUND 0
566#define ENTRY_FOUND 1
567#define ENTRY_NOT_FOUND 0
568#define DIRECTORY_NOT_FOUND -1
569#define REGULAR_FILE_FOUND -2
570#define DIRECTORY_FOUND -3
571#define BYTE_FOUND 1
572#define BYTE_NOT_FOUND 0
573#define FILE_NOT_FOUND -1
574
575#define POSITION_FOUND 1
576#define POSITION_NOT_FOUND 0
577
578// return values for reiserfs_find_entry and search_by_entry_key
579#define NAME_FOUND 1
580#define NAME_NOT_FOUND 0
581#define GOTO_PREVIOUS_ITEM 2
582#define NAME_FOUND_INVISIBLE 3
583
584/* Everything in the filesystem is stored as a set of items. The
585 item head contains the key of the item, its free space (for
586 indirect items) and specifies the location of the item itself
587 within the block. */
588
589struct item_head {
590 /* Everything in the tree is found by searching for it based on
591 * its key.*/
592 struct reiserfs_key ih_key;
593 union {
594 /* The free space in the last unformatted node of an
595 indirect item if this is an indirect item. This
596 equals 0xFFFF iff this is a direct item or stat data
597 item. Note that the key, not this field, is used to
598 determine the item type, and thus which field this
599 union contains. */
600 __le16 ih_free_space_reserved;
601 /* Iff this is a directory item, this field equals the
602 number of directory entries in the directory item. */
603 __le16 ih_entry_count;
604 } __attribute__ ((__packed__)) u;
605 __le16 ih_item_len; /* total size of the item body */
606 __le16 ih_item_location; /* an offset to the item body
607 * within the block */
608 __le16 ih_version; /* 0 for all old items, 2 for new
609 ones. Highest bit is set by fsck
610 temporary, cleaned after all
611 done */
612} __attribute__ ((__packed__));
613/* size of item header */
614#define IH_SIZE (sizeof(struct item_head))
615
616#define ih_free_space(ih) le16_to_cpu((ih)->u.ih_free_space_reserved)
617#define ih_version(ih) le16_to_cpu((ih)->ih_version)
618#define ih_entry_count(ih) le16_to_cpu((ih)->u.ih_entry_count)
619#define ih_location(ih) le16_to_cpu((ih)->ih_item_location)
620#define ih_item_len(ih) le16_to_cpu((ih)->ih_item_len)
621
622#define put_ih_free_space(ih, val) do { (ih)->u.ih_free_space_reserved = cpu_to_le16(val); } while(0)
623#define put_ih_version(ih, val) do { (ih)->ih_version = cpu_to_le16(val); } while (0)
624#define put_ih_entry_count(ih, val) do { (ih)->u.ih_entry_count = cpu_to_le16(val); } while (0)
625#define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0)
626#define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0)
627
628#define unreachable_item(ih) (ih_version(ih) & (1 << 15))
629
630#define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih))
631#define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == KEY_FORMAT_3_6) ? 0 : (val)))
632
633/* these operate on indirect items, where you've got an array of ints
634** at a possibly unaligned location. These are a noop on ia32
635**
636** p is the array of __u32, i is the index into the array, v is the value
637** to store there.
638*/
639#define get_block_num(p, i) get_unaligned_le32((p) + (i))
640#define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i))
641
642//
643// in old version uniqueness field shows key type
644//
645#define V1_SD_UNIQUENESS 0
646#define V1_INDIRECT_UNIQUENESS 0xfffffffe
647#define V1_DIRECT_UNIQUENESS 0xffffffff
648#define V1_DIRENTRY_UNIQUENESS 500
649#define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
650
651//
652// here are conversion routines
653//
654static inline int uniqueness2type(__u32 uniqueness) CONSTF;
655static inline int uniqueness2type(__u32 uniqueness)
656{
657 switch ((int)uniqueness) {
658 case V1_SD_UNIQUENESS:
659 return TYPE_STAT_DATA;
660 case V1_INDIRECT_UNIQUENESS:
661 return TYPE_INDIRECT;
662 case V1_DIRECT_UNIQUENESS:
663 return TYPE_DIRECT;
664 case V1_DIRENTRY_UNIQUENESS:
665 return TYPE_DIRENTRY;
666 case V1_ANY_UNIQUENESS:
667 default:
668 return TYPE_ANY;
669 }
670}
671
672static inline __u32 type2uniqueness(int type) CONSTF;
673static inline __u32 type2uniqueness(int type)
674{
675 switch (type) {
676 case TYPE_STAT_DATA:
677 return V1_SD_UNIQUENESS;
678 case TYPE_INDIRECT:
679 return V1_INDIRECT_UNIQUENESS;
680 case TYPE_DIRECT:
681 return V1_DIRECT_UNIQUENESS;
682 case TYPE_DIRENTRY:
683 return V1_DIRENTRY_UNIQUENESS;
684 case TYPE_ANY:
685 default:
686 return V1_ANY_UNIQUENESS;
687 }
688}
689
690//
691// key is pointer to on disk key which is stored in le, result is cpu,
692// there is no way to get version of object from key, so, provide
693// version to these defines
694//
695static inline loff_t le_key_k_offset(int version,
696 const struct reiserfs_key *key)
697{
698 return (version == KEY_FORMAT_3_5) ?
699 le32_to_cpu(key->u.k_offset_v1.k_offset) :
700 offset_v2_k_offset(&(key->u.k_offset_v2));
701}
702
703static inline loff_t le_ih_k_offset(const struct item_head *ih)
704{
705 return le_key_k_offset(ih_version(ih), &(ih->ih_key));
706}
707
708static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key)
709{
710 return (version == KEY_FORMAT_3_5) ?
711 uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) :
712 offset_v2_k_type(&(key->u.k_offset_v2));
713}
714
715static inline loff_t le_ih_k_type(const struct item_head *ih)
716{
717 return le_key_k_type(ih_version(ih), &(ih->ih_key));
718}
719
720static inline void set_le_key_k_offset(int version, struct reiserfs_key *key,
721 loff_t offset)
722{
723 (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */
724 (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset));
725}
726
727static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset)
728{
729 set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset);
730}
731
732static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
733 int type)
734{
735 (version == KEY_FORMAT_3_5) ?
736 (void)(key->u.k_offset_v1.k_uniqueness =
737 cpu_to_le32(type2uniqueness(type)))
738 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
739}
740
741static inline void set_le_ih_k_type(struct item_head *ih, int type)
742{
743 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
744}
745
746static inline int is_direntry_le_key(int version, struct reiserfs_key *key)
747{
748 return le_key_k_type(version, key) == TYPE_DIRENTRY;
749}
750
751static inline int is_direct_le_key(int version, struct reiserfs_key *key)
752{
753 return le_key_k_type(version, key) == TYPE_DIRECT;
754}
755
756static inline int is_indirect_le_key(int version, struct reiserfs_key *key)
757{
758 return le_key_k_type(version, key) == TYPE_INDIRECT;
759}
760
761static inline int is_statdata_le_key(int version, struct reiserfs_key *key)
762{
763 return le_key_k_type(version, key) == TYPE_STAT_DATA;
764}
765
766//
767// item header has version.
768//
769static inline int is_direntry_le_ih(struct item_head *ih)
770{
771 return is_direntry_le_key(ih_version(ih), &ih->ih_key);
772}
773
774static inline int is_direct_le_ih(struct item_head *ih)
775{
776 return is_direct_le_key(ih_version(ih), &ih->ih_key);
777}
778
779static inline int is_indirect_le_ih(struct item_head *ih)
780{
781 return is_indirect_le_key(ih_version(ih), &ih->ih_key);
782}
783
784static inline int is_statdata_le_ih(struct item_head *ih)
785{
786 return is_statdata_le_key(ih_version(ih), &ih->ih_key);
787}
788
789//
790// key is pointer to cpu key, result is cpu
791//
792static inline loff_t cpu_key_k_offset(const struct cpu_key *key)
793{
794 return key->on_disk_key.k_offset;
795}
796
797static inline loff_t cpu_key_k_type(const struct cpu_key *key)
798{
799 return key->on_disk_key.k_type;
800}
801
802static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset)
803{
804 key->on_disk_key.k_offset = offset;
805}
806
807static inline void set_cpu_key_k_type(struct cpu_key *key, int type)
808{
809 key->on_disk_key.k_type = type;
810}
811
812static inline void cpu_key_k_offset_dec(struct cpu_key *key)
813{
814 key->on_disk_key.k_offset--;
815}
816
817#define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY)
818#define is_direct_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRECT)
819#define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT)
820#define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA)
821
822/* are these used ? */
823#define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key)))
824#define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key)))
825#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
826#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
827
828#define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
829 (!COMP_SHORT_KEYS(ih, key) && \
830 I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
831
832/* maximal length of item */
833#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
834#define MIN_ITEM_LEN 1
835
836/* object identifier for root dir */
837#define REISERFS_ROOT_OBJECTID 2
838#define REISERFS_ROOT_PARENT_OBJECTID 1
839
840extern struct reiserfs_key root_key;
841
842/*
843 * Picture represents a leaf of the S+tree
844 * ______________________________________________________
845 * | | Array of | | |
846 * |Block | Object-Item | F r e e | Objects- |
847 * | head | Headers | S p a c e | Items |
848 * |______|_______________|___________________|___________|
849 */
850
851/* Header of a disk block. More precisely, header of a formatted leaf
852 or internal node, and not the header of an unformatted node. */
853struct block_head {
854 __le16 blk_level; /* Level of a block in the tree. */
855 __le16 blk_nr_item; /* Number of keys/items in a block. */
856 __le16 blk_free_space; /* Block free space in bytes. */
857 __le16 blk_reserved;
858 /* dump this in v4/planA */
859 struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */
860};
861
862#define BLKH_SIZE (sizeof(struct block_head))
863#define blkh_level(p_blkh) (le16_to_cpu((p_blkh)->blk_level))
864#define blkh_nr_item(p_blkh) (le16_to_cpu((p_blkh)->blk_nr_item))
865#define blkh_free_space(p_blkh) (le16_to_cpu((p_blkh)->blk_free_space))
866#define blkh_reserved(p_blkh) (le16_to_cpu((p_blkh)->blk_reserved))
867#define set_blkh_level(p_blkh,val) ((p_blkh)->blk_level = cpu_to_le16(val))
868#define set_blkh_nr_item(p_blkh,val) ((p_blkh)->blk_nr_item = cpu_to_le16(val))
869#define set_blkh_free_space(p_blkh,val) ((p_blkh)->blk_free_space = cpu_to_le16(val))
870#define set_blkh_reserved(p_blkh,val) ((p_blkh)->blk_reserved = cpu_to_le16(val))
871#define blkh_right_delim_key(p_blkh) ((p_blkh)->blk_right_delim_key)
872#define set_blkh_right_delim_key(p_blkh,val) ((p_blkh)->blk_right_delim_key = val)
873
874/*
875 * values for blk_level field of the struct block_head
876 */
877
878#define FREE_LEVEL 0 /* when node gets removed from the tree its
879 blk_level is set to FREE_LEVEL. It is then
880 used to see whether the node is still in the
881 tree */
882
883#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
884
885/* Given the buffer head of a formatted node, resolve to the block head of that node. */
886#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
887/* Number of items that are in buffer. */
888#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
889#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
890#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
891
892#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
893#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
894#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
895
896/* Get right delimiting key. -- little endian */
897#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
898
899/* Does the buffer contain a disk leaf. */
900#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
901
902/* Does the buffer contain a disk internal node */
903#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
904 && B_LEVEL(bh) <= MAX_HEIGHT)
905
906/***************************************************************************/
907/* STAT DATA */
908/***************************************************************************/
909
910//
911// old stat data is 32 bytes long. We are going to distinguish new one by
912// different size
913//
914struct stat_data_v1 {
915 __le16 sd_mode; /* file type, permissions */
916 __le16 sd_nlink; /* number of hard links */
917 __le16 sd_uid; /* owner */
918 __le16 sd_gid; /* group */
919 __le32 sd_size; /* file size */
920 __le32 sd_atime; /* time of last access */
921 __le32 sd_mtime; /* time file was last modified */
922 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
923 union {
924 __le32 sd_rdev;
925 __le32 sd_blocks; /* number of blocks file uses */
926 } __attribute__ ((__packed__)) u;
927 __le32 sd_first_direct_byte; /* first byte of file which is stored
928 in a direct item: except that if it
929 equals 1 it is a symlink and if it
930 equals ~(__u32)0 there is no
931 direct item. The existence of this
932 field really grates on me. Let's
933 replace it with a macro based on
934 sd_size and our tail suppression
935 policy. Someday. -Hans */
936} __attribute__ ((__packed__));
937
938#define SD_V1_SIZE (sizeof(struct stat_data_v1))
939#define stat_data_v1(ih) (ih_version (ih) == KEY_FORMAT_3_5)
940#define sd_v1_mode(sdp) (le16_to_cpu((sdp)->sd_mode))
941#define set_sd_v1_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v))
942#define sd_v1_nlink(sdp) (le16_to_cpu((sdp)->sd_nlink))
943#define set_sd_v1_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le16(v))
944#define sd_v1_uid(sdp) (le16_to_cpu((sdp)->sd_uid))
945#define set_sd_v1_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le16(v))
946#define sd_v1_gid(sdp) (le16_to_cpu((sdp)->sd_gid))
947#define set_sd_v1_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le16(v))
948#define sd_v1_size(sdp) (le32_to_cpu((sdp)->sd_size))
949#define set_sd_v1_size(sdp,v) ((sdp)->sd_size = cpu_to_le32(v))
950#define sd_v1_atime(sdp) (le32_to_cpu((sdp)->sd_atime))
951#define set_sd_v1_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v))
952#define sd_v1_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime))
953#define set_sd_v1_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v))
954#define sd_v1_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime))
955#define set_sd_v1_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v))
956#define sd_v1_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev))
957#define set_sd_v1_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v))
958#define sd_v1_blocks(sdp) (le32_to_cpu((sdp)->u.sd_blocks))
959#define set_sd_v1_blocks(sdp,v) ((sdp)->u.sd_blocks = cpu_to_le32(v))
960#define sd_v1_first_direct_byte(sdp) \
961 (le32_to_cpu((sdp)->sd_first_direct_byte))
962#define set_sd_v1_first_direct_byte(sdp,v) \
963 ((sdp)->sd_first_direct_byte = cpu_to_le32(v))
964
965/* inode flags stored in sd_attrs (nee sd_reserved) */
966
967/* we want common flags to have the same values as in ext2,
968 so chattr(1) will work without problems */
969#define REISERFS_IMMUTABLE_FL FS_IMMUTABLE_FL
970#define REISERFS_APPEND_FL FS_APPEND_FL
971#define REISERFS_SYNC_FL FS_SYNC_FL
972#define REISERFS_NOATIME_FL FS_NOATIME_FL
973#define REISERFS_NODUMP_FL FS_NODUMP_FL
974#define REISERFS_SECRM_FL FS_SECRM_FL
975#define REISERFS_UNRM_FL FS_UNRM_FL
976#define REISERFS_COMPR_FL FS_COMPR_FL
977#define REISERFS_NOTAIL_FL FS_NOTAIL_FL
978
979/* persistent flags that file inherits from the parent directory */
980#define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
981 REISERFS_SYNC_FL | \
982 REISERFS_NOATIME_FL | \
983 REISERFS_NODUMP_FL | \
984 REISERFS_SECRM_FL | \
985 REISERFS_COMPR_FL | \
986 REISERFS_NOTAIL_FL )
987
988/* Stat Data on disk (reiserfs version of UFS disk inode minus the
989 address blocks) */
990struct stat_data {
991 __le16 sd_mode; /* file type, permissions */
992 __le16 sd_attrs; /* persistent inode flags */
993 __le32 sd_nlink; /* number of hard links */
994 __le64 sd_size; /* file size */
995 __le32 sd_uid; /* owner */
996 __le32 sd_gid; /* group */
997 __le32 sd_atime; /* time of last access */
998 __le32 sd_mtime; /* time file was last modified */
999 __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
1000 __le32 sd_blocks;
1001 union {
1002 __le32 sd_rdev;
1003 __le32 sd_generation;
1004 //__le32 sd_first_direct_byte;
1005 /* first byte of file which is stored in a
1006 direct item: except that if it equals 1
1007 it is a symlink and if it equals
1008 ~(__u32)0 there is no direct item. The
1009 existence of this field really grates
1010 on me. Let's replace it with a macro
1011 based on sd_size and our tail
1012 suppression policy? */
1013 } __attribute__ ((__packed__)) u;
1014} __attribute__ ((__packed__));
1015//
1016// this is 44 bytes long
1017//
1018#define SD_SIZE (sizeof(struct stat_data))
1019#define SD_V2_SIZE SD_SIZE
1020#define stat_data_v2(ih) (ih_version (ih) == KEY_FORMAT_3_6)
1021#define sd_v2_mode(sdp) (le16_to_cpu((sdp)->sd_mode))
1022#define set_sd_v2_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v))
1023/* sd_reserved */
1024/* set_sd_reserved */
1025#define sd_v2_nlink(sdp) (le32_to_cpu((sdp)->sd_nlink))
1026#define set_sd_v2_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le32(v))
1027#define sd_v2_size(sdp) (le64_to_cpu((sdp)->sd_size))
1028#define set_sd_v2_size(sdp,v) ((sdp)->sd_size = cpu_to_le64(v))
1029#define sd_v2_uid(sdp) (le32_to_cpu((sdp)->sd_uid))
1030#define set_sd_v2_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le32(v))
1031#define sd_v2_gid(sdp) (le32_to_cpu((sdp)->sd_gid))
1032#define set_sd_v2_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le32(v))
1033#define sd_v2_atime(sdp) (le32_to_cpu((sdp)->sd_atime))
1034#define set_sd_v2_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v))
1035#define sd_v2_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime))
1036#define set_sd_v2_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v))
1037#define sd_v2_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime))
1038#define set_sd_v2_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v))
1039#define sd_v2_blocks(sdp) (le32_to_cpu((sdp)->sd_blocks))
1040#define set_sd_v2_blocks(sdp,v) ((sdp)->sd_blocks = cpu_to_le32(v))
1041#define sd_v2_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev))
1042#define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v))
1043#define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation))
1044#define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v))
1045#define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs))
1046#define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v))
1047
1048/***************************************************************************/
1049/* DIRECTORY STRUCTURE */
1050/***************************************************************************/
1051/*
1052 Picture represents the structure of directory items
1053 ________________________________________________
1054 | Array of | | | | | |
1055 | directory |N-1| N-2 | .... | 1st |0th|
1056 | entry headers | | | | | |
1057 |_______________|___|_____|________|_______|___|
1058 <---- directory entries ------>
1059
1060 First directory item has k_offset component 1. We store "." and ".."
1061 in one item, always, we never split "." and ".." into differing
1062 items. This makes, among other things, the code for removing
1063 directories simpler. */
1064#define SD_OFFSET 0
1065#define SD_UNIQUENESS 0
1066#define DOT_OFFSET 1
1067#define DOT_DOT_OFFSET 2
1068#define DIRENTRY_UNIQUENESS 500
1069
1070/* */
1071#define FIRST_ITEM_OFFSET 1
1072
1073/*
1074 Q: How to get key of object pointed to by entry from entry?
1075
1076 A: Each directory entry has its header. This header has deh_dir_id and deh_objectid fields, those are key
1077 of object, entry points to */
1078
1079/* NOT IMPLEMENTED:
1080 Directory will someday contain stat data of object */
1081
1082struct reiserfs_de_head {
1083 __le32 deh_offset; /* third component of the directory entry key */
1084 __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced
1085 by directory entry */
1086 __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */
1087 __le16 deh_location; /* offset of name in the whole item */
1088 __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
1089 entry is hidden (unlinked) */
1090} __attribute__ ((__packed__));
1091#define DEH_SIZE sizeof(struct reiserfs_de_head)
1092#define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset))
1093#define deh_dir_id(p_deh) (le32_to_cpu((p_deh)->deh_dir_id))
1094#define deh_objectid(p_deh) (le32_to_cpu((p_deh)->deh_objectid))
1095#define deh_location(p_deh) (le16_to_cpu((p_deh)->deh_location))
1096#define deh_state(p_deh) (le16_to_cpu((p_deh)->deh_state))
1097
1098#define put_deh_offset(p_deh,v) ((p_deh)->deh_offset = cpu_to_le32((v)))
1099#define put_deh_dir_id(p_deh,v) ((p_deh)->deh_dir_id = cpu_to_le32((v)))
1100#define put_deh_objectid(p_deh,v) ((p_deh)->deh_objectid = cpu_to_le32((v)))
1101#define put_deh_location(p_deh,v) ((p_deh)->deh_location = cpu_to_le16((v)))
1102#define put_deh_state(p_deh,v) ((p_deh)->deh_state = cpu_to_le16((v)))
1103
1104/* empty directory contains two entries "." and ".." and their headers */
1105#define EMPTY_DIR_SIZE \
1106(DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen ("..")))
1107
1108/* old format directories have this size when empty */
1109#define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3)
1110
1111#define DEH_Statdata 0 /* not used now */
1112#define DEH_Visible 2
1113
1114/* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */
1115#if BITS_PER_LONG == 64 || defined(__s390__) || defined(__hppa__)
1116# define ADDR_UNALIGNED_BITS (3)
1117#endif
1118
1119/* These are only used to manipulate deh_state.
1120 * Because of this, we'll use the ext2_ bit routines,
1121 * since they are little endian */
1122#ifdef ADDR_UNALIGNED_BITS
1123
1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
1126
1127# define set_bit_unaligned(nr, addr) \
1128 __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1129# define clear_bit_unaligned(nr, addr) \
1130 __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1131# define test_bit_unaligned(nr, addr) \
1132 test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1133
1134#else
1135
1136# define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr)
1137# define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr)
1138# define test_bit_unaligned(nr, addr) test_bit_le(nr, addr)
1139
1140#endif
1141
1142#define mark_de_with_sd(deh) set_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
1143#define mark_de_without_sd(deh) clear_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
1144#define mark_de_visible(deh) set_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1145#define mark_de_hidden(deh) clear_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1146
1147#define de_with_sd(deh) test_bit_unaligned (DEH_Statdata, &((deh)->deh_state))
1148#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1149#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
1150
1151extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid,
1152 __le32 par_dirid, __le32 par_objid);
1153extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid,
1154 __le32 par_dirid, __le32 par_objid);
1155
1156/* array of the entry headers */
1157 /* get item body */
1158#define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) )
1159#define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih)))
1160
1161/* length of the directory entry in directory item. This define
1162 calculates length of i-th directory entry using directory entry
1163 locations from dir entry head. When it calculates length of 0-th
1164 directory entry, it uses length of whole item in place of entry
1165 location of the non-existent following entry in the calculation.
1166 See picture above.*/
1167/*
1168#define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \
1169((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh))))
1170*/
1171static inline int entry_length(const struct buffer_head *bh,
1172 const struct item_head *ih, int pos_in_item)
1173{
1174 struct reiserfs_de_head *deh;
1175
1176 deh = B_I_DEH(bh, ih) + pos_in_item;
1177 if (pos_in_item)
1178 return deh_location(deh - 1) - deh_location(deh);
1179
1180 return ih_item_len(ih) - deh_location(deh);
1181}
1182
1183/* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */
1184#define I_ENTRY_COUNT(ih) (ih_entry_count((ih)))
1185
1186/* name by bh, ih and entry_num */
1187#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
1188
1189// two entries per block (at least)
1190#define REISERFS_MAX_NAME(block_size) 255
1191
1192/* this structure is used for operations on directory entries. It is
1193 not a disk structure. */
1194/* When reiserfs_find_entry or search_by_entry_key find directory
1195 entry, they return filled reiserfs_dir_entry structure */
1196struct reiserfs_dir_entry {
1197 struct buffer_head *de_bh;
1198 int de_item_num;
1199 struct item_head *de_ih;
1200 int de_entry_num;
1201 struct reiserfs_de_head *de_deh;
1202 int de_entrylen;
1203 int de_namelen;
1204 char *de_name;
1205 unsigned long *de_gen_number_bit_string;
1206
1207 __u32 de_dir_id;
1208 __u32 de_objectid;
1209
1210 struct cpu_key de_entry_key;
1211};
1212
1213/* these defines are useful when a particular member of a reiserfs_dir_entry is needed */
1214
1215/* pointer to file name, stored in entry */
1216#define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh))
1217
1218/* length of name */
1219#define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \
1220(I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0))
1221
1222/* hash value occupies bits from 7 up to 30 */
1223#define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL)
1224/* generation number occupies 7 bits starting from 0 up to 6 */
1225#define GET_GENERATION_NUMBER(offset) ((offset) & 0x7fLL)
1226#define MAX_GENERATION_NUMBER 127
1227
1228#define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number))
1229
1230/*
1231 * Picture represents an internal node of the reiserfs tree
1232 * ______________________________________________________
1233 * | | Array of | Array of | Free |
1234 * |block | keys | pointers | space |
1235 * | head | N | N+1 | |
1236 * |______|_______________|___________________|___________|
1237 */
1238
1239/***************************************************************************/
1240/* DISK CHILD */
1241/***************************************************************************/
1242/* Disk child pointer: The pointer from an internal node of the tree
1243 to a node that is on disk. */
1244struct disk_child {
1245 __le32 dc_block_number; /* Disk child's block number. */
1246 __le16 dc_size; /* Disk child's used space. */
1247 __le16 dc_reserved;
1248};
1249
1250#define DC_SIZE (sizeof(struct disk_child))
1251#define dc_block_number(dc_p) (le32_to_cpu((dc_p)->dc_block_number))
1252#define dc_size(dc_p) (le16_to_cpu((dc_p)->dc_size))
1253#define put_dc_block_number(dc_p, val) do { (dc_p)->dc_block_number = cpu_to_le32(val); } while(0)
1254#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
1255
1256/* Get disk child by buffer header and position in the tree node. */
1257#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
1258((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
1259
1260/* Get disk child number by buffer header and position in the tree node. */
1261#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
1262#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
1263 (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
1264
1265 /* maximal value of field child_size in structure disk_child */
1266 /* child size is the combined size of all items and their headers */
1267#define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE ))
1268
1269/* amount of used space in buffer (not including block head) */
1270#define B_CHILD_SIZE(cur) (MAX_CHILD_SIZE(cur)-(B_FREE_SPACE(cur)))
1271
1272/* max and min number of keys in internal node */
1273#define MAX_NR_KEY(bh) ( (MAX_CHILD_SIZE(bh)-DC_SIZE)/(KEY_SIZE+DC_SIZE) )
1274#define MIN_NR_KEY(bh) (MAX_NR_KEY(bh)/2)
1275
1276/***************************************************************************/
1277/* PATH STRUCTURES AND DEFINES */
1278/***************************************************************************/
1279
1280/* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the
1281 key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it
1282 does not find them in the cache it reads them from disk. For each node search_by_key finds using
1283 reiserfs_bread it then uses bin_search to look through that node. bin_search will find the
1284 position of the block_number of the next node if it is looking through an internal node. If it
1285 is looking through a leaf node bin_search will find the position of the item which has key either
1286 equal to given key, or which is the maximal key less than the given key. */
1287
1288struct path_element {
1289 struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */
1290 int pe_position; /* Position in the tree node which is placed in the */
1291 /* buffer above. */
1292};
1293
1294#define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */
1295#define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */
1296#define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */
1297
1298#define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */
1299#define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */
1300
1301/* We need to keep track of who the ancestors of nodes are. When we
1302 perform a search we record which nodes were visited while
1303 descending the tree looking for the node we searched for. This list
1304 of nodes is called the path. This information is used while
1305 performing balancing. Note that this path information may become
1306 invalid, and this means we must check it when using it to see if it
1307 is still valid. You'll need to read search_by_key and the comments
1308 in it, especially about decrement_counters_in_path(), to understand
1309 this structure.
1310
1311Paths make the code so much harder to work with and debug.... An
1312enormous number of bugs are due to them, and trying to write or modify
1313code that uses them just makes my head hurt. They are based on an
1314excessive effort to avoid disturbing the precious VFS code.:-( The
1315gods only know how we are going to SMP the code that uses them.
1316znodes are the way! */
1317
1318#define PATH_READA 0x1 /* do read ahead */
1319#define PATH_READA_BACK 0x2 /* read backwards */
1320
1321struct treepath {
1322 int path_length; /* Length of the array above. */
1323 int reada;
1324 struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */
1325 int pos_in_item;
1326};
1327
1328#define pos_in_item(path) ((path)->pos_in_item)
1329
1330#define INITIALIZE_PATH(var) \
1331struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1332
1333/* Get path element by path and path position. */
1334#define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
1335
1336/* Get buffer header at the path by path and path position. */
1337#define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
1338
1339/* Get position in the element at the path by path and path position. */
1340#define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
1341
1342#define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
1343 /* you know, to the person who didn't
1344 write this the macro name does not
1345 at first suggest what it does.
1346 Maybe POSITION_FROM_PATH_END? Or
1347 maybe we should just focus on
1348 dumping paths... -Hans */
1349#define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
1350
1351#define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
1352
1353/* in do_balance leaf has h == 0 in contrast with path structure,
1354 where root has level == 0. That is why we need these defines */
1355#define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
1356#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1357#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1358#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1359
1360#define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
1361
1362#define get_last_bh(path) PATH_PLAST_BUFFER(path)
1363#define get_ih(path) PATH_PITEM_HEAD(path)
1364#define get_item_pos(path) PATH_LAST_POSITION(path)
1365#define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path)))
1366#define item_moved(ih,path) comp_items(ih, path)
1367#define path_changed(ih,path) comp_items (ih, path)
1368
1369/***************************************************************************/
1370/* MISC */
1371/***************************************************************************/
1372
1373/* Size of pointer to the unformatted node. */
1374#define UNFM_P_SIZE (sizeof(unp_t))
1375#define UNFM_P_SHIFT 2
1376
1377// in in-core inode key is stored on le form
1378#define INODE_PKEY(inode) ((struct reiserfs_key *)(REISERFS_I(inode)->i_key))
1379
1380#define MAX_UL_INT 0xffffffff
1381#define MAX_INT 0x7ffffff
1382#define MAX_US_INT 0xffff
1383
1384// reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset
1385#define U32_MAX (~(__u32)0)
1386
1387static inline loff_t max_reiserfs_offset(struct inode *inode)
1388{
1389 if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
1390 return (loff_t) U32_MAX;
1391
1392 return (loff_t) ((~(__u64) 0) >> 4);
1393}
1394
1395/*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/
1396#define MAX_KEY_OBJECTID MAX_UL_INT
1397
1398#define MAX_B_NUM MAX_UL_INT
1399#define MAX_FC_NUM MAX_US_INT
1400
1401/* the purpose is to detect overflow of an unsigned short */
1402#define REISERFS_LINK_MAX (MAX_US_INT - 1000)
1403
1404/* The following defines are used in reiserfs_insert_item and reiserfs_append_item */
1405#define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */
1406#define REISERFS_USER_MEM 1 /* reiserfs user memory mode */
1407
1408#define fs_generation(s) (REISERFS_SB(s)->s_generation_counter)
1409#define get_generation(s) atomic_read (&fs_generation(s))
1410#define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen)
1411#define __fs_changed(gen,s) (gen != get_generation (s))
1412#define fs_changed(gen,s) \
1413({ \
1414 reiserfs_cond_resched(s); \
1415 __fs_changed(gen, s); \
1416})
1417
1418/***************************************************************************/
1419/* FIXATE NODES */
1420/***************************************************************************/
1421
1422#define VI_TYPE_LEFT_MERGEABLE 1
1423#define VI_TYPE_RIGHT_MERGEABLE 2
1424
1425/* To make any changes in the tree we always first find node, that
1426 contains item to be changed/deleted or place to insert a new
1427 item. We call this node S. To do balancing we need to decide what
1428 we will shift to left/right neighbor, or to a new node, where new
1429 item will be etc. To make this analysis simpler we build virtual
1430 node. Virtual node is an array of items, that will replace items of
1431 node S. (For instance if we are going to delete an item, virtual
1432 node does not contain it). Virtual node keeps information about
1433 item sizes and types, mergeability of first and last items, sizes
1434 of all entries in directory item. We use this array of items when
1435 calculating what we can shift to neighbors and how many nodes we
1436 have to have if we do not any shiftings, if we shift to left/right
1437 neighbor or to both. */
1438struct virtual_item {
1439 int vi_index; // index in the array of item operations
1440 unsigned short vi_type; // left/right mergeability
1441 unsigned short vi_item_len; /* length of item that it will have after balancing */
1442 struct item_head *vi_ih;
1443 const char *vi_item; // body of item (old or new)
1444 const void *vi_new_data; // 0 always but paste mode
1445 void *vi_uarea; // item specific area
1446};
1447
1448struct virtual_node {
1449 char *vn_free_ptr; /* this is a pointer to the free space in the buffer */
1450 unsigned short vn_nr_item; /* number of items in virtual node */
1451 short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */
1452 short vn_mode; /* mode of balancing (paste, insert, delete, cut) */
1453 short vn_affected_item_num;
1454 short vn_pos_in_item;
1455 struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */
1456 const void *vn_data;
1457 struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */
1458};
1459
1460/* used by directory items when creating virtual nodes */
1461struct direntry_uarea {
1462 int flags;
1463 __u16 entry_count;
1464 __u16 entry_sizes[1];
1465} __attribute__ ((__packed__));
1466
1467/***************************************************************************/
1468/* TREE BALANCE */
1469/***************************************************************************/
1470
1471/* This temporary structure is used in tree balance algorithms, and
1472 constructed as we go to the extent that its various parts are
1473 needed. It contains arrays of nodes that can potentially be
1474 involved in the balancing of node S, and parameters that define how
1475 each of the nodes must be balanced. Note that in these algorithms
1476 for balancing the worst case is to need to balance the current node
1477 S and the left and right neighbors and all of their parents plus
1478 create a new node. We implement S1 balancing for the leaf nodes
1479 and S0 balancing for the internal nodes (S1 and S0 are defined in
1480 our papers.)*/
1481
1482#define MAX_FREE_BLOCK 7 /* size of the array of buffers to free at end of do_balance */
1483
1484/* maximum number of FEB blocknrs on a single level */
1485#define MAX_AMOUNT_NEEDED 2
1486
1487/* someday somebody will prefix every field in this struct with tb_ */
1488struct tree_balance {
1489 int tb_mode;
1490 int need_balance_dirty;
1491 struct super_block *tb_sb;
1492 struct reiserfs_transaction_handle *transaction_handle;
1493 struct treepath *tb_path;
1494 struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */
1495 struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */
1496 struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */
1497 struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */
1498 struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */
1499 struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */
1500
1501 struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals
1502 cur_blknum. */
1503 struct buffer_head *used[MAX_FEB_SIZE];
1504 struct buffer_head *thrown[MAX_FEB_SIZE];
1505 int lnum[MAX_HEIGHT]; /* array of number of items which must be
1506 shifted to the left in order to balance the
1507 current node; for leaves includes item that
1508 will be partially shifted; for internal
1509 nodes, it is the number of child pointers
1510 rather than items. It includes the new item
1511 being created. The code sometimes subtracts
1512 one to get the number of wholly shifted
1513 items for other purposes. */
1514 int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */
1515 int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and
1516 S[h] to its item number within the node CFL[h] */
1517 int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */
1518 int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from
1519 S[h]. A negative value means removing. */
1520 int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after
1521 balancing on the level h of the tree. If 0 then S is
1522 being deleted, if 1 then S is remaining and no new nodes
1523 are being created, if 2 or 3 then 1 or 2 new nodes is
1524 being created */
1525
1526 /* fields that are used only for balancing leaves of the tree */
1527 int cur_blknum; /* number of empty blocks having been already allocated */
1528 int s0num; /* number of items that fall into left most node when S[0] splits */
1529 int s1num; /* number of items that fall into first new node when S[0] splits */
1530 int s2num; /* number of items that fall into second new node when S[0] splits */
1531 int lbytes; /* number of bytes which can flow to the left neighbor from the left */
1532 /* most liquid item that cannot be shifted from S[0] entirely */
1533 /* if -1 then nothing will be partially shifted */
1534 int rbytes; /* number of bytes which will flow to the right neighbor from the right */
1535 /* most liquid item that cannot be shifted from S[0] entirely */
1536 /* if -1 then nothing will be partially shifted */
1537 int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */
1538 /* note: if S[0] splits into 3 nodes, then items do not need to be cut */
1539 int s2bytes;
1540 struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */
1541 char *vn_buf; /* kmalloced memory. Used to create
1542 virtual node and keep map of
1543 dirtied bitmap blocks */
1544 int vn_buf_size; /* size of the vn_buf */
1545 struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */
1546
1547 int fs_gen; /* saved value of `reiserfs_generation' counter
1548 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
1549#ifdef DISPLACE_NEW_PACKING_LOCALITIES
1550 struct in_core_key key; /* key pointer, to pass to block allocator or
1551 another low-level subsystem */
1552#endif
1553};
1554
1555/* These are modes of balancing */
1556
1557/* When inserting an item. */
1558#define M_INSERT 'i'
1559/* When inserting into (directories only) or appending onto an already
1560 existent item. */
1561#define M_PASTE 'p'
1562/* When deleting an item. */
1563#define M_DELETE 'd'
1564/* When truncating an item or removing an entry from a (directory) item. */
1565#define M_CUT 'c'
1566
1567/* used when balancing on leaf level skipped (in reiserfsck) */
1568#define M_INTERNAL 'n'
1569
1570/* When further balancing is not needed, then do_balance does not need
1571 to be called. */
1572#define M_SKIP_BALANCING 's'
1573#define M_CONVERT 'v'
1574
1575/* modes of leaf_move_items */
1576#define LEAF_FROM_S_TO_L 0
1577#define LEAF_FROM_S_TO_R 1
1578#define LEAF_FROM_R_TO_L 2
1579#define LEAF_FROM_L_TO_R 3
1580#define LEAF_FROM_S_TO_SNEW 4
1581
1582#define FIRST_TO_LAST 0
1583#define LAST_TO_FIRST 1
1584
1585/* used in do_balance for passing parent of node information that has
1586 been gotten from tb struct */
1587struct buffer_info {
1588 struct tree_balance *tb;
1589 struct buffer_head *bi_bh;
1590 struct buffer_head *bi_parent;
1591 int bi_position;
1592};
1593
1594static inline struct super_block *sb_from_tb(struct tree_balance *tb)
1595{
1596 return tb ? tb->tb_sb : NULL;
1597}
1598
1599static inline struct super_block *sb_from_bi(struct buffer_info *bi)
1600{
1601 return bi ? sb_from_tb(bi->tb) : NULL;
1602}
1603
1604/* there are 4 types of items: stat data, directory item, indirect, direct.
1605+-------------------+------------+--------------+------------+
1606| | k_offset | k_uniqueness | mergeable? |
1607+-------------------+------------+--------------+------------+
1608| stat data | 0 | 0 | no |
1609+-------------------+------------+--------------+------------+
1610| 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS| no |
1611| non 1st directory | hash value | | yes |
1612| item | | | |
1613+-------------------+------------+--------------+------------+
1614| indirect item | offset + 1 |TYPE_INDIRECT | if this is not the first indirect item of the object
1615+-------------------+------------+--------------+------------+
1616| direct item | offset + 1 |TYPE_DIRECT | if not this is not the first direct item of the object
1617+-------------------+------------+--------------+------------+
1618*/
1619
1620struct item_operations {
1621 int (*bytes_number) (struct item_head * ih, int block_size);
1622 void (*decrement_key) (struct cpu_key *);
1623 int (*is_left_mergeable) (struct reiserfs_key * ih,
1624 unsigned long bsize);
1625 void (*print_item) (struct item_head *, char *item);
1626 void (*check_item) (struct item_head *, char *item);
1627
1628 int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi,
1629 int is_affected, int insert_size);
1630 int (*check_left) (struct virtual_item * vi, int free,
1631 int start_skip, int end_skip);
1632 int (*check_right) (struct virtual_item * vi, int free);
1633 int (*part_size) (struct virtual_item * vi, int from, int to);
1634 int (*unit_num) (struct virtual_item * vi);
1635 void (*print_vi) (struct virtual_item * vi);
1636};
1637
1638extern struct item_operations *item_ops[TYPE_ANY + 1];
1639
1640#define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)
1641#define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)
1642#define op_print_item(ih,item) item_ops[le_ih_k_type (ih)]->print_item (ih, item)
1643#define op_check_item(ih,item) item_ops[le_ih_k_type (ih)]->check_item (ih, item)
1644#define op_create_vi(vn,vi,is_affected,insert_size) item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size)
1645#define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip)
1646#define op_check_right(vi,free) item_ops[(vi)->vi_index]->check_right (vi, free)
1647#define op_part_size(vi,from,to) item_ops[(vi)->vi_index]->part_size (vi, from, to)
1648#define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi)
1649#define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi)
1650
1651#define COMP_SHORT_KEYS comp_short_keys
1652
1653/* number of blocks pointed to by the indirect item */
1654#define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
1655
1656/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
1657#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
1658
1659/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */
1660
1661/* get the item header */
1662#define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )
1663
1664/* get key */
1665#define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) )
1666
1667/* get the key */
1668#define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) )
1669
1670/* get item body */
1671#define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num))))
1672
1673/* get the stat data by the buffer header and the item order */
1674#define B_N_STAT_DATA(bh,nr) \
1675( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) )
1676
1677 /* following defines use reiserfs buffer header and item header */
1678
1679/* get stat-data */
1680#define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) )
1681
1682// this is 3976 for size==4096
1683#define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE)
1684
1685/* indirect items consist of entries which contain blocknrs, pos
1686 indicates which entry, and B_I_POS_UNFM_POINTER resolves to the
1687 blocknr contained by the entry pos points to */
1688#define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)))
1689#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)
1690
1691struct reiserfs_iget_args {
1692 __u32 objectid;
1693 __u32 dirid;
1694};
1695
1696/***************************************************************************/
1697/* FUNCTION DECLARATIONS */
1698/***************************************************************************/
1699
1700#define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
1701
1702#define journal_trans_half(blocksize) \
1703 ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32))
1704
1705/* journal.c see journal.c for all the comments here */
1706
1707/* first block written in a commit. */
1708struct reiserfs_journal_desc {
1709 __le32 j_trans_id; /* id of commit */
1710 __le32 j_len; /* length of commit. len +1 is the commit block */
1711 __le32 j_mount_id; /* mount id of this trans */
1712 __le32 j_realblock[1]; /* real locations for each block */
1713};
1714
1715#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
1716#define get_desc_trans_len(d) le32_to_cpu((d)->j_len)
1717#define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id)
1718
1719#define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0)
1720#define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0)
1721#define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0)
1722
1723/* last block written in a commit */
1724struct reiserfs_journal_commit {
1725 __le32 j_trans_id; /* must match j_trans_id from the desc block */
1726 __le32 j_len; /* ditto */
1727 __le32 j_realblock[1]; /* real locations for each block */
1728};
1729
1730#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
1731#define get_commit_trans_len(c) le32_to_cpu((c)->j_len)
1732#define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id)
1733
1734#define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0)
1735#define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0)
1736
1737/* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the
1738** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk,
1739** and this transaction does not need to be replayed.
1740*/
1741struct reiserfs_journal_header {
1742 __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */
1743 __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */
1744 __le32 j_mount_id;
1745 /* 12 */ struct journal_params jh_journal;
1746};
1747
1748/* biggest tunable defines are right here */
1749#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */
1750#define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */
1751#define JOURNAL_TRANS_MIN_DEFAULT 256
1752#define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */
1753#define JOURNAL_MIN_RATIO 2
1754#define JOURNAL_MAX_COMMIT_AGE 30
1755#define JOURNAL_MAX_TRANS_AGE 30
1756#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1757#define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \
1758 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
1759 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1760
1761#ifdef CONFIG_QUOTA
1762#define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA))
1763/* We need to update data and inode (atime) */
1764#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0)
1765/* 1 balancing, 1 bitmap, 1 data per write + stat data update */
1766#define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1767(DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0)
1768/* same as with INIT */
1769#define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \
1770(DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0)
1771#else
1772#define REISERFS_QUOTA_TRANS_BLOCKS(s) 0
1773#define REISERFS_QUOTA_INIT_BLOCKS(s) 0
1774#define REISERFS_QUOTA_DEL_BLOCKS(s) 0
1775#endif
1776
1777/* both of these can be as low as 1, or as high as you want. The min is the
1778** number of 4k bitmap nodes preallocated on mount. New nodes are allocated
1779** as needed, and released when transactions are committed. On release, if
1780** the current number of nodes is > max, the node is freed, otherwise,
1781** it is put on a free list for faster use later.
1782*/
1783#define REISERFS_MIN_BITMAP_NODES 10
1784#define REISERFS_MAX_BITMAP_NODES 100
1785
1786#define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */
1787#define JBH_HASH_MASK 8191
1788
1789#define _jhashfn(sb,block) \
1790 (((unsigned long)sb>>L1_CACHE_SHIFT) ^ \
1791 (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12))))
1792#define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK])
1793
1794// We need these to make journal.c code more readable
1795#define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
1796#define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
1797#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize)
1798
1799enum reiserfs_bh_state_bits {
1800 BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */
1801 BH_JDirty_wait,
1802 BH_JNew, /* disk block was taken off free list before
1803 * being in a finished transaction, or
1804 * written to disk. Can be reused immed. */
1805 BH_JPrepared,
1806 BH_JRestore_dirty,
1807 BH_JTest, // debugging only will go away
1808};
1809
1810BUFFER_FNS(JDirty, journaled);
1811TAS_BUFFER_FNS(JDirty, journaled);
1812BUFFER_FNS(JDirty_wait, journal_dirty);
1813TAS_BUFFER_FNS(JDirty_wait, journal_dirty);
1814BUFFER_FNS(JNew, journal_new);
1815TAS_BUFFER_FNS(JNew, journal_new);
1816BUFFER_FNS(JPrepared, journal_prepared);
1817TAS_BUFFER_FNS(JPrepared, journal_prepared);
1818BUFFER_FNS(JRestore_dirty, journal_restore_dirty);
1819TAS_BUFFER_FNS(JRestore_dirty, journal_restore_dirty);
1820BUFFER_FNS(JTest, journal_test);
1821TAS_BUFFER_FNS(JTest, journal_test);
1822
1823/*
1824** transaction handle which is passed around for all journal calls
1825*/
1826struct reiserfs_transaction_handle {
1827 struct super_block *t_super; /* super for this FS when journal_begin was
1828 called. saves calls to reiserfs_get_super
1829 also used by nested transactions to make
1830 sure they are nesting on the right FS
1831 _must_ be first in the handle
1832 */
1833 int t_refcount;
1834 int t_blocks_logged; /* number of blocks this writer has logged */
1835 int t_blocks_allocated; /* number of blocks this writer allocated */
1836 unsigned int t_trans_id; /* sanity check, equals the current trans id */
1837 void *t_handle_save; /* save existing current->journal_info */
1838 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1839 should be displaced from others */
1840 struct list_head t_list;
1841};
1842
1843/* used to keep track of ordered and tail writes, attached to the buffer
1844 * head through b_journal_head.
1845 */
1846struct reiserfs_jh {
1847 struct reiserfs_journal_list *jl;
1848 struct buffer_head *bh;
1849 struct list_head list;
1850};
1851
1852void reiserfs_free_jh(struct buffer_head *bh);
1853int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh);
1854int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh);
1855int journal_mark_dirty(struct reiserfs_transaction_handle *,
1856 struct super_block *, struct buffer_head *bh);
1857
1858static inline int reiserfs_file_data_log(struct inode *inode)
1859{
1860 if (reiserfs_data_log(inode->i_sb) ||
1861 (REISERFS_I(inode)->i_flags & i_data_log))
1862 return 1;
1863 return 0;
1864}
1865
1866static inline int reiserfs_transaction_running(struct super_block *s)
1867{
1868 struct reiserfs_transaction_handle *th = current->journal_info;
1869 if (th && th->t_super == s)
1870 return 1;
1871 if (th && th->t_super == NULL)
1872 BUG();
1873 return 0;
1874}
1875
1876static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th)
1877{
1878 return th->t_blocks_allocated - th->t_blocks_logged;
1879}
1880
1881struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
1882 super_block
1883 *,
1884 int count);
1885int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *);
1886int reiserfs_commit_page(struct inode *inode, struct page *page,
1887 unsigned from, unsigned to);
1888int reiserfs_flush_old_commits(struct super_block *);
1889int reiserfs_commit_for_inode(struct inode *);
1890int reiserfs_inode_needs_commit(struct inode *);
1891void reiserfs_update_inode_transaction(struct inode *);
1892void reiserfs_wait_on_write_block(struct super_block *s);
1893void reiserfs_block_writes(struct reiserfs_transaction_handle *th);
1894void reiserfs_allow_writes(struct super_block *s);
1895void reiserfs_check_lock_depth(struct super_block *s, char *caller);
1896int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh,
1897 int wait);
1898void reiserfs_restore_prepared_buffer(struct super_block *,
1899 struct buffer_head *bh);
1900int journal_init(struct super_block *, const char *j_dev_name, int old_format,
1901 unsigned int);
1902int journal_release(struct reiserfs_transaction_handle *, struct super_block *);
1903int journal_release_error(struct reiserfs_transaction_handle *,
1904 struct super_block *);
1905int journal_end(struct reiserfs_transaction_handle *, struct super_block *,
1906 unsigned long);
1907int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1908 unsigned long);
1909int journal_mark_freed(struct reiserfs_transaction_handle *,
1910 struct super_block *, b_blocknr_t blocknr);
1911int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1912int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
1913 int bit_nr, int searchall, b_blocknr_t *next);
1914int journal_begin(struct reiserfs_transaction_handle *,
1915 struct super_block *sb, unsigned long);
1916int journal_join_abort(struct reiserfs_transaction_handle *,
1917 struct super_block *sb, unsigned long);
1918void reiserfs_abort_journal(struct super_block *sb, int errno);
1919void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1920int reiserfs_allocate_list_bitmaps(struct super_block *s,
1921 struct reiserfs_list_bitmap *, unsigned int);
1922
1923void add_save_link(struct reiserfs_transaction_handle *th,
1924 struct inode *inode, int truncate);
1925int remove_save_link(struct inode *inode, int truncate);
1926
1927/* objectid.c */
1928__u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th);
1929void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
1930 __u32 objectid_to_release);
1931int reiserfs_convert_objectid_map_v1(struct super_block *);
1932
1933/* stree.c */
1934int B_IS_IN_TREE(const struct buffer_head *);
1935extern void copy_item_head(struct item_head *to,
1936 const struct item_head *from);
1937
1938// first key is in cpu form, second - le
1939extern int comp_short_keys(const struct reiserfs_key *le_key,
1940 const struct cpu_key *cpu_key);
1941extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from);
1942
1943// both are in le form
1944extern int comp_le_keys(const struct reiserfs_key *,
1945 const struct reiserfs_key *);
1946extern int comp_short_le_keys(const struct reiserfs_key *,
1947 const struct reiserfs_key *);
1948
1949//
1950// get key version from on disk key - kludge
1951//
1952static inline int le_key_version(const struct reiserfs_key *key)
1953{
1954 int type;
1955
1956 type = offset_v2_k_type(&(key->u.k_offset_v2));
1957 if (type != TYPE_DIRECT && type != TYPE_INDIRECT
1958 && type != TYPE_DIRENTRY)
1959 return KEY_FORMAT_3_5;
1960
1961 return KEY_FORMAT_3_6;
1962
1963}
1964
1965static inline void copy_key(struct reiserfs_key *to,
1966 const struct reiserfs_key *from)
1967{
1968 memcpy(to, from, KEY_SIZE);
1969}
1970
1971int comp_items(const struct item_head *stored_ih, const struct treepath *path);
1972const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
1973 const struct super_block *sb);
1974int search_by_key(struct super_block *, const struct cpu_key *,
1975 struct treepath *, int);
1976#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1977int search_for_position_by_key(struct super_block *sb,
1978 const struct cpu_key *cpu_key,
1979 struct treepath *search_path);
1980extern void decrement_bcount(struct buffer_head *bh);
1981void decrement_counters_in_path(struct treepath *search_path);
1982void pathrelse(struct treepath *search_path);
1983int reiserfs_check_path(struct treepath *p);
1984void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
1985
1986int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1987 struct treepath *path,
1988 const struct cpu_key *key,
1989 struct item_head *ih,
1990 struct inode *inode, const char *body);
1991
1992int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
1993 struct treepath *path,
1994 const struct cpu_key *key,
1995 struct inode *inode,
1996 const char *body, int paste_size);
1997
1998int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1999 struct treepath *path,
2000 struct cpu_key *key,
2001 struct inode *inode,
2002 struct page *page, loff_t new_file_size);
2003
2004int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
2005 struct treepath *path,
2006 const struct cpu_key *key,
2007 struct inode *inode, struct buffer_head *un_bh);
2008
2009void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
2010 struct inode *inode, struct reiserfs_key *key);
2011int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
2012 struct inode *inode);
2013int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
2014 struct inode *inode, struct page *,
2015 int update_timestamps);
2016
2017#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
2018#define file_size(inode) ((inode)->i_size)
2019#define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1))
2020
2021#define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\
2022!STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 )
2023
2024void padd_item(char *item, int total_length, int length);
2025
2026/* inode.c */
2027/* args for the create parameter of reiserfs_get_block */
2028#define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */
2029#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
2030#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
2031#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
2032#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */
2033#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
2034
2035void reiserfs_read_locked_inode(struct inode *inode,
2036 struct reiserfs_iget_args *args);
2037int reiserfs_find_actor(struct inode *inode, void *p);
2038int reiserfs_init_locked_inode(struct inode *inode, void *p);
2039void reiserfs_evict_inode(struct inode *inode);
2040int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2041int reiserfs_get_block(struct inode *inode, sector_t block,
2042 struct buffer_head *bh_result, int create);
2043struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
2044 int fh_len, int fh_type);
2045struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid,
2046 int fh_len, int fh_type);
2047int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
2048 int connectable);
2049
2050int reiserfs_truncate_file(struct inode *, int update_timestamps);
2051void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset,
2052 int type, int key_length);
2053void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
2054 int version,
2055 loff_t offset, int type, int length, int entry_count);
2056struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
2057
2058struct reiserfs_security_handle;
2059int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2060 struct inode *dir, umode_t mode,
2061 const char *symname, loff_t i_size,
2062 struct dentry *dentry, struct inode *inode,
2063 struct reiserfs_security_handle *security);
2064
2065void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
2066 struct inode *inode, loff_t size);
2067
2068static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th,
2069 struct inode *inode)
2070{
2071 reiserfs_update_sd_size(th, inode, inode->i_size);
2072}
2073
2074void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
2075void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
2076int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
2077
2078int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len);
2079
2080/* namei.c */
2081void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
2082int search_by_entry_key(struct super_block *sb, const struct cpu_key *key,
2083 struct treepath *path, struct reiserfs_dir_entry *de);
2084struct dentry *reiserfs_get_parent(struct dentry *);
2085
2086#ifdef CONFIG_REISERFS_PROC_INFO
2087int reiserfs_proc_info_init(struct super_block *sb);
2088int reiserfs_proc_info_done(struct super_block *sb);
2089int reiserfs_proc_info_global_init(void);
2090int reiserfs_proc_info_global_done(void);
2091
2092#define PROC_EXP( e ) e
2093
2094#define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data
2095#define PROC_INFO_MAX( sb, field, value ) \
2096 __PINFO( sb ).field = \
2097 max( REISERFS_SB( sb ) -> s_proc_info_data.field, value )
2098#define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) )
2099#define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) )
2100#define PROC_INFO_BH_STAT( sb, bh, level ) \
2101 PROC_INFO_INC( sb, sbk_read_at[ ( level ) ] ); \
2102 PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \
2103 PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) )
2104#else
2105static inline int reiserfs_proc_info_init(struct super_block *sb)
2106{
2107 return 0;
2108}
2109
2110static inline int reiserfs_proc_info_done(struct super_block *sb)
2111{
2112 return 0;
2113}
2114
2115static inline int reiserfs_proc_info_global_init(void)
2116{
2117 return 0;
2118}
2119
2120static inline int reiserfs_proc_info_global_done(void)
2121{
2122 return 0;
2123}
2124
2125#define PROC_EXP( e )
2126#define VOID_V ( ( void ) 0 )
2127#define PROC_INFO_MAX( sb, field, value ) VOID_V
2128#define PROC_INFO_INC( sb, field ) VOID_V
2129#define PROC_INFO_ADD( sb, field, val ) VOID_V
2130#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
2131#endif
2132
2133/* dir.c */
2134extern const struct inode_operations reiserfs_dir_inode_operations;
2135extern const struct inode_operations reiserfs_symlink_inode_operations;
2136extern const struct inode_operations reiserfs_special_inode_operations;
2137extern const struct file_operations reiserfs_dir_operations;
2138int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
2139
2140/* tail_conversion.c */
2141int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
2142 struct treepath *, struct buffer_head *, loff_t);
2143int indirect2direct(struct reiserfs_transaction_handle *, struct inode *,
2144 struct page *, struct treepath *, const struct cpu_key *,
2145 loff_t, char *);
2146void reiserfs_unmap_buffer(struct buffer_head *);
2147
2148/* file.c */
2149extern const struct inode_operations reiserfs_file_inode_operations;
2150extern const struct file_operations reiserfs_file_operations;
2151extern const struct address_space_operations reiserfs_address_space_operations;
2152
2153/* fix_nodes.c */
2154
2155int fix_nodes(int n_op_mode, struct tree_balance *tb,
2156 struct item_head *ins_ih, const void *);
2157void unfix_nodes(struct tree_balance *);
2158
2159/* prints.c */
2160void __reiserfs_panic(struct super_block *s, const char *id,
2161 const char *function, const char *fmt, ...)
2162 __attribute__ ((noreturn));
2163#define reiserfs_panic(s, id, fmt, args...) \
2164 __reiserfs_panic(s, id, __func__, fmt, ##args)
2165void __reiserfs_error(struct super_block *s, const char *id,
2166 const char *function, const char *fmt, ...);
2167#define reiserfs_error(s, id, fmt, args...) \
2168 __reiserfs_error(s, id, __func__, fmt, ##args)
2169void reiserfs_info(struct super_block *s, const char *fmt, ...);
2170void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
2171void print_indirect_item(struct buffer_head *bh, int item_num);
2172void store_print_tb(struct tree_balance *tb);
2173void print_cur_tb(char *mes);
2174void print_de(struct reiserfs_dir_entry *de);
2175void print_bi(struct buffer_info *bi, char *mes);
2176#define PRINT_LEAF_ITEMS 1 /* print all items */
2177#define PRINT_DIRECTORY_ITEMS 2 /* print directory items */
2178#define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */
2179void print_block(struct buffer_head *bh, ...);
2180void print_bmap(struct super_block *s, int silent);
2181void print_bmap_block(int i, char *data, int size, int silent);
2182/*void print_super_block (struct super_block * s, char * mes);*/
2183void print_objectid_map(struct super_block *s);
2184void print_block_head(struct buffer_head *bh, char *mes);
2185void check_leaf(struct buffer_head *bh);
2186void check_internal(struct buffer_head *bh);
2187void print_statistics(struct super_block *s);
2188char *reiserfs_hashname(int code);
2189
2190/* lbalance.c */
2191int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num,
2192 int mov_bytes, struct buffer_head *Snew);
2193int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes);
2194int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes);
2195void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first,
2196 int del_num, int del_bytes);
2197void leaf_insert_into_buf(struct buffer_info *bi, int before,
2198 struct item_head *inserted_item_ih,
2199 const char *inserted_item_body, int zeros_number);
2200void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2201 int pos_in_item, int paste_size, const char *body,
2202 int zeros_number);
2203void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2204 int pos_in_item, int cut_size);
2205void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
2206 int new_entry_count, struct reiserfs_de_head *new_dehs,
2207 const char *records, int paste_size);
2208/* ibalance.c */
2209int balance_internal(struct tree_balance *, int, int, struct item_head *,
2210 struct buffer_head **);
2211
2212/* do_balance.c */
2213void do_balance_mark_leaf_dirty(struct tree_balance *tb,
2214 struct buffer_head *bh, int flag);
2215#define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty
2216#define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty
2217
2218void do_balance(struct tree_balance *tb, struct item_head *ih,
2219 const char *body, int flag);
2220void reiserfs_invalidate_buffer(struct tree_balance *tb,
2221 struct buffer_head *bh);
2222
2223int get_left_neighbor_position(struct tree_balance *tb, int h);
2224int get_right_neighbor_position(struct tree_balance *tb, int h);
2225void replace_key(struct tree_balance *tb, struct buffer_head *, int,
2226 struct buffer_head *, int);
2227void make_empty_node(struct buffer_info *);
2228struct buffer_head *get_FEB(struct tree_balance *);
2229
2230/* bitmap.c */
2231
2232/* structure contains hints for block allocator, and it is a container for
2233 * arguments, such as node, search path, transaction_handle, etc. */
2234struct __reiserfs_blocknr_hint {
2235 struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */
2236 sector_t block; /* file offset, in blocks */
2237 struct in_core_key key;
2238 struct treepath *path; /* search path, used by allocator to deternine search_start by
2239 * various ways */
2240 struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and
2241 * bitmap blocks changes */
2242 b_blocknr_t beg, end;
2243 b_blocknr_t search_start; /* a field used to transfer search start value (block number)
2244 * between different block allocator procedures
2245 * (determine_search_start() and others) */
2246 int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed
2247 * function that do actual allocation */
2248
2249 unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for
2250 * formatted/unformatted blocks with/without preallocation */
2251 unsigned preallocate:1;
2252};
2253
2254typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t;
2255
2256int reiserfs_parse_alloc_options(struct super_block *, char *);
2257void reiserfs_init_alloc_options(struct super_block *s);
2258
2259/*
2260 * given a directory, this will tell you what packing locality
2261 * to use for a new object underneat it. The locality is returned
2262 * in disk byte order (le).
2263 */
2264__le32 reiserfs_choose_packing(struct inode *dir);
2265
2266int reiserfs_init_bitmap_cache(struct super_block *sb);
2267void reiserfs_free_bitmap_cache(struct super_block *sb);
2268void reiserfs_cache_bitmap_metadata(struct super_block *sb, struct buffer_head *bh, struct reiserfs_bitmap_info *info);
2269struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap);
2270int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value);
2271void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *,
2272 b_blocknr_t, int for_unformatted);
2273int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int,
2274 int);
2275static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2276 b_blocknr_t * new_blocknrs,
2277 int amount_needed)
2278{
2279 reiserfs_blocknr_hint_t hint = {
2280 .th = tb->transaction_handle,
2281 .path = tb->tb_path,
2282 .inode = NULL,
2283 .key = tb->key,
2284 .block = 0,
2285 .formatted_node = 1
2286 };
2287 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed,
2288 0);
2289}
2290
2291static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2292 *th, struct inode *inode,
2293 b_blocknr_t * new_blocknrs,
2294 struct treepath *path,
2295 sector_t block)
2296{
2297 reiserfs_blocknr_hint_t hint = {
2298 .th = th,
2299 .path = path,
2300 .inode = inode,
2301 .block = block,
2302 .formatted_node = 0,
2303 .preallocate = 0
2304 };
2305 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2306}
2307
2308#ifdef REISERFS_PREALLOCATE
2309static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle
2310 *th, struct inode *inode,
2311 b_blocknr_t * new_blocknrs,
2312 struct treepath *path,
2313 sector_t block)
2314{
2315 reiserfs_blocknr_hint_t hint = {
2316 .th = th,
2317 .path = path,
2318 .inode = inode,
2319 .block = block,
2320 .formatted_node = 0,
2321 .preallocate = 1
2322 };
2323 return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0);
2324}
2325
2326void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th,
2327 struct inode *inode);
2328void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th);
2329#endif
2330
2331/* hashes.c */
2332__u32 keyed_hash(const signed char *msg, int len);
2333__u32 yura_hash(const signed char *msg, int len);
2334__u32 r5_hash(const signed char *msg, int len);
2335
2336#define reiserfs_set_le_bit __set_bit_le
2337#define reiserfs_test_and_set_le_bit __test_and_set_bit_le
2338#define reiserfs_clear_le_bit __clear_bit_le
2339#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le
2340#define reiserfs_test_le_bit test_bit_le
2341#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le
2342
2343/* sometimes reiserfs_truncate may require to allocate few new blocks
2344 to perform indirect2direct conversion. People probably used to
2345 think, that truncate should work without problems on a filesystem
2346 without free disk space. They may complain that they can not
2347 truncate due to lack of free disk space. This spare space allows us
2348 to not worry about it. 500 is probably too much, but it should be
2349 absolutely safe */
2350#define SPARE_SPACE 500
2351
2352/* prototypes from ioctl.c */
2353long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
2354long reiserfs_compat_ioctl(struct file *filp,
2355 unsigned int cmd, unsigned long arg);
2356int reiserfs_unpack(struct inode *inode, struct file *filp);
2357
2358#endif /* __KERNEL__ */
2359
2360#endif /* _LINUX_REISER_FS_H */ 26#endif /* _LINUX_REISER_FS_H */
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
deleted file mode 100644
index 97959bdfe214..000000000000
--- a/include/linux/reiserfs_fs_i.h
+++ /dev/null
@@ -1,63 +0,0 @@
1#ifndef _REISER_FS_I
2#define _REISER_FS_I
3
4#include <linux/list.h>
5
6struct reiserfs_journal_list;
7
8/** bitmasks for i_flags field in reiserfs-specific part of inode */
9typedef enum {
10 /** this says what format of key do all items (but stat data) of
11 an object have. If this is set, that format is 3.6 otherwise
12 - 3.5 */
13 i_item_key_version_mask = 0x0001,
14 /** If this is unset, object has 3.5 stat data, otherwise, it has
15 3.6 stat data with 64bit size, 32bit nlink etc. */
16 i_stat_data_version_mask = 0x0002,
17 /** file might need tail packing on close */
18 i_pack_on_close_mask = 0x0004,
19 /** don't pack tail of file */
20 i_nopack_mask = 0x0008,
21 /** If those is set, "safe link" was created for this file during
22 truncate or unlink. Safe link is used to avoid leakage of disk
23 space on crash with some files open, but unlinked. */
24 i_link_saved_unlink_mask = 0x0010,
25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080,
28} reiserfs_inode_flags;
29
30struct reiserfs_inode_info {
31 __u32 i_key[4]; /* key is still 4 32 bit integers */
32 /** transient inode flags that are never stored on disk. Bitmasks
33 for this field are defined above. */
34 __u32 i_flags;
35
36 __u32 i_first_direct_byte; // offset of first byte stored in direct item.
37
38 /* copy of persistent inode flags read from sd_attrs. */
39 __u32 i_attrs;
40
41 int i_prealloc_block; /* first unused block of a sequence of unused blocks */
42 int i_prealloc_count; /* length of that sequence */
43 struct list_head i_prealloc_list; /* per-transaction list of inodes which
44 * have preallocated blocks */
45
46 unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks
47 * for the contents of this directory should be
48 * displaced */
49
50 /* we use these for fsync or O_SYNC to decide which transaction
51 ** needs to be committed in order for this inode to be properly
52 ** flushed */
53 unsigned int i_trans_id;
54 struct reiserfs_journal_list *i_jl;
55 atomic_t openers;
56 struct mutex tailpack;
57#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore i_xattr_sem;
59#endif
60 struct inode vfs_inode;
61};
62
63#endif
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
deleted file mode 100644
index 8c9e85c64b46..000000000000
--- a/include/linux/reiserfs_fs_sb.h
+++ /dev/null
@@ -1,554 +0,0 @@
1/* Copyright 1996-2000 Hans Reiser, see reiserfs/README for licensing
2 * and copyright details */
3
4#ifndef _LINUX_REISER_FS_SB
5#define _LINUX_REISER_FS_SB
6
7#ifdef __KERNEL__
8#include <linux/workqueue.h>
9#include <linux/rwsem.h>
10#include <linux/mutex.h>
11#include <linux/sched.h>
12#endif
13
14typedef enum {
15 reiserfs_attrs_cleared = 0x00000001,
16} reiserfs_super_block_flags;
17
18/* struct reiserfs_super_block accessors/mutators
19 * since this is a disk structure, it will always be in
20 * little endian format. */
21#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count))
22#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v))
23#define sb_free_blocks(sbp) (le32_to_cpu((sbp)->s_v1.s_free_blocks))
24#define set_sb_free_blocks(sbp,v) ((sbp)->s_v1.s_free_blocks = cpu_to_le32(v))
25#define sb_root_block(sbp) (le32_to_cpu((sbp)->s_v1.s_root_block))
26#define set_sb_root_block(sbp,v) ((sbp)->s_v1.s_root_block = cpu_to_le32(v))
27
28#define sb_jp_journal_1st_block(sbp) \
29 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_1st_block))
30#define set_sb_jp_journal_1st_block(sbp,v) \
31 ((sbp)->s_v1.s_journal.jp_journal_1st_block = cpu_to_le32(v))
32#define sb_jp_journal_dev(sbp) \
33 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_dev))
34#define set_sb_jp_journal_dev(sbp,v) \
35 ((sbp)->s_v1.s_journal.jp_journal_dev = cpu_to_le32(v))
36#define sb_jp_journal_size(sbp) \
37 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_size))
38#define set_sb_jp_journal_size(sbp,v) \
39 ((sbp)->s_v1.s_journal.jp_journal_size = cpu_to_le32(v))
40#define sb_jp_journal_trans_max(sbp) \
41 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_trans_max))
42#define set_sb_jp_journal_trans_max(sbp,v) \
43 ((sbp)->s_v1.s_journal.jp_journal_trans_max = cpu_to_le32(v))
44#define sb_jp_journal_magic(sbp) \
45 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_magic))
46#define set_sb_jp_journal_magic(sbp,v) \
47 ((sbp)->s_v1.s_journal.jp_journal_magic = cpu_to_le32(v))
48#define sb_jp_journal_max_batch(sbp) \
49 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_batch))
50#define set_sb_jp_journal_max_batch(sbp,v) \
51 ((sbp)->s_v1.s_journal.jp_journal_max_batch = cpu_to_le32(v))
52#define sb_jp_jourmal_max_commit_age(sbp) \
53 (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_commit_age))
54#define set_sb_jp_journal_max_commit_age(sbp,v) \
55 ((sbp)->s_v1.s_journal.jp_journal_max_commit_age = cpu_to_le32(v))
56
57#define sb_blocksize(sbp) (le16_to_cpu((sbp)->s_v1.s_blocksize))
58#define set_sb_blocksize(sbp,v) ((sbp)->s_v1.s_blocksize = cpu_to_le16(v))
59#define sb_oid_maxsize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_maxsize))
60#define set_sb_oid_maxsize(sbp,v) ((sbp)->s_v1.s_oid_maxsize = cpu_to_le16(v))
61#define sb_oid_cursize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_cursize))
62#define set_sb_oid_cursize(sbp,v) ((sbp)->s_v1.s_oid_cursize = cpu_to_le16(v))
63#define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state))
64#define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v))
65#define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state))
66#define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v))
67#define sb_hash_function_code(sbp) \
68 (le32_to_cpu((sbp)->s_v1.s_hash_function_code))
69#define set_sb_hash_function_code(sbp,v) \
70 ((sbp)->s_v1.s_hash_function_code = cpu_to_le32(v))
71#define sb_tree_height(sbp) (le16_to_cpu((sbp)->s_v1.s_tree_height))
72#define set_sb_tree_height(sbp,v) ((sbp)->s_v1.s_tree_height = cpu_to_le16(v))
73#define sb_bmap_nr(sbp) (le16_to_cpu((sbp)->s_v1.s_bmap_nr))
74#define set_sb_bmap_nr(sbp,v) ((sbp)->s_v1.s_bmap_nr = cpu_to_le16(v))
75#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version))
76#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v))
77
78#define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count))
79#define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v))
80
81#define sb_reserved_for_journal(sbp) \
82 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
83#define set_sb_reserved_for_journal(sbp,v) \
84 ((sbp)->s_v1.s_reserved_for_journal = cpu_to_le16(v))
85
86/* LOGGING -- */
87
88/* These all interelate for performance.
89**
90** If the journal block count is smaller than n transactions, you lose speed.
91** I don't know what n is yet, I'm guessing 8-16.
92**
93** typical transaction size depends on the application, how often fsync is
94** called, and how many metadata blocks you dirty in a 30 second period.
95** The more small files (<16k) you use, the larger your transactions will
96** be.
97**
98** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal
99** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough
100** to prevent wrapping before dirty meta blocks get to disk.
101**
102** If the batch max is smaller than the transaction max, you'll waste space at the end of the journal
103** because journal_end sets the next transaction to start at 0 if the next transaction has any chance of wrapping.
104**
105** The large the batch max age, the better the speed, and the more meta data changes you'll lose after a crash.
106**
107*/
108
109/* don't mess with these for a while */
110 /* we have a node size define somewhere in reiserfs_fs.h. -Hans */
111#define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */
112#define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */
113#define JOURNAL_HASH_SIZE 8192
114#define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */
115
116/* One of these for every block in every transaction
117** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a
118** hash of all the in memory transactions.
119** next and prev are used by the current transaction (journal_hash).
120** hnext and hprev are used by journal_list_hash. If a block is in more than one transaction, the journal_list_hash
121** links it in multiple times. This allows flush_journal_list to remove just the cnode belonging
122** to a given transaction.
123*/
124struct reiserfs_journal_cnode {
125 struct buffer_head *bh; /* real buffer head */
126 struct super_block *sb; /* dev of real buffer head */
127 __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */
128 unsigned long state;
129 struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */
130 struct reiserfs_journal_cnode *next; /* next in transaction list */
131 struct reiserfs_journal_cnode *prev; /* prev in transaction list */
132 struct reiserfs_journal_cnode *hprev; /* prev in hash list */
133 struct reiserfs_journal_cnode *hnext; /* next in hash list */
134};
135
136struct reiserfs_bitmap_node {
137 int id;
138 char *data;
139 struct list_head list;
140};
141
142struct reiserfs_list_bitmap {
143 struct reiserfs_journal_list *journal_list;
144 struct reiserfs_bitmap_node **bitmaps;
145};
146
147/*
148** one of these for each transaction. The most important part here is the j_realblock.
149** this list of cnodes is used to hash all the blocks in all the commits, to mark all the
150** real buffer heads dirty once all the commits hit the disk,
151** and to make sure every real block in a transaction is on disk before allowing the log area
152** to be overwritten */
153struct reiserfs_journal_list {
154 unsigned long j_start;
155 unsigned long j_state;
156 unsigned long j_len;
157 atomic_t j_nonzerolen;
158 atomic_t j_commit_left;
159 atomic_t j_older_commits_done; /* all commits older than this on disk */
160 struct mutex j_commit_mutex;
161 unsigned int j_trans_id;
162 time_t j_timestamp;
163 struct reiserfs_list_bitmap *j_list_bitmap;
164 struct buffer_head *j_commit_bh; /* commit buffer head */
165 struct reiserfs_journal_cnode *j_realblock;
166 struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */
167 /* time ordered list of all active transactions */
168 struct list_head j_list;
169
170 /* time ordered list of all transactions we haven't tried to flush yet */
171 struct list_head j_working_list;
172
173 /* list of tail conversion targets in need of flush before commit */
174 struct list_head j_tail_bh_list;
175 /* list of data=ordered buffers in need of flush before commit */
176 struct list_head j_bh_list;
177 int j_refcount;
178};
179
180struct reiserfs_journal {
181 struct buffer_head **j_ap_blocks; /* journal blocks on disk */
182 struct reiserfs_journal_cnode *j_last; /* newest journal block */
183 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
184
185 struct block_device *j_dev_bd;
186 fmode_t j_dev_mode;
187 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
188
189 unsigned long j_state;
190 unsigned int j_trans_id;
191 unsigned long j_mount_id;
192 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
193 unsigned long j_len; /* length of current waiting commit */
194 unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */
195 atomic_t j_wcount; /* count of writers for current commit */
196 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
197 unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
198 unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */
199 struct buffer_head *j_header_bh;
200
201 time_t j_trans_start_time; /* time this transaction started */
202 struct mutex j_mutex;
203 struct mutex j_flush_mutex;
204 wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */
205 atomic_t j_jlock; /* lock for j_join_wait */
206 int j_list_bitmap_index; /* number of next list bitmap to use */
207 int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */
208 int j_next_full_flush; /* next journal_end will flush all journal list */
209 int j_next_async_flush; /* next journal_end will flush all async commits */
210
211 int j_cnode_used; /* number of cnodes on the used list */
212 int j_cnode_free; /* number of cnodes on the free list */
213
214 unsigned int j_trans_max; /* max number of blocks in a transaction. */
215 unsigned int j_max_batch; /* max number of blocks to batch into a trans */
216 unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */
217 unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */
218 unsigned int j_default_max_commit_age; /* the default for the max commit age */
219
220 struct reiserfs_journal_cnode *j_cnode_free_list;
221 struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */
222
223 struct reiserfs_journal_list *j_current_jl;
224 int j_free_bitmap_nodes;
225 int j_used_bitmap_nodes;
226
227 int j_num_lists; /* total number of active transactions */
228 int j_num_work_lists; /* number that need attention from kreiserfsd */
229
230 /* debugging to make sure things are flushed in order */
231 unsigned int j_last_flush_id;
232
233 /* debugging to make sure things are committed in order */
234 unsigned int j_last_commit_id;
235
236 struct list_head j_bitmap_nodes;
237 struct list_head j_dirty_buffers;
238 spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */
239
240 /* list of all active transactions */
241 struct list_head j_journal_list;
242 /* lists that haven't been touched by writeback attempts */
243 struct list_head j_working_list;
244
245 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
246 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
247 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
248 the transactions */
249 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
250 int j_persistent_trans;
251 unsigned long j_max_trans_size;
252 unsigned long j_max_batch_size;
253
254 int j_errno;
255
256 /* when flushing ordered buffers, throttle new ordered writers */
257 struct delayed_work j_work;
258 struct super_block *j_work_sb;
259 atomic_t j_async_throttle;
260};
261
262enum journal_state_bits {
263 J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */
264 J_WRITERS_QUEUED, /* set when log is full due to too many writers */
265 J_ABORTED, /* set when log is aborted */
266};
267
268#define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */
269
270typedef __u32(*hashf_t) (const signed char *, int);
271
272struct reiserfs_bitmap_info {
273 __u32 free_count;
274};
275
276struct proc_dir_entry;
277
278#if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO )
279typedef unsigned long int stat_cnt_t;
280typedef struct reiserfs_proc_info_data {
281 spinlock_t lock;
282 int exiting;
283 int max_hash_collisions;
284
285 stat_cnt_t breads;
286 stat_cnt_t bread_miss;
287 stat_cnt_t search_by_key;
288 stat_cnt_t search_by_key_fs_changed;
289 stat_cnt_t search_by_key_restarted;
290
291 stat_cnt_t insert_item_restarted;
292 stat_cnt_t paste_into_item_restarted;
293 stat_cnt_t cut_from_item_restarted;
294 stat_cnt_t delete_solid_item_restarted;
295 stat_cnt_t delete_item_restarted;
296
297 stat_cnt_t leaked_oid;
298 stat_cnt_t leaves_removable;
299
300 /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */
301 stat_cnt_t balance_at[5]; /* XXX */
302 /* sbk == search_by_key */
303 stat_cnt_t sbk_read_at[5]; /* XXX */
304 stat_cnt_t sbk_fs_changed[5];
305 stat_cnt_t sbk_restarted[5];
306 stat_cnt_t items_at[5]; /* XXX */
307 stat_cnt_t free_at[5]; /* XXX */
308 stat_cnt_t can_node_be_removed[5]; /* XXX */
309 long int lnum[5]; /* XXX */
310 long int rnum[5]; /* XXX */
311 long int lbytes[5]; /* XXX */
312 long int rbytes[5]; /* XXX */
313 stat_cnt_t get_neighbors[5];
314 stat_cnt_t get_neighbors_restart[5];
315 stat_cnt_t need_l_neighbor[5];
316 stat_cnt_t need_r_neighbor[5];
317
318 stat_cnt_t free_block;
319 struct __scan_bitmap_stats {
320 stat_cnt_t call;
321 stat_cnt_t wait;
322 stat_cnt_t bmap;
323 stat_cnt_t retry;
324 stat_cnt_t in_journal_hint;
325 stat_cnt_t in_journal_nohint;
326 stat_cnt_t stolen;
327 } scan_bitmap;
328 struct __journal_stats {
329 stat_cnt_t in_journal;
330 stat_cnt_t in_journal_bitmap;
331 stat_cnt_t in_journal_reusable;
332 stat_cnt_t lock_journal;
333 stat_cnt_t lock_journal_wait;
334 stat_cnt_t journal_being;
335 stat_cnt_t journal_relock_writers;
336 stat_cnt_t journal_relock_wcount;
337 stat_cnt_t mark_dirty;
338 stat_cnt_t mark_dirty_already;
339 stat_cnt_t mark_dirty_notjournal;
340 stat_cnt_t restore_prepared;
341 stat_cnt_t prepare;
342 stat_cnt_t prepare_retry;
343 } journal;
344} reiserfs_proc_info_data_t;
345#else
346typedef struct reiserfs_proc_info_data {
347} reiserfs_proc_info_data_t;
348#endif
349
350/* reiserfs union of in-core super block data */
351struct reiserfs_sb_info {
352 struct buffer_head *s_sbh; /* Buffer containing the super block */
353 /* both the comment and the choice of
354 name are unclear for s_rs -Hans */
355 struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */
356 struct reiserfs_bitmap_info *s_ap_bitmap;
357 struct reiserfs_journal *s_journal; /* pointer to journal information */
358 unsigned short s_mount_state; /* reiserfs state (valid, invalid) */
359
360 /* Serialize writers access, replace the old bkl */
361 struct mutex lock;
362 /* Owner of the lock (can be recursive) */
363 struct task_struct *lock_owner;
364 /* Depth of the lock, start from -1 like the bkl */
365 int lock_depth;
366
367 /* Comment? -Hans */
368 void (*end_io_handler) (struct buffer_head *, int);
369 hashf_t s_hash_function; /* pointer to function which is used
370 to sort names in directory. Set on
371 mount */
372 unsigned long s_mount_opt; /* reiserfs's mount options are set
373 here (currently - NOTAIL, NOLOG,
374 REPLAYONLY) */
375
376 struct { /* This is a structure that describes block allocator options */
377 unsigned long bits; /* Bitfield for enable/disable kind of options */
378 unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */
379 int border; /* percentage of disk, border takes */
380 int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */
381 int preallocsize; /* Number of blocks we try to prealloc when file
382 reaches preallocmin size (in blocks) or
383 prealloc_list is empty. */
384 } s_alloc_options;
385
386 /* Comment? -Hans */
387 wait_queue_head_t s_wait;
388 /* To be obsoleted soon by per buffer seals.. -Hans */
389 atomic_t s_generation_counter; // increased by one every time the
390 // tree gets re-balanced
391 unsigned long s_properties; /* File system properties. Currently holds
392 on-disk FS format */
393
394 /* session statistics */
395 int s_disk_reads;
396 int s_disk_writes;
397 int s_fix_nodes;
398 int s_do_balance;
399 int s_unneeded_left_neighbor;
400 int s_good_search_by_key_reada;
401 int s_bmaps;
402 int s_bmaps_without_search;
403 int s_direct2indirect;
404 int s_indirect2direct;
405 /* set up when it's ok for reiserfs_read_inode2() to read from
406 disk inode with nlink==0. Currently this is only used during
407 finish_unfinished() processing at mount time */
408 int s_is_unlinked_ok;
409 reiserfs_proc_info_data_t s_proc_info_data;
410 struct proc_dir_entry *procdir;
411 int reserved_blocks; /* amount of blocks reserved for further allocations */
412 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
413 struct dentry *priv_root; /* root of /.reiserfs_priv */
414 struct dentry *xattr_root; /* root of /.reiserfs_priv/xattrs */
415 int j_errno;
416#ifdef CONFIG_QUOTA
417 char *s_qf_names[MAXQUOTAS];
418 int s_jquota_fmt;
419#endif
420 char *s_jdev; /* Stored jdev for mount option showing */
421#ifdef CONFIG_REISERFS_CHECK
422
423 struct tree_balance *cur_tb; /*
424 * Detects whether more than one
425 * copy of tb exists per superblock
426 * as a means of checking whether
427 * do_balance is executing concurrently
428 * against another tree reader/writer
429 * on a same mount point.
430 */
431#endif
432};
433
434/* Definitions of reiserfs on-disk properties: */
435#define REISERFS_3_5 0
436#define REISERFS_3_6 1
437#define REISERFS_OLD_FORMAT 2
438
439enum reiserfs_mount_options {
440/* Mount options */
441 REISERFS_LARGETAIL, /* large tails will be created in a session */
442 REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */
443 REPLAYONLY, /* replay journal and return 0. Use by fsck */
444 REISERFS_CONVERT, /* -o conv: causes conversion of old
445 format super block to the new
446 format. If not specified - old
447 partition will be dealt with in a
448 manner of 3.5.x */
449
450/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
451** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
452** is not required. If the normal autodection code can't determine which
453** hash to use (because both hashes had the same value for a file)
454** use this option to force a specific hash. It won't allow you to override
455** the existing hash on the FS, so if you have a tea hash disk, and mount
456** with -o hash=rupasov, the mount will fail.
457*/
458 FORCE_TEA_HASH, /* try to force tea hash on mount */
459 FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */
460 FORCE_R5_HASH, /* try to force rupasov hash on mount */
461 FORCE_HASH_DETECT, /* try to detect hash function on mount */
462
463 REISERFS_DATA_LOG,
464 REISERFS_DATA_ORDERED,
465 REISERFS_DATA_WRITEBACK,
466
467/* used for testing experimental features, makes benchmarking new
468 features with and without more convenient, should never be used by
469 users in any code shipped to users (ideally) */
470
471 REISERFS_NO_BORDER,
472 REISERFS_NO_UNHASHED_RELOCATION,
473 REISERFS_HASHED_RELOCATION,
474 REISERFS_ATTRS,
475 REISERFS_XATTRS_USER,
476 REISERFS_POSIXACL,
477 REISERFS_EXPOSE_PRIVROOT,
478 REISERFS_BARRIER_NONE,
479 REISERFS_BARRIER_FLUSH,
480
481 /* Actions on error */
482 REISERFS_ERROR_PANIC,
483 REISERFS_ERROR_RO,
484 REISERFS_ERROR_CONTINUE,
485
486 REISERFS_USRQUOTA, /* User quota option specified */
487 REISERFS_GRPQUOTA, /* Group quota option specified */
488
489 REISERFS_TEST1,
490 REISERFS_TEST2,
491 REISERFS_TEST3,
492 REISERFS_TEST4,
493 REISERFS_UNSUPPORTED_OPT,
494};
495
496#define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH))
497#define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH))
498#define reiserfs_tea_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_TEA_HASH))
499#define reiserfs_hash_detect(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_HASH_DETECT))
500#define reiserfs_no_border(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_BORDER))
501#define reiserfs_no_unhashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION))
502#define reiserfs_hashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_HASHED_RELOCATION))
503#define reiserfs_test4(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TEST4))
504
505#define have_large_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_LARGETAIL))
506#define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL))
507#define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY))
508#define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS))
509#define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5))
510#define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT))
511#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
512#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
513#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
514#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
515#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
516#define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT))
517#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
518#define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE))
519#define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH))
520
521#define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC))
522#define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO))
523
524void reiserfs_file_buffer(struct buffer_head *bh, int list);
525extern struct file_system_type reiserfs_fs_type;
526int reiserfs_resize(struct super_block *, unsigned long);
527
528#define CARRY_ON 0
529#define SCHEDULE_OCCURRED 1
530
531#define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh)
532#define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal)
533#define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block)
534#define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free)
535#define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap)
536
537#define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->)
538
539/* A safe version of the "bdevname", which returns the "s_id" field of
540 * a superblock or else "Null superblock" if the super block is NULL.
541 */
542static inline char *reiserfs_bdevname(struct super_block *s)
543{
544 return (s == NULL) ? "Null superblock" : s->s_id;
545}
546
547#define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal)))
548static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal
549 *journal)
550{
551 return test_bit(J_ABORTED, &journal->j_state);
552}
553
554#endif /* _LINUX_REISER_FS_SB */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index c2b71473266e..d8ce17c2459a 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -21,132 +21,4 @@ struct reiserfs_security_handle {
21 size_t length; 21 size_t length;
22}; 22};
23 23
24#ifdef __KERNEL__
25
26#include <linux/init.h>
27#include <linux/list.h>
28#include <linux/rwsem.h>
29#include <linux/reiserfs_fs_i.h>
30#include <linux/reiserfs_fs.h>
31
32struct inode;
33struct dentry;
34struct iattr;
35struct super_block;
36struct nameidata;
37
38int reiserfs_xattr_register_handlers(void) __init;
39void reiserfs_xattr_unregister_handlers(void);
40int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
41int reiserfs_lookup_privroot(struct super_block *sb);
42int reiserfs_delete_xattrs(struct inode *inode);
43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
44int reiserfs_permission(struct inode *inode, int mask);
45
46#ifdef CONFIG_REISERFS_FS_XATTR
47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
48ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
49 void *buffer, size_t size);
50int reiserfs_setxattr(struct dentry *dentry, const char *name,
51 const void *value, size_t size, int flags);
52ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
53int reiserfs_removexattr(struct dentry *dentry, const char *name);
54
55int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
56int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
57int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
58 struct inode *, const char *, const void *,
59 size_t, int);
60
61extern const struct xattr_handler reiserfs_xattr_user_handler;
62extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern const struct xattr_handler reiserfs_xattr_security_handler;
64#ifdef CONFIG_REISERFS_FS_SECURITY
65int reiserfs_security_init(struct inode *dir, struct inode *inode,
66 const struct qstr *qstr,
67 struct reiserfs_security_handle *sec);
68int reiserfs_security_write(struct reiserfs_transaction_handle *th,
69 struct inode *inode,
70 struct reiserfs_security_handle *sec);
71void reiserfs_security_free(struct reiserfs_security_handle *sec);
72#endif
73
74static inline int reiserfs_xattrs_initialized(struct super_block *sb)
75{
76 return REISERFS_SB(sb)->priv_root != NULL;
77}
78
79#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
80static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
81{
82 loff_t ret = 0;
83 if (reiserfs_file_data_log(inode)) {
84 ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
85 ret >>= inode->i_sb->s_blocksize_bits;
86 }
87 return ret;
88}
89
90/* We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
91 * Let's try to be smart about it.
92 * xattr root: We cache it. If it's not cached, we may need to create it.
93 * xattr dir: If anything has been loaded for this inode, we can set a flag
94 * saying so.
95 * xattr file: Since we don't cache xattrs, we can't tell. We always include
96 * blocks for it.
97 *
98 * However, since root and dir can be created between calls - YOU MUST SAVE
99 * THIS VALUE.
100 */
101static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
102{
103 size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
104
105 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
106 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
107 if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode)
108 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
109 }
110
111 return nblocks;
112}
113
114static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
115{
116 init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
117}
118
119#else
120
121#define reiserfs_getxattr NULL
122#define reiserfs_setxattr NULL
123#define reiserfs_listxattr NULL
124#define reiserfs_removexattr NULL
125
126static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
127{
128}
129#endif /* CONFIG_REISERFS_FS_XATTR */
130
131#ifndef CONFIG_REISERFS_FS_SECURITY
132static inline int reiserfs_security_init(struct inode *dir,
133 struct inode *inode,
134 const struct qstr *qstr,
135 struct reiserfs_security_handle *sec)
136{
137 return 0;
138}
139static inline int
140reiserfs_security_write(struct reiserfs_transaction_handle *th,
141 struct inode *inode,
142 struct reiserfs_security_handle *sec)
143{
144 return 0;
145}
146static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
147{}
148#endif
149
150#endif /* __KERNEL__ */
151
152#endif /* _LINUX_REISERFS_XATTR_H */ 24#endif /* _LINUX_REISERFS_XATTR_H */
diff --git a/include/linux/relay.h b/include/linux/relay.h
index a822fd71fd64..91cacc34c159 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -15,6 +15,7 @@
15#include <linux/timer.h> 15#include <linux/timer.h>
16#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/bug.h>
18#include <linux/fs.h> 19#include <linux/fs.h>
19#include <linux/poll.h> 20#include <linux/poll.h>
20#include <linux/kref.h> 21#include <linux/kref.h>
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
new file mode 100644
index 000000000000..f1ffabb978d3
--- /dev/null
+++ b/include/linux/remoteproc.h
@@ -0,0 +1,478 @@
1/*
2 * Remote Processor Framework
3 *
4 * Copyright(c) 2011 Texas Instruments, Inc.
5 * Copyright(c) 2011 Google, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name Texas Instruments nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef REMOTEPROC_H
36#define REMOTEPROC_H
37
38#include <linux/types.h>
39#include <linux/kref.h>
40#include <linux/klist.h>
41#include <linux/mutex.h>
42#include <linux/virtio.h>
43#include <linux/completion.h>
44#include <linux/idr.h>
45
46/**
47 * struct resource_table - firmware resource table header
48 * @ver: version number
49 * @num: number of resource entries
50 * @reserved: reserved (must be zero)
51 * @offset: array of offsets pointing at the various resource entries
52 *
53 * A resource table is essentially a list of system resources required
54 * by the remote processor. It may also include configuration entries.
55 * If needed, the remote processor firmware should contain this table
56 * as a dedicated ".resource_table" ELF section.
57 *
58 * Some resources entries are mere announcements, where the host is informed
59 * of specific remoteproc configuration. Other entries require the host to
60 * do something (e.g. allocate a system resource). Sometimes a negotiation
61 * is expected, where the firmware requests a resource, and once allocated,
62 * the host should provide back its details (e.g. address of an allocated
63 * memory region).
64 *
65 * The header of the resource table, as expressed by this structure,
66 * contains a version number (should we need to change this format in the
67 * future), the number of available resource entries, and their offsets
68 * in the table.
69 *
70 * Immediately following this header are the resource entries themselves,
71 * each of which begins with a resource entry header (as described below).
72 */
73struct resource_table {
74 u32 ver;
75 u32 num;
76 u32 reserved[2];
77 u32 offset[0];
78} __packed;
79
80/**
81 * struct fw_rsc_hdr - firmware resource entry header
82 * @type: resource type
83 * @data: resource data
84 *
85 * Every resource entry begins with a 'struct fw_rsc_hdr' header providing
86 * its @type. The content of the entry itself will immediately follow
87 * this header, and it should be parsed according to the resource type.
88 */
89struct fw_rsc_hdr {
90 u32 type;
91 u8 data[0];
92} __packed;
93
94/**
95 * enum fw_resource_type - types of resource entries
96 *
97 * @RSC_CARVEOUT: request for allocation of a physically contiguous
98 * memory region.
99 * @RSC_DEVMEM: request to iommu_map a memory-based peripheral.
100 * @RSC_TRACE: announces the availability of a trace buffer into which
101 * the remote processor will be writing logs.
102 * @RSC_VDEV: declare support for a virtio device, and serve as its
103 * virtio header.
104 * @RSC_LAST: just keep this one at the end
105 *
106 * For more details regarding a specific resource type, please see its
107 * dedicated structure below.
108 *
109 * Please note that these values are used as indices to the rproc_handle_rsc
110 * lookup table, so please keep them sane. Moreover, @RSC_LAST is used to
111 * check the validity of an index before the lookup table is accessed, so
112 * please update it as needed.
113 */
114enum fw_resource_type {
115 RSC_CARVEOUT = 0,
116 RSC_DEVMEM = 1,
117 RSC_TRACE = 2,
118 RSC_VDEV = 3,
119 RSC_LAST = 4,
120};
121
122#define FW_RSC_ADDR_ANY (0xFFFFFFFFFFFFFFFF)
123
124/**
125 * struct fw_rsc_carveout - physically contiguous memory request
126 * @da: device address
127 * @pa: physical address
128 * @len: length (in bytes)
129 * @flags: iommu protection flags
130 * @reserved: reserved (must be zero)
131 * @name: human-readable name of the requested memory region
132 *
133 * This resource entry requests the host to allocate a physically contiguous
134 * memory region.
135 *
136 * These request entries should precede other firmware resource entries,
137 * as other entries might request placing other data objects inside
138 * these memory regions (e.g. data/code segments, trace resource entries, ...).
139 *
140 * Allocating memory this way helps utilizing the reserved physical memory
141 * (e.g. CMA) more efficiently, and also minimizes the number of TLB entries
142 * needed to map it (in case @rproc is using an IOMMU). Reducing the TLB
143 * pressure is important; it may have a substantial impact on performance.
144 *
145 * If the firmware is compiled with static addresses, then @da should specify
146 * the expected device address of this memory region. If @da is set to
147 * FW_RSC_ADDR_ANY, then the host will dynamically allocate it, and then
148 * overwrite @da with the dynamically allocated address.
149 *
150 * We will always use @da to negotiate the device addresses, even if it
151 * isn't using an iommu. In that case, though, it will obviously contain
152 * physical addresses.
153 *
154 * Some remote processors needs to know the allocated physical address
155 * even if they do use an iommu. This is needed, e.g., if they control
156 * hardware accelerators which access the physical memory directly (this
157 * is the case with OMAP4 for instance). In that case, the host will
158 * overwrite @pa with the dynamically allocated physical address.
159 * Generally we don't want to expose physical addresses if we don't have to
160 * (remote processors are generally _not_ trusted), so we might want to
161 * change this to happen _only_ when explicitly required by the hardware.
162 *
163 * @flags is used to provide IOMMU protection flags, and @name should
164 * (optionally) contain a human readable name of this carveout region
165 * (mainly for debugging purposes).
166 */
167struct fw_rsc_carveout {
168 u32 da;
169 u32 pa;
170 u32 len;
171 u32 flags;
172 u32 reserved;
173 u8 name[32];
174} __packed;
175
176/**
177 * struct fw_rsc_devmem - iommu mapping request
178 * @da: device address
179 * @pa: physical address
180 * @len: length (in bytes)
181 * @flags: iommu protection flags
182 * @reserved: reserved (must be zero)
183 * @name: human-readable name of the requested region to be mapped
184 *
185 * This resource entry requests the host to iommu map a physically contiguous
186 * memory region. This is needed in case the remote processor requires
187 * access to certain memory-based peripherals; _never_ use it to access
188 * regular memory.
189 *
190 * This is obviously only needed if the remote processor is accessing memory
191 * via an iommu.
192 *
193 * @da should specify the required device address, @pa should specify
194 * the physical address we want to map, @len should specify the size of
195 * the mapping and @flags is the IOMMU protection flags. As always, @name may
196 * (optionally) contain a human readable name of this mapping (mainly for
197 * debugging purposes).
198 *
199 * Note: at this point we just "trust" those devmem entries to contain valid
200 * physical addresses, but this isn't safe and will be changed: eventually we
201 * want remoteproc implementations to provide us ranges of physical addresses
202 * the firmware is allowed to request, and not allow firmwares to request
203 * access to physical addresses that are outside those ranges.
204 */
205struct fw_rsc_devmem {
206 u32 da;
207 u32 pa;
208 u32 len;
209 u32 flags;
210 u32 reserved;
211 u8 name[32];
212} __packed;
213
214/**
215 * struct fw_rsc_trace - trace buffer declaration
216 * @da: device address
217 * @len: length (in bytes)
218 * @reserved: reserved (must be zero)
219 * @name: human-readable name of the trace buffer
220 *
221 * This resource entry provides the host information about a trace buffer
222 * into which the remote processor will write log messages.
223 *
224 * @da specifies the device address of the buffer, @len specifies
225 * its size, and @name may contain a human readable name of the trace buffer.
226 *
227 * After booting the remote processor, the trace buffers are exposed to the
228 * user via debugfs entries (called trace0, trace1, etc..).
229 */
230struct fw_rsc_trace {
231 u32 da;
232 u32 len;
233 u32 reserved;
234 u8 name[32];
235} __packed;
236
237/**
238 * struct fw_rsc_vdev_vring - vring descriptor entry
239 * @da: device address
240 * @align: the alignment between the consumer and producer parts of the vring
241 * @num: num of buffers supported by this vring (must be power of two)
242 * @notifyid is a unique rproc-wide notify index for this vring. This notify
243 * index is used when kicking a remote processor, to let it know that this
244 * vring is triggered.
245 * @reserved: reserved (must be zero)
246 *
247 * This descriptor is not a resource entry by itself; it is part of the
248 * vdev resource type (see below).
249 *
250 * Note that @da should either contain the device address where
251 * the remote processor is expecting the vring, or indicate that
252 * dynamically allocation of the vring's device address is supported.
253 */
254struct fw_rsc_vdev_vring {
255 u32 da;
256 u32 align;
257 u32 num;
258 u32 notifyid;
259 u32 reserved;
260} __packed;
261
262/**
263 * struct fw_rsc_vdev - virtio device header
264 * @id: virtio device id (as in virtio_ids.h)
265 * @notifyid is a unique rproc-wide notify index for this vdev. This notify
266 * index is used when kicking a remote processor, to let it know that the
267 * status/features of this vdev have changes.
268 * @dfeatures specifies the virtio device features supported by the firmware
269 * @gfeatures is a place holder used by the host to write back the
270 * negotiated features that are supported by both sides.
271 * @config_len is the size of the virtio config space of this vdev. The config
272 * space lies in the resource table immediate after this vdev header.
273 * @status is a place holder where the host will indicate its virtio progress.
274 * @num_of_vrings indicates how many vrings are described in this vdev header
275 * @reserved: reserved (must be zero)
276 * @vring is an array of @num_of_vrings entries of 'struct fw_rsc_vdev_vring'.
277 *
278 * This resource is a virtio device header: it provides information about
279 * the vdev, and is then used by the host and its peer remote processors
280 * to negotiate and share certain virtio properties.
281 *
282 * By providing this resource entry, the firmware essentially asks remoteproc
283 * to statically allocate a vdev upon registration of the rproc (dynamic vdev
284 * allocation is not yet supported).
285 *
286 * Note: unlike virtualization systems, the term 'host' here means
287 * the Linux side which is running remoteproc to control the remote
288 * processors. We use the name 'gfeatures' to comply with virtio's terms,
289 * though there isn't really any virtualized guest OS here: it's the host
290 * which is responsible for negotiating the final features.
291 * Yeah, it's a bit confusing.
292 *
293 * Note: immediately following this structure is the virtio config space for
294 * this vdev (which is specific to the vdev; for more info, read the virtio
295 * spec). the size of the config space is specified by @config_len.
296 */
297struct fw_rsc_vdev {
298 u32 id;
299 u32 notifyid;
300 u32 dfeatures;
301 u32 gfeatures;
302 u32 config_len;
303 u8 status;
304 u8 num_of_vrings;
305 u8 reserved[2];
306 struct fw_rsc_vdev_vring vring[0];
307} __packed;
308
309/**
310 * struct rproc_mem_entry - memory entry descriptor
311 * @va: virtual address
312 * @dma: dma address
313 * @len: length, in bytes
314 * @da: device address
315 * @priv: associated data
316 * @node: list node
317 */
318struct rproc_mem_entry {
319 void *va;
320 dma_addr_t dma;
321 int len;
322 u32 da;
323 void *priv;
324 struct list_head node;
325};
326
327struct rproc;
328
329/**
330 * struct rproc_ops - platform-specific device handlers
331 * @start: power on the device and boot it
332 * @stop: power off the device
333 * @kick: kick a virtqueue (virtqueue id given as a parameter)
334 */
335struct rproc_ops {
336 int (*start)(struct rproc *rproc);
337 int (*stop)(struct rproc *rproc);
338 void (*kick)(struct rproc *rproc, int vqid);
339};
340
341/**
342 * enum rproc_state - remote processor states
343 * @RPROC_OFFLINE: device is powered off
344 * @RPROC_SUSPENDED: device is suspended; needs to be woken up to receive
345 * a message.
346 * @RPROC_RUNNING: device is up and running
347 * @RPROC_CRASHED: device has crashed; need to start recovery
348 * @RPROC_LAST: just keep this one at the end
349 *
350 * Please note that the values of these states are used as indices
351 * to rproc_state_string, a state-to-name lookup table,
352 * so please keep the two synchronized. @RPROC_LAST is used to check
353 * the validity of an index before the lookup table is accessed, so
354 * please update it as needed too.
355 */
356enum rproc_state {
357 RPROC_OFFLINE = 0,
358 RPROC_SUSPENDED = 1,
359 RPROC_RUNNING = 2,
360 RPROC_CRASHED = 3,
361 RPROC_LAST = 4,
362};
363
364/**
365 * struct rproc - represents a physical remote processor device
366 * @node: klist node of this rproc object
367 * @domain: iommu domain
368 * @name: human readable name of the rproc
369 * @firmware: name of firmware file to be loaded
370 * @priv: private data which belongs to the platform-specific rproc module
371 * @ops: platform-specific start/stop rproc handlers
372 * @dev: underlying device
373 * @refcount: refcount of users that have a valid pointer to this rproc
374 * @power: refcount of users who need this rproc powered up
375 * @state: state of the device
376 * @lock: lock which protects concurrent manipulations of the rproc
377 * @dbg_dir: debugfs directory of this rproc device
378 * @traces: list of trace buffers
379 * @num_traces: number of trace buffers
380 * @carveouts: list of physically contiguous memory allocations
381 * @mappings: list of iommu mappings we initiated, needed on shutdown
382 * @firmware_loading_complete: marks e/o asynchronous firmware loading
383 * @bootaddr: address of first instruction to boot rproc with (optional)
384 * @rvdevs: list of remote virtio devices
385 * @notifyids: idr for dynamically assigning rproc-wide unique notify ids
386 */
387struct rproc {
388 struct klist_node node;
389 struct iommu_domain *domain;
390 const char *name;
391 const char *firmware;
392 void *priv;
393 const struct rproc_ops *ops;
394 struct device *dev;
395 struct kref refcount;
396 atomic_t power;
397 unsigned int state;
398 struct mutex lock;
399 struct dentry *dbg_dir;
400 struct list_head traces;
401 int num_traces;
402 struct list_head carveouts;
403 struct list_head mappings;
404 struct completion firmware_loading_complete;
405 u32 bootaddr;
406 struct list_head rvdevs;
407 struct idr notifyids;
408};
409
410/* we currently support only two vrings per rvdev */
411#define RVDEV_NUM_VRINGS 2
412
413/**
414 * struct rproc_vring - remoteproc vring state
415 * @va: virtual address
416 * @dma: dma address
417 * @len: length, in bytes
418 * @da: device address
419 * @align: vring alignment
420 * @notifyid: rproc-specific unique vring index
421 * @rvdev: remote vdev
422 * @vq: the virtqueue of this vring
423 */
424struct rproc_vring {
425 void *va;
426 dma_addr_t dma;
427 int len;
428 u32 da;
429 u32 align;
430 int notifyid;
431 struct rproc_vdev *rvdev;
432 struct virtqueue *vq;
433};
434
435/**
436 * struct rproc_vdev - remoteproc state for a supported virtio device
437 * @node: list node
438 * @rproc: the rproc handle
439 * @vdev: the virio device
440 * @vring: the vrings for this vdev
441 * @dfeatures: virtio device features
442 * @gfeatures: virtio guest features
443 */
444struct rproc_vdev {
445 struct list_head node;
446 struct rproc *rproc;
447 struct virtio_device vdev;
448 struct rproc_vring vring[RVDEV_NUM_VRINGS];
449 unsigned long dfeatures;
450 unsigned long gfeatures;
451};
452
453struct rproc *rproc_get_by_name(const char *name);
454void rproc_put(struct rproc *rproc);
455
456struct rproc *rproc_alloc(struct device *dev, const char *name,
457 const struct rproc_ops *ops,
458 const char *firmware, int len);
459void rproc_free(struct rproc *rproc);
460int rproc_register(struct rproc *rproc);
461int rproc_unregister(struct rproc *rproc);
462
463int rproc_boot(struct rproc *rproc);
464void rproc_shutdown(struct rproc *rproc);
465
466static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev)
467{
468 return container_of(vdev, struct rproc_vdev, vdev);
469}
470
471static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev)
472{
473 struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
474
475 return rvdev->rproc;
476}
477
478#endif /* REMOTEPROC_H */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index c6c608482cba..6fdf02737e9d 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -117,10 +117,10 @@ enum rfkill_user_states {
117#include <linux/kernel.h> 117#include <linux/kernel.h>
118#include <linux/list.h> 118#include <linux/list.h>
119#include <linux/mutex.h> 119#include <linux/mutex.h>
120#include <linux/device.h>
121#include <linux/leds.h> 120#include <linux/leds.h>
122#include <linux/err.h> 121#include <linux/err.h>
123 122
123struct device;
124/* this is opaque */ 124/* this is opaque */
125struct rfkill; 125struct rfkill;
126 126
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 229b3ca23134..7f07470e1ed9 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -17,7 +17,6 @@
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/device.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/rio.h> 21#include <linux/rio.h>
23 22
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 1cdd62a2788a..fd07c4542cee 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -122,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *); 123void anon_vma_moveto_tail(struct vm_area_struct *);
124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
125void __anon_vma_link(struct vm_area_struct *);
126 125
127static inline void anon_vma_merge(struct vm_area_struct *vma, 126static inline void anon_vma_merge(struct vm_area_struct *vma,
128 struct vm_area_struct *next) 127 struct vm_area_struct *next)
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
new file mode 100644
index 000000000000..a8e50e44203c
--- /dev/null
+++ b/include/linux/rpmsg.h
@@ -0,0 +1,326 @@
1/*
2 * Remote processor messaging
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2011 Google, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name Texas Instruments nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#ifndef _LINUX_RPMSG_H
36#define _LINUX_RPMSG_H
37
38#include <linux/types.h>
39#include <linux/device.h>
40#include <linux/mod_devicetable.h>
41
42/* The feature bitmap for virtio rpmsg */
43#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
44
45/**
46 * struct rpmsg_hdr - common header for all rpmsg messages
47 * @src: source address
48 * @dst: destination address
49 * @reserved: reserved for future use
50 * @len: length of payload (in bytes)
51 * @flags: message flags
52 * @data: @len bytes of message payload data
53 *
54 * Every message sent(/received) on the rpmsg bus begins with this header.
55 */
56struct rpmsg_hdr {
57 u32 src;
58 u32 dst;
59 u32 reserved;
60 u16 len;
61 u16 flags;
62 u8 data[0];
63} __packed;
64
65/**
66 * struct rpmsg_ns_msg - dynamic name service announcement message
67 * @name: name of remote service that is published
68 * @addr: address of remote service that is published
69 * @flags: indicates whether service is created or destroyed
70 *
71 * This message is sent across to publish a new service, or announce
72 * about its removal. When we receive these messages, an appropriate
73 * rpmsg channel (i.e device) is created/destroyed. In turn, the ->probe()
74 * or ->remove() handler of the appropriate rpmsg driver will be invoked
75 * (if/as-soon-as one is registered).
76 */
77struct rpmsg_ns_msg {
78 char name[RPMSG_NAME_SIZE];
79 u32 addr;
80 u32 flags;
81} __packed;
82
83/**
84 * enum rpmsg_ns_flags - dynamic name service announcement flags
85 *
86 * @RPMSG_NS_CREATE: a new remote service was just created
87 * @RPMSG_NS_DESTROY: a known remote service was just destroyed
88 */
89enum rpmsg_ns_flags {
90 RPMSG_NS_CREATE = 0,
91 RPMSG_NS_DESTROY = 1,
92};
93
94#define RPMSG_ADDR_ANY 0xFFFFFFFF
95
96struct virtproc_info;
97
98/**
99 * rpmsg_channel - devices that belong to the rpmsg bus are called channels
100 * @vrp: the remote processor this channel belongs to
101 * @dev: the device struct
102 * @id: device id (used to match between rpmsg drivers and devices)
103 * @src: local address
104 * @dst: destination address
105 * @ept: the rpmsg endpoint of this channel
106 * @announce: if set, rpmsg will announce the creation/removal of this channel
107 */
108struct rpmsg_channel {
109 struct virtproc_info *vrp;
110 struct device dev;
111 struct rpmsg_device_id id;
112 u32 src;
113 u32 dst;
114 struct rpmsg_endpoint *ept;
115 bool announce;
116};
117
118typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32);
119
120/**
121 * struct rpmsg_endpoint - binds a local rpmsg address to its user
122 * @rpdev: rpmsg channel device
123 * @cb: rx callback handler
124 * @addr: local rpmsg address
125 * @priv: private data for the driver's use
126 *
127 * In essence, an rpmsg endpoint represents a listener on the rpmsg bus, as
128 * it binds an rpmsg address with an rx callback handler.
129 *
130 * Simple rpmsg drivers shouldn't use this struct directly, because
131 * things just work: every rpmsg driver provides an rx callback upon
132 * registering to the bus, and that callback is then bound to its rpmsg
133 * address when the driver is probed. When relevant inbound messages arrive
134 * (i.e. messages which their dst address equals to the src address of
135 * the rpmsg channel), the driver's handler is invoked to process it.
136 *
137 * More complicated drivers though, that do need to allocate additional rpmsg
138 * addresses, and bind them to different rx callbacks, must explicitly
139 * create additional endpoints by themselves (see rpmsg_create_ept()).
140 */
141struct rpmsg_endpoint {
142 struct rpmsg_channel *rpdev;
143 rpmsg_rx_cb_t cb;
144 u32 addr;
145 void *priv;
146};
147
148/**
149 * struct rpmsg_driver - rpmsg driver struct
150 * @drv: underlying device driver
151 * @id_table: rpmsg ids serviced by this driver
152 * @probe: invoked when a matching rpmsg channel (i.e. device) is found
153 * @remove: invoked when the rpmsg channel is removed
154 * @callback: invoked when an inbound message is received on the channel
155 */
156struct rpmsg_driver {
157 struct device_driver drv;
158 const struct rpmsg_device_id *id_table;
159 int (*probe)(struct rpmsg_channel *dev);
160 void (*remove)(struct rpmsg_channel *dev);
161 void (*callback)(struct rpmsg_channel *, void *, int, void *, u32);
162};
163
164int register_rpmsg_device(struct rpmsg_channel *dev);
165void unregister_rpmsg_device(struct rpmsg_channel *dev);
166int register_rpmsg_driver(struct rpmsg_driver *drv);
167void unregister_rpmsg_driver(struct rpmsg_driver *drv);
168void rpmsg_destroy_ept(struct rpmsg_endpoint *);
169struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *,
170 rpmsg_rx_cb_t cb, void *priv, u32 addr);
171int
172rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool);
173
174/**
175 * rpmsg_send() - send a message across to the remote processor
176 * @rpdev: the rpmsg channel
177 * @data: payload of message
178 * @len: length of payload
179 *
180 * This function sends @data of length @len on the @rpdev channel.
181 * The message will be sent to the remote processor which the @rpdev
182 * channel belongs to, using @rpdev's source and destination addresses.
183 * In case there are no TX buffers available, the function will block until
184 * one becomes available, or a timeout of 15 seconds elapses. When the latter
185 * happens, -ERESTARTSYS is returned.
186 *
187 * Can only be called from process context (for now).
188 *
189 * Returns 0 on success and an appropriate error value on failure.
190 */
191static inline int rpmsg_send(struct rpmsg_channel *rpdev, void *data, int len)
192{
193 u32 src = rpdev->src, dst = rpdev->dst;
194
195 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
196}
197
198/**
199 * rpmsg_sendto() - send a message across to the remote processor, specify dst
200 * @rpdev: the rpmsg channel
201 * @data: payload of message
202 * @len: length of payload
203 * @dst: destination address
204 *
205 * This function sends @data of length @len to the remote @dst address.
206 * The message will be sent to the remote processor which the @rpdev
207 * channel belongs to, using @rpdev's source address.
208 * In case there are no TX buffers available, the function will block until
209 * one becomes available, or a timeout of 15 seconds elapses. When the latter
210 * happens, -ERESTARTSYS is returned.
211 *
212 * Can only be called from process context (for now).
213 *
214 * Returns 0 on success and an appropriate error value on failure.
215 */
216static inline
217int rpmsg_sendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
218{
219 u32 src = rpdev->src;
220
221 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
222}
223
224/**
225 * rpmsg_send_offchannel() - send a message using explicit src/dst addresses
226 * @rpdev: the rpmsg channel
227 * @src: source address
228 * @dst: destination address
229 * @data: payload of message
230 * @len: length of payload
231 *
232 * This function sends @data of length @len to the remote @dst address,
233 * and uses @src as the source address.
234 * The message will be sent to the remote processor which the @rpdev
235 * channel belongs to.
236 * In case there are no TX buffers available, the function will block until
237 * one becomes available, or a timeout of 15 seconds elapses. When the latter
238 * happens, -ERESTARTSYS is returned.
239 *
240 * Can only be called from process context (for now).
241 *
242 * Returns 0 on success and an appropriate error value on failure.
243 */
244static inline
245int rpmsg_send_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
246 void *data, int len)
247{
248 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
249}
250
251/**
252 * rpmsg_send() - send a message across to the remote processor
253 * @rpdev: the rpmsg channel
254 * @data: payload of message
255 * @len: length of payload
256 *
257 * This function sends @data of length @len on the @rpdev channel.
258 * The message will be sent to the remote processor which the @rpdev
259 * channel belongs to, using @rpdev's source and destination addresses.
260 * In case there are no TX buffers available, the function will immediately
261 * return -ENOMEM without waiting until one becomes available.
262 *
263 * Can only be called from process context (for now).
264 *
265 * Returns 0 on success and an appropriate error value on failure.
266 */
267static inline
268int rpmsg_trysend(struct rpmsg_channel *rpdev, void *data, int len)
269{
270 u32 src = rpdev->src, dst = rpdev->dst;
271
272 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
273}
274
275/**
276 * rpmsg_sendto() - send a message across to the remote processor, specify dst
277 * @rpdev: the rpmsg channel
278 * @data: payload of message
279 * @len: length of payload
280 * @dst: destination address
281 *
282 * This function sends @data of length @len to the remote @dst address.
283 * The message will be sent to the remote processor which the @rpdev
284 * channel belongs to, using @rpdev's source address.
285 * In case there are no TX buffers available, the function will immediately
286 * return -ENOMEM without waiting until one becomes available.
287 *
288 * Can only be called from process context (for now).
289 *
290 * Returns 0 on success and an appropriate error value on failure.
291 */
292static inline
293int rpmsg_trysendto(struct rpmsg_channel *rpdev, void *data, int len, u32 dst)
294{
295 u32 src = rpdev->src;
296
297 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
298}
299
300/**
301 * rpmsg_send_offchannel() - send a message using explicit src/dst addresses
302 * @rpdev: the rpmsg channel
303 * @src: source address
304 * @dst: destination address
305 * @data: payload of message
306 * @len: length of payload
307 *
308 * This function sends @data of length @len to the remote @dst address,
309 * and uses @src as the source address.
310 * The message will be sent to the remote processor which the @rpdev
311 * channel belongs to.
312 * In case there are no TX buffers available, the function will immediately
313 * return -ENOMEM without waiting until one becomes available.
314 *
315 * Can only be called from process context (for now).
316 *
317 * Returns 0 on success and an appropriate error value on failure.
318 */
319static inline
320int rpmsg_trysend_offchannel(struct rpmsg_channel *rpdev, u32 src, u32 dst,
321 void *data, int len)
322{
323 return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
324}
325
326#endif /* _LINUX_RPMSG_H */
diff --git a/include/linux/sa11x0-dma.h b/include/linux/sa11x0-dma.h
new file mode 100644
index 000000000000..65839a58b8e5
--- /dev/null
+++ b/include/linux/sa11x0-dma.h
@@ -0,0 +1,24 @@
1/*
2 * SA11x0 DMA Engine support
3 *
4 * Copyright (C) 2012 Russell King
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_SA11X0_DMA_H
11#define __LINUX_SA11X0_DMA_H
12
13struct dma_chan;
14
15#if defined(CONFIG_DMA_SA11X0) || defined(CONFIG_DMA_SA11X0_MODULE)
16bool sa11x0_dma_filter_fn(struct dma_chan *, void *);
17#else
18static inline bool sa11x0_dma_filter_fn(struct dma_chan *c, void *d)
19{
20 return false;
21}
22#endif
23
24#endif
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 9aaf5bfdad1a..ac9586dadfa5 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -1,10 +1,12 @@
1#ifndef _LINUX_SCATTERLIST_H 1#ifndef _LINUX_SCATTERLIST_H
2#define _LINUX_SCATTERLIST_H 2#define _LINUX_SCATTERLIST_H
3 3
4#include <linux/string.h>
5#include <linux/bug.h>
6#include <linux/mm.h>
7
4#include <asm/types.h> 8#include <asm/types.h>
5#include <asm/scatterlist.h> 9#include <asm/scatterlist.h>
6#include <linux/mm.h>
7#include <linux/string.h>
8#include <asm/io.h> 10#include <asm/io.h>
9 11
10struct sg_table { 12struct sg_table {
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 0657368bd78f..0c3854b0d4b1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -361,6 +361,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout);
361extern signed long schedule_timeout_killable(signed long timeout); 361extern signed long schedule_timeout_killable(signed long timeout);
362extern signed long schedule_timeout_uninterruptible(signed long timeout); 362extern signed long schedule_timeout_uninterruptible(signed long timeout);
363asmlinkage void schedule(void); 363asmlinkage void schedule(void);
364extern void schedule_preempt_disabled(void);
364extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); 365extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);
365 366
366struct nsproxy; 367struct nsproxy;
@@ -552,6 +553,18 @@ struct signal_struct {
552 int group_stop_count; 553 int group_stop_count;
553 unsigned int flags; /* see SIGNAL_* flags below */ 554 unsigned int flags; /* see SIGNAL_* flags below */
554 555
556 /*
557 * PR_SET_CHILD_SUBREAPER marks a process, like a service
558 * manager, to re-parent orphan (double-forking) child processes
559 * to this process instead of 'init'. The service manager is
560 * able to receive SIGCHLD signals and is able to investigate
561 * the process until it calls wait(). All children of this
562 * process will inherit a flag if they should look for a
563 * child_subreaper process at exit.
564 */
565 unsigned int is_child_subreaper:1;
566 unsigned int has_child_subreaper:1;
567
555 /* POSIX.1b Interval Timers */ 568 /* POSIX.1b Interval Timers */
556 struct list_head posix_timers; 569 struct list_head posix_timers;
557 570
@@ -905,6 +918,7 @@ struct sched_group_power {
905 * single CPU. 918 * single CPU.
906 */ 919 */
907 unsigned int power, power_orig; 920 unsigned int power, power_orig;
921 unsigned long next_update;
908 /* 922 /*
909 * Number of busy cpus in this group. 923 * Number of busy cpus in this group.
910 */ 924 */
@@ -1052,6 +1066,8 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag)
1052unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); 1066unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu);
1053unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); 1067unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu);
1054 1068
1069bool cpus_share_cache(int this_cpu, int that_cpu);
1070
1055#else /* CONFIG_SMP */ 1071#else /* CONFIG_SMP */
1056 1072
1057struct sched_domain_attr; 1073struct sched_domain_attr;
@@ -1061,6 +1077,12 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
1061 struct sched_domain_attr *dattr_new) 1077 struct sched_domain_attr *dattr_new)
1062{ 1078{
1063} 1079}
1080
1081static inline bool cpus_share_cache(int this_cpu, int that_cpu)
1082{
1083 return true;
1084}
1085
1064#endif /* !CONFIG_SMP */ 1086#endif /* !CONFIG_SMP */
1065 1087
1066 1088
@@ -1225,6 +1247,12 @@ struct sched_rt_entity {
1225#endif 1247#endif
1226}; 1248};
1227 1249
1250/*
1251 * default timeslice is 100 msecs (used only for SCHED_RR tasks).
1252 * Timeslices get refilled after they expire.
1253 */
1254#define RR_TIMESLICE (100 * HZ / 1000)
1255
1228struct rcu_node; 1256struct rcu_node;
1229 1257
1230enum perf_event_task_context { 1258enum perf_event_task_context {
@@ -1319,6 +1347,11 @@ struct task_struct {
1319 unsigned sched_reset_on_fork:1; 1347 unsigned sched_reset_on_fork:1;
1320 unsigned sched_contributes_to_load:1; 1348 unsigned sched_contributes_to_load:1;
1321 1349
1350#ifdef CONFIG_GENERIC_HARDIRQS
1351 /* IRQ handler threads */
1352 unsigned irq_thread:1;
1353#endif
1354
1322 pid_t pid; 1355 pid_t pid;
1323 pid_t tgid; 1356 pid_t tgid;
1324 1357
@@ -1427,11 +1460,6 @@ struct task_struct {
1427 * mempolicy */ 1460 * mempolicy */
1428 spinlock_t alloc_lock; 1461 spinlock_t alloc_lock;
1429 1462
1430#ifdef CONFIG_GENERIC_HARDIRQS
1431 /* IRQ handler threads */
1432 struct irqaction *irqaction;
1433#endif
1434
1435 /* Protection of the PI data structures: */ 1463 /* Protection of the PI data structures: */
1436 raw_spinlock_t pi_lock; 1464 raw_spinlock_t pi_lock;
1437 1465
@@ -1498,7 +1526,7 @@ struct task_struct {
1498#endif 1526#endif
1499#ifdef CONFIG_CPUSETS 1527#ifdef CONFIG_CPUSETS
1500 nodemask_t mems_allowed; /* Protected by alloc_lock */ 1528 nodemask_t mems_allowed; /* Protected by alloc_lock */
1501 int mems_allowed_change_disable; 1529 seqcount_t mems_allowed_seq; /* Seqence no to catch updates */
1502 int cpuset_mem_spread_rotor; 1530 int cpuset_mem_spread_rotor;
1503 int cpuset_slab_spread_rotor; 1531 int cpuset_slab_spread_rotor;
1504#endif 1532#endif
@@ -1863,8 +1891,7 @@ extern void task_clear_jobctl_pending(struct task_struct *task,
1863#ifdef CONFIG_PREEMPT_RCU 1891#ifdef CONFIG_PREEMPT_RCU
1864 1892
1865#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ 1893#define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */
1866#define RCU_READ_UNLOCK_BOOSTED (1 << 1) /* boosted while in RCU read-side. */ 1894#define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */
1867#define RCU_READ_UNLOCK_NEED_QS (1 << 2) /* RCU core needs CPU response. */
1868 1895
1869static inline void rcu_copy_process(struct task_struct *p) 1896static inline void rcu_copy_process(struct task_struct *p)
1870{ 1897{
@@ -2048,7 +2075,7 @@ extern void sched_autogroup_fork(struct signal_struct *sig);
2048extern void sched_autogroup_exit(struct signal_struct *sig); 2075extern void sched_autogroup_exit(struct signal_struct *sig);
2049#ifdef CONFIG_PROC_FS 2076#ifdef CONFIG_PROC_FS
2050extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); 2077extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m);
2051extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice); 2078extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice);
2052#endif 2079#endif
2053#else 2080#else
2054static inline void sched_autogroup_create_attach(struct task_struct *p) { } 2081static inline void sched_autogroup_create_attach(struct task_struct *p) { }
@@ -2065,12 +2092,20 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice;
2065extern int rt_mutex_getprio(struct task_struct *p); 2092extern int rt_mutex_getprio(struct task_struct *p);
2066extern void rt_mutex_setprio(struct task_struct *p, int prio); 2093extern void rt_mutex_setprio(struct task_struct *p, int prio);
2067extern void rt_mutex_adjust_pi(struct task_struct *p); 2094extern void rt_mutex_adjust_pi(struct task_struct *p);
2095static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2096{
2097 return tsk->pi_blocked_on != NULL;
2098}
2068#else 2099#else
2069static inline int rt_mutex_getprio(struct task_struct *p) 2100static inline int rt_mutex_getprio(struct task_struct *p)
2070{ 2101{
2071 return p->normal_prio; 2102 return p->normal_prio;
2072} 2103}
2073# define rt_mutex_adjust_pi(p) do { } while (0) 2104# define rt_mutex_adjust_pi(p) do { } while (0)
2105static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2106{
2107 return false;
2108}
2074#endif 2109#endif
2075 2110
2076extern bool yield_to(struct task_struct *p, bool preempt); 2111extern bool yield_to(struct task_struct *p, bool preempt);
@@ -2389,12 +2424,15 @@ static inline void task_unlock(struct task_struct *p)
2389extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, 2424extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
2390 unsigned long *flags); 2425 unsigned long *flags);
2391 2426
2392#define lock_task_sighand(tsk, flags) \ 2427static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
2393({ struct sighand_struct *__ss; \ 2428 unsigned long *flags)
2394 __cond_lock(&(tsk)->sighand->siglock, \ 2429{
2395 (__ss = __lock_task_sighand(tsk, flags))); \ 2430 struct sighand_struct *ret;
2396 __ss; \ 2431
2397}) \ 2432 ret = __lock_task_sighand(tsk, flags);
2433 (void)__cond_lock(&tsk->sighand->siglock, ret);
2434 return ret;
2435}
2398 2436
2399static inline void unlock_task_sighand(struct task_struct *tsk, 2437static inline void unlock_task_sighand(struct task_struct *tsk,
2400 unsigned long *flags) 2438 unsigned long *flags)
diff --git a/include/linux/security.h b/include/linux/security.h
index 83c18e8c846d..673afbb8238a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -22,22 +22,36 @@
22#ifndef __LINUX_SECURITY_H 22#ifndef __LINUX_SECURITY_H
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h>
26#include <linux/fsnotify.h>
27#include <linux/binfmts.h>
28#include <linux/dcache.h>
29#include <linux/signal.h>
30#include <linux/resource.h>
31#include <linux/sem.h>
32#include <linux/shm.h>
33#include <linux/mm.h> /* PAGE_ALIGN */
34#include <linux/msg.h>
35#include <linux/sched.h>
36#include <linux/key.h> 25#include <linux/key.h>
37#include <linux/xfrm.h> 26#include <linux/capability.h>
38#include <linux/slab.h> 27#include <linux/slab.h>
39#include <linux/xattr.h> 28#include <linux/err.h>
40#include <net/flow.h> 29
30struct linux_binprm;
31struct cred;
32struct rlimit;
33struct siginfo;
34struct sem_array;
35struct sembuf;
36struct kern_ipc_perm;
37struct audit_context;
38struct super_block;
39struct inode;
40struct dentry;
41struct file;
42struct vfsmount;
43struct path;
44struct qstr;
45struct nameidata;
46struct iattr;
47struct fown_struct;
48struct file_operations;
49struct shmid_kernel;
50struct msg_msg;
51struct msg_queue;
52struct xattr;
53struct xfrm_sec_ctx;
54struct mm_struct;
41 55
42/* Maximum number of letters for an LSM name string */ 56/* Maximum number of letters for an LSM name string */
43#define SECURITY_NAME_MAX 10 57#define SECURITY_NAME_MAX 10
@@ -49,6 +63,7 @@
49struct ctl_table; 63struct ctl_table;
50struct audit_krule; 64struct audit_krule;
51struct user_namespace; 65struct user_namespace;
66struct timezone;
52 67
53/* 68/*
54 * These functions are in security/capability.c and are used 69 * These functions are in security/capability.c and are used
@@ -131,18 +146,6 @@ struct request_sock;
131#define LSM_UNSAFE_PTRACE_CAP 4 146#define LSM_UNSAFE_PTRACE_CAP 4
132 147
133#ifdef CONFIG_MMU 148#ifdef CONFIG_MMU
134/*
135 * If a hint addr is less than mmap_min_addr change hint to be as
136 * low as possible but still greater than mmap_min_addr
137 */
138static inline unsigned long round_hint_to_min(unsigned long hint)
139{
140 hint &= PAGE_MASK;
141 if (((void *)hint != NULL) &&
142 (hint < mmap_min_addr))
143 return PAGE_ALIGN(mmap_min_addr);
144 return hint;
145}
146extern int mmap_min_addr_handler(struct ctl_table *table, int write, 149extern int mmap_min_addr_handler(struct ctl_table *table, int write,
147 void __user *buffer, size_t *lenp, loff_t *ppos); 150 void __user *buffer, size_t *lenp, loff_t *ppos);
148#endif 151#endif
@@ -651,6 +654,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
651 * manual page for definitions of the @clone_flags. 654 * manual page for definitions of the @clone_flags.
652 * @clone_flags contains the flags indicating what should be shared. 655 * @clone_flags contains the flags indicating what should be shared.
653 * Return 0 if permission is granted. 656 * Return 0 if permission is granted.
657 * @task_free:
658 * @task task being freed
659 * Handle release of task-related resources. (Note that this can be called
660 * from interrupt context.)
654 * @cred_alloc_blank: 661 * @cred_alloc_blank:
655 * @cred points to the credentials. 662 * @cred points to the credentials.
656 * @gfp indicates the atomicity of any memory allocations. 663 * @gfp indicates the atomicity of any memory allocations.
@@ -812,7 +819,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
812 * Check permissions before connecting or sending datagrams from @sock to 819 * Check permissions before connecting or sending datagrams from @sock to
813 * @other. 820 * @other.
814 * @sock contains the socket structure. 821 * @sock contains the socket structure.
815 * @sock contains the peer socket structure. 822 * @other contains the peer socket structure.
816 * Return 0 if permission is granted. 823 * Return 0 if permission is granted.
817 * 824 *
818 * The @unix_stream_connect and @unix_may_send hooks were necessary because 825 * The @unix_stream_connect and @unix_may_send hooks were necessary because
@@ -1493,6 +1500,7 @@ struct security_operations {
1493 int (*dentry_open) (struct file *file, const struct cred *cred); 1500 int (*dentry_open) (struct file *file, const struct cred *cred);
1494 1501
1495 int (*task_create) (unsigned long clone_flags); 1502 int (*task_create) (unsigned long clone_flags);
1503 void (*task_free) (struct task_struct *task);
1496 int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); 1504 int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp);
1497 void (*cred_free) (struct cred *cred); 1505 void (*cred_free) (struct cred *cred);
1498 int (*cred_prepare)(struct cred *new, const struct cred *old, 1506 int (*cred_prepare)(struct cred *new, const struct cred *old,
@@ -1674,9 +1682,7 @@ int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1674int security_quota_on(struct dentry *dentry); 1682int security_quota_on(struct dentry *dentry);
1675int security_syslog(int type); 1683int security_syslog(int type);
1676int security_settime(const struct timespec *ts, const struct timezone *tz); 1684int security_settime(const struct timespec *ts, const struct timezone *tz);
1677int security_vm_enough_memory(long pages);
1678int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1685int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1679int security_vm_enough_memory_kern(long pages);
1680int security_bprm_set_creds(struct linux_binprm *bprm); 1686int security_bprm_set_creds(struct linux_binprm *bprm);
1681int security_bprm_check(struct linux_binprm *bprm); 1687int security_bprm_check(struct linux_binprm *bprm);
1682void security_bprm_committing_creds(struct linux_binprm *bprm); 1688void security_bprm_committing_creds(struct linux_binprm *bprm);
@@ -1752,6 +1758,7 @@ int security_file_send_sigiotask(struct task_struct *tsk,
1752int security_file_receive(struct file *file); 1758int security_file_receive(struct file *file);
1753int security_dentry_open(struct file *file, const struct cred *cred); 1759int security_dentry_open(struct file *file, const struct cred *cred);
1754int security_task_create(unsigned long clone_flags); 1760int security_task_create(unsigned long clone_flags);
1761void security_task_free(struct task_struct *task);
1755int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1762int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1756void security_cred_free(struct cred *cred); 1763void security_cred_free(struct cred *cred);
1757int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1764int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
@@ -1896,25 +1903,11 @@ static inline int security_settime(const struct timespec *ts,
1896 return cap_settime(ts, tz); 1903 return cap_settime(ts, tz);
1897} 1904}
1898 1905
1899static inline int security_vm_enough_memory(long pages)
1900{
1901 WARN_ON(current->mm == NULL);
1902 return cap_vm_enough_memory(current->mm, pages);
1903}
1904
1905static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) 1906static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1906{ 1907{
1907 WARN_ON(mm == NULL);
1908 return cap_vm_enough_memory(mm, pages); 1908 return cap_vm_enough_memory(mm, pages);
1909} 1909}
1910 1910
1911static inline int security_vm_enough_memory_kern(long pages)
1912{
1913 /* If current->mm is a kernel thread then we will pass NULL,
1914 for this specific case that is fine */
1915 return cap_vm_enough_memory(current->mm, pages);
1916}
1917
1918static inline int security_bprm_set_creds(struct linux_binprm *bprm) 1911static inline int security_bprm_set_creds(struct linux_binprm *bprm)
1919{ 1912{
1920 return cap_bprm_set_creds(bprm); 1913 return cap_bprm_set_creds(bprm);
@@ -2245,6 +2238,9 @@ static inline int security_task_create(unsigned long clone_flags)
2245 return 0; 2238 return 0;
2246} 2239}
2247 2240
2241static inline void security_task_free(struct task_struct *task)
2242{ }
2243
2248static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) 2244static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp)
2249{ 2245{
2250 return 0; 2246 return 0;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 44f1514b00ba..fc61854f6224 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/bug.h>
6#include <linux/mutex.h> 7#include <linux/mutex.h>
7#include <linux/cpumask.h> 8#include <linux/cpumask.h>
8#include <linux/nodemask.h> 9#include <linux/nodemask.h>
@@ -121,9 +122,12 @@ int single_release(struct inode *, struct file *);
121void *__seq_open_private(struct file *, const struct seq_operations *, int); 122void *__seq_open_private(struct file *, const struct seq_operations *, int);
122int seq_open_private(struct file *, const struct seq_operations *, int); 123int seq_open_private(struct file *, const struct seq_operations *, int);
123int seq_release_private(struct inode *, struct file *); 124int seq_release_private(struct inode *, struct file *);
125int seq_put_decimal_ull(struct seq_file *m, char delimiter,
126 unsigned long long num);
127int seq_put_decimal_ll(struct seq_file *m, char delimiter,
128 long long num);
124 129
125#define SEQ_START_TOKEN ((void *)1) 130#define SEQ_START_TOKEN ((void *)1)
126
127/* 131/*
128 * Helpers for iteration over list_head-s in seq_files 132 * Helpers for iteration over list_head-s in seq_files
129 */ 133 */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 3d86517fe7d5..441980ecc4e5 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -152,8 +152,8 @@ struct serial_uart_config {
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 153
154#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) 154#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 155#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 156 ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
158#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) 158#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
159#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) 159#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
deleted file mode 100644
index e811a615f696..000000000000
--- a/include/linux/serialP.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * Private header file for the (dumb) serial driver
3 *
4 * Copyright (C) 1997 by Theodore Ts'o.
5 *
6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL)
8 */
9
10#ifndef _LINUX_SERIALP_H
11#define _LINUX_SERIALP_H
12
13/*
14 * This is our internal structure for each serial port's state.
15 *
16 * Many fields are paralleled by the structure used by the serial_struct
17 * structure.
18 *
19 * For definitions of the flags field, see tty.h
20 */
21
22#include <linux/termios.h>
23#include <linux/workqueue.h>
24#include <linux/interrupt.h>
25#include <linux/circ_buf.h>
26#include <linux/wait.h>
27
28struct serial_state {
29 int magic;
30 int baud_base;
31 unsigned long port;
32 int irq;
33 int flags;
34 int hub6;
35 int type;
36 int line;
37 int revision; /* Chip revision (950) */
38 int xmit_fifo_size;
39 int custom_divisor;
40 int count;
41 u8 *iomem_base;
42 u16 iomem_reg_shift;
43 unsigned short close_delay;
44 unsigned short closing_wait; /* time to wait before closing */
45 struct async_icount icount;
46 int io_type;
47 struct async_struct *info;
48 struct pci_dev *dev;
49};
50
51struct async_struct {
52 int magic;
53 unsigned long port;
54 int hub6;
55 int flags;
56 int xmit_fifo_size;
57 struct serial_state *state;
58 struct tty_struct *tty;
59 int read_status_mask;
60 int ignore_status_mask;
61 int timeout;
62 int quot;
63 int x_char; /* xon/xoff character */
64 int close_delay;
65 unsigned short closing_wait;
66 unsigned short closing_wait2; /* obsolete */
67 int IER; /* Interrupt Enable Register */
68 int MCR; /* Modem control register */
69 int LCR; /* Line control register */
70 int ACR; /* 16950 Additional Control Reg. */
71 unsigned long event;
72 unsigned long last_active;
73 int line;
74 int blocked_open; /* # of blocked opens */
75 struct circ_buf xmit;
76 spinlock_t xmit_lock;
77 u8 *iomem_base;
78 u16 iomem_reg_shift;
79 int io_type;
80 struct work_struct work;
81 struct tasklet_struct tlet;
82#ifdef DECLARE_WAITQUEUE
83 wait_queue_head_t open_wait;
84 wait_queue_head_t close_wait;
85 wait_queue_head_t delta_msr_wait;
86#else
87 struct wait_queue *open_wait;
88 struct wait_queue *close_wait;
89 struct wait_queue *delta_msr_wait;
90#endif
91 struct async_struct *next_port; /* For the linked list */
92 struct async_struct *prev_port;
93};
94
95#define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
96
97#define SERIAL_MAGIC 0x5301
98#define SSTATE_MAGIC 0x5302
99
100/*
101 * Events are used to schedule things to happen at timer-interrupt
102 * time, instead of at rs interrupt time.
103 */
104#define RS_EVENT_WRITE_WAKEUP 0
105
106/*
107 * Multiport serial configuration structure --- internal structure
108 */
109struct rs_multiport_struct {
110 int port1;
111 unsigned char mask1, match1;
112 int port2;
113 unsigned char mask2, match2;
114 int port3;
115 unsigned char mask3, match3;
116 int port4;
117 unsigned char mask4, match4;
118 int port_monitor;
119};
120
121#if defined(__alpha__) && !defined(CONFIG_PCI)
122/*
123 * Digital did something really horribly wrong with the OUT1 and OUT2
124 * lines on at least some ALPHA's. The failure mode is that if either
125 * is cleared, the machine locks up with endless interrupts.
126 *
127 * This is still used by arch/mips/au1000/common/serial.c for some weird
128 * reason (mips != alpha!)
129 */
130#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
131#elif defined(CONFIG_SBC8560)
132/*
133 * WindRiver did something similarly broken on their SBC8560 board. The
134 * UART tristates its IRQ output while OUT2 is clear, but they pulled
135 * the interrupt line _up_ instead of down, so if we register the IRQ
136 * while the UART is in that state, we die in an IRQ storm. */
137#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2)
138#else
139#define ALPHA_KLUDGE_MCR 0
140#endif
141
142#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c91ace70c21d..f51bf2e70c69 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -210,6 +210,8 @@
210/* Atheros AR933X SoC */ 210/* Atheros AR933X SoC */
211#define PORT_AR933X 99 211#define PORT_AR933X 99
212 212
213/* Energy Micro efm32 SoC */
214#define PORT_EFMUART 100
213 215
214#ifdef __KERNEL__ 216#ifdef __KERNEL__
215 217
@@ -381,6 +383,16 @@ struct uart_port {
381 void *private_data; /* generic platform data pointer */ 383 void *private_data; /* generic platform data pointer */
382}; 384};
383 385
386static inline int serial_port_in(struct uart_port *up, int offset)
387{
388 return up->serial_in(up, offset);
389}
390
391static inline void serial_port_out(struct uart_port *up, int offset, int value)
392{
393 up->serial_out(up, offset, value);
394}
395
384/* 396/*
385 * This is the state information which is persistent across opens. 397 * This is the state information which is persistent across opens.
386 */ 398 */
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h
index de6c19c7f340..79ad87b0be3e 100644
--- a/include/linux/serial_pnx8xxx.h
+++ b/include/linux/serial_pnx8xxx.h
@@ -20,7 +20,6 @@
20#define _LINUX_SERIAL_PNX8XXX_H 20#define _LINUX_SERIAL_PNX8XXX_H
21 21
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/device.h>
24 23
25#define PNX8XXX_NR_PORTS 2 24#define PNX8XXX_NR_PORTS 2
26 25
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 54341d811685..0a9d8f2ac519 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -18,7 +18,8 @@ struct clk_mapping {
18 struct kref ref; 18 struct kref ref;
19}; 19};
20 20
21struct clk_ops { 21
22struct sh_clk_ops {
22#ifdef CONFIG_SH_CLK_CPG_LEGACY 23#ifdef CONFIG_SH_CLK_CPG_LEGACY
23 void (*init)(struct clk *clk); 24 void (*init)(struct clk *clk);
24#endif 25#endif
@@ -37,7 +38,7 @@ struct clk {
37 unsigned short parent_num; /* choose between */ 38 unsigned short parent_num; /* choose between */
38 unsigned char src_shift; /* source clock field in the */ 39 unsigned char src_shift; /* source clock field in the */
39 unsigned char src_width; /* configuration register */ 40 unsigned char src_width; /* configuration register */
40 struct clk_ops *ops; 41 struct sh_clk_ops *ops;
41 42
42 struct list_head children; 43 struct list_head children;
43 struct list_head sibling; /* node for children */ 44 struct list_head sibling; /* node for children */
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
index 2076acf8294d..b17d765ded84 100644
--- a/include/linux/sh_eth.h
+++ b/include/linux/sh_eth.h
@@ -20,6 +20,7 @@ struct sh_eth_plat_data {
20 unsigned char mac_addr[6]; 20 unsigned char mac_addr[6];
21 unsigned no_ether_link:1; 21 unsigned no_ether_link:1;
22 unsigned ether_link_active_low:1; 22 unsigned ether_link_active_low:1;
23 unsigned needs_init:1;
23}; 24};
24 25
25#endif 26#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ae86adee3746..192250bd49f5 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -18,6 +18,7 @@
18#include <linux/kmemcheck.h> 18#include <linux/kmemcheck.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/bug.h>
21#include <linux/cache.h> 22#include <linux/cache.h>
22 23
23#include <linux/atomic.h> 24#include <linux/atomic.h>
@@ -94,6 +95,13 @@
94 * about CHECKSUM_UNNECESSARY. 8) 95 * about CHECKSUM_UNNECESSARY. 8)
95 * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. 96 * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead.
96 * 97 *
98 * UNNECESSARY: device will do per protocol specific csum. Protocol drivers
99 * that do not want net to perform the checksum calculation should use
100 * this flag in their outgoing skbs.
101 * NETIF_F_FCOE_CRC this indicates the device can do FCoE FC CRC
102 * offload. Correspondingly, the FCoE protocol driver
103 * stack should use CHECKSUM_UNNECESSARY.
104 *
97 * Any questions? No questions, good. --ANK 105 * Any questions? No questions, good. --ANK
98 */ 106 */
99 107
@@ -361,6 +369,7 @@ typedef unsigned char *sk_buff_data_t;
361 * ports. 369 * ports.
362 * @wifi_acked_valid: wifi_acked was set 370 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not 371 * @wifi_acked: whether frame was acked on wifi or not
372 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
364 * @dma_cookie: a cookie to one of several possible DMA operations 373 * @dma_cookie: a cookie to one of several possible DMA operations
365 * done by skb DMA functions 374 * done by skb DMA functions
366 * @secmark: security marking 375 * @secmark: security marking
@@ -438,6 +447,11 @@ struct sk_buff {
438#endif 447#endif
439 448
440 int skb_iif; 449 int skb_iif;
450
451 __u32 rxhash;
452
453 __u16 vlan_tci;
454
441#ifdef CONFIG_NET_SCHED 455#ifdef CONFIG_NET_SCHED
442 __u16 tc_index; /* traffic control index */ 456 __u16 tc_index; /* traffic control index */
443#ifdef CONFIG_NET_CLS_ACT 457#ifdef CONFIG_NET_CLS_ACT
@@ -445,8 +459,6 @@ struct sk_buff {
445#endif 459#endif
446#endif 460#endif
447 461
448 __u32 rxhash;
449
450 __u16 queue_mapping; 462 __u16 queue_mapping;
451 kmemcheck_bitfield_begin(flags2); 463 kmemcheck_bitfield_begin(flags2);
452#ifdef CONFIG_IPV6_NDISC_NODETYPE 464#ifdef CONFIG_IPV6_NDISC_NODETYPE
@@ -456,7 +468,8 @@ struct sk_buff {
456 __u8 l4_rxhash:1; 468 __u8 l4_rxhash:1;
457 __u8 wifi_acked_valid:1; 469 __u8 wifi_acked_valid:1;
458 __u8 wifi_acked:1; 470 __u8 wifi_acked:1;
459 /* 10/12 bit hole (depending on ndisc_nodetype presence) */ 471 __u8 no_fcs:1;
472 /* 9/11 bit hole (depending on ndisc_nodetype presence) */
460 kmemcheck_bitfield_end(flags2); 473 kmemcheck_bitfield_end(flags2);
461 474
462#ifdef CONFIG_NET_DMA 475#ifdef CONFIG_NET_DMA
@@ -470,8 +483,6 @@ struct sk_buff {
470 __u32 dropcount; 483 __u32 dropcount;
471 }; 484 };
472 485
473 __u16 vlan_tci;
474
475 sk_buff_data_t transport_header; 486 sk_buff_data_t transport_header;
476 sk_buff_data_t network_header; 487 sk_buff_data_t network_header;
477 sk_buff_data_t mac_header; 488 sk_buff_data_t mac_header;
@@ -876,6 +887,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
876} 887}
877 888
878/** 889/**
890 * skb_peek_next - peek skb following the given one from a queue
891 * @skb: skb to start from
892 * @list_: list to peek at
893 *
894 * Returns %NULL when the end of the list is met or a pointer to the
895 * next element. The reference count is not incremented and the
896 * reference is therefore volatile. Use with caution.
897 */
898static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
899 const struct sk_buff_head *list_)
900{
901 struct sk_buff *next = skb->next;
902 if (next == (struct sk_buff *)list_)
903 next = NULL;
904 return next;
905}
906
907/**
879 * skb_peek_tail - peek at the tail of an &sk_buff_head 908 * skb_peek_tail - peek at the tail of an &sk_buff_head
880 * @list_: list to peek at 909 * @list_: list to peek at
881 * 910 *
@@ -1152,7 +1181,7 @@ static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list)
1152} 1181}
1153 1182
1154 1183
1155static inline int skb_is_nonlinear(const struct sk_buff *skb) 1184static inline bool skb_is_nonlinear(const struct sk_buff *skb)
1156{ 1185{
1157 return skb->data_len; 1186 return skb->data_len;
1158} 1187}
@@ -1216,7 +1245,7 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
1216} 1245}
1217 1246
1218extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, 1247extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1219 int off, int size); 1248 int off, int size, unsigned int truesize);
1220 1249
1221#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1250#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1222#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) 1251#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb))
@@ -2055,7 +2084,7 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
2055 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) 2084 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2056 2085
2057extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 2086extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
2058 int *peeked, int *err); 2087 int *peeked, int *off, int *err);
2059extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 2088extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
2060 int noblock, int *err); 2089 int noblock, int *err);
2061extern unsigned int datagram_poll(struct file *file, struct socket *sock, 2090extern unsigned int datagram_poll(struct file *file, struct socket *sock,
@@ -2448,12 +2477,12 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2448} 2477}
2449#endif 2478#endif
2450 2479
2451static inline int skb_is_gso(const struct sk_buff *skb) 2480static inline bool skb_is_gso(const struct sk_buff *skb)
2452{ 2481{
2453 return skb_shinfo(skb)->gso_size; 2482 return skb_shinfo(skb)->gso_size;
2454} 2483}
2455 2484
2456static inline int skb_is_gso_v6(const struct sk_buff *skb) 2485static inline bool skb_is_gso_v6(const struct sk_buff *skb)
2457{ 2486{
2458 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; 2487 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
2459} 2488}
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a32bcfdc7834..ca122b36aec1 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/bug.h>
11#include <linux/workqueue.h> 12#include <linux/workqueue.h>
12#include <linux/kobject.h> 13#include <linux/kobject.h>
13 14
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index c1241c428179..2e68f5ba0389 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -232,6 +232,8 @@ enum
232 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ 232 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */
233 LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ 233 LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */
234 LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ 234 LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */
235 LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */
236 LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */
235 __LINUX_MIB_MAX 237 __LINUX_MIB_MAX
236}; 238};
237 239
diff --git a/include/linux/socket.h b/include/linux/socket.h
index d0e77f607a79..da2d3e2543f3 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -326,11 +326,11 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
326 int offset, 326 int offset,
327 unsigned int len, __wsum *csump); 327 unsigned int len, __wsum *csump);
328 328
329extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 329extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
330extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 330extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
331extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 331extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
332 int offset, int len); 332 int offset, int len);
333extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); 333extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
334extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 334extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
335 335
336struct timespec; 336struct timespec;
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 0f4eb165f254..32be8dbdf191 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -1,10 +1,10 @@
1#ifndef __LINUX_SPI_MMC_SPI_H 1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H 2#define __LINUX_SPI_MMC_SPI_H
3 3
4#include <linux/device.h>
5#include <linux/spi/spi.h> 4#include <linux/spi/spi.h>
6#include <linux/interrupt.h> 5#include <linux/interrupt.h>
7 6
7struct device;
8struct mmc_host; 8struct mmc_host;
9 9
10/* Put this in platform_data of a device being used to manage an MMC/SD 10/* Put this in platform_data of a device being used to manage an MMC/SD
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
index decf6d8c77b7..b4d9fa6f797c 100644
--- a/include/linux/spi/orion_spi.h
+++ b/include/linux/spi/orion_spi.h
@@ -11,7 +11,6 @@
11 11
12struct orion_spi_info { 12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */ 13 u32 tclk; /* no <linux/clk.h> support yet */
14 u32 enable_clock_fix;
15}; 14};
16 15
17 16
diff --git a/include/linux/spi/s3c24xx.h b/include/linux/spi/s3c24xx.h
new file mode 100644
index 000000000000..c23b923e493b
--- /dev/null
+++ b/include/linux/spi/s3c24xx.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (c) 2006 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * S3C2410 - SPI Controller platform_device info
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __LINUX_SPI_S3C24XX_H
13#define __LINUX_SPI_S3C24XX_H __FILE__
14
15struct s3c2410_spi_info {
16 int pin_cs; /* simple gpio cs */
17 unsigned int num_cs; /* total chipselects */
18 int bus_num; /* bus number to use. */
19
20 unsigned int use_fiq:1; /* use fiq */
21
22 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
23 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
24};
25
26#endif /* __LINUX_SPI_S3C24XX_H */
diff --git a/include/linux/spi/sh_hspi.h b/include/linux/spi/sh_hspi.h
new file mode 100644
index 000000000000..a1121f872ac1
--- /dev/null
+++ b/include/linux/spi/sh_hspi.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2011 Kuninori Morimoto
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; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17#ifndef SH_HSPI_H
18#define SH_HSPI_H
19
20struct sh_hspi_info {
21};
22
23#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 176fce9cc6b1..98679b061b63 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -22,6 +22,7 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h>
25 26
26/* 27/*
27 * INTERFACES between SPI master-side drivers and SPI infrastructure. 28 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -235,6 +236,27 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
235 * the device whose settings are being modified. 236 * the device whose settings are being modified.
236 * @transfer: adds a message to the controller's transfer queue. 237 * @transfer: adds a message to the controller's transfer queue.
237 * @cleanup: frees controller-specific state 238 * @cleanup: frees controller-specific state
239 * @queued: whether this master is providing an internal message queue
240 * @kworker: thread struct for message pump
241 * @kworker_task: pointer to task for message pump kworker thread
242 * @pump_messages: work struct for scheduling work to the message pump
243 * @queue_lock: spinlock to syncronise access to message queue
244 * @queue: message queue
245 * @cur_msg: the currently in-flight message
246 * @busy: message pump is busy
247 * @running: message pump is running
248 * @rt: whether this queue is set to run as a realtime task
249 * @prepare_transfer_hardware: a message will soon arrive from the queue
250 * so the subsystem requests the driver to prepare the transfer hardware
251 * by issuing this call
252 * @transfer_one_message: the subsystem calls the driver to transfer a single
253 * message while queuing transfers that arrive in the meantime. When the
254 * driver is finished with this message, it must call
255 * spi_finalize_current_message() so the subsystem can issue the next
256 * transfer
257 * @prepare_transfer_hardware: there are currently no more messages on the
258 * queue so the subsystem notifies the driver that it may relax the
259 * hardware by issuing this call
238 * 260 *
239 * Each SPI master controller can communicate with one or more @spi_device 261 * Each SPI master controller can communicate with one or more @spi_device
240 * children. These make a small bus, sharing MOSI, MISO and SCK signals 262 * children. These make a small bus, sharing MOSI, MISO and SCK signals
@@ -318,6 +340,28 @@ struct spi_master {
318 340
319 /* called on release() to free memory provided by spi_master */ 341 /* called on release() to free memory provided by spi_master */
320 void (*cleanup)(struct spi_device *spi); 342 void (*cleanup)(struct spi_device *spi);
343
344 /*
345 * These hooks are for drivers that want to use the generic
346 * master transfer queueing mechanism. If these are used, the
347 * transfer() function above must NOT be specified by the driver.
348 * Over time we expect SPI drivers to be phased over to this API.
349 */
350 bool queued;
351 struct kthread_worker kworker;
352 struct task_struct *kworker_task;
353 struct kthread_work pump_messages;
354 spinlock_t queue_lock;
355 struct list_head queue;
356 struct spi_message *cur_msg;
357 bool busy;
358 bool running;
359 bool rt;
360
361 int (*prepare_transfer_hardware)(struct spi_master *master);
362 int (*transfer_one_message)(struct spi_master *master,
363 struct spi_message *mesg);
364 int (*unprepare_transfer_hardware)(struct spi_master *master);
321}; 365};
322 366
323static inline void *spi_master_get_devdata(struct spi_master *master) 367static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -343,6 +387,13 @@ static inline void spi_master_put(struct spi_master *master)
343 put_device(&master->dev); 387 put_device(&master->dev);
344} 388}
345 389
390/* PM calls that need to be issued by the driver */
391extern int spi_master_suspend(struct spi_master *master);
392extern int spi_master_resume(struct spi_master *master);
393
394/* Calls the driver make to interact with the message queue */
395extern struct spi_message *spi_get_next_queued_message(struct spi_master *master);
396extern void spi_finalize_current_message(struct spi_master *master);
346 397
347/* the spi driver core manages memory for the spi_master classdev */ 398/* the spi driver core manages memory for the spi_master classdev */
348extern struct spi_master * 399extern struct spi_master *
@@ -549,7 +600,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags
549 + ntrans * sizeof(struct spi_transfer), 600 + ntrans * sizeof(struct spi_transfer),
550 flags); 601 flags);
551 if (m) { 602 if (m) {
552 int i; 603 unsigned i;
553 struct spi_transfer *t = (struct spi_transfer *)(m + 1); 604 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
554 605
555 INIT_LIST_HEAD(&m->transfers); 606 INIT_LIST_HEAD(&m->transfers);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 7df6c17b0281..363239087263 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -375,10 +375,7 @@ static inline int spin_can_lock(spinlock_t *lock)
375 return raw_spin_can_lock(&lock->rlock); 375 return raw_spin_can_lock(&lock->rlock);
376} 376}
377 377
378static inline void assert_spin_locked(spinlock_t *lock) 378#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
379{
380 assert_raw_spin_locked(&lock->rlock);
381}
382 379
383/* 380/*
384 * Pull the atomic_t declaration: 381 * Pull the atomic_t declaration:
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index e1b005918bbb..d3d5fa54f25e 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -99,15 +99,18 @@ long srcu_batches_completed(struct srcu_struct *sp);
99 * power mode. This way we can notice an extended quiescent state to 99 * power mode. This way we can notice an extended quiescent state to
100 * other CPUs that started a grace period. Otherwise we would delay any 100 * other CPUs that started a grace period. Otherwise we would delay any
101 * grace period as long as we run in the idle task. 101 * grace period as long as we run in the idle task.
102 *
103 * Similarly, we avoid claiming an SRCU read lock held if the current
104 * CPU is offline.
102 */ 105 */
103static inline int srcu_read_lock_held(struct srcu_struct *sp) 106static inline int srcu_read_lock_held(struct srcu_struct *sp)
104{ 107{
105 if (rcu_is_cpu_idle())
106 return 0;
107
108 if (!debug_lockdep_rcu_enabled()) 108 if (!debug_lockdep_rcu_enabled())
109 return 1; 109 return 1;
110 110 if (rcu_is_cpu_idle())
111 return 0;
112 if (!rcu_lockdep_current_cpu_online())
113 return 0;
111 return lock_is_held(&sp->dep_map); 114 return lock_is_held(&sp->dep_map);
112} 115}
113 116
@@ -169,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
169 int retval = __srcu_read_lock(sp); 172 int retval = __srcu_read_lock(sp);
170 173
171 rcu_lock_acquire(&(sp)->dep_map); 174 rcu_lock_acquire(&(sp)->dep_map);
175 rcu_lockdep_assert(!rcu_is_cpu_idle(),
176 "srcu_read_lock() used illegally while idle");
172 return retval; 177 return retval;
173} 178}
174 179
@@ -182,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
182static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) 187static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
183 __releases(sp) 188 __releases(sp)
184{ 189{
190 rcu_lockdep_assert(!rcu_is_cpu_idle(),
191 "srcu_read_unlock() used illegally while idle");
185 rcu_lock_release(&(sp)->dep_map); 192 rcu_lock_release(&(sp)->dep_map);
186 __srcu_read_unlock(sp, idx); 193 __srcu_read_unlock(sp, idx);
187} 194}
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index dcf35b0f303a..d27683180025 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -16,6 +16,12 @@ struct pcmcia_device;
16struct ssb_bus; 16struct ssb_bus;
17struct ssb_driver; 17struct ssb_driver;
18 18
19struct ssb_sprom_core_pwr_info {
20 u8 itssi_2g, itssi_5g;
21 u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh;
22 u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4];
23};
24
19struct ssb_sprom { 25struct ssb_sprom {
20 u8 revision; 26 u8 revision;
21 u8 il0mac[6]; /* MAC address for 802.11b/g */ 27 u8 il0mac[6]; /* MAC address for 802.11b/g */
@@ -26,9 +32,12 @@ struct ssb_sprom {
26 u8 et0mdcport; /* MDIO for enet0 */ 32 u8 et0mdcport; /* MDIO for enet0 */
27 u8 et1mdcport; /* MDIO for enet1 */ 33 u8 et1mdcport; /* MDIO for enet1 */
28 u16 board_rev; /* Board revision number from SPROM. */ 34 u16 board_rev; /* Board revision number from SPROM. */
35 u16 board_num; /* Board number from SPROM. */
36 u16 board_type; /* Board type from SPROM. */
29 u8 country_code; /* Country Code */ 37 u8 country_code; /* Country Code */
30 u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */ 38 char alpha2[2]; /* Country Code as two chars like EU or US */
31 u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ 39 u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */
40 u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */
32 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ 41 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
33 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ 42 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
34 u16 pa0b0; 43 u16 pa0b0;
@@ -47,10 +56,10 @@ struct ssb_sprom {
47 u8 gpio1; /* GPIO pin 1 */ 56 u8 gpio1; /* GPIO pin 1 */
48 u8 gpio2; /* GPIO pin 2 */ 57 u8 gpio2; /* GPIO pin 2 */
49 u8 gpio3; /* GPIO pin 3 */ 58 u8 gpio3; /* GPIO pin 3 */
50 u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ 59 u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */
51 u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ 60 u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */
52 u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ 61 u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */
53 u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ 62 u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */
54 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 63 u8 itssi_a; /* Idle TSSI Target for A-PHY */
55 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 64 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
56 u8 tri2g; /* 2.4GHz TX isolation */ 65 u8 tri2g; /* 2.4GHz TX isolation */
@@ -61,8 +70,8 @@ struct ssb_sprom {
61 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ 70 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
62 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ 71 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
63 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ 72 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
64 u8 rxpo2g; /* 2GHz RX power offset */ 73 s8 rxpo2g; /* 2GHz RX power offset */
65 u8 rxpo5g; /* 5GHz RX power offset */ 74 s8 rxpo5g; /* 5GHz RX power offset */
66 u8 rssisav2g; /* 2GHz RSSI params */ 75 u8 rssisav2g; /* 2GHz RSSI params */
67 u8 rssismc2g; 76 u8 rssismc2g;
68 u8 rssismf2g; 77 u8 rssismf2g;
@@ -82,16 +91,13 @@ struct ssb_sprom {
82 u16 boardflags2_hi; /* Board flags (bits 48-63) */ 91 u16 boardflags2_hi; /* Board flags (bits 48-63) */
83 /* TODO store board flags in a single u64 */ 92 /* TODO store board flags in a single u64 */
84 93
94 struct ssb_sprom_core_pwr_info core_pwr_info[4];
95
85 /* Antenna gain values for up to 4 antennas 96 /* Antenna gain values for up to 4 antennas
86 * on each band. Values in dBm/4 (Q5.2). Negative gain means the 97 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
87 * loss in the connectors is bigger than the gain. */ 98 * loss in the connectors is bigger than the gain. */
88 struct { 99 struct {
89 struct { 100 s8 a0, a1, a2, a3;
90 s8 a0, a1, a2, a3;
91 } ghz24; /* 2.4GHz band */
92 struct {
93 s8 a0, a1, a2, a3;
94 } ghz5; /* 5GHz band */
95 } antenna_gain; 101 } antenna_gain;
96 102
97 struct { 103 struct {
@@ -103,7 +109,79 @@ struct ssb_sprom {
103 } ghz5; 109 } ghz5;
104 } fem; 110 } fem;
105 111
106 /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ 112 u16 mcs2gpo[8];
113 u16 mcs5gpo[8];
114 u16 mcs5glpo[8];
115 u16 mcs5ghpo[8];
116 u8 opo;
117
118 u8 rxgainerr2ga[3];
119 u8 rxgainerr5gla[3];
120 u8 rxgainerr5gma[3];
121 u8 rxgainerr5gha[3];
122 u8 rxgainerr5gua[3];
123
124 u8 noiselvl2ga[3];
125 u8 noiselvl5gla[3];
126 u8 noiselvl5gma[3];
127 u8 noiselvl5gha[3];
128 u8 noiselvl5gua[3];
129
130 u8 regrev;
131 u8 txchain;
132 u8 rxchain;
133 u8 antswitch;
134 u16 cddpo;
135 u16 stbcpo;
136 u16 bw40po;
137 u16 bwduppo;
138
139 u8 tempthresh;
140 u8 tempoffset;
141 u16 rawtempsense;
142 u8 measpower;
143 u8 tempsense_slope;
144 u8 tempcorrx;
145 u8 tempsense_option;
146 u8 freqoffset_corr;
147 u8 iqcal_swp_dis;
148 u8 hw_iqcal_en;
149 u8 elna2g;
150 u8 elna5g;
151 u8 phycal_tempdelta;
152 u8 temps_period;
153 u8 temps_hysteresis;
154 u8 measpower1;
155 u8 measpower2;
156 u8 pcieingress_war;
157
158 /* power per rate from sromrev 9 */
159 u16 cckbw202gpo;
160 u16 cckbw20ul2gpo;
161 u32 legofdmbw202gpo;
162 u32 legofdmbw20ul2gpo;
163 u32 legofdmbw205glpo;
164 u32 legofdmbw20ul5glpo;
165 u32 legofdmbw205gmpo;
166 u32 legofdmbw20ul5gmpo;
167 u32 legofdmbw205ghpo;
168 u32 legofdmbw20ul5ghpo;
169 u32 mcsbw202gpo;
170 u32 mcsbw20ul2gpo;
171 u32 mcsbw402gpo;
172 u32 mcsbw205glpo;
173 u32 mcsbw20ul5glpo;
174 u32 mcsbw405glpo;
175 u32 mcsbw205gmpo;
176 u32 mcsbw20ul5gmpo;
177 u32 mcsbw405gmpo;
178 u32 mcsbw205ghpo;
179 u32 mcsbw20ul5ghpo;
180 u32 mcsbw405ghpo;
181 u16 mcs32po;
182 u16 legofdm40duppo;
183 u8 sar2g;
184 u8 sar5g;
107}; 185};
108 186
109/* Information about the PCB the circuitry is soldered on. */ 187/* Information about the PCB the circuitry is soldered on. */
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index eba52a100533..6b05dcd927ff 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -2,6 +2,7 @@
2#define LINUX_SSB_DRIVER_GIGE_H_ 2#define LINUX_SSB_DRIVER_GIGE_H_
3 3
4#include <linux/ssb/ssb.h> 4#include <linux/ssb/ssb.h>
5#include <linux/bug.h>
5#include <linux/pci.h> 6#include <linux/pci.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7 8
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index c814ae6eeb22..40b1ef8595ee 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -449,6 +449,39 @@
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA 451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA
452
453/* There are 4 blocks with power info sharing the same layout */
454#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
455#define SSB_SROM8_PWR_INFO_CORE1 0x00E0
456#define SSB_SROM8_PWR_INFO_CORE2 0x0100
457#define SSB_SROM8_PWR_INFO_CORE3 0x0120
458
459#define SSB_SROM8_2G_MAXP_ITSSI 0x00
460#define SSB_SPROM8_2G_MAXP 0x00FF
461#define SSB_SPROM8_2G_ITSSI 0xFF00
462#define SSB_SPROM8_2G_ITSSI_SHIFT 8
463#define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */
464#define SSB_SROM8_2G_PA_1 0x04
465#define SSB_SROM8_2G_PA_2 0x06
466#define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */
467#define SSB_SPROM8_5G_MAXP 0x00FF
468#define SSB_SPROM8_5G_ITSSI 0xFF00
469#define SSB_SPROM8_5G_ITSSI_SHIFT 8
470#define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */
471#define SSB_SPROM8_5GH_MAXP 0x00FF
472#define SSB_SPROM8_5GL_MAXP 0xFF00
473#define SSB_SPROM8_5GL_MAXP_SHIFT 8
474#define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */
475#define SSB_SROM8_5G_PA_1 0x0E
476#define SSB_SROM8_5G_PA_2 0x10
477#define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */
478#define SSB_SROM8_5GL_PA_1 0x14
479#define SSB_SROM8_5GL_PA_2 0x16
480#define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */
481#define SSB_SROM8_5GH_PA_1 0x1A
482#define SSB_SROM8_5GH_PA_2 0x1C
483
484/* TODO: Make it deprecated */
452#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ 485#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
453#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 486#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
454#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 487#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
@@ -473,6 +506,7 @@
473#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ 506#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
474#define SSB_SPROM8_PA1HIB1 0x00DA 507#define SSB_SPROM8_PA1HIB1 0x00DA
475#define SSB_SPROM8_PA1HIB2 0x00DC 508#define SSB_SPROM8_PA1HIB2 0x00DC
509
476#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ 510#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
477#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ 511#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
478#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ 512#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
diff --git a/include/linux/static_key.h b/include/linux/static_key.h
new file mode 100644
index 000000000000..27bd3f8a0857
--- /dev/null
+++ b/include/linux/static_key.h
@@ -0,0 +1 @@
#include <linux/jump_label.h>
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 7874a8a56638..492a36d72829 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -99,6 +99,8 @@ struct rpc_authops {
99 99
100 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); 100 struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int);
101 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); 101 struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int);
102 int (*pipes_create)(struct rpc_auth *);
103 void (*pipes_destroy)(struct rpc_auth *);
102}; 104};
103 105
104struct rpc_credops { 106struct rpc_credops {
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index f7f3ce340c08..969c0a671dbf 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); 35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
36void xprt_free_bc_request(struct rpc_rqst *req); 36void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); 38void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
39int bc_send(struct rpc_rqst *req); 39int bc_send(struct rpc_rqst *req);
40 40
41/* 41/*
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 57531f8e5956..f5fd6160dbca 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -117,6 +117,7 @@ struct cache_detail {
117 struct cache_detail_procfs procfs; 117 struct cache_detail_procfs procfs;
118 struct cache_detail_pipefs pipefs; 118 struct cache_detail_pipefs pipefs;
119 } u; 119 } u;
120 struct net *net;
120}; 121};
121 122
122 123
@@ -197,11 +198,14 @@ extern void cache_flush(void);
197extern void cache_purge(struct cache_detail *detail); 198extern void cache_purge(struct cache_detail *detail);
198#define NEVER (0x7FFFFFFF) 199#define NEVER (0x7FFFFFFF)
199extern void __init cache_initialize(void); 200extern void __init cache_initialize(void);
200extern int cache_register(struct cache_detail *cd);
201extern int cache_register_net(struct cache_detail *cd, struct net *net); 201extern int cache_register_net(struct cache_detail *cd, struct net *net);
202extern void cache_unregister(struct cache_detail *cd);
203extern void cache_unregister_net(struct cache_detail *cd, struct net *net); 202extern void cache_unregister_net(struct cache_detail *cd, struct net *net);
204 203
204extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net);
205extern void cache_destroy_net(struct cache_detail *cd, struct net *net);
206
207extern void sunrpc_init_cache_detail(struct cache_detail *cd);
208extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
205extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, 209extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
206 umode_t, struct cache_detail *); 210 umode_t, struct cache_detail *);
207extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); 211extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 2c5993a17c33..523547ecfee2 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -35,14 +35,13 @@ struct rpc_clnt {
35 struct list_head cl_clients; /* Global list of clients */ 35 struct list_head cl_clients; /* Global list of clients */
36 struct list_head cl_tasks; /* List of tasks */ 36 struct list_head cl_tasks; /* List of tasks */
37 spinlock_t cl_lock; /* spinlock */ 37 spinlock_t cl_lock; /* spinlock */
38 struct rpc_xprt * cl_xprt; /* transport */ 38 struct rpc_xprt __rcu * cl_xprt; /* transport */
39 struct rpc_procinfo * cl_procinfo; /* procedure info */ 39 struct rpc_procinfo * cl_procinfo; /* procedure info */
40 u32 cl_prog, /* RPC program number */ 40 u32 cl_prog, /* RPC program number */
41 cl_vers, /* RPC version number */ 41 cl_vers, /* RPC version number */
42 cl_maxproc; /* max procedure number */ 42 cl_maxproc; /* max procedure number */
43 43
44 char * cl_server; /* server machine name */ 44 const char * cl_protname; /* protocol name */
45 char * cl_protname; /* protocol name */
46 struct rpc_auth * cl_auth; /* authenticator */ 45 struct rpc_auth * cl_auth; /* authenticator */
47 struct rpc_stat * cl_stats; /* per-program statistics */ 46 struct rpc_stat * cl_stats; /* per-program statistics */
48 struct rpc_iostats * cl_metrics; /* per-client statistics */ 47 struct rpc_iostats * cl_metrics; /* per-client statistics */
@@ -57,12 +56,11 @@ struct rpc_clnt {
57 56
58 int cl_nodelen; /* nodename length */ 57 int cl_nodelen; /* nodename length */
59 char cl_nodename[UNX_MAXNODENAME]; 58 char cl_nodename[UNX_MAXNODENAME];
60 struct path cl_path; 59 struct dentry * cl_dentry;
61 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 60 struct rpc_clnt * cl_parent; /* Points to parent of clones */
62 struct rpc_rtt cl_rtt_default; 61 struct rpc_rtt cl_rtt_default;
63 struct rpc_timeout cl_timeout_default; 62 struct rpc_timeout cl_timeout_default;
64 struct rpc_program * cl_program; 63 const struct rpc_program *cl_program;
65 char cl_inline_name[32];
66 char *cl_principal; /* target to authenticate to */ 64 char *cl_principal; /* target to authenticate to */
67}; 65};
68 66
@@ -71,12 +69,12 @@ struct rpc_clnt {
71 */ 69 */
72#define RPC_MAXVERSION 4 70#define RPC_MAXVERSION 4
73struct rpc_program { 71struct rpc_program {
74 char * name; /* protocol name */ 72 const char * name; /* protocol name */
75 u32 number; /* program number */ 73 u32 number; /* program number */
76 unsigned int nrvers; /* number of versions */ 74 unsigned int nrvers; /* number of versions */
77 struct rpc_version ** version; /* version array */ 75 const struct rpc_version ** version; /* version array */
78 struct rpc_stat * stats; /* statistics */ 76 struct rpc_stat * stats; /* statistics */
79 char * pipe_dir_name; /* path to rpc_pipefs dir */ 77 const char * pipe_dir_name; /* path to rpc_pipefs dir */
80}; 78};
81 79
82struct rpc_version { 80struct rpc_version {
@@ -97,7 +95,7 @@ struct rpc_procinfo {
97 unsigned int p_count; /* call count */ 95 unsigned int p_count; /* call count */
98 unsigned int p_timer; /* Which RTT timer to use */ 96 unsigned int p_timer; /* Which RTT timer to use */
99 u32 p_statidx; /* Which procedure to account */ 97 u32 p_statidx; /* Which procedure to account */
100 char * p_name; /* name of procedure */ 98 const char * p_name; /* name of procedure */
101}; 99};
102 100
103#ifdef __KERNEL__ 101#ifdef __KERNEL__
@@ -109,8 +107,8 @@ struct rpc_create_args {
109 size_t addrsize; 107 size_t addrsize;
110 struct sockaddr *saddress; 108 struct sockaddr *saddress;
111 const struct rpc_timeout *timeout; 109 const struct rpc_timeout *timeout;
112 char *servername; 110 const char *servername;
113 struct rpc_program *program; 111 const struct rpc_program *program;
114 u32 prognumber; /* overrides program->number */ 112 u32 prognumber; /* overrides program->number */
115 u32 version; 113 u32 version;
116 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
@@ -129,17 +127,18 @@ struct rpc_create_args {
129 127
130struct rpc_clnt *rpc_create(struct rpc_create_args *args); 128struct rpc_clnt *rpc_create(struct rpc_create_args *args);
131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 129struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
132 struct rpc_program *, u32); 130 const struct rpc_program *, u32);
133void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); 131void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
134struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 132struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
135void rpc_shutdown_client(struct rpc_clnt *); 133void rpc_shutdown_client(struct rpc_clnt *);
136void rpc_release_client(struct rpc_clnt *); 134void rpc_release_client(struct rpc_clnt *);
137void rpc_task_release_client(struct rpc_task *); 135void rpc_task_release_client(struct rpc_task *);
138 136
139int rpcb_create_local(void); 137int rpcb_create_local(struct net *);
140void rpcb_put_local(void); 138void rpcb_put_local(struct net *);
141int rpcb_register(u32, u32, int, unsigned short); 139int rpcb_register(struct net *, u32, u32, int, unsigned short);
142int rpcb_v4_register(const u32 program, const u32 version, 140int rpcb_v4_register(struct net *net, const u32 program,
141 const u32 version,
143 const struct sockaddr *address, 142 const struct sockaddr *address,
144 const char *netid); 143 const char *netid);
145void rpcb_getport_async(struct rpc_task *); 144void rpcb_getport_async(struct rpc_task *);
@@ -156,16 +155,19 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
156int rpc_restart_call_prepare(struct rpc_task *); 155int rpc_restart_call_prepare(struct rpc_task *);
157int rpc_restart_call(struct rpc_task *); 156int rpc_restart_call(struct rpc_task *);
158void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 157void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
158int rpc_protocol(struct rpc_clnt *);
159struct net * rpc_net_ns(struct rpc_clnt *);
159size_t rpc_max_payload(struct rpc_clnt *); 160size_t rpc_max_payload(struct rpc_clnt *);
160void rpc_force_rebind(struct rpc_clnt *); 161void rpc_force_rebind(struct rpc_clnt *);
161size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 162size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
162const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 163const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
164int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
163 165
164size_t rpc_ntop(const struct sockaddr *, char *, const size_t); 166size_t rpc_ntop(const struct sockaddr *, char *, const size_t);
165size_t rpc_pton(const char *, const size_t, 167size_t rpc_pton(struct net *, const char *, const size_t,
166 struct sockaddr *, const size_t); 168 struct sockaddr *, const size_t);
167char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); 169char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t);
168size_t rpc_uaddr2sockaddr(const char *, const size_t, 170size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t,
169 struct sockaddr *, const size_t); 171 struct sockaddr *, const size_t);
170 172
171static inline unsigned short rpc_get_port(const struct sockaddr *sap) 173static inline unsigned short rpc_get_port(const struct sockaddr *sap)
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index c2786f20016f..a76cc20d98ce 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -31,9 +31,12 @@
31/* 31/*
32 * Enable RPC debugging/profiling. 32 * Enable RPC debugging/profiling.
33 */ 33 */
34#ifdef CONFIG_SYSCTL 34#ifdef CONFIG_SUNRPC_DEBUG
35#define RPC_DEBUG 35#define RPC_DEBUG
36#endif 36#endif
37#ifdef CONFIG_TRACEPOINTS
38#define RPC_TRACEPOINTS
39#endif
37/* #define RPC_PROFILE */ 40/* #define RPC_PROFILE */
38 41
39/* 42/*
@@ -47,15 +50,32 @@ extern unsigned int nlm_debug;
47#endif 50#endif
48 51
49#define dprintk(args...) dfprintk(FACILITY, ## args) 52#define dprintk(args...) dfprintk(FACILITY, ## args)
53#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
50 54
51#undef ifdebug 55#undef ifdebug
52#ifdef RPC_DEBUG 56#ifdef RPC_DEBUG
53# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 57# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
54# define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0) 58
59# define dfprintk(fac, args...) \
60 do { \
61 ifdebug(fac) \
62 printk(KERN_DEFAULT args); \
63 } while (0)
64
65# define dfprintk_rcu(fac, args...) \
66 do { \
67 ifdebug(fac) { \
68 rcu_read_lock(); \
69 printk(KERN_DEFAULT args); \
70 rcu_read_unlock(); \
71 } \
72 } while (0)
73
55# define RPC_IFDEBUG(x) x 74# define RPC_IFDEBUG(x) x
56#else 75#else
57# define ifdebug(fac) if (0) 76# define ifdebug(fac) if (0)
58# define dfprintk(fac, args...) do ; while (0) 77# define dfprintk(fac, args...) do {} while (0)
78# define dfprintk_rcu(fac, args...) do {} while (0)
59# define RPC_IFDEBUG(x) 79# define RPC_IFDEBUG(x)
60#endif 80#endif
61 81
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index b6edbc0ea83d..1565bbe86d51 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -74,14 +74,16 @@ struct rpc_clnt;
74#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
75 75
76struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); 76struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
77void rpc_count_iostats(struct rpc_task *); 77void rpc_count_iostats(const struct rpc_task *,
78 struct rpc_iostats *);
78void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); 79void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
79void rpc_free_iostats(struct rpc_iostats *); 80void rpc_free_iostats(struct rpc_iostats *);
80 81
81#else /* CONFIG_PROC_FS */ 82#else /* CONFIG_PROC_FS */
82 83
83static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } 84static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
84static inline void rpc_count_iostats(struct rpc_task *task) {} 85static inline void rpc_count_iostats(const struct rpc_task *task,
86 struct rpc_iostats *stats) {}
85static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} 87static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
86static inline void rpc_free_iostats(struct rpc_iostats *stats) {} 88static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
87 89
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 2bb03d77375a..a7b422b33eda 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -21,21 +21,26 @@ struct rpc_pipe_ops {
21 void (*destroy_msg)(struct rpc_pipe_msg *); 21 void (*destroy_msg)(struct rpc_pipe_msg *);
22}; 22};
23 23
24struct rpc_inode { 24struct rpc_pipe {
25 struct inode vfs_inode;
26 void *private;
27 struct list_head pipe; 25 struct list_head pipe;
28 struct list_head in_upcall; 26 struct list_head in_upcall;
29 struct list_head in_downcall; 27 struct list_head in_downcall;
30 int pipelen; 28 int pipelen;
31 int nreaders; 29 int nreaders;
32 int nwriters; 30 int nwriters;
33 int nkern_readwriters;
34 wait_queue_head_t waitq;
35#define RPC_PIPE_WAIT_FOR_OPEN 1 31#define RPC_PIPE_WAIT_FOR_OPEN 1
36 int flags; 32 int flags;
37 struct delayed_work queue_timeout; 33 struct delayed_work queue_timeout;
38 const struct rpc_pipe_ops *ops; 34 const struct rpc_pipe_ops *ops;
35 spinlock_t lock;
36 struct dentry *dentry;
37};
38
39struct rpc_inode {
40 struct inode vfs_inode;
41 void *private;
42 struct rpc_pipe *pipe;
43 wait_queue_head_t waitq;
39}; 44};
40 45
41static inline struct rpc_inode * 46static inline struct rpc_inode *
@@ -44,9 +49,28 @@ RPC_I(struct inode *inode)
44 return container_of(inode, struct rpc_inode, vfs_inode); 49 return container_of(inode, struct rpc_inode, vfs_inode);
45} 50}
46 51
52enum {
53 SUNRPC_PIPEFS_NFS_PRIO,
54 SUNRPC_PIPEFS_RPC_PRIO,
55};
56
57extern int rpc_pipefs_notifier_register(struct notifier_block *);
58extern void rpc_pipefs_notifier_unregister(struct notifier_block *);
59
60enum {
61 RPC_PIPEFS_MOUNT,
62 RPC_PIPEFS_UMOUNT,
63};
64
65extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
66 const unsigned char *dir_name);
67extern void rpc_pipefs_init_net(struct net *net);
68extern struct super_block *rpc_get_sb_net(const struct net *net);
69extern void rpc_put_sb_net(const struct net *net);
70
47extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, 71extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
48 char __user *, size_t); 72 char __user *, size_t);
49extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
50 74
51struct rpc_clnt; 75struct rpc_clnt;
52extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *);
@@ -59,11 +83,13 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *,
59 struct cache_detail *); 83 struct cache_detail *);
60extern void rpc_remove_cache_dir(struct dentry *); 84extern void rpc_remove_cache_dir(struct dentry *);
61 85
62extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, 86extern int rpc_rmdir(struct dentry *dentry);
63 const struct rpc_pipe_ops *, int flags); 87
88struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags);
89void rpc_destroy_pipe_data(struct rpc_pipe *pipe);
90extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *,
91 struct rpc_pipe *);
64extern int rpc_unlink(struct dentry *); 92extern int rpc_unlink(struct dentry *);
65extern struct vfsmount *rpc_get_mount(void);
66extern void rpc_put_mount(void);
67extern int register_rpc_pipefs(void); 93extern int register_rpc_pipefs(void);
68extern void unregister_rpc_pipefs(void); 94extern void unregister_rpc_pipefs(void);
69 95
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index e7756896f3ca..dc0c3cc3ada3 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -103,6 +103,7 @@ typedef void (*rpc_action)(struct rpc_task *);
103struct rpc_call_ops { 103struct rpc_call_ops {
104 void (*rpc_call_prepare)(struct rpc_task *, void *); 104 void (*rpc_call_prepare)(struct rpc_task *, void *);
105 void (*rpc_call_done)(struct rpc_task *, void *); 105 void (*rpc_call_done)(struct rpc_task *, void *);
106 void (*rpc_count_stats)(struct rpc_task *, void *);
106 void (*rpc_release)(void *); 107 void (*rpc_release)(void *);
107}; 108};
108 109
@@ -195,7 +196,7 @@ struct rpc_wait_queue {
195 unsigned char nr; /* # tasks remaining for cookie */ 196 unsigned char nr; /* # tasks remaining for cookie */
196 unsigned short qlen; /* total # tasks waiting in queue */ 197 unsigned short qlen; /* total # tasks waiting in queue */
197 struct rpc_timer timer_list; 198 struct rpc_timer timer_list;
198#ifdef RPC_DEBUG 199#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS)
199 const char * name; 200 const char * name;
200#endif 201#endif
201}; 202};
@@ -235,6 +236,9 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *,
235 struct rpc_task *); 236 struct rpc_task *);
236void rpc_wake_up(struct rpc_wait_queue *); 237void rpc_wake_up(struct rpc_wait_queue *);
237struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); 238struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
239struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
240 bool (*)(struct rpc_task *, void *),
241 void *);
238void rpc_wake_up_status(struct rpc_wait_queue *, int); 242void rpc_wake_up_status(struct rpc_wait_queue *, int);
239int rpc_queue_empty(struct rpc_wait_queue *); 243int rpc_queue_empty(struct rpc_wait_queue *);
240void rpc_delay(struct rpc_task *, unsigned long); 244void rpc_delay(struct rpc_task *, unsigned long);
@@ -244,7 +248,8 @@ int rpciod_up(void);
244void rpciod_down(void); 248void rpciod_down(void);
245int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 249int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
246#ifdef RPC_DEBUG 250#ifdef RPC_DEBUG
247void rpc_show_tasks(void); 251struct net;
252void rpc_show_tasks(struct net *);
248#endif 253#endif
249int rpc_init_mempool(void); 254int rpc_init_mempool(void);
250void rpc_destroy_mempool(void); 255void rpc_destroy_mempool(void);
@@ -266,11 +271,22 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri
266 return (task->tk_priority + RPC_PRIORITY_LOW == prio); 271 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
267} 272}
268 273
269#ifdef RPC_DEBUG 274#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
270static inline const char * rpc_qname(struct rpc_wait_queue *q) 275static inline const char * rpc_qname(const struct rpc_wait_queue *q)
271{ 276{
272 return ((q && q->name) ? q->name : "unknown"); 277 return ((q && q->name) ? q->name : "unknown");
273} 278}
279
280static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
281 const char *name)
282{
283 q->name = name;
284}
285#else
286static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
287 const char *name)
288{
289}
274#endif 290#endif
275 291
276#endif /* _LINUX_SUNRPC_SCHED_H_ */ 292#endif /* _LINUX_SUNRPC_SCHED_H_ */
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 680471d1f28a..edc64219f92b 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -12,7 +12,7 @@
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13 13
14struct rpc_stat { 14struct rpc_stat {
15 struct rpc_program * program; 15 const struct rpc_program *program;
16 16
17 unsigned int netcnt, 17 unsigned int netcnt,
18 netudpcnt, 18 netudpcnt,
@@ -58,24 +58,24 @@ void rpc_modcount(struct inode *, int);
58#endif 58#endif
59 59
60#ifdef CONFIG_PROC_FS 60#ifdef CONFIG_PROC_FS
61struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); 61struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *);
62void rpc_proc_unregister(const char *); 62void rpc_proc_unregister(struct net *,const char *);
63void rpc_proc_zero(struct rpc_program *); 63void rpc_proc_zero(const struct rpc_program *);
64struct proc_dir_entry * svc_proc_register(struct svc_stat *, 64struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *,
65 const struct file_operations *); 65 const struct file_operations *);
66void svc_proc_unregister(const char *); 66void svc_proc_unregister(struct net *, const char *);
67 67
68void svc_seq_show(struct seq_file *, 68void svc_seq_show(struct seq_file *,
69 const struct svc_stat *); 69 const struct svc_stat *);
70#else 70#else
71 71
72static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } 72static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; }
73static inline void rpc_proc_unregister(const char *p) {} 73static inline void rpc_proc_unregister(struct net *net, const char *p) {}
74static inline void rpc_proc_zero(struct rpc_program *p) {} 74static inline void rpc_proc_zero(const struct rpc_program *p) {}
75 75
76static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, 76static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s,
77 const struct file_operations *f) { return NULL; } 77 const struct file_operations *f) { return NULL; }
78static inline void svc_proc_unregister(const char *p) {} 78static inline void svc_proc_unregister(struct net *net, const char *p) {}
79 79
80static inline void svc_seq_show(struct seq_file *seq, 80static inline void svc_seq_show(struct seq_file *seq,
81 const struct svc_stat *st) {} 81 const struct svc_stat *st) {}
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 35b37b1e9299..51b29ac45a8e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -84,7 +84,8 @@ struct svc_serv {
84 unsigned int sv_nrpools; /* number of thread pools */ 84 unsigned int sv_nrpools; /* number of thread pools */
85 struct svc_pool * sv_pools; /* array of thread pools */ 85 struct svc_pool * sv_pools; /* array of thread pools */
86 86
87 void (*sv_shutdown)(struct svc_serv *serv); 87 void (*sv_shutdown)(struct svc_serv *serv,
88 struct net *net);
88 /* Callback to use when last thread 89 /* Callback to use when last thread
89 * exits. 90 * exits.
90 */ 91 */
@@ -413,22 +414,24 @@ struct svc_procedure {
413/* 414/*
414 * Function prototypes. 415 * Function prototypes.
415 */ 416 */
416void svc_rpcb_cleanup(struct svc_serv *serv); 417int svc_rpcb_setup(struct svc_serv *serv, struct net *net);
418void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
417struct svc_serv *svc_create(struct svc_program *, unsigned int, 419struct svc_serv *svc_create(struct svc_program *, unsigned int,
418 void (*shutdown)(struct svc_serv *)); 420 void (*shutdown)(struct svc_serv *, struct net *net));
419struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 421struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
420 struct svc_pool *pool, int node); 422 struct svc_pool *pool, int node);
421void svc_exit_thread(struct svc_rqst *); 423void svc_exit_thread(struct svc_rqst *);
422struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 424struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
423 void (*shutdown)(struct svc_serv *), 425 void (*shutdown)(struct svc_serv *, struct net *net),
424 svc_thread_fn, struct module *); 426 svc_thread_fn, struct module *);
425int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 427int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
426int svc_pool_stats_open(struct svc_serv *serv, struct file *file); 428int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
427void svc_destroy(struct svc_serv *); 429void svc_destroy(struct svc_serv *);
430void svc_shutdown_net(struct svc_serv *, struct net *);
428int svc_process(struct svc_rqst *); 431int svc_process(struct svc_rqst *);
429int bc_svc_process(struct svc_serv *, struct rpc_rqst *, 432int bc_svc_process(struct svc_serv *, struct rpc_rqst *,
430 struct svc_rqst *); 433 struct svc_rqst *);
431int svc_register(const struct svc_serv *, const int, 434int svc_register(const struct svc_serv *, struct net *, const int,
432 const unsigned short, const unsigned short); 435 const unsigned short, const unsigned short);
433 436
434void svc_wake_up(struct svc_serv *); 437void svc_wake_up(struct svc_serv *);
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index dfa900948af7..b3f64b12f141 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
121int svc_port_is_privileged(struct sockaddr *sin); 121int svc_port_is_privileged(struct sockaddr *sin);
122int svc_print_xprts(char *buf, int maxlen); 122int svc_print_xprts(char *buf, int maxlen);
123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
124 const sa_family_t af, const unsigned short port); 124 struct net *net, const sa_family_t af,
125 const unsigned short port);
125int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); 126int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
126 127
127static inline void svc_xprt_get(struct svc_xprt *xprt) 128static inline void svc_xprt_get(struct svc_xprt *xprt)
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 25d333c1b571..548790e9113b 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -135,6 +135,9 @@ extern void svcauth_unix_purge(void);
135extern void svcauth_unix_info_release(struct svc_xprt *xpt); 135extern void svcauth_unix_info_release(struct svc_xprt *xpt);
136extern int svcauth_unix_set_client(struct svc_rqst *rqstp); 136extern int svcauth_unix_set_client(struct svc_rqst *rqstp);
137 137
138extern int unix_gid_cache_create(struct net *net);
139extern void unix_gid_cache_destroy(struct net *net);
140
138static inline unsigned long hash_str(char *name, int bits) 141static inline unsigned long hash_str(char *name, int bits)
139{ 142{
140 unsigned long hash = 0; 143 unsigned long hash = 0;
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index 83bbee3f089c..7c32daa025eb 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -18,6 +18,8 @@
18 18
19int gss_svc_init(void); 19int gss_svc_init(void);
20void gss_svc_shutdown(void); 20void gss_svc_shutdown(void);
21int gss_svc_init_net(struct net *net);
22void gss_svc_shutdown_net(struct net *net);
21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 23int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
22u32 svcauth_gss_flavor(struct auth_domain *dom); 24u32 svcauth_gss_flavor(struct auth_domain *dom);
23char *svc_gss_principal(struct svc_rqst *); 25char *svc_gss_principal(struct svc_rqst *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index c84e9741cb2a..cb4ac69e1f33 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -34,7 +34,7 @@ struct svc_sock {
34/* 34/*
35 * Function prototypes. 35 * Function prototypes.
36 */ 36 */
37void svc_close_all(struct svc_serv *); 37void svc_close_net(struct svc_serv *, struct net *);
38int svc_recv(struct svc_rqst *, long); 38int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 15518a152ac3..77d278defa70 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -21,8 +21,8 @@
21 21
22#define RPC_MIN_SLOT_TABLE (2U) 22#define RPC_MIN_SLOT_TABLE (2U)
23#define RPC_DEF_SLOT_TABLE (16U) 23#define RPC_DEF_SLOT_TABLE (16U)
24#define RPC_MAX_SLOT_TABLE (128U)
25#define RPC_MAX_SLOT_TABLE_LIMIT (65536U) 24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
26 26
27/* 27/*
28 * This describes a timeout strategy 28 * This describes a timeout strategy
@@ -219,13 +219,17 @@ struct rpc_xprt {
219 connect_time, /* jiffies waiting for connect */ 219 connect_time, /* jiffies waiting for connect */
220 sends, /* how many complete requests */ 220 sends, /* how many complete requests */
221 recvs, /* how many complete requests */ 221 recvs, /* how many complete requests */
222 bad_xids; /* lookup_rqst didn't find XID */ 222 bad_xids, /* lookup_rqst didn't find XID */
223 max_slots; /* max rpc_slots used */
223 224
224 unsigned long long req_u, /* average requests on the wire */ 225 unsigned long long req_u, /* average requests on the wire */
225 bklog_u; /* backlog queue utilization */ 226 bklog_u, /* backlog queue utilization */
227 sending_u, /* send q utilization */
228 pending_u; /* pend q utilization */
226 } stat; 229 } stat;
227 230
228 struct net *xprt_net; 231 struct net *xprt_net;
232 const char *servername;
229 const char *address_strings[RPC_DISPLAY_MAX]; 233 const char *address_strings[RPC_DISPLAY_MAX];
230}; 234};
231 235
@@ -255,6 +259,7 @@ struct xprt_create {
255 struct sockaddr * srcaddr; /* optional local address */ 259 struct sockaddr * srcaddr; /* optional local address */
256 struct sockaddr * dstaddr; /* remote peer address */ 260 struct sockaddr * dstaddr; /* remote peer address */
257 size_t addrlen; 261 size_t addrlen;
262 const char *servername;
258 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ 263 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
259}; 264};
260 265
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 3f14a02e9cc0..1ad36cc25b2e 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -12,18 +12,6 @@
12int init_socket_xprt(void); 12int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/*
16 * RPC slot table sizes for UDP, TCP transports
17 */
18extern unsigned int xprt_udp_slot_table_entries;
19extern unsigned int xprt_tcp_slot_table_entries;
20
21/*
22 * Parameters for choosing a free port
23 */
24extern unsigned int xprt_min_resvport;
25extern unsigned int xprt_max_resvport;
26
27#define RPC_MIN_RESVPORT (1U) 15#define RPC_MIN_RESVPORT (1U)
28#define RPC_MAX_RESVPORT (65535U) 16#define RPC_MAX_RESVPORT (65535U)
29#define RPC_DEF_MIN_RESVPORT (665U) 17#define RPC_DEF_MIN_RESVPORT (665U)
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h
new file mode 100644
index 000000000000..68e7430bb0fe
--- /dev/null
+++ b/include/linux/sunserialcore.h
@@ -0,0 +1,33 @@
1/* sunserialcore.h
2 *
3 * Generic SUN serial/kbd/ms layer. Based entirely
4 * upon drivers/sbus/char/sunserial.h which is:
5 *
6 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
7 *
8 * Port to new UART layer is:
9 *
10 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
11 */
12
13#ifndef _SERIAL_SUN_H
14#define _SERIAL_SUN_H
15
16/* Serial keyboard defines for L1-A processing... */
17#define SUNKBD_RESET 0xff
18#define SUNKBD_L1 0x01
19#define SUNKBD_UP 0x80
20#define SUNKBD_A 0x4d
21
22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *);
23extern int suncore_mouse_baud_detection(unsigned char, int);
24
25extern int sunserial_register_minors(struct uart_driver *, int);
26extern void sunserial_unregister_minors(struct uart_driver *, int);
27
28extern int sunserial_console_match(struct console *, struct device_node *,
29 struct uart_driver *, int, bool);
30extern void sunserial_console_termios(struct console *,
31 struct device_node *);
32
33#endif /* !(_SERIAL_SUN_H) */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 91784a4f8608..ac1c114c499d 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -42,8 +42,10 @@ enum suspend_stat_step {
42 SUSPEND_FREEZE = 1, 42 SUSPEND_FREEZE = 1,
43 SUSPEND_PREPARE, 43 SUSPEND_PREPARE,
44 SUSPEND_SUSPEND, 44 SUSPEND_SUSPEND,
45 SUSPEND_SUSPEND_LATE,
45 SUSPEND_SUSPEND_NOIRQ, 46 SUSPEND_SUSPEND_NOIRQ,
46 SUSPEND_RESUME_NOIRQ, 47 SUSPEND_RESUME_NOIRQ,
48 SUSPEND_RESUME_EARLY,
47 SUSPEND_RESUME 49 SUSPEND_RESUME
48}; 50};
49 51
@@ -53,8 +55,10 @@ struct suspend_stats {
53 int failed_freeze; 55 int failed_freeze;
54 int failed_prepare; 56 int failed_prepare;
55 int failed_suspend; 57 int failed_suspend;
58 int failed_suspend_late;
56 int failed_suspend_noirq; 59 int failed_suspend_noirq;
57 int failed_resume; 60 int failed_resume;
61 int failed_resume_early;
58 int failed_resume_noirq; 62 int failed_resume_noirq;
59#define REC_FAILED_NUM 2 63#define REC_FAILED_NUM 2
60 int last_failed_dev; 64 int last_failed_dev;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3e60228e7299..b86b5c20617d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -223,6 +223,7 @@ extern void lru_add_page_tail(struct zone* zone,
223extern void activate_page(struct page *); 223extern void activate_page(struct page *);
224extern void mark_page_accessed(struct page *); 224extern void mark_page_accessed(struct page *);
225extern void lru_add_drain(void); 225extern void lru_add_drain(void);
226extern void lru_add_drain_cpu(int cpu);
226extern int lru_add_drain_all(void); 227extern int lru_add_drain_all(void);
227extern void rotate_reclaimable_page(struct page *page); 228extern void rotate_reclaimable_page(struct page *page);
228extern void deactivate_page(struct page *page); 229extern void deactivate_page(struct page *page);
@@ -329,7 +330,6 @@ extern long total_swap_pages;
329extern void si_swapinfo(struct sysinfo *); 330extern void si_swapinfo(struct sysinfo *);
330extern swp_entry_t get_swap_page(void); 331extern swp_entry_t get_swap_page(void);
331extern swp_entry_t get_swap_page_of_type(int); 332extern swp_entry_t get_swap_page_of_type(int);
332extern int valid_swaphandles(swp_entry_t, unsigned long *);
333extern int add_swap_count_continuation(swp_entry_t, gfp_t); 333extern int add_swap_count_continuation(swp_entry_t, gfp_t);
334extern void swap_shmem_alloc(swp_entry_t); 334extern void swap_shmem_alloc(swp_entry_t);
335extern int swap_duplicate(swp_entry_t); 335extern int swap_duplicate(swp_entry_t);
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 2189d3ffc85d..792d16d9cbc7 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -2,6 +2,7 @@
2#define _LINUX_SWAPOPS_H 2#define _LINUX_SWAPOPS_H
3 3
4#include <linux/radix-tree.h> 4#include <linux/radix-tree.h>
5#include <linux/bug.h>
5 6
6/* 7/*
7 * swapcache pages are stored in the swapper_space radix tree. We want to 8 * swapcache pages are stored in the swapper_space radix tree. We want to
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
new file mode 100644
index 000000000000..2739ccb69571
--- /dev/null
+++ b/include/linux/sys_soc.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson.
4 * License terms: GNU General Public License (GPL), version 2
5 */
6#ifndef __SOC_BUS_H
7#define __SOC_BUS_H
8
9#include <linux/device.h>
10
11struct soc_device_attribute {
12 const char *machine;
13 const char *family;
14 const char *revision;
15 const char *soc_id;
16};
17
18/**
19 * soc_device_register - register SoC as a device
20 * @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC
21 */
22struct soc_device *soc_device_register(
23 struct soc_device_attribute *soc_plat_dev_attr);
24
25/**
26 * soc_device_unregister - unregister SoC device
27 * @dev: SoC device to be unregistered
28 */
29void soc_device_unregister(struct soc_device *soc_dev);
30
31/**
32 * soc_device_to_device - helper function to fetch struct device
33 * @soc: Previously registered SoC device container
34 */
35struct device *soc_device_to_device(struct soc_device *soc);
36
37#endif /* __SOC_BUS_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 8ec1153ff57b..3de3acb84a95 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -68,6 +68,7 @@ struct file_handle;
68#include <linux/aio_abi.h> 68#include <linux/aio_abi.h>
69#include <linux/capability.h> 69#include <linux/capability.h>
70#include <linux/list.h> 70#include <linux/list.h>
71#include <linux/bug.h>
71#include <linux/sem.h> 72#include <linux/sem.h>
72#include <asm/siginfo.h> 73#include <asm/siginfo.h>
73#include <asm/signal.h> 74#include <asm/signal.h>
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bb9127dd814b..c34b4c82b0dc 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -932,34 +932,14 @@ enum
932#include <linux/list.h> 932#include <linux/list.h>
933#include <linux/rcupdate.h> 933#include <linux/rcupdate.h>
934#include <linux/wait.h> 934#include <linux/wait.h>
935#include <linux/rbtree.h>
935 936
936/* For the /proc/sys support */ 937/* For the /proc/sys support */
937struct ctl_table; 938struct ctl_table;
938struct nsproxy; 939struct nsproxy;
939struct ctl_table_root; 940struct ctl_table_root;
940
941struct ctl_table_set {
942 struct list_head list;
943 struct ctl_table_set *parent;
944 int (*is_seen)(struct ctl_table_set *);
945};
946
947extern void setup_sysctl_set(struct ctl_table_set *p,
948 struct ctl_table_set *parent,
949 int (*is_seen)(struct ctl_table_set *));
950
951struct ctl_table_header; 941struct ctl_table_header;
952 942struct ctl_dir;
953extern void sysctl_head_get(struct ctl_table_header *);
954extern void sysctl_head_put(struct ctl_table_header *);
955extern int sysctl_is_seen(struct ctl_table_header *);
956extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
957extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
958extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
959 struct ctl_table_header *prev);
960extern void sysctl_head_finish(struct ctl_table_header *prev);
961extern int sysctl_perm(struct ctl_table_root *root,
962 struct ctl_table *table, int op);
963 943
964typedef struct ctl_table ctl_table; 944typedef struct ctl_table ctl_table;
965 945
@@ -1023,8 +1003,6 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll)
1023 return (void *)(unsigned long)atomic_read(&poll->event); 1003 return (void *)(unsigned long)atomic_read(&poll->event);
1024} 1004}
1025 1005
1026void proc_sys_poll_notify(struct ctl_table_poll *poll);
1027
1028#define __CTL_TABLE_POLL_INITIALIZER(name) { \ 1006#define __CTL_TABLE_POLL_INITIALIZER(name) { \
1029 .event = ATOMIC_INIT(0), \ 1007 .event = ATOMIC_INIT(0), \
1030 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } 1008 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) }
@@ -1039,21 +1017,16 @@ struct ctl_table
1039 void *data; 1017 void *data;
1040 int maxlen; 1018 int maxlen;
1041 umode_t mode; 1019 umode_t mode;
1042 struct ctl_table *child; 1020 struct ctl_table *child; /* Deprecated */
1043 struct ctl_table *parent; /* Automatically set */
1044 proc_handler *proc_handler; /* Callback for text formatting */ 1021 proc_handler *proc_handler; /* Callback for text formatting */
1045 struct ctl_table_poll *poll; 1022 struct ctl_table_poll *poll;
1046 void *extra1; 1023 void *extra1;
1047 void *extra2; 1024 void *extra2;
1048}; 1025};
1049 1026
1050struct ctl_table_root { 1027struct ctl_node {
1051 struct list_head root_list; 1028 struct rb_node node;
1052 struct ctl_table_set default_set; 1029 struct ctl_table_header *header;
1053 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1054 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table);
1057}; 1030};
1058 1031
1059/* struct ctl_table_header is used to maintain dynamic lists of 1032/* struct ctl_table_header is used to maintain dynamic lists of
@@ -1063,9 +1036,9 @@ struct ctl_table_header
1063 union { 1036 union {
1064 struct { 1037 struct {
1065 struct ctl_table *ctl_table; 1038 struct ctl_table *ctl_table;
1066 struct list_head ctl_entry;
1067 int used; 1039 int used;
1068 int count; 1040 int count;
1041 int nreg;
1069 }; 1042 };
1070 struct rcu_head rcu; 1043 struct rcu_head rcu;
1071 }; 1044 };
@@ -1073,9 +1046,27 @@ struct ctl_table_header
1073 struct ctl_table *ctl_table_arg; 1046 struct ctl_table *ctl_table_arg;
1074 struct ctl_table_root *root; 1047 struct ctl_table_root *root;
1075 struct ctl_table_set *set; 1048 struct ctl_table_set *set;
1076 struct ctl_table *attached_by; 1049 struct ctl_dir *parent;
1077 struct ctl_table *attached_to; 1050 struct ctl_node *node;
1078 struct ctl_table_header *parent; 1051};
1052
1053struct ctl_dir {
1054 /* Header must be at the start of ctl_dir */
1055 struct ctl_table_header header;
1056 struct rb_root root;
1057};
1058
1059struct ctl_table_set {
1060 int (*is_seen)(struct ctl_table_set *);
1061 struct ctl_dir dir;
1062};
1063
1064struct ctl_table_root {
1065 struct ctl_table_set default_set;
1066 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1067 struct nsproxy *namespaces);
1068 int (*permissions)(struct ctl_table_root *root,
1069 struct nsproxy *namespaces, struct ctl_table *table);
1079}; 1070};
1080 1071
1081/* struct ctl_path describes where in the hierarchy a table is added */ 1072/* struct ctl_path describes where in the hierarchy a table is added */
@@ -1083,16 +1074,53 @@ struct ctl_path {
1083 const char *procname; 1074 const char *procname;
1084}; 1075};
1085 1076
1077#ifdef CONFIG_SYSCTL
1078
1079void proc_sys_poll_notify(struct ctl_table_poll *poll);
1080
1081extern void setup_sysctl_set(struct ctl_table_set *p,
1082 struct ctl_table_root *root,
1083 int (*is_seen)(struct ctl_table_set *));
1084extern void retire_sysctl_set(struct ctl_table_set *set);
1085
1086void register_sysctl_root(struct ctl_table_root *root); 1086void register_sysctl_root(struct ctl_table_root *root);
1087struct ctl_table_header *__register_sysctl_table(
1088 struct ctl_table_set *set,
1089 const char *path, struct ctl_table *table);
1087struct ctl_table_header *__register_sysctl_paths( 1090struct ctl_table_header *__register_sysctl_paths(
1088 struct ctl_table_root *root, struct nsproxy *namespaces, 1091 struct ctl_table_set *set,
1089 const struct ctl_path *path, struct ctl_table *table); 1092 const struct ctl_path *path, struct ctl_table *table);
1093struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
1090struct ctl_table_header *register_sysctl_table(struct ctl_table * table); 1094struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
1091struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, 1095struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1092 struct ctl_table *table); 1096 struct ctl_table *table);
1093 1097
1094void unregister_sysctl_table(struct ctl_table_header * table); 1098void unregister_sysctl_table(struct ctl_table_header * table);
1095int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); 1099
1100extern int sysctl_init(void);
1101#else /* CONFIG_SYSCTL */
1102static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1103{
1104 return NULL;
1105}
1106
1107static inline struct ctl_table_header *register_sysctl_paths(
1108 const struct ctl_path *path, struct ctl_table *table)
1109{
1110 return NULL;
1111}
1112
1113static inline void unregister_sysctl_table(struct ctl_table_header * table)
1114{
1115}
1116
1117static inline void setup_sysctl_set(struct ctl_table_set *p,
1118 struct ctl_table_root *root,
1119 int (*is_seen)(struct ctl_table_set *))
1120{
1121}
1122
1123#endif /* CONFIG_SYSCTL */
1096 1124
1097#endif /* __KERNEL__ */ 1125#endif /* __KERNEL__ */
1098 1126
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 3c7ffdb40dc6..b6c62d294380 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -464,7 +464,7 @@ struct tcp_sock {
464 const struct tcp_sock_af_ops *af_specific; 464 const struct tcp_sock_af_ops *af_specific;
465 465
466/* TCP MD5 Signature Option information */ 466/* TCP MD5 Signature Option information */
467 struct tcp_md5sig_info *md5sig_info; 467 struct tcp_md5sig_info __rcu *md5sig_info;
468#endif 468#endif
469 469
470 /* When the cookie options are generated and exchanged, then this 470 /* When the cookie options are generated and exchanged, then this
@@ -487,8 +487,7 @@ struct tcp_timewait_sock {
487 u32 tw_ts_recent; 487 u32 tw_ts_recent;
488 long tw_ts_recent_stamp; 488 long tw_ts_recent_stamp;
489#ifdef CONFIG_TCP_MD5SIG 489#ifdef CONFIG_TCP_MD5SIG
490 u16 tw_md5_keylen; 490 struct tcp_md5sig_key *tw_md5_key;
491 u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN];
492#endif 491#endif
493 /* Few sockets in timewait have cookies; in that case, then this 492 /* Few sockets in timewait have cookies; in that case, then this
494 * object holds a reference to them (tw_cookie_values->kref). 493 * object holds a reference to them (tw_cookie_values->kref).
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa60fe7b6ed6..b75e1864ed19 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -234,23 +234,9 @@ struct timex {
234extern unsigned long tick_usec; /* USER_HZ period (usec) */ 234extern unsigned long tick_usec; /* USER_HZ period (usec) */
235extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 235extern unsigned long tick_nsec; /* ACTHZ period (nsec) */
236 236
237/*
238 * phase-lock loop variables
239 */
240extern int time_status; /* clock synchronization status bits */
241
242extern void ntp_init(void); 237extern void ntp_init(void);
243extern void ntp_clear(void); 238extern void ntp_clear(void);
244 239
245/**
246 * ntp_synced - Returns 1 if the NTP status is not UNSYNC
247 *
248 */
249static inline int ntp_synced(void)
250{
251 return !(time_status & STA_UNSYNC);
252}
253
254/* Required to safely shift negative values */ 240/* Required to safely shift negative values */
255#define shift_right(x, s) ({ \ 241#define shift_right(x, s) ({ \
256 __typeof__(x) __x = (x); \ 242 __typeof__(x) __x = (x); \
@@ -264,10 +250,9 @@ static inline int ntp_synced(void)
264#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 250#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
265 251
266/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 252/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
267extern u64 tick_length; 253extern u64 ntp_tick_length(void);
268 254
269extern void second_overflow(void); 255extern void second_overflow(void);
270extern void update_ntp_one_tick(void);
271extern int do_adjtimex(struct timex *); 256extern int do_adjtimex(struct timex *);
272extern void hardpps(const struct timespec *, const struct timespec *); 257extern void hardpps(const struct timespec *, const struct timespec *);
273 258
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index 7dadc3df0c77..a32d86ec8bf2 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -44,7 +44,7 @@ extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len);
44extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, 44extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
45 size_t len); 45 size_t len);
46extern void *trace_seq_reserve(struct trace_seq *s, size_t len); 46extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
47extern int trace_seq_path(struct trace_seq *s, struct path *path); 47extern int trace_seq_path(struct trace_seq *s, const struct path *path);
48 48
49#else /* CONFIG_TRACING */ 49#else /* CONFIG_TRACING */
50static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) 50static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
@@ -88,7 +88,7 @@ static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
88{ 88{
89 return NULL; 89 return NULL;
90} 90}
91static inline int trace_seq_path(struct trace_seq *s, struct path *path) 91static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
92{ 92{
93 return 0; 93 return 0;
94} 94}
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index a71a2927a6a0..51bd91d911c3 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -54,12 +54,12 @@ struct linux_binprm;
54/* 54/*
55 * ptrace report for syscall entry and exit looks identical. 55 * ptrace report for syscall entry and exit looks identical.
56 */ 56 */
57static inline void ptrace_report_syscall(struct pt_regs *regs) 57static inline int ptrace_report_syscall(struct pt_regs *regs)
58{ 58{
59 int ptrace = current->ptrace; 59 int ptrace = current->ptrace;
60 60
61 if (!(ptrace & PT_PTRACED)) 61 if (!(ptrace & PT_PTRACED))
62 return; 62 return 0;
63 63
64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); 64 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
65 65
@@ -72,6 +72,8 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
72 send_sig(current->exit_code, current, 1); 72 send_sig(current->exit_code, current, 1);
73 current->exit_code = 0; 73 current->exit_code = 0;
74 } 74 }
75
76 return fatal_signal_pending(current);
75} 77}
76 78
77/** 79/**
@@ -96,8 +98,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs)
96static inline __must_check int tracehook_report_syscall_entry( 98static inline __must_check int tracehook_report_syscall_entry(
97 struct pt_regs *regs) 99 struct pt_regs *regs)
98{ 100{
99 ptrace_report_syscall(regs); 101 return ptrace_report_syscall(regs);
100 return 0;
101} 102}
102 103
103/** 104/**
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index df0a779c1bbd..bd96ecd0e05c 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -17,7 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
20#include <linux/jump_label.h> 20#include <linux/static_key.h>
21 21
22struct module; 22struct module;
23struct tracepoint; 23struct tracepoint;
@@ -29,7 +29,7 @@ struct tracepoint_func {
29 29
30struct tracepoint { 30struct tracepoint {
31 const char *name; /* Tracepoint name */ 31 const char *name; /* Tracepoint name */
32 struct jump_label_key key; 32 struct static_key key;
33 void (*regfunc)(void); 33 void (*regfunc)(void);
34 void (*unregfunc)(void); 34 void (*unregfunc)(void);
35 struct tracepoint_func __rcu *funcs; 35 struct tracepoint_func __rcu *funcs;
@@ -114,7 +114,7 @@ static inline void tracepoint_synchronize_unregister(void)
114 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just 114 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
115 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto". 115 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
116 */ 116 */
117#define __DO_TRACE(tp, proto, args, cond) \ 117#define __DO_TRACE(tp, proto, args, cond, prercu, postrcu) \
118 do { \ 118 do { \
119 struct tracepoint_func *it_func_ptr; \ 119 struct tracepoint_func *it_func_ptr; \
120 void *it_func; \ 120 void *it_func; \
@@ -122,6 +122,7 @@ static inline void tracepoint_synchronize_unregister(void)
122 \ 122 \
123 if (!(cond)) \ 123 if (!(cond)) \
124 return; \ 124 return; \
125 prercu; \
125 rcu_read_lock_sched_notrace(); \ 126 rcu_read_lock_sched_notrace(); \
126 it_func_ptr = rcu_dereference_sched((tp)->funcs); \ 127 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
127 if (it_func_ptr) { \ 128 if (it_func_ptr) { \
@@ -132,6 +133,7 @@ static inline void tracepoint_synchronize_unregister(void)
132 } while ((++it_func_ptr)->func); \ 133 } while ((++it_func_ptr)->func); \
133 } \ 134 } \
134 rcu_read_unlock_sched_notrace(); \ 135 rcu_read_unlock_sched_notrace(); \
136 postrcu; \
135 } while (0) 137 } while (0)
136 138
137/* 139/*
@@ -139,15 +141,25 @@ static inline void tracepoint_synchronize_unregister(void)
139 * not add unwanted padding between the beginning of the section and the 141 * not add unwanted padding between the beginning of the section and the
140 * structure. Force alignment to the same alignment as the section start. 142 * structure. Force alignment to the same alignment as the section start.
141 */ 143 */
142#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 144#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
143 extern struct tracepoint __tracepoint_##name; \ 145 extern struct tracepoint __tracepoint_##name; \
144 static inline void trace_##name(proto) \ 146 static inline void trace_##name(proto) \
145 { \ 147 { \
148 if (static_key_false(&__tracepoint_##name.key)) \
149 __DO_TRACE(&__tracepoint_##name, \
150 TP_PROTO(data_proto), \
151 TP_ARGS(data_args), \
152 TP_CONDITION(cond),,); \
153 } \
154 static inline void trace_##name##_rcuidle(proto) \
155 { \
146 if (static_branch(&__tracepoint_##name.key)) \ 156 if (static_branch(&__tracepoint_##name.key)) \
147 __DO_TRACE(&__tracepoint_##name, \ 157 __DO_TRACE(&__tracepoint_##name, \
148 TP_PROTO(data_proto), \ 158 TP_PROTO(data_proto), \
149 TP_ARGS(data_args), \ 159 TP_ARGS(data_args), \
150 TP_CONDITION(cond)); \ 160 TP_CONDITION(cond), \
161 rcu_idle_exit(), \
162 rcu_idle_enter()); \
151 } \ 163 } \
152 static inline int \ 164 static inline int \
153 register_trace_##name(void (*probe)(data_proto), void *data) \ 165 register_trace_##name(void (*probe)(data_proto), void *data) \
@@ -176,7 +188,7 @@ static inline void tracepoint_synchronize_unregister(void)
176 __attribute__((section("__tracepoints_strings"))) = #name; \ 188 __attribute__((section("__tracepoints_strings"))) = #name; \
177 struct tracepoint __tracepoint_##name \ 189 struct tracepoint __tracepoint_##name \
178 __attribute__((section("__tracepoints"))) = \ 190 __attribute__((section("__tracepoints"))) = \
179 { __tpstrtab_##name, JUMP_LABEL_INIT, reg, unreg, NULL };\ 191 { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
180 static struct tracepoint * const __tracepoint_ptr_##name __used \ 192 static struct tracepoint * const __tracepoint_ptr_##name __used \
181 __attribute__((section("__tracepoints_ptrs"))) = \ 193 __attribute__((section("__tracepoints_ptrs"))) = \
182 &__tracepoint_##name; 194 &__tracepoint_##name;
@@ -190,9 +202,11 @@ static inline void tracepoint_synchronize_unregister(void)
190 EXPORT_SYMBOL(__tracepoint_##name) 202 EXPORT_SYMBOL(__tracepoint_##name)
191 203
192#else /* !CONFIG_TRACEPOINTS */ 204#else /* !CONFIG_TRACEPOINTS */
193#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 205#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
194 static inline void trace_##name(proto) \ 206 static inline void trace_##name(proto) \
195 { } \ 207 { } \
208 static inline void trace_##name##_rcuidle(proto) \
209 { } \
196 static inline int \ 210 static inline int \
197 register_trace_##name(void (*probe)(data_proto), \ 211 register_trace_##name(void (*probe)(data_proto), \
198 void *data) \ 212 void *data) \
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 9ae8da3e6407..11087cdd4ad3 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -10,6 +10,7 @@
10#define _TRANSPORT_CLASS_H_ 10#define _TRANSPORT_CLASS_H_
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/bug.h>
13#include <linux/attribute_container.h> 14#include <linux/attribute_container.h>
14 15
15struct transport_container; 16struct transport_container;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5dbb3cb05a82..a91ff403b3bf 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -52,6 +52,7 @@
52 * hardcoded at present.) 52 * hardcoded at present.)
53 */ 53 */
54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
55#define NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */
55#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 56#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
56 57
57/* 58/*
@@ -480,10 +481,11 @@ extern void free_tty_struct(struct tty_struct *tty);
480extern void initialize_tty_struct(struct tty_struct *tty, 481extern void initialize_tty_struct(struct tty_struct *tty,
481 struct tty_driver *driver, int idx); 482 struct tty_driver *driver, int idx);
482extern void deinitialize_tty_struct(struct tty_struct *tty); 483extern void deinitialize_tty_struct(struct tty_struct *tty);
483extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, 484extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
484 int first_ok);
485extern int tty_release(struct inode *inode, struct file *filp); 485extern int tty_release(struct inode *inode, struct file *filp);
486extern int tty_init_termios(struct tty_struct *tty); 486extern int tty_init_termios(struct tty_struct *tty);
487extern int tty_standard_install(struct tty_driver *driver,
488 struct tty_struct *tty);
487 489
488extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); 490extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
489extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); 491extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 5cf685086dd3..6e6dbb7447b6 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -50,6 +50,8 @@
50 * Note that tty_shutdown() is not called if ops->shutdown is defined. 50 * Note that tty_shutdown() is not called if ops->shutdown is defined.
51 * This means one is responsible to take care of calling ops->remove (e.g. 51 * This means one is responsible to take care of calling ops->remove (e.g.
52 * via tty_driver_remove_tty) and releasing tty->termios. 52 * via tty_driver_remove_tty) and releasing tty->termios.
53 * Note that this hook may be called from *all* the contexts where one
54 * uses tty refcounting (e.g. tty_port_tty_get).
53 * 55 *
54 * 56 *
55 * void (*cleanup)(struct tty_struct * tty); 57 * void (*cleanup)(struct tty_struct * tty);
@@ -234,6 +236,7 @@
234 * if provided (otherwise EINVAL will be returned). 236 * if provided (otherwise EINVAL will be returned).
235 */ 237 */
236 238
239#include <linux/export.h>
237#include <linux/fs.h> 240#include <linux/fs.h>
238#include <linux/list.h> 241#include <linux/list.h>
239#include <linux/cdev.h> 242#include <linux/cdev.h>
@@ -298,7 +301,6 @@ struct tty_driver {
298 int name_base; /* offset of printed name */ 301 int name_base; /* offset of printed name */
299 int major; /* major device number */ 302 int major; /* major device number */
300 int minor_start; /* start of minor device number */ 303 int minor_start; /* start of minor device number */
301 int minor_num; /* number of *possible* devices */
302 int num; /* number of devices allocated */ 304 int num; /* number of devices allocated */
303 short type; /* type of tty driver */ 305 short type; /* type of tty driver */
304 short subtype; /* subtype of tty driver */ 306 short subtype; /* subtype of tty driver */
@@ -324,7 +326,7 @@ struct tty_driver {
324 326
325extern struct list_head tty_drivers; 327extern struct list_head tty_drivers;
326 328
327extern struct tty_driver *alloc_tty_driver(int lines); 329extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner);
328extern void put_tty_driver(struct tty_driver *driver); 330extern void put_tty_driver(struct tty_driver *driver);
329extern void tty_set_operations(struct tty_driver *driver, 331extern void tty_set_operations(struct tty_driver *driver,
330 const struct tty_operations *op); 332 const struct tty_operations *op);
@@ -332,6 +334,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
332 334
333extern void tty_driver_kref_put(struct tty_driver *driver); 335extern void tty_driver_kref_put(struct tty_driver *driver);
334 336
337#define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE)
338
335static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 339static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
336{ 340{
337 kref_get(&d->kref); 341 kref_get(&d->kref);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 69d845739bc2..73b68d1f2cb0 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -376,6 +376,12 @@ struct usb_bus {
376 376
377struct usb_tt; 377struct usb_tt;
378 378
379enum usb_device_removable {
380 USB_DEVICE_REMOVABLE_UNKNOWN = 0,
381 USB_DEVICE_REMOVABLE,
382 USB_DEVICE_FIXED,
383};
384
379/** 385/**
380 * struct usb_device - kernel's representation of a USB device 386 * struct usb_device - kernel's representation of a USB device
381 * @devnum: device number; address on a USB bus 387 * @devnum: device number; address on a USB bus
@@ -432,6 +438,7 @@ struct usb_tt;
432 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 438 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
433 * specific data for the device. 439 * specific data for the device.
434 * @slot_id: Slot ID assigned by xHCI 440 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port
435 * 442 *
436 * Notes: 443 * Notes:
437 * Usbcore drivers should not set usbdev->state directly. Instead use 444 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -494,7 +501,7 @@ struct usb_device {
494#endif 501#endif
495 502
496 int maxchild; 503 int maxchild;
497 struct usb_device *children[USB_MAXCHILDREN]; 504 struct usb_device **children;
498 505
499 u32 quirks; 506 u32 quirks;
500 atomic_t urbnum; 507 atomic_t urbnum;
@@ -509,6 +516,7 @@ struct usb_device {
509#endif 516#endif
510 struct wusb_dev *wusb_dev; 517 struct wusb_dev *wusb_dev;
511 int slot_id; 518 int slot_id;
519 enum usb_device_removable removable;
512}; 520};
513#define to_usb_device(d) container_of(d, struct usb_device, dev) 521#define to_usb_device(d) container_of(d, struct usb_device, dev)
514 522
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index 964cb603f7c7..ed13053153f4 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -43,6 +43,27 @@ static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
43 return (bmControls >> (control * 2)) & 0x2; 43 return (bmControls >> (control * 2)) & 0x2;
44} 44}
45 45
46/* 4.7.2 Class-Specific AC Interface Descriptor */
47struct uac2_ac_header_descriptor {
48 __u8 bLength; /* 9 */
49 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
50 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
51 __le16 bcdADC; /* 0x0200 */
52 __u8 bCategory;
53 __le16 wTotalLength; /* includes Unit and Terminal desc. */
54 __u8 bmControls;
55} __packed;
56
57/* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/
58struct uac2_format_type_i_descriptor {
59 __u8 bLength; /* in bytes: 6 */
60 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
61 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
62 __u8 bFormatType; /* FORMAT_TYPE_1 */
63 __u8 bSubslotSize; /* {1,2,3,4} */
64 __u8 bBitResolution;
65} __packed;
66
46/* 4.7.2.1 Clock Source Descriptor */ 67/* 4.7.2.1 Clock Source Descriptor */
47 68
48struct uac_clock_source_descriptor { 69struct uac_clock_source_descriptor {
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h
new file mode 100644
index 000000000000..719c332620fa
--- /dev/null
+++ b/include/linux/usb/cdc-wdm.h
@@ -0,0 +1,19 @@
1/*
2 * USB CDC Device Management subdriver
3 *
4 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_USB_CDC_WDM_H
12#define __LINUX_USB_CDC_WDM_H
13
14extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,
15 struct usb_endpoint_descriptor *ep,
16 int bufsize,
17 int (*manage_power)(struct usb_interface *, int));
18
19#endif /* __LINUX_USB_CDC_WDM_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 0b83acd3360a..f1d26b6067f1 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -76,6 +76,11 @@
76#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
78 78
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
82#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
83
79/* 84/*
80 * Hub Status and Hub Change results 85 * Hub Status and Hub Change results
81 * See USB 2.0 spec Table 11-19 and Table 11-20 86 * See USB 2.0 spec Table 11-19 and Table 11-20
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 3b6f628880f8..af21f3115919 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -789,6 +789,11 @@ struct usb_ext_cap_descriptor { /* Link Power Management */
789 __u8 bDevCapabilityType; 789 __u8 bDevCapabilityType;
790 __le32 bmAttributes; 790 __le32 bmAttributes;
791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ 791#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
792#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
793#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
794#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
795#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
796#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
792} __attribute__((packed)); 797} __attribute__((packed));
793 798
794#define USB_DT_USB_EXT_CAP_SIZE 7 799#define USB_DT_USB_EXT_CAP_SIZE 7
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
new file mode 100644
index 000000000000..1894f42fe3f7
--- /dev/null
+++ b/include/linux/usb/ehci_pdriver.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_EHCI_PDRIVER_H
20#define __USB_CORE_EHCI_PDRIVER_H
21
22/**
23 * struct usb_ehci_pdata - platform_data for generic ehci driver
24 *
25 * @caps_offset: offset of the EHCI Capability Registers to the start of
26 * the io memory region provided to the driver.
27 * @has_tt: set to 1 if TT is integrated in root hub.
28 * @port_power_on: set to 1 if the controller needs a power up after
29 * initialization.
30 * @port_power_off: set to 1 if the controller needs to be powered down
31 * after initialization.
32 *
33 * These are general configuration options for the EHCI controller. All of
34 * these options are activating more or less workarounds for some hardware.
35 */
36struct usb_ehci_pdata {
37 int caps_offset;
38 unsigned has_tt:1;
39 unsigned has_synopsys_hc_bug:1;
40 unsigned big_endian_desc:1;
41 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1;
43 unsigned port_power_off:1;
44};
45
46#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index da653b5c7134..9517466ababb 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -950,6 +950,16 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
950 950
951/*-------------------------------------------------------------------------*/ 951/*-------------------------------------------------------------------------*/
952 952
953/* utility to simplify map/unmap of usb_requests to/from DMA */
954
955extern int usb_gadget_map_request(struct usb_gadget *gadget,
956 struct usb_request *req, int is_in);
957
958extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
959 struct usb_request *req, int is_in);
960
961/*-------------------------------------------------------------------------*/
962
953/* utility wrapping a simple endpoint selection policy */ 963/* utility wrapping a simple endpoint selection policy */
954 964
955extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 965extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b2f62f3a32af..5de415707c23 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -127,7 +127,7 @@ struct usb_hcd {
127 unsigned authorized_default:1; 127 unsigned authorized_default:1;
128 unsigned has_tt:1; /* Integrated TT in root hub */ 128 unsigned has_tt:1; /* Integrated TT in root hub */
129 129
130 int irq; /* irq allocated */ 130 unsigned int irq; /* irq allocated */
131 void __iomem *regs; /* device memory/io */ 131 void __iomem *regs; /* device memory/io */
132 u64 rsrc_start; /* memory/io resource start */ 132 u64 rsrc_start; /* memory/io resource start */
133 u64 rsrc_len; /* memory/io resource length */ 133 u64 rsrc_len; /* memory/io resource length */
@@ -412,6 +412,8 @@ extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
412 412
413extern void usb_hc_died(struct usb_hcd *hcd); 413extern void usb_hc_died(struct usb_hcd *hcd);
414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); 414extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
415extern void usb_wakeup_notification(struct usb_device *hdev,
416 unsigned int portnum);
415 417
416/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 418/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
417#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 419#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
index a0ccf795f362..756cf5543ffd 100644
--- a/include/linux/usb/intel_mid_otg.h
+++ b/include/linux/usb/intel_mid_otg.h
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops {
104/* 104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact 105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More 106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on otg_transceiver data structure for this 107 * function members are added based on usb_phy data structure for this
108 * purpose. 108 * purpose.
109 */ 109 */
110struct intel_mid_otg_xceiv { 110struct intel_mid_otg_xceiv {
111 struct otg_transceiver otg; 111 struct usb_phy otg;
112 struct otg_hsm hsm; 112 struct otg_hsm hsm;
113 113
114 /* base address */ 114 /* base address */
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv {
147 147
148}; 148};
149static inline 149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) 150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{ 151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg); 152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153} 153}
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 00311fe9d0df..22a396c13f3a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -160,7 +160,7 @@ struct msm_otg_platform_data {
160 * detection process. 160 * detection process.
161 */ 161 */
162struct msm_otg { 162struct msm_otg {
163 struct otg_transceiver otg; 163 struct usb_phy phy;
164 struct msm_otg_platform_data *pdata; 164 struct msm_otg_platform_data *pdata;
165 int irq; 165 int irq;
166 struct clk *clk; 166 struct clk *clk;
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
new file mode 100644
index 000000000000..2808f2a9cce8
--- /dev/null
+++ b/include/linux/usb/ohci_pdriver.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_OHCI_PDRIVER_H
20#define __USB_CORE_OHCI_PDRIVER_H
21
22/**
23 * struct usb_ohci_pdata - platform_data for generic ohci driver
24 *
25 * @big_endian_desc: BE descriptors
26 * @big_endian_mmio: BE registers
27 * @no_big_frame_no: no big endian frame_no shift
28 *
29 * These are general configuration options for the OHCI controller. All of
30 * these options are activating more or less workarounds for some hardware.
31 */
32struct usb_ohci_pdata {
33 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1;
36};
37
38#endif /* __USB_CORE_OHCI_PDRIVER_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index d87f44f5b04e..f67810f8f21b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -35,7 +35,7 @@ enum usb_otg_state {
35 OTG_STATE_A_VBUS_ERR, 35 OTG_STATE_A_VBUS_ERR,
36}; 36};
37 37
38enum usb_xceiv_events { 38enum usb_phy_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */ 39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */ 40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */ 41 USB_EVENT_ID, /* id was grounded */
@@ -43,14 +43,39 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46struct otg_transceiver; 46struct usb_phy;
47 47
48/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
49 * provide access ops 49 * provide access ops
50 */ 50 */
51struct otg_io_access_ops { 51struct usb_phy_io_ops {
52 int (*read)(struct otg_transceiver *otg, u32 reg); 52 int (*read)(struct usb_phy *x, u32 reg);
53 int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); 53 int (*write)(struct usb_phy *x, u32 val, u32 reg);
54};
55
56struct usb_otg {
57 u8 default_a;
58
59 struct usb_phy *phy;
60 struct usb_bus *host;
61 struct usb_gadget *gadget;
62
63 /* bind/unbind the host controller */
64 int (*set_host)(struct usb_otg *otg, struct usb_bus *host);
65
66 /* bind/unbind the peripheral controller */
67 int (*set_peripheral)(struct usb_otg *otg,
68 struct usb_gadget *gadget);
69
70 /* effective for A-peripheral, ignored for B devices */
71 int (*set_vbus)(struct usb_otg *otg, bool enabled);
72
73 /* for B devices only: start session with A-Host */
74 int (*start_srp)(struct usb_otg *otg);
75
76 /* start or continue HNP role switch */
77 int (*start_hnp)(struct usb_otg *otg);
78
54}; 79};
55 80
56/* 81/*
@@ -59,22 +84,20 @@ struct otg_io_access_ops {
59 * moment, using the transceiver, ID signal, HNP and sometimes static 84 * moment, using the transceiver, ID signal, HNP and sometimes static
60 * configuration information (including "board isn't wired for otg"). 85 * configuration information (including "board isn't wired for otg").
61 */ 86 */
62struct otg_transceiver { 87struct usb_phy {
63 struct device *dev; 88 struct device *dev;
64 const char *label; 89 const char *label;
65 unsigned int flags; 90 unsigned int flags;
66 91
67 u8 default_a;
68 enum usb_otg_state state; 92 enum usb_otg_state state;
69 enum usb_xceiv_events last_event; 93 enum usb_phy_events last_event;
70 94
71 struct usb_bus *host; 95 struct usb_otg *otg;
72 struct usb_gadget *gadget;
73 96
74 struct otg_io_access_ops *io_ops; 97 struct usb_phy_io_ops *io_ops;
75 void __iomem *io_priv; 98 void __iomem *io_priv;
76 99
77 /* for notification of usb_xceiv_events */ 100 /* for notification of usb_phy_events */
78 struct atomic_notifier_head notifier; 101 struct atomic_notifier_head notifier;
79 102
80 /* to pass extra port status to the root hub */ 103 /* to pass extra port status to the root hub */
@@ -82,40 +105,22 @@ struct otg_transceiver {
82 u16 port_change; 105 u16 port_change;
83 106
84 /* initialize/shutdown the OTG controller */ 107 /* initialize/shutdown the OTG controller */
85 int (*init)(struct otg_transceiver *otg); 108 int (*init)(struct usb_phy *x);
86 void (*shutdown)(struct otg_transceiver *otg); 109 void (*shutdown)(struct usb_phy *x);
87
88 /* bind/unbind the host controller */
89 int (*set_host)(struct otg_transceiver *otg,
90 struct usb_bus *host);
91
92 /* bind/unbind the peripheral controller */
93 int (*set_peripheral)(struct otg_transceiver *otg,
94 struct usb_gadget *gadget);
95 110
96 /* effective for B devices, ignored for A-peripheral */ 111 /* effective for B devices, ignored for A-peripheral */
97 int (*set_power)(struct otg_transceiver *otg, 112 int (*set_power)(struct usb_phy *x,
98 unsigned mA); 113 unsigned mA);
99 114
100 /* effective for A-peripheral, ignored for B devices */
101 int (*set_vbus)(struct otg_transceiver *otg,
102 bool enabled);
103
104 /* for non-OTG B devices: set transceiver into suspend mode */ 115 /* for non-OTG B devices: set transceiver into suspend mode */
105 int (*set_suspend)(struct otg_transceiver *otg, 116 int (*set_suspend)(struct usb_phy *x,
106 int suspend); 117 int suspend);
107 118
108 /* for B devices only: start session with A-Host */
109 int (*start_srp)(struct otg_transceiver *otg);
110
111 /* start or continue HNP role switch */
112 int (*start_hnp)(struct otg_transceiver *otg);
113
114}; 119};
115 120
116 121
117/* for board-specific init logic */ 122/* for board-specific init logic */
118extern int otg_set_transceiver(struct otg_transceiver *); 123extern int usb_set_transceiver(struct usb_phy *);
119 124
120#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 125#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
121/* sometimes transceivers are accessed only through e.g. ULPI */ 126/* sometimes transceivers are accessed only through e.g. ULPI */
@@ -132,50 +137,50 @@ static inline void usb_nop_xceiv_unregister(void)
132#endif 137#endif
133 138
134/* helpers for direct access thru low-level io interface */ 139/* helpers for direct access thru low-level io interface */
135static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) 140static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
136{ 141{
137 if (otg->io_ops && otg->io_ops->read) 142 if (x->io_ops && x->io_ops->read)
138 return otg->io_ops->read(otg, reg); 143 return x->io_ops->read(x, reg);
139 144
140 return -EINVAL; 145 return -EINVAL;
141} 146}
142 147
143static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) 148static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
144{ 149{
145 if (otg->io_ops && otg->io_ops->write) 150 if (x->io_ops && x->io_ops->write)
146 return otg->io_ops->write(otg, val, reg); 151 return x->io_ops->write(x, val, reg);
147 152
148 return -EINVAL; 153 return -EINVAL;
149} 154}
150 155
151static inline int 156static inline int
152otg_init(struct otg_transceiver *otg) 157usb_phy_init(struct usb_phy *x)
153{ 158{
154 if (otg->init) 159 if (x->init)
155 return otg->init(otg); 160 return x->init(x);
156 161
157 return 0; 162 return 0;
158} 163}
159 164
160static inline void 165static inline void
161otg_shutdown(struct otg_transceiver *otg) 166usb_phy_shutdown(struct usb_phy *x)
162{ 167{
163 if (otg->shutdown) 168 if (x->shutdown)
164 otg->shutdown(otg); 169 x->shutdown(x);
165} 170}
166 171
167/* for usb host and peripheral controller drivers */ 172/* for usb host and peripheral controller drivers */
168#ifdef CONFIG_USB_OTG_UTILS 173#ifdef CONFIG_USB_OTG_UTILS
169extern struct otg_transceiver *otg_get_transceiver(void); 174extern struct usb_phy *usb_get_transceiver(void);
170extern void otg_put_transceiver(struct otg_transceiver *); 175extern void usb_put_transceiver(struct usb_phy *);
171extern const char *otg_state_string(enum usb_otg_state state); 176extern const char *otg_state_string(enum usb_otg_state state);
172#else 177#else
173static inline struct otg_transceiver *otg_get_transceiver(void) 178static inline struct usb_phy *usb_get_transceiver(void)
174{ 179{
175 return NULL; 180 return NULL;
176} 181}
177 182
178static inline void otg_put_transceiver(struct otg_transceiver *x) 183static inline void usb_put_transceiver(struct usb_phy *x)
179{ 184{
180} 185}
181 186
@@ -187,67 +192,84 @@ static inline const char *otg_state_string(enum usb_otg_state state)
187 192
188/* Context: can sleep */ 193/* Context: can sleep */
189static inline int 194static inline int
190otg_start_hnp(struct otg_transceiver *otg) 195otg_start_hnp(struct usb_otg *otg)
191{ 196{
192 return otg->start_hnp(otg); 197 if (otg && otg->start_hnp)
198 return otg->start_hnp(otg);
199
200 return -ENOTSUPP;
193} 201}
194 202
195/* Context: can sleep */ 203/* Context: can sleep */
196static inline int 204static inline int
197otg_set_vbus(struct otg_transceiver *otg, bool enabled) 205otg_set_vbus(struct usb_otg *otg, bool enabled)
198{ 206{
199 return otg->set_vbus(otg, enabled); 207 if (otg && otg->set_vbus)
208 return otg->set_vbus(otg, enabled);
209
210 return -ENOTSUPP;
200} 211}
201 212
202/* for HCDs */ 213/* for HCDs */
203static inline int 214static inline int
204otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) 215otg_set_host(struct usb_otg *otg, struct usb_bus *host)
205{ 216{
206 return otg->set_host(otg, host); 217 if (otg && otg->set_host)
218 return otg->set_host(otg, host);
219
220 return -ENOTSUPP;
207} 221}
208 222
209/* for usb peripheral controller drivers */ 223/* for usb peripheral controller drivers */
210 224
211/* Context: can sleep */ 225/* Context: can sleep */
212static inline int 226static inline int
213otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 227otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph)
214{ 228{
215 return otg->set_peripheral(otg, periph); 229 if (otg && otg->set_peripheral)
230 return otg->set_peripheral(otg, periph);
231
232 return -ENOTSUPP;
216} 233}
217 234
218static inline int 235static inline int
219otg_set_power(struct otg_transceiver *otg, unsigned mA) 236usb_phy_set_power(struct usb_phy *x, unsigned mA)
220{ 237{
221 return otg->set_power(otg, mA); 238 if (x && x->set_power)
239 return x->set_power(x, mA);
240 return 0;
222} 241}
223 242
224/* Context: can sleep */ 243/* Context: can sleep */
225static inline int 244static inline int
226otg_set_suspend(struct otg_transceiver *otg, int suspend) 245usb_phy_set_suspend(struct usb_phy *x, int suspend)
227{ 246{
228 if (otg->set_suspend != NULL) 247 if (x->set_suspend != NULL)
229 return otg->set_suspend(otg, suspend); 248 return x->set_suspend(x, suspend);
230 else 249 else
231 return 0; 250 return 0;
232} 251}
233 252
234static inline int 253static inline int
235otg_start_srp(struct otg_transceiver *otg) 254otg_start_srp(struct usb_otg *otg)
236{ 255{
237 return otg->start_srp(otg); 256 if (otg && otg->start_srp)
257 return otg->start_srp(otg);
258
259 return -ENOTSUPP;
238} 260}
239 261
240/* notifiers */ 262/* notifiers */
241static inline int 263static inline int
242otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 264usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
243{ 265{
244 return atomic_notifier_chain_register(&otg->notifier, nb); 266 return atomic_notifier_chain_register(&x->notifier, nb);
245} 267}
246 268
247static inline void 269static inline void
248otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 270usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
249{ 271{
250 atomic_notifier_chain_unregister(&otg->notifier, nb); 272 atomic_notifier_chain_unregister(&x->notifier, nb);
251} 273}
252 274
253/* for OTG controller drivers (and maybe other stuff) */ 275/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 0d3f98879256..547e59cc00ea 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -149,6 +149,7 @@ struct renesas_usbhs_driver_param {
149 * option: 149 * option:
150 */ 150 */
151 u32 has_otg:1; /* for controlling PWEN/EXTLP */ 151 u32 has_otg:1; /* for controlling PWEN/EXTLP */
152 u32 has_sudmac:1; /* for SUDMAC */
152}; 153};
153 154
154/* 155/*
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 4267a9c717ba..fbb666b1b670 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -300,8 +300,10 @@ struct usb_serial_driver {
300#define to_usb_serial_driver(d) \ 300#define to_usb_serial_driver(d) \
301 container_of(d, struct usb_serial_driver, driver) 301 container_of(d, struct usb_serial_driver, driver)
302 302
303extern int usb_serial_register(struct usb_serial_driver *driver); 303extern int usb_serial_register_drivers(struct usb_driver *udriver,
304extern void usb_serial_deregister(struct usb_serial_driver *driver); 304 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_deregister_drivers(struct usb_driver *udriver,
306 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_port_softint(struct usb_serial_port *port); 307extern void usb_serial_port_softint(struct usb_serial_port *port);
306 308
307extern int usb_serial_probe(struct usb_interface *iface, 309extern int usb_serial_probe(struct usb_interface *iface,
@@ -389,5 +391,35 @@ do { \
389 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ 391 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
390} while (0) 392} while (0)
391 393
394/*
395 * Macro for reporting errors in write path to avoid inifinite loop
396 * when port is used as a console.
397 */
398#define dev_err_console(usport, fmt, ...) \
399do { \
400 static bool __print_once; \
401 struct usb_serial_port *__port = (usport); \
402 \
403 if (!__port->port.console || !__print_once) { \
404 __print_once = true; \
405 dev_err(&__port->dev, fmt, ##__VA_ARGS__); \
406 } \
407} while (0)
408
409/*
410 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
411 * @__usb_driver: usb_driver struct to register
412 * @__serial_drivers: list of usb_serial drivers to register
413 *
414 * Helper macro for USB serial drivers which do not do anything special
415 * in module init/exit. This eliminates a lot of boilerplate. Each
416 * module may only use this macro once, and calling it replaces
417 * module_init() and module_exit()
418 *
419 */
420#define module_usb_serial_driver(__usb_driver, __serial_drivers) \
421 module_driver(__usb_driver, usb_serial_register_drivers, \
422 usb_serial_deregister_drivers, __serial_drivers)
423
392#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
393 425
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h
index d7fc910f1dc4..cb33fff2ba0b 100644
--- a/include/linux/usb/storage.h
+++ b/include/linux/usb/storage.h
@@ -45,4 +45,42 @@
45 45
46#define USB_PR_DEVICE 0xff /* Use device's value */ 46#define USB_PR_DEVICE 0xff /* Use device's value */
47 47
48 /*
49 * Bulk only data structures
50 */
51
52/* command block wrapper */
53struct bulk_cb_wrap {
54 __le32 Signature; /* contains 'USBC' */
55 __u32 Tag; /* unique per command id */
56 __le32 DataTransferLength; /* size of data */
57 __u8 Flags; /* direction in bit 0 */
58 __u8 Lun; /* LUN normally 0 */
59 __u8 Length; /* of of the CDB */
60 __u8 CDB[16]; /* max command */
61};
62
63#define US_BULK_CB_WRAP_LEN 31
64#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */
65#define US_BULK_FLAG_IN (1 << 7)
66#define US_BULK_FLAG_OUT 0
67
68/* command status wrapper */
69struct bulk_cs_wrap {
70 __le32 Signature; /* should = 'USBS' */
71 __u32 Tag; /* same as original command */
72 __le32 Residue; /* amount not transferred */
73 __u8 Status; /* see below */
74};
75
76#define US_BULK_CS_WRAP_LEN 13
77#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
78#define US_BULK_STAT_OK 0
79#define US_BULK_STAT_FAIL 1
80#define US_BULK_STAT_PHASE 2
81
82/* bulk-only class specific requests */
83#define US_BULK_RESET_REQUEST 0xff
84#define US_BULK_GET_MAX_LUN 0xfe
85
48#endif 86#endif
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
new file mode 100644
index 000000000000..9a988e413694
--- /dev/null
+++ b/include/linux/usb/uas.h
@@ -0,0 +1,69 @@
1#ifndef __USB_UAS_H__
2#define __USB_UAS_H__
3
4#include <scsi/scsi.h>
5#include <scsi/scsi_cmnd.h>
6
7/* Common header for all IUs */
8struct iu {
9 __u8 iu_id;
10 __u8 rsvd1;
11 __be16 tag;
12};
13
14enum {
15 IU_ID_COMMAND = 0x01,
16 IU_ID_STATUS = 0x03,
17 IU_ID_RESPONSE = 0x04,
18 IU_ID_TASK_MGMT = 0x05,
19 IU_ID_READ_READY = 0x06,
20 IU_ID_WRITE_READY = 0x07,
21};
22
23struct command_iu {
24 __u8 iu_id;
25 __u8 rsvd1;
26 __be16 tag;
27 __u8 prio_attr;
28 __u8 rsvd5;
29 __u8 len;
30 __u8 rsvd7;
31 struct scsi_lun lun;
32 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
33};
34
35/*
36 * Also used for the Read Ready and Write Ready IUs since they have the
37 * same first four bytes
38 */
39struct sense_iu {
40 __u8 iu_id;
41 __u8 rsvd1;
42 __be16 tag;
43 __be16 status_qual;
44 __u8 status;
45 __u8 rsvd7[7];
46 __be16 len;
47 __u8 sense[SCSI_SENSE_BUFFERSIZE];
48};
49
50struct usb_pipe_usage_descriptor {
51 __u8 bLength;
52 __u8 bDescriptorType;
53
54 __u8 bPipeID;
55 __u8 Reserved;
56} __attribute__((__packed__));
57
58enum {
59 CMD_PIPE_ID = 1,
60 STATUS_PIPE_ID = 2,
61 DATA_IN_PIPE_ID = 3,
62 DATA_OUT_PIPE_ID = 4,
63
64 UAS_SIMPLE_TAG = 0,
65 UAS_HEAD_TAG = 1,
66 UAS_ORDERED_TAG = 2,
67 UAS_ACA = 4,
68};
69#endif
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 9595796d62ed..6f033a415ecb 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -181,12 +181,12 @@
181 181
182/*-------------------------------------------------------------------------*/ 182/*-------------------------------------------------------------------------*/
183 183
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT 187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */ 188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops; 189extern struct usb_phy_io_ops ulpi_viewport_access_ops;
190#endif 190#endif
191 191
192#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5e11f8a1f867..c9c9a4680cc5 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -235,16 +235,25 @@ struct v4l2_fract {
235 __u32 denominator; 235 __u32 denominator;
236}; 236};
237 237
238/* 238/**
239 * D R I V E R C A P A B I L I T I E S 239 * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
240 */ 240 *
241 * @driver: name of the driver module (e.g. "bttv")
242 * @card: name of the card (e.g. "Hauppauge WinTV")
243 * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
244 * @version: KERNEL_VERSION
245 * @capabilities: capabilities of the physical device as a whole
246 * @device_caps: capabilities accessed via this particular device (node)
247 * @reserved: reserved fields for future extensions
248 */
241struct v4l2_capability { 249struct v4l2_capability {
242 __u8 driver[16]; /* i.e. "bttv" */ 250 __u8 driver[16];
243 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 251 __u8 card[32];
244 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 252 __u8 bus_info[32];
245 __u32 version; /* should use KERNEL_VERSION() */ 253 __u32 version;
246 __u32 capabilities; /* Device capabilities */ 254 __u32 capabilities;
247 __u32 reserved[4]; 255 __u32 device_caps;
256 __u32 reserved[3];
248}; 257};
249 258
250/* Values for 'capabilities' field */ 259/* Values for 'capabilities' field */
@@ -274,6 +283,8 @@ struct v4l2_capability {
274#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 283#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
275#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ 284#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
276 285
286#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
287
277/* 288/*
278 * V I D E O I M A G E F O R M A T 289 * V I D E O I M A G E F O R M A T
279 */ 290 */
@@ -751,20 +762,20 @@ struct v4l2_crop {
751 762
752/* Selection targets */ 763/* Selection targets */
753 764
754/* current cropping area */ 765/* Current cropping area */
755#define V4L2_SEL_TGT_CROP_ACTIVE 0 766#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000
756/* default cropping area */ 767/* Default cropping area */
757#define V4L2_SEL_TGT_CROP_DEFAULT 1 768#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
758/* cropping bounds */ 769/* Cropping bounds */
759#define V4L2_SEL_TGT_CROP_BOUNDS 2 770#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
760/* current composing area */ 771/* Current composing area */
761#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 772#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100
762/* default composing area */ 773/* Default composing area */
763#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 774#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
764/* composing bounds */ 775/* Composing bounds */
765#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 776#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
766/* current composing area plus all padding pixels */ 777/* Current composing area plus all padding pixels */
767#define V4L2_SEL_TGT_COMPOSE_PADDED 259 778#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
768 779
769/** 780/**
770 * struct v4l2_selection - selection info 781 * struct v4l2_selection - selection info
@@ -774,7 +785,7 @@ struct v4l2_crop {
774 * @r: coordinates of selection window 785 * @r: coordinates of selection window
775 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 786 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
776 * 787 *
777 * Hardware may use multiple helper window to process a video stream. 788 * Hardware may use multiple helper windows to process a video stream.
778 * The structure is used to exchange this selection areas between 789 * The structure is used to exchange this selection areas between
779 * an application and a driver. 790 * an application and a driver.
780 */ 791 */
@@ -1125,6 +1136,7 @@ struct v4l2_ext_controls {
1125#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 1136#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1126#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1137#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1127#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1138#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1139#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1128 1140
1129#define V4L2_CTRL_ID_MASK (0x0fffffff) 1141#define V4L2_CTRL_ID_MASK (0x0fffffff)
1130#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1142#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1396,6 +1408,16 @@ enum v4l2_mpeg_audio_ac3_bitrate {
1396 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, 1408 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1397 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, 1409 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1398}; 1410};
1411#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1412enum v4l2_mpeg_audio_dec_playback {
1413 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1414 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1415 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1416 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1417 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1418 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1419};
1420#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1399 1421
1400/* MPEG video controls specific to multiplexed streams */ 1422/* MPEG video controls specific to multiplexed streams */
1401#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1423#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1446,6 +1468,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
1446 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, 1468 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1447}; 1469};
1448#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) 1470#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1471#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1472#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1473
1449#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 1474#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1450#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 1475#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1451#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) 1476#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
@@ -1734,6 +1759,29 @@ enum v4l2_flash_strobe_source {
1734#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) 1759#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1735#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) 1760#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1736 1761
1762/* JPEG-class control IDs defined by V4L2 */
1763#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1764#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
1765
1766#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1767enum v4l2_jpeg_chroma_subsampling {
1768 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1769 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
1770 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
1771 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
1772 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1773 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1774};
1775#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1776#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
1777
1778#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1779#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1780#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1781#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1784
1737/* 1785/*
1738 * T U N I N G 1786 * T U N I N G
1739 */ 1787 */
@@ -1897,6 +1945,54 @@ struct v4l2_encoder_cmd {
1897 }; 1945 };
1898}; 1946};
1899 1947
1948/* Decoder commands */
1949#define V4L2_DEC_CMD_START (0)
1950#define V4L2_DEC_CMD_STOP (1)
1951#define V4L2_DEC_CMD_PAUSE (2)
1952#define V4L2_DEC_CMD_RESUME (3)
1953
1954/* Flags for V4L2_DEC_CMD_START */
1955#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
1956
1957/* Flags for V4L2_DEC_CMD_PAUSE */
1958#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
1959
1960/* Flags for V4L2_DEC_CMD_STOP */
1961#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
1962#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
1963
1964/* Play format requirements (returned by the driver): */
1965
1966/* The decoder has no special format requirements */
1967#define V4L2_DEC_START_FMT_NONE (0)
1968/* The decoder requires full GOPs */
1969#define V4L2_DEC_START_FMT_GOP (1)
1970
1971/* The structure must be zeroed before use by the application
1972 This ensures it can be extended safely in the future. */
1973struct v4l2_decoder_cmd {
1974 __u32 cmd;
1975 __u32 flags;
1976 union {
1977 struct {
1978 __u64 pts;
1979 } stop;
1980
1981 struct {
1982 /* 0 or 1000 specifies normal speed,
1983 1 specifies forward single stepping,
1984 -1 specifies backward single stepping,
1985 >1: playback at speed/1000 of the normal speed,
1986 <-1: reverse playback at (-speed/1000) of the normal speed. */
1987 __s32 speed;
1988 __u32 format;
1989 } start;
1990
1991 struct {
1992 __u32 data[16];
1993 } raw;
1994 };
1995};
1900#endif 1996#endif
1901 1997
1902 1998
@@ -2307,6 +2403,11 @@ struct v4l2_create_buffers {
2307#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) 2403#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
2308#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) 2404#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
2309 2405
2406/* Experimental, these two ioctls may change over the next couple of kernel
2407 versions. */
2408#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2409#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2410
2310/* Reminder: when adding new ioctls please add support for them to 2411/* Reminder: when adding new ioctls please add support for them to
2311 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2412 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2312 2413
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 5206d6541da5..7323a3390206 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -53,6 +53,7 @@
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55#include <linux/err.h> 55#include <linux/err.h>
56#include <linux/bug.h>
56#include <linux/virtio.h> 57#include <linux/virtio.h>
57 58
58/** 59/**
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h
index 85bb0bb66ffc..7529b854b7fd 100644
--- a/include/linux/virtio_ids.h
+++ b/include/linux/virtio_ids.h
@@ -34,6 +34,8 @@
34#define VIRTIO_ID_CONSOLE 3 /* virtio console */ 34#define VIRTIO_ID_CONSOLE 3 /* virtio console */
35#define VIRTIO_ID_RNG 4 /* virtio ring */ 35#define VIRTIO_ID_RNG 4 /* virtio ring */
36#define VIRTIO_ID_BALLOON 5 /* virtio balloon */ 36#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
37#define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */
38#define VIRTIO_ID_SCSI 8 /* virtio scsi */
37#define VIRTIO_ID_9P 9 /* 9p virtio console */ 39#define VIRTIO_ID_9P 9 /* 9p virtio console */
38 40
39#endif /* _LINUX_VIRTIO_IDS_H */ 41#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
new file mode 100644
index 000000000000..8ddeafdc0546
--- /dev/null
+++ b/include/linux/virtio_scsi.h
@@ -0,0 +1,114 @@
1#ifndef _LINUX_VIRTIO_SCSI_H
2#define _LINUX_VIRTIO_SCSI_H
3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5
6#define VIRTIO_SCSI_CDB_SIZE 32
7#define VIRTIO_SCSI_SENSE_SIZE 96
8
9/* SCSI command request, followed by data-out */
10struct virtio_scsi_cmd_req {
11 u8 lun[8]; /* Logical Unit Number */
12 u64 tag; /* Command identifier */
13 u8 task_attr; /* Task attribute */
14 u8 prio;
15 u8 crn;
16 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
17} __packed;
18
19/* Response, followed by sense data and data-in */
20struct virtio_scsi_cmd_resp {
21 u32 sense_len; /* Sense data length */
22 u32 resid; /* Residual bytes in data buffer */
23 u16 status_qualifier; /* Status qualifier */
24 u8 status; /* Command completion status */
25 u8 response; /* Response values */
26 u8 sense[VIRTIO_SCSI_SENSE_SIZE];
27} __packed;
28
29/* Task Management Request */
30struct virtio_scsi_ctrl_tmf_req {
31 u32 type;
32 u32 subtype;
33 u8 lun[8];
34 u64 tag;
35} __packed;
36
37struct virtio_scsi_ctrl_tmf_resp {
38 u8 response;
39} __packed;
40
41/* Asynchronous notification query/subscription */
42struct virtio_scsi_ctrl_an_req {
43 u32 type;
44 u8 lun[8];
45 u32 event_requested;
46} __packed;
47
48struct virtio_scsi_ctrl_an_resp {
49 u32 event_actual;
50 u8 response;
51} __packed;
52
53struct virtio_scsi_event {
54 u32 event;
55 u8 lun[8];
56 u32 reason;
57} __packed;
58
59struct virtio_scsi_config {
60 u32 num_queues;
61 u32 seg_max;
62 u32 max_sectors;
63 u32 cmd_per_lun;
64 u32 event_info_size;
65 u32 sense_size;
66 u32 cdb_size;
67 u16 max_channel;
68 u16 max_target;
69 u32 max_lun;
70} __packed;
71
72/* Response codes */
73#define VIRTIO_SCSI_S_OK 0
74#define VIRTIO_SCSI_S_OVERRUN 1
75#define VIRTIO_SCSI_S_ABORTED 2
76#define VIRTIO_SCSI_S_BAD_TARGET 3
77#define VIRTIO_SCSI_S_RESET 4
78#define VIRTIO_SCSI_S_BUSY 5
79#define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6
80#define VIRTIO_SCSI_S_TARGET_FAILURE 7
81#define VIRTIO_SCSI_S_NEXUS_FAILURE 8
82#define VIRTIO_SCSI_S_FAILURE 9
83#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10
84#define VIRTIO_SCSI_S_FUNCTION_REJECTED 11
85#define VIRTIO_SCSI_S_INCORRECT_LUN 12
86
87/* Controlq type codes. */
88#define VIRTIO_SCSI_T_TMF 0
89#define VIRTIO_SCSI_T_AN_QUERY 1
90#define VIRTIO_SCSI_T_AN_SUBSCRIBE 2
91
92/* Valid TMF subtypes. */
93#define VIRTIO_SCSI_T_TMF_ABORT_TASK 0
94#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1
95#define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2
96#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3
97#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4
98#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5
99#define VIRTIO_SCSI_T_TMF_QUERY_TASK 6
100#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7
101
102/* Events. */
103#define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000
104#define VIRTIO_SCSI_T_NO_EVENT 0
105#define VIRTIO_SCSI_T_TRANSPORT_RESET 1
106#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
107
108#define VIRTIO_SCSI_S_SIMPLE 0
109#define VIRTIO_SCSI_S_ORDERED 1
110#define VIRTIO_SCSI_S_HEAD 2
111#define VIRTIO_SCSI_S_ACA 3
112
113
114#endif /* _LINUX_VIRTIO_SCSI_H */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index c2164fad0083..e33d77f15bda 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -167,4 +167,30 @@ extern int unregister_vt_notifier(struct notifier_block *nb);
167 167
168extern void hide_boot_cursor(bool hide); 168extern void hide_boot_cursor(bool hide);
169 169
170/* keyboard provided interfaces */
171extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
172extern int vt_do_kdskbmode(int console, unsigned int arg);
173extern int vt_do_kdskbmeta(int console, unsigned int arg);
174extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
175 int perm);
176extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe,
177 int perm, int console);
178extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb,
179 int perm);
180extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm);
181extern int vt_do_kdgkbmode(int console);
182extern int vt_do_kdgkbmeta(int console);
183extern void vt_reset_unicode(int console);
184extern int vt_get_shift_state(void);
185extern void vt_reset_keyboard(int console);
186extern int vt_get_leds(int console, int flag);
187extern int vt_get_kbd_mode_bit(int console, int bit);
188extern void vt_set_kbd_mode_bit(int console, int bit);
189extern void vt_clr_kbd_mode_bit(int console, int bit);
190extern void vt_set_led_state(int console, int leds);
191extern void vt_set_led_state(int console, int leds);
192extern void vt_kbd_con_start(int console);
193extern void vt_kbd_con_stop(int console);
194
195
170#endif /* _VT_KERN_H */ 196#endif /* _VT_KERN_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a9ce45e8501c..7d9a9e990ce6 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -157,7 +157,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
157void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 157void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
158void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 158void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr,
159 void *key); 159 void *key);
160void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); 160void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
161void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 161void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
162void __wake_up_bit(wait_queue_head_t *, void *, int); 162void __wake_up_bit(wait_queue_head_t *, void *, int);
163int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 163int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
@@ -170,7 +170,8 @@ wait_queue_head_t *bit_waitqueue(void *, int);
170#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) 170#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
171#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) 171#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
172#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) 172#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL)
173#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL) 173#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL, 1)
174#define wake_up_all_locked(x) __wake_up_locked((x), TASK_NORMAL, 0)
174 175
175#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) 176#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
176#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) 177#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 43ba5b3ce2a3..ac40716b44e9 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -66,6 +66,7 @@ struct watchdog_device;
66 * @ping: The routine that sends a keepalive ping to the watchdog device. 66 * @ping: The routine that sends a keepalive ping to the watchdog device.
67 * @status: The routine that shows the status of the watchdog device. 67 * @status: The routine that shows the status of the watchdog device.
68 * @set_timeout:The routine for setting the watchdog devices timeout value. 68 * @set_timeout:The routine for setting the watchdog devices timeout value.
69 * @get_timeleft:The routine that get's the time that's left before a reset.
69 * @ioctl: The routines that handles extra ioctl calls. 70 * @ioctl: The routines that handles extra ioctl calls.
70 * 71 *
71 * The watchdog_ops structure contains a list of low-level operations 72 * The watchdog_ops structure contains a list of low-level operations
@@ -82,6 +83,7 @@ struct watchdog_ops {
82 int (*ping)(struct watchdog_device *); 83 int (*ping)(struct watchdog_device *);
83 unsigned int (*status)(struct watchdog_device *); 84 unsigned int (*status)(struct watchdog_device *);
84 int (*set_timeout)(struct watchdog_device *, unsigned int); 85 int (*set_timeout)(struct watchdog_device *, unsigned int);
86 unsigned int (*get_timeleft)(struct watchdog_device *);
85 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 87 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
86}; 88};
87 89
@@ -127,7 +129,7 @@ struct watchdog_device {
127#endif 129#endif
128 130
129/* Use the following function to set the nowayout feature */ 131/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) 132static inline void watchdog_set_nowayout(struct watchdog_device *wdd, bool nowayout)
131{ 133{
132 if (nowayout) 134 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status); 135 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index 57031b4d12f2..aaf24ba12c4d 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -154,9 +154,9 @@
154#define __debug__h__ 154#define __debug__h__
155 155
156#include <linux/types.h> 156#include <linux/types.h>
157#include <linux/device.h>
158#include <linux/slab.h> 157#include <linux/slab.h>
159 158
159struct device;
160 160
161/* Backend stuff */ 161/* Backend stuff */
162 162
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 995b8bf630ac..a2b84f598e2b 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -64,7 +64,7 @@ struct writeback_control {
64 long pages_skipped; /* Pages which were not written */ 64 long pages_skipped; /* Pages which were not written */
65 65
66 /* 66 /*
67 * For a_ops->writepages(): is start or end are non-zero then this is 67 * For a_ops->writepages(): if start or end are non-zero then this is
68 * a hint that the filesystem need only write out the pages inside that 68 * a hint that the filesystem need only write out the pages inside that
69 * byterange. The byte at `end' is included in the writeout request. 69 * byterange. The byte at `end' is included in the writeout request.
70 */ 70 */