aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-03-26 11:18:44 -0400
committerIngo Molnar <mingo@kernel.org>2012-03-26 11:19:03 -0400
commit7fd52392c56361a40f0c630a82b36b95ca31eac6 (patch)
tree14091de24c6b28ea4cae9826f98aeedb7be091f5 /include
parentb01c3a0010aabadf745f3e7fdb9cab682e0a28a2 (diff)
parente22057c8599373e5caef0bc42bdb95d2a361ab0d (diff)
Merge branch 'linus' into perf/urgent
Merge reason: we need to fix a non-trivial merge conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-generic/bug.h6
-rw-r--r--include/asm-generic/dma-mapping-common.h1
-rw-r--r--include/asm-generic/getorder.h53
-rw-r--r--include/asm-generic/mman-common.h4
-rw-r--r--include/asm-generic/pci-bridge.h6
-rw-r--r--include/asm-generic/pci.h24
-rw-r--r--include/asm-generic/pgtable.h62
-rw-r--r--include/asm-generic/socket.h5
-rw-r--r--include/asm-generic/tlbflush.h2
-rw-r--r--include/asm-generic/vmlinux.lds.h1
-rw-r--r--include/crypto/scatterwalk.h28
-rw-r--r--include/drm/drm.h2
-rw-r--r--include/drm/drmP.h25
-rw-r--r--include/drm/drm_crtc.h48
-rw-r--r--include/drm/drm_edid.h1
-rw-r--r--include/drm/drm_fb_helper.h2
-rw-r--r--include/drm/drm_mode.h2
-rw-r--r--include/drm/drm_pciids.h54
-rw-r--r--include/drm/exynos_drm.h26
-rw-r--r--include/drm/gma_drm.h2
-rw-r--r--include/drm/i915_drm.h1
-rw-r--r--include/drm/intel-gtt.h4
-rw-r--r--include/drm/radeon_drm.h27
-rw-r--r--include/drm/ttm/ttm_memory.h1
-rw-r--r--include/linux/Kbuild2
-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/atmdev.h3
-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.h1
-rw-r--r--include/linux/ceph/mdsmap.h1
-rw-r--r--include/linux/cgroup.h72
-rw-r--r--include/linux/cleancache.h24
-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.h11
-rw-r--r--include/linux/fsnotify.h1
-rw-r--r--include/linux/gfs2_ondisk.h1
-rw-r--r--include/linux/gpio.h1
-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.h1
-rw-r--r--include/linux/i2c/at24.h35
-rw-r--r--include/linux/i2c/tc35876x.h11
-rw-r--r--include/linux/i2c/twl.h14
-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.h8
-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/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/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.h72
-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/mdio.h10
-rw-r--r--include/linux/memcontrol.h58
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mfd/abx500.h3
-rw-r--r--include/linux/mfd/abx500/ab5500.h2
-rw-r--r--include/linux/mfd/abx500/ab8500.h4
-rw-r--r--include/linux/mfd/max8997.h53
-rw-r--r--include/linux/mfd/pm8xxx/pm8921.h1
-rw-r--r--include/linux/mfd/stmpe.h4
-rw-r--r--include/linux/mfd/tc3589x.h2
-rw-r--r--include/linux/mfd/tps65910.h7
-rw-r--r--include/linux/mfd/wm8994/pdata.h3
-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.h21
-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.h128
-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.h27
-rw-r--r--include/linux/of_address.h33
-rw-r--r--include/linux/of_device.h11
-rw-r--r--include/linux/of_irq.h4
-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/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/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/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/printk.h8
-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.h3
-rw-r--r--include/linux/regmap.h134
-rw-r--r--include/linux/regset.h1
-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/rfkill.h2
-rw-r--r--include/linux/rio_drv.h1
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/scatterlist.h6
-rw-r--r--include/linux/sched.h14
-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_eth.h1
-rw-r--r--include/linux/skbuff.h47
-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/sh_hspi.h23
-rw-r--r--include/linux/spi/spi.h53
-rw-r--r--include/linux/spinlock.h5
-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/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/trace_seq.h4
-rw-r--r--include/linux/tracehook.h9
-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.h1
-rw-r--r--include/linux/virtio_scsi.h114
-rw-r--r--include/linux/vt_kern.h26
-rw-r--r--include/linux/wimax/debug.h2
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/adv7183.h47
-rw-r--r--include/media/blackfin/bfin_capture.h37
-rw-r--r--include/media/blackfin/ppi.h74
-rw-r--r--include/media/davinci/vpif_types.h2
-rw-r--r--include/media/gpio-ir-recv.h22
-rw-r--r--include/media/media-device.h3
-rw-r--r--include/media/mt9m032.h36
-rw-r--r--include/media/rc-map.h3
-rw-r--r--include/media/s5p_hdmi.h35
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/sii9234.h24
-rw-r--r--include/media/tuner.h1
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-ctrls.h14
-rw-r--r--include/media/v4l2-dev.h3
-rw-r--r--include/media/v4l2-ioctl.h5
-rw-r--r--include/net/addrconf.h1
-rw-r--r--include/net/af_unix.h3
-rw-r--r--include/net/arp.h4
-rw-r--r--include/net/bluetooth/bluetooth.h40
-rw-r--r--include/net/bluetooth/hci.h76
-rw-r--r--include/net/bluetooth/hci_core.h301
-rw-r--r--include/net/bluetooth/hci_mon.h51
-rw-r--r--include/net/bluetooth/l2cap.h87
-rw-r--r--include/net/bluetooth/mgmt.h338
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/caif/caif_hsi.h1
-rw-r--r--include/net/cfg80211.h180
-rw-r--r--include/net/compat.h2
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/dn.h1
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/genetlink.h31
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip_vs.h1
-rw-r--r--include/net/iucv/af_iucv.h3
-rw-r--r--include/net/mac80211.h158
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h13
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h19
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h78
-rw-r--r--include/net/netfilter/xt_log.h2
-rw-r--r--include/net/netlink.h35
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/nfc/nci.h53
-rw-r--r--include/net/nfc/nci_core.h36
-rw-r--r--include/net/nfc/nfc.h39
-rw-r--r--include/net/red.h1
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sock.h40
-rw-r--r--include/net/tcp.h67
-rw-r--r--include/net/tcp_memcontrol.h2
-rw-r--r--include/net/timewait_sock.h1
-rw-r--r--include/net/udp.h1
-rw-r--r--include/net/udplite.h4
-rw-r--r--include/net/wpan-phy.h1
-rw-r--r--include/net/xfrm.h5
-rw-r--r--include/rdma/ib_mad.h9
-rw-r--r--include/rdma/ib_verbs.h11
-rw-r--r--include/scsi/fc/fc_fcp.h6
-rw-r--r--include/scsi/fc/fc_ms.h213
-rw-r--r--include/scsi/fc_encode.h363
-rw-r--r--include/scsi/iscsi_if.h79
-rw-r--r--include/scsi/libfc.h11
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/libiscsi_tcp.h2
-rw-r--r--include/scsi/libsas.h71
-rw-r--r--include/scsi/osd_ore.h1
-rw-r--r--include/scsi/sas.h4
-rw-r--r--include/scsi/sas_ata.h44
-rw-r--r--include/scsi/scsi.h1
-rw-r--r--include/scsi/scsi_cmnd.h12
-rw-r--r--include/scsi/scsi_device.h9
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_netlink.h2
-rw-r--r--include/scsi/scsi_transport.h1
-rw-r--r--include/scsi/scsi_transport_fc.h32
-rw-r--r--include/scsi/scsi_transport_iscsi.h22
-rw-r--r--include/scsi/scsi_transport_sas.h12
-rw-r--r--include/sound/compress_params.h2
-rw-r--r--include/sound/control.h7
-rw-r--r--include/sound/core.h5
-rw-r--r--include/sound/dmaengine_pcm.h49
-rw-r--r--include/sound/jack.h3
-rw-r--r--include/sound/max9768.h24
-rw-r--r--include/sound/pcm.h9
-rw-r--r--include/sound/sh_fsi.h12
-rw-r--r--include/sound/soc-dai.h11
-rw-r--r--include/sound/soc-dapm.h36
-rw-r--r--include/sound/soc.h45
-rw-r--r--include/sound/tea575x-tuner.h6
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm2200.h41
-rw-r--r--include/sound/wm8962.h6
-rw-r--r--include/sound/ymfpci.h2
-rw-r--r--include/target/target_core_backend.h2
-rw-r--r--include/target/target_core_base.h85
-rw-r--r--include/target/target_core_fabric.h14
-rw-r--r--include/trace/events/power.h1
-rw-r--r--include/trace/events/regmap.h38
-rw-r--r--include/trace/events/rpm.h3
-rw-r--r--include/trace/events/sunrpc.h177
-rw-r--r--include/trace/events/writeback.h1
-rw-r--r--include/video/exynos_dp.h131
-rw-r--r--include/video/exynos_mipi_dsim.h359
-rw-r--r--include/video/sh_mipi_dsi.h1
-rw-r--r--include/video/sh_mobile_hdmi.h2
-rw-r--r--include/video/sh_mobile_lcdc.h35
-rw-r--r--include/video/sh_mobile_meram.h45
-rw-r--r--include/video/udlfb.h1
-rw-r--r--include/xen/interface/hvm/params.h6
-rw-r--r--include/xen/interface/physdev.h28
-rw-r--r--include/xen/interface/platform.h20
-rw-r--r--include/xen/tmem.h6
-rw-r--r--include/xen/xenbus.h4
449 files changed, 8628 insertions, 5941 deletions
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 8cf7e98a2c7b..9d650476d5dc 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -225,6 +225,7 @@ struct acpi_processor_errata {
225 } piix4; 225 } piix4;
226}; 226};
227 227
228extern void acpi_processor_load_module(struct acpi_processor *pr);
228extern int acpi_processor_preregister_performance(struct 229extern int acpi_processor_preregister_performance(struct
229 acpi_processor_performance 230 acpi_processor_performance
230 __percpu *performance); 231 __percpu *performance);
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 84458b0c38d1..2520a6e241dc 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line);
134#endif 134#endif
135 135
136#define WARN_ON_ONCE(condition) ({ \ 136#define WARN_ON_ONCE(condition) ({ \
137 static bool __warned; \ 137 static bool __section(.data.unlikely) __warned; \
138 int __ret_warn_once = !!(condition); \ 138 int __ret_warn_once = !!(condition); \
139 \ 139 \
140 if (unlikely(__ret_warn_once)) \ 140 if (unlikely(__ret_warn_once)) \
@@ -144,7 +144,7 @@ extern void warn_slowpath_null(const char *file, const int line);
144}) 144})
145 145
146#define WARN_ONCE(condition, format...) ({ \ 146#define WARN_ONCE(condition, format...) ({ \
147 static bool __warned; \ 147 static bool __section(.data.unlikely) __warned; \
148 int __ret_warn_once = !!(condition); \ 148 int __ret_warn_once = !!(condition); \
149 \ 149 \
150 if (unlikely(__ret_warn_once)) \ 150 if (unlikely(__ret_warn_once)) \
@@ -154,7 +154,7 @@ extern void warn_slowpath_null(const char *file, const int line);
154}) 154})
155 155
156#define WARN_TAINT_ONCE(condition, taint, format...) ({ \ 156#define WARN_TAINT_ONCE(condition, taint, format...) ({ \
157 static bool __warned; \ 157 static bool __section(.data.unlikely) __warned; \
158 int __ret_warn_once = !!(condition); \ 158 int __ret_warn_once = !!(condition); \
159 \ 159 \
160 if (unlikely(__ret_warn_once)) \ 160 if (unlikely(__ret_warn_once)) \
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index 9fa3f96e38cf..2e248d8924dc 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_DMA_MAPPING_H 2#define _ASM_GENERIC_DMA_MAPPING_H
3 3
4#include <linux/kmemcheck.h> 4#include <linux/kmemcheck.h>
5#include <linux/bug.h>
5#include <linux/scatterlist.h> 6#include <linux/scatterlist.h>
6#include <linux/dma-debug.h> 7#include <linux/dma-debug.h>
7#include <linux/dma-attrs.h> 8#include <linux/dma-attrs.h>
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
index 67e7245dc9b3..65e4468ac53d 100644
--- a/include/asm-generic/getorder.h
+++ b/include/asm-generic/getorder.h
@@ -4,21 +4,58 @@
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <linux/log2.h>
7 8
8/* Pure 2^n version of get_order */ 9/*
9static inline __attribute_const__ int get_order(unsigned long size) 10 * Runtime evaluation of get_order()
11 */
12static inline __attribute_const__
13int __get_order(unsigned long size)
10{ 14{
11 int order; 15 int order;
12 16
13 size = (size - 1) >> (PAGE_SHIFT - 1); 17 size--;
14 order = -1; 18 size >>= PAGE_SHIFT;
15 do { 19#if BITS_PER_LONG == 32
16 size >>= 1; 20 order = fls(size);
17 order++; 21#else
18 } while (size); 22 order = fls64(size);
23#endif
19 return order; 24 return order;
20} 25}
21 26
27/**
28 * get_order - Determine the allocation order of a memory size
29 * @size: The size for which to get the order
30 *
31 * Determine the allocation order of a particular sized block of memory. This
32 * is on a logarithmic scale, where:
33 *
34 * 0 -> 2^0 * PAGE_SIZE and below
35 * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
36 * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
37 * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
38 * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
39 * ...
40 *
41 * The order returned is used to find the smallest allocation granule required
42 * to hold an object of the specified size.
43 *
44 * The result is undefined if the size is 0.
45 *
46 * This function may be used to initialise variables with compile time
47 * evaluations of constants.
48 */
49#define get_order(n) \
50( \
51 __builtin_constant_p(n) ? ( \
52 ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \
53 (((n) < (1UL << PAGE_SHIFT)) ? 0 : \
54 ilog2((n) - 1) - PAGE_SHIFT + 1) \
55 ) : \
56 __get_order(n) \
57)
58
22#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
23 60
24#endif /* __ASM_GENERIC_GETORDER_H */ 61#endif /* __ASM_GENERIC_GETORDER_H */
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 787abbb6d867..d030d2c2647a 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -48,6 +48,10 @@
48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ 48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ 49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
50 50
51#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
52 overrides the coredump filter bits */
53#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
54
51/* compatibility flags */ 55/* compatibility flags */
52#define MAP_FILE 0 56#define MAP_FILE 0
53 57
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index 4a5aca2a2c94..a5b5d5a89a4f 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -45,6 +45,11 @@ static inline void pci_add_flags(int flags)
45 pci_flags |= flags; 45 pci_flags |= flags;
46} 46}
47 47
48static inline void pci_clear_flags(int flags)
49{
50 pci_flags &= ~flags;
51}
52
48static inline int pci_has_flag(int flag) 53static inline int pci_has_flag(int flag)
49{ 54{
50 return pci_flags & flag; 55 return pci_flags & flag;
@@ -52,6 +57,7 @@ static inline int pci_has_flag(int flag)
52#else 57#else
53static inline void pci_set_flags(int flags) { } 58static inline void pci_set_flags(int flags) { }
54static inline void pci_add_flags(int flags) { } 59static inline void pci_add_flags(int flags) { }
60static inline void pci_clear_flags(int flags) { }
55static inline int pci_has_flag(int flag) 61static inline int pci_has_flag(int flag)
56{ 62{
57 return 0; 63 return 0;
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index 26373cff4546..e80a0495e5b0 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -6,30 +6,6 @@
6#ifndef _ASM_GENERIC_PCI_H 6#ifndef _ASM_GENERIC_PCI_H
7#define _ASM_GENERIC_PCI_H 7#define _ASM_GENERIC_PCI_H
8 8
9/**
10 * pcibios_resource_to_bus - convert resource to PCI bus address
11 * @dev: device which owns this resource
12 * @region: converted bus-centric region (start,end)
13 * @res: resource to convert
14 *
15 * Convert a resource to a PCI device bus address or bus window.
16 */
17static inline void
18pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
19 struct resource *res)
20{
21 region->start = res->start;
22 region->end = res->end;
23}
24
25static inline void
26pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
27 struct pci_bus_region *region)
28{
29 res->start = region->start;
30 res->end = region->end;
31}
32
33static inline struct resource * 9static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res) 10pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{ 11{
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 76bff2bff15e..125c54e98517 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -5,6 +5,7 @@
5#ifdef CONFIG_MMU 5#ifdef CONFIG_MMU
6 6
7#include <linux/mm_types.h> 7#include <linux/mm_types.h>
8#include <linux/bug.h>
8 9
9#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 10#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
10extern int ptep_set_access_flags(struct vm_area_struct *vma, 11extern int ptep_set_access_flags(struct vm_area_struct *vma,
@@ -425,6 +426,8 @@ extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
425 unsigned long size); 426 unsigned long size);
426#endif 427#endif
427 428
429#ifdef CONFIG_MMU
430
428#ifndef CONFIG_TRANSPARENT_HUGEPAGE 431#ifndef CONFIG_TRANSPARENT_HUGEPAGE
429static inline int pmd_trans_huge(pmd_t pmd) 432static inline int pmd_trans_huge(pmd_t pmd)
430{ 433{
@@ -441,7 +444,66 @@ static inline int pmd_write(pmd_t pmd)
441 return 0; 444 return 0;
442} 445}
443#endif /* __HAVE_ARCH_PMD_WRITE */ 446#endif /* __HAVE_ARCH_PMD_WRITE */
447#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
448
449/*
450 * This function is meant to be used by sites walking pagetables with
451 * the mmap_sem hold in read mode to protect against MADV_DONTNEED and
452 * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd
453 * into a null pmd and the transhuge page fault can convert a null pmd
454 * into an hugepmd or into a regular pmd (if the hugepage allocation
455 * fails). While holding the mmap_sem in read mode the pmd becomes
456 * stable and stops changing under us only if it's not null and not a
457 * transhuge pmd. When those races occurs and this function makes a
458 * difference vs the standard pmd_none_or_clear_bad, the result is
459 * undefined so behaving like if the pmd was none is safe (because it
460 * can return none anyway). The compiler level barrier() is critically
461 * important to compute the two checks atomically on the same pmdval.
462 */
463static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
464{
465 /* depend on compiler for an atomic pmd read */
466 pmd_t pmdval = *pmd;
467 /*
468 * The barrier will stabilize the pmdval in a register or on
469 * the stack so that it will stop changing under the code.
470 */
471#ifdef CONFIG_TRANSPARENT_HUGEPAGE
472 barrier();
473#endif
474 if (pmd_none(pmdval))
475 return 1;
476 if (unlikely(pmd_bad(pmdval))) {
477 if (!pmd_trans_huge(pmdval))
478 pmd_clear_bad(pmd);
479 return 1;
480 }
481 return 0;
482}
483
484/*
485 * This is a noop if Transparent Hugepage Support is not built into
486 * the kernel. Otherwise it is equivalent to
487 * pmd_none_or_trans_huge_or_clear_bad(), and shall only be called in
488 * places that already verified the pmd is not none and they want to
489 * walk ptes while holding the mmap sem in read mode (write mode don't
490 * need this). If THP is not enabled, the pmd can't go away under the
491 * code even if MADV_DONTNEED runs, but if THP is enabled we need to
492 * run a pmd_trans_unstable before walking the ptes after
493 * split_huge_page_pmd returns (because it may have run when the pmd
494 * become null, but then a page fault can map in a THP and not a
495 * regular page).
496 */
497static inline int pmd_trans_unstable(pmd_t *pmd)
498{
499#ifdef CONFIG_TRANSPARENT_HUGEPAGE
500 return pmd_none_or_trans_huge_or_clear_bad(pmd);
501#else
502 return 0;
444#endif 503#endif
504}
505
506#endif /* CONFIG_MMU */
445 507
446#endif /* !__ASSEMBLY__ */ 508#endif /* !__ASSEMBLY__ */
447 509
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index 49c1704173e7..b1bea03274d5 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -67,4 +67,9 @@
67 67
68#define SO_WIFI_STATUS 41 68#define SO_WIFI_STATUS 41
69#define SCM_WIFI_STATUS SO_WIFI_STATUS 69#define SCM_WIFI_STATUS SO_WIFI_STATUS
70#define SO_PEEK_OFF 42
71
72/* Instruct lower device to use last 4-bytes of skb data as FCS */
73#define SO_NOFCS 43
74
70#endif /* __ASM_GENERIC_SOCKET_H */ 75#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h
index c7af037024c7..d6d0a88430fe 100644
--- a/include/asm-generic/tlbflush.h
+++ b/include/asm-generic/tlbflush.h
@@ -9,6 +9,8 @@
9#error need to implement an architecture specific asm/tlbflush.h 9#error need to implement an architecture specific asm/tlbflush.h
10#endif 10#endif
11 11
12#include <linux/bug.h>
13
12static inline void flush_tlb_mm(struct mm_struct *mm) 14static inline void flush_tlb_mm(struct mm_struct *mm)
13{ 15{
14 BUG(); 16 BUG();
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b5e2e4c6b017..798603e8ec38 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,7 @@
167 CPU_KEEP(exit.data) \ 167 CPU_KEEP(exit.data) \
168 MEM_KEEP(init.data) \ 168 MEM_KEEP(init.data) \
169 MEM_KEEP(exit.data) \ 169 MEM_KEEP(exit.data) \
170 *(.data.unlikely) \
170 STRUCT_ALIGN(); \ 171 STRUCT_ALIGN(); \
171 *(__tracepoints) \ 172 *(__tracepoints) \
172 /* implement dynamic printk debug */ \ 173 /* implement dynamic printk debug */ \
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 4fd95a323beb..3744d2a642df 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -25,28 +25,6 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28static inline enum km_type crypto_kmap_type(int out)
29{
30 enum km_type type;
31
32 if (in_softirq())
33 type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0;
34 else
35 type = out * (KM_USER1 - KM_USER0) + KM_USER0;
36
37 return type;
38}
39
40static inline void *crypto_kmap(struct page *page, int out)
41{
42 return kmap_atomic(page, crypto_kmap_type(out));
43}
44
45static inline void crypto_kunmap(void *vaddr, int out)
46{
47 kunmap_atomic(vaddr, crypto_kmap_type(out));
48}
49
50static inline void crypto_yield(u32 flags) 28static inline void crypto_yield(u32 flags)
51{ 29{
52 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) 30 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
@@ -121,15 +99,15 @@ static inline struct page *scatterwalk_page(struct scatter_walk *walk)
121 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); 99 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
122} 100}
123 101
124static inline void scatterwalk_unmap(void *vaddr, int out) 102static inline void scatterwalk_unmap(void *vaddr)
125{ 103{
126 crypto_kunmap(vaddr, out); 104 kunmap_atomic(vaddr);
127} 105}
128 106
129void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); 107void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg);
130void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, 108void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
131 size_t nbytes, int out); 109 size_t nbytes, int out);
132void *scatterwalk_map(struct scatter_walk *walk, int out); 110void *scatterwalk_map(struct scatter_walk *walk);
133void scatterwalk_done(struct scatter_walk *walk, int out, int more); 111void scatterwalk_done(struct scatter_walk *walk, int out, int more);
134 112
135void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, 113void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 49d94ede2ec2..34a7b89fd006 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -761,6 +761,8 @@ struct drm_event_vblank {
761 761
762#define DRM_CAP_DUMB_BUFFER 0x1 762#define DRM_CAP_DUMB_BUFFER 0x1
763#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 763#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
764#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
765#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
764 766
765/* typedef area */ 767/* typedef area */
766#ifndef __KERNEL__ 768#ifndef __KERNEL__
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 92f0981b5fb8..574bd1c81ebd 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1170,6 +1170,8 @@ struct drm_device {
1170 struct idr object_name_idr; 1170 struct idr object_name_idr;
1171 /*@} */ 1171 /*@} */
1172 int switch_power_state; 1172 int switch_power_state;
1173
1174 atomic_t unplugged; /* device has been unplugged or gone away */
1173}; 1175};
1174 1176
1175#define DRM_SWITCH_POWER_ON 0 1177#define DRM_SWITCH_POWER_ON 0
@@ -1235,6 +1237,19 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1235} 1237}
1236#endif 1238#endif
1237 1239
1240static inline void drm_device_set_unplugged(struct drm_device *dev)
1241{
1242 smp_wmb();
1243 atomic_set(&dev->unplugged, 1);
1244}
1245
1246static inline int drm_device_is_unplugged(struct drm_device *dev)
1247{
1248 int ret = atomic_read(&dev->unplugged);
1249 smp_rmb();
1250 return ret;
1251}
1252
1238/******************************************************************/ 1253/******************************************************************/
1239/** \name Internal function definitions */ 1254/** \name Internal function definitions */
1240/*@{*/ 1255/*@{*/
@@ -1264,11 +1279,6 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1264 1279
1265 /* Memory management support (drm_memory.h) */ 1280 /* Memory management support (drm_memory.h) */
1266#include "drm_memory.h" 1281#include "drm_memory.h"
1267extern void drm_mem_init(void);
1268extern int drm_mem_info(char *buf, char **start, off_t offset,
1269 int request, int *eof, void *data);
1270extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
1271
1272extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); 1282extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
1273extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1283extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1274extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 1284extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
@@ -1383,12 +1393,8 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
1383 /* IRQ support (drm_irq.h) */ 1393 /* IRQ support (drm_irq.h) */
1384extern int drm_control(struct drm_device *dev, void *data, 1394extern int drm_control(struct drm_device *dev, void *data,
1385 struct drm_file *file_priv); 1395 struct drm_file *file_priv);
1386extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
1387extern int drm_irq_install(struct drm_device *dev); 1396extern int drm_irq_install(struct drm_device *dev);
1388extern int drm_irq_uninstall(struct drm_device *dev); 1397extern int drm_irq_uninstall(struct drm_device *dev);
1389extern void drm_driver_irq_preinstall(struct drm_device *dev);
1390extern void drm_driver_irq_postinstall(struct drm_device *dev);
1391extern void drm_driver_irq_uninstall(struct drm_device *dev);
1392 1398
1393extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); 1399extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
1394extern int drm_wait_vblank(struct drm_device *dev, void *data, 1400extern int drm_wait_vblank(struct drm_device *dev, void *data,
@@ -1464,6 +1470,7 @@ extern void drm_master_put(struct drm_master **master);
1464 1470
1465extern void drm_put_dev(struct drm_device *dev); 1471extern void drm_put_dev(struct drm_device *dev);
1466extern int drm_put_minor(struct drm_minor **minor); 1472extern int drm_put_minor(struct drm_minor **minor);
1473extern void drm_unplug_dev(struct drm_device *dev);
1467extern unsigned int drm_debug; 1474extern unsigned int drm_debug;
1468 1475
1469extern unsigned int drm_vblank_offdelay; 1476extern unsigned int drm_vblank_offdelay;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 4cd4be26722c..e250eda4e3a8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -121,7 +121,7 @@ struct drm_display_mode {
121 char name[DRM_DISPLAY_MODE_LEN]; 121 char name[DRM_DISPLAY_MODE_LEN];
122 122
123 enum drm_mode_status status; 123 enum drm_mode_status status;
124 int type; 124 unsigned int type;
125 125
126 /* Proposed mode values */ 126 /* Proposed mode values */
127 int clock; /* in kHz */ 127 int clock; /* in kHz */
@@ -257,7 +257,7 @@ struct drm_property_blob {
257 struct drm_mode_object base; 257 struct drm_mode_object base;
258 struct list_head head; 258 struct list_head head;
259 unsigned int length; 259 unsigned int length;
260 void *data; 260 unsigned char data[];
261}; 261};
262 262
263struct drm_property_enum { 263struct drm_property_enum {
@@ -796,6 +796,9 @@ struct drm_mode_config {
796 struct drm_property *scaling_mode_property; 796 struct drm_property *scaling_mode_property;
797 struct drm_property *dithering_mode_property; 797 struct drm_property *dithering_mode_property;
798 struct drm_property *dirty_info_property; 798 struct drm_property *dirty_info_property;
799
800 /* dumb ioctl parameters */
801 uint32_t preferred_depth, prefer_shadow;
799}; 802};
800 803
801#define obj_to_crtc(x) container_of(x, struct drm_crtc, base) 804#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
@@ -807,23 +810,29 @@ struct drm_mode_config {
807#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) 810#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
808#define obj_to_plane(x) container_of(x, struct drm_plane, base) 811#define obj_to_plane(x) container_of(x, struct drm_plane, base)
809 812
813struct drm_prop_enum_list {
814 int type;
815 char *name;
816};
810 817
811extern void drm_crtc_init(struct drm_device *dev, 818extern int drm_crtc_init(struct drm_device *dev,
812 struct drm_crtc *crtc, 819 struct drm_crtc *crtc,
813 const struct drm_crtc_funcs *funcs); 820 const struct drm_crtc_funcs *funcs);
814extern void drm_crtc_cleanup(struct drm_crtc *crtc); 821extern void drm_crtc_cleanup(struct drm_crtc *crtc);
815 822
816extern void drm_connector_init(struct drm_device *dev, 823extern int drm_connector_init(struct drm_device *dev,
817 struct drm_connector *connector, 824 struct drm_connector *connector,
818 const struct drm_connector_funcs *funcs, 825 const struct drm_connector_funcs *funcs,
819 int connector_type); 826 int connector_type);
820 827
821extern void drm_connector_cleanup(struct drm_connector *connector); 828extern void drm_connector_cleanup(struct drm_connector *connector);
829/* helper to unplug all connectors from sysfs for device */
830extern void drm_connector_unplug_all(struct drm_device *dev);
822 831
823extern void drm_encoder_init(struct drm_device *dev, 832extern int drm_encoder_init(struct drm_device *dev,
824 struct drm_encoder *encoder, 833 struct drm_encoder *encoder,
825 const struct drm_encoder_funcs *funcs, 834 const struct drm_encoder_funcs *funcs,
826 int encoder_type); 835 int encoder_type);
827 836
828extern int drm_plane_init(struct drm_device *dev, 837extern int drm_plane_init(struct drm_device *dev,
829 struct drm_plane *plane, 838 struct drm_plane *plane,
@@ -848,6 +857,7 @@ extern struct edid *drm_get_edid(struct drm_connector *connector,
848extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 857extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
849extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 858extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
850extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 859extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
860extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
851extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 861extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
852 const struct drm_display_mode *mode); 862 const struct drm_display_mode *mode);
853extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 863extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
@@ -862,7 +872,7 @@ extern int drm_mode_height(struct drm_display_mode *mode);
862/* for us by fb module */ 872/* for us by fb module */
863extern int drm_mode_attachmode_crtc(struct drm_device *dev, 873extern int drm_mode_attachmode_crtc(struct drm_device *dev,
864 struct drm_crtc *crtc, 874 struct drm_crtc *crtc,
865 struct drm_display_mode *mode); 875 const struct drm_display_mode *mode);
866extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); 876extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode);
867 877
868extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); 878extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
@@ -904,6 +914,13 @@ extern int drm_connector_attach_property(struct drm_connector *connector,
904 struct drm_property *property, uint64_t init_val); 914 struct drm_property *property, uint64_t init_val);
905extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, 915extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
906 const char *name, int num_values); 916 const char *name, int num_values);
917extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
918 const char *name,
919 const struct drm_prop_enum_list *props,
920 int num_values);
921struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
922 const char *name,
923 uint64_t min, uint64_t max);
907extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); 924extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
908extern int drm_property_add_enum(struct drm_property *property, int index, 925extern int drm_property_add_enum(struct drm_property *property, int index,
909 uint64_t value, const char *name); 926 uint64_t value, const char *name);
@@ -919,7 +936,7 @@ extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
919 struct drm_encoder *encoder); 936 struct drm_encoder *encoder);
920extern void drm_mode_connector_detach_encoder(struct drm_connector *connector, 937extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
921 struct drm_encoder *encoder); 938 struct drm_encoder *encoder);
922extern bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, 939extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
923 int gamma_size); 940 int gamma_size);
924extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 941extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
925 uint32_t id, uint32_t type); 942 uint32_t id, uint32_t type);
@@ -995,6 +1012,7 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
995 int hdisplay, int vdisplay); 1012 int hdisplay, int vdisplay);
996 1013
997extern int drm_edid_header_is_valid(const u8 *raw_edid); 1014extern int drm_edid_header_is_valid(const u8 *raw_edid);
1015extern bool drm_edid_block_valid(u8 *raw_edid);
998extern bool drm_edid_is_valid(struct edid *edid); 1016extern bool drm_edid_is_valid(struct edid *edid);
999struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1017struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1000 int hsize, int vsize, int fresh); 1018 int hsize, int vsize, int fresh);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 74ce91684629..bcb9a66baa8c 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -238,5 +238,6 @@ int drm_av_sync_delay(struct drm_connector *connector,
238 struct drm_display_mode *mode); 238 struct drm_display_mode *mode);
239struct drm_connector *drm_select_eld(struct drm_encoder *encoder, 239struct drm_connector *drm_select_eld(struct drm_encoder *encoder,
240 struct drm_display_mode *mode); 240 struct drm_display_mode *mode);
241int drm_load_edid_firmware(struct drm_connector *connector);
241 242
242#endif /* __DRM_EDID_H__ */ 243#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6e3076ad646e..5120b01c2eeb 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -35,7 +35,6 @@ struct drm_fb_helper;
35#include <linux/kgdb.h> 35#include <linux/kgdb.h>
36 36
37struct drm_fb_helper_crtc { 37struct drm_fb_helper_crtc {
38 uint32_t crtc_id;
39 struct drm_mode_set mode_set; 38 struct drm_mode_set mode_set;
40 struct drm_display_mode *desired_mode; 39 struct drm_display_mode *desired_mode;
41}; 40};
@@ -74,7 +73,6 @@ struct drm_fb_helper {
74 int connector_count; 73 int connector_count;
75 struct drm_fb_helper_connector **connector_info; 74 struct drm_fb_helper_connector **connector_info;
76 struct drm_fb_helper_funcs *funcs; 75 struct drm_fb_helper_funcs *funcs;
77 int conn_limit;
78 struct fb_info *fbdev; 76 struct fb_info *fbdev;
79 u32 pseudo_palette[17]; 77 u32 pseudo_palette[17];
80 struct list_head kernel_fb_list; 78 struct list_head kernel_fb_list;
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 2a2acda8b437..4a0aae38e160 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,6 +27,8 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#include <linux/types.h>
31
30#define DRM_DISPLAY_INFO_LEN 32 32#define DRM_DISPLAY_INFO_LEN 32
31#define DRM_CONNECTOR_NAME_LEN 32 33#define DRM_CONNECTOR_NAME_LEN 32
32#define DRM_DISPLAY_MODE_LEN 32 34#define DRM_DISPLAY_MODE_LEN 32
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 14b6cd022284..58d0bdab68dd 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -202,11 +202,49 @@
202 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 202 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
203 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 203 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
204 {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 204 {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
205 {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x6784, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
216 {0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
217 {0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
218 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
222 {0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
223 {0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
224 {0x1002, 0x6821, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
225 {0x1002, 0x6823, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
226 {0x1002, 0x6824, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
227 {0x1002, 0x6825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
228 {0x1002, 0x6826, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
229 {0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
230 {0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
231 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
232 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
233 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
234 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
235 {0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
236 {0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
237 {0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
239 {0x1002, 0x683B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x683D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
241 {0x1002, 0x683F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
205 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 242 {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 243 {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 244 {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 245 {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 246 {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
247 {0x1002, 0x684C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 248 {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 249 {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 250 {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
@@ -512,6 +550,22 @@
512 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 550 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
513 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 551 {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
514 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 552 {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
553 {0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
554 {0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
555 {0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
556 {0x1002, 0x9904, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
557 {0x1002, 0x9905, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
558 {0x1002, 0x9906, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
559 {0x1002, 0x9907, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
560 {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
561 {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
562 {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
563 {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
564 {0x1002, 0x9990, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
565 {0x1002, 0x9991, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
566 {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
567 {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
568 {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
515 {0, 0, 0} 569 {0, 0, 0}
516 570
517#define r128_PCI_IDS \ 571#define r128_PCI_IDS \
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 1ed3aae893a5..3963116083ae 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -74,16 +74,37 @@ struct drm_exynos_gem_mmap {
74 uint64_t mapped; 74 uint64_t mapped;
75}; 75};
76 76
77/**
78 * A structure for user connection request of virtual display.
79 *
80 * @connection: indicate whether doing connetion or not by user.
81 * @extensions: if this value is 1 then the vidi driver would need additional
82 * 128bytes edid data.
83 * @edid: the edid data pointer from user side.
84 */
85struct drm_exynos_vidi_connection {
86 unsigned int connection;
87 unsigned int extensions;
88 uint64_t *edid;
89};
90
77struct drm_exynos_plane_set_zpos { 91struct drm_exynos_plane_set_zpos {
78 __u32 plane_id; 92 __u32 plane_id;
79 __s32 zpos; 93 __s32 zpos;
80}; 94};
81 95
96/* memory type definitions. */
97enum e_drm_exynos_gem_mem_type {
98 /* Physically Non-Continuous memory. */
99 EXYNOS_BO_NONCONTIG = 1 << 0
100};
101
82#define DRM_EXYNOS_GEM_CREATE 0x00 102#define DRM_EXYNOS_GEM_CREATE 0x00
83#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 103#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
84#define DRM_EXYNOS_GEM_MMAP 0x02 104#define DRM_EXYNOS_GEM_MMAP 0x02
85/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ 105/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
86#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 106#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
107#define DRM_EXYNOS_VIDI_CONNECTION 0x07
87 108
88#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 109#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
89 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 110 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -97,6 +118,9 @@ struct drm_exynos_plane_set_zpos {
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 118#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 119 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99 120
121#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
122 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
123
100#ifdef __KERNEL__ 124#ifdef __KERNEL__
101 125
102/** 126/**
@@ -147,11 +171,13 @@ struct exynos_drm_common_hdmi_pd {
147 * @timing: default video mode for initializing 171 * @timing: default video mode for initializing
148 * @default_win: default window layer number to be used for UI. 172 * @default_win: default window layer number to be used for UI.
149 * @bpp: default bit per pixel. 173 * @bpp: default bit per pixel.
174 * @is_v13: set if hdmi version 13 is.
150 */ 175 */
151struct exynos_drm_hdmi_pdata { 176struct exynos_drm_hdmi_pdata {
152 struct fb_videomode timing; 177 struct fb_videomode timing;
153 unsigned int default_win; 178 unsigned int default_win;
154 unsigned int bpp; 179 unsigned int bpp;
180 unsigned int is_v13:1;
155}; 181};
156 182
157#endif /* __KERNEL__ */ 183#endif /* __KERNEL__ */
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
index 113686785717..884613ee00ad 100644
--- a/include/drm/gma_drm.h
+++ b/include/drm/gma_drm.h
@@ -83,9 +83,9 @@ struct drm_psb_gem_mmap {
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */ 83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */ 84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */ 85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */
87#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */ 86#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
88#define PSB_MODE_OPERATION_MODE_VALID 0x01 87#define PSB_MODE_OPERATION_MODE_VALID 0x01
88#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x08 /* CRTC to physical pipe# */
89 89
90 90
91#endif 91#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 924f6a454fed..da929bb5b788 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -296,6 +296,7 @@ typedef struct drm_i915_irq_wait {
296#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
297#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16 298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
299#define I915_PARAM_HAS_LLC 17
299 300
300typedef struct drm_i915_getparam { 301typedef struct drm_i915_getparam {
301 int param; 302 int param;
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index b174620cc9b3..0a0001b9dc78 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -15,6 +15,10 @@ const struct intel_gtt {
15 unsigned int needs_dmar : 1; 15 unsigned int needs_dmar : 1;
16 /* Whether we idle the gpu before mapping/unmapping */ 16 /* Whether we idle the gpu before mapping/unmapping */
17 unsigned int do_idle_maps : 1; 17 unsigned int do_idle_maps : 1;
18 /* Share the scratch page dma with ppgtts. */
19 dma_addr_t scratch_page_dma;
20 /* for ppgtt PDE access */
21 u32 __iomem *gtt;
18} *intel_gtt_get(void); 22} *intel_gtt_get(void);
19 23
20void intel_gtt_chipset_flush(void); 24void intel_gtt_chipset_flush(void);
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index b55da40953fd..7c491b4bcf65 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -804,13 +804,23 @@ struct drm_radeon_gem_create {
804 uint32_t flags; 804 uint32_t flags;
805}; 805};
806 806
807#define RADEON_TILING_MACRO 0x1 807#define RADEON_TILING_MACRO 0x1
808#define RADEON_TILING_MICRO 0x2 808#define RADEON_TILING_MICRO 0x2
809#define RADEON_TILING_SWAP_16BIT 0x4 809#define RADEON_TILING_SWAP_16BIT 0x4
810#define RADEON_TILING_SWAP_32BIT 0x8 810#define RADEON_TILING_SWAP_32BIT 0x8
811#define RADEON_TILING_SURFACE 0x10 /* this object requires a surface 811/* this object requires a surface when mapped - i.e. front buffer */
812 * when mapped - i.e. front buffer */ 812#define RADEON_TILING_SURFACE 0x10
813#define RADEON_TILING_MICRO_SQUARE 0x20 813#define RADEON_TILING_MICRO_SQUARE 0x20
814#define RADEON_TILING_EG_BANKW_SHIFT 8
815#define RADEON_TILING_EG_BANKW_MASK 0xf
816#define RADEON_TILING_EG_BANKH_SHIFT 12
817#define RADEON_TILING_EG_BANKH_MASK 0xf
818#define RADEON_TILING_EG_MACRO_TILE_ASPECT_SHIFT 16
819#define RADEON_TILING_EG_MACRO_TILE_ASPECT_MASK 0xf
820#define RADEON_TILING_EG_TILE_SPLIT_SHIFT 24
821#define RADEON_TILING_EG_TILE_SPLIT_MASK 0xf
822#define RADEON_TILING_EG_STENCIL_TILE_SPLIT_SHIFT 28
823#define RADEON_TILING_EG_STENCIL_TILE_SPLIT_MASK 0xf
814 824
815struct drm_radeon_gem_set_tiling { 825struct drm_radeon_gem_set_tiling {
816 uint32_t handle; 826 uint32_t handle;
@@ -898,6 +908,7 @@ struct drm_radeon_gem_va {
898#define RADEON_CHUNK_ID_RELOCS 0x01 908#define RADEON_CHUNK_ID_RELOCS 0x01
899#define RADEON_CHUNK_ID_IB 0x02 909#define RADEON_CHUNK_ID_IB 0x02
900#define RADEON_CHUNK_ID_FLAGS 0x03 910#define RADEON_CHUNK_ID_FLAGS 0x03
911#define RADEON_CHUNK_ID_CONST_IB 0x04
901 912
902/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 913/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
903#define RADEON_CS_KEEP_TILING_FLAGS 0x01 914#define RADEON_CS_KEEP_TILING_FLAGS 0x01
@@ -952,6 +963,8 @@ struct drm_radeon_cs {
952#define RADEON_INFO_VA_START 0x0e 963#define RADEON_INFO_VA_START 0x0e
953/* maximum size of ib using the virtual memory cs */ 964/* maximum size of ib using the virtual memory cs */
954#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f 965#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
966/* max pipes - needed for compute shaders */
967#define RADEON_INFO_MAX_PIPES 0x10
955 968
956struct drm_radeon_info { 969struct drm_radeon_info {
957 uint32_t request; 970 uint32_t request;
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
index 26c1f78d136f..d6d1da468c97 100644
--- a/include/drm/ttm/ttm_memory.h
+++ b/include/drm/ttm/ttm_memory.h
@@ -30,6 +30,7 @@
30 30
31#include <linux/workqueue.h> 31#include <linux/workqueue.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/bug.h>
33#include <linux/wait.h> 34#include <linux/wait.h>
34#include <linux/errno.h> 35#include <linux/errno.h>
35#include <linux/kobject.h> 36#include <linux/kobject.h>
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/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/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/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..e8cf0ccd1a8d 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>
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/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/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 1cd3947987e5..ba317e2930a1 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..fa63f1b46103 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);
@@ -2304,7 +2306,10 @@ extern struct inode * igrab(struct inode *);
2304extern ino_t iunique(struct super_block *, ino_t); 2306extern ino_t iunique(struct super_block *, ino_t);
2305extern int inode_needs_sync(struct inode *inode); 2307extern int inode_needs_sync(struct inode *inode);
2306extern int generic_delete_inode(struct inode *inode); 2308extern int generic_delete_inode(struct inode *inode);
2307extern int generic_drop_inode(struct inode *inode); 2309static inline int generic_drop_inode(struct inode *inode)
2310{
2311 return !inode->i_nlink || inode_unhashed(inode);
2312}
2308 2313
2309extern struct inode *ilookup5_nowait(struct super_block *sb, 2314extern struct inode *ilookup5_nowait(struct super_block *sb,
2310 unsigned long hashval, int (*test)(struct inode *, void *), 2315 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/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..ed5a46707ad0 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -34,6 +34,7 @@ struct gpio {
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/types.h> 35#include <linux/types.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/bug.h>
37 38
38struct device; 39struct device;
39struct gpio_chip; 40struct 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..584ffa0f3282 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -49,5 +49,6 @@ struct i2c_algo_bit_data {
49 49
50int i2c_bit_add_bus(struct i2c_adapter *); 50int i2c_bit_add_bus(struct i2c_adapter *);
51int i2c_bit_add_numbered_bus(struct i2c_adapter *); 51int i2c_bit_add_numbered_bus(struct i2c_adapter *);
52extern const struct i2c_algorithm i2c_bit_algo;
52 53
53#endif /* _LINUX_I2C_ALGO_BIT_H */ 54#endif /* _LINUX_I2C_ALGO_BIT_H */
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..7fcab23c59ce 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,6 +752,13 @@ 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(int module);
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 f994d51f70f2..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),\
@@ -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/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/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 5582c7985567..92c10262d346 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))
@@ -312,6 +311,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int);
312#define strict_strtoull kstrtoull 311#define strict_strtoull kstrtoull
313#define strict_strtoll kstrtoll 312#define strict_strtoll kstrtoll
314 313
314extern int num_to_str(char *buf, int size, unsigned long long num);
315
315/* lib/printf utilities */ 316/* lib/printf utilities */
316 317
317extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); 318extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...);
@@ -328,10 +329,10 @@ extern __printf(2, 3)
328char *kasprintf(gfp_t gfp, const char *fmt, ...); 329char *kasprintf(gfp_t gfp, const char *fmt, ...);
329extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); 330extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
330 331
331extern int sscanf(const char *, const char *, ...) 332extern __scanf(2, 3)
332 __attribute__ ((format (scanf, 2, 3))); 333int sscanf(const char *, const char *, ...);
333extern int vsscanf(const char *, const char *, va_list) 334extern __scanf(2, 0)
334 __attribute__ ((format (scanf, 2, 0))); 335int vsscanf(const char *, const char *, va_list);
335 336
336extern int get_option(char **str, int *pint); 337extern int get_option(char **str, int *pint);
337extern char *get_options(const char *str, int nints, int *ints); 338extern char *get_options(const char *str, int nints, int *ints);
@@ -678,67 +679,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
678 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 679 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
679 (type *)( (char *)__mptr - offsetof(type,member) );}) 680 (type *)( (char *)__mptr - offsetof(type,member) );})
680 681
681#ifdef __CHECKER__
682#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
683#define BUILD_BUG_ON_ZERO(e) (0)
684#define BUILD_BUG_ON_NULL(e) ((void*)0)
685#define BUILD_BUG_ON(condition)
686#define BUILD_BUG() (0)
687#else /* __CHECKER__ */
688
689/* Force a compilation error if a constant expression is not a power of 2 */
690#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
691 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
692
693/* Force a compilation error if condition is true, but also produce a
694 result (of value 0 and type size_t), so the expression can be used
695 e.g. in a structure initializer (or where-ever else comma expressions
696 aren't permitted). */
697#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
698#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
699
700/**
701 * BUILD_BUG_ON - break compile if a condition is true.
702 * @condition: the condition which the compiler should know is false.
703 *
704 * If you have some code which relies on certain constants being equal, or
705 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
706 * detect if someone changes it.
707 *
708 * The implementation uses gcc's reluctance to create a negative array, but
709 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
710 * to inline functions). So as a fallback we use the optimizer; if it can't
711 * prove the condition is false, it will cause a link error on the undefined
712 * "__build_bug_on_failed". This error message can be harder to track down
713 * though, hence the two different methods.
714 */
715#ifndef __OPTIMIZE__
716#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
717#else
718extern int __build_bug_on_failed;
719#define BUILD_BUG_ON(condition) \
720 do { \
721 ((void)sizeof(char[1 - 2*!!(condition)])); \
722 if (condition) __build_bug_on_failed = 1; \
723 } while(0)
724#endif
725
726/**
727 * BUILD_BUG - break compile if used.
728 *
729 * If you have some code that you expect the compiler to eliminate at
730 * build time, you should use BUILD_BUG to detect if it is
731 * unexpectedly used.
732 */
733#define BUILD_BUG() \
734 do { \
735 extern void __build_bug_failed(void) \
736 __linktime_error("BUILD_BUG failed"); \
737 __build_bug_failed(); \
738 } while (0)
739
740#endif /* __CHECKER__ */
741
742/* Trap pasters of __FUNCTION__ at compile-time */ 682/* Trap pasters of __FUNCTION__ at compile-time */
743#define __FUNCTION__ (__func__) 683#define __FUNCTION__ (__func__)
744 684
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/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/abx500.h b/include/linux/mfd/abx500.h
index 9970337ff041..e20dd6ead1d0 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
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.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..dca94396190d 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -7,7 +7,9 @@
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;
11 13
12/* 14/*
13 * AB8500 bank addresses 15 * AB8500 bank addresses
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/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/stmpe.h b/include/linux/mfd/stmpe.h
index ca1d7a347600..8c54de674b4b 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,
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/tps65910.h b/include/linux/mfd/tps65910.h
index d0cb12eba402..76700b5eee92 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -768,6 +768,12 @@
768/* Max number of TPS65910/11 regulators */ 768/* Max number of TPS65910/11 regulators */
769#define TPS65910_NUM_REGS 13 769#define TPS65910_NUM_REGS 13
770 770
771/* External sleep controls through EN1/EN2/EN3/SLEEP inputs */
772#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1
773#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2
774#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4
775#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8
776
771/** 777/**
772 * struct tps65910_board 778 * struct tps65910_board
773 * Board platform data may be used to initialize regulators. 779 * Board platform data may be used to initialize regulators.
@@ -779,6 +785,7 @@ struct tps65910_board {
779 int irq_base; 785 int irq_base;
780 int vmbch_threshold; 786 int vmbch_threshold;
781 int vmbch2_threshold; 787 int vmbch2_threshold;
788 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
782 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; 789 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
783}; 790};
784 791
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 3fb1f407d5e6..dc3e05011689 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -185,6 +185,9 @@ struct wm8994_pdata {
185 unsigned int jd_scthr:2; 185 unsigned int jd_scthr:2;
186 unsigned int jd_thr:2; 186 unsigned int jd_thr:2;
187 187
188 /* Configure WM1811 jack detection for use with external capacitor */
189 unsigned int jd_ext_cap:1;
190
188 /* WM8958 microphone bias configuration */ 191 /* WM8958 microphone bias configuration */
189 int micbias[2]; 192 int micbias[2];
190 193
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..fb69ad191ad7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -560,4 +560,25 @@ struct amba_id {
560#endif 560#endif
561}; 561};
562 562
563/*
564 * Match x86 CPUs for CPU specific drivers.
565 * See documentation of "x86_match_cpu" for details.
566 */
567
568struct x86_cpu_id {
569 __u16 vendor;
570 __u16 family;
571 __u16 model;
572 __u16 feature; /* bit index */
573 kernel_ulong_t driver_data;
574};
575
576#define X86_FEATURE_MATCH(x) \
577 { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x }
578
579#define X86_VENDOR_ANY 0xffff
580#define X86_FAMILY_ANY 0
581#define X86_MODEL_ANY 0
582#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
583
563#endif /* LINUX_MOD_DEVICETABLE_H */ 584#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 7dfaae7846ab..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;
@@ -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/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..d46a18ffbebb 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,
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_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_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/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/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/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/printk.h b/include/linux/printk.h
index 1f77a4174ee0..0525927f203f 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -190,13 +190,13 @@ extern void dump_stack(void) __cold;
190#endif 190#endif
191 191
192/* If you are writing a driver, please use dev_dbg instead */ 192/* If you are writing a driver, please use dev_dbg instead */
193#if defined(DEBUG) 193#if defined(CONFIG_DYNAMIC_DEBUG)
194#define pr_debug(fmt, ...) \
195 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
196#elif defined(CONFIG_DYNAMIC_DEBUG)
197/* 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 */
198#define pr_debug(fmt, ...) \ 195#define pr_debug(fmt, ...) \
199 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__)
200#else 200#else
201#define pr_debug(fmt, ...) \ 201#define pr_debug(fmt, ...) \
202 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 937217425c47..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
@@ -418,7 +419,7 @@ extern int rcu_my_thread_group_empty(void);
418 */ 419 */
419#define rcu_lockdep_assert(c, s) \ 420#define rcu_lockdep_assert(c, s) \
420 do { \ 421 do { \
421 static bool __warned; \ 422 static bool __section(.data.unlikely) __warned; \
422 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ 423 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
423 __warned = true; \ 424 __warned = true; \
424 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ 425 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \
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/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/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/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 e074e1e54f85..0c3854b0d4b1 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -553,6 +553,18 @@ struct signal_struct {
553 int group_stop_count; 553 int group_stop_count;
554 unsigned int flags; /* see SIGNAL_* flags below */ 554 unsigned int flags; /* see SIGNAL_* flags below */
555 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
556 /* POSIX.1b Interval Timers */ 568 /* POSIX.1b Interval Timers */
557 struct list_head posix_timers; 569 struct list_head posix_timers;
558 570
@@ -1514,7 +1526,7 @@ struct task_struct {
1514#endif 1526#endif
1515#ifdef CONFIG_CPUSETS 1527#ifdef CONFIG_CPUSETS
1516 nodemask_t mems_allowed; /* Protected by alloc_lock */ 1528 nodemask_t mems_allowed; /* Protected by alloc_lock */
1517 int mems_allowed_change_disable; 1529 seqcount_t mems_allowed_seq; /* Seqence no to catch updates */
1518 int cpuset_mem_spread_rotor; 1530 int cpuset_mem_spread_rotor;
1519 int cpuset_slab_spread_rotor; 1531 int cpuset_slab_spread_rotor;
1520#endif 1532#endif
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_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..3fcb204a2612 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}
@@ -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/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/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/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/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/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..c5d8455c68c0 100644
--- a/include/linux/virtio_ids.h
+++ b/include/linux/virtio_ids.h
@@ -34,6 +34,7 @@
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_SCSI 8 /* virtio scsi */
37#define VIRTIO_ID_9P 9 /* 9p virtio console */ 38#define VIRTIO_ID_9P 9 /* 9p virtio console */
38 39
39#endif /* _LINUX_VIRTIO_IDS_H */ 40#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/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 */
diff --git a/include/media/adv7183.h b/include/media/adv7183.h
new file mode 100644
index 000000000000..c5c2d377c0a6
--- /dev/null
+++ b/include/media/adv7183.h
@@ -0,0 +1,47 @@
1/*
2 * adv7183.h - definition for adv7183 inputs and outputs
3 *
4 * Copyright (c) 2011 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _ADV7183_H_
21#define _ADV7183_H_
22
23/* ADV7183 HW inputs */
24#define ADV7183_COMPOSITE0 0 /* CVBS in on AIN1 */
25#define ADV7183_COMPOSITE1 1 /* CVBS in on AIN2 */
26#define ADV7183_COMPOSITE2 2 /* CVBS in on AIN3 */
27#define ADV7183_COMPOSITE3 3 /* CVBS in on AIN4 */
28#define ADV7183_COMPOSITE4 4 /* CVBS in on AIN5 */
29#define ADV7183_COMPOSITE5 5 /* CVBS in on AIN6 */
30#define ADV7183_COMPOSITE6 6 /* CVBS in on AIN7 */
31#define ADV7183_COMPOSITE7 7 /* CVBS in on AIN8 */
32#define ADV7183_COMPOSITE8 8 /* CVBS in on AIN9 */
33#define ADV7183_COMPOSITE9 9 /* CVBS in on AIN10 */
34#define ADV7183_COMPOSITE10 10 /* CVBS in on AIN11 */
35
36#define ADV7183_SVIDEO0 11 /* Y on AIN1, C on AIN4 */
37#define ADV7183_SVIDEO1 12 /* Y on AIN2, C on AIN5 */
38#define ADV7183_SVIDEO2 13 /* Y on AIN3, C on AIN6 */
39
40#define ADV7183_COMPONENT0 14 /* Y on AIN1, Pr on AIN4, Pb on AIN5 */
41#define ADV7183_COMPONENT1 15 /* Y on AIN2, Pr on AIN3, Pb on AIN6 */
42
43/* ADV7183 HW outputs */
44#define ADV7183_8BIT_OUT 0
45#define ADV7183_16BIT_OUT 1
46
47#endif
diff --git a/include/media/blackfin/bfin_capture.h b/include/media/blackfin/bfin_capture.h
new file mode 100644
index 000000000000..2038a8a3f8aa
--- /dev/null
+++ b/include/media/blackfin/bfin_capture.h
@@ -0,0 +1,37 @@
1#ifndef _BFIN_CAPTURE_H_
2#define _BFIN_CAPTURE_H_
3
4#include <linux/i2c.h>
5
6struct v4l2_input;
7struct ppi_info;
8
9struct bcap_route {
10 u32 input;
11 u32 output;
12};
13
14struct bfin_capture_config {
15 /* card name */
16 char *card_name;
17 /* inputs available at the sub device */
18 struct v4l2_input *inputs;
19 /* number of inputs supported */
20 int num_inputs;
21 /* routing information for each input */
22 struct bcap_route *routes;
23 /* i2c bus adapter no */
24 int i2c_adapter_id;
25 /* i2c subdevice board info */
26 struct i2c_board_info board_info;
27 /* ppi board info */
28 const struct ppi_info *ppi_info;
29 /* ppi control */
30 unsigned long ppi_control;
31 /* ppi interrupt mask */
32 u32 int_mask;
33 /* horizontal blanking clocks */
34 int blank_clocks;
35};
36
37#endif
diff --git a/include/media/blackfin/ppi.h b/include/media/blackfin/ppi.h
new file mode 100644
index 000000000000..8f72f8a0b3d0
--- /dev/null
+++ b/include/media/blackfin/ppi.h
@@ -0,0 +1,74 @@
1/*
2 * Analog Devices PPI header file
3 *
4 * Copyright (c) 2011 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _PPI_H_
21#define _PPI_H_
22
23#include <linux/interrupt.h>
24
25#ifdef EPPI_EN
26#define PORT_EN EPPI_EN
27#define DMA32 0
28#define PACK_EN PACKEN
29#endif
30
31struct ppi_if;
32
33struct ppi_params {
34 int width;
35 int height;
36 int bpp;
37 unsigned long ppi_control;
38 u32 int_mask;
39 int blank_clocks;
40};
41
42struct ppi_ops {
43 int (*attach_irq)(struct ppi_if *ppi, irq_handler_t handler);
44 void (*detach_irq)(struct ppi_if *ppi);
45 int (*start)(struct ppi_if *ppi);
46 int (*stop)(struct ppi_if *ppi);
47 int (*set_params)(struct ppi_if *ppi, struct ppi_params *params);
48 void (*update_addr)(struct ppi_if *ppi, unsigned long addr);
49};
50
51enum ppi_type {
52 PPI_TYPE_PPI,
53 PPI_TYPE_EPPI,
54};
55
56struct ppi_info {
57 enum ppi_type type;
58 int dma_ch;
59 int irq_err;
60 void __iomem *base;
61 const unsigned short *pin_req;
62};
63
64struct ppi_if {
65 unsigned long ppi_control;
66 const struct ppi_ops *ops;
67 const struct ppi_info *info;
68 bool err_int;
69 void *priv;
70};
71
72struct ppi_if *ppi_create_instance(const struct ppi_info *info);
73void ppi_delete_instance(struct ppi_if *ppi);
74#endif
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
index 9929b05cff3a..bd8217c2577c 100644
--- a/include/media/davinci/vpif_types.h
+++ b/include/media/davinci/vpif_types.h
@@ -17,6 +17,8 @@
17#ifndef _VPIF_TYPES_H 17#ifndef _VPIF_TYPES_H
18#define _VPIF_TYPES_H 18#define _VPIF_TYPES_H
19 19
20#include <linux/i2c.h>
21
20#define VPIF_CAPTURE_MAX_CHANNELS 2 22#define VPIF_CAPTURE_MAX_CHANNELS 2
21 23
22enum vpif_if_type { 24enum vpif_if_type {
diff --git a/include/media/gpio-ir-recv.h b/include/media/gpio-ir-recv.h
new file mode 100644
index 000000000000..67797bf5d432
--- /dev/null
+++ b/include/media/gpio-ir-recv.h
@@ -0,0 +1,22 @@
1/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __GPIO_IR_RECV_H__
14#define __GPIO_IR_RECV_H__
15
16struct gpio_ir_recv_platform_data {
17 int gpio_nr;
18 bool active_low;
19};
20
21#endif /* __GPIO_IR_RECV_H__ */
22
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 6a27d916c250..eaade9815bb6 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -23,7 +23,6 @@
23#ifndef _MEDIA_DEVICE_H 23#ifndef _MEDIA_DEVICE_H
24#define _MEDIA_DEVICE_H 24#define _MEDIA_DEVICE_H
25 25
26#include <linux/device.h>
27#include <linux/list.h> 26#include <linux/list.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
29#include <linux/spinlock.h> 28#include <linux/spinlock.h>
@@ -31,6 +30,8 @@
31#include <media/media-devnode.h> 30#include <media/media-devnode.h>
32#include <media/media-entity.h> 31#include <media/media-entity.h>
33 32
33struct device;
34
34/** 35/**
35 * struct media_device - Media device 36 * struct media_device - Media device
36 * @dev: Parent device 37 * @dev: Parent device
diff --git a/include/media/mt9m032.h b/include/media/mt9m032.h
new file mode 100644
index 000000000000..c3a78114d7a6
--- /dev/null
+++ b/include/media/mt9m032.h
@@ -0,0 +1,36 @@
1/*
2 * Driver for MT9M032 CMOS Image Sensor from Micron
3 *
4 * Copyright (C) 2010-2011 Lund Engineering
5 * Contact: Gil Lund <gwlund@lundeng.com>
6 * Author: Martin Hostettler <martin@neutronstar.dyndns.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef MT9M032_H
25#define MT9M032_H
26
27#define MT9M032_NAME "mt9m032"
28#define MT9M032_I2C_ADDR (0xb8 >> 1)
29
30struct mt9m032_platform_data {
31 u32 ext_clock;
32 u32 pix_clock;
33 bool invert_pixclock;
34
35};
36#endif /* MT9M032_H */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index f688bde61228..8db6741c1256 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -102,8 +102,11 @@ void rc_map_init(void);
102#define RC_MAP_IMON_MCE "rc-imon-mce" 102#define RC_MAP_IMON_MCE "rc-imon-mce"
103#define RC_MAP_IMON_PAD "rc-imon-pad" 103#define RC_MAP_IMON_PAD "rc-imon-pad"
104#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" 104#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
105#define RC_MAP_IT913X_V1 "rc-it913x-v1"
106#define RC_MAP_IT913X_V2 "rc-it913x-v2"
105#define RC_MAP_KAIOMY "rc-kaiomy" 107#define RC_MAP_KAIOMY "rc-kaiomy"
106#define RC_MAP_KWORLD_315U "rc-kworld-315u" 108#define RC_MAP_KWORLD_315U "rc-kworld-315u"
109#define RC_MAP_KWORLD_PC150U "rc-kworld-pc150u"
107#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" 110#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog"
108#define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051" 111#define RC_MAP_LEADTEK_Y04G0051 "rc-leadtek-y04g0051"
109#define RC_MAP_LIRC "rc-lirc" 112#define RC_MAP_LIRC "rc-lirc"
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
new file mode 100644
index 000000000000..361a751f73af
--- /dev/null
+++ b/include/media/s5p_hdmi.h
@@ -0,0 +1,35 @@
1/*
2 * Driver header for S5P HDMI chip.
3 *
4 * Copyright (c) 2011 Samsung Electronics, Co. Ltd
5 * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef S5P_HDMI_H
14#define S5P_HDMI_H
15
16struct i2c_board_info;
17
18/**
19 * @hdmiphy_bus: controller id for HDMIPHY bus
20 * @hdmiphy_info: template for HDMIPHY I2C device
21 * @mhl_bus: controller id for MHL control bus
22 * @mhl_info: template for MHL I2C device
23 *
24 * NULL pointer for *_info fields indicates that
25 * the corresponding chip is not present
26 */
27struct s5p_hdmi_platform_data {
28 int hdmiphy_bus;
29 struct i2c_board_info *hdmiphy_info;
30 int mhl_bus;
31 struct i2c_board_info *mhl_info;
32};
33
34#endif /* S5P_HDMI_H */
35
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 48413b410f15..a90a765f18da 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -18,6 +18,8 @@ struct sh_mobile_ceu_companion {
18 18
19struct sh_mobile_ceu_info { 19struct sh_mobile_ceu_info {
20 unsigned long flags; 20 unsigned long flags;
21 int max_width;
22 int max_height;
21 struct sh_mobile_ceu_companion *csi2; 23 struct sh_mobile_ceu_companion *csi2;
22}; 24};
23 25
diff --git a/include/media/sii9234.h b/include/media/sii9234.h
new file mode 100644
index 000000000000..6a4a809fe9a3
--- /dev/null
+++ b/include/media/sii9234.h
@@ -0,0 +1,24 @@
1/*
2 * Driver header for SII9234 MHL converter chip.
3 *
4 * Copyright (c) 2011 Samsung Electronics, Co. Ltd
5 * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef SII9234_H
14#define SII9234_H
15
16/**
17 * @gpio_n_reset: GPIO driving nRESET pin
18 */
19
20struct sii9234_platform_data {
21 int gpio_n_reset;
22};
23
24#endif /* SII9234_H */
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 29e1920e7339..926aff9bdf65 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -136,6 +136,7 @@
136#define TUNER_TENA_TNF_5337 86 136#define TUNER_TENA_TNF_5337 86
137 137
138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */ 138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */
139#define TUNER_XC5000C 88 /* Xceive Silicon Tuner */
139 140
140/* tv card specific */ 141/* tv card specific */
141#define TDA9887_PRESENT (1<<0) 142#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 810a20928a21..7395c815939d 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -143,6 +143,9 @@ enum {
143 /* module saa6588: just ident 6588 */ 143 /* module saa6588: just ident 6588 */
144 V4L2_IDENT_SAA6588 = 6588, 144 V4L2_IDENT_SAA6588 = 6588,
145 145
146 /* module vs6624: just ident 6624 */
147 V4L2_IDENT_VS6624 = 6624,
148
146 /* module saa6752hs: reserved range 6750-6759 */ 149 /* module saa6752hs: reserved range 6750-6759 */
147 V4L2_IDENT_SAA6752HS = 6752, 150 V4L2_IDENT_SAA6752HS = 6752,
148 V4L2_IDENT_SAA6752HS_AC3 = 6753, 151 V4L2_IDENT_SAA6752HS_AC3 = 6753,
@@ -162,6 +165,9 @@ enum {
162 /* module adv7180: just ident 7180 */ 165 /* module adv7180: just ident 7180 */
163 V4L2_IDENT_ADV7180 = 7180, 166 V4L2_IDENT_ADV7180 = 7180,
164 167
168 /* module adv7183: just ident 7183 */
169 V4L2_IDENT_ADV7183 = 7183,
170
165 /* module saa7185: just ident 7185 */ 171 /* module saa7185: just ident 7185 */
166 V4L2_IDENT_SAA7185 = 7185, 172 V4L2_IDENT_SAA7185 = 7185,
167 173
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index eeb3df637144..11e67562b3ac 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,7 +22,6 @@
22#define _V4L2_CTRLS_H 22#define _V4L2_CTRLS_H
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/device.h>
26#include <linux/videodev2.h> 25#include <linux/videodev2.h>
27 26
28/* forward references */ 27/* forward references */
@@ -33,6 +32,7 @@ struct video_device;
33struct v4l2_subdev; 32struct v4l2_subdev;
34struct v4l2_subscribed_event; 33struct v4l2_subscribed_event;
35struct v4l2_fh; 34struct v4l2_fh;
35struct poll_table_struct;
36 36
37/** struct v4l2_ctrl_ops - The control operations that the driver has to provide. 37/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
38 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant 38 * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
@@ -492,6 +492,18 @@ void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
492void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, 492void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
493 struct v4l2_subscribed_event *sev); 493 struct v4l2_subscribed_event *sev);
494 494
495/* Can be used as a vidioc_log_status function that just dumps all controls
496 associated with the filehandle. */
497int v4l2_ctrl_log_status(struct file *file, void *fh);
498
499/* Can be used as a vidioc_subscribe_event function that just subscribes
500 control events. */
501int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
502 struct v4l2_event_subscription *sub);
503
504/* Can be used as a poll function that just polls for control events. */
505unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
506
495/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ 507/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
496int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); 508int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
497int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); 509int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index c7c40f1d2624..96d22215cc88 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -62,6 +62,9 @@ struct v4l2_file_operations {
62 unsigned int (*poll) (struct file *, struct poll_table_struct *); 62 unsigned int (*poll) (struct file *, struct poll_table_struct *);
63 long (*ioctl) (struct file *, unsigned int, unsigned long); 63 long (*ioctl) (struct file *, unsigned int, unsigned long);
64 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 64 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
65#ifdef CONFIG_COMPAT
66 long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
67#endif
65 unsigned long (*get_unmapped_area) (struct file *, unsigned long, 68 unsigned long (*get_unmapped_area) (struct file *, unsigned long,
66 unsigned long, unsigned long, unsigned long); 69 unsigned long, unsigned long, unsigned long);
67 int (*mmap) (struct file *, struct vm_area_struct *); 70 int (*mmap) (struct file *, struct vm_area_struct *);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 3f5d60fc5df6..3cb939cd03f9 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -11,7 +11,6 @@
11 11
12#include <linux/poll.h> 12#include <linux/poll.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/device.h>
15#include <linux/mutex.h> 14#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */ 15#include <linux/compiler.h> /* need __user */
17#include <linux/videodev2.h> 16#include <linux/videodev2.h>
@@ -211,6 +210,10 @@ struct v4l2_ioctl_ops {
211 struct v4l2_encoder_cmd *a); 210 struct v4l2_encoder_cmd *a);
212 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, 211 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
213 struct v4l2_encoder_cmd *a); 212 struct v4l2_encoder_cmd *a);
213 int (*vidioc_decoder_cmd) (struct file *file, void *fh,
214 struct v4l2_decoder_cmd *a);
215 int (*vidioc_try_decoder_cmd) (struct file *file, void *fh,
216 struct v4l2_decoder_cmd *a);
214 217
215 /* Stream type-dependent parameter ioctls */ 218 /* Stream type-dependent parameter ioctls */
216 int (*vidioc_g_parm) (struct file *file, void *fh, 219 int (*vidioc_g_parm) (struct file *file, void *fh,
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index f68dce2d8d88..757a17638b1b 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -160,7 +160,6 @@ extern void addrconf_prefix_rcv(struct net_device *dev,
160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); 160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr);
161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); 161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr);
162extern void ipv6_sock_ac_close(struct sock *sk); 162extern void ipv6_sock_ac_close(struct sock *sk);
163extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex);
164 163
165extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
166extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 5a4e29b168c9..ca68e2cef230 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -49,8 +49,7 @@ struct unix_sock {
49 /* WARNING: sk has to be the first member */ 49 /* WARNING: sk has to be the first member */
50 struct sock sk; 50 struct sock sk;
51 struct unix_address *addr; 51 struct unix_address *addr;
52 struct dentry *dentry; 52 struct path path;
53 struct vfsmount *mnt;
54 struct mutex readlock; 53 struct mutex readlock;
55 struct sock *peer; 54 struct sock *peer;
56 struct sock *other; 55 struct sock *other;
diff --git a/include/net/arp.h b/include/net/arp.h
index 0013dc87940b..4a1f3fb562eb 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -15,14 +15,14 @@ static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd
15 return val * hash_rnd; 15 return val * hash_rnd;
16} 16}
17 17
18static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) 18static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
19{ 19{
20 struct neigh_hash_table *nht; 20 struct neigh_hash_table *nht;
21 struct neighbour *n; 21 struct neighbour *n;
22 u32 hash_val; 22 u32 hash_val;
23 23
24 rcu_read_lock_bh(); 24 rcu_read_lock_bh();
25 nht = rcu_dereference_bh(tbl->nht); 25 nht = rcu_dereference_bh(arp_tbl.nht);
26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); 26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
28 n != NULL; 28 n != NULL;
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 4a82ca0bb0b2..262ebd1747d4 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -109,12 +109,14 @@ struct bt_power {
109 */ 109 */
110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2 110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
111 111
112__printf(2, 3) 112__printf(1, 2)
113int bt_printk(const char *level, const char *fmt, ...); 113int bt_info(const char *fmt, ...);
114__printf(1, 2)
115int bt_err(const char *fmt, ...);
114 116
115#define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) 117#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__)
116#define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) 118#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__)
117#define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) 119#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)
118 120
119/* Connection and socket states */ 121/* Connection and socket states */
120enum { 122enum {
@@ -129,6 +131,33 @@ enum {
129 BT_CLOSED 131 BT_CLOSED
130}; 132};
131 133
134/* If unused will be removed by compiler */
135static inline const char *state_to_string(int state)
136{
137 switch (state) {
138 case BT_CONNECTED:
139 return "BT_CONNECTED";
140 case BT_OPEN:
141 return "BT_OPEN";
142 case BT_BOUND:
143 return "BT_BOUND";
144 case BT_LISTEN:
145 return "BT_LISTEN";
146 case BT_CONNECT:
147 return "BT_CONNECT";
148 case BT_CONNECT2:
149 return "BT_CONNECT2";
150 case BT_CONFIG:
151 return "BT_CONFIG";
152 case BT_DISCONN:
153 return "BT_DISCONN";
154 case BT_CLOSED:
155 return "BT_CLOSED";
156 }
157
158 return "invalid state";
159}
160
132/* BD Address */ 161/* BD Address */
133typedef struct { 162typedef struct {
134 __u8 b[6]; 163 __u8 b[6];
@@ -193,7 +222,6 @@ struct bt_skb_cb {
193 __u16 tx_seq; 222 __u16 tx_seq;
194 __u8 retries; 223 __u8 retries;
195 __u8 sar; 224 __u8 sar;
196 unsigned short channel;
197 __u8 force_active; 225 __u8 force_active;
198}; 226};
199#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 227#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 00596e816b4d..344b0f972828 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -77,14 +77,6 @@ enum {
77 77
78 HCI_RAW, 78 HCI_RAW,
79 79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
87
88 HCI_RESET, 80 HCI_RESET,
89}; 81};
90 82
@@ -93,7 +85,22 @@ enum {
93 * states from the controller. 85 * states from the controller.
94 */ 86 */
95enum { 87enum {
88 HCI_SETUP,
89 HCI_AUTO_OFF,
90 HCI_MGMT,
91 HCI_PAIRABLE,
92 HCI_SERVICE_CACHE,
93 HCI_LINK_KEYS,
94 HCI_DEBUG_KEYS,
95
96 HCI_LE_SCAN, 96 HCI_LE_SCAN,
97 HCI_SSP_ENABLED,
98 HCI_HS_ENABLED,
99 HCI_LE_ENABLED,
100 HCI_CONNECTABLE,
101 HCI_DISCOVERABLE,
102 HCI_LINK_SECURITY,
103 HCI_PENDING_CLASS,
97}; 104};
98 105
99/* HCI ioctl defines */ 106/* HCI ioctl defines */
@@ -130,6 +137,7 @@ enum {
130#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 137#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
131#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 138#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
132#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 139#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
140#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
133 141
134/* HCI data types */ 142/* HCI data types */
135#define HCI_COMMAND_PKT 0x01 143#define HCI_COMMAND_PKT 0x01
@@ -229,7 +237,9 @@ enum {
229#define LMP_EXTFEATURES 0x80 237#define LMP_EXTFEATURES 0x80
230 238
231/* Extended LMP features */ 239/* Extended LMP features */
232#define LMP_HOST_LE 0x02 240#define LMP_HOST_SSP 0x01
241#define LMP_HOST_LE 0x02
242#define LMP_HOST_LE_BREDR 0x04
233 243
234/* Connection modes */ 244/* Connection modes */
235#define HCI_CM_ACTIVE 0x0000 245#define HCI_CM_ACTIVE 0x0000
@@ -268,10 +278,11 @@ enum {
268#define HCI_LK_UNAUTH_COMBINATION 0x04 278#define HCI_LK_UNAUTH_COMBINATION 0x04
269#define HCI_LK_AUTH_COMBINATION 0x05 279#define HCI_LK_AUTH_COMBINATION 0x05
270#define HCI_LK_CHANGED_COMBINATION 0x06 280#define HCI_LK_CHANGED_COMBINATION 0x06
271/* The spec doesn't define types for SMP keys */ 281/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
272#define HCI_LK_SMP_LTK 0x81 282#define HCI_SMP_STK 0x80
273#define HCI_LK_SMP_IRK 0x82 283#define HCI_SMP_STK_SLAVE 0x81
274#define HCI_LK_SMP_CSRK 0x83 284#define HCI_SMP_LTK 0x82
285#define HCI_SMP_LTK_SLAVE 0x83
275 286
276/* ---- HCI Error Codes ---- */ 287/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05 288#define HCI_ERROR_AUTH_FAILURE 0x05
@@ -284,6 +295,22 @@ enum {
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 295#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 296#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286 297
298/* Extended Inquiry Response field types */
299#define EIR_FLAGS 0x01 /* flags */
300#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
301#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
302#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
303#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
304#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
305#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
306#define EIR_NAME_SHORT 0x08 /* shortened local name */
307#define EIR_NAME_COMPLETE 0x09 /* complete local name */
308#define EIR_TX_POWER 0x0A /* transmit power level */
309#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
310#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
311#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
312#define EIR_DEVICE_ID 0x10 /* device ID */
313
287/* ----- HCI Commands ---- */ 314/* ----- HCI Commands ---- */
288#define HCI_OP_NOP 0x0000 315#define HCI_OP_NOP 0x0000
289 316
@@ -666,8 +693,8 @@ struct hci_cp_host_buffer_size {
666 693
667#define HCI_OP_WRITE_EIR 0x0c52 694#define HCI_OP_WRITE_EIR 0x0c52
668struct hci_cp_write_eir { 695struct hci_cp_write_eir {
669 uint8_t fec; 696 __u8 fec;
670 uint8_t data[HCI_MAX_EIR_LENGTH]; 697 __u8 data[HCI_MAX_EIR_LENGTH];
671} __packed; 698} __packed;
672 699
673#define HCI_OP_READ_SSP_MODE 0x0c55 700#define HCI_OP_READ_SSP_MODE 0x0c55
@@ -698,8 +725,8 @@ struct hci_rp_read_flow_control_mode {
698 725
699#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 726#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
700struct hci_cp_write_le_host_supported { 727struct hci_cp_write_le_host_supported {
701 __u8 le; 728 __u8 le;
702 __u8 simul; 729 __u8 simul;
703} __packed; 730} __packed;
704 731
705#define HCI_OP_READ_LOCAL_VERSION 0x1001 732#define HCI_OP_READ_LOCAL_VERSION 0x1001
@@ -1155,6 +1182,19 @@ struct hci_ev_le_meta {
1155 __u8 subevent; 1182 __u8 subevent;
1156} __packed; 1183} __packed;
1157 1184
1185#define HCI_EV_NUM_COMP_BLOCKS 0x48
1186struct hci_comp_blocks_info {
1187 __le16 handle;
1188 __le16 pkts;
1189 __le16 blocks;
1190} __packed;
1191
1192struct hci_ev_num_comp_blocks {
1193 __le16 num_blocks;
1194 __u8 num_hndl;
1195 struct hci_comp_blocks_info handles[0];
1196} __packed;
1197
1158/* Low energy meta events */ 1198/* Low energy meta events */
1159#define HCI_EV_LE_CONN_COMPLETE 0x01 1199#define HCI_EV_LE_CONN_COMPLETE 0x01
1160struct hci_ev_le_conn_complete { 1200struct hci_ev_le_conn_complete {
@@ -1288,6 +1328,7 @@ struct sockaddr_hci {
1288 1328
1289#define HCI_CHANNEL_RAW 0 1329#define HCI_CHANNEL_RAW 0
1290#define HCI_CHANNEL_CONTROL 1 1330#define HCI_CHANNEL_CONTROL 1
1331#define HCI_CHANNEL_MONITOR 2
1291 1332
1292struct hci_filter { 1333struct hci_filter {
1293 unsigned long type_mask; 1334 unsigned long type_mask;
@@ -1389,5 +1430,6 @@ struct hci_inquiry_req {
1389#define IREQ_CACHE_FLUSH 0x0001 1430#define IREQ_CACHE_FLUSH 0x0001
1390 1431
1391extern bool enable_hs; 1432extern bool enable_hs;
1433extern bool enable_le;
1392 1434
1393#endif /* __HCI_H */ 1435#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 453893b3120e..daefaac51131 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -44,14 +44,31 @@ struct inquiry_data {
44}; 44};
45 45
46struct inquiry_entry { 46struct inquiry_entry {
47 struct inquiry_entry *next; 47 struct list_head all; /* inq_cache.all */
48 struct list_head list; /* unknown or resolve */
49 enum {
50 NAME_NOT_KNOWN,
51 NAME_NEEDED,
52 NAME_PENDING,
53 NAME_KNOWN,
54 } name_state;
48 __u32 timestamp; 55 __u32 timestamp;
49 struct inquiry_data data; 56 struct inquiry_data data;
50}; 57};
51 58
52struct inquiry_cache { 59struct discovery_state {
60 int type;
61 enum {
62 DISCOVERY_STOPPED,
63 DISCOVERY_STARTING,
64 DISCOVERY_FINDING,
65 DISCOVERY_RESOLVING,
66 DISCOVERY_STOPPING,
67 } state;
68 struct list_head all; /* All devices found during inquiry */
69 struct list_head unknown; /* Name state not known */
70 struct list_head resolve; /* Name needs to be resolved */
53 __u32 timestamp; 71 __u32 timestamp;
54 struct inquiry_entry *list;
55}; 72};
56 73
57struct hci_conn_hash { 74struct hci_conn_hash {
@@ -72,18 +89,16 @@ struct bt_uuid {
72 u8 svc_hint; 89 u8 svc_hint;
73}; 90};
74 91
75struct key_master_id { 92struct smp_ltk {
76 __le16 ediv; 93 struct list_head list;
77 u8 rand[8];
78} __packed;
79
80struct link_key_data {
81 bdaddr_t bdaddr; 94 bdaddr_t bdaddr;
95 u8 bdaddr_type;
96 u8 authenticated;
82 u8 type; 97 u8 type;
98 u8 enc_size;
99 __le16 ediv;
100 u8 rand[8];
83 u8 val[16]; 101 u8 val[16];
84 u8 pin_len;
85 u8 dlen;
86 u8 data[0];
87} __packed; 102} __packed;
88 103
89struct link_key { 104struct link_key {
@@ -92,8 +107,6 @@ struct link_key {
92 u8 type; 107 u8 type;
93 u8 val[16]; 108 u8 val[16];
94 u8 pin_len; 109 u8 pin_len;
95 u8 dlen;
96 u8 data[0];
97}; 110};
98 111
99struct oob_data { 112struct oob_data {
@@ -109,11 +122,19 @@ struct adv_entry {
109 u8 bdaddr_type; 122 u8 bdaddr_type;
110}; 123};
111 124
125struct le_scan_params {
126 u8 type;
127 u16 interval;
128 u16 window;
129 int timeout;
130};
131
132#define HCI_MAX_SHORT_NAME_LENGTH 10
133
112#define NUM_REASSEMBLY 4 134#define NUM_REASSEMBLY 4
113struct hci_dev { 135struct hci_dev {
114 struct list_head list; 136 struct list_head list;
115 struct mutex lock; 137 struct mutex lock;
116 atomic_t refcnt;
117 138
118 char name[8]; 139 char name[8];
119 unsigned long flags; 140 unsigned long flags;
@@ -122,6 +143,7 @@ struct hci_dev {
122 __u8 dev_type; 143 __u8 dev_type;
123 bdaddr_t bdaddr; 144 bdaddr_t bdaddr;
124 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 145 __u8 dev_name[HCI_MAX_NAME_LENGTH];
146 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
125 __u8 eir[HCI_MAX_EIR_LENGTH]; 147 __u8 eir[HCI_MAX_EIR_LENGTH];
126 __u8 dev_class[3]; 148 __u8 dev_class[3];
127 __u8 major_class; 149 __u8 major_class;
@@ -129,7 +151,6 @@ struct hci_dev {
129 __u8 features[8]; 151 __u8 features[8];
130 __u8 host_features[8]; 152 __u8 host_features[8];
131 __u8 commands[64]; 153 __u8 commands[64];
132 __u8 ssp_mode;
133 __u8 hci_ver; 154 __u8 hci_ver;
134 __u16 hci_rev; 155 __u16 hci_rev;
135 __u8 lmp_ver; 156 __u8 lmp_ver;
@@ -217,7 +238,7 @@ struct hci_dev {
217 238
218 struct list_head mgmt_pending; 239 struct list_head mgmt_pending;
219 240
220 struct inquiry_cache inq_cache; 241 struct discovery_state discovery;
221 struct hci_conn_hash conn_hash; 242 struct hci_conn_hash conn_hash;
222 struct list_head blacklist; 243 struct list_head blacklist;
223 244
@@ -225,6 +246,8 @@ struct hci_dev {
225 246
226 struct list_head link_keys; 247 struct list_head link_keys;
227 248
249 struct list_head long_term_keys;
250
228 struct list_head remote_oob_data; 251 struct list_head remote_oob_data;
229 252
230 struct list_head adv_entries; 253 struct list_head adv_entries;
@@ -234,7 +257,6 @@ struct hci_dev {
234 257
235 struct sk_buff_head driver_init; 258 struct sk_buff_head driver_init;
236 259
237 void *driver_data;
238 void *core_data; 260 void *core_data;
239 261
240 atomic_t promisc; 262 atomic_t promisc;
@@ -246,15 +268,17 @@ struct hci_dev {
246 268
247 struct rfkill *rfkill; 269 struct rfkill *rfkill;
248 270
249 struct module *owner;
250
251 unsigned long dev_flags; 271 unsigned long dev_flags;
252 272
273 struct delayed_work le_scan_disable;
274
275 struct work_struct le_scan;
276 struct le_scan_params le_scan_params;
277
253 int (*open)(struct hci_dev *hdev); 278 int (*open)(struct hci_dev *hdev);
254 int (*close)(struct hci_dev *hdev); 279 int (*close)(struct hci_dev *hdev);
255 int (*flush)(struct hci_dev *hdev); 280 int (*flush)(struct hci_dev *hdev);
256 int (*send)(struct sk_buff *skb); 281 int (*send)(struct sk_buff *skb);
257 void (*destruct)(struct hci_dev *hdev);
258 void (*notify)(struct hci_dev *hdev, unsigned int evt); 282 void (*notify)(struct hci_dev *hdev, unsigned int evt);
259 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 283 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
260}; 284};
@@ -270,11 +294,10 @@ struct hci_conn {
270 __u16 state; 294 __u16 state;
271 __u8 mode; 295 __u8 mode;
272 __u8 type; 296 __u8 type;
273 __u8 out; 297 bool out;
274 __u8 attempt; 298 __u8 attempt;
275 __u8 dev_class[3]; 299 __u8 dev_class[3];
276 __u8 features[8]; 300 __u8 features[8];
277 __u8 ssp_mode;
278 __u16 interval; 301 __u16 interval;
279 __u16 pkt_type; 302 __u16 pkt_type;
280 __u16 link_policy; 303 __u16 link_policy;
@@ -286,12 +309,10 @@ struct hci_conn {
286 __u8 pin_length; 309 __u8 pin_length;
287 __u8 enc_key_size; 310 __u8 enc_key_size;
288 __u8 io_capability; 311 __u8 io_capability;
289 __u8 power_save;
290 __u16 disc_timeout; 312 __u16 disc_timeout;
291 unsigned long pend; 313 unsigned long flags;
292 314
293 __u8 remote_cap; 315 __u8 remote_cap;
294 __u8 remote_oob;
295 __u8 remote_auth; 316 __u8 remote_auth;
296 317
297 unsigned int sent; 318 unsigned int sent;
@@ -348,21 +369,26 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
348#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 369#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
349#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ 370#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */
350 371
351static inline void inquiry_cache_init(struct hci_dev *hdev) 372static inline void discovery_init(struct hci_dev *hdev)
352{ 373{
353 struct inquiry_cache *c = &hdev->inq_cache; 374 hdev->discovery.state = DISCOVERY_STOPPED;
354 c->list = NULL; 375 INIT_LIST_HEAD(&hdev->discovery.all);
376 INIT_LIST_HEAD(&hdev->discovery.unknown);
377 INIT_LIST_HEAD(&hdev->discovery.resolve);
355} 378}
356 379
380bool hci_discovery_active(struct hci_dev *hdev);
381
382void hci_discovery_set_state(struct hci_dev *hdev, int state);
383
357static inline int inquiry_cache_empty(struct hci_dev *hdev) 384static inline int inquiry_cache_empty(struct hci_dev *hdev)
358{ 385{
359 struct inquiry_cache *c = &hdev->inq_cache; 386 return list_empty(&hdev->discovery.all);
360 return c->list == NULL;
361} 387}
362 388
363static inline long inquiry_cache_age(struct hci_dev *hdev) 389static inline long inquiry_cache_age(struct hci_dev *hdev)
364{ 390{
365 struct inquiry_cache *c = &hdev->inq_cache; 391 struct discovery_state *c = &hdev->discovery;
366 return jiffies - c->timestamp; 392 return jiffies - c->timestamp;
367} 393}
368 394
@@ -372,8 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
372} 398}
373 399
374struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, 400struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
375 bdaddr_t *bdaddr); 401 bdaddr_t *bdaddr);
376void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); 402struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
403 bdaddr_t *bdaddr);
404struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
405 bdaddr_t *bdaddr,
406 int state);
407void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
408 struct inquiry_entry *ie);
409bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
410 bool name_known, bool *ssp);
377 411
378/* ----- HCI Connections ----- */ 412/* ----- HCI Connections ----- */
379enum { 413enum {
@@ -384,8 +418,19 @@ enum {
384 HCI_CONN_MODE_CHANGE_PEND, 418 HCI_CONN_MODE_CHANGE_PEND,
385 HCI_CONN_SCO_SETUP_PEND, 419 HCI_CONN_SCO_SETUP_PEND,
386 HCI_CONN_LE_SMP_PEND, 420 HCI_CONN_LE_SMP_PEND,
421 HCI_CONN_MGMT_CONNECTED,
422 HCI_CONN_SSP_ENABLED,
423 HCI_CONN_POWER_SAVE,
424 HCI_CONN_REMOTE_OOB,
387}; 425};
388 426
427static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
428{
429 struct hci_dev *hdev = conn->hdev;
430 return (test_bit(HCI_SSP_ENABLED, &hdev->flags) &&
431 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags));
432}
433
389static inline void hci_conn_hash_init(struct hci_dev *hdev) 434static inline void hci_conn_hash_init(struct hci_dev *hdev)
390{ 435{
391 struct hci_conn_hash *h = &hdev->conn_hash; 436 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -566,36 +611,33 @@ static inline void hci_conn_put(struct hci_conn *conn)
566} 611}
567 612
568/* ----- HCI Devices ----- */ 613/* ----- HCI Devices ----- */
569static inline void __hci_dev_put(struct hci_dev *d) 614static inline void hci_dev_put(struct hci_dev *d)
570{ 615{
571 if (atomic_dec_and_test(&d->refcnt)) 616 put_device(&d->dev);
572 d->destruct(d);
573} 617}
574 618
575/* 619static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
576 * hci_dev_put and hci_dev_hold are macros to avoid dragging all the
577 * overhead of all the modular infrastructure into this header.
578 */
579#define hci_dev_put(d) \
580do { \
581 __hci_dev_put(d); \
582 module_put(d->owner); \
583} while (0)
584
585static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
586{ 620{
587 atomic_inc(&d->refcnt); 621 get_device(&d->dev);
588 return d; 622 return d;
589} 623}
590 624
591#define hci_dev_hold(d) \
592({ \
593 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \
594})
595
596#define hci_dev_lock(d) mutex_lock(&d->lock) 625#define hci_dev_lock(d) mutex_lock(&d->lock)
597#define hci_dev_unlock(d) mutex_unlock(&d->lock) 626#define hci_dev_unlock(d) mutex_unlock(&d->lock)
598 627
628#define to_hci_dev(d) container_of(d, struct hci_dev, dev)
629#define to_hci_conn(c) container_of(c, struct hci_conn, dev)
630
631static inline void *hci_get_drvdata(struct hci_dev *hdev)
632{
633 return dev_get_drvdata(&hdev->dev);
634}
635
636static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
637{
638 dev_set_drvdata(&hdev->dev, data);
639}
640
599struct hci_dev *hci_dev_get(int index); 641struct hci_dev *hci_dev_get(int index);
600struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 642struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
601 643
@@ -619,20 +661,23 @@ int hci_inquiry(void __user *arg);
619 661
620struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 662struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
621int hci_blacklist_clear(struct hci_dev *hdev); 663int hci_blacklist_clear(struct hci_dev *hdev);
622int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); 664int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
623int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); 665int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
624 666
625int hci_uuids_clear(struct hci_dev *hdev); 667int hci_uuids_clear(struct hci_dev *hdev);
626 668
627int hci_link_keys_clear(struct hci_dev *hdev); 669int hci_link_keys_clear(struct hci_dev *hdev);
628struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 670struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
629int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 671int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
630 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 672 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
631struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 673struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
632struct link_key *hci_find_link_key_type(struct hci_dev *hdev, 674int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
633 bdaddr_t *bdaddr, u8 type); 675 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv,
634int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, 676 u8 rand[8]);
635 u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); 677struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
678 u8 addr_type);
679int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
680int hci_smp_ltks_clear(struct hci_dev *hdev);
636int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 681int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
637 682
638int hci_remote_oob_data_clear(struct hci_dev *hdev); 683int hci_remote_oob_data_clear(struct hci_dev *hdev);
@@ -674,6 +719,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
674#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 719#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
675#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 720#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 721#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
722#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
677 723
678/* ----- Extended LMP capabilities ----- */ 724/* ----- Extended LMP capabilities ----- */
679#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 725#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
@@ -755,7 +801,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
755 if (conn->type != ACL_LINK && conn->type != LE_LINK) 801 if (conn->type != ACL_LINK && conn->type != LE_LINK)
756 return; 802 return;
757 803
758 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 804 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
759 return; 805 return;
760 806
761 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 807 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -796,7 +842,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
796 842
797 hci_proto_auth_cfm(conn, status); 843 hci_proto_auth_cfm(conn, status);
798 844
799 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 845 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
800 return; 846 return;
801 847
802 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 848 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -859,25 +905,71 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
859 read_unlock(&hci_cb_list_lock); 905 read_unlock(&hci_cb_list_lock);
860} 906}
861 907
908static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
909{
910 u8 field_len;
911 size_t parsed;
912
913 for (parsed = 0; parsed < data_len - 1; parsed += field_len) {
914 field_len = data[0];
915
916 if (field_len == 0)
917 break;
918
919 parsed += field_len + 1;
920
921 if (parsed > data_len)
922 break;
923
924 if (data[1] == type)
925 return true;
926
927 data += field_len + 1;
928 }
929
930 return false;
931}
932
933static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
934 u8 data_len)
935{
936 eir[eir_len++] = sizeof(type) + data_len;
937 eir[eir_len++] = type;
938 memcpy(&eir[eir_len], data, data_len);
939 eir_len += data_len;
940
941 return eir_len;
942}
943
862int hci_register_cb(struct hci_cb *hcb); 944int hci_register_cb(struct hci_cb *hcb);
863int hci_unregister_cb(struct hci_cb *hcb); 945int hci_unregister_cb(struct hci_cb *hcb);
864 946
865int hci_register_notifier(struct notifier_block *nb);
866int hci_unregister_notifier(struct notifier_block *nb);
867
868int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 947int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
869void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); 948void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
870void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 949void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
871 950
872void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 951void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
873 952
874void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
875
876/* ----- HCI Sockets ----- */ 953/* ----- HCI Sockets ----- */
877void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, 954void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
878 struct sock *skip_sk); 955void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk);
956void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
957
958void hci_sock_dev_event(struct hci_dev *hdev, int event);
879 959
880/* Management interface */ 960/* Management interface */
961#define MGMT_ADDR_BREDR 0x00
962#define MGMT_ADDR_LE_PUBLIC 0x01
963#define MGMT_ADDR_LE_RANDOM 0x02
964#define MGMT_ADDR_INVALID 0xff
965
966#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR))
967#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
968 BIT(MGMT_ADDR_LE_RANDOM))
969#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
970 BIT(MGMT_ADDR_LE_PUBLIC) | \
971 BIT(MGMT_ADDR_LE_RANDOM))
972
881int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 973int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
882int mgmt_index_added(struct hci_dev *hdev); 974int mgmt_index_added(struct hci_dev *hdev);
883int mgmt_index_removed(struct hci_dev *hdev); 975int mgmt_index_removed(struct hci_dev *hdev);
@@ -886,56 +978,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
886int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 978int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
887int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 979int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
888int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 980int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
889 u8 persistent); 981 u8 persistent);
890int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 982int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
891 u8 addr_type); 983 u8 addr_type, u32 flags, u8 *name, u8 name_len,
892int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 984 u8 *dev_class);
893 u8 addr_type); 985int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
894int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 986 u8 link_type, u8 addr_type);
987int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
988 u8 link_type, u8 addr_type, u8 status);
895int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 989int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
896 u8 addr_type, u8 status); 990 u8 addr_type, u8 status);
897int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 991int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
898int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 992int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
899 u8 status); 993 u8 status);
900int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 994int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
901 u8 status); 995 u8 status);
902int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 996int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 __le32 value, u8 confirm_hint); 997 u8 link_type, u8 addr_type, __le32 value,
998 u8 confirm_hint);
904int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 999int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
905 u8 status); 1000 u8 link_type, u8 addr_type, u8 status);
906int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, 1001int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
907 bdaddr_t *bdaddr, u8 status); 1002 u8 link_type, u8 addr_type, u8 status);
908int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); 1003int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1004 u8 link_type, u8 addr_type);
909int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1005int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
910 u8 status); 1006 u8 link_type, u8 addr_type, u8 status);
911int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, 1007int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
912 bdaddr_t *bdaddr, u8 status); 1008 u8 link_type, u8 addr_type, u8 status);
913int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 1009int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1010 u8 addr_type, u8 status);
1011int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1012int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1013int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1014 u8 status);
914int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1015int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
915int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1016int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
916 u8 *randomizer, u8 status); 1017 u8 *randomizer, u8 status);
1018int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
917int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1019int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
918 u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); 1020 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
919int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); 1021 u8 ssp, u8 *eir, u16 eir_len);
1022int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1023 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
920int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); 1024int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
921int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); 1025int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
922int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1026int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
923int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1027int mgmt_interleaved_discovery(struct hci_dev *hdev);
924int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1028int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1029int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1030
1031int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
925 1032
926/* HCI info for socket */ 1033/* HCI info for socket */
927#define hci_pi(sk) ((struct hci_pinfo *) sk) 1034#define hci_pi(sk) ((struct hci_pinfo *) sk)
928 1035
929/* HCI socket flags */
930#define HCI_PI_MGMT_INIT 0
931
932struct hci_pinfo { 1036struct hci_pinfo {
933 struct bt_sock bt; 1037 struct bt_sock bt;
934 struct hci_dev *hdev; 1038 struct hci_dev *hdev;
935 struct hci_filter filter; 1039 struct hci_filter filter;
936 __u32 cmsg_mask; 1040 __u32 cmsg_mask;
937 unsigned short channel; 1041 unsigned short channel;
938 unsigned long flags;
939}; 1042};
940 1043
941/* HCI security filter */ 1044/* HCI security filter */
@@ -966,5 +1069,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn);
966 1069
967int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1070int hci_do_inquiry(struct hci_dev *hdev, u8 length);
968int hci_cancel_inquiry(struct hci_dev *hdev); 1071int hci_cancel_inquiry(struct hci_dev *hdev);
1072int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1073 int timeout);
969 1074
970#endif /* __HCI_CORE_H */ 1075#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h
new file mode 100644
index 000000000000..77d1e5764185
--- /dev/null
+++ b/include/net/bluetooth/hci_mon.h
@@ -0,0 +1,51 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3
4 Copyright (C) 2011-2012 Intel Corporation
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation;
9
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED.
22*/
23
24#ifndef __HCI_MON_H
25#define __HCI_MON_H
26
27struct hci_mon_hdr {
28 __le16 opcode;
29 __le16 index;
30 __le16 len;
31} __packed;
32#define HCI_MON_HDR_SIZE 6
33
34#define HCI_MON_NEW_INDEX 0
35#define HCI_MON_DEL_INDEX 1
36#define HCI_MON_COMMAND_PKT 2
37#define HCI_MON_EVENT_PKT 3
38#define HCI_MON_ACL_TX_PKT 4
39#define HCI_MON_ACL_RX_PKT 5
40#define HCI_MON_SCO_TX_PKT 6
41#define HCI_MON_SCO_RX_PKT 7
42
43struct hci_mon_new_index {
44 __u8 type;
45 __u8 bus;
46 bdaddr_t bdaddr;
47 char name[8];
48} __packed;
49#define HCI_MON_NEW_INDEX_SIZE 16
50
51#endif /* __HCI_MON_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b1664ed884e6..9b242c6bf55b 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -45,11 +45,11 @@
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47 47
48#define L2CAP_DISC_TIMEOUT (100) 48#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
49#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ 49#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
50#define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ 50#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
51#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 51#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
52#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 52#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
53 53
54/* L2CAP socket address */ 54/* L2CAP socket address */
55struct sockaddr_l2 { 55struct sockaddr_l2 {
@@ -492,51 +492,56 @@ struct l2cap_chan {
492 struct sk_buff_head srej_q; 492 struct sk_buff_head srej_q;
493 struct list_head srej_l; 493 struct list_head srej_l;
494 494
495 struct list_head list; 495 struct list_head list;
496 struct list_head global_l; 496 struct list_head global_l;
497 497
498 void *data; 498 void *data;
499 struct l2cap_ops *ops; 499 struct l2cap_ops *ops;
500 struct mutex lock;
500}; 501};
501 502
502struct l2cap_ops { 503struct l2cap_ops {
503 char *name; 504 char *name;
504 505
505 struct l2cap_chan *(*new_connection) (void *data); 506 struct l2cap_chan *(*new_connection) (void *data);
506 int (*recv) (void *data, struct sk_buff *skb); 507 int (*recv) (void *data, struct sk_buff *skb);
507 void (*close) (void *data); 508 void (*close) (void *data);
508 void (*state_change) (void *data, int state); 509 void (*state_change) (void *data, int state);
510 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
511 unsigned long len, int nb, int *err);
512
509}; 513};
510 514
511struct l2cap_conn { 515struct l2cap_conn {
512 struct hci_conn *hcon; 516 struct hci_conn *hcon;
513 struct hci_chan *hchan; 517 struct hci_chan *hchan;
514 518
515 bdaddr_t *dst; 519 bdaddr_t *dst;
516 bdaddr_t *src; 520 bdaddr_t *src;
517 521
518 unsigned int mtu; 522 unsigned int mtu;
519 523
520 __u32 feat_mask; 524 __u32 feat_mask;
525 __u8 fixed_chan_mask;
521 526
522 __u8 info_state; 527 __u8 info_state;
523 __u8 info_ident; 528 __u8 info_ident;
524 529
525 struct delayed_work info_timer; 530 struct delayed_work info_timer;
526 531
527 spinlock_t lock; 532 spinlock_t lock;
528 533
529 struct sk_buff *rx_skb; 534 struct sk_buff *rx_skb;
530 __u32 rx_len; 535 __u32 rx_len;
531 __u8 tx_ident; 536 __u8 tx_ident;
532 537
533 __u8 disc_reason; 538 __u8 disc_reason;
534 539
535 struct delayed_work security_timer; 540 struct delayed_work security_timer;
536 struct smp_chan *smp_chan; 541 struct smp_chan *smp_chan;
537 542
538 struct list_head chan_l; 543 struct list_head chan_l;
539 struct mutex chan_lock; 544 struct mutex chan_lock;
540}; 545};
541 546
542#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 547#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -551,9 +556,9 @@ struct l2cap_conn {
551#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 556#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
552 557
553struct l2cap_pinfo { 558struct l2cap_pinfo {
554 struct bt_sock bt; 559 struct bt_sock bt;
555 struct l2cap_chan *chan; 560 struct l2cap_chan *chan;
556 struct sk_buff *rx_busy_skb; 561 struct sk_buff *rx_busy_skb;
557}; 562};
558 563
559enum { 564enum {
@@ -606,21 +611,37 @@ static inline void l2cap_chan_put(struct l2cap_chan *c)
606 kfree(c); 611 kfree(c);
607} 612}
608 613
614static inline void l2cap_chan_lock(struct l2cap_chan *chan)
615{
616 mutex_lock(&chan->lock);
617}
618
619static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
620{
621 mutex_unlock(&chan->lock);
622}
623
609static inline void l2cap_set_timer(struct l2cap_chan *chan, 624static inline void l2cap_set_timer(struct l2cap_chan *chan,
610 struct delayed_work *work, long timeout) 625 struct delayed_work *work, long timeout)
611{ 626{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 627 BT_DBG("chan %p state %s timeout %ld", chan,
628 state_to_string(chan->state), timeout);
613 629
614 if (!cancel_delayed_work(work)) 630 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 631 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 632 schedule_delayed_work(work, timeout);
617} 633}
618 634
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 635static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 636 struct delayed_work *work)
621{ 637{
622 if (cancel_delayed_work(work)) 638 bool ret;
639
640 ret = cancel_delayed_work(work);
641 if (ret)
623 l2cap_chan_put(chan); 642 l2cap_chan_put(chan);
643
644 return ret;
624} 645}
625 646
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 647#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index be65d3417883..ffc1377e092e 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -2,6 +2,7 @@
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 3
4 Copyright (C) 2010 Nokia Corporation 4 Copyright (C) 2010 Nokia Corporation
5 Copyright (C) 2011-2012 Intel Corporation
5 6
6 This program is free software; you can redistribute it and/or modify 7 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 it under the terms of the GNU General Public License version 2 as
@@ -39,29 +40,47 @@
39#define MGMT_STATUS_INVALID_PARAMS 0x0d 40#define MGMT_STATUS_INVALID_PARAMS 0x0d
40#define MGMT_STATUS_DISCONNECTED 0x0e 41#define MGMT_STATUS_DISCONNECTED 0x0e
41#define MGMT_STATUS_NOT_POWERED 0x0f 42#define MGMT_STATUS_NOT_POWERED 0x0f
43#define MGMT_STATUS_CANCELLED 0x10
44#define MGMT_STATUS_INVALID_INDEX 0x11
42 45
43struct mgmt_hdr { 46struct mgmt_hdr {
44 __le16 opcode; 47 __le16 opcode;
45 __le16 index; 48 __le16 index;
46 __le16 len; 49 __le16 len;
47} __packed; 50} __packed;
48 51
52struct mgmt_addr_info {
53 bdaddr_t bdaddr;
54 __u8 type;
55} __packed;
56#define MGMT_ADDR_INFO_SIZE 7
57
49#define MGMT_OP_READ_VERSION 0x0001 58#define MGMT_OP_READ_VERSION 0x0001
59#define MGMT_READ_VERSION_SIZE 0
50struct mgmt_rp_read_version { 60struct mgmt_rp_read_version {
51 __u8 version; 61 __u8 version;
52 __le16 revision; 62 __le16 revision;
63} __packed;
64
65#define MGMT_OP_READ_COMMANDS 0x0002
66#define MGMT_READ_COMMANDS_SIZE 0
67struct mgmt_rp_read_commands {
68 __le16 num_commands;
69 __le16 num_events;
70 __le16 opcodes[0];
53} __packed; 71} __packed;
54 72
55#define MGMT_OP_READ_INDEX_LIST 0x0003 73#define MGMT_OP_READ_INDEX_LIST 0x0003
74#define MGMT_READ_INDEX_LIST_SIZE 0
56struct mgmt_rp_read_index_list { 75struct mgmt_rp_read_index_list {
57 __le16 num_controllers; 76 __le16 num_controllers;
58 __le16 index[0]; 77 __le16 index[0];
59} __packed; 78} __packed;
60 79
61/* Reserve one extra byte for names in management messages so that they 80/* Reserve one extra byte for names in management messages so that they
62 * are always guaranteed to be nul-terminated */ 81 * are always guaranteed to be nul-terminated */
63#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) 82#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
64#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) 83#define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1)
65 84
66#define MGMT_SETTING_POWERED 0x00000001 85#define MGMT_SETTING_POWERED 0x00000001
67#define MGMT_SETTING_CONNECTABLE 0x00000002 86#define MGMT_SETTING_CONNECTABLE 0x00000002
@@ -75,28 +94,32 @@ struct mgmt_rp_read_index_list {
75#define MGMT_SETTING_LE 0x00000200 94#define MGMT_SETTING_LE 0x00000200
76 95
77#define MGMT_OP_READ_INFO 0x0004 96#define MGMT_OP_READ_INFO 0x0004
97#define MGMT_READ_INFO_SIZE 0
78struct mgmt_rp_read_info { 98struct mgmt_rp_read_info {
79 bdaddr_t bdaddr; 99 bdaddr_t bdaddr;
80 __u8 version; 100 __u8 version;
81 __le16 manufacturer; 101 __le16 manufacturer;
82 __le32 supported_settings; 102 __le32 supported_settings;
83 __le32 current_settings; 103 __le32 current_settings;
84 __u8 dev_class[3]; 104 __u8 dev_class[3];
85 __u8 name[MGMT_MAX_NAME_LENGTH]; 105 __u8 name[MGMT_MAX_NAME_LENGTH];
86 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 106 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
87} __packed; 107} __packed;
88 108
89struct mgmt_mode { 109struct mgmt_mode {
90 __u8 val; 110 __u8 val;
91} __packed; 111} __packed;
92 112
113#define MGMT_SETTING_SIZE 1
114
93#define MGMT_OP_SET_POWERED 0x0005 115#define MGMT_OP_SET_POWERED 0x0005
94 116
95#define MGMT_OP_SET_DISCOVERABLE 0x0006 117#define MGMT_OP_SET_DISCOVERABLE 0x0006
96struct mgmt_cp_set_discoverable { 118struct mgmt_cp_set_discoverable {
97 __u8 val; 119 __u8 val;
98 __u16 timeout; 120 __u16 timeout;
99} __packed; 121} __packed;
122#define MGMT_SET_DISCOVERABLE_SIZE 3
100 123
101#define MGMT_OP_SET_CONNECTABLE 0x0007 124#define MGMT_OP_SET_CONNECTABLE 0x0007
102 125
@@ -111,73 +134,76 @@ struct mgmt_cp_set_discoverable {
111#define MGMT_OP_SET_HS 0x000C 134#define MGMT_OP_SET_HS 0x000C
112 135
113#define MGMT_OP_SET_LE 0x000D 136#define MGMT_OP_SET_LE 0x000D
114
115#define MGMT_OP_SET_DEV_CLASS 0x000E 137#define MGMT_OP_SET_DEV_CLASS 0x000E
116struct mgmt_cp_set_dev_class { 138struct mgmt_cp_set_dev_class {
117 __u8 major; 139 __u8 major;
118 __u8 minor; 140 __u8 minor;
119} __packed; 141} __packed;
142#define MGMT_SET_DEV_CLASS_SIZE 2
120 143
121#define MGMT_OP_SET_LOCAL_NAME 0x000F 144#define MGMT_OP_SET_LOCAL_NAME 0x000F
122struct mgmt_cp_set_local_name { 145struct mgmt_cp_set_local_name {
123 __u8 name[MGMT_MAX_NAME_LENGTH]; 146 __u8 name[MGMT_MAX_NAME_LENGTH];
147 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
124} __packed; 148} __packed;
149#define MGMT_SET_LOCAL_NAME_SIZE 260
125 150
126#define MGMT_OP_ADD_UUID 0x0010 151#define MGMT_OP_ADD_UUID 0x0010
127struct mgmt_cp_add_uuid { 152struct mgmt_cp_add_uuid {
128 __u8 uuid[16]; 153 __u8 uuid[16];
129 __u8 svc_hint; 154 __u8 svc_hint;
130} __packed; 155} __packed;
156#define MGMT_ADD_UUID_SIZE 17
131 157
132#define MGMT_OP_REMOVE_UUID 0x0011 158#define MGMT_OP_REMOVE_UUID 0x0011
133struct mgmt_cp_remove_uuid { 159struct mgmt_cp_remove_uuid {
134 __u8 uuid[16]; 160 __u8 uuid[16];
135} __packed; 161} __packed;
162#define MGMT_REMOVE_UUID_SIZE 16
136 163
137struct mgmt_link_key_info { 164struct mgmt_link_key_info {
138 bdaddr_t bdaddr; 165 struct mgmt_addr_info addr;
139 u8 type; 166 __u8 type;
140 u8 val[16]; 167 __u8 val[16];
141 u8 pin_len; 168 __u8 pin_len;
142} __packed; 169} __packed;
143 170
144#define MGMT_OP_LOAD_LINK_KEYS 0x0012 171#define MGMT_OP_LOAD_LINK_KEYS 0x0012
145struct mgmt_cp_load_link_keys { 172struct mgmt_cp_load_link_keys {
146 __u8 debug_keys; 173 __u8 debug_keys;
147 __le16 key_count; 174 __le16 key_count;
148 struct mgmt_link_key_info keys[0]; 175 struct mgmt_link_key_info keys[0];
149} __packed; 176} __packed;
177#define MGMT_LOAD_LINK_KEYS_SIZE 3
150 178
151#define MGMT_OP_REMOVE_KEYS 0x0013 179struct mgmt_ltk_info {
152struct mgmt_cp_remove_keys { 180 struct mgmt_addr_info addr;
153 bdaddr_t bdaddr; 181 __u8 authenticated;
154 __u8 disconnect; 182 __u8 master;
183 __u8 enc_size;
184 __le16 ediv;
185 __u8 rand[8];
186 __u8 val[16];
155} __packed; 187} __packed;
156struct mgmt_rp_remove_keys { 188
157 bdaddr_t bdaddr; 189#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
158 __u8 status; 190struct mgmt_cp_load_long_term_keys {
159}; 191 __le16 key_count;
192 struct mgmt_ltk_info keys[0];
193} __packed;
194#define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2
160 195
161#define MGMT_OP_DISCONNECT 0x0014 196#define MGMT_OP_DISCONNECT 0x0014
162struct mgmt_cp_disconnect { 197struct mgmt_cp_disconnect {
163 bdaddr_t bdaddr; 198 struct mgmt_addr_info addr;
164} __packed; 199} __packed;
200#define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE
165struct mgmt_rp_disconnect { 201struct mgmt_rp_disconnect {
166 bdaddr_t bdaddr; 202 struct mgmt_addr_info addr;
167 __u8 status;
168} __packed;
169
170#define MGMT_ADDR_BREDR 0x00
171#define MGMT_ADDR_LE_PUBLIC 0x01
172#define MGMT_ADDR_LE_RANDOM 0x02
173#define MGMT_ADDR_INVALID 0xff
174
175struct mgmt_addr_info {
176 bdaddr_t bdaddr;
177 __u8 type;
178} __packed; 203} __packed;
179 204
180#define MGMT_OP_GET_CONNECTIONS 0x0015 205#define MGMT_OP_GET_CONNECTIONS 0x0015
206#define MGMT_GET_CONNECTIONS_SIZE 0
181struct mgmt_rp_get_connections { 207struct mgmt_rp_get_connections {
182 __le16 conn_count; 208 __le16 conn_count;
183 struct mgmt_addr_info addr[0]; 209 struct mgmt_addr_info addr[0];
@@ -185,124 +211,152 @@ struct mgmt_rp_get_connections {
185 211
186#define MGMT_OP_PIN_CODE_REPLY 0x0016 212#define MGMT_OP_PIN_CODE_REPLY 0x0016
187struct mgmt_cp_pin_code_reply { 213struct mgmt_cp_pin_code_reply {
188 bdaddr_t bdaddr; 214 struct mgmt_addr_info addr;
189 __u8 pin_len; 215 __u8 pin_len;
190 __u8 pin_code[16]; 216 __u8 pin_code[16];
191} __packed; 217} __packed;
218#define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17)
192struct mgmt_rp_pin_code_reply { 219struct mgmt_rp_pin_code_reply {
193 bdaddr_t bdaddr; 220 struct mgmt_addr_info addr;
194 uint8_t status;
195} __packed; 221} __packed;
196 222
197#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 223#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
198struct mgmt_cp_pin_code_neg_reply { 224struct mgmt_cp_pin_code_neg_reply {
199 bdaddr_t bdaddr; 225 struct mgmt_addr_info addr;
200} __packed; 226} __packed;
227#define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
201 228
202#define MGMT_OP_SET_IO_CAPABILITY 0x0018 229#define MGMT_OP_SET_IO_CAPABILITY 0x0018
203struct mgmt_cp_set_io_capability { 230struct mgmt_cp_set_io_capability {
204 __u8 io_capability; 231 __u8 io_capability;
205} __packed; 232} __packed;
233#define MGMT_SET_IO_CAPABILITY_SIZE 1
206 234
207#define MGMT_OP_PAIR_DEVICE 0x0019 235#define MGMT_OP_PAIR_DEVICE 0x0019
208struct mgmt_cp_pair_device { 236struct mgmt_cp_pair_device {
209 struct mgmt_addr_info addr; 237 struct mgmt_addr_info addr;
210 __u8 io_cap; 238 __u8 io_cap;
211} __packed; 239} __packed;
240#define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
212struct mgmt_rp_pair_device { 241struct mgmt_rp_pair_device {
213 struct mgmt_addr_info addr; 242 struct mgmt_addr_info addr;
214 __u8 status;
215} __packed; 243} __packed;
216 244
217#define MGMT_OP_USER_CONFIRM_REPLY 0x001A 245#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
246#define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
247
248#define MGMT_OP_UNPAIR_DEVICE 0x001B
249struct mgmt_cp_unpair_device {
250 struct mgmt_addr_info addr;
251 __u8 disconnect;
252} __packed;
253#define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
254struct mgmt_rp_unpair_device {
255 struct mgmt_addr_info addr;
256};
257
258#define MGMT_OP_USER_CONFIRM_REPLY 0x001C
218struct mgmt_cp_user_confirm_reply { 259struct mgmt_cp_user_confirm_reply {
219 bdaddr_t bdaddr; 260 struct mgmt_addr_info addr;
220} __packed; 261} __packed;
262#define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE
221struct mgmt_rp_user_confirm_reply { 263struct mgmt_rp_user_confirm_reply {
222 bdaddr_t bdaddr; 264 struct mgmt_addr_info addr;
223 __u8 status;
224} __packed; 265} __packed;
225 266
226#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B 267#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
227struct mgmt_cp_user_confirm_neg_reply { 268struct mgmt_cp_user_confirm_neg_reply {
228 bdaddr_t bdaddr; 269 struct mgmt_addr_info addr;
229} __packed; 270} __packed;
271#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
230 272
231#define MGMT_OP_USER_PASSKEY_REPLY 0x001C 273#define MGMT_OP_USER_PASSKEY_REPLY 0x001E
232struct mgmt_cp_user_passkey_reply { 274struct mgmt_cp_user_passkey_reply {
233 bdaddr_t bdaddr; 275 struct mgmt_addr_info addr;
234 __le32 passkey; 276 __le32 passkey;
235} __packed; 277} __packed;
278#define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4)
236struct mgmt_rp_user_passkey_reply { 279struct mgmt_rp_user_passkey_reply {
237 bdaddr_t bdaddr; 280 struct mgmt_addr_info addr;
238 __u8 status;
239} __packed; 281} __packed;
240 282
241#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D 283#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
242struct mgmt_cp_user_passkey_neg_reply { 284struct mgmt_cp_user_passkey_neg_reply {
243 bdaddr_t bdaddr; 285 struct mgmt_addr_info addr;
244} __packed; 286} __packed;
287#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
245 288
246#define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E 289#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
290#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
247struct mgmt_rp_read_local_oob_data { 291struct mgmt_rp_read_local_oob_data {
248 __u8 hash[16]; 292 __u8 hash[16];
249 __u8 randomizer[16]; 293 __u8 randomizer[16];
250} __packed; 294} __packed;
251 295
252#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F 296#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
253struct mgmt_cp_add_remote_oob_data { 297struct mgmt_cp_add_remote_oob_data {
254 bdaddr_t bdaddr; 298 struct mgmt_addr_info addr;
255 __u8 hash[16]; 299 __u8 hash[16];
256 __u8 randomizer[16]; 300 __u8 randomizer[16];
257} __packed; 301} __packed;
302#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
258 303
259#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 304#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
260struct mgmt_cp_remove_remote_oob_data { 305struct mgmt_cp_remove_remote_oob_data {
261 bdaddr_t bdaddr; 306 struct mgmt_addr_info addr;
262} __packed; 307} __packed;
308#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
263 309
264#define MGMT_OP_START_DISCOVERY 0x0021 310#define MGMT_OP_START_DISCOVERY 0x0023
265struct mgmt_cp_start_discovery { 311struct mgmt_cp_start_discovery {
266 __u8 type; 312 __u8 type;
267} __packed; 313} __packed;
314#define MGMT_START_DISCOVERY_SIZE 1
268 315
269#define MGMT_OP_STOP_DISCOVERY 0x0022 316#define MGMT_OP_STOP_DISCOVERY 0x0024
317struct mgmt_cp_stop_discovery {
318 __u8 type;
319} __packed;
320#define MGMT_STOP_DISCOVERY_SIZE 1
270 321
271#define MGMT_OP_CONFIRM_NAME 0x0023 322#define MGMT_OP_CONFIRM_NAME 0x0025
272struct mgmt_cp_confirm_name { 323struct mgmt_cp_confirm_name {
273 bdaddr_t bdaddr; 324 struct mgmt_addr_info addr;
274 __u8 name_known; 325 __u8 name_known;
275} __packed; 326} __packed;
327#define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1)
276struct mgmt_rp_confirm_name { 328struct mgmt_rp_confirm_name {
277 bdaddr_t bdaddr; 329 struct mgmt_addr_info addr;
278 __u8 status;
279} __packed; 330} __packed;
280 331
281#define MGMT_OP_BLOCK_DEVICE 0x0024 332#define MGMT_OP_BLOCK_DEVICE 0x0026
282struct mgmt_cp_block_device { 333struct mgmt_cp_block_device {
283 bdaddr_t bdaddr; 334 struct mgmt_addr_info addr;
284} __packed; 335} __packed;
336#define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
285 337
286#define MGMT_OP_UNBLOCK_DEVICE 0x0025 338#define MGMT_OP_UNBLOCK_DEVICE 0x0027
287struct mgmt_cp_unblock_device { 339struct mgmt_cp_unblock_device {
288 bdaddr_t bdaddr; 340 struct mgmt_addr_info addr;
289} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
290 343
291#define MGMT_EV_CMD_COMPLETE 0x0001 344#define MGMT_EV_CMD_COMPLETE 0x0001
292struct mgmt_ev_cmd_complete { 345struct mgmt_ev_cmd_complete {
293 __le16 opcode; 346 __le16 opcode;
294 __u8 data[0]; 347 __u8 status;
348 __u8 data[0];
295} __packed; 349} __packed;
296 350
297#define MGMT_EV_CMD_STATUS 0x0002 351#define MGMT_EV_CMD_STATUS 0x0002
298struct mgmt_ev_cmd_status { 352struct mgmt_ev_cmd_status {
299 __u8 status; 353 __le16 opcode;
300 __le16 opcode; 354 __u8 status;
301} __packed; 355} __packed;
302 356
303#define MGMT_EV_CONTROLLER_ERROR 0x0003 357#define MGMT_EV_CONTROLLER_ERROR 0x0003
304struct mgmt_ev_controller_error { 358struct mgmt_ev_controller_error {
305 __u8 error_code; 359 __u8 error_code;
306} __packed; 360} __packed;
307 361
308#define MGMT_EV_INDEX_ADDED 0x0004 362#define MGMT_EV_INDEX_ADDED 0x0004
@@ -313,78 +367,96 @@ struct mgmt_ev_controller_error {
313 367
314#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 368#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
315struct mgmt_ev_class_of_dev_changed { 369struct mgmt_ev_class_of_dev_changed {
316 __u8 dev_class[3]; 370 __u8 dev_class[3];
317}; 371};
318 372
319#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 373#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
320struct mgmt_ev_local_name_changed { 374struct mgmt_ev_local_name_changed {
321 __u8 name[MGMT_MAX_NAME_LENGTH]; 375 __u8 name[MGMT_MAX_NAME_LENGTH];
322 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 376 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
323} __packed; 377} __packed;
324 378
325#define MGMT_EV_NEW_LINK_KEY 0x0009 379#define MGMT_EV_NEW_LINK_KEY 0x0009
326struct mgmt_ev_new_link_key { 380struct mgmt_ev_new_link_key {
327 __u8 store_hint; 381 __u8 store_hint;
328 struct mgmt_link_key_info key; 382 struct mgmt_link_key_info key;
329} __packed; 383} __packed;
330 384
331#define MGMT_EV_CONNECTED 0x000A 385#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
386struct mgmt_ev_new_long_term_key {
387 __u8 store_hint;
388 struct mgmt_ltk_info key;
389} __packed;
332 390
333#define MGMT_EV_DISCONNECTED 0x000B 391#define MGMT_EV_DEVICE_CONNECTED 0x000B
392struct mgmt_ev_device_connected {
393 struct mgmt_addr_info addr;
394 __le32 flags;
395 __le16 eir_len;
396 __u8 eir[0];
397} __packed;
398
399#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
334 400
335#define MGMT_EV_CONNECT_FAILED 0x000C 401#define MGMT_EV_CONNECT_FAILED 0x000D
336struct mgmt_ev_connect_failed { 402struct mgmt_ev_connect_failed {
337 struct mgmt_addr_info addr; 403 struct mgmt_addr_info addr;
338 __u8 status; 404 __u8 status;
339} __packed; 405} __packed;
340 406
341#define MGMT_EV_PIN_CODE_REQUEST 0x000D 407#define MGMT_EV_PIN_CODE_REQUEST 0x000E
342struct mgmt_ev_pin_code_request { 408struct mgmt_ev_pin_code_request {
343 bdaddr_t bdaddr; 409 struct mgmt_addr_info addr;
344 __u8 secure; 410 __u8 secure;
345} __packed; 411} __packed;
346 412
347#define MGMT_EV_USER_CONFIRM_REQUEST 0x000E 413#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
348struct mgmt_ev_user_confirm_request { 414struct mgmt_ev_user_confirm_request {
349 bdaddr_t bdaddr; 415 struct mgmt_addr_info addr;
350 __u8 confirm_hint; 416 __u8 confirm_hint;
351 __le32 value; 417 __le32 value;
352} __packed; 418} __packed;
353 419
354#define MGMT_EV_USER_PASSKEY_REQUEST 0x000F 420#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
355struct mgmt_ev_user_passkey_request { 421struct mgmt_ev_user_passkey_request {
356 bdaddr_t bdaddr; 422 struct mgmt_addr_info addr;
357} __packed; 423} __packed;
358 424
359#define MGMT_EV_AUTH_FAILED 0x0010 425#define MGMT_EV_AUTH_FAILED 0x0011
360struct mgmt_ev_auth_failed { 426struct mgmt_ev_auth_failed {
361 bdaddr_t bdaddr; 427 struct mgmt_addr_info addr;
362 __u8 status; 428 __u8 status;
363} __packed; 429} __packed;
364 430
365#define MGMT_EV_DEVICE_FOUND 0x0011 431#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
432#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
433
434#define MGMT_EV_DEVICE_FOUND 0x0012
366struct mgmt_ev_device_found { 435struct mgmt_ev_device_found {
367 struct mgmt_addr_info addr; 436 struct mgmt_addr_info addr;
368 __u8 dev_class[3]; 437 __s8 rssi;
369 __s8 rssi; 438 __u8 flags[4];
370 __u8 confirm_name; 439 __le16 eir_len;
371 __u8 eir[HCI_MAX_EIR_LENGTH]; 440 __u8 eir[0];
372} __packed;
373
374#define MGMT_EV_REMOTE_NAME 0x0012
375struct mgmt_ev_remote_name {
376 bdaddr_t bdaddr;
377 __u8 name[MGMT_MAX_NAME_LENGTH];
378} __packed; 441} __packed;
379 442
380#define MGMT_EV_DISCOVERING 0x0013 443#define MGMT_EV_DISCOVERING 0x0013
444struct mgmt_ev_discovering {
445 __u8 type;
446 __u8 discovering;
447} __packed;
381 448
382#define MGMT_EV_DEVICE_BLOCKED 0x0014 449#define MGMT_EV_DEVICE_BLOCKED 0x0014
383struct mgmt_ev_device_blocked { 450struct mgmt_ev_device_blocked {
384 bdaddr_t bdaddr; 451 struct mgmt_addr_info addr;
385} __packed; 452} __packed;
386 453
387#define MGMT_EV_DEVICE_UNBLOCKED 0x0015 454#define MGMT_EV_DEVICE_UNBLOCKED 0x0015
388struct mgmt_ev_device_unblocked { 455struct mgmt_ev_device_unblocked {
389 bdaddr_t bdaddr; 456 struct mgmt_addr_info addr;
457} __packed;
458
459#define MGMT_EV_DEVICE_UNPAIRED 0x0016
460struct mgmt_ev_device_unpaired {
461 struct mgmt_addr_info addr;
390} __packed; 462} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index aeaf5fa2b9f1..7b3acdd29134 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -127,7 +127,7 @@ struct smp_chan {
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 smp_key_size; 130 u8 enc_key_size;
131 unsigned long smp_flags; 131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm; 132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm; 133 struct work_struct confirm;
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 8d552519ff67..6db8ecf52aa2 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -138,6 +138,7 @@ struct cfhsi {
138 u8 *rx_ptr; 138 u8 *rx_ptr;
139 u8 *tx_buf; 139 u8 *tx_buf;
140 u8 *rx_buf; 140 u8 *rx_buf;
141 u8 *rx_flip_buf;
141 spinlock_t lock; 142 spinlock_t lock;
142 int flow_off_sent; 143 int flow_off_sent;
143 u32 q_low_mark; 144 u32 q_low_mark;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a067d30ce73e..248fb05feb63 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -13,6 +13,7 @@
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14#include <linux/debugfs.h> 14#include <linux/debugfs.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/bug.h>
16#include <linux/netlink.h> 17#include <linux/netlink.h>
17#include <linux/skbuff.h> 18#include <linux/skbuff.h>
18#include <linux/nl80211.h> 19#include <linux/nl80211.h>
@@ -120,6 +121,7 @@ enum ieee80211_channel_flags {
120 * @band: band this channel belongs to. 121 * @band: band this channel belongs to.
121 * @max_antenna_gain: maximum antenna gain in dBi 122 * @max_antenna_gain: maximum antenna gain in dBi
122 * @max_power: maximum transmission power (in dBm) 123 * @max_power: maximum transmission power (in dBm)
124 * @max_reg_power: maximum regulatory transmission power (in dBm)
123 * @beacon_found: helper to regulatory code to indicate when a beacon 125 * @beacon_found: helper to regulatory code to indicate when a beacon
124 * has been found on this channel. Use regulatory_hint_found_beacon() 126 * has been found on this channel. Use regulatory_hint_found_beacon()
125 * to enable this, this is useful only on 5 GHz band. 127 * to enable this, this is useful only on 5 GHz band.
@@ -133,6 +135,7 @@ struct ieee80211_channel {
133 u32 flags; 135 u32 flags;
134 int max_antenna_gain; 136 int max_antenna_gain;
135 int max_power; 137 int max_power;
138 int max_reg_power;
136 bool beacon_found; 139 bool beacon_found;
137 u32 orig_flags; 140 u32 orig_flags;
138 int orig_mag, orig_mpwr; 141 int orig_mag, orig_mpwr;
@@ -364,25 +367,13 @@ struct cfg80211_crypto_settings {
364}; 367};
365 368
366/** 369/**
367 * struct beacon_parameters - beacon parameters 370 * struct cfg80211_beacon_data - beacon data
368 *
369 * Used to configure the beacon for an interface.
370 *
371 * @head: head portion of beacon (before TIM IE) 371 * @head: head portion of beacon (before TIM IE)
372 * or %NULL if not changed 372 * or %NULL if not changed
373 * @tail: tail portion of beacon (after TIM IE) 373 * @tail: tail portion of beacon (after TIM IE)
374 * or %NULL if not changed 374 * or %NULL if not changed
375 * @interval: beacon interval or zero if not changed
376 * @dtim_period: DTIM period or zero if not changed
377 * @head_len: length of @head 375 * @head_len: length of @head
378 * @tail_len: length of @tail 376 * @tail_len: length of @tail
379 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
380 * user space)
381 * @ssid_len: length of @ssid
382 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
383 * @crypto: crypto settings
384 * @privacy: the BSS uses privacy
385 * @auth_type: Authentication type (algorithm)
386 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 377 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
387 * @beacon_ies_len: length of beacon_ies in octets 378 * @beacon_ies_len: length of beacon_ies in octets
388 * @proberesp_ies: extra information element(s) to add into Probe Response 379 * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -394,24 +385,48 @@ struct cfg80211_crypto_settings {
394 * @probe_resp_len: length of probe response template (@probe_resp) 385 * @probe_resp_len: length of probe response template (@probe_resp)
395 * @probe_resp: probe response template (AP mode only) 386 * @probe_resp: probe response template (AP mode only)
396 */ 387 */
397struct beacon_parameters { 388struct cfg80211_beacon_data {
398 u8 *head, *tail; 389 const u8 *head, *tail;
399 int interval, dtim_period; 390 const u8 *beacon_ies;
400 int head_len, tail_len; 391 const u8 *proberesp_ies;
392 const u8 *assocresp_ies;
393 const u8 *probe_resp;
394
395 size_t head_len, tail_len;
396 size_t beacon_ies_len;
397 size_t proberesp_ies_len;
398 size_t assocresp_ies_len;
399 size_t probe_resp_len;
400};
401
402/**
403 * struct cfg80211_ap_settings - AP configuration
404 *
405 * Used to configure an AP interface.
406 *
407 * @beacon: beacon data
408 * @beacon_interval: beacon interval
409 * @dtim_period: DTIM period
410 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
411 * user space)
412 * @ssid_len: length of @ssid
413 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
414 * @crypto: crypto settings
415 * @privacy: the BSS uses privacy
416 * @auth_type: Authentication type (algorithm)
417 * @inactivity_timeout: time in seconds to determine station's inactivity.
418 */
419struct cfg80211_ap_settings {
420 struct cfg80211_beacon_data beacon;
421
422 int beacon_interval, dtim_period;
401 const u8 *ssid; 423 const u8 *ssid;
402 size_t ssid_len; 424 size_t ssid_len;
403 enum nl80211_hidden_ssid hidden_ssid; 425 enum nl80211_hidden_ssid hidden_ssid;
404 struct cfg80211_crypto_settings crypto; 426 struct cfg80211_crypto_settings crypto;
405 bool privacy; 427 bool privacy;
406 enum nl80211_auth_type auth_type; 428 enum nl80211_auth_type auth_type;
407 const u8 *beacon_ies; 429 int inactivity_timeout;
408 size_t beacon_ies_len;
409 const u8 *proberesp_ies;
410 size_t proberesp_ies_len;
411 const u8 *assocresp_ies;
412 size_t assocresp_ies_len;
413 int probe_resp_len;
414 u8 *probe_resp;
415}; 430};
416 431
417/** 432/**
@@ -796,6 +811,8 @@ struct mesh_config {
796 * mesh gate, but not necessarily using the gate announcement protocol. 811 * mesh gate, but not necessarily using the gate announcement protocol.
797 * Still keeping the same nomenclature to be in sync with the spec. */ 812 * Still keeping the same nomenclature to be in sync with the spec. */
798 bool dot11MeshGateAnnouncementProtocol; 813 bool dot11MeshGateAnnouncementProtocol;
814 bool dot11MeshForwarding;
815 s32 rssi_threshold;
799}; 816};
800 817
801/** 818/**
@@ -1036,10 +1053,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1036 * @key_len: length of WEP key for shared key authentication 1053 * @key_len: length of WEP key for shared key authentication
1037 * @key_idx: index of WEP key for shared key authentication 1054 * @key_idx: index of WEP key for shared key authentication
1038 * @key: WEP key for shared key authentication 1055 * @key: WEP key for shared key authentication
1039 * @local_state_change: This is a request for a local state only, i.e., no
1040 * Authentication frame is to be transmitted and authentication state is
1041 * to be changed without having to wait for a response from the peer STA
1042 * (AP).
1043 */ 1056 */
1044struct cfg80211_auth_request { 1057struct cfg80211_auth_request {
1045 struct cfg80211_bss *bss; 1058 struct cfg80211_bss *bss;
@@ -1048,7 +1061,6 @@ struct cfg80211_auth_request {
1048 enum nl80211_auth_type auth_type; 1061 enum nl80211_auth_type auth_type;
1049 const u8 *key; 1062 const u8 *key;
1050 u8 key_len, key_idx; 1063 u8 key_len, key_idx;
1051 bool local_state_change;
1052}; 1064};
1053 1065
1054/** 1066/**
@@ -1065,7 +1077,11 @@ enum cfg80211_assoc_req_flags {
1065 * 1077 *
1066 * This structure provides information needed to complete IEEE 802.11 1078 * This structure provides information needed to complete IEEE 802.11
1067 * (re)association. 1079 * (re)association.
1068 * @bss: The BSS to associate with. 1080 * @bss: The BSS to associate with. If the call is successful the driver
1081 * is given a reference that it must release, normally via a call to
1082 * cfg80211_send_rx_assoc(), or, if association timed out, with a
1083 * call to cfg80211_put_bss() (in addition to calling
1084 * cfg80211_send_assoc_timeout())
1069 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1085 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1070 * @ie_len: Length of ie buffer in octets 1086 * @ie_len: Length of ie buffer in octets
1071 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1087 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1093,19 +1109,16 @@ struct cfg80211_assoc_request {
1093 * This structure provides information needed to complete IEEE 802.11 1109 * This structure provides information needed to complete IEEE 802.11
1094 * deauthentication. 1110 * deauthentication.
1095 * 1111 *
1096 * @bss: the BSS to deauthenticate from 1112 * @bssid: the BSSID of the BSS to deauthenticate from
1097 * @ie: Extra IEs to add to Deauthentication frame or %NULL 1113 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1098 * @ie_len: Length of ie buffer in octets 1114 * @ie_len: Length of ie buffer in octets
1099 * @reason_code: The reason code for the deauthentication 1115 * @reason_code: The reason code for the deauthentication
1100 * @local_state_change: This is a request for a local state only, i.e., no
1101 * Deauthentication frame is to be transmitted.
1102 */ 1116 */
1103struct cfg80211_deauth_request { 1117struct cfg80211_deauth_request {
1104 struct cfg80211_bss *bss; 1118 const u8 *bssid;
1105 const u8 *ie; 1119 const u8 *ie;
1106 size_t ie_len; 1120 size_t ie_len;
1107 u16 reason_code; 1121 u16 reason_code;
1108 bool local_state_change;
1109}; 1122};
1110 1123
1111/** 1124/**
@@ -1148,6 +1161,10 @@ struct cfg80211_disassoc_request {
1148 * @beacon_interval: beacon interval to use 1161 * @beacon_interval: beacon interval to use
1149 * @privacy: this is a protected network, keys will be configured 1162 * @privacy: this is a protected network, keys will be configured
1150 * after joining 1163 * after joining
1164 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1165 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1166 * required to assume that the port is unauthorized until authorized by
1167 * user space. Otherwise, port is marked authorized by default.
1151 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1168 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1152 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1169 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1153 */ 1170 */
@@ -1162,6 +1179,7 @@ struct cfg80211_ibss_params {
1162 u32 basic_rates; 1179 u32 basic_rates;
1163 bool channel_fixed; 1180 bool channel_fixed;
1164 bool privacy; 1181 bool privacy;
1182 bool control_port;
1165 int mcast_rate[IEEE80211_NUM_BANDS]; 1183 int mcast_rate[IEEE80211_NUM_BANDS];
1166}; 1184};
1167 1185
@@ -1186,6 +1204,8 @@ struct cfg80211_ibss_params {
1186 * @key_idx: index of WEP key for shared key authentication 1204 * @key_idx: index of WEP key for shared key authentication
1187 * @key: WEP key for shared key authentication 1205 * @key: WEP key for shared key authentication
1188 * @flags: See &enum cfg80211_assoc_req_flags 1206 * @flags: See &enum cfg80211_assoc_req_flags
1207 * @bg_scan_period: Background scan period in seconds
1208 * or -1 to indicate that default value is to be used.
1189 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1209 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1190 * will be used in ht_capa. Un-supported values will be ignored. 1210 * will be used in ht_capa. Un-supported values will be ignored.
1191 * @ht_capa_mask: The bits of ht_capa which are to be used. 1211 * @ht_capa_mask: The bits of ht_capa which are to be used.
@@ -1203,6 +1223,7 @@ struct cfg80211_connect_params {
1203 const u8 *key; 1223 const u8 *key;
1204 u8 key_len, key_idx; 1224 u8 key_len, key_idx;
1205 u32 flags; 1225 u32 flags;
1226 int bg_scan_period;
1206 struct ieee80211_ht_cap ht_capa; 1227 struct ieee80211_ht_cap ht_capa;
1207 struct ieee80211_ht_cap ht_capa_mask; 1228 struct ieee80211_ht_cap ht_capa_mask;
1208}; 1229};
@@ -1229,8 +1250,7 @@ enum wiphy_params_flags {
1229struct cfg80211_bitrate_mask { 1250struct cfg80211_bitrate_mask {
1230 struct { 1251 struct {
1231 u32 legacy; 1252 u32 legacy;
1232 /* TODO: add support for masking MCS rates; e.g.: */ 1253 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
1233 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
1234 } control[IEEE80211_NUM_BANDS]; 1254 } control[IEEE80211_NUM_BANDS];
1235}; 1255};
1236/** 1256/**
@@ -1343,12 +1363,10 @@ struct cfg80211_gtk_rekey_data {
1343 * 1363 *
1344 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1364 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1345 * 1365 *
1346 * @add_beacon: Add a beacon with given parameters, @head, @interval 1366 * @start_ap: Start acting in AP mode defined by the parameters.
1347 * and @dtim_period will be valid, @tail is optional. 1367 * @change_beacon: Change the beacon parameters for an access point mode
1348 * @set_beacon: Change the beacon parameters for an access point mode 1368 * interface. This should reject the call when AP mode wasn't started.
1349 * interface. This should reject the call when no beacon has been 1369 * @stop_ap: Stop being an AP, including stopping beaconing.
1350 * configured.
1351 * @del_beacon: Remove beacon configuration and stop sending the beacon.
1352 * 1370 *
1353 * @add_station: Add a new station. 1371 * @add_station: Add a new station.
1354 * @del_station: Remove a station; @mac may be NULL to remove all stations. 1372 * @del_station: Remove a station; @mac may be NULL to remove all stations.
@@ -1515,11 +1533,11 @@ struct cfg80211_ops {
1515 struct net_device *netdev, 1533 struct net_device *netdev,
1516 u8 key_index); 1534 u8 key_index);
1517 1535
1518 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1536 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
1519 struct beacon_parameters *info); 1537 struct cfg80211_ap_settings *settings);
1520 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1538 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
1521 struct beacon_parameters *info); 1539 struct cfg80211_beacon_data *info);
1522 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 1540 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
1523 1541
1524 1542
1525 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 1543 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
@@ -1574,11 +1592,9 @@ struct cfg80211_ops {
1574 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1592 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
1575 struct cfg80211_assoc_request *req); 1593 struct cfg80211_assoc_request *req);
1576 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1594 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
1577 struct cfg80211_deauth_request *req, 1595 struct cfg80211_deauth_request *req);
1578 void *cookie);
1579 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1596 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1580 struct cfg80211_disassoc_request *req, 1597 struct cfg80211_disassoc_request *req);
1581 void *cookie);
1582 1598
1583 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1599 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1584 struct cfg80211_connect_params *sme); 1600 struct cfg80211_connect_params *sme);
@@ -2204,8 +2220,6 @@ struct cfg80211_conn;
2204struct cfg80211_internal_bss; 2220struct cfg80211_internal_bss;
2205struct cfg80211_cached_keys; 2221struct cfg80211_cached_keys;
2206 2222
2207#define MAX_AUTH_BSSES 4
2208
2209/** 2223/**
2210 * struct wireless_dev - wireless per-netdev state 2224 * struct wireless_dev - wireless per-netdev state
2211 * 2225 *
@@ -2269,8 +2283,6 @@ struct wireless_dev {
2269 struct list_head event_list; 2283 struct list_head event_list;
2270 spinlock_t event_lock; 2284 spinlock_t event_lock;
2271 2285
2272 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
2273 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
2274 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2286 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2275 struct ieee80211_channel *channel; 2287 struct ieee80211_channel *channel;
2276 2288
@@ -2686,7 +2698,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2686 * @wiphy: the wiphy reporting the BSS 2698 * @wiphy: the wiphy reporting the BSS
2687 * @channel: The channel the frame was received on 2699 * @channel: The channel the frame was received on
2688 * @bssid: the BSSID of the BSS 2700 * @bssid: the BSSID of the BSS
2689 * @timestamp: the TSF timestamp sent by the peer 2701 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
2690 * @capability: the capability field sent by the peer 2702 * @capability: the capability field sent by the peer
2691 * @beacon_interval: the beacon interval announced by the peer 2703 * @beacon_interval: the beacon interval announced by the peer
2692 * @ie: additional IEs sent by the peer 2704 * @ie: additional IEs sent by the peer
@@ -2702,9 +2714,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2702struct cfg80211_bss * __must_check 2714struct cfg80211_bss * __must_check
2703cfg80211_inform_bss(struct wiphy *wiphy, 2715cfg80211_inform_bss(struct wiphy *wiphy,
2704 struct ieee80211_channel *channel, 2716 struct ieee80211_channel *channel,
2705 const u8 *bssid, 2717 const u8 *bssid, u64 tsf, u16 capability,
2706 u64 timestamp, u16 capability, u16 beacon_interval, 2718 u16 beacon_interval, const u8 *ie, size_t ielen,
2707 const u8 *ie, size_t ielen,
2708 s32 signal, gfp_t gfp); 2719 s32 signal, gfp_t gfp);
2709 2720
2710struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 2721struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
@@ -2725,6 +2736,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
2725 struct ieee80211_channel *channel, 2736 struct ieee80211_channel *channel,
2726 const u8 *meshid, size_t meshidlen, 2737 const u8 *meshid, size_t meshidlen,
2727 const u8 *meshcfg); 2738 const u8 *meshcfg);
2739/**
2740 * cfg80211_ref_bss - reference BSS struct
2741 * @bss: the BSS struct to reference
2742 *
2743 * Increments the refcount of the given BSS struct.
2744 */
2745void cfg80211_ref_bss(struct cfg80211_bss *bss);
2746
2747/**
2748 * cfg80211_put_bss - unref BSS struct
2749 * @bss: the BSS struct
2750 *
2751 * Decrements the refcount of the given BSS struct.
2752 */
2728void cfg80211_put_bss(struct cfg80211_bss *bss); 2753void cfg80211_put_bss(struct cfg80211_bss *bss);
2729 2754
2730/** 2755/**
@@ -2762,20 +2787,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
2762void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 2787void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
2763 2788
2764/** 2789/**
2765 * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2766 * @dev: network device
2767 * @addr: The MAC address of the device with which the authentication timed out
2768 *
2769 * When a pending authentication had no action yet, the driver may decide
2770 * to not send a deauth frame, but in that case must calls this function
2771 * to tell cfg80211 about this decision. It is only valid to call this
2772 * function within the deauth() callback.
2773 */
2774void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2775
2776/**
2777 * cfg80211_send_rx_assoc - notification of processed association 2790 * cfg80211_send_rx_assoc - notification of processed association
2778 * @dev: network device 2791 * @dev: network device
2792 * @bss: the BSS struct association was requested for, the struct reference
2793 * is owned by cfg80211 after this call
2779 * @buf: (re)association response frame (header + body) 2794 * @buf: (re)association response frame (header + body)
2780 * @len: length of the frame data 2795 * @len: length of the frame data
2781 * 2796 *
@@ -2784,7 +2799,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2784 * function or cfg80211_send_assoc_timeout() to indicate the result of 2799 * function or cfg80211_send_assoc_timeout() to indicate the result of
2785 * cfg80211_ops::assoc() call. This function may sleep. 2800 * cfg80211_ops::assoc() call. This function may sleep.
2786 */ 2801 */
2787void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 2802void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
2803 const u8 *buf, size_t len);
2788 2804
2789/** 2805/**
2790 * cfg80211_send_assoc_timeout - notification of timed out association 2806 * cfg80211_send_assoc_timeout - notification of timed out association
@@ -3176,6 +3192,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3176 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3192 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3177 * @dev: network device 3193 * @dev: network device
3178 * @freq: Frequency on which the frame was received in MHz 3194 * @freq: Frequency on which the frame was received in MHz
3195 * @sig_dbm: signal strength in mBm, or 0 if unknown
3179 * @buf: Management frame (header + body) 3196 * @buf: Management frame (header + body)
3180 * @len: length of the frame data 3197 * @len: length of the frame data
3181 * @gfp: context flags 3198 * @gfp: context flags
@@ -3188,8 +3205,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3188 * This function is called whenever an Action frame is received for a station 3205 * This function is called whenever an Action frame is received for a station
3189 * mode interface, but is not processed in kernel. 3206 * mode interface, but is not processed in kernel.
3190 */ 3207 */
3191bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 3208bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3192 size_t len, gfp_t gfp); 3209 const u8 *buf, size_t len, gfp_t gfp);
3193 3210
3194/** 3211/**
3195 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3212 * cfg80211_mgmt_tx_status - notification of TX status for management frame
@@ -3302,6 +3319,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3302 * @frame: the frame 3319 * @frame: the frame
3303 * @len: length of the frame 3320 * @len: length of the frame
3304 * @freq: frequency the frame was received on 3321 * @freq: frequency the frame was received on
3322 * @sig_dbm: signal strength in mBm, or 0 if unknown
3305 * @gfp: allocation flags 3323 * @gfp: allocation flags
3306 * 3324 *
3307 * Use this function to report to userspace when a beacon was 3325 * Use this function to report to userspace when a beacon was
@@ -3310,7 +3328,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3310 */ 3328 */
3311void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3329void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3312 const u8 *frame, size_t len, 3330 const u8 *frame, size_t len,
3313 int freq, gfp_t gfp); 3331 int freq, int sig_dbm, gfp_t gfp);
3314 3332
3315/* 3333/*
3316 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3334 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
@@ -3322,6 +3340,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3322 struct ieee80211_channel *chan, 3340 struct ieee80211_channel *chan,
3323 enum nl80211_channel_type channel_type); 3341 enum nl80211_channel_type channel_type);
3324 3342
3343/*
3344 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3345 * @rate: given rate_info to calculate bitrate from
3346 *
3347 * return 0 if MCS index >= 32
3348 */
3349u16 cfg80211_calculate_bitrate(struct rate_info *rate);
3350
3325/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3351/* Logging, debugging and troubleshooting/diagnostic helpers. */
3326 3352
3327/* wiphy_printk helpers, similar to dev_printk */ 3353/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/compat.h b/include/net/compat.h
index 9ee75edcc295..a974ae92d182 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -41,7 +41,7 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int);
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
47 unsigned, unsigned); 47 unsigned, unsigned);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 2cd66d0be348..f55c980d8e23 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops {
72 void (*getpfccfg)(struct net_device *, int, u8 *); 72 void (*getpfccfg)(struct net_device *, int, u8 *);
73 u8 (*setall)(struct net_device *); 73 u8 (*setall)(struct net_device *);
74 u8 (*getcap)(struct net_device *, int, u8 *); 74 u8 (*getcap)(struct net_device *, int, u8 *);
75 u8 (*getnumtcs)(struct net_device *, int, u8 *); 75 int (*getnumtcs)(struct net_device *, int, u8 *);
76 u8 (*setnumtcs)(struct net_device *, int, u8); 76 int (*setnumtcs)(struct net_device *, int, u8);
77 u8 (*getpfcstate)(struct net_device *); 77 u8 (*getpfcstate)(struct net_device *);
78 void (*setpfcstate)(struct net_device *, u8); 78 void (*setpfcstate)(struct net_device *, u8);
79 void (*getbcncfg)(struct net_device *, int, u32 *); 79 void (*getbcncfg)(struct net_device *, int, u32 *);
diff --git a/include/net/dn.h b/include/net/dn.h
index 298521e0d8a2..814af0b9387d 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <net/flow.h>
6#include <asm/byteorder.h> 7#include <asm/byteorder.h>
7#include <asm/unaligned.h> 8#include <asm/unaligned.h>
8 9
diff --git a/include/net/dst.h b/include/net/dst.h
index 344c8dd02874..59c5d18cc385 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -12,6 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/bug.h>
15#include <linux/jiffies.h> 16#include <linux/jiffies.h>
16#include <net/neighbour.h> 17#include <net/neighbour.h>
17#include <asm/processor.h> 18#include <asm/processor.h>
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 7db32995ccd3..ccb68880abf5 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -131,35 +131,8 @@ extern void genl_unregister_mc_group(struct genl_family *family,
131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
132 u32 group, struct nlmsghdr *nlh, gfp_t flags); 132 u32 group, struct nlmsghdr *nlh, gfp_t flags);
133 133
134/** 134void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
135 * genlmsg_put - Add generic netlink header to netlink message 135 struct genl_family *family, int flags, u8 cmd);
136 * @skb: socket buffer holding the message
137 * @pid: netlink pid the message is addressed to
138 * @seq: sequence number (usually the one of the sender)
139 * @family: generic netlink family
140 * @flags netlink message flags
141 * @cmd: generic netlink command
142 *
143 * Returns pointer to user specific header
144 */
145static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
146 struct genl_family *family, int flags, u8 cmd)
147{
148 struct nlmsghdr *nlh;
149 struct genlmsghdr *hdr;
150
151 nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN +
152 family->hdrsize, flags);
153 if (nlh == NULL)
154 return NULL;
155
156 hdr = nlmsg_data(nlh);
157 hdr->cmd = cmd;
158 hdr->version = family->version;
159 hdr->reserved = 0;
160
161 return (char *) hdr + GENL_HDRLEN;
162}
163 136
164/** 137/**
165 * genlmsg_nlhdr - Obtain netlink header from user specified header 138 * genlmsg_nlhdr - Obtain netlink header from user specified header
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index e3e405106afe..ae17e1352d7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -132,6 +132,7 @@ struct rtable;
132 * @tos - TOS 132 * @tos - TOS
133 * @mc_ttl - Multicasting TTL 133 * @mc_ttl - Multicasting TTL
134 * @is_icsk - is this an inet_connection_sock? 134 * @is_icsk - is this an inet_connection_sock?
135 * @uc_index - Unicast outgoing device index
135 * @mc_index - Multicast device index 136 * @mc_index - Multicast device index
136 * @mc_list - Group array 137 * @mc_list - Group array
137 * @cork - info to build ip hdr on each ip frag while socket is corked 138 * @cork - info to build ip hdr on each ip frag while socket is corked
@@ -167,6 +168,8 @@ struct inet_sock {
167 transparent:1, 168 transparent:1,
168 mc_all:1, 169 mc_all:1,
169 nodefrag:1; 170 nodefrag:1;
171 __u8 rcv_tos;
172 int uc_index;
170 int mc_index; 173 int mc_index;
171 __be32 mc_addr; 174 __be32 mc_addr;
172 struct ip_mc_socklist __rcu *mc_list; 175 struct ip_mc_socklist __rcu *mc_list;
diff --git a/include/net/ip.h b/include/net/ip.h
index 775009f9eaba..b53d65f24f7b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -388,7 +388,7 @@ static inline int sk_mc_loop(struct sock *sk)
388 return 1; 388 return 1;
389} 389}
390 390
391extern int ip_call_ra_chain(struct sk_buff *skb); 391extern bool ip_call_ra_chain(struct sk_buff *skb);
392 392
393/* 393/*
394 * Functions provided by ip_fragment.c 394 * Functions provided by ip_fragment.c
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ebe517f2da9f..2bdee51ba30d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -16,6 +16,7 @@
16#include <linux/atomic.h> /* for struct atomic_t */ 16#include <linux/atomic.h> /* for struct atomic_t */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/bug.h>
19 20
20#include <net/checksum.h> 21#include <net/checksum.h>
21#include <linux/netfilter.h> /* for union nf_inet_addr */ 22#include <linux/netfilter.h> /* for union nf_inet_addr */
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 0954ec959159..cc7c19732389 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -62,6 +62,7 @@ struct sock_msg_q {
62#define AF_IUCV_FLAG_SYN 0x2 62#define AF_IUCV_FLAG_SYN 0x2
63#define AF_IUCV_FLAG_FIN 0x4 63#define AF_IUCV_FLAG_FIN 0x4
64#define AF_IUCV_FLAG_WIN 0x8 64#define AF_IUCV_FLAG_WIN 0x8
65#define AF_IUCV_FLAG_SHT 0x10
65 66
66struct af_iucv_trans_hdr { 67struct af_iucv_trans_hdr {
67 u16 magic; 68 u16 magic;
@@ -113,6 +114,7 @@ struct iucv_sock {
113 spinlock_t accept_q_lock; 114 spinlock_t accept_q_lock;
114 struct sock *parent; 115 struct sock *parent;
115 struct iucv_path *path; 116 struct iucv_path *path;
117 struct net_device *hs_dev;
116 struct sk_buff_head send_skb_q; 118 struct sk_buff_head send_skb_q;
117 struct sk_buff_head backlog_skb_q; 119 struct sk_buff_head backlog_skb_q;
118 struct sock_msg_q message_q; 120 struct sock_msg_q message_q;
@@ -131,6 +133,7 @@ struct iucv_sock {
131/* iucv socket options (SOL_IUCV) */ 133/* iucv socket options (SOL_IUCV) */
132#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ 134#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
133#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ 135#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
136#define SO_MSGSIZE 0x0800 /* get maximum msgsize */
134 137
135/* iucv related control messages (scm) */ 138/* iucv related control messages (scm) */
136#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ 139#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d49928ba5d09..87d203ff7a8a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -13,10 +13,10 @@
13#ifndef MAC80211_H 13#ifndef MAC80211_H
14#define MAC80211_H 14#define MAC80211_H
15 15
16#include <linux/bug.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/if_ether.h> 18#include <linux/if_ether.h>
18#include <linux/skbuff.h> 19#include <linux/skbuff.h>
19#include <linux/device.h>
20#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
21#include <net/cfg80211.h> 21#include <net/cfg80211.h>
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
@@ -87,6 +87,8 @@
87 * 87 *
88 */ 88 */
89 89
90struct device;
91
90/** 92/**
91 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
92 * 94 *
@@ -229,7 +231,8 @@ enum ieee80211_rssi_event {
229 * valid in station mode only while @assoc is true and if also 231 * valid in station mode only while @assoc is true and if also
230 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 232 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
231 * @ps_dtim_period) 233 * @ps_dtim_period)
232 * @timestamp: beacon timestamp 234 * @last_tsf: last beacon's/probe response's TSF timestamp (could be old
235 * as it may have been received during scanning long ago)
233 * @beacon_int: beacon interval 236 * @beacon_int: beacon interval
234 * @assoc_capability: capabilities taken from assoc resp 237 * @assoc_capability: capabilities taken from assoc resp
235 * @basic_rates: bitmap of basic rates, each bit stands for an 238 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -276,7 +279,7 @@ struct ieee80211_bss_conf {
276 u8 dtim_period; 279 u8 dtim_period;
277 u16 beacon_int; 280 u16 beacon_int;
278 u16 assoc_capability; 281 u16 assoc_capability;
279 u64 timestamp; 282 u64 last_tsf;
280 u32 basic_rates; 283 u32 basic_rates;
281 int mcast_rate[IEEE80211_NUM_BANDS]; 284 int mcast_rate[IEEE80211_NUM_BANDS];
282 u16 ht_operation_mode; 285 u16 ht_operation_mode;
@@ -341,9 +344,9 @@ struct ieee80211_bss_conf {
341 * used to indicate that a frame was already retried due to PS 344 * used to indicate that a frame was already retried due to PS
342 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, 345 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
343 * used to indicate frame should not be encrypted 346 * used to indicate frame should not be encrypted
344 * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll 347 * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
345 * frame (PS-Poll or uAPSD) and should be sent although the station 348 * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
346 * is in powersave mode. 349 * be sent although the station is in powersave mode.
347 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the 350 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
348 * transmit function after the current frame, this can be used 351 * transmit function after the current frame, this can be used
349 * by drivers to kick the DMA queue only if unset or when the 352 * by drivers to kick the DMA queue only if unset or when the
@@ -399,7 +402,7 @@ enum mac80211_tx_control_flags {
399 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 402 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
400 IEEE80211_TX_INTFL_RETRIED = BIT(15), 403 IEEE80211_TX_INTFL_RETRIED = BIT(15),
401 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 404 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
402 IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), 405 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
403 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 406 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
404 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 407 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
405 /* hole at 20, use later */ 408 /* hole at 20, use later */
@@ -425,7 +428,7 @@ enum mac80211_tx_control_flags {
425 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ 428 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
426 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ 429 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
427 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ 430 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
428 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ 431 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
429 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ 432 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
430 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) 433 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
431 434
@@ -659,6 +662,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
659 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 662 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
660 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 663 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
661 * @RX_FLAG_SHORT_GI: Short guard interval was used 664 * @RX_FLAG_SHORT_GI: Short guard interval was used
665 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
666 * Valid only for data frames (mainly A-MPDU)
662 */ 667 */
663enum mac80211_rx_flags { 668enum mac80211_rx_flags {
664 RX_FLAG_MMIC_ERROR = 1<<0, 669 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -672,6 +677,7 @@ enum mac80211_rx_flags {
672 RX_FLAG_HT = 1<<9, 677 RX_FLAG_HT = 1<<9,
673 RX_FLAG_40MHZ = 1<<10, 678 RX_FLAG_40MHZ = 1<<10,
674 RX_FLAG_SHORT_GI = 1<<11, 679 RX_FLAG_SHORT_GI = 1<<11,
680 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
675}; 681};
676 682
677/** 683/**
@@ -852,6 +858,21 @@ struct ieee80211_channel_switch {
852}; 858};
853 859
854/** 860/**
861 * enum ieee80211_vif_flags - virtual interface flags
862 *
863 * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
864 * on this virtual interface to avoid unnecessary CPU wakeups
865 * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
866 * monitoring on this virtual interface -- i.e. it can monitor
867 * connection quality related parameters, such as the RSSI level and
868 * provide notifications if configured trigger levels are reached.
869 */
870enum ieee80211_vif_flags {
871 IEEE80211_VIF_BEACON_FILTER = BIT(0),
872 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
873};
874
875/**
855 * struct ieee80211_vif - per-interface data 876 * struct ieee80211_vif - per-interface data
856 * 877 *
857 * Data in this structure is continually present for driver 878 * Data in this structure is continually present for driver
@@ -863,6 +884,10 @@ struct ieee80211_channel_switch {
863 * @addr: address of this interface 884 * @addr: address of this interface
864 * @p2p: indicates whether this AP or STA interface is a p2p 885 * @p2p: indicates whether this AP or STA interface is a p2p
865 * interface, i.e. a GO or p2p-sta respectively 886 * interface, i.e. a GO or p2p-sta respectively
887 * @driver_flags: flags/capabilities the driver has for this interface,
888 * these need to be set (or cleared) when the interface is added
889 * or, if supported by the driver, the interface type is changed
890 * at runtime, mac80211 will never touch this field
866 * @drv_priv: data area for driver use, will always be aligned to 891 * @drv_priv: data area for driver use, will always be aligned to
867 * sizeof(void *). 892 * sizeof(void *).
868 */ 893 */
@@ -871,6 +896,7 @@ struct ieee80211_vif {
871 struct ieee80211_bss_conf bss_conf; 896 struct ieee80211_bss_conf bss_conf;
872 u8 addr[ETH_ALEN]; 897 u8 addr[ETH_ALEN];
873 bool p2p; 898 bool p2p;
899 u32 driver_flags;
874 /* must be last */ 900 /* must be last */
875 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 901 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
876}; 902};
@@ -962,6 +988,25 @@ enum set_key_cmd {
962}; 988};
963 989
964/** 990/**
991 * enum ieee80211_sta_state - station state
992 *
993 * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
994 * this is a special state for add/remove transitions
995 * @IEEE80211_STA_NONE: station exists without special state
996 * @IEEE80211_STA_AUTH: station is authenticated
997 * @IEEE80211_STA_ASSOC: station is associated
998 * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
999 */
1000enum ieee80211_sta_state {
1001 /* NOTE: These need to be ordered correctly! */
1002 IEEE80211_STA_NOTEXIST,
1003 IEEE80211_STA_NONE,
1004 IEEE80211_STA_AUTH,
1005 IEEE80211_STA_ASSOC,
1006 IEEE80211_STA_AUTHORIZED,
1007};
1008
1009/**
965 * struct ieee80211_sta - station table entry 1010 * struct ieee80211_sta - station table entry
966 * 1011 *
967 * A station table entry represents a station we are possibly 1012 * A station table entry represents a station we are possibly
@@ -1079,10 +1124,6 @@ enum sta_notify_cmd {
1079 * @IEEE80211_HW_MFP_CAPABLE: 1124 * @IEEE80211_HW_MFP_CAPABLE:
1080 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1125 * Hardware supports management frame protection (MFP, IEEE 802.11w).
1081 * 1126 *
1082 * @IEEE80211_HW_BEACON_FILTER:
1083 * Hardware supports dropping of irrelevant beacon frames to
1084 * avoid waking up cpu.
1085 *
1086 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: 1127 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
1087 * Hardware supports static spatial multiplexing powersave, 1128 * Hardware supports static spatial multiplexing powersave,
1088 * ie. can turn off all but one chain even on HT connections 1129 * ie. can turn off all but one chain even on HT connections
@@ -1108,11 +1149,6 @@ enum sta_notify_cmd {
1108 * When this flag is set, signaling beacon-loss will cause an immediate 1149 * When this flag is set, signaling beacon-loss will cause an immediate
1109 * change to disassociated state. 1150 * change to disassociated state.
1110 * 1151 *
1111 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1112 * Hardware can do connection quality monitoring - i.e. it can monitor
1113 * connection quality related parameters, such as the RSSI level and
1114 * provide notifications if configured trigger levels are reached.
1115 *
1116 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1152 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1117 * This device needs to know the DTIM period for the BSS before 1153 * This device needs to know the DTIM period for the BSS before
1118 * associating. 1154 * associating.
@@ -1134,6 +1170,10 @@ enum sta_notify_cmd {
1134 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session 1170 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
1135 * setup strictly in HW. mac80211 should not attempt to do this in 1171 * setup strictly in HW. mac80211 should not attempt to do this in
1136 * software. 1172 * software.
1173 *
1174 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1175 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1176 * the scan).
1137 */ 1177 */
1138enum ieee80211_hw_flags { 1178enum ieee80211_hw_flags {
1139 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1179 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1150,16 +1190,17 @@ enum ieee80211_hw_flags {
1150 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1190 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1151 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1191 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1152 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1192 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1153 IEEE80211_HW_BEACON_FILTER = 1<<14, 1193 /* reuse bit 14 */
1154 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1194 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1155 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1195 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1156 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1196 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1157 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1197 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1158 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1198 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1159 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1199 /* reuse bit 20 */
1160 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1200 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1161 IEEE80211_HW_AP_LINK_PS = 1<<22, 1201 IEEE80211_HW_AP_LINK_PS = 1<<22,
1162 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1202 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1203 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1163}; 1204};
1164 1205
1165/** 1206/**
@@ -1446,8 +1487,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1446 * way the host will only receive beacons where some relevant information 1487 * way the host will only receive beacons where some relevant information
1447 * (for example ERP protection or WMM settings) have changed. 1488 * (for example ERP protection or WMM settings) have changed.
1448 * 1489 *
1449 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER 1490 * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
1450 * hardware capability. The driver needs to enable beacon filter support 1491 * interface capability. The driver needs to enable beacon filter support
1451 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When 1492 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1452 * power save is enabled, the stack will not check for beacon loss and the 1493 * power save is enabled, the stack will not check for beacon loss and the
1453 * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). 1494 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
@@ -1599,7 +1640,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1599 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 1640 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
1600 * will inform the driver of this with the @allow_buffered_frames 1641 * will inform the driver of this with the @allow_buffered_frames
1601 * callback; this callback is optional. mac80211 will then transmit 1642 * callback; this callback is optional. mac80211 will then transmit
1602 * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE 1643 * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
1603 * on each frame. The last frame in the service period (or the only 1644 * on each frame. The last frame in the service period (or the only
1604 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to 1645 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
1605 * indicate that it ends the service period; as this frame must have 1646 * indicate that it ends the service period; as this frame must have
@@ -1607,6 +1648,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1607 * When TX status is reported for this frame, the service period is 1648 * When TX status is reported for this frame, the service period is
1608 * marked has having ended and a new one can be started by the peer. 1649 * marked has having ended and a new one can be started by the peer.
1609 * 1650 *
1651 * Additionally, non-bufferable MMPDUs can also be transmitted by
1652 * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
1653 *
1610 * Another race condition can happen on some devices like iwlwifi 1654 * Another race condition can happen on some devices like iwlwifi
1611 * when there are frames queued for the station and it wakes up 1655 * when there are frames queued for the station and it wakes up
1612 * or polls; the frames that are already queued could end up being 1656 * or polls; the frames that are already queued could end up being
@@ -1725,20 +1769,6 @@ enum ieee80211_ampdu_mlme_action {
1725}; 1769};
1726 1770
1727/** 1771/**
1728 * enum ieee80211_tx_sync_type - TX sync type
1729 * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication
1730 * (and possibly also before direct probe)
1731 * @IEEE80211_TX_SYNC_ASSOC: sync TX for association
1732 * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame
1733 * (not implemented yet)
1734 */
1735enum ieee80211_tx_sync_type {
1736 IEEE80211_TX_SYNC_AUTH,
1737 IEEE80211_TX_SYNC_ASSOC,
1738 IEEE80211_TX_SYNC_ACTION,
1739};
1740
1741/**
1742 * enum ieee80211_frame_release_type - frame release reason 1772 * enum ieee80211_frame_release_type - frame release reason
1743 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll 1773 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
1744 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to 1774 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
@@ -1848,26 +1878,6 @@ enum ieee80211_frame_release_type {
1848 * of the bss parameters has changed when a call is made. The callback 1878 * of the bss parameters has changed when a call is made. The callback
1849 * can sleep. 1879 * can sleep.
1850 * 1880 *
1851 * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the
1852 * driver should sync with the GO's powersaving so the device doesn't
1853 * transmit the frame while the GO is asleep. In the regular AP case
1854 * it may be used by drivers for devices implementing other restrictions
1855 * on talking to APs, e.g. due to regulatory enforcement or just HW
1856 * restrictions.
1857 * This function is called for every authentication, association and
1858 * action frame separately since applications might attempt to auth
1859 * with multiple APs before chosing one to associate to. If it returns
1860 * an error, the corresponding authentication, association or frame
1861 * transmission is aborted and reported as having failed. It is always
1862 * called after tuning to the correct channel.
1863 * The callback might be called multiple times before @finish_tx_sync
1864 * (but @finish_tx_sync will be called once for each) but in practice
1865 * this is unlikely to happen. It can also refuse in that case if the
1866 * driver cannot handle that situation.
1867 * This callback can sleep.
1868 * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned
1869 * an error. This callback can sleep.
1870 *
1871 * @prepare_multicast: Prepare for multicast filter configuration. 1881 * @prepare_multicast: Prepare for multicast filter configuration.
1872 * This callback is optional, and its return value is passed 1882 * This callback is optional, and its return value is passed
1873 * to configure_filter(). This callback must be atomic. 1883 * to configure_filter(). This callback must be atomic.
@@ -1963,6 +1973,13 @@ enum ieee80211_frame_release_type {
1963 * in AP mode, this callback will not be called when the flag 1973 * in AP mode, this callback will not be called when the flag
1964 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. 1974 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1965 * 1975 *
1976 * @sta_state: Notifies low level driver about state transition of a
1977 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
1978 * This callback is mutually exclusive with @sta_add/@sta_remove.
1979 * It must not fail for down transitions but may fail for transitions
1980 * up the list of states.
1981 * The callback can sleep.
1982 *
1966 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1983 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1967 * bursting) for a hardware TX queue. 1984 * bursting) for a hardware TX queue.
1968 * Returns a negative error code on failure. 1985 * Returns a negative error code on failure.
@@ -2098,7 +2115,7 @@ enum ieee80211_frame_release_type {
2098 * @allow_buffered_frames: Prepare device to allow the given number of frames 2115 * @allow_buffered_frames: Prepare device to allow the given number of frames
2099 * to go out to the given station. The frames will be sent by mac80211 2116 * to go out to the given station. The frames will be sent by mac80211
2100 * via the usual TX path after this call. The TX information for frames 2117 * via the usual TX path after this call. The TX information for frames
2101 * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set 2118 * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
2102 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case 2119 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
2103 * frames from multiple TIDs are released and the driver might reorder 2120 * frames from multiple TIDs are released and the driver might reorder
2104 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2121 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
@@ -2132,13 +2149,6 @@ struct ieee80211_ops {
2132 struct ieee80211_bss_conf *info, 2149 struct ieee80211_bss_conf *info,
2133 u32 changed); 2150 u32 changed);
2134 2151
2135 int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2136 const u8 *bssid, enum ieee80211_tx_sync_type type);
2137 void (*finish_tx_sync)(struct ieee80211_hw *hw,
2138 struct ieee80211_vif *vif,
2139 const u8 *bssid,
2140 enum ieee80211_tx_sync_type type);
2141
2142 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2152 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2143 struct netdev_hw_addr_list *mc_list); 2153 struct netdev_hw_addr_list *mc_list);
2144 void (*configure_filter)(struct ieee80211_hw *hw, 2154 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2182,6 +2192,10 @@ struct ieee80211_ops {
2182 struct ieee80211_sta *sta); 2192 struct ieee80211_sta *sta);
2183 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2193 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2184 enum sta_notify_cmd, struct ieee80211_sta *sta); 2194 enum sta_notify_cmd, struct ieee80211_sta *sta);
2195 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2196 struct ieee80211_sta *sta,
2197 enum ieee80211_sta_state old_state,
2198 enum ieee80211_sta_state new_state);
2185 int (*conf_tx)(struct ieee80211_hw *hw, 2199 int (*conf_tx)(struct ieee80211_hw *hw,
2186 struct ieee80211_vif *vif, u16 queue, 2200 struct ieee80211_vif *vif, u16 queue,
2187 const struct ieee80211_tx_queue_params *params); 2201 const struct ieee80211_tx_queue_params *params);
@@ -3316,7 +3330,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
3316 * 3330 *
3317 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3331 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3318 * 3332 *
3319 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and 3333 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
3320 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the 3334 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
3321 * hardware is not receiving beacons with this function. 3335 * hardware is not receiving beacons with this function.
3322 */ 3336 */
@@ -3327,7 +3341,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3327 * 3341 *
3328 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3342 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3329 * 3343 *
3330 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and 3344 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
3331 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 3345 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
3332 * needs to inform if the connection to the AP has been lost. 3346 * needs to inform if the connection to the AP has been lost.
3333 * 3347 *
@@ -3397,7 +3411,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3397 * @rssi_event: the RSSI trigger event type 3411 * @rssi_event: the RSSI trigger event type
3398 * @gfp: context flags 3412 * @gfp: context flags
3399 * 3413 *
3400 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality 3414 * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
3401 * monitoring is configured with an rssi threshold, the driver will inform 3415 * monitoring is configured with an rssi threshold, the driver will inform
3402 * whenever the rssi level reaches the threshold. 3416 * whenever the rssi level reaches the threshold.
3403 */ 3417 */
@@ -3516,6 +3530,8 @@ enum rate_control_changed {
3516 * @hw: The hardware the algorithm is invoked for. 3530 * @hw: The hardware the algorithm is invoked for.
3517 * @sband: The band this frame is being transmitted on. 3531 * @sband: The band this frame is being transmitted on.
3518 * @bss_conf: the current BSS configuration 3532 * @bss_conf: the current BSS configuration
3533 * @skb: the skb that will be transmitted, the control information in it needs
3534 * to be filled in
3519 * @reported_rate: The rate control algorithm can fill this in to indicate 3535 * @reported_rate: The rate control algorithm can fill this in to indicate
3520 * which rate should be reported to userspace as the current rate and 3536 * which rate should be reported to userspace as the current rate and
3521 * used for rate calculations in the mesh network. 3537 * used for rate calculations in the mesh network.
@@ -3523,12 +3539,11 @@ enum rate_control_changed {
3523 * RTS threshold 3539 * RTS threshold
3524 * @short_preamble: whether mac80211 will request short-preamble transmission 3540 * @short_preamble: whether mac80211 will request short-preamble transmission
3525 * if the selected rate supports it 3541 * if the selected rate supports it
3526 * @max_rate_idx: user-requested maximum rate (not MCS for now) 3542 * @max_rate_idx: user-requested maximum (legacy) rate
3527 * (deprecated; this will be removed once drivers get updated to use 3543 * (deprecated; this will be removed once drivers get updated to use
3528 * rate_idx_mask) 3544 * rate_idx_mask)
3529 * @rate_idx_mask: user-requested rate mask (not MCS for now) 3545 * @rate_idx_mask: user-requested (legacy) rate mask
3530 * @skb: the skb that will be transmitted, the control information in it needs 3546 * @rate_idx_mcs_mask: user-requested MCS rate mask
3531 * to be filled in
3532 * @bss: whether this frame is sent out in AP or IBSS mode 3547 * @bss: whether this frame is sent out in AP or IBSS mode
3533 */ 3548 */
3534struct ieee80211_tx_rate_control { 3549struct ieee80211_tx_rate_control {
@@ -3540,6 +3555,7 @@ struct ieee80211_tx_rate_control {
3540 bool rts, short_preamble; 3555 bool rts, short_preamble;
3541 u8 max_rate_idx; 3556 u8 max_rate_idx;
3542 u32 rate_idx_mask; 3557 u32 rate_idx_mask;
3558 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
3543 bool bss; 3559 bool bss;
3544}; 3560};
3545 3561
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index e3133c23980e..6f9c25a76cd1 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev,
133 const struct in6_addr *daddr); 133 const struct in6_addr *daddr);
134 134
135extern void ndisc_send_redirect(struct sk_buff *skb, 135extern void ndisc_send_redirect(struct sk_buff *skb,
136 struct neighbour *neigh,
137 const struct in6_addr *target); 136 const struct in6_addr *target);
138 137
139extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 138extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 2dcf31703acb..96755c3798a5 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -20,6 +20,9 @@ enum nf_ct_ext_id {
20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
21 NF_CT_EXT_TSTAMP, 21 NF_CT_EXT_TSTAMP,
22#endif 22#endif
23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
24 NF_CT_EXT_TIMEOUT,
25#endif
23 NF_CT_EXT_NUM, 26 NF_CT_EXT_NUM,
24}; 27};
25 28
@@ -29,6 +32,7 @@ enum nf_ct_ext_id {
29#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 32#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
30#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 33#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
31#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 34#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
35#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout
32 36
33/* Extensions: optional stuff which isn't permanently in struct. */ 37/* Extensions: optional stuff which isn't permanently in struct. */
34struct nf_ct_ext { 38struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f1c1311adc2c..5767dc242dee 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -69,4 +69,17 @@ extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
69 enum ip_conntrack_info ctinfo, 69 enum ip_conntrack_info ctinfo,
70 unsigned int timeout); 70 unsigned int timeout);
71 71
72struct nf_ct_helper_expectfn {
73 struct list_head head;
74 const char *name;
75 void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
76};
77
78void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n);
79void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n);
80struct nf_ct_helper_expectfn *
81nf_ct_helper_expectfn_find_by_name(const char *name);
82struct nf_ct_helper_expectfn *
83nf_ct_helper_expectfn_find_by_symbol(const void *symbol);
84
72#endif /*_NF_CONNTRACK_HELPER_H*/ 85#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index e3d3ee3c06a2..90c67c7db7e9 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -39,12 +39,13 @@ struct nf_conntrack_l4proto {
39 unsigned int dataoff, 39 unsigned int dataoff,
40 enum ip_conntrack_info ctinfo, 40 enum ip_conntrack_info ctinfo,
41 u_int8_t pf, 41 u_int8_t pf,
42 unsigned int hooknum); 42 unsigned int hooknum,
43 unsigned int *timeouts);
43 44
44 /* Called when a new connection for this protocol found; 45 /* Called when a new connection for this protocol found;
45 * returns TRUE if it's OK. If so, packet() called next. */ 46 * returns TRUE if it's OK. If so, packet() called next. */
46 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, 47 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb,
47 unsigned int dataoff); 48 unsigned int dataoff, unsigned int *timeouts);
48 49
49 /* Called when a conntrack entry is destroyed */ 50 /* Called when a conntrack entry is destroyed */
50 void (*destroy)(struct nf_conn *ct); 51 void (*destroy)(struct nf_conn *ct);
@@ -60,6 +61,9 @@ struct nf_conntrack_l4proto {
60 /* Print out the private part of the conntrack. */ 61 /* Print out the private part of the conntrack. */
61 int (*print_conntrack)(struct seq_file *s, struct nf_conn *); 62 int (*print_conntrack)(struct seq_file *s, struct nf_conn *);
62 63
64 /* Return the array of timeouts for this protocol. */
65 unsigned int *(*get_timeouts)(struct net *net);
66
63 /* convert protoinfo to nfnetink attributes */ 67 /* convert protoinfo to nfnetink attributes */
64 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 68 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
65 struct nf_conn *ct); 69 struct nf_conn *ct);
@@ -79,6 +83,17 @@ struct nf_conntrack_l4proto {
79 83
80 size_t nla_size; 84 size_t nla_size;
81 85
86#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
87 struct {
88 size_t obj_size;
89 int (*nlattr_to_obj)(struct nlattr *tb[], void *data);
90 int (*obj_to_nlattr)(struct sk_buff *skb, const void *data);
91
92 unsigned int nlattr_max;
93 const struct nla_policy *nla_policy;
94 } ctnl_timeout;
95#endif
96
82#ifdef CONFIG_SYSCTL 97#ifdef CONFIG_SYSCTL
83 struct ctl_table_header **ctl_table_header; 98 struct ctl_table_header **ctl_table_header;
84 struct ctl_table *ctl_table; 99 struct ctl_table *ctl_table;
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
new file mode 100644
index 000000000000..0e04db4a0865
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -0,0 +1,78 @@
1#ifndef _NF_CONNTRACK_TIMEOUT_H
2#define _NF_CONNTRACK_TIMEOUT_H
3
4#include <net/net_namespace.h>
5#include <linux/netfilter/nf_conntrack_common.h>
6#include <linux/netfilter/nf_conntrack_tuple_common.h>
7#include <net/netfilter/nf_conntrack.h>
8#include <net/netfilter/nf_conntrack_extend.h>
9
10#define CTNL_TIMEOUT_NAME_MAX 32
11
12struct ctnl_timeout {
13 struct list_head head;
14 struct rcu_head rcu_head;
15 atomic_t refcnt;
16 char name[CTNL_TIMEOUT_NAME_MAX];
17 __u16 l3num;
18 __u8 l4num;
19 char data[0];
20};
21
22struct nf_conn_timeout {
23 struct ctnl_timeout *timeout;
24};
25
26#define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data)
27
28static inline
29struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
30{
31#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
32 return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT);
33#else
34 return NULL;
35#endif
36}
37
38static inline
39struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
40 struct ctnl_timeout *timeout,
41 gfp_t gfp)
42{
43#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
44 struct nf_conn_timeout *timeout_ext;
45
46 timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp);
47 if (timeout_ext == NULL)
48 return NULL;
49
50 timeout_ext->timeout = timeout;
51
52 return timeout_ext;
53#else
54 return NULL;
55#endif
56};
57
58#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
59extern int nf_conntrack_timeout_init(struct net *net);
60extern void nf_conntrack_timeout_fini(struct net *net);
61#else
62static inline int nf_conntrack_timeout_init(struct net *net)
63{
64 return 0;
65}
66
67static inline void nf_conntrack_timeout_fini(struct net *net)
68{
69 return;
70}
71#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
72
73#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
74extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name);
75extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
76#endif
77
78#endif /* _NF_CONNTRACK_TIMEOUT_H */
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h
index 0dfb34a5b53c..7e1544e8f70d 100644
--- a/include/net/netfilter/xt_log.h
+++ b/include/net/netfilter/xt_log.h
@@ -6,7 +6,7 @@ struct sbuff {
6}; 6};
7static struct sbuff emergency, *emergency_ptr = &emergency; 7static struct sbuff emergency, *emergency_ptr = &emergency;
8 8
9static int sb_add(struct sbuff *m, const char *f, ...) 9static __printf(2, 3) int sb_add(struct sbuff *m, const char *f, ...)
10{ 10{
11 va_list args; 11 va_list args;
12 int len; 12 int len;
diff --git a/include/net/netlink.h b/include/net/netlink.h
index cb1f3504687f..f394fe5d7641 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -441,41 +441,6 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ 441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
442 nlmsg_attrlen(nlh, hdrlen), rem) 442 nlmsg_attrlen(nlh, hdrlen), rem)
443 443
444#if 0
445/* FIXME: Enable once all users have been converted */
446
447/**
448 * __nlmsg_put - Add a new netlink message to an skb
449 * @skb: socket buffer to store message in
450 * @pid: netlink process id
451 * @seq: sequence number of message
452 * @type: message type
453 * @payload: length of message payload
454 * @flags: message flags
455 *
456 * The caller is responsible to ensure that the skb provides enough
457 * tailroom for both the netlink header and payload.
458 */
459static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid,
460 u32 seq, int type, int payload,
461 int flags)
462{
463 struct nlmsghdr *nlh;
464
465 nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload));
466 nlh->nlmsg_type = type;
467 nlh->nlmsg_len = nlmsg_msg_size(payload);
468 nlh->nlmsg_flags = flags;
469 nlh->nlmsg_pid = pid;
470 nlh->nlmsg_seq = seq;
471
472 memset((unsigned char *) nlmsg_data(nlh) + payload, 0,
473 nlmsg_padlen(payload));
474
475 return nlh;
476}
477#endif
478
479/** 444/**
480 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
481 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index d55f43443335..0931618c0f7f 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -5,6 +5,7 @@
5#ifndef __NET_GENERIC_H__ 5#ifndef __NET_GENERIC_H__
6#define __NET_GENERIC_H__ 6#define __NET_GENERIC_H__
7 7
8#include <linux/bug.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
9 10
10/* 11/*
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 2be95e2626c0..276094b91d7c 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -116,6 +116,11 @@
116#define NCI_DISC_MAP_MODE_POLL 0x01 116#define NCI_DISC_MAP_MODE_POLL 0x01
117#define NCI_DISC_MAP_MODE_LISTEN 0x02 117#define NCI_DISC_MAP_MODE_LISTEN 0x02
118 118
119/* NCI Discover Notification Type */
120#define NCI_DISCOVER_NTF_TYPE_LAST 0x00
121#define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01
122#define NCI_DISCOVER_NTF_TYPE_MORE 0x02
123
119/* NCI Deactivation Type */ 124/* NCI Deactivation Type */
120#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 125#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
121#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 126#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd {
207 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; 212 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
208} __packed; 213} __packed;
209 214
215#define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
216struct nci_rf_discover_select_cmd {
217 __u8 rf_discovery_id;
218 __u8 rf_protocol;
219 __u8 rf_interface;
220} __packed;
221
210#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 222#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
211struct nci_rf_deactivate_cmd { 223struct nci_rf_deactivate_cmd {
212 __u8 type; 224 __u8 type;
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 {
244 256
245#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 257#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
246 258
259#define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
260
247#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 261#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
248 262
249/* --------------------------- */ 263/* --------------------------- */
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf {
260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 274 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
261} __packed; 275} __packed;
262 276
277#define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
278
263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
264struct nci_core_intf_error_ntf { 280struct nci_core_intf_error_ntf {
265 __u8 status; 281 __u8 status;
266 __u8 conn_id; 282 __u8 conn_id;
267} __packed; 283} __packed;
268 284
269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 285#define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
270struct rf_tech_specific_params_nfca_poll { 286struct rf_tech_specific_params_nfca_poll {
271 __u16 sens_res; 287 __u16 sens_res;
272 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 288 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -275,11 +291,43 @@ struct rf_tech_specific_params_nfca_poll {
275 __u8 sel_res; 291 __u8 sel_res;
276} __packed; 292} __packed;
277 293
294struct rf_tech_specific_params_nfcb_poll {
295 __u8 sensb_res_len;
296 __u8 sensb_res[12]; /* 11 or 12 Bytes */
297} __packed;
298
299struct rf_tech_specific_params_nfcf_poll {
300 __u8 bit_rate;
301 __u8 sensf_res_len;
302 __u8 sensf_res[18]; /* 16 or 18 Bytes */
303} __packed;
304
305struct nci_rf_discover_ntf {
306 __u8 rf_discovery_id;
307 __u8 rf_protocol;
308 __u8 rf_tech_and_mode;
309 __u8 rf_tech_specific_params_len;
310
311 union {
312 struct rf_tech_specific_params_nfca_poll nfca_poll;
313 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
314 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
315 } rf_tech_specific_params;
316
317 __u8 ntf_type;
318} __packed;
319
320#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
278struct activation_params_nfca_poll_iso_dep { 321struct activation_params_nfca_poll_iso_dep {
279 __u8 rats_res_len; 322 __u8 rats_res_len;
280 __u8 rats_res[20]; 323 __u8 rats_res[20];
281}; 324};
282 325
326struct activation_params_nfcb_poll_iso_dep {
327 __u8 attrib_res_len;
328 __u8 attrib_res[50];
329};
330
283struct nci_rf_intf_activated_ntf { 331struct nci_rf_intf_activated_ntf {
284 __u8 rf_discovery_id; 332 __u8 rf_discovery_id;
285 __u8 rf_interface; 333 __u8 rf_interface;
@@ -291,6 +339,8 @@ struct nci_rf_intf_activated_ntf {
291 339
292 union { 340 union {
293 struct rf_tech_specific_params_nfca_poll nfca_poll; 341 struct rf_tech_specific_params_nfca_poll nfca_poll;
342 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
343 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
294 } rf_tech_specific_params; 344 } rf_tech_specific_params;
295 345
296 __u8 data_exch_rf_tech_and_mode; 346 __u8 data_exch_rf_tech_and_mode;
@@ -300,6 +350,7 @@ struct nci_rf_intf_activated_ntf {
300 350
301 union { 351 union {
302 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 352 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
353 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
303 } activation_params; 354 } activation_params;
304 355
305} __packed; 356} __packed;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index bccd89e9d4c2..feba74027ff8 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -34,21 +34,31 @@
34#include <net/nfc/nfc.h> 34#include <net/nfc/nfc.h>
35#include <net/nfc/nci.h> 35#include <net/nfc/nci.h>
36 36
37/* NCI device state */ 37/* NCI device flags */
38enum { 38enum nci_flag {
39 NCI_INIT, 39 NCI_INIT,
40 NCI_UP, 40 NCI_UP,
41 NCI_DATA_EXCHANGE,
42 NCI_DATA_EXCHANGE_TO,
43};
44
45/* NCI device states */
46enum nci_state {
47 NCI_IDLE,
41 NCI_DISCOVERY, 48 NCI_DISCOVERY,
49 NCI_W4_ALL_DISCOVERIES,
50 NCI_W4_HOST_SELECT,
42 NCI_POLL_ACTIVE, 51 NCI_POLL_ACTIVE,
43 NCI_DATA_EXCHANGE,
44}; 52};
45 53
46/* NCI timeouts */ 54/* NCI timeouts */
47#define NCI_RESET_TIMEOUT 5000 55#define NCI_RESET_TIMEOUT 5000
48#define NCI_INIT_TIMEOUT 5000 56#define NCI_INIT_TIMEOUT 5000
49#define NCI_RF_DISC_TIMEOUT 5000 57#define NCI_RF_DISC_TIMEOUT 5000
50#define NCI_RF_DEACTIVATE_TIMEOUT 5000 58#define NCI_RF_DISC_SELECT_TIMEOUT 5000
59#define NCI_RF_DEACTIVATE_TIMEOUT 30000
51#define NCI_CMD_TIMEOUT 5000 60#define NCI_CMD_TIMEOUT 5000
61#define NCI_DATA_TIMEOUT 700
52 62
53struct nci_dev; 63struct nci_dev;
54 64
@@ -59,6 +69,7 @@ struct nci_ops {
59}; 69};
60 70
61#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 71#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
72#define NCI_MAX_DISCOVERED_TARGETS 10
62 73
63/* NCI Core structures */ 74/* NCI Core structures */
64struct nci_dev { 75struct nci_dev {
@@ -68,12 +79,14 @@ struct nci_dev {
68 int tx_headroom; 79 int tx_headroom;
69 int tx_tailroom; 80 int tx_tailroom;
70 81
82 atomic_t state;
71 unsigned long flags; 83 unsigned long flags;
72 84
73 atomic_t cmd_cnt; 85 atomic_t cmd_cnt;
74 atomic_t credits_cnt; 86 atomic_t credits_cnt;
75 87
76 struct timer_list cmd_timer; 88 struct timer_list cmd_timer;
89 struct timer_list data_timer;
77 90
78 struct workqueue_struct *cmd_wq; 91 struct workqueue_struct *cmd_wq;
79 struct work_struct cmd_work; 92 struct work_struct cmd_work;
@@ -96,9 +109,11 @@ struct nci_dev {
96 void *driver_data; 109 void *driver_data;
97 110
98 __u32 poll_prots; 111 __u32 poll_prots;
99 __u32 target_available_prots;
100 __u32 target_active_prot; 112 __u32 target_active_prot;
101 113
114 struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS];
115 int n_targets;
116
102 /* received during NCI_OP_CORE_RESET_RSP */ 117 /* received during NCI_OP_CORE_RESET_RSP */
103 __u8 nci_ver; 118 __u8 nci_ver;
104 119
@@ -126,17 +141,17 @@ struct nci_dev {
126 141
127/* ----- NCI Devices ----- */ 142/* ----- NCI Devices ----- */
128struct nci_dev *nci_allocate_device(struct nci_ops *ops, 143struct nci_dev *nci_allocate_device(struct nci_ops *ops,
129 __u32 supported_protocols, 144 __u32 supported_protocols,
130 int tx_headroom, 145 int tx_headroom,
131 int tx_tailroom); 146 int tx_tailroom);
132void nci_free_device(struct nci_dev *ndev); 147void nci_free_device(struct nci_dev *ndev);
133int nci_register_device(struct nci_dev *ndev); 148int nci_register_device(struct nci_dev *ndev);
134void nci_unregister_device(struct nci_dev *ndev); 149void nci_unregister_device(struct nci_dev *ndev);
135int nci_recv_frame(struct sk_buff *skb); 150int nci_recv_frame(struct sk_buff *skb);
136 151
137static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, 152static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
138 unsigned int len, 153 unsigned int len,
139 gfp_t how) 154 gfp_t how)
140{ 155{
141 struct sk_buff *skb; 156 struct sk_buff *skb;
142 157
@@ -169,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
169int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); 184int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
170void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, 185void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
171 int err); 186 int err);
187void nci_clear_target_list(struct nci_dev *ndev);
172 188
173/* ----- NCI requests ----- */ 189/* ----- NCI requests ----- */
174#define NCI_REQ_DONE 0 190#define NCI_REQ_DONE 0
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 8696b773a695..bac070bf3514 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -24,6 +24,7 @@
24#ifndef __NET_NFC_H 24#ifndef __NET_NFC_H
25#define __NET_NFC_H 25#define __NET_NFC_H
26 26
27#include <linux/nfc.h>
27#include <linux/device.h> 28#include <linux/device.h>
28#include <linux/skbuff.h> 29#include <linux/skbuff.h>
29 30
@@ -52,20 +53,19 @@ struct nfc_ops {
52 int (*dev_down)(struct nfc_dev *dev); 53 int (*dev_down)(struct nfc_dev *dev);
53 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 54 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
54 void (*stop_poll)(struct nfc_dev *dev); 55 void (*stop_poll)(struct nfc_dev *dev);
55 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, 56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode,
56 u8 comm_mode, u8 rf_mode); 57 u8 *gb, size_t gb_len);
57 int (*dep_link_down)(struct nfc_dev *dev); 58 int (*dep_link_down)(struct nfc_dev *dev);
58 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
59 u32 protocol); 60 u32 protocol);
60 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx);
61 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx,
62 struct sk_buff *skb, data_exchange_cb_t cb, 63 struct sk_buff *skb, data_exchange_cb_t cb,
63 void *cb_context); 64 void *cb_context);
64}; 65};
65 66
66#define NFC_TARGET_IDX_ANY -1 67#define NFC_TARGET_IDX_ANY -1
67#define NFC_MAX_GT_LEN 48 68#define NFC_MAX_GT_LEN 48
68#define NFC_MAX_NFCID1_LEN 10
69 69
70struct nfc_target { 70struct nfc_target {
71 u32 idx; 71 u32 idx;
@@ -73,7 +73,11 @@ struct nfc_target {
73 u16 sens_res; 73 u16 sens_res;
74 u8 sel_res; 74 u8 sel_res;
75 u8 nfcid1_len; 75 u8 nfcid1_len;
76 u8 nfcid1[NFC_MAX_NFCID1_LEN]; 76 u8 nfcid1[NFC_NFCID1_MAXSIZE];
77 u8 sensb_res_len;
78 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
79 u8 sensf_res_len;
80 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
77}; 81};
78 82
79struct nfc_genl_data { 83struct nfc_genl_data {
@@ -83,7 +87,6 @@ struct nfc_genl_data {
83 87
84struct nfc_dev { 88struct nfc_dev {
85 unsigned idx; 89 unsigned idx;
86 unsigned target_idx;
87 struct nfc_target *targets; 90 struct nfc_target *targets;
88 int n_targets; 91 int n_targets;
89 int targets_generation; 92 int targets_generation;
@@ -107,9 +110,9 @@ struct nfc_dev {
107extern struct class nfc_class; 110extern struct class nfc_class;
108 111
109struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 112struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
110 u32 supported_protocols, 113 u32 supported_protocols,
111 int tx_headroom, 114 int tx_headroom,
112 int tx_tailroom); 115 int tx_tailroom);
113 116
114/** 117/**
115 * nfc_free_device - free nfc device 118 * nfc_free_device - free nfc device
@@ -132,7 +135,7 @@ void nfc_unregister_device(struct nfc_dev *dev);
132 * @dev: The parent device 135 * @dev: The parent device
133 */ 136 */
134static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, 137static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev,
135 struct device *dev) 138 struct device *dev)
136{ 139{
137 nfc_dev->dev.parent = dev; 140 nfc_dev->dev.parent = dev;
138} 141}
@@ -169,17 +172,15 @@ static inline const char *nfc_device_name(struct nfc_dev *dev)
169} 172}
170 173
171struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, 174struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
172 unsigned int flags, unsigned int size, 175 unsigned int flags, unsigned int size,
173 unsigned int *err); 176 unsigned int *err);
174struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); 177struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
175 178
176int nfc_set_remote_general_bytes(struct nfc_dev *dev, 179int nfc_set_remote_general_bytes(struct nfc_dev *dev,
177 u8 *gt, u8 gt_len); 180 u8 *gt, u8 gt_len);
178 181
179u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len); 182int nfc_targets_found(struct nfc_dev *dev,
180 183 struct nfc_target *targets, int ntargets);
181int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
182 int ntargets);
183 184
184int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 185int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
185 u8 comm_mode, u8 rf_mode); 186 u8 comm_mode, u8 rf_mode);
diff --git a/include/net/red.h b/include/net/red.h
index 28068ec614b2..77d4c3745cb5 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -2,6 +2,7 @@
2#define __NET_SCHED_RED_H 2#define __NET_SCHED_RED_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/bug.h>
5#include <net/pkt_sched.h> 6#include <net/pkt_sched.h>
6#include <net/inet_ecn.h> 7#include <net/inet_ecn.h>
7#include <net/dsfield.h> 8#include <net/dsfield.h>
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d3685615a8b0..6ee44b24864a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -413,6 +413,7 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
413/* Look up the association by its id. */ 413/* Look up the association by its id. */
414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); 414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
415 415
416int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
416 417
417/* A macro to walk a list of skbs. */ 418/* A macro to walk a list of skbs. */
418#define sctp_skb_for_each(pos, head, tmp) \ 419#define sctp_skb_for_each(pos, head, tmp) \
diff --git a/include/net/sock.h b/include/net/sock.h
index dcde2d9268cd..a6ba1f8871fd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -56,6 +56,8 @@
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/static_key.h> 58#include <linux/static_key.h>
59#include <linux/aio.h>
60#include <linux/sched.h>
59 61
60#include <linux/filter.h> 62#include <linux/filter.h>
61#include <linux/rculist_nulls.h> 63#include <linux/rculist_nulls.h>
@@ -69,7 +71,7 @@ struct cgroup;
69struct cgroup_subsys; 71struct cgroup_subsys;
70#ifdef CONFIG_NET 72#ifdef CONFIG_NET
71int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); 73int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss);
72void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss); 74void mem_cgroup_sockets_destroy(struct cgroup *cgrp);
73#else 75#else
74static inline 76static inline
75int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) 77int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
@@ -77,7 +79,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
77 return 0; 79 return 0;
78} 80}
79static inline 81static inline
80void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss) 82void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
81{ 83{
82} 84}
83#endif 85#endif
@@ -357,6 +359,7 @@ struct sock {
357 struct page *sk_sndmsg_page; 359 struct page *sk_sndmsg_page;
358 struct sk_buff *sk_send_head; 360 struct sk_buff *sk_send_head;
359 __u32 sk_sndmsg_off; 361 __u32 sk_sndmsg_off;
362 __s32 sk_peek_off;
360 int sk_write_pending; 363 int sk_write_pending;
361#ifdef CONFIG_SECURITY 364#ifdef CONFIG_SECURITY
362 void *sk_security; 365 void *sk_security;
@@ -373,6 +376,30 @@ struct sock {
373 void (*sk_destruct)(struct sock *sk); 376 void (*sk_destruct)(struct sock *sk);
374}; 377};
375 378
379static inline int sk_peek_offset(struct sock *sk, int flags)
380{
381 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
382 return sk->sk_peek_off;
383 else
384 return 0;
385}
386
387static inline void sk_peek_offset_bwd(struct sock *sk, int val)
388{
389 if (sk->sk_peek_off >= 0) {
390 if (sk->sk_peek_off >= val)
391 sk->sk_peek_off -= val;
392 else
393 sk->sk_peek_off = 0;
394 }
395}
396
397static inline void sk_peek_offset_fwd(struct sock *sk, int val)
398{
399 if (sk->sk_peek_off >= 0)
400 sk->sk_peek_off += val;
401}
402
376/* 403/*
377 * Hashed lists helper routines 404 * Hashed lists helper routines
378 */ 405 */
@@ -590,6 +617,10 @@ enum sock_flags {
590 SOCK_RXQ_OVFL, 617 SOCK_RXQ_OVFL,
591 SOCK_ZEROCOPY, /* buffers from userspace */ 618 SOCK_ZEROCOPY, /* buffers from userspace */
592 SOCK_WIFI_STATUS, /* push wifi status to userspace */ 619 SOCK_WIFI_STATUS, /* push wifi status to userspace */
620 SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS.
621 * Will use last 4 bytes of packet sent from
622 * user-space instead.
623 */
593}; 624};
594 625
595static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 626static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -871,8 +902,7 @@ struct proto {
871 */ 902 */
872 int (*init_cgroup)(struct cgroup *cgrp, 903 int (*init_cgroup)(struct cgroup *cgrp,
873 struct cgroup_subsys *ss); 904 struct cgroup_subsys *ss);
874 void (*destroy_cgroup)(struct cgroup *cgrp, 905 void (*destroy_cgroup)(struct cgroup *cgrp);
875 struct cgroup_subsys *ss);
876 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 906 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
877#endif 907#endif
878}; 908};
@@ -1824,7 +1854,7 @@ static inline bool wq_has_sleeper(struct socket_wq *wq)
1824static inline void sock_poll_wait(struct file *filp, 1854static inline void sock_poll_wait(struct file *filp,
1825 wait_queue_head_t *wait_address, poll_table *p) 1855 wait_queue_head_t *wait_address, poll_table *p)
1826{ 1856{
1827 if (p && wait_address) { 1857 if (!poll_does_not_wait(p) && wait_address) {
1828 poll_wait(filp, wait_address, p); 1858 poll_wait(filp, wait_address, p);
1829 /* 1859 /*
1830 * We need to be sure we are in sync with the 1860 * We need to be sure we are in sync with the
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 2d80c291fffb..f75a04d752cb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/tcp.h> 24#include <linux/tcp.h>
25#include <linux/bug.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <linux/cache.h> 27#include <linux/cache.h>
27#include <linux/percpu.h> 28#include <linux/percpu.h>
@@ -1138,35 +1139,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1138/* MD5 Signature */ 1139/* MD5 Signature */
1139struct crypto_hash; 1140struct crypto_hash;
1140 1141
1142union tcp_md5_addr {
1143 struct in_addr a4;
1144#if IS_ENABLED(CONFIG_IPV6)
1145 struct in6_addr a6;
1146#endif
1147};
1148
1141/* - key database */ 1149/* - key database */
1142struct tcp_md5sig_key { 1150struct tcp_md5sig_key {
1143 u8 *key; 1151 struct hlist_node node;
1144 u8 keylen; 1152 u8 keylen;
1145}; 1153 u8 family; /* AF_INET or AF_INET6 */
1146 1154 union tcp_md5_addr addr;
1147struct tcp4_md5sig_key { 1155 u8 key[TCP_MD5SIG_MAXKEYLEN];
1148 struct tcp_md5sig_key base; 1156 struct rcu_head rcu;
1149 __be32 addr;
1150};
1151
1152struct tcp6_md5sig_key {
1153 struct tcp_md5sig_key base;
1154#if 0
1155 u32 scope_id; /* XXX */
1156#endif
1157 struct in6_addr addr;
1158}; 1157};
1159 1158
1160/* - sock block */ 1159/* - sock block */
1161struct tcp_md5sig_info { 1160struct tcp_md5sig_info {
1162 struct tcp4_md5sig_key *keys4; 1161 struct hlist_head head;
1163#if IS_ENABLED(CONFIG_IPV6) 1162 struct rcu_head rcu;
1164 struct tcp6_md5sig_key *keys6;
1165 u32 entries6;
1166 u32 alloced6;
1167#endif
1168 u32 entries4;
1169 u32 alloced4;
1170}; 1163};
1171 1164
1172/* - pseudo header */ 1165/* - pseudo header */
@@ -1203,19 +1196,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1203 const struct sock *sk, 1196 const struct sock *sk,
1204 const struct request_sock *req, 1197 const struct request_sock *req,
1205 const struct sk_buff *skb); 1198 const struct sk_buff *skb);
1206extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, 1199extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1207 struct sock *addr_sk); 1200 int family, const u8 *newkey,
1208extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, 1201 u8 newkeylen, gfp_t gfp);
1209 u8 newkeylen); 1202extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1210extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); 1203 int family);
1204extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1205 struct sock *addr_sk);
1211 1206
1212#ifdef CONFIG_TCP_MD5SIG 1207#ifdef CONFIG_TCP_MD5SIG
1213#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1208extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1214 &(struct tcp_md5sig_key) { \ 1209 const union tcp_md5_addr *addr, int family);
1215 .key = (twsk)->tw_md5_key, \ 1210#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1216 .keylen = (twsk)->tw_md5_keylen, \
1217 } : NULL)
1218#else 1211#else
1212static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1213 const union tcp_md5_addr *addr,
1214 int family)
1215{
1216 return NULL;
1217}
1219#define tcp_twsk_md5_key(twsk) NULL 1218#define tcp_twsk_md5_key(twsk) NULL
1220#endif 1219#endif
1221 1220
@@ -1471,10 +1470,6 @@ struct tcp_sock_af_ops {
1471 const struct sock *sk, 1470 const struct sock *sk,
1472 const struct request_sock *req, 1471 const struct request_sock *req,
1473 const struct sk_buff *skb); 1472 const struct sk_buff *skb);
1474 int (*md5_add) (struct sock *sk,
1475 struct sock *addr_sk,
1476 u8 *newkey,
1477 u8 len);
1478 int (*md5_parse) (struct sock *sk, 1473 int (*md5_parse) (struct sock *sk,
1479 char __user *optval, 1474 char __user *optval,
1480 int optlen); 1475 int optlen);
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 3512082fa909..48410ff25c9e 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -13,7 +13,7 @@ struct tcp_memcontrol {
13 13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 16void tcp_destroy_cgroup(struct cgroup *cgrp);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); 17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); 18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 19#endif /* _TCP_MEMCG_H */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 053b3cf2c66a..8d6689cb2c66 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -12,6 +12,7 @@
12#define _TIMEWAIT_SOCK_H 12#define _TIMEWAIT_SOCK_H
13 13
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/bug.h>
15#include <net/sock.h> 16#include <net/sock.h>
16 17
17struct timewait_sock_ops { 18struct timewait_sock_ops {
diff --git a/include/net/udp.h b/include/net/udp.h
index e39592f682c3..5d606d9da9e5 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -23,6 +23,7 @@
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/bug.h>
26#include <net/inet_sock.h> 27#include <net/inet_sock.h>
27#include <net/sock.h> 28#include <net/sock.h>
28#include <net/snmp.h> 29#include <net/snmp.h>
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 5f097ca7d5c5..71375459a884 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -40,7 +40,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
41 * with a zero checksum field are illegal. */ 41 * with a zero checksum field are illegal. */
42 if (uh->check == 0) { 42 if (uh->check == 0) {
43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n"); 43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n");
44 return 1; 44 return 1;
45 } 45 }
46 46
@@ -52,7 +52,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
52 /* 52 /*
53 * Coverage length violates RFC 3828: log and discard silently. 53 * Coverage length violates RFC 3828: log and discard silently.
54 */ 54 */
55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n", 55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n",
56 cscov, skb->len); 56 cscov, skb->len);
57 return 1; 57 return 1;
58 58
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index d86fffd3c03c..ff27f1b078d1 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/netdevice.h> 24#include <linux/netdevice.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/bug.h>
26 27
27struct wpan_phy { 28struct wpan_phy {
28 struct mutex pib_lock; 29 struct mutex pib_lock;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 89174e29dca9..96239e78e621 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1566,11 +1566,6 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1567 int probe); 1567 int probe);
1568 1568
1569struct hash_desc;
1570struct scatterlist;
1571typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1572 unsigned int);
1573
1574static inline int xfrm_addr_cmp(const xfrm_address_t *a, 1569static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1575 const xfrm_address_t *b, 1570 const xfrm_address_t *b,
1576 int family) 1571 int family)
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index d3b9401b77b0..b513f57e1725 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -77,6 +77,15 @@
77 77
78#define IB_MGMT_MAX_METHODS 128 78#define IB_MGMT_MAX_METHODS 128
79 79
80/* MAD Status field bit masks */
81#define IB_MGMT_MAD_STATUS_SUCCESS 0x0000
82#define IB_MGMT_MAD_STATUS_BUSY 0x0001
83#define IB_MGMT_MAD_STATUS_REDIRECT_REQD 0x0002
84#define IB_MGMT_MAD_STATUS_BAD_VERSION 0x0004
85#define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD 0x0008
86#define IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB 0x000c
87#define IB_MGMT_MAD_STATUS_INVALID_ATTRIB_VALUE 0x001c
88
80/* RMPP information */ 89/* RMPP information */
81#define IB_MGMT_RMPP_VERSION 1 90#define IB_MGMT_RMPP_VERSION 1
82 91
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index bf5daafe8ecc..c3cca5a4dacd 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -239,6 +239,15 @@ static inline int ib_width_enum_to_int(enum ib_port_width width)
239 } 239 }
240} 240}
241 241
242enum ib_port_speed {
243 IB_SPEED_SDR = 1,
244 IB_SPEED_DDR = 2,
245 IB_SPEED_QDR = 4,
246 IB_SPEED_FDR10 = 8,
247 IB_SPEED_FDR = 16,
248 IB_SPEED_EDR = 32
249};
250
242struct ib_protocol_stats { 251struct ib_protocol_stats {
243 /* TBD... */ 252 /* TBD... */
244}; 253};
@@ -509,6 +518,7 @@ enum ib_wc_flags {
509 IB_WC_GRH = 1, 518 IB_WC_GRH = 1,
510 IB_WC_WITH_IMM = (1<<1), 519 IB_WC_WITH_IMM = (1<<1),
511 IB_WC_WITH_INVALIDATE = (1<<2), 520 IB_WC_WITH_INVALIDATE = (1<<2),
521 IB_WC_IP_CSUM_OK = (1<<3),
512}; 522};
513 523
514struct ib_wc { 524struct ib_wc {
@@ -529,7 +539,6 @@ struct ib_wc {
529 u8 sl; 539 u8 sl;
530 u8 dlid_path_bits; 540 u8 dlid_path_bits;
531 u8 port_num; /* valid only for DR SMPs on switches */ 541 u8 port_num; /* valid only for DR SMPs on switches */
532 int csum_ok;
533}; 542};
534 543
535enum ib_cq_notify_flags { 544enum ib_cq_notify_flags {
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 652dec230514..0d7d67e96d43 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -20,6 +20,8 @@
20#ifndef _FC_FCP_H_ 20#ifndef _FC_FCP_H_
21#define _FC_FCP_H_ 21#define _FC_FCP_H_
22 22
23#include <scsi/scsi.h>
24
23/* 25/*
24 * Fibre Channel Protocol for SCSI. 26 * Fibre Channel Protocol for SCSI.
25 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. 27 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005.
@@ -45,7 +47,7 @@
45 * FCP_CMND IU Payload. 47 * FCP_CMND IU Payload.
46 */ 48 */
47struct fcp_cmnd { 49struct fcp_cmnd {
48 __u8 fc_lun[8]; /* logical unit number */ 50 struct scsi_lun fc_lun; /* logical unit number */
49 __u8 fc_cmdref; /* command reference number */ 51 __u8 fc_cmdref; /* command reference number */
50 __u8 fc_pri_ta; /* priority and task attribute */ 52 __u8 fc_pri_ta; /* priority and task attribute */
51 __u8 fc_tm_flags; /* task management flags */ 53 __u8 fc_tm_flags; /* task management flags */
@@ -57,7 +59,7 @@ struct fcp_cmnd {
57#define FCP_CMND_LEN 32 /* expected length of structure */ 59#define FCP_CMND_LEN 32 /* expected length of structure */
58 60
59struct fcp_cmnd32 { 61struct fcp_cmnd32 {
60 __u8 fc_lun[8]; /* logical unit number */ 62 struct scsi_lun fc_lun; /* logical unit number */
61 __u8 fc_cmdref; /* command reference number */ 63 __u8 fc_cmdref; /* command reference number */
62 __u8 fc_pri_ta; /* priority and task attribute */ 64 __u8 fc_pri_ta; /* priority and task attribute */
63 __u8 fc_tm_flags; /* task management flags */ 65 __u8 fc_tm_flags; /* task management flags */
diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
new file mode 100644
index 000000000000..f52b921b5c70
--- /dev/null
+++ b/include/scsi/fc/fc_ms.h
@@ -0,0 +1,213 @@
1/* * Copyright(c) 2011 Intel Corporation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms and conditions of the GNU General Public License,
5 * version 2, as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope it will be useful, but WITHOUT
8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
10 * more details.
11 *
12 * You should have received a copy of the GNU General Public License along with
13 * this program; if not, write to the Free Software Foundation, Inc.,
14 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * Maintained at www.Open-FCoE.org
17 */
18
19#ifndef _FC_MS_H_
20#define _FC_MS_H_
21
22#include <linux/types.h>
23
24/*
25 * Fibre Channel Services - Management Service (MS)
26 * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
27 */
28
29/*
30 * Fabric Device Management Interface
31 */
32
33/*
34 * Common-transport sub-type for FDMI
35 */
36#define FC_FDMI_SUBTYPE 0x10 /* fs_ct_hdr.ct_fs_subtype */
37
38/*
39 * Management server FDMI Requests.
40 */
41enum fc_fdmi_req {
42 FC_FDMI_GRHL = 0x0100, /* Get Registered HBA List */
43 FC_FDMI_GHAT = 0x0101, /* Get HBA Attributes */
44 FC_FDMI_GRPL = 0x0102, /* Get Registered Port List */
45 FC_FDMI_GPAT = 0x0110, /* Get Port Attributes */
46 FC_FDMI_RHBA = 0x0200, /* Register HBA */
47 FC_FDMI_RHAT = 0x0201, /* Register HBA Attributes */
48 FC_FDMI_RPRT = 0x0210, /* Register Port */
49 FC_FDMI_RPA = 0x0211, /* Register Port Attributes */
50 FC_FDMI_DHBA = 0x0300, /* Deregister HBA */
51 FC_FDMI_DHAT = 0x0301, /* Deregister HBA Attributes */
52 FC_FDMI_DPRT = 0x0310, /* Deregister Port */
53 FC_FDMI_DPA = 0x0311, /* Deregister Port Attributes */
54};
55
56/*
57 * HBA Attribute Entry Type
58 */
59enum fc_fdmi_hba_attr_type {
60 FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
61 FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
62 FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
63 FC_FDMI_HBA_ATTR_MODEL = 0x0004,
64 FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
65 FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
66 FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
67 FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
68 FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
69 FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
70 FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
71};
72
73/*
74 * HBA Attribute Length
75 */
76#define FC_FDMI_HBA_ATTR_NODENAME_LEN 8
77#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64
78#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64
79#define FC_FDMI_HBA_ATTR_MODEL_LEN 256
80#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256
81#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
82#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256
83#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256
84#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256
85#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256
86#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4
87
88/*
89 * Port Attribute Type
90 */
91enum fc_fdmi_port_attr_type {
92 FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
93 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
94 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
95 FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
96 FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
97 FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
98};
99
100/*
101 * Port Attribute Length
102 */
103#define FC_FDMI_PORT_ATTR_FC4TYPES_LEN 32
104#define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN 4
105#define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN 4
106#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4
107#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256
108#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256
109
110/*
111 * HBA Attribute ID
112 */
113struct fc_fdmi_hba_identifier {
114 __be64 id;
115};
116
117/*
118 * Port Name
119 */
120struct fc_fdmi_port_name {
121 __be64 portname;
122};
123
124/*
125 * Attribute Entry Block for HBA/Port Attributes
126 */
127#define FC_FDMI_ATTR_ENTRY_HEADER_LEN 4
128struct fc_fdmi_attr_entry {
129 __be16 type;
130 __be16 len;
131 __u8 value[1];
132} __attribute__((__packed__));
133
134/*
135 * Common for HBA/Port Attributes
136 */
137struct fs_fdmi_attrs {
138 __be32 numattrs;
139 struct fc_fdmi_attr_entry attr[1];
140} __attribute__((__packed__));
141
142/*
143 * Registered Port List
144 */
145struct fc_fdmi_rpl {
146 __be32 numport;
147 struct fc_fdmi_port_name port[1];
148} __attribute__((__packed__));
149
150/*
151 * Register HBA (RHBA)
152 */
153struct fc_fdmi_rhba {
154 struct fc_fdmi_hba_identifier hbaid;
155 struct fc_fdmi_rpl port;
156 struct fs_fdmi_attrs hba_attrs;
157} __attribute__((__packed__));
158
159/*
160 * Register HBA Attributes (RHAT)
161 */
162struct fc_fdmi_rhat {
163 struct fc_fdmi_hba_identifier hbaid;
164 struct fs_fdmi_attrs hba_attrs;
165} __attribute__((__packed__));
166
167/*
168 * Register Port (RPRT)
169 */
170struct fc_fdmi_rprt {
171 struct fc_fdmi_hba_identifier hbaid;
172 struct fc_fdmi_port_name port;
173 struct fs_fdmi_attrs hba_attrs;
174} __attribute__((__packed__));
175
176/*
177 * Register Port Attributes (RPA)
178 */
179struct fc_fdmi_rpa {
180 struct fc_fdmi_port_name port;
181 struct fs_fdmi_attrs hba_attrs;
182} __attribute__((__packed__));
183
184/*
185 * Deregister Port (DPRT)
186 */
187struct fc_fdmi_dprt {
188 struct fc_fdmi_port_name port;
189} __attribute__((__packed__));
190
191/*
192 * Deregister Port Attributes (DPA)
193 */
194struct fc_fdmi_dpa {
195 struct fc_fdmi_port_name port;
196 struct fs_fdmi_attrs hba_attrs;
197} __attribute__((__packed__));
198
199/*
200 * Deregister HBA Attributes (DHAT)
201 */
202struct fc_fdmi_dhat {
203 struct fc_fdmi_hba_identifier hbaid;
204} __attribute__((__packed__));
205
206/*
207 * Deregister HBA (DHBA)
208 */
209struct fc_fdmi_dhba {
210 struct fc_fdmi_hba_identifier hbaid;
211} __attribute__((__packed__));
212
213#endif /* _FC_MS_H_ */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index be418d8448a5..35fd4744f3e9 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -20,6 +20,7 @@
20#ifndef _FC_ENCODE_H_ 20#ifndef _FC_ENCODE_H_
21#define _FC_ENCODE_H_ 21#define _FC_ENCODE_H_
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
23#include <linux/utsname.h>
23 24
24/* 25/*
25 * F_CTL values for simple requests and responses. 26 * F_CTL values for simple requests and responses.
@@ -43,6 +44,10 @@ struct fc_ct_req {
43 struct fc_ns_fid fid; 44 struct fc_ns_fid fid;
44 struct fc_ns_rsnn snn; 45 struct fc_ns_rsnn snn;
45 struct fc_ns_rspn spn; 46 struct fc_ns_rspn spn;
47 struct fc_fdmi_rhba rhba;
48 struct fc_fdmi_rpa rpa;
49 struct fc_fdmi_dprt dprt;
50 struct fc_fdmi_dhba dhba;
46 } payload; 51 } payload;
47}; 52};
48 53
@@ -97,7 +102,9 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
97 * returns pointer to ct request. 102 * returns pointer to ct request.
98 */ 103 */
99static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, 104static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
100 unsigned int op, size_t req_size) 105 unsigned int op, size_t req_size,
106 enum fc_ct_fs_type fs_type,
107 u8 subtype)
101{ 108{
102 struct fc_ct_req *ct; 109 struct fc_ct_req *ct;
103 size_t ct_plen; 110 size_t ct_plen;
@@ -106,14 +113,14 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
106 ct = fc_frame_payload_get(fp, ct_plen); 113 ct = fc_frame_payload_get(fp, ct_plen);
107 memset(ct, 0, ct_plen); 114 memset(ct, 0, ct_plen);
108 ct->hdr.ct_rev = FC_CT_REV; 115 ct->hdr.ct_rev = FC_CT_REV;
109 ct->hdr.ct_fs_type = FC_FST_DIR; 116 ct->hdr.ct_fs_type = fs_type;
110 ct->hdr.ct_fs_subtype = FC_NS_SUBTYPE; 117 ct->hdr.ct_fs_subtype = subtype;
111 ct->hdr.ct_cmd = htons((u16) op); 118 ct->hdr.ct_cmd = htons((u16) op);
112 return ct; 119 return ct;
113} 120}
114 121
115/** 122/**
116 * fc_ct_fill() - Fill in a name service request frame 123 * fc_ct_ns_fill() - Fill in a name service request frame
117 * @lport: local port. 124 * @lport: local port.
118 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. 125 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
119 * @fp: frame to contain payload. 126 * @fp: frame to contain payload.
@@ -121,7 +128,7 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
121 * @r_ctl: pointer to FC header R_CTL. 128 * @r_ctl: pointer to FC header R_CTL.
122 * @fh_type: pointer to FC-4 type. 129 * @fh_type: pointer to FC-4 type.
123 */ 130 */
124static inline int fc_ct_fill(struct fc_lport *lport, 131static inline int fc_ct_ns_fill(struct fc_lport *lport,
125 u32 fc_id, struct fc_frame *fp, 132 u32 fc_id, struct fc_frame *fp,
126 unsigned int op, enum fc_rctl *r_ctl, 133 unsigned int op, enum fc_rctl *r_ctl,
127 enum fc_fh_type *fh_type) 134 enum fc_fh_type *fh_type)
@@ -131,23 +138,28 @@ static inline int fc_ct_fill(struct fc_lport *lport,
131 138
132 switch (op) { 139 switch (op) {
133 case FC_NS_GPN_FT: 140 case FC_NS_GPN_FT:
134 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft)); 141 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft),
142 FC_FST_DIR, FC_NS_SUBTYPE);
135 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; 143 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
136 break; 144 break;
137 145
138 case FC_NS_GPN_ID: 146 case FC_NS_GPN_ID:
139 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid)); 147 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid),
148 FC_FST_DIR, FC_NS_SUBTYPE);
149 ct->payload.gid.fn_fc4_type = FC_TYPE_FCP;
140 hton24(ct->payload.fid.fp_fid, fc_id); 150 hton24(ct->payload.fid.fp_fid, fc_id);
141 break; 151 break;
142 152
143 case FC_NS_RFT_ID: 153 case FC_NS_RFT_ID:
144 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); 154 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft),
155 FC_FST_DIR, FC_NS_SUBTYPE);
145 hton24(ct->payload.rft.fid.fp_fid, lport->port_id); 156 hton24(ct->payload.rft.fid.fp_fid, lport->port_id);
146 ct->payload.rft.fts = lport->fcts; 157 ct->payload.rft.fts = lport->fcts;
147 break; 158 break;
148 159
149 case FC_NS_RFF_ID: 160 case FC_NS_RFF_ID:
150 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); 161 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id),
162 FC_FST_DIR, FC_NS_SUBTYPE);
151 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id); 163 hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id);
152 ct->payload.rff.fr_type = FC_TYPE_FCP; 164 ct->payload.rff.fr_type = FC_TYPE_FCP;
153 if (lport->service_params & FCP_SPPF_INIT_FCN) 165 if (lport->service_params & FCP_SPPF_INIT_FCN)
@@ -157,14 +169,16 @@ static inline int fc_ct_fill(struct fc_lport *lport,
157 break; 169 break;
158 170
159 case FC_NS_RNN_ID: 171 case FC_NS_RNN_ID:
160 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); 172 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id),
173 FC_FST_DIR, FC_NS_SUBTYPE);
161 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id); 174 hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id);
162 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); 175 put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn);
163 break; 176 break;
164 177
165 case FC_NS_RSPN_ID: 178 case FC_NS_RSPN_ID:
166 len = strnlen(fc_host_symbolic_name(lport->host), 255); 179 len = strnlen(fc_host_symbolic_name(lport->host), 255);
167 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); 180 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len,
181 FC_FST_DIR, FC_NS_SUBTYPE);
168 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id); 182 hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id);
169 strncpy(ct->payload.spn.fr_name, 183 strncpy(ct->payload.spn.fr_name,
170 fc_host_symbolic_name(lport->host), len); 184 fc_host_symbolic_name(lport->host), len);
@@ -173,7 +187,8 @@ static inline int fc_ct_fill(struct fc_lport *lport,
173 187
174 case FC_NS_RSNN_NN: 188 case FC_NS_RSNN_NN:
175 len = strnlen(fc_host_symbolic_name(lport->host), 255); 189 len = strnlen(fc_host_symbolic_name(lport->host), 255);
176 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len); 190 ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn) + len,
191 FC_FST_DIR, FC_NS_SUBTYPE);
177 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); 192 put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn);
178 strncpy(ct->payload.snn.fr_name, 193 strncpy(ct->payload.snn.fr_name,
179 fc_host_symbolic_name(lport->host), len); 194 fc_host_symbolic_name(lport->host), len);
@@ -189,6 +204,330 @@ static inline int fc_ct_fill(struct fc_lport *lport,
189} 204}
190 205
191/** 206/**
207 * fc_ct_ms_fill() - Fill in a mgmt service request frame
208 * @lport: local port.
209 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
210 * @fp: frame to contain payload.
211 * @op: CT opcode.
212 * @r_ctl: pointer to FC header R_CTL.
213 * @fh_type: pointer to FC-4 type.
214 */
215static inline int fc_ct_ms_fill(struct fc_lport *lport,
216 u32 fc_id, struct fc_frame *fp,
217 unsigned int op, enum fc_rctl *r_ctl,
218 enum fc_fh_type *fh_type)
219{
220 struct fc_ct_req *ct;
221 size_t len;
222 struct fc_fdmi_attr_entry *entry;
223 struct fs_fdmi_attrs *hba_attrs;
224 int numattrs = 0;
225
226 switch (op) {
227 case FC_FDMI_RHBA:
228 numattrs = 10;
229 len = sizeof(struct fc_fdmi_rhba);
230 len -= sizeof(struct fc_fdmi_attr_entry);
231 len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN);
232 len += FC_FDMI_HBA_ATTR_NODENAME_LEN;
233 len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN;
234 len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN;
235 len += FC_FDMI_HBA_ATTR_MODEL_LEN;
236 len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN;
237 len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN;
238 len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN;
239 len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN;
240 len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN;
241 len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN;
242 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
243 FC_FDMI_SUBTYPE);
244
245 /* HBA Identifier */
246 put_unaligned_be64(lport->wwpn, &ct->payload.rhba.hbaid.id);
247 /* Number of Ports - always 1 */
248 put_unaligned_be32(1, &ct->payload.rhba.port.numport);
249 /* Port Name */
250 put_unaligned_be64(lport->wwpn,
251 &ct->payload.rhba.port.port[0].portname);
252
253 /* HBA Attributes */
254 put_unaligned_be32(numattrs,
255 &ct->payload.rhba.hba_attrs.numattrs);
256 hba_attrs = &ct->payload.rhba.hba_attrs;
257 entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr;
258 /* NodeName*/
259 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
260 len += FC_FDMI_HBA_ATTR_NODENAME_LEN;
261 put_unaligned_be16(FC_FDMI_HBA_ATTR_NODENAME,
262 &entry->type);
263 put_unaligned_be16(len, &entry->len);
264 put_unaligned_be64(lport->wwnn,
265 (__be64 *)&entry->value[0]);
266
267 /* Manufacturer */
268 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
269 FC_FDMI_HBA_ATTR_NODENAME_LEN);
270 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
271 len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN;
272 put_unaligned_be16(FC_FDMI_HBA_ATTR_MANUFACTURER,
273 &entry->type);
274 put_unaligned_be16(len, &entry->len);
275 strncpy((char *)&entry->value,
276 fc_host_manufacturer(lport->host),
277 FC_FDMI_HBA_ATTR_MANUFACTURER_LEN);
278
279 /* SerialNumber */
280 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
281 FC_FDMI_HBA_ATTR_MANUFACTURER_LEN);
282 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
283 len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN;
284 put_unaligned_be16(FC_FDMI_HBA_ATTR_SERIALNUMBER,
285 &entry->type);
286 put_unaligned_be16(len, &entry->len);
287 strncpy((char *)&entry->value,
288 fc_host_serial_number(lport->host),
289 FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN);
290
291 /* Model */
292 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
293 FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN);
294 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
295 len += FC_FDMI_HBA_ATTR_MODEL_LEN;
296 put_unaligned_be16(FC_FDMI_HBA_ATTR_MODEL,
297 &entry->type);
298 put_unaligned_be16(len, &entry->len);
299 strncpy((char *)&entry->value,
300 fc_host_model(lport->host),
301 FC_FDMI_HBA_ATTR_MODEL_LEN);
302
303 /* Model Description */
304 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
305 FC_FDMI_HBA_ATTR_MODEL_LEN);
306 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
307 len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN;
308 put_unaligned_be16(FC_FDMI_HBA_ATTR_MODELDESCRIPTION,
309 &entry->type);
310 put_unaligned_be16(len, &entry->len);
311 strncpy((char *)&entry->value,
312 fc_host_model_description(lport->host),
313 FC_FDMI_HBA_ATTR_MODELDESCR_LEN);
314
315 /* Hardware Version */
316 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
317 FC_FDMI_HBA_ATTR_MODELDESCR_LEN);
318 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
319 len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN;
320 put_unaligned_be16(FC_FDMI_HBA_ATTR_HARDWAREVERSION,
321 &entry->type);
322 put_unaligned_be16(len, &entry->len);
323 strncpy((char *)&entry->value,
324 fc_host_hardware_version(lport->host),
325 FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN);
326
327 /* Driver Version */
328 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
329 FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN);
330 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
331 len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN;
332 put_unaligned_be16(FC_FDMI_HBA_ATTR_DRIVERVERSION,
333 &entry->type);
334 put_unaligned_be16(len, &entry->len);
335 strncpy((char *)&entry->value,
336 fc_host_driver_version(lport->host),
337 FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN);
338
339 /* OptionROM Version */
340 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
341 FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN);
342 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
343 len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN;
344 put_unaligned_be16(FC_FDMI_HBA_ATTR_OPTIONROMVERSION,
345 &entry->type);
346 put_unaligned_be16(len, &entry->len);
347 strncpy((char *)&entry->value,
348 fc_host_optionrom_version(lport->host),
349 FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN);
350
351 /* Firmware Version */
352 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
353 FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN);
354 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
355 len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN;
356 put_unaligned_be16(FC_FDMI_HBA_ATTR_FIRMWAREVERSION,
357 &entry->type);
358 put_unaligned_be16(len, &entry->len);
359 strncpy((char *)&entry->value,
360 fc_host_firmware_version(lport->host),
361 FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN);
362
363 /* OS Name and Version */
364 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
365 FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN);
366 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
367 len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN;
368 put_unaligned_be16(FC_FDMI_HBA_ATTR_OSNAMEVERSION,
369 &entry->type);
370 put_unaligned_be16(len, &entry->len);
371 snprintf((char *)&entry->value,
372 FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN,
373 "%s v%s",
374 init_utsname()->sysname,
375 init_utsname()->release);
376 break;
377 case FC_FDMI_RPA:
378 numattrs = 6;
379 len = sizeof(struct fc_fdmi_rpa);
380 len -= sizeof(struct fc_fdmi_attr_entry);
381 len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN);
382 len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN;
383 len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN;
384 len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN;
385 len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN;
386 len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN;
387 len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN;
388 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
389 FC_FDMI_SUBTYPE);
390
391 /* Port Name */
392 put_unaligned_be64(lport->wwpn,
393 &ct->payload.rpa.port.portname);
394
395 /* Port Attributes */
396 put_unaligned_be32(numattrs,
397 &ct->payload.rpa.hba_attrs.numattrs);
398
399 hba_attrs = &ct->payload.rpa.hba_attrs;
400 entry = (struct fc_fdmi_attr_entry *)hba_attrs->attr;
401
402 /* FC4 types */
403 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
404 len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN;
405 put_unaligned_be16(FC_FDMI_PORT_ATTR_FC4TYPES,
406 &entry->type);
407 put_unaligned_be16(len, &entry->len);
408 memcpy(&entry->value, fc_host_supported_fc4s(lport->host),
409 FC_FDMI_PORT_ATTR_FC4TYPES_LEN);
410
411 /* Supported Speed */
412 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
413 FC_FDMI_PORT_ATTR_FC4TYPES_LEN);
414 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
415 len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN;
416 put_unaligned_be16(FC_FDMI_PORT_ATTR_SUPPORTEDSPEED,
417 &entry->type);
418 put_unaligned_be16(len, &entry->len);
419
420 put_unaligned_be32(fc_host_supported_speeds(lport->host),
421 &entry->value);
422
423 /* Current Port Speed */
424 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
425 FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN);
426 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
427 len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN;
428 put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTPORTSPEED,
429 &entry->type);
430 put_unaligned_be16(len, &entry->len);
431 put_unaligned_be32(lport->link_speed,
432 &entry->value);
433
434 /* Max Frame Size */
435 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
436 FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN);
437 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
438 len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN;
439 put_unaligned_be16(FC_FDMI_PORT_ATTR_MAXFRAMESIZE,
440 &entry->type);
441 put_unaligned_be16(len, &entry->len);
442 put_unaligned_be32(fc_host_maxframe_size(lport->host),
443 &entry->value);
444
445 /* OS Device Name */
446 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
447 FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN);
448 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
449 len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN;
450 put_unaligned_be16(FC_FDMI_PORT_ATTR_OSDEVICENAME,
451 &entry->type);
452 put_unaligned_be16(len, &entry->len);
453 /* Use the sysfs device name */
454 strncpy((char *)&entry->value,
455 dev_name(&lport->host->shost_gendev),
456 strnlen(dev_name(&lport->host->shost_gendev),
457 FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
458
459 /* Host Name */
460 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
461 FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN);
462 len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
463 len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN;
464 put_unaligned_be16(FC_FDMI_PORT_ATTR_HOSTNAME,
465 &entry->type);
466 put_unaligned_be16(len, &entry->len);
467 if (strlen(fc_host_system_hostname(lport->host)))
468 strncpy((char *)&entry->value,
469 fc_host_system_hostname(lport->host),
470 strnlen(fc_host_system_hostname(lport->host),
471 FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
472 else
473 strncpy((char *)&entry->value,
474 init_utsname()->nodename,
475 FC_FDMI_PORT_ATTR_HOSTNAME_LEN);
476 break;
477 case FC_FDMI_DPRT:
478 len = sizeof(struct fc_fdmi_dprt);
479 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
480 FC_FDMI_SUBTYPE);
481 /* Port Name */
482 put_unaligned_be64(lport->wwpn,
483 &ct->payload.dprt.port.portname);
484 break;
485 case FC_FDMI_DHBA:
486 len = sizeof(struct fc_fdmi_dhba);
487 ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
488 FC_FDMI_SUBTYPE);
489 /* HBA Identifier */
490 put_unaligned_be64(lport->wwpn, &ct->payload.dhba.hbaid.id);
491 break;
492 default:
493 return -EINVAL;
494 }
495 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
496 *fh_type = FC_TYPE_CT;
497 return 0;
498}
499
500/**
501 * fc_ct_fill() - Fill in a common transport service request frame
502 * @lport: local port.
503 * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries.
504 * @fp: frame to contain payload.
505 * @op: CT opcode.
506 * @r_ctl: pointer to FC header R_CTL.
507 * @fh_type: pointer to FC-4 type.
508 */
509static inline int fc_ct_fill(struct fc_lport *lport,
510 u32 fc_id, struct fc_frame *fp,
511 unsigned int op, enum fc_rctl *r_ctl,
512 enum fc_fh_type *fh_type, u32 *did)
513{
514 int rc = -EINVAL;
515
516 switch (fc_id) {
517 case FC_FID_MGMT_SERV:
518 rc = fc_ct_ms_fill(lport, fc_id, fp, op, r_ctl, fh_type);
519 *did = FC_FID_MGMT_SERV;
520 break;
521 case FC_FID_DIR_SERV:
522 default:
523 rc = fc_ct_ns_fill(lport, fc_id, fp, op, r_ctl, fh_type);
524 *did = FC_FID_DIR_SERV;
525 break;
526 }
527
528 return rc;
529}
530/**
192 * fc_plogi_fill - Fill in plogi request frame 531 * fc_plogi_fill - Fill in plogi request frame
193 */ 532 */
194static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp, 533static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp,
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 2703e3bedbf5..9c23ee8fd2d3 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -60,6 +60,9 @@ enum iscsi_uevent_e {
60 60
61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20, 61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
62 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21, 62 ISCSI_UEVENT_SET_IFACE_PARAMS = UEVENT_BASE + 21,
63 ISCSI_UEVENT_PING = UEVENT_BASE + 22,
64 ISCSI_UEVENT_GET_CHAP = UEVENT_BASE + 23,
65 ISCSI_UEVENT_DELETE_CHAP = UEVENT_BASE + 24,
63 66
64 /* up events */ 67 /* up events */
65 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 68 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -72,6 +75,8 @@ enum iscsi_uevent_e {
72 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7, 75 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
73 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8, 76 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
74 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9, 77 ISCSI_KEVENT_CONN_LOGIN_STATE = KEVENT_BASE + 9,
78 ISCSI_KEVENT_HOST_EVENT = KEVENT_BASE + 10,
79 ISCSI_KEVENT_PING_COMP = KEVENT_BASE + 11,
75}; 80};
76 81
77enum iscsi_tgt_dscvr { 82enum iscsi_tgt_dscvr {
@@ -80,6 +85,13 @@ enum iscsi_tgt_dscvr {
80 ISCSI_TGT_DSCVR_SLP = 3, 85 ISCSI_TGT_DSCVR_SLP = 3,
81}; 86};
82 87
88enum iscsi_host_event_code {
89 ISCSI_EVENT_LINKUP = 1,
90 ISCSI_EVENT_LINKDOWN,
91 /* must always be last */
92 ISCSI_EVENT_MAX,
93};
94
83struct iscsi_uevent { 95struct iscsi_uevent {
84 uint32_t type; /* k/u events type */ 96 uint32_t type; /* k/u events type */
85 uint32_t iferror; /* carries interface or resource errors */ 97 uint32_t iferror; /* carries interface or resource errors */
@@ -178,6 +190,26 @@ struct iscsi_uevent {
178 uint32_t host_no; 190 uint32_t host_no;
179 uint32_t count; 191 uint32_t count;
180 } set_iface_params; 192 } set_iface_params;
193 struct msg_iscsi_ping {
194 uint32_t host_no;
195 uint32_t iface_num;
196 uint32_t iface_type;
197 uint32_t payload_size;
198 uint32_t pid; /* unique ping id associated
199 with each ping request */
200 } iscsi_ping;
201 struct msg_get_chap {
202 uint32_t host_no;
203 uint32_t num_entries; /* number of CHAP entries
204 * on request, number of
205 * valid CHAP entries on
206 * response */
207 uint16_t chap_tbl_idx;
208 } get_chap;
209 struct msg_delete_chap {
210 uint32_t host_no;
211 uint16_t chap_tbl_idx;
212 } delete_chap;
181 } u; 213 } u;
182 union { 214 union {
183 /* messages k -> u */ 215 /* messages k -> u */
@@ -222,6 +254,18 @@ struct iscsi_uevent {
222 struct msg_notify_if_down { 254 struct msg_notify_if_down {
223 uint32_t host_no; 255 uint32_t host_no;
224 } notify_if_down; 256 } notify_if_down;
257 struct msg_host_event {
258 uint32_t host_no;
259 uint32_t data_size;
260 enum iscsi_host_event_code code;
261 } host_event;
262 struct msg_ping_comp {
263 uint32_t host_no;
264 uint32_t status;
265 uint32_t pid; /* unique ping id associated
266 with each ping request */
267 uint32_t data_size;
268 } ping_comp;
225 } r; 269 } r;
226} __attribute__ ((aligned (sizeof(uint64_t)))); 270} __attribute__ ((aligned (sizeof(uint64_t))));
227 271
@@ -406,6 +450,9 @@ enum iscsi_param {
406 450
407 ISCSI_PARAM_TGT_RESET_TMO, 451 ISCSI_PARAM_TGT_RESET_TMO,
408 ISCSI_PARAM_TARGET_ALIAS, 452 ISCSI_PARAM_TARGET_ALIAS,
453
454 ISCSI_PARAM_CHAP_IN_IDX,
455 ISCSI_PARAM_CHAP_OUT_IDX,
409 /* must always be last */ 456 /* must always be last */
410 ISCSI_PARAM_MAX, 457 ISCSI_PARAM_MAX,
411}; 458};
@@ -416,9 +463,26 @@ enum iscsi_host_param {
416 ISCSI_HOST_PARAM_INITIATOR_NAME, 463 ISCSI_HOST_PARAM_INITIATOR_NAME,
417 ISCSI_HOST_PARAM_NETDEV_NAME, 464 ISCSI_HOST_PARAM_NETDEV_NAME,
418 ISCSI_HOST_PARAM_IPADDRESS, 465 ISCSI_HOST_PARAM_IPADDRESS,
466 ISCSI_HOST_PARAM_PORT_STATE,
467 ISCSI_HOST_PARAM_PORT_SPEED,
419 ISCSI_HOST_PARAM_MAX, 468 ISCSI_HOST_PARAM_MAX,
420}; 469};
421 470
471/* iSCSI port Speed */
472enum iscsi_port_speed {
473 ISCSI_PORT_SPEED_UNKNOWN = 0x1,
474 ISCSI_PORT_SPEED_10MBPS = 0x2,
475 ISCSI_PORT_SPEED_100MBPS = 0x4,
476 ISCSI_PORT_SPEED_1GBPS = 0x8,
477 ISCSI_PORT_SPEED_10GBPS = 0x10,
478};
479
480/* iSCSI port state */
481enum iscsi_port_state {
482 ISCSI_PORT_STATE_DOWN = 0x1,
483 ISCSI_PORT_STATE_UP = 0x2,
484};
485
422#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 486#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
423#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 487#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
424 488
@@ -501,4 +565,19 @@ struct iscsi_stats {
501 __attribute__ ((aligned (sizeof(uint64_t)))); 565 __attribute__ ((aligned (sizeof(uint64_t))));
502}; 566};
503 567
568enum chap_type_e {
569 CHAP_TYPE_OUT,
570 CHAP_TYPE_IN,
571};
572
573#define ISCSI_CHAP_AUTH_NAME_MAX_LEN 256
574#define ISCSI_CHAP_AUTH_SECRET_MAX_LEN 256
575struct iscsi_chap_rec {
576 uint16_t chap_tbl_idx;
577 enum chap_type_e chap_type;
578 char username[ISCSI_CHAP_AUTH_NAME_MAX_LEN];
579 uint8_t password[ISCSI_CHAP_AUTH_SECRET_MAX_LEN];
580 uint8_t password_length;
581} __packed;
582
504#endif 583#endif
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 6a3922fe0be0..8f9dfba3fcf0 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -30,6 +30,7 @@
30 30
31#include <scsi/fc/fc_fcp.h> 31#include <scsi/fc/fc_fcp.h>
32#include <scsi/fc/fc_ns.h> 32#include <scsi/fc/fc_ns.h>
33#include <scsi/fc/fc_ms.h>
33#include <scsi/fc/fc_els.h> 34#include <scsi/fc/fc_els.h>
34#include <scsi/fc/fc_gs.h> 35#include <scsi/fc/fc_gs.h>
35 36
@@ -52,6 +53,8 @@
52 * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent 53 * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent
53 * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent 54 * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent
54 * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent 55 * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent
56 * @LPORT_ST_FDMI: Waiting for mgmt server rport to become ready
57 * @LPORT_ST_RHBA:
55 * @LPORT_ST_SCR: State Change Register (SCR) sent 58 * @LPORT_ST_SCR: State Change Register (SCR) sent
56 * @LPORT_ST_READY: Ready for use 59 * @LPORT_ST_READY: Ready for use
57 * @LPORT_ST_LOGO: Local port logout (LOGO) sent 60 * @LPORT_ST_LOGO: Local port logout (LOGO) sent
@@ -66,6 +69,11 @@ enum fc_lport_state {
66 LPORT_ST_RSPN_ID, 69 LPORT_ST_RSPN_ID,
67 LPORT_ST_RFT_ID, 70 LPORT_ST_RFT_ID,
68 LPORT_ST_RFF_ID, 71 LPORT_ST_RFF_ID,
72 LPORT_ST_FDMI,
73 LPORT_ST_RHBA,
74 LPORT_ST_RPA,
75 LPORT_ST_DHBA,
76 LPORT_ST_DPRT,
69 LPORT_ST_SCR, 77 LPORT_ST_SCR,
70 LPORT_ST_READY, 78 LPORT_ST_READY,
71 LPORT_ST_LOGO, 79 LPORT_ST_LOGO,
@@ -797,6 +805,7 @@ enum fc_lport_event {
797 * @host: The SCSI host associated with a local port 805 * @host: The SCSI host associated with a local port
798 * @ema_list: Exchange manager anchor list 806 * @ema_list: Exchange manager anchor list
799 * @dns_rdata: The directory server remote port 807 * @dns_rdata: The directory server remote port
808 * @ms_rdata: The management server remote port
800 * @ptp_rdata: Point to point remote port 809 * @ptp_rdata: Point to point remote port
801 * @scsi_priv: FCP layer internal data 810 * @scsi_priv: FCP layer internal data
802 * @disc: Discovery context 811 * @disc: Discovery context
@@ -842,6 +851,7 @@ struct fc_lport {
842 struct Scsi_Host *host; 851 struct Scsi_Host *host;
843 struct list_head ema_list; 852 struct list_head ema_list;
844 struct fc_rport_priv *dns_rdata; 853 struct fc_rport_priv *dns_rdata;
854 struct fc_rport_priv *ms_rdata;
845 struct fc_rport_priv *ptp_rdata; 855 struct fc_rport_priv *ptp_rdata;
846 void *scsi_priv; 856 void *scsi_priv;
847 struct fc_disc disc; 857 struct fc_disc disc;
@@ -877,6 +887,7 @@ struct fc_lport {
877 u32 does_npiv:1; 887 u32 does_npiv:1;
878 u32 npiv_enabled:1; 888 u32 npiv_enabled:1;
879 u32 point_to_multipoint:1; 889 u32 point_to_multipoint:1;
890 u32 fdmi_enabled:1;
880 u32 mfs; 891 u32 mfs;
881 u8 max_retry_count; 892 u8 max_retry_count;
882 u8 max_rport_retry_count; 893 u8 max_rport_retry_count;
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index cedcff371c88..6e33386a3898 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -268,7 +268,7 @@ struct iscsi_session {
268 int lu_reset_timeout; 268 int lu_reset_timeout;
269 int tgt_reset_timeout; 269 int tgt_reset_timeout;
270 int initial_r2t_en; 270 int initial_r2t_en;
271 unsigned max_r2t; 271 unsigned short max_r2t;
272 int imm_data_en; 272 int imm_data_en;
273 unsigned first_burst; 273 unsigned first_burst;
274 unsigned max_burst; 274 unsigned max_burst;
@@ -284,6 +284,7 @@ struct iscsi_session {
284 char *password; 284 char *password;
285 char *password_in; 285 char *password_in;
286 char *targetname; 286 char *targetname;
287 char *targetalias;
287 char *ifacename; 288 char *ifacename;
288 char *initiatorname; 289 char *initiatorname;
289 /* control data */ 290 /* control data */
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index ac0cc1d925ef..215469a9b801 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -128,7 +128,7 @@ extern void iscsi_tcp_conn_teardown(struct iscsi_cls_conn *cls_conn);
128/* misc helpers */ 128/* misc helpers */
129extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session); 129extern int iscsi_tcp_r2tpool_alloc(struct iscsi_session *session);
130extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session); 130extern void iscsi_tcp_r2tpool_free(struct iscsi_session *session);
131 131extern int iscsi_tcp_set_max_r2t(struct iscsi_conn *conn, char *buf);
132extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, 132extern void iscsi_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn,
133 struct iscsi_stats *stats); 133 struct iscsi_stats *stats);
134#endif /* LIBISCSI_TCP_H */ 134#endif /* LIBISCSI_TCP_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 6a308d42d98f..5f5ed1b8b41b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -86,7 +86,9 @@ enum discover_event {
86 DISCE_DISCOVER_DOMAIN = 0U, 86 DISCE_DISCOVER_DOMAIN = 0U,
87 DISCE_REVALIDATE_DOMAIN = 1, 87 DISCE_REVALIDATE_DOMAIN = 1,
88 DISCE_PORT_GONE = 2, 88 DISCE_PORT_GONE = 2,
89 DISC_NUM_EVENTS = 3, 89 DISCE_PROBE = 3,
90 DISCE_DESTRUCT = 4,
91 DISC_NUM_EVENTS = 5,
90}; 92};
91 93
92/* ---------- Expander Devices ---------- */ 94/* ---------- Expander Devices ---------- */
@@ -151,6 +153,8 @@ struct expander_device {
151 153
152 struct ex_phy *ex_phy; 154 struct ex_phy *ex_phy;
153 struct sas_port *parent_port; 155 struct sas_port *parent_port;
156
157 struct mutex cmd_mutex;
154}; 158};
155 159
156/* ---------- SATA device ---------- */ 160/* ---------- SATA device ---------- */
@@ -162,22 +166,21 @@ enum ata_command_set {
162struct sata_device { 166struct sata_device {
163 enum ata_command_set command_set; 167 enum ata_command_set command_set;
164 struct smp_resp rps_resp; /* report_phy_sata_resp */ 168 struct smp_resp rps_resp; /* report_phy_sata_resp */
165 __le16 *identify_device;
166 __le16 *identify_packet_device;
167
168 u8 port_no; /* port number, if this is a PM (Port) */ 169 u8 port_no; /* port number, if this is a PM (Port) */
169 struct list_head children; /* PM Ports if this is a PM */ 170 struct list_head children; /* PM Ports if this is a PM */
170 171
171 struct ata_port *ap; 172 struct ata_port *ap;
172 struct ata_host ata_host; 173 struct ata_host ata_host;
173 struct ata_taskfile tf; 174 struct ata_taskfile tf;
174 u32 sstatus;
175 u32 serror;
176 u32 scontrol;
177}; 175};
178 176
179/* ---------- Domain device ---------- */ 177enum {
178 SAS_DEV_GONE,
179 SAS_DEV_DESTROY,
180};
181
180struct domain_device { 182struct domain_device {
183 spinlock_t done_lock;
181 enum sas_dev_type dev_type; 184 enum sas_dev_type dev_type;
182 185
183 enum sas_linkrate linkrate; 186 enum sas_linkrate linkrate;
@@ -189,8 +192,10 @@ struct domain_device {
189 struct domain_device *parent; 192 struct domain_device *parent;
190 struct list_head siblings; /* devices on the same level */ 193 struct list_head siblings; /* devices on the same level */
191 struct asd_sas_port *port; /* shortcut to root of the tree */ 194 struct asd_sas_port *port; /* shortcut to root of the tree */
195 struct sas_phy *phy;
192 196
193 struct list_head dev_list_node; 197 struct list_head dev_list_node;
198 struct list_head disco_list_node; /* awaiting probe or destruct */
194 199
195 enum sas_protocol iproto; 200 enum sas_protocol iproto;
196 enum sas_protocol tproto; 201 enum sas_protocol tproto;
@@ -208,7 +213,8 @@ struct domain_device {
208 }; 213 };
209 214
210 void *lldd_dev; 215 void *lldd_dev;
211 int gone; 216 unsigned long state;
217 struct kref kref;
212}; 218};
213 219
214struct sas_discovery_event { 220struct sas_discovery_event {
@@ -217,7 +223,6 @@ struct sas_discovery_event {
217}; 223};
218 224
219struct sas_discovery { 225struct sas_discovery {
220 spinlock_t disc_event_lock;
221 struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; 226 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
222 unsigned long pending; 227 unsigned long pending;
223 u8 fanout_sas_addr[8]; 228 u8 fanout_sas_addr[8];
@@ -226,7 +231,6 @@ struct sas_discovery {
226 int max_level; 231 int max_level;
227}; 232};
228 233
229
230/* The port struct is Class:RW, driver:RO */ 234/* The port struct is Class:RW, driver:RO */
231struct asd_sas_port { 235struct asd_sas_port {
232/* private: */ 236/* private: */
@@ -236,9 +240,10 @@ struct asd_sas_port {
236 struct domain_device *port_dev; 240 struct domain_device *port_dev;
237 spinlock_t dev_list_lock; 241 spinlock_t dev_list_lock;
238 struct list_head dev_list; 242 struct list_head dev_list;
243 struct list_head disco_list;
244 struct list_head destroy_list;
239 enum sas_linkrate linkrate; 245 enum sas_linkrate linkrate;
240 246
241 struct sas_phy *phy;
242 struct work_struct work; 247 struct work_struct work;
243 248
244/* public: */ 249/* public: */
@@ -274,7 +279,6 @@ struct asd_sas_event {
274 */ 279 */
275struct asd_sas_phy { 280struct asd_sas_phy {
276/* private: */ 281/* private: */
277 /* protected by ha->event_lock */
278 struct asd_sas_event port_events[PORT_NUM_EVENTS]; 282 struct asd_sas_event port_events[PORT_NUM_EVENTS];
279 struct asd_sas_event phy_events[PHY_NUM_EVENTS]; 283 struct asd_sas_event phy_events[PHY_NUM_EVENTS];
280 284
@@ -320,6 +324,7 @@ struct asd_sas_phy {
320struct scsi_core { 324struct scsi_core {
321 struct Scsi_Host *shost; 325 struct Scsi_Host *shost;
322 326
327 struct mutex task_queue_flush;
323 spinlock_t task_queue_lock; 328 spinlock_t task_queue_lock;
324 struct list_head task_queue; 329 struct list_head task_queue;
325 int task_queue_size; 330 int task_queue_size;
@@ -334,18 +339,23 @@ struct sas_ha_event {
334 339
335enum sas_ha_state { 340enum sas_ha_state {
336 SAS_HA_REGISTERED, 341 SAS_HA_REGISTERED,
337 SAS_HA_UNREGISTERED 342 SAS_HA_DRAINING,
343 SAS_HA_ATA_EH_ACTIVE,
344 SAS_HA_FROZEN,
338}; 345};
339 346
340struct sas_ha_struct { 347struct sas_ha_struct {
341/* private: */ 348/* private: */
342 spinlock_t event_lock;
343 struct sas_ha_event ha_events[HA_NUM_EVENTS]; 349 struct sas_ha_event ha_events[HA_NUM_EVENTS];
344 unsigned long pending; 350 unsigned long pending;
345 351
346 enum sas_ha_state state; 352 struct list_head defer_q; /* work queued while draining */
353 struct mutex drain_mutex;
354 unsigned long state;
347 spinlock_t state_lock; 355 spinlock_t state_lock;
348 356
357 struct mutex disco_mutex;
358
349 struct scsi_core core; 359 struct scsi_core core;
350 360
351/* public: */ 361/* public: */
@@ -374,7 +384,8 @@ struct sas_ha_struct {
374 384
375 void *lldd_ha; /* not touched by sas class code */ 385 void *lldd_ha; /* not touched by sas class code */
376 386
377 struct list_head eh_done_q; 387 struct list_head eh_done_q; /* complete via scsi_eh_flush_done_q */
388 struct list_head eh_ata_q; /* scmds to promote from sas to ata eh */
378}; 389};
379 390
380#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) 391#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
@@ -418,6 +429,11 @@ static inline unsigned int to_sas_gpio_od(int device, int bit)
418 return 3 * device + bit; 429 return 3 * device + bit;
419} 430}
420 431
432static inline void sas_put_local_phy(struct sas_phy *phy)
433{
434 put_device(&phy->dev);
435}
436
421#ifdef CONFIG_SCSI_SAS_HOST_SMP 437#ifdef CONFIG_SCSI_SAS_HOST_SMP
422int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count); 438int try_test_sas_gpio_gp_bit(unsigned int od, u8 *data, u8 index, u8 count);
423#else 439#else
@@ -447,7 +463,10 @@ enum service_response {
447}; 463};
448 464
449enum exec_status { 465enum exec_status {
450 /* The SAM_STAT_.. codes fit in the lower 6 bits */ 466 /* The SAM_STAT_.. codes fit in the lower 6 bits, alias some of
467 * them here to silence 'case value not in enumerated type' warnings
468 */
469 __SAM_STAT_CHECK_CONDITION = SAM_STAT_CHECK_CONDITION,
451 470
452 SAS_DEV_NO_RESPONSE = 0x80, 471 SAS_DEV_NO_RESPONSE = 0x80,
453 SAS_DATA_UNDERRUN, 472 SAS_DATA_UNDERRUN,
@@ -487,10 +506,6 @@ enum exec_status {
487struct ata_task_resp { 506struct ata_task_resp {
488 u16 frame_len; 507 u16 frame_len;
489 u8 ending_fis[24]; /* dev to host or data-in */ 508 u8 ending_fis[24]; /* dev to host or data-in */
490 u32 sstatus;
491 u32 serror;
492 u32 scontrol;
493 u32 sactive;
494}; 509};
495 510
496#define SAS_STATUS_BUF_SIZE 96 511#define SAS_STATUS_BUF_SIZE 96
@@ -604,7 +619,8 @@ struct sas_domain_function_template {
604 int (*lldd_clear_aca)(struct domain_device *, u8 *lun); 619 int (*lldd_clear_aca)(struct domain_device *, u8 *lun);
605 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); 620 int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
606 int (*lldd_I_T_nexus_reset)(struct domain_device *); 621 int (*lldd_I_T_nexus_reset)(struct domain_device *);
607 int (*lldd_ata_soft_reset)(struct domain_device *); 622 int (*lldd_ata_check_ready)(struct domain_device *);
623 void (*lldd_ata_set_dmamode)(struct domain_device *);
608 int (*lldd_lu_reset)(struct domain_device *, u8 *lun); 624 int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
609 int (*lldd_query_task)(struct sas_task *); 625 int (*lldd_query_task)(struct sas_task *);
610 626
@@ -625,14 +641,11 @@ extern int sas_unregister_ha(struct sas_ha_struct *);
625 641
626int sas_set_phy_speed(struct sas_phy *phy, 642int sas_set_phy_speed(struct sas_phy *phy,
627 struct sas_phy_linkrates *rates); 643 struct sas_phy_linkrates *rates);
628int sas_phy_enable(struct sas_phy *phy, int enabled);
629int sas_phy_reset(struct sas_phy *phy, int hard_reset); 644int sas_phy_reset(struct sas_phy *phy, int hard_reset);
630int sas_queue_up(struct sas_task *task); 645int sas_queue_up(struct sas_task *task);
631extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *); 646extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
632extern int sas_target_alloc(struct scsi_target *); 647extern int sas_target_alloc(struct scsi_target *);
633extern int sas_slave_alloc(struct scsi_device *);
634extern int sas_slave_configure(struct scsi_device *); 648extern int sas_slave_configure(struct scsi_device *);
635extern void sas_slave_destroy(struct scsi_device *);
636extern int sas_change_queue_depth(struct scsi_device *, int new_depth, 649extern int sas_change_queue_depth(struct scsi_device *, int new_depth,
637 int reason); 650 int reason);
638extern int sas_change_queue_type(struct scsi_device *, int qt); 651extern int sas_change_queue_type(struct scsi_device *, int qt);
@@ -649,7 +662,7 @@ void sas_init_ex_attr(void);
649 662
650int sas_ex_revalidate_domain(struct domain_device *); 663int sas_ex_revalidate_domain(struct domain_device *);
651 664
652void sas_unregister_domain_devices(struct asd_sas_port *port); 665void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
653void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *); 666void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
654int sas_discover_event(struct asd_sas_port *, enum discover_event ev); 667int sas_discover_event(struct asd_sas_port *, enum discover_event ev);
655 668
@@ -661,20 +674,20 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
661void sas_init_dev(struct domain_device *); 674void sas_init_dev(struct domain_device *);
662 675
663void sas_task_abort(struct sas_task *); 676void sas_task_abort(struct sas_task *);
664int __sas_task_abort(struct sas_task *);
665int sas_eh_device_reset_handler(struct scsi_cmnd *cmd); 677int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
666int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd); 678int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd);
667 679
668extern void sas_target_destroy(struct scsi_target *); 680extern void sas_target_destroy(struct scsi_target *);
669extern int sas_slave_alloc(struct scsi_device *); 681extern int sas_slave_alloc(struct scsi_device *);
670extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); 682extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg);
683extern int sas_drain_work(struct sas_ha_struct *ha);
671 684
672extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, 685extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
673 struct request *req); 686 struct request *req);
674 687
675extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, 688extern void sas_ssp_task_response(struct device *dev, struct sas_task *task,
676 struct ssp_response_iu *iu); 689 struct ssp_response_iu *iu);
677struct sas_phy *sas_find_local_phy(struct domain_device *dev); 690struct sas_phy *sas_get_local_phy(struct domain_device *dev);
678 691
679int sas_request_addr(struct Scsi_Host *shost, u8 *addr); 692int sas_request_addr(struct Scsi_Host *shost, u8 *addr);
680 693
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
index f05fa826f89e..a5f9b960dfc8 100644
--- a/include/scsi/osd_ore.h
+++ b/include/scsi/osd_ore.h
@@ -26,6 +26,7 @@
26#include <scsi/osd_attributes.h> 26#include <scsi/osd_attributes.h>
27#include <scsi/osd_sec.h> 27#include <scsi/osd_sec.h>
28#include <linux/pnfs_osd_xdr.h> 28#include <linux/pnfs_osd_xdr.h>
29#include <linux/bug.h>
29 30
30struct ore_comp { 31struct ore_comp {
31 struct osd_obj_id obj; 32 struct osd_obj_id obj;
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index 3673d685e6ad..a577a833603d 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -89,8 +89,7 @@ enum sas_oob_mode {
89 SAS_OOB_MODE 89 SAS_OOB_MODE
90}; 90};
91 91
92/* See sas_discover.c if you plan on changing these. 92/* See sas_discover.c if you plan on changing these */
93 */
94enum sas_dev_type { 93enum sas_dev_type {
95 NO_DEVICE = 0, /* protocol */ 94 NO_DEVICE = 0, /* protocol */
96 SAS_END_DEV = 1, /* protocol */ 95 SAS_END_DEV = 1, /* protocol */
@@ -100,6 +99,7 @@ enum sas_dev_type {
100 SATA_DEV = 5, 99 SATA_DEV = 5,
101 SATA_PM = 7, 100 SATA_PM = 7,
102 SATA_PM_PORT= 8, 101 SATA_PM_PORT= 8,
102 SATA_PENDING = 9,
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index 9c159f74c6d0..cdccd2eb7b6c 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -32,19 +32,19 @@
32 32
33static inline int dev_is_sata(struct domain_device *dev) 33static inline int dev_is_sata(struct domain_device *dev)
34{ 34{
35 return (dev->rphy->identify.target_port_protocols & SAS_PROTOCOL_SATA); 35 return dev->dev_type == SATA_DEV || dev->dev_type == SATA_PM ||
36 dev->dev_type == SATA_PM_PORT || dev->dev_type == SATA_PENDING;
36} 37}
37 38
38int sas_ata_init_host_and_port(struct domain_device *found_dev, 39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
39 struct scsi_target *starget); 40int sas_ata_init_host_and_port(struct domain_device *found_dev);
40
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost); 42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task, 43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
44 enum blk_eh_timer_return *rtn); 44 struct list_head *done_q);
45int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 45void sas_ata_schedule_reset(struct domain_device *dev);
46 struct list_head *done_q); 46void sas_ata_wait_eh(struct domain_device *dev);
47 47void sas_probe_sata(struct asd_sas_port *port);
48#else 48#else
49 49
50 50
@@ -52,8 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev, 55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev)
56 struct scsi_target *starget)
57{ 56{
58 return 0; 57 return 0;
59} 58}
@@ -65,18 +64,27 @@ static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
65{ 64{
66} 65}
67 66
68static inline int sas_ata_timed_out(struct scsi_cmnd *cmd, 67static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
69 struct sas_task *task, 68 struct list_head *done_q)
70 enum blk_eh_timer_return *rtn)
71{ 69{
72 return 0;
73} 70}
74static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 71
75 struct list_head *done_q) 72static inline void sas_ata_schedule_reset(struct domain_device *dev)
73{
74}
75
76static inline void sas_ata_wait_eh(struct domain_device *dev)
77{
78}
79
80static inline void sas_probe_sata(struct asd_sas_port *port)
76{ 81{
77 return 0;
78} 82}
79 83
84static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
85{
86 return 0;
87}
80#endif 88#endif
81 89
82#endif /* _SAS_ATA_H_ */ 90#endif /* _SAS_ATA_H_ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 8001ae4cd7ba..f34a5a87af38 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -143,6 +143,7 @@ struct scsi_cmnd;
143#define READ_ATTRIBUTE 0x8c 143#define READ_ATTRIBUTE 0x8c
144#define WRITE_ATTRIBUTE 0x8d 144#define WRITE_ATTRIBUTE 0x8d
145#define VERIFY_16 0x8f 145#define VERIFY_16 0x8f
146#define SYNCHRONIZE_CACHE_16 0x91
146#define WRITE_SAME_16 0x93 147#define WRITE_SAME_16 0x93
147#define SERVICE_ACTION_IN 0x9e 148#define SERVICE_ACTION_IN 0x9e
148/* values for service action in */ 149/* values for service action in */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a5e885a111df..377df4a28512 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -10,6 +10,7 @@
10 10
11struct Scsi_Host; 11struct Scsi_Host;
12struct scsi_device; 12struct scsi_device;
13struct scsi_driver;
13 14
14/* 15/*
15 * MAX_COMMAND_SIZE is: 16 * MAX_COMMAND_SIZE is:
@@ -131,6 +132,11 @@ struct scsi_cmnd {
131 unsigned char tag; /* SCSI-II queued command tag */ 132 unsigned char tag; /* SCSI-II queued command tag */
132}; 133};
133 134
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{
137 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
138}
139
134extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 140extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
135extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); 141extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
136extern void scsi_put_command(struct scsi_cmnd *); 142extern void scsi_put_command(struct scsi_cmnd *);
@@ -289,17 +295,17 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)
289 295
290static inline void set_msg_byte(struct scsi_cmnd *cmd, char status) 296static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
291{ 297{
292 cmd->result |= status << 8; 298 cmd->result = (cmd->result & 0xffff00ff) | (status << 8);
293} 299}
294 300
295static inline void set_host_byte(struct scsi_cmnd *cmd, char status) 301static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
296{ 302{
297 cmd->result |= status << 16; 303 cmd->result = (cmd->result & 0xff00ffff) | (status << 16);
298} 304}
299 305
300static inline void set_driver_byte(struct scsi_cmnd *cmd, char status) 306static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
301{ 307{
302 cmd->result |= status << 24; 308 cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
303} 309}
304 310
305#endif /* _SCSI_SCSI_CMND_H */ 311#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 77273f2fdd80..6efb2e1416e0 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -1,7 +1,6 @@
1#ifndef _SCSI_SCSI_DEVICE_H 1#ifndef _SCSI_SCSI_DEVICE_H
2#define _SCSI_SCSI_DEVICE_H 2#define _SCSI_SCSI_DEVICE_H
3 3
4#include <linux/device.h>
5#include <linux/list.h> 4#include <linux/list.h>
6#include <linux/spinlock.h> 5#include <linux/spinlock.h>
7#include <linux/workqueue.h> 6#include <linux/workqueue.h>
@@ -9,6 +8,7 @@
9#include <scsi/scsi.h> 8#include <scsi/scsi.h>
10#include <linux/atomic.h> 9#include <linux/atomic.h>
11 10
11struct device;
12struct request_queue; 12struct request_queue;
13struct scsi_cmnd; 13struct scsi_cmnd;
14struct scsi_lun; 14struct scsi_lun;
@@ -136,6 +136,7 @@ struct scsi_device {
136 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ 136 unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
137 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ 137 unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */
138 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ 138 unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */
139 unsigned skip_vpd_pages:1; /* do not read VPD pages */
139 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ 140 unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */
140 unsigned no_start_on_add:1; /* do not issue start on add */ 141 unsigned no_start_on_add:1; /* do not issue start on add */
141 unsigned allow_restart:1; /* issue START_UNIT in error handler */ 142 unsigned allow_restart:1; /* issue START_UNIT in error handler */
@@ -246,8 +247,10 @@ struct scsi_target {
246 unsigned int single_lun:1; /* Indicates we should only 247 unsigned int single_lun:1; /* Indicates we should only
247 * allow I/O to one of the luns 248 * allow I/O to one of the luns
248 * for the device at a time. */ 249 * for the device at a time. */
249 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ 250 unsigned int pdt_1f_for_no_lun:1; /* PDT = 0x1f
250 /* means no lun present */ 251 * means no lun present. */
252 unsigned int no_report_luns:1; /* Don't use
253 * REPORT LUNS for scanning. */
251 /* commands actually active on LLD. protected by host lock. */ 254 /* commands actually active on LLD. protected by host lock. */
252 unsigned int target_busy; 255 unsigned int target_busy;
253 /* 256 /*
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 9fd6702f02e2..d443aa06a722 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -16,6 +16,7 @@ struct scsi_driver {
16 16
17 void (*rescan)(struct device *); 17 void (*rescan)(struct device *);
18 int (*done)(struct scsi_cmnd *); 18 int (*done)(struct scsi_cmnd *);
19 int (*eh_action)(struct scsi_cmnd *, unsigned char *, int, int);
19}; 20};
20#define to_scsi_driver(drv) \ 21#define to_scsi_driver(drv) \
21 container_of((drv), struct scsi_driver, gendrv) 22 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 58ce8fe44783..5cb20ccb1956 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -23,7 +23,7 @@
23#define SCSI_NETLINK_H 23#define SCSI_NETLINK_H
24 24
25#include <linux/netlink.h> 25#include <linux/netlink.h>
26 26#include <linux/types.h>
27 27
28/* 28/*
29 * This file intended to be included by both kernel and user space 29 * This file intended to be included by both kernel and user space
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 0de32cd4e8a7..af244f4bba53 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/transport_class.h> 23#include <linux/transport_class.h>
24#include <linux/blkdev.h> 24#include <linux/blkdev.h>
25#include <linux/bug.h>
25#include <scsi/scsi_host.h> 26#include <scsi/scsi_host.h>
26#include <scsi/scsi_device.h> 27#include <scsi/scsi_device.h>
27 28
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 2a65167a8f10..719faf1863ad 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -126,8 +126,8 @@ enum fc_vport_state {
126 incapable of reporting */ 126 incapable of reporting */
127#define FC_PORTSPEED_1GBIT 1 127#define FC_PORTSPEED_1GBIT 1
128#define FC_PORTSPEED_2GBIT 2 128#define FC_PORTSPEED_2GBIT 2
129#define FC_PORTSPEED_4GBIT 4 129#define FC_PORTSPEED_10GBIT 4
130#define FC_PORTSPEED_10GBIT 8 130#define FC_PORTSPEED_4GBIT 8
131#define FC_PORTSPEED_8GBIT 0x10 131#define FC_PORTSPEED_8GBIT 0x10
132#define FC_PORTSPEED_16GBIT 0x20 132#define FC_PORTSPEED_16GBIT 0x20
133#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ 133#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
@@ -486,6 +486,13 @@ struct fc_host_attrs {
486 u32 maxframe_size; 486 u32 maxframe_size;
487 u16 max_npiv_vports; 487 u16 max_npiv_vports;
488 char serial_number[FC_SERIAL_NUMBER_SIZE]; 488 char serial_number[FC_SERIAL_NUMBER_SIZE];
489 char manufacturer[FC_SERIAL_NUMBER_SIZE];
490 char model[FC_SYMBOLIC_NAME_SIZE];
491 char model_description[FC_SYMBOLIC_NAME_SIZE];
492 char hardware_version[FC_VERSION_STRING_SIZE];
493 char driver_version[FC_VERSION_STRING_SIZE];
494 char firmware_version[FC_VERSION_STRING_SIZE];
495 char optionrom_version[FC_VERSION_STRING_SIZE];
489 496
490 /* Dynamic Attributes */ 497 /* Dynamic Attributes */
491 u32 port_id; 498 u32 port_id;
@@ -541,6 +548,20 @@ struct fc_host_attrs {
541 (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports) 548 (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports)
542#define fc_host_serial_number(x) \ 549#define fc_host_serial_number(x) \
543 (((struct fc_host_attrs *)(x)->shost_data)->serial_number) 550 (((struct fc_host_attrs *)(x)->shost_data)->serial_number)
551#define fc_host_manufacturer(x) \
552 (((struct fc_host_attrs *)(x)->shost_data)->manufacturer)
553#define fc_host_model(x) \
554 (((struct fc_host_attrs *)(x)->shost_data)->model)
555#define fc_host_model_description(x) \
556 (((struct fc_host_attrs *)(x)->shost_data)->model_description)
557#define fc_host_hardware_version(x) \
558 (((struct fc_host_attrs *)(x)->shost_data)->hardware_version)
559#define fc_host_driver_version(x) \
560 (((struct fc_host_attrs *)(x)->shost_data)->driver_version)
561#define fc_host_firmware_version(x) \
562 (((struct fc_host_attrs *)(x)->shost_data)->firmware_version)
563#define fc_host_optionrom_version(x) \
564 (((struct fc_host_attrs *)(x)->shost_data)->optionrom_version)
544#define fc_host_port_id(x) \ 565#define fc_host_port_id(x) \
545 (((struct fc_host_attrs *)(x)->shost_data)->port_id) 566 (((struct fc_host_attrs *)(x)->shost_data)->port_id)
546#define fc_host_port_type(x) \ 567#define fc_host_port_type(x) \
@@ -700,6 +721,13 @@ struct fc_function_template {
700 unsigned long show_host_supported_speeds:1; 721 unsigned long show_host_supported_speeds:1;
701 unsigned long show_host_maxframe_size:1; 722 unsigned long show_host_maxframe_size:1;
702 unsigned long show_host_serial_number:1; 723 unsigned long show_host_serial_number:1;
724 unsigned long show_host_manufacturer:1;
725 unsigned long show_host_model:1;
726 unsigned long show_host_model_description:1;
727 unsigned long show_host_hardware_version:1;
728 unsigned long show_host_driver_version:1;
729 unsigned long show_host_firmware_version:1;
730 unsigned long show_host_optionrom_version:1;
703 /* host dynamic attributes */ 731 /* host dynamic attributes */
704 unsigned long show_host_port_id:1; 732 unsigned long show_host_port_id:1;
705 unsigned long show_host_port_type:1; 733 unsigned long show_host_port_type:1;
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 2c3a46d102fd..53f0b361d668 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -144,6 +144,12 @@ struct iscsi_transport {
144 int param, char *buf); 144 int param, char *buf);
145 umode_t (*attr_is_visible)(int param_type, int param); 145 umode_t (*attr_is_visible)(int param_type, int param);
146 int (*bsg_request)(struct bsg_job *job); 146 int (*bsg_request)(struct bsg_job *job);
147 int (*send_ping) (struct Scsi_Host *shost, uint32_t iface_num,
148 uint32_t iface_type, uint32_t payload_size,
149 uint32_t pid, struct sockaddr *dst_addr);
150 int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx,
151 uint32_t *num_entries, char *buf);
152 int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx);
147}; 153};
148 154
149/* 155/*
@@ -166,6 +172,17 @@ extern int iscsi_offload_mesg(struct Scsi_Host *shost,
166 struct iscsi_transport *transport, uint32_t type, 172 struct iscsi_transport *transport, uint32_t type,
167 char *data, uint16_t data_size); 173 char *data, uint16_t data_size);
168 174
175extern void iscsi_post_host_event(uint32_t host_no,
176 struct iscsi_transport *transport,
177 enum iscsi_host_event_code code,
178 uint32_t data_size,
179 uint8_t *data);
180
181extern void iscsi_ping_comp_event(uint32_t host_no,
182 struct iscsi_transport *transport,
183 uint32_t status, uint32_t pid,
184 uint32_t data_size, uint8_t *data);
185
169struct iscsi_cls_conn { 186struct iscsi_cls_conn {
170 struct list_head conn_list; /* item in connlist */ 187 struct list_head conn_list; /* item in connlist */
171 void *dd_data; /* LLD private data */ 188 void *dd_data; /* LLD private data */
@@ -238,6 +255,8 @@ struct iscsi_cls_host {
238 atomic_t nr_scans; 255 atomic_t nr_scans;
239 struct mutex mutex; 256 struct mutex mutex;
240 struct request_queue *bsg_q; 257 struct request_queue *bsg_q;
258 uint32_t port_speed;
259 uint32_t port_state;
241}; 260};
242 261
243#define iscsi_job_to_shost(_job) \ 262#define iscsi_job_to_shost(_job) \
@@ -307,5 +326,8 @@ extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost,
307 uint32_t iface_num, int dd_size); 326 uint32_t iface_num, int dd_size);
308extern void iscsi_destroy_iface(struct iscsi_iface *iface); 327extern void iscsi_destroy_iface(struct iscsi_iface *iface);
309extern struct iscsi_iface *iscsi_lookup_iface(int handle); 328extern struct iscsi_iface *iscsi_lookup_iface(int handle);
329extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost);
330extern char *iscsi_get_port_state_name(struct Scsi_Host *shost);
331extern int iscsi_is_session_dev(const struct device *dev);
310 332
311#endif 333#endif
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index ffeebc34a4f7..98b3a20a0102 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -75,7 +75,8 @@ struct sas_phy {
75 /* for the list of phys belonging to a port */ 75 /* for the list of phys belonging to a port */
76 struct list_head port_siblings; 76 struct list_head port_siblings;
77 77
78 struct work_struct reset_work; 78 /* available to the lldd */
79 void *hostdata;
79}; 80};
80 81
81#define dev_to_phy(d) \ 82#define dev_to_phy(d) \
@@ -169,6 +170,8 @@ struct sas_function_template {
169 int (*get_bay_identifier)(struct sas_rphy *); 170 int (*get_bay_identifier)(struct sas_rphy *);
170 int (*phy_reset)(struct sas_phy *, int); 171 int (*phy_reset)(struct sas_phy *, int);
171 int (*phy_enable)(struct sas_phy *, int); 172 int (*phy_enable)(struct sas_phy *, int);
173 int (*phy_setup)(struct sas_phy *);
174 void (*phy_release)(struct sas_phy *);
172 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); 175 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *);
173 int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *); 176 int (*smp_handler)(struct Scsi_Host *, struct sas_rphy *, struct request *);
174}; 177};
@@ -194,6 +197,7 @@ void sas_rphy_free(struct sas_rphy *);
194extern int sas_rphy_add(struct sas_rphy *); 197extern int sas_rphy_add(struct sas_rphy *);
195extern void sas_rphy_remove(struct sas_rphy *); 198extern void sas_rphy_remove(struct sas_rphy *);
196extern void sas_rphy_delete(struct sas_rphy *); 199extern void sas_rphy_delete(struct sas_rphy *);
200extern void sas_rphy_unlink(struct sas_rphy *);
197extern int scsi_is_sas_rphy(const struct device *); 201extern int scsi_is_sas_rphy(const struct device *);
198 202
199struct sas_port *sas_port_alloc(struct device *, int); 203struct sas_port *sas_port_alloc(struct device *, int);
@@ -205,6 +209,12 @@ void sas_port_add_phy(struct sas_port *, struct sas_phy *);
205void sas_port_delete_phy(struct sas_port *, struct sas_phy *); 209void sas_port_delete_phy(struct sas_port *, struct sas_phy *);
206void sas_port_mark_backlink(struct sas_port *); 210void sas_port_mark_backlink(struct sas_port *);
207int scsi_is_sas_port(const struct device *); 211int scsi_is_sas_port(const struct device *);
212struct sas_phy *sas_port_get_phy(struct sas_port *port);
213static inline void sas_port_put_phy(struct sas_phy *phy)
214{
215 if (phy)
216 put_device(&phy->dev);
217}
208 218
209extern struct scsi_transport_template * 219extern struct scsi_transport_template *
210sas_attach_transport(struct sas_function_template *); 220sas_attach_transport(struct sas_function_template *);
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index d97d69f81a7d..da4a456de032 100644
--- a/include/sound/compress_params.h
+++ b/include/sound/compress_params.h
@@ -51,6 +51,8 @@
51#ifndef __SND_COMPRESS_PARAMS_H 51#ifndef __SND_COMPRESS_PARAMS_H
52#define __SND_COMPRESS_PARAMS_H 52#define __SND_COMPRESS_PARAMS_H
53 53
54#include <linux/types.h>
55
54/* AUDIO CODECS SUPPORTED */ 56/* AUDIO CODECS SUPPORTED */
55#define MAX_NUM_CODECS 32 57#define MAX_NUM_CODECS 32
56#define MAX_NUM_CODEC_DESCRIPTORS 32 58#define MAX_NUM_CODEC_DESCRIPTORS 32
diff --git a/include/sound/control.h b/include/sound/control.h
index b2796e83c7ac..8332e865c759 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -40,7 +40,7 @@ struct snd_kcontrol_new {
40 snd_ctl_elem_iface_t iface; /* interface identifier */ 40 snd_ctl_elem_iface_t iface; /* interface identifier */
41 unsigned int device; /* device/client number */ 41 unsigned int device; /* device/client number */
42 unsigned int subdevice; /* subdevice (substream) number */ 42 unsigned int subdevice; /* subdevice (substream) number */
43 unsigned char *name; /* ASCII name of item */ 43 const unsigned char *name; /* ASCII name of item */
44 unsigned int index; /* index of item */ 44 unsigned int index; /* index of item */
45 unsigned int access; /* access rights */ 45 unsigned int access; /* access rights */
46 unsigned int count; /* count of same elements */ 46 unsigned int count; /* count of same elements */
@@ -227,6 +227,11 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); 227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
228} 228}
229 229
230int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl,
231 void (*hook)(void *private_data, int),
232 void *private_data);
233void snd_ctl_sync_vmaster_hook(struct snd_kcontrol *kctl);
234
230/* 235/*
231 * Helper functions for jack-detection controls 236 * Helper functions for jack-detection controls
232 */ 237 */
diff --git a/include/sound/core.h b/include/sound/core.h
index cea1b5426dfa..b6e0f57d451d 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -26,7 +26,6 @@
26#include <linux/mutex.h> /* struct mutex */ 26#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/pm.h> /* pm_message_t */ 28#include <linux/pm.h> /* pm_message_t */
29#include <linux/device.h>
30#include <linux/stringify.h> 29#include <linux/stringify.h>
31 30
32/* number of supported soundcards */ 31/* number of supported soundcards */
@@ -39,10 +38,10 @@
39#define CONFIG_SND_MAJOR 116 /* standard configuration */ 38#define CONFIG_SND_MAJOR 116 /* standard configuration */
40 39
41/* forward declarations */ 40/* forward declarations */
42#ifdef CONFIG_PCI
43struct pci_dev; 41struct pci_dev;
44#endif
45struct module; 42struct module;
43struct device;
44struct device_attribute;
46 45
47/* device allocation stuff */ 46/* device allocation stuff */
48 47
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
new file mode 100644
index 000000000000..a8fcaa6d531f
--- /dev/null
+++ b/include/sound/dmaengine_pcm.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2012, Analog Devices Inc.
3 * Author: Lars-Peter Clausen <lars@metafoo.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15#ifndef __SOUND_DMAENGINE_PCM_H__
16#define __SOUND_DMAENGINE_PCM_H__
17
18#include <sound/pcm.h>
19#include <linux/dmaengine.h>
20
21/**
22 * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM
23 * substream
24 * @substream: PCM substream
25 */
26static inline enum dma_transfer_direction
27snd_pcm_substream_to_dma_direction(const struct snd_pcm_substream *substream)
28{
29 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
30 return DMA_MEM_TO_DEV;
31 else
32 return DMA_DEV_TO_MEM;
33}
34
35void snd_dmaengine_pcm_set_data(struct snd_pcm_substream *substream, void *data);
36void *snd_dmaengine_pcm_get_data(struct snd_pcm_substream *substream);
37
38int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream,
39 const struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config);
40int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
41snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream);
42
43int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
44 dma_filter_fn filter_fn, void *filter_data);
45int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
46
47struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream);
48
49#endif
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 63c790742db4..58916573db58 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -53,6 +53,9 @@ enum snd_jack_types {
53 SND_JACK_BTN_5 = 0x0200, 53 SND_JACK_BTN_5 = 0x0200,
54}; 54};
55 55
56/* Keep in sync with definitions above */
57#define SND_JACK_SWITCH_TYPES 6
58
56struct snd_jack { 59struct snd_jack {
57 struct input_dev *input_dev; 60 struct input_dev *input_dev;
58 int registered; 61 int registered;
diff --git a/include/sound/max9768.h b/include/sound/max9768.h
new file mode 100644
index 000000000000..0f78b41d030e
--- /dev/null
+++ b/include/sound/max9768.h
@@ -0,0 +1,24 @@
1/*
2 * Platform data for MAX9768
3 * Copyright (C) 2011, 2012 by Wolfram Sang, Pengutronix e.K.
4 * same licence as the driver
5 */
6
7#ifndef __SOUND_MAX9768_PDATA_H__
8#define __SOUND_MAX9768_PDATA_H__
9
10/**
11 * struct max9768_pdata - optional platform specific MAX9768 configuration
12 * @shdn_gpio: GPIO to SHDN pin. If not valid, pin must be hardwired HIGH
13 * @mute_gpio: GPIO to MUTE pin. If not valid, control for mute won't be added
14 * @flags: configuration flags, e.g. set classic PWM mode (check datasheet
15 * regarding "filterless modulation" which is default).
16 */
17struct max9768_pdata {
18 int shdn_gpio;
19 int mute_gpio;
20 unsigned flags;
21#define MAX9768_FLAG_CLASSIC_PWM (1 << 0)
22};
23
24#endif /* __SOUND_MAX9768_PDATA_H__*/
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 0cf91b2f08ca..0d1112815be3 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -264,7 +264,7 @@ struct snd_pcm_hw_constraint_ratdens {
264 264
265struct snd_pcm_hw_constraint_list { 265struct snd_pcm_hw_constraint_list {
266 unsigned int count; 266 unsigned int count;
267 unsigned int *list; 267 const unsigned int *list;
268 unsigned int mask; 268 unsigned int mask;
269}; 269};
270 270
@@ -454,6 +454,7 @@ struct snd_pcm {
454 void *private_data; 454 void *private_data;
455 void (*private_free) (struct snd_pcm *pcm); 455 void (*private_free) (struct snd_pcm *pcm);
456 struct device *dev; /* actual hw device this belongs to */ 456 struct device *dev; /* actual hw device this belongs to */
457 bool internal; /* pcm is for internal use only */
457#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 458#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
458 struct snd_pcm_oss oss; 459 struct snd_pcm_oss oss;
459#endif 460#endif
@@ -475,6 +476,9 @@ extern const struct file_operations snd_pcm_f_ops[2];
475int snd_pcm_new(struct snd_card *card, const char *id, int device, 476int snd_pcm_new(struct snd_card *card, const char *id, int device,
476 int playback_count, int capture_count, 477 int playback_count, int capture_count,
477 struct snd_pcm **rpcm); 478 struct snd_pcm **rpcm);
479int snd_pcm_new_internal(struct snd_card *card, const char *id, int device,
480 int playback_count, int capture_count,
481 struct snd_pcm **rpcm);
478int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 482int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
479 483
480int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); 484int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
@@ -781,7 +785,8 @@ void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interva
781 unsigned int k, struct snd_interval *c); 785 unsigned int k, struct snd_interval *c);
782void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, 786void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
783 const struct snd_interval *b, struct snd_interval *c); 787 const struct snd_interval *b, struct snd_interval *c);
784int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); 788int snd_interval_list(struct snd_interval *i, unsigned int count,
789 const unsigned int *list, unsigned int mask);
785int snd_interval_ratnum(struct snd_interval *i, 790int snd_interval_ratnum(struct snd_interval *i,
786 unsigned int rats_count, struct snd_ratnum *rats, 791 unsigned int rats_count, struct snd_ratnum *rats,
787 unsigned int *nump, unsigned int *denp); 792 unsigned int *nump, unsigned int *denp);
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 9b1aacaa82fe..b457e87fbd08 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -72,10 +72,16 @@
72#define SH_FSI_BPFMD_32 (5 << 4) 72#define SH_FSI_BPFMD_32 (5 << 4)
73#define SH_FSI_BPFMD_16 (6 << 4) 73#define SH_FSI_BPFMD_16 (6 << 4)
74 74
75struct sh_fsi_port_info {
76 unsigned long flags;
77 int tx_id;
78 int rx_id;
79 int (*set_rate)(struct device *dev, int rate, int enable);
80};
81
75struct sh_fsi_platform_info { 82struct sh_fsi_platform_info {
76 unsigned long porta_flags; 83 struct sh_fsi_port_info port_a;
77 unsigned long portb_flags; 84 struct sh_fsi_port_info port_b;
78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
79}; 85};
80 86
81/* 87/*
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 2413acc54883..c429f248cf4e 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -17,6 +17,7 @@
17#include <linux/list.h> 17#include <linux/list.h>
18 18
19struct snd_pcm_substream; 19struct snd_pcm_substream;
20struct snd_soc_dapm_widget;
20 21
21/* 22/*
22 * DAI hardware audio formats. 23 * DAI hardware audio formats.
@@ -238,6 +239,9 @@ struct snd_soc_dai {
238 unsigned char pop_wait:1; 239 unsigned char pop_wait:1;
239 unsigned char probed:1; 240 unsigned char probed:1;
240 241
242 struct snd_soc_dapm_widget *playback_widget;
243 struct snd_soc_dapm_widget *capture_widget;
244
241 /* DAI DMA data */ 245 /* DAI DMA data */
242 void *playback_dma_data; 246 void *playback_dma_data;
243 void *capture_dma_data; 247 void *capture_dma_data;
@@ -246,10 +250,9 @@ struct snd_soc_dai {
246 unsigned int rate; 250 unsigned int rate;
247 251
248 /* parent platform/codec */ 252 /* parent platform/codec */
249 union { 253 struct snd_soc_platform *platform;
250 struct snd_soc_platform *platform; 254 struct snd_soc_codec *codec;
251 struct snd_soc_codec *codec; 255
252 };
253 struct snd_soc_card *card; 256 struct snd_soc_card *card;
254 257
255 struct list_head list; 258 struct list_head list;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index d26a9b784772..8da3c2409060 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -13,10 +13,11 @@
13#ifndef __LINUX_SND_SOC_DAPM_H 13#ifndef __LINUX_SND_SOC_DAPM_H
14#define __LINUX_SND_SOC_DAPM_H 14#define __LINUX_SND_SOC_DAPM_H
15 15
16#include <linux/device.h>
17#include <linux/types.h> 16#include <linux/types.h>
18#include <sound/control.h> 17#include <sound/control.h>
19 18
19struct device;
20
20/* widget has no PM register bit */ 21/* widget has no PM register bit */
21#define SND_SOC_NOPM -1 22#define SND_SOC_NOPM -1
22 23
@@ -243,6 +244,10 @@
243{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
244 .shift = wshift, .invert = winvert, .event = wevent, \ 245 .shift = wshift, .invert = winvert, .event = wevent, \
245 .event_flags = wflags} 246 .event_flags = wflags}
247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay) \
248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \
249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD }
246 251
247/* dapm kcontrol types */ 252/* dapm kcontrol types */
248#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ 253#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
@@ -322,6 +327,8 @@ struct snd_soc_dapm_context;
322 327
323int dapm_reg_event(struct snd_soc_dapm_widget *w, 328int dapm_reg_event(struct snd_soc_dapm_widget *w,
324 struct snd_kcontrol *kcontrol, int event); 329 struct snd_kcontrol *kcontrol, int event);
330int dapm_regulator_event(struct snd_soc_dapm_widget *w,
331 struct snd_kcontrol *kcontrol, int event);
325 332
326/* dapm controls */ 333/* dapm controls */
327int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, 334int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
@@ -346,11 +353,12 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
346 struct snd_ctl_elem_value *uncontrol); 353 struct snd_ctl_elem_value *uncontrol);
347int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, 354int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
348 struct snd_ctl_elem_value *uncontrol); 355 struct snd_ctl_elem_value *uncontrol);
349int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
350 const struct snd_soc_dapm_widget *widget);
351int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, 356int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
352 const struct snd_soc_dapm_widget *widget, 357 const struct snd_soc_dapm_widget *widget,
353 int num); 358 int num);
359int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
360 struct snd_soc_dai *dai);
361int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
354 362
355/* dapm path setup */ 363/* dapm path setup */
356int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); 364int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
@@ -361,10 +369,16 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
361 const struct snd_soc_dapm_route *route, int num); 369 const struct snd_soc_dapm_route *route, int num);
362 370
363/* dapm events */ 371/* dapm events */
364int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, 372int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
365 const char *stream, int event); 373 struct snd_soc_dai *dai, int event);
366void snd_soc_dapm_shutdown(struct snd_soc_card *card); 374void snd_soc_dapm_shutdown(struct snd_soc_card *card);
367 375
376/* external DAPM widget events */
377int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
378 struct snd_kcontrol *kcontrol, int connect);
379int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
380 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e);
381
368/* dapm sys fs - used by the core */ 382/* dapm sys fs - used by the core */
369int snd_soc_dapm_sys_add(struct device *dev); 383int snd_soc_dapm_sys_add(struct device *dev);
370void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, 384void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
@@ -411,9 +425,11 @@ enum snd_soc_dapm_type {
411 snd_soc_dapm_pre, /* machine specific pre widget - exec first */ 425 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
412 snd_soc_dapm_post, /* machine specific post widget - exec last */ 426 snd_soc_dapm_post, /* machine specific post widget - exec last */
413 snd_soc_dapm_supply, /* power/clock supply */ 427 snd_soc_dapm_supply, /* power/clock supply */
428 snd_soc_dapm_regulator_supply, /* external regulator */
414 snd_soc_dapm_aif_in, /* audio interface input */ 429 snd_soc_dapm_aif_in, /* audio interface input */
415 snd_soc_dapm_aif_out, /* audio interface output */ 430 snd_soc_dapm_aif_out, /* audio interface output */
416 snd_soc_dapm_siggen, /* signal generator */ 431 snd_soc_dapm_siggen, /* signal generator */
432 snd_soc_dapm_dai, /* link to DAI structure */
417}; 433};
418 434
419/* 435/*
@@ -434,8 +450,8 @@ struct snd_soc_dapm_route {
434 450
435/* dapm audio path between two widgets */ 451/* dapm audio path between two widgets */
436struct snd_soc_dapm_path { 452struct snd_soc_dapm_path {
437 char *name; 453 const char *name;
438 char *long_name; 454 const char *long_name;
439 455
440 /* source (input) and sink (output) widgets */ 456 /* source (input) and sink (output) widgets */
441 struct snd_soc_dapm_widget *source; 457 struct snd_soc_dapm_widget *source;
@@ -458,13 +474,15 @@ struct snd_soc_dapm_path {
458/* dapm widget */ 474/* dapm widget */
459struct snd_soc_dapm_widget { 475struct snd_soc_dapm_widget {
460 enum snd_soc_dapm_type id; 476 enum snd_soc_dapm_type id;
461 char *name; /* widget name */ 477 const char *name; /* widget name */
462 char *sname; /* stream name */ 478 const char *sname; /* stream name */
463 struct snd_soc_codec *codec; 479 struct snd_soc_codec *codec;
464 struct snd_soc_platform *platform; 480 struct snd_soc_platform *platform;
465 struct list_head list; 481 struct list_head list;
466 struct snd_soc_dapm_context *dapm; 482 struct snd_soc_dapm_context *dapm;
467 483
484 void *priv; /* widget specific data */
485
468 /* dapm control */ 486 /* dapm control */
469 short reg; /* negative reg = no direct dapm */ 487 short reg; /* negative reg = no direct dapm */
470 unsigned char shift; /* bits to shift */ 488 unsigned char shift; /* bits to shift */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0992dff55959..2ebf7877c148 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -185,6 +185,20 @@
185 .rreg = xreg_right, .shift = xshift, \ 185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} } 186 .min = xmin, .max = xmax} }
187 187
188#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
191 .put = snd_soc_bytes_put, .private_value = \
192 ((unsigned long)&(struct soc_bytes) \
193 {.base = xbase, .num_regs = xregs }) }
194
195#define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \
196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
197 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
198 .put = snd_soc_bytes_put, .private_value = \
199 ((unsigned long)&(struct soc_bytes) \
200 {.base = xbase, .num_regs = xregs, \
201 .mask = xmask }) }
188 202
189/* 203/*
190 * Simplified versions of above macros, declaring a struct and calculating 204 * Simplified versions of above macros, declaring a struct and calculating
@@ -366,12 +380,16 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
366 *Controls 380 *Controls
367 */ 381 */
368struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 382struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
369 void *data, char *long_name, 383 void *data, const char *long_name,
370 const char *prefix); 384 const char *prefix);
371int snd_soc_add_controls(struct snd_soc_codec *codec, 385int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
372 const struct snd_kcontrol_new *controls, int num_controls); 386 const struct snd_kcontrol_new *controls, int num_controls);
373int snd_soc_add_platform_controls(struct snd_soc_platform *platform, 387int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
374 const struct snd_kcontrol_new *controls, int num_controls); 388 const struct snd_kcontrol_new *controls, int num_controls);
389int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
390 const struct snd_kcontrol_new *controls, int num_controls);
391int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
392 const struct snd_kcontrol_new *controls, int num_controls);
375int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 393int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
376 struct snd_ctl_elem_info *uinfo); 394 struct snd_ctl_elem_info *uinfo);
377int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, 395int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -409,6 +427,13 @@ int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
409 struct snd_ctl_elem_value *ucontrol); 427 struct snd_ctl_elem_value *ucontrol);
410int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, 428int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
411 struct snd_ctl_elem_value *ucontrol); 429 struct snd_ctl_elem_value *ucontrol);
430int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_info *uinfo);
432int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol);
434int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_value *ucontrol);
436
412 437
413/** 438/**
414 * struct snd_soc_reg_access - Describes whether a given register is 439 * struct snd_soc_reg_access - Describes whether a given register is
@@ -505,6 +530,7 @@ struct snd_soc_pcm_stream {
505 unsigned int rate_max; /* max rate */ 530 unsigned int rate_max; /* max rate */
506 unsigned int channels_min; /* min channels */ 531 unsigned int channels_min; /* min channels */
507 unsigned int channels_max; /* max channels */ 532 unsigned int channels_max; /* max channels */
533 unsigned int sig_bits; /* number of bits of content */
508}; 534};
509 535
510/* SoC audio ops */ 536/* SoC audio ops */
@@ -559,6 +585,7 @@ struct snd_soc_codec {
559 unsigned int ac97_created:1; /* Codec has been created by SoC */ 585 unsigned int ac97_created:1; /* Codec has been created by SoC */
560 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 586 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
561 unsigned int cache_init:1; /* codec cache has been initialized */ 587 unsigned int cache_init:1; /* codec cache has been initialized */
588 unsigned int using_regmap:1; /* using regmap access */
562 u32 cache_only; /* Suppress writes to hardware */ 589 u32 cache_only; /* Suppress writes to hardware */
563 u32 cache_sync; /* Cache needs to be synced to hardware */ 590 u32 cache_sync; /* Cache needs to be synced to hardware */
564 591
@@ -637,6 +664,8 @@ struct snd_soc_codec_driver {
637 /* codec stream completion event */ 664 /* codec stream completion event */
638 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 665 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
639 666
667 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
668
640 /* probe ordering - for components with runtime dependencies */ 669 /* probe ordering - for components with runtime dependencies */
641 int probe_order; 670 int probe_order;
642 int remove_order; 671 int remove_order;
@@ -689,6 +718,7 @@ struct snd_soc_platform {
689 int id; 718 int id;
690 struct device *dev; 719 struct device *dev;
691 struct snd_soc_platform_driver *driver; 720 struct snd_soc_platform_driver *driver;
721 struct mutex mutex;
692 722
693 unsigned int suspended:1; /* platform is suspended */ 723 unsigned int suspended:1; /* platform is suspended */
694 unsigned int probed:1; 724 unsigned int probed:1;
@@ -698,6 +728,11 @@ struct snd_soc_platform {
698 struct list_head card_list; 728 struct list_head card_list;
699 729
700 struct snd_soc_dapm_context dapm; 730 struct snd_soc_dapm_context dapm;
731
732#ifdef CONFIG_DEBUG_FS
733 struct dentry *debugfs_platform_root;
734 struct dentry *debugfs_dapm;
735#endif
701}; 736};
702 737
703struct snd_soc_dai_link { 738struct snd_soc_dai_link {
@@ -875,6 +910,12 @@ struct soc_mixer_control {
875 unsigned int reg, rreg, shift, rshift, invert; 910 unsigned int reg, rreg, shift, rshift, invert;
876}; 911};
877 912
913struct soc_bytes {
914 int base;
915 int num_regs;
916 u32 mask;
917};
918
878/* enumerated kcontrol */ 919/* enumerated kcontrol */
879struct soc_enum { 920struct soc_enum {
880 unsigned short reg; 921 unsigned short reg;
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 726e94742a5c..ec3f910aa40b 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -25,6 +25,7 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <media/v4l2-ctrls.h> 26#include <media/v4l2-ctrls.h>
27#include <media/v4l2-dev.h> 27#include <media/v4l2-dev.h>
28#include <media/v4l2-device.h>
28 29
29#define TEA575X_FMIF 10700 30#define TEA575X_FMIF 10700
30 31
@@ -42,13 +43,16 @@ struct snd_tea575x_ops {
42}; 43};
43 44
44struct snd_tea575x { 45struct snd_tea575x {
46 struct v4l2_device *v4l2_dev;
45 struct video_device vd; /* video device */ 47 struct video_device vd; /* video device */
48 int radio_nr; /* radio_nr */
46 bool tea5759; /* 5759 chip is present */ 49 bool tea5759; /* 5759 chip is present */
50 bool cannot_read_data; /* Device cannot read the data pin */
47 bool mute; /* Device is muted? */ 51 bool mute; /* Device is muted? */
48 bool stereo; /* receiving stereo */ 52 bool stereo; /* receiving stereo */
49 bool tuned; /* tuned to a station */ 53 bool tuned; /* tuned to a station */
50 unsigned int val; /* hw value */ 54 unsigned int val; /* hw value */
51 unsigned long freq; /* frequency */ 55 u32 freq; /* frequency */
52 struct mutex mutex; 56 struct mutex mutex;
53 struct snd_tea575x_ops *ops; 57 struct snd_tea575x_ops *ops;
54 void *private_data; 58 void *private_data;
diff --git a/include/sound/version.h b/include/sound/version.h
index 8fc5321e1ecc..cc75024c1089 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.24" 2#define CONFIG_SND_VERSION "1.0.25"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm2200.h b/include/sound/wm2200.h
new file mode 100644
index 000000000000..79bf55be7ffa
--- /dev/null
+++ b/include/sound/wm2200.h
@@ -0,0 +1,41 @@
1/*
2 * linux/sound/wm2200.h -- Platform data for WM2200
3 *
4 * Copyright 2012 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM2200_H
12#define __LINUX_SND_WM2200_H
13
14#define WM2200_GPIO_SET 0x10000
15
16enum wm2200_in_mode {
17 WM2200_IN_SE = 0,
18 WM2200_IN_DIFF = 1,
19 WM2200_IN_DMIC = 2,
20};
21
22enum wm2200_dmic_sup {
23 WM2200_DMIC_SUP_MICVDD = 0,
24 WM2200_DMIC_SUP_MICBIAS1 = 1,
25 WM2200_DMIC_SUP_MICBIAS2 = 2,
26};
27
28struct wm2200_pdata {
29 int reset; /** GPIO controlling /RESET, if any */
30 int ldo_ena; /** GPIO controlling LODENA, if any */
31 int irq_flags;
32
33 int gpio_defaults[4];
34
35 enum wm2200_in_mode in_mode[3];
36 enum wm2200_dmic_sup dmic_sup[3];
37
38 int micbias_cfg[2]; /** Register value to configure MICBIAS */
39};
40
41#endif
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h
index 1750bed7c2f6..79e6d427b858 100644
--- a/include/sound/wm8962.h
+++ b/include/sound/wm8962.h
@@ -49,6 +49,12 @@ struct wm8962_pdata {
49 bool irq_active_low; 49 bool irq_active_low;
50 50
51 bool spk_mono; /* Speaker outputs tied together as mono */ 51 bool spk_mono; /* Speaker outputs tied together as mono */
52
53 /**
54 * This flag should be set if one or both IN4 inputs is wired
55 * in a DC measurement configuration.
56 */
57 bool in4_dc_measure;
52}; 58};
53 59
54#endif 60#endif
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 444cd6ba0ba7..41199664666b 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -366,6 +366,8 @@ struct snd_ymfpci {
366#ifdef CONFIG_PM 366#ifdef CONFIG_PM
367 u32 *saved_regs; 367 u32 *saved_regs;
368 u32 saved_ydsxgr_mode; 368 u32 saved_ydsxgr_mode;
369 u16 saved_dsxg_legacy;
370 u16 saved_dsxg_elegacy;
369#endif 371#endif
370}; 372};
371 373
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index e5e6ff98f0fa..8c9ff1b14396 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -62,4 +62,6 @@ int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
62void *transport_kmap_data_sg(struct se_cmd *); 62void *transport_kmap_data_sg(struct se_cmd *);
63void transport_kunmap_data_sg(struct se_cmd *); 63void transport_kunmap_data_sg(struct se_cmd *);
64 64
65void array_free(void *array, int n);
66
65#endif /* TARGET_CORE_BACKEND_H */ 67#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index dc4e345a0163..aaccc5f5fc9f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -9,7 +9,7 @@
9#include <net/sock.h> 9#include <net/sock.h>
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" 12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc2-ml"
13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION 13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
14 14
15/* Maximum Number of LUNs per Target Portal Group */ 15/* Maximum Number of LUNs per Target Portal Group */
@@ -86,6 +86,8 @@
86#define DA_UNMAP_GRANULARITY_DEFAULT 0 86#define DA_UNMAP_GRANULARITY_DEFAULT 0
87/* Default unmap_granularity_alignment */ 87/* Default unmap_granularity_alignment */
88#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 88#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
89/* Default max transfer length */
90#define DA_FABRIC_MAX_SECTORS 8192
89/* Emulation for Direct Page Out */ 91/* Emulation for Direct Page Out */
90#define DA_EMULATE_DPO 0 92#define DA_EMULATE_DPO 0
91/* Emulation for Forced Unit Access WRITEs */ 93/* Emulation for Forced Unit Access WRITEs */
@@ -118,9 +120,9 @@
118/* Queue Algorithm Modifier default for restricted reordering in control mode page */ 120/* Queue Algorithm Modifier default for restricted reordering in control mode page */
119#define DA_EMULATE_REST_REORD 0 121#define DA_EMULATE_REST_REORD 0
120 122
123#define SE_INQUIRY_BUF 512
121#define SE_MODE_PAGE_BUF 512 124#define SE_MODE_PAGE_BUF 512
122 125
123
124/* struct se_hba->hba_flags */ 126/* struct se_hba->hba_flags */
125enum hba_flags_table { 127enum hba_flags_table {
126 HBA_FLAGS_INTERNAL_USE = 0x01, 128 HBA_FLAGS_INTERNAL_USE = 0x01,
@@ -169,7 +171,8 @@ enum se_cmd_flags_table {
169 SCF_EMULATED_TASK_SENSE = 0x00000004, 171 SCF_EMULATED_TASK_SENSE = 0x00000004,
170 SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, 172 SCF_SCSI_DATA_SG_IO_CDB = 0x00000008,
171 SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, 173 SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010,
172 SCF_SCSI_NON_DATA_CDB = 0x00000040, 174 SCF_SCSI_NON_DATA_CDB = 0x00000020,
175 SCF_SCSI_TMR_CDB = 0x00000040,
173 SCF_SCSI_CDB_EXCEPTION = 0x00000080, 176 SCF_SCSI_CDB_EXCEPTION = 0x00000080,
174 SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, 177 SCF_SCSI_RESERVATION_CONFLICT = 0x00000100,
175 SCF_FUA = 0x00000200, 178 SCF_FUA = 0x00000200,
@@ -183,7 +186,8 @@ enum se_cmd_flags_table {
183 SCF_ALUA_NON_OPTIMIZED = 0x00040000, 186 SCF_ALUA_NON_OPTIMIZED = 0x00040000,
184 SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, 187 SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000,
185 SCF_UNUSED = 0x00100000, 188 SCF_UNUSED = 0x00100000,
186 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, 189 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00200000,
190 SCF_ACK_KREF = 0x00400000,
187}; 191};
188 192
189/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 193/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -474,12 +478,6 @@ struct t10_reservation {
474 struct t10_reservation_ops pr_ops; 478 struct t10_reservation_ops pr_ops;
475}; 479};
476 480
477struct se_queue_req {
478 int state;
479 struct se_cmd *cmd;
480 struct list_head qr_list;
481};
482
483struct se_queue_obj { 481struct se_queue_obj {
484 atomic_t queue_cnt; 482 atomic_t queue_cnt;
485 spinlock_t cmd_queue_lock; 483 spinlock_t cmd_queue_lock;
@@ -504,6 +502,24 @@ struct se_task {
504 struct completion task_stop_comp; 502 struct completion task_stop_comp;
505}; 503};
506 504
505struct se_tmr_req {
506 /* Task Management function to be performed */
507 u8 function;
508 /* Task Management response to send */
509 u8 response;
510 int call_transport;
511 /* Reference to ITT that Task Mgmt should be performed */
512 u32 ref_task_tag;
513 /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */
514 u64 ref_task_lun;
515 void *fabric_tmr_ptr;
516 struct se_cmd *task_cmd;
517 struct se_cmd *ref_cmd;
518 struct se_device *tmr_dev;
519 struct se_lun *tmr_lun;
520 struct list_head tmr_list;
521};
522
507struct se_cmd { 523struct se_cmd {
508 /* SAM response code being sent to initiator */ 524 /* SAM response code being sent to initiator */
509 u8 scsi_status; 525 u8 scsi_status;
@@ -555,23 +571,23 @@ struct se_cmd {
555 unsigned char *t_task_cdb; 571 unsigned char *t_task_cdb;
556 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 572 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
557 unsigned long long t_task_lba; 573 unsigned long long t_task_lba;
558 int t_tasks_failed;
559 u32 t_tasks_sg_chained_no; 574 u32 t_tasks_sg_chained_no;
560 atomic_t t_fe_count; 575 atomic_t t_fe_count;
561 atomic_t t_se_count; 576 atomic_t t_se_count;
562 atomic_t t_task_cdbs_left; 577 atomic_t t_task_cdbs_left;
563 atomic_t t_task_cdbs_ex_left; 578 atomic_t t_task_cdbs_ex_left;
564 atomic_t t_task_cdbs_sent; 579 atomic_t t_task_cdbs_sent;
565 atomic_t t_transport_aborted; 580 unsigned int transport_state;
566 atomic_t t_transport_active; 581#define CMD_T_ABORTED (1 << 0)
567 atomic_t t_transport_complete; 582#define CMD_T_ACTIVE (1 << 1)
568 atomic_t t_transport_queue_active; 583#define CMD_T_COMPLETE (1 << 2)
569 atomic_t t_transport_sent; 584#define CMD_T_QUEUED (1 << 3)
570 atomic_t t_transport_stop; 585#define CMD_T_SENT (1 << 4)
571 atomic_t transport_dev_active; 586#define CMD_T_STOP (1 << 5)
572 atomic_t transport_lun_active; 587#define CMD_T_FAILED (1 << 6)
573 atomic_t transport_lun_fe_stop; 588#define CMD_T_LUN_STOP (1 << 7)
574 atomic_t transport_lun_stop; 589#define CMD_T_LUN_FE_STOP (1 << 8)
590#define CMD_T_DEV_ACTIVE (1 << 9)
575 spinlock_t t_state_lock; 591 spinlock_t t_state_lock;
576 struct completion t_transport_stop_comp; 592 struct completion t_transport_stop_comp;
577 struct completion transport_lun_fe_stop_comp; 593 struct completion transport_lun_fe_stop_comp;
@@ -592,24 +608,6 @@ struct se_cmd {
592 608
593}; 609};
594 610
595struct se_tmr_req {
596 /* Task Management function to be preformed */
597 u8 function;
598 /* Task Management response to send */
599 u8 response;
600 int call_transport;
601 /* Reference to ITT that Task Mgmt should be preformed */
602 u32 ref_task_tag;
603 /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */
604 u64 ref_task_lun;
605 void *fabric_tmr_ptr;
606 struct se_cmd *task_cmd;
607 struct se_cmd *ref_cmd;
608 struct se_device *tmr_dev;
609 struct se_lun *tmr_lun;
610 struct list_head tmr_list;
611};
612
613struct se_ua { 611struct se_ua {
614 u8 ua_asc; 612 u8 ua_asc;
615 u8 ua_ascq; 613 u8 ua_ascq;
@@ -622,6 +620,7 @@ struct se_node_acl {
622 char initiatorname[TRANSPORT_IQN_LEN]; 620 char initiatorname[TRANSPORT_IQN_LEN];
623 /* Used to signal demo mode created ACL, disabled by default */ 621 /* Used to signal demo mode created ACL, disabled by default */
624 bool dynamic_node_acl; 622 bool dynamic_node_acl;
623 bool acl_stop:1;
625 u32 queue_depth; 624 u32 queue_depth;
626 u32 acl_index; 625 u32 acl_index;
627 u64 num_cmds; 626 u64 num_cmds;
@@ -630,7 +629,7 @@ struct se_node_acl {
630 spinlock_t stats_lock; 629 spinlock_t stats_lock;
631 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ 630 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
632 atomic_t acl_pr_ref_count; 631 atomic_t acl_pr_ref_count;
633 struct se_dev_entry *device_list; 632 struct se_dev_entry **device_list;
634 struct se_session *nacl_sess; 633 struct se_session *nacl_sess;
635 struct se_portal_group *se_tpg; 634 struct se_portal_group *se_tpg;
636 spinlock_t device_list_lock; 635 spinlock_t device_list_lock;
@@ -643,6 +642,8 @@ struct se_node_acl {
643 struct config_group *acl_default_groups[5]; 642 struct config_group *acl_default_groups[5];
644 struct list_head acl_list; 643 struct list_head acl_list;
645 struct list_head acl_sess_list; 644 struct list_head acl_sess_list;
645 struct completion acl_free_comp;
646 struct kref acl_kref;
646}; 647};
647 648
648struct se_session { 649struct se_session {
@@ -656,6 +657,7 @@ struct se_session {
656 struct list_head sess_cmd_list; 657 struct list_head sess_cmd_list;
657 struct list_head sess_wait_list; 658 struct list_head sess_wait_list;
658 spinlock_t sess_cmd_lock; 659 spinlock_t sess_cmd_lock;
660 struct kref sess_kref;
659}; 661};
660 662
661struct se_device; 663struct se_device;
@@ -730,6 +732,7 @@ struct se_dev_attrib {
730 u32 block_size; 732 u32 block_size;
731 u32 hw_max_sectors; 733 u32 hw_max_sectors;
732 u32 max_sectors; 734 u32 max_sectors;
735 u32 fabric_max_sectors;
733 u32 optimal_sectors; 736 u32 optimal_sectors;
734 u32 hw_queue_depth; 737 u32 hw_queue_depth;
735 u32 queue_depth; 738 u32 queue_depth;
@@ -931,7 +934,7 @@ struct se_portal_group {
931 struct list_head se_tpg_node; 934 struct list_head se_tpg_node;
932 /* linked list for initiator ACL list */ 935 /* linked list for initiator ACL list */
933 struct list_head acl_node_list; 936 struct list_head acl_node_list;
934 struct se_lun *tpg_lun_list; 937 struct se_lun **tpg_lun_list;
935 struct se_lun tpg_virt_lun0; 938 struct se_lun tpg_virt_lun0;
936 /* List of TCM sessions associated wth this TPG */ 939 /* List of TCM sessions associated wth this TPG */
937 struct list_head tpg_sess_list; 940 struct list_head tpg_sess_list;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index d36fad317e78..10c690809601 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -58,9 +58,6 @@ struct target_core_fabric_ops {
58 */ 58 */
59 int (*shutdown_session)(struct se_session *); 59 int (*shutdown_session)(struct se_session *);
60 void (*close_session)(struct se_session *); 60 void (*close_session)(struct se_session *);
61 void (*stop_session)(struct se_session *, int, int);
62 void (*fall_back_to_erl0)(struct se_session *);
63 int (*sess_logged_in)(struct se_session *);
64 u32 (*sess_get_index)(struct se_session *); 61 u32 (*sess_get_index)(struct se_session *);
65 /* 62 /*
66 * Used only for SCSI fabrics that contain multi-value TransportIDs 63 * Used only for SCSI fabrics that contain multi-value TransportIDs
@@ -78,7 +75,6 @@ struct target_core_fabric_ops {
78 int (*queue_tm_rsp)(struct se_cmd *); 75 int (*queue_tm_rsp)(struct se_cmd *);
79 u16 (*set_fabric_sense_len)(struct se_cmd *, u32); 76 u16 (*set_fabric_sense_len)(struct se_cmd *, u32);
80 u16 (*get_fabric_sense_len)(void); 77 u16 (*get_fabric_sense_len)(void);
81 int (*is_state_remove)(struct se_cmd *);
82 /* 78 /*
83 * fabric module calls for target_core_fabric_configfs.c 79 * fabric module calls for target_core_fabric_configfs.c
84 */ 80 */
@@ -105,7 +101,10 @@ void __transport_register_session(struct se_portal_group *,
105 struct se_node_acl *, struct se_session *, void *); 101 struct se_node_acl *, struct se_session *, void *);
106void transport_register_session(struct se_portal_group *, 102void transport_register_session(struct se_portal_group *,
107 struct se_node_acl *, struct se_session *, void *); 103 struct se_node_acl *, struct se_session *, void *);
104void target_get_session(struct se_session *);
105int target_put_session(struct se_session *);
108void transport_free_session(struct se_session *); 106void transport_free_session(struct se_session *);
107void target_put_nacl(struct se_node_acl *);
109void transport_deregister_session_configfs(struct se_session *); 108void transport_deregister_session_configfs(struct se_session *);
110void transport_deregister_session(struct se_session *); 109void transport_deregister_session(struct se_session *);
111 110
@@ -116,6 +115,10 @@ int transport_lookup_cmd_lun(struct se_cmd *, u32);
116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 115int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
117void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 116void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
118 unsigned char *, u32, u32, int, int, int); 117 unsigned char *, u32, u32, int, int, int);
118int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
119 unsigned char *sense, u32 unpacked_lun,
120 void *fabric_tmr_ptr, unsigned char tm_type,
121 gfp_t, unsigned int, int);
119int transport_handle_cdb_direct(struct se_cmd *); 122int transport_handle_cdb_direct(struct se_cmd *);
120int transport_generic_handle_cdb_map(struct se_cmd *); 123int transport_generic_handle_cdb_map(struct se_cmd *);
121int transport_generic_handle_data(struct se_cmd *); 124int transport_generic_handle_data(struct se_cmd *);
@@ -139,9 +142,10 @@ void target_wait_for_sess_cmds(struct se_session *, int);
139 142
140int core_alua_check_nonop_delay(struct se_cmd *); 143int core_alua_check_nonop_delay(struct se_cmd *);
141 144
142struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); 145int core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
143void core_tmr_release_req(struct se_tmr_req *); 146void core_tmr_release_req(struct se_tmr_req *);
144int transport_generic_handle_tmr(struct se_cmd *); 147int transport_generic_handle_tmr(struct se_cmd *);
148void transport_generic_request_failure(struct se_cmd *);
145int transport_lookup_tmr_lun(struct se_cmd *, u32); 149int transport_lookup_tmr_lun(struct se_cmd *, u32);
146 150
147struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, 151struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 14b38940062b..cae9a94f025d 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -65,7 +65,6 @@ TRACE_EVENT(machine_suspend,
65 TP_printk("state=%lu", (unsigned long)__entry->state) 65 TP_printk("state=%lu", (unsigned long)__entry->state)
66); 66);
67 67
68/* This code will be removed after deprecation time exceeded (2.6.41) */
69#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED 68#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
70 69
71/* 70/*
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 12fbf43524e9..41a7dbd570e2 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -4,10 +4,10 @@
4#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ) 4#if !defined(_TRACE_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_REGMAP_H 5#define _TRACE_REGMAP_H
6 6
7#include <linux/device.h>
8#include <linux/ktime.h> 7#include <linux/ktime.h>
9#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
10 9
10struct device;
11struct regmap; 11struct regmap;
12 12
13/* 13/*
@@ -139,6 +139,42 @@ TRACE_EVENT(regcache_sync,
139 __get_str(type), __get_str(status)) 139 __get_str(type), __get_str(status))
140); 140);
141 141
142DECLARE_EVENT_CLASS(regmap_bool,
143
144 TP_PROTO(struct device *dev, bool flag),
145
146 TP_ARGS(dev, flag),
147
148 TP_STRUCT__entry(
149 __string( name, dev_name(dev) )
150 __field( int, flag )
151 ),
152
153 TP_fast_assign(
154 __assign_str(name, dev_name(dev));
155 __entry->flag = flag;
156 ),
157
158 TP_printk("%s flag=%d", __get_str(name),
159 (int)__entry->flag)
160);
161
162DEFINE_EVENT(regmap_bool, regmap_cache_only,
163
164 TP_PROTO(struct device *dev, bool flag),
165
166 TP_ARGS(dev, flag)
167
168);
169
170DEFINE_EVENT(regmap_bool, regmap_cache_bypass,
171
172 TP_PROTO(struct device *dev, bool flag),
173
174 TP_ARGS(dev, flag)
175
176);
177
142#endif /* _TRACE_REGMAP_H */ 178#endif /* _TRACE_REGMAP_H */
143 179
144/* This part must be outside protection */ 180/* This part must be outside protection */
diff --git a/include/trace/events/rpm.h b/include/trace/events/rpm.h
index d62c558bf64b..33f85b68c22c 100644
--- a/include/trace/events/rpm.h
+++ b/include/trace/events/rpm.h
@@ -7,7 +7,8 @@
7 7
8#include <linux/ktime.h> 8#include <linux/ktime.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/device.h> 10
11struct device;
11 12
12/* 13/*
13 * The rpm_internal events are used for tracing some important 14 * The rpm_internal events are used for tracing some important
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
new file mode 100644
index 000000000000..43be87d5dd58
--- /dev/null
+++ b/include/trace/events/sunrpc.h
@@ -0,0 +1,177 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sunrpc
3
4#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SUNRPC_H
6
7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(rpc_task_status,
12
13 TP_PROTO(struct rpc_task *task),
14
15 TP_ARGS(task),
16
17 TP_STRUCT__entry(
18 __field(const struct rpc_task *, task)
19 __field(const struct rpc_clnt *, clnt)
20 __field(int, status)
21 ),
22
23 TP_fast_assign(
24 __entry->task = task;
25 __entry->clnt = task->tk_client;
26 __entry->status = task->tk_status;
27 ),
28
29 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
30);
31
32DEFINE_EVENT(rpc_task_status, rpc_call_status,
33 TP_PROTO(struct rpc_task *task),
34
35 TP_ARGS(task)
36);
37
38DEFINE_EVENT(rpc_task_status, rpc_bind_status,
39 TP_PROTO(struct rpc_task *task),
40
41 TP_ARGS(task)
42);
43
44TRACE_EVENT(rpc_connect_status,
45 TP_PROTO(struct rpc_task *task, int status),
46
47 TP_ARGS(task, status),
48
49 TP_STRUCT__entry(
50 __field(const struct rpc_task *, task)
51 __field(const struct rpc_clnt *, clnt)
52 __field(int, status)
53 ),
54
55 TP_fast_assign(
56 __entry->task = task;
57 __entry->clnt = task->tk_client;
58 __entry->status = status;
59 ),
60
61 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
62);
63
64DECLARE_EVENT_CLASS(rpc_task_running,
65
66 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
67
68 TP_ARGS(clnt, task, action),
69
70 TP_STRUCT__entry(
71 __field(const struct rpc_clnt *, clnt)
72 __field(const struct rpc_task *, task)
73 __field(const void *, action)
74 __field(unsigned long, runstate)
75 __field(int, status)
76 __field(unsigned short, flags)
77 ),
78
79 TP_fast_assign(
80 __entry->clnt = clnt;
81 __entry->task = task;
82 __entry->action = action;
83 __entry->runstate = task->tk_runstate;
84 __entry->status = task->tk_status;
85 __entry->flags = task->tk_flags;
86 ),
87
88 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf",
89 __entry->task,
90 __entry->clnt,
91 __entry->flags,
92 __entry->runstate,
93 __entry->status,
94 __entry->action
95 )
96);
97
98DEFINE_EVENT(rpc_task_running, rpc_task_begin,
99
100 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
101
102 TP_ARGS(clnt, task, action)
103
104);
105
106DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
107
108 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
109
110 TP_ARGS(clnt, task, action)
111
112);
113
114DEFINE_EVENT(rpc_task_running, rpc_task_complete,
115
116 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
117
118 TP_ARGS(clnt, task, action)
119
120);
121
122DECLARE_EVENT_CLASS(rpc_task_queued,
123
124 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
125
126 TP_ARGS(clnt, task, q),
127
128 TP_STRUCT__entry(
129 __field(const struct rpc_clnt *, clnt)
130 __field(const struct rpc_task *, task)
131 __field(unsigned long, timeout)
132 __field(unsigned long, runstate)
133 __field(int, status)
134 __field(unsigned short, flags)
135 __string(q_name, rpc_qname(q))
136 ),
137
138 TP_fast_assign(
139 __entry->clnt = clnt;
140 __entry->task = task;
141 __entry->timeout = task->tk_timeout;
142 __entry->runstate = task->tk_runstate;
143 __entry->status = task->tk_status;
144 __entry->flags = task->tk_flags;
145 __assign_str(q_name, rpc_qname(q));
146 ),
147
148 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
149 __entry->task,
150 __entry->clnt,
151 __entry->flags,
152 __entry->runstate,
153 __entry->status,
154 __entry->timeout,
155 __get_str(q_name)
156 )
157);
158
159DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
160
161 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
162
163 TP_ARGS(clnt, task, q)
164
165);
166
167DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
168
169 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
170
171 TP_ARGS(clnt, task, q)
172
173);
174
175#endif /* _TRACE_SUNRPC_H */
176
177#include <trace/define_trace.h>
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 5973410e8f8c..7b81887b023f 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -5,7 +5,6 @@
5#define _TRACE_WRITEBACK_H 5#define _TRACE_WRITEBACK_H
6 6
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
8#include <linux/device.h>
9#include <linux/writeback.h> 8#include <linux/writeback.h>
10 9
11#define show_inode_state(state) \ 10#define show_inode_state(state) \
diff --git a/include/video/exynos_dp.h b/include/video/exynos_dp.h
new file mode 100644
index 000000000000..8847a9d6dd42
--- /dev/null
+++ b/include/video/exynos_dp.h
@@ -0,0 +1,131 @@
1/*
2 * Samsung SoC DP device support
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EXYNOS_DP_H
13#define _EXYNOS_DP_H
14
15#define DP_TIMEOUT_LOOP_COUNT 100
16#define MAX_CR_LOOP 5
17#define MAX_EQ_LOOP 4
18
19enum link_rate_type {
20 LINK_RATE_1_62GBPS = 0x06,
21 LINK_RATE_2_70GBPS = 0x0a
22};
23
24enum link_lane_count_type {
25 LANE_COUNT1 = 1,
26 LANE_COUNT2 = 2,
27 LANE_COUNT4 = 4
28};
29
30enum link_training_state {
31 START,
32 CLOCK_RECOVERY,
33 EQUALIZER_TRAINING,
34 FINISHED,
35 FAILED
36};
37
38enum voltage_swing_level {
39 VOLTAGE_LEVEL_0,
40 VOLTAGE_LEVEL_1,
41 VOLTAGE_LEVEL_2,
42 VOLTAGE_LEVEL_3,
43};
44
45enum pre_emphasis_level {
46 PRE_EMPHASIS_LEVEL_0,
47 PRE_EMPHASIS_LEVEL_1,
48 PRE_EMPHASIS_LEVEL_2,
49 PRE_EMPHASIS_LEVEL_3,
50};
51
52enum pattern_set {
53 PRBS7,
54 D10_2,
55 TRAINING_PTN1,
56 TRAINING_PTN2,
57 DP_NONE
58};
59
60enum color_space {
61 COLOR_RGB,
62 COLOR_YCBCR422,
63 COLOR_YCBCR444
64};
65
66enum color_depth {
67 COLOR_6,
68 COLOR_8,
69 COLOR_10,
70 COLOR_12
71};
72
73enum color_coefficient {
74 COLOR_YCBCR601,
75 COLOR_YCBCR709
76};
77
78enum dynamic_range {
79 VESA,
80 CEA
81};
82
83enum pll_status {
84 PLL_UNLOCKED,
85 PLL_LOCKED
86};
87
88enum clock_recovery_m_value_type {
89 CALCULATED_M,
90 REGISTER_M
91};
92
93enum video_timing_recognition_type {
94 VIDEO_TIMING_FROM_CAPTURE,
95 VIDEO_TIMING_FROM_REGISTER
96};
97
98enum analog_power_block {
99 AUX_BLOCK,
100 CH0_BLOCK,
101 CH1_BLOCK,
102 CH2_BLOCK,
103 CH3_BLOCK,
104 ANALOG_TOTAL,
105 POWER_ALL
106};
107
108struct video_info {
109 char *name;
110
111 bool h_sync_polarity;
112 bool v_sync_polarity;
113 bool interlaced;
114
115 enum color_space color_space;
116 enum dynamic_range dynamic_range;
117 enum color_coefficient ycbcr_coeff;
118 enum color_depth color_depth;
119
120 enum link_rate_type link_rate;
121 enum link_lane_count_type lane_count;
122};
123
124struct exynos_dp_platdata {
125 struct video_info *video_info;
126
127 void (*phy_init)(void);
128 void (*phy_exit)(void);
129};
130
131#endif /* _EXYNOS_DP_H */
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
new file mode 100644
index 000000000000..772c770535f1
--- /dev/null
+++ b/include/video/exynos_mipi_dsim.h
@@ -0,0 +1,359 @@
1/* include/video/exynos_mipi_dsim.h
2 *
3 * Platform data header for Samsung SoC MIPI-DSIM.
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd
6 *
7 * InKi Dae <inki.dae@samsung.com>
8 * Donghwa Lee <dh09.lee@samsung.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef _EXYNOS_MIPI_DSIM_H
16#define _EXYNOS_MIPI_DSIM_H
17
18#include <linux/device.h>
19#include <linux/fb.h>
20
21#define PANEL_NAME_SIZE (32)
22
23/*
24 * Enumerate display interface type.
25 *
26 * DSIM_COMMAND means cpu interface and rgb interface for DSIM_VIDEO.
27 *
28 * P.S. MIPI DSI Master has two display controller intefaces, RGB Interface
29 * for main display and CPU Interface(same as I80 Interface) for main
30 * and sub display.
31 */
32enum mipi_dsim_interface_type {
33 DSIM_COMMAND,
34 DSIM_VIDEO
35};
36
37enum mipi_dsim_virtual_ch_no {
38 DSIM_VIRTUAL_CH_0,
39 DSIM_VIRTUAL_CH_1,
40 DSIM_VIRTUAL_CH_2,
41 DSIM_VIRTUAL_CH_3
42};
43
44enum mipi_dsim_burst_mode_type {
45 DSIM_NON_BURST_SYNC_EVENT,
46 DSIM_BURST_SYNC_EVENT,
47 DSIM_NON_BURST_SYNC_PULSE,
48 DSIM_BURST,
49 DSIM_NON_VIDEO_MODE
50};
51
52enum mipi_dsim_no_of_data_lane {
53 DSIM_DATA_LANE_1,
54 DSIM_DATA_LANE_2,
55 DSIM_DATA_LANE_3,
56 DSIM_DATA_LANE_4
57};
58
59enum mipi_dsim_byte_clk_src {
60 DSIM_PLL_OUT_DIV8,
61 DSIM_EXT_CLK_DIV8,
62 DSIM_EXT_CLK_BYPASS
63};
64
65enum mipi_dsim_pixel_format {
66 DSIM_CMD_3BPP,
67 DSIM_CMD_8BPP,
68 DSIM_CMD_12BPP,
69 DSIM_CMD_16BPP,
70 DSIM_VID_16BPP_565,
71 DSIM_VID_18BPP_666PACKED,
72 DSIM_18BPP_666LOOSELYPACKED,
73 DSIM_24BPP_888
74};
75
76/*
77 * struct mipi_dsim_config - interface for configuring mipi-dsi controller.
78 *
79 * @auto_flush: enable or disable Auto flush of MD FIFO using VSYNC pulse.
80 * @eot_disable: enable or disable EoT packet in HS mode.
81 * @auto_vertical_cnt: specifies auto vertical count mode.
82 * in Video mode, the vertical line transition uses line counter
83 * configured by VSA, VBP, and Vertical resolution.
84 * If this bit is set to '1', the line counter does not use VSA and VBP
85 * registers.(in command mode, this variable is ignored)
86 * @hse: set horizontal sync event mode.
87 * In VSYNC pulse and Vporch area, MIPI DSI master transfers only HSYNC
88 * start packet to MIPI DSI slave at MIPI DSI spec1.1r02.
89 * this bit transfers HSYNC end packet in VSYNC pulse and Vporch area
90 * (in mommand mode, this variable is ignored)
91 * @hfp: specifies HFP disable mode.
92 * if this variable is set, DSI master ignores HFP area in VIDEO mode.
93 * (in command mode, this variable is ignored)
94 * @hbp: specifies HBP disable mode.
95 * if this variable is set, DSI master ignores HBP area in VIDEO mode.
96 * (in command mode, this variable is ignored)
97 * @hsa: specifies HSA disable mode.
98 * if this variable is set, DSI master ignores HSA area in VIDEO mode.
99 * (in command mode, this variable is ignored)
100 * @cma_allow: specifies the number of horizontal lines, where command packet
101 * transmission is allowed after Stable VFP period.
102 * @e_interface: specifies interface to be used.(CPU or RGB interface)
103 * @e_virtual_ch: specifies virtual channel number that main or
104 * sub diaplsy uses.
105 * @e_pixel_format: specifies pixel stream format for main or sub display.
106 * @e_burst_mode: selects Burst mode in Video mode.
107 * in Non-burst mode, RGB data area is filled with RGB data and NULL
108 * packets, according to input bandwidth of RGB interface.
109 * In Burst mode, RGB data area is filled with RGB data only.
110 * @e_no_data_lane: specifies data lane count to be used by Master.
111 * @e_byte_clk: select byte clock source. (it must be DSIM_PLL_OUT_DIV8)
112 * DSIM_EXT_CLK_DIV8 and DSIM_EXT_CLK_BYPASSS are not supported.
113 * @pll_stable_time: specifies the PLL Timer for stability of the ganerated
114 * clock(System clock cycle base)
115 * if the timer value goes to 0x00000000, the clock stable bit of status
116 * and interrupt register is set.
117 * @esc_clk: specifies escape clock frequency for getting the escape clock
118 * prescaler value.
119 * @stop_holding_cnt: specifies the interval value between transmitting
120 * read packet(or write "set_tear_on" command) and BTA request.
121 * after transmitting read packet or write "set_tear_on" command,
122 * BTA requests to D-PHY automatically. this counter value specifies
123 * the interval between them.
124 * @bta_timeout: specifies the timer for BTA.
125 * this register specifies time out from BTA request to change
126 * the direction with respect to Tx escape clock.
127 * @rx_timeout: specifies the timer for LP Rx mode timeout.
128 * this register specifies time out on how long RxValid deasserts,
129 * after RxLpdt asserts with respect to Tx escape clock.
130 * - RxValid specifies Rx data valid indicator.
131 * - RxLpdt specifies an indicator that D-PHY is under RxLpdt mode.
132 * - RxValid and RxLpdt specifies signal from D-PHY.
133 */
134struct mipi_dsim_config {
135 unsigned char auto_flush;
136 unsigned char eot_disable;
137
138 unsigned char auto_vertical_cnt;
139 unsigned char hse;
140 unsigned char hfp;
141 unsigned char hbp;
142 unsigned char hsa;
143 unsigned char cmd_allow;
144
145 enum mipi_dsim_interface_type e_interface;
146 enum mipi_dsim_virtual_ch_no e_virtual_ch;
147 enum mipi_dsim_pixel_format e_pixel_format;
148 enum mipi_dsim_burst_mode_type e_burst_mode;
149 enum mipi_dsim_no_of_data_lane e_no_data_lane;
150 enum mipi_dsim_byte_clk_src e_byte_clk;
151
152 /*
153 * ===========================================
154 * | P | M | S | MHz |
155 * -------------------------------------------
156 * | 3 | 100 | 3 | 100 |
157 * | 3 | 100 | 2 | 200 |
158 * | 3 | 63 | 1 | 252 |
159 * | 4 | 100 | 1 | 300 |
160 * | 4 | 110 | 1 | 330 |
161 * | 12 | 350 | 1 | 350 |
162 * | 3 | 100 | 1 | 400 |
163 * | 4 | 150 | 1 | 450 |
164 * | 6 | 118 | 1 | 472 |
165 * | 3 | 120 | 1 | 480 |
166 * | 12 | 250 | 0 | 500 |
167 * | 4 | 100 | 0 | 600 |
168 * | 3 | 81 | 0 | 648 |
169 * | 3 | 88 | 0 | 704 |
170 * | 3 | 90 | 0 | 720 |
171 * | 3 | 100 | 0 | 800 |
172 * | 12 | 425 | 0 | 850 |
173 * | 4 | 150 | 0 | 900 |
174 * | 12 | 475 | 0 | 950 |
175 * | 6 | 250 | 0 | 1000 |
176 * -------------------------------------------
177 */
178
179 /*
180 * pms could be calculated as the following.
181 * M * 24 / P * 2 ^ S = MHz
182 */
183 unsigned char p;
184 unsigned short m;
185 unsigned char s;
186
187 unsigned int pll_stable_time;
188 unsigned long esc_clk;
189
190 unsigned short stop_holding_cnt;
191 unsigned char bta_timeout;
192 unsigned short rx_timeout;
193};
194
195/*
196 * struct mipi_dsim_device - global interface for mipi-dsi driver.
197 *
198 * @dev: driver model representation of the device.
199 * @id: unique device id.
200 * @clock: pointer to MIPI-DSI clock of clock framework.
201 * @irq: interrupt number to MIPI-DSI controller.
202 * @reg_base: base address to memory mapped SRF of MIPI-DSI controller.
203 * (virtual address)
204 * @lock: the mutex protecting this data structure.
205 * @dsim_info: infomation for configuring mipi-dsi controller.
206 * @master_ops: callbacks to mipi-dsi operations.
207 * @dsim_lcd_dev: pointer to activated ddi device.
208 * (it would be registered by mipi-dsi driver.)
209 * @dsim_lcd_drv: pointer to activated_ddi driver.
210 * (it would be registered by mipi-dsi driver.)
211 * @lcd_info: pointer to mipi_lcd_info structure.
212 * @state: specifies status of MIPI-DSI controller.
213 * the status could be RESET, INIT, STOP, HSCLKEN and ULPS.
214 * @data_lane: specifiec enabled data lane number.
215 * this variable would be set by driver according to e_no_data_lane
216 * automatically.
217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data.
219 */
220struct mipi_dsim_device {
221 struct device *dev;
222 int id;
223 struct resource *res;
224 struct clk *clock;
225 unsigned int irq;
226 void __iomem *reg_base;
227 struct mutex lock;
228
229 struct mipi_dsim_config *dsim_config;
230 struct mipi_dsim_master_ops *master_ops;
231 struct mipi_dsim_lcd_device *dsim_lcd_dev;
232 struct mipi_dsim_lcd_driver *dsim_lcd_drv;
233
234 unsigned int state;
235 unsigned int data_lane;
236 unsigned int e_clk_src;
237 bool suspended;
238
239 struct mipi_dsim_platform_data *pd;
240};
241
242/*
243 * struct mipi_dsim_platform_data - interface to platform data
244 * for mipi-dsi driver.
245 *
246 * @lcd_panel_name: specifies lcd panel name registered to mipi-dsi driver.
247 * lcd panel driver searched would be actived.
248 * @dsim_config: pointer of structure for configuring mipi-dsi controller.
249 * @enabled: indicate whether mipi controller got enabled or not.
250 * @lcd_panel_info: pointer for lcd panel specific structure.
251 * this structure specifies width, height, timing and polarity and so on.
252 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
253 */
254struct mipi_dsim_platform_data {
255 char lcd_panel_name[PANEL_NAME_SIZE];
256
257 struct mipi_dsim_config *dsim_config;
258 unsigned int enabled;
259 void *lcd_panel_info;
260
261 int (*phy_enable)(struct platform_device *pdev, bool on);
262};
263
264/*
265 * struct mipi_dsim_master_ops - callbacks to mipi-dsi operations.
266 *
267 * @cmd_write: transfer command to lcd panel at LP mode.
268 * @cmd_read: read command from rx register.
269 * @get_dsim_frame_done: get the status that all screen data have been
270 * transferred to mipi-dsi.
271 * @clear_dsim_frame_done: clear frame done status.
272 * @get_fb_frame_done: get frame done status of display controller.
273 * @trigger: trigger display controller.
274 * - this one would be used only in case of CPU mode.
275 * @set_early_blank_mode: set framebuffer blank mode.
276 * - this callback should be called prior to fb_blank() by a client driver
277 * only if needing.
278 * @set_blank_mode: set framebuffer blank mode.
279 * - this callback should be called after fb_blank() by a client driver
280 * only if needing.
281 */
282
283struct mipi_dsim_master_ops {
284 int (*cmd_write)(struct mipi_dsim_device *dsim, unsigned int data_id,
285 const unsigned char *data0, unsigned int data1);
286 int (*cmd_read)(struct mipi_dsim_device *dsim, unsigned int data_id,
287 unsigned int data0, unsigned int req_size, u8 *rx_buf);
288 int (*get_dsim_frame_done)(struct mipi_dsim_device *dsim);
289 int (*clear_dsim_frame_done)(struct mipi_dsim_device *dsim);
290
291 int (*get_fb_frame_done)(struct fb_info *info);
292 void (*trigger)(struct fb_info *info);
293 int (*set_early_blank_mode)(struct mipi_dsim_device *dsim, int power);
294 int (*set_blank_mode)(struct mipi_dsim_device *dsim, int power);
295};
296
297/*
298 * device structure for mipi-dsi based lcd panel.
299 *
300 * @name: name of the device to use with this device, or an
301 * alias for that name.
302 * @dev: driver model representation of the device.
303 * @id: id of device to be registered.
304 * @bus_id: bus id for identifing connected bus
305 * and this bus id should be same as id of mipi_dsim_device.
306 * @irq: irq number for signaling when framebuffer transfer of
307 * lcd panel module is completed.
308 * this irq would be used only for MIPI-DSI based CPU mode lcd panel.
309 * @master: pointer to mipi-dsi master device object.
310 * @platform_data: lcd panel specific platform data.
311 */
312struct mipi_dsim_lcd_device {
313 char *name;
314 struct device dev;
315 int id;
316 int bus_id;
317 int irq;
318
319 struct mipi_dsim_device *master;
320 void *platform_data;
321};
322
323/*
324 * driver structure for mipi-dsi based lcd panel.
325 *
326 * this structure should be registered by lcd panel driver.
327 * mipi-dsi driver seeks lcd panel registered through name field
328 * and calls these callback functions in appropriate time.
329 *
330 * @name: name of the driver to use with this device, or an
331 * alias for that name.
332 * @id: id of driver to be registered.
333 * this id would be used for finding device object registered.
334 */
335struct mipi_dsim_lcd_driver {
336 char *name;
337 int id;
338
339 void (*power_on)(struct mipi_dsim_lcd_device *dsim_dev, int enable);
340 void (*set_sequence)(struct mipi_dsim_lcd_device *dsim_dev);
341 int (*probe)(struct mipi_dsim_lcd_device *dsim_dev);
342 int (*remove)(struct mipi_dsim_lcd_device *dsim_dev);
343 void (*shutdown)(struct mipi_dsim_lcd_device *dsim_dev);
344 int (*suspend)(struct mipi_dsim_lcd_device *dsim_dev);
345 int (*resume)(struct mipi_dsim_lcd_device *dsim_dev);
346};
347
348/*
349 * register mipi_dsim_lcd_device to mipi-dsi master.
350 */
351int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device
352 *lcd_dev);
353/**
354 * register mipi_dsim_lcd_driver object defined by lcd panel driver
355 * to mipi-dsi driver.
356 */
357int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver
358 *lcd_drv);
359#endif /* _EXYNOS_MIPI_DSIM_H */
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 434d56b4a1a5..06c67fbc4eee 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info {
51 int lane; 51 int lane;
52 unsigned long flags; 52 unsigned long flags;
53 u32 clksrc; 53 u32 clksrc;
54 u32 phyctrl; /* for extra setting */
54 unsigned int vsynw_offset; 55 unsigned int vsynw_offset;
55 int (*set_dot_clock)(struct platform_device *pdev, 56 int (*set_dot_clock)(struct platform_device *pdev,
56 void __iomem *base, 57 void __iomem *base,
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
index b56932927d0a..728f9de9c258 100644
--- a/include/video/sh_mobile_hdmi.h
+++ b/include/video/sh_mobile_hdmi.h
@@ -31,8 +31,6 @@ struct clk;
31#define HDMI_SND_SRC_HBR (3 << 0) 31#define HDMI_SND_SRC_HBR (3 << 0)
32 32
33struct sh_mobile_hdmi_info { 33struct sh_mobile_hdmi_info {
34 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
35 struct device *lcd_dev;
36 unsigned int flags; 34 unsigned int flags;
37 long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, 35 long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
38 unsigned long *parent_freq); 36 unsigned long *parent_freq);
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index fe30b759c51e..7571b27a0ba1 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -147,29 +147,23 @@ struct sh_mobile_lcdc_sys_bus_ops {
147 unsigned long (*read_data)(void *handle); 147 unsigned long (*read_data)(void *handle);
148}; 148};
149 149
150struct module; 150struct sh_mobile_lcdc_panel_cfg {
151struct sh_mobile_lcdc_board_cfg { 151 unsigned long width; /* Panel width in mm */
152 struct module *owner; 152 unsigned long height; /* Panel height in mm */
153 void *board_data; 153 int (*setup_sys)(void *sys_ops_handle,
154 int (*setup_sys)(void *board_data, void *sys_ops_handle,
155 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 154 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
156 void (*start_transfer)(void *board_data, void *sys_ops_handle, 155 void (*start_transfer)(void *sys_ops_handle,
157 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 156 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
158 void (*display_on)(void *board_data, struct fb_info *info); 157 void (*display_on)(void);
159 void (*display_off)(void *board_data); 158 void (*display_off)(void);
160 int (*set_brightness)(void *board_data, int brightness);
161 int (*get_brightness)(void *board_data);
162};
163
164struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
165 unsigned long width;
166 unsigned long height;
167}; 159};
168 160
169/* backlight info */ 161/* backlight info */
170struct sh_mobile_lcdc_bl_info { 162struct sh_mobile_lcdc_bl_info {
171 const char *name; 163 const char *name;
172 int max_brightness; 164 int max_brightness;
165 int (*set_brightness)(int brightness);
166 int (*get_brightness)(void);
173}; 167};
174 168
175struct sh_mobile_lcdc_chan_cfg { 169struct sh_mobile_lcdc_chan_cfg {
@@ -179,13 +173,14 @@ struct sh_mobile_lcdc_chan_cfg {
179 int interface_type; /* selects RGBn or SYSn I/F, see above */ 173 int interface_type; /* selects RGBn or SYSn I/F, see above */
180 int clock_divider; 174 int clock_divider;
181 unsigned long flags; /* LCDC_FLAGS_... */ 175 unsigned long flags; /* LCDC_FLAGS_... */
182 const struct fb_videomode *lcd_cfg; 176 const struct fb_videomode *lcd_modes;
183 int num_cfg; 177 int num_modes;
184 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; 178 struct sh_mobile_lcdc_panel_cfg panel_cfg;
185 struct sh_mobile_lcdc_board_cfg board_cfg;
186 struct sh_mobile_lcdc_bl_info bl_info; 179 struct sh_mobile_lcdc_bl_info bl_info;
187 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 180 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
188 struct sh_mobile_meram_cfg *meram_cfg; 181 const struct sh_mobile_meram_cfg *meram_cfg;
182
183 struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
189}; 184};
190 185
191struct sh_mobile_lcdc_info { 186struct sh_mobile_lcdc_info {
diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
index af602d602b28..29b2fd3b147e 100644
--- a/include/video/sh_mobile_meram.h
+++ b/include/video/sh_mobile_meram.h
@@ -17,52 +17,47 @@ enum {
17struct sh_mobile_meram_priv; 17struct sh_mobile_meram_priv;
18struct sh_mobile_meram_ops; 18struct sh_mobile_meram_ops;
19 19
20/*
21 * struct sh_mobile_meram_info - MERAM platform data
22 * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
23 */
20struct sh_mobile_meram_info { 24struct sh_mobile_meram_info {
21 int addr_mode; 25 int addr_mode;
26 u32 reserved_icbs;
22 struct sh_mobile_meram_ops *ops; 27 struct sh_mobile_meram_ops *ops;
23 struct sh_mobile_meram_priv *priv; 28 struct sh_mobile_meram_priv *priv;
24 struct platform_device *pdev; 29 struct platform_device *pdev;
25}; 30};
26 31
27/* icb config */ 32/* icb config */
28struct sh_mobile_meram_icb { 33struct sh_mobile_meram_icb_cfg {
29 int marker_icb; /* ICB # for Marker ICB */ 34 unsigned int meram_size; /* MERAM Buffer Size to use */
30 int cache_icb; /* ICB # for Cache ICB */
31 int meram_offset; /* MERAM Buffer Offset to use */
32 int meram_size; /* MERAM Buffer Size to use */
33
34 int cache_unit; /* bytes to cache per ICB */
35}; 35};
36 36
37struct sh_mobile_meram_cfg { 37struct sh_mobile_meram_cfg {
38 struct sh_mobile_meram_icb icb[2]; 38 struct sh_mobile_meram_icb_cfg icb[2];
39 int pixelformat;
40 int current_reg;
41}; 39};
42 40
43struct module; 41struct module;
44struct sh_mobile_meram_ops { 42struct sh_mobile_meram_ops {
45 struct module *module; 43 struct module *module;
46 /* register usage of meram */ 44 /* register usage of meram */
47 int (*meram_register)(struct sh_mobile_meram_info *meram_dev, 45 void *(*meram_register)(struct sh_mobile_meram_info *meram_dev,
48 struct sh_mobile_meram_cfg *cfg, 46 const struct sh_mobile_meram_cfg *cfg,
49 int xres, int yres, int pixelformat, 47 unsigned int xres, unsigned int yres,
50 unsigned long base_addr_y, 48 unsigned int pixelformat,
51 unsigned long base_addr_c, 49 unsigned int *pitch);
52 unsigned long *icb_addr_y,
53 unsigned long *icb_addr_c, int *pitch);
54 50
55 /* unregister usage of meram */ 51 /* unregister usage of meram */
56 int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, 52 void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
57 struct sh_mobile_meram_cfg *cfg); 53 void *data);
58 54
59 /* update meram settings */ 55 /* update meram settings */
60 int (*meram_update)(struct sh_mobile_meram_info *meram_dev, 56 void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
61 struct sh_mobile_meram_cfg *cfg, 57 unsigned long base_addr_y,
62 unsigned long base_addr_y, 58 unsigned long base_addr_c,
63 unsigned long base_addr_c, 59 unsigned long *icb_addr_y,
64 unsigned long *icb_addr_y, 60 unsigned long *icb_addr_c);
65 unsigned long *icb_addr_c);
66}; 61};
67 62
68#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ 63#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
diff --git a/include/video/udlfb.h b/include/video/udlfb.h
index c41f308c9636..f9466fa54ba4 100644
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -41,6 +41,7 @@ struct dlfb_data {
41 char *backing_buffer; 41 char *backing_buffer;
42 int fb_count; 42 int fb_count;
43 bool virtualized; /* true when physical usb device not present */ 43 bool virtualized; /* true when physical usb device not present */
44 struct delayed_work init_framebuffer_work;
44 struct delayed_work free_framebuffer_work; 45 struct delayed_work free_framebuffer_work;
45 atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ 46 atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
46 atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ 47 atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
index 1888d8c157e6..1b4f923d7086 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -90,6 +90,10 @@
90/* Boolean: Enable aligning all periodic vpts to reduce interrupts */ 90/* Boolean: Enable aligning all periodic vpts to reduce interrupts */
91#define HVM_PARAM_VPT_ALIGN 16 91#define HVM_PARAM_VPT_ALIGN 16
92 92
93#define HVM_NR_PARAMS 17 93/* Console debug shared memory ring and event channel */
94#define HVM_PARAM_CONSOLE_PFN 17
95#define HVM_PARAM_CONSOLE_EVTCHN 18
96
97#define HVM_NR_PARAMS 19
94 98
95#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ 99#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index c1080d9c705d..9ce788d8cf49 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -39,6 +39,27 @@ struct physdev_eoi {
39}; 39};
40 40
41/* 41/*
42 * Register a shared page for the hypervisor to indicate whether the guest
43 * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly
44 * once the guest used this function in that the associated event channel
45 * will automatically get unmasked. The page registered is used as a bit
46 * array indexed by Xen's PIRQ value.
47 */
48#define PHYSDEVOP_pirq_eoi_gmfn_v1 17
49/*
50 * Register a shared page for the hypervisor to indicate whether the
51 * guest must issue PHYSDEVOP_eoi. This hypercall is very similar to
52 * PHYSDEVOP_pirq_eoi_gmfn_v1 but it doesn't change the semantics of
53 * PHYSDEVOP_eoi. The page registered is used as a bit array indexed by
54 * Xen's PIRQ value.
55 */
56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
57struct physdev_pirq_eoi_gmfn {
58 /* IN */
59 unsigned long gmfn;
60};
61
62/*
42 * Query the status of an IRQ line. 63 * Query the status of an IRQ line.
43 * @arg == pointer to physdev_irq_status_query structure. 64 * @arg == pointer to physdev_irq_status_query structure.
44 */ 65 */
@@ -145,6 +166,13 @@ struct physdev_manage_pci {
145 uint8_t devfn; 166 uint8_t devfn;
146}; 167};
147 168
169#define PHYSDEVOP_restore_msi 19
170struct physdev_restore_msi {
171 /* IN */
172 uint8_t bus;
173 uint8_t devfn;
174};
175
148#define PHYSDEVOP_manage_pci_add_ext 20 176#define PHYSDEVOP_manage_pci_add_ext 20
149struct physdev_manage_pci_ext { 177struct physdev_manage_pci_ext {
150 /* IN */ 178 /* IN */
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c1684680431b..486653f0dd8f 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -200,7 +200,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_getidletime_t);
200#define XEN_PM_CX 0 200#define XEN_PM_CX 0
201#define XEN_PM_PX 1 201#define XEN_PM_PX 1
202#define XEN_PM_TX 2 202#define XEN_PM_TX 2
203 203#define XEN_PM_PDC 3
204/* Px sub info type */ 204/* Px sub info type */
205#define XEN_PX_PCT 1 205#define XEN_PX_PCT 1
206#define XEN_PX_PSS 2 206#define XEN_PX_PSS 2
@@ -293,10 +293,27 @@ struct xenpf_set_processor_pminfo {
293 union { 293 union {
294 struct xen_processor_power power;/* Cx: _CST/_CSD */ 294 struct xen_processor_power power;/* Cx: _CST/_CSD */
295 struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ 295 struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */
296 GUEST_HANDLE(uint32_t) pdc;
296 }; 297 };
297}; 298};
298DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo); 299DEFINE_GUEST_HANDLE_STRUCT(xenpf_set_processor_pminfo);
299 300
301#define XENPF_get_cpuinfo 55
302struct xenpf_pcpuinfo {
303 /* IN */
304 uint32_t xen_cpuid;
305 /* OUT */
306 /* The maxium cpu_id that is present */
307 uint32_t max_present;
308#define XEN_PCPU_FLAGS_ONLINE 1
309 /* Correponding xen_cpuid is not present*/
310#define XEN_PCPU_FLAGS_INVALID 2
311 uint32_t flags;
312 uint32_t apic_id;
313 uint32_t acpi_id;
314};
315DEFINE_GUEST_HANDLE_STRUCT(xenpf_pcpuinfo);
316
300struct xen_platform_op { 317struct xen_platform_op {
301 uint32_t cmd; 318 uint32_t cmd;
302 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ 319 uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -312,6 +329,7 @@ struct xen_platform_op {
312 struct xenpf_change_freq change_freq; 329 struct xenpf_change_freq change_freq;
313 struct xenpf_getidletime getidletime; 330 struct xenpf_getidletime getidletime;
314 struct xenpf_set_processor_pminfo set_pminfo; 331 struct xenpf_set_processor_pminfo set_pminfo;
332 struct xenpf_pcpuinfo pcpu_info;
315 uint8_t pad[128]; 333 uint8_t pad[128];
316 } u; 334 } u;
317}; 335};
diff --git a/include/xen/tmem.h b/include/xen/tmem.h
index 82e2c83a32f5..591550a22ac7 100644
--- a/include/xen/tmem.h
+++ b/include/xen/tmem.h
@@ -1,5 +1,9 @@
1#ifndef _XEN_TMEM_H 1#ifndef _XEN_TMEM_H
2#define _XEN_TMEM_H 2#define _XEN_TMEM_H
3
4#include <linux/types.h>
5
3/* defined in drivers/xen/tmem.c */ 6/* defined in drivers/xen/tmem.c */
4extern int tmem_enabled; 7extern bool tmem_enabled;
8
5#endif /* _XEN_TMEM_H */ 9#endif /* _XEN_TMEM_H */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index e8c599b237c2..0a7515c1e3a4 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -139,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t);
139int xenbus_transaction_end(struct xenbus_transaction t, int abort); 139int xenbus_transaction_end(struct xenbus_transaction t, int abort);
140 140
141/* Single read and scanf: returns -errno or num scanned if > 0. */ 141/* Single read and scanf: returns -errno or num scanned if > 0. */
142__scanf(4, 5)
142int xenbus_scanf(struct xenbus_transaction t, 143int xenbus_scanf(struct xenbus_transaction t,
143 const char *dir, const char *node, const char *fmt, ...) 144 const char *dir, const char *node, const char *fmt, ...);
144 __attribute__((format(scanf, 4, 5)));
145 145
146/* Single printf and write: returns -errno or 0. */ 146/* Single printf and write: returns -errno or 0. */
147__printf(4, 5) 147__printf(4, 5)